client

package
v0.0.0-...-6712c69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 29, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SequenceNum

func SequenceNum(lcdEndpoint string, address string) (string, error)

SequenceNum retrieves the current sequence number for the wallet

Types

type AccountData

type AccountData struct {
	Height string `json:"height"`
	Result struct {
		Type  string `json:"type"`
		Value struct {
			Address   string `json:"address"`
			PublicKey struct {
				Type  string `json:"type"`
				Value string `json:"value"`
			} `json:"public_key"`
			AccountNumber string `json:"account_number"`
			Sequence      string `json:"sequence"`
		} `json:"value"`
	} `json:"result"`
}

func GetAccountData

func GetAccountData(lcdEndpoint, address string) (AccountData, error)

type CreateTxOptions

type CreateTxOptions struct {
	Msgs []msg.Msg
	Memo string

	// Optional parameters
	AccountNumber uint64
	Sequence      uint64
	GasLimit      uint64
	FeeAmount     msg.Coins

	SignMode      tx.SignMode
	FeeGranter    msg.AccAddress
	TimeoutHeight uint64
}

CreateTxOptions tx creation options

type Error

type Error struct {
	Error string `json:"error,omitempty"`
}

type EstimateFeeResWrapper

type EstimateFeeResWrapper struct {
	Height msg.Int                  `json:"height"`
	Result feeutils.EstimateFeeResp `json:"result"`
}

EstimateFeeResWrapper - wrapper for estimate fee query

type LCDClient

type LCDClient struct {
	URL           string
	ChainID       string
	GasPrice      msg.DecCoin
	GasAdjustment msg.Dec

	PrivKey        key.PrivKey
	EncodingConfig terraappparams.EncodingConfig
	// contains filtered or unexported fields
}

LCDClient outer interface for building & signing & broadcasting tx

func NewLCDClient

func NewLCDClient(URL, chainID string, gasPrice msg.DecCoin, gasAdjustment msg.Dec, tmKey key.PrivKey, httpTimeout time.Duration) *LCDClient

NewLCDClient create new LCDClient

func (LCDClient) Broadcast

func (lcd LCDClient) Broadcast(ctx context.Context, txbuilder *tx.Builder) (*sdk.TxResponse, error)

Broadcast - no-lint

func (LCDClient) ComputeTax

func (lcd LCDClient) ComputeTax(ctx context.Context, txbuilder tx.Builder) (*customauthtx.ComputeTaxResponse, error)

ComputeTax compute tax

func (*LCDClient) CreateAndSignTx

func (lcd *LCDClient) CreateAndSignTx(ctx context.Context, options CreateTxOptions) (*tx.Builder, error)

CreateAndSignTx build and sign tx

func (LCDClient) EstimateFee

func (lcd LCDClient) EstimateFee(ctx context.Context, options CreateTxOptions) (res *feeutils.EstimateFeeResp, err error)

EstimateFee simulates gas and fee for a transaction

func (LCDClient) LoadAccount

func (lcd LCDClient) LoadAccount(ctx context.Context, address msg.AccAddress) (res authtypes.AccountI, err error)

LoadAccount simulates gas and fee for a transaction

func (LCDClient) Simulate

func (lcd LCDClient) Simulate(ctx context.Context, txbuilder tx.Builder, options CreateTxOptions) (*sdktx.SimulateResponse, error)

Simulate tx and get response

type QueryAccountRes

type QueryAccountRes struct {
	Account QueryAccountResData `json:"account"`
}

QueryAccountRes response

type QueryAccountResData

type QueryAccountResData struct {
	Address       msg.AccAddress `json:"address"`
	AccountNumber msg.Int        `json:"account_number"`
	Sequence      msg.Int        `json:"sequence"`
}

QueryAccountResData response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL