wallet

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EthereumWallet

type EthereumWallet struct {
	// contains filtered or unexported fields
}

EthereumWallet is a wallet with ethereum private key

func NewEthereumWalletFromHDWallet

func NewEthereumWalletFromHDWallet(hdWallet *HDWallet) (*EthereumWallet, error)

func NewEthereumWalletFromKey

func NewEthereumWalletFromKey(key *bip32.Key) (*EthereumWallet, error)

func (*EthereumWallet) Address

func (w *EthereumWallet) Address() common.Address

Address the address of this ethereum wallet

func (*EthereumWallet) PersonalSign

func (w *EthereumWallet) PersonalSign(data []byte) ([]byte, error)

PersonalSign use personal sign to sign any data

func (*EthereumWallet) PersonalSignString

func (w *EthereumWallet) PersonalSignString(s string) ([]byte, error)

PersonalSignString use personal sign to sign a custom string message

func (*EthereumWallet) PrivateKey

func (w *EthereumWallet) PrivateKey() *ecdsa.PrivateKey

PrivateKey the private key of this ethereum wallet

func (*EthereumWallet) PublicKey

func (w *EthereumWallet) PublicKey() ecdsa.PublicKey

PublicKey the public key of this ethereum wallet

func (*EthereumWallet) Sign

func (w *EthereumWallet) Sign(data []byte) ([]byte, error)

Sign a transaction data

type HDWallet

type HDWallet struct {
	// contains filtered or unexported fields
}

HDWallet represents a Hierarchical deterministic wallet

func NewHDWallet

func NewHDWallet(mnemonic *bip39.Mnemonic) (*HDWallet, error)

NewHDWallet creates a HDWallet with specified mnemonic and a passphrase

func NewHDWalletPassphrase

func NewHDWalletPassphrase(mnemonic *bip39.Mnemonic, passphrase string) (*HDWallet, error)

NewHDWalletPassphrase creates a HDWallet with specified mnemonic and a passphrase

func (*HDWallet) KeyForCoin

func (m *HDWallet) KeyForCoin(coin, account, change, address uint32) (key *bip32.Key, err error)

KeyForCoin derive a private key from coin, account, change and address index.

func (*HDWallet) KeyForDeriveParams

func (m *HDWallet) KeyForDeriveParams(params *bip44.DerivePathParams) (key *bip32.Key, err error)

KeyForDeriveParams derive a private key from specified DerivePathParams.

func (*HDWallet) KeyForDerivePath

func (m *HDWallet) KeyForDerivePath(path bip44.DerivePath) (*bip32.Key, error)

KeyForDerivePath derive a private key from specified DerivePath.

Jump to

Keyboard shortcuts

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