ledger

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: 12 Imported by: 11

Documentation

Overview

Package ledger provides hardware wallet integration for TRON signing.

Index

Constants

This section is empty.

Variables

View Source
var DEBUG bool

DEBUG enables verbose HID frame logging when true.

Functions

func GetAddress

func GetAddress() string

GetAddress returns the TRON address from the connected Ledger device.

func ProcessAddressCommand

func ProcessAddressCommand()

ProcessAddressCommand prints the Ledger device address to stdout.

func SignTx

func SignTx(tx []byte) ([]byte, error)

SignTx signs the given transaction with the requested account.

Types

type APDU

type APDU struct {
	CLA     byte
	INS     byte
	P1, P2  byte
	Payload []byte
}

APDU represents an Application Protocol Data Unit for Ledger communication.

type ErrCode

type ErrCode uint16

ErrCode represents a Ledger APDU error status code.

func (ErrCode) Error

func (c ErrCode) Error() string

type NanoS

type NanoS struct {
	// contains filtered or unexported fields
}

NanoS represents a connection to a Ledger Nano S hardware wallet.

func OpenNanoS

func OpenNanoS() (*NanoS, error)

OpenNanoS detects and opens a connection to a Ledger Nano S device.

func (*NanoS) Exchange

func (n *NanoS) Exchange(cmd byte, p1, p2 byte, data []byte) (resp []byte, err error)

Exchange sends an APDU command to the Ledger and returns the response.

func (*NanoS) GetAddress

func (n *NanoS) GetAddress() (addr string, err error)

GetAddress returns the TRON address from the Ledger device.

func (*NanoS) GetVersion

func (n *NanoS) GetVersion() (version string, err error)

GetVersion returns the TRON app version running on the Ledger device.

func (*NanoS) SignTxn

func (n *NanoS) SignTxn(txn []byte) (sig [signatureSize]byte, err error)

SignTxn signs a raw transaction using the Ledger device and returns the 65-byte signature.

Jump to

Keyboard shortcuts

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