Intents
Token Transfer
Learn how to create token transfer operations using the Okto TypeScript SDK.
The tokenTransfer()
function creates a user operation for transferring tokens. This function initiates the process of transferring a token by encoding the necessary parameters into a User Operation, which can then be signed and executed using the OktoClient.
Available on





To enable these chains for your application, please configure them in the Okto Dashboard.
Not available on
There are two ways to implement token transfers:
- Abstracted Flow: A simplified approach where the user operation is automatically created, signed, and executed in a single step. Perfect for most applications.
- UserOp Flow: A granular approach where you manually control the creation, signing, and execution of the user operation. Useful for custom implementations or advanced use cases.
Example
Note
For error handling:
- Use the error code to debug issues. Check out the SDK errors and warnings documentation
- For help, navigate to the troubleshooting guide to contact support
Method Overview
Method | Description |
---|---|
async tokenTransfer | Create a user operation for token transfer |
Token Transfer
async tokenTransfer(oktoClient: OktoClient, data: TokenTransferIntentParams)
creates a user operation for transferring tokens.
Parameters
Parameter | Type | Description | Required |
---|---|---|---|
oktoClient | OktoClient | Instance of OktoClient | Yes |
data | TokenTransferIntentParams | Parameters for the token transfer | Yes |
Where TokenTransferIntentParams
contains:
Field | Type | Description | Required |
---|---|---|---|
amount | number | bigint | Amount to send, in the smallest unit (e.g., gwei for ETH) | Yes |
recipient | Address | Wallet address of the recipient | Yes |
token | Address | '' | The token address for the transaction | Yes |
caip2Id | string | The network ID (e.g., Ethereum - eip155:1, Polygon - eip155:137) | Yes |
Response
Success Response
Field Name | Type | Description |
---|---|---|
result | Promise<string> | Returns the jobId for the token transfer |