PDPServer
Defined in: packages/synapse-sdk/src/pdp/server.ts:164
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PDPServer(options): PDPServer;Defined in: packages/synapse-sdk/src/pdp/server.ts:181
Create a new PDPServer instance
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | OptionsType | PDPServer.OptionsType |
Returns
Section titled “Returns”PDPServer
Methods
Section titled “Methods”addPieces()
Section titled “addPieces()”addPieces( dataSetId, clientDataSetId,pieces): Promise<AddPiecesResponse>;Defined in: packages/synapse-sdk/src/pdp/server.ts:253
Add pieces to an existing data set
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dataSetId | number | The ID of the data set to add pieces to |
clientDataSetId | bigint | The client’s dataset ID used when creating the data set |
pieces | PieceInputWithMetadata[] | Array of piece data containing PieceCID CIDs and raw sizes |
Returns
Section titled “Returns”Promise that resolves when the pieces are added (201 Created)
Throws
Section titled “Throws”Error if any CID is invalid
createAndAddPieces()
Section titled “createAndAddPieces()”createAndAddPieces( clientDataSetId, payee, payer, recordKeeper, pieces,metadata): Promise<CreateDataSetResponse>;Defined in: packages/synapse-sdk/src/pdp/server.ts:225
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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
clientDataSetId | bigint | Unique 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 |
pieces | PieceInputWithMetadata[] | - |
metadata | MetadataObject | Optional metadata for dataset and each of the pieces. |
Returns
Section titled “Returns”Promise<CreateDataSetResponse>
Promise that resolves with transaction hash and status URL
createDataSet()
Section titled “createDataSet()”createDataSet( clientDataSetId, payee, payer, metadata,recordKeeper): Promise<CreateDataSetResponse>;Defined in: packages/synapse-sdk/src/pdp/server.ts:195
Create a new data set on the PDP server
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
clientDataSetId | bigint | Unique 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) |
metadata | MetadataObject | Metadata entries for the data set (key-value pairs) |
recordKeeper | `0x${string}` | Address of the Warm Storage contract |
Returns
Section titled “Returns”Promise<CreateDataSetResponse>
Promise that resolves with transaction hash and status URL
getDataSet()
Section titled “getDataSet()”getDataSet(dataSetId): Promise<DataSetData>;Defined in: packages/synapse-sdk/src/pdp/server.ts:323
Get data set details from the PDP server
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
dataSetId | number | The ID of the data set to fetch |
Returns
Section titled “Returns”Promise that resolves with data set data
uploadPiece()
Section titled “uploadPiece()”uploadPiece(data, options?): Promise<UploadPieceResponse>;Defined in: packages/synapse-sdk/src/pdp/server.ts:282
Upload a piece to the PDP server using the commp-last protocol.
Accepts data as Uint8Array, AsyncIterable
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
data | | Uint8Array<ArrayBufferLike> | AsyncIterable<Uint8Array<ArrayBufferLike>, any, any> | ReadableStream<Uint8Array<ArrayBufferLike>> | The data to upload (Uint8Array, AsyncIterable, or ReadableStream) |
options? | UploadPieceOptions | Optional upload options |