Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python How to do the data returned by GRPC is compatible with RPC #441

Open
huwentao1 opened this issue Oct 15, 2024 · 1 comment
Open

Comments

@huwentao1
Copy link

huwentao1 commented Oct 15, 2024

What I hope is that the data that can be returned is consistent with the data returned by the rpc request, so that I can better switch to the GRPC node.
This is my filter

transactions_filter = geyser_pb2.SubscribeRequestFilterTransactions(
        vote=False,
        failed=False,
        signature=None,
        account_include=["675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8"],
        account_exclude=[],
        account_required=[],
    )

    # slots_filter = geyser_pb2.SubscribeRequestFilterSlots()
    subscribe_request = geyser_pb2.SubscribeRequest(
        slots={},
        accounts={},
        transactions={"client": transactions_filter},
        transactions_status={"client": transactions_filter},
        entry={},
        blocks={},
        blocks_meta={},
        commitment=None,
        accounts_data_slice=[],
        ping=None,
    )

This is Grpc subscribe return tx data:

transaction {
  transaction {
    signature: "M<\302\270\330#|)\247\322\006\262\033[\370EYG\254%W~\230\320\373s-f[\243\023\267\006\325\302\2749H7a\033rD\341\032>\306\266Q\206\254\350\264\204\337\364H\235\200\200\220\200q\017"
    transaction {
      signatures: "M<\302\270\330#|)\247\322\006\262\033[\370EYG\254%W~\230\320\373s-f[\243\023\267\006\325\302\2749H7a\033rD\341\032>\306\266Q\206\254\350\264\204\337\364H\235\200\200\220\200q\017"
      message {
        header {
          num_required_signatures: 1
          num_readonly_unsigned_accounts: 7
        }
        account_keys: "\006\354\2148\206m8\310\335\311\315D\376;\315\203\342Hp\231\241[\307B'\251\026doV\215\t"
        account_keys: "T\213\302_\231Q\365\232\213\203aP\031\356\2405\234\343\202\021+\252\216#\250.6\020\346~\203,"
        account_keys: "\324\247\314\027\214T\302\244\251}\265\226\006R5m \324\244\360?"\311%^\020\354l\213\001\225I"
        account_keys: "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"
        account_keys: "\003\006Fo\345!\0272\377\354\255\272r\303\233\347\274\214\345\273\305\367\022k,C\233:@\000\000\000"
        account_keys: "\004y\325[\3621\300n\356t\305n\316h\025\007\375\261\262\336\243\364\216Q\002\261\315\242V\274\023\217"
        account_keys: "\006\335\366\341\327e\241\223\331\313\341F\316\353y\254\034\264\205\355_[7\221:\214\365\205~\377\000\251"
        account_keys: "e\247\177\357\310\033\r{?\0215#uD\204\364Y\215\022\373|\315E\213\261]\266V`:\337O"
        account_keys: "\214\227%\217N$\211\361\273=\020)\024\216\r\203\013Z\023\231\332\377\020\204\004\216{\330\333\351\370Y"
        account_keys: "\264?\372'\365\327\366Jt\300\233\037)Xy\336K\t\2536\337\311\335QK2\032\247\263\214\345\350"
        recent_blockhash: "\262c\305\033\261)Kn\032\276\272\200\210\005Jd\201;\353\274\200-\260}.l\237\370\362\200\320\337"
        instructions {
          program_id_index: 4
          data: "\002\373\232\001\000"
        }
        instructions {
          program_id_index: 4
          data: "\003\000\000\000\000\000\000\000\000"
        }
        instructions {
          program_id_index: 3
          accounts: "\000\002"
          data: "\002\000\000\000\360\376\024\006\000\000\000\000"
        }
        instructions {
          program_id_index: 5
          accounts: "\002\000\r\006\003"
          data: "\223\361{d\364\204\256v\377"
        }
        instructions {
          program_id_index: 8
          accounts: "\000\001\000\007\003\006"
          data: "\001"
        }
        instructions {
          program_id_index: 5
          accounts: "\006\000\002\001\005\007\005\t\005\017\006\n\016\n\014\013\n\n\n\n\n\n\n\n\002\001\000"
          data: "\345\027\313\227z\343\255*\001\000\000\000\007d\000\001\000\341\365\005\000\000\000\000\354\215\207\211\036\000\000\000\243\000\000"
        }
        instructions {
          program_id_index: 6
          accounts: "\002\000\000"
          data: "\t"
        }
        versioned: true
        address_table_lookups {
          account_key: "\223\326\r\\213\035\306\342\273\225\375\227\373Q\202dP\037t|\310o\013\217'\027\207ro\253mZ"
          writable_indexes: "204"
          readonly_indexes: "\013\020\016"
        }
      }
    }
    meta {
      fee: 5000
      pre_balances: 256174747
      pre_balances: 0
      pre_balances: 0
      pre_balances: 1
      pre_balances: 1
      pre_balances: 1141440
      pre_balances: 934087680
      pre_balances: 24869638820
      pre_balances: 731913600
      pre_balances: 0
      pre_balances: 6124800
      pre_balances: 2039280
      pre_balances: 219808492510
      pre_balances: 624734779787
      pre_balances: 6161017923
      pre_balances: 1141440
      post_balances: 154130467
      post_balances: 2039280
      post_balances: 0
      post_balances: 1
      post_balances: 1
      post_balances: 1141440
      post_balances: 934087680
      post_balances: 24869638820
      post_balances: 731913600
      post_balances: 0
      post_balances: 6124800
      post_balances: 2039280
      post_balances: 219908492510
      post_balances: 624734779787
      post_balances: 6161017923
      post_balances: 1141440
      inner_instructions {
        index: 3
        instructions {
          program_id_index: 3
          accounts: "\002"
          data: "\010\000\000\000\245\000\000\000\000\000\000\000"
          stack_height: 2
        }
        instructions {
          program_id_index: 3
          accounts: "\002"
          data: "\001\000\000\000\006\335\366\341\327e\241\223\331\313\341F\316\353y\254\034\264\205\355_[7\221:\214\365\205~\377\000\251"
          stack_height: 2
        }
        instructions {
          program_id_index: 6
          accounts: "\002\r"
          data: "\022\006\354\2148\206m8\310\335\311\315D\376;\315\203\342Hp\231\241[\307B'\251\026doV\215\t"
          stack_height: 2
        }
      }
      inner_instructions {
        index: 4
        instructions {
          program_id_index: 6
          accounts: "\007"
          data: "\025\007\000"
          stack_height: 2
        }
        instructions {
          program_id_index: 3
          accounts: "\000\001"
          data: "\000\000\000\000\360\035\037\000\000\000\000\000\245\000\000\000\000\000\000\000\006\335\366\341\327e\241\223\331\313\341F\316\353y\254\034\264\205\355_[7\221:\214\365\205~\377\000\251"
          stack_height: 2
        }
        instructions {
          program_id_index: 6
          accounts: "\001"
          data: "\026"
          stack_height: 2
        }
        instructions {
          program_id_index: 6
          accounts: "\001\007"
          data: "\022\006\354\2148\206m8\310\335\311\315D\376;\315\203\342Hp\231\241[\307B'\251\026doV\215\t"
          stack_height: 2
        }
      }
      inner_instructions {
        index: 5
        instructions {
          program_id_index: 15
          accounts: "\006\n\016\n\014\013\n\n\n\n\n\n\n\n\002\001\000"
          data: "\t\000\341\365\005\000\000\000\000\000\000\000\000\000\000\000\000"
          stack_height: 2
        }
        instructions {
          program_id_index: 6
          accounts: "\002\014\000"
          data: "\003\000\341\365\005\000\000\000\000"
          stack_height: 3
        }
        instructions {
          program_id_index: 6
          accounts: "\013\001\016"
          data: "\003\370&D4\036\000\000\000"
          stack_height: 3
        }
        instructions {
          program_id_index: 5
          accounts: "\t"
          data: "\344E\245.Q\313\232\035@\306\315\350&\010q\342K\331I\3046\002\303? w\220\355\026\243RL\241\271\227\\361!\242\251\014\377\354}\370\266\212\315\006\233\210W\376\253\201\204\373h\177cF\030\3005\332\3049\334\032\353;U\230\240\360\000\000\000\000\001\000\341\365\005\000\000\000\000e\247\177\357\310\033\r{?\0215#uD\204\364Y\215\022\373|\315E\213\261]\266V`:\337O\370&D4\036\000\000\000"
          stack_height: 2
        }
      }
      log_messages: "Program ComputeBudget111111111111111111111111111111 invoke [1]"
      log_messages: "Program ComputeBudget111111111111111111111111111111 success"
      log_messages: "Program ComputeBudget111111111111111111111111111111 invoke [1]"
      log_messages: "Program ComputeBudget111111111111111111111111111111 success"
      log_messages: "Program 11111111111111111111111111111111 invoke [1]"
      log_messages: "Program 11111111111111111111111111111111 success"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 invoke [1]"
      log_messages: "Program 11111111111111111111111111111111 invoke [2]"
      log_messages: "Program 11111111111111111111111111111111 success"
      log_messages: "Program 11111111111111111111111111111111 invoke [2]"
      log_messages: "Program 11111111111111111111111111111111 success"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]"
      log_messages: "Program log: Instruction: InitializeAccount3"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3158 of 97077 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 consumed 11005 of 104761 compute units"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 success"
      log_messages: "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]"
      log_messages: "Program log: CreateIdempotent"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]"
      log_messages: "Program log: Instruction: GetAccountDataSize"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1569 of 86851 compute units"
      log_messages: "Program return: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA pQAAAAAAAAA="
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program 11111111111111111111111111111111 invoke [2]"
      log_messages: "Program 11111111111111111111111111111111 success"
      log_messages: "Program log: Initialize the associated token account"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]"
      log_messages: "Program log: Instruction: InitializeImmutableOwner"
      log_messages: "Program log: Please upgrade to SPL Token 2022 for immutable owner support"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1405 of 80264 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]"
      log_messages: "Program log: Instruction: InitializeAccount3"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4188 of 76382 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 21845 of 93756 compute units"
      log_messages: "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 invoke [1]"
      log_messages: "Program log: Instruction: Route"
      log_messages: "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 invoke [2]"
      log_messages: "Program log: ray_log: AwDh9QUAAAAAAAAAAAAAAAACAAAAAAAAAADh9QUAAAAA7k18LTMAAADMh/BMGwQBAPgmRDQeAAAA"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]"
      log_messages: "Program log: Instruction: Transfer"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4736 of 41355 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [3]"
      log_messages: "Program log: Instruction: Transfer"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 4645 of 33638 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      log_messages: "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 consumed 29661 of 57799 compute units"
      log_messages: "Program 675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8 success"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 invoke [2]"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 consumed 471 of 25764 compute units"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 success"
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 consumed 48753 of 71911 compute units"
      log_messages: "Program return: JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 +CZENB4AAAA="
      log_messages: "Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 success"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]"
      log_messages: "Program log: Instruction: CloseAccount"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2915 of 23158 compute units"
      log_messages: "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
      pre_token_balances {
        account_index: 11
        mint: "7qpKH1bkvoZPDGbtmjHa9opCGnzfeycD34iuDrJBpump"
        ui_token_amount {
          ui_amount: 285990278.170572
          decimals: 6
          amount: "285990278170572"
          ui_amount_string: "285990278.170572"
        }
        owner: "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"
        program_id: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
      }
      pre_token_balances {
        account_index: 12
        mint: "So11111111111111111111111111111111111111112"
        ui_token_amount {
          ui_amount: 219.80645323
          decimals: 9
          amount: "219806453230"
          ui_amount_string: "219.80645323"
        }
        owner: "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"
        program_id: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
      }
      post_token_balances {
        account_index: 1
        mint: "7qpKH1bkvoZPDGbtmjHa9opCGnzfeycD34iuDrJBpump"
        ui_token_amount {
          ui_amount: 129725.900536
          decimals: 6
          amount: "129725900536"
          ui_amount_string: "129725.900536"
        }
        owner: "U2eiHkeN2Yg8FGsyZGcL3mMVRFfFTrfpCQTDBPA1Pmi"
        program_id: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
      }
      post_token_balances {
        account_index: 11
        mint: "7qpKH1bkvoZPDGbtmjHa9opCGnzfeycD34iuDrJBpump"
        ui_token_amount {
          ui_amount: 285860552.270036
          decimals: 6
          amount: "285860552270036"
          ui_amount_string: "285860552.270036"
        }
        owner: "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"
        program_id: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
      }
      post_token_balances {
        account_index: 12
        mint: "So11111111111111111111111111111111111111112"
        ui_token_amount {
          ui_amount: 219.90645323
          decimals: 9
          amount: "219906453230"
          ui_amount_string: "219.90645323"
        }
        owner: "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1"
        program_id: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
      }
      loaded_writable_addresses: "3_\324"y\346\033\263\023P\364\342\204\357\000Q\260\360\205a\325.*f\323\377j\354\2660\333\333"
      loaded_writable_addresses: "\260\356"o\277\344\371\0236\252\247E\3168\353\336\364\311\2418\2751\343\225\365\356HC\251\211\257""
      loaded_writable_addresses: "\316y>\367\205zg"\2128\276\211\234:\240\244$\345,OU\324\275\214\231\325\351\223{\336\371\031"
      loaded_readonly_addresses: "\006\233\210W\376\253\201\204\373h\177cF\030\3005\332\3049\334\032\353;U\230\240\360\000\000\000\000\001"
      loaded_readonly_addresses: "AW\260X\0171\305\374\344JbX-\274\371\327\216\347YC\240\204\243\223\263P6\215"\211\223\010"
      loaded_readonly_addresses: "K\331I\3046\002\303? w\220\355\026\243RL\241\271\227\\361!\242\251\014\377\354}\370\266\212\315"
      return_data_none: true
      compute_units_consumed: 84968
    }
    index: 529
  }
  slot: 295718624
}

