This guide applies to Avalanche C-Chain or projects using the legacy SmartAccount approach.
For Ethereum, Kaia, and Base networks, refer to the Transaction Fee Sponsorship guide.
API Guide
API Call Guide
1.Check Smart Account Information
Use the Owner EOA and Access Token to call the SmartAccount Info Query.
This request allows you to check the init_code, nonce, and sender address information of the smart account. If the smart account has not been deployed yet, the value of init_code will be filled. Upon sending the UserOperation, the smart account will be deployed.
2.Check Smart Account Execution Data
To generate the calldata for the transaction input field corresponding to UserOperation, call the SmartAccount Init Calldata Query.
For example, to send 0.0001 Ether to the address 0x31BB26934D372024f44FB04BF2E3d37d317DbE0A, you can fill it out as follows:
to: 0x31BB26934D372024f44FB04BF2E3d37d317DbE0A # Recipient address
value: 100000000000000 # in wei
data: 0x # For simple coin transfer, use 0x
Additionally, for executing a smart contract (e.g., sending an NFT), you can fill it out as follows:
to: 0xED5AF388653567Af2F388E6224dC7C4b3241C544 # NFT contract address
value: 0 # in wei
data: 0x23b872dd0000000000000000000000007b8766... # For simple coin transfer, use 0x
3.Calculate Gas Information
To get the gas information required for the smart account transaction, call the UserOperation Gas Info Query. For gas fee sponsorship, integrate a paymaster and call the Paymaster Sponsor Data Query to obtain gas information.
This request will return the preVerificationGas, verificationGasLimit, callGasLimit, maxFeePerGas, and maxPriorityFeePerGas information. The Paymaster Sponsor Data Query will also return the paymasterAndData.
4.Generate the UserOperation Hash to be Signed by the User
Combine the response data from the 1. Check Smart Account Information and 2. Check Smart Account Execution Data steps and call the Owner Signature Digest Hash Query.
If paymaster_and_data is not available, set it to “0x”.
This request will return the digest value that the user needs to sign using personal_sign.
5.Sign and Send UserOperation
The Owner EOA will sign (using personal_sign) the result value returned in the 3. Calculate Gas Information step, and then include the generated signature value to call the UserOperation Send.
At this stage, the smart account transaction will be sent to the network.
6.Check UserOperation Status
Once the transaction is sent, use the result value returned in the 3. Calculate Gas Information step to call the UserOperation Receipt Query. This request allows you to track the processing status of the UserOperation.
UserOperation Field Query APIs
When calling the three APIs listed below, the data for each field must be identical.
When calling the Owner Signature Digest Hash Query, the paymaster_and_data should match the paymaster_and_data when calling the UserOperation Send.
UserOperation Field Query APIs
| Field | API |
|---|---|
| sender | GET /core/evm/v2/erc4337/{address}/address GET /core/evm/v2/erc4337/{address}/info |
| nonce | GET /core/evm/v2/erc4337/{address}/nonce GET /core/evm/v2/erc4337/{address}/info |
| init_code | POST /core/evm/v2/erc4337/calldata/init GET /core/evm/v2/erc4337/{address}/info |
| call_data | POST /core/evm/v2/erc4337/calldata/execute |
| call_gas_limit | POST /core/evm/v2/erc4337/gas/info POST /core/evm/v2/erc4337/paymaster/sponsor |
| verification_gas_limit | POST /core/evm/v2/erc4337/gas/info POST /core/evm/v2/erc4337/paymaster/sponsor |
| pre_verification_gas | POST /core/evm/v2/erc4337/gas/info POST /core/evm/v2/erc4337/paymaster/sponsor |
| max_fee_per_gas | POST /core/evm/v2/erc4337/gas/info POST /core/evm/v2/erc4337/paymaster/sponsor |
| max_priority_fee_per_gas | POST /core/evm/v2/erc4337/gas/info POST /core/evm/v2/erc4337/paymaster/sponsor |
| paymaster_and_data | POST /core/evm/v2/erc4337/paymaster/sponsor |