Skip to main content

Class: Stamp

Defined in: bee-js/src/modules/stamp.ts:29

Low-level postage batch (stamp) operations.

Accessed as bee.stamp. For the ergonomic wrapper see bee.storage.

Constructors​

Constructor​

new Stamp(context): Stamp

Defined in: bee-js/src/modules/stamp.ts:30

Parameters​

context​

BeeContext

Returns​

Stamp

Methods​

calculateTopUpForBZZ()​

calculateTopUpForBZZ(depth, bzz, requestOptions?): Promise<{ amount: bigint; duration: Duration; }>

Defined in: bee-js/src/modules/stamp.ts:108

Calculates the amount and expected duration extension for topping up a postage batch with a given BZZ value.

Parameters​

depth​

number

Depth of the postage batch to top up.

bzz​

BZZ

The amount of BZZ to spend on the top-up.

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<{ amount: bigint; duration: Duration; }>


create()​

create(amount, depth, options?, requestOptions?): Promise<BatchId>

Defined in: bee-js/src/modules/stamp.ts:42

Creates a new postage batch, spending BZZ tokens from the node wallet.

Use bee.storage.buy for a more convenient way to create a postage batch.

Parameters​

amount​

TTL parameter - 1 day at the minimum of 24,000 storage price requires an amount of 414,720,000.

string | bigint | NumberString

depth​

number

Capacity parameter - 17..255.

options?​

PostageBatchOptions

Options for creation of postage batch

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<BatchId>


dilute()​

dilute(postageBatchId, depth, requestOptions?): Promise<BatchId>

Defined in: bee-js/src/modules/stamp.ts:146

Dilutes a postage batch to extend its capacity by increasing its depth.

Parameters​

postageBatchId​

Batch ID

string | Uint8Array<ArrayBufferLike> | BatchId

depth​

number

New depth for the batch

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<BatchId>


get()​

get(postageBatchId, requestOptions?, encryption?, erasureCodeLevel?): Promise<PostageBatch>

Defined in: bee-js/src/modules/stamp.ts:165

Returns details for a specific postage batch.

Parameters​

postageBatchId​

Batch ID

string | Uint8Array<ArrayBufferLike> | BatchId

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

encryption?​

boolean

Assume that uploads with this postage batch are encrypted, which skews the capacity.

erasureCodeLevel?​

RedundancyLevel

Assume that uploads with this postage batch are erasure coded, which skews the capacity.

Returns​

Promise<PostageBatch>


getAll()​

getAll(requestOptions?): Promise<PostageBatch[]>

Defined in: bee-js/src/modules/stamp.ts:216

Returns all postage batches that belong to the node.

Parameters​

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<PostageBatch[]>


getAllGlobal()​

getAllGlobal(requestOptions?): Promise<GlobalPostageBatch[]>

Defined in: bee-js/src/modules/stamp.ts:225

Returns all globally available postage batches.

Parameters​

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<GlobalPostageBatch[]>


getBuckets()​

getBuckets(postageBatchId, requestOptions?): Promise<PostageBatchBuckets>

Defined in: bee-js/src/modules/stamp.ts:202

Returns detailed information related to buckets for a specific postage batch.

Parameters​

postageBatchId​

Batch ID

string | Uint8Array<ArrayBufferLike> | BatchId

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<PostageBatchBuckets>


getGlobal()​

getGlobal(postageBatchId, requestOptions?): Promise<GlobalPostageBatch>

Defined in: bee-js/src/modules/stamp.ts:187

Returns details for a specific globally available postage batch.

Parameters​

postageBatchId​

Batch ID

string | Uint8Array<ArrayBufferLike> | BatchId

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<GlobalPostageBatch>


topUp()​

topUp(postageBatchId, amount, requestOptions?): Promise<BatchId>

Defined in: bee-js/src/modules/stamp.ts:128

Increases the duration of a postage batch by increasing its amount.

Parameters​

postageBatchId​

Batch ID

string | Uint8Array<ArrayBufferLike> | BatchId

amount​

Amount to be added to the batch

string | bigint | NumberString

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<BatchId>


updateLabel()​

updateLabel(postageBatchId, label, requestOptions?): Promise<void>

Defined in: bee-js/src/modules/stamp.ts:91

Updates the label of a certain postage batch.

Parameters​

postageBatchId​

Batch ID of the postage batch to update.

string | Uint8Array<ArrayBufferLike> | BatchId

label​

string

New label for the postage batch.

requestOptions?​

BeeRequestOptions

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

Returns​

Promise<void>

💬 Get Help