@shapeshiftoss/hdwallet-metamask-multichain 1.55.10-mipd.0
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/LICENSE.md +21 -0
- package/dist/adapter.d.ts +11 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +95 -0
- package/dist/adapter.js.map +1 -0
- package/dist/bitcoin.d.ts +8 -0
- package/dist/bitcoin.d.ts.map +1 -0
- package/dist/bitcoin.js +43 -0
- package/dist/bitcoin.js.map +1 -0
- package/dist/bitcoincash.d.ts +8 -0
- package/dist/bitcoincash.d.ts.map +1 -0
- package/dist/bitcoincash.js +43 -0
- package/dist/bitcoincash.js.map +1 -0
- package/dist/common.d.ts +2 -0
- package/dist/common.d.ts.map +1 -0
- package/dist/common.js +6 -0
- package/dist/common.js.map +1 -0
- package/dist/cosmos.d.ts +7 -0
- package/dist/cosmos.d.ts.map +1 -0
- package/dist/cosmos.js +64 -0
- package/dist/cosmos.js.map +1 -0
- package/dist/dogecoin.d.ts +8 -0
- package/dist/dogecoin.d.ts.map +1 -0
- package/dist/dogecoin.js +43 -0
- package/dist/dogecoin.js.map +1 -0
- package/dist/ethereum.d.ts +9 -0
- package/dist/ethereum.d.ts.map +1 -0
- package/dist/ethereum.js +159 -0
- package/dist/ethereum.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/litecoin.d.ts +8 -0
- package/dist/litecoin.d.ts.map +1 -0
- package/dist/litecoin.js +43 -0
- package/dist/litecoin.js.map +1 -0
- package/dist/shapeshift-multichain.d.ts +203 -0
- package/dist/shapeshift-multichain.d.ts.map +1 -0
- package/dist/shapeshift-multichain.js +883 -0
- package/dist/shapeshift-multichain.js.map +1 -0
- package/dist/thorchain.d.ts +7 -0
- package/dist/thorchain.d.ts.map +1 -0
- package/dist/thorchain.js +64 -0
- package/dist/thorchain.js.map +1 -0
- package/dist/utxo.d.ts +6 -0
- package/dist/utxo.d.ts.map +1 -0
- package/dist/utxo.js +205 -0
- package/dist/utxo.js.map +1 -0
- package/package.json +32 -0
- package/src/adapter.ts +62 -0
- package/src/bitcoin.ts +32 -0
- package/src/bitcoincash.ts +32 -0
- package/src/common.ts +2 -0
- package/src/cosmos.ts +30 -0
- package/src/dogecoin.ts +32 -0
- package/src/ethereum.ts +125 -0
- package/src/index.ts +2 -0
- package/src/litecoin.ts +31 -0
- package/src/shapeshift-multichain.test.ts +170 -0
- package/src/shapeshift-multichain.ts +871 -0
- package/src/thorchain.ts +30 -0
- package/src/utxo.ts +201 -0
- package/tsconfig.json +10 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/yarn-error.log +18555 -0
|
@@ -0,0 +1,883 @@
|
|
|
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.MetaMaskShapeShiftMultiChainHDWallet = exports.MetaMaskShapeShiftMultiChainHDWalletInfo = void 0;
|
|
39
|
+
exports.isMetaMask = isMetaMask;
|
|
40
|
+
const core = __importStar(require("@shapeshiftoss/hdwallet-core"));
|
|
41
|
+
const eth_rpc_errors_1 = require("eth-rpc-errors");
|
|
42
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
43
|
+
const Btc = __importStar(require("./bitcoin"));
|
|
44
|
+
const BtcCash = __importStar(require("./bitcoincash"));
|
|
45
|
+
const Cosmos = __importStar(require("./cosmos"));
|
|
46
|
+
const Doge = __importStar(require("./dogecoin"));
|
|
47
|
+
const Eth = __importStar(require("./ethereum"));
|
|
48
|
+
const Litecoin = __importStar(require("./litecoin"));
|
|
49
|
+
const Thorchain = __importStar(require("./thorchain"));
|
|
50
|
+
const utxo = __importStar(require("./utxo"));
|
|
51
|
+
function isMetaMask(wallet) {
|
|
52
|
+
return lodash_1.default.isObject(wallet) && wallet._isMetaMask;
|
|
53
|
+
}
|
|
54
|
+
class MetaMaskShapeShiftMultiChainHDWalletInfo {
|
|
55
|
+
constructor() {
|
|
56
|
+
this._supportsBTCInfo = true;
|
|
57
|
+
this._supportsETHInfo = true;
|
|
58
|
+
this._supportsCosmosInfo = true;
|
|
59
|
+
this._supportsBinanceInfo = false;
|
|
60
|
+
this._supportsRippleInfo = false;
|
|
61
|
+
this._supportsEosInfo = false;
|
|
62
|
+
this._supportsFioInfo = false;
|
|
63
|
+
this._supportsThorchainInfo = true;
|
|
64
|
+
}
|
|
65
|
+
ethGetChainId() {
|
|
66
|
+
throw new Error("Method not implemented.");
|
|
67
|
+
}
|
|
68
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
69
|
+
ethSwitchChain(params) {
|
|
70
|
+
throw new Error("Method not implemented.");
|
|
71
|
+
}
|
|
72
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
73
|
+
ethAddChain(params) {
|
|
74
|
+
throw new Error("Method not implemented.");
|
|
75
|
+
}
|
|
76
|
+
getVendor() {
|
|
77
|
+
return "MetaMask";
|
|
78
|
+
}
|
|
79
|
+
hasOnDevicePinEntry() {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
hasOnDevicePassphrase() {
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
hasOnDeviceDisplay() {
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
hasOnDeviceRecovery() {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
92
|
+
hasNativeShapeShift(srcCoin, dstCoin) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
supportsBip44Accounts() {
|
|
96
|
+
// Multi-account not supported in MM/snap, the only BIP44 bits we derive is diff slip44s than 60 (meaning, we support EVM chains)
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
supportsOfflineSigning() {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
supportsBroadcast() {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
describePath(msg) {
|
|
106
|
+
switch (msg.coin) {
|
|
107
|
+
case "bitcoin":
|
|
108
|
+
case "bitcoincash":
|
|
109
|
+
case "dogecoin":
|
|
110
|
+
case "litecoin": {
|
|
111
|
+
const unknown = core.unknownUTXOPath(msg.path, msg.coin, msg.scriptType);
|
|
112
|
+
if (!msg.scriptType)
|
|
113
|
+
return unknown;
|
|
114
|
+
if (!utxo.utxoSupportsCoin(msg.coin))
|
|
115
|
+
return unknown;
|
|
116
|
+
if (!utxo.utxoSupportsScriptType(msg.coin, msg.scriptType))
|
|
117
|
+
return unknown;
|
|
118
|
+
return core.describeUTXOPath(msg.path, msg.coin, msg.scriptType);
|
|
119
|
+
}
|
|
120
|
+
case "atom":
|
|
121
|
+
return core.cosmosDescribePath(msg.path);
|
|
122
|
+
case "ethereum":
|
|
123
|
+
return core.describeETHPath(msg.path);
|
|
124
|
+
case "rune":
|
|
125
|
+
case "trune":
|
|
126
|
+
case "thorchain":
|
|
127
|
+
return core.thorchainDescribePath(msg.path);
|
|
128
|
+
default:
|
|
129
|
+
throw new Error("Unsupported path");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
bitcoinSupportsNetwork() {
|
|
133
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 0) {
|
|
134
|
+
return chainId === 0;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
bitcoinSupportsSecureTransfer() {
|
|
138
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
139
|
+
return false;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
bitcoinSupportsNativeShapeShift() {
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
bitcoinGetAccountPaths(msg) {
|
|
146
|
+
return Btc.bitcoinGetAccountPaths(msg);
|
|
147
|
+
}
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
149
|
+
bitcoinNextAccountPath(msg) {
|
|
150
|
+
// TODO: What do we do here?
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
bitcoinCashSupportsNetwork() {
|
|
154
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 145) {
|
|
155
|
+
return chainId === 145;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
bitcoinCashSupportsSecureTransfer() {
|
|
159
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
160
|
+
return false;
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
bitcoinCashSupportsNativeShapeShift() {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
bitcoinCashGetAccountPaths(msg) {
|
|
167
|
+
return Btc.bitcoinGetAccountPaths(msg);
|
|
168
|
+
}
|
|
169
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
170
|
+
bitcoinCashNextAccountPath(msg) {
|
|
171
|
+
// TODO: What do we do here?
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
cosmosSupportsNetwork() {
|
|
175
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 118) {
|
|
176
|
+
return chainId === 118;
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
cosmosSupportsSecureTransfer() {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
return false;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
cosmosSupportsNativeShapeShift() {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
cosmosGetAccountPaths(msg) {
|
|
188
|
+
return Cosmos.cosmosGetAccountPaths(msg);
|
|
189
|
+
}
|
|
190
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
191
|
+
cosmosNextAccountPath(msg) {
|
|
192
|
+
// TODO: What do we do here?
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
dogecoinSupportsNetwork() {
|
|
196
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 3) {
|
|
197
|
+
return chainId === 3;
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
dogecoinSupportsSecureTransfer() {
|
|
201
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
202
|
+
return false;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
dogecoinSupportsNativeShapeShift() {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
dogecoinGetAccountPaths(msg) {
|
|
209
|
+
return Doge.dogecoinGetAccountPaths(msg);
|
|
210
|
+
}
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
212
|
+
dogecoinNextAccountPath(msg) {
|
|
213
|
+
// TODO: What do we do here?
|
|
214
|
+
return undefined;
|
|
215
|
+
}
|
|
216
|
+
ethSupportsNetwork(chainId) {
|
|
217
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
218
|
+
return chainId === 1;
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
ethSupportsSecureTransfer() {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
return false;
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
ethSupportsNativeShapeShift() {
|
|
227
|
+
return false;
|
|
228
|
+
}
|
|
229
|
+
ethGetAccountPaths(msg) {
|
|
230
|
+
return Eth.ethGetAccountPaths(msg);
|
|
231
|
+
}
|
|
232
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
233
|
+
ethNextAccountPath(msg) {
|
|
234
|
+
// TODO: What do we do here?
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
ethSupportsEIP1559() {
|
|
238
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
239
|
+
return true;
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
litecoinSupportsNetwork() {
|
|
243
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 2) {
|
|
244
|
+
return chainId === 2;
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
litecoinSupportsSecureTransfer() {
|
|
248
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
249
|
+
return false;
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
litecoinSupportsNativeShapeShift() {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
litecoinGetAccountPaths(msg) {
|
|
256
|
+
return Litecoin.litecoinGetAccountPaths(msg);
|
|
257
|
+
}
|
|
258
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
259
|
+
litecoinNextAccountPath(msg) {
|
|
260
|
+
// TODO: What do we do here?
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
thorchainSupportsNetwork() {
|
|
264
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 931) {
|
|
265
|
+
return chainId === 931;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
thorchainSupportsSecureTransfer() {
|
|
269
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
270
|
+
return false;
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
thorchainSupportsNativeShapeShift() {
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
thorchainGetAccountPaths(msg) {
|
|
277
|
+
return Thorchain.thorchainGetAccountPaths(msg);
|
|
278
|
+
}
|
|
279
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
280
|
+
thorchainNextAccountPath(msg) {
|
|
281
|
+
// TODO: What do we do here?
|
|
282
|
+
return undefined;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
exports.MetaMaskShapeShiftMultiChainHDWalletInfo = MetaMaskShapeShiftMultiChainHDWalletInfo;
|
|
286
|
+
class MetaMaskShapeShiftMultiChainHDWallet {
|
|
287
|
+
constructor(provider) {
|
|
288
|
+
this._supportsETH = true;
|
|
289
|
+
this._supportsETHInfo = true;
|
|
290
|
+
this._supportsBTCInfo = true;
|
|
291
|
+
this._supportsBTC = true;
|
|
292
|
+
this._supportsCosmosInfo = true;
|
|
293
|
+
this._supportsCosmos = true;
|
|
294
|
+
this._supportsEthSwitchChain = true;
|
|
295
|
+
this._supportsAvalanche = true;
|
|
296
|
+
this._supportsOptimism = true;
|
|
297
|
+
this._supportsBSC = true;
|
|
298
|
+
this._supportsPolygon = true;
|
|
299
|
+
this._supportsGnosis = true;
|
|
300
|
+
this._supportsArbitrum = true;
|
|
301
|
+
this._supportsArbitrumNova = true;
|
|
302
|
+
this._supportsBase = true;
|
|
303
|
+
this._supportsOsmosisInfo = true;
|
|
304
|
+
this._supportsOsmosis = true;
|
|
305
|
+
this._supportsBinanceInfo = false;
|
|
306
|
+
this._supportsBinance = false;
|
|
307
|
+
this._supportsDebugLink = false;
|
|
308
|
+
this._isPortis = false;
|
|
309
|
+
this._isMetaMask = true;
|
|
310
|
+
this._supportsRippleInfo = false;
|
|
311
|
+
this._supportsRipple = false;
|
|
312
|
+
this._supportsEosInfo = false;
|
|
313
|
+
this._supportsEos = false;
|
|
314
|
+
this._supportsFioInfo = false;
|
|
315
|
+
this._supportsFio = false;
|
|
316
|
+
this._supportsThorchainInfo = true;
|
|
317
|
+
this._supportsThorchain = true;
|
|
318
|
+
this.publicKeysCache = new Map();
|
|
319
|
+
this.addressCache = new Map();
|
|
320
|
+
this.info = new MetaMaskShapeShiftMultiChainHDWalletInfo();
|
|
321
|
+
this.provider = provider;
|
|
322
|
+
}
|
|
323
|
+
getFeatures() {
|
|
324
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
325
|
+
return {};
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
isLocked() {
|
|
329
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
330
|
+
try {
|
|
331
|
+
return !this.provider._metamask.isUnlocked();
|
|
332
|
+
}
|
|
333
|
+
catch (e) {
|
|
334
|
+
// This may not be properly implemented in MM impersonators, e.g
|
|
335
|
+
// https://github.com/zeriontech/zerion-wallet-extension/blob/294630a4e1ef303205a6e6dd681245a27c8d1eec/src/modules/ethereum/provider.ts#L36C1-L39
|
|
336
|
+
// Assume unlocked, but log the error regardless in case this happens with *actual* MM
|
|
337
|
+
console.error(e);
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
getVendor() {
|
|
343
|
+
return "MetaMask";
|
|
344
|
+
}
|
|
345
|
+
getModel() {
|
|
346
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
+
return "MetaMask";
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
getLabel() {
|
|
351
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
352
|
+
return "MetaMask";
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
initialize() {
|
|
356
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
357
|
+
// nothing to initialize
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
hasOnDevicePinEntry() {
|
|
361
|
+
return this.info.hasOnDevicePinEntry();
|
|
362
|
+
}
|
|
363
|
+
hasOnDevicePassphrase() {
|
|
364
|
+
return this.info.hasOnDevicePassphrase();
|
|
365
|
+
}
|
|
366
|
+
hasOnDeviceDisplay() {
|
|
367
|
+
return this.info.hasOnDeviceDisplay();
|
|
368
|
+
}
|
|
369
|
+
hasOnDeviceRecovery() {
|
|
370
|
+
return this.info.hasOnDeviceRecovery();
|
|
371
|
+
}
|
|
372
|
+
hasNativeShapeShift(srcCoin, dstCoin) {
|
|
373
|
+
return this.info.hasNativeShapeShift(srcCoin, dstCoin);
|
|
374
|
+
}
|
|
375
|
+
supportsBip44Accounts() {
|
|
376
|
+
return this.info.supportsBip44Accounts();
|
|
377
|
+
}
|
|
378
|
+
supportsOfflineSigning() {
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
supportsBroadcast() {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
clearSession() {
|
|
385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
386
|
+
// TODO: Can we lock MetaMask from here?
|
|
387
|
+
});
|
|
388
|
+
}
|
|
389
|
+
ping(msg) {
|
|
390
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
391
|
+
// no ping function for MetaMask, so just returning Core.Pong
|
|
392
|
+
return { msg: msg.msg };
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
396
|
+
sendPin(pin) {
|
|
397
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
398
|
+
// no concept of pin in MetaMask
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
402
|
+
sendPassphrase(passphrase) {
|
|
403
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
404
|
+
// cannot send passphrase to MetaMask. Could show the widget?
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
408
|
+
sendCharacter(charater) {
|
|
409
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
410
|
+
// no concept of sendCharacter in MetaMask
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
414
|
+
sendWord(word) {
|
|
415
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
416
|
+
// no concept of sendWord in MetaMask
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
cancel() {
|
|
420
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
421
|
+
// no concept of cancel in MetaMask
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
425
|
+
wipe() {
|
|
426
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
427
|
+
}
|
|
428
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
|
|
429
|
+
reset(msg) {
|
|
430
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
431
|
+
}
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
433
|
+
recover(msg) {
|
|
434
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
435
|
+
// no concept of recover in MetaMask
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
439
|
+
loadDevice(msg) {
|
|
440
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
441
|
+
// TODO: Does MetaMask allow this to be done programatically?
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
describePath(msg) {
|
|
445
|
+
return this.info.describePath(msg);
|
|
446
|
+
}
|
|
447
|
+
getPublicKeys(msg) {
|
|
448
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
449
|
+
const key = JSON.stringify(msg);
|
|
450
|
+
const maybeCachedPublicKeys = this.publicKeysCache.get(key);
|
|
451
|
+
if (maybeCachedPublicKeys) {
|
|
452
|
+
return maybeCachedPublicKeys;
|
|
453
|
+
}
|
|
454
|
+
const pubKeys = yield Promise.all(msg.map((getPublicKey) => __awaiter(this, void 0, void 0, function* () {
|
|
455
|
+
switch (getPublicKey.coin) {
|
|
456
|
+
case "Bitcoin":
|
|
457
|
+
return Btc.bitcoinGetPublicKeys(getPublicKey);
|
|
458
|
+
case "Litecoin":
|
|
459
|
+
return Litecoin.litecoinGetPublicKeys(getPublicKey);
|
|
460
|
+
case "Dogecoin":
|
|
461
|
+
return Doge.dogecoinGetPublicKeys(getPublicKey);
|
|
462
|
+
case "BitcoinCash":
|
|
463
|
+
return BtcCash.bitcoinCashGetPublicKeys(getPublicKey);
|
|
464
|
+
default:
|
|
465
|
+
return null;
|
|
466
|
+
}
|
|
467
|
+
})));
|
|
468
|
+
const flattened = pubKeys.flat();
|
|
469
|
+
const filtered = flattened.filter((x) => x !== null);
|
|
470
|
+
// Cache the result
|
|
471
|
+
this.publicKeysCache.set(key, filtered);
|
|
472
|
+
return filtered;
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
isInitialized() {
|
|
476
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
477
|
+
return true;
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
/** INSERT NEW CODE HERE */
|
|
481
|
+
/** BITCOIN */
|
|
482
|
+
btcSupportsSecureTransfer() {
|
|
483
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
484
|
+
return false;
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
btcSupportsNativeShapeShift() {
|
|
488
|
+
return false;
|
|
489
|
+
}
|
|
490
|
+
btcGetAccountPaths(msg) {
|
|
491
|
+
return Btc.bitcoinGetAccountPaths(msg);
|
|
492
|
+
}
|
|
493
|
+
btcNextAccountPath(msg) {
|
|
494
|
+
return this.info.bitcoinNextAccountPath(msg);
|
|
495
|
+
}
|
|
496
|
+
btcGetAddress(msg) {
|
|
497
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
498
|
+
const key = JSON.stringify(msg);
|
|
499
|
+
const maybeCachedAddress = this.addressCache.get(key);
|
|
500
|
+
if (maybeCachedAddress)
|
|
501
|
+
return maybeCachedAddress;
|
|
502
|
+
const value = yield (() => __awaiter(this, void 0, void 0, function* () {
|
|
503
|
+
switch (msg.coin) {
|
|
504
|
+
case "Bitcoin":
|
|
505
|
+
return Btc.bitcoinGetAddress(msg);
|
|
506
|
+
case "Litecoin":
|
|
507
|
+
return Litecoin.litecoinGetAddress(msg);
|
|
508
|
+
case "Dogecoin":
|
|
509
|
+
return Doge.dogecoinGetAddress(msg);
|
|
510
|
+
case "BitcoinCash":
|
|
511
|
+
return BtcCash.bitcoinCashGetAddress(msg);
|
|
512
|
+
default:
|
|
513
|
+
return null;
|
|
514
|
+
}
|
|
515
|
+
}))();
|
|
516
|
+
if (!value || typeof value !== "string")
|
|
517
|
+
return null;
|
|
518
|
+
this.addressCache.set(key, value);
|
|
519
|
+
return value;
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
btcSignTx(msg) {
|
|
523
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
524
|
+
const { coin } = msg;
|
|
525
|
+
switch (coin) {
|
|
526
|
+
case "Bitcoin":
|
|
527
|
+
return Btc.bitcoinSignTx(msg);
|
|
528
|
+
case "Litecoin":
|
|
529
|
+
return Litecoin.litecoinSignTx(msg);
|
|
530
|
+
case "Dogecoin":
|
|
531
|
+
return Doge.dogecoinSignTx(msg);
|
|
532
|
+
case "BitcoinCash":
|
|
533
|
+
return BtcCash.bitcoinCashSignTx(msg);
|
|
534
|
+
default:
|
|
535
|
+
return null;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
540
|
+
btcSignMessage(msg) {
|
|
541
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
542
|
+
throw new Error("Method not implemented.");
|
|
543
|
+
});
|
|
544
|
+
}
|
|
545
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
546
|
+
btcVerifyMessage(msg) {
|
|
547
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
548
|
+
throw new Error("Method not implemented.");
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
btcSupportsScriptType(coin, scriptType) {
|
|
552
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
553
|
+
return utxo.utxoSupportsScriptType(coin, scriptType);
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
btcSupportsCoin(coin) {
|
|
557
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
558
|
+
return utxo.utxoSupportsCoin(coin);
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
/** BITCOIN CASH */
|
|
562
|
+
bitcoinCashSupportsSecureTransfer() {
|
|
563
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
564
|
+
return false;
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
bitcoinCashSupportsNativeShapeShift() {
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
bitcoinCashGetAccountPaths(msg) {
|
|
571
|
+
return BtcCash.bitcoinCashGetAccountPaths(msg);
|
|
572
|
+
}
|
|
573
|
+
bitcoinCashNextAccountPath(msg) {
|
|
574
|
+
return this.info.bitcoinCashNextAccountPath(msg);
|
|
575
|
+
}
|
|
576
|
+
bitcoinCashGetAddress(msg) {
|
|
577
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
578
|
+
if (this.bitcoinCashAddress) {
|
|
579
|
+
return this.bitcoinCashAddress;
|
|
580
|
+
}
|
|
581
|
+
const address = yield BtcCash.bitcoinCashGetAddress(msg);
|
|
582
|
+
if (address && typeof address === "string") {
|
|
583
|
+
this.bitcoinCashAddress = address;
|
|
584
|
+
return address;
|
|
585
|
+
}
|
|
586
|
+
else {
|
|
587
|
+
this.bitcoinCashAddress = null;
|
|
588
|
+
return null;
|
|
589
|
+
}
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
bitcoinCashSignTx(msg) {
|
|
593
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
594
|
+
const address = yield this.bitcoinCashGetAddress(this.provider);
|
|
595
|
+
return address ? Btc.bitcoinSignTx(msg) : null;
|
|
596
|
+
});
|
|
597
|
+
}
|
|
598
|
+
/** COSMOS */
|
|
599
|
+
cosmosSupportsSecureTransfer() {
|
|
600
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
601
|
+
return false;
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
cosmosSupportsNativeShapeShift() {
|
|
605
|
+
return false;
|
|
606
|
+
}
|
|
607
|
+
cosmosGetAccountPaths(msg) {
|
|
608
|
+
return Cosmos.cosmosGetAccountPaths(msg);
|
|
609
|
+
}
|
|
610
|
+
cosmosNextAccountPath(msg) {
|
|
611
|
+
return this.info.cosmosNextAccountPath(msg);
|
|
612
|
+
}
|
|
613
|
+
cosmosGetAddress(msg) {
|
|
614
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
615
|
+
if (this.cosmosAddress) {
|
|
616
|
+
return this.cosmosAddress;
|
|
617
|
+
}
|
|
618
|
+
const address = yield Cosmos.cosmosGetAddress(msg);
|
|
619
|
+
if (address && typeof address === "string") {
|
|
620
|
+
this.cosmosAddress = address;
|
|
621
|
+
return address;
|
|
622
|
+
}
|
|
623
|
+
else {
|
|
624
|
+
this.cosmosAddress = null;
|
|
625
|
+
return null;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
cosmosSignTx(msg) {
|
|
630
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
631
|
+
const address = yield this.cosmosGetAddress(this.provider);
|
|
632
|
+
return address ? Cosmos.cosmosSignTx(msg) : null;
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
/** DOGECOIN */
|
|
636
|
+
dogecoinSupportsSecureTransfer() {
|
|
637
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
638
|
+
return false;
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
dogecoinSupportsNativeShapeShift() {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
dogecoinGetAccountPaths(msg) {
|
|
645
|
+
return Doge.dogecoinGetAccountPaths(msg);
|
|
646
|
+
}
|
|
647
|
+
dogecoinNextAccountPath(msg) {
|
|
648
|
+
return this.info.dogecoinNextAccountPath(msg);
|
|
649
|
+
}
|
|
650
|
+
dogecoinGetAddress(msg) {
|
|
651
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
652
|
+
if (this.dogecoinAddress) {
|
|
653
|
+
return this.dogecoinAddress;
|
|
654
|
+
}
|
|
655
|
+
const address = yield Doge.dogecoinGetAddress(msg);
|
|
656
|
+
if (address && typeof address === "string") {
|
|
657
|
+
this.dogecoinAddress = address;
|
|
658
|
+
return address;
|
|
659
|
+
}
|
|
660
|
+
else {
|
|
661
|
+
this.dogecoinAddress = null;
|
|
662
|
+
return null;
|
|
663
|
+
}
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
dogecoinSignTx(msg) {
|
|
667
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
668
|
+
const address = yield this.dogecoinGetAddress(this.provider);
|
|
669
|
+
return address ? Doge.dogecoinSignTx(msg) : null;
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
/** ETHEREUM */
|
|
673
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
674
|
+
disconnect() {
|
|
675
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
676
|
+
}
|
|
677
|
+
ethSupportsNetwork() {
|
|
678
|
+
return __awaiter(this, arguments, void 0, function* (chainId = 1) {
|
|
679
|
+
return chainId === 1;
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
ethGetChainId() {
|
|
683
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
684
|
+
try {
|
|
685
|
+
// chainId as hex string
|
|
686
|
+
const chainId = yield this.provider.request({ method: "eth_chainId" });
|
|
687
|
+
return parseInt(chainId, 16);
|
|
688
|
+
}
|
|
689
|
+
catch (e) {
|
|
690
|
+
console.error(e);
|
|
691
|
+
return null;
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
ethAddChain(params) {
|
|
696
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
697
|
+
// at this point, we know that we're in the context of a valid MetaMask provider
|
|
698
|
+
yield this.provider.request({ method: "wallet_addEthereumChain", params: [params] });
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
ethSwitchChain(params) {
|
|
702
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
703
|
+
try {
|
|
704
|
+
// at this point, we know that we're in the context of a valid MetaMask provider
|
|
705
|
+
yield this.provider.request({ method: "wallet_switchEthereumChain", params: [{ chainId: params.chainId }] });
|
|
706
|
+
}
|
|
707
|
+
catch (e) {
|
|
708
|
+
const error = (0, eth_rpc_errors_1.serializeError)(e);
|
|
709
|
+
// https://docs.metamask.io/guide/ethereum-provider.html#errors
|
|
710
|
+
// Internal error, which in the case of wallet_switchEthereumChain call means the chain isn't currently added to the wallet
|
|
711
|
+
if (error.code === -32603) {
|
|
712
|
+
try {
|
|
713
|
+
yield this.ethAddChain(params);
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
catch (addChainE) {
|
|
717
|
+
const addChainError = (0, eth_rpc_errors_1.serializeError)(addChainE);
|
|
718
|
+
if (addChainError.code === 4001) {
|
|
719
|
+
throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest();
|
|
720
|
+
}
|
|
721
|
+
throw addChainError.data.originalError;
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
if (error.code === 4001) {
|
|
725
|
+
throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest();
|
|
726
|
+
}
|
|
727
|
+
throw error.data.originalError;
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
}
|
|
731
|
+
ethSupportsSecureTransfer() {
|
|
732
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
733
|
+
return false;
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
ethSupportsNativeShapeShift() {
|
|
737
|
+
return false;
|
|
738
|
+
}
|
|
739
|
+
ethSupportsEIP1559() {
|
|
740
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
741
|
+
return true;
|
|
742
|
+
});
|
|
743
|
+
}
|
|
744
|
+
ethGetAccountPaths(msg) {
|
|
745
|
+
return Eth.ethGetAccountPaths(msg);
|
|
746
|
+
}
|
|
747
|
+
ethNextAccountPath(msg) {
|
|
748
|
+
return this.info.ethNextAccountPath(msg);
|
|
749
|
+
}
|
|
750
|
+
// TODO: Respect msg.addressNList!
|
|
751
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
752
|
+
ethGetAddress(msg) {
|
|
753
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
754
|
+
if (this.ethAddress) {
|
|
755
|
+
return this.ethAddress;
|
|
756
|
+
}
|
|
757
|
+
const address = yield Eth.ethGetAddress(this.provider);
|
|
758
|
+
if (address) {
|
|
759
|
+
this.ethAddress = address;
|
|
760
|
+
return address;
|
|
761
|
+
}
|
|
762
|
+
else {
|
|
763
|
+
this.ethAddress = null;
|
|
764
|
+
return null;
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
ethSignTx(msg) {
|
|
769
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
770
|
+
const address = yield this.ethGetAddress(this.provider);
|
|
771
|
+
return address ? Eth.ethSignTx(msg, this.provider, address) : null;
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
ethSendTx(msg) {
|
|
775
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
776
|
+
const txid = yield this.ethGetAddress(this.provider);
|
|
777
|
+
return txid ? Eth.ethSendTx(msg, this.provider, txid) : null;
|
|
778
|
+
});
|
|
779
|
+
}
|
|
780
|
+
ethSignMessage(msg) {
|
|
781
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
782
|
+
const address = yield this.ethGetAddress(this.provider);
|
|
783
|
+
return address ? Eth.ethSignMessage(msg, this.provider, address) : null;
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
ethSignTypedData(msg) {
|
|
787
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
788
|
+
const address = yield this.ethGetAddress(this.provider);
|
|
789
|
+
return address ? Eth.ethSignTypedData(msg, this.provider, address) : null;
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
ethVerifyMessage(msg) {
|
|
793
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
794
|
+
return Eth.ethVerifyMessage(msg, this.provider);
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
/** LITECOIN */
|
|
798
|
+
litecoinSupportsSecureTransfer() {
|
|
799
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
800
|
+
return false;
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
litecoinSupportsNativeShapeShift() {
|
|
804
|
+
return false;
|
|
805
|
+
}
|
|
806
|
+
litecoinGetAccountPaths(msg) {
|
|
807
|
+
return Litecoin.litecoinGetAccountPaths(msg);
|
|
808
|
+
}
|
|
809
|
+
litecoinNextAccountPath(msg) {
|
|
810
|
+
return this.info.litecoinNextAccountPath(msg);
|
|
811
|
+
}
|
|
812
|
+
litecoinGetAddress(msg) {
|
|
813
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
814
|
+
if (this.litecoinAddress) {
|
|
815
|
+
return this.litecoinAddress;
|
|
816
|
+
}
|
|
817
|
+
const address = yield Litecoin.litecoinGetAddress(msg);
|
|
818
|
+
if (address && typeof address === "string") {
|
|
819
|
+
this.litecoinAddress = address;
|
|
820
|
+
return address;
|
|
821
|
+
}
|
|
822
|
+
else {
|
|
823
|
+
this.litecoinAddress = null;
|
|
824
|
+
return null;
|
|
825
|
+
}
|
|
826
|
+
});
|
|
827
|
+
}
|
|
828
|
+
litecoinSignTx(msg) {
|
|
829
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
830
|
+
const address = yield this.litecoinGetAddress(this.provider);
|
|
831
|
+
return address ? Litecoin.litecoinSignTx(msg) : null;
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
/** THORCHAIN */
|
|
835
|
+
thorchainSupportsSecureTransfer() {
|
|
836
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
837
|
+
return false;
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
thorchainSupportsNativeShapeShift() {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
thorchainGetAccountPaths(msg) {
|
|
844
|
+
return Thorchain.thorchainGetAccountPaths(msg);
|
|
845
|
+
}
|
|
846
|
+
thorchainNextAccountPath(msg) {
|
|
847
|
+
return this.info.thorchainNextAccountPath(msg);
|
|
848
|
+
}
|
|
849
|
+
thorchainGetAddress(msg) {
|
|
850
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
851
|
+
if (this.thorchainAddress) {
|
|
852
|
+
return this.thorchainAddress;
|
|
853
|
+
}
|
|
854
|
+
const address = yield Thorchain.thorchainGetAddress(msg);
|
|
855
|
+
if (address && typeof address === "string") {
|
|
856
|
+
this.thorchainAddress = address;
|
|
857
|
+
return address;
|
|
858
|
+
}
|
|
859
|
+
else {
|
|
860
|
+
this.thorchainAddress = null;
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
863
|
+
});
|
|
864
|
+
}
|
|
865
|
+
thorchainSignTx(msg) {
|
|
866
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
867
|
+
const address = yield this.thorchainGetAddress(this.provider);
|
|
868
|
+
return address ? Thorchain.thorchainSignTx(msg) : null;
|
|
869
|
+
});
|
|
870
|
+
}
|
|
871
|
+
getDeviceID() {
|
|
872
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
873
|
+
return "metaMask:" + (yield this.ethGetAddress(this.provider));
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
getFirmwareVersion() {
|
|
877
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
878
|
+
return "metaMask";
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
exports.MetaMaskShapeShiftMultiChainHDWallet = MetaMaskShapeShiftMultiChainHDWallet;
|
|
883
|
+
//# sourceMappingURL=shapeshift-multichain.js.map
|