From 70ce94c2098c5268c5273e61f8f29ebff8fe854b Mon Sep 17 00:00:00 2001 From: Slavomir Date: Thu, 1 Jul 2021 15:24:49 +0200 Subject: [PATCH] Add RPC/getFeeCalculatorForBlockhash --- rpc/getFeeCalculatorForBlockhash.go | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 rpc/getFeeCalculatorForBlockhash.go diff --git a/rpc/getFeeCalculatorForBlockhash.go b/rpc/getFeeCalculatorForBlockhash.go new file mode 100644 index 0000000..06f40cb --- /dev/null +++ b/rpc/getFeeCalculatorForBlockhash.go @@ -0,0 +1,31 @@ +package rpc + +import ( + "context" + + "github.com/dfuse-io/solana-go" +) + +type GetFeeCalculatorForBlockhashResult struct { + RPCContext + Value FeeCalculatorForBlockhashResult `json:"value"` +} + +type FeeCalculatorForBlockhashResult struct { + FeeCalculator FeeCalculator `json:"feeCalculator"` +} + +// GetFeeCalculatorForBlockhash returns the fee calculator +// associated with the query blockhash, or null if the blockhash has expired. +func (cl *Client) GetFeeCalculatorForBlockhash( + ctx context.Context, + hash solana.Hash, // query blockhash as a Base58 encoded string + commitment CommitmentType, +) (out *GetFeeCalculatorForBlockhashResult, err error) { + params := []interface{}{hash} + if commitment != "" { + params = append(params, M{"commitment": commitment}) + } + err = cl.rpcClient.CallFor(&out, "getFeeCalculatorForBlockhash", params) + return +}