wallet

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: GPL-3.0 Imports: 3 Imported by: 23

Documentation

Index

Constants

View Source
const (
	DefaultNodeKeyPath       = "m/44'/60'/0'/0/%d"
	LedgerLiveNodeKeyPath    = "m/44'/60'/%d/0/0"
	MyEtherWalletNodeKeyPath = "m/44'/60'/0'/%d"
)

Variables

This section is empty.

Functions

func GetDerivationPath added in v0.3.0

func GetDerivationPath(pathType DerivationPath) (string, error)

Convert a derivation path type to an actual path value

func IsWalletReady

func IsWalletReady(status WalletStatus) bool

Check if the node wallet is ready for transacting

Types

type DerivationPath

type DerivationPath string
const (
	DerivationPath_Default    DerivationPath = ""
	DerivationPath_LedgerLive DerivationPath = "ledger-live"
	DerivationPath_Mew        DerivationPath = "mew"
)

type HardwareWalletData

type HardwareWalletData struct {
}

Placeholder for hardware wallets

type LocalWalletData

type LocalWalletData struct {
	// Encrypted seed information
	Crypto map[string]any `json:"crypto"`

	// Name of the encryptor used to generate the keystore
	Name string `json:"name"`

	// Version of the encryptor used to generate the keystore
	Version uint `json:"version"`

	// Unique ID for this keystore
	UUID uuid.UUID `json:"uuid"`

	// The path that should be used to derive the target key; assumes there's only one index that can be iterated on
	DerivationPath string `json:"derivationPath,omitempty"`

	// The index of the target wallet, used to format DerivationPath
	WalletIndex uint `json:"walletIndex,omitempty"`
}

Keystore for local node wallets - note that this is NOT an EIP-2335 keystore.

type WalletData

type WalletData struct {
	// The type of wallet
	Type WalletType `json:"type"`

	// Data about a local wallet
	LocalData LocalWalletData `json:"localData"`

	// Data about a hardware wallet
	HardwareData HardwareWalletData `json:"hardwareData"`
}

Data storage for node wallets

type WalletStatus

type WalletStatus struct {
	Address struct {
		NodeAddress common.Address `json:"nodeAddress"`
		HasAddress  bool           `json:"hasAddress"`
	} `json:"address"`

	Wallet struct {
		Type          WalletType     `json:"type"`
		IsLoaded      bool           `json:"isLoaded"`
		IsOnDisk      bool           `json:"isOnDisk"`
		WalletAddress common.Address `json:"walletAddress"`
	} `json:"wallet"`

	Password struct {
		IsPasswordSaved bool `json:"isPasswordSaved"`
	} `json:"password"`
}

type WalletType

type WalletType string

An enum describing the type of wallet used by the node

const (
	// Unset wallet type
	WalletType_Unknown WalletType = ""

	// Indicator for local wallets that have encrypted keystores saved to disk
	WalletType_Local WalletType = "local"

	// Indicator for hardware wallets that store the private key offline
	WalletType_Hardware WalletType = "hardware"
)

Jump to

Keyboard shortcuts

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