Documentation
¶
Index ¶
- Variables
- func CheckMnemonic(mnemonic string) error
- func GenerateMnemonic(entropy int) string
- func NewErrWalletExits(path string) error
- func OptionFee(fee int64) func(builder *txBuilder) error
- func OptionMemo(memo string) func(builder *txBuilder) error
- func OptionSequence(seq int32) func(builder *txBuilder) error
- func OptionStamp(stamp string) func(builder *txBuilder) error
- type ErrWalletExits
- type HistoryInfo
- type TxOption
- type Wallet
- func (w *Wallet) AccountSequence(addrStr string) (int32, error)
- func (w *Wallet) AddTransaction(id tx.ID) error
- func (w *Wallet) AddressCount() int
- func (w *Wallet) AddressInfo(addr string) *vault.AddressInfo
- func (w *Wallet) AddressLabels() []vault.AddressInfo
- func (w *Wallet) Balance(addrStr string) (int64, error)
- func (w *Wallet) BroadcastTransaction(trx *tx.Tx) (string, error)
- func (w *Wallet) CalculateFee(amount int64) int64
- func (w *Wallet) Connect(addr string) error
- func (w *Wallet) Contains(addr string) bool
- func (w *Wallet) DeriveNewAddress(label string) (string, error)
- func (w *Wallet) GetHistory(addr string) []HistoryInfo
- func (w *Wallet) ImportPrivateKey(password string, prv crypto.PrivateKey) error
- func (w *Wallet) IsEncrypted() bool
- func (w *Wallet) IsOffline() bool
- func (w *Wallet) Label(addr string) string
- func (w *Wallet) MakeBondTx(sender, receiver, pubKey string, amount int64, options ...TxOption) (*tx.Tx, error)
- func (w *Wallet) MakeTransferTx(sender, receiver string, amount int64, options ...TxOption) (*tx.Tx, error)
- func (w *Wallet) MakeUnbondTx(addr string, opts ...TxOption) (*tx.Tx, error)
- func (w *Wallet) MakeWithdrawTx(sender, receiver string, amount int64, options ...TxOption) (*tx.Tx, error)
- func (w *Wallet) Mnemonic(password string) (string, error)
- func (w *Wallet) Name() string
- func (w *Wallet) Path() string
- func (w *Wallet) PrivateKey(password, addr string) (crypto.PrivateKey, error)
- func (w *Wallet) PrivateKeys(password string, addrs []string) ([]crypto.PrivateKey, error)
- func (w *Wallet) Save() error
- func (w *Wallet) SetLabel(addr, label string) error
- func (w *Wallet) SignTransaction(password string, trx *tx.Tx) error
- func (w *Wallet) Stake(addrStr string) (int64, error)
- func (w *Wallet) UpdatePassword(oldPassword, newPassword string) error
- func (w *Wallet) ValidatorSequence(addrStr string) (int32, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCRC describes an error in which the wallet CRC is invalid. ErrInvalidCRC = errors.New("invalid CRC") // ErrInvalidNetwork describes an error in which the network is invalid. ErrInvalidNetwork = errors.New("invalid network") // ErrOffline describes an error in which the wallet is offline. ErrOffline = errors.New("wallet is in offline mode") // ErrHistoryExists describes an error in which the transaction already exists // in history. ErrHistoryExists = errors.New("transaction already exists") )
Functions ¶
func CheckMnemonic ¶ added in v0.13.0
CheckMnemonic is a wrapper for `vault.CheckMnemonic`
func GenerateMnemonic ¶
GenerateMnemonic is a wrapper for `vault.GenerateMnemonic`.
func NewErrWalletExits ¶
func OptionMemo ¶
func OptionSequence ¶
func OptionStamp ¶
Types ¶
type ErrWalletExits ¶
type ErrWalletExits struct {
Path string
}
ErrWalletExits describes an error in which a wallet exists in the given path.
func (ErrWalletExits) Error ¶
func (e ErrWalletExits) Error() string
type HistoryInfo ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func Open ¶ added in v0.10.0
Open tries to open a wallet at the given path. If the wallet doesn’t exist on this path, it returns an error. A wallet can be opened in offline or online modes. Offline wallet doesn’t have any connection to any node. Online wallet has a connection to one of the pre-defined servers.
func (*Wallet) AccountSequence ¶ added in v0.10.0
AccountSequence returns the sequence of the account associated with the address.
func (*Wallet) AddressCount ¶
AddressCount returns the number of addresses inside the wallet.
func (*Wallet) AddressInfo ¶
func (w *Wallet) AddressInfo(addr string) *vault.AddressInfo
func (*Wallet) AddressLabels ¶
func (w *Wallet) AddressLabels() []vault.AddressInfo
func (*Wallet) BroadcastTransaction ¶
func (*Wallet) CalculateFee ¶
TODO: query fee from grpc client
func (*Wallet) GetHistory ¶
func (w *Wallet) GetHistory(addr string) []HistoryInfo
func (*Wallet) ImportPrivateKey ¶
func (w *Wallet) ImportPrivateKey(password string, prv crypto.PrivateKey) error
func (*Wallet) IsEncrypted ¶
func (*Wallet) MakeBondTx ¶
func (w *Wallet) MakeBondTx(sender, receiver, pubKey string, amount int64, options ...TxOption) (*tx.Tx, error)
MakeBondTx creates a new bond transaction based on the given parameters.
func (*Wallet) MakeTransferTx ¶ added in v0.13.0
func (w *Wallet) MakeTransferTx(sender, receiver string, amount int64, options ...TxOption) (*tx.Tx, error)
MakeTransferTx creates a new transfer transaction based on the given parameters.
func (*Wallet) MakeUnbondTx ¶
MakeUnbondTx creates a new unbond transaction based on the given parameters.
func (*Wallet) MakeWithdrawTx ¶
func (w *Wallet) MakeWithdrawTx(sender, receiver string, amount int64, options ...TxOption) (*tx.Tx, error)
MakeWithdrawTx creates a new withdraw transaction based on the given parameters.
func (*Wallet) PrivateKey ¶
func (w *Wallet) PrivateKey(password, addr string) (crypto.PrivateKey, error)