token_transfer
Transfer tokens from the authenticated user to another user.Method Signature
Parameters
TransferRequest
Field | Type | Required | Description |
---|---|---|---|
to | string | Yes | The recipient’s address or principal |
tokenid | string | Yes | The token identifier to transfer |
amount | TokenAmount | Yes | Amount of tokens to transfer (bigint) |
Response
TransferResponse
- Success:
{ ok: null }
- Transfer completed successfully - Error:
{ err: string }
- Error message describing what went wrong
Example Usage
Common Errors
- Insufficient balance: Not enough tokens in sender’s account
- Invalid recipient: Recipient address/principal is invalid
- Token not found: Specified token ID doesn’t exist
- Transfer blocked: Token transfers may be restricted