Documentation ¶
Index ¶
- Constants
- Variables
- func NewSeed(mnemonic, password, language string) ([]byte, error)
- func PathNumber(str string) uint32
- type AddressType
- type Btc
- type Key
- type KeyOption
- type KeyOptionFunc
- func AccountFunc(a uint32) KeyOptionFunc
- func AddressIndexFunc(a uint32) KeyOptionFunc
- func ChangeFunc(c uint32) KeyOptionFunc
- func CoinTypeFunc(c uint32) KeyOptionFunc
- func LanguageFunc(l string) KeyOptionFunc
- func MnemonicFunc(m string) KeyOptionFunc
- func ParamsFunc(p *chaincfg.Params) KeyOptionFunc
- func PasswordFunc(p string) KeyOptionFunc
- func PathFunc(path string) KeyOptionFunc
- func PurposeFunc(p uint32) KeyOptionFunc
- func SeedFunc(s []byte) KeyOptionFunc
- type Wallet
Constants ¶
View Source
const ( English = "english" ChineseSimplified = "chinese_simplified" ChineseTraditional = "chinese_traditional" )
View Source
const ( Zero uint32 = 0 ZeroQuote uint32 = 0x80000000 BTCToken uint32 = 0x10000000 ETHToken uint32 = 0x20000000 )
View Source
const ( // https://github.com/satoshilabs/slips/blob/master/slip-0044.md#registered-coin-types BTC = ZeroQuote + 0 BTCTestnet = ZeroQuote + 1 LTC = ZeroQuote + 2 DOGE = ZeroQuote + 3 DASH = ZeroQuote + 5 ETH = ZeroQuote + 60 ETC = ZeroQuote + 61 BCH = ZeroQuote + 145 )
wallet type from bip44
Variables ¶
View Source
var ( DefaultParams = &BTCParams DefaultPassword = "" DefaultLanguage = English DefaultPurpose = ZeroQuote + 44 DefaultCoinType = BTC DefaultAccount = ZeroQuote DefaultChange = Zero DefaultAddressIndex = Zero )
View Source
var ( BTCParams = chaincfg.MainNetParams BTCTestnetParams = chaincfg.TestNet3Params LTCParams = chaincfg.MainNetParams DOGEParams = chaincfg.MainNetParams DASHParams = chaincfg.MainNetParams BCHParams = chaincfg.MainNetParams )
View Source
var ( BTCLegacy = AddressType(0) BTCTaproot = AddressType(1) BTCNativeSegwit = AddressType(2) BTCNestedSegwit = AddressType(3) )
Functions ¶
Types ¶
type AddressType ¶
type AddressType uint32
func (AddressType) EqualTo ¶
func (a AddressType) EqualTo(t AddressType) bool
type Btc ¶
type Btc struct { AddressType AddressType // contains filtered or unexported fields }
func (*Btc) AddressWithType ¶
func (b *Btc) AddressWithType(addressType AddressType) string
type Key ¶
type Key struct { Opt *KeyOption Extended *hdkeychain.ExtendedKey // btc Private *btcec.PrivateKey Public *btcec.PublicKey // eth PrivateECDSA *ecdsa.PrivateKey PublicECDSA *ecdsa.PublicKey }
func NewMasterKey ¶
func NewMasterKey(opts ...KeyOptionFunc) (*Key, error)
func (*Key) AddressBTC ¶
func (*Key) AddressP2WPKH ¶
func (*Key) AddressP2WPKHInP2SH ¶
func (*Key) GetChildrenKey ¶
func (k *Key) GetChildrenKey(opts ...KeyOptionFunc) (*Key, error)
func (*Key) PublicHash ¶
type KeyOption ¶
type KeyOption struct { Params *chaincfg.Params Mnemonic string Password string Language string Seed []byte // bip44 Purpose uint32 CoinType uint32 Account uint32 Change uint32 AddressIndex uint32 }
func (*KeyOption) GetPath ¶
GetPath https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#path-levels
func (*KeyOption) GetPathString ¶
type KeyOptionFunc ¶
type KeyOptionFunc func(option *KeyOption)
func AccountFunc ¶
func AccountFunc(a uint32) KeyOptionFunc
func AddressIndexFunc ¶
func AddressIndexFunc(a uint32) KeyOptionFunc
func ChangeFunc ¶
func ChangeFunc(c uint32) KeyOptionFunc
func CoinTypeFunc ¶
func CoinTypeFunc(c uint32) KeyOptionFunc
func LanguageFunc ¶
func LanguageFunc(l string) KeyOptionFunc
func MnemonicFunc ¶
func MnemonicFunc(m string) KeyOptionFunc
func ParamsFunc ¶
func ParamsFunc(p *chaincfg.Params) KeyOptionFunc
func PasswordFunc ¶
func PasswordFunc(p string) KeyOptionFunc
func PathFunc ¶
func PathFunc(path string) KeyOptionFunc
func PurposeFunc ¶
func PurposeFunc(p uint32) KeyOptionFunc
func SeedFunc ¶
func SeedFunc(s []byte) KeyOptionFunc
type Wallet ¶
type Wallet interface { Type() uint32 Name() string Symbol() string Address() string // contains filtered or unexported methods }
func NewBTCFromKey ¶
func NewBTCFromKey(key *Key, addressType AddressType) Wallet
Click to show internal directories.
Click to hide internal directories.