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