Skip to content

Defined in: packages/synapse-sdk/src/pdp/server.ts:75

new PDPServer(options): PDPServer

Defined in: packages/synapse-sdk/src/pdp/server.ts:91

Create a new PDPServer instance

ParameterTypeDescription
optionsOptionsTypePDPServer.OptionsType

PDPServer

addPieces(dataSetId, clientDataSetId, pieces): Promise<AddPiecesResponse>

Defined in: packages/synapse-sdk/src/pdp/server.ts:163

Add pieces to an existing data set

ParameterTypeDescription
dataSetIdbigintThe ID of the data set to add pieces to
clientDataSetIdbigintThe client’s dataset ID used when creating the data set
piecesPieceInputWithMetadata[]Array of piece data containing PieceCID CIDs and raw sizes

Promise<AddPiecesResponse>

Promise that resolves when the pieces are added (201 Created)

Error if any CID is invalid


createAndAddPieces(clientDataSetId, payee, payer, recordKeeper, pieces, metadata): Promise<CreateDataSetResponse>

Defined in: packages/synapse-sdk/src/pdp/server.ts:135

Creates a data set and adds pieces to it in a combined operation. Users can poll the status of the operation using the returned data set status URL. After which the user can use the returned transaction hash and data set ID to check the status of the piece addition.

ParameterTypeDescription
clientDataSetIdbigintUnique ID for the client’s dataset
payee`0x${string}`Address that will receive payments (service provider)
payer`0x${string}`Address that will pay for the storage (client)
recordKeeper`0x${string}`Address of the Warm Storage contract
piecesPieceInputWithMetadata[]Array of pieces to add to the data set. PieceInputWithMetadata
metadataMetadataObjectOptional metadata for dataset and each of the pieces.

Promise<CreateDataSetResponse>

Promise that resolves with transaction hash and status URL


createDataSet(clientDataSetId, payee, payer, metadata, recordKeeper): Promise<CreateDataSetResponse>

Defined in: packages/synapse-sdk/src/pdp/server.ts:105

Create a new data set on the PDP server

ParameterTypeDescription
clientDataSetIdbigintUnique ID for the client’s dataset
payee`0x${string}`Address that will receive payments (service provider)
payer`0x${string}`Address that will pay for the storage (client)
metadataMetadataObjectMetadata entries for the data set (key-value pairs)
recordKeeper`0x${string}`Address of the Warm Storage contract

Promise<CreateDataSetResponse>

Promise that resolves with transaction hash and status URL


getDataSet(dataSetId): Promise<DataSetData>

Defined in: packages/synapse-sdk/src/pdp/server.ts:233

Get data set details from the PDP server

ParameterTypeDescription
dataSetIdbigintThe ID of the data set to fetch

Promise<DataSetData>

Promise that resolves with data set data


uploadPiece(data, options?): Promise<UploadPieceResponse>

Defined in: packages/synapse-sdk/src/pdp/server.ts:192

Upload a piece to the PDP server using the commp-last protocol.

Accepts data as Uint8Array, AsyncIterable, or ReadableStream. For optimal performance with non-trivial sizes, prefer streaming types (AsyncIterable or ReadableStream) to avoid memory pressure and blocking behavior. See SIZE_CONSTANTS.MAX_UPLOAD_SIZE documentation for detailed guidance.

ParameterTypeDescription
dataUint8Array<ArrayBufferLike> | AsyncIterable<Uint8Array<ArrayBufferLike>, any, any> | ReadableStream<Uint8Array<ArrayBufferLike>>The data to upload (Uint8Array, AsyncIterable, or ReadableStream)
options?UploadPieceOptionsOptional upload options UploadPieceOptions

Promise<UploadPieceResponse>