GUI
GUI provides methods related to chain interactions
Methods
getWalletAddress
Gets the address of the currently injected wallet
Inputs
None
Usage
getEthBalance
Gets the ETH balance of a specific address
Inputs
address
- The address to get the ETH balance of
Usage
getBalance
Gets the balance of a specific token for a specific address
Inputs
token
- The token to get the balance ofaddress
- The address to get the balance of
Usage
getAllowance
Gets the allowance of a specific token for specific owner and spender addresses
Inputs
token
- The token to get the allowance ofownerAddress
- The address of the owner of the tokens to get the allowance forspenderAddress
- The address of the spender of the tokens to get the allowance for
Usage
initializeChain
Spawns a forked network using Foundry's Anvil using a specific chain ID and (optionally) a block number. If you do not specify a block number, the test will run at the current block.
Inputs
chainId
- The network chain ID to forkforkBlockNumber
- The block number to fork from (optional)
Usage
setAllowance
Sets the allowance of an address to spend the test wallet's ERC20 tokens to a specific amount.
Inputs
token
- The designated token address for balance allocation (e.g. USDC on Ethereum is 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)spenderAddress
- The address to authorize for spending the tokens in the test wallet.amount
- The amount to be approved to be spent by the spender. This needs to have the appropriate number of decimals (i.e. 1 ETH is "1000000000000000000")
Usage
setBalance
Sets an ERC20 token's balance for the test wallet.
Inputs
token
- The designated token address for balance allocation.amount
- The amount of tokens to give the test wallet. This needs to have the appropriate number of decimals (i.e. 1 ETH is "1000000000000000000")
Usage
setEthBalance
Sets the test wallet's ETH balance to a specific amount.
Inputs
amount
- The amount of ETH to give to the test wallet. This needs to have the appropriate number of decimals (i.e. 1 ETH is "1000000000000000000")
Usage
setContractStorageSlot
Arbitrarily sets a storage slot on a contract to a specific value.
Inputs
contract
- The contract address to set the storage slot onslot
- The keccak256'd storage slot to setvalue
- The assigned value for the storage slot
Usage
validateContractInteraction
Checks that the eth_sendTransaction
or eth_sendRawTransaction
request following a button click is interacting with the correct contract or providing approval to the correct contract.
Inputs
locator
- The Playwright locator string of the button to clicktargetContract
- The contract address the button should trigger an interaction with
Usage
Last updated