API Reference

Checking for Transaction Sponsorship

To check whether a swap is sponsorable, first send your unsigned transaction to your RPC endpoint at https://bsc.blinklabs.xyz/v1/<API_KEY> with the following POST request

pm_isSponsorable

{
    "jsonrpc": "2.0",
    "method": "pm_isSponsorable",
    "params": [
        {
          "to": "<TX_TO_ADDRESS>",
          "from": "<TX_FROM_ADDRESS>",
          "value": "<TX_VALUE_HEX>",
          "data": "TX_DATA_HEX>",
          "gas": "<TX_GAS_LIMIT_HEX>"
        }
    ],
    "id": 1
}

Example request:

{
    "jsonrpc": "2.0",
    "method": "pm_isSponsorable",
    "params": [
        {
          "to": "0xb30eC35F98ff1237EDe720D32aC2da7e52A5f56b",
          "from": "0x1234567890b4fa4756b8db7a52e4150e6c18fc2c",
          "value": "0x2386f26fc10000",
          "data": "0x095ea7b3000000000000000000000000111111125421cA6dc452d289314280a0f8842A650000000000000000000000000000000000000000000000000000000000000000",
          "gas": "0x11170"
        }
    ],
    "id": 0
}

Example response:

{
    "id": 0,
    "result": {
        "sponsorable": true,
        "sponsorName": "Blink",
        "sponsorIcon": "https://framerusercontent.com/images/o61GQaQ3nRGkpdVnUD5P3HhDxx0.png",
        "sponsorWebsite": "https://blinklabs.xyz/"
    },
    "jsonrpc": "2.0"
}

If the response returns true, your transaction is sponsorable.

Now it's up to you to set the gas price of the transaction to 0.

You can now submit it even if your simulations fail. Now it's our turn to get the transaction on-chain. Simply submit the signed transaction as you would normally using eth_sendRawTransaction.

Last updated