API Reference
Checking for Transaction Sponsorship
To check whether a swap is sponsorable, first send your unsigned transaction to your RPC endpoint at https://eth.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.
eth_sendRawTransaction
After calling pm_isSponsorable, send the signed transaction using the RPC method eth_sendRawTransaction.
The only difference compared to a normal API is that you must add the query string parameter, sponsorship=true. The full URL would be:
https://eth.blinklabs.xyz/v1/<API_KEY>?sponsorship=true
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_sendRawTransaction",
"params": [
"0x...",
],
}
Example response;
{
"id": 1,
"jsonrpc": "2.0",
"result": "0x..."
}
Provided that the same transaction data passed to pm_isSponsorable is used in eth_sendRawTransaction, the transaction will be sponsored.
Notes:
We can setup arbitrary sponsorable criteria (e.g. whitelisted contract addresses, max sponsored transactions per user, etc...).
We only sponsor if the transaction does not have enough funds.
It's important that the gasLimit is not set too high compared to the gasUsed. We simulate the transaction and will return false in pm_isSponsorable if the simulated transaction's gasLimit > 1.1 * gasUsed.
Last updated