@xrpl-wallet-kit/adapter-ledger 0.1.18 → 0.1.19

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
@@ -39,6 +39,7 @@ const kit = createWalletKit({
39
39
  - `signTransaction()` supports XRPL multisigning when `SigningPubKey` is empty. It returns a signed blob plus the signer contribution under `raw.signer`/`raw.signedTx` for the dApp to combine with other signers.
40
40
  - `signAndSubmit()` rejects multisign payloads with `UNSUPPORTED_METHOD`; the dApp must combine a quorum of signer contributions before submission.
41
41
  - A custom `connectLedger` session must implement `signMultisignTransaction()` to opt into multisigning.
42
+ - Default multisign signing requires a fully prepared transaction (`Account`, `Sequence`/ticket fields, `Fee`, `LastLedgerSequence`, `SigningPubKey: ""`, no signature fields). It does not autofill or connect to RPC. Prepare once before collecting signatures; see [core coordination helpers](../../../docs/multisign.md).
42
43
 
43
44
  ## Options
44
45
 
@@ -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,OAA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,IAAI,CAAC;IAKtE,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAqB/D,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAiBhF,WAAW,CAAC,KAAK,SAAI,EAAE,UAAU,SAAI,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;YA+BxD,oBAAoB;YAyBpB,qBAAqB;YAgErB,wBAAwB;YAMxB,8BAA8B;YAqB9B,eAAe;YAwBf,OAAO;IAYrB,OAAO,CAAC,kBAAkB;IAW1B,OAAO,CAAC,eAAe;YAQT,WAAW;IAezB,OAAO,CAAC,sBAAsB;CAI/B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE,oBAAoB,iBAEjE"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseWalletAdapter, createWalletError } from "@xrpl-wallet-kit/core";
1
+ import { BaseWalletAdapter, createWalletError, validateMultisignTransaction } from "@xrpl-wallet-kit/core";
2
2
  export const LEDGER_ICON = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyOCIgaGVpZ2h0PSIyOCIgZmlsbD0ibm9uZSI+PHBhdGggZmlsbD0iIzAwMCIgZD0iTTAgMGgyOHYyOEgweiIvPjxwYXRoIGZpbGw9IiNmZmYiIGZpbGwtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjY1IDQuNEg0LjRWOWgxLjFWNS41bDYuMTUtLjA0VjQuNFptLjA1IDUuOTV2Ny4yNWg0LjZ2LTEuMWgtMy41bC0uMDQtNi4xNUgxMS43Wk00LjQgMjMuNmg3LjI1di0xLjA2TDUuNSAyMi41VjE5SDQuNHY0LjZaTTE2LjM1IDQuNGg3LjI1VjloLTEuMVY1LjVsLTYuMTUtLjA0VjQuNFptNy4yNSAxOS4yaC03LjI1di0xLjA2bDYuMTUtLjA0VjE5aDEuMXY0LjZaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=";
3
3
  const DEFAULT_TIMEOUT = 60000;
4
4
  const DEFAULT_ACCOUNT_INDEX = 0;
@@ -231,35 +231,17 @@ export class LedgerAdapter extends BaseWalletAdapter {
231
231
  throw createWalletError.notConnected();
232
232
  if (!this.network)
233
233
  throw createWalletError.connectionFailed(this.metadata.name, new Error("XRPL network is required for Ledger signing"));
234
- const { Client, encode, encodeForMultiSigning } = await import("xrpl");
235
- const client = new Client(this.network.rpcUrl);
236
- await client.connect();
237
- try {
238
- const input = asRecord(tx);
239
- if (Array.isArray(input.Signers) && input.Signers.length > 0) {
240
- throw createWalletError.unsupportedMethod("adding a signer to a populated Signers array", this.metadata.name);
241
- }
242
- const prepared = await client.autofill({
243
- ...input,
244
- Account: typeof input.Account === "string" ? input.Account : this.session.address,
245
- SigningPubKey: ""
246
- });
247
- delete prepared.TxnSignature;
248
- delete prepared.Signers;
249
- prepared.SigningPubKey = "";
250
- const publicKey = (this.session.publicKey ?? (await this.xrp.getAddress(this.derivationPath, false, false)).publicKey).toUpperCase();
251
- const signingBlob = encodeForMultiSigning(prepared, this.session.address).toUpperCase();
252
- const signature = await this.withTimeout(this.xrp.signTransaction(this.derivationPath, signingBlob), "Ledger multisigning timeout. Please confirm the transaction on your Ledger device.");
253
- if (!signature)
254
- throw new Error("Ledger did not return a transaction signature");
255
- const signer = { Signer: { Account: this.session.address, SigningPubKey: publicKey, TxnSignature: signature.toUpperCase() } };
256
- const signedTx = { ...prepared, Signers: [signer] };
257
- const txBlob = encode(signedTx);
258
- return { txBlob, signed: true, raw: { txBlob, signedTx, signer } };
259
- }
260
- finally {
261
- await client.disconnect();
262
- }
234
+ const { encode, encodeForMultiSigning } = await import("xrpl");
235
+ const prepared = await validateMultisignTransaction(asRecord(tx));
236
+ const publicKey = (this.session.publicKey ?? (await this.xrp.getAddress(this.derivationPath, false, false)).publicKey).toUpperCase();
237
+ const signingBlob = encodeForMultiSigning(prepared, this.session.address).toUpperCase();
238
+ const signature = await this.withTimeout(this.xrp.signTransaction(this.derivationPath, signingBlob), "Ledger multisigning timeout. Please confirm the transaction on your Ledger device.");
239
+ if (!signature)
240
+ throw new Error("Ledger did not return a transaction signature");
241
+ const signer = { Signer: { Account: this.session.address, SigningPubKey: publicKey, TxnSignature: signature.toUpperCase() } };
242
+ const signedTx = { ...prepared, Signers: [signer] };
243
+ const txBlob = encode(signedTx);
244
+ return { txBlob, signed: true, raw: { txBlob, signedTx, signer } };
263
245
  }
264
246
  async createTransport() {
265
247
  const support = getLedgerBrowserSupport();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xrpl-wallet-kit/adapter-ledger",
3
- "version": "0.1.18",
3
+ "version": "0.1.19",
4
4
  "description": "Ledger hardware wallet adapter for XRPL Wallet Kit.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -21,13 +21,10 @@
21
21
  "build": "tsc -p tsconfig.json"
22
22
  },
23
23
  "dependencies": {
24
- "@ledgerhq/errors": "^6.16.0",
25
24
  "@ledgerhq/hw-app-xrp": "^6.28.0",
26
- "@ledgerhq/hw-transport": "^6.28.0",
27
25
  "@ledgerhq/hw-transport-webhid": "^6.28.0",
28
26
  "@ledgerhq/hw-transport-webusb": "^6.28.0",
29
- "@xrpl-wallet-kit/core": "0.1.18",
30
- "buffer": "^6.0.3"
27
+ "@xrpl-wallet-kit/core": "0.1.19"
31
28
  },
32
29
  "peerDependencies": {
33
30
  "xrpl": "^4.0.0 || ^5.0.0"