wallet

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriKeyType         = byte(0x0) // Serialize wallet account key into string with only PRIVATE KEY of account keyset
	PaymentAddressType = byte(0x1) // Serialize wallet account key into string with only PAYMENT ADDRESS of account keyset
	ReadonlyKeyType    = byte(0x2) // Serialize wallet account key into string with only READONLY KEY of account keyset
)

Variables

This section is empty.

Functions

func CreateImportMasterAccount

func CreateImportMasterAccount(mnemonic, passPhrase string) (*Wallet, *KeySerializedData, error)

func NewWordList

func NewWordList(language string) []string

Types

type AccountWallet

type AccountWallet struct {
	Name       string
	Key        KeyWallet
	Child      []AccountWallet
	IsImported bool
}

func CreateNewAccount

func CreateNewAccount() (*AccountWallet, error)

func CreateNewAccountByShardId

func CreateNewAccountByShardId(shardId int) (*AccountWallet, error)

func ImportAccount

func ImportAccount(privateKeyStr string, accountName string) (*AccountWallet, error)

type KeySerializedData

type KeySerializedData struct {
	PrivateKey     string `json:"PrivateKey"`
	PaymentAddress string `json:"PaymentAddress"`
	Pubkey         string `json:"Pubkey"` // in hex encode string
	ReadonlyKey    string `json:"ReadonlyKey"`
	ValidatorKey   string `json:"ValidatorKey"` // in base58check encode string
	ShardId        int    `json:"ShardId"`
}

type KeyWallet

type KeyWallet struct {
	Depth       byte   // 1 bytes
	ChildNumber []byte // 4 bytes
	ChainCode   []byte // 32 bytes
	KeySet      incognitokey.KeySet
}

KeyWallet represents with bip32 standard

func Base58CheckDeserialize

func Base58CheckDeserialize(data string) (*KeyWallet, error)

Base58CheckDeserialize deserializes a KeySet encoded in base58 encoding because data contains keyType and serialized data of corresponding key it returns KeySet just contain corresponding key

func NewMasterKey

func NewMasterKey(seed []byte) (*KeyWallet, error)

NewMasterKey creates a new master extended PubKey from a Seed Seed is a bytes array which any size

func (*KeyWallet) Base58CheckSerialize

func (key *KeyWallet) Base58CheckSerialize(keyType byte) string

Base58CheckSerialize encodes the key corresponding to keyType in KeySet in the standard Incognito base58 encoding It returns the encoding string of the key

func (*KeyWallet) NewChildKey

func (key *KeyWallet) NewChildKey(childIdx uint32) (*KeyWallet, error)

NewChildKey derives a Child KeyWallet from a given parent as outlined by bip32 2 child keys is derived from one key and a same child index are the same

func (*KeyWallet) Serialize

func (key *KeyWallet) Serialize(keyType byte) ([]byte, error)

Serialize receives keyType and serializes key which has keyType to bytes array and append 4-byte checksum into bytes array

type MnemonicGenerator

type MnemonicGenerator struct{}

func (*MnemonicGenerator) NewSeed

func (mnemonicGen *MnemonicGenerator) NewSeed(mnemonic string, password string) []byte

NewSeed creates a hashed Seed output given a provided string and password. No checking is performed to validate that the string provided is a valid Mnemonic.

type Wallet

type Wallet struct {
	Seed          []byte
	Entropy       []byte
	PassPhrase    string
	Mnemonic      string
	MasterAccount AccountWallet
	Name          string
	// contains filtered or unexported fields
}

func (Wallet) GetConfig

func (wallet Wallet) GetConfig() *WalletConfig

GetConfig returns configuration of wallet

type WalletConfig

type WalletConfig struct {
	DataDir        string
	DataFile       string
	DataPath       string
	IncrementalFee uint64
	ShardID        *byte //default is nil -> create account for any shard
}

Jump to

Keyboard shortcuts

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