app

package
v0.3.7-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AccNormal  = "normal"
	AccValoper = "valoper"
	AccAll     = "all"
)
View Source
const (
	RAW    = "raw"
	DETAIL = "detail"
	HASH   = "hash"
	SHARES = "shares"
	TOKEN  = "token"
)

Variables

This section is empty.

Functions

func AmtToBaseCoin

func AmtToBaseCoin(amt string) (sdktypes.Coin, error)

Convert token to base Coin amount Wraps around ParseCoinNormalized

func AmtToBaseStr

func AmtToBaseStr(amt string) string

Convert amount to base denom anmount (string)

func AmtToTokenDecCoin

func AmtToTokenDecCoin(amt string) (sdktypes.DecCoin, error)

Convert base denom to token DecCoin amount

func AmtToTokenStr

func AmtToTokenStr(amt string) string

Convert amount to token amount (string)

func CheckBalances

func CheckBalances(address string)

Check balance method

func ConvertAmt

func ConvertAmt(amt string, targetDenom string) string

Convert amount to specified denom amount

func GetBalance

func GetBalance(address string) (sdktypes.Coin, error)

Get Balances (first denom) to string amount

func GetBalancesQuery

func GetBalancesQuery(address string) (*types.BalancesQuery, error)

Get Balances Query

func GetCommission

func GetCommission(valopAddress string) (sdktypes.Coin, error)

Get commissions (first denom) to decimal amount

func GetDelegationAmountShares

func GetDelegationAmountShares(address, valopAddress string) (sdktypes.Coin, string, error)

Get Delegation Amount

func GetRewards

func GetRewards(address string) (*types.RewardsQuery, error)

Parse rewards

func GetValidator

func GetValidator(search string) (string, string)

Search validators by moniker or valoper-address

func GetValidatorsQuery

func GetValidatorsQuery() (*types.ValidatorsQuery, error)

Query Validators

func ImportFromKeyring

func ImportFromKeyring(l *Accounts, keyring string) (int, error)

Import addresses from keyring

func IsNormalAddress

func IsNormalAddress(address string) bool

Checks if address is a wallet account

func IsSelfDelegate

func IsSelfDelegate(address string, valoperAddress string) bool

Simple check if address is self-delegate for validator 1tman8gcu0d8rn7md6q9qdxme0dp74yv3 33 matching characters after the prefix

func IsValidAddress

func IsValidAddress(address string) bool

Checks if address is valid

func IsValidatorAddress

func IsValidatorAddress(address string) bool

Checks if address is a validator account

func NormalizeAmountDenom

func NormalizeAmountDenom(amtstr string) (string, error)

func OutputAmount

func OutputAmount(out io.Writer, name, address string, baseAmount string, outType string)

func PrettifyAmount

func PrettifyAmount(amount string) string

func PrettifyBaseAmt

func PrettifyBaseAmt(amt string) string

Insert separator for non-decimal numbers as output

func PrettifyTokenAmt

func PrettifyTokenAmt(amt string, numDecimals int) string

Parse decimal string to fixed number of digits after the decimal point.

func QueryCommission

func QueryCommission(valopAddress string) (*types.CommissionsQuery, error)

Parse commissions for validator

func QueryDelegation

func QueryDelegation(address, valopAddress string) (*types.DelegationQuery, error)

Query delegation

func QueryKeyringAddress

func QueryKeyringAddress(name, keyring string) string

Query Keyring for address

func ShortAddress

func ShortAddress(address string) string

func StrSplitAmountDenom

func StrSplitAmountDenom(amtstr string) (string, string, error)

Split denominated amount to amount and denom

func TxDelegateToValidator

func TxDelegateToValidator(out io.Writer, delegator string, valAddress string, amount string, auto bool, keyring, outType string) (string, error)

Delegate to validator method

func TxSend

func TxSend(out io.Writer, fromAddress string, toAddress string, amount string, auto bool, keyring, outType string) (string, error)

Send tokens between accounts method

func TxWithdrawRewards

func TxWithdrawRewards(out io.Writer, name string, auto bool, keyring, outType string) (string, error)

Withdraw all rewards method

func TxWithdrawValidatorCommission

func TxWithdrawValidatorCommission(out io.Writer, name string, valoperAddress string, auto bool, keyring, outType string) (string, error)

Withdraw all rewards method

Types

type Account

type Account struct {
	Alias   string
	Address string
}

type Accounts

type Accounts []Account

func GetKeyringAccounts

func GetKeyringAccounts(keyring string) (Accounts, error)

Get keyring name and addresses

func (*Accounts) Add

func (l *Accounts) Add(alias string, address string) error

Add method creates a new account and appends it to the list of Accounts

func (*Accounts) Delete

func (l *Accounts) Delete(alias string) error

Delete account from list with matching alias

func (*Accounts) DeleteIndex

func (l *Accounts) DeleteIndex(idx int) error

Delete account from the list with matching index

func (*Accounts) GetAddress

func (l *Accounts) GetAddress(alias string) string

Get address for given alias

func (*Accounts) GetIndex

func (l *Accounts) GetIndex(alias string) int

Get index for given alias

func (*Accounts) GetIndexAddress

func (l *Accounts) GetIndexAddress(alias string) (int, string)

Get index for given alias

func (*Accounts) ListFiltered

func (l *Accounts) ListFiltered(accountType string, addressOnly bool) string

func (*Accounts) Load

func (l *Accounts) Load(filealias string) error

Load accounts from JSON file

func (*Accounts) Modify

func (l *Accounts) Modify(idx int, alias string, address string) error

Modify account details with matching index

func (*Accounts) Save

func (l *Accounts) Save(filename string) error

Save accounts in JSON format

func (*Accounts) String

func (l *Accounts) String() string

Lists accounts

Jump to

Keyboard shortcuts

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