Documentation
¶
Index ¶
- Constants
- func AccAddressFromBech32(address string, addressPrefix string) (sdk.AccAddress, error)
- func Bech32FromAccAddress(address []byte, addressPrefix string) (string, error)
- func EncodePublicKeyToAddress(publicKey string, addressPrefix string) (string, error)
- func IsValidAddress(address string, addressPrefix string) bool
- type Account
- func (a *Account) Address() string
- func (a *Account) PrivateKey() ([]byte, error)
- func (a *Account) PrivateKeyHex() (string, error)
- func (a *Account) PublicKey() []byte
- func (a *Account) PublicKeyHex() string
- func (a *Account) Sign(message []byte, password string) ([]byte, error)
- func (a *Account) SignHex(messageHex string, password string) (*base.OptionalString, error)
- type AccountInfo
- type Chain
- func (c *Chain) AccountOf(address string) (*AccountInfo, error)
- func (c *Chain) BalanceOfAccount(account base.Account) (*base.Balance, error)
- func (c *Chain) BalanceOfAddress(address string) (*base.Balance, error)
- func (c *Chain) BalanceOfAddressAndDenom(address, denom string) (b *base.Balance, err error)
- func (c *Chain) BalanceOfPublicKey(publicKey string) (*base.Balance, error)
- func (c *Chain) BatchFetchTransactionStatus(hashListString string) string
- func (c *Chain) DenomToken(prefix, denom string) *Token
- func (c *Chain) FetchTransactionDetail(hash string) (detail *base.TransactionDetail, err error)
- func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
- func (c *Chain) GetClient() (*tendermintHttp.HTTP, error)
- func (c *Chain) MainToken() base.Token
- func (c *Chain) SendRawTransaction(signedTx string) (string, error)
- type Token
- func (t *Token) BalanceOfAccount(account base.Account) (*base.Balance, error)
- func (t *Token) BalanceOfAddress(address string) (*base.Balance, error)
- func (t *Token) BalanceOfPublicKey(publicKey string) (*base.Balance, error)
- func (t *Token) BuildTransferTx(privateKey, receiverAddress, gasPrice, gasLimit, amount, memo string) (string, error)
- func (t *Token) BuildTransferTxWithAccount(account *Account, receiverAddress, gasPrice, gasLimit, amount, memo string) (string, error)
- func (t *Token) Chain() base.Chain
- func (t *Token) TokenInfo() (*base.TokenInfo, error)
- type Util
Constants ¶
const ( // 0.01 GasPriceLow = "0.01" // 0.025 GasPriceAverage = "0.025" // 0.04 GasPriceHigh = "0.04" // 100000 GasLimitDefault = "100000" // 118 CosmosCointype = 118 // cosmos CosmosPrefix = "cosmos" // uatom CosmosAtomDenom = "uatom" // 330 TerraCointype = 330 // terra TerraPrefix = "terra" // uluna TerraLunaDenom = "uluna" // uusd TerraUSTDenom = "uusd" // 10 TerraGasPrice = "10" // 0.25 TerraGasPriceUST = "0.25" // 80000 TerraGasLimitDefault = "80000" )
Variables ¶
This section is empty.
Functions ¶
func AccAddressFromBech32 ¶
func AccAddressFromBech32(address string, addressPrefix string) (sdk.AccAddress, error)
func Bech32FromAccAddress ¶
func EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.
func IsValidAddress ¶
@param chainnet chain name
Types ¶
type Account ¶
type Account struct { Cointype int64 AddressPrefix string // contains filtered or unexported fields }
func NewAccountWithMnemonic ¶
func NewCosmosAccountWithMnemonic ¶
return NewAccountWithMnemonic(mnemonic, 118, "cosmos")
func NewTerraAccountWithMnemonic ¶
return NewAccountWithMnemonic(mnemonic, 330, "terra")
func (*Account) PrivateKeyHex ¶
@return privateKey string that will start with 0x.
func (*Account) PublicKeyHex ¶
The ethereum public key is same as address in coming @return publicKey string that will start with 0x.
type AccountInfo ¶
type Chain ¶
func NewChainWithRpc ¶
func (*Chain) BalanceOfAccount ¶
func (*Chain) BalanceOfAddress ¶
func (*Chain) BalanceOfAddressAndDenom ¶
func (*Chain) BalanceOfPublicKey ¶
Warning: Unable to use public key to query balance
func (*Chain) BatchFetchTransactionStatus ¶
Batch fetch the transaction status, the hash list and the return value, which can only be passed as strings separated by "," @param hashListString The hash of the transactions to be queried in batches, a string concatenated with ",": "hash1,hash2,hash3" @return Batch transaction status, its order is consistent with hashListString: "status1,status2,status3"
func (*Chain) DenomToken ¶
func (*Chain) FetchTransactionDetail ¶
func (c *Chain) FetchTransactionDetail(hash string) (detail *base.TransactionDetail, err error)
Fetch transaction details through transaction hash
func (*Chain) FetchTransactionStatus ¶
func (c *Chain) FetchTransactionStatus(hash string) base.TransactionStatus
Fetch transaction status through transaction hash
type Token ¶
func (*Token) BalanceOfAccount ¶
func (*Token) BalanceOfAddress ¶
func (*Token) BalanceOfPublicKey ¶
Warning: Unable to use public key to query balance
func (*Token) BuildTransferTx ¶
func (*Token) BuildTransferTxWithAccount ¶
type Util ¶
type Util struct {
AddressPrefix string
}
func NewUtilWithPrefix ¶
func (*Util) DecodeAddressToPublicKey ¶
@throw decode address to public key is not supported
func (*Util) EncodePublicKeyToAddress ¶
@param publicKey can start with 0x or not.