Skip to content

Index

Synapse SDK - Main entry point

import { Synapse } from '@filoz/synapse-sdk'
ModuleDescription
<internal>-
ClassDescription
PaymentsService-
PDPAuthHelperHelper class for creating EIP-712 typed signatures for PDP operations
PDPServer-
PDPVerifier-
StorageContext-
StorageManager-
SubgraphServiceDefines the contract for a service that can retrieve provider information from a data source, typically a Synapse-compatible subgraph.
Synapse-
WarmStorageService-
InterfaceDescription
AddPiecesInfoHelper information for adding pieces to a data set
AddPiecesResponseResponse from adding pieces to a data set
AuthSignatureSignature data for authenticated operations
ComprehensiveDataSetStatusCombined status information from both PDP server and chain
CreateDataSetResponseResponse from creating a data set
DataSetCreationStatusResponseResponse from checking data set creation status
DataSetCreationVerificationResult of verifying data set creation on-chain
DataSetDataData set data returned from the API
DataSetInfoData set information returned from Warm Storage contract
DataSetPieceDataIndividual data set piece data from API
DepositCallbacksCallbacks for deposit operation visibility
DetailedSubgraphDataSetInfoDetailed data set information from subgraph with additional metadata
EnhancedDataSetInfoEnhanced data set information with chain details and clear ID separation
FaultRecordFault record information
FindPieceResponseResponse from finding a piece
NestedQueryOptionsOptions for nested entity queries in subgraphs
PaginationOptionsOptions for pagination in subgraph queries
PieceAdditionStatusResponseResponse from checking piece addition status
PieceInfoPiece information with data set context
PieceRetrieverPieceRetriever interface for fetching pieces from various sources Returns standard Web API Response objects for flexibility
PieceStatusStatus information for a piece stored on a provider Note: Proofs are submitted for entire data sets, not individual pieces. The timing information reflects the data set’s status.
PreflightInfoPreflight information for storage uploads
ProviderInfoDecoded provider info for SDK use
ProviderSelectionResultResult of provider selection and data set resolution
ProviderStatsExtended provider statistics including fault information
QueryOptionsOptions for flexible subgraph queries with custom where clauses
RailInfoInformation about a payment rail
SettlementResultSettlement result from settling a payment rail
StorageCreationCallbacksCallbacks for storage service creation process
StorageInfoComprehensive storage service information
StorageOptionsStorage service options
StorageServiceOptionsOptions for creating or selecting a storage context
SubgraphConfigConfiguration for the SubgraphService, determining how to connect to a Synapse-compatible subgraph for provider discovery.
SubgraphDataSetInfoBasic data set information from subgraph
SubgraphRetrievalServiceDefines the contract for a service that can retrieve provider information from a data source, typically a Synapse-compatible subgraph.
SynapseOptionsOptions for initializing the Synapse instance Must provide one of: 1. privateKey + rpcURL (for server environments) 2. provider (for browser environments - user handles MetaMask coupling) 3. signer (for direct ethers.js integration)
UploadCallbacksCallbacks for tracking upload progress
UploadOptionsOptions for uploading individual pieces to an existing storage context
UploadResponseUpload response containing piece information
UploadResultUpload result information
UploadTaskUpload task tracking
Type AliasDescription
Address-
DataSetId-
DownloadOptionsDownload options Currently empty, reserved for future options
FilecoinNetworkTypeSupported Filecoin network types
MetadataEntry-
PieceCIDPieceCID - A constrained CID type for Piece Commitments. This is implemented as a Link type which is made concrete by a CID. A PieceCID uses the raw codec (0x55) and the fr32-sha256-trunc254-padbintree multihash function (0x1011) which encodes the base content length (as padding) of the original piece, and the height of the merkle tree used to hash it.
PrivateKey-
ServiceProvider-
TokenAmount-
TokenIdentifierToken identifier for balance queries
VariableDescription
CHAIN_IDSNetwork chain IDs
CONTRACT_ABISContract ABIs
CONTRACT_ADDRESSESContract addresses
EIP2612_PERMIT_TYPESEIP-2612 typed data schema (Permit)
GENESIS_TIMESTAMPSGenesis timestamps for Filecoin networks (Unix timestamp in seconds)
METADATA_KEYSCommon metadata keys
RPC_URLSRecommended RPC endpoints for Filecoin networks
SETTLEMENT_FEESettlement fee required for rail settlement operations This is the NETWORK_FEE constant in the Payments contract that gets burned to the Filecoin network Value: 0.0013 FIL (1300000000000000 attoFIL)
SIZE_CONSTANTSData size constants
TIME_CONSTANTSTime and size constants
TIMING_CONSTANTSTiming constants for blockchain operations
TOKENSToken identifiers
FunctionDescription
asDataSetDataConverts and validates data set data Returns null if validation fails
asDataSetPieceDataConverts and validates individual data set piece data Returns null if validation fails
calculateLastProofDateCalculate when the last proof should have been submitted based on current time
combineMetadataCombines metadata object with withCDN flag, ensuring consistent behavior. If withCDN is true, adds the withCDN key only if not already present. If withCDN is false or undefined, returns metadata unchanged.
constructFindPieceUrlConstruct a piece discovery (findPiece) URL
constructPieceUrlConstruct a piece retrieval URL
createErrorUtility function to create descriptive errors with context
dateToEpochConvert a JavaScript Date to a Filecoin epoch
epochToDateConvert a Filecoin epoch to a JavaScript Date
getCurrentEpochGet the current epoch from the blockchain This is an internal utility, not part of the public API
getFilecoinNetworkTypeExtract and validate FilecoinNetworkType from an ethers Provider
getGenesisTimestampGet the genesis timestamp for a network
isDataSetCreationStatusResponseType guard for DataSetCreationStatusResponse Validates the response from checking data set creation status
isFindPieceResponseType guard for FindPieceResponse Validates the response from finding a piece Supports both pieceCid (new) and piece_cid (legacy) field names for backward compatibility
isPieceAdditionStatusResponseType guard for PieceAdditionStatusResponse Validates the response from checking piece addition status
metadataMatchesChecks if a data set’s metadata exactly matches the requested metadata.
timeUntilEpochCalculate the time until a future epoch
validateDataSetCreationStatusResponseValidates and returns a DataSetCreationStatusResponse
validateFindPieceResponseValidates and returns a FindPieceResponse Normalizes the response to always have pieceCid field as a PieceCID object
validatePieceAdditionStatusResponseValidates and returns a PieceAdditionStatusResponse

Renames and re-exports StorageContext