Documentation ¶
Index ¶
- Constants
- Variables
- func EntropyFromMnemonic(mnemonic string) (entropy string, err error)
- func GetAvailableCoinList() string
- func GetBuildTime() string
- func GetGitHash() string
- func GetVersion() string
- func MnemonicFromEntropy(entropy string) (mnemonic string, err error)
- func NewMnemonic() (mnemonic string, err error)
- func ValidateMnemonic(mnemonic string) (err error)
- type Wallet
- func BuildWalletFromMnemonic(mnemonic string, testNet bool, options *WalletOptions) (wallet *Wallet, err error)
- func BuildWalletFromPrivateKey(privateKey string, testNet bool, options WalletOptions) (wallet *Wallet, err error)
- func NewHDWalletFromMnemonic(mnemonic, password string, testNet bool) (w *Wallet, err error)
- func (c *Wallet) AddFlag(f string)
- func (c *Wallet) Bip39Seed() ([]byte, error)
- func (c Wallet) Clone(options *WalletOptions) (wallet *Wallet, err error)
- func (c Wallet) DecodeTx(symbol, msg string) (tx string, err error)
- func (c Wallet) DeriveAddress(symbol string) (address string, err error)
- func (c Wallet) DerivePrivateKey(symbol string) (privateKey string, err error)
- func (c Wallet) DerivePublicKey(symbol string) (publicKey string, err error)
- func (c *Wallet) HasFlag(flag string) bool
- func (c Wallet) Metadata(symbol string) (core.MetadataProvider, error)
- func (c Wallet) RawKey(symbol string) ([]byte, error)
- func (c Wallet) Sign(symbol, msg string) (sig string, err error)
- type WalletBuilder
- func (wb *WalletBuilder) SetMnemonic(mnemonic string) *WalletBuilder
- func (wb *WalletBuilder) SetPassword(password string) *WalletBuilder
- func (wb *WalletBuilder) SetShareAccountWithParentChain(shareAccountWithParentChain bool) *WalletBuilder
- func (wb *WalletBuilder) SetTestNet(testNet bool) *WalletBuilder
- func (wb *WalletBuilder) SetUseShortestPath(useShortestPath bool) *WalletBuilder
- func (wb *WalletBuilder) Wallet() (wallet *Wallet, err error)
- type WalletOption
- type WalletOptions
Constants ¶
const ( //FlagBBCUseStandardBip44ID BBC使用标准bip44 id (默认不是标准bip44 id) FlagBBCUseStandardBip44ID = "bbc_use_std_bip44_id" //FlagMKFUseBBCBip44ID MKF使用BBC的bip44 id (即MKF和BBC共用地址) FlagMKFUseBBCBip44ID = "mkf_use_bbc_bip44_id" // FlagBTCUseSegWitFormat BTC使用隔离见证地址 FlagBTCUseSegWitFormat = btc.FlagUseSegWitFormat )
Variables ¶
var ( // Debug 模式下会打印关键过程 Debug = false )
Functions ¶
func EntropyFromMnemonic ¶
EntropyFromMnemonic 根据 助记词, 获取 Entropy returns the input entropy used to generate the given mnemonic
func GetAvailableCoinList ¶
func GetAvailableCoinList() string
GetAvailableCoinList 获取支持币种列表 (case sensitive) return : "BTC LMC ETH WCG"
func GetBuildTime ¶
func GetBuildTime() string
func GetGitHash ¶
func GetGitHash() string
func GetVersion ¶
func GetVersion() string
func MnemonicFromEntropy ¶
MnemonicFromEntropy 根据 entropy, 获取对应助记词
func NewMnemonic ¶
NewMnemonic 生成助记词 默认使用128位密钥,生成12个单词的助记词
func ValidateMnemonic ¶
ValidateMnemonic 验证助记词的正确性
Types ¶
type Wallet ¶
type Wallet struct { bool // contains filtered or unexported fields }ShareAccountWithParentChain
Wallet all in one signer
func BuildWalletFromMnemonic ¶
func BuildWalletFromMnemonic(mnemonic string, testNet bool, options *WalletOptions) (wallet *Wallet, err error)
BuildWalletFromMnemonic create a Wallet instance with fixed args (here is mnemonic and testNet) and other options
func BuildWalletFromPrivateKey ¶
func BuildWalletFromPrivateKey(privateKey string, testNet bool, options WalletOptions) (wallet *Wallet, err error)
TODO not implemented BuildWallet create a Wallet instance with fixed args (here is privateKey and testNet) and other options
func NewHDWalletFromMnemonic ¶
NewHDWalletFromMnemonic 通过助记词得到一个 HD 对象
func (Wallet) Clone ¶
func (c Wallet) Clone(options *WalletOptions) (wallet *Wallet, err error)
Clone makes a copy of existing Wallet instance, with original attributes override by the given options
func (Wallet) DeriveAddress ¶
DeriveAddress 获取对应币种代号的 地址
func (Wallet) DerivePrivateKey ¶
DerivePrivateKey 获取对应币种代号的 私钥
func (Wallet) DerivePublicKey ¶
DerivePublicKey 获取对应币种代号的 公钥
type WalletBuilder ¶
type WalletBuilder struct {
// contains filtered or unexported fields
}
func NewWalletBuilder ¶
func NewWalletBuilder() *WalletBuilder
NewWalletBuilder normal builder pattern, not so good in golang
func (*WalletBuilder) SetMnemonic ¶
func (wb *WalletBuilder) SetMnemonic(mnemonic string) *WalletBuilder
func (*WalletBuilder) SetPassword ¶
func (wb *WalletBuilder) SetPassword(password string) *WalletBuilder
func (*WalletBuilder) SetShareAccountWithParentChain ¶
func (wb *WalletBuilder) SetShareAccountWithParentChain(shareAccountWithParentChain bool) *WalletBuilder
func (*WalletBuilder) SetTestNet ¶
func (wb *WalletBuilder) SetTestNet(testNet bool) *WalletBuilder
func (*WalletBuilder) SetUseShortestPath ¶
func (wb *WalletBuilder) SetUseShortestPath(useShortestPath bool) *WalletBuilder
func (*WalletBuilder) Wallet ¶
func (wb *WalletBuilder) Wallet() (wallet *Wallet, err error)
type WalletOption ¶
func WithPassword ¶
func WithPassword(password string) WalletOption
func WithPathFormat ¶
func WithPathFormat(pathFormat string) WalletOption
func WithShareAccountWithParentChain ¶
func WithShareAccountWithParentChain(shareAccountWithParentChain bool) WalletOption
type WalletOptions ¶
type WalletOptions struct {
// contains filtered or unexported fields
}
func (*WalletOptions) Add ¶
func (opts *WalletOptions) Add(opt WalletOption)