On-chain account updates, parsed and sent straight to your backend, in real-time.
Overview
In Solana, programs store their data in accounts. There might be some accounts that update quite frequently, instead of continuous polling, you can setup callbacks on them to listen to those changes in real-time.
Also, as a program owner, you need to easily query/filter your accounts data. For this, one needs to poll getProgramAccounts() regularly to create an off-chain replica of your accounts. This is generally very slow and not real-time, leading to discrepancies or out-of-sync data.
With Shyft's Account Callbacks, this becomes super easy. You can register a callback on your program ID (or account addresses your are interested in) and start receiving POST requests to your backend whenever your account data changes.
How to Create Account Callbacks
You can create callbacks programmatically through our APIs, Postman or Swagger UI.
constcreateTensorCNFTAccountCallback=async () => {try {constresponse=awaitfetch("https://api.shyft.to/sol/v1/callback/create", { method:'POST', headers: {'Content-Type':'application/json','x-api-key':'{ YOUR-API-KEY }' }, body:JSON.stringify({"network":"mainnet-beta",//or devnet"addresses": ["TCMPhJdwDryooaGtiocG1u3xcYbRpiJzb283XfCZsDp" ],"callback_url":"YOUR SERVER URL","type":"ACCOUNT",//optional, default is CALLBACK"encoding":"PARSED",//optional, default is raw//For parsed encoding to work, please upload IDL to Translator }), } );constdata=awaitresponse.json();console.log(data); } catch (e) {console.error("callback creation error", e); }}createTensorCNFTAccountCallback ();
Accounts Callback Payload
This is a sample account callback payload for Tensor cNFT program.
You can specify encoding while registering a callback to receive either raw or parsed format.
Upload your IDL on Translator (Shyft's Solana Explorer) to receive parsed account Callbacks.