@xrpl-wallet-kit/adapter-ledger 0.1.12 → 0.1.14

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 CHANGED
@@ -1,69 +1,71 @@
1
- # @xrpl-wallet-kit/adapter-ledger
2
-
3
- Ledger hardware wallet adapter for XRPL Wallet Kit.
4
-
5
- This adapter connects to Ledger devices through WebHID or WebUSB, reads an XRPL account from the XRP app, and supports signed transaction flows for XRPL dApps.
6
-
7
- ## Capabilities
8
-
9
- - `connect`
10
- - `disconnect`
11
- - `signTransaction`
12
- - `signAndSubmit`
13
-
14
- ## Install
15
-
16
- ```bash
17
- npm install @xrpl-wallet-kit/adapter-ledger
18
- ```
19
-
20
- ## Usage
21
-
22
- ```ts
23
- import { createWalletKit } from "@xrpl-wallet-kit/client";
24
- import { createLedgerAdapter } from "@xrpl-wallet-kit/adapter-ledger";
25
-
26
- const kit = createWalletKit({
27
- adapters: [createLedgerAdapter()]
28
- });
29
- ```
30
-
31
- ## Runtime Notes
32
-
33
- - Requires a browser with WebHID or WebUSB support.
34
- - Requires a connected Ledger device with the XRP app open.
35
- - Hardware wallets are explicit user-presence devices. `restoreSession()` returns `null` and does not silently reconnect after refresh.
36
- - Default derivation path is `44'/144'/0'/0/0`.
37
- - `signTransaction()` signs without submit.
38
- - `signAndSubmit()` signs and submits when requested by the caller.
39
-
40
- ## Options
41
-
42
- ```ts
43
- createLedgerAdapter({
44
- accountIndex: 0,
45
- derivationPath: "44'/144'/0'/0/0",
46
- preferWebHID: true,
47
- timeout: 60000
48
- });
49
- ```
50
-
51
- Use `connectLedger` in tests or custom integrations to inject a prebuilt Ledger session.
52
-
53
- ## Testing
54
-
55
- Hardware transport should be mocked in unit tests. Manual smoke testing should cover:
56
-
57
- - unsupported browser;
58
- - device disconnected;
59
- - device locked;
60
- - XRP app not open;
61
- - connect success;
62
- - disconnect cleanup;
63
- - `submit:false` signed transaction result;
64
- - user rejection on device.
65
-
66
- ## Links
67
-
68
- - Ledger: https://www.ledger.com
69
- - XRPL Wallet Kit: https://github.com/XRPDomains/xrpl-wallet-kit
1
+ # @xrpl-wallet-kit/adapter-ledger
2
+
3
+ Ledger hardware wallet adapter for XRPL Wallet Kit.
4
+
5
+ This adapter connects to Ledger devices through WebHID or WebUSB, reads an XRPL account from the XRP app, and supports signed transaction flows for XRPL dApps.
6
+
7
+ ## Capabilities
8
+
9
+ - `connect`
10
+ - `disconnect`
11
+ - `signTransaction`
12
+ - `signAndSubmit`
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install @xrpl-wallet-kit/adapter-ledger
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```ts
23
+ import { createWalletKit } from "@xrpl-wallet-kit/client";
24
+ import { createLedgerAdapter } from "@xrpl-wallet-kit/adapter-ledger";
25
+
26
+ const kit = createWalletKit({
27
+ adapters: [createLedgerAdapter()]
28
+ });
29
+ ```
30
+
31
+ ## Runtime Notes
32
+
33
+ - Requires a browser with WebHID or WebUSB support.
34
+ - Requires a connected Ledger device with the XRP app open.
35
+ - Hardware wallets are explicit user-presence devices. `restoreSession()` returns `null` and does not silently reconnect after refresh.
36
+ - Default derivation path is `44'/144'/0'/0/0`.
37
+ - `signTransaction()` signs without submit.
38
+ - `signAndSubmit()` signs and submits when requested by the caller.
39
+ - XRPL multisigning is intentionally not advertised. Payloads that contain multisign shape such as `SigningPubKey: ""` or `Signers` fail with `UNSUPPORTED_METHOD` before the adapter delegates signing.
40
+
41
+ ## Options
42
+
43
+ ```ts
44
+ createLedgerAdapter({
45
+ accountIndex: 0,
46
+ derivationPath: "44'/144'/0'/0/0",
47
+ preferWebHID: true,
48
+ timeout: 60000
49
+ });
50
+ ```
51
+
52
+ Use `connectLedger` in tests or custom integrations to inject a prebuilt Ledger session.
53
+
54
+ ## Testing
55
+
56
+ Hardware transport should be mocked in unit tests. Manual smoke testing should cover:
57
+
58
+ - unsupported browser;
59
+ - device disconnected;
60
+ - device locked;
61
+ - XRP app not open;
62
+ - connect success;
63
+ - disconnect cleanup;
64
+ - `submit:false` signed transaction result;
65
+ - multisign payloads fail closed;
66
+ - user rejection on device.
67
+
68
+ ## Links
69
+
70
+ - Ledger: https://www.ledger.com
71
+ - XRPL Wallet Kit: https://github.com/XRPDomains/xrpl-wallet-kit
package/dist/index.d.ts CHANGED
@@ -59,6 +59,7 @@ export declare class LedgerAdapter extends BaseWalletAdapter {
59
59
  private mapConnectionError;
60
60
  private mapSigningError;
61
61
  private withTimeout;
62
+ private assertSingleSignTransaction;
62
63
  }
63
64
  export declare function createLedgerAdapter(options?: LedgerAdapterOptions): LedgerAdapter;
