Skip to main content

Class: Stamper

Defined in: core-sdk/src/stamper/stamper.ts:45

Stateful postage stamp issuer: tracks how many chunks have been stamped into each of the batch's 65536 buckets, so each chunk gets a distinct, capacity-respecting index without the caller managing that bookkeeping.

Properties​

batchId​

batchId: BatchId

Defined in: core-sdk/src/stamper/stamper.ts:47


buckets​

buckets: Uint32Array

Defined in: core-sdk/src/stamper/stamper.ts:48


depth​

depth: number

Defined in: core-sdk/src/stamper/stamper.ts:49


maxSlot​

maxSlot: number

Defined in: core-sdk/src/stamper/stamper.ts:50


signer​

signer: PrivateKey

Defined in: core-sdk/src/stamper/stamper.ts:46

Methods​

getState()​

getState(): Uint32Array

Defined in: core-sdk/src/stamper/stamper.ts:108

Returns the live bucket-height state, for persisting and later resuming via fromState.

Returns​

Uint32Array


stamp()​

stamp(address, timestampMs?): EnvelopeWithBatchId

Defined in: core-sdk/src/stamper/stamper.ts:91

Stamps a chunk address, automatically picking and reserving the next free slot in its bucket. Throws once a bucket reaches its depth-derived capacity.

Parameters​

address​

Uint8Array

timestampMs?​

number

Returns​

EnvelopeWithBatchId


fromBlank()​

static fromBlank(signer, batchId, depth): Stamper

Defined in: core-sdk/src/stamper/stamper.ts:67

Creates a fresh Stamper for a batch with no chunks stamped yet.

Parameters​

signer​

string | Uint8Array<ArrayBufferLike> | PrivateKey

batchId​

string | Uint8Array<ArrayBufferLike> | BatchId

depth​

number

Returns​

Stamper


fromState()​

static fromState(signer, batchId, buckets, depth): Stamper

Defined in: core-sdk/src/stamper/stamper.ts:78

Resumes a Stamper from a previously persisted bucket state (see getState).

Parameters​

signer​

string | Uint8Array<ArrayBufferLike> | PrivateKey

batchId​

string | Uint8Array<ArrayBufferLike> | BatchId

buckets​

Uint32Array

depth​

number

Returns​

Stamper

💬 Get Help