github.com/algorand/go-algorand-sdk@v1.24.0/client/v2/algod/blockRaw.go (about)

     1  package algod
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/algorand/go-algorand-sdk/client/v2/common"
     8  )
     9  
    10  // GetBlockParams defines parameters for GetBlock.
    11  type GetBlockParams struct {
    12  	// Return raw msgpack block bytes or json
    13  	Format string `url:"format,omitempty"`
    14  }
    15  
    16  // BlockRaw contains metadata required to execute a BlockRaw query.
    17  type BlockRaw struct {
    18  	c     *Client
    19  	round uint64
    20  	p     GetBlockParams
    21  }
    22  
    23  // Do executes the BlockRaw query and gets the results.
    24  func (s *BlockRaw) Do(ctx context.Context, headers ...*common.Header) (result []byte, err error) {
    25  	s.p.Format = "msgpack"
    26  	return s.c.getRaw(ctx, fmt.Sprintf("/v2/blocks/%d", s.round), s.p, headers)
    27  }