@shapeshiftoss/hdwallet-ledger 1.55.2-alpha.0 → 1.55.3
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/dist/bitcoin.js +177 -243
- package/dist/bitcoin.js.map +1 -1
- package/dist/cosmos.d.ts.map +1 -1
- package/dist/cosmos.js +38 -82
- package/dist/cosmos.js.map +1 -1
- package/dist/currencies.js +1 -4
- package/dist/currencies.js.map +1 -1
- package/dist/ethereum.d.ts.map +1 -1
- package/dist/ethereum.js +138 -199
- package/dist/ethereum.js.map +1 -1
- package/dist/index.js +6 -22
- package/dist/index.js.map +1 -1
- package/dist/ledger.js +183 -284
- package/dist/ledger.js.map +1 -1
- package/dist/thorchain/common.js +11 -16
- package/dist/thorchain/common.js.map +1 -1
- package/dist/thorchain/hw-app-thor.d.ts +2 -3
- package/dist/thorchain/hw-app-thor.d.ts.map +1 -1
- package/dist/thorchain/hw-app-thor.js +125 -146
- package/dist/thorchain/hw-app-thor.js.map +1 -1
- package/dist/thorchain/index.d.ts.map +1 -1
- package/dist/thorchain/index.js +39 -86
- package/dist/thorchain/index.js.map +1 -1
- package/dist/transport.js +4 -29
- package/dist/transport.js.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +13 -49
- package/dist/utils.js.map +1 -1
- package/dist/utxoUtils.js +67 -73
- package/dist/utxoUtils.js.map +1 -1
- package/package.json +3 -3
package/dist/cosmos.js
CHANGED
|
@@ -1,61 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.cosmosSignTx = exports.cosmosGetAddress = void 0;
|
|
39
|
-
const crypto_1 = require("@cosmjs/crypto");
|
|
40
|
-
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
41
|
-
const base64_js_1 = require("base64-js");
|
|
42
|
-
const p_lazy_1 = __importDefault(require("p-lazy"));
|
|
43
|
-
const utils_1 = require("./utils");
|
|
44
|
-
const protoTxBuilder = p_lazy_1.default.from(() => Promise.resolve().then(() => __importStar(require("@shapeshiftoss/proto-tx-builder"))));
|
|
1
|
+
import { Secp256k1Signature } from "@cosmjs/crypto";
|
|
2
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
3
|
+
import { fromByteArray } from "base64-js";
|
|
4
|
+
import PLazy from "p-lazy";
|
|
5
|
+
import { handleError, stringifyKeysInOrder } from "./utils";
|
|
6
|
+
const protoTxBuilder = PLazy.from(() => import("@shapeshiftoss/proto-tx-builder"));
|
|
45
7
|
const ATOM_CHAIN = "cosmoshub-4";
|
|
46
|
-
const cosmosGetAddress = (transport, msg) =>
|
|
8
|
+
export const cosmosGetAddress = async (transport, msg) => {
|
|
47
9
|
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
48
|
-
const res =
|
|
49
|
-
|
|
10
|
+
const res = await transport.call("Cosmos", "getAddress", bip32path, "cosmos");
|
|
11
|
+
handleError(res, transport, "Unable to obtain address from device.");
|
|
50
12
|
return res.payload.address;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const cosmosSignTx = (transport, msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
13
|
+
};
|
|
14
|
+
export const cosmosSignTx = async (transport, msg) => {
|
|
54
15
|
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
55
|
-
const getAddressResponse =
|
|
56
|
-
|
|
16
|
+
const getAddressResponse = await transport.call("Cosmos", "getAddress", bip32path, "cosmos");
|
|
17
|
+
handleError(getAddressResponse, transport, "Unable to obtain address and public key from device.");
|
|
57
18
|
const { address, publicKey } = getAddressResponse.payload;
|
|
58
|
-
const unsignedTx =
|
|
19
|
+
const unsignedTx = stringifyKeysInOrder({
|
|
59
20
|
account_number: msg.account_number,
|
|
60
21
|
chain_id: ATOM_CHAIN,
|
|
61
22
|
fee: { amount: msg.tx.fee.amount, gas: msg.tx.fee.gas },
|
|
@@ -63,38 +24,34 @@ const cosmosSignTx = (transport, msg) => __awaiter(void 0, void 0, void 0, funct
|
|
|
63
24
|
msgs: msg.tx.msg,
|
|
64
25
|
sequence: msg.sequence,
|
|
65
26
|
});
|
|
66
|
-
const signResponse =
|
|
67
|
-
|
|
27
|
+
const signResponse = await transport.call("Cosmos", "sign", bip32path, unsignedTx);
|
|
28
|
+
handleError(signResponse, transport, "Unable to obtain signature from device.");
|
|
68
29
|
const signature = signResponse.payload.signature;
|
|
69
30
|
if (!signature)
|
|
70
31
|
throw new Error("No signature returned from device");
|
|
71
32
|
const offlineSigner = {
|
|
72
|
-
getAccounts() {
|
|
73
|
-
return
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
];
|
|
81
|
-
});
|
|
33
|
+
async getAccounts() {
|
|
34
|
+
return [
|
|
35
|
+
{
|
|
36
|
+
address,
|
|
37
|
+
algo: "secp256k1",
|
|
38
|
+
pubkey: Buffer.from(publicKey, "hex"),
|
|
39
|
+
},
|
|
40
|
+
];
|
|
82
41
|
},
|
|
83
|
-
signAmino(signerAddress, signDoc) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
value: publicKey,
|
|
93
|
-
},
|
|
94
|
-
signature: (0, base64_js_1.fromByteArray)(crypto_1.Secp256k1Signature.fromDer(signature).toFixedLength()),
|
|
42
|
+
async signAmino(signerAddress, signDoc) {
|
|
43
|
+
if (signerAddress !== address)
|
|
44
|
+
throw new Error("expected signerAddress to match address");
|
|
45
|
+
return {
|
|
46
|
+
signed: signDoc,
|
|
47
|
+
signature: {
|
|
48
|
+
pub_key: {
|
|
49
|
+
type: "tendermint/PubKeySecp256k1",
|
|
50
|
+
value: publicKey,
|
|
95
51
|
},
|
|
96
|
-
|
|
97
|
-
|
|
52
|
+
signature: fromByteArray(Secp256k1Signature.fromDer(signature).toFixedLength()),
|
|
53
|
+
},
|
|
54
|
+
};
|
|
98
55
|
},
|
|
99
56
|
};
|
|
100
57
|
const signerData = {
|
|
@@ -102,7 +59,6 @@ const cosmosSignTx = (transport, msg) => __awaiter(void 0, void 0, void 0, funct
|
|
|
102
59
|
accountNumber: Number(msg.account_number),
|
|
103
60
|
chainId: msg.chain_id,
|
|
104
61
|
};
|
|
105
|
-
return (
|
|
106
|
-
}
|
|
107
|
-
exports.cosmosSignTx = cosmosSignTx;
|
|
62
|
+
return (await protoTxBuilder).sign(address, msg.tx, offlineSigner, signerData, "cosmos");
|
|
63
|
+
};
|
|
108
64
|
//# sourceMappingURL=cosmos.js.map
|
package/dist/cosmos.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,MAAM,QAAQ,CAAC;AAG3B,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE5D,MAAM,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,iCAAiC,CAAC,CAAC,CAAC;AAEnF,MAAM,UAAU,GAAG,aAAa,CAAC;AAEjC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,EAAE,SAA0B,EAAE,GAA0B,EAAmB,EAAE;IAChH,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC7D,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAE9E,WAAW,CAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC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B;QACxC,KAAK,CAAC,WAAW;YACf,OAAO;gBACL;oBACE,OAAO;oBACP,IAAI,EAAE,WAAW;oBACjB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,CAAC;iBACtC;aACF,CAAC;QACJ,CAAC;QAED,KAAK,CAAC,SAAS,CAAC,aAAqB,EAAE,OAAmB;YACxD,IAAI,aAAa,KAAK,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;YAE1F,OAAO;gBACL,MAAM,EAAE,OAAO;gBACf,SAAS,EAAE;oBACT,OAAO,EAAE;wBACP,IAAI,EAAE,4BAA4B;wBAClC,KAAK,EAAE,SAAS;qBACjB;oBACD,SAAS,EAAE,aAAa,CAAC,kBAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC;iBAChF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;IAEF,MAAM,UAAU,GAAe;QAC7B,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC9B,aAAa,EAAE,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC;QACzC,OAAO,EAAE,GAAG,CAAC,QAAQ;KACtB,CAAC;IAEF,OAAO,CAAC,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,EAAW,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AACpG,CAAC,CAAC"}
|
package/dist/currencies.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
// Taken from https://github.com/LedgerHQ/ledgerjs/blob/master/packages/cryptoassets/src/currencies.ts#L299
|
|
3
|
-
|
|
4
|
-
exports.currencies = void 0;
|
|
5
|
-
exports.currencies = {
|
|
2
|
+
export const currencies = {
|
|
6
3
|
Bitcoin: {
|
|
7
4
|
name: "Bitcoin",
|
|
8
5
|
xpubVersion: 0x0488b21e,
|
package/dist/currencies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAI3G,MAAM,CAAC,MAAM,UAAU,GAA6B;IAClD,OAAO,EAAE;QACP,IAAI,EAAE,SAAS;QACf,WAAW,EAAE,UAAU;KACxB;IACD,WAAW,EAAE;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EAAE,UAAU;KACxB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,UAAU;KACxB;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU;QAChB,WAAW,EAAE,UAAU;KACxB;CACF,CAAC"}
|
package/dist/ethereum.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethereum.d.ts","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ethereum.d.ts","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,IAAI,MAAM,8BAA8B,CAAC;AAQrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAE3E;AAED,wBAAsB,aAAa,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAMxG;AAGD,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAC1B,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,GAC5B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,CAgDvC;AAED,wBAAsB,SAAS,CAAC,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CA0C1G;AAED,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,OAAO,CAAC,CAElE;AAED,wBAAgB,2BAA2B,IAAI,OAAO,CAErD;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAiB1F;AAED,wBAAsB,cAAc,CAClC,SAAS,EAAE,eAAe,EAC1B,GAAG,EAAE,IAAI,CAAC,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAwBhC;AAKD,wBAAsB,gBAAgB,CACpC,SAAS,EAAE,eAAe,EAC1B,GAAG,EAAE,IAAI,CAAC,gBAAgB,GACzB,OAAO,CAAC,IAAI,CAAC,kBAAkB,CAAC,CA6ClC;AAGD,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAWnF"}
|
package/dist/ethereum.js
CHANGED
|
@@ -1,155 +1,104 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.ethVerifyMessage = exports.ethSignTypedData = exports.ethSignMessage = exports.ethGetAccountPaths = exports.ethSupportsEIP1559 = exports.ethSupportsNativeShapeShift = exports.ethSupportsSecureTransfer = exports.ethSignTx = exports.ethGetPublicKeys = exports.ethGetAddress = exports.ethSupportsNetwork = void 0;
|
|
39
|
-
const common_1 = __importDefault(require("@ethereumjs/common"));
|
|
40
|
-
const tx_1 = require("@ethereumjs/tx");
|
|
41
|
-
const sigUtil = __importStar(require("@metamask/eth-sig-util"));
|
|
42
|
-
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
43
|
-
const ethereumjs_tx_1 = __importDefault(require("ethereumjs-tx"));
|
|
1
|
+
import Common from "@ethereumjs/common";
|
|
2
|
+
import { Transaction } from "@ethereumjs/tx";
|
|
3
|
+
import * as sigUtil from "@metamask/eth-sig-util";
|
|
4
|
+
import * as core from "@shapeshiftoss/hdwallet-core";
|
|
5
|
+
import EthereumTx from "ethereumjs-tx";
|
|
44
6
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
45
7
|
// @ts-ignore
|
|
46
8
|
// TODO: fix ts-ignore
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
return chain_id === 1;
|
|
54
|
-
});
|
|
9
|
+
import * as ethereumUtil from "ethereumjs-util";
|
|
10
|
+
import { arrayify, isBytes, isHexString, joinSignature } from "ethers/lib/utils";
|
|
11
|
+
import { compressPublicKey, createXpub, handleError, networksUtil } from "./utils";
|
|
12
|
+
export async function ethSupportsNetwork(chain_id) {
|
|
13
|
+
return chain_id === 1;
|
|
55
14
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
(0, utils_1.handleError)(res, transport, "Unable to obtain ETH address from device.");
|
|
62
|
-
return res.payload.address;
|
|
63
|
-
});
|
|
15
|
+
export async function ethGetAddress(transport, msg) {
|
|
16
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
17
|
+
const res = await transport.call("Eth", "getAddress", bip32path, !!msg.showDisplay);
|
|
18
|
+
handleError(res, transport, "Unable to obtain ETH address from device.");
|
|
19
|
+
return res.payload.address;
|
|
64
20
|
}
|
|
65
|
-
exports.ethGetAddress = ethGetAddress;
|
|
66
21
|
// Adapted from https://github.com/LedgerHQ/ledger-wallet-webtool
|
|
67
|
-
function ethGetPublicKeys(transport, msg) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
continue;
|
|
79
|
-
}
|
|
80
|
-
const parentBip32path = core.addressNListToBIP32(addressNList.slice(0, -1)).substring(2); // i.e. "44'/0'"
|
|
81
|
-
const bip32path = core.addressNListToBIP32(addressNList).substring(2); // i.e 44'/0'/0'
|
|
82
|
-
const res1 = yield transport.call("Eth", "getAddress", parentBip32path, /* display */ false, /* chain code */ true);
|
|
83
|
-
(0, utils_1.handleError)(res1, transport, "Unable to obtain public key from device.");
|
|
84
|
-
const { payload: { publicKey: parentPublicKeyHex }, } = res1;
|
|
85
|
-
const parentPublicKey = (0, utils_1.compressPublicKey)(Buffer.from(parentPublicKeyHex, "hex"));
|
|
86
|
-
const parentFingerprint = new DataView(ethereumUtil.ripemd160(ethereumUtil.sha256(parentPublicKey), false).buffer).getUint32(0);
|
|
87
|
-
const res2 = yield transport.call("Eth", "getAddress", bip32path, /* display */ false, /* chain code */ true);
|
|
88
|
-
(0, utils_1.handleError)(res2, transport, "Unable to obtain public key from device.");
|
|
89
|
-
const { payload: { publicKey: publicKeyHex, chainCode: chainCodeHex }, } = res2;
|
|
90
|
-
const publicKey = (0, utils_1.compressPublicKey)(Buffer.from(publicKeyHex, "hex"));
|
|
91
|
-
const chainCode = Buffer.from(core.mustBeDefined(chainCodeHex), "hex");
|
|
92
|
-
const coinDetails = utils_1.networksUtil[core.mustBeDefined(core.slip44ByCoin(coin))];
|
|
93
|
-
const childNum = addressNList[addressNList.length - 1];
|
|
94
|
-
const networkMagic = coinDetails.bitcoinjs.bip32.public[scriptType];
|
|
95
|
-
if (networkMagic === undefined)
|
|
96
|
-
throw new Error(`scriptType ${scriptType} not supported`);
|
|
97
|
-
xpubs.push({
|
|
98
|
-
xpub: (0, utils_1.createXpub)(addressNList.length, parentFingerprint, childNum, chainCode, publicKey, networkMagic),
|
|
99
|
-
});
|
|
22
|
+
export async function ethGetPublicKeys(transport, msg) {
|
|
23
|
+
const xpubs = [];
|
|
24
|
+
for (const getPublicKey of msg) {
|
|
25
|
+
const { addressNList, coin } = getPublicKey;
|
|
26
|
+
let { scriptType } = getPublicKey;
|
|
27
|
+
if (!scriptType)
|
|
28
|
+
scriptType = core.BTCInputScriptType.SpendAddress;
|
|
29
|
+
// Only get public keys for ETH account paths
|
|
30
|
+
if (!addressNList.includes(0x80000000 + 44, 0) || !addressNList.includes(0x80000000 + 60, 1)) {
|
|
31
|
+
xpubs.push(null);
|
|
32
|
+
continue;
|
|
100
33
|
}
|
|
101
|
-
|
|
102
|
-
|
|
34
|
+
const parentBip32path = core.addressNListToBIP32(addressNList.slice(0, -1)).substring(2); // i.e. "44'/0'"
|
|
35
|
+
const bip32path = core.addressNListToBIP32(addressNList).substring(2); // i.e 44'/0'/0'
|
|
36
|
+
const res1 = await transport.call("Eth", "getAddress", parentBip32path, /* display */ false, /* chain code */ true);
|
|
37
|
+
handleError(res1, transport, "Unable to obtain public key from device.");
|
|
38
|
+
const { payload: { publicKey: parentPublicKeyHex }, } = res1;
|
|
39
|
+
const parentPublicKey = compressPublicKey(Buffer.from(parentPublicKeyHex, "hex"));
|
|
40
|
+
const parentFingerprint = new DataView(ethereumUtil.ripemd160(ethereumUtil.sha256(parentPublicKey), false).buffer).getUint32(0);
|
|
41
|
+
const res2 = await transport.call("Eth", "getAddress", bip32path, /* display */ false, /* chain code */ true);
|
|
42
|
+
handleError(res2, transport, "Unable to obtain public key from device.");
|
|
43
|
+
const { payload: { publicKey: publicKeyHex, chainCode: chainCodeHex }, } = res2;
|
|
44
|
+
const publicKey = compressPublicKey(Buffer.from(publicKeyHex, "hex"));
|
|
45
|
+
const chainCode = Buffer.from(core.mustBeDefined(chainCodeHex), "hex");
|
|
46
|
+
const coinDetails = networksUtil[core.mustBeDefined(core.slip44ByCoin(coin))];
|
|
47
|
+
const childNum = addressNList[addressNList.length - 1];
|
|
48
|
+
const networkMagic = coinDetails.bitcoinjs.bip32.public[scriptType];
|
|
49
|
+
if (networkMagic === undefined)
|
|
50
|
+
throw new Error(`scriptType ${scriptType} not supported`);
|
|
51
|
+
xpubs.push({
|
|
52
|
+
xpub: createXpub(addressNList.length, parentFingerprint, childNum, chainCode, publicKey, networkMagic),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return xpubs;
|
|
103
56
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
57
|
+
export async function ethSignTx(transport, msg) {
|
|
58
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
59
|
+
const common = Common.custom({ chainId: msg.chainId });
|
|
60
|
+
const txParams = {
|
|
61
|
+
to: msg.to,
|
|
62
|
+
value: msg.value,
|
|
63
|
+
data: msg.data,
|
|
64
|
+
chainId: msg.chainId,
|
|
65
|
+
nonce: msg.nonce,
|
|
66
|
+
gasLimit: msg.gasLimit,
|
|
67
|
+
gasPrice: msg.gasPrice,
|
|
68
|
+
v: "0x" + msg.chainId.toString(16).padStart(2, "0"),
|
|
69
|
+
r: "0x00",
|
|
70
|
+
s: "0x00",
|
|
71
|
+
};
|
|
72
|
+
const utx = new EthereumTx(txParams);
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
74
|
+
// @ts-ignore transport.call is drunk, there *is* a third argument to eth.signTransaction
|
|
75
|
+
// see https://github.com/LedgerHQ/ledgerjs/blob/master/packages/hw-app-eth/README.md#parameters-2
|
|
76
|
+
const res = await transport.call("Eth", "signTransaction", bip32path, utx.serialize().toString("hex"), null);
|
|
77
|
+
handleError(res, transport, "Could not sign ETH tx with Ledger");
|
|
78
|
+
const { v, r, s } = res.payload;
|
|
79
|
+
const tx = Transaction.fromTxData({
|
|
80
|
+
...txParams,
|
|
81
|
+
v: "0x" + v,
|
|
82
|
+
r: "0x" + r,
|
|
83
|
+
s: "0x" + s,
|
|
84
|
+
}, { common });
|
|
85
|
+
return {
|
|
86
|
+
v: parseInt(v, 16),
|
|
87
|
+
r: "0x" + r,
|
|
88
|
+
s: "0x" + s,
|
|
89
|
+
serialized: "0x" + core.toHexString(tx.serialize()),
|
|
90
|
+
};
|
|
136
91
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
-
return false;
|
|
141
|
-
});
|
|
92
|
+
export async function ethSupportsSecureTransfer() {
|
|
93
|
+
return false;
|
|
142
94
|
}
|
|
143
|
-
|
|
144
|
-
function ethSupportsNativeShapeShift() {
|
|
95
|
+
export function ethSupportsNativeShapeShift() {
|
|
145
96
|
return false;
|
|
146
97
|
}
|
|
147
|
-
|
|
148
|
-
function ethSupportsEIP1559() {
|
|
98
|
+
export function ethSupportsEIP1559() {
|
|
149
99
|
return false;
|
|
150
100
|
}
|
|
151
|
-
|
|
152
|
-
function ethGetAccountPaths(msg) {
|
|
101
|
+
export function ethGetAccountPaths(msg) {
|
|
153
102
|
const slip44 = core.slip44ByCoin(msg.coin);
|
|
154
103
|
if (slip44 === undefined)
|
|
155
104
|
return [];
|
|
@@ -168,73 +117,63 @@ function ethGetAccountPaths(msg) {
|
|
|
168
117
|
},
|
|
169
118
|
];
|
|
170
119
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
signature: "0x" + r + s + vStr,
|
|
192
|
-
};
|
|
193
|
-
});
|
|
120
|
+
export async function ethSignMessage(transport, msg) {
|
|
121
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
122
|
+
if (!isHexString(msg.message))
|
|
123
|
+
throw new Error("data is not an hex string");
|
|
124
|
+
// Ledger's inner implementation does a Buffer.from(messageHex, "hex").length on our message
|
|
125
|
+
// However, Buffer.from method with the "hex" encoding expects a valid hexadecimal string without the 0x prefix
|
|
126
|
+
// so we need to strip it in case it's present
|
|
127
|
+
const sanitizedMessageHex = msg.message.startsWith("0x") ? msg.message.slice(2) : msg.message;
|
|
128
|
+
const res = await transport.call("Eth", "signPersonalMessage", bip32path, sanitizedMessageHex);
|
|
129
|
+
handleError(res, transport, "Could not sign ETH message with Ledger");
|
|
130
|
+
let { v } = res.payload;
|
|
131
|
+
const { r, s } = res.payload;
|
|
132
|
+
v = v - 27;
|
|
133
|
+
const vStr = v.toString(16).padStart(2, "0");
|
|
134
|
+
const addressRes = await transport.call("Eth", "getAddress", bip32path, false);
|
|
135
|
+
handleError(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
136
|
+
return {
|
|
137
|
+
address: addressRes.payload.address,
|
|
138
|
+
signature: "0x" + r + s + vStr,
|
|
139
|
+
};
|
|
194
140
|
}
|
|
195
|
-
exports.ethSignMessage = ethSignMessage;
|
|
196
141
|
// TODO(gomes): Implement signEIP712Message instead and fallback to signEIP712HashedMessage only if it fails (incompatible with Nano S)
|
|
197
142
|
// https://github.com/LedgerHQ/ledger-live/blob/1de4de022b4e3abc02fcb823ae6ef1f9a64adba2/libs/ledgerjs/packages/hw-app-eth/README.md#signeip712message
|
|
198
143
|
// The reason why we don't do that now is because bumping hw-app-eth to latest means problems
|
|
199
|
-
function ethSignTypedData(transport, msg) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
v: typeof v === "string" ? parseInt(v, 16) : v,
|
|
215
|
-
});
|
|
216
|
-
const addressRes = yield transport.call("Eth", "getAddress", bip32path, false);
|
|
217
|
-
(0, utils_1.handleError)(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
218
|
-
return {
|
|
219
|
-
address: addressRes.payload.address,
|
|
220
|
-
signature,
|
|
221
|
-
};
|
|
144
|
+
export async function ethSignTypedData(transport, msg) {
|
|
145
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
146
|
+
if (!("EIP712Domain" in msg.typedData.types))
|
|
147
|
+
throw new Error("msg.typedData missing EIP712Domain");
|
|
148
|
+
const typedData = msg.typedData;
|
|
149
|
+
const { types, primaryType, message } = sigUtil.TypedDataUtils.sanitizeData(typedData);
|
|
150
|
+
const domainSeparatorHex = sigUtil.TypedDataUtils.eip712DomainHash(typedData, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
151
|
+
const hashStructMessageHex = sigUtil.TypedDataUtils.hashStruct(primaryType, message, types, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
152
|
+
const res = await transport.call("Eth", "signEIP712HashedMessage", bip32path, domainSeparatorHex, hashStructMessageHex);
|
|
153
|
+
handleError(res, transport, "Could not sign typed data with Ledger");
|
|
154
|
+
const { r, s, v } = res.payload;
|
|
155
|
+
const signature = joinSignature({
|
|
156
|
+
r: `0x${r}`,
|
|
157
|
+
s: `0x${s}`,
|
|
158
|
+
v: typeof v === "string" ? parseInt(v, 16) : v,
|
|
222
159
|
});
|
|
160
|
+
const addressRes = await transport.call("Eth", "getAddress", bip32path, false);
|
|
161
|
+
handleError(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
162
|
+
return {
|
|
163
|
+
address: addressRes.payload.address,
|
|
164
|
+
signature,
|
|
165
|
+
};
|
|
223
166
|
}
|
|
224
|
-
exports.ethSignTypedData = ethSignTypedData;
|
|
225
167
|
// Adapted from https://github.com/kvhnuke/etherwallet/blob/2a5bc0db1c65906b14d8c33ce9101788c70d3774/app/scripts/controllers/signMsgCtrl.js#L118
|
|
226
|
-
function ethVerifyMessage(msg) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
return core.stripHexPrefixAndLower(msg.address) === ethereumUtil.pubToAddress(pubKey).toString("hex");
|
|
237
|
-
});
|
|
168
|
+
export async function ethVerifyMessage(msg) {
|
|
169
|
+
const sigb = Buffer.from(core.stripHexPrefixAndLower(msg.signature), "hex");
|
|
170
|
+
if (sigb.length !== 65) {
|
|
171
|
+
return false;
|
|
172
|
+
}
|
|
173
|
+
sigb[64] = sigb[64] === 0 || sigb[64] === 1 ? sigb[64] + 27 : sigb[64];
|
|
174
|
+
const buffer = isBytes(msg.message) ? Buffer.from(arrayify(msg.message)) : Buffer.from(msg.message);
|
|
175
|
+
const hash = ethereumUtil.hashPersonalMessage(buffer);
|
|
176
|
+
const pubKey = ethereumUtil.ecrecover(hash, sigb[64], sigb.slice(0, 32), sigb.slice(32, 64));
|
|
177
|
+
return core.stripHexPrefixAndLower(msg.address) === ethereumUtil.pubToAddress(pubKey).toString("hex");
|
|
238
178
|
}
|
|
239
|
-
exports.ethVerifyMessage = ethVerifyMessage;
|
|
240
179
|
//# sourceMappingURL=ethereum.js.map
|
package/dist/ethereum.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ethereum.js","sourceRoot":"","sources":["../src/ethereum.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,WA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