From b3a107bedadb88faf555632204a8b80ddbc1fa51 Mon Sep 17 00:00:00 2001 From: Slavomir Date: Sun, 11 Jul 2021 17:58:41 +0200 Subject: [PATCH] Fix request and comments --- rpc/getBlock.go | 28 +++++++++++++++------------- rpc/getBlocks.go | 1 + rpc/getRecentBlockhash.go | 2 +- rpc/getSignaturesForAddress.go | 1 + rpc/getTransaction.go | 1 + 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/rpc/getBlock.go b/rpc/getBlock.go index 56e98d9..2b4eba9 100644 --- a/rpc/getBlock.go +++ b/rpc/getBlock.go @@ -7,19 +7,6 @@ import ( "github.com/gagliardetto/solana-go" ) -// GetBlock returns identity and transaction information about a confirmed block in the ledger. -// NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6 -func (cl *Client) GetBlock( - ctx context.Context, - slot uint64, -) (out *GetBlockResult, err error) { - return cl.GetBlockWithOpts( - ctx, - slot, - nil, - ) -} - type TransactionDetailsType string const ( @@ -35,6 +22,21 @@ type GetBlockOpts struct { Commitment CommitmentType // "processed" is not supported. If parameter not provided, the default is "finalized". } +// GetBlock returns identity and transaction information about a confirmed block in the ledger. +// NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6 +func (cl *Client) GetBlock( + ctx context.Context, + slot uint64, +) (out *GetBlockResult, err error) { + return cl.GetBlockWithOpts( + ctx, + slot, + nil, + ) +} + +// GetBlock returns identity and transaction information about a confirmed block in the ledger. +// NEW: This method is only available in solana-core v1.7 or newer. Please use getConfirmedBlock for solana-core v1.6 func (cl *Client) GetBlockWithOpts( ctx context.Context, slot uint64, diff --git a/rpc/getBlocks.go b/rpc/getBlocks.go index 5f8ed9e..a1bf173 100644 --- a/rpc/getBlocks.go +++ b/rpc/getBlocks.go @@ -9,6 +9,7 @@ import ( type BlocksResult []bin.Uint64 // GetBlocks returns a list of confirmed blocks between two slots. +// // NEW: This method is only available in solana-core v1.7 or newer. // Please use getConfirmedBlocks for solana-core v1.6. // The result will be an array of u64 integers listing confirmed blocks diff --git a/rpc/getRecentBlockhash.go b/rpc/getRecentBlockhash.go index 2b5a903..b3f6342 100644 --- a/rpc/getRecentBlockhash.go +++ b/rpc/getRecentBlockhash.go @@ -22,7 +22,7 @@ import ( func (cl *Client) GetRecentBlockhash(ctx context.Context, commitment CommitmentType) (out *GetRecentBlockhashResult, err error) { params := []interface{}{} if commitment != "" { - params = append(params, M{"commitment": string(commitment)}) + params = append(params, M{"commitment": commitment}) } err = cl.rpcClient.CallFor(&out, "getRecentBlockhash", params) diff --git a/rpc/getSignaturesForAddress.go b/rpc/getSignaturesForAddress.go index c263057..2c91e72 100644 --- a/rpc/getSignaturesForAddress.go +++ b/rpc/getSignaturesForAddress.go @@ -16,6 +16,7 @@ type GetSignaturesForAddressOpts struct { // GetSignaturesForAddress returns confirmed signatures for transactions // involving an address backwards in time from the provided signature // or most recent confirmed block. +// // NEW: This method is only available in solana-core v1.7 or newer. // Please use getConfirmedSignaturesForAddress2 for solana-core v1.6 func (cl *Client) GetSignaturesForAddress( diff --git a/rpc/getTransaction.go b/rpc/getTransaction.go index 4819ecd..bc131b3 100644 --- a/rpc/getTransaction.go +++ b/rpc/getTransaction.go @@ -21,6 +21,7 @@ type GetTransactionOpts struct { } // GetTransaction returns transaction details for a confirmed transaction. +// // NEW: This method is only available in solana-core v1.7 or newer. // Please use getConfirmedTransaction for solana-core v1.6 func (cl *Client) GetTransaction(