Check Balance

Check Balance

The balance method retrieves the balance for a specific MNEE address. This method is useful for checking how many MNEE tokens are associated with a given address.

Usage

const address = '1G6CB3Ch4zFkPmuhZzEyChQmrQPfi86qk3';

mnee.balance(address).then(balance => {
  console.log('Your balance:', balance);
});

Response

The method returns a Promise that resolves to a MNEEBalance object, which includes the address and the amount of MNEE tokens.

Sample Response

{
  "address": "1G6CB3Ch4zFkPmuhZzEyChQmrQPfi86qk3",
  "amount": 461163,
  "decimalAmount": 4.61163
}

Check Balances

The balances method retrieves the balances for multiple MNEE addresses in a single call. This is useful for checking the balances of several addresses at once.

Usage

Response

The method returns a Promise that resolves to an array of MNEEBalance objects, each containing the address and the amount of MNEE tokens.

Sample Response

Balance Properties

  • address: The Bitcoin address that was queried

  • amount: The balance in atomic units (100,000 atomic units = 1 MNEE)

  • decimalAmount: The balance in MNEE (human-readable format with decimals)

Common Use Cases

Single Address - Display User Balance

Single Address - Check Sufficient Funds

Multiple Addresses - Calculate Total Balance

Multiple Addresses - Find Funded Addresses

HD Wallet Balance Check

Monitor Balance Changes

Performance Considerations

  • Use balance() for single address queries

  • Use balances() when checking 2 or more addresses (more efficient than multiple balance() calls)

  • For very large sets of addresses (100+), consider using batch operations

Notes

  • The balance is calculated from all UTXOs owned by the address

  • Both amount and decimalAmount represent the same value in different units

  • Empty or invalid addresses will return a balance of 0

  • The order of returned balances matches the order of input addresses

See Also

Last updated