@ledgerhq/live-common 21.36.2 → 21.36.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/lib/bridge/jsHelpers.d.ts.map +1 -1
- package/lib/bridge/jsHelpers.js +238 -245
- package/lib/bridge/jsHelpers.js.map +1 -1
- package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
- package/lib/families/bitcoin/js-signOperation.js +130 -139
- package/lib/families/bitcoin/js-signOperation.js.map +1 -1
- package/lib/families/crypto_org/js-signOperation.d.ts.map +1 -1
- package/lib/families/crypto_org/js-signOperation.js +55 -62
- package/lib/families/crypto_org/js-signOperation.js.map +1 -1
- package/lib/families/elrond/js-signOperation.d.ts.map +1 -1
- package/lib/families/elrond/js-signOperation.js +43 -50
- package/lib/families/elrond/js-signOperation.js.map +1 -1
- package/lib/families/polkadot/js-signOperation.d.ts.map +1 -1
- package/lib/families/polkadot/js-signOperation.js +54 -61
- package/lib/families/polkadot/js-signOperation.js.map +1 -1
- package/lib/families/ripple/bridge/js.d.ts.map +1 -1
- package/lib/families/ripple/bridge/js.js +299 -313
- package/lib/families/ripple/bridge/js.js.map +1 -1
- package/lib/families/stellar/js-signOperation.d.ts.map +1 -1
- package/lib/families/stellar/js-signOperation.js +44 -51
- package/lib/families/stellar/js-signOperation.js.map +1 -1
- package/lib/families/tron/bridge/js.d.ts.map +1 -1
- package/lib/families/tron/bridge/js.js +159 -167
- package/lib/families/tron/bridge/js.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/bridge/jsHelpers.ts +213 -213
- package/src/data/flags/.DS_Store +0 -0
- package/src/families/bitcoin/js-signOperation.ts +14 -17
- package/src/families/crypto_org/js-signOperation.ts +12 -16
- package/src/families/elrond/js-signOperation.ts +10 -14
- package/src/families/polkadot/js-signOperation.ts +61 -61
- package/src/families/ripple/bridge/js.ts +257 -260
- package/src/families/stellar/js-signOperation.ts +10 -14
- package/src/families/tron/bridge/js.ts +57 -58
|
@@ -89,7 +89,7 @@ var operation_1 = require("../../../operation");
|
|
|
89
89
|
var account_1 = require("../../../account");
|
|
90
90
|
var account_2 = require("../../../account");
|
|
91
91
|
var getAddress_1 = __importDefault(require("../../../hw/getAddress"));
|
|
92
|
-
var
|
|
92
|
+
var deviceAccess_1 = require("../../../hw/deviceAccess");
|
|
93
93
|
var Ripple_1 = require("../../../api/Ripple");
|
|
94
94
|
var signTransaction_1 = __importDefault(require("../../../hw/signTransaction"));
|
|
95
95
|
var jsHelpers_1 = require("../../../bridge/jsHelpers");
|
|
@@ -125,109 +125,101 @@ var validateTag = function (tag) {
|
|
|
125
125
|
};
|
|
126
126
|
var signOperation = function (_a) {
|
|
127
127
|
var account = _a.account, transaction = _a.transaction, deviceId = _a.deviceId;
|
|
128
|
-
return
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
128
|
+
return (0, deviceAccess_1.withDevice)(deviceId)(function (transport) {
|
|
129
|
+
return new rxjs_1.Observable(function (o) {
|
|
130
|
+
delete cacheRecipientsNew[transaction.recipient];
|
|
131
|
+
var fee = transaction.fee;
|
|
132
|
+
if (!fee)
|
|
133
|
+
throw new errors_1.FeeNotLoaded();
|
|
134
|
+
function main() {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
136
|
+
var amount, tag, payment, instruction, prepared, signature, hash, operation, e_1;
|
|
137
|
+
var _a;
|
|
138
|
+
return __generator(this, function (_b) {
|
|
139
|
+
switch (_b.label) {
|
|
140
|
+
case 0:
|
|
141
|
+
amount = (0, Ripple_1.formatAPICurrencyXRP)(transaction.amount);
|
|
142
|
+
tag = transaction.tag ? transaction.tag : undefined;
|
|
143
|
+
payment = {
|
|
144
|
+
source: {
|
|
145
|
+
address: account.freshAddress,
|
|
146
|
+
amount: amount
|
|
147
|
+
},
|
|
148
|
+
destination: {
|
|
149
|
+
address: transaction.recipient,
|
|
150
|
+
minAmount: amount,
|
|
151
|
+
tag: tag
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
instruction = {
|
|
155
|
+
fee: (0, Ripple_1.formatAPICurrencyXRP)(fee).value,
|
|
156
|
+
maxLedgerVersionOffset: 12
|
|
157
|
+
};
|
|
158
|
+
if (tag)
|
|
159
|
+
(0, invariant_1["default"])(validateTag(new bignumber_js_1.BigNumber(tag)), "tag is set but is not in a valid format, should be between [0 - ".concat(uint32maxPlus1
|
|
160
|
+
.minus(1)
|
|
161
|
+
.toString(), "]"));
|
|
162
|
+
return [4 /*yield*/, (0, Ripple_2.preparePayment)(account.freshAddress, payment, instruction)];
|
|
163
|
+
case 1:
|
|
164
|
+
prepared = _b.sent();
|
|
165
|
+
_b.label = 2;
|
|
166
|
+
case 2:
|
|
167
|
+
_b.trys.push([2, 5, , 6]);
|
|
168
|
+
o.next({
|
|
169
|
+
type: "device-signature-requested"
|
|
170
|
+
});
|
|
171
|
+
return [4 /*yield*/, (0, signTransaction_1["default"])(account.currency, transport, account.freshAddressPath, JSON.parse(prepared.txJSON))];
|
|
172
|
+
case 3:
|
|
173
|
+
signature = _b.sent();
|
|
174
|
+
o.next({
|
|
175
|
+
type: "device-signature-granted"
|
|
176
|
+
});
|
|
177
|
+
hash = "";
|
|
178
|
+
_a = {
|
|
179
|
+
id: "".concat(account.id, "-").concat(hash, "-OUT"),
|
|
180
|
+
hash: hash,
|
|
181
|
+
accountId: account.id,
|
|
182
|
+
type: "OUT",
|
|
183
|
+
value: transaction.amount,
|
|
184
|
+
fee: fee,
|
|
185
|
+
blockHash: null,
|
|
186
|
+
blockHeight: null,
|
|
187
|
+
senders: [account.freshAddress],
|
|
188
|
+
recipients: [transaction.recipient],
|
|
189
|
+
date: new Date()
|
|
190
|
+
};
|
|
191
|
+
return [4 /*yield*/, getSequenceNumber(account)];
|
|
192
|
+
case 4:
|
|
193
|
+
operation = (
|
|
194
|
+
// we probably can't get it so it's a predictive value
|
|
195
|
+
_a.transactionSequenceNumber = _b.sent(),
|
|
196
|
+
_a.extra = {},
|
|
197
|
+
_a);
|
|
198
|
+
if (transaction.tag) {
|
|
199
|
+
operation.extra.tag = transaction.tag;
|
|
152
200
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
return [4 /*yield*/, (0, hw_1.open)(deviceId)];
|
|
167
|
-
case 2:
|
|
168
|
-
transport = _b.sent();
|
|
169
|
-
_b.label = 3;
|
|
170
|
-
case 3:
|
|
171
|
-
_b.trys.push([3, , 5, 6]);
|
|
172
|
-
o.next({
|
|
173
|
-
type: "device-signature-requested"
|
|
174
|
-
});
|
|
175
|
-
return [4 /*yield*/, (0, signTransaction_1["default"])(account.currency, transport, account.freshAddressPath, JSON.parse(prepared.txJSON))];
|
|
176
|
-
case 4:
|
|
177
|
-
signature = _b.sent();
|
|
178
|
-
o.next({
|
|
179
|
-
type: "device-signature-granted"
|
|
180
|
-
});
|
|
181
|
-
return [3 /*break*/, 6];
|
|
182
|
-
case 5:
|
|
183
|
-
(0, hw_1.close)(transport, deviceId);
|
|
184
|
-
return [7 /*endfinally*/];
|
|
185
|
-
case 6:
|
|
186
|
-
hash = "";
|
|
187
|
-
_a = {
|
|
188
|
-
id: "".concat(account.id, "-").concat(hash, "-OUT"),
|
|
189
|
-
hash: hash,
|
|
190
|
-
accountId: account.id,
|
|
191
|
-
type: "OUT",
|
|
192
|
-
value: transaction.amount,
|
|
193
|
-
fee: fee,
|
|
194
|
-
blockHash: null,
|
|
195
|
-
blockHeight: null,
|
|
196
|
-
senders: [account.freshAddress],
|
|
197
|
-
recipients: [transaction.recipient],
|
|
198
|
-
date: new Date()
|
|
199
|
-
};
|
|
200
|
-
return [4 /*yield*/, getSequenceNumber(account)];
|
|
201
|
-
case 7:
|
|
202
|
-
operation = (
|
|
203
|
-
// we probably can't get it so it's a predictive value
|
|
204
|
-
_a.transactionSequenceNumber = _b.sent(),
|
|
205
|
-
_a.extra = {},
|
|
206
|
-
_a);
|
|
207
|
-
if (transaction.tag) {
|
|
208
|
-
operation.extra.tag = transaction.tag;
|
|
209
|
-
}
|
|
210
|
-
o.next({
|
|
211
|
-
type: "signed",
|
|
212
|
-
signedOperation: {
|
|
213
|
-
operation: operation,
|
|
214
|
-
signature: signature,
|
|
215
|
-
expirationDate: null
|
|
201
|
+
o.next({
|
|
202
|
+
type: "signed",
|
|
203
|
+
signedOperation: {
|
|
204
|
+
operation: operation,
|
|
205
|
+
signature: signature,
|
|
206
|
+
expirationDate: null
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
return [3 /*break*/, 6];
|
|
210
|
+
case 5:
|
|
211
|
+
e_1 = _b.sent();
|
|
212
|
+
if (e_1 && e_1.name === "RippledError" && e_1.data.resultMessage) {
|
|
213
|
+
throw new Error(e_1.data.resultMessage);
|
|
216
214
|
}
|
|
217
|
-
|
|
218
|
-
return [
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
if (e_1 && e_1.name === "RippledError" && e_1.data.resultMessage) {
|
|
222
|
-
throw new Error(e_1.data.resultMessage);
|
|
223
|
-
}
|
|
224
|
-
throw e_1;
|
|
225
|
-
case 9: return [2 /*return*/];
|
|
226
|
-
}
|
|
215
|
+
throw e_1;
|
|
216
|
+
case 6: return [2 /*return*/];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
227
219
|
});
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
220
|
+
}
|
|
221
|
+
main().then(function () { return o.complete(); }, function (e) { return o.error(e); });
|
|
222
|
+
});
|
|
231
223
|
});
|
|
232
224
|
};
|
|
233
225
|
var broadcast = function (_a) {
|
|
@@ -337,222 +329,216 @@ var currencyBridge = {
|
|
|
337
329
|
hydrate: function () { },
|
|
338
330
|
scanAccounts: function (_a) {
|
|
339
331
|
var currency = _a.currency, deviceId = _a.deviceId;
|
|
340
|
-
return
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
332
|
+
return (0, deviceAccess_1.withDevice)(deviceId)(function (transport) {
|
|
333
|
+
return new rxjs_1.Observable(function (o) {
|
|
334
|
+
var finished = false;
|
|
335
|
+
var unsubscribe = function () {
|
|
336
|
+
finished = true;
|
|
337
|
+
};
|
|
338
|
+
function main() {
|
|
339
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
340
|
+
var serverInfo, ledgers, minLedgerVersion, maxLedgerVersion, derivationModes, derivationModes_1, derivationModes_1_1, derivationMode, derivationScheme, stopAt, index, freshAddressPath, address, accountId, info, e_3, freshAddress, balance, transactions, account, e_4_1, e_5;
|
|
341
|
+
var e_4, _a;
|
|
342
|
+
return __generator(this, function (_b) {
|
|
343
|
+
switch (_b.label) {
|
|
344
|
+
case 0:
|
|
345
|
+
_b.trys.push([0, 17, , 18]);
|
|
346
|
+
return [4 /*yield*/, (0, Ripple_2.getServerInfo)()];
|
|
347
|
+
case 1:
|
|
348
|
+
serverInfo = _b.sent();
|
|
349
|
+
ledgers = serverInfo.completeLedgers.split("-");
|
|
350
|
+
minLedgerVersion = Number(ledgers[0]);
|
|
351
|
+
maxLedgerVersion = Number(ledgers[1]);
|
|
352
|
+
derivationModes = (0, derivation_1.getDerivationModesForCurrency)(currency);
|
|
353
|
+
_b.label = 2;
|
|
354
|
+
case 2:
|
|
355
|
+
_b.trys.push([2, 14, 15, 16]);
|
|
356
|
+
derivationModes_1 = __values(derivationModes), derivationModes_1_1 = derivationModes_1.next();
|
|
357
|
+
_b.label = 3;
|
|
358
|
+
case 3:
|
|
359
|
+
if (!!derivationModes_1_1.done) return [3 /*break*/, 13];
|
|
360
|
+
derivationMode = derivationModes_1_1.value;
|
|
361
|
+
derivationScheme = (0, derivation_1.getDerivationScheme)({
|
|
362
|
+
derivationMode: derivationMode,
|
|
363
|
+
currency: currency
|
|
364
|
+
});
|
|
365
|
+
stopAt = (0, derivation_1.isIterableDerivationMode)(derivationMode)
|
|
366
|
+
? 255
|
|
367
|
+
: 1;
|
|
368
|
+
index = 0;
|
|
369
|
+
_b.label = 4;
|
|
370
|
+
case 4:
|
|
371
|
+
if (!(index < stopAt)) return [3 /*break*/, 12];
|
|
372
|
+
if (!(0, derivation_1.derivationModeSupportsIndex)(derivationMode, index))
|
|
373
|
+
return [3 /*break*/, 11];
|
|
374
|
+
freshAddressPath = (0, derivation_1.runDerivationScheme)(derivationScheme, currency, {
|
|
375
|
+
account: index
|
|
376
|
+
});
|
|
377
|
+
return [4 /*yield*/, (0, getAddress_1["default"])(transport, {
|
|
378
|
+
currency: currency,
|
|
379
|
+
path: freshAddressPath,
|
|
380
|
+
derivationMode: derivationMode
|
|
381
|
+
})];
|
|
382
|
+
case 5:
|
|
383
|
+
address = (_b.sent()).address;
|
|
384
|
+
if (finished)
|
|
385
|
+
return [2 /*return*/];
|
|
386
|
+
accountId = "ripplejs:2:".concat(currency.id, ":").concat(address, ":").concat(derivationMode);
|
|
387
|
+
info = void 0;
|
|
388
|
+
_b.label = 6;
|
|
389
|
+
case 6:
|
|
390
|
+
_b.trys.push([6, 8, , 9]);
|
|
391
|
+
return [4 /*yield*/, (0, Ripple_2.getAccountInfo)(address)];
|
|
392
|
+
case 7:
|
|
393
|
+
info = _b.sent();
|
|
394
|
+
return [3 /*break*/, 9];
|
|
395
|
+
case 8:
|
|
396
|
+
e_3 = _b.sent();
|
|
397
|
+
if (checkAccountNotFound(e_3)) {
|
|
398
|
+
throw e_3;
|
|
399
|
+
}
|
|
400
|
+
return [3 /*break*/, 9];
|
|
401
|
+
case 9:
|
|
402
|
+
freshAddress = address;
|
|
403
|
+
if (!info) {
|
|
404
|
+
// account does not exist in Ripple server
|
|
405
|
+
// we are generating a new account locally
|
|
406
|
+
if (derivationMode === "") {
|
|
407
|
+
o.next({
|
|
408
|
+
type: "discovered",
|
|
409
|
+
account: {
|
|
410
|
+
type: "Account",
|
|
411
|
+
id: accountId,
|
|
412
|
+
seedIdentifier: freshAddress,
|
|
413
|
+
derivationMode: derivationMode,
|
|
414
|
+
name: (0, account_2.getNewAccountPlaceholderName)({
|
|
415
|
+
currency: currency,
|
|
416
|
+
index: index,
|
|
417
|
+
derivationMode: derivationMode
|
|
418
|
+
}),
|
|
419
|
+
starred: false,
|
|
420
|
+
used: false,
|
|
421
|
+
freshAddress: freshAddress,
|
|
422
|
+
freshAddressPath: freshAddressPath,
|
|
423
|
+
freshAddresses: [
|
|
424
|
+
{
|
|
425
|
+
address: freshAddress,
|
|
426
|
+
derivationPath: freshAddressPath
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
balance: new bignumber_js_1.BigNumber(0),
|
|
430
|
+
spendableBalance: new bignumber_js_1.BigNumber(0),
|
|
431
|
+
blockHeight: maxLedgerVersion,
|
|
424
432
|
index: index,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
index: index,
|
|
441
|
-
currency: currency,
|
|
442
|
-
operationsCount: 0,
|
|
443
|
-
operations: [],
|
|
444
|
-
pendingOperations: [],
|
|
445
|
-
unit: currency.units[0],
|
|
446
|
-
// @ts-expect-error archived does not exists on type Account
|
|
447
|
-
archived: false,
|
|
448
|
-
lastSyncDate: new Date(),
|
|
449
|
-
creationDate: new Date(),
|
|
450
|
-
swapHistory: [],
|
|
451
|
-
balanceHistoryCache: account_2.emptyHistoryCache
|
|
452
|
-
}
|
|
453
|
-
});
|
|
433
|
+
currency: currency,
|
|
434
|
+
operationsCount: 0,
|
|
435
|
+
operations: [],
|
|
436
|
+
pendingOperations: [],
|
|
437
|
+
unit: currency.units[0],
|
|
438
|
+
// @ts-expect-error archived does not exists on type Account
|
|
439
|
+
archived: false,
|
|
440
|
+
lastSyncDate: new Date(),
|
|
441
|
+
creationDate: new Date(),
|
|
442
|
+
swapHistory: [],
|
|
443
|
+
balanceHistoryCache: account_2.emptyHistoryCache
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
return [3 /*break*/, 12];
|
|
454
448
|
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
449
|
+
if (finished)
|
|
450
|
+
return [2 /*return*/];
|
|
451
|
+
balance = (0, Ripple_1.parseAPIValue)(info.xrpBalance);
|
|
452
|
+
(0, invariant_1["default"])(!balance.isNaN() && balance.isFinite(), "Ripple: invalid balance=".concat(balance.toString(), " for address ").concat(address));
|
|
453
|
+
return [4 /*yield*/, (0, Ripple_2.getTransactions)(address, {
|
|
454
|
+
minLedgerVersion: minLedgerVersion,
|
|
455
|
+
maxLedgerVersion: maxLedgerVersion,
|
|
456
|
+
types: ["payment"]
|
|
457
|
+
})];
|
|
458
|
+
case 10:
|
|
459
|
+
transactions = _b.sent();
|
|
460
|
+
if (finished)
|
|
461
|
+
return [2 /*return*/];
|
|
462
|
+
account = {
|
|
463
|
+
type: "Account",
|
|
464
|
+
id: accountId,
|
|
465
|
+
seedIdentifier: freshAddress,
|
|
466
|
+
derivationMode: derivationMode,
|
|
467
|
+
name: (0, account_2.getAccountPlaceholderName)({
|
|
468
|
+
currency: currency,
|
|
469
|
+
index: index,
|
|
470
|
+
derivationMode: derivationMode
|
|
471
|
+
}),
|
|
472
|
+
starred: false,
|
|
473
|
+
used: true,
|
|
474
|
+
freshAddress: freshAddress,
|
|
475
|
+
freshAddressPath: freshAddressPath,
|
|
476
|
+
freshAddresses: [
|
|
477
|
+
{
|
|
478
|
+
address: freshAddress,
|
|
479
|
+
derivationPath: freshAddressPath
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
balance: balance,
|
|
483
|
+
spendableBalance: balance,
|
|
484
|
+
// TODO calc with base reserve
|
|
485
|
+
blockHeight: maxLedgerVersion,
|
|
477
486
|
index: index,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
return [3 /*break*/, 17];
|
|
529
|
-
case 16:
|
|
530
|
-
try {
|
|
531
|
-
if (derivationModes_1_1 && !derivationModes_1_1.done && (_a = derivationModes_1["return"])) _a.call(derivationModes_1);
|
|
532
|
-
}
|
|
533
|
-
finally { if (e_4) throw e_4.error; }
|
|
534
|
-
return [7 /*endfinally*/];
|
|
535
|
-
case 17:
|
|
536
|
-
o.complete();
|
|
537
|
-
return [3 /*break*/, 22];
|
|
538
|
-
case 18:
|
|
539
|
-
e_5 = _b.sent();
|
|
540
|
-
o.error(e_5);
|
|
541
|
-
return [3 /*break*/, 22];
|
|
542
|
-
case 19:
|
|
543
|
-
if (!transport) return [3 /*break*/, 21];
|
|
544
|
-
return [4 /*yield*/, (0, hw_1.close)(transport, deviceId)];
|
|
545
|
-
case 20:
|
|
546
|
-
_b.sent();
|
|
547
|
-
_b.label = 21;
|
|
548
|
-
case 21: return [7 /*endfinally*/];
|
|
549
|
-
case 22: return [2 /*return*/];
|
|
550
|
-
}
|
|
487
|
+
currency: currency,
|
|
488
|
+
operationsCount: 0,
|
|
489
|
+
operations: [],
|
|
490
|
+
pendingOperations: [],
|
|
491
|
+
unit: currency.units[0],
|
|
492
|
+
lastSyncDate: new Date(),
|
|
493
|
+
creationDate: new Date(),
|
|
494
|
+
swapHistory: [],
|
|
495
|
+
balanceHistoryCache: account_2.emptyHistoryCache
|
|
496
|
+
};
|
|
497
|
+
account.operations = transactions
|
|
498
|
+
.map(txToOperation(account))
|
|
499
|
+
.filter(Boolean);
|
|
500
|
+
account.operationsCount = account.operations.length;
|
|
501
|
+
if (account.operations.length > 0) {
|
|
502
|
+
account.creationDate =
|
|
503
|
+
account.operations[account.operations.length - 1].date;
|
|
504
|
+
}
|
|
505
|
+
o.next({
|
|
506
|
+
type: "discovered",
|
|
507
|
+
account: account
|
|
508
|
+
});
|
|
509
|
+
_b.label = 11;
|
|
510
|
+
case 11:
|
|
511
|
+
index++;
|
|
512
|
+
return [3 /*break*/, 4];
|
|
513
|
+
case 12:
|
|
514
|
+
derivationModes_1_1 = derivationModes_1.next();
|
|
515
|
+
return [3 /*break*/, 3];
|
|
516
|
+
case 13: return [3 /*break*/, 16];
|
|
517
|
+
case 14:
|
|
518
|
+
e_4_1 = _b.sent();
|
|
519
|
+
e_4 = { error: e_4_1 };
|
|
520
|
+
return [3 /*break*/, 16];
|
|
521
|
+
case 15:
|
|
522
|
+
try {
|
|
523
|
+
if (derivationModes_1_1 && !derivationModes_1_1.done && (_a = derivationModes_1["return"])) _a.call(derivationModes_1);
|
|
524
|
+
}
|
|
525
|
+
finally { if (e_4) throw e_4.error; }
|
|
526
|
+
return [7 /*endfinally*/];
|
|
527
|
+
case 16:
|
|
528
|
+
o.complete();
|
|
529
|
+
return [3 /*break*/, 18];
|
|
530
|
+
case 17:
|
|
531
|
+
e_5 = _b.sent();
|
|
532
|
+
o.error(e_5);
|
|
533
|
+
return [3 /*break*/, 18];
|
|
534
|
+
case 18: return [2 /*return*/];
|
|
535
|
+
}
|
|
536
|
+
});
|
|
551
537
|
});
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
538
|
+
}
|
|
539
|
+
main();
|
|
540
|
+
return unsubscribe;
|
|
541
|
+
});
|
|
556
542
|
});
|
|
557
543
|
}
|
|
558
544
|
};
|