register_lighter_account_on_anvil
Documentation for eth_defi.lighter.testing.register_lighter_account_on_anvil function.
- register_lighter_account_on_anvil(web3, owner, account_index, zk_lighter='0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7')
Anvil override: forge an L1 Lighter account registration for
owner.Calls bound to the caller’s registered account —
withdrawandchangePubKey— readmasterAccountIndex = validateAndGetAccountIndexFromAddress(msg.sender)and revertAccountIsNotRegisteredif the caller has no account. Registration normally happens off-chain (a Safe signature) plus an L2 state update, which cannot be reproduced on a fork. This writesZkLighter’saddressToAccountIndex[owner] = account_indexmapping slot directly withanvil_setStorageAtso those calls can be exercised end-to-end.- Parameters
web3 (web3.main.Web3) – Web3 connection (Anvil fork).
owner (Union[eth_typing.evm.HexAddress, str]) – Address to register (e.g. the vault’s Safe).
account_index (int) – Lighter account index to assign (must be non-zero and below
MAX_ACCOUNT_INDEX).zk_lighter (Union[eth_typing.evm.HexAddress, str]) – The
ZkLighterL1 contract address.
- Return type
None