This page describes the components of the Synapse SDK and how they work together. You’ll learn how each component can be used independently, how they are organized within the SDK architecture, and how they interact with the underlying smart contracts and storage providers.
The SDK is built from these core components:
Synapse - Main SDK entry point with simple, high-level API
PaymentsService - SDK client for managing deposits, approvals, and payment rails (interacts with Filecoin Pay contract)
Purpose: SDK client for storage coordination and pricing - storage pricing and cost calculations, data set management and queries, metadata operations (data sets and pieces), service provider approval management, contract address discovery, data set creation verification.
This sequence diagram shows the complete lifecycle of a file upload operation, from initialization through verification. Each step represents an actual blockchain transaction or API call.
sequenceDiagram
participant Client
participant SDK
participant WarmStorage
participant Curio
participant PDPVerifier
participant Payments
Note over Client,Payments: Step 1: Preparation
Client->>SDK: Initialize Synapse SDK
SDK->>WarmStorage: Discover contract addresses
Note over Client,Payments: Step 2: Payment Setup
Client->>SDK: Check allowances
SDK->>WarmStorage: getServicePrice()
SDK->>Payments: accountInfo(client)
alt Needs setup
Client->>Payments: depositWithPermitAndApproveOperator()
end
Note over Client,Payments: Step 3: Storage Context
Client->>SDK: synapse.storage.upload(data)
SDK->>SDK: Auto-select provider or use default
alt No data set exists
SDK->>SDK: Sign CreateDataSet (EIP-712)
SDK->>Curio: POST /pdp/data-sets (+ signature)
Curio->>PDPVerifier: createDataSet(warmStorage, signature)
PDPVerifier->>WarmStorage: dataSetCreated()
WarmStorage->>Payments: createRail()
Payments-->>WarmStorage: railId
end
Note over Client,Payments: Step 4: Upload & Register
SDK->>SDK: Calculate PieceCID
SDK->>Curio: POST /pdp/piece (upload data)
Curio-->>SDK: uploadUUID
SDK->>SDK: Sign AddPieces (EIP-712)
SDK->>Curio: POST /pdp/data-sets/{id}/pieces
Curio->>PDPVerifier: addPieces(dataSetId, pieces, signature)
PDPVerifier->>WarmStorage: piecesAdded()
WarmStorage->>WarmStorage: Store metadata
WarmStorage-->>PDPVerifier: Success
Note over Client,Payments: Step 5: Verification Begins
PDPVerifier->>PDPVerifier: Schedule first challenge
PDPVerifier-->>Client: Upload complete!