64
65
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAqB,MAAM,uBAAuB,CAAC;AAC7E,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,aAAa,EAEd,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,WAAW,uiBAC8gB,CAAC;AAUviB,oBAAY,iBAAiB;IAC3B,aAAa,kBAAkB;IAC/B,MAAM,WAAW;IACjB,YAAY,iBAAiB;IAC7B,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,oBAAoB;IACnC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;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QT,WAAW;IAezB,OAAO,CAAC,2BAA2B;CAMpC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,iBAEjE"}
package/dist/index.js CHANGED
@@ -79,6 +79,7 @@ export class LedgerAdapter extends BaseWalletAdapter {
79
79
  async signAndSubmit(request) {
80
80
  if (!this.session)
81
81
  throw createWalletError.notConnected();
82
+ this.assertSingleSignTransaction(request.txJson);
82
83
  try {
83
84
  const result = await this.session.signTransaction(request.txJson, request.submit ?? true);
84
85
  return {
@@ -98,6 +99,7 @@ export class LedgerAdapter extends BaseWalletAdapter {
98
99
  async signTransaction(request) {
99
100
  if (!this.session)
100
101
  throw createWalletError.notConnected();
102
+ this.assertSingleSignTransaction(request.txJson);
101
103
  try {
102
104
  const result = await this.session.signTransaction(request.txJson, false);
103
105
  return {
@@ -162,6 +164,7 @@ export class LedgerAdapter extends BaseWalletAdapter {
162
164
  throw createWalletError.notConnected();
163
165
  if (!this.network)
164
166
  throw createWalletError.connectionFailed(this.metadata.name, new Error("XRPL network is required for Ledger signing"));
167
+ this.assertSingleSignTransaction(tx);
165
168
  const { Client, encode } = await import("xrpl");
166
169
  const client = new Client(this.network.rpcUrl);
167
170
  await client.connect();
@@ -287,6 +290,12 @@ export class LedgerAdapter extends BaseWalletAdapter {
287
290
  clearTimeout(timer);
288
291
  }
289
292
  }
293
+ assertSingleSignTransaction(tx) {
294
+ const txJson = asRecord(tx);
295
+ if (txJson.SigningPubKey === "" || Array.isArray(txJson.Signers)) {
296
+ throw createWalletError.unsupportedMethod("XRPL multisigning", this.metadata.name);
297
+ }
298
+ }
290
299
  }
291
300
  export function createLedgerAdapter(options) {
292
301
  return new LedgerAdapter(options);
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@xrpl-wallet-kit/adapter-ledger",
3
- "version": "0.1.12",
4
- "description": "Ledger hardware wallet adapter for XRPL Wallet Kit.",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "./dist/index.js",
8
- "types": "./dist/index.d.ts",
9
- "exports": {
10
- ".": {
11
- "types": "./dist/index.d.ts",
12
- "import": "./dist/index.js"
13
- }
14
- },
15
- "files": [
16
- "dist",
17
- "README.md"
18
- ],
19
- "scripts": {
20
- "build": "tsc -p tsconfig.json"
21
- },
22
- "dependencies": {
23
- "@ledgerhq/errors": "^6.16.0",
24
- "@ledgerhq/hw-app-xrp": "^6.28.0",
25
- "@ledgerhq/hw-transport": "^6.28.0",
26
- "@ledgerhq/hw-transport-webhid": "^6.28.0",
27
- "@ledgerhq/hw-transport-webusb": "^6.28.0",
28
- "@xrpl-wallet-kit/core": "0.1.12",
29
- "buffer": "^6.0.3"
30
- },
31
- "peerDependencies": {
32
- "xrpl": "^4.0.0"
33
- },
34
- "devDependencies": {
35
- "xrpl": "^4.0.0"
36
- },
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
- "repository": {
41
- "type": "git",
42
- "url": "git+https://github.com/XRPDomains/xrpl-wallet-kit.git"
43
- },
44
- "homepage": "https://github.com/XRPDomains/xrpl-wallet-kit#readme",
45
- "bugs": {
46
- "url": "https://github.com/XRPDomains/xrpl-wallet-kit/issues"
47
- },
48
- "keywords": [
49
- "xrpl",
50
- "wallet",
51
- "wallet-adapter",
52
- "wallet-kit",
53
- "xrp-ledger",
54
- "web3",
55
- "adapter"
56
- ]
57
- }
1
+ {
2
+ "name": "@xrpl-wallet-kit/adapter-ledger",
3
+ "version": "0.1.14",
4
+ "description": "Ledger hardware wallet adapter for XRPL Wallet Kit.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json"
21
+ },
22
+ "dependencies": {
23
+ "@ledgerhq/errors": "^6.16.0",
24
+ "@ledgerhq/hw-app-xrp": "^6.28.0",
25
+ "@ledgerhq/hw-transport": "^6.28.0",
26
+ "@ledgerhq/hw-transport-webhid": "^6.28.0",
27
+ "@ledgerhq/hw-transport-webusb": "^6.28.0",
28
+ "@xrpl-wallet-kit/core": "0.1.14",
29
+ "buffer": "^6.0.3"
30
+ },
31
+ "peerDependencies": {
32
+ "xrpl": "^4.0.0 || ^5.0.0"
33
+ },
34
+ "devDependencies": {
35
+ "xrpl": "^4.0.0"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "git+https://github.com/XRPDomains/xrpl-wallet-kit.git"
43
+ },
44
+ "homepage": "https://github.com/XRPDomains/xrpl-wallet-kit#readme",
45
+ "bugs": {
46
+ "url": "https://github.com/XRPDomains/xrpl-wallet-kit/issues"
47
+ },
48
+ "keywords": [
49
+ "xrpl",
50
+ "wallet",
51
+ "wallet-adapter",
52
+ "wallet-kit",
53
+ "xrp-ledger",
54
+ "web3",
55
+ "adapter"
56
+ ]
57
+ }