Documentation
¶
Overview ¶
Copyright (C) 2025, Lux Industries Inc. All rights reserved. See the file LICENSE for licensing terms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keychain ¶
func NewKeychain ¶
func NewKeychain( network network.Network, keyPath string, ledgerInfo *LedgerParams, ) (*Keychain, error)
NewKeychain generates a new key pair from either a stored key path or Ledger. For stored keys, NewKeychain will generate a new key pair in the provided keyPath if no .pk file currently exists in the provided path.
func (*Keychain) AddLedgerAddresses ¶
func (*Keychain) AddLedgerFunds ¶
func (*Keychain) AddLedgerIndices ¶
func (*Keychain) LedgerEnabled ¶
type Ledger ¶
type Ledger struct {
// LedgerDevice is the main interface of interacting with the Ledger Device
LedgerDevice *ledger.LedgerDevice
// LedgerIndices contain indexes of the addresses selected from Ledger
LedgerIndices []uint32
}
Ledger is part of the output of NewKeyChain if a new keychain is to be created using Ledger
type LedgerParams ¶
type LedgerParams struct {
// LedgerAddresses specify which addresses in Ledger should be in the Keychain
// NewKeyChain will then look for the indexes of the specified addresses and add the indexes
// into LedgerIndices in Ledger
LedgerAddresses []string
// RequiredFunds is the minimum total LUX that the selected addresses from Ledger should contain.
// NewKeychain will then look through all indexes of all addresses in the Ledger until
// sufficient LUX balance is reached.
// For example if Ledger's index 0 and index 1 each contains 0.1 LUX and RequiredFunds is
// 0.2 LUX, LedgerIndices will have value of [0,1]
RequiredFunds uint64
}
LedgerParams is an input to NewKeyChain if a new keychain is to be created using Ledger
To view Ledger addresses and their balances, you can use Lux CLI and use the command lux key list --ledger [0,1,2,3,4] The example command above will list the first five addresses in your Ledger
To transfer funds between addresses in Ledger, refer to https://docs.lux.network/tooling/cli-transfer-funds/how-to-transfer-funds