This is rpc return data format

{
                "meta": {
                    "computeUnitsConsumed": 2100,
                    "err": null,
                    "fee": 5000,
                    "innerInstructions": [],
                    "logMessages": [
                        "Program Vote111111111111111111111111111111111111111 invoke [1]",
                        "Program Vote111111111111111111111111111111111111111 success"
                    ],
                    "postBalances": [
                        75885905600,
                        27130412,
                        1
                    ],
                    "postTokenBalances": [],
                    "preBalances": [
                        75885910600,
                        27130412,
                        1
                    ],
                    "preTokenBalances": [],
                    "rewards": [],
                    "status": {
                        "Ok": null
                    }
                },
                "transaction": {
                    "message": {
                        "accountKeys": [
                            {
                                "pubkey": "LUM3Nz4NnP3QVKiTUrZi4T1wnCAwkN1oo52WUNyxuwW",
                                "signer": true,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "LUM3Ur6VsoBygnLvmU1JjBKJCwFFs21iuohgjwQj8JV",
                                "signer": false,
                                "source": "transaction",
                                "writable": true
                            },
                            {
                                "pubkey": "Vote111111111111111111111111111111111111111",
                                "signer": false,
                                "source": "transaction",
                                "writable": false
                            }
                        ],
                        "instructions": [
                            {
                                "parsed": {
                                    "info": {
                                        "voteAccount": "LUM3Ur6VsoBygnLvmU1JjBKJCwFFs21iuohgjwQj8JV",
                                        "voteAuthority": "LUM3Nz4NnP3QVKiTUrZi4T1wnCAwkN1oo52WUNyxuwW",
                                        "voteStateUpdate": {
                                            "hash": "FTeNFchotePaiHzrCdP187HZVEQvXoAMFoDbh6GzsB2",
                                            "lockouts": [
                                                {
                                                    "confirmation_count": 31,
                                                    "slot": 281858168
                                                },
                                                {
                                                    "confirmation_count": 30,
                                                    "slot": 281858169
                                                },
                                                {
                                                    "confirmation_count": 29,
                                                    "slot": 281858170
                                                },
                                                {
                                                    "confirmation_count": 28,
                                                    "slot": 281858171
                                                },
                                                {
                                                    "confirmation_count": 27,
                                                    "slot": 281858172
                                                },
                                                {
                                                    "confirmation_count": 26,
                                                    "slot": 281858173
                                                },
                                                {
                                                    "confirmation_count": 25,
                                                    "slot": 281858174
                                                },
                                                {
                                                    "confirmation_count": 24,
                                                    "slot": 281858175
                                                },
                                                {
                                                    "confirmation_count": 23,
                                                    "slot": 281858176
                                                },
                                                {
                                                    "confirmation_count": 22,
                                                    "slot": 281858177
                                                },
                                                {
                                                    "confirmation_count": 21,
                                                    "slot": 281858178
                                                },
                                                {
                                                    "confirmation_count": 20,
                                                    "slot": 281858179
                                                },
                                                {
                                                    "confirmation_count": 19,
                                                    "slot": 281858180
                                                },
                                                {
                                                    "confirmation_count": 18,
                                                    "slot": 281858181
                                                },
                                                {
                                                    "confirmation_count": 17,
                                                    "slot": 281858182
                                                },
                                                {
                                                    "confirmation_count": 16,
                                                    "slot": 281858183
                                                },
                                                {
                                                    "confirmation_count": 15,
                                                    "slot": 281858184
                                                },
                                                {
                                                    "confirmation_count": 14,
                                                    "slot": 281858185
                                                },
                                                {
                                                    "confirmation_count": 13,
                                                    "slot": 281858186
                                                },
                                                {
                                                    "confirmation_count": 12,
                                                    "slot": 281858187
                                                },
                                                {
                                                    "confirmation_count": 11,
                                                    "slot": 281858188
                                                },
                                                {
                                                    "confirmation_count": 10,
                                                    "slot": 281858189
                                                },
                                                {
                                                    "confirmation_count": 9,
                                                    "slot": 281858190
                                                },
                                                {
                                                    "confirmation_count": 8,
                                                    "slot": 281858191
                                                },
                                                {
                                                    "confirmation_count": 7,
                                                    "slot": 281858192
                                                },
                                                {
                                                    "confirmation_count": 6,
                                                    "slot": 281858193
                                                },
                                                {
                                                    "confirmation_count": 5,
                                                    "slot": 281858194
                                                },
                                                {
                                                    "confirmation_count": 4,
                                                    "slot": 281858195
                                                },
                                                {
                                                    "confirmation_count": 3,
                                                    "slot": 281858196
                                                },
                                                {
                                                    "confirmation_count": 2,
                                                    "slot": 281858197
                                                },
                                                {
                                                    "confirmation_count": 1,
                                                    "slot": 281858198
                                                }
                                            ],
                                            "root": 281858167,
                                            "timestamp": 1722926251
                                        }
                                    },
                                    "type": "compactupdatevotestate"
                                },
                                "program": "vote",
                                "programId": "Vote111111111111111111111111111111111111111",
                                "stackHeight": null
                            }
                        ],
                        "recentBlockhash": "8Aoim2N6e42E3iuJzcShrD3b64TVeLS3ppyeaAvqGJNt"
                    },
                    "signatures": [
                        "3nWNiA8DQuZt2JvToZc2KgtZrtfao64Fs3XNBQyzZ5o3i1YzJ7VyTmtKRJmbxmgaEGcZw9sozAinqGsSiZkGGtmv"
                    ]
                },
                "version": "legacy"
            }

