From: Chris Duncan Date: Mon, 18 May 2026 21:09:14 +0000 (-0700) Subject: Adjust imports and exports. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=923b0d0614eb3c1330afc78e2fa9ac8e835a57a7;p=libnemo.git Adjust imports and exports. --- diff --git a/src/lib/ledger/index.ts b/src/lib/ledger/index.ts index 2b49f67..d016e81 100644 --- a/src/lib/ledger/index.ts +++ b/src/lib/ledger/index.ts @@ -2,9 +2,9 @@ //! SPDX-License-Identifier: GPL-3.0-or-later import { StatusCodes } from '@ledgerhq/errors' -import { default as TransportBLE } from '@ledgerhq/hw-transport-web-ble' -import { default as TransportHID } from '@ledgerhq/hw-transport-webhid' -import { default as TransportUSB } from '@ledgerhq/hw-transport-webusb' +import TransportBLE from '@ledgerhq/hw-transport-web-ble' +import TransportHID from '@ledgerhq/hw-transport-webhid' +import TransportUSB from '@ledgerhq/hw-transport-webusb' import { Block } from '../block' import { BIP44_COIN_NANO, BIP44_PURPOSE, HARDENED_OFFSET } from '../constants' import { dec } from '../convert' @@ -22,43 +22,35 @@ import { _verify } from './verify' export type LedgerStatus = 'UNSUPPORTED' | 'DISCONNECTED' | 'BUSY' | 'LOCKED' | 'CONNECTED' export type LedgerTransport = typeof TransportHID | typeof TransportBLE | typeof TransportUSB - export interface LedgerResponse { status: string } - export interface LedgerAccountResponse extends LedgerResponse { publicKey: string | null, address: string | null } - export const APDU_CODES = Object.freeze({ - class: 0xa1 as 0xa1, - bip32DerivationLevel: 0x03 as 0x03, - version: 0x01 as 0x01, - account: 0x02 as 0x02, - cacheBlock: 0x03 as 0x03, - signBlock: 0x04 as 0x04, - signNonce: 0x05 as 0x05, - paramUnused: 0x00 as 0x00 + class: 0xa1 as const, + bip32DerivationLevel: 0x03 as const, + version: 0x01 as const, + account: 0x02 as const, + cacheBlock: 0x03 as const, + signBlock: 0x04 as const, + signNonce: 0x05 as const, + paramUnused: 0x00 as const }) - export const DERIVATION_PATH: Uint8Array = new Uint8Array([ APDU_CODES.bip32DerivationLevel, ...dec.toBytes(BIP44_PURPOSE + HARDENED_OFFSET, 4), ...dec.toBytes(BIP44_COIN_NANO + HARDENED_OFFSET, 4) ]) - /** * Vendor ID assigned to Ledger for HID and USB interfaces. * https://github.com/LedgerHQ/ledger-live/blob/develop/libs/ledgerjs/packages/devices/src/index.ts#L164 */ -export const LEDGER_VENDOR_ID: 0x2c97 = 0x2c97 - -export const LISTEN_TIMEOUT: 30000 = 30000 - -export const OPEN_TIMEOUT: 3000 = 3000 - +export const LEDGER_VENDOR_ID = 0x2c97 as const +export const LISTEN_TIMEOUT = 30000 as const +export const OPEN_TIMEOUT = 3000 as const export const STATUS_CODES: Readonly> = Object.freeze({ ...Object.fromEntries(Object.entries(StatusCodes).map(([k, v]) => [+v, k])), 0x6807: 'APPLICATION_NOT_INSTALLED',