Documentation
¶
Index ¶
- Constants
- func NewClient(opts ClientOptions, cdc *codec.Codec) account.Client
- func NewGasEstimator(gasPerByte pack.U256) gas.Estimator
- func NewTxBuilder(options TxBuilderOptions) account.TxBuilder
- type Address
- type AddressDecoder
- type AddressEncodeDecoder
- type AddressEncoder
- type Client
- type ClientOptions
- type Coin
- type Coins
- type GasEstimator
- type MsgSend
- type StdFee
- type StdSignature
- type StdTx
- func (tx StdTx) From() address.Address
- func (tx StdTx) Hash() pack.Bytes
- func (tx StdTx) Nonce() pack.U256
- func (tx StdTx) Payload() contract.CallData
- func (tx StdTx) Serialize() (pack.Bytes, error)
- func (tx StdTx) Sighashes() ([]pack.Bytes32, error)
- func (tx *StdTx) Sign(signatures []pack.Bytes65, pubKey pack.Bytes) error
- func (tx StdTx) To() address.Address
- func (tx StdTx) Value() pack.U256
- type TxBuilderOptions
Constants ¶
const ( // DefaultClientTimeout used by the Client. DefaultClientTimeout = time.Minute // DefaultClientTimeoutRetry used by the Client. DefaultClientTimeoutRetry = time.Second // DefaultClientHost used by the Client. This should only be used for local // deployments of the multichain. DefaultClientHost = "http://0.0.0.0:26657" // DefaultBroadcastMode configures the behaviour of a cosmos client while it // interacts with the cosmos node. Allowed broadcast modes can be async, sync // and block. "async" returns immediately after broadcasting, "sync" returns // after the transaction has been checked and "block" waits until the // transaction is committed to the chain. DefaultBroadcastMode = "sync" )
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(opts ClientOptions, cdc *codec.Codec) account.Client
NewClient returns a new Client.
func NewGasEstimator ¶
NewGasEstimator returns a simple gas estimator that always returns the same amount of gas-per-byte.
func NewTxBuilder ¶
func NewTxBuilder(options TxBuilderOptions) account.TxBuilder
NewTxBuilder returns an implementation of the transaction builder interface from the Cosmos Compat API, and exposes the functionality to build simple Cosmos based transactions.
Types ¶
type Address ¶
type Address sdk.AccAddress
An Address is a public address that can be encoded/decoded to/from strings. Addresses are usually formatted different between different network configurations.
func (Address) AccAddress ¶
func (addr Address) AccAddress() sdk.AccAddress
AccAddress convert Address to sdk.AccAddress
type AddressDecoder ¶
type AddressDecoder struct {
// contains filtered or unexported fields
}
AddressDecoder implements the address.Decoder interface
func NewAddressDecoder ¶
func NewAddressDecoder(hrp string) AddressDecoder
NewAddressDecoder creates a new address decoder
func (AddressDecoder) DecodeAddress ¶
func (decoder AddressDecoder) DecodeAddress(addr address.Address) (address.RawAddress, error)
DecodeAddress consumes a human-readable representation of a cosmos compatible address and decodes it to its raw bytes representation.
type AddressEncodeDecoder ¶
type AddressEncodeDecoder struct {
AddressEncoder
AddressDecoder
}
AddressEncodeDecoder encapsulates fields that implement the address.EncodeDecoder interface
func NewAddressEncodeDecoder ¶
func NewAddressEncodeDecoder(hrp string) AddressEncodeDecoder
NewAddressEncodeDecoder creates a new address encoder-decoder
type AddressEncoder ¶
type AddressEncoder struct{}
AddressEncoder implements the address.Encoder interface
func NewAddressEncoder ¶
func NewAddressEncoder() AddressEncoder
NewAddressEncoder creates a new address encoder
func (AddressEncoder) EncodeAddress ¶
func (encoder AddressEncoder) EncodeAddress(rawAddr address.RawAddress) (address.Address, error)
EncodeAddress consumes raw bytes and encodes them to a human-readable address format.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client interacts with an instance of the Cosmos based network using the REST interface exposed by a lightclient node.
type ClientOptions ¶
type ClientOptions struct {
Timeout time.Duration
TimeoutRetry time.Duration
Host pack.String
BroadcastMode pack.String
}
ClientOptions are used to parameterise the behaviour of the Client.
func DefaultClientOptions ¶
func DefaultClientOptions() ClientOptions
DefaultClientOptions returns ClientOptions with the default settings. These settings are valid for use with the default local deployment of the multichain. In production, the host, user, and password should be changed.
func (ClientOptions) WithHost ¶
func (opts ClientOptions) WithHost(host pack.String) ClientOptions
WithHost sets the URL of the Bitcoin node.
type GasEstimator ¶
type GasEstimator struct {
// contains filtered or unexported fields
}
A GasEstimator returns the gas-per-byte that is needed in order to confirm transactions with an estimated maximum delay of one block. In distributed networks that collectively build, sign, and submit transactions, it is important that all nodes in the network have reached consensus on the gas-per-byte.
func (*GasEstimator) EstimateGasPrice ¶
EstimateGasPrice returns gas required per byte for Cosmos-compatible chains.
type MsgSend ¶
type MsgSend struct {
FromAddress Address `json:"from_address" yaml:"from_address"`
ToAddress Address `json:"to_address" yaml:"to_address"`
Amount Coins `json:"amount" yaml:"amount"`
}
MsgSend - high level transaction of the coin module
type StdFee ¶
type StdFee struct {
Amount Coins `json:"amount" yaml:"amount"`
Gas pack.U64 `json:"gas" yaml:"gas"`
}
StdFee auth.StdFee wrapper
type StdSignature ¶
type StdSignature struct {
PubKey pack.Bytes `json:"pub_key" yaml:"pub_key"`
Signature pack.Bytes `json:"signature" yaml:"signature"`
}
StdSignature auth.StdStdSignature wrapper
type StdTx ¶
type StdTx struct {
// contains filtered or unexported fields
}
StdTx auth.StStdTx wrapper
func (*StdTx) Sign ¶
Sign the transaction by injecting signatures and the serialized pubkey of the signer.