ion

package
v1.12.4 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: Apache-2.0 Imports: 73 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrTimeoutAfterWaitingForTxBroadcast _err = "timed out after waiting for tx to get included in the block"
	ErrUnexpectedNonZeroCode             _err = "node returned unexpected code"
)

Variables

View Source
var (
	// Variables used for retries
	RtyAttNum = uint(5)
	RtyAtt    = retry.Attempts(RtyAttNum)
	RtyDel    = retry.Delay(time.Millisecond * 400)
	RtyErr    = retry.LastErrorOnly(true)
)

Functions

func BuildSimTx

func BuildSimTx(info *keyring.Record, txf tx.Factory, msgs ...sdk.Msg) ([]byte, error)

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 DefaultPageRequest

func DefaultPageRequest() *query.PageRequest

func GetHeightFromMetadata

func GetHeightFromMetadata(md metadata.MD) (int64, error)

func GetProveFromMetadata

func GetProveFromMetadata(md metadata.MD) (bool, error)

func NewRPCClient

func NewRPCClient(addr string, timeout time.Duration) (*rpchttp.HTTP, error)

func SetHeightOnContext

func SetHeightOnContext(ctx context.Context, height int64) context.Context

func SetProveOnContext

func SetProveOnContext(ctx context.Context, prove bool) context.Context

Types

type ChainClientConfig

type ChainClientConfig struct {
	BlockTimeout   string                  `json:"block-timeout" yaml:"block-timeout"`
	OutputFormat   string                  `json:"output-format" yaml:"output-format"`
	KeyDirectory   string                  `json:"key-directory" yaml:"key-directory"`
	GRPCAddr       string                  `json:"grpc-addr" yaml:"grpc-addr"`
	AccountPrefix  string                  `json:"account-prefix" yaml:"account-prefix"`
	KeyringBackend string                  `json:"keyring-backend" yaml:"keyring-backend"`
	SignModeStr    string                  `json:"sign-mode" yaml:"sign-mode"`
	GasPrices      string                  `json:"gas-prices" yaml:"gas-prices"`
	RPCAddr        string                  `json:"rpc-addr" yaml:"rpc-addr"`
	ChainID        string                  `json:"chain-id" yaml:"chain-id"`
	Timeout        string                  `json:"timeout" yaml:"timeout"`
	Key            string                  `json:"key" yaml:"key"`
	ExtraCodecs    []string                `json:"extra-codecs" yaml:"extra-codecs"`
	Modules        []module.AppModuleBasic `json:"-" yaml:"-"`
	Slip44         int                     `json:"slip44" yaml:"slip44"`
	GasAdjustment  float64                 `json:"gas-adjustment" yaml:"gas-adjustment"`
	MinGasAmount   uint64                  `json:"min-gas-amount" yaml:"min-gas-amount"`
	Debug          bool                    `json:"debug" yaml:"debug"`
}

func (*ChainClientConfig) SignMode

func (ccc *ChainClientConfig) SignMode() signing.SignMode

type Client

type Client struct {
	Codec          Codec
	Keybase        keyring.Keyring
	RPCClient      rpcclient.Client
	LightProvider  provtypes.Provider
	Input          io.Reader
	Output         io.Writer
	Config         *ChainClientConfig
	KeyringOptions []keyring.Option
}

func NewClient

func NewClient(cfg *ChainClientConfig, input io.Reader, output io.Writer, kro ...keyring.Option) (*Client, error)

func (*Client) BroadcastTx

func (cc *Client) BroadcastTx(ctx context.Context, tx []byte) (*sdk.TxResponse, error)

func (*Client) CalculateGas

func (cc *Client) CalculateGas(ctx context.Context, txf tx.Factory, msgs ...sdk.Msg) (txtypes.SimulateResponse, uint64, error)

func (*Client) DecodeBech32AccAddr

func (cc *Client) DecodeBech32AccAddr(addr string) (sdk.AccAddress, error)

func (*Client) DecodeBech32AccPub

func (cc *Client) DecodeBech32AccPub(addr string) (sdk.AccAddress, error)

func (*Client) DecodeBech32ConsAddr

func (cc *Client) DecodeBech32ConsAddr(addr string) (sdk.AccAddress, error)

func (*Client) DecodeBech32ConsPub

func (cc *Client) DecodeBech32ConsPub(addr string) (sdk.AccAddress, error)

func (*Client) DecodeBech32ValAddr

