API Reference
Checking for Transaction Sponsorship
To check whether a swap is sponsorable, first send your unsigned transaction to your RPC endpoint at https://sol.blinklabs.xyz/v1/<API_KEY> with the following POST request
pm_isSponsorable
{
"id": 1,
"jsonrpc": "2.0",
"method": "pm_isSponsorable",
"params": [
"unsigned_transaction_string_base64"
{
"encoding": "base64",
}
]
}Example response:
{
"id": 1,
"result": {
"sponsorable": true,
"sponsorName": "Blink",
"sponsorIcon": "https://framerusercontent.com/images/o61GQaQ3nRGkpdVnUD5P3HhDxx0.png",
"sponsorWebsite": "https://blinklabs.xyz/",
"sponsorWallet": "7czf8vVLjGUaLqn9DBneEz1sNwP3gLx8Usrq3zMctify", // only returned on active sponsorship plan
"activeSponsorTransfer": "5000000" // only returned on active sponsorship plan
},
"jsonrpc": "2.0"
}If the response returns true, your transaction is sponsorable. You're free to submit it even if your simulations fail or the user does not seem to have enough funds. We will do our best to get the transaction on-chain. Alternatively, you can improve those chances by using our active sponsorship. Reach out to [email protected] to get set up on an active sponsorship plan.
Active sponsorship
There is no need to request an active sponsorship as we will detect these automatically. After you have confirmation that your transaction is generally sponsorable, simply append a instruction to the end of your unsigned transaction. This is a basic transfer instruction with an amount (in Lamports) equal to the activeSponsorAmount (0.005 SOL) with the receiving address set to the value returned in the sponsorWallet field. Here is an example typescript code snippet for appending this instruction to an existing unsigned transaction:
Then simply submit this new transaction as you would a passive sponsorship. We guarantee that we will always sponsor the user with more SOL than what is being transferred back to us at the end of the transaction.
Passive Sponsorship
Simply send your signed transaction to your RPC endpoint at https://sol.blinklabs.xyz/v1/<API_KEY> with the following POST request. Make sure that you set the skipPreflight flag to true otherwise the transaction will fail in preflight simulations.
Example:
Last updated