2020-03-13 10:59:14 -07:00
|
|
|
package tx
|
2020-03-12 12:35:22 -07:00
|
|
|
|
|
|
|
import (
|
2020-03-24 13:36:12 -07:00
|
|
|
"bufio"
|
|
|
|
"errors"
|
|
|
|
"fmt"
|
2020-03-25 11:23:34 -07:00
|
|
|
"net/http"
|
2020-03-24 13:36:12 -07:00
|
|
|
"os"
|
2020-03-26 09:50:39 -07:00
|
|
|
"strings"
|
|
|
|
|
|
|
|
"github.com/gogo/protobuf/jsonpb"
|
2020-06-30 13:59:21 -07:00
|
|
|
"github.com/spf13/pflag"
|
2020-03-24 13:36:12 -07:00
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
2020-03-24 13:51:59 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
2020-03-24 13:36:12 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/client/input"
|
2020-03-12 12:35:22 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-04-15 14:55:02 -07:00
|
|
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
2020-03-25 11:23:34 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/rest"
|
2020-06-16 12:57:37 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/types/tx/signing"
|
|
|
|
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
2020-03-12 12:35:22 -07:00
|
|
|
)
|
|
|
|
|
2020-06-30 13:59:21 -07:00
|
|
|
// GenerateOrBroadcastTxCLI will either generate and print and unsigned transaction
|
|
|
|
// or sign it and broadcast it returning an error upon failure.
|
|
|
|
func GenerateOrBroadcastTxCLI(clientCtx client.Context, flagSet *pflag.FlagSet, msgs ...sdk.Msg) error {
|
|
|
|
txf := NewFactoryCLI(clientCtx, flagSet)
|
|
|
|
return GenerateOrBroadcastTxWithFactory(clientCtx, txf, msgs...)
|
|
|
|
}
|
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
// GenerateOrBroadcastTx will either generate and print and unsigned transaction
|
|
|
|
// or sign it and broadcast it returning an error upon failure.
|
2020-06-30 13:59:21 -07:00
|
|
|
//
|
|
|
|
// TODO: Remove in favor of GenerateOrBroadcastTxCLI
|
2020-06-01 05:46:03 -07:00
|
|
|
func GenerateOrBroadcastTx(clientCtx client.Context, msgs ...sdk.Msg) error {
|
2020-06-30 13:59:21 -07:00
|
|
|
txf := NewFactoryFromDeprecated(clientCtx.Input).WithTxGenerator(clientCtx.TxGenerator).WithAccountRetriever(clientCtx.AccountRetriever)
|
2020-06-01 05:46:03 -07:00
|
|
|
return GenerateOrBroadcastTxWithFactory(clientCtx, txf, msgs...)
|
2020-05-21 14:29:34 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// GenerateOrBroadcastTxWithFactory will either generate and print and unsigned transaction
|
|
|
|
// or sign it and broadcast it returning an error upon failure.
|
2020-06-01 05:46:03 -07:00
|
|
|
func GenerateOrBroadcastTxWithFactory(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error {
|
|
|
|
if clientCtx.GenerateOnly {
|
|
|
|
return GenerateTx(clientCtx, txf, msgs...)
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
return BroadcastTx(clientCtx, txf, msgs...)
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// GenerateTx will generate an unsigned transaction and print it to the writer
|
|
|
|
// specified by ctx.Output. If simulation was requested, the gas will be
|
|
|
|
// simulated and also printed to the same writer before the transaction is
|
|
|
|
// printed.
|
2020-06-01 05:46:03 -07:00
|
|
|
func GenerateTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error {
|
2020-03-24 13:36:12 -07:00
|
|
|
if txf.SimulateAndExecute() {
|
2020-06-01 05:46:03 -07:00
|
|
|
if clientCtx.Offline {
|
2020-03-24 13:36:12 -07:00
|
|
|
return errors.New("cannot estimate gas in offline mode")
|
|
|
|
}
|
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
_, adjusted, err := CalculateGas(clientCtx.QueryWithData, txf, msgs...)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
txf = txf.WithGas(adjusted)
|
|
|
|
_, _ = fmt.Fprintf(os.Stderr, "%s\n", GasEstimateResponse{GasEstimate: txf.Gas()})
|
|
|
|
}
|
|
|
|
|
|
|
|
tx, err := BuildUnsignedTx(txf, msgs...)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-18 00:36:25 -07:00
|
|
|
return clientCtx.PrintOutput(tx.GetTx())
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// BroadcastTx attempts to generate, sign and broadcast a transaction with the
|
|
|
|
// given set of messages. It will also simulate gas requirements if necessary.
|
|
|
|
// It will return an error upon failure.
|
2020-06-01 05:46:03 -07:00
|
|
|
func BroadcastTx(clientCtx client.Context, txf Factory, msgs ...sdk.Msg) error {
|
|
|
|
txf, err := PrepareFactory(clientCtx, txf)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
if txf.SimulateAndExecute() || clientCtx.Simulate {
|
|
|
|
_, adjusted, err := CalculateGas(clientCtx.QueryWithData, txf, msgs...)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
txf = txf.WithGas(adjusted)
|
|
|
|
_, _ = fmt.Fprintf(os.Stderr, "%s\n", GasEstimateResponse{GasEstimate: txf.Gas()})
|
|
|
|
}
|
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
if clientCtx.Simulate {
|
2020-03-24 13:36:12 -07:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
tx, err := BuildUnsignedTx(txf, msgs...)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
if !clientCtx.SkipConfirm {
|
|
|
|
out, err := clientCtx.JSONMarshaler.MarshalJSON(tx)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
_, _ = fmt.Fprintf(os.Stderr, "%s\n\n", out)
|
|
|
|
|
|
|
|
buf := bufio.NewReader(os.Stdin)
|
2020-04-08 02:38:28 -07:00
|
|
|
ok, err := input.GetConfirmation("confirm transaction before signing and broadcasting", buf, os.Stderr)
|
2020-04-29 19:36:34 -07:00
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil || !ok {
|
|
|
|
_, _ = fmt.Fprintf(os.Stderr, "%s\n", "cancelled transaction")
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
err = Sign(txf, clientCtx.GetFromName(), tx)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-18 13:29:41 -07:00
|
|
|
txBytes, err := clientCtx.TxGenerator.TxEncoder()(tx.GetTx())
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
// broadcast to a Tendermint node
|
2020-06-01 05:46:03 -07:00
|
|
|
res, err := clientCtx.BroadcastTx(txBytes)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2020-06-18 00:36:25 -07:00
|
|
|
return clientCtx.PrintOutput(res)
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
2020-03-25 11:23:34 -07:00
|
|
|
// WriteGeneratedTxResponse writes a generated unsigned transaction to the
|
|
|
|
// provided http.ResponseWriter. It will simulate gas costs if requested by the
|
|
|
|
// BaseReq. Upon any error, the error will be written to the http.ResponseWriter.
|
|
|
|
func WriteGeneratedTxResponse(
|
2020-06-01 05:46:03 -07:00
|
|
|
ctx client.Context, w http.ResponseWriter, br rest.BaseReq, msgs ...sdk.Msg,
|
2020-03-25 11:23:34 -07:00
|
|
|
) {
|
|
|
|
gasAdj, ok := rest.ParseFloat64OrReturnBadRequest(w, br.GasAdjustment, flags.DefaultGasAdjustment)
|
|
|
|
if !ok {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
simAndExec, gas, err := flags.ParseGas(br.Gas)
|
2020-04-01 00:50:22 -07:00
|
|
|
if rest.CheckBadRequestError(w, err) {
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
txf := Factory{fees: br.Fees, gasPrices: br.GasPrices}.
|
|
|
|
WithAccountNumber(br.AccountNumber).
|
|
|
|
WithSequence(br.Sequence).
|
|
|
|
WithGas(gas).
|
|
|
|
WithGasAdjustment(gasAdj).
|
|
|
|
WithMemo(br.Memo).
|
|
|
|
WithChainID(br.ChainID).
|
2020-05-21 14:29:34 -07:00
|
|
|
WithSimulateAndExecute(br.Simulate).
|
|
|
|
WithTxGenerator(ctx.TxGenerator)
|
2020-03-25 11:23:34 -07:00
|
|
|
|
|
|
|
if br.Simulate || simAndExec {
|
|
|
|
if gasAdj < 0 {
|
2020-04-15 14:55:02 -07:00
|
|
|
rest.WriteErrorResponse(w, http.StatusBadRequest, sdkerrors.ErrorInvalidGasAdjustment.Error())
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
_, adjusted, err := CalculateGas(ctx.QueryWithData, txf, msgs...)
|
2020-04-01 00:50:22 -07:00
|
|
|
if rest.CheckInternalServerError(w, err) {
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
txf = txf.WithGas(adjusted)
|
|
|
|
|
|
|
|
if br.Simulate {
|
2020-05-21 14:29:34 -07:00
|
|
|
rest.WriteSimulationResponse(w, ctx.JSONMarshaler, txf.Gas())
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
tx, err := BuildUnsignedTx(txf, msgs...)
|
2020-04-01 00:50:22 -07:00
|
|
|
if rest.CheckBadRequestError(w, err) {
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-07-01 20:16:39 -07:00
|
|
|
output, err := ctx.JSONMarshaler.MarshalJSON(tx.GetTx())
|
2020-04-01 00:50:22 -07:00
|
|
|
if rest.CheckInternalServerError(w, err) {
|
2020-03-25 11:23:34 -07:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
|
|
w.WriteHeader(http.StatusOK)
|
|
|
|
_, _ = w.Write(output)
|
|
|
|
}
|
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
// BuildUnsignedTx builds a transaction to be signed given a set of messages. The
|
|
|
|
// transaction is initially created via the provided factory's generator. Once
|
|
|
|
// created, the fee, memo, and messages are set.
|
2020-06-01 05:46:03 -07:00
|
|
|
func BuildUnsignedTx(txf Factory, msgs ...sdk.Msg) (client.TxBuilder, error) {
|
2020-03-24 13:36:12 -07:00
|
|
|
if txf.chainID == "" {
|
|
|
|
return nil, fmt.Errorf("chain ID required but not specified")
|
|
|
|
}
|
|
|
|
|
|
|
|
fees := txf.fees
|
2020-04-29 19:36:34 -07:00
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
if !txf.gasPrices.IsZero() {
|
|
|
|
if !fees.IsZero() {
|
|
|
|
return nil, errors.New("cannot provide both fees and gas prices")
|
|
|
|
}
|
|
|
|
|
|
|
|
glDec := sdk.NewDec(int64(txf.gas))
|
|
|
|
|
|
|
|
// Derive the fees based on the provided gas prices, where
|
|
|
|
// fee = ceil(gasPrice * gasLimit).
|
|
|
|
fees = make(sdk.Coins, len(txf.gasPrices))
|
2020-04-29 19:36:34 -07:00
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
for i, gp := range txf.gasPrices {
|
|
|
|
fee := gp.Amount.Mul(glDec)
|
|
|
|
fees[i] = sdk.NewCoin(gp.Denom, fee.Ceil().RoundInt())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
tx := txf.txGenerator.NewTxBuilder()
|
2020-03-24 13:36:12 -07:00
|
|
|
|
2020-04-06 07:24:40 -07:00
|
|
|
if err := tx.SetMsgs(msgs...); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2020-06-16 12:57:37 -07:00
|
|
|
tx.SetMemo(txf.memo)
|
|
|
|
tx.SetFeeAmount(fees)
|
|
|
|
tx.SetGasLimit(txf.gas)
|
2020-04-06 07:24:40 -07:00
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
return tx, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// BuildSimTx creates an unsigned tx with an empty single signature and returns
|
|
|
|
// the encoded transaction or an error if the unsigned transaction cannot be
|
|
|
|
// built.
|
|
|
|
func BuildSimTx(txf Factory, msgs ...sdk.Msg) ([]byte, error) {
|
|
|
|
tx, err := BuildUnsignedTx(txf, msgs...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create an empty signature literal as the ante handler will populate with a
|
|
|
|
// sentinel pubkey.
|
2020-06-16 12:57:37 -07:00
|
|
|
sig := signing.SignatureV2{}
|
2020-04-15 14:55:02 -07:00
|
|
|
|
|
|
|
if err := tx.SetSignatures(sig); err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
2020-03-24 13:36:12 -07:00
|
|
|
|
2020-06-18 13:29:41 -07:00
|
|
|
return txf.txGenerator.TxEncoder()(tx.GetTx())
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// CalculateGas simulates the execution of a transaction and returns the
|
|
|
|
// simulation response obtained by the query and the adjusted gas amount.
|
|
|
|
func CalculateGas(
|
2020-03-25 11:23:34 -07:00
|
|
|
queryFunc func(string, []byte) ([]byte, int64, error), txf Factory, msgs ...sdk.Msg,
|
2020-03-24 13:36:12 -07:00
|
|
|
) (sdk.SimulationResponse, uint64, error) {
|
2020-03-25 11:23:34 -07:00
|
|
|
txBytes, err := BuildSimTx(txf, msgs...)
|
|
|
|
if err != nil {
|
|
|
|
return sdk.SimulationResponse{}, 0, err
|
|
|
|
}
|
|
|
|
|
2020-03-24 13:45:34 -07:00
|
|
|
bz, _, err := queryFunc("/app/simulate", txBytes)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return sdk.SimulationResponse{}, 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
var simRes sdk.SimulationResponse
|
2020-03-26 09:50:39 -07:00
|
|
|
if err := jsonpb.Unmarshal(strings.NewReader(string(bz)), &simRes); err != nil {
|
2020-03-24 13:36:12 -07:00
|
|
|
return sdk.SimulationResponse{}, 0, err
|
|
|
|
}
|
|
|
|
|
2020-03-25 11:23:34 -07:00
|
|
|
return simRes, uint64(txf.GasAdjustment() * float64(simRes.GasUsed)), nil
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// PrepareFactory ensures the account defined by ctx.GetFromAddress() exists and
|
|
|
|
// if the account number and/or the account sequence number are zero (not set),
|
|
|
|
// they will be queried for and set on the provided Factory. A new Factory with
|
|
|
|
// the updated fields will be returned.
|
2020-06-01 05:46:03 -07:00
|
|
|
func PrepareFactory(clientCtx client.Context, txf Factory) (Factory, error) {
|
|
|
|
from := clientCtx.GetFromAddress()
|
2020-03-24 13:36:12 -07:00
|
|
|
|
2020-06-01 05:46:03 -07:00
|
|
|
if err := txf.accountRetriever.EnsureExists(clientCtx, from); err != nil {
|
2020-03-24 13:36:12 -07:00
|
|
|
return txf, err
|
|
|
|
}
|
|
|
|
|
|
|
|
initNum, initSeq := txf.accountNumber, txf.sequence
|
|
|
|
if initNum == 0 || initSeq == 0 {
|
2020-06-01 05:46:03 -07:00
|
|
|
num, seq, err := txf.accountRetriever.GetAccountNumberSequence(clientCtx, from)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
|
|
|
return txf, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if initNum == 0 {
|
|
|
|
txf = txf.WithAccountNumber(num)
|
|
|
|
}
|
2020-04-29 19:36:34 -07:00
|
|
|
|
2020-03-24 13:36:12 -07:00
|
|
|
if initSeq == 0 {
|
|
|
|
txf = txf.WithSequence(seq)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return txf, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sign signs a given tx with the provided name and passphrase. If the Factory's
|
|
|
|
// Keybase is not set, a new one will be created based on the client's backend.
|
|
|
|
// The bytes signed over are canconical. The resulting signature will be set on
|
|
|
|
// the transaction. Finally, the marshaled transaction is returned. An error is
|
|
|
|
// returned upon failure.
|
|
|
|
//
|
|
|
|
// Note, It is assumed the Factory has the necessary fields set that are required
|
|
|
|
// by the CanonicalSignBytes call.
|
2020-06-16 12:57:37 -07:00
|
|
|
func Sign(txf Factory, name string, tx client.TxBuilder) error {
|
2020-03-24 13:36:12 -07:00
|
|
|
if txf.keybase == nil {
|
2020-06-16 12:57:37 -07:00
|
|
|
return errors.New("keybase must be set prior to signing a transaction")
|
|
|
|
}
|
|
|
|
|
|
|
|
signMode := txf.signMode
|
|
|
|
if signMode == signing.SignMode_SIGN_MODE_UNSPECIFIED {
|
|
|
|
// use the SignModeHandler's default mode if unspecified
|
|
|
|
signMode = txf.txGenerator.SignModeHandler().DefaultMode()
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
key, err := txf.keybase.Key(name)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
2020-06-16 12:57:37 -07:00
|
|
|
return err
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
pubKey := key.GetPubKey()
|
|
|
|
sigData := &signing.SingleSignatureData{
|
|
|
|
SignMode: signMode,
|
|
|
|
Signature: nil,
|
|
|
|
}
|
|
|
|
sig := signing.SignatureV2{
|
|
|
|
PubKey: pubKey,
|
|
|
|
Data: sigData,
|
|
|
|
}
|
|
|
|
err = tx.SetSignatures(sig)
|
2020-03-24 13:36:12 -07:00
|
|
|
if err != nil {
|
2020-06-16 12:57:37 -07:00
|
|
|
return err
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
signBytes, err := txf.txGenerator.SignModeHandler().GetSignBytes(
|
|
|
|
signMode,
|
|
|
|
authsigning.SignerData{
|
|
|
|
ChainID: txf.chainID,
|
|
|
|
AccountNumber: txf.accountNumber,
|
|
|
|
AccountSequence: txf.sequence,
|
|
|
|
}, tx.GetTx(),
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2020-04-15 14:55:02 -07:00
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
sigBytes, _, err := txf.keybase.Sign(name, signBytes)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
2020-04-15 14:55:02 -07:00
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
sigData.Signature = sigBytes
|
|
|
|
sig = signing.SignatureV2{
|
|
|
|
PubKey: pubKey,
|
|
|
|
Data: sigData,
|
2020-04-15 14:55:02 -07:00
|
|
|
}
|
|
|
|
|
2020-06-16 12:57:37 -07:00
|
|
|
return tx.SetSignatures(sig)
|
2020-03-24 13:36:12 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// GasEstimateResponse defines a response definition for tx gas estimation.
|
|
|
|
type GasEstimateResponse struct {
|
|
|
|
GasEstimate uint64 `json:"gas_estimate" yaml:"gas_estimate"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (gr GasEstimateResponse) String() string {
|
|
|
|
return fmt.Sprintf("gas estimate: %d", gr.GasEstimate)
|
|
|
|
}
|