Class: Bee
Defined in: bee-js/src/bee.ts:142
The main component that abstracts operations available on the main Bee API.
Not all methods are always available as it depends in what mode is Bee node launched in. For example gateway mode and light node mode has only limited set of endpoints enabled.
Extended by
Constructors
Constructor
new Bee(
url
,options?
):Bee
Defined in: bee-js/src/bee.ts:168
Parameters
url
string
URL on which is the main API of Bee node exposed
options?
Returns
Bee
Properties
network
readonly
network:"gnosis"
|"sepolia"
Defined in: bee-js/src/bee.ts:156
Network on which the Bee node is running
signer?
readonly
optional
signer:PrivateKey
Defined in: bee-js/src/bee.ts:151
Default Signer object used for signing operations, mainly Feeds.
url
readonly
url:string
Defined in: bee-js/src/bee.ts:146
URL on which is the main API of Bee node exposed
Methods
buyStorage()
buyStorage(
size
,duration
,options?
,requestOptions?
):Promise
<BatchId
>
Defined in: bee-js/src/bee.ts:1649
Parameters
size
duration
options?
requestOptions?
Returns
Promise
<BatchId
>
cancelPendingTransaction()
cancelPendingTransaction(
transactionHash
,gasPrice?
,options?
):Promise
<TransactionId
>
Defined in: bee-js/src/bee.ts:1907
Cancel currently pending transaction
Parameters
transactionHash
string
| Uint8Array
<ArrayBufferLike
> | TransactionId
gasPrice?
string
| bigint
| NumberString
options?
Returns
Promise
<TransactionId
>
cashoutLastCheque()
cashoutLastCheque(
address
,options?
,requestOptions?
):Promise
<TransactionId
>
Defined in: bee-js/src/bee.ts:1425
Cashout the last cheque for the peer
Parameters
address
Swarm address of peer
string
| PeerAddress
options?
requestOptions?
Returns
Promise
<TransactionId
>
checkConnection()
checkConnection(
options?
):Promise
<void
>
Defined in: bee-js/src/bee.ts:1265
Ping the Bee node to see if there is a live Bee node on the given URL.
Parameters
options?
Options that affects the request behavior
Returns
Promise
<void
>
Throws
If connection was not successful throw error
createEnvelope()
createEnvelope(
postageBatchId
,reference
,options?
):Promise
<EnvelopeWithBatchId
>
Defined in: bee-js/src/bee.ts:1241
Parameters
postageBatchId
string
| Uint8Array
<ArrayBufferLike
> | BatchId
reference
string
| Uint8Array
<ArrayBufferLike
> | Reference
options?
Returns
Promise
<EnvelopeWithBatchId
>
createFeedManifest()
createFeedManifest(
postageBatchId
,topic
,owner
,options?
,requestOptions?
):Promise
<Reference
>
Defined in: bee-js/src/bee.ts:1132
Create feed manifest chunk and return the reference to it.
Feed manifest chunk allows for a feed to be able to be resolved through /bzz
endpoint.
Parameters
postageBatchId
Postage BatchId to be used to create the Feed Manifest
string
| Uint8Array
<ArrayBufferLike
> | BatchId
topic
Topic in hex or bytes
string
| Uint8Array
<ArrayBufferLike
> | Topic
owner
Owner's ethereum address in hex or bytes
string
| Uint8Array
<ArrayBufferLike
> | EthAddress
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<Reference
>
See
createGrantees()
createGrantees(
postageBatchId
,grantees
,requestOptions?
):Promise
<GranteesResult
>
Defined in: bee-js/src/bee.ts:345
Create a grantees list from the given array of public keys.
The grantees list can be obtained with the getGrantees
method.
Parameters
postageBatchId
The ID of the postage batch.
string
| Uint8Array
<ArrayBufferLike
> | BatchId
grantees
An array of public keys representing the grantees.
string
[] | Uint8Array
<ArrayBufferLike
>[] | PublicKey
[]
requestOptions?
Optional request options.
Returns
Promise
<GranteesResult
>
A promise that resolves to a GranteesResult
object.
createPostageBatch()
createPostageBatch(
amount
,depth
,options?
,requestOptions?
):Promise
<BatchId
>
Defined in: bee-js/src/bee.ts:1609
Creates new postage batch from the funds that the node has available in its Ethereum account.
For better understanding what each parameter means and what are the optimal values please see Bee docs - Keep your data alive / Postage stamps.
WARNING: THIS CREATES TRANSACTIONS THAT SPENDS MONEY
Parameters
amount
Amount that represents the value per chunk, has to be greater or equal zero.
string
| bigint
| NumberString
depth
number
Logarithm of the number of chunks that can be stamped with the batch.
options?
Options for creation of postage batch
requestOptions?
Returns
Promise
<BatchId
>
Throws
BeeArgumentError when negative amount or depth is specified
Throws
TypeError if non-integer value is passed to amount or depth
See
createTag()
createTag(
options?
):Promise
<Tag
>
Defined in: bee-js/src/bee.ts:649
Create a new Tag which is meant for tracking progres of syncing data across network.
Parameters
options?
Options that affects the request behavior
Returns
Promise
<Tag
>
See
deleteTag()
deleteTag(
tagUid
,options?
):Promise
<void
>
Defined in: bee-js/src/bee.ts:701
Delete Tag
Parameters
tagUid
UID or tag object to be retrieved
number
| Tag
options?
Options that affects the request behavior
Returns
Promise
<void
>
Throws
TypeError if tagUid is in not correct format
Throws
BeeResponse error if something went wrong on the Bee node side while deleting the tag.
See
depositStake()
depositStake(
amount
,options?
,requestOptions?
):Promise
<TransactionId
>
Defined in: bee-js/src/bee.ts:1940
Deposits given amount of BZZ token (in PLUR unit).
Be aware that staked BZZ tokens can not be withdrawn.
Parameters
amount
Amount of BZZ token (in PLUR unit) to be staked. Minimum is 100_000_000_000_000_000 PLUR (10 BZZ).
string
| bigint
| BZZ
| NumberString
options?
requestOptions?
Returns
Promise
<TransactionId
>
depositTokens()
depositTokens(
amount
,gasPrice?
,options?
):Promise
<TransactionId
>
Defined in: bee-js/src/bee.ts:1446
Deposit tokens from overlay address into chequebook
Parameters
amount
Amount of tokens to deposit (must be positive integer)
string
| bigint
| BZZ
| NumberString
gasPrice?
Gas Price in WEI for the transaction call
string
| bigint
| NumberString
options?
Returns
Promise
<TransactionId
>
string Hash of the transaction
diluteBatch()
diluteBatch(
postageBatchId
,depth
,options?
):Promise
<BatchId
>
Defined in: bee-js/src/bee.ts:1786
Dilute given Postage Batch with new depth (that has to be bigger then the original depth), which allows the Postage Batch to be used for more chunks.
For better understanding what each parameter means and what are the optimal values please see Bee docs - Keep your data alive / Postage stamps.
Parameters
postageBatchId
Batch ID
string
| Uint8Array
<ArrayBufferLike
> | BatchId
depth
number
Amount to be added to the batch
options?
Request options
Returns
Promise
<BatchId
>
See
- Bee docs - Keep your data alive / Postage stamps
- Bee Debug API reference -
PATCH /stamps/topup/${id}/${amount}
downloadChunk()
downloadChunk(
reference
,options?
,requestOptions?
):Promise
<Uint8Array
<ArrayBufferLike
>>
Defined in: bee-js/src/bee.ts:321
Download chunk as a byte array
Parameters
reference
Bee chunk reference in hex string (either 64 or 128 chars long) or ENS domain.
string
| Uint8Array
<ArrayBufferLike
> | Reference
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<Uint8Array
<ArrayBufferLike
>>
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
downloadData()
downloadData(
resource
,options?
,requestOptions?
):Promise
<Bytes
>
Defined in: bee-js/src/bee.ts:243
Download data as a byte array
Parameters
resource
Swarm reference, Swarm CID, or ENS domain
string
| Uint8Array
<ArrayBufferLike
> | Reference
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<Bytes
>
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
downloadFile()
downloadFile(
resource
,path
,options?
,requestOptions?
):Promise
<FileData
<Bytes
>>
Defined in: bee-js/src/bee.ts:468
Download single file.
Parameters
resource
Swarm reference, Swarm CID, or ENS domain
string
| Uint8Array
<ArrayBufferLike
> | Reference
path
string
= ''
If reference points to manifest, then this parameter defines path to the file
options?
Options that affects the request behavior
requestOptions?
Returns
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
downloadReadableData()
downloadReadableData(
resource
,options?
,requestOptions?
):Promise
<ReadableStream
<Uint8Array
<ArrayBufferLike
>>>
Defined in: bee-js/src/bee.ts:265
Download data as a Readable stream
Parameters
resource
Swarm reference, Swarm CID, or ENS domain
string
| Uint8Array
<ArrayBufferLike
> | Reference
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<ReadableStream
<Uint8Array
<ArrayBufferLike
>>>
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
downloadReadableFile()
downloadReadableFile(
reference
,path
,options?
,requestOptions?
):Promise
<FileData
<ReadableStream
<Uint8Array
<ArrayBufferLike
>>>>
Defined in: bee-js/src/bee.ts:493
Download single file as a readable stream
Parameters
reference
Bee file reference in hex string (either 64 or 128 chars long), ENS domain or Swarm CID.
string
| Uint8Array
<ArrayBufferLike
> | Reference
path
string
= ''
If reference points to manifest / collections, then this parameter defines path to the file
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<FileData
<ReadableStream
<Uint8Array
<ArrayBufferLike
>>>>
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
extendStorageDuration()
extendStorageDuration(
postageBatchId
,duration
,options?
):Promise
<BatchId
>
Defined in: bee-js/src/bee.ts:1688
Parameters
postageBatchId
string
| Uint8Array
<ArrayBufferLike
> | BatchId
duration
options?
Returns
Promise
<BatchId
>
extendStorageSize()
extendStorageSize(
postageBatchId
,size
,options?
):Promise
<BatchId
>
Defined in: bee-js/src/bee.ts:1674
Parameters
postageBatchId
string
| Uint8Array
<ArrayBufferLike
> | BatchId
size
options?
Returns
Promise
<BatchId
>
fetchLatestFeedUpdate()
fetchLatestFeedUpdate(
topic
,owner
,requestOptions?
):Promise
<FeedPayloadResult
>
Defined in: bee-js/src/bee.ts:1194
Parameters
topic
string
| Uint8Array
<ArrayBufferLike
> | Topic
owner
string
| Uint8Array
<ArrayBufferLike
> | EthAddress
requestOptions?
Returns
Promise
<FeedPayloadResult
>
getAllBalances()
getAllBalances(
options?
):Promise
<BalanceResponse
>
Defined in: bee-js/src/bee.ts:1325
Get the balances with all known peers including prepaid services
Parameters
options?
Returns
Promise
<BalanceResponse
>
getAllGlobalPostageBatch()
getAllGlobalPostageBatch(
options?
):Promise
<GlobalPostageBatch
[]>
Defined in: bee-js/src/bee.ts:1846
Return all globally available postage batches.
Parameters
options?
Returns
Promise
<GlobalPostageBatch
[]>
Deprecated
Use getGlobalPostageBatches
instead
getAllPendingTransactions()
getAllPendingTransactions(
options?
):Promise
<TransactionInfo
[]>
Defined in: bee-js/src/bee.ts:1870
Return lists of all current pending transactions that the Bee made
Parameters
options?
Returns
Promise
<TransactionInfo
[]>
getAllPins()
getAllPins(
options?
):Promise
<Reference
[]>
Defined in: bee-js/src/bee.ts:766
Get list of all locally pinned references
Parameters
options?
Options that affects the request behavior
Returns
Promise
<Reference
[]>
See
getAllPostageBatch()
getAllPostageBatch(
options?
):Promise
<PostageBatch
[]>
Defined in: bee-js/src/bee.ts:1838
Return all postage batches that has the node available.
Parameters
options?
Returns
Promise
<PostageBatch
[]>
See
Deprecated
Use getPostageBatches
instead
getAllSettlements()
getAllSettlements(
options?
):Promise
<AllSettlements
>
Defined in: bee-js/src/bee.ts:1506
Get settlements with all known peers and total amount sent or received
Parameters
options?
Returns
Promise
<AllSettlements
>
getAllTags()
getAllTags(
options?
,requestOptions?
):Promise
<Tag
[]>
Defined in: bee-js/src/bee.ts:665
Fetches all tags.
The listing is limited by options.limit. So you have to iterate using options.offset to get all tags.
Parameters
options?
Options that affects the request behavior
requestOptions?
Returns
Promise
<Tag
[]>
Throws
TypeError if limit or offset are not numbers or undefined
Throws
BeeArgumentError if limit or offset have invalid options
See
getBlocklist()
getBlocklist(
options?
):Promise
<Peer
[]>
Defined in: bee-js/src/bee.ts:1291
Parameters
options?
Returns
Promise
<Peer
[]>
getChainState()
getChainState(
options?
):Promise
<ChainState
>
Defined in: bee-js/src/bee.ts:1579
Get chain state
Parameters
options?
Returns
Promise
<ChainState
>
getChequebookAddress()
getChequebookAddress(
options?
):Promise
<ChequebookAddressResponse
>
Defined in: bee-js/src/bee.ts:1371
Get the address of the chequebook contract used.
Warning: The address is returned with 0x prefix unlike all other calls. https://github.com/ethersphere/bee/issues/1443
Parameters
options?
Returns
Promise
<ChequebookAddressResponse
>
getChequebookBalance()
getChequebookBalance(
options?
):Promise
<ChequebookBalanceResponse
>
Defined in: bee-js/src/bee.ts:1378
Get the balance of the chequebook
Parameters
options?
Returns
Promise
<ChequebookBalanceResponse
>
getDurationExtensionCost()
getDurationExtensionCost(
postageBatchId
,duration
,options?
):Promise
<BZZ
>
Defined in: bee-js/src/bee.ts:1736
Parameters
postageBatchId
string
| Uint8Array
<ArrayBufferLike
> | BatchId
duration
options?
Returns
Promise
<BZZ
>
getExtensionCost()
getExtensionCost(
postageBatchId
,size
,duration
,options?
):Promise
<BZZ
>
Defined in: bee-js/src/bee.ts:1700
Parameters
postageBatchId
string
| Uint8Array
<ArrayBufferLike
> | BatchId
size
duration
options?
Returns
Promise
<BZZ
>
getGlobalPostageBatches()
getGlobalPostageBatches(
options?
):Promise
<GlobalPostageBatch
[]>
Defined in: bee-js/src/bee.ts:1863
Return all globally available postage batches.
Parameters
options?
Returns
Promise
<GlobalPostageBatch
[]>
getGrantees()
getGrantees(
reference
,requestOptions?
):Promise
<GetGranteesResult
>
Defined in: bee-js/src/bee.ts:363
Retrieves the grantees for a given reference.
Parameters
reference
The reference.
string
| Uint8Array
<ArrayBufferLike
> | Reference
requestOptions?
Optional request options.
Returns
Promise
<GetGranteesResult
>
A promise that resolves to a GetGranteesResult
object.
getHealth()
getHealth(
options?
):Promise
<Health
>
Defined in: bee-js/src/bee.ts:1520
Get health of node
Parameters
options?
Returns
Promise
<Health
>
getLastCashoutAction()
getLastCashoutAction(
address
,options?
):Promise
<LastCashoutActionResponse
>
Defined in: bee-js/src/bee.ts:1408
Get last cashout action for the peer
Parameters
address
Swarm address of peer
string
| PeerAddress
options?
Returns
Promise
<LastCashoutActionResponse
>
getLastCheques()
getLastCheques(
options?
):Promise
<LastChequesResponse
>
Defined in: bee-js/src/bee.ts:1385
Get last cheques for all peers
Parameters
options?
Returns
Promise
<LastChequesResponse
>
getLastChequesForPeer()
getLastChequesForPeer(
address
,options?
):Promise
<LastChequesForPeerResponse
>
Defined in: bee-js/src/bee.ts:1394
Get last cheques for the peer
Parameters
address
Swarm address of peer
string
| PeerAddress
options?
Returns
Promise
<LastChequesForPeerResponse
>
getNodeAddresses()
getNodeAddresses(
options?
):Promise
<NodeAddresses
>
Defined in: bee-js/src/bee.ts:1287
Parameters
options?
Returns
Promise
<NodeAddresses
>
getNodeInfo()
getNodeInfo(
options?
):Promise
<NodeInfo
>
Defined in: bee-js/src/bee.ts:1534
Get mode information of node
Parameters
options?
Returns
Promise
<NodeInfo
>
getPastDueConsumptionBalances()
getPastDueConsumptionBalances(
options?
):Promise
<BalanceResponse
>
Defined in: bee-js/src/bee.ts:1343
Get the past due consumption balances with all known peers
Parameters
options?
Returns
Promise
<BalanceResponse
>
getPastDueConsumptionPeerBalance()
getPastDueConsumptionPeerBalance(
address
,options?
):Promise
<PeerBalance
>
Defined in: bee-js/src/bee.ts:1352
Get the past due consumption balance with a specific peer
Parameters
address
Swarm address of peer
string
| PeerAddress
options?
Returns
Promise
<PeerBalance
>
getPeerBalance()
getPeerBalance(
address
,options?
):Promise
<PeerBalance
>
Defined in: bee-js/src/bee.ts:1334
Get the balances with a specific peer including prepaid services
Parameters
address
Swarm address of peer
string
| PeerAddress
options?
Returns
Promise
<PeerBalance
>
getPeers()
getPeers(
options?
):Promise
<Peer
[]>
Defined in: bee-js/src/bee.ts:1298
Get list of peers for this node
Parameters
options?
Returns
Promise
<Peer
[]>
getPendingTransaction()
getPendingTransaction(
transactionHash
,options?
):Promise
<TransactionInfo
>
Defined in: bee-js/src/bee.ts:1878
Return transaction information for specific transaction
Parameters
transactionHash
string
| Uint8Array
<ArrayBufferLike
> | TransactionId
options?
Returns
Promise
<TransactionInfo
>
getPin()
getPin(
reference
,options?
):Promise
<Pin
>
Defined in: bee-js/src/bee.ts:780
Get pinning status of chunk with given reference
Parameters
reference
Bee data reference in hex string (either 64 or 128 chars long) or ENS domain.
string
| Uint8Array
<ArrayBufferLike
> | Reference
options?
Options that affects the request behavior
Returns
Promise
<Pin
>
Throws
TypeError if some of the input parameters is not expected type
Throws
BeeArgumentError if there is passed ENS domain with invalid unicode characters
See
getPostageBatch()
getPostageBatch(
postageBatchId
,options?
):Promise
<PostageBatch
>
Defined in: bee-js/src/bee.ts:1805
Return details for specific postage batch.
Parameters
postageBatchId
Batch ID
string
| Uint8Array
<ArrayBufferLike
> | BatchId
options?
Returns
Promise
<PostageBatch
>
See
getPostageBatchBuckets()
getPostageBatchBuckets(
postageBatchId
,options?
):Promise
<PostageBatchBuckets
>
Defined in: bee-js/src/bee.ts:1822
Return detailed information related to buckets for specific postage batch.
Parameters
postageBatchId
Batch ID
string
| Uint8Array
<ArrayBufferLike
> | BatchId
options?
Returns
Promise
<PostageBatchBuckets
>
See
- Bee docs - Keep your data alive / Postage stamps
- Bee Debug API reference -
GET /stamps/${id}/buckets
getPostageBatches()
getPostageBatches(
options?
):Promise
<PostageBatch
[]>
Defined in: bee-js/src/bee.ts:1856
Return all postage batches that belong to the node.
Parameters
options?
Returns
Promise
<PostageBatch
[]>
See
getReadiness()
getReadiness(
options?
):Promise
<Readiness
>
Defined in: bee-js/src/bee.ts:1527
Get readiness of node
Parameters
options?
Returns
Promise
<Readiness
>
getRedistributionState()
getRedistributionState(
options?
):Promise
<RedistributionState
>
Defined in: bee-js/src/bee.ts:1960
Get current status of node in redistribution game
Parameters
options?
Returns
Promise
<RedistributionState
>
getRequestOptionsForCall()
protected
getRequestOptionsForCall(options?
):BeeRequestOptions
Defined in: bee-js/src/bee.ts:1983
Parameters
options?
Returns
getReserveState()
getReserveState(
options?
):Promise
<ReserveState
>
Defined in: bee-js/src/bee.ts:1572
Get reserve state
Parameters
options?
Returns
Promise
<ReserveState
>
getSettlements()
getSettlements(
address
,options?
):Promise
<Settlements
>
Defined in: bee-js/src/bee.ts:1497
Get amount of sent and received from settlements with a peer
Parameters
address
Swarm address of peer
string
| PeerAddress