@shapeshiftoss/hdwallet-ledger 1.55.4-alpha.1 → 1.55.4
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 +243 -177
- package/dist/bitcoin.js.map +1 -1
- package/dist/cosmos.js +82 -38
- package/dist/cosmos.js.map +1 -1
- package/dist/currencies.js +4 -1
- package/dist/currencies.js.map +1 -1
- package/dist/ethereum.d.ts.map +1 -1
- package/dist/ethereum.js +200 -143
- package/dist/ethereum.js.map +1 -1
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/ledger.js +284 -183
- package/dist/ledger.js.map +1 -1
- package/dist/thorchain/common.js +15 -10
- package/dist/thorchain/common.js.map +1 -1
- package/dist/thorchain/hw-app-thor.js +146 -125
- package/dist/thorchain/hw-app-thor.js.map +1 -1
- package/dist/thorchain/index.js +86 -39
- package/dist/thorchain/index.js.map +1 -1
- package/dist/transport.js +29 -4
- package/dist/transport.js.map +1 -1
- package/dist/utils.js +49 -13
- package/dist/utils.js.map +1 -1
- package/dist/utxoUtils.js +73 -67
- package/dist/utxoUtils.js.map +1 -1
- package/package.json +7 -7
package/dist/cosmos.js
CHANGED
|
@@ -1,22 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
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.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"))));
|
|
7
45
|
const ATOM_CHAIN = "cosmoshub-4";
|
|
8
|
-
|
|
46
|
+
const cosmosGetAddress = (transport, msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9
47
|
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
10
|
-
const res =
|
|
11
|
-
handleError(res, transport, "Unable to obtain address from device.");
|
|
48
|
+
const res = yield transport.call("Cosmos", "getAddress", bip32path, "cosmos");
|
|
49
|
+
(0, utils_1.handleError)(res, transport, "Unable to obtain address from device.");
|
|
12
50
|
return res.payload.address;
|
|
13
|
-
};
|
|
14
|
-
|
|
51
|
+
});
|
|
52
|
+
exports.cosmosGetAddress = cosmosGetAddress;
|
|
53
|
+
const cosmosSignTx = (transport, msg) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
54
|
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
16
|
-
const getAddressResponse =
|
|
17
|
-
handleError(getAddressResponse, transport, "Unable to obtain address and public key from device.");
|
|
55
|
+
const getAddressResponse = yield transport.call("Cosmos", "getAddress", bip32path, "cosmos");
|
|
56
|
+
(0, utils_1.handleError)(getAddressResponse, transport, "Unable to obtain address and public key from device.");
|
|
18
57
|
const { address, publicKey } = getAddressResponse.payload;
|
|
19
|
-
const unsignedTx = stringifyKeysInOrder({
|
|
58
|
+
const unsignedTx = (0, utils_1.stringifyKeysInOrder)({
|
|
20
59
|
account_number: msg.account_number,
|
|
21
60
|
chain_id: ATOM_CHAIN,
|
|
22
61
|
fee: { amount: msg.tx.fee.amount, gas: msg.tx.fee.gas },
|
|
@@ -24,34 +63,38 @@ export const cosmosSignTx = async (transport, msg) => {
|
|
|
24
63
|
msgs: msg.tx.msg,
|
|
25
64
|
sequence: msg.sequence,
|
|
26
65
|
});
|
|
27
|
-
const signResponse =
|
|
28
|
-
handleError(signResponse, transport, "Unable to obtain signature from device.");
|
|
66
|
+
const signResponse = yield transport.call("Cosmos", "sign", bip32path, unsignedTx);
|
|
67
|
+
(0, utils_1.handleError)(signResponse, transport, "Unable to obtain signature from device.");
|
|
29
68
|
const signature = signResponse.payload.signature;
|
|
30
69
|
if (!signature)
|
|
31
70
|
throw new Error("No signature returned from device");
|
|
32
71
|
const offlineSigner = {
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
72
|
+
getAccounts() {
|
|
73
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
address,
|
|
77
|
+
algo: "secp256k1",
|
|
78
|
+
pubkey: Buffer.from(publicKey, "hex"),
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
});
|
|
41
82
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
83
|
+
signAmino(signerAddress, signDoc) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
if (signerAddress !== address)
|
|
86
|
+
throw new Error("expected signerAddress to match address");
|
|
87
|
+
return {
|
|
88
|
+
signed: signDoc,
|
|
89
|
+
signature: {
|
|
90
|
+
pub_key: {
|
|
91
|
+
type: "tendermint/PubKeySecp256k1",
|
|
92
|
+
value: publicKey,
|
|
93
|
+
},
|
|
94
|
+
signature: (0, base64_js_1.fromByteArray)(crypto_1.Secp256k1Signature.fromDer(signature).toFixedLength()),
|
|
51
95
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
96
|
+
};
|
|
97
|
+
});
|
|
55
98
|
},
|
|
56
99
|
};
|
|
57
100
|
const signerData = {
|
|
@@ -59,6 +102,7 @@ export const cosmosSignTx = async (transport, msg) => {
|
|
|
59
102
|
accountNumber: Number(msg.account_number),
|
|
60
103
|
chainId: msg.chain_id,
|
|
61
104
|
};
|
|
62
|
-
return (
|
|
63
|
-
};
|
|
105
|
+
return (yield protoTxBuilder).sign(address, msg.tx, offlineSigner, signerData, "cosmos");
|
|
106
|
+
});
|
|
107
|
+
exports.cosmosSignTx = cosmosSignTx;
|
|
64
108
|
//# 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":"AACA,
|
|
1
|
+
{"version":3,"file":"cosmos.js","sourceRoot":"","sources":["../src/cosmos.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2CAAoD;AAEpD,mEAAqD;AACrD,yCAA0C;AAC1C,oDAA2B;AAG3B,mCAA4D;AAE5D,MAAM,cAAc,GAAG,gBAAK,CAAC,IAAI,CAAC,GAAG,EAAE,mDAAQ,iCAAiC,GAAC,CAAC,CAAC;AAEnF,MAAM,UAAU,GAAG,aAAa,CAAC;AAE1B,MAAM,gBAAgB,GAAG,CAAO,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,IAAA,mBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,uCAAuC,CAAC,CAAC;IAErE,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;AAC7B,CAAC,CAAA,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEK,MAAM,YAAY,GAAG,CAC1B,SAA0B,EAC1B,GAAsB,EACQ,EAAE;IAChC,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,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AAqB,EAAE,OAAmB;;gBACxD,IAAI,aAAa,KAAK,OAAO;oBAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;gBAE1F,OAAO;oBACL,MAAM,EAAE,OAAO;oBACf,SAAS,EAAE;wBACT,OAAO,EAAE;4BACP,IAAI,EAAE,4BAA4B;4BAClC,KAAK,EAAE,SAAS;yBACjB;wBACD,SAAS,EAAE,IAAA,yBAAa,EAAC,2BAAkB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,aAAa,EAAE,CAAC;qBAChF;iBACF,CAAC;YACJ,CAAC;SAAA;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,CAAA,CAAC;AA9DW,QAAA,YAAY,gBA8DvB"}
|
package/dist/currencies.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
// Taken from https://github.com/LedgerHQ/ledgerjs/blob/master/packages/cryptoassets/src/currencies.ts#L299
|
|
2
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.currencies = void 0;
|
|
5
|
+
exports.currencies = {
|
|
3
6
|
Bitcoin: {
|
|
4
7
|
name: "Bitcoin",
|
|
5
8
|
xpubVersion: 0x0488b21e,
|
package/dist/currencies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":"AAAA,2GAA2G
|
|
1
|
+
{"version":3,"file":"currencies.js","sourceRoot":"","sources":["../src/currencies.ts"],"names":[],"mappings":";AAAA,2GAA2G;;;AAI9F,QAAA,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":"
|
|
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,104 +1,157 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
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.ethSupportsNetwork = ethSupportsNetwork;
|
|
39
|
+
exports.ethGetAddress = ethGetAddress;
|
|
40
|
+
exports.ethGetPublicKeys = ethGetPublicKeys;
|
|
41
|
+
exports.ethSignTx = ethSignTx;
|
|
42
|
+
exports.ethSupportsSecureTransfer = ethSupportsSecureTransfer;
|
|
43
|
+
exports.ethSupportsNativeShapeShift = ethSupportsNativeShapeShift;
|
|
44
|
+
exports.ethSupportsEIP1559 = ethSupportsEIP1559;
|
|
45
|
+
exports.ethGetAccountPaths = ethGetAccountPaths;
|
|
46
|
+
exports.ethSignMessage = ethSignMessage;
|
|
47
|
+
exports.ethSignTypedData = ethSignTypedData;
|
|
48
|
+
exports.ethVerifyMessage = ethVerifyMessage;
|
|
49
|
+
const common_1 = __importDefault(require("@ethereumjs/common"));
|
|
50
|
+
const tx_1 = require("@ethereumjs/tx");
|
|
51
|
+
const sigUtil = __importStar(require("@metamask/eth-sig-util"));
|
|
52
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
53
|
+
const ethereumjs_tx_1 = __importDefault(require("ethereumjs-tx"));
|
|
6
54
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
7
55
|
// @ts-ignore
|
|
8
56
|
// TODO: fix ts-ignore
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return
|
|
57
|
+
const ethereumUtil = __importStar(require("ethereumjs-util"));
|
|
58
|
+
const utils_1 = require("ethers/lib/utils");
|
|
59
|
+
const utils_2 = require("./utils");
|
|
60
|
+
function ethSupportsNetwork(chain_id) {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
return chain_id === 1;
|
|
63
|
+
});
|
|
14
64
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
65
|
+
function ethGetAddress(transport, msg) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
68
|
+
const res = yield transport.call("Eth", "getAddress", bip32path, !!msg.showDisplay);
|
|
69
|
+
(0, utils_2.handleError)(res, transport, "Unable to obtain ETH address from device.");
|
|
70
|
+
return res.payload.address;
|
|
71
|
+
});
|
|
20
72
|
}
|
|
21
73
|
// Adapted from https://github.com/LedgerHQ/ledger-wallet-webtool
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
scriptType
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
74
|
+
function ethGetPublicKeys(transport, msg) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const xpubs = [];
|
|
77
|
+
for (const getPublicKey of msg) {
|
|
78
|
+
const { addressNList, coin } = getPublicKey;
|
|
79
|
+
let { scriptType } = getPublicKey;
|
|
80
|
+
if (!scriptType)
|
|
81
|
+
scriptType = core.BTCInputScriptType.SpendAddress;
|
|
82
|
+
// Only get public keys for ETH account paths
|
|
83
|
+
if (!addressNList.includes(0x80000000 + 44, 0) || !addressNList.includes(0x80000000 + 60, 1)) {
|
|
84
|
+
xpubs.push(null);
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const parentBip32path = core.addressNListToBIP32(addressNList.slice(0, -1)).substring(2); // i.e. "44'/0'"
|
|
88
|
+
const bip32path = core.addressNListToBIP32(addressNList).substring(2); // i.e 44'/0'/0'
|
|
89
|
+
const res1 = yield transport.call("Eth", "getAddress", parentBip32path, /* display */ false, /* chain code */ true);
|
|
90
|
+
(0, utils_2.handleError)(res1, transport, "Unable to obtain public key from device.");
|
|
91
|
+
const { payload: { publicKey: parentPublicKeyHex }, } = res1;
|
|
92
|
+
const parentPublicKey = (0, utils_2.compressPublicKey)(Buffer.from(parentPublicKeyHex, "hex"));
|
|
93
|
+
const parentFingerprint = new DataView(ethereumUtil.ripemd160(ethereumUtil.sha256(parentPublicKey), false).buffer).getUint32(0);
|
|
94
|
+
const res2 = yield transport.call("Eth", "getAddress", bip32path, /* display */ false, /* chain code */ true);
|
|
95
|
+
(0, utils_2.handleError)(res2, transport, "Unable to obtain public key from device.");
|
|
96
|
+
const { payload: { publicKey: publicKeyHex, chainCode: chainCodeHex }, } = res2;
|
|
97
|
+
const publicKey = (0, utils_2.compressPublicKey)(Buffer.from(publicKeyHex, "hex"));
|
|
98
|
+
const chainCode = Buffer.from(core.mustBeDefined(chainCodeHex), "hex");
|
|
99
|
+
const coinDetails = utils_2.networksUtil[core.mustBeDefined(core.slip44ByCoin(coin))];
|
|
100
|
+
const childNum = addressNList[addressNList.length - 1];
|
|
101
|
+
const networkMagic = coinDetails.bitcoinjs.bip32.public[scriptType];
|
|
102
|
+
if (networkMagic === undefined)
|
|
103
|
+
throw new Error(`scriptType ${scriptType} not supported`);
|
|
104
|
+
xpubs.push({
|
|
105
|
+
xpub: (0, utils_2.createXpub)(addressNList.length, parentFingerprint, childNum, chainCode, publicKey, networkMagic),
|
|
106
|
+
});
|
|
33
107
|
}
|
|
34
|
-
|
|
35
|
-
|
|
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;
|
|
108
|
+
return xpubs;
|
|
109
|
+
});
|
|
56
110
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
s: "0x" + s,
|
|
89
|
-
serialized: "0x" + core.toHexString(tx.serialize()),
|
|
90
|
-
};
|
|
111
|
+
function ethSignTx(transport, msg) {
|
|
112
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
113
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
114
|
+
const common = common_1.default.custom({ chainId: msg.chainId });
|
|
115
|
+
const txParams = {
|
|
116
|
+
to: msg.to,
|
|
117
|
+
value: msg.value,
|
|
118
|
+
data: msg.data,
|
|
119
|
+
chainId: msg.chainId,
|
|
120
|
+
nonce: msg.nonce,
|
|
121
|
+
gasLimit: msg.gasLimit,
|
|
122
|
+
gasPrice: msg.gasPrice,
|
|
123
|
+
v: "0x" + msg.chainId.toString(16).padStart(2, "0"),
|
|
124
|
+
r: "0x00",
|
|
125
|
+
s: "0x00",
|
|
126
|
+
};
|
|
127
|
+
const utx = new ethereumjs_tx_1.default(txParams);
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
129
|
+
// @ts-ignore transport.call is drunk, there *is* a third argument to eth.signTransaction
|
|
130
|
+
// see https://github.com/LedgerHQ/ledgerjs/blob/master/packages/hw-app-eth/README.md#parameters-2
|
|
131
|
+
const res = yield transport.call("Eth", "signTransaction", bip32path, utx.serialize().toString("hex"), null);
|
|
132
|
+
(0, utils_2.handleError)(res, transport, "Could not sign ETH tx with Ledger");
|
|
133
|
+
const { v, r, s } = res.payload;
|
|
134
|
+
const tx = tx_1.Transaction.fromTxData(Object.assign(Object.assign({}, txParams), { v: "0x" + v, r: "0x" + r, s: "0x" + s }), { common });
|
|
135
|
+
return {
|
|
136
|
+
v: parseInt(v, 16),
|
|
137
|
+
r: "0x" + r,
|
|
138
|
+
s: "0x" + s,
|
|
139
|
+
serialized: "0x" + core.toHexString(tx.serialize()),
|
|
140
|
+
};
|
|
141
|
+
});
|
|
91
142
|
}
|
|
92
|
-
|
|
93
|
-
return
|
|
143
|
+
function ethSupportsSecureTransfer() {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
return false;
|
|
146
|
+
});
|
|
94
147
|
}
|
|
95
|
-
|
|
148
|
+
function ethSupportsNativeShapeShift() {
|
|
96
149
|
return false;
|
|
97
150
|
}
|
|
98
|
-
|
|
151
|
+
function ethSupportsEIP1559() {
|
|
99
152
|
return false;
|
|
100
153
|
}
|
|
101
|
-
|
|
154
|
+
function ethGetAccountPaths(msg) {
|
|
102
155
|
const slip44 = core.slip44ByCoin(msg.coin);
|
|
103
156
|
if (slip44 === undefined)
|
|
104
157
|
return [];
|
|
@@ -117,65 +170,69 @@ export function ethGetAccountPaths(msg) {
|
|
|
117
170
|
},
|
|
118
171
|
];
|
|
119
172
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
export async function ethSignTypedData(transport, msg) {
|
|
142
|
-
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
143
|
-
if (!("EIP712Domain" in msg.typedData.types))
|
|
144
|
-
throw new Error("msg.typedData missing EIP712Domain");
|
|
145
|
-
const typedData = msg.typedData;
|
|
146
|
-
const { types, primaryType, message } = sigUtil.TypedDataUtils.sanitizeData(typedData);
|
|
147
|
-
const domainSeparatorHex = sigUtil.TypedDataUtils.eip712DomainHash(typedData, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
148
|
-
const hashStructMessageHex = sigUtil.TypedDataUtils.hashStruct(primaryType, message, types, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
149
|
-
// The old Ledger Nano S (not S+) doesn't support signEIP712Message, so we have to fallback to signEIP712HashedMessage only if it fails
|
|
150
|
-
// https://github.com/LedgerHQ/ledger-live/blob/1de4de022b4e3abc02fcb823ae6ef1f9a64adba2/libs/ledgerjs/packages/hw-app-eth/README.md#signeip712message
|
|
151
|
-
const res = await transport.call("Eth", "signEIP712Message", bip32path, msg.typedData).catch((e) => {
|
|
152
|
-
console.error(e);
|
|
153
|
-
return transport.call("Eth", "signEIP712HashedMessage", bip32path, domainSeparatorHex, hashStructMessageHex);
|
|
173
|
+
function ethSignMessage(transport, msg) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
176
|
+
if (!(0, utils_1.isHexString)(msg.message))
|
|
177
|
+
throw new Error("data is not an hex string");
|
|
178
|
+
// Ledger's inner implementation does a Buffer.from(messageHex, "hex").length on our message
|
|
179
|
+
// However, Buffer.from method with the "hex" encoding expects a valid hexadecimal string without the 0x prefix
|
|
180
|
+
// so we need to strip it in case it's present
|
|
181
|
+
const sanitizedMessageHex = msg.message.startsWith("0x") ? msg.message.slice(2) : msg.message;
|
|
182
|
+
const res = yield transport.call("Eth", "signPersonalMessage", bip32path, sanitizedMessageHex);
|
|
183
|
+
(0, utils_2.handleError)(res, transport, "Could not sign ETH message with Ledger");
|
|
184
|
+
let { v } = res.payload;
|
|
185
|
+
const { r, s } = res.payload;
|
|
186
|
+
v = v - 27;
|
|
187
|
+
const vStr = v.toString(16).padStart(2, "0");
|
|
188
|
+
const addressRes = yield transport.call("Eth", "getAddress", bip32path, false);
|
|
189
|
+
(0, utils_2.handleError)(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
190
|
+
return {
|
|
191
|
+
address: addressRes.payload.address,
|
|
192
|
+
signature: "0x" + r + s + vStr,
|
|
193
|
+
};
|
|
154
194
|
});
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
195
|
+
}
|
|
196
|
+
// TODO(gomes): Implement signEIP712Message instead and fallback to signEIP712HashedMessage only if it fails (incompatible with Nano S)
|
|
197
|
+
// https://github.com/LedgerHQ/ledger-live/blob/1de4de022b4e3abc02fcb823ae6ef1f9a64adba2/libs/ledgerjs/packages/hw-app-eth/README.md#signeip712message
|
|
198
|
+
// 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
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
const bip32path = core.addressNListToBIP32(msg.addressNList);
|
|
202
|
+
if (!("EIP712Domain" in msg.typedData.types))
|
|
203
|
+
throw new Error("msg.typedData missing EIP712Domain");
|
|
204
|
+
const typedData = msg.typedData;
|
|
205
|
+
const { types, primaryType, message } = sigUtil.TypedDataUtils.sanitizeData(typedData);
|
|
206
|
+
const domainSeparatorHex = sigUtil.TypedDataUtils.eip712DomainHash(typedData, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
207
|
+
const hashStructMessageHex = sigUtil.TypedDataUtils.hashStruct(primaryType, message, types, sigUtil.SignTypedDataVersion.V4).toString("hex");
|
|
208
|
+
const res = yield transport.call("Eth", "signEIP712HashedMessage", bip32path, domainSeparatorHex, hashStructMessageHex);
|
|
209
|
+
(0, utils_2.handleError)(res, transport, "Could not sign typed data with Ledger");
|
|
210
|
+
const { r, s, v } = res.payload;
|
|
211
|
+
const signature = (0, utils_1.joinSignature)({
|
|
212
|
+
r: `0x${r}`,
|
|
213
|
+
s: `0x${s}`,
|
|
214
|
+
v: typeof v === "string" ? parseInt(v, 16) : v,
|
|
215
|
+
});
|
|
216
|
+
const addressRes = yield transport.call("Eth", "getAddress", bip32path, false);
|
|
217
|
+
(0, utils_2.handleError)(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
218
|
+
return {
|
|
219
|
+
address: addressRes.payload.address,
|
|
220
|
+
signature,
|
|
221
|
+
};
|
|
161
222
|
});
|
|
162
|
-
const addressRes = await transport.call("Eth", "getAddress", bip32path, false);
|
|
163
|
-
handleError(addressRes, transport, "Unable to obtain ETH address from Ledger.");
|
|
164
|
-
return {
|
|
165
|
-
address: addressRes.payload.address,
|
|
166
|
-
signature,
|
|
167
|
-
};
|
|
168
223
|
}
|
|
169
224
|
// Adapted from https://github.com/kvhnuke/etherwallet/blob/2a5bc0db1c65906b14d8c33ce9101788c70d3774/app/scripts/controllers/signMsgCtrl.js#L118
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
225
|
+
function ethVerifyMessage(msg) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
const sigb = Buffer.from(core.stripHexPrefixAndLower(msg.signature), "hex");
|
|
228
|
+
if (sigb.length !== 65) {
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
sigb[64] = sigb[64] === 0 || sigb[64] === 1 ? sigb[64] + 27 : sigb[64];
|
|
232
|
+
const buffer = (0, utils_1.isBytes)(msg.message) ? Buffer.from((0, utils_1.arrayify)(msg.message)) : Buffer.from(msg.message);
|
|
233
|
+
const hash = ethereumUtil.hashPersonalMessage(buffer);
|
|
234
|
+
const pubKey = ethereumUtil.ecrecover(hash, sigb[64], sigb.slice(0, 32), sigb.slice(32, 64));
|
|
235
|
+
return core.stripHexPrefixAndLower(msg.address) === ethereumUtil.pubToAddress(pubKey).toString("hex");
|
|
236
|
+
});
|
|
180
237
|
}
|
|
181
238
|
//# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,gDAEC;AAED,sCAMC;AAGD,4CAmDC;AAED,8BA0CC;AAED,8DAEC;AAED,kEAEC;AAED,gDAEC;AAED,gDAiBC;AAED,wCA2BC;AAKD,4CAgDC;AAGD,4CAWC;AAzPD,gEAAwC;AACxC,uCAA6C;AAC7C,gEAAkD;AAClD,mEAAqD;AACrD,kEAAuC;AACvC,6DAA6D;AAC7D,aAAa;AACb,sBAAsB;AACtB,8DAAgD;AAChD,4CAAiF;AAGjF,mCAAmF;AAEnF,SAAsB,kBAAkB,CAAC,QAAgB;;QACvD,OAAO,QAAQ,KAAK,CAAC,CAAC;IACxB,CAAC;CAAA;AAED,SAAsB,aAAa,CAAC,SAA0B,EAAE,GAAuB;;QACrF,MAAM,SAAS,GAAG,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC7D,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACpF,IAAA,mBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,2CAA2C,CAAC,CAAC;QAEzE,OAAO,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;IAC7B,CAAC;CAAA;AAED,iEAAiE;AACjE,SAA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