store

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: LGPL-3.0 Imports: 9 Imported by: 19

Documentation

Overview

Package store provides local keystore management for TRON accounts.

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNoUnlockBadPassphrase is returned when an account cannot be unlocked with the given passphrase.
	ErrNoUnlockBadPassphrase = fmt.Errorf("could not unlock account with passphrase, perhaps need different phrase")
)

Functions

func AddressFromAccountName

func AddressFromAccountName(name string) (string, error)

AddressFromAccountName returns the Base58 address for the named account, or an error if not found.

func CloseAll added in v0.24.3

func CloseAll()

CloseAll closes all tracked keystores and resets the factory to production defaults. This is a safety net for test cleanup.

func DefaultLocation

func DefaultLocation() string

DefaultLocation returns the current default keystore directory path.

func DescribeLocalAccounts

func DescribeLocalAccounts()

DescribeLocalAccounts prints all account alias names and their addresses to stdout.

func DoesNamedAccountExist

func DoesNamedAccountExist(name string) bool

DoesNamedAccountExist reports whether an account alias with the given name exists locally.

func FromAccountName

func FromAccountName(name string) *keystore.KeyStore

FromAccountName returns a KeyStore loaded from the named account's directory.

func FromAddress

func FromAddress(addr string) *keystore.KeyStore

FromAddress will return nil if the Base58 string is not found in the imported accounts. Non-matching keystores are closed to prevent goroutine leaks.

func InitConfigDir

func InitConfigDir()

InitConfigDir creates the account keystore directory if it does not exist.

func LocalAccounts

func LocalAccounts() []string

LocalAccounts returns the alias names of all locally stored accounts.

func SetDefaultLocation

func SetDefaultLocation(directory string)

SetDefaultLocation updates the default keystore directory and creates it if needed.

func SetKeystoreFactory added in v0.24.3

func SetKeystoreFactory(fn func(string) *keystore.KeyStore)

SetKeystoreFactory replaces the function used to create keystores. Pass keystore.ForPathLight in tests for faster key derivation.

func UnlockedKeystore

func UnlockedKeystore(from, passphrase string) (*keystore.KeyStore, *keystore.Account, error)

UnlockedKeystore finds, unlocks, and returns the keystore and account for the given Base58 address.

Types

This section is empty.

Jump to

Keyboard shortcuts

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