gagliardetto / solana-go

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

unable to decode instruction: no known type for type [12 0 225 245 0 0 0 0] #189

Open elvis-hp opened 7 months ago

elvis-hp commented 7 months ago

Hello, how to fix this error:

mcannot decode instruction for TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA program, tx: vfXRWpvaQWAg8DZ4eoKX3ngt6gifm12Lv1XbZ25sNJD888w8YBJw7LQ2kCP3dwUDC62kiThYELmLyzsBG6nQybt: 
unable to decode instruction: no known type for type [12 0 225 245 0 0 0 0]
elvis-hp commented 7 months ago

hello, pls help me!

0xvbetsun commented 7 months ago

hey, @elvis-hp , you can use GetParsedTransaction from this SDK

package main

import (
    "context"

    "github.com/davecgh/go-spew/spew"
    "github.com/gagliardetto/solana-go"
    "github.com/gagliardetto/solana-go/rpc"
)

func main() {
    client := rpc.New(rpc.MainNetBeta.RPC)

    sig := solana.MustSignatureFromBase58("vfXRWpvaQWAg8DZ4eoKX3ngt6gifm12Lv1XbZ25sNJD888w8YBJw7LQ2kCP3dwUDC62kiThYELmLyzsBG6nQybt")

    tx, err := client.GetParsedTransaction(context.TODO(), sig, nil)
    if err != nil {
        panic(err)
    }
    spew.Dump(tx)
}

Output:

(*rpc.GetParsedTransactionResult)(0x14000299900)({
 Slot: (uint64) 258103723,
 BlockTime: (*solana.UnixTimeSeconds)(0x140002c2e88)(2024-04-03 13:03:58 +0300 EEST),
 Transaction: (*rpc.ParsedTransaction)(0x14000292480)({
  Signatures: ([]solana.Signature) (len=1 cap=1) {
   (solana.Signature) (len=64 cap=64) vfXRWpvaQWAg8DZ4eoKX3ngt6gifm12Lv1XbZ25sNJD888w8YBJw7LQ2kCP3dwUDC62kiThYELmLyzsBG6nQybt
  },
  Message: (rpc.ParsedMessage) {
   AccountKeys: ([]rpc.ParsedMessageAccount) (len=5 cap=8) {
    (rpc.ParsedMessageAccount) {
     PublicKey: (solana.PublicKey) (len=32 cap=32) GQWUhXsFMmKW7CDRJGPVaVnY31HZWxDVvDFcvoXvDFtt,
     Signer: (bool) true,
     Writable: (bool) true
    },
    (rpc.ParsedMessageAccount) {
     PublicKey: (solana.PublicKey) (len=32 cap=32) 6TLboY4kk9kArPNS82VmmwtmnHfaFuU4wy8Nw6ShEThS,
     Signer: (bool) false,
     Writable: (bool) true
    },
    (rpc.ParsedMessageAccount) {
     PublicKey: (solana.PublicKey) (len=32 cap=32) 3LnWULKynGvW3XYgX5YaMJ8iTbMggBq3yzpdAzHsnqKL,
     Signer: (bool) false,
     Writable: (bool) false
    },
    (rpc.ParsedMessageAccount) {
     PublicKey: (solana.PublicKey) (len=32 cap=32) ComputeBudget111111111111111111111111111111,
     Signer: (bool) false,
     Writable: (bool) false
    },
    (rpc.ParsedMessageAccount) {
     PublicKey: (solana.PublicKey) (len=32 cap=32) TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA,
     Signer: (bool) false,
     Writable: (bool) false
    }
   },
   Instructions: ([]*rpc.ParsedInstruction) (len=3 cap=4) {
    (*rpc.ParsedInstruction)(0x140002e20e0)({
     Program: (string) "",
     ProgramId: (solana.PublicKey) (len=32 cap=32) ComputeBudget111111111111111111111111111111,
     Parsed: (*rpc.InstructionInfoEnvelope)(<nil>),
     Data: (solana.Base58) (len=9 cap=15) 3gJqkocMWaMm,
     Accounts: ([]solana.PublicKey) {
     }
    }),
    (*rpc.ParsedInstruction)(0x140002e2150)({
     Program: (string) "",
     ProgramId: (solana.PublicKey) (len=32 cap=32) ComputeBudget111111111111111111111111111111,
     Parsed: (*rpc.InstructionInfoEnvelope)(<nil>),
     Data: (solana.Base58) (len=5 cap=9) Fj2Eoy,
     Accounts: ([]solana.PublicKey) {
     }
    }),
    (*rpc.ParsedInstruction)(0x140002e21c0)({
     Program: (string) (len=9) "spl-token",
     ProgramId: (solana.PublicKey) (len=32 cap=32) TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA,
     Parsed: (*rpc.InstructionInfoEnvelope)(0x14000295008)({
      asString: (string) "",
      asInstructionInfo: (*rpc.InstructionInfo)(0x140002950e0)({
       Info: (map[string]interface {}) (len=6) {
        (string) (len=11) "destination": (string) (len=44) "6TLboY4kk9kArPNS82VmmwtmnHfaFuU4wy8Nw6ShEThS",
        (string) (len=4) "mint": (string) (len=44) "3LnWULKynGvW3XYgX5YaMJ8iTbMggBq3yzpdAzHsnqKL",
        (string) (len=17) "multisigAuthority": (string) (len=44) "GQWUhXsFMmKW7CDRJGPVaVnY31HZWxDVvDFcvoXvDFtt",
        (string) (len=7) "signers": ([]interface {}) (len=1 cap=1) {
         (string) (len=44) "GQWUhXsFMmKW7CDRJGPVaVnY31HZWxDVvDFcvoXvDFtt"
        },
        (string) (len=6) "source": (string) (len=44) "6TLboY4kk9kArPNS82VmmwtmnHfaFuU4wy8Nw6ShEThS",
        (string) (len=11) "tokenAmount": (map[string]interface {}) (len=4) {
         (string) (len=6) "amount": (string) (len=9) "100000000",
         (string) (len=8) "decimals": (float64) 9,
         (string) (len=8) "uiAmount": (float64) 0.1,
         (string) (len=14) "uiAmountString": (string) (len=3) "0.1"
        }
       },
       InstructionType: (string) (len=15) "transferChecked"
      })
     }),
     Data: (solana.Base58) ,
     Accounts: ([]solana.PublicKey) <nil>
    })
   },
   RecentBlockHash: (string) (len=44) "6TqLCGgnqV2unvno7Zzszxm9ZCpp5aEyrKF2zYx7Xz7p"
  }
 }),
 Meta: (*rpc.ParsedTransactionMeta)(0x140002fc000)({
  Err: (interface {}) <nil>,
  Fee: (uint64) 25000,
  PreBalances: ([]uint64) (len=5 cap=8) {
   (uint64) 2950605443,
   (uint64) 2039280,
   (uint64) 1461600,
   (uint64) 1,
   (uint64) 934087680
  },
  PostBalances: ([]uint64) (len=5 cap=8) {
   (uint64) 2950580443,
   (uint64) 2039280,
   (uint64) 1461600,
   (uint64) 1,
   (uint64) 934087680
  },
  InnerInstructions: ([]rpc.ParsedInnerInstruction) {
  },
  PreTokenBalances: ([]rpc.TokenBalance) (len=1 cap=1) {
   (rpc.TokenBalance) {
    AccountIndex: (uint16) 1,
    Owner: (*solana.PublicKey)(0x140002c8920)((len=32 cap=32) GQWUhXsFMmKW7CDRJGPVaVnY31HZWxDVvDFcvoXvDFtt),
    Mint: (solana.PublicKey) (len=32 cap=32) 3LnWULKynGvW3XYgX5YaMJ8iTbMggBq3yzpdAzHsnqKL,
    UiTokenAmount: (*rpc.UiTokenAmount)(0x140002f30b0)({
     Amount: (string) (len=18) "100000000000000000",
     Decimals: (uint8) 9,
     UiAmount: (*float64)(0x140002c3010)(1e+08),
     UiAmountString: (string) (len=9) "100000000"
    })
   }
  },
  PostTokenBalances: ([]rpc.TokenBalance) (len=1 cap=1) {
   (rpc.TokenBalance) {
    AccountIndex: (uint16) 1,
    Owner: (*solana.PublicKey)(0x140002c88a0)((len=32 cap=32) GQWUhXsFMmKW7CDRJGPVaVnY31HZWxDVvDFcvoXvDFtt),
    Mint: (solana.PublicKey) (len=32 cap=32) 3LnWULKynGvW3XYgX5YaMJ8iTbMggBq3yzpdAzHsnqKL,
    UiTokenAmount: (*rpc.UiTokenAmount)(0x140002f3080)({
     Amount: (string) (len=18) "100000000000000000",
     Decimals: (uint8) 9,
     UiAmount: (*float64)(0x140002c2f60)(1e+08),
     UiAmountString: (string) (len=9) "100000000"
    })
   }
  },
  LogMessages: ([]string) (len=8 cap=8) {
   (string) (len=62) "Program ComputeBudget111111111111111111111111111111 invoke [1]",
   (string) (len=59) "Program ComputeBudget111111111111111111111111111111 success",
   (string) (len=62) "Program ComputeBudget111111111111111111111111111111 invoke [1]",
   (string) (len=59) "Program ComputeBudget111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: TransferChecked",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 6011 of 199700 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success"
  }
 })
})
sudotx commented 5 months ago

was this able to solve the problem? @elvis-hp