@xrpl-wallet-kit/adapter-ledger 0.1.17 → 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 +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -30
- package/package.json +55 -57
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
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAmD,MAAM,uBAAuB,CAAC;AAC3G,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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AC,CAAkB;IACpC,OAAO,CAAC,GAAG,CAAC,CAAe;IAC3B,OAAO,CAAC,cAAc,CAAS;gBAEX,OAAO,GAAE,oBAAyB;IAahD,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAmCxD,cAAc,CAAC,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,aAAa,GAAG,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 {
|
|
235
|
-
const
|
|
236
|
-
await
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
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,57 +1,55 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@xrpl-wallet-kit/adapter-ledger",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Ledger hardware wallet adapter for XRPL Wallet Kit.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"@ledgerhq/hw-app-xrp": "^6.28.0",
|
|
25
|
-
"@ledgerhq/hw-transport": "^6.28.0",
|
|
26
|
-
"@ledgerhq/hw-transport-
|
|
27
|
-
"@
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
"
|
|
50
|
-
"wallet",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
]
|
|
57
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@xrpl-wallet-kit/adapter-ledger",
|
|
3
|
+
"version": "0.1.19",
|
|
4
|
+
"description": "Ledger hardware wallet adapter for XRPL Wallet Kit.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@ledgerhq/hw-app-xrp": "^6.28.0",
|
|
25
|
+
"@ledgerhq/hw-transport-webhid": "^6.28.0",
|
|
26
|
+
"@ledgerhq/hw-transport-webusb": "^6.28.0",
|
|
27
|
+
"@xrpl-wallet-kit/core": "0.1.19"
|
|
28
|
+
},
|
|
29
|
+
"peerDependencies": {
|
|
30
|
+
"xrpl": "^4.0.0 || ^5.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"xrpl": "^4.0.0"
|
|
34
|
+
},
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/XRPDomains/xrpl-wallet-kit.git"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/XRPDomains/xrpl-wallet-kit#readme",
|
|
43
|
+
"bugs": {
|
|
44
|
+
"url": "https://github.com/XRPDomains/xrpl-wallet-kit/issues"
|
|
45
|
+
},
|
|
46
|
+
"keywords": [
|
|
47
|
+
"xrpl",
|
|
48
|
+
"wallet",
|
|
49
|
+
"wallet-adapter",
|
|
50
|
+
"wallet-kit",
|
|
51
|
+
"xrp-ledger",
|
|
52
|
+
"web3",
|
|
53
|
+
"adapter"
|
|
54
|
+
]
|
|
55
|
+
}
|