func (cc *Client) DecodeBech32ValAddr(addr string) (sdk.ValAddress, error)

func (*Client) DecodeBech32ValPub

func (cc *Client) DecodeBech32ValPub(addr string) (sdk.AccAddress, error)

func (*Client) EncodeBech32AccAddr

func (cc *Client) EncodeBech32AccAddr(addr sdk.AccAddress) (string, error)

func (*Client) EncodeBech32AccPub

func (cc *Client) EncodeBech32AccPub(addr sdk.AccAddress) (string, error)

func (*Client) EncodeBech32ConsAddr

func (cc *Client) EncodeBech32ConsAddr(addr sdk.AccAddress) (string, error)

func (*Client) EncodeBech32ConsPub

func (cc *Client) EncodeBech32ConsPub(addr sdk.AccAddress) (string, error)

func (*Client) EncodeBech32ValAddr

func (cc *Client) EncodeBech32ValAddr(addr sdk.ValAddress) (string, error)

func (*Client) EncodeBech32ValPub

func (cc *Client) EncodeBech32ValPub(addr sdk.AccAddress) (string, error)

func (*Client) EnsureExists

func (cc *Client) EnsureExists(clientCtx client.Context, addr sdk.AccAddress) error

EnsureExists returns an error if no account exists for the given address else nil.

func (*Client) GetAccount

func (cc *Client) GetAccount(clientCtx client.Context, addr sdk.AccAddress) (client.Account, error)

GetAccount queries for an account given an address and a block height. An error is returned if the query or decoding fails.

func (*Client) GetAccountNumberSequence

func (cc *Client) GetAccountNumberSequence(clientCtx client.Context, addr sdk.AccAddress) (uint64, uint64, error)

GetAccountNumberSequence returns sequence and account number for the given address. It returns an error if the account couldn't be retrieved from the state.

func (*Client) GetAccountWithHeight

func (cc *Client) GetAccountWithHeight(clientCtx client.Context, addr sdk.AccAddress) (client.Account, int64, error)

GetAccountWithHeight queries for an account given an address. Returns the height of the query with the account. An error is returned if the query or decoding fails.

func (*Client) GetKeyAddress

func (cc *Client) GetKeyAddress() (addr sdk.AccAddress, err error)

func (*Client) GetKeybase

func (c *Client) GetKeybase() keyring.Keyring

func (*Client) HandleAndPrintMsgSend

func (cc *Client) HandleAndPrintMsgSend(res *sdk.TxResponse, err error) error

func (*Client) Invoke

func (cc *Client) Invoke(ctx context.Context, method string, req, reply interface{}, opts ...grpc.CallOption) (err error)

Invoke implements the grpc ClientConn.Invoke method

func (*Client) MarshalProto

func (cc *Client) MarshalProto(res proto.Message) ([]byte, error)

func (*Client) MustEncodeAccAddr

func (cc *Client) MustEncodeAccAddr(addr sdk.AccAddress) string

func (*Client) MustEncodeValAddr

func (cc *Client) MustEncodeValAddr(addr sdk.ValAddress) string

func (*Client) NewStream

NewStream implements the grpc ClientConn.NewStream method

func (*Client) PrepareFactory

func (cc *Client) PrepareFactory(txf tx.Factory) (tx.Factory, error)

func (*Client) PrintObject

func (cc *Client) PrintObject(res interface{}) error

func (*Client) PrintTxResponse

func (cc *Client) PrintTxResponse(res *sdk.TxResponse) error

TODO: actually do something different here have a couple of levels of verbosity

func (*Client) QueryABCI

func (cc *Client) QueryABCI(ctx context.Context, req abci.RequestQuery) (abci.ResponseQuery, error)

func (*Client) QueryAccount

func (cc *Client) QueryAccount(ctx context.Context, address sdk.AccAddress) (authtypes.AccountI, error)

func (*Client) QueryBalanceWithDenomTraces

func (cc *Client) QueryBalanceWithDenomTraces(ctx context.Context, address sdk.AccAddress, pageReq *query.PageRequest) (sdk.Coins, error)

QueryBalanceWithDenomTraces is a helper function for query balance

func (*Client) QueryDelegatorValidators

func (cc *Client) QueryDelegatorValidators(ctx context.Context, address sdk.AccAddress) ([]string, error)

func (*Client) QueryDenomsMetadata

func (cc *Client) QueryDenomsMetadata(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryDenomsMetadataResponse, error)

func (*Client) QueryDistributionCommission

