Wallet API
Get Information Needed for Signing

Get Information Needed for Signing#

Once you have completed the previous steps, you can now attempt to initiate a transaction. Use the POST /api/v5/waas/wallet/pre-transaction/sign-info endpoint to retrieve data required for signing, such as gas price, gas limit, and nonce for EVM chains.

// Define your parameters
// EVM
const postSignInfoBody = {
    chainIndex: '1',
    fromAddr: '0xdf54b6c6195ea4d948d03bfd818d365cf175cfc2',
    toAddr: '0x1e80c39051f078ee34763282cbb36ffd88b40c65',
    txAmount: '123000000000000',
    extJson: {
        inputData: '041bbc6fa102394773c6d8f6d634320773af4'
    }
  };

// Define helper function
const signInfoData = async () => {
    const apiRequestUrl = getRequestUrl(
      apiBaseUrl,
      '/api/v5/waas/wallet/pre-transaction/sign-info'
    );
    return fetch(apiRequestUrl, {
      method: 'post',
      headers: headersParams,
      body: JSON.stringify(postSignInfoBody),
    })
      .then((res) => res.json())
      .then((res) => {
        return res;
      });
  };

const { data: signInfoData } = await signInfoData();

Upon successfully querying the information, you will receive the following response:

// EVM
{
        "code": 0,
        "msg": "success",
        "data": [
            // EVM
            {
                "gasLimit": "21000",
                "nonce": "0",
                "gasPrice": {
                        "normal": "12200500000",
                        "min": "9130000000",
                        "max": "16801000000",
                        "supportEip1559": true,
                        "erc1599Protocol": {
                                "suggestBaseFee": "8630000000",
                                "proposePriorityFee": "550000000",
                                "safePriorityFee": "500000000",
                                "fastPriorityFee": "2130000000",
                                "baseFee": "8630000000"
                        }
                }
            },
        ]
}