diff --git a/.mockery.yaml b/.mockery.yaml index e2bd813314..47256b2092 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -22,6 +22,7 @@ packages: ContractReader: EVMService: TONService: + SolanaService: github.com/smartcontractkit/chainlink-common/pkg/types/core: interfaces: CapabilitiesRegistry: diff --git a/go.mod b/go.mod index ffd413ac3a..3d12317dd0 100644 --- a/go.mod +++ b/go.mod @@ -30,6 +30,7 @@ require ( github.com/kylelemons/godebug v1.1.0 github.com/lib/pq v1.10.9 github.com/marcboeker/go-duckdb v1.8.5 + github.com/mr-tron/base58 v1.2.0 github.com/pelletier/go-toml v1.9.5 github.com/pelletier/go-toml/v2 v2.2.4 github.com/prometheus/client_golang v1.22.0 @@ -125,7 +126,6 @@ require ( github.com/mitchellh/go-wordwrap v1.0.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/mr-tron/base58 v1.2.0 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/oklog/run v1.2.0 // indirect github.com/pierrec/lz4/v4 v4.1.22 // indirect diff --git a/pkg/chains/solana/generate.go b/pkg/chains/solana/generate.go new file mode 100644 index 0000000000..874e6fb974 --- /dev/null +++ b/pkg/chains/solana/generate.go @@ -0,0 +1,2 @@ +//go:generate go run ./generate +package solana diff --git a/pkg/chains/solana/generate/main.go b/pkg/chains/solana/generate/main.go new file mode 100644 index 0000000000..2eb8b5211c --- /dev/null +++ b/pkg/chains/solana/generate/main.go @@ -0,0 +1,11 @@ +package main + +import "github.com/smartcontractkit/chainlink-protos/cre/go/installer/pkg" + +func main() { + gen := &pkg.ProtocGen{Plugins: []pkg.Plugin{pkg.GoPlugin, {Name: "go-grpc"}}} + gen.AddSourceDirectories("../..", ".") + if err := gen.GenerateFile("solana.proto", "."); err != nil { + panic(err) + } +} diff --git a/pkg/chains/solana/proto_helpers.go b/pkg/chains/solana/proto_helpers.go new file mode 100644 index 0000000000..6df89854ec --- /dev/null +++ b/pkg/chains/solana/proto_helpers.go @@ -0,0 +1,1615 @@ +package solana + +import ( + "errors" + "fmt" + "time" + + "github.com/mr-tron/base58" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + codecpb "github.com/smartcontractkit/chainlink-common/pkg/internal/codec" + chaincommonpb "github.com/smartcontractkit/chainlink-common/pkg/loop/chain-common" + "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + typesolana "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + "github.com/smartcontractkit/chainlink-common/pkg/types/query" + "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" + solprimitives "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives/solana" + valuespb "github.com/smartcontractkit/chainlink-protos/cre/go/values/pb" +) + +func ConvertPublicKeysFromProto(pubKeys [][]byte) ([]typesolana.PublicKey, error) { + out := make([]typesolana.PublicKey, 0, len(pubKeys)) + var errs []error + for i, b := range pubKeys { + pk, err := ConvertPublicKeyFromProto(b) + if err != nil { + errs = append(errs, fmt.Errorf("public key[%d]: %w", i, err)) + continue + } + out = append(out, pk) + } + if len(errs) > 0 { + return nil, errors.Join(errs...) + } + return out, nil +} + +func ConvertPublicKeyFromProto(b []byte) (typesolana.PublicKey, error) { + if err := ValidatePublicKeyBytes(b); err != nil { + return typesolana.PublicKey{}, err + } + return typesolana.PublicKey(b), nil +} + +func ValidatePublicKeyBytes(b []byte) error { + if b == nil { + return fmt.Errorf("address can't be nil") + } + if len(b) != typesolana.PublicKeyLength { + return fmt.Errorf("invalid public key: got %d bytes, expected %d, value=%s", + len(b), typesolana.PublicKeyLength, base58.Encode(b)) + } + return nil +} + +func ConvertSignatureFromProto(b []byte) (typesolana.Signature, error) { + if err := ValidateSignatureBytes(b); err != nil { + return typesolana.Signature{}, err + } + var s typesolana.Signature + copy(s[:], b[:typesolana.SignatureLength]) + return s, nil +} + +func ConvertSignaturesFromProto(arr [][]byte) ([]typesolana.Signature, error) { + out := make([]typesolana.Signature, 0, len(arr)) + var errs []error + for i, b := range arr { + s, err := ConvertSignatureFromProto(b) + if err != nil { + errs = append(errs, fmt.Errorf("signature[%d]: %w", i, err)) + continue + } + out = append(out, s) + } + if len(errs) > 0 { + return nil, errors.Join(errs...) + } + return out, nil +} + +func ConvertSignaturesToProto(sigs []typesolana.Signature) [][]byte { + out := make([][]byte, 0, len(sigs)) + for _, s := range sigs { + out = append(out, s[:]) + } + return out +} + +func ValidateSignatureBytes(b []byte) error { + if b == nil { + return fmt.Errorf("signature can't be nil") + } + if len(b) != typesolana.SignatureLength { + return fmt.Errorf("invalid signature: got %d bytes, expected %d, value=%s", + len(b), typesolana.SignatureLength, base58.Encode(b)) + } + return nil +} + +func ConvertHashFromProto(b []byte) (typesolana.Hash, error) { + if b == nil { + return typesolana.Hash{}, fmt.Errorf("hash can't be nil") + } + + if len(b) != solana.HashLength { + return typesolana.Hash{}, fmt.Errorf("invalid hash: got %d bytes, expected %d, value=%s", + len(b), solana.HashLength, base58.Encode(b)) + } + return typesolana.Hash(typesolana.PublicKey(b)), nil +} + +func ConvertEventSigFromProto(b []byte) (typesolana.EventSignature, error) { + if b == nil { + return typesolana.EventSignature{}, fmt.Errorf("hash can't be nil") + } + + if len(b) != solana.EventSignatureLength { + return typesolana.EventSignature{}, fmt.Errorf("invalid event signature: got %d bytes, expected %d, value=%x", + len(b), solana.EventSignatureLength, b) + } + + return typesolana.EventSignature(b), nil + +} + +func ConvertEncodingTypeFromProto(e EncodingType) typesolana.EncodingType { + switch e { + case EncodingType_ENCODING_TYPE_BASE58: + return typesolana.EncodingBase58 + case EncodingType_ENCODING_TYPE_BASE64: + return typesolana.EncodingBase64 + case EncodingType_ENCODING_TYPE_BASE64_ZSTD: + return typesolana.EncodingBase64Zstd + case EncodingType_ENCODING_TYPE_JSON: + return typesolana.EncodingJSON + case EncodingType_ENCODING_TYPE_JSON_PARSED: + return typesolana.EncodingJSONParsed + default: + return typesolana.EncodingType("") + } +} + +func ConvertEncodingTypeToProto(e typesolana.EncodingType) EncodingType { + switch e { + case typesolana.EncodingBase64: + return EncodingType_ENCODING_TYPE_BASE64 + case typesolana.EncodingBase58: + return EncodingType_ENCODING_TYPE_BASE58 + case typesolana.EncodingBase64Zstd: + return EncodingType_ENCODING_TYPE_BASE64_ZSTD + case typesolana.EncodingJSONParsed: + return EncodingType_ENCODING_TYPE_JSON_PARSED + case typesolana.EncodingJSON: + return EncodingType_ENCODING_TYPE_JSON + default: + return EncodingType_ENCODING_TYPE_NONE + } +} + +func ConvertCommitmentFromProto(c CommitmentType) typesolana.CommitmentType { + switch c { + case CommitmentType_COMMITMENT_TYPE_CONFIRMED: + return typesolana.CommitmentConfirmed + case CommitmentType_COMMITMENT_TYPE_FINALIZED: + return typesolana.CommitmentFinalized + case CommitmentType_COMMITMENT_TYPE_PROCESSED: + return typesolana.CommitmentProcessed + default: + return typesolana.CommitmentType("") + } +} + +func ConvertCommitmentToProto(c typesolana.CommitmentType) CommitmentType { + switch c { + case typesolana.CommitmentFinalized: + return CommitmentType_COMMITMENT_TYPE_FINALIZED + case typesolana.CommitmentConfirmed: + return CommitmentType_COMMITMENT_TYPE_CONFIRMED + case typesolana.CommitmentProcessed: + return CommitmentType_COMMITMENT_TYPE_PROCESSED + default: + return CommitmentType_COMMITMENT_TYPE_NONE + } +} + +func ConvertConfirmationStatusToProto(c typesolana.ConfirmationStatusType) ConfirmationStatusType { + switch c { + case typesolana.ConfirmationStatusFinalized: + return ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_FINALIZED + case typesolana.ConfirmationStatusConfirmed: + return ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_CONFIRMED + case typesolana.ConfirmationStatusProcessed: + return ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_PROCESSED + default: + return ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_NONE + } +} + +func ConvertConfirmationStatusFromProto(c ConfirmationStatusType) typesolana.ConfirmationStatusType { + switch c { + case ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_CONFIRMED: + return typesolana.ConfirmationStatusConfirmed + case ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_FINALIZED: + return typesolana.ConfirmationStatusFinalized + case ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_PROCESSED: + return typesolana.ConfirmationStatusProcessed + default: + return typesolana.ConfirmationStatusType("") + } +} + +func ConvertDataSliceFromProto(p *DataSlice) *typesolana.DataSlice { + if p == nil { + return nil + } + return &typesolana.DataSlice{ + Offset: ptrUint64(p.Offset), + Length: ptrUint64(p.Length), + } +} + +func ConvertDataSliceToProto(d *typesolana.DataSlice) *DataSlice { + if d == nil { + return nil + } + var off, ln uint64 + if d.Offset != nil { + off = *d.Offset + } + if d.Length != nil { + ln = *d.Length + } + return &DataSlice{ + Offset: off, + Length: ln, + } +} + +func ConvertUiTokenAmountFromProto(p *UiTokenAmount) *typesolana.UiTokenAmount { + if p == nil { + return nil + } + return &typesolana.UiTokenAmount{ + Amount: p.Amount, + Decimals: uint8(p.Decimals), + UiAmountString: p.UiAmountString, + } +} + +func ConvertUiTokenAmountToProto(u *typesolana.UiTokenAmount) *UiTokenAmount { + if u == nil { + return nil + } + return &UiTokenAmount{ + Amount: u.Amount, + Decimals: uint32(u.Decimals), + UiAmountString: u.UiAmountString, + } +} + +func ConvertAccountFromProto(p *Account) (*typesolana.Account, error) { + if p == nil { + return nil, nil + } + owner, err := ConvertPublicKeyFromProto(p.Owner) + if err != nil { + return nil, fmt.Errorf("owner: %w", err) + } + data := ConvertDataBytesOrJSONFromProto(p.Data) + + return &typesolana.Account{ + Lamports: p.Lamports, + Owner: owner, + Data: data, + Executable: p.Executable, + RentEpoch: valuespb.NewIntFromBigInt(p.RentEpoch), + Space: p.Space, + }, nil +} + +func ConvertAccountToProto(a *typesolana.Account) *Account { + if a == nil { + return nil + } + return &Account{ + Lamports: a.Lamports, + Owner: a.Owner[:], + Data: ConvertDataBytesOrJSONToProto(a.Data), + Executable: a.Executable, + RentEpoch: valuespb.NewBigIntFromInt(a.RentEpoch), + Space: a.Space, + } +} + +func ConvertDataBytesOrJSONFromProto(p *DataBytesOrJSON) *typesolana.DataBytesOrJSON { + if p == nil { + return nil + } + switch t := p.GetBody().(type) { + case *DataBytesOrJSON_Raw: + return &typesolana.DataBytesOrJSON{ + AsDecodedBinary: t.Raw, + RawDataEncoding: ConvertEncodingTypeFromProto(p.Encoding), + } + case *DataBytesOrJSON_Json: + return &typesolana.DataBytesOrJSON{ + AsJSON: t.Json, + RawDataEncoding: ConvertEncodingTypeFromProto(p.Encoding), + } + } + + return nil +} + +func ConvertDataBytesOrJSONToProto(d *typesolana.DataBytesOrJSON) *DataBytesOrJSON { + if d == nil { + return nil + } + + ret := &DataBytesOrJSON{ + Encoding: ConvertEncodingTypeToProto(d.RawDataEncoding), + } + if d.AsJSON != nil { + ret.Body = &DataBytesOrJSON_Json{Json: d.AsJSON} + return ret + } + + ret.Body = &DataBytesOrJSON_Raw{Raw: d.AsDecodedBinary} + + return ret +} + +func ConvertGetAccountInfoOptsFromProto(p *GetAccountInfoOpts) *typesolana.GetAccountInfoOpts { + if p == nil { + return nil + } + return &typesolana.GetAccountInfoOpts{ + Encoding: ConvertEncodingTypeFromProto(p.Encoding), + Commitment: ConvertCommitmentFromProto(p.Commitment), + DataSlice: ConvertDataSliceFromProto(p.DataSlice), + MinContextSlot: ptrUint64(p.MinContextSlot), + } +} + +func ConvertGetAccountInfoOptsToProto(o *typesolana.GetAccountInfoOpts) *GetAccountInfoOpts { + if o == nil { + return nil + } + var min uint64 + if o.MinContextSlot != nil { + min = *o.MinContextSlot + } + return &GetAccountInfoOpts{ + Encoding: ConvertEncodingTypeToProto(o.Encoding), + Commitment: ConvertCommitmentToProto(o.Commitment), + DataSlice: ConvertDataSliceToProto(o.DataSlice), + MinContextSlot: min, + } +} + +func ConvertGetMultipleAccountsOptsFromProto(p *GetMultipleAccountsOpts) *typesolana.GetMultipleAccountsOpts { + if p == nil { + return nil + } + return &typesolana.GetMultipleAccountsOpts{ + Encoding: ConvertEncodingTypeFromProto(p.Encoding), + Commitment: ConvertCommitmentFromProto(p.Commitment), + DataSlice: ConvertDataSliceFromProto(p.DataSlice), + MinContextSlot: ptrUint64(p.MinContextSlot), + } +} + +func ConvertGetMultipleAccountsOptsToProto(o *typesolana.GetMultipleAccountsOpts) *GetMultipleAccountsOpts { + if o == nil { + return nil + } + var min uint64 + if o.MinContextSlot != nil { + min = *o.MinContextSlot + } + return &GetMultipleAccountsOpts{ + Encoding: ConvertEncodingTypeToProto(o.Encoding), + Commitment: ConvertCommitmentToProto(o.Commitment), + DataSlice: ConvertDataSliceToProto(o.DataSlice), + MinContextSlot: min, + } +} + +func ConvertGetBlockOptsFromProto(p *GetBlockOpts) *typesolana.GetBlockOpts { + if p == nil { + return nil + } + return &typesolana.GetBlockOpts{ + Commitment: ConvertCommitmentFromProto(p.Commitment), + } +} + +func ConvertGetBlockOptsToProto(o *typesolana.GetBlockOpts) *GetBlockOpts { + if o == nil { + return nil + } + return &GetBlockOpts{ + Commitment: ConvertCommitmentToProto(o.Commitment), + } +} + +func ConvertMessageHeaderFromProto(p *MessageHeader) typesolana.MessageHeader { + if p == nil { + return typesolana.MessageHeader{} + } + return typesolana.MessageHeader{ + NumRequiredSignatures: uint8(p.NumRequiredSignatures), + NumReadonlySignedAccounts: uint8(p.NumReadonlySignedAccounts), + NumReadonlyUnsignedAccounts: uint8(p.NumReadonlyUnsignedAccounts), + } +} + +func ConvertMessageHeaderToProto(h typesolana.MessageHeader) *MessageHeader { + return &MessageHeader{ + NumRequiredSignatures: uint32(h.NumRequiredSignatures), + NumReadonlySignedAccounts: uint32(h.NumReadonlySignedAccounts), + NumReadonlyUnsignedAccounts: uint32(h.NumReadonlyUnsignedAccounts), + } +} + +func ConvertCompiledInstructionFromProto(p *CompiledInstruction) typesolana.CompiledInstruction { + if p == nil { + return typesolana.CompiledInstruction{} + } + accts := make([]uint16, len(p.Accounts)) + for i, a := range p.Accounts { + accts[i] = uint16(a) + } + + return typesolana.CompiledInstruction{ + ProgramIDIndex: uint16(p.ProgramIdIndex), + Accounts: accts, + Data: p.Data, + StackHeight: uint16(p.StackHeight), + } +} + +func ConvertCompiledInstructionToProto(ci typesolana.CompiledInstruction) *CompiledInstruction { + accts := make([]uint32, len(ci.Accounts)) + for i, a := range ci.Accounts { + accts[i] = uint32(a) + } + return &CompiledInstruction{ + ProgramIdIndex: uint32(ci.ProgramIDIndex), + Accounts: accts, + Data: ci.Data, + StackHeight: uint32(ci.StackHeight), + } +} + +func ConvertInnerInstructionFromProto(p *InnerInstruction) typesolana.InnerInstruction { + if p == nil { + return typesolana.InnerInstruction{} + } + out := typesolana.InnerInstruction{ + Index: uint16(p.Index), + Instructions: make([]typesolana.CompiledInstruction, 0, len(p.Instructions)), + } + for _, in := range p.Instructions { + out.Instructions = append(out.Instructions, ConvertCompiledInstructionFromProto(in)) + } + return out +} + +func ConvertInnerInstructionToProto(ii typesolana.InnerInstruction) *InnerInstruction { + out := &InnerInstruction{ + Index: uint32(ii.Index), + Instructions: make([]*CompiledInstruction, 0, len(ii.Instructions)), + } + for _, in := range ii.Instructions { + out.Instructions = append(out.Instructions, ConvertCompiledInstructionToProto(in)) + } + return out +} + +func ConvertLoadedAddressesFromProto(p *LoadedAddresses) typesolana.LoadedAddresses { + if p == nil { + return typesolana.LoadedAddresses{} + } + ro, _ := ConvertPublicKeysFromProto(p.Readonly) + wr, _ := ConvertPublicKeysFromProto(p.Writable) + return typesolana.LoadedAddresses{ + ReadOnly: ro, + Writable: wr, + } +} + +func ConvertLoadedAddressesToProto(l typesolana.LoadedAddresses) *LoadedAddresses { + return &LoadedAddresses{ + Readonly: ConvertPublicKeysToProto(l.ReadOnly), + Writable: ConvertPublicKeysToProto(l.Writable), + } +} + +func ConvertPublicKeysToProto(keys []typesolana.PublicKey) [][]byte { + out := make([][]byte, 0, len(keys)) + for _, k := range keys { + out = append(out, k[:]) + } + return out +} + +func ConvertParsedMessageFromProto(p *ParsedMessage) (typesolana.Message, error) { + if p == nil { + return typesolana.Message{}, nil + } + rb, err := ConvertHashFromProto(p.RecentBlockhash) + if err != nil { + return typesolana.Message{}, fmt.Errorf("recent blockhash: %w", err) + } + keys, err := ConvertPublicKeysFromProto(p.AccountKeys) + if err != nil { + return typesolana.Message{}, fmt.Errorf("account keys: %w", err) + } + msg := typesolana.Message{ + AccountKeys: keys, + Header: ConvertMessageHeaderFromProto(p.Header), + RecentBlockhash: rb, + Instructions: make([]typesolana.CompiledInstruction, 0, len(p.Instructions)), + } + for _, ins := range p.Instructions { + msg.Instructions = append(msg.Instructions, ConvertCompiledInstructionFromProto(ins)) + } + return msg, nil +} + +func ConvertParsedMessageToProto(m typesolana.Message) *ParsedMessage { + out := &ParsedMessage{ + RecentBlockhash: m.RecentBlockhash[:], + AccountKeys: ConvertPublicKeysToProto(m.AccountKeys), + Header: ConvertMessageHeaderToProto(m.Header), + Instructions: make([]*CompiledInstruction, 0, len(m.Instructions)), + } + for _, ins := range m.Instructions { + out.Instructions = append(out.Instructions, ConvertCompiledInstructionToProto(ins)) + } + return out +} + +func ConvertParsedTransactionFromProto(p *ParsedTransaction) (typesolana.Transaction, error) { + if p == nil { + return typesolana.Transaction{}, nil + } + sigs, err := ConvertSignaturesFromProto(p.Signatures) + if err != nil { + return typesolana.Transaction{}, fmt.Errorf("signatures: %w", err) + } + msg, err := ConvertParsedMessageFromProto(p.Message) + if err != nil { + return typesolana.Transaction{}, fmt.Errorf("message: %w", err) + } + return typesolana.Transaction{ + Signatures: sigs, + Message: msg, + }, nil +} + +func ConvertParsedTransactionToProto(t typesolana.Transaction) *ParsedTransaction { + return &ParsedTransaction{ + Signatures: ConvertSignaturesToProto(t.Signatures), + Message: ConvertParsedMessageToProto(t.Message), + } +} + +func ConvertTokenBalanceFromProto(p *TokenBalance) (*typesolana.TokenBalance, error) { + if p == nil { + return nil, nil + } + mint, err := ConvertPublicKeyFromProto(p.Mint) + if err != nil { + return nil, fmt.Errorf("mint: %w", err) + } + var owner *typesolana.PublicKey + if len(p.Owner) > 0 { + o, err := ConvertPublicKeyFromProto(p.Owner) + if err != nil { + return nil, fmt.Errorf("owner: %w", err) + } + owner = &o + } + var program *typesolana.PublicKey + if len(p.ProgramId) > 0 { + prog, err := ConvertPublicKeyFromProto(p.ProgramId) + if err != nil { + return nil, fmt.Errorf("programId: %w", err) + } + program = &prog + } + return &typesolana.TokenBalance{ + AccountIndex: uint16(p.AccountIndex), + Owner: owner, + ProgramId: program, + Mint: mint, + UiTokenAmount: ConvertUiTokenAmountFromProto(p.Ui), + }, nil +} + +func ConvertTokenBalanceToProto(tb *typesolana.TokenBalance) *TokenBalance { + if tb == nil { + return nil + } + var owner, program []byte + if tb.Owner != nil { + tmp := *tb.Owner + owner = tmp[:] + } + if tb.ProgramId != nil { + tmp := *tb.ProgramId + program = tmp[:] + } + return &TokenBalance{ + AccountIndex: uint32(tb.AccountIndex), + Owner: owner, + ProgramId: program, + Mint: tb.Mint[:], + Ui: ConvertUiTokenAmountToProto(tb.UiTokenAmount), + } +} + +func ConvertReturnDataFromProto(p *ReturnData) (*typesolana.ReturnData, error) { + if p == nil { + return nil, nil + } + prog, err := ConvertPublicKeyFromProto(p.ProgramId) + if err != nil { + return nil, fmt.Errorf("programId: %w", err) + } + return &typesolana.ReturnData{ + ProgramId: prog, + Data: typesolana.Data{ + Content: p.Data.GetContent(), + Encoding: ConvertEncodingTypeFromProto(p.Data.GetEncoding()), + }, + }, nil +} + +func ConvertReturnDataToProto(r *typesolana.ReturnData) *ReturnData { + if r == nil { + return nil + } + + return &ReturnData{ + ProgramId: r.ProgramId[:], + Data: &Data{ + Content: r.Data.Content, + Encoding: ConvertEncodingTypeToProto(r.Data.Encoding), + }, + } +} + +func ConvertTransactionMetaFromProto(p *TransactionMeta) (*typesolana.TransactionMeta, error) { + if p == nil { + return nil, nil + } + preTB := make([]typesolana.TokenBalance, 0, len(p.PreTokenBalances)) + for _, x := range p.PreTokenBalances { + tb, err := ConvertTokenBalanceFromProto(x) + if err != nil { + return nil, fmt.Errorf("pre token balance: %w", err) + } + preTB = append(preTB, *tb) + } + postTB := make([]typesolana.TokenBalance, 0, len(p.PostTokenBalances)) + for _, x := range p.PostTokenBalances { + tb, err := ConvertTokenBalanceFromProto(x) + if err != nil { + return nil, fmt.Errorf("post token balance: %w", err) + } + postTB = append(postTB, *tb) + } + inner := make([]typesolana.InnerInstruction, 0, len(p.InnerInstructions)) + for _, in := range p.InnerInstructions { + inner = append(inner, ConvertInnerInstructionFromProto(in)) + } + ret, err := ConvertReturnDataFromProto(p.ReturnData) + if err != nil { + return nil, fmt.Errorf("return data: %w", err) + } + la := ConvertLoadedAddressesFromProto(p.LoadedAddresses) + + meta := &typesolana.TransactionMeta{ + Err: p.ErrJson, + Fee: p.Fee, + PreBalances: p.PreBalances, + PostBalances: p.PostBalances, + InnerInstructions: inner, + PreTokenBalances: preTB, + PostTokenBalances: postTB, + LogMessages: p.LogMessages, + LoadedAddresses: la, + ReturnData: *ret, + ComputeUnitsConsumed: p.ComputeUnitsConsumed, + } + return meta, nil +} + +func ConvertTransactionMetaToProto(m *typesolana.TransactionMeta) *TransactionMeta { + if m == nil { + return nil + } + preTB := make([]*TokenBalance, 0, len(m.PreTokenBalances)) + for i := range m.PreTokenBalances { + preTB = append(preTB, ConvertTokenBalanceToProto(&m.PreTokenBalances[i])) + } + postTB := make([]*TokenBalance, 0, len(m.PostTokenBalances)) + for i := range m.PostTokenBalances { + postTB = append(postTB, ConvertTokenBalanceToProto(&m.PostTokenBalances[i])) + } + inner := make([]*InnerInstruction, 0, len(m.InnerInstructions)) + for _, in := range m.InnerInstructions { + inner = append(inner, ConvertInnerInstructionToProto(in)) + } + var cuc uint64 + if m.ComputeUnitsConsumed != nil { + cuc = *m.ComputeUnitsConsumed + } + return &TransactionMeta{ + ErrJson: m.Err, + Fee: m.Fee, + PreBalances: m.PreBalances, + PostBalances: m.PostBalances, + LogMessages: m.LogMessages, + PreTokenBalances: preTB, + PostTokenBalances: postTB, + InnerInstructions: inner, + LoadedAddresses: ConvertLoadedAddressesToProto(m.LoadedAddresses), + ReturnData: ConvertReturnDataToProto(&m.ReturnData), + ComputeUnitsConsumed: &cuc, + } +} + +func ConvertTransactionEnvelopeFromProto(p *TransactionEnvelope) (typesolana.TransactionResultEnvelope, error) { + if p == nil { + return typesolana.TransactionResultEnvelope{}, nil + } + var out typesolana.TransactionResultEnvelope + switch t := p.GetTransaction().(type) { + case *TransactionEnvelope_Raw: + out.AsDecodedBinary = typesolana.Data{ + Content: t.Raw, + Encoding: typesolana.EncodingBase64, + } + case *TransactionEnvelope_Parsed: + ptx, err := ConvertParsedTransactionFromProto(t.Parsed) + if err != nil { + return typesolana.TransactionResultEnvelope{}, err + } + out.AsParsedTransaction = &ptx + default: + } + return out, nil +} + +func ConvertTransactionEnvelopeToProto(e typesolana.TransactionResultEnvelope) *TransactionEnvelope { + switch { + case e.AsParsedTransaction != nil: + return &TransactionEnvelope{ + Transaction: &TransactionEnvelope_Parsed{ + Parsed: ConvertParsedTransactionToProto(*e.AsParsedTransaction), + }, + } + case len(e.AsDecodedBinary.Content) > 0: + return &TransactionEnvelope{ + Transaction: &TransactionEnvelope_Raw{ + Raw: e.AsDecodedBinary.Content, + }, + } + default: + return &TransactionEnvelope{} + } +} + +func ConvertGetTransactionReplyFromProto(p *GetTransactionReply) (*typesolana.GetTransactionReply, error) { + if p == nil { + return nil, nil + } + env, err := ConvertTransactionEnvelopeFromProto(p.Transaction) + if err != nil { + return nil, err + } + meta, err := ConvertTransactionMetaFromProto(p.Meta) + if err != nil { + return nil, err + } + var bt *typesolana.UnixTimeSeconds + if p.BlockTime != nil { + bt = ptrUnix(typesolana.UnixTimeSeconds(*p.BlockTime)) + } + + return &typesolana.GetTransactionReply{ + Slot: p.Slot, + BlockTime: bt, + Transaction: &env, + Meta: meta, + }, nil +} + +func ConvertGetTransactionReplyToProto(r *typesolana.GetTransactionReply) *GetTransactionReply { + if r == nil { + return nil + } + var bt int64 + if r.BlockTime != nil { + bt = int64(*r.BlockTime) + } + var tx *TransactionEnvelope + if r.Transaction != nil { + tx = ConvertTransactionEnvelopeToProto(*r.Transaction) + } + return &GetTransactionReply{ + Slot: r.Slot, + BlockTime: &bt, + Transaction: tx, + Meta: ConvertTransactionMetaToProto(r.Meta), + } +} + +func ConvertGetTransactionRequestFromProto(p *GetTransactionRequest) (typesolana.GetTransactionRequest, error) { + sig, err := ConvertSignatureFromProto(p.Signature) + if err != nil { + return typesolana.GetTransactionRequest{}, err + } + return typesolana.GetTransactionRequest{Signature: sig}, nil +} + +func ConvertGetTransactionRequestToProto(r typesolana.GetTransactionRequest) *GetTransactionRequest { + return &GetTransactionRequest{Signature: r.Signature[:]} +} + +func ConvertGetBalanceReplyFromProto(p *GetBalanceReply) *typesolana.GetBalanceReply { + if p == nil { + return nil + } + return &typesolana.GetBalanceReply{Value: p.Value} +} + +func ConvertGetBalanceReplyToProto(r *typesolana.GetBalanceReply) *GetBalanceReply { + if r == nil { + return nil + } + return &GetBalanceReply{Value: r.Value} +} + +func ConvertGetBalanceRequestFromProto(p *GetBalanceRequest) (typesolana.GetBalanceRequest, error) { + pk, err := ConvertPublicKeyFromProto(p.Addr) + if err != nil { + return typesolana.GetBalanceRequest{}, err + } + return typesolana.GetBalanceRequest{ + Addr: pk, + Commitment: ConvertCommitmentFromProto(p.Commitment), + }, nil +} + +func ConvertGetBalanceRequestToProto(r typesolana.GetBalanceRequest) *GetBalanceRequest { + return &GetBalanceRequest{ + Addr: r.Addr[:], + Commitment: ConvertCommitmentToProto(r.Commitment), + } +} + +func ConvertGetSlotHeightReplyFromProto(p *GetSlotHeightReply) *typesolana.GetSlotHeightReply { + if p == nil { + return nil + } + return &typesolana.GetSlotHeightReply{Height: p.Height} +} + +func ConvertGetSlotHeightReplyToProto(r *typesolana.GetSlotHeightReply) *GetSlotHeightReply { + if r == nil { + return nil + } + return &GetSlotHeightReply{Height: r.Height} +} + +func ConvertGetSlotHeightRequestFromProto(p *GetSlotHeightRequest) typesolana.GetSlotHeightRequest { + return typesolana.GetSlotHeightRequest{Commitment: ConvertCommitmentFromProto(p.Commitment)} +} + +func ConvertGetSlotHeightRequestToProto(r typesolana.GetSlotHeightRequest) *GetSlotHeightRequest { + return &GetSlotHeightRequest{Commitment: ConvertCommitmentToProto(r.Commitment)} +} + +func ConvertGetBlockOptsReplyFromProto(p *GetBlockReply) (*typesolana.GetBlockReply, error) { + if p == nil { + return nil, nil + } + hash, err := ConvertHashFromProto(p.Blockhash) + if err != nil { + return nil, fmt.Errorf("blockhash: %w", err) + } + prev, err := ConvertHashFromProto(p.PreviousBlockhash) + if err != nil { + return nil, fmt.Errorf("previous blockhash: %w", err) + } + + var bt *solana.UnixTimeSeconds + if p.BlockTime != nil { + bt = ptrUnix(typesolana.UnixTimeSeconds(*p.BlockTime)) + } + + return &typesolana.GetBlockReply{ + Blockhash: hash, + PreviousBlockhash: prev, + ParentSlot: p.ParentSlot, + BlockTime: bt, + BlockHeight: ptrUint64(p.BlockHeight), + }, nil +} + +func ConvertGetBlockReplyToProto(r *typesolana.GetBlockReply) *GetBlockReply { + if r == nil { + return nil + } + var bt *int64 + if r.BlockTime != nil { + t := int64(*r.BlockTime) + bt = &t + } + var bh uint64 + if r.BlockHeight != nil { + bh = *r.BlockHeight + } + + return &GetBlockReply{ + Blockhash: r.Blockhash[:], + PreviousBlockhash: r.PreviousBlockhash[:], + ParentSlot: r.ParentSlot, + BlockTime: bt, + BlockHeight: bh, + } +} + +func ConvertGetBlockRequestFromProto(p *GetBlockRequest) *typesolana.GetBlockRequest { + if p == nil { + return nil + } + return &typesolana.GetBlockRequest{ + Slot: p.Slot, + Opts: ConvertGetBlockOptsFromProto(p.Opts), + } +} + +func ConvertGetBlockRequestToProto(r *typesolana.GetBlockRequest) *GetBlockRequest { + if r == nil { + return nil + } + return &GetBlockRequest{ + Slot: r.Slot, + Opts: ConvertGetBlockOptsToProto(r.Opts), + } +} + +func ConvertGetFeeForMessageRequestFromProto(p *GetFeeForMessageRequest) *typesolana.GetFeeForMessageRequest { + if p == nil { + return nil + } + return &typesolana.GetFeeForMessageRequest{ + Message: p.Message, + Commitment: ConvertCommitmentFromProto(p.Commitment), + } +} + +func ConvertGetFeeForMessageRequestToProto(r *typesolana.GetFeeForMessageRequest) *GetFeeForMessageRequest { + if r == nil { + return nil + } + return &GetFeeForMessageRequest{ + Message: r.Message, + Commitment: ConvertCommitmentToProto(r.Commitment), + } +} + +func ConvertGetFeeForMessageReplyFromProto(p *GetFeeForMessageReply) *typesolana.GetFeeForMessageReply { + if p == nil { + return nil + } + return &typesolana.GetFeeForMessageReply{Fee: p.Fee} +} + +func ConvertGetFeeForMessageReplyToProto(r *typesolana.GetFeeForMessageReply) *GetFeeForMessageReply { + if r == nil { + return nil + } + return &GetFeeForMessageReply{Fee: r.Fee} +} + +func ConvertGetMultipleAccountsRequestFromProto(p *GetMultipleAccountsWithOptsRequest) *typesolana.GetMultipleAccountsRequest { + if p == nil { + return nil + } + accts, _ := ConvertPublicKeysFromProto(p.Accounts) + return &typesolana.GetMultipleAccountsRequest{ + Accounts: accts, + Opts: ConvertGetMultipleAccountsOptsFromProto(p.Opts), + } +} + +func ConvertGetMultipleAccountsRequestToProto(r *typesolana.GetMultipleAccountsRequest) *GetMultipleAccountsWithOptsRequest { + if r == nil { + return nil + } + return &GetMultipleAccountsWithOptsRequest{ + Accounts: ConvertPublicKeysToProto(r.Accounts), + Opts: ConvertGetMultipleAccountsOptsToProto(r.Opts), + } +} + +func ConvertGetMultipleAccountsReplyFromProto(p *GetMultipleAccountsWithOptsReply) (*typesolana.GetMultipleAccountsReply, error) { + if p == nil { + return nil, nil + } + val := make([]*typesolana.Account, 0, len(p.Value)) + for _, a := range p.Value { + acc, err := ConvertAccountFromProto(a.Account) + if err != nil { + return nil, err + } + val = append(val, acc) + } + return &typesolana.GetMultipleAccountsReply{ + Value: val, + }, nil +} + +func ConvertGetMultipleAccountsReplyToProto(r *typesolana.GetMultipleAccountsReply) *GetMultipleAccountsWithOptsReply { + if r == nil { + return nil + } + val := make([]*OptionalAccountWrapper, 0, len(r.Value)) + for _, a := range r.Value { + val = append(val, &OptionalAccountWrapper{Account: ConvertAccountToProto(a)}) + } + + return &GetMultipleAccountsWithOptsReply{ + Value: val, + } +} + +func ConvertGetSignatureStatusesRequestFromProto(p *GetSignatureStatusesRequest) (*typesolana.GetSignatureStatusesRequest, error) { + if p == nil { + return nil, nil + } + sigs, err := ConvertSignaturesFromProto(p.Sigs) + if err != nil { + return nil, err + } + return &typesolana.GetSignatureStatusesRequest{Sigs: sigs}, nil +} + +func ConvertGetSignatureStatusesRequestToProto(r *typesolana.GetSignatureStatusesRequest) *GetSignatureStatusesRequest { + if r == nil { + return nil + } + return &GetSignatureStatusesRequest{Sigs: ConvertSignaturesToProto(r.Sigs)} +} + +func ConvertGetSignatureStatusesReplyFromProto(p *GetSignatureStatusesReply) *typesolana.GetSignatureStatusesReply { + if p == nil { + return nil + } + out := &typesolana.GetSignatureStatusesReply{Results: make([]typesolana.GetSignatureStatusesResult, 0, len(p.Results))} + for _, r := range p.Results { + out.Results = append(out.Results, typesolana.GetSignatureStatusesResult{ + Slot: r.Slot, + Confirmations: r.Confirmations, + Err: r.Err, + ConfirmationStatus: ConvertConfirmationStatusFromProto(r.ConfirmationStatus), + }) + } + return out +} + +func ConvertGetSignatureStatusesReplyToProto(r *typesolana.GetSignatureStatusesReply) *GetSignatureStatusesReply { + if r == nil { + return nil + } + out := &GetSignatureStatusesReply{Results: make([]*GetSignatureStatusesResult, 0, len(r.Results))} + for i := range r.Results { + var conf uint64 + if r.Results[i].Confirmations != nil { + conf = *r.Results[i].Confirmations + } + out.Results = append(out.Results, &GetSignatureStatusesResult{ + Slot: r.Results[i].Slot, + Confirmations: ptrUint64(conf), + Err: r.Results[i].Err, + ConfirmationStatus: ConvertConfirmationStatusToProto(r.Results[i].ConfirmationStatus), + }) + } + return out +} + +func ConvertSimulateTransactionAccountsOptsFromProto(p *SimulateTransactionAccountsOpts) *typesolana.SimulateTransactionAccountsOpts { + if p == nil { + return nil + } + addrs, _ := ConvertPublicKeysFromProto(p.Addresses) + return &typesolana.SimulateTransactionAccountsOpts{ + Encoding: ConvertEncodingTypeFromProto(p.Encoding), + Addresses: addrs, + } +} + +func ConvertSimulateTransactionAccountsOptsToProto(o *typesolana.SimulateTransactionAccountsOpts) *SimulateTransactionAccountsOpts { + if o == nil { + return nil + } + return &SimulateTransactionAccountsOpts{ + Encoding: ConvertEncodingTypeToProto(o.Encoding), + Addresses: ConvertPublicKeysToProto(o.Addresses), + } +} + +func ConvertSimulateTXOptsFromProto(p *SimulateTXOpts) *typesolana.SimulateTXOpts { + if p == nil { + return nil + } + return &typesolana.SimulateTXOpts{ + SigVerify: p.SigVerify, + Commitment: ConvertCommitmentFromProto(p.Commitment), + ReplaceRecentBlockhash: p.ReplaceRecentBlockhash, + Accounts: ConvertSimulateTransactionAccountsOptsFromProto(p.Accounts), + } +} + +func ConvertSimulateTXOptsToProto(o *typesolana.SimulateTXOpts) *SimulateTXOpts { + if o == nil { + return nil + } + return &SimulateTXOpts{ + SigVerify: o.SigVerify, + Commitment: ConvertCommitmentToProto(o.Commitment), + ReplaceRecentBlockhash: o.ReplaceRecentBlockhash, + Accounts: ConvertSimulateTransactionAccountsOptsToProto(o.Accounts), + } +} + +func ConvertSimulateTXRequestFromProto(p *SimulateTXRequest) (typesolana.SimulateTXRequest, error) { + recv, err := ConvertPublicKeyFromProto(p.Receiver) + if err != nil { + return typesolana.SimulateTXRequest{}, fmt.Errorf("receiver: %w", err) + } + return typesolana.SimulateTXRequest{ + Receiver: recv, + EncodedTransaction: p.EncodedTransaction, + Opts: ConvertSimulateTXOptsFromProto(p.Opts), + }, nil +} + +func ConvertSimulateTXRequestToProto(r typesolana.SimulateTXRequest) *SimulateTXRequest { + return &SimulateTXRequest{ + Receiver: r.Receiver[:], + EncodedTransaction: r.EncodedTransaction, + Opts: ConvertSimulateTXOptsToProto(r.Opts), + } +} + +func ConvertSimulateTXReplyFromProto(p *SimulateTXReply) (*typesolana.SimulateTXReply, error) { + if p == nil { + return nil, nil + } + accs := make([]*typesolana.Account, 0, len(p.Accounts)) + for _, a := range p.Accounts { + acc, err := ConvertAccountFromProto(a) + if err != nil { + return nil, err + } + accs = append(accs, acc) + } + return &typesolana.SimulateTXReply{ + Err: p.Err, + Logs: p.Logs, + Accounts: accs, + UnitsConsumed: ptrUint64(p.UnitsConsumed), + }, nil +} + +func ConvertSimulateTXReplyToProto(r *typesolana.SimulateTXReply) *SimulateTXReply { + if r == nil { + return nil + } + var units uint64 + if r.UnitsConsumed != nil { + units = *r.UnitsConsumed + } + out := &SimulateTXReply{ + Err: r.Err, + Logs: r.Logs, + UnitsConsumed: units, + } + for _, a := range r.Accounts { + out.Accounts = append(out.Accounts, ConvertAccountToProto(a)) + } + return out +} + +func ConvertComputeConfigFromProto(p *ComputeConfig) *typesolana.ComputeConfig { + if p == nil { + return nil + } + return &typesolana.ComputeConfig{ + ComputeLimit: &p.ComputeLimit, + ComputeMaxPrice: &p.ComputeMaxPrice, + } +} + +func ConvertComputeConfigToProto(c *typesolana.ComputeConfig) *ComputeConfig { + if c == nil { + return nil + } + + var cl uint32 + if c.ComputeLimit != nil { + cl = *c.ComputeLimit + } + var cmp uint64 + if c.ComputeMaxPrice != nil { + cmp = *c.ComputeMaxPrice + } + return &ComputeConfig{ + ComputeLimit: cl, + ComputeMaxPrice: cmp, + } +} + +func ConvertSubmitTransactionRequestFromProto(p *SubmitTransactionRequest) (typesolana.SubmitTransactionRequest, error) { + if p == nil { + return typesolana.SubmitTransactionRequest{}, nil + } + rcv, err := ConvertPublicKeyFromProto(p.Receiver) + if err != nil { + return typesolana.SubmitTransactionRequest{}, fmt.Errorf("receiver: %w", err) + } + return typesolana.SubmitTransactionRequest{ + Cfg: ConvertComputeConfigFromProto(p.Cfg), + Receiver: rcv, + EncodedTransaction: p.EncodedTransaction, + }, nil +} + +func ConvertSubmitTransactionRequestToProto(r typesolana.SubmitTransactionRequest) *SubmitTransactionRequest { + return &SubmitTransactionRequest{ + Cfg: ConvertComputeConfigToProto(r.Cfg), + Receiver: r.Receiver[:], + EncodedTransaction: r.EncodedTransaction, + } +} + +func ConvertSubmitTransactionReplyFromProto(p *SubmitTransactionReply) (*typesolana.SubmitTransactionReply, error) { + if p == nil { + return nil, nil + } + sig, err := ConvertSignatureFromProto(p.Signature) + if err != nil { + return nil, err + } + return &typesolana.SubmitTransactionReply{ + Signature: sig, + IdempotencyKey: p.IdempotencyKey, + Status: typesolana.TransactionStatus(p.Status), + }, nil +} + +func ConvertSubmitTransactionReplyToProto(r *typesolana.SubmitTransactionReply) *SubmitTransactionReply { + if r == nil { + return nil + } + return &SubmitTransactionReply{ + Signature: r.Signature[:], + IdempotencyKey: r.IdempotencyKey, + Status: TxStatus(r.Status), + } +} + +func ConvertRPCContextFromProto(p *RPCContext) typesolana.RPCContext { + if p == nil { + return typesolana.RPCContext{} + } + return typesolana.RPCContext{Slot: p.Slot} +} + +func ConvertRPCContextToProto(r typesolana.RPCContext) *RPCContext { + return &RPCContext{Slot: r.Slot} +} + +func ConvertLogFromProto(p *Log) (*typesolana.Log, error) { + if p == nil { + return nil, nil + } + addr, err := ConvertPublicKeyFromProto(p.Address) + if err != nil && len(p.Address) > 0 { // address optional + return nil, fmt.Errorf("address: %w", err) + } + ev, _ := ConvertEventSigFromProto(p.EventSig) + tx, err := ConvertSignatureFromProto(p.TxHash) + if err != nil && len(p.TxHash) > 0 { + return nil, fmt.Errorf("txHash: %w", err) + } + bh, _ := ConvertHashFromProto(p.BlockHash) + var lErr *string + if p.Error != "" { + lErr = &p.Error + } + + return &typesolana.Log{ + ChainID: p.ChainId, + LogIndex: p.LogIndex, + BlockHash: bh, + BlockNumber: p.BlockNumber, + BlockTimestamp: uint64(p.BlockTimestamp), + Address: addr, + EventSig: ev, + TxHash: tx, + Data: p.Data, + SequenceNum: p.SequenceNum, + Error: lErr, + }, nil +} + +func ConvertLogToProto(l *typesolana.Log) *Log { + if l == nil { + return nil + } + var err string + if l.Error != nil { + err = *l.Error + } + return &Log{ + ChainId: l.ChainID, + LogIndex: l.LogIndex, + BlockHash: l.BlockHash[:], + BlockNumber: l.BlockNumber, + BlockTimestamp: l.BlockTimestamp, + Address: l.Address[:], + EventSig: l.EventSig[:], + TxHash: l.TxHash[:], + Data: l.Data, + SequenceNum: l.SequenceNum, + Error: err, + } +} + +func ConvertExpressionsToProto(expressions []query.Expression) ([]*Expression, error) { + protoExpressions := make([]*Expression, 0, len(expressions)) + for _, expr := range expressions { + protoExpression, err := convertExpressionToProto(expr) + if err != nil { + return nil, err + } + protoExpressions = append(protoExpressions, protoExpression) + } + return protoExpressions, nil +} + +func convertExpressionToProto(expression query.Expression) (*Expression, error) { + pbExpression := &Expression{} + if expression.IsPrimitive() { + ep := &Primitive{} + switch primitive := expression.Primitive.(type) { + case *solprimitives.Address: + ep.Primitive = &Primitive_Address{Address: primitive.PubKey[:]} + + putPrimitive(pbExpression, ep) + case *solprimitives.EventSig: + ep.Primitive = &Primitive_EventSig{EventSig: primitive.Sig[:]} + + putPrimitive(pbExpression, ep) + case *solprimitives.EventBySubkey: + ep.Primitive = &Primitive_EventBySubkey{ + EventBySubkey: &EventBySubkey{ + //nolint: gosec // G115 + SubkeyIndex: primitive.SubKeyIndex, + ValueComparers: ConvertValueComparatorsToProto(primitive.ValueComparers), + }, + } + + putPrimitive(pbExpression, ep) + default: + generalPrimitive, err := chaincommonpb.ConvertPrimitiveToProto(primitive, func(value any) (*codecpb.VersionedBytes, error) { + return nil, fmt.Errorf("unsupported primitive type: %T", value) + }) + if err != nil { + return nil, err + } + putGeneralPrimitive(pbExpression, generalPrimitive) + } + return pbExpression, nil + } + + pbExpression.Evaluator = &Expression_BooleanExpression{BooleanExpression: &BooleanExpression{}} + expressions := make([]*Expression, 0) + for _, expr := range expression.BoolExpression.Expressions { + pbExpr, err := convertExpressionToProto(expr) + if err != nil { + return nil, err + } + expressions = append(expressions, pbExpr) + } + pbExpression.Evaluator = &Expression_BooleanExpression{ + BooleanExpression: &BooleanExpression{ + //nolint: gosec // G115 + BooleanOperator: chaincommonpb.BooleanOperator(expression.BoolExpression.BoolOperator), + Expression: expressions, + }} + + return pbExpression, nil +} + +func ConvertValueComparatorsToProto(comparators []solprimitives.IndexedValueComparator) []*IndexedValueComparator { + if len(comparators) == 0 { + return nil + } + + out := make([]*IndexedValueComparator, len(comparators)) + for _, c := range comparators { + out = append(out, &IndexedValueComparator{ + Value: c.Value, + Operator: chaincommonpb.ComparisonOperator(c.Operator), + }) + } + + return nil +} + +func ConvertValueCompraratorsFromProto(comparators []*IndexedValueComparator) []solprimitives.IndexedValueComparator { + if len(comparators) == 0 { + return nil + } + + out := make([]solprimitives.IndexedValueComparator, 0, len(comparators)) + for _, c := range comparators { + out = append(out, solprimitives.IndexedValueComparator{ + Value: c.Value, + Operator: primitives.ComparisonOperator(c.Operator), + }) + } + return out +} + +func putGeneralPrimitive(exp *Expression, p *chaincommonpb.Primitive) { + exp.Evaluator = &Expression_Primitive{Primitive: &Primitive{Primitive: &Primitive_GeneralPrimitive{GeneralPrimitive: p}}} +} + +func ConvertExpressionsFromProto(protoExpressions []*Expression) ([]query.Expression, error) { + expressions := make([]query.Expression, 0, len(protoExpressions)) + if len(protoExpressions) == 0 { + return nil, nil + } + for idx, protoExpression := range protoExpressions { + expr, err := convertExpressionFromProto(protoExpression) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "err to convert expr idx %d err: %s", idx, err.Error()) + } + + expressions = append(expressions, expr) + } + return expressions, nil +} + +func convertExpressionFromProto(protoExpression *Expression) (query.Expression, error) { + if protoExpression == nil { + return query.Expression{}, errors.New("expression can not be nil") + } + + switch protoEvaluatedExpr := protoExpression.GetEvaluator().(type) { + case *Expression_BooleanExpression: + var expressions []query.Expression + for idx, expression := range protoEvaluatedExpr.BooleanExpression.GetExpression() { + convertedExpression, err := convertExpressionFromProto(expression) + if err != nil { + return query.Expression{}, fmt.Errorf("failed to convert sub-expression %d: %w", idx, err) + } + expressions = append(expressions, convertedExpression) + } + if protoEvaluatedExpr.BooleanExpression.GetBooleanOperator() == chaincommonpb.BooleanOperator_AND { + return query.And(expressions...), nil + } + return query.Or(expressions...), nil + + case *Expression_Primitive: + switch primitive := protoEvaluatedExpr.Primitive.GetPrimitive().(type) { + case *Primitive_GeneralPrimitive: + return chaincommonpb.ConvertPrimitiveFromProto(primitive.GeneralPrimitive, func(_ string, _ bool) (any, error) { + return nil, fmt.Errorf("unsupported primitive type: %T", primitive) + }) + default: + return convertSolPrimitiveFromProto(protoEvaluatedExpr.Primitive) + } + default: + return query.Expression{}, fmt.Errorf("unknown expression type: %T", protoExpression.GetEvaluator()) + } +} + +func convertSolPrimitiveFromProto(protoPrimitive *Primitive) (query.Expression, error) { + switch primitive := protoPrimitive.GetPrimitive().(type) { + case *Primitive_Address: + publicKey, err := ConvertPublicKeyFromProto(primitive.Address) + if err != nil { + return query.Expression{}, fmt.Errorf("convert expr err: %w", err) + } + return solprimitives.NewAddressFilter(publicKey), nil + case *Primitive_EventSig: + sig, err := ConvertEventSigFromProto(primitive.EventSig) + if err != nil { + return query.Expression{}, fmt.Errorf("failed to convert event sig: %w", err) + } + return solprimitives.NewEventSigFilter(sig), nil + case *Primitive_EventBySubkey: + return solprimitives.NewEventBySubkeyFilter(primitive.EventBySubkey.SubkeyIndex, ConvertValueCompraratorsFromProto(primitive.EventBySubkey.ValueComparers)), nil + default: + return query.Expression{}, fmt.Errorf("unknown primitive type: %T", primitive) + } +} + +func ConvertLPFilterQueryFromProto(p *LPFilterQuery) (*typesolana.LPFilterQuery, error) { + if p == nil { + return nil, nil + } + var addr typesolana.PublicKey + var err error + if len(p.Address) > 0 { + addr, err = ConvertPublicKeyFromProto(p.Address) + if err != nil { + return nil, fmt.Errorf("filter.address: %w", err) + } + } + var err2 error + var eventSig typesolana.EventSignature + if len(p.EventSig) > 0 { + eventSig, err2 = ConvertEventSigFromProto(p.EventSig) + if err != nil { + return nil, fmt.Errorf("filter.event_sig: %w", err2) + } + } + + return &typesolana.LPFilterQuery{ + Name: p.Name, + Address: addr, + EventName: p.EventName, + EventSig: eventSig, + StartingBlock: p.StartingBlock, + EventIdlJSON: p.EventIdlJson, + SubkeyPaths: ConvertSubkeyPathsFromProto(p.SubkeyPaths), + Retention: time.Duration(p.Retention), + MaxLogsKept: p.MaxLogsKept, + IncludeReverted: p.IncludeReverted, + }, nil +} + +func ConvertSubkeyPathsFromProto(skeys []*Subkeys) [][]string { + if len(skeys) == 0 { + return nil + } + out := make([][]string, 0, len(skeys)) + for _, k := range skeys { + out = append(out, k.Subkeys) + } + + return out +} + +func ConvertSubkeyPathsToProto(keys [][]string) []*Subkeys { + if len(keys) == 0 { + return nil + } + out := make([]*Subkeys, 0, len(keys)) + for _, k := range keys { + out = append(out, &Subkeys{ + Subkeys: k, + }) + } + + return out +} + +func ConvertLPFilterQueryToProto(f *typesolana.LPFilterQuery) *LPFilterQuery { + if f == nil { + return nil + } + + return &LPFilterQuery{ + Name: f.Name, + Address: f.Address[:], + EventName: f.EventName, + EventSig: f.EventSig[:], + StartingBlock: f.StartingBlock, + EventIdlJson: f.EventIdlJSON, + SubkeyPaths: ConvertSubkeyPathsToProto(f.SubkeyPaths), + Retention: int64(f.Retention), + MaxLogsKept: f.MaxLogsKept, + IncludeReverted: f.IncludeReverted, + } +} + +func putPrimitive(exp *Expression, p *Primitive) { + exp.Evaluator = &Expression_Primitive{Primitive: &Primitive{Primitive: p.Primitive}} +} + +func ptrUint64(v uint64) *uint64 { + if v == 0 { + return nil + } + return &v + +} +func ptrBool(v bool) *bool { return &v } +func ptrUnix(v typesolana.UnixTimeSeconds) *typesolana.UnixTimeSeconds { return &v } diff --git a/pkg/chains/solana/proto_helpers_test.go b/pkg/chains/solana/proto_helpers_test.go new file mode 100644 index 0000000000..f66ce6908b --- /dev/null +++ b/pkg/chains/solana/proto_helpers_test.go @@ -0,0 +1,403 @@ +package solana_test + +import ( + "bytes" + "errors" + "testing" + "time" + + "github.com/stretchr/testify/require" + + conv "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" + chain_common "github.com/smartcontractkit/chainlink-common/pkg/loop/chain-common" + typesolana "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + "github.com/smartcontractkit/chainlink-common/pkg/types/query" + solprimitives "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives/solana" +) + +func mkBytes(n int, fill byte) []byte { + b := make([]byte, n) + for i := range b { + b[i] = fill + } + return b +} + +func TestPublicKeyConverters(t *testing.T) { + t.Run("ConvertPublicKeyFromProto", func(t *testing.T) { + cases := []struct { + name string + in []byte + wantErrParts []string + wantEqualsInput bool + }{ + {"accepts 32-byte public key", mkBytes(typesolana.PublicKeyLength, 0xAB), nil, true}, + {"rejects nil public key", nil, []string{"address can't be nil"}, false}, + {"rejects wrong length and shows base58", mkBytes(typesolana.PublicKeyLength-1, 0x01), []string{"invalid public key", "expected", "value="}, false}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + got, err := conv.ConvertPublicKeyFromProto(tc.in) + if tc.wantErrParts != nil { + require.Error(t, err, "expected error") + for _, p := range tc.wantErrParts { + require.Contains(t, err.Error(), p) + } + return + } + require.NoError(t, err) + if tc.wantEqualsInput && !bytes.Equal(got[:], tc.in) { + t.Fatalf("mismatch: got=%x want=%x", got[:], tc.in) + } + }) + } + }) + + t.Run("Roundtrip slice", func(t *testing.T) { + keys := [][]byte{ + mkBytes(typesolana.PublicKeyLength, 0x11), + mkBytes(typesolana.PublicKeyLength, 0x22), + } + dom, err := conv.ConvertPublicKeysFromProto(keys) + require.NoError(t, err) + require.Len(t, dom, 2) + back := conv.ConvertPublicKeysToProto(dom) + require.Len(t, back, 2) + require.True(t, bytes.Equal(back[0], keys[0]) && bytes.Equal(back[1], keys[1])) + }) + + t.Run("AggregatesErrors", func(t *testing.T) { + in := [][]byte{ + mkBytes(typesolana.PublicKeyLength, 0x01), + mkBytes(typesolana.PublicKeyLength-1, 0x02), + nil, + } + got, err := conv.ConvertPublicKeysFromProto(in) + require.Nil(t, got) + require.Error(t, err) + msg := err.Error() + require.Contains(t, msg, "public key[1]") + require.Contains(t, msg, "public key[2]") + }) +} + +func TestSignatureConverters(t *testing.T) { + t.Run("ConvertSignatureFromProto", func(t *testing.T) { + ok := mkBytes(typesolana.SignatureLength, 0xCD) + got, err := conv.ConvertSignatureFromProto(ok) + require.NoError(t, err) + require.True(t, bytes.Equal(ok, got[:])) + + _, err = conv.ConvertSignatureFromProto(nil) + require.ErrorContains(t, err, "signature can't be nil") + + _, err = conv.ConvertSignatureFromProto(mkBytes(typesolana.SignatureLength+1, 0x01)) + require.ErrorContains(t, err, "invalid signature") + require.ErrorContains(t, err, "expected") + require.ErrorContains(t, err, "value=") + }) + + t.Run("Batch/roundtrip", func(t *testing.T) { + s1 := mkBytes(typesolana.SignatureLength, 0xAA) + s2 := mkBytes(typesolana.SignatureLength, 0xBB) + dom, err := conv.ConvertSignaturesFromProto([][]byte{s1, s2}) + require.NoError(t, err) + back := conv.ConvertSignaturesToProto(dom) + require.True(t, bytes.Equal(s1, back[0]) && bytes.Equal(s2, back[1])) + }) + + t.Run("AggregatesErrors", func(t *testing.T) { + _, err := conv.ConvertSignaturesFromProto([][]byte{ + mkBytes(typesolana.SignatureLength-1, 0x01), + nil, + }) + require.Error(t, err) + require.Contains(t, err.Error(), "signature[0]") + require.Contains(t, err.Error(), "signature[1]") + }) +} + +func TestHashConverters(t *testing.T) { + t.Run("ConvertHashFromProto", func(t *testing.T) { + ok := mkBytes(typesolana.HashLength, 0xEF) + got, err := conv.ConvertHashFromProto(ok) + require.NoError(t, err) + require.True(t, bytes.Equal(ok, got[:])) + + _, err = conv.ConvertHashFromProto(nil) + require.ErrorContains(t, err, "hash can't be nil") + + _, err = conv.ConvertHashFromProto(mkBytes(typesolana.HashLength-2, 0x01)) + require.ErrorContains(t, err, "invalid hash") + require.ErrorContains(t, err, "expected") + require.ErrorContains(t, err, "value=") // base58 string + }) +} + +func TestEventSignatureConverters(t *testing.T) { + t.Run("ConvertEventSigFromProto", func(t *testing.T) { + ok := mkBytes(typesolana.EventSignatureLength, 0xAA) + got, err := conv.ConvertEventSigFromProto(ok) + require.NoError(t, err) + require.True(t, bytes.Equal(ok, got[:])) + + _, err = conv.ConvertEventSigFromProto(nil) + require.ErrorContains(t, err, "hash can't be nil") // matches current message + + _, err = conv.ConvertEventSigFromProto(mkBytes(typesolana.EventSignatureLength-1, 0x01)) + require.ErrorContains(t, err, "invalid event signature") + }) +} + +func TestConvertExpressionsFromProto_Errors(t *testing.T) { + testCases := []struct { + Name string + In []*conv.Expression + ExpectedErr string + ExpectedFinal []query.Expression + }{ + { + Name: "empty", + }, + { + Name: "Empty evaluator", + In: []*conv.Expression{{}}, + ExpectedErr: "rpc error: code = InvalidArgument desc = err to convert expr idx 0 err: " + + "unknown expression type: ", + }, + { + Name: "Empty Expression_Primitive", + In: []*conv.Expression{{Evaluator: &conv.Expression_Primitive{}}}, + ExpectedErr: "rpc error: code = InvalidArgument desc = err to convert expr idx 0 err: " + + "unknown primitive type: ", + }, + { + Name: "Empty Expression_BooleanExpression", + In: []*conv.Expression{{Evaluator: &conv.Expression_BooleanExpression{}}}, + ExpectedFinal: []query.Expression{ + {BoolExpression: query.BoolExpression{}}, + }, + }, + { + Name: "Nested empty Expression", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_BooleanExpression{ + BooleanExpression: &conv.BooleanExpression{ + Expression: []*conv.Expression{{}}, + }, + }, + }}, + ExpectedErr: "err to convert expr idx 0 err: failed to convert sub-expression 0: unknown expression type: ", + }, + { + Name: "Empty Evaluator.Primitive.Primitive", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{}, + }, + }}, + ExpectedErr: "rpc error: code = InvalidArgument desc = err to convert expr idx 0 err: unknown primitive type: ", + }, + { + Name: "Empty Evaluator.Primitive.GeneralPrimitive", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{ + Primitive: &conv.Primitive_GeneralPrimitive{}, + }, + }, + }}, + ExpectedErr: "rpc error: code = InvalidArgument desc = err to convert expr idx 0 err: rpc error: code = InvalidArgument desc = primitive can not be nil", + }, + { + Name: "Empty Evaluator.Primitive.GeneralPrimitive.Primitive", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{ + Primitive: &conv.Primitive_GeneralPrimitive{ + GeneralPrimitive: &chain_common.Primitive{}, + }, + }, + }, + }}, + ExpectedErr: "rpc error: code = InvalidArgument desc = err to convert expr idx 0 err: rpc error: code = InvalidArgument desc = unknown primitive type: ", + }, + { + Name: "Empty Comparator in GeneralPrimitive", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{ + Primitive: &conv.Primitive_GeneralPrimitive{ + GeneralPrimitive: &chain_common.Primitive{ + Primitive: &chain_common.Primitive_Comparator{}, + }, + }, + }, + }, + }}, + ExpectedErr: "comparator can not be nil", + }, + { + Name: "Invalid Solana Address primitive (nil bytes)", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{ + Primitive: &conv.Primitive_Address{Address: nil}, + }, + }, + }}, + ExpectedErr: "convert expr err: address can't be nil", + }, + { + Name: "Invalid Solana EventSig primitive (bad len)", + In: []*conv.Expression{{ + Evaluator: &conv.Expression_Primitive{ + Primitive: &conv.Primitive{ + Primitive: &conv.Primitive_EventSig{EventSig: mkBytes(typesolana.EventSignatureLength-1, 0x01)}, + }, + }, + }}, + ExpectedErr: "failed to convert event sig: invalid event signature", + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + got, err := conv.ConvertExpressionsFromProto(tc.In) + if tc.ExpectedErr != "" { + require.Error(t, err) + require.Contains(t, err.Error(), tc.ExpectedErr) + return + } + require.NoError(t, err) + require.Equal(t, tc.ExpectedFinal, got) + }) + } +} + +func TestExpressions_Roundtrip_SolanaPrimitives(t *testing.T) { + // Build (Address AND EventSig) OR EventBySubkey + addrBytes := mkBytes(typesolana.PublicKeyLength, 0x01) + evBytes := mkBytes(typesolana.EventSignatureLength, 0x02) + + addr, err := conv.ConvertPublicKeyFromProto(addrBytes) + require.NoError(t, err) + ev, err := conv.ConvertEventSigFromProto(evBytes) + require.NoError(t, err) + + a := solprimitives.NewAddressFilter(addr) + e := solprimitives.NewEventSigFilter(ev) + evBy := solprimitives.NewEventBySubkeyFilter(1, []solprimitives.IndexedValueComparator{ + {Value: typesolana.IndexedValue{1, 2, 3}, Operator: 0}, + }) + + root := query.Or(query.And(a, e), evBy) + + // to proto + pb, err := conv.ConvertExpressionsToProto([]query.Expression{root}) + require.NoError(t, err) + require.Len(t, pb, 1) + + // from proto + round, err := conv.ConvertExpressionsFromProto(pb) + require.NoError(t, err) + require.Len(t, round, 1) +} + +func TestLPFilterAndSubkeysConverters(t *testing.T) { + f := &conv.LPFilterQuery{ + Name: "test", + Address: mkBytes(typesolana.PublicKeyLength, 0xAA), + EventName: "Evt", + EventSig: mkBytes(typesolana.EventSignatureLength, 0xBB), + StartingBlock: 10, + EventIdlJson: []byte(`{"idl":1}`), + SubkeyPaths: []*conv.Subkeys{{Subkeys: []string{"a", "b"}}, {Subkeys: []string{"c"}}}, + Retention: int64(time.Hour), + MaxLogsKept: 100, + IncludeReverted: true, + } + df, err := conv.ConvertLPFilterQueryFromProto(f) + require.NoError(t, err) + require.Equal(t, "test", df.Name) + require.Equal(t, 2, len(df.SubkeyPaths)) + + back := conv.ConvertLPFilterQueryToProto(df) + require.Equal(t, f.Name, back.Name) + require.Equal(t, f.MaxLogsKept, back.MaxLogsKept) + + // Also exercise subkey helpers alone; ensure shape preserved. + keys := [][]string{{"x", "y"}, {"z"}} + ps := conv.ConvertSubkeyPathsToProto(keys) + got := conv.ConvertSubkeyPathsFromProto(ps) + require.Equal(t, keys, got) +} + +func TestGettersAndSmallStructs_Smoke(t *testing.T) { + // A few quick "does not panic / round-trips" on small structs + + // DataSlice + ds := &conv.DataSlice{Offset: 5, Length: 7} + dd := conv.ConvertDataSliceFromProto(ds) + require.NotNil(t, dd) + require.EqualValues(t, 5, *dd.Offset) + require.EqualValues(t, 7, *dd.Length) + ds2 := conv.ConvertDataSliceToProto(dd) + require.EqualValues(t, 5, ds2.Offset) + require.EqualValues(t, 7, ds2.Length) + + // UiTokenAmount + ui := &conv.UiTokenAmount{Amount: "42", Decimals: 6, UiAmountString: "0.000042"} + du := conv.ConvertUiTokenAmountFromProto(ui) + require.NotNil(t, du) + require.Equal(t, uint8(6), du.Decimals) + ui2 := conv.ConvertUiTokenAmountToProto(du) + require.EqualValues(t, 6, ui2.Decimals) + + // Commitment/Encoding enums (spot) + require.Equal(t, conv.EncodingType_ENCODING_TYPE_BASE64, conv.ConvertEncodingTypeToProto(typesolana.EncodingBase64)) + require.Equal(t, typesolana.EncodingJSON, conv.ConvertEncodingTypeFromProto(conv.EncodingType_ENCODING_TYPE_JSON)) + require.Equal(t, conv.CommitmentType_COMMITMENT_TYPE_FINALIZED, conv.ConvertCommitmentToProto(typesolana.CommitmentFinalized)) + require.Equal(t, typesolana.CommitmentProcessed, conv.ConvertCommitmentFromProto(conv.CommitmentType_COMMITMENT_TYPE_PROCESSED)) +} + +func TestGetSignatureStatusesConverters(t *testing.T) { + req := &conv.GetSignatureStatusesRequest{Sigs: [][]byte{mkBytes(typesolana.SignatureLength, 0xAA)}} + dr, err := conv.ConvertGetSignatureStatusesRequestFromProto(req) + require.NoError(t, err) + req2 := conv.ConvertGetSignatureStatusesRequestToProto(dr) + require.Len(t, req2.Sigs, 1) + require.True(t, bytes.Equal(req.Sigs[0], req2.Sigs[0])) + c := uint64(2) + rep := &conv.GetSignatureStatusesReply{ + Results: []*conv.GetSignatureStatusesResult{{ + Slot: 1, + Confirmations: &c, + Err: "", + ConfirmationStatus: conv.ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_CONFIRMED, + }}, + } + drep := conv.ConvertGetSignatureStatusesReplyFromProto(rep) + require.EqualValues(t, 1, drep.Results[0].Slot) + require.NotNil(t, drep.Results[0].Confirmations) + require.EqualValues(t, c, *drep.Results[0].Confirmations) + + rep2 := conv.ConvertGetSignatureStatusesReplyToProto(drep) + require.EqualValues(t, &c, rep2.Results[0].Confirmations) + require.Equal(t, conv.ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_CONFIRMED, rep2.Results[0].ConfirmationStatus) +} + +func TestErrorJoinBehavior_PublicKeys(t *testing.T) { + in := [][]byte{ + mkBytes(typesolana.PublicKeyLength-1, 0x01), + nil, + } + _, err := conv.ConvertPublicKeysFromProto(in) + require.Error(t, err) + // Error should mention both indices + require.Contains(t, err.Error(), "public key[0]") + require.Contains(t, err.Error(), "public key[1]") + + // Ensure errors.Is behaves reasonably (not super strict here) + require.True(t, errors.Is(err, err)) +} diff --git a/pkg/chains/solana/solana.pb.go b/pkg/chains/solana/solana.pb.go new file mode 100644 index 0000000000..c3f8baeec4 --- /dev/null +++ b/pkg/chains/solana/solana.pb.go @@ -0,0 +1,4489 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.8 +// protoc v5.29.3 +// source: solana.proto + +package solana + +import ( + chain_common "github.com/smartcontractkit/chainlink-common/pkg/loop/chain-common" + pb "github.com/smartcontractkit/chainlink-protos/cre/go/values/pb" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// Account/tx data encodings. +type EncodingType int32 + +const ( + EncodingType_ENCODING_TYPE_NONE EncodingType = 0 + EncodingType_ENCODING_TYPE_BASE58 EncodingType = 1 // for data <129 bytes + EncodingType_ENCODING_TYPE_BASE64 EncodingType = 2 // any size + EncodingType_ENCODING_TYPE_BASE64_ZSTD EncodingType = 3 // zstd-compressed, base64-wrapped + EncodingType_ENCODING_TYPE_JSON_PARSED EncodingType = 4 // program parsers; fallback to base64 if unknown + EncodingType_ENCODING_TYPE_JSON EncodingType = 5 // raw JSON (rare; prefer JSON_PARSED) +) + +// Enum value maps for EncodingType. +var ( + EncodingType_name = map[int32]string{ + 0: "ENCODING_TYPE_NONE", + 1: "ENCODING_TYPE_BASE58", + 2: "ENCODING_TYPE_BASE64", + 3: "ENCODING_TYPE_BASE64_ZSTD", + 4: "ENCODING_TYPE_JSON_PARSED", + 5: "ENCODING_TYPE_JSON", + } + EncodingType_value = map[string]int32{ + "ENCODING_TYPE_NONE": 0, + "ENCODING_TYPE_BASE58": 1, + "ENCODING_TYPE_BASE64": 2, + "ENCODING_TYPE_BASE64_ZSTD": 3, + "ENCODING_TYPE_JSON_PARSED": 4, + "ENCODING_TYPE_JSON": 5, + } +) + +func (x EncodingType) Enum() *EncodingType { + p := new(EncodingType) + *p = x + return p +} + +func (x EncodingType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (EncodingType) Descriptor() protoreflect.EnumDescriptor { + return file_solana_proto_enumTypes[0].Descriptor() +} + +func (EncodingType) Type() protoreflect.EnumType { + return &file_solana_proto_enumTypes[0] +} + +func (x EncodingType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use EncodingType.Descriptor instead. +func (EncodingType) EnumDescriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{0} +} + +// Read consistency of queried state. +type CommitmentType int32 + +const ( + CommitmentType_COMMITMENT_TYPE_NONE CommitmentType = 0 + CommitmentType_COMMITMENT_TYPE_FINALIZED CommitmentType = 1 // cluster-finalized + CommitmentType_COMMITMENT_TYPE_CONFIRMED CommitmentType = 2 // voted by supermajority + CommitmentType_COMMITMENT_TYPE_PROCESSED CommitmentType = 3 // node’s latest +) + +// Enum value maps for CommitmentType. +var ( + CommitmentType_name = map[int32]string{ + 0: "COMMITMENT_TYPE_NONE", + 1: "COMMITMENT_TYPE_FINALIZED", + 2: "COMMITMENT_TYPE_CONFIRMED", + 3: "COMMITMENT_TYPE_PROCESSED", + } + CommitmentType_value = map[string]int32{ + "COMMITMENT_TYPE_NONE": 0, + "COMMITMENT_TYPE_FINALIZED": 1, + "COMMITMENT_TYPE_CONFIRMED": 2, + "COMMITMENT_TYPE_PROCESSED": 3, + } +) + +func (x CommitmentType) Enum() *CommitmentType { + p := new(CommitmentType) + *p = x + return p +} + +func (x CommitmentType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (CommitmentType) Descriptor() protoreflect.EnumDescriptor { + return file_solana_proto_enumTypes[1].Descriptor() +} + +func (CommitmentType) Type() protoreflect.EnumType { + return &file_solana_proto_enumTypes[1] +} + +func (x CommitmentType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use CommitmentType.Descriptor instead. +func (CommitmentType) EnumDescriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{1} +} + +// Cluster confirmation status of a tx/signature. +type ConfirmationStatusType int32 + +const ( + ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_NONE ConfirmationStatusType = 0 + ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_PROCESSED ConfirmationStatusType = 1 + ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_CONFIRMED ConfirmationStatusType = 2 + ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_FINALIZED ConfirmationStatusType = 3 +) + +// Enum value maps for ConfirmationStatusType. +var ( + ConfirmationStatusType_name = map[int32]string{ + 0: "CONFIRMATION_STATUS_TYPE_NONE", + 1: "CONFIRMATION_STATUS_TYPE_PROCESSED", + 2: "CONFIRMATION_STATUS_TYPE_CONFIRMED", + 3: "CONFIRMATION_STATUS_TYPE_FINALIZED", + } + ConfirmationStatusType_value = map[string]int32{ + "CONFIRMATION_STATUS_TYPE_NONE": 0, + "CONFIRMATION_STATUS_TYPE_PROCESSED": 1, + "CONFIRMATION_STATUS_TYPE_CONFIRMED": 2, + "CONFIRMATION_STATUS_TYPE_FINALIZED": 3, + } +) + +func (x ConfirmationStatusType) Enum() *ConfirmationStatusType { + p := new(ConfirmationStatusType) + *p = x + return p +} + +func (x ConfirmationStatusType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ConfirmationStatusType) Descriptor() protoreflect.EnumDescriptor { + return file_solana_proto_enumTypes[2].Descriptor() +} + +func (ConfirmationStatusType) Type() protoreflect.EnumType { + return &file_solana_proto_enumTypes[2] +} + +func (x ConfirmationStatusType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ConfirmationStatusType.Descriptor instead. +func (ConfirmationStatusType) EnumDescriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{2} +} + +// Transaction execution status returned by submitters/simulations. +type TxStatus int32 + +const ( + TxStatus_TX_STATUS_FATAL TxStatus = 0 // unrecoverable failure + TxStatus_TX_STATUS_ABORTED TxStatus = 1 // not executed / dropped + TxStatus_TX_STATUS_SUCCESS TxStatus = 2 // executed successfully +) + +// Enum value maps for TxStatus. +var ( + TxStatus_name = map[int32]string{ + 0: "TX_STATUS_FATAL", + 1: "TX_STATUS_ABORTED", + 2: "TX_STATUS_SUCCESS", + } + TxStatus_value = map[string]int32{ + "TX_STATUS_FATAL": 0, + "TX_STATUS_ABORTED": 1, + "TX_STATUS_SUCCESS": 2, + } +) + +func (x TxStatus) Enum() *TxStatus { + p := new(TxStatus) + *p = x + return p +} + +func (x TxStatus) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TxStatus) Descriptor() protoreflect.EnumDescriptor { + return file_solana_proto_enumTypes[3].Descriptor() +} + +func (TxStatus) Type() protoreflect.EnumType { + return &file_solana_proto_enumTypes[3] +} + +func (x TxStatus) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TxStatus.Descriptor instead. +func (TxStatus) EnumDescriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{3} +} + +// On-chain account state. +type Account struct { + state protoimpl.MessageState `protogen:"open.v1"` + Lamports uint64 `protobuf:"varint,1,opt,name=lamports,proto3" json:"lamports,omitempty"` // balance in lamports (1e-9 SOL) + Owner []byte `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"` // 32-byte program id (Pubkey) + Data *DataBytesOrJSON `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // account data (encoded or JSON) + Executable bool `protobuf:"varint,4,opt,name=executable,proto3" json:"executable,omitempty"` // true if this is a program account + RentEpoch *pb.BigInt `protobuf:"bytes,5,opt,name=rent_epoch,json=rentEpoch,proto3" json:"rent_epoch,omitempty"` // next rent epoch + Space uint64 `protobuf:"varint,6,opt,name=space,proto3" json:"space,omitempty"` // data length in bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Account) Reset() { + *x = Account{} + mi := &file_solana_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Account) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Account) ProtoMessage() {} + +func (x *Account) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Account.ProtoReflect.Descriptor instead. +func (*Account) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{0} +} + +func (x *Account) GetLamports() uint64 { + if x != nil { + return x.Lamports + } + return 0 +} + +func (x *Account) GetOwner() []byte { + if x != nil { + return x.Owner + } + return nil +} + +func (x *Account) GetData() *DataBytesOrJSON { + if x != nil { + return x.Data + } + return nil +} + +func (x *Account) GetExecutable() bool { + if x != nil { + return x.Executable + } + return false +} + +func (x *Account) GetRentEpoch() *pb.BigInt { + if x != nil { + return x.RentEpoch + } + return nil +} + +func (x *Account) GetSpace() uint64 { + if x != nil { + return x.Space + } + return 0 +} + +// Compute budget configuration when submitting txs. +type ComputeConfig struct { + state protoimpl.MessageState `protogen:"open.v1"` + ComputeLimit uint32 `protobuf:"varint,1,opt,name=compute_limit,json=computeLimit,proto3" json:"compute_limit,omitempty"` // max CUs (approx per-tx limit) + ComputeMaxPrice uint64 `protobuf:"varint,2,opt,name=compute_max_price,json=computeMaxPrice,proto3" json:"compute_max_price,omitempty"` // max lamports per CU + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ComputeConfig) Reset() { + *x = ComputeConfig{} + mi := &file_solana_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ComputeConfig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ComputeConfig) ProtoMessage() {} + +func (x *ComputeConfig) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ComputeConfig.ProtoReflect.Descriptor instead. +func (*ComputeConfig) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{1} +} + +func (x *ComputeConfig) GetComputeLimit() uint32 { + if x != nil { + return x.ComputeLimit + } + return 0 +} + +func (x *ComputeConfig) GetComputeMaxPrice() uint64 { + if x != nil { + return x.ComputeMaxPrice + } + return 0 +} + +// Raw bytes vs parsed JSON (as returned by RPC). +type DataBytesOrJSON struct { + state protoimpl.MessageState `protogen:"open.v1"` + Encoding EncodingType `protobuf:"varint,1,opt,name=encoding,proto3,enum=loop.solana.EncodingType" json:"encoding,omitempty"` + // Types that are valid to be assigned to Body: + // + // *DataBytesOrJSON_Raw + // *DataBytesOrJSON_Json + Body isDataBytesOrJSON_Body `protobuf_oneof:"body"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataBytesOrJSON) Reset() { + *x = DataBytesOrJSON{} + mi := &file_solana_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataBytesOrJSON) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataBytesOrJSON) ProtoMessage() {} + +func (x *DataBytesOrJSON) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataBytesOrJSON.ProtoReflect.Descriptor instead. +func (*DataBytesOrJSON) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{2} +} + +func (x *DataBytesOrJSON) GetEncoding() EncodingType { + if x != nil { + return x.Encoding + } + return EncodingType_ENCODING_TYPE_NONE +} + +func (x *DataBytesOrJSON) GetBody() isDataBytesOrJSON_Body { + if x != nil { + return x.Body + } + return nil +} + +func (x *DataBytesOrJSON) GetRaw() []byte { + if x != nil { + if x, ok := x.Body.(*DataBytesOrJSON_Raw); ok { + return x.Raw + } + } + return nil +} + +func (x *DataBytesOrJSON) GetJson() []byte { + if x != nil { + if x, ok := x.Body.(*DataBytesOrJSON_Json); ok { + return x.Json + } + } + return nil +} + +type isDataBytesOrJSON_Body interface { + isDataBytesOrJSON_Body() +} + +type DataBytesOrJSON_Raw struct { + Raw []byte `protobuf:"bytes,2,opt,name=raw,proto3,oneof"` // program data (node’s base64/base58 decoded) +} + +type DataBytesOrJSON_Json struct { + Json []byte `protobuf:"bytes,3,opt,name=json,proto3,oneof"` // json: UTF-8 bytes of the jsonParsed payload. +} + +func (*DataBytesOrJSON_Raw) isDataBytesOrJSON_Body() {} + +func (*DataBytesOrJSON_Json) isDataBytesOrJSON_Body() {} + +// Return a slice of account data. +type DataSlice struct { + state protoimpl.MessageState `protogen:"open.v1"` + Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"` // start byte + Length uint64 `protobuf:"varint,2,opt,name=length,proto3" json:"length,omitempty"` // number of bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *DataSlice) Reset() { + *x = DataSlice{} + mi := &file_solana_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *DataSlice) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DataSlice) ProtoMessage() {} + +func (x *DataSlice) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DataSlice.ProtoReflect.Descriptor instead. +func (*DataSlice) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{3} +} + +func (x *DataSlice) GetOffset() uint64 { + if x != nil { + return x.Offset + } + return 0 +} + +func (x *DataSlice) GetLength() uint64 { + if x != nil { + return x.Length + } + return 0 +} + +// Options for GetAccountInfo. +type GetAccountInfoOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + Encoding EncodingType `protobuf:"varint,1,opt,name=encoding,proto3,enum=loop.solana.EncodingType" json:"encoding,omitempty"` // data encoding + Commitment CommitmentType `protobuf:"varint,2,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + DataSlice *DataSlice `protobuf:"bytes,3,opt,name=data_slice,json=dataSlice,proto3" json:"data_slice,omitempty"` // optional slice window + MinContextSlot uint64 `protobuf:"varint,4,opt,name=min_context_slot,json=minContextSlot,proto3" json:"min_context_slot,omitempty"` // lower bound slot + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAccountInfoOpts) Reset() { + *x = GetAccountInfoOpts{} + mi := &file_solana_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAccountInfoOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountInfoOpts) ProtoMessage() {} + +func (x *GetAccountInfoOpts) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountInfoOpts.ProtoReflect.Descriptor instead. +func (*GetAccountInfoOpts) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{4} +} + +func (x *GetAccountInfoOpts) GetEncoding() EncodingType { + if x != nil { + return x.Encoding + } + return EncodingType_ENCODING_TYPE_NONE +} + +func (x *GetAccountInfoOpts) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +func (x *GetAccountInfoOpts) GetDataSlice() *DataSlice { + if x != nil { + return x.DataSlice + } + return nil +} + +func (x *GetAccountInfoOpts) GetMinContextSlot() uint64 { + if x != nil { + return x.MinContextSlot + } + return 0 +} + +// Reply for GetAccountInfoWithOpts. +type GetAccountInfoWithOptsReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + RpcContext *RPCContext `protobuf:"bytes,1,opt,name=rpc_context,json=rpcContext,proto3" json:"rpc_context,omitempty"` // read slot + Value *Account `protobuf:"bytes,2,opt,name=value,proto3,oneof" json:"value,omitempty"` // account (may be empty) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAccountInfoWithOptsReply) Reset() { + *x = GetAccountInfoWithOptsReply{} + mi := &file_solana_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAccountInfoWithOptsReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountInfoWithOptsReply) ProtoMessage() {} + +func (x *GetAccountInfoWithOptsReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountInfoWithOptsReply.ProtoReflect.Descriptor instead. +func (*GetAccountInfoWithOptsReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{5} +} + +func (x *GetAccountInfoWithOptsReply) GetRpcContext() *RPCContext { + if x != nil { + return x.RpcContext + } + return nil +} + +func (x *GetAccountInfoWithOptsReply) GetValue() *Account { + if x != nil { + return x.Value + } + return nil +} + +// Request for GetAccountInfoWithOpts. +type GetAccountInfoWithOptsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Account []byte `protobuf:"bytes,1,opt,name=account,proto3" json:"account,omitempty"` // 32-byte Pubkey + Opts *GetAccountInfoOpts `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetAccountInfoWithOptsRequest) Reset() { + *x = GetAccountInfoWithOptsRequest{} + mi := &file_solana_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetAccountInfoWithOptsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetAccountInfoWithOptsRequest) ProtoMessage() {} + +func (x *GetAccountInfoWithOptsRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetAccountInfoWithOptsRequest.ProtoReflect.Descriptor instead. +func (*GetAccountInfoWithOptsRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{6} +} + +func (x *GetAccountInfoWithOptsRequest) GetAccount() []byte { + if x != nil { + return x.Account + } + return nil +} + +func (x *GetAccountInfoWithOptsRequest) GetOpts() *GetAccountInfoOpts { + if x != nil { + return x.Opts + } + return nil +} + +// Reply for GetBalance. +type GetBalanceReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` // lamports + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBalanceReply) Reset() { + *x = GetBalanceReply{} + mi := &file_solana_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBalanceReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBalanceReply) ProtoMessage() {} + +func (x *GetBalanceReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBalanceReply.ProtoReflect.Descriptor instead. +func (*GetBalanceReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{7} +} + +func (x *GetBalanceReply) GetValue() uint64 { + if x != nil { + return x.Value + } + return 0 +} + +// Request for GetBalance. +type GetBalanceRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` // 32-byte Pubkey + Commitment CommitmentType `protobuf:"varint,2,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBalanceRequest) Reset() { + *x = GetBalanceRequest{} + mi := &file_solana_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBalanceRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBalanceRequest) ProtoMessage() {} + +func (x *GetBalanceRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBalanceRequest.ProtoReflect.Descriptor instead. +func (*GetBalanceRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{8} +} + +func (x *GetBalanceRequest) GetAddr() []byte { + if x != nil { + return x.Addr + } + return nil +} + +func (x *GetBalanceRequest) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +// Options for GetBlock. +type GetBlockOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + Commitment CommitmentType `protobuf:"varint,4,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBlockOpts) Reset() { + *x = GetBlockOpts{} + mi := &file_solana_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBlockOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBlockOpts) ProtoMessage() {} + +func (x *GetBlockOpts) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBlockOpts.ProtoReflect.Descriptor instead. +func (*GetBlockOpts) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{9} +} + +func (x *GetBlockOpts) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +// Block response. +type GetBlockReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Blockhash []byte `protobuf:"bytes,1,opt,name=blockhash,proto3" json:"blockhash,omitempty"` // 32-byte block hash + PreviousBlockhash []byte `protobuf:"bytes,2,opt,name=previous_blockhash,json=previousBlockhash,proto3" json:"previous_blockhash,omitempty"` // 32-byte parent hash + ParentSlot uint64 `protobuf:"varint,3,opt,name=parent_slot,json=parentSlot,proto3" json:"parent_slot,omitempty"` + BlockTime *int64 `protobuf:"varint,4,opt,name=block_time,json=blockTime,proto3,oneof" json:"block_time,omitempty"` // unix seconds, node may not report it + BlockHeight uint64 `protobuf:"varint,5,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // chain height + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBlockReply) Reset() { + *x = GetBlockReply{} + mi := &file_solana_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBlockReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBlockReply) ProtoMessage() {} + +func (x *GetBlockReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBlockReply.ProtoReflect.Descriptor instead. +func (*GetBlockReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{10} +} + +func (x *GetBlockReply) GetBlockhash() []byte { + if x != nil { + return x.Blockhash + } + return nil +} + +func (x *GetBlockReply) GetPreviousBlockhash() []byte { + if x != nil { + return x.PreviousBlockhash + } + return nil +} + +func (x *GetBlockReply) GetParentSlot() uint64 { + if x != nil { + return x.ParentSlot + } + return 0 +} + +func (x *GetBlockReply) GetBlockTime() int64 { + if x != nil && x.BlockTime != nil { + return *x.BlockTime + } + return 0 +} + +func (x *GetBlockReply) GetBlockHeight() uint64 { + if x != nil { + return x.BlockHeight + } + return 0 +} + +// Request for GetBlock. +type GetBlockRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` // target slot + Opts *GetBlockOpts `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetBlockRequest) Reset() { + *x = GetBlockRequest{} + mi := &file_solana_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetBlockRequest) ProtoMessage() {} + +func (x *GetBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetBlockRequest.ProtoReflect.Descriptor instead. +func (*GetBlockRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{11} +} + +func (x *GetBlockRequest) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *GetBlockRequest) GetOpts() *GetBlockOpts { + if x != nil { + return x.Opts + } + return nil +} + +// Fee quote for a base58-encoded Message. +type GetFeeForMessageReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Fee uint64 `protobuf:"varint,1,opt,name=fee,proto3" json:"fee,omitempty"` // lamports + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFeeForMessageReply) Reset() { + *x = GetFeeForMessageReply{} + mi := &file_solana_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFeeForMessageReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFeeForMessageReply) ProtoMessage() {} + +func (x *GetFeeForMessageReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFeeForMessageReply.ProtoReflect.Descriptor instead. +func (*GetFeeForMessageReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{12} +} + +func (x *GetFeeForMessageReply) GetFee() uint64 { + if x != nil { + return x.Fee + } + return 0 +} + +type GetFeeForMessageRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // must be base58-encoded Message + Commitment CommitmentType `protobuf:"varint,2,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetFeeForMessageRequest) Reset() { + *x = GetFeeForMessageRequest{} + mi := &file_solana_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetFeeForMessageRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetFeeForMessageRequest) ProtoMessage() {} + +func (x *GetFeeForMessageRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetFeeForMessageRequest.ProtoReflect.Descriptor instead. +func (*GetFeeForMessageRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{13} +} + +func (x *GetFeeForMessageRequest) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +func (x *GetFeeForMessageRequest) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +// Options for GetMultipleAccounts. +type GetMultipleAccountsOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + Encoding EncodingType `protobuf:"varint,1,opt,name=encoding,proto3,enum=loop.solana.EncodingType" json:"encoding,omitempty"` + Commitment CommitmentType `protobuf:"varint,2,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` + DataSlice *DataSlice `protobuf:"bytes,3,opt,name=data_slice,json=dataSlice,proto3" json:"data_slice,omitempty"` + MinContextSlot uint64 `protobuf:"varint,4,opt,name=min_context_slot,json=minContextSlot,proto3" json:"min_context_slot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMultipleAccountsOpts) Reset() { + *x = GetMultipleAccountsOpts{} + mi := &file_solana_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMultipleAccountsOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMultipleAccountsOpts) ProtoMessage() {} + +func (x *GetMultipleAccountsOpts) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMultipleAccountsOpts.ProtoReflect.Descriptor instead. +func (*GetMultipleAccountsOpts) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{14} +} + +func (x *GetMultipleAccountsOpts) GetEncoding() EncodingType { + if x != nil { + return x.Encoding + } + return EncodingType_ENCODING_TYPE_NONE +} + +func (x *GetMultipleAccountsOpts) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +func (x *GetMultipleAccountsOpts) GetDataSlice() *DataSlice { + if x != nil { + return x.DataSlice + } + return nil +} + +func (x *GetMultipleAccountsOpts) GetMinContextSlot() uint64 { + if x != nil { + return x.MinContextSlot + } + return 0 +} + +type OptionalAccountWrapper struct { + state protoimpl.MessageState `protogen:"open.v1"` + Account *Account `protobuf:"bytes,1,opt,name=account,proto3,oneof" json:"account,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OptionalAccountWrapper) Reset() { + *x = OptionalAccountWrapper{} + mi := &file_solana_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OptionalAccountWrapper) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OptionalAccountWrapper) ProtoMessage() {} + +func (x *OptionalAccountWrapper) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OptionalAccountWrapper.ProtoReflect.Descriptor instead. +func (*OptionalAccountWrapper) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{15} +} + +func (x *OptionalAccountWrapper) GetAccount() *Account { + if x != nil { + return x.Account + } + return nil +} + +// Reply for GetMultipleAccountsWithOpts. +type GetMultipleAccountsWithOptsReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + RpcContext *RPCContext `protobuf:"bytes,1,opt,name=rpc_context,json=rpcContext,proto3" json:"rpc_context,omitempty"` // read slot + Value []*OptionalAccountWrapper `protobuf:"bytes,2,rep,name=value,proto3" json:"value,omitempty"` // accounts (nil entries allowed) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMultipleAccountsWithOptsReply) Reset() { + *x = GetMultipleAccountsWithOptsReply{} + mi := &file_solana_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMultipleAccountsWithOptsReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMultipleAccountsWithOptsReply) ProtoMessage() {} + +func (x *GetMultipleAccountsWithOptsReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMultipleAccountsWithOptsReply.ProtoReflect.Descriptor instead. +func (*GetMultipleAccountsWithOptsReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{16} +} + +func (x *GetMultipleAccountsWithOptsReply) GetRpcContext() *RPCContext { + if x != nil { + return x.RpcContext + } + return nil +} + +func (x *GetMultipleAccountsWithOptsReply) GetValue() []*OptionalAccountWrapper { + if x != nil { + return x.Value + } + return nil +} + +// Request for GetMultipleAccountsWithOpts. +type GetMultipleAccountsWithOptsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Accounts [][]byte `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"` // list of 32-byte Pubkeys + Opts *GetMultipleAccountsOpts `protobuf:"bytes,2,opt,name=opts,proto3" json:"opts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetMultipleAccountsWithOptsRequest) Reset() { + *x = GetMultipleAccountsWithOptsRequest{} + mi := &file_solana_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetMultipleAccountsWithOptsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMultipleAccountsWithOptsRequest) ProtoMessage() {} + +func (x *GetMultipleAccountsWithOptsRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMultipleAccountsWithOptsRequest.ProtoReflect.Descriptor instead. +func (*GetMultipleAccountsWithOptsRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{17} +} + +func (x *GetMultipleAccountsWithOptsRequest) GetAccounts() [][]byte { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *GetMultipleAccountsWithOptsRequest) GetOpts() *GetMultipleAccountsOpts { + if x != nil { + return x.Opts + } + return nil +} + +// Reply for GetSignatureStatuses. +type GetSignatureStatusesReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Results []*GetSignatureStatusesResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"` // 1:1 with input + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSignatureStatusesReply) Reset() { + *x = GetSignatureStatusesReply{} + mi := &file_solana_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSignatureStatusesReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSignatureStatusesReply) ProtoMessage() {} + +func (x *GetSignatureStatusesReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSignatureStatusesReply.ProtoReflect.Descriptor instead. +func (*GetSignatureStatusesReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{18} +} + +func (x *GetSignatureStatusesReply) GetResults() []*GetSignatureStatusesResult { + if x != nil { + return x.Results + } + return nil +} + +// Request for GetSignatureStatuses. +type GetSignatureStatusesRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Sigs [][]byte `protobuf:"bytes,1,rep,name=sigs,proto3" json:"sigs,omitempty"` // 64-byte signatures + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSignatureStatusesRequest) Reset() { + *x = GetSignatureStatusesRequest{} + mi := &file_solana_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSignatureStatusesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSignatureStatusesRequest) ProtoMessage() {} + +func (x *GetSignatureStatusesRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSignatureStatusesRequest.ProtoReflect.Descriptor instead. +func (*GetSignatureStatusesRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{19} +} + +func (x *GetSignatureStatusesRequest) GetSigs() [][]byte { + if x != nil { + return x.Sigs + } + return nil +} + +// Per-signature status. +type GetSignatureStatusesResult struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` // processed slot + Confirmations *uint64 `protobuf:"varint,2,opt,name=confirmations,proto3,oneof" json:"confirmations,omitempty"` // null->0 here + Err string `protobuf:"bytes,3,opt,name=err,proto3" json:"err,omitempty"` // error JSON string (empty on success) + ConfirmationStatus ConfirmationStatusType `protobuf:"varint,4,opt,name=confirmation_status,json=confirmationStatus,proto3,enum=loop.solana.ConfirmationStatusType" json:"confirmation_status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSignatureStatusesResult) Reset() { + *x = GetSignatureStatusesResult{} + mi := &file_solana_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSignatureStatusesResult) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSignatureStatusesResult) ProtoMessage() {} + +func (x *GetSignatureStatusesResult) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSignatureStatusesResult.ProtoReflect.Descriptor instead. +func (*GetSignatureStatusesResult) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{20} +} + +func (x *GetSignatureStatusesResult) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *GetSignatureStatusesResult) GetConfirmations() uint64 { + if x != nil && x.Confirmations != nil { + return *x.Confirmations + } + return 0 +} + +func (x *GetSignatureStatusesResult) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +func (x *GetSignatureStatusesResult) GetConfirmationStatus() ConfirmationStatusType { + if x != nil { + return x.ConfirmationStatus + } + return ConfirmationStatusType_CONFIRMATION_STATUS_TYPE_NONE +} + +// Current “height” (blocks below latest). +type GetSlotHeightReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSlotHeightReply) Reset() { + *x = GetSlotHeightReply{} + mi := &file_solana_proto_msgTypes[21] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSlotHeightReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSlotHeightReply) ProtoMessage() {} + +func (x *GetSlotHeightReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[21] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSlotHeightReply.ProtoReflect.Descriptor instead. +func (*GetSlotHeightReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{21} +} + +func (x *GetSlotHeightReply) GetHeight() uint64 { + if x != nil { + return x.Height + } + return 0 +} + +type GetSlotHeightRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Commitment CommitmentType `protobuf:"varint,1,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSlotHeightRequest) Reset() { + *x = GetSlotHeightRequest{} + mi := &file_solana_proto_msgTypes[22] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSlotHeightRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSlotHeightRequest) ProtoMessage() {} + +func (x *GetSlotHeightRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[22] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSlotHeightRequest.ProtoReflect.Descriptor instead. +func (*GetSlotHeightRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{22} +} + +func (x *GetSlotHeightRequest) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +// Message header counts. +type MessageHeader struct { + state protoimpl.MessageState `protogen:"open.v1"` + NumRequiredSignatures uint32 `protobuf:"varint,1,opt,name=num_required_signatures,json=numRequiredSignatures,proto3" json:"num_required_signatures,omitempty"` // signer count + NumReadonlySignedAccounts uint32 `protobuf:"varint,2,opt,name=num_readonly_signed_accounts,json=numReadonlySignedAccounts,proto3" json:"num_readonly_signed_accounts,omitempty"` // trailing signed RO + NumReadonlyUnsignedAccounts uint32 `protobuf:"varint,3,opt,name=num_readonly_unsigned_accounts,json=numReadonlyUnsignedAccounts,proto3" json:"num_readonly_unsigned_accounts,omitempty"` // trailing unsigned RO + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *MessageHeader) Reset() { + *x = MessageHeader{} + mi := &file_solana_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *MessageHeader) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MessageHeader) ProtoMessage() {} + +func (x *MessageHeader) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[23] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MessageHeader.ProtoReflect.Descriptor instead. +func (*MessageHeader) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{23} +} + +func (x *MessageHeader) GetNumRequiredSignatures() uint32 { + if x != nil { + return x.NumRequiredSignatures + } + return 0 +} + +func (x *MessageHeader) GetNumReadonlySignedAccounts() uint32 { + if x != nil { + return x.NumReadonlySignedAccounts + } + return 0 +} + +func (x *MessageHeader) GetNumReadonlyUnsignedAccounts() uint32 { + if x != nil { + return x.NumReadonlyUnsignedAccounts + } + return 0 +} + +// Parsed message (no address tables). +type ParsedMessage struct { + state protoimpl.MessageState `protogen:"open.v1"` + RecentBlockhash []byte `protobuf:"bytes,1,opt,name=recent_blockhash,json=recentBlockhash,proto3" json:"recent_blockhash,omitempty"` // 32-byte Hash + AccountKeys [][]byte `protobuf:"bytes,2,rep,name=account_keys,json=accountKeys,proto3" json:"account_keys,omitempty"` // list of 32-byte Pubkeys + Header *MessageHeader `protobuf:"bytes,3,opt,name=header,proto3" json:"header,omitempty"` + Instructions []*CompiledInstruction `protobuf:"bytes,4,rep,name=instructions,proto3" json:"instructions,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ParsedMessage) Reset() { + *x = ParsedMessage{} + mi := &file_solana_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ParsedMessage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParsedMessage) ProtoMessage() {} + +func (x *ParsedMessage) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[24] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParsedMessage.ProtoReflect.Descriptor instead. +func (*ParsedMessage) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{24} +} + +func (x *ParsedMessage) GetRecentBlockhash() []byte { + if x != nil { + return x.RecentBlockhash + } + return nil +} + +func (x *ParsedMessage) GetAccountKeys() [][]byte { + if x != nil { + return x.AccountKeys + } + return nil +} + +func (x *ParsedMessage) GetHeader() *MessageHeader { + if x != nil { + return x.Header + } + return nil +} + +func (x *ParsedMessage) GetInstructions() []*CompiledInstruction { + if x != nil { + return x.Instructions + } + return nil +} + +// Parsed transaction (signatures + message). +type ParsedTransaction struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signatures [][]byte `protobuf:"bytes,1,rep,name=signatures,proto3" json:"signatures,omitempty"` // 64-byte signatures + Message *ParsedMessage `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ParsedTransaction) Reset() { + *x = ParsedTransaction{} + mi := &file_solana_proto_msgTypes[25] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ParsedTransaction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ParsedTransaction) ProtoMessage() {} + +func (x *ParsedTransaction) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[25] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ParsedTransaction.ProtoReflect.Descriptor instead. +func (*ParsedTransaction) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{25} +} + +func (x *ParsedTransaction) GetSignatures() [][]byte { + if x != nil { + return x.Signatures + } + return nil +} + +func (x *ParsedTransaction) GetMessage() *ParsedMessage { + if x != nil { + return x.Message + } + return nil +} + +// Token amount (UI-friendly). +type UiTokenAmount struct { + state protoimpl.MessageState `protogen:"open.v1"` + Amount string `protobuf:"bytes,1,opt,name=amount,proto3" json:"amount,omitempty"` // raw integer string + Decimals uint32 `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"` // mint decimals + UiAmountString string `protobuf:"bytes,4,opt,name=ui_amount_string,json=uiAmountString,proto3" json:"ui_amount_string,omitempty"` // amount / 10^decimals + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UiTokenAmount) Reset() { + *x = UiTokenAmount{} + mi := &file_solana_proto_msgTypes[26] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UiTokenAmount) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UiTokenAmount) ProtoMessage() {} + +func (x *UiTokenAmount) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[26] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UiTokenAmount.ProtoReflect.Descriptor instead. +func (*UiTokenAmount) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{26} +} + +func (x *UiTokenAmount) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + +func (x *UiTokenAmount) GetDecimals() uint32 { + if x != nil { + return x.Decimals + } + return 0 +} + +func (x *UiTokenAmount) GetUiAmountString() string { + if x != nil { + return x.UiAmountString + } + return "" +} + +// SPL token balance entry. +type TokenBalance struct { + state protoimpl.MessageState `protogen:"open.v1"` + AccountIndex uint32 `protobuf:"varint,1,opt,name=account_index,json=accountIndex,proto3" json:"account_index,omitempty"` // index in account_keys + Owner []byte `protobuf:"bytes,2,opt,name=owner,proto3,oneof" json:"owner,omitempty"` // 32-byte owner (optional) + ProgramId []byte `protobuf:"bytes,3,opt,name=program_id,json=programId,proto3,oneof" json:"program_id,omitempty"` // 32-byte token program (optional) + Mint []byte `protobuf:"bytes,4,opt,name=mint,proto3" json:"mint,omitempty"` // 32-byte mint + Ui *UiTokenAmount `protobuf:"bytes,5,opt,name=ui,proto3" json:"ui,omitempty"` // formatted amounts + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TokenBalance) Reset() { + *x = TokenBalance{} + mi := &file_solana_proto_msgTypes[27] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TokenBalance) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TokenBalance) ProtoMessage() {} + +func (x *TokenBalance) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[27] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TokenBalance.ProtoReflect.Descriptor instead. +func (*TokenBalance) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{27} +} + +func (x *TokenBalance) GetAccountIndex() uint32 { + if x != nil { + return x.AccountIndex + } + return 0 +} + +func (x *TokenBalance) GetOwner() []byte { + if x != nil { + return x.Owner + } + return nil +} + +func (x *TokenBalance) GetProgramId() []byte { + if x != nil { + return x.ProgramId + } + return nil +} + +func (x *TokenBalance) GetMint() []byte { + if x != nil { + return x.Mint + } + return nil +} + +func (x *TokenBalance) GetUi() *UiTokenAmount { + if x != nil { + return x.Ui + } + return nil +} + +// Inner instruction list at a given outer instruction index. +type InnerInstruction struct { + state protoimpl.MessageState `protogen:"open.v1"` + Index uint32 `protobuf:"varint,1,opt,name=index,proto3" json:"index,omitempty"` // outer ix index + Instructions []*CompiledInstruction `protobuf:"bytes,2,rep,name=instructions,proto3" json:"instructions,omitempty"` // invoked ixs + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *InnerInstruction) Reset() { + *x = InnerInstruction{} + mi := &file_solana_proto_msgTypes[28] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *InnerInstruction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*InnerInstruction) ProtoMessage() {} + +func (x *InnerInstruction) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[28] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use InnerInstruction.ProtoReflect.Descriptor instead. +func (*InnerInstruction) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{28} +} + +func (x *InnerInstruction) GetIndex() uint32 { + if x != nil { + return x.Index + } + return 0 +} + +func (x *InnerInstruction) GetInstructions() []*CompiledInstruction { + if x != nil { + return x.Instructions + } + return nil +} + +// Address table lookups expanded by loader. +type LoadedAddresses struct { + state protoimpl.MessageState `protogen:"open.v1"` + Readonly [][]byte `protobuf:"bytes,1,rep,name=readonly,proto3" json:"readonly,omitempty"` // 32-byte Pubkeys + Writable [][]byte `protobuf:"bytes,2,rep,name=writable,proto3" json:"writable,omitempty"` // 32-byte Pubkeys + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LoadedAddresses) Reset() { + *x = LoadedAddresses{} + mi := &file_solana_proto_msgTypes[29] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LoadedAddresses) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LoadedAddresses) ProtoMessage() {} + +func (x *LoadedAddresses) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[29] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LoadedAddresses.ProtoReflect.Descriptor instead. +func (*LoadedAddresses) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{29} +} + +func (x *LoadedAddresses) GetReadonly() [][]byte { + if x != nil { + return x.Readonly + } + return nil +} + +func (x *LoadedAddresses) GetWritable() [][]byte { + if x != nil { + return x.Writable + } + return nil +} + +// Compiled (program) instruction. +type CompiledInstruction struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProgramIdIndex uint32 `protobuf:"varint,1,opt,name=program_id_index,json=programIdIndex,proto3" json:"program_id_index,omitempty"` // index into account_keys + Accounts []uint32 `protobuf:"varint,2,rep,packed,name=accounts,proto3" json:"accounts,omitempty"` // indices into account_keys + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` // program input bytes + StackHeight uint32 `protobuf:"varint,4,opt,name=stack_height,json=stackHeight,proto3" json:"stack_height,omitempty"` // if recorded by node + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CompiledInstruction) Reset() { + *x = CompiledInstruction{} + mi := &file_solana_proto_msgTypes[30] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CompiledInstruction) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CompiledInstruction) ProtoMessage() {} + +func (x *CompiledInstruction) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[30] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CompiledInstruction.ProtoReflect.Descriptor instead. +func (*CompiledInstruction) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{30} +} + +func (x *CompiledInstruction) GetProgramIdIndex() uint32 { + if x != nil { + return x.ProgramIdIndex + } + return 0 +} + +func (x *CompiledInstruction) GetAccounts() []uint32 { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *CompiledInstruction) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *CompiledInstruction) GetStackHeight() uint32 { + if x != nil { + return x.StackHeight + } + return 0 +} + +// Raw bytes with encoding tag. +type Data struct { + state protoimpl.MessageState `protogen:"open.v1"` + Content []byte `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // raw bytes + Encoding EncodingType `protobuf:"varint,2,opt,name=encoding,proto3,enum=loop.solana.EncodingType" json:"encoding,omitempty"` // how it was encoded originally + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Data) Reset() { + *x = Data{} + mi := &file_solana_proto_msgTypes[31] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Data) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Data) ProtoMessage() {} + +func (x *Data) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[31] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Data.ProtoReflect.Descriptor instead. +func (*Data) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{31} +} + +func (x *Data) GetContent() []byte { + if x != nil { + return x.Content + } + return nil +} + +func (x *Data) GetEncoding() EncodingType { + if x != nil { + return x.Encoding + } + return EncodingType_ENCODING_TYPE_NONE +} + +// Program return data. +type ReturnData struct { + state protoimpl.MessageState `protogen:"open.v1"` + ProgramId []byte `protobuf:"bytes,1,opt,name=program_id,json=programId,proto3" json:"program_id,omitempty"` // 32-byte Pubkey + Data *Data `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` // raw return bytes + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *ReturnData) Reset() { + *x = ReturnData{} + mi := &file_solana_proto_msgTypes[32] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *ReturnData) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReturnData) ProtoMessage() {} + +func (x *ReturnData) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[32] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ReturnData.ProtoReflect.Descriptor instead. +func (*ReturnData) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{32} +} + +func (x *ReturnData) GetProgramId() []byte { + if x != nil { + return x.ProgramId + } + return nil +} + +func (x *ReturnData) GetData() *Data { + if x != nil { + return x.Data + } + return nil +} + +// Transaction execution metadata. +type TransactionMeta struct { + state protoimpl.MessageState `protogen:"open.v1"` + ErrJson string `protobuf:"bytes,1,opt,name=err_json,json=errJson,proto3" json:"err_json,omitempty"` // error JSON (empty on success) + Fee uint64 `protobuf:"varint,2,opt,name=fee,proto3" json:"fee,omitempty"` // lamports + PreBalances []uint64 `protobuf:"varint,3,rep,packed,name=pre_balances,json=preBalances,proto3" json:"pre_balances,omitempty"` // lamports per account + PostBalances []uint64 `protobuf:"varint,4,rep,packed,name=post_balances,json=postBalances,proto3" json:"post_balances,omitempty"` // lamports per account + LogMessages []string `protobuf:"bytes,5,rep,name=log_messages,json=logMessages,proto3" json:"log_messages,omitempty"` // runtime logs + PreTokenBalances []*TokenBalance `protobuf:"bytes,6,rep,name=pre_token_balances,json=preTokenBalances,proto3" json:"pre_token_balances,omitempty"` + PostTokenBalances []*TokenBalance `protobuf:"bytes,7,rep,name=post_token_balances,json=postTokenBalances,proto3" json:"post_token_balances,omitempty"` + InnerInstructions []*InnerInstruction `protobuf:"bytes,8,rep,name=inner_instructions,json=innerInstructions,proto3" json:"inner_instructions,omitempty"` + LoadedAddresses *LoadedAddresses `protobuf:"bytes,9,opt,name=loaded_addresses,json=loadedAddresses,proto3" json:"loaded_addresses,omitempty"` + ReturnData *ReturnData `protobuf:"bytes,10,opt,name=return_data,json=returnData,proto3" json:"return_data,omitempty"` + ComputeUnitsConsumed *uint64 `protobuf:"varint,11,opt,name=compute_units_consumed,json=computeUnitsConsumed,proto3,oneof" json:"compute_units_consumed,omitempty"` // CUs + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransactionMeta) Reset() { + *x = TransactionMeta{} + mi := &file_solana_proto_msgTypes[33] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransactionMeta) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionMeta) ProtoMessage() {} + +func (x *TransactionMeta) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[33] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransactionMeta.ProtoReflect.Descriptor instead. +func (*TransactionMeta) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{33} +} + +func (x *TransactionMeta) GetErrJson() string { + if x != nil { + return x.ErrJson + } + return "" +} + +func (x *TransactionMeta) GetFee() uint64 { + if x != nil { + return x.Fee + } + return 0 +} + +func (x *TransactionMeta) GetPreBalances() []uint64 { + if x != nil { + return x.PreBalances + } + return nil +} + +func (x *TransactionMeta) GetPostBalances() []uint64 { + if x != nil { + return x.PostBalances + } + return nil +} + +func (x *TransactionMeta) GetLogMessages() []string { + if x != nil { + return x.LogMessages + } + return nil +} + +func (x *TransactionMeta) GetPreTokenBalances() []*TokenBalance { + if x != nil { + return x.PreTokenBalances + } + return nil +} + +func (x *TransactionMeta) GetPostTokenBalances() []*TokenBalance { + if x != nil { + return x.PostTokenBalances + } + return nil +} + +func (x *TransactionMeta) GetInnerInstructions() []*InnerInstruction { + if x != nil { + return x.InnerInstructions + } + return nil +} + +func (x *TransactionMeta) GetLoadedAddresses() *LoadedAddresses { + if x != nil { + return x.LoadedAddresses + } + return nil +} + +func (x *TransactionMeta) GetReturnData() *ReturnData { + if x != nil { + return x.ReturnData + } + return nil +} + +func (x *TransactionMeta) GetComputeUnitsConsumed() uint64 { + if x != nil && x.ComputeUnitsConsumed != nil { + return *x.ComputeUnitsConsumed + } + return 0 +} + +// Transaction envelope: raw bytes or parsed struct. +type TransactionEnvelope struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Transaction: + // + // *TransactionEnvelope_Raw + // *TransactionEnvelope_Parsed + Transaction isTransactionEnvelope_Transaction `protobuf_oneof:"transaction"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *TransactionEnvelope) Reset() { + *x = TransactionEnvelope{} + mi := &file_solana_proto_msgTypes[34] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *TransactionEnvelope) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionEnvelope) ProtoMessage() {} + +func (x *TransactionEnvelope) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[34] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use TransactionEnvelope.ProtoReflect.Descriptor instead. +func (*TransactionEnvelope) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{34} +} + +func (x *TransactionEnvelope) GetTransaction() isTransactionEnvelope_Transaction { + if x != nil { + return x.Transaction + } + return nil +} + +func (x *TransactionEnvelope) GetRaw() []byte { + if x != nil { + if x, ok := x.Transaction.(*TransactionEnvelope_Raw); ok { + return x.Raw + } + } + return nil +} + +func (x *TransactionEnvelope) GetParsed() *ParsedTransaction { + if x != nil { + if x, ok := x.Transaction.(*TransactionEnvelope_Parsed); ok { + return x.Parsed + } + } + return nil +} + +type isTransactionEnvelope_Transaction interface { + isTransactionEnvelope_Transaction() +} + +type TransactionEnvelope_Raw struct { + Raw []byte `protobuf:"bytes,1,opt,name=raw,proto3,oneof"` // raw tx bytes (for RAW/base64) +} + +type TransactionEnvelope_Parsed struct { + Parsed *ParsedTransaction `protobuf:"bytes,2,opt,name=parsed,proto3,oneof"` // parsed tx (for JSON_PARSED) +} + +func (*TransactionEnvelope_Raw) isTransactionEnvelope_Transaction() {} + +func (*TransactionEnvelope_Parsed) isTransactionEnvelope_Transaction() {} + +// GetTransaction reply. +type GetTransactionReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` // processed slot + BlockTime *int64 `protobuf:"varint,2,opt,name=block_time,json=blockTime,proto3,oneof" json:"block_time,omitempty"` // unix seconds + Transaction *TransactionEnvelope `protobuf:"bytes,3,opt,name=transaction,proto3,oneof" json:"transaction,omitempty"` // tx bytes or parsed + Meta *TransactionMeta `protobuf:"bytes,4,opt,name=meta,proto3,oneof" json:"meta,omitempty"` // may be omitted by node + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTransactionReply) Reset() { + *x = GetTransactionReply{} + mi := &file_solana_proto_msgTypes[35] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTransactionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTransactionReply) ProtoMessage() {} + +func (x *GetTransactionReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[35] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTransactionReply.ProtoReflect.Descriptor instead. +func (*GetTransactionReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{35} +} + +func (x *GetTransactionReply) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +func (x *GetTransactionReply) GetBlockTime() int64 { + if x != nil && x.BlockTime != nil { + return *x.BlockTime + } + return 0 +} + +func (x *GetTransactionReply) GetTransaction() *TransactionEnvelope { + if x != nil { + return x.Transaction + } + return nil +} + +func (x *GetTransactionReply) GetMeta() *TransactionMeta { + if x != nil { + return x.Meta + } + return nil +} + +// GetTransaction request. +type GetTransactionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` // 64-byte signature + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetTransactionRequest) Reset() { + *x = GetTransactionRequest{} + mi := &file_solana_proto_msgTypes[36] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetTransactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetTransactionRequest) ProtoMessage() {} + +func (x *GetTransactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[36] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetTransactionRequest.ProtoReflect.Descriptor instead. +func (*GetTransactionRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{36} +} + +func (x *GetTransactionRequest) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +// RPC read context. +type RPCContext struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RPCContext) Reset() { + *x = RPCContext{} + mi := &file_solana_proto_msgTypes[37] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RPCContext) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RPCContext) ProtoMessage() {} + +func (x *RPCContext) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[37] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RPCContext.ProtoReflect.Descriptor instead. +func (*RPCContext) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{37} +} + +func (x *RPCContext) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +// Simulation options. +type SimulateTXOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + SigVerify bool `protobuf:"varint,1,opt,name=sig_verify,json=sigVerify,proto3" json:"sig_verify,omitempty"` // verify sigs + Commitment CommitmentType `protobuf:"varint,2,opt,name=commitment,proto3,enum=loop.solana.CommitmentType" json:"commitment,omitempty"` // read consistency + ReplaceRecentBlockhash bool `protobuf:"varint,3,opt,name=replace_recent_blockhash,json=replaceRecentBlockhash,proto3" json:"replace_recent_blockhash,omitempty"` // refresh blockhash + Accounts *SimulateTransactionAccountsOpts `protobuf:"bytes,4,opt,name=accounts,proto3" json:"accounts,omitempty"` // return accounts + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulateTXOpts) Reset() { + *x = SimulateTXOpts{} + mi := &file_solana_proto_msgTypes[38] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulateTXOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulateTXOpts) ProtoMessage() {} + +func (x *SimulateTXOpts) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[38] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulateTXOpts.ProtoReflect.Descriptor instead. +func (*SimulateTXOpts) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{38} +} + +func (x *SimulateTXOpts) GetSigVerify() bool { + if x != nil { + return x.SigVerify + } + return false +} + +func (x *SimulateTXOpts) GetCommitment() CommitmentType { + if x != nil { + return x.Commitment + } + return CommitmentType_COMMITMENT_TYPE_NONE +} + +func (x *SimulateTXOpts) GetReplaceRecentBlockhash() bool { + if x != nil { + return x.ReplaceRecentBlockhash + } + return false +} + +func (x *SimulateTXOpts) GetAccounts() *SimulateTransactionAccountsOpts { + if x != nil { + return x.Accounts + } + return nil +} + +// Simulation result. +type SimulateTXReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Err string `protobuf:"bytes,1,opt,name=err,proto3" json:"err,omitempty"` // empty on success + Logs []string `protobuf:"bytes,2,rep,name=logs,proto3" json:"logs,omitempty"` // runtime logs + Accounts []*Account `protobuf:"bytes,3,rep,name=accounts,proto3" json:"accounts,omitempty"` // returned accounts + UnitsConsumed uint64 `protobuf:"varint,4,opt,name=units_consumed,json=unitsConsumed,proto3" json:"units_consumed,omitempty"` // CUs + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulateTXReply) Reset() { + *x = SimulateTXReply{} + mi := &file_solana_proto_msgTypes[39] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulateTXReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulateTXReply) ProtoMessage() {} + +func (x *SimulateTXReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[39] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulateTXReply.ProtoReflect.Descriptor instead. +func (*SimulateTXReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{39} +} + +func (x *SimulateTXReply) GetErr() string { + if x != nil { + return x.Err + } + return "" +} + +func (x *SimulateTXReply) GetLogs() []string { + if x != nil { + return x.Logs + } + return nil +} + +func (x *SimulateTXReply) GetAccounts() []*Account { + if x != nil { + return x.Accounts + } + return nil +} + +func (x *SimulateTXReply) GetUnitsConsumed() uint64 { + if x != nil { + return x.UnitsConsumed + } + return 0 +} + +// Simulation request. +type SimulateTXRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Receiver []byte `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"` // 32-byte program id (target) + EncodedTransaction string `protobuf:"bytes,2,opt,name=encoded_transaction,json=encodedTransaction,proto3" json:"encoded_transaction,omitempty"` // base64/base58 tx + Opts *SimulateTXOpts `protobuf:"bytes,3,opt,name=opts,proto3" json:"opts,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulateTXRequest) Reset() { + *x = SimulateTXRequest{} + mi := &file_solana_proto_msgTypes[40] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulateTXRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulateTXRequest) ProtoMessage() {} + +func (x *SimulateTXRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[40] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulateTXRequest.ProtoReflect.Descriptor instead. +func (*SimulateTXRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{40} +} + +func (x *SimulateTXRequest) GetReceiver() []byte { + if x != nil { + return x.Receiver + } + return nil +} + +func (x *SimulateTXRequest) GetEncodedTransaction() string { + if x != nil { + return x.EncodedTransaction + } + return "" +} + +func (x *SimulateTXRequest) GetOpts() *SimulateTXOpts { + if x != nil { + return x.Opts + } + return nil +} + +// Accounts to return during simulation. +type SimulateTransactionAccountsOpts struct { + state protoimpl.MessageState `protogen:"open.v1"` + Encoding EncodingType `protobuf:"varint,1,opt,name=encoding,proto3,enum=loop.solana.EncodingType" json:"encoding,omitempty"` // account data encoding + Addresses [][]byte `protobuf:"bytes,2,rep,name=addresses,proto3" json:"addresses,omitempty"` // 32-byte Pubkeys + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SimulateTransactionAccountsOpts) Reset() { + *x = SimulateTransactionAccountsOpts{} + mi := &file_solana_proto_msgTypes[41] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SimulateTransactionAccountsOpts) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SimulateTransactionAccountsOpts) ProtoMessage() {} + +func (x *SimulateTransactionAccountsOpts) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[41] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SimulateTransactionAccountsOpts.ProtoReflect.Descriptor instead. +func (*SimulateTransactionAccountsOpts) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{41} +} + +func (x *SimulateTransactionAccountsOpts) GetEncoding() EncodingType { + if x != nil { + return x.Encoding + } + return EncodingType_ENCODING_TYPE_NONE +} + +func (x *SimulateTransactionAccountsOpts) GetAddresses() [][]byte { + if x != nil { + return x.Addresses + } + return nil +} + +// Submit transaction result. +type SubmitTransactionReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"` // 64-byte signature + IdempotencyKey string `protobuf:"bytes,2,opt,name=idempotency_key,json=idempotencyKey,proto3" json:"idempotency_key,omitempty"` // echo key + Status TxStatus `protobuf:"varint,3,opt,name=status,proto3,enum=loop.solana.TxStatus" json:"status,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubmitTransactionReply) Reset() { + *x = SubmitTransactionReply{} + mi := &file_solana_proto_msgTypes[42] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubmitTransactionReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubmitTransactionReply) ProtoMessage() {} + +func (x *SubmitTransactionReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[42] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubmitTransactionReply.ProtoReflect.Descriptor instead. +func (*SubmitTransactionReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{42} +} + +func (x *SubmitTransactionReply) GetSignature() []byte { + if x != nil { + return x.Signature + } + return nil +} + +func (x *SubmitTransactionReply) GetIdempotencyKey() string { + if x != nil { + return x.IdempotencyKey + } + return "" +} + +func (x *SubmitTransactionReply) GetStatus() TxStatus { + if x != nil { + return x.Status + } + return TxStatus_TX_STATUS_FATAL +} + +// Submit transaction request. +type SubmitTransactionRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Cfg *ComputeConfig `protobuf:"bytes,1,opt,name=cfg,proto3" json:"cfg,omitempty"` // compute budget + Receiver []byte `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"` // 32-byte program id (target) + EncodedTransaction string `protobuf:"bytes,3,opt,name=encoded_transaction,json=encodedTransaction,proto3" json:"encoded_transaction,omitempty"` // base64/base58 tx + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SubmitTransactionRequest) Reset() { + *x = SubmitTransactionRequest{} + mi := &file_solana_proto_msgTypes[43] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SubmitTransactionRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SubmitTransactionRequest) ProtoMessage() {} + +func (x *SubmitTransactionRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[43] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SubmitTransactionRequest.ProtoReflect.Descriptor instead. +func (*SubmitTransactionRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{43} +} + +func (x *SubmitTransactionRequest) GetCfg() *ComputeConfig { + if x != nil { + return x.Cfg + } + return nil +} + +func (x *SubmitTransactionRequest) GetReceiver() []byte { + if x != nil { + return x.Receiver + } + return nil +} + +func (x *SubmitTransactionRequest) GetEncodedTransaction() string { + if x != nil { + return x.EncodedTransaction + } + return "" +} + +// Event/topic filter by hashed value(s). +type EventSig struct { + state protoimpl.MessageState `protogen:"open.v1"` + Topic uint64 `protobuf:"varint,1,opt,name=topic,proto3" json:"topic,omitempty"` // topic index + HashedValueComparers []*HashedValueComparator `protobuf:"bytes,2,rep,name=hashed_value_comparers,json=hashedValueComparers,proto3" json:"hashed_value_comparers,omitempty"` // comparisons + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EventSig) Reset() { + *x = EventSig{} + mi := &file_solana_proto_msgTypes[44] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EventSig) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventSig) ProtoMessage() {} + +func (x *EventSig) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[44] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventSig.ProtoReflect.Descriptor instead. +func (*EventSig) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{44} +} + +func (x *EventSig) GetTopic() uint64 { + if x != nil { + return x.Topic + } + return 0 +} + +func (x *EventSig) GetHashedValueComparers() []*HashedValueComparator { + if x != nil { + return x.HashedValueComparers + } + return nil +} + +// Comparator for a single indexed value. +type IndexedValueComparator struct { + state protoimpl.MessageState `protogen:"open.v1"` + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // raw bytes + Operator chain_common.ComparisonOperator `protobuf:"varint,2,opt,name=operator,proto3,enum=loop.chain.common.ComparisonOperator" json:"operator,omitempty"` // eq/lt/gt etc. + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *IndexedValueComparator) Reset() { + *x = IndexedValueComparator{} + mi := &file_solana_proto_msgTypes[45] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *IndexedValueComparator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IndexedValueComparator) ProtoMessage() {} + +func (x *IndexedValueComparator) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[45] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use IndexedValueComparator.ProtoReflect.Descriptor instead. +func (*IndexedValueComparator) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{45} +} + +func (x *IndexedValueComparator) GetValue() []byte { + if x != nil { + return x.Value + } + return nil +} + +func (x *IndexedValueComparator) GetOperator() chain_common.ComparisonOperator { + if x != nil { + return x.Operator + } + return chain_common.ComparisonOperator(0) +} + +// Filter events by a subkey path. +type EventBySubkey struct { + state protoimpl.MessageState `protogen:"open.v1"` + SubkeyIndex uint64 `protobuf:"varint,1,opt,name=subkey_index,json=subkeyIndex,proto3" json:"subkey_index,omitempty"` // path element index + ValueComparers []*IndexedValueComparator `protobuf:"bytes,2,rep,name=value_comparers,json=valueComparers,proto3" json:"value_comparers,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *EventBySubkey) Reset() { + *x = EventBySubkey{} + mi := &file_solana_proto_msgTypes[46] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *EventBySubkey) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EventBySubkey) ProtoMessage() {} + +func (x *EventBySubkey) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[46] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use EventBySubkey.ProtoReflect.Descriptor instead. +func (*EventBySubkey) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{46} +} + +func (x *EventBySubkey) GetSubkeyIndex() uint64 { + if x != nil { + return x.SubkeyIndex + } + return 0 +} + +func (x *EventBySubkey) GetValueComparers() []*IndexedValueComparator { + if x != nil { + return x.ValueComparers + } + return nil +} + +// Expression tree wrapper. +type Expression struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Evaluator: + // + // *Expression_Primitive + // *Expression_BooleanExpression + Evaluator isExpression_Evaluator `protobuf_oneof:"evaluator"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Expression) Reset() { + *x = Expression{} + mi := &file_solana_proto_msgTypes[47] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Expression) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Expression) ProtoMessage() {} + +func (x *Expression) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[47] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Expression.ProtoReflect.Descriptor instead. +func (*Expression) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{47} +} + +func (x *Expression) GetEvaluator() isExpression_Evaluator { + if x != nil { + return x.Evaluator + } + return nil +} + +func (x *Expression) GetPrimitive() *Primitive { + if x != nil { + if x, ok := x.Evaluator.(*Expression_Primitive); ok { + return x.Primitive + } + } + return nil +} + +func (x *Expression) GetBooleanExpression() *BooleanExpression { + if x != nil { + if x, ok := x.Evaluator.(*Expression_BooleanExpression); ok { + return x.BooleanExpression + } + } + return nil +} + +type isExpression_Evaluator interface { + isExpression_Evaluator() +} + +type Expression_Primitive struct { + Primitive *Primitive `protobuf:"bytes,1,opt,name=primitive,proto3,oneof"` // leaf filter +} + +type Expression_BooleanExpression struct { + BooleanExpression *BooleanExpression `protobuf:"bytes,2,opt,name=boolean_expression,json=booleanExpression,proto3,oneof"` // AND/OR of expressions +} + +func (*Expression_Primitive) isExpression_Evaluator() {} + +func (*Expression_BooleanExpression) isExpression_Evaluator() {} + +// Boolean composition over expressions. +type BooleanExpression struct { + state protoimpl.MessageState `protogen:"open.v1"` + BooleanOperator chain_common.BooleanOperator `protobuf:"varint,1,opt,name=boolean_operator,json=booleanOperator,proto3,enum=loop.chain.common.BooleanOperator" json:"boolean_operator,omitempty"` // AND/OR + Expression []*Expression `protobuf:"bytes,2,rep,name=expression,proto3" json:"expression,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *BooleanExpression) Reset() { + *x = BooleanExpression{} + mi := &file_solana_proto_msgTypes[48] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *BooleanExpression) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooleanExpression) ProtoMessage() {} + +func (x *BooleanExpression) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[48] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BooleanExpression.ProtoReflect.Descriptor instead. +func (*BooleanExpression) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{48} +} + +func (x *BooleanExpression) GetBooleanOperator() chain_common.BooleanOperator { + if x != nil { + return x.BooleanOperator + } + return chain_common.BooleanOperator(0) +} + +func (x *BooleanExpression) GetExpression() []*Expression { + if x != nil { + return x.Expression + } + return nil +} + +// Primitive leaf for expressions/filters. +type Primitive struct { + state protoimpl.MessageState `protogen:"open.v1"` + // Types that are valid to be assigned to Primitive: + // + // *Primitive_GeneralPrimitive + // *Primitive_Address + // *Primitive_EventSig + // *Primitive_EventBySubkey + Primitive isPrimitive_Primitive `protobuf_oneof:"primitive"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Primitive) Reset() { + *x = Primitive{} + mi := &file_solana_proto_msgTypes[49] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Primitive) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Primitive) ProtoMessage() {} + +func (x *Primitive) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[49] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Primitive.ProtoReflect.Descriptor instead. +func (*Primitive) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{49} +} + +func (x *Primitive) GetPrimitive() isPrimitive_Primitive { + if x != nil { + return x.Primitive + } + return nil +} + +func (x *Primitive) GetGeneralPrimitive() *chain_common.Primitive { + if x != nil { + if x, ok := x.Primitive.(*Primitive_GeneralPrimitive); ok { + return x.GeneralPrimitive + } + } + return nil +} + +func (x *Primitive) GetAddress() []byte { + if x != nil { + if x, ok := x.Primitive.(*Primitive_Address); ok { + return x.Address + } + } + return nil +} + +func (x *Primitive) GetEventSig() []byte { + if x != nil { + if x, ok := x.Primitive.(*Primitive_EventSig); ok { + return x.EventSig + } + } + return nil +} + +func (x *Primitive) GetEventBySubkey() *EventBySubkey { + if x != nil { + if x, ok := x.Primitive.(*Primitive_EventBySubkey); ok { + return x.EventBySubkey + } + } + return nil +} + +type isPrimitive_Primitive interface { + isPrimitive_Primitive() +} + +type Primitive_GeneralPrimitive struct { + GeneralPrimitive *chain_common.Primitive `protobuf:"bytes,1,opt,name=general_primitive,json=generalPrimitive,proto3,oneof"` // shared primitives +} + +type Primitive_Address struct { + Address []byte `protobuf:"bytes,2,opt,name=address,proto3,oneof"` // 32-byte program id +} + +type Primitive_EventSig struct { + EventSig []byte `protobuf:"bytes,3,opt,name=event_sig,json=eventSig,proto3,oneof"` // 8-byte discriminator +} + +type Primitive_EventBySubkey struct { + EventBySubkey *EventBySubkey `protobuf:"bytes,4,opt,name=event_by_subkey,json=eventBySubkey,proto3,oneof"` // subkey filter +} + +func (*Primitive_GeneralPrimitive) isPrimitive_Primitive() {} + +func (*Primitive_Address) isPrimitive_Primitive() {} + +func (*Primitive_EventSig) isPrimitive_Primitive() {} + +func (*Primitive_EventBySubkey) isPrimitive_Primitive() {} + +// Comparator against hashed values. +type HashedValueComparator struct { + state protoimpl.MessageState `protogen:"open.v1"` + Values [][]byte `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` // hashed bytes + Operator int64 `protobuf:"varint,2,opt,name=operator,proto3" json:"operator,omitempty"` // comparison op + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *HashedValueComparator) Reset() { + *x = HashedValueComparator{} + mi := &file_solana_proto_msgTypes[50] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *HashedValueComparator) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HashedValueComparator) ProtoMessage() {} + +func (x *HashedValueComparator) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[50] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HashedValueComparator.ProtoReflect.Descriptor instead. +func (*HashedValueComparator) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{50} +} + +func (x *HashedValueComparator) GetValues() [][]byte { + if x != nil { + return x.Values + } + return nil +} + +func (x *HashedValueComparator) GetOperator() int64 { + if x != nil { + return x.Operator + } + return 0 +} + +// Subkey path elements. +type Subkeys struct { + state protoimpl.MessageState `protogen:"open.v1"` + Subkeys []string `protobuf:"bytes,1,rep,name=subkeys,proto3" json:"subkeys,omitempty"` // e.g., ["events","0","fields","owner"] + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Subkeys) Reset() { + *x = Subkeys{} + mi := &file_solana_proto_msgTypes[51] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Subkeys) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Subkeys) ProtoMessage() {} + +func (x *Subkeys) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[51] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Subkeys.ProtoReflect.Descriptor instead. +func (*Subkeys) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{51} +} + +func (x *Subkeys) GetSubkeys() []string { + if x != nil { + return x.Subkeys + } + return nil +} + +// Log-poller filter config (Solana flavor). +type LPFilterQuery struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` // filter name/id + Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` // 32-byte program id + EventName string `protobuf:"bytes,3,opt,name=event_name,json=eventName,proto3" json:"event_name,omitempty"` // optional label + EventSig []byte `protobuf:"bytes,4,opt,name=event_sig,json=eventSig,proto3" json:"event_sig,omitempty"` // 8-byte event discriminator + StartingBlock int64 `protobuf:"varint,5,opt,name=starting_block,json=startingBlock,proto3" json:"starting_block,omitempty"` // start slot + EventIdlJson []byte `protobuf:"bytes,6,opt,name=event_idl_json,json=eventIdlJson,proto3" json:"event_idl_json,omitempty"` // IDL JSON bytes + SubkeyPaths []*Subkeys `protobuf:"bytes,7,rep,name=subkey_paths,json=subkeyPaths,proto3" json:"subkey_paths,omitempty"` // subkey selectors + Retention int64 `protobuf:"varint,8,opt,name=retention,proto3" json:"retention,omitempty"` // seconds to keep logs + MaxLogsKept int64 `protobuf:"varint,9,opt,name=max_logs_kept,json=maxLogsKept,proto3" json:"max_logs_kept,omitempty"` // 0 = unlimited + IncludeReverted bool `protobuf:"varint,10,opt,name=include_reverted,json=includeReverted,proto3" json:"include_reverted,omitempty"` // include rolled-back + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *LPFilterQuery) Reset() { + *x = LPFilterQuery{} + mi := &file_solana_proto_msgTypes[52] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *LPFilterQuery) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LPFilterQuery) ProtoMessage() {} + +func (x *LPFilterQuery) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[52] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use LPFilterQuery.ProtoReflect.Descriptor instead. +func (*LPFilterQuery) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{52} +} + +func (x *LPFilterQuery) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *LPFilterQuery) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +func (x *LPFilterQuery) GetEventName() string { + if x != nil { + return x.EventName + } + return "" +} + +func (x *LPFilterQuery) GetEventSig() []byte { + if x != nil { + return x.EventSig + } + return nil +} + +func (x *LPFilterQuery) GetStartingBlock() int64 { + if x != nil { + return x.StartingBlock + } + return 0 +} + +func (x *LPFilterQuery) GetEventIdlJson() []byte { + if x != nil { + return x.EventIdlJson + } + return nil +} + +func (x *LPFilterQuery) GetSubkeyPaths() []*Subkeys { + if x != nil { + return x.SubkeyPaths + } + return nil +} + +func (x *LPFilterQuery) GetRetention() int64 { + if x != nil { + return x.Retention + } + return 0 +} + +func (x *LPFilterQuery) GetMaxLogsKept() int64 { + if x != nil { + return x.MaxLogsKept + } + return 0 +} + +func (x *LPFilterQuery) GetIncludeReverted() bool { + if x != nil { + return x.IncludeReverted + } + return false +} + +// Canonical log shape for tracked events. +type Log struct { + state protoimpl.MessageState `protogen:"open.v1"` + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // e.g., "solana-mainnet" + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index,omitempty"` // per-block index + BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` // 32-byte + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"` // slot + BlockTimestamp uint64 `protobuf:"varint,5,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp,omitempty"` // unix seconds + Address []byte `protobuf:"bytes,6,opt,name=address,proto3" json:"address,omitempty"` // 32-byte program id + EventSig []byte `protobuf:"bytes,7,opt,name=event_sig,json=eventSig,proto3" json:"event_sig,omitempty"` // 8-byte discriminator + TxHash []byte `protobuf:"bytes,8,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` // 64-byte signature + Data []byte `protobuf:"bytes,9,opt,name=data,proto3" json:"data,omitempty"` // raw event bytes + SequenceNum int64 `protobuf:"varint,10,opt,name=sequence_num,json=sequenceNum,proto3" json:"sequence_num,omitempty"` // monotonic seq + Error string `protobuf:"bytes,11,opt,name=error,proto3" json:"error,omitempty"` // decode/processing error + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Log) Reset() { + *x = Log{} + mi := &file_solana_proto_msgTypes[53] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Log) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Log) ProtoMessage() {} + +func (x *Log) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[53] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Log.ProtoReflect.Descriptor instead. +func (*Log) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{53} +} + +func (x *Log) GetChainId() string { + if x != nil { + return x.ChainId + } + return "" +} + +func (x *Log) GetLogIndex() int64 { + if x != nil { + return x.LogIndex + } + return 0 +} + +func (x *Log) GetBlockHash() []byte { + if x != nil { + return x.BlockHash + } + return nil +} + +func (x *Log) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber + } + return 0 +} + +func (x *Log) GetBlockTimestamp() uint64 { + if x != nil { + return x.BlockTimestamp + } + return 0 +} + +func (x *Log) GetAddress() []byte { + if x != nil { + return x.Address + } + return nil +} + +func (x *Log) GetEventSig() []byte { + if x != nil { + return x.EventSig + } + return nil +} + +func (x *Log) GetTxHash() []byte { + if x != nil { + return x.TxHash + } + return nil +} + +func (x *Log) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +func (x *Log) GetSequenceNum() int64 { + if x != nil { + return x.SequenceNum + } + return 0 +} + +func (x *Log) GetError() string { + if x != nil { + return x.Error + } + return "" +} + +// Query tracked logs. +type QueryTrackedLogsRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + FilterQuery []*Expression `protobuf:"bytes,1,rep,name=filterQuery,proto3" json:"filterQuery,omitempty"` // filter tree + LimitAndSort *chain_common.LimitAndSort `protobuf:"bytes,2,opt,name=limit_and_sort,json=limitAndSort,proto3" json:"limit_and_sort,omitempty"` // paging + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueryTrackedLogsRequest) Reset() { + *x = QueryTrackedLogsRequest{} + mi := &file_solana_proto_msgTypes[54] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueryTrackedLogsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryTrackedLogsRequest) ProtoMessage() {} + +func (x *QueryTrackedLogsRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[54] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryTrackedLogsRequest.ProtoReflect.Descriptor instead. +func (*QueryTrackedLogsRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{54} +} + +func (x *QueryTrackedLogsRequest) GetFilterQuery() []*Expression { + if x != nil { + return x.FilterQuery + } + return nil +} + +func (x *QueryTrackedLogsRequest) GetLimitAndSort() *chain_common.LimitAndSort { + if x != nil { + return x.LimitAndSort + } + return nil +} + +type QueryTrackedLogsReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Logs []*Log `protobuf:"bytes,1,rep,name=logs,proto3" json:"logs,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *QueryTrackedLogsReply) Reset() { + *x = QueryTrackedLogsReply{} + mi := &file_solana_proto_msgTypes[55] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *QueryTrackedLogsReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*QueryTrackedLogsReply) ProtoMessage() {} + +func (x *QueryTrackedLogsReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[55] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use QueryTrackedLogsReply.ProtoReflect.Descriptor instead. +func (*QueryTrackedLogsReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{55} +} + +func (x *QueryTrackedLogsReply) GetLogs() []*Log { + if x != nil { + return x.Logs + } + return nil +} + +// Register a log tracking filter. +type RegisterLogTrackingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Filter *LPFilterQuery `protobuf:"bytes,1,opt,name=filter,proto3" json:"filter,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterLogTrackingRequest) Reset() { + *x = RegisterLogTrackingRequest{} + mi := &file_solana_proto_msgTypes[56] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterLogTrackingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterLogTrackingRequest) ProtoMessage() {} + +func (x *RegisterLogTrackingRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[56] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterLogTrackingRequest.ProtoReflect.Descriptor instead. +func (*RegisterLogTrackingRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{56} +} + +func (x *RegisterLogTrackingRequest) GetFilter() *LPFilterQuery { + if x != nil { + return x.Filter + } + return nil +} + +type RegisterLogTrackingReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *RegisterLogTrackingReply) Reset() { + *x = RegisterLogTrackingReply{} + mi := &file_solana_proto_msgTypes[57] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *RegisterLogTrackingReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RegisterLogTrackingReply) ProtoMessage() {} + +func (x *RegisterLogTrackingReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[57] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RegisterLogTrackingReply.ProtoReflect.Descriptor instead. +func (*RegisterLogTrackingReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{57} +} + +// Unregister a filter by name/id. +type UnregisterLogTrackingRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + FilterName string `protobuf:"bytes,1,opt,name=filterName,proto3" json:"filterName,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnregisterLogTrackingRequest) Reset() { + *x = UnregisterLogTrackingRequest{} + mi := &file_solana_proto_msgTypes[58] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnregisterLogTrackingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnregisterLogTrackingRequest) ProtoMessage() {} + +func (x *UnregisterLogTrackingRequest) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[58] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnregisterLogTrackingRequest.ProtoReflect.Descriptor instead. +func (*UnregisterLogTrackingRequest) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{58} +} + +func (x *UnregisterLogTrackingRequest) GetFilterName() string { + if x != nil { + return x.FilterName + } + return "" +} + +type UnregisterLogTrackingReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UnregisterLogTrackingReply) Reset() { + *x = UnregisterLogTrackingReply{} + mi := &file_solana_proto_msgTypes[59] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UnregisterLogTrackingReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UnregisterLogTrackingReply) ProtoMessage() {} + +func (x *UnregisterLogTrackingReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[59] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UnregisterLogTrackingReply.ProtoReflect.Descriptor instead. +func (*UnregisterLogTrackingReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{59} +} + +// latest block processed by lp +type GetLatestLPBlockReply struct { + state protoimpl.MessageState `protogen:"open.v1"` + Slot uint64 `protobuf:"varint,1,opt,name=slot,proto3" json:"slot,omitempty"` // block slot + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetLatestLPBlockReply) Reset() { + *x = GetLatestLPBlockReply{} + mi := &file_solana_proto_msgTypes[60] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetLatestLPBlockReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetLatestLPBlockReply) ProtoMessage() {} + +func (x *GetLatestLPBlockReply) ProtoReflect() protoreflect.Message { + mi := &file_solana_proto_msgTypes[60] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetLatestLPBlockReply.ProtoReflect.Descriptor instead. +func (*GetLatestLPBlockReply) Descriptor() ([]byte, []int) { + return file_solana_proto_rawDescGZIP(), []int{60} +} + +func (x *GetLatestLPBlockReply) GetSlot() uint64 { + if x != nil { + return x.Slot + } + return 0 +} + +var File_solana_proto protoreflect.FileDescriptor + +const file_solana_proto_rawDesc = "" + + "\n" + + "\fsolana.proto\x12\vloop.solana\x1a\x1dloop/chain-common/query.proto\x1a\x16values/v1/values.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xd5\x01\n" + + "\aAccount\x12\x1a\n" + + "\blamports\x18\x01 \x01(\x04R\blamports\x12\x14\n" + + "\x05owner\x18\x02 \x01(\fR\x05owner\x120\n" + + "\x04data\x18\x03 \x01(\v2\x1c.loop.solana.DataBytesOrJSONR\x04data\x12\x1e\n" + + "\n" + + "executable\x18\x04 \x01(\bR\n" + + "executable\x120\n" + + "\n" + + "rent_epoch\x18\x05 \x01(\v2\x11.values.v1.BigIntR\trentEpoch\x12\x14\n" + + "\x05space\x18\x06 \x01(\x04R\x05space\"`\n" + + "\rComputeConfig\x12#\n" + + "\rcompute_limit\x18\x01 \x01(\rR\fcomputeLimit\x12*\n" + + "\x11compute_max_price\x18\x02 \x01(\x04R\x0fcomputeMaxPrice\"z\n" + + "\x0fDataBytesOrJSON\x125\n" + + "\bencoding\x18\x01 \x01(\x0e2\x19.loop.solana.EncodingTypeR\bencoding\x12\x12\n" + + "\x03raw\x18\x02 \x01(\fH\x00R\x03raw\x12\x14\n" + + "\x04json\x18\x03 \x01(\fH\x00R\x04jsonB\x06\n" + + "\x04body\";\n" + + "\tDataSlice\x12\x16\n" + + "\x06offset\x18\x01 \x01(\x04R\x06offset\x12\x16\n" + + "\x06length\x18\x02 \x01(\x04R\x06length\"\xe9\x01\n" + + "\x12GetAccountInfoOpts\x125\n" + + "\bencoding\x18\x01 \x01(\x0e2\x19.loop.solana.EncodingTypeR\bencoding\x12;\n" + + "\n" + + "commitment\x18\x02 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\x125\n" + + "\n" + + "data_slice\x18\x03 \x01(\v2\x16.loop.solana.DataSliceR\tdataSlice\x12(\n" + + "\x10min_context_slot\x18\x04 \x01(\x04R\x0eminContextSlot\"\x92\x01\n" + + "\x1bGetAccountInfoWithOptsReply\x128\n" + + "\vrpc_context\x18\x01 \x01(\v2\x17.loop.solana.RPCContextR\n" + + "rpcContext\x12/\n" + + "\x05value\x18\x02 \x01(\v2\x14.loop.solana.AccountH\x00R\x05value\x88\x01\x01B\b\n" + + "\x06_value\"n\n" + + "\x1dGetAccountInfoWithOptsRequest\x12\x18\n" + + "\aaccount\x18\x01 \x01(\fR\aaccount\x123\n" + + "\x04opts\x18\x02 \x01(\v2\x1f.loop.solana.GetAccountInfoOptsR\x04opts\"'\n" + + "\x0fGetBalanceReply\x12\x14\n" + + "\x05value\x18\x01 \x01(\x04R\x05value\"d\n" + + "\x11GetBalanceRequest\x12\x12\n" + + "\x04addr\x18\x01 \x01(\fR\x04addr\x12;\n" + + "\n" + + "commitment\x18\x02 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\"K\n" + + "\fGetBlockOpts\x12;\n" + + "\n" + + "commitment\x18\x04 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\"\xd3\x01\n" + + "\rGetBlockReply\x12\x1c\n" + + "\tblockhash\x18\x01 \x01(\fR\tblockhash\x12-\n" + + "\x12previous_blockhash\x18\x02 \x01(\fR\x11previousBlockhash\x12\x1f\n" + + "\vparent_slot\x18\x03 \x01(\x04R\n" + + "parentSlot\x12\"\n" + + "\n" + + "block_time\x18\x04 \x01(\x03H\x00R\tblockTime\x88\x01\x01\x12!\n" + + "\fblock_height\x18\x05 \x01(\x04R\vblockHeightB\r\n" + + "\v_block_time\"T\n" + + "\x0fGetBlockRequest\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x04R\x04slot\x12-\n" + + "\x04opts\x18\x02 \x01(\v2\x19.loop.solana.GetBlockOptsR\x04opts\")\n" + + "\x15GetFeeForMessageReply\x12\x10\n" + + "\x03fee\x18\x01 \x01(\x04R\x03fee\"p\n" + + "\x17GetFeeForMessageRequest\x12\x18\n" + + "\amessage\x18\x01 \x01(\tR\amessage\x12;\n" + + "\n" + + "commitment\x18\x02 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\"\xee\x01\n" + + "\x17GetMultipleAccountsOpts\x125\n" + + "\bencoding\x18\x01 \x01(\x0e2\x19.loop.solana.EncodingTypeR\bencoding\x12;\n" + + "\n" + + "commitment\x18\x02 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\x125\n" + + "\n" + + "data_slice\x18\x03 \x01(\v2\x16.loop.solana.DataSliceR\tdataSlice\x12(\n" + + "\x10min_context_slot\x18\x04 \x01(\x04R\x0eminContextSlot\"Y\n" + + "\x16OptionalAccountWrapper\x123\n" + + "\aaccount\x18\x01 \x01(\v2\x14.loop.solana.AccountH\x00R\aaccount\x88\x01\x01B\n" + + "\n" + + "\b_account\"\x97\x01\n" + + " GetMultipleAccountsWithOptsReply\x128\n" + + "\vrpc_context\x18\x01 \x01(\v2\x17.loop.solana.RPCContextR\n" + + "rpcContext\x129\n" + + "\x05value\x18\x02 \x03(\v2#.loop.solana.OptionalAccountWrapperR\x05value\"z\n" + + "\"GetMultipleAccountsWithOptsRequest\x12\x1a\n" + + "\baccounts\x18\x01 \x03(\fR\baccounts\x128\n" + + "\x04opts\x18\x02 \x01(\v2$.loop.solana.GetMultipleAccountsOptsR\x04opts\"^\n" + + "\x19GetSignatureStatusesReply\x12A\n" + + "\aresults\x18\x01 \x03(\v2'.loop.solana.GetSignatureStatusesResultR\aresults\"1\n" + + "\x1bGetSignatureStatusesRequest\x12\x12\n" + + "\x04sigs\x18\x01 \x03(\fR\x04sigs\"\xd5\x01\n" + + "\x1aGetSignatureStatusesResult\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x04R\x04slot\x12)\n" + + "\rconfirmations\x18\x02 \x01(\x04H\x00R\rconfirmations\x88\x01\x01\x12\x10\n" + + "\x03err\x18\x03 \x01(\tR\x03err\x12T\n" + + "\x13confirmation_status\x18\x04 \x01(\x0e2#.loop.solana.ConfirmationStatusTypeR\x12confirmationStatusB\x10\n" + + "\x0e_confirmations\",\n" + + "\x12GetSlotHeightReply\x12\x16\n" + + "\x06height\x18\x01 \x01(\x04R\x06height\"S\n" + + "\x14GetSlotHeightRequest\x12;\n" + + "\n" + + "commitment\x18\x01 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\"\xcd\x01\n" + + "\rMessageHeader\x126\n" + + "\x17num_required_signatures\x18\x01 \x01(\rR\x15numRequiredSignatures\x12?\n" + + "\x1cnum_readonly_signed_accounts\x18\x02 \x01(\rR\x19numReadonlySignedAccounts\x12C\n" + + "\x1enum_readonly_unsigned_accounts\x18\x03 \x01(\rR\x1bnumReadonlyUnsignedAccounts\"\xd7\x01\n" + + "\rParsedMessage\x12)\n" + + "\x10recent_blockhash\x18\x01 \x01(\fR\x0frecentBlockhash\x12!\n" + + "\faccount_keys\x18\x02 \x03(\fR\vaccountKeys\x122\n" + + "\x06header\x18\x03 \x01(\v2\x1a.loop.solana.MessageHeaderR\x06header\x12D\n" + + "\finstructions\x18\x04 \x03(\v2 .loop.solana.CompiledInstructionR\finstructions\"i\n" + + "\x11ParsedTransaction\x12\x1e\n" + + "\n" + + "signatures\x18\x01 \x03(\fR\n" + + "signatures\x124\n" + + "\amessage\x18\x02 \x01(\v2\x1a.loop.solana.ParsedMessageR\amessage\"m\n" + + "\rUiTokenAmount\x12\x16\n" + + "\x06amount\x18\x01 \x01(\tR\x06amount\x12\x1a\n" + + "\bdecimals\x18\x02 \x01(\rR\bdecimals\x12(\n" + + "\x10ui_amount_string\x18\x04 \x01(\tR\x0euiAmountString\"\xcb\x01\n" + + "\fTokenBalance\x12#\n" + + "\raccount_index\x18\x01 \x01(\rR\faccountIndex\x12\x19\n" + + "\x05owner\x18\x02 \x01(\fH\x00R\x05owner\x88\x01\x01\x12\"\n" + + "\n" + + "program_id\x18\x03 \x01(\fH\x01R\tprogramId\x88\x01\x01\x12\x12\n" + + "\x04mint\x18\x04 \x01(\fR\x04mint\x12*\n" + + "\x02ui\x18\x05 \x01(\v2\x1a.loop.solana.UiTokenAmountR\x02uiB\b\n" + + "\x06_ownerB\r\n" + + "\v_program_id\"n\n" + + "\x10InnerInstruction\x12\x14\n" + + "\x05index\x18\x01 \x01(\rR\x05index\x12D\n" + + "\finstructions\x18\x02 \x03(\v2 .loop.solana.CompiledInstructionR\finstructions\"I\n" + + "\x0fLoadedAddresses\x12\x1a\n" + + "\breadonly\x18\x01 \x03(\fR\breadonly\x12\x1a\n" + + "\bwritable\x18\x02 \x03(\fR\bwritable\"\x92\x01\n" + + "\x13CompiledInstruction\x12(\n" + + "\x10program_id_index\x18\x01 \x01(\rR\x0eprogramIdIndex\x12\x1a\n" + + "\baccounts\x18\x02 \x03(\rR\baccounts\x12\x12\n" + + "\x04data\x18\x03 \x01(\fR\x04data\x12!\n" + + "\fstack_height\x18\x04 \x01(\rR\vstackHeight\"W\n" + + "\x04Data\x12\x18\n" + + "\acontent\x18\x01 \x01(\fR\acontent\x125\n" + + "\bencoding\x18\x02 \x01(\x0e2\x19.loop.solana.EncodingTypeR\bencoding\"R\n" + + "\n" + + "ReturnData\x12\x1d\n" + + "\n" + + "program_id\x18\x01 \x01(\fR\tprogramId\x12%\n" + + "\x04data\x18\x02 \x01(\v2\x11.loop.solana.DataR\x04data\"\xe4\x04\n" + + "\x0fTransactionMeta\x12\x19\n" + + "\berr_json\x18\x01 \x01(\tR\aerrJson\x12\x10\n" + + "\x03fee\x18\x02 \x01(\x04R\x03fee\x12!\n" + + "\fpre_balances\x18\x03 \x03(\x04R\vpreBalances\x12#\n" + + "\rpost_balances\x18\x04 \x03(\x04R\fpostBalances\x12!\n" + + "\flog_messages\x18\x05 \x03(\tR\vlogMessages\x12G\n" + + "\x12pre_token_balances\x18\x06 \x03(\v2\x19.loop.solana.TokenBalanceR\x10preTokenBalances\x12I\n" + + "\x13post_token_balances\x18\a \x03(\v2\x19.loop.solana.TokenBalanceR\x11postTokenBalances\x12L\n" + + "\x12inner_instructions\x18\b \x03(\v2\x1d.loop.solana.InnerInstructionR\x11innerInstructions\x12G\n" + + "\x10loaded_addresses\x18\t \x01(\v2\x1c.loop.solana.LoadedAddressesR\x0floadedAddresses\x128\n" + + "\vreturn_data\x18\n" + + " \x01(\v2\x17.loop.solana.ReturnDataR\n" + + "returnData\x129\n" + + "\x16compute_units_consumed\x18\v \x01(\x04H\x00R\x14computeUnitsConsumed\x88\x01\x01B\x19\n" + + "\x17_compute_units_consumed\"r\n" + + "\x13TransactionEnvelope\x12\x12\n" + + "\x03raw\x18\x01 \x01(\fH\x00R\x03raw\x128\n" + + "\x06parsed\x18\x02 \x01(\v2\x1e.loop.solana.ParsedTransactionH\x00R\x06parsedB\r\n" + + "\vtransaction\"\xf5\x01\n" + + "\x13GetTransactionReply\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x04R\x04slot\x12\"\n" + + "\n" + + "block_time\x18\x02 \x01(\x03H\x00R\tblockTime\x88\x01\x01\x12G\n" + + "\vtransaction\x18\x03 \x01(\v2 .loop.solana.TransactionEnvelopeH\x01R\vtransaction\x88\x01\x01\x125\n" + + "\x04meta\x18\x04 \x01(\v2\x1c.loop.solana.TransactionMetaH\x02R\x04meta\x88\x01\x01B\r\n" + + "\v_block_timeB\x0e\n" + + "\f_transactionB\a\n" + + "\x05_meta\"5\n" + + "\x15GetTransactionRequest\x12\x1c\n" + + "\tsignature\x18\x01 \x01(\fR\tsignature\" \n" + + "\n" + + "RPCContext\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x04R\x04slot\"\xf0\x01\n" + + "\x0eSimulateTXOpts\x12\x1d\n" + + "\n" + + "sig_verify\x18\x01 \x01(\bR\tsigVerify\x12;\n" + + "\n" + + "commitment\x18\x02 \x01(\x0e2\x1b.loop.solana.CommitmentTypeR\n" + + "commitment\x128\n" + + "\x18replace_recent_blockhash\x18\x03 \x01(\bR\x16replaceRecentBlockhash\x12H\n" + + "\baccounts\x18\x04 \x01(\v2,.loop.solana.SimulateTransactionAccountsOptsR\baccounts\"\x90\x01\n" + + "\x0fSimulateTXReply\x12\x10\n" + + "\x03err\x18\x01 \x01(\tR\x03err\x12\x12\n" + + "\x04logs\x18\x02 \x03(\tR\x04logs\x120\n" + + "\baccounts\x18\x03 \x03(\v2\x14.loop.solana.AccountR\baccounts\x12%\n" + + "\x0eunits_consumed\x18\x04 \x01(\x04R\runitsConsumed\"\x91\x01\n" + + "\x11SimulateTXRequest\x12\x1a\n" + + "\breceiver\x18\x01 \x01(\fR\breceiver\x12/\n" + + "\x13encoded_transaction\x18\x02 \x01(\tR\x12encodedTransaction\x12/\n" + + "\x04opts\x18\x03 \x01(\v2\x1b.loop.solana.SimulateTXOptsR\x04opts\"v\n" + + "\x1fSimulateTransactionAccountsOpts\x125\n" + + "\bencoding\x18\x01 \x01(\x0e2\x19.loop.solana.EncodingTypeR\bencoding\x12\x1c\n" + + "\taddresses\x18\x02 \x03(\fR\taddresses\"\x8e\x01\n" + + "\x16SubmitTransactionReply\x12\x1c\n" + + "\tsignature\x18\x01 \x01(\fR\tsignature\x12'\n" + + "\x0fidempotency_key\x18\x02 \x01(\tR\x0eidempotencyKey\x12-\n" + + "\x06status\x18\x03 \x01(\x0e2\x15.loop.solana.TxStatusR\x06status\"\x95\x01\n" + + "\x18SubmitTransactionRequest\x12,\n" + + "\x03cfg\x18\x01 \x01(\v2\x1a.loop.solana.ComputeConfigR\x03cfg\x12\x1a\n" + + "\breceiver\x18\x02 \x01(\fR\breceiver\x12/\n" + + "\x13encoded_transaction\x18\x03 \x01(\tR\x12encodedTransaction\"z\n" + + "\bEventSig\x12\x14\n" + + "\x05topic\x18\x01 \x01(\x04R\x05topic\x12X\n" + + "\x16hashed_value_comparers\x18\x02 \x03(\v2\".loop.solana.HashedValueComparatorR\x14hashedValueComparers\"q\n" + + "\x16IndexedValueComparator\x12\x14\n" + + "\x05value\x18\x01 \x01(\fR\x05value\x12A\n" + + "\boperator\x18\x02 \x01(\x0e2%.loop.chain.common.ComparisonOperatorR\boperator\"\x80\x01\n" + + "\rEventBySubkey\x12!\n" + + "\fsubkey_index\x18\x01 \x01(\x04R\vsubkeyIndex\x12L\n" + + "\x0fvalue_comparers\x18\x02 \x03(\v2#.loop.solana.IndexedValueComparatorR\x0evalueComparers\"\xa2\x01\n" + + "\n" + + "Expression\x126\n" + + "\tprimitive\x18\x01 \x01(\v2\x16.loop.solana.PrimitiveH\x00R\tprimitive\x12O\n" + + "\x12boolean_expression\x18\x02 \x01(\v2\x1e.loop.solana.BooleanExpressionH\x00R\x11booleanExpressionB\v\n" + + "\tevaluator\"\x9b\x01\n" + + "\x11BooleanExpression\x12M\n" + + "\x10boolean_operator\x18\x01 \x01(\x0e2\".loop.chain.common.BooleanOperatorR\x0fbooleanOperator\x127\n" + + "\n" + + "expression\x18\x02 \x03(\v2\x17.loop.solana.ExpressionR\n" + + "expression\"\xe6\x01\n" + + "\tPrimitive\x12K\n" + + "\x11general_primitive\x18\x01 \x01(\v2\x1c.loop.chain.common.PrimitiveH\x00R\x10generalPrimitive\x12\x1a\n" + + "\aaddress\x18\x02 \x01(\fH\x00R\aaddress\x12\x1d\n" + + "\tevent_sig\x18\x03 \x01(\fH\x00R\beventSig\x12D\n" + + "\x0fevent_by_subkey\x18\x04 \x01(\v2\x1a.loop.solana.EventBySubkeyH\x00R\reventBySubkeyB\v\n" + + "\tprimitive\"K\n" + + "\x15HashedValueComparator\x12\x16\n" + + "\x06values\x18\x01 \x03(\fR\x06values\x12\x1a\n" + + "\boperator\x18\x02 \x01(\x03R\boperator\"#\n" + + "\aSubkeys\x12\x18\n" + + "\asubkeys\x18\x01 \x03(\tR\asubkeys\"\xec\x02\n" + + "\rLPFilterQuery\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x18\n" + + "\aaddress\x18\x02 \x01(\fR\aaddress\x12\x1d\n" + + "\n" + + "event_name\x18\x03 \x01(\tR\teventName\x12\x1b\n" + + "\tevent_sig\x18\x04 \x01(\fR\beventSig\x12%\n" + + "\x0estarting_block\x18\x05 \x01(\x03R\rstartingBlock\x12$\n" + + "\x0eevent_idl_json\x18\x06 \x01(\fR\feventIdlJson\x127\n" + + "\fsubkey_paths\x18\a \x03(\v2\x14.loop.solana.SubkeysR\vsubkeyPaths\x12\x1c\n" + + "\tretention\x18\b \x01(\x03R\tretention\x12\"\n" + + "\rmax_logs_kept\x18\t \x01(\x03R\vmaxLogsKept\x12)\n" + + "\x10include_reverted\x18\n" + + " \x01(\bR\x0fincludeReverted\"\xc5\x02\n" + + "\x03Log\x12\x19\n" + + "\bchain_id\x18\x01 \x01(\tR\achainId\x12\x1b\n" + + "\tlog_index\x18\x02 \x01(\x03R\blogIndex\x12\x1d\n" + + "\n" + + "block_hash\x18\x03 \x01(\fR\tblockHash\x12!\n" + + "\fblock_number\x18\x04 \x01(\x03R\vblockNumber\x12'\n" + + "\x0fblock_timestamp\x18\x05 \x01(\x04R\x0eblockTimestamp\x12\x18\n" + + "\aaddress\x18\x06 \x01(\fR\aaddress\x12\x1b\n" + + "\tevent_sig\x18\a \x01(\fR\beventSig\x12\x17\n" + + "\atx_hash\x18\b \x01(\fR\x06txHash\x12\x12\n" + + "\x04data\x18\t \x01(\fR\x04data\x12!\n" + + "\fsequence_num\x18\n" + + " \x01(\x03R\vsequenceNum\x12\x14\n" + + "\x05error\x18\v \x01(\tR\x05error\"\x9b\x01\n" + + "\x17QueryTrackedLogsRequest\x129\n" + + "\vfilterQuery\x18\x01 \x03(\v2\x17.loop.solana.ExpressionR\vfilterQuery\x12E\n" + + "\x0elimit_and_sort\x18\x02 \x01(\v2\x1f.loop.chain.common.LimitAndSortR\flimitAndSort\"=\n" + + "\x15QueryTrackedLogsReply\x12$\n" + + "\x04logs\x18\x01 \x03(\v2\x10.loop.solana.LogR\x04logs\"P\n" + + "\x1aRegisterLogTrackingRequest\x122\n" + + "\x06filter\x18\x01 \x01(\v2\x1a.loop.solana.LPFilterQueryR\x06filter\"\x1a\n" + + "\x18RegisterLogTrackingReply\">\n" + + "\x1cUnregisterLogTrackingRequest\x12\x1e\n" + + "\n" + + "filterName\x18\x01 \x01(\tR\n" + + "filterName\"\x1c\n" + + "\x1aUnregisterLogTrackingReply\"+\n" + + "\x15GetLatestLPBlockReply\x12\x12\n" + + "\x04slot\x18\x01 \x01(\x04R\x04slot*\xb0\x01\n" + + "\fEncodingType\x12\x16\n" + + "\x12ENCODING_TYPE_NONE\x10\x00\x12\x18\n" + + "\x14ENCODING_TYPE_BASE58\x10\x01\x12\x18\n" + + "\x14ENCODING_TYPE_BASE64\x10\x02\x12\x1d\n" + + "\x19ENCODING_TYPE_BASE64_ZSTD\x10\x03\x12\x1d\n" + + "\x19ENCODING_TYPE_JSON_PARSED\x10\x04\x12\x16\n" + + "\x12ENCODING_TYPE_JSON\x10\x05*\x87\x01\n" + + "\x0eCommitmentType\x12\x18\n" + + "\x14COMMITMENT_TYPE_NONE\x10\x00\x12\x1d\n" + + "\x19COMMITMENT_TYPE_FINALIZED\x10\x01\x12\x1d\n" + + "\x19COMMITMENT_TYPE_CONFIRMED\x10\x02\x12\x1d\n" + + "\x19COMMITMENT_TYPE_PROCESSED\x10\x03*\xb3\x01\n" + + "\x16ConfirmationStatusType\x12!\n" + + "\x1dCONFIRMATION_STATUS_TYPE_NONE\x10\x00\x12&\n" + + "\"CONFIRMATION_STATUS_TYPE_PROCESSED\x10\x01\x12&\n" + + "\"CONFIRMATION_STATUS_TYPE_CONFIRMED\x10\x02\x12&\n" + + "\"CONFIRMATION_STATUS_TYPE_FINALIZED\x10\x03*M\n" + + "\bTxStatus\x12\x13\n" + + "\x0fTX_STATUS_FATAL\x10\x00\x12\x15\n" + + "\x11TX_STATUS_ABORTED\x10\x01\x12\x15\n" + + "\x11TX_STATUS_SUCCESS\x10\x022\xad\n" + + "\n" + + "\x06Solana\x12n\n" + + "\x16GetAccountInfoWithOpts\x12*.loop.solana.GetAccountInfoWithOptsRequest\x1a(.loop.solana.GetAccountInfoWithOptsReply\x12J\n" + + "\n" + + "GetBalance\x12\x1e.loop.solana.GetBalanceRequest\x1a\x1c.loop.solana.GetBalanceReply\x12D\n" + + "\bGetBlock\x12\x1c.loop.solana.GetBlockRequest\x1a\x1a.loop.solana.GetBlockReply\x12\\\n" + + "\x10GetFeeForMessage\x12$.loop.solana.GetFeeForMessageRequest\x1a\".loop.solana.GetFeeForMessageReply\x12}\n" + + "\x1bGetMultipleAccountsWithOpts\x12/.loop.solana.GetMultipleAccountsWithOptsRequest\x1a-.loop.solana.GetMultipleAccountsWithOptsReply\x12h\n" + + "\x14GetSignatureStatuses\x12(.loop.solana.GetSignatureStatusesRequest\x1a&.loop.solana.GetSignatureStatusesReply\x12S\n" + + "\rGetSlotHeight\x12!.loop.solana.GetSlotHeightRequest\x1a\x1f.loop.solana.GetSlotHeightReply\x12V\n" + + "\x0eGetTransaction\x12\".loop.solana.GetTransactionRequest\x1a .loop.solana.GetTransactionReply\x12\\\n" + + "\x10QueryTrackedLogs\x12$.loop.solana.QueryTrackedLogsRequest\x1a\".loop.solana.QueryTrackedLogsReply\x12e\n" + + "\x13RegisterLogTracking\x12'.loop.solana.RegisterLogTrackingRequest\x1a%.loop.solana.RegisterLogTrackingReply\x12J\n" + + "\n" + + "SimulateTX\x12\x1e.loop.solana.SimulateTXRequest\x1a\x1c.loop.solana.SimulateTXReply\x12_\n" + + "\x11SubmitTransaction\x12%.loop.solana.SubmitTransactionRequest\x1a#.loop.solana.SubmitTransactionReply\x12k\n" + + "\x15UnregisterLogTracking\x12).loop.solana.UnregisterLogTrackingRequest\x1a'.loop.solana.UnregisterLogTrackingReply\x12N\n" + + "\x10GetLatestLPBlock\x12\x16.google.protobuf.Empty\x1a\".loop.solana.GetLatestLPBlockReplyB@Z>github.com/smartcontractkit/chainlink-common/pkg/chains/solanab\x06proto3" + +var ( + file_solana_proto_rawDescOnce sync.Once + file_solana_proto_rawDescData []byte +) + +func file_solana_proto_rawDescGZIP() []byte { + file_solana_proto_rawDescOnce.Do(func() { + file_solana_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_solana_proto_rawDesc), len(file_solana_proto_rawDesc))) + }) + return file_solana_proto_rawDescData +} + +var file_solana_proto_enumTypes = make([]protoimpl.EnumInfo, 4) +var file_solana_proto_msgTypes = make([]protoimpl.MessageInfo, 61) +var file_solana_proto_goTypes = []any{ + (EncodingType)(0), // 0: loop.solana.EncodingType + (CommitmentType)(0), // 1: loop.solana.CommitmentType + (ConfirmationStatusType)(0), // 2: loop.solana.ConfirmationStatusType + (TxStatus)(0), // 3: loop.solana.TxStatus + (*Account)(nil), // 4: loop.solana.Account + (*ComputeConfig)(nil), // 5: loop.solana.ComputeConfig + (*DataBytesOrJSON)(nil), // 6: loop.solana.DataBytesOrJSON + (*DataSlice)(nil), // 7: loop.solana.DataSlice + (*GetAccountInfoOpts)(nil), // 8: loop.solana.GetAccountInfoOpts + (*GetAccountInfoWithOptsReply)(nil), // 9: loop.solana.GetAccountInfoWithOptsReply + (*GetAccountInfoWithOptsRequest)(nil), // 10: loop.solana.GetAccountInfoWithOptsRequest + (*GetBalanceReply)(nil), // 11: loop.solana.GetBalanceReply + (*GetBalanceRequest)(nil), // 12: loop.solana.GetBalanceRequest + (*GetBlockOpts)(nil), // 13: loop.solana.GetBlockOpts + (*GetBlockReply)(nil), // 14: loop.solana.GetBlockReply + (*GetBlockRequest)(nil), // 15: loop.solana.GetBlockRequest + (*GetFeeForMessageReply)(nil), // 16: loop.solana.GetFeeForMessageReply + (*GetFeeForMessageRequest)(nil), // 17: loop.solana.GetFeeForMessageRequest + (*GetMultipleAccountsOpts)(nil), // 18: loop.solana.GetMultipleAccountsOpts + (*OptionalAccountWrapper)(nil), // 19: loop.solana.OptionalAccountWrapper + (*GetMultipleAccountsWithOptsReply)(nil), // 20: loop.solana.GetMultipleAccountsWithOptsReply + (*GetMultipleAccountsWithOptsRequest)(nil), // 21: loop.solana.GetMultipleAccountsWithOptsRequest + (*GetSignatureStatusesReply)(nil), // 22: loop.solana.GetSignatureStatusesReply + (*GetSignatureStatusesRequest)(nil), // 23: loop.solana.GetSignatureStatusesRequest + (*GetSignatureStatusesResult)(nil), // 24: loop.solana.GetSignatureStatusesResult + (*GetSlotHeightReply)(nil), // 25: loop.solana.GetSlotHeightReply + (*GetSlotHeightRequest)(nil), // 26: loop.solana.GetSlotHeightRequest + (*MessageHeader)(nil), // 27: loop.solana.MessageHeader + (*ParsedMessage)(nil), // 28: loop.solana.ParsedMessage + (*ParsedTransaction)(nil), // 29: loop.solana.ParsedTransaction + (*UiTokenAmount)(nil), // 30: loop.solana.UiTokenAmount + (*TokenBalance)(nil), // 31: loop.solana.TokenBalance + (*InnerInstruction)(nil), // 32: loop.solana.InnerInstruction + (*LoadedAddresses)(nil), // 33: loop.solana.LoadedAddresses + (*CompiledInstruction)(nil), // 34: loop.solana.CompiledInstruction + (*Data)(nil), // 35: loop.solana.Data + (*ReturnData)(nil), // 36: loop.solana.ReturnData + (*TransactionMeta)(nil), // 37: loop.solana.TransactionMeta + (*TransactionEnvelope)(nil), // 38: loop.solana.TransactionEnvelope + (*GetTransactionReply)(nil), // 39: loop.solana.GetTransactionReply + (*GetTransactionRequest)(nil), // 40: loop.solana.GetTransactionRequest + (*RPCContext)(nil), // 41: loop.solana.RPCContext + (*SimulateTXOpts)(nil), // 42: loop.solana.SimulateTXOpts + (*SimulateTXReply)(nil), // 43: loop.solana.SimulateTXReply + (*SimulateTXRequest)(nil), // 44: loop.solana.SimulateTXRequest + (*SimulateTransactionAccountsOpts)(nil), // 45: loop.solana.SimulateTransactionAccountsOpts + (*SubmitTransactionReply)(nil), // 46: loop.solana.SubmitTransactionReply + (*SubmitTransactionRequest)(nil), // 47: loop.solana.SubmitTransactionRequest + (*EventSig)(nil), // 48: loop.solana.EventSig + (*IndexedValueComparator)(nil), // 49: loop.solana.IndexedValueComparator + (*EventBySubkey)(nil), // 50: loop.solana.EventBySubkey + (*Expression)(nil), // 51: loop.solana.Expression + (*BooleanExpression)(nil), // 52: loop.solana.BooleanExpression + (*Primitive)(nil), // 53: loop.solana.Primitive + (*HashedValueComparator)(nil), // 54: loop.solana.HashedValueComparator + (*Subkeys)(nil), // 55: loop.solana.Subkeys + (*LPFilterQuery)(nil), // 56: loop.solana.LPFilterQuery + (*Log)(nil), // 57: loop.solana.Log + (*QueryTrackedLogsRequest)(nil), // 58: loop.solana.QueryTrackedLogsRequest + (*QueryTrackedLogsReply)(nil), // 59: loop.solana.QueryTrackedLogsReply + (*RegisterLogTrackingRequest)(nil), // 60: loop.solana.RegisterLogTrackingRequest + (*RegisterLogTrackingReply)(nil), // 61: loop.solana.RegisterLogTrackingReply + (*UnregisterLogTrackingRequest)(nil), // 62: loop.solana.UnregisterLogTrackingRequest + (*UnregisterLogTrackingReply)(nil), // 63: loop.solana.UnregisterLogTrackingReply + (*GetLatestLPBlockReply)(nil), // 64: loop.solana.GetLatestLPBlockReply + (*pb.BigInt)(nil), // 65: values.v1.BigInt + (chain_common.ComparisonOperator)(0), // 66: loop.chain.common.ComparisonOperator + (chain_common.BooleanOperator)(0), // 67: loop.chain.common.BooleanOperator + (*chain_common.Primitive)(nil), // 68: loop.chain.common.Primitive + (*chain_common.LimitAndSort)(nil), // 69: loop.chain.common.LimitAndSort + (*emptypb.Empty)(nil), // 70: google.protobuf.Empty +} +var file_solana_proto_depIdxs = []int32{ + 6, // 0: loop.solana.Account.data:type_name -> loop.solana.DataBytesOrJSON + 65, // 1: loop.solana.Account.rent_epoch:type_name -> values.v1.BigInt + 0, // 2: loop.solana.DataBytesOrJSON.encoding:type_name -> loop.solana.EncodingType + 0, // 3: loop.solana.GetAccountInfoOpts.encoding:type_name -> loop.solana.EncodingType + 1, // 4: loop.solana.GetAccountInfoOpts.commitment:type_name -> loop.solana.CommitmentType + 7, // 5: loop.solana.GetAccountInfoOpts.data_slice:type_name -> loop.solana.DataSlice + 41, // 6: loop.solana.GetAccountInfoWithOptsReply.rpc_context:type_name -> loop.solana.RPCContext + 4, // 7: loop.solana.GetAccountInfoWithOptsReply.value:type_name -> loop.solana.Account + 8, // 8: loop.solana.GetAccountInfoWithOptsRequest.opts:type_name -> loop.solana.GetAccountInfoOpts + 1, // 9: loop.solana.GetBalanceRequest.commitment:type_name -> loop.solana.CommitmentType + 1, // 10: loop.solana.GetBlockOpts.commitment:type_name -> loop.solana.CommitmentType + 13, // 11: loop.solana.GetBlockRequest.opts:type_name -> loop.solana.GetBlockOpts + 1, // 12: loop.solana.GetFeeForMessageRequest.commitment:type_name -> loop.solana.CommitmentType + 0, // 13: loop.solana.GetMultipleAccountsOpts.encoding:type_name -> loop.solana.EncodingType + 1, // 14: loop.solana.GetMultipleAccountsOpts.commitment:type_name -> loop.solana.CommitmentType + 7, // 15: loop.solana.GetMultipleAccountsOpts.data_slice:type_name -> loop.solana.DataSlice + 4, // 16: loop.solana.OptionalAccountWrapper.account:type_name -> loop.solana.Account + 41, // 17: loop.solana.GetMultipleAccountsWithOptsReply.rpc_context:type_name -> loop.solana.RPCContext + 19, // 18: loop.solana.GetMultipleAccountsWithOptsReply.value:type_name -> loop.solana.OptionalAccountWrapper + 18, // 19: loop.solana.GetMultipleAccountsWithOptsRequest.opts:type_name -> loop.solana.GetMultipleAccountsOpts + 24, // 20: loop.solana.GetSignatureStatusesReply.results:type_name -> loop.solana.GetSignatureStatusesResult + 2, // 21: loop.solana.GetSignatureStatusesResult.confirmation_status:type_name -> loop.solana.ConfirmationStatusType + 1, // 22: loop.solana.GetSlotHeightRequest.commitment:type_name -> loop.solana.CommitmentType + 27, // 23: loop.solana.ParsedMessage.header:type_name -> loop.solana.MessageHeader + 34, // 24: loop.solana.ParsedMessage.instructions:type_name -> loop.solana.CompiledInstruction + 28, // 25: loop.solana.ParsedTransaction.message:type_name -> loop.solana.ParsedMessage + 30, // 26: loop.solana.TokenBalance.ui:type_name -> loop.solana.UiTokenAmount + 34, // 27: loop.solana.InnerInstruction.instructions:type_name -> loop.solana.CompiledInstruction + 0, // 28: loop.solana.Data.encoding:type_name -> loop.solana.EncodingType + 35, // 29: loop.solana.ReturnData.data:type_name -> loop.solana.Data + 31, // 30: loop.solana.TransactionMeta.pre_token_balances:type_name -> loop.solana.TokenBalance + 31, // 31: loop.solana.TransactionMeta.post_token_balances:type_name -> loop.solana.TokenBalance + 32, // 32: loop.solana.TransactionMeta.inner_instructions:type_name -> loop.solana.InnerInstruction + 33, // 33: loop.solana.TransactionMeta.loaded_addresses:type_name -> loop.solana.LoadedAddresses + 36, // 34: loop.solana.TransactionMeta.return_data:type_name -> loop.solana.ReturnData + 29, // 35: loop.solana.TransactionEnvelope.parsed:type_name -> loop.solana.ParsedTransaction + 38, // 36: loop.solana.GetTransactionReply.transaction:type_name -> loop.solana.TransactionEnvelope + 37, // 37: loop.solana.GetTransactionReply.meta:type_name -> loop.solana.TransactionMeta + 1, // 38: loop.solana.SimulateTXOpts.commitment:type_name -> loop.solana.CommitmentType + 45, // 39: loop.solana.SimulateTXOpts.accounts:type_name -> loop.solana.SimulateTransactionAccountsOpts + 4, // 40: loop.solana.SimulateTXReply.accounts:type_name -> loop.solana.Account + 42, // 41: loop.solana.SimulateTXRequest.opts:type_name -> loop.solana.SimulateTXOpts + 0, // 42: loop.solana.SimulateTransactionAccountsOpts.encoding:type_name -> loop.solana.EncodingType + 3, // 43: loop.solana.SubmitTransactionReply.status:type_name -> loop.solana.TxStatus + 5, // 44: loop.solana.SubmitTransactionRequest.cfg:type_name -> loop.solana.ComputeConfig + 54, // 45: loop.solana.EventSig.hashed_value_comparers:type_name -> loop.solana.HashedValueComparator + 66, // 46: loop.solana.IndexedValueComparator.operator:type_name -> loop.chain.common.ComparisonOperator + 49, // 47: loop.solana.EventBySubkey.value_comparers:type_name -> loop.solana.IndexedValueComparator + 53, // 48: loop.solana.Expression.primitive:type_name -> loop.solana.Primitive + 52, // 49: loop.solana.Expression.boolean_expression:type_name -> loop.solana.BooleanExpression + 67, // 50: loop.solana.BooleanExpression.boolean_operator:type_name -> loop.chain.common.BooleanOperator + 51, // 51: loop.solana.BooleanExpression.expression:type_name -> loop.solana.Expression + 68, // 52: loop.solana.Primitive.general_primitive:type_name -> loop.chain.common.Primitive + 50, // 53: loop.solana.Primitive.event_by_subkey:type_name -> loop.solana.EventBySubkey + 55, // 54: loop.solana.LPFilterQuery.subkey_paths:type_name -> loop.solana.Subkeys + 51, // 55: loop.solana.QueryTrackedLogsRequest.filterQuery:type_name -> loop.solana.Expression + 69, // 56: loop.solana.QueryTrackedLogsRequest.limit_and_sort:type_name -> loop.chain.common.LimitAndSort + 57, // 57: loop.solana.QueryTrackedLogsReply.logs:type_name -> loop.solana.Log + 56, // 58: loop.solana.RegisterLogTrackingRequest.filter:type_name -> loop.solana.LPFilterQuery + 10, // 59: loop.solana.Solana.GetAccountInfoWithOpts:input_type -> loop.solana.GetAccountInfoWithOptsRequest + 12, // 60: loop.solana.Solana.GetBalance:input_type -> loop.solana.GetBalanceRequest + 15, // 61: loop.solana.Solana.GetBlock:input_type -> loop.solana.GetBlockRequest + 17, // 62: loop.solana.Solana.GetFeeForMessage:input_type -> loop.solana.GetFeeForMessageRequest + 21, // 63: loop.solana.Solana.GetMultipleAccountsWithOpts:input_type -> loop.solana.GetMultipleAccountsWithOptsRequest + 23, // 64: loop.solana.Solana.GetSignatureStatuses:input_type -> loop.solana.GetSignatureStatusesRequest + 26, // 65: loop.solana.Solana.GetSlotHeight:input_type -> loop.solana.GetSlotHeightRequest + 40, // 66: loop.solana.Solana.GetTransaction:input_type -> loop.solana.GetTransactionRequest + 58, // 67: loop.solana.Solana.QueryTrackedLogs:input_type -> loop.solana.QueryTrackedLogsRequest + 60, // 68: loop.solana.Solana.RegisterLogTracking:input_type -> loop.solana.RegisterLogTrackingRequest + 44, // 69: loop.solana.Solana.SimulateTX:input_type -> loop.solana.SimulateTXRequest + 47, // 70: loop.solana.Solana.SubmitTransaction:input_type -> loop.solana.SubmitTransactionRequest + 62, // 71: loop.solana.Solana.UnregisterLogTracking:input_type -> loop.solana.UnregisterLogTrackingRequest + 70, // 72: loop.solana.Solana.GetLatestLPBlock:input_type -> google.protobuf.Empty + 9, // 73: loop.solana.Solana.GetAccountInfoWithOpts:output_type -> loop.solana.GetAccountInfoWithOptsReply + 11, // 74: loop.solana.Solana.GetBalance:output_type -> loop.solana.GetBalanceReply + 14, // 75: loop.solana.Solana.GetBlock:output_type -> loop.solana.GetBlockReply + 16, // 76: loop.solana.Solana.GetFeeForMessage:output_type -> loop.solana.GetFeeForMessageReply + 20, // 77: loop.solana.Solana.GetMultipleAccountsWithOpts:output_type -> loop.solana.GetMultipleAccountsWithOptsReply + 22, // 78: loop.solana.Solana.GetSignatureStatuses:output_type -> loop.solana.GetSignatureStatusesReply + 25, // 79: loop.solana.Solana.GetSlotHeight:output_type -> loop.solana.GetSlotHeightReply + 39, // 80: loop.solana.Solana.GetTransaction:output_type -> loop.solana.GetTransactionReply + 59, // 81: loop.solana.Solana.QueryTrackedLogs:output_type -> loop.solana.QueryTrackedLogsReply + 61, // 82: loop.solana.Solana.RegisterLogTracking:output_type -> loop.solana.RegisterLogTrackingReply + 43, // 83: loop.solana.Solana.SimulateTX:output_type -> loop.solana.SimulateTXReply + 46, // 84: loop.solana.Solana.SubmitTransaction:output_type -> loop.solana.SubmitTransactionReply + 63, // 85: loop.solana.Solana.UnregisterLogTracking:output_type -> loop.solana.UnregisterLogTrackingReply + 64, // 86: loop.solana.Solana.GetLatestLPBlock:output_type -> loop.solana.GetLatestLPBlockReply + 73, // [73:87] is the sub-list for method output_type + 59, // [59:73] is the sub-list for method input_type + 59, // [59:59] is the sub-list for extension type_name + 59, // [59:59] is the sub-list for extension extendee + 0, // [0:59] is the sub-list for field type_name +} + +func init() { file_solana_proto_init() } +func file_solana_proto_init() { + if File_solana_proto != nil { + return + } + file_solana_proto_msgTypes[2].OneofWrappers = []any{ + (*DataBytesOrJSON_Raw)(nil), + (*DataBytesOrJSON_Json)(nil), + } + file_solana_proto_msgTypes[5].OneofWrappers = []any{} + file_solana_proto_msgTypes[10].OneofWrappers = []any{} + file_solana_proto_msgTypes[15].OneofWrappers = []any{} + file_solana_proto_msgTypes[20].OneofWrappers = []any{} + file_solana_proto_msgTypes[27].OneofWrappers = []any{} + file_solana_proto_msgTypes[33].OneofWrappers = []any{} + file_solana_proto_msgTypes[34].OneofWrappers = []any{ + (*TransactionEnvelope_Raw)(nil), + (*TransactionEnvelope_Parsed)(nil), + } + file_solana_proto_msgTypes[35].OneofWrappers = []any{} + file_solana_proto_msgTypes[47].OneofWrappers = []any{ + (*Expression_Primitive)(nil), + (*Expression_BooleanExpression)(nil), + } + file_solana_proto_msgTypes[49].OneofWrappers = []any{ + (*Primitive_GeneralPrimitive)(nil), + (*Primitive_Address)(nil), + (*Primitive_EventSig)(nil), + (*Primitive_EventBySubkey)(nil), + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_solana_proto_rawDesc), len(file_solana_proto_rawDesc)), + NumEnums: 4, + NumMessages: 61, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_solana_proto_goTypes, + DependencyIndexes: file_solana_proto_depIdxs, + EnumInfos: file_solana_proto_enumTypes, + MessageInfos: file_solana_proto_msgTypes, + }.Build() + File_solana_proto = out.File + file_solana_proto_goTypes = nil + file_solana_proto_depIdxs = nil +} diff --git a/pkg/chains/solana/solana.proto b/pkg/chains/solana/solana.proto new file mode 100644 index 0000000000..257f4da70b --- /dev/null +++ b/pkg/chains/solana/solana.proto @@ -0,0 +1,465 @@ +syntax = "proto3"; +option go_package = "github.com/smartcontractkit/chainlink-common/pkg/chains/solana"; + +import "loop/chain-common/query.proto"; +import "values/v1/values.proto"; +import "google/protobuf/empty.proto"; + +package loop.solana; + +service Solana { + rpc GetAccountInfoWithOpts(GetAccountInfoWithOptsRequest) returns (GetAccountInfoWithOptsReply); + rpc GetBalance(GetBalanceRequest) returns (GetBalanceReply); + rpc GetBlock(GetBlockRequest) returns (GetBlockReply); + rpc GetFeeForMessage(GetFeeForMessageRequest) returns (GetFeeForMessageReply); + rpc GetMultipleAccountsWithOpts(GetMultipleAccountsWithOptsRequest) returns (GetMultipleAccountsWithOptsReply); + rpc GetSignatureStatuses(GetSignatureStatusesRequest) returns (GetSignatureStatusesReply); + rpc GetSlotHeight(GetSlotHeightRequest) returns (GetSlotHeightReply); + rpc GetTransaction(GetTransactionRequest) returns (GetTransactionReply); + rpc QueryTrackedLogs(QueryTrackedLogsRequest) returns (QueryTrackedLogsReply); + rpc RegisterLogTracking(RegisterLogTrackingRequest) returns (RegisterLogTrackingReply); + rpc SimulateTX(SimulateTXRequest) returns (SimulateTXReply); + rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionReply); + rpc UnregisterLogTracking(UnregisterLogTrackingRequest) returns (UnregisterLogTrackingReply); + rpc GetLatestLPBlock(google.protobuf.Empty) returns (GetLatestLPBlockReply); +} + +// Account/tx data encodings. +enum EncodingType { + ENCODING_TYPE_NONE = 0; + ENCODING_TYPE_BASE58 = 1; // for data <129 bytes + ENCODING_TYPE_BASE64 = 2; // any size + ENCODING_TYPE_BASE64_ZSTD = 3; // zstd-compressed, base64-wrapped + ENCODING_TYPE_JSON_PARSED = 4; // program parsers; fallback to base64 if unknown + ENCODING_TYPE_JSON = 5; // raw JSON (rare; prefer JSON_PARSED) +} + +// Read consistency of queried state. +enum CommitmentType { + COMMITMENT_TYPE_NONE = 0; + COMMITMENT_TYPE_FINALIZED = 1; // cluster-finalized + COMMITMENT_TYPE_CONFIRMED = 2; // voted by supermajority + COMMITMENT_TYPE_PROCESSED = 3; // node’s latest +} + +// Cluster confirmation status of a tx/signature. +enum ConfirmationStatusType { + CONFIRMATION_STATUS_TYPE_NONE = 0; + CONFIRMATION_STATUS_TYPE_PROCESSED = 1; + CONFIRMATION_STATUS_TYPE_CONFIRMED = 2; + CONFIRMATION_STATUS_TYPE_FINALIZED = 3; +} + +// Transaction execution status returned by submitters/simulations. +enum TxStatus { + TX_STATUS_FATAL = 0; // unrecoverable failure + TX_STATUS_ABORTED = 1; // not executed / dropped + TX_STATUS_SUCCESS = 2; // executed successfully +} + +// On-chain account state. +message Account { + uint64 lamports = 1; // balance in lamports (1e-9 SOL) + bytes owner = 2; // 32-byte program id (Pubkey) + DataBytesOrJSON data = 3; // account data (encoded or JSON) + bool executable = 4; // true if this is a program account + values.v1.BigInt rent_epoch = 5; // next rent epoch + uint64 space = 6; // data length in bytes +} + +// Compute budget configuration when submitting txs. +message ComputeConfig { + uint32 compute_limit = 1; // max CUs (approx per-tx limit) + uint64 compute_max_price = 2; // max lamports per CU +} + +// Raw bytes vs parsed JSON (as returned by RPC). +message DataBytesOrJSON { + EncodingType encoding = 1; + oneof body { + bytes raw = 2; // program data (node’s base64/base58 decoded) + bytes json = 3; // json: UTF-8 bytes of the jsonParsed payload. + } +} + +// Return a slice of account data. +message DataSlice { + uint64 offset = 1; // start byte + uint64 length = 2; // number of bytes +} + +// Options for GetAccountInfo. +message GetAccountInfoOpts { + EncodingType encoding = 1; // data encoding + CommitmentType commitment = 2; // read consistency + DataSlice data_slice = 3; // optional slice window + uint64 min_context_slot = 4; // lower bound slot +} + +// Reply for GetAccountInfoWithOpts. +message GetAccountInfoWithOptsReply { + RPCContext rpc_context = 1; // read slot + optional Account value = 2; // account (may be empty) +} + +// Request for GetAccountInfoWithOpts. +message GetAccountInfoWithOptsRequest { + bytes account = 1; // 32-byte Pubkey + GetAccountInfoOpts opts = 2; +} + +// Reply for GetBalance. +message GetBalanceReply { + uint64 value = 1; // lamports +} + +// Request for GetBalance. +message GetBalanceRequest { + bytes addr = 1; // 32-byte Pubkey + CommitmentType commitment = 2; // read consistency +} + +// Options for GetBlock. +message GetBlockOpts { + CommitmentType commitment = 4; // read consistency +} + +// Block response. +message GetBlockReply { + bytes blockhash = 1; // 32-byte block hash + bytes previous_blockhash = 2; // 32-byte parent hash + uint64 parent_slot = 3; + optional int64 block_time = 4; // unix seconds, node may not report it + uint64 block_height = 5; // chain height +} + +// Request for GetBlock. +message GetBlockRequest { + uint64 slot = 1; // target slot + GetBlockOpts opts = 2; +} + +// Fee quote for a base58-encoded Message. +message GetFeeForMessageReply { + uint64 fee = 1; // lamports +} + +message GetFeeForMessageRequest { + string message = 1; // must be base58-encoded Message + CommitmentType commitment = 2; // read consistency +} + +// Options for GetMultipleAccounts. +message GetMultipleAccountsOpts { + EncodingType encoding = 1; + CommitmentType commitment = 2; + DataSlice data_slice = 3; + uint64 min_context_slot = 4; +} + +message OptionalAccountWrapper { + optional Account account = 1; +} + +// Reply for GetMultipleAccountsWithOpts. +message GetMultipleAccountsWithOptsReply { + RPCContext rpc_context = 1; // read slot + repeated OptionalAccountWrapper value = 2; // accounts (nil entries allowed) +} + +// Request for GetMultipleAccountsWithOpts. +message GetMultipleAccountsWithOptsRequest { + repeated bytes accounts = 1; // list of 32-byte Pubkeys + GetMultipleAccountsOpts opts = 2; +} + +// Reply for GetSignatureStatuses. +message GetSignatureStatusesReply { + repeated GetSignatureStatusesResult results = 1; // 1:1 with input +} + +// Request for GetSignatureStatuses. +message GetSignatureStatusesRequest { + repeated bytes sigs = 1; // 64-byte signatures +} + +// Per-signature status. +message GetSignatureStatusesResult { + uint64 slot = 1; // processed slot + optional uint64 confirmations = 2; // null->0 here + string err = 3; // error JSON string (empty on success) + ConfirmationStatusType confirmation_status = 4; +} + +// Current “height” (blocks below latest). +message GetSlotHeightReply { + uint64 height = 1; +} + +message GetSlotHeightRequest { + CommitmentType commitment = 1; // read consistency +} + +// Message header counts. +message MessageHeader { + uint32 num_required_signatures = 1; // signer count + uint32 num_readonly_signed_accounts = 2; // trailing signed RO + uint32 num_readonly_unsigned_accounts = 3; // trailing unsigned RO +} + +// Parsed message (no address tables). +message ParsedMessage { + bytes recent_blockhash = 1; // 32-byte Hash + repeated bytes account_keys = 2; // list of 32-byte Pubkeys + MessageHeader header = 3; + repeated CompiledInstruction instructions = 4; +} + +// Parsed transaction (signatures + message). +message ParsedTransaction { + repeated bytes signatures = 1; // 64-byte signatures + ParsedMessage message = 2; +} + +// Token amount (UI-friendly). +message UiTokenAmount { + string amount = 1; // raw integer string + uint32 decimals = 2; // mint decimals + string ui_amount_string = 4; // amount / 10^decimals +} + +// SPL token balance entry. +message TokenBalance { + uint32 account_index = 1; // index in account_keys + optional bytes owner = 2; // 32-byte owner (optional) + optional bytes program_id = 3; // 32-byte token program (optional) + bytes mint = 4; // 32-byte mint + UiTokenAmount ui = 5; // formatted amounts +} + +// Inner instruction list at a given outer instruction index. +message InnerInstruction { + uint32 index = 1; // outer ix index + repeated CompiledInstruction instructions = 2; // invoked ixs +} + +// Address table lookups expanded by loader. +message LoadedAddresses { + repeated bytes readonly = 1; // 32-byte Pubkeys + repeated bytes writable = 2; // 32-byte Pubkeys +} + +// Compiled (program) instruction. +message CompiledInstruction { + uint32 program_id_index = 1; // index into account_keys + repeated uint32 accounts = 2; // indices into account_keys + bytes data = 3; // program input bytes + uint32 stack_height = 4; // if recorded by node +} + +// Raw bytes with encoding tag. +message Data { + bytes content = 1; // raw bytes + EncodingType encoding = 2; // how it was encoded originally +} + +// Program return data. +message ReturnData { + bytes program_id = 1; // 32-byte Pubkey + Data data = 2; // raw return bytes +} + +// Transaction execution metadata. +message TransactionMeta { + string err_json = 1; // error JSON (empty on success) + uint64 fee = 2; // lamports + repeated uint64 pre_balances = 3; // lamports per account + repeated uint64 post_balances = 4; // lamports per account + repeated string log_messages = 5; // runtime logs + repeated TokenBalance pre_token_balances = 6; + repeated TokenBalance post_token_balances = 7; + repeated InnerInstruction inner_instructions = 8; + LoadedAddresses loaded_addresses = 9; + ReturnData return_data = 10; + optional uint64 compute_units_consumed = 11; // CUs +} + +// Transaction envelope: raw bytes or parsed struct. +message TransactionEnvelope { + oneof transaction { + bytes raw = 1; // raw tx bytes (for RAW/base64) + ParsedTransaction parsed = 2; // parsed tx (for JSON_PARSED) + } +} + +// GetTransaction reply. +message GetTransactionReply { + uint64 slot = 1; // processed slot + optional int64 block_time = 2; // unix seconds + optional TransactionEnvelope transaction = 3; // tx bytes or parsed + optional TransactionMeta meta = 4; // may be omitted by node +} + +// GetTransaction request. +message GetTransactionRequest { + bytes signature = 1; // 64-byte signature +} + +// RPC read context. +message RPCContext { + uint64 slot = 1; +} + +// Simulation options. +message SimulateTXOpts { + bool sig_verify = 1; // verify sigs + CommitmentType commitment = 2; // read consistency + bool replace_recent_blockhash = 3; // refresh blockhash + SimulateTransactionAccountsOpts accounts = 4; // return accounts +} + +// Simulation result. +message SimulateTXReply { + string err = 1; // empty on success + repeated string logs = 2; // runtime logs + repeated Account accounts = 3; // returned accounts + uint64 units_consumed = 4; // CUs +} + +// Simulation request. +message SimulateTXRequest { + bytes receiver = 1; // 32-byte program id (target) + string encoded_transaction = 2; // base64/base58 tx + SimulateTXOpts opts = 3; +} + +// Accounts to return during simulation. +message SimulateTransactionAccountsOpts { + EncodingType encoding = 1; // account data encoding + repeated bytes addresses = 2; // 32-byte Pubkeys +} + +// Submit transaction result. +message SubmitTransactionReply { + bytes signature = 1; // 64-byte signature + string idempotency_key = 2; // echo key + TxStatus status = 3; +} + +// Submit transaction request. +message SubmitTransactionRequest { + ComputeConfig cfg = 1; // compute budget + bytes receiver = 2; // 32-byte program id (target) + string encoded_transaction = 3; // base64/base58 tx +} + +// Event/topic filter by hashed value(s). +message EventSig { + uint64 topic = 1; // topic index + repeated HashedValueComparator hashed_value_comparers = 2; // comparisons +} + +// Comparator for a single indexed value. +message IndexedValueComparator { + bytes value = 1; // raw bytes + loop.chain.common.ComparisonOperator operator = 2; // eq/lt/gt etc. +} + +// Filter events by a subkey path. +message EventBySubkey { + uint64 subkey_index = 1; // path element index + repeated IndexedValueComparator value_comparers = 2; +} + +// Expression tree wrapper. +message Expression { + oneof evaluator { + Primitive primitive = 1; // leaf filter + BooleanExpression boolean_expression = 2; // AND/OR of expressions + } +} + +// Boolean composition over expressions. +message BooleanExpression { + loop.chain.common.BooleanOperator boolean_operator = 1; // AND/OR + repeated Expression expression = 2; +} + +// Primitive leaf for expressions/filters. +message Primitive { + oneof primitive { + loop.chain.common.Primitive general_primitive = 1; // shared primitives + bytes address = 2; // 32-byte program id + bytes event_sig = 3; // 8-byte discriminator + EventBySubkey event_by_subkey = 4; // subkey filter + } +} + +// Comparator against hashed values. +message HashedValueComparator { + repeated bytes values = 1; // hashed bytes + int64 operator = 2; // comparison op +} + +// Subkey path elements. +message Subkeys { + repeated string subkeys = 1; // e.g., ["events","0","fields","owner"] +} + +// Log-poller filter config (Solana flavor). +message LPFilterQuery { + string name = 1; // filter name/id + bytes address = 2; // 32-byte program id + string event_name = 3; // optional label + bytes event_sig = 4; // 8-byte event discriminator + int64 starting_block = 5; // start slot + bytes event_idl_json = 6; // IDL JSON bytes + repeated Subkeys subkey_paths = 7; // subkey selectors + int64 retention = 8; // seconds to keep logs + int64 max_logs_kept = 9; // 0 = unlimited + bool include_reverted = 10; // include rolled-back +} + +// Canonical log shape for tracked events. +message Log { + string chain_id = 1; // e.g., "solana-mainnet" + int64 log_index = 2; // per-block index + bytes block_hash = 3; // 32-byte + int64 block_number = 4; // slot + uint64 block_timestamp = 5; // unix seconds + bytes address = 6; // 32-byte program id + bytes event_sig = 7; // 8-byte discriminator + bytes tx_hash = 8; // 64-byte signature + bytes data = 9; // raw event bytes + int64 sequence_num = 10; // monotonic seq + string error = 11; // decode/processing error +} +// Query tracked logs. +message QueryTrackedLogsRequest { + repeated Expression filterQuery = 1; // filter tree + loop.chain.common.LimitAndSort limit_and_sort = 2; // paging +} + +message QueryTrackedLogsReply { + repeated Log logs = 1; +} + +// Register a log tracking filter. +message RegisterLogTrackingRequest { + LPFilterQuery filter = 1; +} + +message RegisterLogTrackingReply {} + +// Unregister a filter by name/id. +message UnregisterLogTrackingRequest { + string filterName = 1; +} + +message UnregisterLogTrackingReply {} + + +// latest block processed by lp +message GetLatestLPBlockReply { + uint64 slot = 1; // block slot +} diff --git a/pkg/chains/solana/solana_grpc.pb.go b/pkg/chains/solana/solana_grpc.pb.go new file mode 100644 index 0000000000..0ba218f75a --- /dev/null +++ b/pkg/chains/solana/solana_grpc.pb.go @@ -0,0 +1,616 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.5.1 +// - protoc v5.29.3 +// source: solana.proto + +package solana + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + emptypb "google.golang.org/protobuf/types/known/emptypb" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 + +const ( + Solana_GetAccountInfoWithOpts_FullMethodName = "/loop.solana.Solana/GetAccountInfoWithOpts" + Solana_GetBalance_FullMethodName = "/loop.solana.Solana/GetBalance" + Solana_GetBlock_FullMethodName = "/loop.solana.Solana/GetBlock" + Solana_GetFeeForMessage_FullMethodName = "/loop.solana.Solana/GetFeeForMessage" + Solana_GetMultipleAccountsWithOpts_FullMethodName = "/loop.solana.Solana/GetMultipleAccountsWithOpts" + Solana_GetSignatureStatuses_FullMethodName = "/loop.solana.Solana/GetSignatureStatuses" + Solana_GetSlotHeight_FullMethodName = "/loop.solana.Solana/GetSlotHeight" + Solana_GetTransaction_FullMethodName = "/loop.solana.Solana/GetTransaction" + Solana_QueryTrackedLogs_FullMethodName = "/loop.solana.Solana/QueryTrackedLogs" + Solana_RegisterLogTracking_FullMethodName = "/loop.solana.Solana/RegisterLogTracking" + Solana_SimulateTX_FullMethodName = "/loop.solana.Solana/SimulateTX" + Solana_SubmitTransaction_FullMethodName = "/loop.solana.Solana/SubmitTransaction" + Solana_UnregisterLogTracking_FullMethodName = "/loop.solana.Solana/UnregisterLogTracking" + Solana_GetLatestLPBlock_FullMethodName = "/loop.solana.Solana/GetLatestLPBlock" +) + +// SolanaClient is the client API for Solana service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type SolanaClient interface { + GetAccountInfoWithOpts(ctx context.Context, in *GetAccountInfoWithOptsRequest, opts ...grpc.CallOption) (*GetAccountInfoWithOptsReply, error) + GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceReply, error) + GetBlock(ctx context.Context, in *GetBlockRequest, opts ...grpc.CallOption) (*GetBlockReply, error) + GetFeeForMessage(ctx context.Context, in *GetFeeForMessageRequest, opts ...grpc.CallOption) (*GetFeeForMessageReply, error) + GetMultipleAccountsWithOpts(ctx context.Context, in *GetMultipleAccountsWithOptsRequest, opts ...grpc.CallOption) (*GetMultipleAccountsWithOptsReply, error) + GetSignatureStatuses(ctx context.Context, in *GetSignatureStatusesRequest, opts ...grpc.CallOption) (*GetSignatureStatusesReply, error) + GetSlotHeight(ctx context.Context, in *GetSlotHeightRequest, opts ...grpc.CallOption) (*GetSlotHeightReply, error) + GetTransaction(ctx context.Context, in *GetTransactionRequest, opts ...grpc.CallOption) (*GetTransactionReply, error) + QueryTrackedLogs(ctx context.Context, in *QueryTrackedLogsRequest, opts ...grpc.CallOption) (*QueryTrackedLogsReply, error) + RegisterLogTracking(ctx context.Context, in *RegisterLogTrackingRequest, opts ...grpc.CallOption) (*RegisterLogTrackingReply, error) + SimulateTX(ctx context.Context, in *SimulateTXRequest, opts ...grpc.CallOption) (*SimulateTXReply, error) + SubmitTransaction(ctx context.Context, in *SubmitTransactionRequest, opts ...grpc.CallOption) (*SubmitTransactionReply, error) + UnregisterLogTracking(ctx context.Context, in *UnregisterLogTrackingRequest, opts ...grpc.CallOption) (*UnregisterLogTrackingReply, error) + GetLatestLPBlock(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetLatestLPBlockReply, error) +} + +type solanaClient struct { + cc grpc.ClientConnInterface +} + +func NewSolanaClient(cc grpc.ClientConnInterface) SolanaClient { + return &solanaClient{cc} +} + +func (c *solanaClient) GetAccountInfoWithOpts(ctx context.Context, in *GetAccountInfoWithOptsRequest, opts ...grpc.CallOption) (*GetAccountInfoWithOptsReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetAccountInfoWithOptsReply) + err := c.cc.Invoke(ctx, Solana_GetAccountInfoWithOpts_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetBalance(ctx context.Context, in *GetBalanceRequest, opts ...grpc.CallOption) (*GetBalanceReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetBalanceReply) + err := c.cc.Invoke(ctx, Solana_GetBalance_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetBlock(ctx context.Context, in *GetBlockRequest, opts ...grpc.CallOption) (*GetBlockReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetBlockReply) + err := c.cc.Invoke(ctx, Solana_GetBlock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetFeeForMessage(ctx context.Context, in *GetFeeForMessageRequest, opts ...grpc.CallOption) (*GetFeeForMessageReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetFeeForMessageReply) + err := c.cc.Invoke(ctx, Solana_GetFeeForMessage_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetMultipleAccountsWithOpts(ctx context.Context, in *GetMultipleAccountsWithOptsRequest, opts ...grpc.CallOption) (*GetMultipleAccountsWithOptsReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetMultipleAccountsWithOptsReply) + err := c.cc.Invoke(ctx, Solana_GetMultipleAccountsWithOpts_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetSignatureStatuses(ctx context.Context, in *GetSignatureStatusesRequest, opts ...grpc.CallOption) (*GetSignatureStatusesReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetSignatureStatusesReply) + err := c.cc.Invoke(ctx, Solana_GetSignatureStatuses_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetSlotHeight(ctx context.Context, in *GetSlotHeightRequest, opts ...grpc.CallOption) (*GetSlotHeightReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetSlotHeightReply) + err := c.cc.Invoke(ctx, Solana_GetSlotHeight_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetTransaction(ctx context.Context, in *GetTransactionRequest, opts ...grpc.CallOption) (*GetTransactionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetTransactionReply) + err := c.cc.Invoke(ctx, Solana_GetTransaction_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) QueryTrackedLogs(ctx context.Context, in *QueryTrackedLogsRequest, opts ...grpc.CallOption) (*QueryTrackedLogsReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(QueryTrackedLogsReply) + err := c.cc.Invoke(ctx, Solana_QueryTrackedLogs_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) RegisterLogTracking(ctx context.Context, in *RegisterLogTrackingRequest, opts ...grpc.CallOption) (*RegisterLogTrackingReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(RegisterLogTrackingReply) + err := c.cc.Invoke(ctx, Solana_RegisterLogTracking_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) SimulateTX(ctx context.Context, in *SimulateTXRequest, opts ...grpc.CallOption) (*SimulateTXReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SimulateTXReply) + err := c.cc.Invoke(ctx, Solana_SimulateTX_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) SubmitTransaction(ctx context.Context, in *SubmitTransactionRequest, opts ...grpc.CallOption) (*SubmitTransactionReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(SubmitTransactionReply) + err := c.cc.Invoke(ctx, Solana_SubmitTransaction_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) UnregisterLogTracking(ctx context.Context, in *UnregisterLogTrackingRequest, opts ...grpc.CallOption) (*UnregisterLogTrackingReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(UnregisterLogTrackingReply) + err := c.cc.Invoke(ctx, Solana_UnregisterLogTracking_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *solanaClient) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*GetLatestLPBlockReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(GetLatestLPBlockReply) + err := c.cc.Invoke(ctx, Solana_GetLatestLPBlock_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// SolanaServer is the server API for Solana service. +// All implementations must embed UnimplementedSolanaServer +// for forward compatibility. +type SolanaServer interface { + GetAccountInfoWithOpts(context.Context, *GetAccountInfoWithOptsRequest) (*GetAccountInfoWithOptsReply, error) + GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceReply, error) + GetBlock(context.Context, *GetBlockRequest) (*GetBlockReply, error) + GetFeeForMessage(context.Context, *GetFeeForMessageRequest) (*GetFeeForMessageReply, error) + GetMultipleAccountsWithOpts(context.Context, *GetMultipleAccountsWithOptsRequest) (*GetMultipleAccountsWithOptsReply, error) + GetSignatureStatuses(context.Context, *GetSignatureStatusesRequest) (*GetSignatureStatusesReply, error) + GetSlotHeight(context.Context, *GetSlotHeightRequest) (*GetSlotHeightReply, error) + GetTransaction(context.Context, *GetTransactionRequest) (*GetTransactionReply, error) + QueryTrackedLogs(context.Context, *QueryTrackedLogsRequest) (*QueryTrackedLogsReply, error) + RegisterLogTracking(context.Context, *RegisterLogTrackingRequest) (*RegisterLogTrackingReply, error) + SimulateTX(context.Context, *SimulateTXRequest) (*SimulateTXReply, error) + SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) + UnregisterLogTracking(context.Context, *UnregisterLogTrackingRequest) (*UnregisterLogTrackingReply, error) + GetLatestLPBlock(context.Context, *emptypb.Empty) (*GetLatestLPBlockReply, error) + mustEmbedUnimplementedSolanaServer() +} + +// UnimplementedSolanaServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedSolanaServer struct{} + +func (UnimplementedSolanaServer) GetAccountInfoWithOpts(context.Context, *GetAccountInfoWithOptsRequest) (*GetAccountInfoWithOptsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccountInfoWithOpts not implemented") +} +func (UnimplementedSolanaServer) GetBalance(context.Context, *GetBalanceRequest) (*GetBalanceReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented") +} +func (UnimplementedSolanaServer) GetBlock(context.Context, *GetBlockRequest) (*GetBlockReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented") +} +func (UnimplementedSolanaServer) GetFeeForMessage(context.Context, *GetFeeForMessageRequest) (*GetFeeForMessageReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFeeForMessage not implemented") +} +func (UnimplementedSolanaServer) GetMultipleAccountsWithOpts(context.Context, *GetMultipleAccountsWithOptsRequest) (*GetMultipleAccountsWithOptsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMultipleAccountsWithOpts not implemented") +} +func (UnimplementedSolanaServer) GetSignatureStatuses(context.Context, *GetSignatureStatusesRequest) (*GetSignatureStatusesReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSignatureStatuses not implemented") +} +func (UnimplementedSolanaServer) GetSlotHeight(context.Context, *GetSlotHeightRequest) (*GetSlotHeightReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSlotHeight not implemented") +} +func (UnimplementedSolanaServer) GetTransaction(context.Context, *GetTransactionRequest) (*GetTransactionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTransaction not implemented") +} +func (UnimplementedSolanaServer) QueryTrackedLogs(context.Context, *QueryTrackedLogsRequest) (*QueryTrackedLogsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryTrackedLogs not implemented") +} +func (UnimplementedSolanaServer) RegisterLogTracking(context.Context, *RegisterLogTrackingRequest) (*RegisterLogTrackingReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method RegisterLogTracking not implemented") +} +func (UnimplementedSolanaServer) SimulateTX(context.Context, *SimulateTXRequest) (*SimulateTXReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SimulateTX not implemented") +} +func (UnimplementedSolanaServer) SubmitTransaction(context.Context, *SubmitTransactionRequest) (*SubmitTransactionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented") +} +func (UnimplementedSolanaServer) UnregisterLogTracking(context.Context, *UnregisterLogTrackingRequest) (*UnregisterLogTrackingReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnregisterLogTracking not implemented") +} +func (UnimplementedSolanaServer) GetLatestLPBlock(context.Context, *emptypb.Empty) (*GetLatestLPBlockReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLatestLPBlock not implemented") +} +func (UnimplementedSolanaServer) mustEmbedUnimplementedSolanaServer() {} +func (UnimplementedSolanaServer) testEmbeddedByValue() {} + +// UnsafeSolanaServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SolanaServer will +// result in compilation errors. +type UnsafeSolanaServer interface { + mustEmbedUnimplementedSolanaServer() +} + +func RegisterSolanaServer(s grpc.ServiceRegistrar, srv SolanaServer) { + // If the following call pancis, it indicates UnimplementedSolanaServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } + s.RegisterService(&Solana_ServiceDesc, srv) +} + +func _Solana_GetAccountInfoWithOpts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetAccountInfoWithOptsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetAccountInfoWithOpts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetAccountInfoWithOpts_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetAccountInfoWithOpts(ctx, req.(*GetAccountInfoWithOptsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetBalance_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBalanceRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetBalance(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetBalance_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetBalance(ctx, req.(*GetBalanceRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetBlock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetBlock(ctx, req.(*GetBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetFeeForMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetFeeForMessageRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetFeeForMessage(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetFeeForMessage_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetFeeForMessage(ctx, req.(*GetFeeForMessageRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetMultipleAccountsWithOpts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMultipleAccountsWithOptsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetMultipleAccountsWithOpts(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetMultipleAccountsWithOpts_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetMultipleAccountsWithOpts(ctx, req.(*GetMultipleAccountsWithOptsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetSignatureStatuses_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSignatureStatusesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetSignatureStatuses(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetSignatureStatuses_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetSignatureStatuses(ctx, req.(*GetSignatureStatusesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetSlotHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSlotHeightRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetSlotHeight(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetSlotHeight_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetSlotHeight(ctx, req.(*GetSlotHeightRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetTransactionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetTransaction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetTransaction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetTransaction(ctx, req.(*GetTransactionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_QueryTrackedLogs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryTrackedLogsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).QueryTrackedLogs(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_QueryTrackedLogs_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).QueryTrackedLogs(ctx, req.(*QueryTrackedLogsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_RegisterLogTracking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RegisterLogTrackingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).RegisterLogTracking(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_RegisterLogTracking_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).RegisterLogTracking(ctx, req.(*RegisterLogTrackingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_SimulateTX_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SimulateTXRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).SimulateTX(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_SimulateTX_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).SimulateTX(ctx, req.(*SimulateTXRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_SubmitTransaction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(SubmitTransactionRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).SubmitTransaction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_SubmitTransaction_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).SubmitTransaction(ctx, req.(*SubmitTransactionRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_UnregisterLogTracking_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UnregisterLogTrackingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).UnregisterLogTracking(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_UnregisterLogTracking_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).UnregisterLogTracking(ctx, req.(*UnregisterLogTrackingRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Solana_GetLatestLPBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(emptypb.Empty) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(SolanaServer).GetLatestLPBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Solana_GetLatestLPBlock_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(SolanaServer).GetLatestLPBlock(ctx, req.(*emptypb.Empty)) + } + return interceptor(ctx, in, info, handler) +} + +// Solana_ServiceDesc is the grpc.ServiceDesc for Solana service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var Solana_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "loop.solana.Solana", + HandlerType: (*SolanaServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "GetAccountInfoWithOpts", + Handler: _Solana_GetAccountInfoWithOpts_Handler, + }, + { + MethodName: "GetBalance", + Handler: _Solana_GetBalance_Handler, + }, + { + MethodName: "GetBlock", + Handler: _Solana_GetBlock_Handler, + }, + { + MethodName: "GetFeeForMessage", + Handler: _Solana_GetFeeForMessage_Handler, + }, + { + MethodName: "GetMultipleAccountsWithOpts", + Handler: _Solana_GetMultipleAccountsWithOpts_Handler, + }, + { + MethodName: "GetSignatureStatuses", + Handler: _Solana_GetSignatureStatuses_Handler, + }, + { + MethodName: "GetSlotHeight", + Handler: _Solana_GetSlotHeight_Handler, + }, + { + MethodName: "GetTransaction", + Handler: _Solana_GetTransaction_Handler, + }, + { + MethodName: "QueryTrackedLogs", + Handler: _Solana_QueryTrackedLogs_Handler, + }, + { + MethodName: "RegisterLogTracking", + Handler: _Solana_RegisterLogTracking_Handler, + }, + { + MethodName: "SimulateTX", + Handler: _Solana_SimulateTX_Handler, + }, + { + MethodName: "SubmitTransaction", + Handler: _Solana_SubmitTransaction_Handler, + }, + { + MethodName: "UnregisterLogTracking", + Handler: _Solana_UnregisterLogTracking_Handler, + }, + { + MethodName: "GetLatestLPBlock", + Handler: _Solana_GetLatestLPBlock_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "solana.proto", +} diff --git a/pkg/loop/internal/example-relay/main.go b/pkg/loop/internal/example-relay/main.go index b61fd86d1b..16eb6d0086 100644 --- a/pkg/loop/internal/example-relay/main.go +++ b/pkg/loop/internal/example-relay/main.go @@ -74,14 +74,6 @@ type relayer struct { func (r *relayer) Name() string { return r.lggr.Name() } -func (r *relayer) EVM() (types.EVMService, error) { - return nil, nil -} - -func (r *relayer) TON() (types.TONService, error) { - return nil, nil -} - func (r *relayer) Start(ctx context.Context) error { var names []string // Test database connection with dummy query diff --git a/pkg/loop/internal/pb/relayerset/helper.go b/pkg/loop/internal/pb/relayerset/helper.go index 5003010a5e..be49adb443 100644 --- a/pkg/loop/internal/pb/relayerset/helper.go +++ b/pkg/loop/internal/pb/relayerset/helper.go @@ -4,23 +4,29 @@ import ( "google.golang.org/grpc" "github.com/smartcontractkit/chainlink-common/pkg/chains/evm" + "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" "github.com/smartcontractkit/chainlink-common/pkg/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb" ) +type HasChainServers interface { + SolanaServer() solana.SolanaServer + EVMServer() evm.EVMServer + TONServer() ton.TONServer + ContractReaderServer() pb.ContractReaderServer +} + // RegisterRelayerSetServerWithDependants registers all the grpc services hidden injected into and hidden behind RelayerSet. func RegisterRelayerSetServerWithDependants(s grpc.ServiceRegistrar, srv RelayerSetServer) { RegisterRelayerSetServer(s, srv) switch eSrv := srv.(type) { - case evm.EVMServer: - evm.RegisterEVMServer(s, eSrv) - } - switch eSrv := srv.(type) { - case ton.TONServer: - ton.RegisterTONServer(s, eSrv) - } - switch eSrv := srv.(type) { case pb.ContractReaderServer: pb.RegisterContractReaderServer(s, eSrv) } + if h, ok := srv.(HasChainServers); ok { + solana.RegisterSolanaServer(s, h.SolanaServer()) + evm.RegisterEVMServer(s, h.EVMServer()) + ton.RegisterTONServer(s, h.TONServer()) + pb.RegisterContractReaderServer(s, h.ContractReaderServer()) + } } diff --git a/pkg/loop/internal/relayer/relayer.go b/pkg/loop/internal/relayer/relayer.go index 79b505f189..c0309c5db2 100644 --- a/pkg/loop/internal/relayer/relayer.go +++ b/pkg/loop/internal/relayer/relayer.go @@ -14,6 +14,7 @@ import ( "google.golang.org/protobuf/types/known/structpb" evmpb "github.com/smartcontractkit/chainlink-common/pkg/chains/evm" + solpb "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" tonpb "github.com/smartcontractkit/chainlink-common/pkg/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/core/services/capability" @@ -156,6 +157,9 @@ func (p *pluginRelayerServer) NewRelayer(ctx context.Context, request *pb.NewRel if tonService, ok := r.(types.TONService); ok { tonpb.RegisterTONServer(s, newTONServer(tonService, p.BrokerExt)) } + if solService, ok := r.(types.SolanaService); ok { + solpb.RegisterSolanaServer(s, newSolServer(solService, p.BrokerExt)) + } }, rRes, ksRes, ksCSARes, crRes) if err != nil { return nil, err @@ -172,11 +176,12 @@ type relayerClient struct { relayer pb.RelayerClient evmClient evmpb.EVMClient tonClient tonpb.TONClient + solClient solpb.SolanaClient } func newRelayerClient(b *net.BrokerExt, conn grpc.ClientConnInterface) *relayerClient { b = b.WithName("RelayerClient") - return &relayerClient{b, goplugin.NewServiceClient(b, conn), pb.NewRelayerClient(conn), evmpb.NewEVMClient(conn), tonpb.NewTONClient(conn)} + return &relayerClient{b, goplugin.NewServiceClient(b, conn), pb.NewRelayerClient(conn), evmpb.NewEVMClient(conn), tonpb.NewTONClient(conn), solpb.NewSolanaClient(conn)} } func (r *relayerClient) NewContractWriter(_ context.Context, contractWriterConfig []byte) (types.ContractWriter, error) { @@ -426,6 +431,12 @@ func (r *relayerClient) TON() (types.TONService, error) { }, nil } +func (r *relayerClient) Solana() (types.SolanaService, error) { + return &SolClient{ + r.solClient, + }, nil +} + var _ pb.RelayerServer = (*relayerServer)(nil) // relayerServer exposes [Relayer] as a GRPC [pb.RelayerServer]. diff --git a/pkg/loop/internal/relayer/solana.go b/pkg/loop/internal/relayer/solana.go new file mode 100644 index 0000000000..491a4935ba --- /dev/null +++ b/pkg/loop/internal/relayer/solana.go @@ -0,0 +1,417 @@ +package relayer + +import ( + "context" + "fmt" + + solpb "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" + chaincommonpb "github.com/smartcontractkit/chainlink-common/pkg/loop/chain-common" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + "github.com/smartcontractkit/chainlink-common/pkg/types/query" + "google.golang.org/protobuf/types/known/emptypb" +) + +var _ types.SolanaService = (*SolClient)(nil) + +type SolClient struct { + grpcClient solpb.SolanaClient +} + +func NewSolanaClient(client solpb.SolanaClient) *SolClient { + return &SolClient{ + grpcClient: client, + } +} + +func (sc *SolClient) GetLatestLPBlock(ctx context.Context) (*solana.LPBlock, error) { + resp, err := sc.grpcClient.GetLatestLPBlock(ctx, &emptypb.Empty{}) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solana.LPBlock{ + Slot: resp.GetSlot(), + }, nil +} + +func (sc *SolClient) SubmitTransaction(ctx context.Context, req solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error) { + pReq := solpb.ConvertSubmitTransactionRequestToProto(req) + + pResp, err := sc.grpcClient.SubmitTransaction(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := solpb.ConvertSubmitTransactionReplyFromProto(pResp) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return dResp, nil +} + +func (sc *SolClient) RegisterLogTracking(ctx context.Context, req solana.LPFilterQuery) error { + filter := solpb.ConvertLPFilterQueryToProto(&req) + _, err := sc.grpcClient.RegisterLogTracking(ctx, &solpb.RegisterLogTrackingRequest{ + Filter: filter, + }) + return net.WrapRPCErr(err) +} + +func (sc *SolClient) UnregisterLogTracking(ctx context.Context, filterName string) error { + _, err := sc.grpcClient.UnregisterLogTracking(ctx, &solpb.UnregisterLogTrackingRequest{FilterName: filterName}) + return net.WrapRPCErr(err) +} + +func (sc *SolClient) QueryTrackedLogs(ctx context.Context, filterQuery []query.Expression, limitAndSort query.LimitAndSort) ([]*solana.Log, error) { + pExprs, err := solpb.ConvertExpressionsToProto(filterQuery) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + protoLimitAndSort, err := chaincommonpb.ConvertLimitAndSortToProto(limitAndSort) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + pReq := &solpb.QueryTrackedLogsRequest{ + FilterQuery: pExprs, + LimitAndSort: protoLimitAndSort, + } + + pResp, err := sc.grpcClient.QueryTrackedLogs(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + out := make([]*solana.Log, 0, len(pResp.Logs)) + for _, pl := range pResp.Logs { + dl, err := solpb.ConvertLogFromProto(pl) + if err != nil { + return nil, net.WrapRPCErr(err) + } + out = append(out, dl) + } + + return out, nil +} + +func (sc *SolClient) GetBalance(ctx context.Context, req solana.GetBalanceRequest) (*solana.GetBalanceReply, error) { + pReq := solpb.ConvertGetBalanceRequestToProto(req) + pResp, err := sc.grpcClient.GetBalance(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetBalanceReplyFromProto(pResp), nil +} + +func (sc *SolClient) GetAccountInfoWithOpts(ctx context.Context, req solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error) { + pReq := &solpb.GetAccountInfoWithOptsRequest{ + Account: req.Account[:], + Opts: solpb.ConvertGetAccountInfoOptsToProto(req.Opts), + } + pResp, err := sc.grpcClient.GetAccountInfoWithOpts(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + acc, err := solpb.ConvertAccountFromProto(pResp.Value) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + reply := &solana.GetAccountInfoReply{ + RPCContext: solpb.ConvertRPCContextFromProto(pResp.RpcContext), + Value: acc, + } + + return reply, nil +} + +func (sc *SolClient) GetMultipleAccountsWithOpts(ctx context.Context, req solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error) { + pReq := solpb.ConvertGetMultipleAccountsRequestToProto(&req) + pResp, err := sc.grpcClient.GetMultipleAccountsWithOpts(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + reply, err := solpb.ConvertGetMultipleAccountsReplyFromProto(pResp) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return reply, nil +} + +func (sc *SolClient) GetBlock(ctx context.Context, req solana.GetBlockRequest) (*solana.GetBlockReply, error) { + pReq := solpb.ConvertGetBlockRequestToProto(&req) + pResp, err := sc.grpcClient.GetBlock(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + reply, err := solpb.ConvertGetBlockOptsReplyFromProto(pResp) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return reply, nil +} + +func (sc *SolClient) GetSlotHeight(ctx context.Context, req solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error) { + pReq := solpb.ConvertGetSlotHeightRequestToProto(req) + pResp, err := sc.grpcClient.GetSlotHeight(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetSlotHeightReplyFromProto(pResp), nil +} + +func (sc *SolClient) GetTransaction(ctx context.Context, req solana.GetTransactionRequest) (*solana.GetTransactionReply, error) { + pReq := solpb.ConvertGetTransactionRequestToProto(req) + pResp, err := sc.grpcClient.GetTransaction(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + reply, err := solpb.ConvertGetTransactionReplyFromProto(pResp) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return reply, nil +} + +func (sc *SolClient) GetFeeForMessage(ctx context.Context, req solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error) { + pReq := solpb.ConvertGetFeeForMessageRequestToProto(&req) + pResp, err := sc.grpcClient.GetFeeForMessage(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetFeeForMessageReplyFromProto(pResp), nil +} + +func (sc *SolClient) GetSignatureStatuses(ctx context.Context, req solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error) { + pReq := solpb.ConvertGetSignatureStatusesRequestToProto(&req) + pResp, err := sc.grpcClient.GetSignatureStatuses(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetSignatureStatusesReplyFromProto(pResp), nil +} + +func (sc *SolClient) SimulateTX(ctx context.Context, req solana.SimulateTXRequest) (*solana.SimulateTXReply, error) { + pReq := solpb.ConvertSimulateTXRequestToProto(req) + pResp, err := sc.grpcClient.SimulateTX(ctx, pReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + reply, err := solpb.ConvertSimulateTXReplyFromProto(pResp) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return reply, nil +} + +type solServer struct { + solpb.UnimplementedSolanaServer + + *net.BrokerExt + + impl types.SolanaService +} + +var _ solpb.SolanaServer = (*solServer)(nil) + +func newSolServer(impl types.SolanaService, b *net.BrokerExt) *solServer { + return &solServer{impl: impl, BrokerExt: b.WithName("SolanaServer")} +} + +func (s *solServer) GetLatestLPBlock(ctx context.Context, _ *emptypb.Empty) (*solpb.GetLatestLPBlockReply, error) { + dResp, err := s.impl.GetLatestLPBlock(ctx) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solpb.GetLatestLPBlockReply{ + Slot: dResp.Slot, + }, nil +} + +func (s *solServer) SubmitTransaction(ctx context.Context, req *solpb.SubmitTransactionRequest) (*solpb.SubmitTransactionReply, error) { + dReq, err := solpb.ConvertSubmitTransactionRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := s.impl.SubmitTransaction(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + pResp := solpb.ConvertSubmitTransactionReplyToProto(dResp) + return pResp, nil +} + +func (s *solServer) RegisterLogTracking(ctx context.Context, req *solpb.RegisterLogTrackingRequest) (*solpb.RegisterLogTrackingReply, error) { + if req.Filter == nil { + return nil, net.WrapRPCErr(fmt.Errorf("missing filter")) + } + + filter, err := solpb.ConvertLPFilterQueryFromProto(req.Filter) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + if err := s.impl.RegisterLogTracking(ctx, *filter); err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solpb.RegisterLogTrackingReply{}, nil +} + +func (s *solServer) UnregisterLogTracking(ctx context.Context, req *solpb.UnregisterLogTrackingRequest) (*solpb.UnregisterLogTrackingReply, error) { + if err := s.impl.UnregisterLogTracking(ctx, req.GetFilterName()); err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solpb.UnregisterLogTrackingReply{}, nil +} + +func (s *solServer) QueryTrackedLogs(ctx context.Context, req *solpb.QueryTrackedLogsRequest) (*solpb.QueryTrackedLogsReply, error) { + dExprs, err := solpb.ConvertExpressionsFromProto(req.GetFilterQuery()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + ls, err := chaincommonpb.ConvertLimitAndSortFromProto(req.GetLimitAndSort()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + logs, err := s.impl.QueryTrackedLogs(ctx, dExprs, ls) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + out := make([]*solpb.Log, 0, len(logs)) + for _, l := range logs { + out = append(out, solpb.ConvertLogToProto(l)) + } + + return &solpb.QueryTrackedLogsReply{Logs: out}, nil +} + +func (s *solServer) GetBalance(ctx context.Context, req *solpb.GetBalanceRequest) (*solpb.GetBalanceReply, error) { + dReq, err := solpb.ConvertGetBalanceRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := s.impl.GetBalance(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetBalanceReplyToProto(dResp), nil +} + +func (s *solServer) GetAccountInfoWithOpts(ctx context.Context, req *solpb.GetAccountInfoWithOptsRequest) (*solpb.GetAccountInfoWithOptsReply, error) { + addr, err := solpb.ConvertPublicKeyFromProto(req.GetAccount()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + opts := solpb.ConvertGetAccountInfoOptsFromProto(req.GetOpts()) + + dReq := solana.GetAccountInfoRequest{Account: addr, Opts: opts} + dResp, err := s.impl.GetAccountInfoWithOpts(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solpb.GetAccountInfoWithOptsReply{ + RpcContext: solpb.ConvertRPCContextToProto(dResp.RPCContext), + Value: solpb.ConvertAccountToProto(dResp.Value), + }, nil +} + +func (s *solServer) GetMultipleAccountsWithOpts(ctx context.Context, req *solpb.GetMultipleAccountsWithOptsRequest) (*solpb.GetMultipleAccountsWithOptsReply, error) { + dReq := solpb.ConvertGetMultipleAccountsRequestFromProto(req) + dResp, err := s.impl.GetMultipleAccountsWithOpts(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetMultipleAccountsReplyToProto(dResp), nil +} + +func (s *solServer) GetBlock(ctx context.Context, req *solpb.GetBlockRequest) (*solpb.GetBlockReply, error) { + dReq := solpb.ConvertGetBlockRequestFromProto(req) + dResp, err := s.impl.GetBlock(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetBlockReplyToProto(dResp), nil +} + +func (s *solServer) GetSlotHeight(ctx context.Context, req *solpb.GetSlotHeightRequest) (*solpb.GetSlotHeightReply, error) { + dReq := solpb.ConvertGetSlotHeightRequestFromProto(req) + dResp, err := s.impl.GetSlotHeight(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetSlotHeightReplyToProto(dResp), nil +} + +func (s *solServer) GetTransaction(ctx context.Context, req *solpb.GetTransactionRequest) (*solpb.GetTransactionReply, error) { + dReq, err := solpb.ConvertGetTransactionRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := s.impl.GetTransaction(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetTransactionReplyToProto(dResp), nil +} + +func (s *solServer) GetFeeForMessage(ctx context.Context, req *solpb.GetFeeForMessageRequest) (*solpb.GetFeeForMessageReply, error) { + dReq := solpb.ConvertGetFeeForMessageRequestFromProto(req) + dResp, err := s.impl.GetFeeForMessage(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetFeeForMessageReplyToProto(dResp), nil +} + +func (s *solServer) GetSignatureStatuses(ctx context.Context, req *solpb.GetSignatureStatusesRequest) (*solpb.GetSignatureStatusesReply, error) { + dReq, err := solpb.ConvertGetSignatureStatusesRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := s.impl.GetSignatureStatuses(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetSignatureStatusesReplyToProto(dResp), nil +} + +func (s *solServer) SimulateTX(ctx context.Context, req *solpb.SimulateTXRequest) (*solpb.SimulateTXReply, error) { + dReq, err := solpb.ConvertSimulateTXRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := s.impl.SimulateTX(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertSimulateTXReplyToProto(dResp), nil +} diff --git a/pkg/loop/internal/relayer/test/relayer.go b/pkg/loop/internal/relayer/test/relayer.go index f0bfb030b2..b745472a3a 100644 --- a/pkg/loop/internal/relayer/test/relayer.go +++ b/pkg/loop/internal/relayer/test/relayer.go @@ -245,6 +245,10 @@ func (s staticRelayer) TON() (types.TONService, error) { return nil, nil } +func (s staticRelayer) Solana() (types.SolanaService, error) { + return nil, nil +} + func (s staticRelayer) NewContractReader(_ context.Context, contractReaderConfig []byte) (types.ContractReader, error) { if s.StaticChecks && !(bytes.Equal(s.contractReaderConfig, contractReaderConfig)) { return nil, fmt.Errorf("expected contractReaderConfig:\n\t%v\nbut got:\n\t%v", string(s.contractReaderConfig), string(contractReaderConfig)) diff --git a/pkg/loop/internal/relayerset/client.go b/pkg/loop/internal/relayerset/client.go index bc37e0fbce..bb1677e65a 100644 --- a/pkg/loop/internal/relayerset/client.go +++ b/pkg/loop/internal/relayerset/client.go @@ -8,6 +8,7 @@ import ( "google.golang.org/grpc" "github.com/smartcontractkit/chainlink-common/pkg/chains/evm" + "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" "github.com/smartcontractkit/chainlink-common/pkg/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/goplugin" @@ -26,22 +27,24 @@ type Client struct { log logger.Logger - relayerSetClient relayerset.RelayerSetClient - contractReaderClient pb.ContractReaderClient - evmRelayerSetClient evm.EVMClient - tonRelayerSetClient ton.TONClient + relayerSetClient relayerset.RelayerSetClient + contractReaderClient pb.ContractReaderClient + evmRelayerSetClient evm.EVMClient + tonRelayerSetClient ton.TONClient + solanaRelayerSetClient solana.SolanaClient } func NewRelayerSetClient(log logger.Logger, b *net.BrokerExt, conn grpc.ClientConnInterface) *Client { b = b.WithName("ChainRelayerClient") return &Client{ - log: log, - BrokerExt: b, - ServiceClient: goplugin.NewServiceClient(b, conn), - relayerSetClient: relayerset.NewRelayerSetClient(conn), - evmRelayerSetClient: evm.NewEVMClient(conn), - tonRelayerSetClient: ton.NewTONClient(conn), - contractReaderClient: pb.NewContractReaderClient(conn)} + log: log, + BrokerExt: b, + ServiceClient: goplugin.NewServiceClient(b, conn), + relayerSetClient: relayerset.NewRelayerSetClient(conn), + evmRelayerSetClient: evm.NewEVMClient(conn), + tonRelayerSetClient: ton.NewTONClient(conn), + solanaRelayerSetClient: solana.NewSolanaClient(conn), + contractReaderClient: pb.NewContractReaderClient(conn)} } func (k *Client) Get(ctx context.Context, relayID types.RelayID) (core.Relayer, error) { @@ -167,6 +170,19 @@ func (k *Client) TON(relayID types.RelayID) (types.TONService, error) { }), nil } +func (k *Client) Solana(relayID types.RelayID) (types.SolanaService, error) { + if k.solanaRelayerSetClient == nil { + return nil, errors.New("solanaRelayerSetClient can't be nil") + } + + return rel.NewSolanaClient( + &solClient{ + relayID: relayID, + client: k.solanaRelayerSetClient, + }, + ), nil +} + func (k *Client) NewPluginProvider(ctx context.Context, relayID types.RelayID, relayArgs core.RelayArgs, pluginArgs core.PluginArgs) (uint32, error) { // TODO at a later phase these credentials should be set as part of the relay config and not as a separate field var mercuryCredentials *relayerset.MercuryCredentials diff --git a/pkg/loop/internal/relayerset/contract_reader.go b/pkg/loop/internal/relayerset/contract_reader.go index e686ec9702..d167984f22 100644 --- a/pkg/loop/internal/relayerset/contract_reader.go +++ b/pkg/loop/internal/relayerset/contract_reader.go @@ -83,8 +83,15 @@ func (s *contractReaderServiceClient) Ready() error { return nil } -func (s *Server) ContractReaderStart(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { - reader, err := s.getReader(ctx) +type readerServer struct { + pb.UnimplementedContractReaderServer + parent *Server +} + +var _ pb.ContractReaderServer = (*readerServer)(nil) + +func (rs *readerServer) ContractReaderStart(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -92,8 +99,8 @@ func (s *Server) ContractReaderStart(ctx context.Context, _ *emptypb.Empty) (*em return &emptypb.Empty{}, reader.reader.Start(ctx) } -func (s *Server) ContractReaderClose(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) ContractReaderClose(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -101,12 +108,12 @@ func (s *Server) ContractReaderClose(ctx context.Context, _ *emptypb.Empty) (*em if err != nil { return nil, err } - s.removeReader(id) + rs.parent.removeReader(id) return &emptypb.Empty{}, reader.reader.Close() } -func (s *Server) GetLatestValue(ctx context.Context, in *pb.GetLatestValueRequest) (*pb.GetLatestValueReply, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) GetLatestValue(ctx context.Context, in *pb.GetLatestValueRequest) (*pb.GetLatestValueReply, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -114,8 +121,8 @@ func (s *Server) GetLatestValue(ctx context.Context, in *pb.GetLatestValueReques return reader.server.GetLatestValue(ctx, in) } -func (s *Server) GetLatestValueWithHeadData(ctx context.Context, in *pb.GetLatestValueRequest) (*pb.GetLatestValueWithHeadDataReply, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) GetLatestValueWithHeadData(ctx context.Context, in *pb.GetLatestValueRequest) (*pb.GetLatestValueWithHeadDataReply, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -123,8 +130,8 @@ func (s *Server) GetLatestValueWithHeadData(ctx context.Context, in *pb.GetLates return reader.server.GetLatestValueWithHeadData(ctx, in) } -func (s *Server) GetLatestValues(ctx context.Context, in *pb.BatchGetLatestValuesRequest) (*pb.BatchGetLatestValuesReply, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) GetLatestValues(ctx context.Context, in *pb.BatchGetLatestValuesRequest) (*pb.BatchGetLatestValuesReply, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -132,8 +139,8 @@ func (s *Server) GetLatestValues(ctx context.Context, in *pb.BatchGetLatestValue return reader.server.BatchGetLatestValues(ctx, in) } -func (s *Server) QueryKeys(ctx context.Context, in *pb.QueryKeysRequest) (*pb.QueryKeysReply, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) QueryKeys(ctx context.Context, in *pb.QueryKeysRequest) (*pb.QueryKeysReply, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -141,8 +148,8 @@ func (s *Server) QueryKeys(ctx context.Context, in *pb.QueryKeysRequest) (*pb.Qu return reader.server.QueryKeys(ctx, in) } -func (s *Server) QueryKey(ctx context.Context, in *pb.QueryKeyRequest) (*pb.QueryKeyReply, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) QueryKey(ctx context.Context, in *pb.QueryKeyRequest) (*pb.QueryKeyReply, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -150,8 +157,8 @@ func (s *Server) QueryKey(ctx context.Context, in *pb.QueryKeyRequest) (*pb.Quer return reader.server.QueryKey(ctx, in) } -func (s *Server) Bind(ctx context.Context, in *pb.BindRequest) (*emptypb.Empty, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) Bind(ctx context.Context, in *pb.BindRequest) (*emptypb.Empty, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } @@ -159,11 +166,18 @@ func (s *Server) Bind(ctx context.Context, in *pb.BindRequest) (*emptypb.Empty, return reader.server.Bind(ctx, in) } -func (s *Server) Unbind(ctx context.Context, in *pb.UnbindRequest) (*emptypb.Empty, error) { - reader, err := s.getReader(ctx) +func (rs *readerServer) Unbind(ctx context.Context, in *pb.UnbindRequest) (*emptypb.Empty, error) { + reader, err := rs.parent.getReader(ctx) if err != nil { return nil, err } return reader.server.Unbind(ctx, in) } + +func (s *Server) ContractReaderStart(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + return s.contractReader.ContractReaderStart(ctx, &emptypb.Empty{}) +} +func (s *Server) ContractReaderClose(ctx context.Context, _ *emptypb.Empty) (*emptypb.Empty, error) { + return s.contractReader.ContractReaderClose(ctx, &emptypb.Empty{}) +} diff --git a/pkg/loop/internal/relayerset/evm.go b/pkg/loop/internal/relayerset/evm.go index d6f4ae48e4..f40948845e 100644 --- a/pkg/loop/internal/relayerset/evm.go +++ b/pkg/loop/internal/relayerset/evm.go @@ -95,8 +95,15 @@ func (e evmClient) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty, opts return e.client.GetLatestLPBlock(appendRelayID(ctx, e.relayID), in, opts...) } -func (s *Server) GetTransactionFee(ctx context.Context, request *evmpb.GetTransactionFeeRequest) (*evmpb.GetTransactionFeeReply, error) { - evmService, err := s.getEVMService(ctx) +type evmServer struct { + evmpb.UnimplementedEVMServer + parent *Server +} + +var _ evmpb.EVMServer = (*evmServer)(nil) + +func (es *evmServer) GetTransactionFee(ctx context.Context, request *evmpb.GetTransactionFeeRequest) (*evmpb.GetTransactionFeeReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -112,8 +119,8 @@ func (s *Server) GetTransactionFee(ctx context.Context, request *evmpb.GetTransa return &evmpb.GetTransactionFeeReply{TransactionFee: valuespb.NewBigIntFromInt(reply.TransactionFee)}, nil } -func (s *Server) CallContract(ctx context.Context, request *evmpb.CallContractRequest) (*evmpb.CallContractReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) CallContract(ctx context.Context, request *evmpb.CallContractRequest) (*evmpb.CallContractReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -146,8 +153,8 @@ func (s *Server) CallContract(ctx context.Context, request *evmpb.CallContractRe }, nil } -func (s *Server) FilterLogs(ctx context.Context, request *evmpb.FilterLogsRequest) (*evmpb.FilterLogsReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) FilterLogs(ctx context.Context, request *evmpb.FilterLogsRequest) (*evmpb.FilterLogsReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -181,8 +188,8 @@ func (s *Server) FilterLogs(ctx context.Context, request *evmpb.FilterLogsReques return &evmpb.FilterLogsReply{Logs: logs}, nil } -func (s *Server) BalanceAt(ctx context.Context, request *evmpb.BalanceAtRequest) (*evmpb.BalanceAtReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) BalanceAt(ctx context.Context, request *evmpb.BalanceAtRequest) (*evmpb.BalanceAtReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -213,8 +220,8 @@ func (s *Server) BalanceAt(ctx context.Context, request *evmpb.BalanceAtRequest) return &evmpb.BalanceAtReply{Balance: valuespb.NewBigIntFromInt(reply.Balance)}, nil } -func (s *Server) EstimateGas(ctx context.Context, request *evmpb.EstimateGasRequest) (*evmpb.EstimateGasReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) EstimateGas(ctx context.Context, request *evmpb.EstimateGasRequest) (*evmpb.EstimateGasReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -232,8 +239,8 @@ func (s *Server) EstimateGas(ctx context.Context, request *evmpb.EstimateGasRequ return &evmpb.EstimateGasReply{Gas: gasLimit}, nil } -func (s *Server) GetTransactionByHash(ctx context.Context, request *evmpb.GetTransactionByHashRequest) (*evmpb.GetTransactionByHashReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) GetTransactionByHash(ctx context.Context, request *evmpb.GetTransactionByHashRequest) (*evmpb.GetTransactionByHashReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -256,8 +263,8 @@ func (s *Server) GetTransactionByHash(ctx context.Context, request *evmpb.GetTra }, nil } -func (s *Server) GetTransactionReceipt(ctx context.Context, request *evmpb.GetTransactionReceiptRequest) (*evmpb.GetTransactionReceiptReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) GetTransactionReceipt(ctx context.Context, request *evmpb.GetTransactionReceiptRequest) (*evmpb.GetTransactionReceiptReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -280,8 +287,8 @@ func (s *Server) GetTransactionReceipt(ctx context.Context, request *evmpb.GetTr }, nil } -func (s *Server) HeaderByNumber(ctx context.Context, request *evmpb.HeaderByNumberRequest) (*evmpb.HeaderByNumberReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) HeaderByNumber(ctx context.Context, request *evmpb.HeaderByNumberRequest) (*evmpb.HeaderByNumberReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -313,8 +320,8 @@ func (s *Server) HeaderByNumber(ctx context.Context, request *evmpb.HeaderByNumb }, nil } -func (s *Server) QueryTrackedLogs(ctx context.Context, request *evmpb.QueryTrackedLogsRequest) (*evmpb.QueryTrackedLogsReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) QueryTrackedLogs(ctx context.Context, request *evmpb.QueryTrackedLogsRequest) (*evmpb.QueryTrackedLogsReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -347,9 +354,9 @@ func (s *Server) QueryTrackedLogs(ctx context.Context, request *evmpb.QueryTrack return &evmpb.QueryTrackedLogsReply{Logs: l}, nil } -func (s *Server) GetFiltersNames(ctx context.Context, _ *emptypb.Empty) (*evmpb.GetFiltersNamesReply, error) { +func (es *evmServer) GetFiltersNames(ctx context.Context, _ *emptypb.Empty) (*evmpb.GetFiltersNamesReply, error) { // TODO PLEX-1465: once code is moved away, remove this GetFiltersNames method - evmService, err := s.getEVMService(ctx) + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -362,8 +369,8 @@ func (s *Server) GetFiltersNames(ctx context.Context, _ *emptypb.Empty) (*evmpb. return &evmpb.GetFiltersNamesReply{Items: names}, nil } -func (s *Server) RegisterLogTracking(ctx context.Context, request *evmpb.RegisterLogTrackingRequest) (*emptypb.Empty, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) RegisterLogTracking(ctx context.Context, request *evmpb.RegisterLogTrackingRequest) (*emptypb.Empty, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -380,8 +387,8 @@ func (s *Server) RegisterLogTracking(ctx context.Context, request *evmpb.Registe return &emptypb.Empty{}, nil } -func (s *Server) UnregisterLogTracking(ctx context.Context, request *evmpb.UnregisterLogTrackingRequest) (*emptypb.Empty, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) UnregisterLogTracking(ctx context.Context, request *evmpb.UnregisterLogTrackingRequest) (*emptypb.Empty, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -393,8 +400,8 @@ func (s *Server) UnregisterLogTracking(ctx context.Context, request *evmpb.Unreg return &emptypb.Empty{}, nil } -func (s *Server) GetTransactionStatus(ctx context.Context, request *evmpb.GetTransactionStatusRequest) (*evmpb.GetTransactionStatusReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) GetTransactionStatus(ctx context.Context, request *evmpb.GetTransactionStatusRequest) (*evmpb.GetTransactionStatusReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -408,8 +415,8 @@ func (s *Server) GetTransactionStatus(ctx context.Context, request *evmpb.GetTra return &evmpb.GetTransactionStatusReply{TransactionStatus: evmpb.TransactionStatus(txStatus)}, nil } -func (s *Server) SubmitTransaction(ctx context.Context, request *evmpb.SubmitTransactionRequest) (*evmpb.SubmitTransactionReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) SubmitTransaction(ctx context.Context, request *evmpb.SubmitTransactionRequest) (*evmpb.SubmitTransactionReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -438,8 +445,8 @@ func (s *Server) SubmitTransaction(ctx context.Context, request *evmpb.SubmitTra }, nil } -func (s *Server) CalculateTransactionFee(ctx context.Context, request *evmpb.CalculateTransactionFeeRequest) (*evmpb.CalculateTransactionFeeReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) CalculateTransactionFee(ctx context.Context, request *evmpb.CalculateTransactionFeeRequest) (*evmpb.CalculateTransactionFeeReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -460,8 +467,8 @@ func (s *Server) CalculateTransactionFee(ctx context.Context, request *evmpb.Cal }, nil } -func (s *Server) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty) (*evmpb.GetLatestLPBlockReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty) (*evmpb.GetLatestLPBlockReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } @@ -482,8 +489,8 @@ func (s *Server) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty) (*evmp }, nil } -func (s *Server) GetForwarderForEOA(ctx context.Context, request *evmpb.GetForwarderForEOARequest) (*evmpb.GetForwarderForEOAReply, error) { - evmService, err := s.getEVMService(ctx) +func (es *evmServer) GetForwarderForEOA(ctx context.Context, request *evmpb.GetForwarderForEOARequest) (*evmpb.GetForwarderForEOAReply, error) { + evmService, err := es.parent.getEVMService(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/relayerset/relayer.go b/pkg/loop/internal/relayerset/relayer.go index 55ef1e8901..00dadd948e 100644 --- a/pkg/loop/internal/relayerset/relayer.go +++ b/pkg/loop/internal/relayerset/relayer.go @@ -43,6 +43,10 @@ func (r *relayer) TON() (types.TONService, error) { return r.relayerSetClient.TON(r.relayerID) } +func (r *relayer) Solana() (types.SolanaService, error) { + return r.relayerSetClient.Solana(r.relayerID) +} + func (r *relayer) NewContractReader(ctx context.Context, contractReaderConfig []byte) (types.ContractReader, error) { return r.relayerSetClient.NewContractReader(ctx, r.relayerID, contractReaderConfig) } diff --git a/pkg/loop/internal/relayerset/relayerset_test.go b/pkg/loop/internal/relayerset/relayerset_test.go index db3db9ec42..f7d7f2515d 100644 --- a/pkg/loop/internal/relayerset/relayerset_test.go +++ b/pkg/loop/internal/relayerset/relayerset_test.go @@ -19,6 +19,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/relayerset" "github.com/smartcontractkit/chainlink-common/pkg/types" evmtypes "github.com/smartcontractkit/chainlink-common/pkg/types/chains/evm" + soltypes "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" "github.com/smartcontractkit/chainlink-common/pkg/types/chains/ton" tontypes "github.com/smartcontractkit/chainlink-common/pkg/types/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/types/core" @@ -27,6 +28,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/query" "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" evmprimitives "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives/evm" + solprimitives "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives/solana" ) func Test_RelayerSet(t *testing.T) { @@ -575,6 +577,347 @@ func Test_RelayerSet_EVMService(t *testing.T) { } } +func Test_RelayerSet_SolanaService(t *testing.T) { + ctx := t.Context() + stopCh := make(chan struct{}) + log := logger.Test(t) + + relayer1 := mocks.NewRelayer(t) + relayers := map[types.RelayID]core.Relayer{ + {Network: "N1", ChainID: "C1"}: relayer1, + } + + pluginName := "solana-relayerset-test" + client, server := plugin.TestPluginGRPCConn( + t, + true, + map[string]plugin.Plugin{ + pluginName: &testRelaySetPlugin{ + log: log, + impl: &TestRelayerSet{relayers: relayers}, + brokerExt: &net.BrokerExt{ + BrokerConfig: net.BrokerConfig{ + StopCh: stopCh, + Logger: log, + }, + }, + }, + }, + ) + defer client.Close() + defer server.Stop() + + relayerSetClient, err := client.Dispense(pluginName) + require.NoError(t, err) + rc, ok := relayerSetClient.(*Client) + require.True(t, ok) + + retrievedRelayer, err := rc.Get(ctx, types.RelayID{Network: "N1", ChainID: "C1"}) + require.NoError(t, err) + + tests := []struct { + name string + run func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) + }{ + { + name: "GetBalance", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + address := soltypes.PublicKey{1, 2, 3} + bal := uint64(32) + mockSol.EXPECT().GetBalance(mock.Anything, soltypes.GetBalanceRequest{ + Addr: address, + Commitment: soltypes.CommitmentConfirmed, + }).Return(&soltypes.GetBalanceReply{Value: bal}, nil) + reply, err := sol.GetBalance(ctx, soltypes.GetBalanceRequest{ + Addr: address, Commitment: soltypes.CommitmentConfirmed, + }) + require.NoError(t, err) + require.Equal(t, bal, reply.Value) + }, + }, + { + name: "GetAccountInfoWithOpts", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.GetAccountInfoRequest{ + Account: soltypes.PublicKey{9, 9, 9}, + Opts: &soltypes.GetAccountInfoOpts{ + Encoding: soltypes.EncodingJSONParsed, + Commitment: soltypes.CommitmentFinalized, + }, + } + slot := uint64(22) + lamports := uint64(33) + mockSol.EXPECT(). + GetAccountInfoWithOpts(mock.Anything, req). + Return(&soltypes.GetAccountInfoReply{ + RPCContext: soltypes.RPCContext{Slot: slot}, + Value: &soltypes.Account{ + Lamports: lamports, + Executable: false, + }, + }, nil) + + out, err := sol.GetAccountInfoWithOpts(ctx, req) + require.NoError(t, err) + require.Equal(t, lamports, out.Value.Lamports) + require.Equal(t, slot, out.RPCContext.Slot) + }, + }, + { + name: "GetMultipleAccountsWithOpts", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.GetMultipleAccountsRequest{ + Accounts: []soltypes.PublicKey{{1}, {2}}, + Opts: &soltypes.GetMultipleAccountsOpts{ + Encoding: soltypes.EncodingBase64, + Commitment: soltypes.CommitmentProcessed, + }, + } + slot := uint64(22) + lamports := uint64(33) + mockSol.EXPECT(). + GetMultipleAccountsWithOpts(mock.Anything, req). + Return(&soltypes.GetMultipleAccountsReply{ + RPCContext: soltypes.RPCContext{Slot: slot}, + Value: []*soltypes.Account{ + {Lamports: lamports}, {Lamports: lamports}, + }, + }, nil) + + out, err := sol.GetMultipleAccountsWithOpts(ctx, req) + require.NoError(t, err) + require.Len(t, out.Value, 2) + require.Equal(t, lamports, out.Value[0].Lamports) + }, + }, + { + name: "GetBlock", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.GetBlockRequest{ + Slot: 42, + Opts: &soltypes.GetBlockOpts{ + Commitment: soltypes.CommitmentConfirmed, + }, + } + expHash := soltypes.Hash{1, 2, 3} + parSlot := uint64(33) + expHeight := uint64(66) + mockSol.EXPECT(). + GetBlock(mock.Anything, req). + Return(&soltypes.GetBlockReply{ + Blockhash: expHash, + ParentSlot: parSlot, + BlockTime: nil, + BlockHeight: &expHeight, + }, nil) + + out, err := sol.GetBlock(ctx, req) + require.NoError(t, err) + require.Equal(t, parSlot, out.ParentSlot) + require.Equal(t, expHeight, *out.BlockHeight) + }, + }, + { + name: "GetSlotHeight", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.GetSlotHeightRequest{Commitment: soltypes.CommitmentFinalized} + mockSol.EXPECT(). + GetSlotHeight(mock.Anything, req). + Return(&soltypes.GetSlotHeightReply{Height: 9090}, nil) + + out, err := sol.GetSlotHeight(ctx, req) + require.NoError(t, err) + require.Equal(t, uint64(9090), out.Height) + }, + }, + { + name: "GetTransaction", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + var sig soltypes.Signature + copy(sig[:], []byte{1, 2, 3, 4}) + req := soltypes.GetTransactionRequest{Signature: sig} + expTime := soltypes.UnixTimeSeconds(11) + expFee := uint64(33) + expSlot := uint64(17) + mockSol.EXPECT(). + GetTransaction(mock.Anything, req). + Return(&soltypes.GetTransactionReply{ + Slot: expSlot, + BlockTime: &expTime, + Meta: &soltypes.TransactionMeta{ + Fee: expFee, + }, + }, nil) + + out, err := sol.GetTransaction(ctx, req) + require.NoError(t, err) + require.Equal(t, expSlot, out.Slot) + require.Equal(t, expFee, out.Meta.Fee) + }, + }, + { + name: "GetFeeForMessage", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.GetFeeForMessageRequest{ + Message: "AgAAAA==", + Commitment: soltypes.CommitmentProcessed, + } + mockSol.EXPECT(). + GetFeeForMessage(mock.Anything, req). + Return(&soltypes.GetFeeForMessageReply{Fee: 1234}, nil) + + out, err := sol.GetFeeForMessage(ctx, req) + require.NoError(t, err) + require.Equal(t, uint64(1234), out.Fee) + }, + }, + { + name: "GetSignatureStatuses", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + s1, s2 := soltypes.Signature{}, soltypes.Signature{} + copy(s1[:], []byte{7}) + copy(s2[:], []byte{8}) + req := soltypes.GetSignatureStatusesRequest{Sigs: []soltypes.Signature{s1, s2}} + expSlot1 := uint64(1) + expConf1 := uint64(11) + expSlot2 := uint64(33) + expConf2 := uint64(22) + mockSol.EXPECT(). + GetSignatureStatuses(mock.Anything, req). + Return(&soltypes.GetSignatureStatusesReply{ + Results: []soltypes.GetSignatureStatusesResult{ + {Slot: uint64(expSlot1), Confirmations: &expConf1}, {Slot: expSlot2, Confirmations: &expConf2}, + }, + }, nil) + + out, err := sol.GetSignatureStatuses(ctx, req) + require.NoError(t, err) + require.Len(t, out.Results, 2) + require.Equal(t, expSlot1, out.Results[0].Slot) + }, + }, + { + name: "SimulateTX", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.SimulateTXRequest{ + Receiver: soltypes.PublicKey{5, 5, 5}, + EncodedTransaction: "BASE64TX==", + Opts: &soltypes.SimulateTXOpts{ + SigVerify: true, + Commitment: soltypes.CommitmentProcessed, + ReplaceRecentBlockhash: true, + }, + } + mockSol.EXPECT(). + SimulateTX(mock.Anything, req). + Return(&soltypes.SimulateTXReply{ + Err: "", + Logs: []string{"log1", "log2"}, + }, nil) + + out, err := sol.SimulateTX(ctx, req) + require.NoError(t, err) + require.Len(t, out.Logs, 2) + }, + }, + { + name: "SubmitTransaction", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + units := uint32(1_400_999) + price := uint64(11) + req := soltypes.SubmitTransactionRequest{ + Cfg: &soltypes.ComputeConfig{ + ComputeLimit: &units, + ComputeMaxPrice: &price, + }, + Receiver: soltypes.PublicKey{3, 3, 3}, + EncodedTransaction: "BASE64TX==", + } + expected := &soltypes.SubmitTransactionReply{ + Signature: soltypes.Signature{0xaa, 0xbb}, + IdempotencyKey: "idem-123", + Status: soltypes.TxSuccess, + } + mockSol.EXPECT(). + SubmitTransaction(mock.Anything, req). + Return(expected, nil) + + out, err := sol.SubmitTransaction(ctx, req) + require.NoError(t, err) + require.Equal(t, expected.IdempotencyKey, out.IdempotencyKey) + require.Equal(t, expected.Signature, out.Signature) + require.Equal(t, expected.Status, out.Status) + }, + }, + { + name: "RegisterLogTracking", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + req := soltypes.LPFilterQuery{ + Name: "my-filter", + Address: soltypes.PublicKey{0x11}, + EventName: "MyEvent", + StartingBlock: 1234, + Retention: 3600, + } + mockSol.EXPECT(). + RegisterLogTracking(mock.Anything, req). + Return(nil) + + err := sol.RegisterLogTracking(ctx, req) + require.NoError(t, err) + }, + }, + { + name: "UnregisterLogTracking", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + filterName := "my-filter" + mockSol.EXPECT(). + UnregisterLogTracking(mock.Anything, filterName). + Return(nil) + + err := sol.UnregisterLogTracking(ctx, filterName) + require.NoError(t, err) + }, + }, + { + name: "QueryTrackedLogs", + run: func(t *testing.T, sol types.SolanaService, mockSol *mocks2.SolanaService) { + // simple expression & limit + filterExpr := []query.Expression{} + primitiveExpressions := []query.Expression{query.TxHash("txHash")} + primitiveExpressions = append(primitiveExpressions, solprimitives.NewAddressFilter(soltypes.PublicKey{1, 2, 3})) + filterExpr = append(filterExpr, primitiveExpressions...) + expected := []*soltypes.Log{ + {BlockNumber: 1, LogIndex: 0}, + {BlockNumber: 2, LogIndex: 5}, + } + + expLimitAndSort := query.NewLimitAndSort(query.CountLimit(10), query.SortByTimestamp{}) + mockSol.EXPECT(). + QueryTrackedLogs(mock.Anything, filterExpr, expLimitAndSort). + Return(expected, nil) + + out, err := sol.QueryTrackedLogs(ctx, filterExpr, expLimitAndSort) + require.NoError(t, err) + require.Len(t, out, 2) + require.Equal(t, int64(2), out[1].BlockNumber) + }, + }, + } + + for _, tc := range tests { + t.Run(tc.name, func(t *testing.T) { + mockSol := mocks2.NewSolanaService(t) + relayer1.On("Solana", mock.Anything, mock.Anything).Return(mockSol, nil).Once() + + fetchedSol, err := retrievedRelayer.Solana() + require.NoError(t, err) + + tc.run(t, fetchedSol, mockSol) + }) + } +} + func Test_RelayerSet_TONService(t *testing.T) { ctx := t.Context() stopCh := make(chan struct{}) diff --git a/pkg/loop/internal/relayerset/server.go b/pkg/loop/internal/relayerset/server.go index d4183c1981..d0a254508f 100644 --- a/pkg/loop/internal/relayerset/server.go +++ b/pkg/loop/internal/relayerset/server.go @@ -14,6 +14,7 @@ import ( "google.golang.org/protobuf/types/known/emptypb" evmpb "github.com/smartcontractkit/chainlink-common/pkg/chains/evm" + solpb "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" tonpb "github.com/smartcontractkit/chainlink-common/pkg/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/logger" "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" @@ -34,13 +35,15 @@ type Server struct { log logger.Logger relayerset.UnimplementedRelayerSetServer - evmpb.UnimplementedEVMServer - tonpb.UnimplementedTONServer - pb.ContractReaderServer impl core.RelayerSet broker *net.BrokerExt + sol *solServer + ton *tonServer + evm *evmServer + contractReader *readerServer + serverResources net.Resources readers map[string]*readerAndServer @@ -51,14 +54,15 @@ type Server struct { } var _ relayerset.RelayerSetServer = (*Server)(nil) -var _ evmpb.EVMServer = (*Server)(nil) -var _ tonpb.TONServer = (*Server)(nil) -var _ pb.ContractReaderServer = (*Server)(nil) func NewRelayerSetServer(log logger.Logger, underlying core.RelayerSet, broker *net.BrokerExt) (*Server, net.Resource) { pluginProviderServers := make(net.Resources, 0) server := &Server{log: log, impl: underlying, broker: broker, serverResources: pluginProviderServers, readers: map[string]*readerAndServer{}} + server.sol = &solServer{parent: server} + server.ton = &tonServer{parent: server} + server.evm = &evmServer{parent: server} + server.contractReader = &readerServer{parent: server} return server, net.Resource{ Name: "PluginProviderServers", @@ -66,6 +70,11 @@ func NewRelayerSetServer(log logger.Logger, underlying core.RelayerSet, broker * } } +func (s *Server) SolanaServer() solpb.SolanaServer { return s.sol } +func (s *Server) TONServer() tonpb.TONServer { return s.ton } +func (s *Server) EVMServer() evmpb.EVMServer { return s.evm } +func (s *Server) ContractReaderServer() pb.ContractReaderServer { return s.contractReader } + func (s *Server) Close() error { for _, pluginProviderServer := range s.serverResources { if err := pluginProviderServer.Close(); err != nil { diff --git a/pkg/loop/internal/relayerset/solana.go b/pkg/loop/internal/relayerset/solana.go new file mode 100644 index 0000000000..563ee8ff92 --- /dev/null +++ b/pkg/loop/internal/relayerset/solana.go @@ -0,0 +1,359 @@ +package relayerset + +import ( + "context" + "fmt" + + solpb "github.com/smartcontractkit/chainlink-common/pkg/chains/solana" + chaincommonpb "github.com/smartcontractkit/chainlink-common/pkg/loop/chain-common" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/net" + "github.com/smartcontractkit/chainlink-common/pkg/loop/internal/pb/relayerset" + "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + "google.golang.org/grpc" + "google.golang.org/protobuf/types/known/emptypb" +) + +// solClient wraps the SolanaRelayerSetClient by attaching a RelayerID to SolClient requests. +// The attached RelayerID is stored in the context metadata. +type solClient struct { + relayID types.RelayID + client solpb.SolanaClient +} + +var _ solpb.SolanaClient = (*solClient)(nil) + +func (sc *solClient) GetAccountInfoWithOpts(ctx context.Context, in *solpb.GetAccountInfoWithOptsRequest, opts ...grpc.CallOption) (*solpb.GetAccountInfoWithOptsReply, error) { + return sc.client.GetAccountInfoWithOpts(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetBalance(ctx context.Context, in *solpb.GetBalanceRequest, opts ...grpc.CallOption) (*solpb.GetBalanceReply, error) { + return sc.client.GetBalance(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetBlock(ctx context.Context, in *solpb.GetBlockRequest, opts ...grpc.CallOption) (*solpb.GetBlockReply, error) { + return sc.client.GetBlock(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetLatestLPBlock(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*solpb.GetLatestLPBlockReply, error) { + return sc.client.GetLatestLPBlock(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetFeeForMessage(ctx context.Context, in *solpb.GetFeeForMessageRequest, opts ...grpc.CallOption) (*solpb.GetFeeForMessageReply, error) { + return sc.client.GetFeeForMessage(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetMultipleAccountsWithOpts(ctx context.Context, in *solpb.GetMultipleAccountsWithOptsRequest, opts ...grpc.CallOption) (*solpb.GetMultipleAccountsWithOptsReply, error) { + return sc.client.GetMultipleAccountsWithOpts(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetSignatureStatuses(ctx context.Context, in *solpb.GetSignatureStatusesRequest, opts ...grpc.CallOption) (*solpb.GetSignatureStatusesReply, error) { + return sc.client.GetSignatureStatuses(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetSlotHeight(ctx context.Context, in *solpb.GetSlotHeightRequest, opts ...grpc.CallOption) (*solpb.GetSlotHeightReply, error) { + return sc.client.GetSlotHeight(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) GetTransaction(ctx context.Context, in *solpb.GetTransactionRequest, opts ...grpc.CallOption) (*solpb.GetTransactionReply, error) { + return sc.client.GetTransaction(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) QueryTrackedLogs(ctx context.Context, in *solpb.QueryTrackedLogsRequest, opts ...grpc.CallOption) (*solpb.QueryTrackedLogsReply, error) { + return sc.client.QueryTrackedLogs(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) RegisterLogTracking(ctx context.Context, in *solpb.RegisterLogTrackingRequest, opts ...grpc.CallOption) (*solpb.RegisterLogTrackingReply, error) { + return sc.client.RegisterLogTracking(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) SimulateTX(ctx context.Context, in *solpb.SimulateTXRequest, opts ...grpc.CallOption) (*solpb.SimulateTXReply, error) { + return sc.client.SimulateTX(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) SubmitTransaction(ctx context.Context, in *solpb.SubmitTransactionRequest, opts ...grpc.CallOption) (*solpb.SubmitTransactionReply, error) { + return sc.client.SubmitTransaction(appendRelayID(ctx, sc.relayID), in, opts...) +} + +func (sc *solClient) UnregisterLogTracking(ctx context.Context, in *solpb.UnregisterLogTrackingRequest, opts ...grpc.CallOption) (*solpb.UnregisterLogTrackingReply, error) { + return sc.client.UnregisterLogTracking(appendRelayID(ctx, sc.relayID), in, opts...) +} + +type solServer struct { + solpb.UnimplementedSolanaServer + parent *Server +} + +var _ solpb.SolanaServer = (*solServer)(nil) + +// Server handlers +func (ss *solServer) GetLatestLPBlock(ctx context.Context, _ *emptypb.Empty) (*solpb.GetLatestLPBlockReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dResp, err := solService.GetLatestLPBlock(ctx) + if err != nil { + return nil, err + } + + return &solpb.GetLatestLPBlockReply{ + Slot: dResp.Slot, + }, nil +} + +func (ss *solServer) SubmitTransaction(ctx context.Context, req *solpb.SubmitTransactionRequest) (*solpb.SubmitTransactionReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq, err := solpb.ConvertSubmitTransactionRequestFromProto(req) + if err != nil { + return nil, err + } + + dResp, err := solService.SubmitTransaction(ctx, dReq) + if err != nil { + return nil, err + } + + pResp := solpb.ConvertSubmitTransactionReplyToProto(dResp) + return pResp, nil +} + +func (ss *solServer) RegisterLogTracking(ctx context.Context, req *solpb.RegisterLogTrackingRequest) (*solpb.RegisterLogTrackingReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + if req.Filter == nil { + return nil, fmt.Errorf("missing filter") + } + + filter, err := solpb.ConvertLPFilterQueryFromProto(req.Filter) + if err != nil { + return nil, err + } + + if err := solService.RegisterLogTracking(ctx, *filter); err != nil { + return nil, err + } + + return &solpb.RegisterLogTrackingReply{}, nil +} + +func (ss *solServer) UnregisterLogTracking(ctx context.Context, req *solpb.UnregisterLogTrackingRequest) (*solpb.UnregisterLogTrackingReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + if err := solService.UnregisterLogTracking(ctx, req.GetFilterName()); err != nil { + return nil, err + } + + return &solpb.UnregisterLogTrackingReply{}, nil +} + +func (ss *solServer) QueryTrackedLogs(ctx context.Context, req *solpb.QueryTrackedLogsRequest) (*solpb.QueryTrackedLogsReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dExprs, err := solpb.ConvertExpressionsFromProto(req.GetFilterQuery()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + ls, err := chaincommonpb.ConvertLimitAndSortFromProto(req.GetLimitAndSort()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + logs, err := solService.QueryTrackedLogs(ctx, dExprs, ls) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + out := make([]*solpb.Log, 0, len(logs)) + for _, l := range logs { + out = append(out, solpb.ConvertLogToProto(l)) + } + + return &solpb.QueryTrackedLogsReply{Logs: out}, nil +} + +func (ss *solServer) GetBalance(ctx context.Context, req *solpb.GetBalanceRequest) (*solpb.GetBalanceReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq, err := solpb.ConvertGetBalanceRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := solService.GetBalance(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetBalanceReplyToProto(dResp), nil +} + +func (ss *solServer) GetAccountInfoWithOpts(ctx context.Context, req *solpb.GetAccountInfoWithOptsRequest) (*solpb.GetAccountInfoWithOptsReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + addr, err := solpb.ConvertPublicKeyFromProto(req.GetAccount()) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + opts := solpb.ConvertGetAccountInfoOptsFromProto(req.GetOpts()) + + dReq := solana.GetAccountInfoRequest{Account: addr, Opts: opts} + dResp, err := solService.GetAccountInfoWithOpts(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return &solpb.GetAccountInfoWithOptsReply{ + RpcContext: solpb.ConvertRPCContextToProto(dResp.RPCContext), + Value: solpb.ConvertAccountToProto(dResp.Value), + }, nil +} + +func (ss *solServer) GetMultipleAccountsWithOpts(ctx context.Context, req *solpb.GetMultipleAccountsWithOptsRequest) (*solpb.GetMultipleAccountsWithOptsReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq := solpb.ConvertGetMultipleAccountsRequestFromProto(req) + dResp, err := solService.GetMultipleAccountsWithOpts(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetMultipleAccountsReplyToProto(dResp), nil +} + +func (ss *solServer) GetBlock(ctx context.Context, req *solpb.GetBlockRequest) (*solpb.GetBlockReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq := solpb.ConvertGetBlockRequestFromProto(req) + dResp, err := solService.GetBlock(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetBlockReplyToProto(dResp), nil +} + +func (ss *solServer) GetSlotHeight(ctx context.Context, req *solpb.GetSlotHeightRequest) (*solpb.GetSlotHeightReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq := solpb.ConvertGetSlotHeightRequestFromProto(req) + dResp, err := solService.GetSlotHeight(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetSlotHeightReplyToProto(dResp), nil +} + +func (ss *solServer) GetTransaction(ctx context.Context, req *solpb.GetTransactionRequest) (*solpb.GetTransactionReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq, err := solpb.ConvertGetTransactionRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := solService.GetTransaction(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + return solpb.ConvertGetTransactionReplyToProto(dResp), nil +} + +func (ss *solServer) GetFeeForMessage(ctx context.Context, req *solpb.GetFeeForMessageRequest) (*solpb.GetFeeForMessageReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq := solpb.ConvertGetFeeForMessageRequestFromProto(req) + dResp, err := solService.GetFeeForMessage(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetFeeForMessageReplyToProto(dResp), nil +} + +func (ss *solServer) GetSignatureStatuses(ctx context.Context, req *solpb.GetSignatureStatusesRequest) (*solpb.GetSignatureStatusesReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq, err := solpb.ConvertGetSignatureStatusesRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := solService.GetSignatureStatuses(ctx, *dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertGetSignatureStatusesReplyToProto(dResp), nil +} + +func (ss *solServer) SimulateTX(ctx context.Context, req *solpb.SimulateTXRequest) (*solpb.SimulateTXReply, error) { + solService, err := ss.parent.getSolService(ctx) + if err != nil { + return nil, err + } + + dReq, err := solpb.ConvertSimulateTXRequestFromProto(req) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + dResp, err := solService.SimulateTX(ctx, dReq) + if err != nil { + return nil, net.WrapRPCErr(err) + } + + return solpb.ConvertSimulateTXReplyToProto(dResp), nil +} + +func (s *Server) getSolService(ctx context.Context) (types.SolanaService, error) { + id, err := readRelayID(ctx) + if err != nil { + return nil, err + } + idT := relayerset.RelayerId{Network: id.Network, ChainId: id.ChainID} + r, err := s.getRelayer(ctx, &idT) + if err != nil { + return nil, err + } + + return r.Solana() +} diff --git a/pkg/loop/internal/relayerset/ton.go b/pkg/loop/internal/relayerset/ton.go index ec21f007d0..e7502ab0fa 100644 --- a/pkg/loop/internal/relayerset/ton.go +++ b/pkg/loop/internal/relayerset/ton.go @@ -57,8 +57,15 @@ func (t tonClient) UnregisterFilter(ctx context.Context, in *tonpb.UnregisterFil return t.client.UnregisterFilter(appendRelayID(ctx, t.relayID), in, opts...) } -func (s *Server) GetMasterchainInfo(ctx context.Context, request *emptypb.Empty) (*tonpb.BlockIDExt, error) { - tonService, err := s.getTONService(ctx) +type tonServer struct { + tonpb.UnimplementedTONServer + parent *Server +} + +var _ tonpb.TONServer = (*tonServer)(nil) + +func (ts *tonServer) GetMasterchainInfo(ctx context.Context, request *emptypb.Empty) (*tonpb.BlockIDExt, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -71,8 +78,8 @@ func (s *Server) GetMasterchainInfo(ctx context.Context, request *emptypb.Empty) return &tonpb.BlockIDExt{Workchain: blockIdExt.Workchain, Shard: blockIdExt.Shard, SeqNo: blockIdExt.SeqNo}, nil } -func (s *Server) GetBlockData(ctx context.Context, request *tonpb.GetBlockDataRequest) (*tonpb.Block, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) GetBlockData(ctx context.Context, request *tonpb.GetBlockDataRequest) (*tonpb.Block, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -86,8 +93,8 @@ func (s *Server) GetBlockData(ctx context.Context, request *tonpb.GetBlockDataRe return tonpb.NewBlock(block), nil } -func (s *Server) GetAccountBalance(ctx context.Context, request *tonpb.GetAccountBalanceRequest) (*tonpb.Balance, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) GetAccountBalance(ctx context.Context, request *tonpb.GetAccountBalanceRequest) (*tonpb.Balance, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -101,8 +108,8 @@ func (s *Server) GetAccountBalance(ctx context.Context, request *tonpb.GetAccoun return tonpb.NewBalance(balance), nil } -func (s *Server) SendTx(ctx context.Context, request *tonpb.SendTxRequest) (*emptypb.Empty, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) SendTx(ctx context.Context, request *tonpb.SendTxRequest) (*emptypb.Empty, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -116,8 +123,8 @@ func (s *Server) SendTx(ctx context.Context, request *tonpb.SendTxRequest) (*emp return &emptypb.Empty{}, nil } -func (s *Server) GetTxStatus(ctx context.Context, request *tonpb.GetTxStatusRequest) (*tonpb.GetTxStatusReply, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) GetTxStatus(ctx context.Context, request *tonpb.GetTxStatusRequest) (*tonpb.GetTxStatusReply, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -134,8 +141,8 @@ func (s *Server) GetTxStatus(ctx context.Context, request *tonpb.GetTxStatusRequ }, nil } -func (s *Server) GetTxExecutionFees(ctx context.Context, request *tonpb.GetTxExecutionFeesRequest) (*tonpb.GetTxExecutionFeesReply, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) GetTxExecutionFees(ctx context.Context, request *tonpb.GetTxExecutionFeesRequest) (*tonpb.GetTxExecutionFeesReply, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -151,25 +158,22 @@ func (s *Server) GetTxExecutionFees(ctx context.Context, request *tonpb.GetTxExe }, nil } -func (s *Server) HasFilter(ctx context.Context, request *tonpb.HasFilterRequest) (*tonpb.HasFilterReply, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) HasFilter(ctx context.Context, request *tonpb.HasFilterRequest) (*tonpb.HasFilterReply, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } name := request.GetName() exists := tonService.HasFilter(ctx, name) - if err != nil { - return nil, err - } return &tonpb.HasFilterReply{ Exists: exists, }, nil } -func (s *Server) RegisterFilter(ctx context.Context, request *tonpb.RegisterFilterRequest) (*emptypb.Empty, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) RegisterFilter(ctx context.Context, request *tonpb.RegisterFilterRequest) (*emptypb.Empty, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } @@ -183,8 +187,8 @@ func (s *Server) RegisterFilter(ctx context.Context, request *tonpb.RegisterFilt return &emptypb.Empty{}, nil } -func (s *Server) UnregisterFilter(ctx context.Context, request *tonpb.UnregisterFilterRequest) (*emptypb.Empty, error) { - tonService, err := s.getTONService(ctx) +func (ts *tonServer) UnregisterFilter(ctx context.Context, request *tonpb.UnregisterFilterRequest) (*emptypb.Empty, error) { + tonService, err := ts.parent.getTONService(ctx) if err != nil { return nil, err } diff --git a/pkg/loop/internal/types/types.go b/pkg/loop/internal/types/types.go index 0ffb588c8c..078f5eae26 100644 --- a/pkg/loop/internal/types/types.go +++ b/pkg/loop/internal/types/types.go @@ -48,6 +48,7 @@ type Relayer interface { EVM() (types.EVMService, error) TON() (types.TONService, error) + Solana() (types.SolanaService, error) // NewContractWriter returns a new ContractWriter. // The format of config depends on the implementation. NewContractWriter(ctx context.Context, contractWriterConfig []byte) (types.ContractWriter, error) diff --git a/pkg/loop/mocks/relayer.go b/pkg/loop/mocks/relayer.go index 7f0d29d563..9bf27f1901 100644 --- a/pkg/loop/mocks/relayer.go +++ b/pkg/loop/mocks/relayer.go @@ -909,6 +909,63 @@ func (_c *Relayer_Replay_Call) RunAndReturn(run func(context.Context, string, ma return _c } +// Solana provides a mock function with no fields +func (_m *Relayer) Solana() (types.SolanaService, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Solana") + } + + var r0 types.SolanaService + var r1 error + if rf, ok := ret.Get(0).(func() (types.SolanaService, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() types.SolanaService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.SolanaService) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Relayer_Solana_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Solana' +type Relayer_Solana_Call struct { + *mock.Call +} + +// Solana is a helper method to define mock.On call +func (_e *Relayer_Expecter) Solana() *Relayer_Solana_Call { + return &Relayer_Solana_Call{Call: _e.mock.On("Solana")} +} + +func (_c *Relayer_Solana_Call) Run(run func()) *Relayer_Solana_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Relayer_Solana_Call) Return(_a0 types.SolanaService, _a1 error) *Relayer_Solana_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Relayer_Solana_Call) RunAndReturn(run func() (types.SolanaService, error)) *Relayer_Solana_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *Relayer) Start(_a0 context.Context) error { ret := _m.Called(_a0) diff --git a/pkg/loop/relayer_service.go b/pkg/loop/relayer_service.go index 07edd5dc7c..76ab5ed741 100644 --- a/pkg/loop/relayer_service.go +++ b/pkg/loop/relayer_service.go @@ -56,6 +56,13 @@ func (r *RelayerService) TON() (types.TONService, error) { return r.Service.TON() } +func (r *RelayerService) Solana() (types.SolanaService, error) { + if err := r.Wait(); err != nil { + return nil, err + } + return r.Service.Solana() +} + func (r *RelayerService) NewContractReader(ctx context.Context, contractReaderConfig []byte) (types.ContractReader, error) { if err := r.WaitCtx(ctx); err != nil { return nil, err diff --git a/pkg/types/chains/solana/lp_types.go b/pkg/types/chains/solana/lp_types.go new file mode 100644 index 0000000000..19c5b597cc --- /dev/null +++ b/pkg/types/chains/solana/lp_types.go @@ -0,0 +1,47 @@ +package solana + +import "time" + +const EventSignatureLength = 8 + +type EventSignature [EventSignatureLength]byte + +// matches solana lp-types IndexedValue +type IndexedValue []byte + +type SubKeyPaths [][]string + +// matches cache-filter +// this filter defines what logs should be cached +// cached logs can be retrieved with [types.SolanaService.QueryTrackedLogs] +type LPFilterQuery struct { + Name string + Address PublicKey + EventName string + EventSig EventSignature + StartingBlock int64 + EventIdlJSON []byte + SubkeyPaths SubKeyPaths + Retention time.Duration + MaxLogsKept int64 + IncludeReverted bool +} + +// matches lp-parsed solana logs +type Log struct { + ChainID string + LogIndex int64 + BlockHash Hash + BlockNumber int64 + BlockTimestamp uint64 + Address PublicKey + EventSig EventSignature + TxHash Signature + Data []byte + SequenceNum int64 + Error *string +} + +type LPBlock struct { + Slot uint64 +} diff --git a/pkg/types/chains/solana/solana.go b/pkg/types/chains/solana/solana.go index fd7b795a96..c350a6ff86 100644 --- a/pkg/types/chains/solana/solana.go +++ b/pkg/types/chains/solana/solana.go @@ -1,14 +1,560 @@ package solana +import ( + "context" + "math/big" +) + const ( PublicKeyLength = 32 + HashLength = PublicKeyLength + SignatureLength = 64 ) -// represents solana-style AccountsMeta +// represents solana-go PublicKey +type PublicKey [PublicKeyLength]byte + +// represents solana-go PublicKeySlice +type PublicKeySlice []PublicKey + +// represents solana-go Signature +type Signature [SignatureLength]byte + +// represents solana-go Hash +type Hash PublicKey + +// represents solana-go AccountsMeta type AccountMeta struct { - PublicKey [PublicKeyLength]byte + PublicKey PublicKey IsWritable bool IsSigner bool } +// represents solana-go AccountMetaSlice type AccountMetaSlice []*AccountMeta + +// represents solana-go EncodingType +type EncodingType string + +const ( + EncodingBase58 EncodingType = "base58" // limited to Account data of less than 129 bytes + EncodingBase64 EncodingType = "base64" // will return base64 encoded data for Account data of any size + EncodingBase64Zstd EncodingType = "base64+zstd" // compresses the Account data using Zstandard and base64-encodes the result + + // attempts to use program-specific state parsers to + // return more human-readable and explicit account state data. + // If "jsonParsed" is requested but a parser cannot be found, + // the field falls back to "base64" encoding, detectable when the data field is type . + // Cannot be used if specifying dataSlice parameters (offset, length). + EncodingJSONParsed EncodingType = "jsonParsed" + + EncodingJSON EncodingType = "json" // NOTE: you're probably looking for EncodingJSONParsed +) + +// represents solana-go CommitmentType +type CommitmentType string + +const ( + // The node will query the most recent block confirmed by supermajority + // of the cluster as having reached maximum lockout, + // meaning the cluster has recognized this block as finalized. + CommitmentFinalized CommitmentType = "finalized" + + // The node will query the most recent block that has been voted on by supermajority of the cluster. + // - It incorporates votes from gossip and replay. + // - It does not count votes on descendants of a block, only direct votes on that block. + // - This confirmation level also upholds "optimistic confirmation" guarantees in release 1.3 and onwards. + CommitmentConfirmed CommitmentType = "confirmed" + + // The node will query its most recent block. Note that the block may still be skipped by the cluster. + CommitmentProcessed CommitmentType = "processed" +) + +// Client wraps Solana RPC via type/chains/solana types. +type Client interface { + // GetBalance: lamports for account at commitment. + // In: ctx, {Addr, Commitment}. Out: {Value}, error. + GetBalance(ctx context.Context, req GetBalanceRequest) (*GetBalanceReply, error) + + // GetAccountInfoWithOpts: account state + metadata. + // In: ctx, {Account, Opts(Encoding, Commitment, DataSlice, MinContextSlot)}. + // Out: {Context.Slot, Value(*Account|nil)}, error. + GetAccountInfoWithOpts(ctx context.Context, req GetAccountInfoRequest) (*GetAccountInfoReply, error) + + // GetMultipleAccountsWithOpts: batch account fetch. + // In: ctx, {Accounts, Opts}. Out: {Context.Slot, Value([]*Account)}, error. + GetMultipleAccountsWithOpts(ctx context.Context, req GetMultipleAccountsRequest) (*GetMultipleAccountsReply, error) + + // GetBlock: block by slot with optional tx details. + // In: ctx, {Slot, Opts(Encoding, TxDetails, Rewards, Commitment, MaxTxVersion)}. + // Out: block fields + Transactions/Signatures, error. + GetBlock(ctx context.Context, req GetBlockRequest) (*GetBlockReply, error) + + // GetSlotHeight: current height at commitment. + // In: ctx, {Commitment}. Out: {Height}, error. + GetSlotHeight(ctx context.Context, req GetSlotHeightRequest) (*GetSlotHeightReply, error) + + // GetTransaction: tx by signature with meta. + // In: ctx, {Signature}. Out: {Slot, BlockTime, Version, Transaction, Meta}, error. + GetTransaction(ctx context.Context, req GetTransactionRequest) (*GetTransactionReply, error) + + // GetFeeForMessage: fee estimate for base58 message. + // In: ctx, {Message, Commitment}. Out: {Fee}, error. + GetFeeForMessage(ctx context.Context, req GetFeeForMessageRequest) (*GetFeeForMessageReply, error) + + // GetSignatureStatuses: confirmation status for sigs. + // In: ctx, {Sigs}. Out: {Results[Slot, Confirmations, Err, Status]}, error. + GetSignatureStatuses(ctx context.Context, req GetSignatureStatusesRequest) (*GetSignatureStatusesReply, error) + + // SimulateTX: dry-run a transaction. + // In: ctx, {Receiver, EncodedTransaction, Opts(SigVerify, Commitment, ReplaceRecentBlockhash, Accounts)}. + // Out: {Err, Logs, Accounts, UnitsConsumed}, error. + SimulateTX(ctx context.Context, req SimulateTXRequest) (*SimulateTXReply, error) +} + +// represents solana-go DataSlice +type DataSlice struct { + Offset *uint64 + Length *uint64 +} + +// represents solana-go GetAccountInfoOpts +type GetAccountInfoOpts struct { + // Encoding for Account data. + // Either "base58" (slow), "base64", "base64+zstd", or "jsonParsed". + // - "base58" is limited to Account data of less than 129 bytes. + // - "base64" will return base64 encoded data for Account data of any size. + // - "base64+zstd" compresses the Account data using Zstandard and base64-encodes the result. + // - "jsonParsed" encoding attempts to use program-specific state parsers to return more + // human-readable and explicit account state data. If "jsonParsed" is requested but a parser + // cannot be found, the field falls back to "base64" encoding, + // detectable when the data field is type . + // + // This parameter is optional. + Encoding EncodingType + + // Commitment requirement. + // + // This parameter is optional. Default value is Finalized + Commitment CommitmentType + + // dataSlice parameters for limiting returned account data: + // Limits the returned account data using the provided offset and length fields; + // only available for "base58", "base64" or "base64+zstd" encodings. + // + // This parameter is optional. + DataSlice *DataSlice + + // The minimum slot that the request can be evaluated at. + // This parameter is optional. + MinContextSlot *uint64 +} + +// represents solana-go RPCContext +type RPCContext struct { + Slot uint64 +} + +// represents solana-go Account +type Account struct { + // Number of lamports assigned to this account + Lamports uint64 + + // Pubkey of the program this account has been assigned to + Owner PublicKey + + // Data associated with the account, either as encoded binary data or JSON format {: }, depending on encoding parameter + Data *DataBytesOrJSON + + // Boolean indicating if the account contains a program (and is strictly read-only) + Executable bool + + // The epoch at which this account will next owe rent + RentEpoch *big.Int + + // The amount of storage space required to store the token account + Space uint64 +} + +// represents solana-go TransactionDetailsType +type TransactionDetailsType string + +const ( + TransactionDetailsFull TransactionDetailsType = "full" + TransactionDetailsSignatures TransactionDetailsType = "signatures" + TransactionDetailsNone TransactionDetailsType = "none" + TransactionDetailsAccounts TransactionDetailsType = "accounts" +) + +type TransactionVersion int + +const ( + LegacyTransactionVersion TransactionVersion = -1 + legacyVersion = `"legacy"` +) + +type ConfirmationStatusType string + +const ( + ConfirmationStatusProcessed ConfirmationStatusType = "processed" + ConfirmationStatusConfirmed ConfirmationStatusType = "confirmed" + ConfirmationStatusFinalized ConfirmationStatusType = "finalized" +) + +type UiTokenAmount struct { + // Raw amount of tokens as a string, ignoring decimals. + Amount string + + // Number of decimals configured for token's mint. + Decimals uint8 + + // Token amount as a string, accounting for decimals. + UiAmountString string +} + +type TokenBalance struct { + // Index of the account in which the token balance is provided for. + AccountIndex uint16 + + // Pubkey of token balance's owner. + Owner *PublicKey + // Pubkey of token program. + ProgramId *PublicKey + + // Pubkey of the token's mint. + Mint PublicKey + UiTokenAmount *UiTokenAmount +} + +type LoadedAddresses struct { + ReadOnly PublicKeySlice + Writable PublicKeySlice +} + +type Data struct { + Content []byte + Encoding EncodingType +} + +type ReturnData struct { + ProgramId PublicKey + Data Data +} + +type TransactionMeta struct { + // Error if transaction failed, empty if transaction succeeded. + Err string + // Fee this transaction was charged + Fee uint64 + + // Array of u64 account balances from before the transaction was processed + PreBalances []uint64 + + // Array of u64 account balances after the transaction was processed + PostBalances []uint64 + + // List of inner instructions or omitted if inner instruction recording + // was not yet enabled during this transaction + InnerInstructions []InnerInstruction + + // List of token balances from before the transaction was processed + // or omitted if token balance recording was not yet enabled during this transaction + PreTokenBalances []TokenBalance + + // List of token balances from after the transaction was processed + // or omitted if token balance recording was not yet enabled during this transaction + PostTokenBalances []TokenBalance + + // Array of string log messages or omitted if log message + // recording was not yet enabled during this transaction + LogMessages []string + + LoadedAddresses LoadedAddresses + + // Data returned by transaction (if any + ReturnData ReturnData + + // Total compute units consumed by transaction execution + ComputeUnitsConsumed *uint64 +} + +type InnerInstruction struct { + Index uint16 + + // Ordered list of inner program instructions that were invoked during a single transaction instruction. + Instructions []CompiledInstruction +} + +type CompiledInstruction struct { + // Index into the message.accountKeys array indicating the program account that executes this instruction. + ProgramIDIndex uint16 + + // List of ordered indices into the message.accountKeys array indicating which accounts to pass to the program. + Accounts []uint16 + + // The program input data encoded in a base-58 string. + Data []byte + + StackHeight uint16 +} + +// represents solana-go GetBlockOpts +type GetBlockOpts struct { + // "processed" is not supported. + // If parameter not provided, the default is "finalized". + // + // This parameter is optional. + Commitment CommitmentType +} + +var ( + MaxSupportedTransactionVersion0 uint64 = 0 + MaxSupportedTransactionVersion1 uint64 = 1 +) + +// UnixTimeSeconds represents a UNIX second-resolution timestamp. +type UnixTimeSeconds int64 + +type GetMultipleAccountsOpts GetAccountInfoOpts + +type SimulateTransactionAccountsOpts struct { + // (optional) Encoding for returned Account data, + // either "base64" (default), "base64+zstd" or "jsonParsed". + // - "jsonParsed" encoding attempts to use program-specific state parsers + // to return more human-readable and explicit account state data. + // If "jsonParsed" is requested but a parser cannot be found, + // the field falls back to binary encoding, detectable when + // the data field is type . + Encoding EncodingType + + // An array of accounts to return. + Addresses []PublicKey +} + +type SimulateTXOpts struct { + // If true the transaction signatures will be verified + // (default: false, conflicts with ReplaceRecentBlockhash) + SigVerify bool + + // Commitment level to simulate the transaction at. + // (default: "finalized"). + Commitment CommitmentType + + // If true the transaction recent blockhash will be replaced with the most recent blockhash. + // (default: false, conflicts with SigVerify) + ReplaceRecentBlockhash bool + + Accounts *SimulateTransactionAccountsOpts +} + +type GetAccountInfoRequest struct { + Account PublicKey + Opts *GetAccountInfoOpts +} + +type GetAccountInfoReply struct { + RPCContext + Value *Account +} + +type GetMultipleAccountsRequest struct { + Accounts []PublicKey + Opts *GetMultipleAccountsOpts +} + +type GetMultipleAccountsReply struct { + RPCContext + Value []*Account +} + +type GetBalanceRequest struct { + Addr PublicKey + Commitment CommitmentType +} + +type GetBalanceReply struct { + // Balance in lamports + Value uint64 +} + +type GetBlockRequest struct { + Slot uint64 + Opts *GetBlockOpts +} + +// Will contain a AsJSON if the requested encoding is `solana.EncodingJSON` +// (which is also the default when the encoding is not specified), +// or a `AsDecodedBinary` in case of EncodingBase58, EncodingBase64. +type DataBytesOrJSON struct { + RawDataEncoding EncodingType + AsDecodedBinary []byte + AsJSON []byte +} + +type GetBlockReply struct { + // The blockhash of this block. + Blockhash Hash + + // The blockhash of this block's parent; + // if the parent block is not available due to ledger cleanup, + // this field will return "11111111111111111111111111111111". + PreviousBlockhash Hash + + // The slot index of this block's parent. + ParentSlot uint64 + + // Estimated production time, as Unix timestamp (seconds since the Unix epoch). + // Nil if not available. + BlockTime *UnixTimeSeconds + + // The number of blocks beneath this block. + BlockHeight *uint64 +} + +type GetSlotHeightRequest struct { + Commitment CommitmentType +} + +type GetSlotHeightReply struct { + Height uint64 +} + +type MessageHeader struct { + // The total number of signatures required to make the transaction valid. + // The signatures must match the first `numRequiredSignatures` of `message.account_keys`. + NumRequiredSignatures uint8 + + // The last numReadonlySignedAccounts of the signed keys are read-only accounts. + // Programs may process multiple transactions that load read-only accounts within + // a single PoH entry, but are not permitted to credit or debit lamports or modify + // account data. + // Transactions targeting the same read-write account are evaluated sequentially. + NumReadonlySignedAccounts uint8 + + // The last `numReadonlyUnsignedAccounts` of the unsigned keys are read-only accounts. + NumReadonlyUnsignedAccounts uint8 +} + +type MessageAddressTableLookupSlice []MessageAddressTableLookup + +type MessageAddressTableLookup struct { + AccountKey PublicKey // The account key of the address table. + WritableIndexes []uint8 + ReadonlyIndexes []uint8 +} + +type Message struct { + // List of base-58 encoded public keys used by the transaction, + // including by the instructions and for signatures. + // The first `message.header.numRequiredSignatures` public keys must sign the transaction. + AccountKeys PublicKeySlice + + // Details the account types and signatures required by the transaction. + Header MessageHeader + + // A base-58 encoded hash of a recent block in the ledger used to + // prevent transaction duplication and to give transactions lifetimes. + RecentBlockhash Hash + + // List of program instructions that will be executed in sequence + // and committed in one atomic transaction if all succeed. + Instructions []CompiledInstruction + + // List of address table lookups used to load additional accounts for this transaction. + AddressTableLookups MessageAddressTableLookupSlice +} + +type Transaction struct { + Signatures []Signature + Message Message +} + +type TransactionResultEnvelope struct { + AsParsedTransaction *Transaction + AsDecodedBinary Data +} + +// arguments for solana-rpc GetTransaction call +type GetTransactionRequest struct { + Signature Signature +} + +// result of solana-rpc GetTransaction call +type GetTransactionReply struct { + Slot uint64 + + BlockTime *UnixTimeSeconds + + Version TransactionVersion + + Transaction *TransactionResultEnvelope + + Meta *TransactionMeta +} + +type GetFeeForMessageRequest struct { + // base58 encoded message + Message string + Commitment CommitmentType +} + +type GetFeeForMessageReply struct { + // The amount in lamports the network will charge for a particular message + Fee uint64 +} + +type GetLatestBlockhashRequest struct { + Commitment CommitmentType +} + +type GetLatestBlockhashReply struct { + RPCContext + Hash Hash + LastValidBlockHeight uint64 +} + +type SimulateTXRequest struct { + Receiver PublicKey + // Encoded + EncodedTransaction string + Opts *SimulateTXOpts +} + +type SimulateTXReply struct { + // Error if transaction failed, empty if transaction succeeded. + Err string + + // Array of log messages the transaction instructions output during execution, + // null if simulation failed before the transaction was able to execute + // (for example due to an invalid blockhash or signature verification failure) + Logs []string + + // Array of accounts with the same length as the accounts.addresses array in the request. + Accounts []*Account + + // The number of compute budget units consumed during the processing of this transaction. + UnitsConsumed *uint64 +} + +type GetSignatureStatusesRequest struct { + Sigs []Signature +} + +type GetSignatureStatusesResult struct { + // The slot the transaction was processed. + Slot uint64 + + // Number of blocks since signature confirmation, + // null if rooted or finalized by a supermajority of the cluster. + Confirmations *uint64 + + // Error if transaction failed, empty if transaction succeeded. + Err string + + // The transaction's cluster confirmation status; either processed, confirmed, or finalized. + ConfirmationStatus ConfirmationStatusType +} + +type GetSignatureStatusesReply struct { + Results []GetSignatureStatusesResult +} diff --git a/pkg/types/chains/solana/txm_types.go b/pkg/types/chains/solana/txm_types.go new file mode 100644 index 0000000000..d7f4004e76 --- /dev/null +++ b/pkg/types/chains/solana/txm_types.go @@ -0,0 +1,32 @@ +package solana + +type SubmitTransactionRequest struct { + Cfg *ComputeConfig + Receiver PublicKey + EncodedTransaction string // base64 encoded transaction +} + +// TransactionStatus is the result of the transaction sent to the chain +type TransactionStatus int + +const ( + // Transaction processing failed due to a network issue, RPC issue, or other fatal error + TxFatal TransactionStatus = iota + // Transaction was sent successfully to the chain but the program execution was aborted + TxAborted + // Transaction was sent successfully to the chain, program was succesfully executed and mined into a block. + TxSuccess +) + +type ComputeConfig struct { + // Default to nil. If not specified the value configured in GasEstimator will be used + ComputeLimit *uint32 + // Default to nil. If not specified the value configured in GasEstimator will be used + ComputeMaxPrice *uint64 +} + +type SubmitTransactionReply struct { + Signature Signature + IdempotencyKey string + Status TransactionStatus +} diff --git a/pkg/types/core/mocks/relayer.go b/pkg/types/core/mocks/relayer.go index 3ee0982c0a..3e077a6c16 100644 --- a/pkg/types/core/mocks/relayer.go +++ b/pkg/types/core/mocks/relayer.go @@ -553,6 +553,63 @@ func (_c *Relayer_Ready_Call) RunAndReturn(run func() error) *Relayer_Ready_Call return _c } +// Solana provides a mock function with no fields +func (_m *Relayer) Solana() (types.SolanaService, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Solana") + } + + var r0 types.SolanaService + var r1 error + if rf, ok := ret.Get(0).(func() (types.SolanaService, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() types.SolanaService); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(types.SolanaService) + } + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// Relayer_Solana_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Solana' +type Relayer_Solana_Call struct { + *mock.Call +} + +// Solana is a helper method to define mock.On call +func (_e *Relayer_Expecter) Solana() *Relayer_Solana_Call { + return &Relayer_Solana_Call{Call: _e.mock.On("Solana")} +} + +func (_c *Relayer_Solana_Call) Run(run func()) *Relayer_Solana_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *Relayer_Solana_Call) Return(_a0 types.SolanaService, _a1 error) *Relayer_Solana_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *Relayer_Solana_Call) RunAndReturn(run func() (types.SolanaService, error)) *Relayer_Solana_Call { + _c.Call.Return(run) + return _c +} + // Start provides a mock function with given fields: _a0 func (_m *Relayer) Start(_a0 context.Context) error { ret := _m.Called(_a0) diff --git a/pkg/types/core/relayerset.go b/pkg/types/core/relayerset.go index 0f2b81fdc4..e1357b8bb2 100644 --- a/pkg/types/core/relayerset.go +++ b/pkg/types/core/relayerset.go @@ -33,6 +33,8 @@ type Relayer interface { EVM() (types.EVMService, error) // TON returns TONService that provides access to TON specific functionalities TON() (types.TONService, error) + // Solana returns SolanaService that provides access to Solana specific functionalities + Solana() (types.SolanaService, error) NewPluginProvider(context.Context, RelayArgs, PluginArgs) (PluginProvider, error) NewContractReader(_ context.Context, contractReaderConfig []byte) (types.ContractReader, error) NewContractWriter(_ context.Context, contractWriterConfig []byte) (types.ContractWriter, error) diff --git a/pkg/types/mocks/solana_service.go b/pkg/types/mocks/solana_service.go new file mode 100644 index 0000000000..5ece5720f4 --- /dev/null +++ b/pkg/types/mocks/solana_service.go @@ -0,0 +1,841 @@ +// Code generated by mockery v2.53.3. DO NOT EDIT. + +package mocks + +import ( + context "context" + + query "github.com/smartcontractkit/chainlink-common/pkg/types/query" + mock "github.com/stretchr/testify/mock" + + solana "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" +) + +// SolanaService is an autogenerated mock type for the SolanaService type +type SolanaService struct { + mock.Mock +} + +type SolanaService_Expecter struct { + mock *mock.Mock +} + +func (_m *SolanaService) EXPECT() *SolanaService_Expecter { + return &SolanaService_Expecter{mock: &_m.Mock} +} + +// GetAccountInfoWithOpts provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetAccountInfoWithOpts(ctx context.Context, req solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetAccountInfoWithOpts") + } + + var r0 *solana.GetAccountInfoReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetAccountInfoRequest) *solana.GetAccountInfoReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetAccountInfoReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetAccountInfoRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetAccountInfoWithOpts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAccountInfoWithOpts' +type SolanaService_GetAccountInfoWithOpts_Call struct { + *mock.Call +} + +// GetAccountInfoWithOpts is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetAccountInfoRequest +func (_e *SolanaService_Expecter) GetAccountInfoWithOpts(ctx interface{}, req interface{}) *SolanaService_GetAccountInfoWithOpts_Call { + return &SolanaService_GetAccountInfoWithOpts_Call{Call: _e.mock.On("GetAccountInfoWithOpts", ctx, req)} +} + +func (_c *SolanaService_GetAccountInfoWithOpts_Call) Run(run func(ctx context.Context, req solana.GetAccountInfoRequest)) *SolanaService_GetAccountInfoWithOpts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetAccountInfoRequest)) + }) + return _c +} + +func (_c *SolanaService_GetAccountInfoWithOpts_Call) Return(_a0 *solana.GetAccountInfoReply, _a1 error) *SolanaService_GetAccountInfoWithOpts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetAccountInfoWithOpts_Call) RunAndReturn(run func(context.Context, solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error)) *SolanaService_GetAccountInfoWithOpts_Call { + _c.Call.Return(run) + return _c +} + +// GetBalance provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetBalance(ctx context.Context, req solana.GetBalanceRequest) (*solana.GetBalanceReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + + var r0 *solana.GetBalanceReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetBalanceRequest) (*solana.GetBalanceReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetBalanceRequest) *solana.GetBalanceReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetBalanceReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetBalanceRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetBalance_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBalance' +type SolanaService_GetBalance_Call struct { + *mock.Call +} + +// GetBalance is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetBalanceRequest +func (_e *SolanaService_Expecter) GetBalance(ctx interface{}, req interface{}) *SolanaService_GetBalance_Call { + return &SolanaService_GetBalance_Call{Call: _e.mock.On("GetBalance", ctx, req)} +} + +func (_c *SolanaService_GetBalance_Call) Run(run func(ctx context.Context, req solana.GetBalanceRequest)) *SolanaService_GetBalance_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetBalanceRequest)) + }) + return _c +} + +func (_c *SolanaService_GetBalance_Call) Return(_a0 *solana.GetBalanceReply, _a1 error) *SolanaService_GetBalance_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetBalance_Call) RunAndReturn(run func(context.Context, solana.GetBalanceRequest) (*solana.GetBalanceReply, error)) *SolanaService_GetBalance_Call { + _c.Call.Return(run) + return _c +} + +// GetBlock provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetBlock(ctx context.Context, req solana.GetBlockRequest) (*solana.GetBlockReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetBlock") + } + + var r0 *solana.GetBlockReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetBlockRequest) (*solana.GetBlockReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetBlockRequest) *solana.GetBlockReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetBlockReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetBlockRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBlock' +type SolanaService_GetBlock_Call struct { + *mock.Call +} + +// GetBlock is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetBlockRequest +func (_e *SolanaService_Expecter) GetBlock(ctx interface{}, req interface{}) *SolanaService_GetBlock_Call { + return &SolanaService_GetBlock_Call{Call: _e.mock.On("GetBlock", ctx, req)} +} + +func (_c *SolanaService_GetBlock_Call) Run(run func(ctx context.Context, req solana.GetBlockRequest)) *SolanaService_GetBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetBlockRequest)) + }) + return _c +} + +func (_c *SolanaService_GetBlock_Call) Return(_a0 *solana.GetBlockReply, _a1 error) *SolanaService_GetBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetBlock_Call) RunAndReturn(run func(context.Context, solana.GetBlockRequest) (*solana.GetBlockReply, error)) *SolanaService_GetBlock_Call { + _c.Call.Return(run) + return _c +} + +// GetFeeForMessage provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetFeeForMessage(ctx context.Context, req solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetFeeForMessage") + } + + var r0 *solana.GetFeeForMessageReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetFeeForMessageRequest) *solana.GetFeeForMessageReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetFeeForMessageReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetFeeForMessageRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetFeeForMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFeeForMessage' +type SolanaService_GetFeeForMessage_Call struct { + *mock.Call +} + +// GetFeeForMessage is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetFeeForMessageRequest +func (_e *SolanaService_Expecter) GetFeeForMessage(ctx interface{}, req interface{}) *SolanaService_GetFeeForMessage_Call { + return &SolanaService_GetFeeForMessage_Call{Call: _e.mock.On("GetFeeForMessage", ctx, req)} +} + +func (_c *SolanaService_GetFeeForMessage_Call) Run(run func(ctx context.Context, req solana.GetFeeForMessageRequest)) *SolanaService_GetFeeForMessage_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetFeeForMessageRequest)) + }) + return _c +} + +func (_c *SolanaService_GetFeeForMessage_Call) Return(_a0 *solana.GetFeeForMessageReply, _a1 error) *SolanaService_GetFeeForMessage_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetFeeForMessage_Call) RunAndReturn(run func(context.Context, solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error)) *SolanaService_GetFeeForMessage_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestLPBlock provides a mock function with given fields: ctx +func (_m *SolanaService) GetLatestLPBlock(ctx context.Context) (*solana.LPBlock, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetLatestLPBlock") + } + + var r0 *solana.LPBlock + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*solana.LPBlock, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *solana.LPBlock); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.LPBlock) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetLatestLPBlock_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestLPBlock' +type SolanaService_GetLatestLPBlock_Call struct { + *mock.Call +} + +// GetLatestLPBlock is a helper method to define mock.On call +// - ctx context.Context +func (_e *SolanaService_Expecter) GetLatestLPBlock(ctx interface{}) *SolanaService_GetLatestLPBlock_Call { + return &SolanaService_GetLatestLPBlock_Call{Call: _e.mock.On("GetLatestLPBlock", ctx)} +} + +func (_c *SolanaService_GetLatestLPBlock_Call) Run(run func(ctx context.Context)) *SolanaService_GetLatestLPBlock_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SolanaService_GetLatestLPBlock_Call) Return(_a0 *solana.LPBlock, _a1 error) *SolanaService_GetLatestLPBlock_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetLatestLPBlock_Call) RunAndReturn(run func(context.Context) (*solana.LPBlock, error)) *SolanaService_GetLatestLPBlock_Call { + _c.Call.Return(run) + return _c +} + +// GetMultipleAccountsWithOpts provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetMultipleAccountsWithOpts(ctx context.Context, req solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetMultipleAccountsWithOpts") + } + + var r0 *solana.GetMultipleAccountsReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetMultipleAccountsRequest) *solana.GetMultipleAccountsReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetMultipleAccountsReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetMultipleAccountsRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetMultipleAccountsWithOpts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMultipleAccountsWithOpts' +type SolanaService_GetMultipleAccountsWithOpts_Call struct { + *mock.Call +} + +// GetMultipleAccountsWithOpts is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetMultipleAccountsRequest +func (_e *SolanaService_Expecter) GetMultipleAccountsWithOpts(ctx interface{}, req interface{}) *SolanaService_GetMultipleAccountsWithOpts_Call { + return &SolanaService_GetMultipleAccountsWithOpts_Call{Call: _e.mock.On("GetMultipleAccountsWithOpts", ctx, req)} +} + +func (_c *SolanaService_GetMultipleAccountsWithOpts_Call) Run(run func(ctx context.Context, req solana.GetMultipleAccountsRequest)) *SolanaService_GetMultipleAccountsWithOpts_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetMultipleAccountsRequest)) + }) + return _c +} + +func (_c *SolanaService_GetMultipleAccountsWithOpts_Call) Return(_a0 *solana.GetMultipleAccountsReply, _a1 error) *SolanaService_GetMultipleAccountsWithOpts_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetMultipleAccountsWithOpts_Call) RunAndReturn(run func(context.Context, solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error)) *SolanaService_GetMultipleAccountsWithOpts_Call { + _c.Call.Return(run) + return _c +} + +// GetSignatureStatuses provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetSignatureStatuses(ctx context.Context, req solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetSignatureStatuses") + } + + var r0 *solana.GetSignatureStatusesReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetSignatureStatusesRequest) *solana.GetSignatureStatusesReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetSignatureStatusesReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetSignatureStatusesRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetSignatureStatuses_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSignatureStatuses' +type SolanaService_GetSignatureStatuses_Call struct { + *mock.Call +} + +// GetSignatureStatuses is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetSignatureStatusesRequest +func (_e *SolanaService_Expecter) GetSignatureStatuses(ctx interface{}, req interface{}) *SolanaService_GetSignatureStatuses_Call { + return &SolanaService_GetSignatureStatuses_Call{Call: _e.mock.On("GetSignatureStatuses", ctx, req)} +} + +func (_c *SolanaService_GetSignatureStatuses_Call) Run(run func(ctx context.Context, req solana.GetSignatureStatusesRequest)) *SolanaService_GetSignatureStatuses_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetSignatureStatusesRequest)) + }) + return _c +} + +func (_c *SolanaService_GetSignatureStatuses_Call) Return(_a0 *solana.GetSignatureStatusesReply, _a1 error) *SolanaService_GetSignatureStatuses_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetSignatureStatuses_Call) RunAndReturn(run func(context.Context, solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error)) *SolanaService_GetSignatureStatuses_Call { + _c.Call.Return(run) + return _c +} + +// GetSlotHeight provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetSlotHeight(ctx context.Context, req solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetSlotHeight") + } + + var r0 *solana.GetSlotHeightReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetSlotHeightRequest) *solana.GetSlotHeightReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetSlotHeightReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetSlotHeightRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetSlotHeight_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSlotHeight' +type SolanaService_GetSlotHeight_Call struct { + *mock.Call +} + +// GetSlotHeight is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetSlotHeightRequest +func (_e *SolanaService_Expecter) GetSlotHeight(ctx interface{}, req interface{}) *SolanaService_GetSlotHeight_Call { + return &SolanaService_GetSlotHeight_Call{Call: _e.mock.On("GetSlotHeight", ctx, req)} +} + +func (_c *SolanaService_GetSlotHeight_Call) Run(run func(ctx context.Context, req solana.GetSlotHeightRequest)) *SolanaService_GetSlotHeight_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetSlotHeightRequest)) + }) + return _c +} + +func (_c *SolanaService_GetSlotHeight_Call) Return(_a0 *solana.GetSlotHeightReply, _a1 error) *SolanaService_GetSlotHeight_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetSlotHeight_Call) RunAndReturn(run func(context.Context, solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error)) *SolanaService_GetSlotHeight_Call { + _c.Call.Return(run) + return _c +} + +// GetTransaction provides a mock function with given fields: ctx, req +func (_m *SolanaService) GetTransaction(ctx context.Context, req solana.GetTransactionRequest) (*solana.GetTransactionReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for GetTransaction") + } + + var r0 *solana.GetTransactionReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.GetTransactionRequest) (*solana.GetTransactionReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.GetTransactionRequest) *solana.GetTransactionReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.GetTransactionReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.GetTransactionRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_GetTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransaction' +type SolanaService_GetTransaction_Call struct { + *mock.Call +} + +// GetTransaction is a helper method to define mock.On call +// - ctx context.Context +// - req solana.GetTransactionRequest +func (_e *SolanaService_Expecter) GetTransaction(ctx interface{}, req interface{}) *SolanaService_GetTransaction_Call { + return &SolanaService_GetTransaction_Call{Call: _e.mock.On("GetTransaction", ctx, req)} +} + +func (_c *SolanaService_GetTransaction_Call) Run(run func(ctx context.Context, req solana.GetTransactionRequest)) *SolanaService_GetTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.GetTransactionRequest)) + }) + return _c +} + +func (_c *SolanaService_GetTransaction_Call) Return(_a0 *solana.GetTransactionReply, _a1 error) *SolanaService_GetTransaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_GetTransaction_Call) RunAndReturn(run func(context.Context, solana.GetTransactionRequest) (*solana.GetTransactionReply, error)) *SolanaService_GetTransaction_Call { + _c.Call.Return(run) + return _c +} + +// QueryTrackedLogs provides a mock function with given fields: ctx, filterQuery, limitAndSort +func (_m *SolanaService) QueryTrackedLogs(ctx context.Context, filterQuery []query.Expression, limitAndSort query.LimitAndSort) ([]*solana.Log, error) { + ret := _m.Called(ctx, filterQuery, limitAndSort) + + if len(ret) == 0 { + panic("no return value specified for QueryTrackedLogs") + } + + var r0 []*solana.Log + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []query.Expression, query.LimitAndSort) ([]*solana.Log, error)); ok { + return rf(ctx, filterQuery, limitAndSort) + } + if rf, ok := ret.Get(0).(func(context.Context, []query.Expression, query.LimitAndSort) []*solana.Log); ok { + r0 = rf(ctx, filterQuery, limitAndSort) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*solana.Log) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, []query.Expression, query.LimitAndSort) error); ok { + r1 = rf(ctx, filterQuery, limitAndSort) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_QueryTrackedLogs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'QueryTrackedLogs' +type SolanaService_QueryTrackedLogs_Call struct { + *mock.Call +} + +// QueryTrackedLogs is a helper method to define mock.On call +// - ctx context.Context +// - filterQuery []query.Expression +// - limitAndSort query.LimitAndSort +func (_e *SolanaService_Expecter) QueryTrackedLogs(ctx interface{}, filterQuery interface{}, limitAndSort interface{}) *SolanaService_QueryTrackedLogs_Call { + return &SolanaService_QueryTrackedLogs_Call{Call: _e.mock.On("QueryTrackedLogs", ctx, filterQuery, limitAndSort)} +} + +func (_c *SolanaService_QueryTrackedLogs_Call) Run(run func(ctx context.Context, filterQuery []query.Expression, limitAndSort query.LimitAndSort)) *SolanaService_QueryTrackedLogs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]query.Expression), args[2].(query.LimitAndSort)) + }) + return _c +} + +func (_c *SolanaService_QueryTrackedLogs_Call) Return(_a0 []*solana.Log, _a1 error) *SolanaService_QueryTrackedLogs_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_QueryTrackedLogs_Call) RunAndReturn(run func(context.Context, []query.Expression, query.LimitAndSort) ([]*solana.Log, error)) *SolanaService_QueryTrackedLogs_Call { + _c.Call.Return(run) + return _c +} + +// RegisterLogTracking provides a mock function with given fields: ctx, req +func (_m *SolanaService) RegisterLogTracking(ctx context.Context, req solana.LPFilterQuery) error { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for RegisterLogTracking") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, solana.LPFilterQuery) error); ok { + r0 = rf(ctx, req) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SolanaService_RegisterLogTracking_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RegisterLogTracking' +type SolanaService_RegisterLogTracking_Call struct { + *mock.Call +} + +// RegisterLogTracking is a helper method to define mock.On call +// - ctx context.Context +// - req solana.LPFilterQuery +func (_e *SolanaService_Expecter) RegisterLogTracking(ctx interface{}, req interface{}) *SolanaService_RegisterLogTracking_Call { + return &SolanaService_RegisterLogTracking_Call{Call: _e.mock.On("RegisterLogTracking", ctx, req)} +} + +func (_c *SolanaService_RegisterLogTracking_Call) Run(run func(ctx context.Context, req solana.LPFilterQuery)) *SolanaService_RegisterLogTracking_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.LPFilterQuery)) + }) + return _c +} + +func (_c *SolanaService_RegisterLogTracking_Call) Return(_a0 error) *SolanaService_RegisterLogTracking_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SolanaService_RegisterLogTracking_Call) RunAndReturn(run func(context.Context, solana.LPFilterQuery) error) *SolanaService_RegisterLogTracking_Call { + _c.Call.Return(run) + return _c +} + +// SimulateTX provides a mock function with given fields: ctx, req +func (_m *SolanaService) SimulateTX(ctx context.Context, req solana.SimulateTXRequest) (*solana.SimulateTXReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for SimulateTX") + } + + var r0 *solana.SimulateTXReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.SimulateTXRequest) (*solana.SimulateTXReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.SimulateTXRequest) *solana.SimulateTXReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.SimulateTXReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.SimulateTXRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_SimulateTX_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SimulateTX' +type SolanaService_SimulateTX_Call struct { + *mock.Call +} + +// SimulateTX is a helper method to define mock.On call +// - ctx context.Context +// - req solana.SimulateTXRequest +func (_e *SolanaService_Expecter) SimulateTX(ctx interface{}, req interface{}) *SolanaService_SimulateTX_Call { + return &SolanaService_SimulateTX_Call{Call: _e.mock.On("SimulateTX", ctx, req)} +} + +func (_c *SolanaService_SimulateTX_Call) Run(run func(ctx context.Context, req solana.SimulateTXRequest)) *SolanaService_SimulateTX_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.SimulateTXRequest)) + }) + return _c +} + +func (_c *SolanaService_SimulateTX_Call) Return(_a0 *solana.SimulateTXReply, _a1 error) *SolanaService_SimulateTX_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_SimulateTX_Call) RunAndReturn(run func(context.Context, solana.SimulateTXRequest) (*solana.SimulateTXReply, error)) *SolanaService_SimulateTX_Call { + _c.Call.Return(run) + return _c +} + +// SubmitTransaction provides a mock function with given fields: ctx, req +func (_m *SolanaService) SubmitTransaction(ctx context.Context, req solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error) { + ret := _m.Called(ctx, req) + + if len(ret) == 0 { + panic("no return value specified for SubmitTransaction") + } + + var r0 *solana.SubmitTransactionReply + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error)); ok { + return rf(ctx, req) + } + if rf, ok := ret.Get(0).(func(context.Context, solana.SubmitTransactionRequest) *solana.SubmitTransactionReply); ok { + r0 = rf(ctx, req) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*solana.SubmitTransactionReply) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, solana.SubmitTransactionRequest) error); ok { + r1 = rf(ctx, req) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SolanaService_SubmitTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubmitTransaction' +type SolanaService_SubmitTransaction_Call struct { + *mock.Call +} + +// SubmitTransaction is a helper method to define mock.On call +// - ctx context.Context +// - req solana.SubmitTransactionRequest +func (_e *SolanaService_Expecter) SubmitTransaction(ctx interface{}, req interface{}) *SolanaService_SubmitTransaction_Call { + return &SolanaService_SubmitTransaction_Call{Call: _e.mock.On("SubmitTransaction", ctx, req)} +} + +func (_c *SolanaService_SubmitTransaction_Call) Run(run func(ctx context.Context, req solana.SubmitTransactionRequest)) *SolanaService_SubmitTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(solana.SubmitTransactionRequest)) + }) + return _c +} + +func (_c *SolanaService_SubmitTransaction_Call) Return(_a0 *solana.SubmitTransactionReply, _a1 error) *SolanaService_SubmitTransaction_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SolanaService_SubmitTransaction_Call) RunAndReturn(run func(context.Context, solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error)) *SolanaService_SubmitTransaction_Call { + _c.Call.Return(run) + return _c +} + +// UnregisterLogTracking provides a mock function with given fields: ctx, filterName +func (_m *SolanaService) UnregisterLogTracking(ctx context.Context, filterName string) error { + ret := _m.Called(ctx, filterName) + + if len(ret) == 0 { + panic("no return value specified for UnregisterLogTracking") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string) error); ok { + r0 = rf(ctx, filterName) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SolanaService_UnregisterLogTracking_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UnregisterLogTracking' +type SolanaService_UnregisterLogTracking_Call struct { + *mock.Call +} + +// UnregisterLogTracking is a helper method to define mock.On call +// - ctx context.Context +// - filterName string +func (_e *SolanaService_Expecter) UnregisterLogTracking(ctx interface{}, filterName interface{}) *SolanaService_UnregisterLogTracking_Call { + return &SolanaService_UnregisterLogTracking_Call{Call: _e.mock.On("UnregisterLogTracking", ctx, filterName)} +} + +func (_c *SolanaService_UnregisterLogTracking_Call) Run(run func(ctx context.Context, filterName string)) *SolanaService_UnregisterLogTracking_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *SolanaService_UnregisterLogTracking_Call) Return(_a0 error) *SolanaService_UnregisterLogTracking_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SolanaService_UnregisterLogTracking_Call) RunAndReturn(run func(context.Context, string) error) *SolanaService_UnregisterLogTracking_Call { + _c.Call.Return(run) + return _c +} + +// NewSolanaService creates a new instance of SolanaService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// The first argument is typically a *testing.T value. +func NewSolanaService(t interface { + mock.TestingT + Cleanup(func()) +}) *SolanaService { + mock := &SolanaService{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/types/query/primitives/solana/solana.go b/pkg/types/query/primitives/solana/solana.go new file mode 100644 index 0000000000..56141ba8a0 --- /dev/null +++ b/pkg/types/query/primitives/solana/solana.go @@ -0,0 +1,72 @@ +package solana + +import ( + "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" + "github.com/smartcontractkit/chainlink-common/pkg/types/query" + "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" +) + +type Visitor interface { + Address(primitive *Address) + EventSig(primitive *EventSig) + EventBySubkey(primitive *EventBySubkey) +} + +type Address struct { + PubKey solana.PublicKey +} + +func (a *Address) Accept(visitor primitives.Visitor) { + if v, ok := visitor.(Visitor); ok { + v.Address(a) + } +} + +func NewAddressFilter(address solana.PublicKey) query.Expression { + return query.Expression{ + Primitive: &Address{PubKey: address}, + } +} + +type EventSig struct { + Sig solana.EventSignature +} + +func (e *EventSig) Accept(visitor primitives.Visitor) { + if v, ok := visitor.(Visitor); ok { + v.EventSig(e) + } +} + +func NewEventSigFilter(e solana.EventSignature) query.Expression { + return query.Expression{ + Primitive: &EventSig{ + Sig: e, + }, + } +} + +type EventBySubkey struct { + SubKeyIndex uint64 + ValueComparers []IndexedValueComparator +} + +type IndexedValueComparator struct { + Value solana.IndexedValue + Operator primitives.ComparisonOperator +} + +func (esk *EventBySubkey) Accept(visitor primitives.Visitor) { + if v, ok := visitor.(Visitor); ok { + v.EventBySubkey(esk) + } +} + +func NewEventBySubkeyFilter(subkeyIndex uint64, comparers []IndexedValueComparator) query.Expression { + return query.Expression{ + Primitive: &EventBySubkey{ + SubKeyIndex: subkeyIndex, + ValueComparers: comparers, + }, + } +} diff --git a/pkg/types/relayer.go b/pkg/types/relayer.go index a487f529bd..f848834c8b 100644 --- a/pkg/types/relayer.go +++ b/pkg/types/relayer.go @@ -11,6 +11,7 @@ import ( "google.golang.org/grpc/status" "github.com/smartcontractkit/chainlink-common/pkg/types/chains/evm" + "github.com/smartcontractkit/chainlink-common/pkg/types/chains/solana" "github.com/smartcontractkit/chainlink-common/pkg/types/chains/ton" "github.com/smartcontractkit/chainlink-common/pkg/types/query" "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" @@ -227,6 +228,33 @@ type TONService interface { UnregisterFilter(ctx context.Context, name string) error } +type SolanaService interface { + solana.Client + + // Submits a transaction to the chain. It will return once the transaction is finalized or an error occurs. + SubmitTransaction(ctx context.Context, req solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error) + + // RegisterLogTracking registers a persistent log filter for tracking and caching logs + // based on the provided filter parameters. Once registered, matching logs will be collected + // over time and stored in a cache for future querying. + // noop guaranteed when filter.Name exists + RegisterLogTracking(ctx context.Context, req solana.LPFilterQuery) error + + // UnregisterLogTracking removes a previously registered log filter by its name. + // After removal, logs matching this filter will no longer be collected or cached. + // noop guaranteed when filterName doesn't exist + UnregisterLogTracking(ctx context.Context, filterName string) error + + // QueryTrackedLogs retrieves logs from the log storage based on the provided + // query expression, sorting, and confidence level. It only returns logs that were + // collected through previously registered log filters. + QueryTrackedLogs(ctx context.Context, filterQuery []query.Expression, + limitAndSort query.LimitAndSort) ([]*solana.Log, error) + + // GetLatestLPBlock retrieves current LatestBlock from cache perspective + GetLatestLPBlock(ctx context.Context) (*solana.LPBlock, error) +} + // Relayer extends ChainService with providers for each product. type Relayer interface { ChainService @@ -235,6 +263,9 @@ type Relayer interface { EVM() (EVMService, error) // TON returns TONService that provides access to TON specific functionalities TON() (TONService, error) + + Solana() (SolanaService, error) + // NewContractWriter returns a new ContractWriter. // The format of config depends on the implementation. NewContractWriter(ctx context.Context, config []byte) (ContractWriter, error) @@ -321,6 +352,10 @@ func (u *UnimplementedRelayer) TON() (TONService, error) { return nil, status.Errorf(codes.Unimplemented, "method TON not implemented") } +func (u *UnimplementedRelayer) Solana() (SolanaService, error) { + return nil, status.Errorf(codes.Unimplemented, "method Solana not implemented") +} + func (u *UnimplementedRelayer) NewContractWriter(ctx context.Context, config []byte) (ContractWriter, error) { return nil, status.Errorf(codes.Unimplemented, "method NewContractWriter not implemented") } @@ -449,3 +484,56 @@ func (ues *UnimplementedEVMService) GetTransactionStatus(ctx context.Context, tr func (ues *UnimplementedEVMService) GetForwarderForEOA(ctx context.Context, eoa, ocr2AggregatorID evm.Address, pluginType string) (forwarder evm.Address, err error) { return evm.Address{}, status.Errorf(codes.Unimplemented, "method GetForwarderForEOA not implemented") } + +var _ SolanaService = &UnimplementedSolanaService{} + +// UnimplementedSolanaService implements the SolanaService interface with stubbed methods that return codes.Unimplemented errors or panic. +// It is meant to be embedded in real SolanaService implementations in order to get default behavior for new methods without having +// to react to each change. +// In the future, embedding this type may be required to implement SolanaService (through use of an unexported method). +type UnimplementedSolanaService struct{} + +func (uss *UnimplementedSolanaService) SubmitTransaction(ctx context.Context, req solana.SubmitTransactionRequest) (*solana.SubmitTransactionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTransaction not implemented") +} + +func (uss *UnimplementedSolanaService) RegisterLogTracking(ctx context.Context, req solana.LPFilterQuery) error { + return status.Errorf(codes.Unimplemented, "method RegisterLogTracking not implemented") +} + +func (uss *UnimplementedSolanaService) UnregisterLogTracking(ctx context.Context, filterName string) error { + return status.Errorf(codes.Unimplemented, "method UnregisterLogTracking not implemented") +} +func (uss *UnimplementedSolanaService) QueryTrackedLogs(ctx context.Context, filterQuery []query.Expression, limitAndSort query.LimitAndSort) ([]*solana.Log, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryTrackedLogs not implemented") +} +func (uss *UnimplementedSolanaService) GetBalance(ctx context.Context, req solana.GetBalanceRequest) (*solana.GetBalanceReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBalance not implemented") +} +func (uss *UnimplementedSolanaService) GetAccountInfoWithOpts(ctx context.Context, req solana.GetAccountInfoRequest) (*solana.GetAccountInfoReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetAccountInfoWithOpts not implemented") +} +func (uss *UnimplementedSolanaService) GetMultipleAccountsWithOpts(ctx context.Context, req solana.GetMultipleAccountsRequest) (*solana.GetMultipleAccountsReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMultipleAccountsWithOpts not implemented") +} +func (uss *UnimplementedSolanaService) GetBlock(ctx context.Context, req solana.GetBlockRequest) (*solana.GetBlockReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetBlock not implemented") +} +func (uss *UnimplementedSolanaService) GetSlotHeight(ctx context.Context, req solana.GetSlotHeightRequest) (*solana.GetSlotHeightReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSlotHeight not implemented") +} +func (uss *UnimplementedSolanaService) GetTransaction(ctx context.Context, req solana.GetTransactionRequest) (*solana.GetTransactionReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetTransaction not implemented") +} +func (uss *UnimplementedSolanaService) GetFeeForMessage(ctx context.Context, req solana.GetFeeForMessageRequest) (*solana.GetFeeForMessageReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetFeeForMessage not implemented") +} +func (uss *UnimplementedSolanaService) GetSignatureStatuses(ctx context.Context, req solana.GetSignatureStatusesRequest) (*solana.GetSignatureStatusesReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSignatureStatuses not implemented") +} +func (uss *UnimplementedSolanaService) SimulateTX(ctx context.Context, req solana.SimulateTXRequest) (*solana.SimulateTXReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method SimulateTX not implemented") +} +func (uss *UnimplementedSolanaService) GetLatestLPBlock(ctx context.Context) (*solana.LPBlock, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetLatestLPBlock not implemented") +}