func (cc *Client) QueryDistributionCommission(ctx context.Context, address sdk.ValAddress) (sdk.DecCoins, error)

func (*Client) QueryDistributionCommunityPool

func (cc *Client) QueryDistributionCommunityPool(ctx context.Context) (sdk.DecCoins, error)

func (*Client) QueryDistributionParams

func (cc *Client) QueryDistributionParams(ctx context.Context) (*distTypes.Params, error)

func (*Client) QueryDistributionRewards

func (cc *Client) QueryDistributionRewards(ctx context.Context, delegatorAddress sdk.AccAddress, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)

func (*Client) QueryDistributionSlashes

func (cc *Client) QueryDistributionSlashes(ctx context.Context, validatorAddress sdk.ValAddress, startHeight, endHeight uint64, pageReq *query.PageRequest) (*distTypes.QueryValidatorSlashesResponse, error)

QueryDistributionSlashes returns all slashes of a validator, optionally pass the start and end height

func (*Client) QueryDistributionValidatorRewards

func (cc *Client) QueryDistributionValidatorRewards(ctx context.Context, validatorAddress sdk.ValAddress) (sdk.DecCoins, error)

QueryDistributionValidatorRewards returns all the validator distribution rewards from a given height

func (*Client) QueryTotalSupply

func (cc *Client) QueryTotalSupply(ctx context.Context, pageReq *query.PageRequest) (*bankTypes.QueryTotalSupplyResponse, error)

QueryTotalSupply returns the total supply of coins on a chain

func (*Client) QueryTx

func (cc *Client) QueryTx(ctx context.Context, hashHex string, prove bool) (*ctypes.ResultTx, error)

QueryTx takes a hex encoded tx hash and decodes it before attempting to query the tx via the RPCClient.

func (*Client) QueryTxs

func (cc *Client) QueryTxs(ctx context.Context, page, limit int, events []string) ([]*ctypes.ResultTx, error)

QueryTxs returns an array of transactions related to the specified event search criteria.

func (*Client) RunGRPCQuery

func (cc *Client) RunGRPCQuery(ctx context.Context, method string, req interface{}, md metadata.MD) (abci.ResponseQuery, metadata.MD, error)

RunGRPCQuery runs a gRPC query from the clientCtx, given all necessary arguments for the gRPC method, and returns the ABCI response. It is used to factorize code between client (Invoke) and server (RegisterGRPCServer) gRPC handlers.

func (*Client) SendMsg

func (cc *Client) SendMsg(ctx context.Context, msg sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)

func (*Client) SendMsgs

func (cc *Client) SendMsgs(ctx context.Context, msgs []sdk.Msg, memo string, opts ...SendMsgOption) (*sdk.TxResponse, error)

SendMsgs wraps the msgs in a StdTx, signs and sends it. An error is returned if there was an issue sending the transaction. A successfully sent, but failed transaction will not return an error. If a transaction is successfully sent, the result of the execution of that transaction will be logged. A boolean indicating if a transaction was successfully sent and executed successfully is returned.

func (*Client) SetSDKContext

func (cc *Client) SetSDKContext() func()

SetSDKConfig sets the SDK config to the proper bech32 prefixes Don't use this unless you know what you're doing. if lens is successful, this can be eliminated TODO: :dagger: :knife: :chainsaw: remove this function

func (*Client) Status

func (cc *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error)

func (*Client) TxFactory

func (cc *Client) TxFactory() tx.Factory

func (*Client) TxServiceBroadcast

func (cc *Client) TxServiceBroadcast(ctx context.Context, req *tx.BroadcastTxRequest) (*tx.BroadcastTxResponse, error)

TxServiceBroadcast is a helper function to broadcast a Tx with the correct gRPC types from the tx service. Calls `clientCtx.BroadcastTx` under the hood.

func (*Client) UnpackAny

func (c *Client) UnpackAny(any *types.Any, iface interface{}) error

UnpackAny implements types.AnyUnpacker.

type Codec

type Codec struct {
	InterfaceRegistry types.InterfaceRegistry
	Marshaler         codec.Codec
	TxConfig          client.TxConfig
	Amino             *codec.LegacyAmino
}

func MakeCodec

func MakeCodec(moduleBasics []module.AppModuleBasic, _ []string) Codec

type SendMsgOption

type SendMsgOption func(tx.Factory) tx.Factory

func WithFeeGranter

func WithFeeGranter(address sdk.AccAddress) SendMsgOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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