gagliardetto / solana-go

Go SDK library and RPC client for the Solana Blockchain
Apache License 2.0
929 stars 264 forks source link

[HELP] GetBlockWithOpts using GetParsedTransaction not working in the version v1.8.4 #163

Open elvis-hp opened 1 year ago

elvis-hp commented 1 year ago

received the error: "detailedTx.GetParsedTransaction data is not in JSONParsed encoding" Code:

            var maxUint uint64 = 0
            blockInfo, err := e.RpcClient.GetBlockWithOpts(context.Background(), fromBlock, &rpc.GetBlockOpts{
              MaxSupportedTransactionVersion: &maxUint,
            })
            for _, tx := range blockInfo.Transactions {
        txParsed, err := tx.GetParsedTransaction()
        if err != nil {
            fmt.Println("detailedTx.GetParsedTransaction", err)
            continue
        }           
    }
0xvbetsun commented 1 year ago

@elvis-hp This functionality is not fully implemented. BTW, you can log an error instead of ignoring it, maybe it'll help you

blockInfo, err := e.RpcClient.GetBlockWithOpts(context.Background(), fromBlock, &rpc.GetBlockOpts{
    MaxSupportedTransactionVersion: &maxUint,
 })
+if err != nil {
+   log.Fatal(err)
+}

I'll have a couple of free hours this weekend, so I'll try to extend this functionality and add more options for parsing transactions with meta

gagliardetto commented 1 year ago

yep, the jsonParsed format is not implemented.