Open yangyile1990 opened 1 year ago
how to get the "type": "syncNative"
like this:
{
"jsonrpc": "2.0",
"result": {
"blockTime": 1675358593,
"meta": {
"err": null,
"fee": 5000,
"innerInstructions": [],
"logMessages": [
"Program 11111111111111111111111111111111 invoke [1]",
"Program 11111111111111111111111111111111 success",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
"Program log: Instruction: SyncNative",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3045 of 400000 compute units",
"Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
],
"postBalances": [
16312840,
1444044870,
1,
934087680
],
"postTokenBalances": [
{
"accountIndex": 1,
"mint": "So11111111111111111111111111111111111111112",
"owner": "5wp1KskystsYK8iU7V2W9eAC6XKwuvggMB8pVsJM33CX",
"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"uiTokenAmount": {
"amount": "1442005590",
"decimals": 9,
"uiAmount": 1.44200559,
"uiAmountString": "1.44200559"
}
}
],
"preBalances": [
537186943,
923175767,
1,
934087680
],
"preTokenBalances": [
{
"accountIndex": 1,
"mint": "So11111111111111111111111111111111111111112",
"owner": "5wp1KskystsYK8iU7V2W9eAC6XKwuvggMB8pVsJM33CX",
"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"uiTokenAmount": {
"amount": "921136487",
"decimals": 9,
"uiAmount": 0.921136487,
"uiAmountString": "0.921136487"
}
}
],
"rewards": [],
"status": {
"Ok": null
}
},
"slot": 175687414,
"transaction": {
"message": {
"accountKeys": [
{
"pubkey": "5wp1KskystsYK8iU7V2W9eAC6XKwuvggMB8pVsJM33CX",
"signer": true,
"source": "transaction",
"writable": true
},
{
"pubkey": "3g7AbGhgZr2Xb43MQuJnrQLoH8HefrUMrM6LcQa93dEG",
"signer": false,
"source": "transaction",
"writable": true
},
{
"pubkey": "11111111111111111111111111111111",
"signer": false,
"source": "transaction",
"writable": false
},
{
"pubkey": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
"signer": false,
"source": "transaction",
"writable": false
}
],
"addressTableLookups": null,
"instructions": [
{
"parsed": {
"info": {
"destination": "3g7AbGhgZr2Xb43MQuJnrQLoH8HefrUMrM6LcQa93dEG",
"lamports": 520869103,
"source": "5wp1KskystsYK8iU7V2W9eAC6XKwuvggMB8pVsJM33CX"
},
"type": "transfer"
},
"program": "system",
"programId": "11111111111111111111111111111111"
},
{
"parsed": {
"info": {
"account": "3g7AbGhgZr2Xb43MQuJnrQLoH8HefrUMrM6LcQa93dEG"
},
"type": "syncNative"
},
"program": "spl-token",
"programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
}
],
"recentBlockhash": "ZprqouuSmzbU3cGqsayT3NftzxgW3H91q2W8XW4iQ38"
},
"signatures": [
"3wMPKe86EK4zZEuD6GycPoi3CvWrPBvvwzdLcrLv6JW2FNSq89Re1jhPbSvnw9H54aAMkkeU5F72k21mgAjYwqgB"
]
},
"version": "legacy"
},
"id": "a6202aa5-44e7-4d51-9a0d-acf89f06d3c6"
}
that
"data": "J"
is base64 (base58?) encoded by array.
If you go read the source code of the token program, you will see that syncNative
instruction is number 17, and accepts no parameters:
That means that the parameters to the token program is just the number of the instruction to call, and no other params.
I use
I print the txn:
where why I decode the instructions[1]. I got an error, because I decode the "J" with:
But the program is "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA".
So my question is how to find the instructions[1] as "Token Program: Sync Native"
https://explorer.solana.com/tx/3wMPKe86EK4zZEuD6GycPoi3CvWrPBvvwzdLcrLv6JW2FNSq89Re1jhPbSvnw9H54aAMkkeU5F72k21mgAjYwqgB