Check a Balance
You can use the faucet service to send test tokens to any Chrysalis devnet address.
- Java
- Nodejs
- Python
- Rust
- Wasm
Client.getBalance(seed: String)
Combines Client.getAddresses()
and
Client.getAddressBalance()
api calls. It returns a combined balance for the provided seed
.
Client.getAddressBalance(address: String)
Expects a single address in Bech32 format and returns dict
with a balance for the address.
Client.getAddressBalances(addresses: String[])
A convenient function that expects list
of addresses in Bech32 format and returns list of dict
with balances for all
given addresses.
Client.getAddress().balance(address: String)
You can use the GetAdressBuilder
on a Client
instance and
query for and addresses' balances by chaining a call to the balance(address: String)
function.
Client.getAddress().outputs(address: String, options: OutputOptions)
You can use the GetAdressBuilder
on a Client
instance and
query for and addresses' balances by chaining a call to the outputs(address: String)
function.
loading...
Example output:
Account balance: 1096055332i
The balance of "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r" is 451055332i
The outputs of address "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r" are: [
UtxoInput(741673db85f78ebd95d04b572d1bf32e9207bbd265d90dbbe499a6d32f2b25470000),
UtxoInput(ed33089c623c67eb06dbc1c10b0c1c0424b0ace04a2e44070702668b3de440c80000),
UtxoInput(0af84c860dc461730064e7c4c88152ed8bea1ae72b1d6f5e4ab0c3e51ed185b70100),
...]
dustAllowed
indicates whether the given address is allowed to accept a dust. You can learn more about dust protection in the Chrysalis documentation.
There are three common API calls you can use to get a balance:
Client.getAddressBalance(address: string)
It expects a single address in Bech32 format and returns dict
with a balance for the address.
Client.getAddressBalances(AddressBalance[]: string[])
A convenient function that expects list
of addresses in Bech32 format and returns list of dict
with balances for all
given addresses.
Client.getBalance(seed: string)
A convenient helper BalanceGetter
class that combines
Client.getAddresses()
and
Client.getAddressBalance()
api calls. It returns a combined balance for the provided seed
and optional chaining
calls .accountIndex(index: number)
,
.initialAddressIndex(index: number)
and
.gapLimit(amount: number)
.
Client.getBalance(seed)
performs several tasks under the hood. It starts by generating addresses for the provided
seed
and .accountIndex
from .initialAddressIndex(index)
, and checks for a balance of each of the generated
addresses. Since it does not know how many addresses are used in fact, there is a condition set by the
.gapLimit(amount)
argument to know when to stop searching. If the .gapLimit
amount of addresses in a row have no
balance, the function returns results and searching does not continue.
loading...
Example of output:
{
"address":"atoi1qp9427varyc05py79ajku89xarfgkj74tpel5egr9y7xu3wpfc4lkpx0l86",
"balance":10000000,
"dustAllowed":false
}
Account balance: 0
dustAllowed
indicates whether the given address is allowed to accept a dust. You can learn more about dust protection in the Chrysalis documentation.
There are three common API calls you can use to get a balance:
Client.get_address_balance(address: str)
Expects a single address in Bech32 format and returns dict
with a balance for the address.
Client.get_address_balances(addresses: list[str])
:
A convenient function that expects list
of addresses in Bech32 format and returns list of dict
with balances for all given addresses
Client.get_balance(seed, account_index (optional), initial_address_index(optional), gap_limit(optional))
A convenient function that combines Client.get_addresses()
and Client.get_address_balances()
api calls. It returns a combined balance for the provided seed
and optional chaining calls .accountIndex(index)
, .initialAddressIndex(index)
and .gapLimit(amount)
Client.get_balance(seed)
performs several tasks under the hood. It starts by generating addresses for the provided
seed
and account_index
from initial_address_index
, and checks for a balance of each of the generated
addresses. Since it does not know how many addresses are used in fact, there is a condition set by the
gap_limit
argument to know when to stop searching. If the gap_limit
amount of addresses in a row have no
balance, the function returns results and stops searching.
loading...
Example of output:
{
"address":"atoi1qp9427varyc05py79ajku89xarfgkj74tpel5egr9y7xu3wpfc4lkpx0l86",
"balance":10000000,
"dustAllowed":false
}
Account balance: 0
dustAllowed
indicates whether the given address is allowed to accept a dust due to dust protection mechanism.
There are several API calls you can use to get a balance:
Client. get_address_balances(addresses: &[String])
Aconvenient function that expects list
of addresses in Bech32 format and returns list of dict
with balances for all
given addresses.
Client.get_balance(seed: seed: &'a Seed)
A convenient GetBalanceBuilder
class that combines
Client.get_addresses(seed: &'a Seed)
and
Client.get_address_balances(addresses: &[String])
api calls. It returns a combined balance for the provided seed
and optional chaining calls
.with_account_index(account_index: usize)
,
.with_initial_address_index(initial_address_index: usize)
and
.with_gap_limit(gap_limit: usize)
.
Client.get_balance(seed)
performs several tasks under the hood. It starts by generating addresses for the provided
seed
and .account_index
from .with_initial_address_index(account_index)
, and checks for a balance of each of the
generated addresses. Since it does not know how many addresses are used in fact, there is a condition set by the
.with_gap_limit(gap_limit)
argument to know when to stop searching. If the .gap_limit
amount of addresses in a row
have no balance, the function returns results and searching does not continue.
Client.get_address().balance(address: &str)
You can use the GetAdressBuilder
on a Client
instance and query for an addresses' balances by chaining a call to the balance(address: String)
function.
Client.get_address().outputs(address: &str, options: OutputOptions)
You can use the GetAdressBuilder
on a Client
instance and query for an addresses' balances by chaining a call to the outputs(address: String)
function.
loading...
Example of output:
Account balance: 1096055332i
The balance of "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r" is 451055332i
The outputs of address "atoi1qzt0nhsf38nh6rs4p6zs5knqp6psgha9wsv74uajqgjmwc75ugupx3y7x0r" are: [
UtxoInput(741673db85f78ebd95d04b572d1bf32e9207bbd265d90dbbe499a6d32f2b25470000),
UtxoInput(ed33089c623c67eb06dbc1c10b0c1c0424b0ace04a2e44070702668b3de440c80000),
UtxoInput(0af84c860dc461730064e7c4c88152ed8bea1ae72b1d6f5e4ab0c3e51ed185b70100),
...]
dustAllowed
indicates whether the given address is allowed to accept a dust due to dust protection mechanism.
There are two API calls you can use to get a balance:
Client.getAddressBalances(addresses: any)
A convenient function that expects list
of addresses in Bech32 format and returns list of dict
with balances for all
given addresses.
Client.getBalance(seed: string)
A convenient helper BalanceGetter
class that combines
Client.getAddresses(seed: string)
and
Client.getAddressBalances()
api calls. It returns a combined balance for the provided seed
and optional chaining
calls .accountIndex(index)
,
.initialAddressIndex(initial_address_index: number)
and
.gap_limit(amount: number)
Client.getBalance(seed: string)
performs several tasks under the hood. It starts by generating addresses for the
provided seed
and .accountIndex
from
.initialAddressIndex(initial_address_index: number)
,
and checks for a balance of each of the generated addresses. Since it does not know how many addresses are used in fact,
there is a condition set by the
.gap_limit(amount: number)
argument to know when to stop
searching. If the .gap_limit
amount of addresses in a row have no balance, the function returns results and searching
does not continue.
loading...
Example of output:
{
"address":"atoi1qp9427varyc05py79ajku89xarfgkj74tpel5egr9y7xu3wpfc4lkpx0l86",
"balance":10000000,
"dustAllowed":false,
"ledgerIndex": 2338924
}
Account balance: 0
dustAllowed
indicates whether the given address is allowed to accept a dust. You can learn more about dust protection in the Chrysalis documentation.