Documentation ¶
Index ¶
- Constants
- Variables
- func CheckError(err error) xc.ClientError
- func NewAddressBuilder(asset xc.ITask) (xc.AddressBuilder, error)
- func NewSigner(asset xc.ITask) (xc.Signer, error)
- func NewTxBuilder(asset xc.ITask) (xc.TxBuilder, error)
- type AddressBuilder
- type Client
- func (client *Client) EstimateGas(ctx context.Context) (xc.AmountBlockchain, error)
- func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
- func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
- func (client *Client) FetchTxInfo(ctx context.Context, txHash xc.TxHash) (xc.TxInfo, error)
- func (client *Client) FetchTxInput(ctx context.Context, from xc.Address, _ xc.Address) (xc.TxInput, error)
- func (client *Client) GetAccount(ctx context.Context, address xc.Address) (client.Account, error)
- func (client *Client) RegisterEstimateGasCallback(fn xc.EstimateGasFunc)
- func (client *Client) SubmitTx(ctx context.Context, txInput xc.Tx) error
- type EncodingConfig
- type Signer
- type Tx
- func (tx Tx) AddSignatures(signatures ...xc.TxSignature) error
- func (tx Tx) Amount() xc.AmountBlockchain
- func (tx Tx) ContractAddress() xc.ContractAddress
- func (tx Tx) Destinations() []*xc.TxInfoEndpoint
- func (tx Tx) Fee() xc.AmountBlockchain
- func (tx Tx) From() xc.Address
- func (tx Tx) Hash() xc.TxHash
- func (tx *Tx) ParseTransfer()
- func (tx Tx) Serialize() ([]byte, error)
- func (tx Tx) Sighashes() ([]xc.TxDataToSign, error)
- func (tx Tx) Sources() []*xc.TxInfoEndpoint
- func (tx Tx) To() xc.Address
- type TxBuilder
- func (txBuilder TxBuilder) NewNativeTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewTokenTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- func (txBuilder TxBuilder) NewTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
- type TxInput
Constants ¶
const LEN_NATIVE_ASSET = 8
Variables ¶
var ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, genutil.AppModuleBasic{}, bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic(getGovProposalHandlers()...), params.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, ibc.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, upgrade.AppModuleBasic{}, evidence.AppModuleBasic{}, transfer.AppModuleBasic{}, vesting.AppModuleBasic{}, ica.AppModuleBasic{}, router.AppModuleBasic{}, authzmodule.AppModuleBasic{}, wasm.AppModuleBasic{}, )
ModuleBasics defines the module BasicManager is in charge of setting up basic, non-dependant module elements, such as codec registration and genesis verification.
Functions ¶
func CheckError ¶ added in v0.3.0
func CheckError(err error) xc.ClientError
func NewAddressBuilder ¶
func NewAddressBuilder(asset xc.ITask) (xc.AddressBuilder, error)
NewAddressBuilder creates a new Cosmos AddressBuilder
Types ¶
type AddressBuilder ¶
type AddressBuilder struct {
Asset *xc.AssetConfig
}
AddressBuilder for Cosmos
func (AddressBuilder) GetAddressFromPublicKey ¶
func (ab AddressBuilder) GetAddressFromPublicKey(publicKeyBytes []byte) (xc.Address, error)
GetAddressFromPublicKey returns an Address given a public key
func (AddressBuilder) GetAllPossibleAddressesFromPublicKey ¶
func (ab AddressBuilder) GetAllPossibleAddressesFromPublicKey(publicKeyBytes []byte) ([]xc.PossibleAddress, error)
GetAllPossibleAddressesFromPublicKey returns all PossubleAddress(es) given a public key
type Client ¶
type Client struct { Asset xc.ITask Ctx client.Context Prefix string EstimateGasFunc xc.EstimateGasFunc }
Client for Cosmos
func (*Client) EstimateGas ¶ added in v0.2.0
EstimateGas estimates gas price for a Cosmos chain
func (*Client) FetchBalance ¶ added in v0.2.0
func (client *Client) FetchBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
FetchBalance fetches balance for input asset for a Cosmos address
func (*Client) FetchNativeBalance ¶ added in v0.2.0
func (client *Client) FetchNativeBalance(ctx context.Context, address xc.Address) (xc.AmountBlockchain, error)
FetchNativeBalance fetches account balance for a Cosmos address
func (*Client) FetchTxInfo ¶
FetchTxInfo returns tx info for a Cosmos tx
func (*Client) FetchTxInput ¶
func (client *Client) FetchTxInput(ctx context.Context, from xc.Address, _ xc.Address) (xc.TxInput, error)
FetchTxInput returns tx input for a Cosmos tx
func (*Client) GetAccount ¶ added in v0.2.0
GetAccount returns a Cosmos account Equivalent to client.Ctx.AccountRetriever.GetAccount(), but doesn't rely GetConfig()
func (*Client) RegisterEstimateGasCallback ¶ added in v0.3.0
func (client *Client) RegisterEstimateGasCallback(fn xc.EstimateGasFunc)
RegisterEstimateGasCallback registers a callback to get gas price
type EncodingConfig ¶ added in v0.3.0
type EncodingConfig struct { InterfaceRegistry codectypes.InterfaceRegistry Marshaler codec.Codec TxConfig client.TxConfig Amino *codec.LegacyAmino }
EncodingConfig specifies the concrete encoding types to use for a given app. This is provided for compatibility between protobuf and amino implementations.
func MakeCosmosConfig ¶ added in v0.3.0
func MakeCosmosConfig() EncodingConfig
func MakeEncodingConfig ¶ added in v0.3.0
func MakeEncodingConfig() EncodingConfig
MakeEncodingConfig creates an EncodingConfig for testing
func NewEncodingConfig ¶ added in v0.3.0
func NewEncodingConfig() EncodingConfig
type Signer ¶
Signer for Cosmos
func (Signer) ImportPrivateKey ¶ added in v0.2.0
func (signer Signer) ImportPrivateKey(privateKeyOrMnemonic string) (xc.PrivateKey, error)
ImportPrivateKey imports a Cosmos private key
func (Signer) Sign ¶
func (signer Signer) Sign(privateKeyBytes xc.PrivateKey, data xc.TxDataToSign) (xc.TxSignature, error)
Sign a Cosmos tx
type Tx ¶
type Tx struct { CosmosTx types.Tx ParsedTransfers []types.Msg // aux fields CosmosTxBuilder client.TxBuilder CosmosTxEncoder types.TxEncoder SigsV2 []signingtypes.SignatureV2 TxDataToSign []byte }
Tx for Cosmos
func (Tx) AddSignatures ¶ added in v0.3.0
func (tx Tx) AddSignatures(signatures ...xc.TxSignature) error
AddSignatures adds a signature to Tx
func (Tx) Amount ¶ added in v0.2.0
func (tx Tx) Amount() xc.AmountBlockchain
Amount returns the amount of a Tx
func (Tx) ContractAddress ¶ added in v0.2.0
func (tx Tx) ContractAddress() xc.ContractAddress
ContractAddress returns the contract address of a Tx, if any
func (Tx) Destinations ¶ added in v0.3.0
func (tx Tx) Destinations() []*xc.TxInfoEndpoint
Destinations returns the destinations of a Tx
func (*Tx) ParseTransfer ¶ added in v0.2.0
func (tx *Tx) ParseTransfer()
ParseTransfer parses a Tx as a transfer Currently only banktypes.MsgSend is implemented, i.e. only native tokens
func (Tx) Sighashes ¶ added in v0.3.0
func (tx Tx) Sighashes() ([]xc.TxDataToSign, error)
Sighashes returns the tx payload to sign, aka sighash
func (Tx) Sources ¶ added in v0.3.0
func (tx Tx) Sources() []*xc.TxInfoEndpoint
Sources returns the sources of a Tx
type TxBuilder ¶
type TxBuilder struct { xc.TxBuilder Asset xc.ITask CosmosTxConfig client.TxConfig CosmosTxBuilder client.TxBuilder }
TxBuilder for Cosmos
func (TxBuilder) NewNativeTransfer ¶
func (txBuilder TxBuilder) NewNativeTransfer(from xc.Address, to xc.Address, amount xc.AmountBlockchain, input xc.TxInput) (xc.Tx, error)
NewNativeTransfer creates a new transfer for a native asset
type TxInput ¶
type TxInput struct { xc.TxInputEnvelope AccountNumber uint64 Sequence uint64 GasLimit uint64 GasPrice float64 Memo string FromPublicKey []byte }
TxInput for Cosmos
func NewTxInput ¶ added in v0.3.0
func NewTxInput() *TxInput
NewTxInput returns a new Cosmos TxInput