@shapeshiftoss/hdwallet-trezor 1.55.3 → 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 +157 -99
- package/dist/bitcoin.js.map +1 -1
- package/dist/ethereum.js +121 -66
- package/dist/ethereum.js.map +1 -1
- package/dist/index.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/transport.js +30 -3
- package/dist/transport.js.map +1 -1
- package/dist/trezor.js +309 -194
- package/dist/trezor.js.map +1 -1
- package/dist/utils.js +28 -2
- package/dist/utils.js.map +1 -1
- package/package.json +3 -3
package/dist/trezor.js
CHANGED
|
@@ -1,10 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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.TrezorHDWallet = exports.TrezorHDWalletInfo = void 0;
|
|
39
|
+
exports.isTrezor = isTrezor;
|
|
40
|
+
exports.info = info;
|
|
41
|
+
exports.create = create;
|
|
42
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
43
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
44
|
+
const Btc = __importStar(require("./bitcoin"));
|
|
45
|
+
const Eth = __importStar(require("./ethereum"));
|
|
46
|
+
const utils_1 = require("./utils");
|
|
47
|
+
function isTrezor(wallet) {
|
|
48
|
+
return lodash_1.default.isObject(wallet) && wallet._isTrezor;
|
|
8
49
|
}
|
|
9
50
|
function describeETHPath(path) {
|
|
10
51
|
const pathStr = core.addressNListToBIP32(path);
|
|
@@ -36,6 +77,7 @@ function describeETHPath(path) {
|
|
|
36
77
|
};
|
|
37
78
|
}
|
|
38
79
|
function describeUTXOPath(path, coin, scriptType) {
|
|
80
|
+
var _a;
|
|
39
81
|
const pathStr = core.addressNListToBIP32(path);
|
|
40
82
|
const unknown = {
|
|
41
83
|
verbose: pathStr,
|
|
@@ -65,11 +107,11 @@ function describeUTXOPath(path, coin, scriptType) {
|
|
|
65
107
|
return unknown;
|
|
66
108
|
const wholeAccount = path.length === 3;
|
|
67
109
|
let script = scriptType
|
|
68
|
-
? {
|
|
110
|
+
? (_a = {
|
|
69
111
|
[core.BTCInputScriptType.SpendAddress]: " (Legacy)",
|
|
70
112
|
[core.BTCInputScriptType.SpendP2SHWitness]: "",
|
|
71
113
|
[core.BTCInputScriptType.SpendWitness]: " (Segwit Native)",
|
|
72
|
-
}[scriptType]
|
|
114
|
+
}[scriptType]) !== null && _a !== void 0 ? _a : ""
|
|
73
115
|
: "";
|
|
74
116
|
switch (coin) {
|
|
75
117
|
case "Bitcoin":
|
|
@@ -108,20 +150,28 @@ function describeUTXOPath(path, coin, scriptType) {
|
|
|
108
150
|
};
|
|
109
151
|
}
|
|
110
152
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
153
|
+
class TrezorHDWalletInfo {
|
|
154
|
+
constructor() {
|
|
155
|
+
this._supportsBTCInfo = true;
|
|
156
|
+
this._supportsETHInfo = true;
|
|
157
|
+
}
|
|
114
158
|
getVendor() {
|
|
115
159
|
return "Trezor";
|
|
116
160
|
}
|
|
117
|
-
|
|
118
|
-
return
|
|
161
|
+
btcSupportsCoin(coin) {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
return Btc.btcSupportsCoin(coin);
|
|
164
|
+
});
|
|
119
165
|
}
|
|
120
|
-
|
|
121
|
-
return
|
|
166
|
+
btcSupportsScriptType(coin, scriptType) {
|
|
167
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
+
return Btc.btcSupportsScriptType(coin, scriptType);
|
|
169
|
+
});
|
|
122
170
|
}
|
|
123
|
-
|
|
124
|
-
return
|
|
171
|
+
btcSupportsSecureTransfer() {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
return Btc.btcSupportsSecureTransfer();
|
|
174
|
+
});
|
|
125
175
|
}
|
|
126
176
|
btcSupportsNativeShapeShift() {
|
|
127
177
|
return Btc.btcSupportsNativeShapeShift();
|
|
@@ -132,17 +182,23 @@ export class TrezorHDWalletInfo {
|
|
|
132
182
|
btcIsSameAccount(msg) {
|
|
133
183
|
return Btc.btcIsSameAccount(msg);
|
|
134
184
|
}
|
|
135
|
-
|
|
136
|
-
return
|
|
185
|
+
ethSupportsNetwork(chain_id) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return Eth.ethSupportsNetwork(chain_id);
|
|
188
|
+
});
|
|
137
189
|
}
|
|
138
|
-
|
|
139
|
-
return
|
|
190
|
+
ethSupportsSecureTransfer() {
|
|
191
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
192
|
+
return Eth.ethSupportsSecureTransfer();
|
|
193
|
+
});
|
|
140
194
|
}
|
|
141
195
|
ethSupportsNativeShapeShift() {
|
|
142
196
|
return Eth.ethSupportsNativeShapeShift();
|
|
143
197
|
}
|
|
144
|
-
|
|
145
|
-
return
|
|
198
|
+
ethSupportsEIP1559() {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
return yield Eth.ethSupportsEIP1559();
|
|
201
|
+
});
|
|
146
202
|
}
|
|
147
203
|
ethGetAccountPaths(msg) {
|
|
148
204
|
return Eth.ethGetAccountPaths(msg);
|
|
@@ -191,10 +247,7 @@ export class TrezorHDWalletInfo {
|
|
|
191
247
|
addressNList[0] === 0x80000000 + 49 ||
|
|
192
248
|
addressNList[0] === 0x80000000 + 84) {
|
|
193
249
|
addressNList[2] += 1;
|
|
194
|
-
return {
|
|
195
|
-
...msg,
|
|
196
|
-
addressNList,
|
|
197
|
-
};
|
|
250
|
+
return Object.assign(Object.assign({}, msg), { addressNList });
|
|
198
251
|
}
|
|
199
252
|
return undefined;
|
|
200
253
|
}
|
|
@@ -206,186 +259,219 @@ export class TrezorHDWalletInfo {
|
|
|
206
259
|
}
|
|
207
260
|
if (addressNList[0] === 0x80000000 + 44) {
|
|
208
261
|
addressNList[4] += 1;
|
|
209
|
-
return {
|
|
210
|
-
...msg,
|
|
211
|
-
addressNList,
|
|
212
|
-
hardenedPath: core.hardenedPath(addressNList),
|
|
213
|
-
relPath: core.relativePath(addressNList),
|
|
214
|
-
};
|
|
262
|
+
return Object.assign(Object.assign({}, msg), { addressNList, hardenedPath: core.hardenedPath(addressNList), relPath: core.relativePath(addressNList) });
|
|
215
263
|
}
|
|
216
264
|
return undefined;
|
|
217
265
|
}
|
|
218
266
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
_supportsBTCInfo = true;
|
|
222
|
-
_supportsBTC = true;
|
|
223
|
-
_supportsETH = true;
|
|
224
|
-
_supportsEthSwitchChain = true;
|
|
225
|
-
_supportsAvalanche = true;
|
|
226
|
-
_supportsOptimism = false;
|
|
227
|
-
_supportsBSC = false;
|
|
228
|
-
_supportsPolygon = false;
|
|
229
|
-
_supportsGnosis = false;
|
|
230
|
-
_supportsArbitrum = true;
|
|
231
|
-
_supportsArbitrumNova = true;
|
|
232
|
-
_supportsBase = true;
|
|
233
|
-
_supportsKavaInfo = true;
|
|
234
|
-
_supportsTerraInfo = true;
|
|
235
|
-
_isTrezor = true;
|
|
236
|
-
transport;
|
|
237
|
-
featuresCache;
|
|
238
|
-
info;
|
|
267
|
+
exports.TrezorHDWalletInfo = TrezorHDWalletInfo;
|
|
268
|
+
class TrezorHDWallet {
|
|
239
269
|
constructor(transport) {
|
|
270
|
+
this._supportsETHInfo = true;
|
|
271
|
+
this._supportsBTCInfo = true;
|
|
272
|
+
this._supportsBTC = true;
|
|
273
|
+
this._supportsETH = true;
|
|
274
|
+
this._supportsEthSwitchChain = true;
|
|
275
|
+
this._supportsAvalanche = true;
|
|
276
|
+
this._supportsOptimism = false;
|
|
277
|
+
this._supportsBSC = false;
|
|
278
|
+
this._supportsPolygon = false;
|
|
279
|
+
this._supportsGnosis = false;
|
|
280
|
+
this._supportsArbitrum = true;
|
|
281
|
+
this._supportsArbitrumNova = true;
|
|
282
|
+
this._supportsBase = true;
|
|
283
|
+
this._supportsKavaInfo = true;
|
|
284
|
+
this._supportsTerraInfo = true;
|
|
285
|
+
this._isTrezor = true;
|
|
240
286
|
this.transport = transport;
|
|
241
287
|
this.info = new TrezorHDWalletInfo();
|
|
242
288
|
}
|
|
243
|
-
|
|
244
|
-
return
|
|
289
|
+
initialize() {
|
|
290
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
291
|
+
return;
|
|
292
|
+
});
|
|
245
293
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
294
|
+
isInitialized() {
|
|
295
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
296
|
+
const features = yield this.getFeatures(/*cached*/ true);
|
|
297
|
+
return features.initialized;
|
|
298
|
+
});
|
|
249
299
|
}
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
300
|
+
getDeviceID() {
|
|
301
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
302
|
+
const { device: { deviceID: transportId }, } = this.transport;
|
|
303
|
+
if (transportId)
|
|
304
|
+
return transportId;
|
|
305
|
+
const features = yield this.getFeatures(/*cached*/ true);
|
|
306
|
+
return features.device_id;
|
|
307
|
+
});
|
|
256
308
|
}
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
309
|
+
getFirmwareVersion() {
|
|
310
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
311
|
+
const features = yield this.getFeatures(/*cached*/ true);
|
|
312
|
+
return `v${features.major_version}.${features.minor_version}.${features.patch_version}`;
|
|
313
|
+
});
|
|
260
314
|
}
|
|
261
315
|
getVendor() {
|
|
262
316
|
return "Trezor";
|
|
263
317
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
318
|
+
getModel() {
|
|
319
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
320
|
+
const features = yield this.getFeatures(/*cached*/ true);
|
|
321
|
+
return "Trezor " + features.model;
|
|
322
|
+
});
|
|
267
323
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
324
|
+
getLabel() {
|
|
325
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
326
|
+
const features = yield this.getFeatures(/*cached*/ true);
|
|
327
|
+
return typeof features.label === "string" ? features.label : "";
|
|
328
|
+
});
|
|
271
329
|
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
330
|
+
getFeatures() {
|
|
331
|
+
return __awaiter(this, arguments, void 0, function* (cached = false) {
|
|
332
|
+
if (cached && this.featuresCache)
|
|
333
|
+
return this.featuresCache;
|
|
334
|
+
const res = yield this.transport.call("getFeatures", {});
|
|
335
|
+
(0, utils_1.handleError)(this.transport, res, "Could not get Trezor features");
|
|
336
|
+
this.cacheFeatures(res.payload);
|
|
337
|
+
return res.payload;
|
|
338
|
+
});
|
|
279
339
|
}
|
|
280
340
|
cacheFeatures(features) {
|
|
281
341
|
this.featuresCache = features;
|
|
282
342
|
}
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
path: request.addressNList,
|
|
290
|
-
coin: request.coin || "Bitcoin",
|
|
291
|
-
crossChain: true,
|
|
292
|
-
};
|
|
293
|
-
}),
|
|
294
|
-
});
|
|
295
|
-
handleError(this.transport, res, "Could not load xpubs from Trezor");
|
|
296
|
-
return res.payload.map((result, i) => {
|
|
297
|
-
const scriptType = msg[i].scriptType;
|
|
298
|
-
switch (scriptType) {
|
|
299
|
-
case core.BTCInputScriptType.SpendP2SHWitness:
|
|
300
|
-
case core.BTCInputScriptType.SpendWitness: {
|
|
301
|
-
const xpub = result.xpubSegwit;
|
|
302
|
-
if (!xpub)
|
|
303
|
-
throw new Error("unable to get public key");
|
|
304
|
-
return {
|
|
305
|
-
xpub,
|
|
306
|
-
};
|
|
307
|
-
}
|
|
308
|
-
case core.BTCInputScriptType.SpendAddress:
|
|
309
|
-
default: {
|
|
310
|
-
const xpub = result.xpub;
|
|
311
|
-
if (!xpub)
|
|
312
|
-
throw new Error("unable to get public key");
|
|
343
|
+
getPublicKeys(msg) {
|
|
344
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
345
|
+
if (!msg.length)
|
|
346
|
+
return [];
|
|
347
|
+
const res = yield this.transport.call("getPublicKey", {
|
|
348
|
+
bundle: msg.map((request) => {
|
|
313
349
|
return {
|
|
314
|
-
|
|
350
|
+
path: request.addressNList,
|
|
351
|
+
coin: request.coin || "Bitcoin",
|
|
352
|
+
crossChain: true,
|
|
315
353
|
};
|
|
354
|
+
}),
|
|
355
|
+
});
|
|
356
|
+
(0, utils_1.handleError)(this.transport, res, "Could not load xpubs from Trezor");
|
|
357
|
+
return res.payload.map((result, i) => {
|
|
358
|
+
const scriptType = msg[i].scriptType;
|
|
359
|
+
switch (scriptType) {
|
|
360
|
+
case core.BTCInputScriptType.SpendP2SHWitness:
|
|
361
|
+
case core.BTCInputScriptType.SpendWitness: {
|
|
362
|
+
const xpub = result.xpubSegwit;
|
|
363
|
+
if (!xpub)
|
|
364
|
+
throw new Error("unable to get public key");
|
|
365
|
+
return {
|
|
366
|
+
xpub,
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
case core.BTCInputScriptType.SpendAddress:
|
|
370
|
+
default: {
|
|
371
|
+
const xpub = result.xpub;
|
|
372
|
+
if (!xpub)
|
|
373
|
+
throw new Error("unable to get public key");
|
|
374
|
+
return {
|
|
375
|
+
xpub,
|
|
376
|
+
};
|
|
377
|
+
}
|
|
316
378
|
}
|
|
317
|
-
}
|
|
379
|
+
});
|
|
318
380
|
});
|
|
319
381
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
382
|
+
isLocked() {
|
|
383
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
384
|
+
const features = yield this.getFeatures(false);
|
|
385
|
+
if (features.pin_protection && !features.pin_cached)
|
|
386
|
+
return true;
|
|
387
|
+
if (features.passphrase_protection && !features.passphrase_cached)
|
|
388
|
+
return true;
|
|
389
|
+
return false;
|
|
390
|
+
});
|
|
327
391
|
}
|
|
328
|
-
|
|
329
|
-
|
|
392
|
+
clearSession() {
|
|
393
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
394
|
+
// TrezorConnect doesn't expose session management, so this is a no-op.
|
|
395
|
+
});
|
|
330
396
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
397
|
+
sendPin(pin) {
|
|
398
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
399
|
+
yield this.transport.call("uiResponse", {
|
|
400
|
+
type: "ui-receive_pin",
|
|
401
|
+
payload: pin,
|
|
402
|
+
});
|
|
335
403
|
});
|
|
336
404
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
405
|
+
sendPassphrase(passphrase) {
|
|
406
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
407
|
+
yield this.transport.call("uiResponse", {
|
|
408
|
+
type: "ui-receive_passphrase",
|
|
409
|
+
payload: {
|
|
410
|
+
value: passphrase,
|
|
411
|
+
save: true,
|
|
412
|
+
},
|
|
413
|
+
});
|
|
344
414
|
});
|
|
345
415
|
}
|
|
346
416
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
347
|
-
|
|
348
|
-
|
|
417
|
+
sendCharacter(charater) {
|
|
418
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
419
|
+
throw new Error("Trezor does not suport chiphered recovery");
|
|
420
|
+
});
|
|
349
421
|
}
|
|
350
422
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
351
|
-
|
|
352
|
-
|
|
423
|
+
sendWord(word) {
|
|
424
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
425
|
+
throw new Error("Trezor does not yet support recoverDevice");
|
|
426
|
+
});
|
|
353
427
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
428
|
+
ping(msg) {
|
|
429
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
430
|
+
// TrezorConnect doesn't expose the device's normal 'Core.Ping' message, so we
|
|
431
|
+
// have to fake it here:
|
|
432
|
+
return { msg: msg.msg };
|
|
433
|
+
});
|
|
358
434
|
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
435
|
+
wipe() {
|
|
436
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
437
|
+
const res = yield this.transport.call("wipeDevice", {});
|
|
438
|
+
(0, utils_1.handleError)(this.transport, res, "Could not wipe Trezor");
|
|
439
|
+
});
|
|
362
440
|
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
441
|
+
reset(msg) {
|
|
442
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
443
|
+
const res = yield this.transport.call("resetDevice", {
|
|
444
|
+
strength: msg.entropy,
|
|
445
|
+
label: msg.label,
|
|
446
|
+
pinProtection: msg.pin,
|
|
447
|
+
passphraseProtection: msg.passphrase,
|
|
448
|
+
});
|
|
449
|
+
(0, utils_1.handleError)(this.transport, res, "Could not reset Trezor");
|
|
369
450
|
});
|
|
370
|
-
handleError(this.transport, res, "Could not reset Trezor");
|
|
371
451
|
}
|
|
372
|
-
|
|
373
|
-
|
|
452
|
+
cancel() {
|
|
453
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
454
|
+
yield this.transport.cancel();
|
|
455
|
+
});
|
|
374
456
|
}
|
|
375
457
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
458
|
+
recover(msg) {
|
|
459
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
460
|
+
// https://github.com/trezor/connect/pull/320
|
|
461
|
+
throw new Error("TrezorConnect does not expose Core.RecoverDevice... yet?");
|
|
462
|
+
});
|
|
379
463
|
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
464
|
+
loadDevice(msg) {
|
|
465
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
466
|
+
// https://github.com/trezor/connect/issues/363
|
|
467
|
+
const res = yield this.transport.call("loadDevice", {
|
|
468
|
+
mnemonic: msg.mnemonic,
|
|
469
|
+
pin: msg.pin,
|
|
470
|
+
passphraseProtection: msg.passphrase,
|
|
471
|
+
label: msg.label,
|
|
472
|
+
});
|
|
473
|
+
(0, utils_1.handleError)(this.transport, res, "Could not load seed into Trezor");
|
|
387
474
|
});
|
|
388
|
-
handleError(this.transport, res, "Could not load seed into Trezor");
|
|
389
475
|
}
|
|
390
476
|
hasOnDevicePinEntry() {
|
|
391
477
|
return this.transport.hasPopup;
|
|
@@ -413,29 +499,43 @@ export class TrezorHDWallet {
|
|
|
413
499
|
supportsBroadcast() {
|
|
414
500
|
return false;
|
|
415
501
|
}
|
|
416
|
-
|
|
417
|
-
return this
|
|
502
|
+
btcSupportsCoin(coin) {
|
|
503
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
504
|
+
return this.info.btcSupportsCoin(coin);
|
|
505
|
+
});
|
|
418
506
|
}
|
|
419
|
-
|
|
420
|
-
return this
|
|
507
|
+
btcSupportsScriptType(coin, scriptType) {
|
|
508
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
509
|
+
return this.info.btcSupportsScriptType(coin, scriptType);
|
|
510
|
+
});
|
|
421
511
|
}
|
|
422
|
-
|
|
423
|
-
return
|
|
512
|
+
btcGetAddress(msg) {
|
|
513
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
514
|
+
return Btc.btcGetAddress(this.transport, msg);
|
|
515
|
+
});
|
|
424
516
|
}
|
|
425
|
-
|
|
426
|
-
return
|
|
517
|
+
btcSignTx(msg) {
|
|
518
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
519
|
+
return Btc.btcSignTx(this, this.transport, msg);
|
|
520
|
+
});
|
|
427
521
|
}
|
|
428
|
-
|
|
429
|
-
return this
|
|
522
|
+
btcSupportsSecureTransfer() {
|
|
523
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
524
|
+
return this.info.btcSupportsSecureTransfer();
|
|
525
|
+
});
|
|
430
526
|
}
|
|
431
527
|
btcSupportsNativeShapeShift() {
|
|
432
528
|
return this.info.btcSupportsNativeShapeShift();
|
|
433
529
|
}
|
|
434
|
-
|
|
435
|
-
return
|
|
530
|
+
btcSignMessage(msg) {
|
|
531
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
532
|
+
return Btc.btcSignMessage(this.transport, msg);
|
|
533
|
+
});
|
|
436
534
|
}
|
|
437
|
-
|
|
438
|
-
return
|
|
535
|
+
btcVerifyMessage(msg) {
|
|
536
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
537
|
+
return Btc.btcVerifyMessage(this.transport, msg);
|
|
538
|
+
});
|
|
439
539
|
}
|
|
440
540
|
btcGetAccountPaths(msg) {
|
|
441
541
|
return Btc.btcGetAccountPaths(msg);
|
|
@@ -443,29 +543,43 @@ export class TrezorHDWallet {
|
|
|
443
543
|
btcIsSameAccount(msg) {
|
|
444
544
|
return this.info.btcIsSameAccount(msg);
|
|
445
545
|
}
|
|
446
|
-
|
|
447
|
-
return
|
|
546
|
+
ethSignTx(msg) {
|
|
547
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
548
|
+
return Eth.ethSignTx(this, this.transport, msg);
|
|
549
|
+
});
|
|
448
550
|
}
|
|
449
|
-
|
|
450
|
-
return
|
|
551
|
+
ethGetAddress(msg) {
|
|
552
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
553
|
+
return Eth.ethGetAddress(this.transport, msg);
|
|
554
|
+
});
|
|
451
555
|
}
|
|
452
|
-
|
|
453
|
-
return
|
|
556
|
+
ethSignMessage(msg) {
|
|
557
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
+
return Eth.ethSignMessage(this.transport, msg);
|
|
559
|
+
});
|
|
454
560
|
}
|
|
455
|
-
|
|
456
|
-
return
|
|
561
|
+
ethVerifyMessage(msg) {
|
|
562
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
+
return Eth.ethVerifyMessage(this.transport, msg);
|
|
564
|
+
});
|
|
457
565
|
}
|
|
458
|
-
|
|
459
|
-
return this
|
|
566
|
+
ethSupportsNetwork(chain_id) {
|
|
567
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
568
|
+
return this.info.ethSupportsNetwork(chain_id);
|
|
569
|
+
});
|
|
460
570
|
}
|
|
461
|
-
|
|
462
|
-
return this
|
|
571
|
+
ethSupportsSecureTransfer() {
|
|
572
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
573
|
+
return this.info.ethSupportsSecureTransfer();
|
|
574
|
+
});
|
|
463
575
|
}
|
|
464
576
|
ethSupportsNativeShapeShift() {
|
|
465
577
|
return this.info.ethSupportsNativeShapeShift();
|
|
466
578
|
}
|
|
467
|
-
|
|
468
|
-
return
|
|
579
|
+
ethSupportsEIP1559() {
|
|
580
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
581
|
+
return yield this.info.ethSupportsEIP1559();
|
|
582
|
+
});
|
|
469
583
|
}
|
|
470
584
|
ethGetAccountPaths(msg) {
|
|
471
585
|
return this.info.ethGetAccountPaths(msg);
|
|
@@ -483,10 +597,11 @@ export class TrezorHDWallet {
|
|
|
483
597
|
return this.info.ethNextAccountPath(msg);
|
|
484
598
|
}
|
|
485
599
|
}
|
|
486
|
-
|
|
600
|
+
exports.TrezorHDWallet = TrezorHDWallet;
|
|
601
|
+
function info() {
|
|
487
602
|
return new TrezorHDWalletInfo();
|
|
488
603
|
}
|
|
489
|
-
|
|
604
|
+
function create(transport) {
|
|
490
605
|
return new TrezorHDWallet(transport);
|
|
491
606
|
}
|
|
492
607
|
//# sourceMappingURL=trezor.js.map
|