Documentation ¶
Index ¶
- Constants
- func BuildAnnotatedInput(tx *types.Tx, i uint32) *query.AnnotatedInput
- func BuildAnnotatedOutput(tx *types.Tx, idx int) *query.AnnotatedOutput
- type AccountBalance
- type KeyInfo
- type StatusInfo
- type Summary
- type TxSummary
- type Wallet
- func (w *Wallet) ExportAccountPrivKey(xpub chainkd.XPub, auth string) (*string, error)
- func (w *Wallet) GetAccountBalances(id string) []AccountBalance
- func (w *Wallet) GetAccountUTXOs(id string) []account.UTXO
- func (w *Wallet) GetRescanStatus() ([]KeyInfo, error)
- func (w *Wallet) GetTransactionByTxID(txID string) (*query.AnnotatedTx, error)
- func (w *Wallet) GetTransactionsByAccountID(accountID string) ([]*query.AnnotatedTx, error)
- func (w *Wallet) GetTransactionsByTxID(txID string) ([]*query.AnnotatedTx, error)
- func (w *Wallet) GetTransactionsSummary(transactions []*query.AnnotatedTx) []TxSummary
- func (w *Wallet) ImportAccountPrivKey(xprv chainkd.XPrv, keyAlias, auth string, index uint64, accountAlias string) (*pseudohsm.XPub, error)
- func (w *Wallet) ImportAccountXpubKey(xpubIndex int, xpub pseudohsm.XPub, cpIndex uint64) error
Constants ¶
const ( //TxPrefix is wallet database transactions prefix TxPrefix = "TXS:" //TxIndexPrefix is wallet database tx index prefix TxIndexPrefix = "TID:" )
const RecoveryIndex = 5000
RecoveryIndex walletdb recovery cp number
const SINGLE = 1
SINGLE single sign
Variables ¶
This section is empty.
Functions ¶
func BuildAnnotatedInput ¶
func BuildAnnotatedInput(tx *types.Tx, i uint32) *query.AnnotatedInput
BuildAnnotatedInput build the annotated input.
func BuildAnnotatedOutput ¶
func BuildAnnotatedOutput(tx *types.Tx, idx int) *query.AnnotatedOutput
BuildAnnotatedOutput build the annotated output.
Types ¶
type AccountBalance ¶ added in v0.4.3
type AccountBalance struct { AccountID string `json:"account_id"` Alias string `json:"account_alias"` AssetAlias string `json:"asset_alias"` AssetID string `json:"asset_id"` Amount uint64 `json:"amount"` }
AccountBalance account balance
type KeyInfo ¶
type KeyInfo struct { Alias string `json:"alias"` XPub chainkd.XPub `json:"xpub"` Percent uint8 `json:"percent"` Complete bool `json:"complete"` }
KeyInfo is key import status
type StatusInfo ¶
StatusInfo is base valid block info to handle orphan block rollback
type Summary ¶
type Summary struct { Type string `json:"type"` AssetID bc.AssetID `json:"asset_id,omitempty"` AssetAlias string `json:"asset_alias,omitempty"` Amount uint64 `json:"amount,omitempty"` AccountID string `json:"account_id,omitempty"` AccountAlias string `json:"account_alias,omitempty"` Arbitrary chainjson.HexBytes `json:"arbitrary,omitempty"` }
Summary is the struct of transaction's input and output summary
type TxSummary ¶
type TxSummary struct { ID bc.Hash `json:"tx_id"` Timestamp uint64 `json:"block_time"` Inputs []Summary `json:"inputs"` Outputs []Summary `json:"outputs"` }
TxSummary is the struct of transaction summary
type Wallet ¶
type Wallet struct { DB db.DB AccountMgr *account.Manager AssetReg *asset.Registry Hsm *pseudohsm.HSM ImportPrivKey bool // contains filtered or unexported fields }
Wallet is related to storing account unspent outputs
func NewWallet ¶
func NewWallet(walletDB db.DB, account *account.Manager, asset *asset.Registry, hsm *pseudohsm.HSM, chain *protocol.Chain) (*Wallet, error)
NewWallet return a new wallet instance
func (*Wallet) ExportAccountPrivKey ¶
ExportAccountPrivKey exports the account private key as a WIF for encoding as a string in the Wallet Import Formt.
func (*Wallet) GetAccountBalances ¶
func (w *Wallet) GetAccountBalances(id string) []AccountBalance
GetAccountBalances return all account balances
func (*Wallet) GetAccountUTXOs ¶
GetAccountUTXOs return all account unspent outputs
func (*Wallet) GetRescanStatus ¶
GetRescanStatus return key import rescan status
func (*Wallet) GetTransactionByTxID ¶
func (w *Wallet) GetTransactionByTxID(txID string) (*query.AnnotatedTx, error)
GetTransactionByTxID get transaction by txID
func (*Wallet) GetTransactionsByAccountID ¶
func (w *Wallet) GetTransactionsByAccountID(accountID string) ([]*query.AnnotatedTx, error)
GetTransactionsByAccountID get account txs by account ID
func (*Wallet) GetTransactionsByTxID ¶
func (w *Wallet) GetTransactionsByTxID(txID string) ([]*query.AnnotatedTx, error)
GetTransactionsByTxID get account txs by account tx ID
func (*Wallet) GetTransactionsSummary ¶
func (w *Wallet) GetTransactionsSummary(transactions []*query.AnnotatedTx) []TxSummary
GetTransactionsSummary get transactions summary