Embedded Wallets
How to
Wallet Operation
Send Token

Send Token

API Documentation: Send Token

Overview

This API endpoint allows you to send token from a blockchain network

  • HTTP Method: POST
  • Endpoint: /api/<VERSION>/wallet/send-token

Request Body Parameters

  • to (required): Recipient wallet address.
  • amount (required): Amount to send in decimal units (e.g., 0.123 WETH).
  • network (required if chainId empty): The network used for transactions. You can see Networks Reference to get the network code.
  • chainId (required if network empty): The chain ID of the network used for transactions.
  • tokenAddress (required): Address of the token user want to send.
  • nonce (optional): The number used once to prevent duplicate transactions (this will be calculated automatically if not provided).
  • gasPrice (optional): Gas price in Wei (this will be calculated automatically if not provided).
  • gasLimit (optional): Gas limit for single transaction, transaction will be reverted if actual gas consumption is higher than gas limit (this will be calculated automatically if not provided).
  • maxFeePerGas (optional): Maximum fee per gas provided (this will be calculated automatically if not provided).
  • maxPriorityFeePerGas (optional): Maximum priority fee per gas you are willing to pay, this only used in EIP1559 support blockchain

Example Request Body

{
    "to": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964",
    "amount": "10",
    "network": "ethereum",
    "chainId": "1",
    "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}

Request

Request Headers

  • Authorization (required): JWT token which was generated when user login and do not have an MPC wallet.
  • x-client-secret (required): Client secret which was generated when register in Xellar Embedded Wallet API Service Dashboard.

Example Request Syntax

curl -X POST -H "Content-Type: application/json" -H "x-client-secret: $YOUR_CLIENT_SECRET" -H "Authorization: Bearer $YOUR_ACCESS_TOKEN" -d '{
    "to": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964",
    "amount": "10",
    "network": "ethereum",
    "chainId": "1",
    "tokenAddress": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
}' <BASE_URL>/api/<VERSION>/wallet/send-token

Response

The response will include a JSON object with the following properties:

  • status (number): The HTTP status code of the response (e.g., 200 for success).
  • message (string): A message providing additional information about the operation.
  • data (object): An object containing the transaction receipt data.

Example Response

{
    "status": 200,
    "message": "Send Token is processing",
    "data": {
        "txReceipt": {
            "_type": "TransactionReceipt",
            "accessList": null,
            "blockNumber": null,
            "blockHash": null,
            "chainId": "1",
            "data": "0xa9059cbb000000000000000000000000bfe64b4b628e0998a03e2522b051cf1b4661c9640000000000000000000000000000000000000000000000008ac7230489e80000",
            "from": "0xBfE64B4b628E0998A03e2522B051Cf1B4661c964",
            "gasLimit": "51580",
            "gasPrice": "10000000000",
            "hash": "0x6cfad4fd9f3aae8e3c3d9e79f3bee3c4b467086a995a1bfd20c7a821a32365cb",
            "maxFeePerGas": null,
            "maxPriorityFeePerGas": null,
            "nonce": 1,
            "signature": {
                "_type": "signature",
                "networkV": "229",
                "r": "0x7e0f60d0d2c7e71a707212ecb74744252e799aed281a6849fe227256dafefb38",
                "s": "0x58f5cebba1142015b5f92d5124d49b15126e00a5f210b2780418e75c79b041dc",
                "v": 27
            },
            "to": "0x9B9ef330B204bf33316FAf24E3Ed4FfCf57F02C3",
            "type": 0,
            "value": "0"
        }
    }
}