Skip to content

ContextCreateContextsOptions

Defined in: packages/synapse-sdk/src/types.ts:419

Options for creating multiple storage contexts via createContexts()

Extends BaseContextOptions with plural provider/dataset selection and count for multi-provider redundancy.

Provider targeting is mutually exclusive, use ONE of:

  • providerIds to target specific providers (SDK handles dataset resolution)
  • dataSetIds to target specific existing datasets
  • Neither, to let the SDK auto-select providers

optional callbacks?: StorageContextCallbacks

Defined in: packages/synapse-sdk/src/types.ts:372

Callbacks for creation process

CreateContextsOptions.callbacks


optional cdnGroup?: string

Defined in: packages/synapse-sdk/src/types.ts:363

CDN group id used as the withCDN metadata value when CDN is enabled. Every context (primary and secondaries) that shares this value resolves to the same shared CDN bandwidth rail in FWSS (keyed by keccak256(payer, cdnGroup)), so a multi-copy CDN upload buys bandwidth once instead of once per copy. Opt-in and empty by default, which keeps a dedicated bandwidth rail per data set and preserves exact-metadata reuse.

CreateContextsOptions.cdnGroup


optional copies?: number

Defined in: packages/synapse-sdk/src/types.ts:388

Number of storage copies to create (optional, defaults to 2)

CreateContextsOptions.copies


optional dataSetIds?: bigint[]

Defined in: packages/synapse-sdk/src/types.ts:398

Specific data set IDs to target. Each must be an active data set owned by the caller. Mutually exclusive with providerIds.

Use this only when resuming into a known data set from a prior operation. For first-time uploads to specific providers, use providerIds instead, the SDK handles data set creation automatically.

CreateContextsOptions.dataSetIds


optional excludeProviderIds?: bigint[]

Defined in: packages/synapse-sdk/src/types.ts:416

Do not select any of these providers

CreateContextsOptions.excludeProviderIds


optional metadata?: Record<string, string>

Defined in: packages/synapse-sdk/src/types.ts:369

Custom metadata for data sets (key-value pairs). Used to match existing data sets during provider selection.

CreateContextsOptions.metadata


optional providerIds?: bigint[]

Defined in: packages/synapse-sdk/src/types.ts:413

Specific provider IDs to upload to. The SDK resolves or creates data sets on each provider automatically. Mutually exclusive with dataSetIds.

This is the recommended way to target specific providers. Do not call createContext() to resolve data sets first, pass provider IDs here and the SDK handles the rest.

Upload to two specific providers

await synapse.storage.upload(data, { providerIds: [4n, 9n] })

CreateContextsOptions.providerIds


synapse: Synapse

Defined in: packages/synapse-sdk/src/types.ts:421

The Synapse instance


warmStorageService: WarmStorageService

Defined in: packages/synapse-sdk/src/types.ts:423

The WarmStorageService instance


optional withCDN?: boolean

Defined in: packages/synapse-sdk/src/types.ts:354

Whether to enable CDN services

CreateContextsOptions.withCDN