WarmStorageService
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:56
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WarmStorageService(
options):WarmStorageService
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:68
Create a new WarmStorageService instance
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { client: Client<Transport, Chain, Account>; readClient?: Client<Transport, Chain>; } | Options for the WarmStorageService |
options.client | Client<Transport, Chain, Account> | Wallet client |
options.readClient? | Client<Transport, Chain> | - |
Returns
Section titled “Returns”WarmStorageService
A new WarmStorageService instance
Methods
Section titled “Methods”addApprovedProvider()
Section titled “addApprovedProvider()”addApprovedProvider(
options):Promise<`0x${string}`>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:405
Add an approved provider by ID (owner only)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { providerId: bigint; } | Options for the approved provider addition |
options.providerId | bigint | Provider ID from registry |
Returns
Section titled “Returns”Promise<`0x${string}`>
Transaction response
getAccountTotalStorageSize()
Section titled “getAccountTotalStorageSize()”getAccountTotalStorageSize(
options?):Promise<OutputType>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:230
Get the total storage size across all live datasets for an account.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { address?: `0x${string}`; } | Options for the total storage size query |
options.address? | `0x${string}` | Address to query. Defaults to the client account address. |
Returns
Section titled “Returns”Total storage size and dataset count getAccountTotalStorageSize.OutputType
Throws
Section titled “Throws”Errors getAccountTotalStorageSize.ErrorType
getActivePieceCount()
Section titled “getActivePieceCount()”getActivePieceCount(
options):Promise<bigint>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:290
Get the count of active pieces in a dataset (excludes removed pieces)
Paginates getActivePiecesByCursor rather than calling the contract’s
linear-scan getter, which can run out of gas for large data sets.
Prefer hasActivePieces when only presence is needed.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the data set |
options.dataSetId | bigint | The PDPVerifier data set ID |
Returns
Section titled “Returns”Promise<bigint>
The number of active pieces
getApprovedProviderIds()
Section titled “getApprovedProviderIds()”getApprovedProviderIds():
Promise<bigint[]>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:431
Get list of approved provider IDs
Returns
Section titled “Returns”Promise<bigint[]>
Array of approved provider IDs
getClientDataSetIds()
Section titled “getClientDataSetIds()”getClientDataSetIds(
options):Promise<OutputType>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:140
Get data set IDs for a specific client with optional pagination
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | PaginationOptions & object | Options for the client data set IDs |
Returns
Section titled “Returns”A page of data set IDs getClientDataSetIds.OutputType
getClientDataSets()
Section titled “getClientDataSets()”getClientDataSets(
options):Promise<OutputType>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:118
Get one bounded page of data sets for a specific client
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | PaginationOptions & object | Options for the client data sets |
Returns
Section titled “Returns”A page of data set information getClientDataSets.OutputType
Throws
Section titled “Throws”Errors getClientDataSets.ErrorType
getClientDataSetsLength()
Section titled “getClientDataSetsLength()”getClientDataSetsLength(
options):Promise<bigint>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:128
Get total count of data sets for a specific client
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { address: `0x${string}`; } | Options for the client data sets length |
options.address | `0x${string}` | The client address |
Returns
Section titled “Returns”Promise<bigint>
Total count of data sets
getClientDataSetsWithDetails()
Section titled “getClientDataSetsWithDetails()”getClientDataSetsWithDetails(
options):Promise<EnhancedDataSetInfo[]>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:157
Get all data sets for a client with enhanced details This includes live status and management information.
Piece presence uses a non-zero PDP leaf count rather than an exact active piece count. Prefer getActivePieceCount when an exact count is needed.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { address?: `0x${string}`; onlyManaged?: boolean; } | Options for the client data sets |
options.address? | `0x${string}` | The client address. Defaults to the client account address. |
options.onlyManaged? | boolean | If true, only return data sets managed by this Warm Storage contract. Defaults to false. |
Returns
Section titled “Returns”Promise<EnhancedDataSetInfo[]>
Array of enhanced data set information EnhancedDataSetInfo
getDataSet()
Section titled “getDataSet()”getDataSet(
options):Promise<OutputType>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:105
Get a single data set by ID
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the data set |
options.dataSetId | bigint | The data set ID to retrieve |
Returns
Section titled “Returns”Data set information getDataSet.OutputType
Throws
Section titled “Throws”Errors getDataSet.ErrorType
getDataSetMetadata()
Section titled “getDataSetMetadata()”getDataSetMetadata(
options):Promise<MetadataObject>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:320
Get all metadata for a data set
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the data set |
options.dataSetId | bigint | The data set ID |
Returns
Section titled “Returns”Object with metadata key-value pairs
getDataSetMetadataByKey()
Section titled “getDataSetMetadataByKey()”getDataSetMetadataByKey(
options):Promise<string|null>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:332
Get specific metadata key for a data set
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; key: string; } | Options for the data set |
options.dataSetId | bigint | The data set ID |
options.key | string | The metadata key to retrieve |
Returns
Section titled “Returns”Promise<string | null>
The metadata value if it exists, null otherwise
getOwner()
Section titled “getOwner()”getOwner():
Promise<`0x${string}`>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:454
Get the contract owner address
Returns
Section titled “Returns”Promise<`0x${string}`>
Owner address
getPDPConfig()
Section titled “getPDPConfig()”getPDPConfig():
Promise<{challengesPerProof:bigint;challengeWindowSize:bigint;initChallengeWindowStart:bigint;maxProvingPeriod:bigint; }>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:477
Get the PDP config from the WarmStorage contract. Returns maxProvingPeriod, challengeWindowSize, challengesPerProof, initChallengeWindowStart
Returns
Section titled “Returns”Promise<{ challengesPerProof: bigint; challengeWindowSize: bigint; initChallengeWindowStart: bigint; maxProvingPeriod: bigint; }>
getPieceMetadata()
Section titled “getPieceMetadata()”getPieceMetadata(
options):Promise<MetadataObject>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:350
Get all metadata for a piece in a data set
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; pieceId: bigint; } | Options for the piece |
options.dataSetId | bigint | The data set ID |
options.pieceId | bigint | The piece ID |
Returns
Section titled “Returns”Object with metadata key-value pairs
getPieceMetadataByKey()
Section titled “getPieceMetadataByKey()”getPieceMetadataByKey(
options):Promise<string|null>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:363
Get specific metadata key for a piece in a data set
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; key: string; pieceId: bigint; } | Options for the piece |
options.dataSetId | bigint | The data set ID |
options.key | string | The metadata key to retrieve |
options.pieceId | bigint | The piece ID |
Returns
Section titled “Returns”Promise<string | null>
The metadata value if it exists, null otherwise
getPriceList()
Section titled “getPriceList()”getPriceList():
Promise<OutputType>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:379
Get the current warm storage price list.
Returns
Section titled “Returns”Recurring rates, operation fees, and lockups.
hasActivePieces()
Section titled “hasActivePieces()”hasActivePieces(
options):Promise<boolean>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:307
Report whether a data set has at least one active piece.
Uses a non-zero PDP leaf count as a proxy rather than scanning piece IDs or calculating the exact active piece count, both of which can run out of gas for large data sets.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the data set |
options.dataSetId | bigint | The PDPVerifier data set ID |
Returns
Section titled “Returns”Promise<boolean>
True when the data set has at least one active piece
isOwner()
Section titled “isOwner()”isOwner(
options):Promise<boolean>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:468
Check if an address is the contract owner
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { address: `0x${string}`; } | Options for the owner check |
options.address | `0x${string}` | Address to check |
Returns
Section titled “Returns”Promise<boolean>
Whether the address is the owner
isProviderIdApproved()
Section titled “isProviderIdApproved()”isProviderIdApproved(
options):Promise<boolean>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:441
Check if a provider ID is approved
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { providerId: bigint; } | Options for the provider ID approval check |
options.providerId | bigint | Provider ID to check |
Returns
Section titled “Returns”Promise<boolean>
Whether the provider is approved
removeApprovedProvider()
Section titled “removeApprovedProvider()”removeApprovedProvider(
options):Promise<`0x${string}`>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:415
Remove an approved provider by ID (owner only)
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { providerId: bigint; } | Options for the approved provider removal |
options.providerId | bigint | Provider ID from registry |
Returns
Section titled “Returns”Promise<`0x${string}`>
Transaction response
terminateService()
Section titled “terminateService()”terminateService(
options):Promise<`0x${string}`>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:393
Terminate the storage service by submitting the transaction on-chain directly.
The service and its payments run to the end of the lockup period.
For provider-relayed (immediate) termination use StorageManager.terminateService.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the service termination |
options.dataSetId | bigint | ID of the data set to terminate |
Returns
Section titled “Returns”Promise<`0x${string}`>
Transaction hash
topUpCDNPaymentRails()
Section titled “topUpCDNPaymentRails()”topUpCDNPaymentRails(
options):Promise<`0x${string}`>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:511
Increments the fixed locked-up amounts for CDN payment rails.
This method tops up the prepaid balance for CDN services by adding to the existing lockup amounts. Both CDN and cache miss rails can be incremented independently.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { cacheMissAmountToAdd: bigint; cdnAmountToAdd: bigint; dataSetId: bigint; } | Options for the top up CDN payment rails |
options.cacheMissAmountToAdd | bigint | Amount to add to the cache miss rail lockup |
options.cdnAmountToAdd | bigint | Amount to add to the CDN rail lockup |
options.dataSetId | bigint | The ID of the data set |
Returns
Section titled “Returns”Promise<`0x${string}`>
Transaction response Hash
validateDataSet()
Section titled “validateDataSet()”validateDataSet(
options):Promise<void>
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:249
Validate that a dataset is live and managed by this WarmStorage contract
Performs validation checks in parallel:
- Dataset exists and is live
- Dataset is managed by this WarmStorage contract
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { dataSetId: bigint; } | Options for the data set |
options.dataSetId | bigint | The PDPVerifier data set ID |
Returns
Section titled “Returns”Promise<void>
Throws
Section titled “Throws”if dataset is not valid for operations
create()
Section titled “create()”
staticcreate(options):WarmStorageService
Defined in: packages/synapse-sdk/src/warm-storage/service.ts:83
Create a new WarmStorageService with pre-configured client
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | { account: Account; chain?: Chain; transport?: Transport; } | Options for the WarmStorageService |
options.account | Account | Viem account (required) |
options.chain? | Chain | Filecoin chain (optional, defaults to DEFAULT_CHAIN) |
options.transport? | Transport | Viem transport (optional, defaults to http()) |
Returns
Section titled “Returns”WarmStorageService
A new WarmStorageService instance