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
  • priorityFee (optional): Priority fee you are willing to pay, this only in Solana network

Example Request Body

EVM Network

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

Solana Network

{
    "network": "solana-devnet",
    "transaction": {
        "feePayer": "sXWc8igtm5hPGXKS7N3iyint4F49FnTb4LKzgrEPYL6",
        "recentBlockhash": "HZ3HuJ76q8De5j5QDsin4eqDwksd2XTqH7qXM7x3vXqw",
        "instructions": [
            {
                "programId": "11111111111111111111111111111111",
                "keys": [
                    {
                        "pubkey": "sXWc8igtm5hPGXKS7N3iyint4F49FnTb4LKzgrEPYL6",
                        "isSigner": true,
                        "isWritable": true
                    },
                    {
                        "pubkey": "E24G7rBLU1Xt1WKTMuC1Cwx46QXY5ZcX797M5JVXq7de",
                        "isSigner": false,
                        "isWritable": true
                    }
                ],
                "data": "3Bxs412MvVNQj175"
            }
        ],
        "partialSignatures": [],
        "transaction": "AQAAAAAAAAAAAAAAAAAAAA...AAQwCAAAAAQAAAAAAAAA=" //Serialized transaction
    }
}

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

EVM Network

{
    "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"
        }
    }
}

Solana Network

{
    "status": 200,
    "message": "Send Transaction is processing",
    "data": {
        "txReceipt": {
            "instructions": [
                {
                    "keys": [
                        {
                            "pubkey": "sXWc8igtm5hPGXKS7N3iyint4F49FnTb4LKzgrEPYL6",
                            "isSigner": true,
                            "isWritable": true
                        },
                        {
                            "pubkey": "2eGsfAk1aov7PGWYmXUNw5T9XpJaSyjHqVMqwF7SZ3Av",
                            "isSigner": false,
                            "isWritable": true
                        }
                    ],
                    "programId": "11111111111111111111111111111111",
                    "data": [2, 0, 0, 0, 168, 7, 15, 0, 0, 0, 0, 0]
                }
            ],
            "recentBlockhash": "GgWcS5eKNVQBD1nhJSwj37pq5TyMVXqVWszYHAP4Sa92",
            "lastValidBlockHeight": 344361913,
            "hash": "5wLwkhNbe4jbShMNak1SJTh7teX3ETGrrXCnpQoitkDJarg8zFzvNQkSXFEvZDmHt3SCUNvc934SUuRtT6XqWiHM"
        }
    }
}