-1

I am trying to write a Scrypto test to test my Radix Scrypto smart contract.

in Scrypto 0.9.0, the "balance" method shown below has been removed from the Account Component.

    let manifest = ManifestBuilder::new()
        .call_method(compo_addr, "balance", manifest_args!(resource_addr))
        .build();

How can I check my account(compo_addr) balance of a given token address(resource_addr) ?

Mikko Ohtamaa
  • 82,057
  • 50
  • 264
  • 435
Russo
  • 2,186
  • 2
  • 26
  • 42

2 Answers2

0

Account component has been removed in favor of TokenAccount component, use it as:

let token_account = ctx.state().get_account(resource_addr)?.get_component::<TokenAccount>()?;
let balance = token_account.get_balance(&compo_addr)?;
Jishan Shaikh
  • 1,572
  • 2
  • 13
  • 31
0
let component_balance: Option<Decimal> = test_runner.account_balance(component_address, resource_address);
Russo
  • 2,186
  • 2
  • 26
  • 42