github.com/gagliardetto/solana-go@v1.11.0/rpc/isBlockhashValid.go (about)

     1  package rpc
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/gagliardetto/solana-go"
     7  )
     8  
     9  // Returns whether a blockhash is still valid or not
    10  //
    11  // **NEW: This method is only available in solana-core v1.9 or newer. Please use
    12  // `getFeeCalculatorForBlockhash` for solana-core v1.8**
    13  func (cl *Client) IsBlockhashValid(
    14  	ctx context.Context,
    15  	// Blockhash to be queried. Required.
    16  	blockHash solana.Hash,
    17  
    18  	// Commitment requirement. Optional.
    19  	commitment CommitmentType,
    20  ) (out *IsValidBlockhashResult, err error) {
    21  	params := []interface{}{blockHash}
    22  	if commitment != "" {
    23  		params = append(params, M{"commitment": string(commitment)})
    24  	}
    25  
    26  	err = cl.rpcClient.CallForInto(ctx, &out, "isBlockhashValid", params)
    27  	return
    28  }