programSubscribe RPCメソッド
指定されたプログラムが所有するアカウントのlamportまたはデータが変更されたときに通知を受け取るためにプログラムをサブスクライブします
{"jsonrpc": "2.0","id": 1,"method": "programSubscribe","params": ["11111111111111111111111111111111",{"encoding": "base64","filters": [{ "dataSize": 80 }]}]}
params
stringrequired
program_id
のpubkeyをbase-58でエンコードした文字列
objectoptional
以下のフィールドを含む設定オブジェクト:
result
Response
{"jsonrpc": "2.0","result": 24040,"id": 1}
integer
サブスクリプションID(登録解除に必要)
通知フォーマット
通知フォーマットは、getProgramAccounts RPC HTTPメソッドで見られる単一のprogram accountオブジェクトです。
Base58エンコーディング:
{"jsonrpc": "2.0","method": "programNotification","params": {"result": {"context": {"slot": 5208469},"value": {"pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq","account": {"data": ["11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR","base58"],"executable": false,"lamports": 33594,"owner": "11111111111111111111111111111111","rentEpoch": 636,"space": 80}}},"subscription": 24040}}
Parsed-JSONエンコーディング:
{"jsonrpc": "2.0","method": "programNotification","params": {"result": {"context": {"slot": 5208469},"value": {"pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq","account": {"data": {"program": "nonce","parsed": {"type": "initialized","info": {"authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX","blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k","feeCalculator": {"lamportsPerSignature": 5000}}}},"executable": false,"lamports": 33594,"owner": "11111111111111111111111111111111","rentEpoch": 636,"space": 80}}},"subscription": 24040}}
Is this page helpful?