Python how to compatible it ?

Python how to compatible it ?
I found can convert grpc output to TransactionWithStatusMeta Object, then encode it, But how to do this, any examples?
And the innerstruction returned by grpc is similar to this data

 "innerInstructions": [
                    {
                        "index": 4,
                        "instructions": [
                            {
                                "programIdIndex": 18,
                                "accounts": "BQMA",
                                "data": "A/ZsVQAAAAAA",
                                "stackHeight": 2,
                            },
                            {
                                "programIdIndex": 18,
                                "accounts": "BgcU",
                                "data": "AxYoAAAAAAAA",
                                "stackHeight": 2,
                            },
                        ],
                    }
                ],

But I see that rpc returns parsed data.

"innerInstructions": [
            {
                "index": 4,
                "instructions": [
                    {
                        "parsed": {
                            "info": {
                                "amount": "5598454",
                                "authority": "2D6PbWPbZgWS55P1hmog4BX5jEAXwzXUKqJuChsXTSUV",
                                "destination": "37A7KbGttTsVPsADXyGstgdWeUWZhBXqVpPnaNjwjGDk",
                                "source": "3jRxy5ezKjHiXAe6q3J9zKtYmPBJgtyonNUtxE1RJtox",
                            },
                            "type": "transfer",
                        },
                        "program": "spl-token",
                        "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                        "stackHeight": 2,
                    },
                    {
                        "parsed": {
                            "info": {
                                "amount": "10262",
                                "authority": "5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1",
                                "destination": "5S4fB19kUcgAWa4pARHNymiMNKz7xDHSMvxZT4E4eQuB",
                                "source": "4jKPzdxJdPWghamCMKtcQUeQyR1RGJT9VCqkN86MfQKR",
                            },
                            "type": "transfer",
                        },
                        "program": "spl-token",
                        "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                        "stackHeight": 2,
                    },
                ],
            }
        ],

What should I do to get the same data format as the rpc interface?

@huwentao1 huwentao1 reopened this Oct 15, 2024
@PUXLBIY
Copy link

PUXLBIY commented Dec 2, 2024

Did you find a solution? I have same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants