From 39e2b9848ce474b266739affb5e849d63404ce92 Mon Sep 17 00:00:00 2001 From: gagliardetto Date: Thu, 16 Jan 2025 19:04:24 +0100 Subject: [PATCH] Add `rpc.CompiledInstruction{}` type so that we can add to it the `StackHeight` field without touching the `solana.CompiledInstruction` type. --- rpc/types.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/rpc/types.go b/rpc/types.go index e00d44c6..6673620e 100644 --- a/rpc/types.go +++ b/rpc/types.go @@ -234,7 +234,24 @@ type InnerInstruction struct { Index uint16 `json:"index"` // Ordered list of inner program instructions that were invoked during a single transaction instruction. - Instructions []solana.CompiledInstruction `json:"instructions"` + Instructions []CompiledInstruction `json:"instructions"` +} + +type CompiledInstruction struct { + // Index into the message.accountKeys array indicating the program account that executes this instruction. + // NOTE: it is actually a uint8, but using a uint16 because uint8 is treated as a byte everywhere, + // and that can be an issue. + ProgramIDIndex uint16 `json:"programIdIndex"` + + // List of ordered indices into the message.accountKeys array indicating which accounts to pass to the program. + // NOTE: it is actually a []uint8, but using a uint16 because []uint8 is treated as a []byte everywhere, + // and that can be an issue. + Accounts []uint16 `json:"accounts"` + + // The program input data encoded in a base-58 string. + Data solana.Base58 `json:"data"` + + StackHeight uint16 `json:"stackHeight"` } // Ok interface{} `json:"Ok"` // Transaction was successful