@zondax/ledger-stacks
v2.0.0
Published
Node API for Stacks App (Ledger Nano S+, X, Stax, Flex and Apex)
Readme
@zondax/ledger-stacks
This package provides a basic client library to communicate with the Stacks App running in a Ledger Nano S+/X, Flex, Stax and Apex
We recommend using the npmjs package to receive updates/fixes.
Transports
StacksApp accepts any transport that can send an APDU: a legacy Transport from
@ledgerhq/hw-transport, or a Device Management Kit
session wrapped in DMKTransport, which this package re-exports.
import StacksApp, { DMKTransport } from '@zondax/ledger-stacks'
const sessionId = await dmk.connect({
device,
// A DMK session polls the device roughly once a second over the same queue your APDUs
// leave on, and signing sends an awaited sequence of chunks. Disable it, as Ledger Live
// does in its own DMK transport.
sessionRefresherOptions: { isRefresherDisabled: true },
})
const app = new StacksApp(new DMKTransport(dmk, sessionId))Passing anything other than a DMKTransport is deprecated: that constructor overload is
marked @deprecated, logs a one-time warning, and is removed in the next major version.
Development
Available Scripts
# Build the project
pnpm build
# Format code and sort package.json
pnpm format
# Check formatting
pnpm format:check
# Run linter
pnpm lint
# Fix linting issues
pnpm lint:fix
# Run tests (builds first)
pnpm test
# Check for dependency updates
pnpm upgradeNotes
Use pnpm install to avoid issues.
