getBalance method

Future<BigInt> getBalance()

Returns a balance of the jetton wallet as a Future

Throws 'ContractProvider field was not initialized' if provider is null

Implementation

Future<BigInt> getBalance() async {
  if (provider == null) {
    throw 'ContractProvider field was not initialized';
  }
  var state = await provider!.getState();
  if (state.state is! CstActive) {
    return BigInt.zero;
  }
  var res = await provider!.get('get_wallet_data', []);
  return res.stack.readBigInt();
}