api_reference
Classes
- AddressGetter
- BalanceGetter
- Client
- ClientBuilder
- GetAddressBuilder
- MessageBuilder
- MessageGetter
- UnspentAddressGetter
Functions
- start()
Initializes the console error panic hook for better error messages
AddressGetter
Kind: global class
- AddressGetter
- instance
- static
addressGetter.accountIndex(index) ⇒ AddressGetter
Set the account index
Kind: instance method of AddressGetter
Param | Type |
---|---|
index | number |
addressGetter.range(start, end) ⇒ AddressGetter
Set the address range
Kind: instance method of AddressGetter
Param | Type |
---|---|
start | number |
end | number |
addressGetter.bech32Hrp(bech32_hrp) ⇒ AddressGetter
Set the bech32 hrp
Kind: instance method of AddressGetter
Param | Type |
---|---|
bech32_hrp | string |
addressGetter.includeInternal() ⇒ AddressGetter
Include internal addresses
Kind: instance method of AddressGetter
addressGetter.get() ⇒ Promise.<any>
Get the addresses.
Kind: instance method of AddressGetter
AddressGetter.new(client, seed) ⇒ AddressGetter
Kind: static method of AddressGetter
Param | Type |
---|---|
client | Client |
seed | string |
BalanceGetter
Kind: global class
- BalanceGetter
- instance
- static
balanceGetter.accountIndex(index) ⇒ BalanceGetter
Sets the account index
Kind: instance method of BalanceGetter
Param | Type |
---|---|
index | number |
balanceGetter.initialAddressIndex(initial_address_index) ⇒ BalanceGetter
Sets the address index from which to start looking for balance
Kind: instance method of BalanceGetter
Param | Type |
---|---|
initial_address_index | number |
balanceGetter.gap_limit(gap_limit) ⇒ BalanceGetter
Sets the gap limit to specify how many addresses will be checked each round. If gap_limit amount of addresses in a row have no balance the function will return.
Kind: instance method of BalanceGetter
Param | Type |
---|---|
gap_limit | number |
balanceGetter.get() ⇒ Promise.<any>
Get the balance.
Kind: instance method of BalanceGetter
BalanceGetter.new(client, seed) ⇒ BalanceGetter
Kind: static method of BalanceGetter
Param | Type |
---|---|
client | Client |
seed | string |
Client
Kind: global class
- Client
- .message() ⇒
MessageBuilder
- .getMessage() ⇒
MessageGetter
- .getAddresses(seed) ⇒
AddressGetter
- .getUnspentAddress(seed) ⇒
UnspentAddressGetter
- .getBalance(seed) ⇒
BalanceGetter
- .getAddress() ⇒
GetAddressBuilder
- .getInfo() ⇒
Promise.<any>
- .getNodeInfo(url, jwt, username, password) ⇒
Promise.<any>
- .networkInfo() ⇒
Promise.<any>
- .getNetworkId() ⇒
Promise.<any>
- .getBech32Hrp() ⇒
Promise.<any>
- .getMinPowScore() ⇒
Promise.<any>
- .getHealth() ⇒
Promise.<any>
- .getTips() ⇒
Promise.<any>
- .getPeers() ⇒
Promise.<any>
- .getOutput(output_id) ⇒
Promise.<any>
- .findMessages(indexation_keys, message_ids) ⇒
Promise.<any>
- .findInputs(addresses, amount) ⇒
Promise.<any>
- .findOutputs(outputs, addresses) ⇒
Promise.<any>
- .getAddressBalances(addresses) ⇒
Promise.<any>
- .getMilestone(index) ⇒
Promise.<any>
- .getMilestoneUtxoChanges(index) ⇒
Promise.<any>
- .getReceipts() ⇒
Promise.<any>
- .getReceiptsMigratedAt(milestone_index) ⇒
Promise.<any>
- .getTreasury() ⇒
Promise.<any>
- .getIncludedMessage(transaction_id) ⇒
Promise.<any>
- .postMessage(message) ⇒
Promise.<any>
- .retry(message_id) ⇒
Promise.<any>
- .retryUntilIncluded(message_id, interval, max_attempts) ⇒
Promise.<any>
- .reattach(message_id) ⇒
Promise.<any>
- .promote(message_id) ⇒
Promise.<any>
- .consolidateFunds(seed, account_index, start_index, end_index) ⇒
Promise.<any>
- .bech32ToHex(address) ⇒
string
- .hexToBech32(address, bech32) ⇒
Promise.<any>
- .hexPublicKeyToBech32Address(public_key, bech32) ⇒
Promise.<any>
- .isAddressValid(address) ⇒
boolean
- .generateMnemonic() ⇒
string
- .mnemonicToHexSeed(mnemonic) ⇒
string
- .getMessageId(message) ⇒
string
- .getTransactionId(transaction) ⇒
string
- .getEssenceHash(essence) ⇒
string
- .message() ⇒
client.message() ⇒ MessageBuilder
Send a message to the Tangle.
Kind: instance method of Client
client.getMessage() ⇒ MessageGetter
Get a message from the Tangle.
Kind: instance method of Client
client.getAddresses(seed) ⇒ AddressGetter
Generate addresses.
Kind: instance method of Client
Param | Type |
---|---|
seed | string |
client.getUnspentAddress(seed) ⇒ UnspentAddressGetter
Get an unspent address.
Kind: instance method of Client
Param | Type |
---|---|
seed | string |
client.getBalance(seed) ⇒ BalanceGetter
Get the account balance.
Kind: instance method of Client
Param | Type |
---|---|
seed | string |
client.getAddress() ⇒ GetAddressBuilder
GET /api/v1/addresses/{address} endpoint
Kind: instance method of Client
client.getInfo() ⇒ Promise.<any>
Get the nodeinfo.
Kind: instance method of Client
client.getNodeInfo(url, jwt, username, password) ⇒ Promise.<any>
Get the nodeinfo.
Kind: instance method of Client
Param | Type |
---|---|
url | string |
jwt | string | undefined |
username | string | undefined |
password | string | undefined |
client.networkInfo() ⇒ Promise.<any>
Gets the network related information such as network_id and min_pow_score and if it's the default one, sync it first.
Kind: instance method of Client
client.getNetworkId() ⇒ Promise.<any>
Gets the network id of the node we're connecting to.
Kind: instance method of Client
client.getBech32Hrp() ⇒ Promise.<any>
returns the bech32_hrp
Kind: instance method of Client
client.getMinPowScore() ⇒ Promise.<any>
returns the bech32_hrp
Kind: instance method of Client
client.getHealth() ⇒ Promise.<any>
Get the node health.
Kind: instance method of Client
client.getTips() ⇒ Promise.<any>
Get tips.
Kind: instance method of Client
client.getPeers() ⇒ Promise.<any>
Get peers.
Kind: instance method of Client
client.getOutput(output_id) ⇒ Promise.<any>
GET /api/v1/outputs/{outputId} endpoint Find an output by its transaction_id and corresponding output_index.
Kind: instance method of Client
Param | Type |
---|---|
output_id | string |
client.findMessages(indexation_keys, message_ids) ⇒ Promise.<any>
Find all messages by provided message IDs and/or indexation_keys.
Kind: instance method of Client
Param | Type |
---|---|
indexation_keys | any |
message_ids | any |
client.findInputs(addresses, amount) ⇒ Promise.<any>
Function to find inputs from addresses for a provided amount (useful for offline signing)
Kind: instance method of Client
Param | Type |
---|---|
addresses | any |
amount | BigInt |
client.findOutputs(outputs, addresses) ⇒ Promise.<any>
Find all outputs based on the requests criteria. This method will try to query multiple nodes if the request amount exceeds individual node limit.
Kind: instance method of Client
Param | Type |
---|---|
outputs | any |
addresses | any |
client.getAddressBalances(addresses) ⇒ Promise.<any>
Return the balance in iota for the given addresses; No seed needed to do this since we are only checking and already know the addresses.
Kind: instance method of Client
Param | Type |
---|---|
addresses | any |
client.getMilestone(index) ⇒ Promise.<any>
GET /api/v1/milestones/{index} endpoint Get the milestone by the given index.
Kind: instance method of Client
Param | Type |
---|---|
index | number |
client.getMilestoneUtxoChanges(index) ⇒ Promise.<any>
GET /api/v1/milestones/{index}/utxo-changes endpoint Get the milestone by the given index.
Kind: instance method of Client
Param | Type |
---|---|
index | number |
client.getReceipts() ⇒ Promise.<any>
GET /api/v1/receipts endpoint Get all receipts.
Kind: instance method of Client
client.getReceiptsMigratedAt(milestone_index) ⇒ Promise.<any>
GET /api/v1/receipts/{migratedAt} endpoint Get the receipts by the given milestone index.
Kind: instance method of Client
Param | Type |
---|---|
milestone_index | number |
client.getTreasury() ⇒ Promise.<any>
GET /api/v1/treasury endpoint Get the treasury output.
Kind: instance method of Client
client.getIncludedMessage(transaction_id) ⇒ Promise.<any>
GET /api/v1/transactions/{transactionId}/included-message Returns the included message of the transaction.
Kind: instance method of Client
Param | Type |
---|---|
transaction_id | string |
client.postMessage(message) ⇒ Promise.<any>
Post message.
Kind: instance method of Client
Param | Type |
---|---|
message | any |
client.retry(message_id) ⇒ Promise.<any>
Retries (promotes or reattaches) a message for provided message id. Message should only be retried only if they are valid and haven't been confirmed for a while.
Kind: instance method of Client
Param | Type |
---|---|
message_id | string |
client.retryUntilIncluded(message_id, interval, max_attempts) ⇒ Promise.<any>
Only works in browser because of the timeouts Retries (promotes or reattaches) a message for provided message id until it's included (referenced by a milestone). Default interval is 5 seconds and max attempts is 40. Returns reattached messages
Kind: instance method of Client
Param | Type |
---|---|
message_id | string |
interval | BigInt | undefined |
max_attempts | BigInt | undefined |
client.reattach(message_id) ⇒ Promise.<any>
Reattaches messages for provided message id. Messages can be reattached only if they are valid and haven't been confirmed for a while.
Kind: instance method of Client
Param | Type |
---|---|
message_id | string |
client.promote(message_id) ⇒ Promise.<any>
Promotes a message. The method should validate if a promotion is necessary through get_message. If not, the method should error out and should not allow unnecessary promotions.
Kind: instance method of Client
Param | Type |
---|---|
message_id | string |
client.consolidateFunds(seed, account_index, start_index, end_index) ⇒ Promise.<any>
Only works in browser because of the timeouts Function to consolidate all funds from a range of addresses to the address with the lowest index in that range Returns the address to which the funds got consolidated, if any were available
Kind: instance method of Client
Param | Type |
---|---|
seed | string |
account_index | number |
start_index | number |
end_index | number |
client.bech32ToHex(address) ⇒ string
Returns a parsed hex String from bech32.
Kind: instance method of Client
Param | Type |
---|---|
address | string |
client.hexToBech32(address, bech32) ⇒ Promise.<any>
Returns a parsed bech32 String from hex.
Kind: instance method of Client
Param | Type |
---|---|
address | string |
bech32 | string | undefined |
client.hexPublicKeyToBech32Address(public_key, bech32) ⇒ Promise.<any>
Transforms a hex encoded public key to a bech32 encoded address
Kind: instance method of Client
Param | Type |
---|---|
public_key | string |
bech32 | string | undefined |
client.isAddressValid(address) ⇒ boolean
Checks if a String is a valid bech32 encoded address.
Kind: instance method of Client
Param | Type |
---|---|
address | string |
client.generateMnemonic() ⇒ string
Generates a new mnemonic.
Kind: instance method of Client
client.mnemonicToHexSeed(mnemonic) ⇒ string
Returns a hex encoded seed for a mnemonic.
Kind: instance method of Client
Param | Type |
---|---|
mnemonic | string |
client.getMessageId(message) ⇒ string
Returns the message id from a provided message.
Kind: instance method of Client
Param | Type |
---|---|
message | string |
client.getTransactionId(transaction) ⇒ string
Returns the transaction id from a provided transaction payload.
Kind: instance method of Client
Param | Type |
---|---|
transaction | string |
client.getEssenceHash(essence) ⇒ string
Get essence hash
Kind: instance method of Client
Param | Type |
---|---|
essence | string |
ClientBuilder
Kind: global class
- ClientBuilder
- new ClientBuilder()
- .node(url) ⇒
ClientBuilder
- .primaryNode(url, jwt, username, password) ⇒
ClientBuilder
- .primaryPowNode(url, jwt, username, password) ⇒
ClientBuilder
- .permanode(url, jwt, username, password) ⇒
ClientBuilder
- .nodeAuth(url, jwt, username, password) ⇒
ClientBuilder
- .nodes(urls) ⇒
ClientBuilder
- .nodeSyncInterval(value) ⇒
ClientBuilder
- .nodeSyncDisabled() ⇒
ClientBuilder
- .offlineMode() ⇒
ClientBuilder
- .nodePoolUrls(node_pool_urls) ⇒
Promise.<any>
- .quorum(value) ⇒
ClientBuilder
- .quorumSize(value) ⇒
ClientBuilder
- .quorumThreshold(value) ⇒
ClientBuilder
- .network(network) ⇒
ClientBuilder
- .localPow(value) ⇒
ClientBuilder
- .tipsInterval(value) ⇒
ClientBuilder
- .requestTimeout(value) ⇒
ClientBuilder
- .apiTimeout(api, timeout) ⇒
ClientBuilder
- .build() ⇒
Promise.<any>
new ClientBuilder()
Creates an IOTA client builder.
clientBuilder.node(url) ⇒ ClientBuilder
Adds an IOTA node by its URL.
Kind: instance method of ClientBuilder
Param | Type |
---|---|
url | string |
clientBuilder.primaryNode(url, jwt, username, password) ⇒ ClientBuilder
Adds an IOTA node by its URL to be used as primary node, with optional jwt and or basic authentication
Kind: instance method of ClientBuilder
Param | Type |
---|---|
url | string |
jwt | string | undefined |
username | string | undefined |
password | string | undefined |
clientBuilder.primaryPowNode(url, jwt, username, password) ⇒ ClientBuilder
Adds an IOTA node by its URL to be used as primary PoW node (for remote PoW), with optional jwt and or basic authentication
Kind: instance method of ClientBuilder
Param | Type |
---|---|
url | string |
jwt | string | undefined |
username | string | undefined |
password | string | undefined |
clientBuilder.permanode(url, jwt, username, password) ⇒ ClientBuilder
Adds a permanode by its URL, with optional jwt and or basic authentication
Kind: instance method of ClientBuilder
Param | Type |
---|---|
url | string |
jwt | string | undefined |
username | string | undefined |
password | string | undefined |
clientBuilder.nodeAuth(url, jwt, username, password) ⇒ ClientBuilder
Adds an IOTA node by its URL with optional jwt and or basic authentication
Kind: instance method of ClientBuilder
Param | Type |
---|---|
url | string |
jwt | string | undefined |
username | string | undefined |
password | string | undefined |
clientBuilder.nodes(urls) ⇒ ClientBuilder
Adds a list of IOTA nodes by their URLs.
Kind: instance method of ClientBuilder
Param | Type |
---|---|
urls | any |
clientBuilder.nodeSyncInterval(value) ⇒ ClientBuilder
Set the node sync interval (has no effect because we can't spawn another thread in wasm to sync the nodes)
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | number |
clientBuilder.nodeSyncDisabled() ⇒ ClientBuilder
Disables the node syncing process. Every node will be considered healthy and ready to use.
Kind: instance method of ClientBuilder
clientBuilder.offlineMode() ⇒ ClientBuilder
Allows creating the client without nodes for offline address generation or signing
Kind: instance method of ClientBuilder
clientBuilder.nodePoolUrls(node_pool_urls) ⇒ Promise.<any>
Get node list from the node_pool_urls
Kind: instance method of ClientBuilder
Param | Type |
---|---|
node_pool_urls | any |
clientBuilder.quorum(value) ⇒ ClientBuilder
Set if quroum should be used or not
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | boolean |
clientBuilder.quorumSize(value) ⇒ ClientBuilder
Set amount of nodes which should be used for quorum
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | number |
clientBuilder.quorumThreshold(value) ⇒ ClientBuilder
Set quorum_threshold
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | number |
clientBuilder.network(network) ⇒ ClientBuilder
Selects the type of network to get default nodes for it, only "devnet" is supported at the moment. Nodes that don't belong to this network are ignored. Default nodes are only used when no other nodes are provided.
Kind: instance method of ClientBuilder
Param | Type |
---|---|
network | string |
clientBuilder.localPow(value) ⇒ ClientBuilder
Since we can only have a single thread in wasm, local PoW is much slower
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | boolean |
clientBuilder.tipsInterval(value) ⇒ ClientBuilder
Sets after how many seconds new tips will be requested during PoW
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | number |
clientBuilder.requestTimeout(value) ⇒ ClientBuilder
Sets the default request timeout.
Kind: instance method of ClientBuilder
Param | Type |
---|---|
value | number |
clientBuilder.apiTimeout(api, timeout) ⇒ ClientBuilder
Sets the request timeout for a specific API usage.
Kind: instance method of ClientBuilder
Param | Type |
---|---|
api | string |
timeout | number |
clientBuilder.build() ⇒ Promise.<any>
Build the client.
Kind: instance method of ClientBuilder
GetAddressBuilder
Kind: global class
- GetAddressBuilder
- instance
- .balance(address) ⇒
Promise.<any>
- .outputs(address, options) ⇒
Promise.<any>
- .balance(address) ⇒
- static
- instance
getAddressBuilder.balance(address) ⇒ Promise.<any>
Consume the builder and get the balance of a given Bech32 encoded address. If count equals maxResults, then there might be more outputs available but those were skipped for performance reasons. User should sweep the address to reduce the amount of outputs.
Kind: instance method of GetAddressBuilder
Param | Type |
---|---|
address | string |
getAddressBuilder.outputs(address, options) ⇒ Promise.<any>
Consume the builder and get all outputs that use a given address. If count equals maxResults, then there might be more outputs available but those were skipped for performance reasons. User should sweep the address to reduce the amount of outputs.
Kind: instance method of GetAddressBuilder
Param | Type |
---|---|
address | string |
options | any |
GetAddressBuilder.new(client) ⇒ GetAddressBuilder
Kind: static method of GetAddressBuilder
Param | Type |
---|---|
client | Client |
MessageBuilder
Kind: global class
- MessageBuilder
- instance
- .index(index) ⇒
MessageBuilder
- .data(data) ⇒
MessageBuilder
- .seed(seed) ⇒
MessageBuilder
- .accountIndex(account_index) ⇒
MessageBuilder
- .initialAddressIndex(initial_address_index) ⇒
MessageBuilder
- .parents(parents) ⇒
MessageBuilder
- .input(output_id) ⇒
MessageBuilder
- .inputRange(start, end) ⇒
MessageBuilder
- .output(address, amount) ⇒
MessageBuilder
- .dustAllowanceOutput(address, amount) ⇒
MessageBuilder
- .prepareTransaction() ⇒
Promise.<any>
- .signTransaction(prepared_transaction_data, seed, input_range_start, input_range_end) ⇒
Promise.<any>
- .finishMessage(payload) ⇒
Promise.<any>
- .submit() ⇒
Promise.<any>
- .index(index) ⇒
- static
- instance
messageBuilder.index(index) ⇒ MessageBuilder
Set indexation to the builder
Kind: instance method of MessageBuilder
Param | Type |
---|---|
index | Uint8Array |
messageBuilder.data(data) ⇒ MessageBuilder
Set data to the builder
Kind: instance method of MessageBuilder
Param | Type |
---|---|
data | Uint8Array |
messageBuilder.seed(seed) ⇒ MessageBuilder
Sets the seed.
Kind: instance method of MessageBuilder
Param | Type |
---|---|
seed | string |
messageBuilder.accountIndex(account_index) ⇒ MessageBuilder
Sets the account index.
Kind: instance method of MessageBuilder
Param | Type |
---|---|
account_index | number |
messageBuilder.initialAddressIndex(initial_address_index) ⇒ MessageBuilder
Sets the index of the address to start looking for balance.
Kind: instance method of MessageBuilder
Param | Type |
---|---|
initial_address_index | number |
messageBuilder.parents(parents) ⇒ MessageBuilder
Set 1-8 custom parent message ids
Kind: instance method of MessageBuilder
Param | Type |
---|---|
parents | any |
messageBuilder.input(output_id) ⇒ MessageBuilder
Set a custom input(transaction output)
Kind: instance method of MessageBuilder
Param | Type |
---|---|
output_id | string |
messageBuilder.inputRange(start, end) ⇒ MessageBuilder
Set a custom range in which to search for addresses for custom provided inputs. Default: 0..100
Kind: instance method of MessageBuilder
Param | Type |
---|---|
start | number |
end | number |
messageBuilder.output(address, amount) ⇒ MessageBuilder
Set a transfer to the builder
Kind: instance method of MessageBuilder
Param | Type |
---|---|
address | string |
amount | BigInt |
messageBuilder.dustAllowanceOutput(address, amount) ⇒ MessageBuilder
Set a dust allowance transfer to the builder, address needs to be Bech32 encoded
Kind: instance method of MessageBuilder
Param | Type |
---|---|
address | string |
amount | BigInt |
messageBuilder.prepareTransaction() ⇒ Promise.<any>
Prepare a transaction
Kind: instance method of MessageBuilder
messageBuilder.signTransaction(prepared_transaction_data, seed, input_range_start, input_range_end) ⇒ Promise.<any>
Sign a transaction
Kind: instance method of MessageBuilder
Param | Type |
---|---|
prepared_transaction_data | any |
seed | string |
input_range_start | number | undefined |
input_range_end | number | undefined |
messageBuilder.finishMessage(payload) ⇒ Promise.<any>
Create a message with a provided payload
Kind: instance method of MessageBuilder
Param | Type |
---|---|
payload | any |
messageBuilder.submit() ⇒ Promise.<any>
Build and sumbit the message.
Kind: instance method of MessageBuilder
MessageBuilder.new(client) ⇒ MessageBuilder
Kind: static method of MessageBuilder
Param | Type |
---|---|
client | Client |
MessageGetter
Kind: global class
- MessageGetter
- instance
- .index(index) ⇒
Promise.<any>
- .data(message_id) ⇒
Promise.<any>
- .raw(message_id) ⇒
Promise.<any>
- .children(message_id) ⇒
Promise.<any>
- .metadata(message_id) ⇒
Promise.<any>
- .index(index) ⇒
- static
- instance
messageGetter.index(index) ⇒ Promise.<any>
Get message ids with an index.
Kind: instance method of MessageGetter
Param | Type |
---|---|
index | Uint8Array |
messageGetter.data(message_id) ⇒ Promise.<any>
Get a message with the message id.
Kind: instance method of MessageGetter
Param | Type |
---|---|
message_id | string |
messageGetter.raw(message_id) ⇒ Promise.<any>
Get the raw message with the message id.
Kind: instance method of MessageGetter
Param | Type |
---|---|
message_id | string |
messageGetter.children(message_id) ⇒ Promise.<any>
Get the childrens of a message with the message id.
Kind: instance method of MessageGetter
Param | Type |
---|---|
message_id | string |
messageGetter.metadata(message_id) ⇒ Promise.<any>
Get the metadata of a message with the message id.
Kind: instance method of MessageGetter
Param | Type |
---|---|
message_id | string |
MessageGetter.new(client) ⇒ MessageGetter
Kind: static method of MessageGetter
Param | Type |
---|---|
client | Client |
UnspentAddressGetter
Kind: global class
- UnspentAddressGetter
- instance
- static
unspentAddressGetter.accountIndex(index) ⇒ UnspentAddressGetter
Sets the account index
Kind: instance method of UnspentAddressGetter
Param | Type |
---|---|
index | number |
unspentAddressGetter.initialAddressIndex(index) ⇒ UnspentAddressGetter
Sets the index of the address to start looking for balance
Kind: instance method of UnspentAddressGetter
Param | Type |
---|---|
index | number |
unspentAddressGetter.get() ⇒ Promise.<any>
Get an unspent address with its index.
Kind: instance method of UnspentAddressGetter
UnspentAddressGetter.new(client, seed) ⇒ UnspentAddressGetter
Kind: static method of UnspentAddressGetter
Param | Type |
---|---|
client | Client |
seed | string |
start()
Initializes the console error panic hook for better error messages
Kind: global function