Skip to content

WarmStorageService

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:56

new WarmStorageService(options): WarmStorageService

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:68

Create a new WarmStorageService instance

ParameterTypeDescription
options{ client: Client<Transport, Chain, Account>; readClient?: Client<Transport, Chain>; }Options for the WarmStorageService
options.clientClient<Transport, Chain, Account>Wallet client
options.readClient?Client<Transport, Chain>-

WarmStorageService

A new WarmStorageService instance

addApprovedProvider(options): Promise<`0x${string}`>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:405

Add an approved provider by ID (owner only)

ParameterTypeDescription
options{ providerId: bigint; }Options for the approved provider addition
options.providerIdbigintProvider ID from registry

Promise<`0x${string}`>

Transaction response


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.

ParameterTypeDescription
options{ address?: `0x${string}`; }Options for the total storage size query
options.address?`0x${string}`Address to query. Defaults to the client account address.

Promise<OutputType>

Total storage size and dataset count getAccountTotalStorageSize.OutputType

Errors getAccountTotalStorageSize.ErrorType


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.

ParameterTypeDescription
options{ dataSetId: bigint; }Options for the data set
options.dataSetIdbigintThe PDPVerifier data set ID

Promise<bigint>

The number of active pieces


getApprovedProviderIds(): Promise<bigint[]>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:431

Get list of approved provider IDs

Promise<bigint[]>

Array of approved provider IDs


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

ParameterTypeDescription
optionsPaginationOptions & objectOptions for the client data set IDs

Promise<OutputType>

A page of data set IDs getClientDataSetIds.OutputType


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

ParameterTypeDescription
optionsPaginationOptions & objectOptions for the client data sets

Promise<OutputType>

A page of data set information getClientDataSets.OutputType

Errors getClientDataSets.ErrorType


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

ParameterTypeDescription
options{ address: `0x${string}`; }Options for the client data sets length
options.address`0x${string}`The client address

Promise<bigint>

Total count of data sets


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.

ParameterTypeDescription
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?booleanIf true, only return data sets managed by this Warm Storage contract. Defaults to false.

Promise<EnhancedDataSetInfo[]>

Array of enhanced data set information EnhancedDataSetInfo


getDataSet(options): Promise<OutputType>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:105

Get a single data set by ID

ParameterTypeDescription
options{ dataSetId: bigint; }Options for the data set
options.dataSetIdbigintThe data set ID to retrieve

Promise<OutputType>

Data set information getDataSet.OutputType

Errors getDataSet.ErrorType


getDataSetMetadata(options): Promise<MetadataObject>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:320

Get all metadata for a data set

ParameterTypeDescription
options{ dataSetId: bigint; }Options for the data set
options.dataSetIdbigintThe data set ID

Promise<MetadataObject>

Object with metadata key-value pairs


getDataSetMetadataByKey(options): Promise<string | null>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:332

Get specific metadata key for a data set

ParameterTypeDescription
options{ dataSetId: bigint; key: string; }Options for the data set
options.dataSetIdbigintThe data set ID
options.keystringThe metadata key to retrieve

Promise<string | null>

The metadata value if it exists, null otherwise


getOwner(): Promise<`0x${string}`>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:454

Get the contract owner address

Promise<`0x${string}`>

Owner address


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

Promise<{ challengesPerProof: bigint; challengeWindowSize: bigint; initChallengeWindowStart: bigint; maxProvingPeriod: bigint; }>


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

ParameterTypeDescription
options{ dataSetId: bigint; pieceId: bigint; }Options for the piece
options.dataSetIdbigintThe data set ID
options.pieceIdbigintThe piece ID

Promise<MetadataObject>

Object with metadata key-value pairs


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

ParameterTypeDescription
options{ dataSetId: bigint; key: string; pieceId: bigint; }Options for the piece
options.dataSetIdbigintThe data set ID
options.keystringThe metadata key to retrieve
options.pieceIdbigintThe piece ID

Promise<string | null>

The metadata value if it exists, null otherwise


getPriceList(): Promise<OutputType>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:379

Get the current warm storage price list.

Promise<OutputType>

Recurring rates, operation fees, and lockups.


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.

ParameterTypeDescription
options{ dataSetId: bigint; }Options for the data set
options.dataSetIdbigintThe PDPVerifier data set ID

Promise<boolean>

True when the data set has at least one active piece


isOwner(options): Promise<boolean>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:468

Check if an address is the contract owner

ParameterTypeDescription
options{ address: `0x${string}`; }Options for the owner check
options.address`0x${string}`Address to check

Promise<boolean>

Whether the address is the owner


isProviderIdApproved(options): Promise<boolean>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:441

Check if a provider ID is approved

ParameterTypeDescription
options{ providerId: bigint; }Options for the provider ID approval check
options.providerIdbigintProvider ID to check

Promise<boolean>

Whether the provider is approved


removeApprovedProvider(options): Promise<`0x${string}`>

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:415

Remove an approved provider by ID (owner only)

ParameterTypeDescription
options{ providerId: bigint; }Options for the approved provider removal
options.providerIdbigintProvider ID from registry

Promise<`0x${string}`>

Transaction response


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.

ParameterTypeDescription
options{ dataSetId: bigint; }Options for the service termination
options.dataSetIdbigintID of the data set to terminate

Promise<`0x${string}`>

Transaction hash


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.

ParameterTypeDescription
options{ cacheMissAmountToAdd: bigint; cdnAmountToAdd: bigint; dataSetId: bigint; }Options for the top up CDN payment rails
options.cacheMissAmountToAddbigintAmount to add to the cache miss rail lockup
options.cdnAmountToAddbigintAmount to add to the CDN rail lockup
options.dataSetIdbigintThe ID of the data set

Promise<`0x${string}`>

Transaction response Hash


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
ParameterTypeDescription
options{ dataSetId: bigint; }Options for the data set
options.dataSetIdbigintThe PDPVerifier data set ID

Promise<void>

if dataset is not valid for operations


static create(options): WarmStorageService

Defined in: packages/synapse-sdk/src/warm-storage/service.ts:83

Create a new WarmStorageService with pre-configured client

ParameterTypeDescription
options{ account: Account; chain?: Chain; transport?: Transport; }Options for the WarmStorageService
options.accountAccountViem account (required)
options.chain?ChainFilecoin chain (optional, defaults to DEFAULT_CHAIN)
options.transport?TransportViem transport (optional, defaults to http())

WarmStorageService

A new WarmStorageService instance