@ledgerhq/live-common 26.1.0-next.1 → 27.0.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/lib/account/importAccounts.d.ts +35 -2
- package/lib/account/importAccounts.d.ts.map +1 -1
- package/lib/account/importAccounts.integration.test.d.ts +2 -0
- package/lib/account/importAccounts.integration.test.d.ts.map +1 -0
- package/lib/account/importAccounts.integration.test.js +219 -0
- package/lib/account/importAccounts.integration.test.js.map +1 -0
- package/lib/account/importAccounts.js +130 -12
- package/lib/account/importAccounts.js.map +1 -1
- package/lib/account/importAccounts.test.d.ts +2 -0
- package/lib/account/importAccounts.test.d.ts.map +1 -0
- package/lib/{__tests__/accounts/importAccounts.js → account/importAccounts.test.js} +44 -64
- package/lib/account/importAccounts.test.js.map +1 -0
- package/package.json +17 -17
- package/src/account/importAccounts.integration.test.ts +193 -0
- package/src/{__tests__/accounts/importAccounts.ts → account/importAccounts.test.ts} +39 -59
- package/src/account/importAccounts.ts +103 -12
- package/lib/__tests__/accounts/importAccounts.d.ts +0 -2
- package/lib/__tests__/accounts/importAccounts.d.ts.map +0 -1
- package/lib/__tests__/accounts/importAccounts.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Result } from "../cross";
|
|
2
2
|
import type { Account } from "@ledgerhq/types-live";
|
|
3
|
+
import { BridgeCacheSystem } from "../bridge/cache";
|
|
3
4
|
declare const itemModeDisplaySort: {
|
|
4
5
|
create: number;
|
|
5
6
|
update: number;
|
|
@@ -17,9 +18,41 @@ export declare const importAccountsMakeItems: ({ result, accounts, items, }: {
|
|
|
17
18
|
accounts: Account[];
|
|
18
19
|
items?: ImportItem[] | undefined;
|
|
19
20
|
}) => ImportItem[];
|
|
20
|
-
|
|
21
|
+
/**
|
|
22
|
+
* SyncNewAccountsOutput
|
|
23
|
+
* - synchronized: a map of account id to account. the account id are kept as originally set in the items[].account before a possible "remap" of the ids after a sync happened
|
|
24
|
+
* - failed: a map of account id to errors for all possible fails that happened.
|
|
25
|
+
*/
|
|
26
|
+
export declare type SyncNewAccountsOutput = {
|
|
27
|
+
synchronized: Record<string, Account>;
|
|
28
|
+
failed: Record<string, Error>;
|
|
29
|
+
};
|
|
30
|
+
export declare type SyncNewAccountsInput = {
|
|
21
31
|
items: ImportItem[];
|
|
22
32
|
selectedAccounts: string[];
|
|
23
|
-
}
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
*
|
|
36
|
+
* @param items: result of importAccountsMakeItems
|
|
37
|
+
* @param selectedAccounts: user's selected accounts
|
|
38
|
+
* @param bridgeCache: the bridge cache created on user land to prepare currency for a sync
|
|
39
|
+
* @param blacklistedTokenIds: the list of blacklisted token ids to ignore sync with
|
|
40
|
+
* @returns SyncNewAccountsOutput
|
|
41
|
+
*/
|
|
42
|
+
export declare const syncNewAccountsToImport: ({ items, selectedAccounts }: SyncNewAccountsInput, bridgeCache: BridgeCacheSystem, blacklistedTokenIds?: string[] | undefined) => Promise<SyncNewAccountsOutput>;
|
|
43
|
+
export declare type ImportAccountsReduceInput = {
|
|
44
|
+
items: ImportItem[];
|
|
45
|
+
selectedAccounts: string[];
|
|
46
|
+
syncResult: SyncNewAccountsOutput;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param existingAccounts
|
|
51
|
+
* @param items: value resulting of importAccountsMakeItems
|
|
52
|
+
* @params selectedAccounts: array of all account ids selected by user for import
|
|
53
|
+
* @param syncedNewAccounts: accounts resulting of syncNewAccountsToImport(). all accounts that would be missing from that list would be ignored to be imported (fresh sync is needed to make sure the accounts are "ready")
|
|
54
|
+
* @returns all accounts
|
|
55
|
+
*/
|
|
56
|
+
export declare const importAccountsReduce: (existingAccounts: Account[], { items, selectedAccounts, syncResult }: ImportAccountsReduceInput) => Account[];
|
|
24
57
|
export {};
|
|
25
58
|
//# sourceMappingURL=importAccounts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importAccounts.d.ts","sourceRoot":"","sources":["../../src/account/importAccounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,QAAA,MAAM,mBAAmB;;;;;CAKxB,CAAC;AACF,oBAAY,cAAc,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAC9D,oBAAY,UAAU,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,uBAAuB;YAK1B,MAAM;cACJ,OAAO,EAAE;;MAEjB,UAAU,EA6EO,CAAC;
|
|
1
|
+
{"version":3,"file":"importAccounts.d.ts","sourceRoot":"","sources":["../../src/account/importAccounts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAKvC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAOpD,QAAA,MAAM,mBAAmB;;;;;CAKxB,CAAC;AACF,oBAAY,cAAc,GAAG,MAAM,OAAO,mBAAmB,CAAC;AAC9D,oBAAY,UAAU,GAAG;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;CACtB,CAAC;AACF,eAAO,MAAM,uBAAuB;YAK1B,MAAM;cACJ,OAAO,EAAE;;MAEjB,UAAU,EA6EO,CAAC;AAEtB;;;;GAIG;AACH,oBAAY,qBAAqB,GAAG;IAClC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC/B,CAAC;AAEF,oBAAY,oBAAoB,GAAG;IACjC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,gCACL,oBAAoB,eACpC,iBAAiB,iDAE7B,QAAQ,qBAAqB,CA6B/B,CAAC;AAEF,oBAAY,yBAAyB,GAAG;IACtC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,gBAAgB,EAAE,MAAM,EAAE,CAAC;IAC3B,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,qBACb,OAAO,EAAE,2CACc,yBAAyB,KACjE,OAAO,EAyCT,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importAccounts.integration.test.d.ts","sourceRoot":"","sources":["../../src/account/importAccounts.integration.test.ts"],"names":[],"mappings":"AAAA,OAAO,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
require("../__tests__/test-helpers/setup");
|
|
40
|
+
var cache_1 = require("../bridge/cache");
|
|
41
|
+
var cross_1 = require("../cross");
|
|
42
|
+
var _1 = require(".");
|
|
43
|
+
jest.setTimeout(200000);
|
|
44
|
+
test("importAccounts with a set of real data", function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
var accounts, localCache, bridgeCache, result, accountsState, items, selectedAccounts, syncResult, reduced;
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
switch (_a.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
accounts = [
|
|
50
|
+
{
|
|
51
|
+
id: "js:2:algorand:32PI2C5HLHMVUF5KMNURLGCTYVIOVJJ2NLHLZ2PIMK567MKMS4RXBSVWQI:",
|
|
52
|
+
seedIdentifier: "32PI2C5HLHMVUF5KMNURLGCTYVIOVJJ2NLHLZ2PIMK567MKMS4RXBSVWQI",
|
|
53
|
+
name: "Algorand legacy 32PI2C5H...RXBSVWQI",
|
|
54
|
+
starred: true,
|
|
55
|
+
used: true,
|
|
56
|
+
derivationMode: "",
|
|
57
|
+
index: 0,
|
|
58
|
+
freshAddress: "32PI2C5HLHMVUF5KMNURLGCTYVIOVJJ2NLHLZ2PIMK567MKMS4RXBSVWQI",
|
|
59
|
+
freshAddressPath: "44'/283'/0'/0/0",
|
|
60
|
+
freshAddresses: [],
|
|
61
|
+
blockHeight: 23066613,
|
|
62
|
+
creationDate: "2022-02-04T13:12:58.000Z",
|
|
63
|
+
operationsCount: 184,
|
|
64
|
+
operations: [],
|
|
65
|
+
pendingOperations: [],
|
|
66
|
+
currencyId: "algorand",
|
|
67
|
+
unitMagnitude: 6,
|
|
68
|
+
lastSyncDate: "2022-08-26T09:24:27.076Z",
|
|
69
|
+
balance: "2100190",
|
|
70
|
+
spendableBalance: "190",
|
|
71
|
+
xpub: "32PI2C5HLHMVUF5KMNURLGCTYVIOVJJ2NLHLZ2PIMK567MKMS4RXBSVWQI",
|
|
72
|
+
subAccounts: [],
|
|
73
|
+
algorandResources: { rewards: "190", nbAssets: 20 },
|
|
74
|
+
swapHistory: []
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: "js:2:tron:TRbtdwHowocq8ThZbRnTHgK4JG5sx3fFCK:",
|
|
78
|
+
seedIdentifier: "TRbtdwHowocq8ThZbRnTHgK4JG5sx3fFCK",
|
|
79
|
+
name: "Tron legacy TRbtdwHo...5sx3fFCK",
|
|
80
|
+
starred: true,
|
|
81
|
+
used: true,
|
|
82
|
+
derivationMode: "",
|
|
83
|
+
index: 0,
|
|
84
|
+
freshAddress: "TRbtdwHowocq8ThZbRnTHgK4JG5sx3fFCK",
|
|
85
|
+
freshAddressPath: "44'/195'/0'/0/0",
|
|
86
|
+
freshAddresses: [],
|
|
87
|
+
blockHeight: 43642499,
|
|
88
|
+
creationDate: "2022-07-19T15:32:12.000Z",
|
|
89
|
+
operationsCount: 41,
|
|
90
|
+
operations: [],
|
|
91
|
+
pendingOperations: [],
|
|
92
|
+
currencyId: "tron",
|
|
93
|
+
unitMagnitude: 6,
|
|
94
|
+
lastSyncDate: "2022-08-26T09:24:59.492Z",
|
|
95
|
+
balance: "0",
|
|
96
|
+
spendableBalance: "0",
|
|
97
|
+
xpub: "TRbtdwHowocq8ThZbRnTHgK4JG5sx3fFCK",
|
|
98
|
+
subAccounts: [],
|
|
99
|
+
tronResources: {
|
|
100
|
+
frozen: {},
|
|
101
|
+
delegatedFrozen: {},
|
|
102
|
+
votes: [],
|
|
103
|
+
tronPower: 0,
|
|
104
|
+
energy: "0",
|
|
105
|
+
bandwidth: {
|
|
106
|
+
freeUsed: "0",
|
|
107
|
+
freeLimit: "1500",
|
|
108
|
+
gainedUsed: "0",
|
|
109
|
+
gainedLimit: "0"
|
|
110
|
+
},
|
|
111
|
+
unwithdrawnReward: "2730",
|
|
112
|
+
lastVotedDate: "2022-07-22T14:39:51.000Z",
|
|
113
|
+
cacheTransactionInfoById: {}
|
|
114
|
+
},
|
|
115
|
+
swapHistory: []
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "js:2:polkadot:15jLBbe9LD6VSUYFkV5Fmo5LhZU5cns9E6g8qcDv5KrKM1eP:polkadotbip44",
|
|
119
|
+
seedIdentifier: "15jLBbe9LD6VSUYFkV5Fmo5LhZU5cns9E6g8qcDv5KrKM1eP",
|
|
120
|
+
name: "Polkadot polkadotbip44 15jLBbe9...5KrKM1eP",
|
|
121
|
+
starred: true,
|
|
122
|
+
used: true,
|
|
123
|
+
derivationMode: "polkadotbip44",
|
|
124
|
+
index: 0,
|
|
125
|
+
freshAddress: "15jLBbe9LD6VSUYFkV5Fmo5LhZU5cns9E6g8qcDv5KrKM1eP",
|
|
126
|
+
freshAddressPath: "44'/354'/0'/0'/0'",
|
|
127
|
+
freshAddresses: [],
|
|
128
|
+
blockHeight: 11771108,
|
|
129
|
+
creationDate: "2022-02-24T14:39:00.007Z",
|
|
130
|
+
operationsCount: 65,
|
|
131
|
+
operations: [],
|
|
132
|
+
pendingOperations: [],
|
|
133
|
+
currencyId: "polkadot",
|
|
134
|
+
unitMagnitude: 10,
|
|
135
|
+
lastSyncDate: "2022-08-26T09:25:00.713Z",
|
|
136
|
+
balance: "15512511464",
|
|
137
|
+
spendableBalance: "15512511464",
|
|
138
|
+
xpub: "15jLBbe9LD6VSUYFkV5Fmo5LhZU5cns9E6g8qcDv5KrKM1eP",
|
|
139
|
+
polkadotResources: {
|
|
140
|
+
controller: null,
|
|
141
|
+
stash: null,
|
|
142
|
+
nonce: 63,
|
|
143
|
+
lockedBalance: "0",
|
|
144
|
+
unlockedBalance: "0",
|
|
145
|
+
unlockingBalance: "0",
|
|
146
|
+
unlockings: [],
|
|
147
|
+
nominations: []
|
|
148
|
+
},
|
|
149
|
+
swapHistory: []
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
id: "js:2:bsc:0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB:",
|
|
153
|
+
seedIdentifier: "0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB",
|
|
154
|
+
name: "Binance Smart Chain legacy 0xa22CA8...CdD06FAB",
|
|
155
|
+
starred: true,
|
|
156
|
+
used: true,
|
|
157
|
+
derivationMode: "",
|
|
158
|
+
index: 0,
|
|
159
|
+
freshAddress: "0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB",
|
|
160
|
+
freshAddressPath: "44'/60'/0'/0/0",
|
|
161
|
+
freshAddresses: [],
|
|
162
|
+
blockHeight: 20775454,
|
|
163
|
+
syncHash: "[]_655",
|
|
164
|
+
creationDate: "2022-02-04T13:11:32.001Z",
|
|
165
|
+
operationsCount: 21,
|
|
166
|
+
operations: [],
|
|
167
|
+
pendingOperations: [],
|
|
168
|
+
currencyId: "bsc",
|
|
169
|
+
unitMagnitude: 18,
|
|
170
|
+
lastSyncDate: "2022-08-26T09:25:01.109Z",
|
|
171
|
+
balance: "3128019430408477",
|
|
172
|
+
spendableBalance: "3128019430408477",
|
|
173
|
+
xpub: "0xa22CA840265d3C5CB1846e419B14c6a6CdD06FAB",
|
|
174
|
+
subAccounts: [],
|
|
175
|
+
swapHistory: []
|
|
176
|
+
},
|
|
177
|
+
].map(_1.fromAccountRaw);
|
|
178
|
+
localCache = {};
|
|
179
|
+
bridgeCache = (0, cache_1.makeBridgeCacheSystem)({
|
|
180
|
+
saveData: function (c, d) {
|
|
181
|
+
localCache[c.id] = d;
|
|
182
|
+
return Promise.resolve();
|
|
183
|
+
},
|
|
184
|
+
getData: function (c) {
|
|
185
|
+
return Promise.resolve(localCache[c.id]);
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
result = {
|
|
189
|
+
accounts: accounts.map(cross_1.accountToAccountData),
|
|
190
|
+
settings: { currenciesSettings: {}, pairExchanges: {} },
|
|
191
|
+
meta: { exporterName: "Test", exporterVersion: "0" }
|
|
192
|
+
};
|
|
193
|
+
accountsState = [];
|
|
194
|
+
items = (0, _1.importAccountsMakeItems)({
|
|
195
|
+
result: result,
|
|
196
|
+
accounts: accountsState
|
|
197
|
+
});
|
|
198
|
+
selectedAccounts = accounts.map(function (a) { return a.id; });
|
|
199
|
+
return [4 /*yield*/, (0, _1.syncNewAccountsToImport)({ items: items, selectedAccounts: selectedAccounts }, bridgeCache)];
|
|
200
|
+
case 1:
|
|
201
|
+
syncResult = _a.sent();
|
|
202
|
+
reduced = (0, _1.importAccountsReduce)(accountsState, {
|
|
203
|
+
items: items,
|
|
204
|
+
selectedAccounts: selectedAccounts,
|
|
205
|
+
syncResult: syncResult
|
|
206
|
+
});
|
|
207
|
+
expect(reduced.length).toEqual(4);
|
|
208
|
+
expect(reduced[0].algorandResources).toBeDefined();
|
|
209
|
+
expect(reduced[1].tronResources).toBeDefined();
|
|
210
|
+
expect(reduced[2].polkadotResources).toBeDefined();
|
|
211
|
+
expect(reduced[0].operations.length).toBeGreaterThan(1);
|
|
212
|
+
expect(reduced[1].operations.length).toBeGreaterThan(1);
|
|
213
|
+
expect(reduced[2].operations.length).toBeGreaterThan(1);
|
|
214
|
+
expect(reduced[3].operations.length).toBeGreaterThan(1);
|
|
215
|
+
return [2 /*return*/];
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}); });
|
|
219
|
+
//# sourceMappingURL=importAccounts.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importAccounts.integration.test.js","sourceRoot":"","sources":["../../src/account/importAccounts.integration.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAyC;AACzC,yCAAwD;AACxD,kCAAgD;AAChD,sBAKW;AAGX,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AAExB,IAAI,CAAC,wCAAwC,EAAE;;;;;gBACvC,QAAQ,GAAG;oBACf;wBACE,EAAE,EAAE,2EAA2E;wBAC/E,cAAc,EACZ,4DAA4D;wBAC9D,IAAI,EAAE,qCAAqC;wBAC3C,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,IAAI;wBACV,cAAc,EAAE,EAAE;wBAClB,KAAK,EAAE,CAAC;wBACR,YAAY,EACV,4DAA4D;wBAC9D,gBAAgB,EAAE,iBAAiB;wBACnC,cAAc,EA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__assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
+
function step(op) {
|
|
27
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
+
while (_) try {
|
|
29
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
+
switch (op[0]) {
|
|
32
|
+
case 0: case 1: t = op; break;
|
|
33
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
+
default:
|
|
37
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
+
if (t[2]) _.ops.pop();
|
|
42
|
+
_.trys.pop(); continue;
|
|
43
|
+
}
|
|
44
|
+
op = body.call(thisArg, _);
|
|
45
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
+
}
|
|
48
|
+
};
|
|
13
49
|
var __values = (this && this.__values) || function(o) {
|
|
14
50
|
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
51
|
if (m) return m.call(o);
|
|
@@ -25,12 +61,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
25
61
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
26
62
|
};
|
|
27
63
|
exports.__esModule = true;
|
|
28
|
-
exports.importAccountsReduce = exports.importAccountsMakeItems = void 0;
|
|
64
|
+
exports.importAccountsReduce = exports.syncNewAccountsToImport = exports.importAccountsMakeItems = void 0;
|
|
29
65
|
var logs_1 = require("@ledgerhq/logs");
|
|
30
66
|
var cross_1 = require("../cross");
|
|
31
67
|
var support_1 = require("./support");
|
|
32
68
|
var joinSwapHistories_1 = __importDefault(require("../exchange/swap/joinSwapHistories"));
|
|
33
69
|
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
70
|
+
var bridge_1 = require("../bridge");
|
|
71
|
+
var promise_1 = require("../promise");
|
|
72
|
+
var env_1 = require("../env");
|
|
73
|
+
var operators_1 = require("rxjs/operators");
|
|
34
74
|
var itemModeDisplaySort = {
|
|
35
75
|
create: 1,
|
|
36
76
|
update: 2,
|
|
@@ -100,22 +140,100 @@ var importAccountsMakeItems = function (_a) {
|
|
|
100
140
|
});
|
|
101
141
|
};
|
|
102
142
|
exports.importAccountsMakeItems = importAccountsMakeItems;
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
/**
|
|
144
|
+
*
|
|
145
|
+
* @param items: result of importAccountsMakeItems
|
|
146
|
+
* @param selectedAccounts: user's selected accounts
|
|
147
|
+
* @param bridgeCache: the bridge cache created on user land to prepare currency for a sync
|
|
148
|
+
* @param blacklistedTokenIds: the list of blacklisted token ids to ignore sync with
|
|
149
|
+
* @returns SyncNewAccountsOutput
|
|
150
|
+
*/
|
|
151
|
+
var syncNewAccountsToImport = function (_a, bridgeCache, blacklistedTokenIds) {
|
|
105
152
|
var items = _a.items, selectedAccounts = _a.selectedAccounts;
|
|
153
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var selectedItems, synchronized, failed;
|
|
155
|
+
return __generator(this, function (_b) {
|
|
156
|
+
switch (_b.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
selectedItems = items.filter(function (item) {
|
|
159
|
+
return selectedAccounts.includes(item.account.id);
|
|
160
|
+
});
|
|
161
|
+
synchronized = {};
|
|
162
|
+
failed = {};
|
|
163
|
+
return [4 /*yield*/, (0, promise_1.promiseAllBatched)((0, env_1.getEnv)("SYNC_MAX_CONCURRENT"), selectedItems, function (_a) {
|
|
164
|
+
var account = _a.account;
|
|
165
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
166
|
+
var bridge, syncConfig, observable, reduced, synced, e_1;
|
|
167
|
+
return __generator(this, function (_b) {
|
|
168
|
+
switch (_b.label) {
|
|
169
|
+
case 0:
|
|
170
|
+
_b.trys.push([0, 3, , 4]);
|
|
171
|
+
bridge = (0, bridge_1.getAccountBridge)(account);
|
|
172
|
+
return [4 /*yield*/, bridgeCache.prepareCurrency(account.currency)];
|
|
173
|
+
case 1:
|
|
174
|
+
_b.sent();
|
|
175
|
+
syncConfig = {
|
|
176
|
+
paginationConfig: {},
|
|
177
|
+
blacklistedTokenIds: blacklistedTokenIds
|
|
178
|
+
};
|
|
179
|
+
observable = bridge.sync(account, syncConfig);
|
|
180
|
+
reduced = observable.pipe((0, operators_1.reduce)(function (a, f) { return f(a); }, account));
|
|
181
|
+
return [4 /*yield*/, reduced.toPromise()];
|
|
182
|
+
case 2:
|
|
183
|
+
synced = _b.sent();
|
|
184
|
+
synchronized[account.id] = synced;
|
|
185
|
+
return [3 /*break*/, 4];
|
|
186
|
+
case 3:
|
|
187
|
+
e_1 = _b.sent();
|
|
188
|
+
failed[account.id] = e_1;
|
|
189
|
+
return [3 /*break*/, 4];
|
|
190
|
+
case 4: return [2 /*return*/];
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
})];
|
|
195
|
+
case 1:
|
|
196
|
+
_b.sent();
|
|
197
|
+
return [2 /*return*/, { synchronized: synchronized, failed: failed }];
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
exports.syncNewAccountsToImport = syncNewAccountsToImport;
|
|
203
|
+
/**
|
|
204
|
+
*
|
|
205
|
+
* @param existingAccounts
|
|
206
|
+
* @param items: value resulting of importAccountsMakeItems
|
|
207
|
+
* @params selectedAccounts: array of all account ids selected by user for import
|
|
208
|
+
* @param syncedNewAccounts: accounts resulting of syncNewAccountsToImport(). all accounts that would be missing from that list would be ignored to be imported (fresh sync is needed to make sure the accounts are "ready")
|
|
209
|
+
* @returns all accounts
|
|
210
|
+
*/
|
|
211
|
+
var importAccountsReduce = function (existingAccounts, _a) {
|
|
212
|
+
var e_2, _b;
|
|
213
|
+
var items = _a.items, selectedAccounts = _a.selectedAccounts, syncResult = _a.syncResult;
|
|
106
214
|
var accounts = existingAccounts.slice(0);
|
|
107
215
|
var selectedItems = items.filter(function (item) {
|
|
108
216
|
return selectedAccounts.includes(item.account.id);
|
|
109
217
|
});
|
|
110
|
-
var _loop_1 = function (mode,
|
|
218
|
+
var _loop_1 = function (mode, id, initialAccountId) {
|
|
219
|
+
var account = syncResult.synchronized[id];
|
|
220
|
+
if (!account)
|
|
221
|
+
return "continue";
|
|
111
222
|
switch (mode) {
|
|
112
|
-
case "create":
|
|
113
|
-
accounts.
|
|
223
|
+
case "create": {
|
|
224
|
+
var exists = accounts.find(function (a) { return a.id === initialAccountId || a.id === id; });
|
|
225
|
+
if (!exists) {
|
|
226
|
+
// prevent duplicate cases to happen (in case of race condition)
|
|
227
|
+
accounts.push(account);
|
|
228
|
+
}
|
|
114
229
|
break;
|
|
230
|
+
}
|
|
115
231
|
case "update": {
|
|
116
|
-
var item = accounts.find(function (a) { return a.id === initialAccountId; });
|
|
232
|
+
var item = accounts.find(function (a) { return a.id === initialAccountId || a.id === id; });
|
|
117
233
|
var i = accounts.indexOf(item);
|
|
118
|
-
|
|
234
|
+
if (i !== -1) {
|
|
235
|
+
accounts[i] = account;
|
|
236
|
+
}
|
|
119
237
|
break;
|
|
120
238
|
}
|
|
121
239
|
default:
|
|
@@ -123,16 +241,16 @@ var importAccountsReduce = function (existingAccounts, _a) {
|
|
|
123
241
|
};
|
|
124
242
|
try {
|
|
125
243
|
for (var selectedItems_1 = __values(selectedItems), selectedItems_1_1 = selectedItems_1.next(); !selectedItems_1_1.done; selectedItems_1_1 = selectedItems_1.next()) {
|
|
126
|
-
var _c = selectedItems_1_1.value, mode = _c.mode,
|
|
127
|
-
_loop_1(mode,
|
|
244
|
+
var _c = selectedItems_1_1.value, mode = _c.mode, id = _c.account.id, initialAccountId = _c.initialAccountId;
|
|
245
|
+
_loop_1(mode, id, initialAccountId);
|
|
128
246
|
}
|
|
129
247
|
}
|
|
130
|
-
catch (
|
|
248
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
131
249
|
finally {
|
|
132
250
|
try {
|
|
133
251
|
if (selectedItems_1_1 && !selectedItems_1_1.done && (_b = selectedItems_1["return"])) _b.call(selectedItems_1);
|
|
134
252
|
}
|
|
135
|
-
finally { if (
|
|
253
|
+
finally { if (e_2) throw e_2.error; }
|
|
136
254
|
}
|
|
137
255
|
return accounts;
|
|
138
256
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importAccounts.js","sourceRoot":"","sources":["../../src/account/importAccounts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"importAccounts.js","sourceRoot":"","sources":["../../src/account/importAccounts.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAqC;AAErC,kCAAgD;AAChD,qCAAwE;AACxE,yFAAmE;AACnE,2DAAqC;AAGrC,oCAA6C;AAC7C,sCAA+C;AAC/C,8BAAgC;AAEhC,4CAAwC;AAExC,IAAM,mBAAmB,GAAG;IAC1B,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,EAAE,EAAE,CAAC;IACL,WAAW,EAAE,CAAC;CACf,CAAC;AAOK,IAAM,uBAAuB,GAAG,UAAC,EAQvC;QAPC,MAAM,YAAA,EACN,QAAQ,cAAA,EACR,KAAK,WAAA;IAML,OAAA,MAAM,CAAC,QAAQ;SACZ,GAAG,CAAC,UAAC,QAAQ;QACZ,IAAM,QAAQ,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,IAAI,CACjC,UAAC,IAAI,IAAK,OAAA,IAAI,CAAC,OAAO,CAAC,EAAE,KAAK,QAAQ,CAAC,EAAE,EAA/B,CAA+B,CAC1C,CAAC;QACF,IAAI,QAAQ;YAAE,OAAO,QAAQ,CAAC;QAE9B,IAAI;YACF,IAAM,SAAO,GAAG,IAAA,4BAAoB,EAAC,QAAQ,CAAC,CAAC;YAC/C,IAAM,KAAK,GAAG,IAAA,+BAAqB,EAAC,SAAO,CAAC,CAAC;YAE7C,IAAI,KAAK,EAAE;gBACT,OAAO;oBACL,gBAAgB,EAAE,SAAO,CAAC,EAAE;oBAC5B,OAAO,WAAA;oBACP,IAAI,EAAE,aAAa;iBACpB,CAAC;aACH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