Embedded Wallets
How to
Wallet Operation
Send Transaction

Send Transaction

API Documentation: Send Transaction

Overview

This API endpoint allows users to send transaction using their MPC wallet.

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

Request Body Parameters

  • 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.
  • transaction (required): Raw transaction data 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

{
    "network": "ethereum",
    "chainId": "1",
    "transaction": {
        "from": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "to": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "data": "0x",
        "nonce": "0x00",
        "gasPrice": "0x1cb3fa334b",
        "gasLimit": "0x5208",
        "value": "0x00"
    }
}

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 '{
    "network": "ethereum",
    "chainId": "1",
    "transaction": {
        "from":"0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "to":"0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
        "data":"0x",
        "nonce":"0x00",
        "gasPrice":"0x1cb3fa334b",
        "gasLimit":"0x5208",
        "value":"0x00"
    }
}' <BASE_URL>/api/<VERSION>/wallet/send-transaction

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 Transaction is processing",
    "data": {
        "txReceipt": {
            "_type": "TransactionReceipt",
            "accessList": null,
            "blockNumber": null,
            "blockHash": null,
            "chainId": "1",
            "data": "0x",
            "from": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
            "gasLimit": "21000",
            "gasPrice": "123278603083",
            "hash": "0x94cb07276ea513abde5d9c8f1bca1986822e9ed176190dd91d29a5c99ed62075",
            "maxFeePerGas": null,
            "maxPriorityFeePerGas": null,
            "nonce": 4,
            "signature": {
                "_type": "signature",
                "networkV": "230",
                "r": "0x862636e954a2f904290499eb206a0b959f2aa6383c4ed66427b057db791fc047",
                "s": "0x674f31a31e935265964d450d070de48a41d914194ff37aa3f22a98c2c2a31ec1",
                "v": 28
            },
            "to": "0x5B3A69CD0984c8621c75c54aa4dCA89e382523A9",
            "type": 0,
            "value": "0"
        }
    }
}