ledger_cosmos_go

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

ledger-cosmos-go

Test Build status

This project is work in progress. Some aspects are subject to change.

Get source

Apart from cloning, be sure you install dep dependency management tool https://github.com/golang/dep

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVersion

func CheckVersion(ver VersionInfo, req VersionInfo) error

CheckVersion compares the current version with the required version

func GetBip32bytesv1

func GetBip32bytesv1(bip32Path []uint32, hardenCount int) ([]byte, error)

func GetBip32bytesv2

func GetBip32bytesv2(bip44Path []uint32, hardenCount int) ([]byte, error)

func NewVersionRequiredError

func NewVersionRequiredError(req VersionInfo, ver VersionInfo) error

Types

type LedgerCosmos

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

LedgerCosmos represents a connection to the Cosmos app in a Ledger Nano S device

func FindLedgerCosmosUserApp

func FindLedgerCosmosUserApp() (_ *LedgerCosmos, rerr error)

FindLedgerCosmosUserApp finds a Cosmos user app running in a ledger device

func (*LedgerCosmos) CheckVersion

func (ledger *LedgerCosmos) CheckVersion(ver VersionInfo) error

VersionIsSupported returns true if the App version is supported by this library

func (*LedgerCosmos) Close

func (ledger *LedgerCosmos) Close() error

Close closes a connection with the Cosmos user app

func (*LedgerCosmos) GetAddressPubKeySECP256K1

func (ledger *LedgerCosmos) GetAddressPubKeySECP256K1(bip32Path []uint32, hrp string) (pubkey []byte, addr string, err error)

GetAddressPubKeySECP256K1 returns the pubkey (compressed) and address (bech( this command requires user confirmation in the device

func (*LedgerCosmos) GetBip32bytes

func (ledger *LedgerCosmos) GetBip32bytes(bip32Path []uint32, hardenCount int) ([]byte, error)

func (*LedgerCosmos) GetPublicKeySECP256K1

func (ledger *LedgerCosmos) GetPublicKeySECP256K1(bip32Path []uint32) ([]byte, error)

GetPublicKeySECP256K1 retrieves the public key for the corresponding bip32 derivation path (compressed) this command DOES NOT require user confirmation in the device

func (*LedgerCosmos) GetVersion

func (ledger *LedgerCosmos) GetVersion() (*VersionInfo, error)

GetVersion returns the current version of the Cosmos user app

func (*LedgerCosmos) SignSECP256K1

func (ledger *LedgerCosmos) SignSECP256K1(bip32Path []uint32, transaction []byte, p2 byte) ([]byte, error)

SignSECP256K1 signs a transaction using Cosmos user app. It can either use SIGN_MODE_LEGACY_AMINO_JSON (P2=0) or SIGN_MODE_TEXTUAL (P2=1). this command requires user confirmation in the device

type LedgerTendermintValidator

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

Validator app

func FindLedgerTendermintValidatorApp

func FindLedgerTendermintValidatorApp() (_ *LedgerTendermintValidator, rerr error)

FindLedgerCosmosValidatorApp finds a Cosmos validator app running in a ledger device

func (*LedgerTendermintValidator) Close

func (ledger *LedgerTendermintValidator) Close() error

Close closes a connection with the Cosmos user app

func (*LedgerTendermintValidator) GetPublicKeyED25519

func (ledger *LedgerTendermintValidator) GetPublicKeyED25519(bip32Path []uint32) ([]byte, error)

GetPublicKeyED25519 retrieves the public key for the corresponding bip32 derivation path

func (*LedgerTendermintValidator) GetVersion

func (ledger *LedgerTendermintValidator) GetVersion() (*VersionInfo, error)

GetVersion returns the current version of the Cosmos user app

func (*LedgerTendermintValidator) SignED25519

func (ledger *LedgerTendermintValidator) SignED25519(bip32Path []uint32, message []byte) ([]byte, error)

SignSECP256K1 signs a message/vote using the Tendermint validator app

type VersionInfo

type VersionInfo struct {
	AppMode uint8
	Major   uint8
	Minor   uint8
	Patch   uint8
}

VersionInfo contains app version information

func RequiredTendermintValidatorAppVersion

func RequiredTendermintValidatorAppVersion() VersionInfo

RequiredCosmosUserAppVersion indicates the minimum required version of the Tendermint app

func (VersionInfo) String

func (c VersionInfo) String() string

type VersionRequiredError

type VersionRequiredError struct {
	Found    VersionInfo
	Required VersionInfo
}

VersionRequiredError the command is not supported by this app

func (VersionRequiredError) Error

func (e VersionRequiredError) Error() string

Jump to

Keyboard shortcuts

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