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

     1  package algod
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/algorand/go-algorand-sdk/client/v2/common"
     7  	"github.com/algorand/go-algorand-sdk/client/v2/common/models"
     8  	"github.com/algorand/go-algorand-sdk/types"
     9  )
    10  
    11  // SuggestedParams get parameters for constructing a new transaction
    12  type SuggestedParams struct {
    13  	c *Client
    14  }
    15  
    16  // Do performs the HTTP request
    17  func (s *SuggestedParams) Do(ctx context.Context, headers ...*common.Header) (params types.SuggestedParams, err error) {
    18  	var response models.TransactionParametersResponse
    19  	err = s.c.get(ctx, &response, "/v2/transactions/params", nil, headers)
    20  	params = types.SuggestedParams{
    21  		Fee:              types.MicroAlgos(response.Fee),
    22  		GenesisID:        response.GenesisId,
    23  		GenesisHash:      response.GenesisHash,
    24  		FirstRoundValid:  types.Round(response.LastRound),
    25  		LastRoundValid:   types.Round(response.LastRound + 1000),
    26  		ConsensusVersion: response.ConsensusVersion,
    27  		MinFee:           response.MinFee,
    28  	}
    29  	return
    30  }