Skip to Content
SDK & CLISDKBalances

Balances

Instantly set or increase native and ERC20 balances on any Stagenet account.

Use these methods to fund test wallets, move an account into a specific balance state, or prepare addresses for scripted transactions.

There are two types of balance helpers:

  • add* methods increase the current balance.
  • set* methods replace the current balance.

Amounts are always in base units: wei for native tokens, and the token’s smallest unit for ERC20s. Each method accepts string, bigint, or number.

Native balance

stagenet.addBalance(address, amount)

Adds native tokens to an account.

const alice = "0x1111111111111111111111111111111111111111"; await stagenet.addBalance(alice, 10n ** 18n); // +1 ETH

Returns { success, address, newBalance }. newBalance is the post-update balance in wei, returned as a string.

stagenet.setBalance(address, amount)

Overwrites an account’s native balance.

await stagenet.setBalance(alice, 0n); // wipe await stagenet.setBalance(alice, 5n * 10n ** 18n); // exactly 5 ETH

Same return shape as addBalance.

ERC20 balance

stagenet.addERC20Balance(address, tokenAddress, amount)

Adds ERC20 tokens to an account.

const usdc = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"; await stagenet.addERC20Balance(alice, usdc, 1_000_000n); // +1 USDC (6 decimals)

Returns { success, tokenAddress, address, newBalance }.

stagenet.setERC20Balance(address, tokenAddress, amount)

Overwrites an account’s ERC20 balance.

await stagenet.setERC20Balance(alice, usdc, 0n);

Same return shape as addERC20Balance.

Notes

  • The token’s totalSupply is not adjusted. If your code reads totalSupply (e.g. for share-price math), set it explicitly with setStorageAt.
  • ERC20s with non-standard balanceOf layouts (e.g. rebasing tokens, custom storage layouts) may not be writable through these helpers. In that case, write the slot directly.
Last updated on