keychain

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

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

type Keychain struct {
	keychain.Keychain

	Ledger *Ledger
	// contains filtered or unexported fields
}

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 (kc *Keychain) AddLedgerAddresses(addresses []string) error

func (*Keychain) AddLedgerFunds

func (kc *Keychain) AddLedgerFunds(amount uint64) error

func (*Keychain) AddLedgerIndices

func (kc *Keychain) AddLedgerIndices(indices []uint32) error

func (*Keychain) LedgerEnabled

func (kc *Keychain) LedgerEnabled() bool

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

Jump to

Keyboard shortcuts

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