Transfer ERC20
Overview
This SDK method allows you to create a user operation for transferring ERC20 tokens from your Account Abstraction account.
Method
xellar.accountAbstraction.create.sendToken({
accountId: string,
tokenAddress: string,
to: string,
amount: string,
});
Parameters
accountId
(required): The ID of your Account Abstraction account.tokenAddress
(required): The address of the ERC20 token contract.to
(required): The recipient's address.amount
(required): The amount of tokens to transfer. Must include decimals (e.g., for 1 USDC with 6 decimals, use "1000000").
Response
The response will include an object with the following properties:
userOpId
(string): The unique identifier of the user operation.hash
(string): The hash of the user operation.validUntil
(number): The timestamp until which the user operation is valid.
Example Response
{
"userOpId": "uop_123456789",
"hash": "0x1234...",
"validUntil": 1234567890
}
⚠️
The user operation must be signed and submitted before the validUntil
timestamp expires.
ℹ️
After creating the user operation, you need to sign it using the
signMessageHash
method and then submit it using the submitUserOp
method.
⚠️
Make sure to include the correct number of decimals in the amount parameter. For example, if you want to transfer 1 USDC (which has 6 decimals), the amount should be "1000000".