@pezkuwi/hw-ledger-transports 14.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,2 @@
1
+ # @pezkuwi/hw-ledger-transports
2
+
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "author": "Jaco Greeff <jacogr@gmail.com>",
3
+ "bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
4
+ "engines": {
5
+ "node": ">=18"
6
+ },
7
+ "homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/hw-ledger-transports#readme",
8
+ "license": "Apache-2.0",
9
+ "name": "@pezkuwi/hw-ledger-transports",
10
+ "repository": {
11
+ "directory": "packages/hw-ledger-transports",
12
+ "type": "git",
13
+ "url": "https://github.com/pezkuwichain/pezkuwi-common.git"
14
+ },
15
+ "sideEffects": false,
16
+ "type": "module",
17
+ "version": "14.0.1",
18
+ "browser": "browser.js",
19
+ "main": "node.js",
20
+ "react-native": "react-native.js",
21
+ "dependencies": {
22
+ "@ledgerhq/hw-transport": "^6.31.4",
23
+ "@ledgerhq/hw-transport-webhid": "^6.29.4",
24
+ "@ledgerhq/hw-transport-webusb": "^6.29.4",
25
+ "@pezkuwi/util": "14.0.1",
26
+ "tslib": "^2.8.0"
27
+ },
28
+ "optionalDependencies": {
29
+ "@ledgerhq/hw-transport-node-hid-singleton": "^6.31.5"
30
+ }
31
+ }
package/src/browser.ts ADDED
@@ -0,0 +1,11 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import LedgerHid from '@ledgerhq/hw-transport-webhid';
5
+ import LedgerUsb from '@ledgerhq/hw-transport-webusb';
6
+
7
+ import { createDefs } from './util.js';
8
+
9
+ export { packageInfo } from './packageInfo.js';
10
+
11
+ export const transports = /*#__PURE__*/ createDefs(['webusb', LedgerUsb], ['hid', LedgerHid]);
package/src/empty.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { createDefs } from './util.js';
5
+
6
+ export { packageInfo } from './packageInfo.js';
7
+
8
+ export const transports = /*#__PURE__*/ createDefs();
package/src/mod.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './empty.js';
package/src/node.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import LedgerHid from '@ledgerhq/hw-transport-node-hid-singleton';
5
+
6
+ import { createDefs } from './util.js';
7
+
8
+ export { packageInfo } from './packageInfo.js';
9
+
10
+ export const transports = /*#__PURE__*/ createDefs(['hid', LedgerHid]);
@@ -0,0 +1,11 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger-transports authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Do not edit, auto-generated by @polkadot/dev
5
+ // (packageInfo imports will be kept as-is, user-editable)
6
+
7
+ import { detectPackage } from '@pezkuwi/util';
8
+
9
+ import { packageInfo } from './packageInfo.js';
10
+
11
+ detectPackage(packageInfo, null, []);
@@ -0,0 +1,6 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger-transports authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Do not edit, auto-generated by @polkadot/dev
5
+
6
+ export const packageInfo = { name: '@polkadot/hw-ledger-transports', path: 'auto', type: 'auto', version: '14.0.1' };
@@ -0,0 +1,4 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './empty.js';
package/src/types.ts ADDED
@@ -0,0 +1,17 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // CJS, so we use import * syntax
5
+ import type * as HwTransport from '@ledgerhq/hw-transport';
6
+
7
+ // u2f is deprecated an therefore not added
8
+ export type TransportType = 'hid' | 'webusb';
9
+
10
+ export type Transport = HwTransport.default;
11
+
12
+ export interface TransportDef {
13
+ /** Create a transport to be used in Ledger operations */
14
+ create (): Promise<Transport>;
15
+ /** The type of the underlying transport definition */
16
+ type: TransportType;
17
+ }
package/src/util.ts ADDED
@@ -0,0 +1,12 @@
1
+ // Copyright 2017-2025 @polkadot/hw-ledger authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import type { Transport, TransportDef, TransportType } from './types.js';
5
+
6
+ export function createDefs (...items: readonly [type: TransportType, Clazz: unknown][]): TransportDef[] {
7
+ return items.map(([type, Clazz]): TransportDef => ({
8
+ create: (): Promise<Transport> =>
9
+ (Clazz as Pick<TransportDef, 'create'>).create(),
10
+ type
11
+ }));
12
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "..",
5
+ "outDir": "./build",
6
+ "rootDir": "./src"
7
+ },
8
+ "exclude": [
9
+ "**/mod.ts"
10
+ ],
11
+ "references": [
12
+ { "path": "../util/tsconfig.build.json" }
13
+ ]
14
+ }