@ledgerhq/live-wallet 0.7.4-spl-test.0 → 0.7.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/.eslintrc.js +1 -0
- package/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +26 -8
- package/lib/store.d.ts +2 -2
- package/lib/walletsync/aggregator.d.ts +1 -1
- package/lib/walletsync/aggregator.d.ts.map +1 -1
- package/lib/walletsync/incrementalUpdates.d.ts +1 -1
- package/lib/walletsync/incrementalUpdates.d.ts.map +1 -1
- package/lib/walletsync/incrementalUpdates.js +5 -5
- package/lib/walletsync/incrementalUpdates.js.map +1 -1
- package/lib/walletsync/index.d.ts +7 -94
- package/lib/walletsync/index.d.ts.map +1 -1
- package/lib/walletsync/index.js +9 -23
- package/lib/walletsync/index.js.map +1 -1
- package/lib/walletsync/modules/accounts.d.ts +8 -8
- package/lib/walletsync/root.d.ts +84 -0
- package/lib/walletsync/root.d.ts.map +1 -0
- package/lib/walletsync/root.js +22 -0
- package/lib/walletsync/root.js.map +1 -0
- package/lib/walletsync/trustchainLifecyle.d.ts +1 -0
- package/lib/walletsync/trustchainLifecyle.d.ts.map +1 -1
- package/lib/walletsync/trustchainLifecyle.js +4 -4
- package/lib/walletsync/trustchainLifecyle.js.map +1 -1
- package/lib-es/store.d.ts +2 -2
- package/lib-es/walletsync/aggregator.d.ts +1 -1
- package/lib-es/walletsync/aggregator.d.ts.map +1 -1
- package/lib-es/walletsync/incrementalUpdates.d.ts +1 -1
- package/lib-es/walletsync/incrementalUpdates.d.ts.map +1 -1
- package/lib-es/walletsync/incrementalUpdates.js +1 -1
- package/lib-es/walletsync/incrementalUpdates.js.map +1 -1
- package/lib-es/walletsync/index.d.ts +7 -94
- package/lib-es/walletsync/index.d.ts.map +1 -1
- package/lib-es/walletsync/index.js +5 -20
- package/lib-es/walletsync/index.js.map +1 -1
- package/lib-es/walletsync/modules/accounts.d.ts +8 -8
- package/lib-es/walletsync/root.d.ts +84 -0
- package/lib-es/walletsync/root.d.ts.map +1 -0
- package/lib-es/walletsync/root.js +17 -0
- package/lib-es/walletsync/root.js.map +1 -0
- package/lib-es/walletsync/trustchainLifecyle.d.ts +1 -0
- package/lib-es/walletsync/trustchainLifecyle.d.ts.map +1 -1
- package/lib-es/walletsync/trustchainLifecyle.js +1 -1
- package/lib-es/walletsync/trustchainLifecyle.js.map +1 -1
- package/package.json +9 -9
- package/src/walletsync/incrementalUpdates.ts +1 -1
- package/src/walletsync/index.ts +10 -36
- package/src/walletsync/root.ts +29 -0
- package/src/walletsync/trustchainLifecyle.ts +2 -1
- package/.unimportedrc.json +0 -19
package/.eslintrc.js
CHANGED
|
@@ -15,6 +15,7 @@ module.exports = {
|
|
|
15
15
|
extends: ["plugin:import/typescript", "plugin:jsx-a11y/recommended"],
|
|
16
16
|
plugins: ["import", "jsx-a11y"],
|
|
17
17
|
rules: {
|
|
18
|
+
"import/no-cycle": ["error", { maxDepth: 1 }],
|
|
18
19
|
"no-console": ["error", { allow: ["warn", "error"] }],
|
|
19
20
|
"linebreak-style": ["error", "unix"],
|
|
20
21
|
"@typescript-eslint/no-empty-function": "off",
|
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
# @ledgerhq/live-wallet
|
|
2
2
|
|
|
3
|
-
## 0.7.4
|
|
3
|
+
## 0.7.4
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- @ledgerhq/
|
|
11
|
-
- @ledgerhq/coin-framework@0.19.0
|
|
12
|
-
- @ledgerhq/
|
|
13
|
-
- @ledgerhq/
|
|
7
|
+
- [#8302](https://github.com/LedgerHQ/ledger-live/pull/8302) [`a8c4369`](https://github.com/LedgerHQ/ledger-live/commit/a8c436934f18518883c6e1ef658c8df354fde5e6) Thanks [@thesan](https://github.com/thesan)! - Remove circular dependencies from walletsync
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`5c13c7b`](https://github.com/LedgerHQ/ledger-live/commit/5c13c7bf743333f09cbfee720d275dfae7e157d2), [`2013b0f`](https://github.com/LedgerHQ/ledger-live/commit/2013b0f23d7f5bccff58dfd93fd45333194b8ae0), [`2013b0f`](https://github.com/LedgerHQ/ledger-live/commit/2013b0f23d7f5bccff58dfd93fd45333194b8ae0), [`95fbec9`](https://github.com/LedgerHQ/ledger-live/commit/95fbec9fdff75cd6d4ac23e189e876efffc81906), [`63e5392`](https://github.com/LedgerHQ/ledger-live/commit/63e5392a108f1bec7cfc9c413db1550e7b5c9a25), [`87218b1`](https://github.com/LedgerHQ/ledger-live/commit/87218b17b86eaea9daa23c4c9cdf644c7ad2f65a), [`b93a421`](https://github.com/LedgerHQ/ledger-live/commit/b93a421866519b80fdd8a029caea97323eceae93), [`42e27f2`](https://github.com/LedgerHQ/ledger-live/commit/42e27f229ee2c1302258b6cc27d165c7b638cf3b), [`a40c525`](https://github.com/LedgerHQ/ledger-live/commit/a40c5256b80574aaaf17651d195832668b9796f5)]:
|
|
10
|
+
- @ledgerhq/live-env@2.4.1
|
|
11
|
+
- @ledgerhq/coin-framework@0.19.0
|
|
12
|
+
- @ledgerhq/types-cryptoassets@7.17.0
|
|
13
|
+
- @ledgerhq/cryptoassets@13.7.0
|
|
14
|
+
- @ledgerhq/types-live@6.53.0
|
|
15
|
+
- @ledgerhq/ledger-key-ring-protocol@0.5.1
|
|
16
|
+
- @ledgerhq/live-network@2.0.3
|
|
17
|
+
|
|
18
|
+
## 0.7.4-next.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#8302](https://github.com/LedgerHQ/ledger-live/pull/8302) [`a8c4369`](https://github.com/LedgerHQ/ledger-live/commit/a8c436934f18518883c6e1ef658c8df354fde5e6) Thanks [@thesan](https://github.com/thesan)! - Remove circular dependencies from walletsync
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`5c13c7b`](https://github.com/LedgerHQ/ledger-live/commit/5c13c7bf743333f09cbfee720d275dfae7e157d2), [`2013b0f`](https://github.com/LedgerHQ/ledger-live/commit/2013b0f23d7f5bccff58dfd93fd45333194b8ae0), [`2013b0f`](https://github.com/LedgerHQ/ledger-live/commit/2013b0f23d7f5bccff58dfd93fd45333194b8ae0), [`35d6de2`](https://github.com/LedgerHQ/ledger-live/commit/35d6de2ace269f30fc39a3f022673a82d0c48193), [`95fbec9`](https://github.com/LedgerHQ/ledger-live/commit/95fbec9fdff75cd6d4ac23e189e876efffc81906), [`63e5392`](https://github.com/LedgerHQ/ledger-live/commit/63e5392a108f1bec7cfc9c413db1550e7b5c9a25), [`87218b1`](https://github.com/LedgerHQ/ledger-live/commit/87218b17b86eaea9daa23c4c9cdf644c7ad2f65a), [`b93a421`](https://github.com/LedgerHQ/ledger-live/commit/b93a421866519b80fdd8a029caea97323eceae93), [`42e27f2`](https://github.com/LedgerHQ/ledger-live/commit/42e27f229ee2c1302258b6cc27d165c7b638cf3b), [`a40c525`](https://github.com/LedgerHQ/ledger-live/commit/a40c5256b80574aaaf17651d195832668b9796f5)]:
|
|
25
|
+
- @ledgerhq/live-env@2.4.1-next.0
|
|
26
|
+
- @ledgerhq/coin-framework@0.19.0-next.0
|
|
27
|
+
- @ledgerhq/types-cryptoassets@7.17.0-next.0
|
|
28
|
+
- @ledgerhq/cryptoassets@13.7.0-next.0
|
|
29
|
+
- @ledgerhq/types-live@6.53.0-next.0
|
|
30
|
+
- @ledgerhq/ledger-key-ring-protocol@0.5.1-next.0
|
|
31
|
+
- @ledgerhq/live-network@2.0.3-next.0
|
|
14
32
|
|
|
15
33
|
## 0.7.3
|
|
16
34
|
|
package/lib/store.d.ts
CHANGED
|
@@ -104,10 +104,10 @@ export declare const walletSyncUpdate: (data: DistantState | null, version: numb
|
|
|
104
104
|
accounts?: {
|
|
105
105
|
index: number;
|
|
106
106
|
id: string;
|
|
107
|
-
currencyId: string;
|
|
108
|
-
freshAddress: string;
|
|
109
107
|
seedIdentifier: string;
|
|
110
108
|
derivationMode: string;
|
|
109
|
+
freshAddress: string;
|
|
110
|
+
currencyId: string;
|
|
111
111
|
}[] | undefined;
|
|
112
112
|
accountNames?: Record<string, string> | undefined;
|
|
113
113
|
} | null;
|
|
@@ -5,7 +5,7 @@ import { ExtractLocalState, ExtractUpdateEvent, UpdateDiff, WalletSyncDataManage
|
|
|
5
5
|
* In this root WalletSyncDataManager, the data is segmented into JS Object fields (one field = one module)
|
|
6
6
|
* and under modules/ folder: each module implements a WalletSyncDataManager at the field level of the main data.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createAggregator<Mods extends Record<string, WalletSyncDataManager<any, any, any>>>(modules: Mods): WalletSyncDataManager<{ [K in keyof Mods]: ExtractLocalState<Mods[K]>; }, { [K_1 in keyof Mods]: UpdateDiff<ExtractUpdateEvent<Mods[K_1]>>; }, z.ZodObject<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }, "strip", z.ZodTypeAny, { [
|
|
8
|
+
export declare function createAggregator<Mods extends Record<string, WalletSyncDataManager<any, any, any>>>(modules: Mods): WalletSyncDataManager<{ [K in keyof Mods]: ExtractLocalState<Mods[K]>; }, { [K_1 in keyof Mods]: UpdateDiff<ExtractUpdateEvent<Mods[K_1]>>; }, z.ZodObject<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }, "strip", z.ZodTypeAny, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>[k]; }, { [k_1 in keyof z.baseObjectInputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>]: z.baseObjectInputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>[k_1]; }>, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>[k]; }>;
|
|
9
9
|
export declare function mapValues<T extends object, U extends {
|
|
10
10
|
[K in keyof T]: unknown;
|
|
11
11
|
}>(obj: T, fn: <K extends keyof T>(value: T[K], key: K) => any): U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/walletsync/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAChG,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/walletsync/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAChG,OAAO,EAAE,IAAI,27BAgFd;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO;CAAE,EAC/E,GAAG,EAAE,CAAC,EACN,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,GAClD,CAAC,CAMH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalUpdates.d.ts","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"incrementalUpdates.d.ts","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EACnC,GAAG,EACH,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,UAAU,GACX,EAAE;IACD,GAAG,EAAE,sCAAsC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,0BAA0B,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,YAAY,GAAG,IAAI,CAAC;IAC9D,4BAA4B,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACnD,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC;IAC7C,UAAU,EAAE,CACV,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,UAAU,GAAG,IAAI,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAqCtD;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,EAC5C,GAAG,EACH,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EAClB,UAAU,GACX,EAAE;IACD,GAAG,EAAE,sCAAsC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,yBAAyB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACjD,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC;IAC7C,UAAU,EAAE,CACV,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,UAAU,GAAG,IAAI,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAetB"}
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.makeLocalIncrementalUpdate = exports.makeSaveNewUpdate = void 0;
|
|
16
16
|
const logs_1 = require("@ledgerhq/logs");
|
|
17
|
-
const
|
|
17
|
+
const root_1 = __importDefault(require("./root"));
|
|
18
18
|
function makeSaveNewUpdate({ ctx, getState, latestDistantStateSelector, latestDistantVersionSelector, localStateSelector, saveUpdate, }) {
|
|
19
19
|
return (event) => __awaiter(this, void 0, void 0, function* () {
|
|
20
20
|
(0, logs_1.log)("walletsync", "saveNewUpdate", { event });
|
|
@@ -26,11 +26,11 @@ function makeSaveNewUpdate({ ctx, getState, latestDistantStateSelector, latestDi
|
|
|
26
26
|
const latest = latestDistantStateSelector(state);
|
|
27
27
|
const local = localStateSelector(state);
|
|
28
28
|
const data = event.data;
|
|
29
|
-
const resolved = yield
|
|
29
|
+
const resolved = yield root_1.default.resolveIncrementalUpdate(ctx, local, latest, data);
|
|
30
30
|
if (resolved.hasChanges) {
|
|
31
31
|
const version = event.version;
|
|
32
32
|
const localState = localStateSelector(getState()); // fetch again latest state because it might have changed
|
|
33
|
-
const newLocalState =
|
|
33
|
+
const newLocalState = root_1.default.applyUpdate(localState, resolved.update); // we resolve in sync the new local state to save
|
|
34
34
|
yield saveUpdate(data, version, newLocalState);
|
|
35
35
|
(0, logs_1.log)("walletsync", "resolved. changes applied.");
|
|
36
36
|
}
|
|
@@ -60,10 +60,10 @@ function makeLocalIncrementalUpdate({ ctx, getState, latestWalletStateSelector,
|
|
|
60
60
|
const state = getState();
|
|
61
61
|
const { data, version } = latestWalletStateSelector(state);
|
|
62
62
|
const local = localStateSelector(state);
|
|
63
|
-
const resolved = yield
|
|
63
|
+
const resolved = yield root_1.default.resolveIncrementalUpdate(ctx, local, data, data);
|
|
64
64
|
if (resolved.hasChanges) {
|
|
65
65
|
const localState = localStateSelector(getState()); // fetch again latest state because it might have changed
|
|
66
|
-
const newLocalState =
|
|
66
|
+
const newLocalState = root_1.default.applyUpdate(localState, resolved.update); // we resolve in sync the new local state to save
|
|
67
67
|
yield saveUpdate(data, version, newLocalState);
|
|
68
68
|
(0, logs_1.log)("walletsync", "localIncrementalUpdate done.");
|
|
69
69
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalUpdates.js","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAqC;AACrC,
|
|
1
|
+
{"version":3,"file":"incrementalUpdates.js","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,yCAAqC;AACrC,kDAA8D;AAK9D,SAAgB,iBAAiB,CAAI,EACnC,GAAG,EACH,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,UAAU,GAYX;IACC,OAAO,CAAO,KAAg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
|
1
|
-
import {
|
|
2
|
-
import { ExtractLocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
-
import { createWalletSyncWatchLoop, VisualConfig, WatchConfig } from "./createWalletSyncWatchLoop";
|
|
4
|
-
export { createWalletSyncWatchLoop };
|
|
5
|
-
export type { VisualConfig, WatchConfig };
|
|
6
|
-
export { trustchainLifecycle } from "./trustchainLifecyle";
|
|
7
|
-
export * from "./incrementalUpdates";
|
|
1
|
+
import { VisualConfig, WatchConfig } from "./createWalletSyncWatchLoop";
|
|
8
2
|
import { CloudSyncSDK } from "../cloudsync";
|
|
9
3
|
import { MemberCredentials, Trustchain } from "@ledgerhq/ledger-key-ring-protocol/types";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
accounts: {
|
|
17
|
-
list: import("@ledgerhq/types-live").Account[];
|
|
18
|
-
/**
|
|
19
|
-
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
20
|
-
* for all the different fields and delegate/dispatch/aggregate the data
|
|
21
|
-
* to each module.
|
|
22
|
-
*/
|
|
23
|
-
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
24
|
-
};
|
|
25
|
-
accountNames: Map<string, string>;
|
|
26
|
-
}, {
|
|
27
|
-
accounts: import("./types").UpdateDiff<{
|
|
28
|
-
removed: string[];
|
|
29
|
-
added: import("@ledgerhq/types-live").Account[];
|
|
30
|
-
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
31
|
-
}>;
|
|
32
|
-
accountNames: import("./types").UpdateDiff<{
|
|
33
|
-
replaceAllNames: Record<string, string>;
|
|
34
|
-
}>;
|
|
35
|
-
}, z.ZodObject<{
|
|
36
|
-
accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
-
id: z.ZodString;
|
|
38
|
-
currencyId: z.ZodString;
|
|
39
|
-
freshAddress: z.ZodString;
|
|
40
|
-
seedIdentifier: z.ZodString;
|
|
41
|
-
derivationMode: z.ZodString;
|
|
42
|
-
index: z.ZodNumber;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
index: number;
|
|
45
|
-
id: string;
|
|
46
|
-
currencyId: string;
|
|
47
|
-
freshAddress: string;
|
|
48
|
-
seedIdentifier: string;
|
|
49
|
-
derivationMode: string;
|
|
50
|
-
}, {
|
|
51
|
-
index: number;
|
|
52
|
-
id: string;
|
|
53
|
-
currencyId: string;
|
|
54
|
-
freshAddress: string;
|
|
55
|
-
seedIdentifier: string;
|
|
56
|
-
derivationMode: string;
|
|
57
|
-
}>, "many">>;
|
|
58
|
-
accountNames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
-
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
accounts?: {
|
|
61
|
-
index: number;
|
|
62
|
-
id: string;
|
|
63
|
-
currencyId: string;
|
|
64
|
-
freshAddress: string;
|
|
65
|
-
seedIdentifier: string;
|
|
66
|
-
derivationMode: string;
|
|
67
|
-
}[] | undefined;
|
|
68
|
-
accountNames?: Record<string, string> | undefined;
|
|
69
|
-
}, {
|
|
70
|
-
accounts?: {
|
|
71
|
-
index: number;
|
|
72
|
-
id: string;
|
|
73
|
-
currencyId: string;
|
|
74
|
-
freshAddress: string;
|
|
75
|
-
seedIdentifier: string;
|
|
76
|
-
derivationMode: string;
|
|
77
|
-
}[] | undefined;
|
|
78
|
-
accountNames?: Record<string, string> | undefined;
|
|
79
|
-
}>, {
|
|
80
|
-
accounts?: {
|
|
81
|
-
index: number;
|
|
82
|
-
id: string;
|
|
83
|
-
currencyId: string;
|
|
84
|
-
freshAddress: string;
|
|
85
|
-
seedIdentifier: string;
|
|
86
|
-
derivationMode: string;
|
|
87
|
-
}[] | undefined;
|
|
88
|
-
accountNames?: Record<string, string> | undefined;
|
|
89
|
-
}>;
|
|
90
|
-
type Root = typeof root;
|
|
91
|
-
export type LocalState = ExtractLocalState<Root>;
|
|
92
|
-
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
93
|
-
export type Schema = ExtractSchema<Root>;
|
|
94
|
-
export type DistantState = z.infer<Schema>;
|
|
95
|
-
export default root;
|
|
96
|
-
export declare const liveSlug = "live";
|
|
4
|
+
import { DistantState, LocalState, Schema } from "./root";
|
|
5
|
+
export { createWalletSyncWatchLoop, type VisualConfig, type WatchConfig, } from "./createWalletSyncWatchLoop";
|
|
6
|
+
export * from "./trustchainLifecyle";
|
|
7
|
+
export * from "./incrementalUpdates";
|
|
8
|
+
export * from "./root";
|
|
9
|
+
export { default } from "./root";
|
|
97
10
|
/**
|
|
98
11
|
* specialized version of createWalletSyncWatchLoop for the root WalletSyncDataManager.
|
|
99
12
|
* UserState is the global state of the application that you have. (LLD/LLM/webtools all have different states)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhE,OAAO,EACL,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,EAC7C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,GACrB,EAAE;IACD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,gBAAgB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,yBAAyB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,UAAU,CAAC;IACrD,0BAA0B,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,YAAY,GAAG,IAAI,CAAC;IACtE,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;;;EAkBA"}
|
package/lib/walletsync/index.js
CHANGED
|
@@ -17,37 +17,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.walletSyncWatchLoop = exports.
|
|
21
|
-
const aggregator_1 = require("./aggregator");
|
|
20
|
+
exports.walletSyncWatchLoop = exports.default = exports.createWalletSyncWatchLoop = void 0;
|
|
22
21
|
const createWalletSyncWatchLoop_1 = require("./createWalletSyncWatchLoop");
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
Object.defineProperty(exports, "
|
|
22
|
+
const root_1 = __importDefault(require("./root"));
|
|
23
|
+
var createWalletSyncWatchLoop_2 = require("./createWalletSyncWatchLoop");
|
|
24
|
+
Object.defineProperty(exports, "createWalletSyncWatchLoop", { enumerable: true, get: function () { return createWalletSyncWatchLoop_2.createWalletSyncWatchLoop; } });
|
|
25
|
+
__exportStar(require("./trustchainLifecyle"), exports);
|
|
26
26
|
__exportStar(require("./incrementalUpdates"), exports);
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const accountNames_1 = __importDefault(require("./modules/accountNames"));
|
|
31
|
-
const modules = {
|
|
32
|
-
accounts: accounts_1.default,
|
|
33
|
-
accountNames: accountNames_1.default,
|
|
34
|
-
};
|
|
35
|
-
////////////////////////////////////////////////////////////////////////
|
|
36
|
-
/**
|
|
37
|
-
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
38
|
-
* for all the different fields and delegate/dispatch/aggregate the data
|
|
39
|
-
* to each module.
|
|
40
|
-
*/
|
|
41
|
-
const root = (0, aggregator_1.createAggregator)(modules);
|
|
42
|
-
exports.default = root;
|
|
43
|
-
exports.liveSlug = "live";
|
|
27
|
+
__exportStar(require("./root"), exports);
|
|
28
|
+
var root_2 = require("./root");
|
|
29
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(root_2).default; } });
|
|
44
30
|
/**
|
|
45
31
|
* specialized version of createWalletSyncWatchLoop for the root WalletSyncDataManager.
|
|
46
32
|
* UserState is the global state of the application that you have. (LLD/LLM/webtools all have different states)
|
|
47
33
|
* Refer to createWalletSyncWatchLoop for more information.
|
|
48
34
|
*/
|
|
49
35
|
function walletSyncWatchLoop({ watchConfig, visualConfig, walletSyncSdk, trustchain, memberCredentials, setVisualPending, onError, onStartPolling, getState, localStateSelector, latestDistantStateSelector, onTrustchainRefreshNeeded, localIncrementUpdate, }) {
|
|
50
|
-
const walletsync =
|
|
36
|
+
const walletsync = root_1.default;
|
|
51
37
|
return (0, createWalletSyncWatchLoop_1.createWalletSyncWatchLoop)({
|
|
52
38
|
watchConfig,
|
|
53
39
|
visualConfig,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,2EAAmG;AAGnG,kDAAgE;AAEhE,yEAIqC;AAHnC,sIAAA,yBAAyB,OAAA;AAI3B,uDAAqC;AACrC,uDAAqC;AACrC,yCAAuB;AACvB,+BAAiC;AAAxB,gHAAA,OAAO,OAAA;AAEhB;;;;GAIG;AACH,SAAgB,mBAAmB,CAAY,EAC7C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,GAerB;IACC,MAAM,UAAU,GAAG,cAAI,CAAC;IACxB,OAAO,IAAA,qDAAyB,EAAC;QAC/B,WAAW;QACX,YAAY;QACZ,UAAU;QACV,aAAa;QACb,UAAU;QACV,iBAAiB;QACjB,gBAAgB;QAChB,OAAO;QACP,cAAc;QACd,QAAQ;QACR,kBAAkB;QAClB,0BAA0B;QAC1B,yBAAyB;QACzB,oBAAoB;KACrB,CAAC,CAAC;AACL,CAAC;AA9CD,kDA8CC"}
|
|
@@ -11,17 +11,17 @@ declare const accountDescriptorSchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
index: number;
|
|
13
13
|
id: string;
|
|
14
|
-
currencyId: string;
|
|
15
|
-
freshAddress: string;
|
|
16
14
|
seedIdentifier: string;
|
|
17
15
|
derivationMode: string;
|
|
16
|
+
freshAddress: string;
|
|
17
|
+
currencyId: string;
|
|
18
18
|
}, {
|
|
19
19
|
index: number;
|
|
20
20
|
id: string;
|
|
21
|
-
currencyId: string;
|
|
22
|
-
freshAddress: string;
|
|
23
21
|
seedIdentifier: string;
|
|
24
22
|
derivationMode: string;
|
|
23
|
+
freshAddress: string;
|
|
24
|
+
currencyId: string;
|
|
25
25
|
}>;
|
|
26
26
|
type AccountDescriptor = z.infer<typeof accountDescriptorSchema>;
|
|
27
27
|
declare const schema: z.ZodArray<z.ZodObject<{
|
|
@@ -34,17 +34,17 @@ declare const schema: z.ZodArray<z.ZodObject<{
|
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
index: number;
|
|
36
36
|
id: string;
|
|
37
|
-
currencyId: string;
|
|
38
|
-
freshAddress: string;
|
|
39
37
|
seedIdentifier: string;
|
|
40
38
|
derivationMode: string;
|
|
39
|
+
freshAddress: string;
|
|
40
|
+
currencyId: string;
|
|
41
41
|
}, {
|
|
42
42
|
index: number;
|
|
43
43
|
id: string;
|
|
44
|
-
currencyId: string;
|
|
45
|
-
freshAddress: string;
|
|
46
44
|
seedIdentifier: string;
|
|
47
45
|
derivationMode: string;
|
|
46
|
+
freshAddress: string;
|
|
47
|
+
currencyId: string;
|
|
48
48
|
}>, "many">;
|
|
49
49
|
export type NonImportedAccountInfo = {
|
|
50
50
|
id: string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ExtractLocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
5
|
+
* for all the different fields and delegate/dispatch/aggregate the data
|
|
6
|
+
* to each module.
|
|
7
|
+
*/
|
|
8
|
+
declare const root: import("./types").WalletSyncDataManager<{
|
|
9
|
+
accounts: {
|
|
10
|
+
list: import("@ledgerhq/types-live").Account[];
|
|
11
|
+
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
12
|
+
};
|
|
13
|
+
accountNames: Map<string, string>;
|
|
14
|
+
}, {
|
|
15
|
+
accounts: import("./types").UpdateDiff<{
|
|
16
|
+
removed: string[];
|
|
17
|
+
added: import("@ledgerhq/types-live").Account[];
|
|
18
|
+
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
19
|
+
}>;
|
|
20
|
+
accountNames: import("./types").UpdateDiff<{
|
|
21
|
+
replaceAllNames: Record<string, string>;
|
|
22
|
+
}>;
|
|
23
|
+
}, z.ZodObject<{
|
|
24
|
+
accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
currencyId: z.ZodString;
|
|
27
|
+
freshAddress: z.ZodString;
|
|
28
|
+
seedIdentifier: z.ZodString;
|
|
29
|
+
derivationMode: z.ZodString;
|
|
30
|
+
index: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
index: number;
|
|
33
|
+
id: string;
|
|
34
|
+
seedIdentifier: string;
|
|
35
|
+
derivationMode: string;
|
|
36
|
+
freshAddress: string;
|
|
37
|
+
currencyId: string;
|
|
38
|
+
}, {
|
|
39
|
+
index: number;
|
|
40
|
+
id: string;
|
|
41
|
+
seedIdentifier: string;
|
|
42
|
+
derivationMode: string;
|
|
43
|
+
freshAddress: string;
|
|
44
|
+
currencyId: string;
|
|
45
|
+
}>, "many">>;
|
|
46
|
+
accountNames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
accounts?: {
|
|
49
|
+
index: number;
|
|
50
|
+
id: string;
|
|
51
|
+
seedIdentifier: string;
|
|
52
|
+
derivationMode: string;
|
|
53
|
+
freshAddress: string;
|
|
54
|
+
currencyId: string;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
accountNames?: Record<string, string> | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
accounts?: {
|
|
59
|
+
index: number;
|
|
60
|
+
id: string;
|
|
61
|
+
seedIdentifier: string;
|
|
62
|
+
derivationMode: string;
|
|
63
|
+
freshAddress: string;
|
|
64
|
+
currencyId: string;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
accountNames?: Record<string, string> | undefined;
|
|
67
|
+
}>, {
|
|
68
|
+
accounts?: {
|
|
69
|
+
index: number;
|
|
70
|
+
id: string;
|
|
71
|
+
seedIdentifier: string;
|
|
72
|
+
derivationMode: string;
|
|
73
|
+
freshAddress: string;
|
|
74
|
+
currencyId: string;
|
|
75
|
+
}[] | undefined;
|
|
76
|
+
accountNames?: Record<string, string> | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
type Root = typeof root;
|
|
79
|
+
export type LocalState = ExtractLocalState<Root>;
|
|
80
|
+
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
81
|
+
export type Schema = ExtractSchema<Root>;
|
|
82
|
+
export type DistantState = z.infer<Schema>;
|
|
83
|
+
export default root;
|
|
84
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/walletsync/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAc/E;;;;GAIG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AAEvC,KAAK,IAAI,GAAG,OAAO,IAAI,CAAC;AACxB,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AACzC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3C,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const aggregator_1 = require("./aggregator");
|
|
7
|
+
// Maintain here the list of modules to aggregate for WalletSync data
|
|
8
|
+
// New modules can be added over time, it's also possible to remove modules but don't replace modules because the schema of a field must not change.
|
|
9
|
+
const accounts_1 = __importDefault(require("./modules/accounts"));
|
|
10
|
+
const accountNames_1 = __importDefault(require("./modules/accountNames"));
|
|
11
|
+
const modules = {
|
|
12
|
+
accounts: accounts_1.default,
|
|
13
|
+
accountNames: accountNames_1.default,
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
17
|
+
* for all the different fields and delegate/dispatch/aggregate the data
|
|
18
|
+
* to each module.
|
|
19
|
+
*/
|
|
20
|
+
const root = (0, aggregator_1.createAggregator)(modules);
|
|
21
|
+
exports.default = root;
|
|
22
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/walletsync/root.ts"],"names":[],"mappings":";;;;;AAEA,6CAAgD;AAEhD,qEAAqE;AACrE,oJAAoJ;AAEpJ,kEAA0C;AAC1C,0EAAkD;AAElD,MAAM,OAAO,GAAG;IACd,QAAQ,EAAR,kBAAQ;IACR,YAAY,EAAZ,sBAAY;CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,IAAI,GAAG,IAAA,6BAAgB,EAAC,OAAO,CAAC,CAAC;AAQvC,kBAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trustchainLifecyle.d.ts","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"trustchainLifecyle.d.ts","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,eAAO,MAAM,QAAQ,SAAS,CAAC;AAE/B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,OAAO,CAAC;CAClC,GAAG,mBAAmB,CA4BtB"}
|
|
@@ -12,10 +12,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.trustchainLifecycle = void 0;
|
|
15
|
+
exports.trustchainLifecycle = exports.liveSlug = void 0;
|
|
16
16
|
const api_1 = __importDefault(require("../cloudsync/api"));
|
|
17
|
-
const _1 = require(".");
|
|
18
17
|
const cipher_1 = require("../cloudsync/cipher");
|
|
18
|
+
exports.liveSlug = "live";
|
|
19
19
|
/**
|
|
20
20
|
* implements to provide to TrustchainSdk the glue with cloudsync/walletsync
|
|
21
21
|
*/
|
|
@@ -26,7 +26,7 @@ function trustchainLifecycle({ cloudSyncApiBaseUrl, getCurrentWSState, }) {
|
|
|
26
26
|
return (newTrustchain) => __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const api = (0, api_1.default)(cloudSyncApiBaseUrl);
|
|
28
28
|
// when trustchain rotates, we need to delete old data to inform members still on the old id
|
|
29
|
-
yield api.deleteData(oldJwt,
|
|
29
|
+
yield api.deleteData(oldJwt, exports.liveSlug, oldTrustchain);
|
|
30
30
|
const newJwt = yield trustchainSdk.withAuth(newTrustchain, memberCredentials, jwt => Promise.resolve(jwt), "refresh");
|
|
31
31
|
// we then need to push back data to a new CloudSync id with the new encryption key
|
|
32
32
|
const { version, data } = getCurrentWSState();
|
|
@@ -34,7 +34,7 @@ function trustchainLifecycle({ cloudSyncApiBaseUrl, getCurrentWSState, }) {
|
|
|
34
34
|
return;
|
|
35
35
|
const cipher = (0, cipher_1.makeCipher)(trustchainSdk);
|
|
36
36
|
const payload = yield cipher.encrypt(newTrustchain, data);
|
|
37
|
-
yield api.uploadData(newJwt,
|
|
37
|
+
yield api.uploadData(newJwt, exports.liveSlug, version, payload, newTrustchain);
|
|
38
38
|
});
|
|
39
39
|
}),
|
|
40
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trustchainLifecyle.js","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2DAA+C;
|
|
1
|
+
{"version":3,"file":"trustchainLifecyle.js","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,2DAA+C;AAE/C,gDAAiD;AAEpC,QAAA,QAAQ,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,EAClC,mBAAmB,EACnB,iBAAiB,GAIlB;IACC,OAAO;QACL,oBAAoB,EAAE,CAAO,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAAE,EAAE;YAC9E,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CACzC,aAAa,EACb,iBAAiB,EACjB,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAC3B,SAAS,CACV,CAAC;YACF,OAAO,CAAM,aAAa,EAAC,EAAE;gBAC3B,MAAM,GAAG,GAAG,IAAA,aAAe,EAAC,mBAAmB,CAAC,CAAC;gBACjD,4FAA4F;gBAC5F,MAAM,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,gBAAQ,EAAE,aAAa,CAAC,CAAC;gBACtD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,QAAQ,CACzC,aAAa,EACb,iBAAiB,EACjB,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAC3B,SAAS,CACV,CAAC;gBACF,mFAAmF;gBACnF,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,iBAAiB,EAAE,CAAC;gBAC9C,IAAI,CAAC,IAAI;oBAAE,OAAO;gBAClB,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,aAAa,CAAC,CAAC;gBACzC,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAC1D,MAAM,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,gBAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;YAC1E,CAAC,CAAA,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;AACJ,CAAC;AAlCD,kDAkCC"}
|
package/lib-es/store.d.ts
CHANGED
|
@@ -104,10 +104,10 @@ export declare const walletSyncUpdate: (data: DistantState | null, version: numb
|
|
|
104
104
|
accounts?: {
|
|
105
105
|
index: number;
|
|
106
106
|
id: string;
|
|
107
|
-
currencyId: string;
|
|
108
|
-
freshAddress: string;
|
|
109
107
|
seedIdentifier: string;
|
|
110
108
|
derivationMode: string;
|
|
109
|
+
freshAddress: string;
|
|
110
|
+
currencyId: string;
|
|
111
111
|
}[] | undefined;
|
|
112
112
|
accountNames?: Record<string, string> | undefined;
|
|
113
113
|
} | null;
|
|
@@ -5,7 +5,7 @@ import { ExtractLocalState, ExtractUpdateEvent, UpdateDiff, WalletSyncDataManage
|
|
|
5
5
|
* In this root WalletSyncDataManager, the data is segmented into JS Object fields (one field = one module)
|
|
6
6
|
* and under modules/ folder: each module implements a WalletSyncDataManager at the field level of the main data.
|
|
7
7
|
*/
|
|
8
|
-
export declare function createAggregator<Mods extends Record<string, WalletSyncDataManager<any, any, any>>>(modules: Mods): WalletSyncDataManager<{ [K in keyof Mods]: ExtractLocalState<Mods[K]>; }, { [K_1 in keyof Mods]: UpdateDiff<ExtractUpdateEvent<Mods[K_1]>>; }, z.ZodObject<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }, "strip", z.ZodTypeAny, { [
|
|
8
|
+
export declare function createAggregator<Mods extends Record<string, WalletSyncDataManager<any, any, any>>>(modules: Mods): WalletSyncDataManager<{ [K in keyof Mods]: ExtractLocalState<Mods[K]>; }, { [K_1 in keyof Mods]: UpdateDiff<ExtractUpdateEvent<Mods[K_1]>>; }, z.ZodObject<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }, "strip", z.ZodTypeAny, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>[k]; }, { [k_1 in keyof z.baseObjectInputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>]: z.baseObjectInputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>[k_1]; }>, { [k in keyof z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>]: z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{ [K_2 in keyof Mods]: ZodOptional<Mods[K_2]["schema"]>; }>, any>[k]; }>;
|
|
9
9
|
export declare function mapValues<T extends object, U extends {
|
|
10
10
|
[K in keyof T]: unknown;
|
|
11
11
|
}>(obj: T, fn: <K extends keyof T>(value: T[K], key: K) => any): U;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/walletsync/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAChG,OAAO,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"aggregator.d.ts","sourceRoot":"","sources":["../../src/walletsync/aggregator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEnG;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,EAChG,OAAO,EAAE,IAAI,27BAgFd;AAED,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,OAAO;CAAE,EAC/E,GAAG,EAAE,CAAC,EACN,EAAE,EAAE,CAAC,CAAC,SAAS,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,GAClD,CAAC,CAMH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalUpdates.d.ts","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"incrementalUpdates.d.ts","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":"AACA,OAAmB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,sCAAsC,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,EACnC,GAAG,EACH,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,UAAU,GACX,EAAE;IACD,GAAG,EAAE,sCAAsC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,0BAA0B,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,YAAY,GAAG,IAAI,CAAC;IAC9D,4BAA4B,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,CAAC;IACnD,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC;IAC7C,UAAU,EAAE,CACV,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,UAAU,GAAG,IAAI,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,GAAG,CAAC,KAAK,EAAE,WAAW,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAqCtD;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,EAC5C,GAAG,EACH,QAAQ,EACR,yBAAyB,EACzB,kBAAkB,EAClB,UAAU,GACX,EAAE;IACD,GAAG,EAAE,sCAAsC,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,CAAC;IAClB,yBAAyB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACjD,kBAAkB,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,CAAC;IAC7C,UAAU,EAAE,CACV,IAAI,EAAE,YAAY,GAAG,IAAI,EACzB,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,UAAU,GAAG,IAAI,KAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAetB"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { log } from "@ledgerhq/logs";
|
|
11
|
-
import walletsync from "
|
|
11
|
+
import walletsync from "./root";
|
|
12
12
|
export function makeSaveNewUpdate({ ctx, getState, latestDistantStateSelector, latestDistantVersionSelector, localStateSelector, saveUpdate, }) {
|
|
13
13
|
return (event) => __awaiter(this, void 0, void 0, function* () {
|
|
14
14
|
log("walletsync", "saveNewUpdate", { event });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"incrementalUpdates.js","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,UAAwC,MAAM,
|
|
1
|
+
{"version":3,"file":"incrementalUpdates.js","sourceRoot":"","sources":["../../src/walletsync/incrementalUpdates.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,UAAwC,MAAM,QAAQ,CAAC;AAK9D,MAAM,UAAU,iBAAiB,CAAI,EACnC,GAAG,EACH,QAAQ,EACR,0BAA0B,EAC1B,4BAA4B,EAC5B,kBAAkB,EAClB,UAAU,GAYX;IACC,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LocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
-
import { createWalletSyncWatchLoop, VisualConfig, WatchConfig } from "./createWalletSyncWatchLoop";
|
|
4
|
-
export { createWalletSyncWatchLoop };
|
|
5
|
-
export type { VisualConfig, WatchConfig };
|
|
6
|
-
export { trustchainLifecycle } from "./trustchainLifecyle";
|
|
7
|
-
export * from "./incrementalUpdates";
|
|
1
|
+
import { VisualConfig, WatchConfig } from "./createWalletSyncWatchLoop";
|
|
8
2
|
import { CloudSyncSDK } from "../cloudsync";
|
|
9
3
|
import { MemberCredentials, Trustchain } from "@ledgerhq/ledger-key-ring-protocol/types";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
accounts: {
|
|
17
|
-
list: import("@ledgerhq/types-live").Account[];
|
|
18
|
-
/**
|
|
19
|
-
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
20
|
-
* for all the different fields and delegate/dispatch/aggregate the data
|
|
21
|
-
* to each module.
|
|
22
|
-
*/
|
|
23
|
-
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
24
|
-
};
|
|
25
|
-
accountNames: Map<string, string>;
|
|
26
|
-
}, {
|
|
27
|
-
accounts: import("./types").UpdateDiff<{
|
|
28
|
-
removed: string[];
|
|
29
|
-
added: import("@ledgerhq/types-live").Account[];
|
|
30
|
-
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
31
|
-
}>;
|
|
32
|
-
accountNames: import("./types").UpdateDiff<{
|
|
33
|
-
replaceAllNames: Record<string, string>;
|
|
34
|
-
}>;
|
|
35
|
-
}, z.ZodObject<{
|
|
36
|
-
accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
37
|
-
id: z.ZodString;
|
|
38
|
-
currencyId: z.ZodString;
|
|
39
|
-
freshAddress: z.ZodString;
|
|
40
|
-
seedIdentifier: z.ZodString;
|
|
41
|
-
derivationMode: z.ZodString;
|
|
42
|
-
index: z.ZodNumber;
|
|
43
|
-
}, "strip", z.ZodTypeAny, {
|
|
44
|
-
index: number;
|
|
45
|
-
id: string;
|
|
46
|
-
currencyId: string;
|
|
47
|
-
freshAddress: string;
|
|
48
|
-
seedIdentifier: string;
|
|
49
|
-
derivationMode: string;
|
|
50
|
-
}, {
|
|
51
|
-
index: number;
|
|
52
|
-
id: string;
|
|
53
|
-
currencyId: string;
|
|
54
|
-
freshAddress: string;
|
|
55
|
-
seedIdentifier: string;
|
|
56
|
-
derivationMode: string;
|
|
57
|
-
}>, "many">>;
|
|
58
|
-
accountNames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
59
|
-
}, "strip", z.ZodTypeAny, {
|
|
60
|
-
accounts?: {
|
|
61
|
-
index: number;
|
|
62
|
-
id: string;
|
|
63
|
-
currencyId: string;
|
|
64
|
-
freshAddress: string;
|
|
65
|
-
seedIdentifier: string;
|
|
66
|
-
derivationMode: string;
|
|
67
|
-
}[] | undefined;
|
|
68
|
-
accountNames?: Record<string, string> | undefined;
|
|
69
|
-
}, {
|
|
70
|
-
accounts?: {
|
|
71
|
-
index: number;
|
|
72
|
-
id: string;
|
|
73
|
-
currencyId: string;
|
|
74
|
-
freshAddress: string;
|
|
75
|
-
seedIdentifier: string;
|
|
76
|
-
derivationMode: string;
|
|
77
|
-
}[] | undefined;
|
|
78
|
-
accountNames?: Record<string, string> | undefined;
|
|
79
|
-
}>, {
|
|
80
|
-
accounts?: {
|
|
81
|
-
index: number;
|
|
82
|
-
id: string;
|
|
83
|
-
currencyId: string;
|
|
84
|
-
freshAddress: string;
|
|
85
|
-
seedIdentifier: string;
|
|
86
|
-
derivationMode: string;
|
|
87
|
-
}[] | undefined;
|
|
88
|
-
accountNames?: Record<string, string> | undefined;
|
|
89
|
-
}>;
|
|
90
|
-
type Root = typeof root;
|
|
91
|
-
export type LocalState = ExtractLocalState<Root>;
|
|
92
|
-
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
93
|
-
export type Schema = ExtractSchema<Root>;
|
|
94
|
-
export type DistantState = z.infer<Schema>;
|
|
95
|
-
export default root;
|
|
96
|
-
export declare const liveSlug = "live";
|
|
4
|
+
import { DistantState, LocalState, Schema } from "./root";
|
|
5
|
+
export { createWalletSyncWatchLoop, type VisualConfig, type WatchConfig, } from "./createWalletSyncWatchLoop";
|
|
6
|
+
export * from "./trustchainLifecyle";
|
|
7
|
+
export * from "./incrementalUpdates";
|
|
8
|
+
export * from "./root";
|
|
9
|
+
export { default } from "./root";
|
|
97
10
|
/**
|
|
98
11
|
* specialized version of createWalletSyncWatchLoop for the root WalletSyncDataManager.
|
|
99
12
|
* UserState is the global state of the application that you have. (LLD/LLM/webtools all have different states)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,YAAY,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhE,OAAO,EACL,yBAAyB,EACzB,KAAK,YAAY,EACjB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,EAC7C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,GACrB,EAAE;IACD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACpC,UAAU,EAAE,UAAU,CAAC;IACvB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,gBAAgB,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,yBAAyB,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,SAAS,CAAC;IAC1B,kBAAkB,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,UAAU,CAAC;IACrD,0BAA0B,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,YAAY,GAAG,IAAI,CAAC;IACtE,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;;;EAkBA"}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import { createAggregator } from "./aggregator";
|
|
2
1
|
import { createWalletSyncWatchLoop } from "./createWalletSyncWatchLoop";
|
|
3
|
-
|
|
4
|
-
export {
|
|
2
|
+
import root from "./root";
|
|
3
|
+
export { createWalletSyncWatchLoop, } from "./createWalletSyncWatchLoop";
|
|
4
|
+
export * from "./trustchainLifecyle";
|
|
5
5
|
export * from "./incrementalUpdates";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import accounts from "./modules/accounts";
|
|
9
|
-
import accountNames from "./modules/accountNames";
|
|
10
|
-
const modules = {
|
|
11
|
-
accounts,
|
|
12
|
-
accountNames,
|
|
13
|
-
};
|
|
14
|
-
////////////////////////////////////////////////////////////////////////
|
|
15
|
-
/**
|
|
16
|
-
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
17
|
-
* for all the different fields and delegate/dispatch/aggregate the data
|
|
18
|
-
* to each module.
|
|
19
|
-
*/
|
|
20
|
-
const root = createAggregator(modules);
|
|
21
|
-
export default root;
|
|
22
|
-
export const liveSlug = "live";
|
|
6
|
+
export * from "./root";
|
|
7
|
+
export { default } from "./root";
|
|
23
8
|
/**
|
|
24
9
|
* specialized version of createWalletSyncWatchLoop for the root WalletSyncDataManager.
|
|
25
10
|
* UserState is the global state of the application that you have. (LLD/LLM/webtools all have different states)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/walletsync/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAA6B,MAAM,6BAA6B,CAAC;AAGnG,OAAO,IAA0C,MAAM,QAAQ,CAAC;AAEhE,OAAO,EACL,yBAAyB,GAG1B,MAAM,6BAA6B,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAEjC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAY,EAC7C,WAAW,EACX,YAAY,EACZ,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,OAAO,EACP,cAAc,EACd,QAAQ,EACR,kBAAkB,EAClB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,GAerB;IACC,MAAM,UAAU,GAAG,IAAI,CAAC;IACxB,OAAO,yBAAyB,CAAC;QAC/B,WAAW;QACX,YAAY;QACZ,UAAU;QACV,aAAa;QACb,UAAU;QACV,iBAAiB;QACjB,gBAAgB;QAChB,OAAO;QACP,cAAc;QACd,QAAQ;QACR,kBAAkB;QAClB,0BAA0B;QAC1B,yBAAyB;QACzB,oBAAoB;KACrB,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -11,17 +11,17 @@ declare const accountDescriptorSchema: z.ZodObject<{
|
|
|
11
11
|
}, "strip", z.ZodTypeAny, {
|
|
12
12
|
index: number;
|
|
13
13
|
id: string;
|
|
14
|
-
currencyId: string;
|
|
15
|
-
freshAddress: string;
|
|
16
14
|
seedIdentifier: string;
|
|
17
15
|
derivationMode: string;
|
|
16
|
+
freshAddress: string;
|
|
17
|
+
currencyId: string;
|
|
18
18
|
}, {
|
|
19
19
|
index: number;
|
|
20
20
|
id: string;
|
|
21
|
-
currencyId: string;
|
|
22
|
-
freshAddress: string;
|
|
23
21
|
seedIdentifier: string;
|
|
24
22
|
derivationMode: string;
|
|
23
|
+
freshAddress: string;
|
|
24
|
+
currencyId: string;
|
|
25
25
|
}>;
|
|
26
26
|
type AccountDescriptor = z.infer<typeof accountDescriptorSchema>;
|
|
27
27
|
declare const schema: z.ZodArray<z.ZodObject<{
|
|
@@ -34,17 +34,17 @@ declare const schema: z.ZodArray<z.ZodObject<{
|
|
|
34
34
|
}, "strip", z.ZodTypeAny, {
|
|
35
35
|
index: number;
|
|
36
36
|
id: string;
|
|
37
|
-
currencyId: string;
|
|
38
|
-
freshAddress: string;
|
|
39
37
|
seedIdentifier: string;
|
|
40
38
|
derivationMode: string;
|
|
39
|
+
freshAddress: string;
|
|
40
|
+
currencyId: string;
|
|
41
41
|
}, {
|
|
42
42
|
index: number;
|
|
43
43
|
id: string;
|
|
44
|
-
currencyId: string;
|
|
45
|
-
freshAddress: string;
|
|
46
44
|
seedIdentifier: string;
|
|
47
45
|
derivationMode: string;
|
|
46
|
+
freshAddress: string;
|
|
47
|
+
currencyId: string;
|
|
48
48
|
}>, "many">;
|
|
49
49
|
export type NonImportedAccountInfo = {
|
|
50
50
|
id: string;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ExtractLocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
5
|
+
* for all the different fields and delegate/dispatch/aggregate the data
|
|
6
|
+
* to each module.
|
|
7
|
+
*/
|
|
8
|
+
declare const root: import("./types").WalletSyncDataManager<{
|
|
9
|
+
accounts: {
|
|
10
|
+
list: import("@ledgerhq/types-live").Account[];
|
|
11
|
+
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
12
|
+
};
|
|
13
|
+
accountNames: Map<string, string>;
|
|
14
|
+
}, {
|
|
15
|
+
accounts: import("./types").UpdateDiff<{
|
|
16
|
+
removed: string[];
|
|
17
|
+
added: import("@ledgerhq/types-live").Account[];
|
|
18
|
+
nonImportedAccountInfos: import("./modules/accounts").NonImportedAccountInfo[];
|
|
19
|
+
}>;
|
|
20
|
+
accountNames: import("./types").UpdateDiff<{
|
|
21
|
+
replaceAllNames: Record<string, string>;
|
|
22
|
+
}>;
|
|
23
|
+
}, z.ZodObject<{
|
|
24
|
+
accounts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
currencyId: z.ZodString;
|
|
27
|
+
freshAddress: z.ZodString;
|
|
28
|
+
seedIdentifier: z.ZodString;
|
|
29
|
+
derivationMode: z.ZodString;
|
|
30
|
+
index: z.ZodNumber;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
index: number;
|
|
33
|
+
id: string;
|
|
34
|
+
seedIdentifier: string;
|
|
35
|
+
derivationMode: string;
|
|
36
|
+
freshAddress: string;
|
|
37
|
+
currencyId: string;
|
|
38
|
+
}, {
|
|
39
|
+
index: number;
|
|
40
|
+
id: string;
|
|
41
|
+
seedIdentifier: string;
|
|
42
|
+
derivationMode: string;
|
|
43
|
+
freshAddress: string;
|
|
44
|
+
currencyId: string;
|
|
45
|
+
}>, "many">>;
|
|
46
|
+
accountNames: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
47
|
+
}, "strip", z.ZodTypeAny, {
|
|
48
|
+
accounts?: {
|
|
49
|
+
index: number;
|
|
50
|
+
id: string;
|
|
51
|
+
seedIdentifier: string;
|
|
52
|
+
derivationMode: string;
|
|
53
|
+
freshAddress: string;
|
|
54
|
+
currencyId: string;
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
accountNames?: Record<string, string> | undefined;
|
|
57
|
+
}, {
|
|
58
|
+
accounts?: {
|
|
59
|
+
index: number;
|
|
60
|
+
id: string;
|
|
61
|
+
seedIdentifier: string;
|
|
62
|
+
derivationMode: string;
|
|
63
|
+
freshAddress: string;
|
|
64
|
+
currencyId: string;
|
|
65
|
+
}[] | undefined;
|
|
66
|
+
accountNames?: Record<string, string> | undefined;
|
|
67
|
+
}>, {
|
|
68
|
+
accounts?: {
|
|
69
|
+
index: number;
|
|
70
|
+
id: string;
|
|
71
|
+
seedIdentifier: string;
|
|
72
|
+
derivationMode: string;
|
|
73
|
+
freshAddress: string;
|
|
74
|
+
currencyId: string;
|
|
75
|
+
}[] | undefined;
|
|
76
|
+
accountNames?: Record<string, string> | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
type Root = typeof root;
|
|
79
|
+
export type LocalState = ExtractLocalState<Root>;
|
|
80
|
+
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
81
|
+
export type Schema = ExtractSchema<Root>;
|
|
82
|
+
export type DistantState = z.infer<Schema>;
|
|
83
|
+
export default root;
|
|
84
|
+
//# sourceMappingURL=root.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.d.ts","sourceRoot":"","sources":["../../src/walletsync/root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAc/E;;;;GAIG;AACH,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAC;AAEvC,KAAK,IAAI,GAAG,OAAO,IAAI,CAAC;AACxB,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjD,MAAM,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAC,CAAC;AACnD,MAAM,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;AACzC,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3C,eAAe,IAAI,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createAggregator } from "./aggregator";
|
|
2
|
+
// Maintain here the list of modules to aggregate for WalletSync data
|
|
3
|
+
// New modules can be added over time, it's also possible to remove modules but don't replace modules because the schema of a field must not change.
|
|
4
|
+
import accounts from "./modules/accounts";
|
|
5
|
+
import accountNames from "./modules/accountNames";
|
|
6
|
+
const modules = {
|
|
7
|
+
accounts,
|
|
8
|
+
accountNames,
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
12
|
+
* for all the different fields and delegate/dispatch/aggregate the data
|
|
13
|
+
* to each module.
|
|
14
|
+
*/
|
|
15
|
+
const root = createAggregator(modules);
|
|
16
|
+
export default root;
|
|
17
|
+
//# sourceMappingURL=root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"root.js","sourceRoot":"","sources":["../../src/walletsync/root.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEhD,qEAAqE;AACrE,oJAAoJ;AAEpJ,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD,MAAM,OAAO,GAAG;IACd,QAAQ;IACR,YAAY;CACb,CAAC;AAEF;;;;GAIG;AACH,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;AAQvC,eAAe,IAAI,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trustchainLifecyle.d.ts","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"trustchainLifecyle.d.ts","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGnC,eAAO,MAAM,QAAQ,SAAS,CAAC;AAE/B;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,mBAAmB,EACnB,iBAAiB,GAClB,EAAE;IACD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,iBAAiB,EAAE,MAAM,OAAO,CAAC;CAClC,GAAG,mBAAmB,CA4BtB"}
|
|
@@ -8,8 +8,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import getCloudSyncApi from "../cloudsync/api";
|
|
11
|
-
import { liveSlug } from ".";
|
|
12
11
|
import { makeCipher } from "../cloudsync/cipher";
|
|
12
|
+
export const liveSlug = "live";
|
|
13
13
|
/**
|
|
14
14
|
* implements to provide to TrustchainSdk the glue with cloudsync/walletsync
|
|
15
15
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trustchainLifecyle.js","sourceRoot":"","sources":["../../src/walletsync/trustchainLifecyle.ts"],"names":[],"mappings":";;;;;;;;;A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gBAC1D,MAAM,GAAG,CAAC,UAAU,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;YAC1E,CAAC,CAAA,CAAC;QACJ,CAAC,CAAA;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-wallet",
|
|
3
|
-
"version": "0.7.4
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "Ledger Live wallet",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger"
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"pako": "^2.0.4",
|
|
30
30
|
"rxjs": "7",
|
|
31
31
|
"zod": "^3.22.4",
|
|
32
|
-
"@ledgerhq/coin-framework": "0.19.0
|
|
33
|
-
"@ledgerhq/cryptoassets": "13.7.0
|
|
32
|
+
"@ledgerhq/coin-framework": "0.19.0",
|
|
33
|
+
"@ledgerhq/cryptoassets": "13.7.0",
|
|
34
34
|
"@ledgerhq/devices": "8.4.4",
|
|
35
|
-
"@ledgerhq/live-env": "2.4.1
|
|
36
|
-
"@ledgerhq/live-network": "2.0.3
|
|
35
|
+
"@ledgerhq/live-env": "2.4.1",
|
|
36
|
+
"@ledgerhq/live-network": "2.0.3",
|
|
37
37
|
"@ledgerhq/live-promise": "0.1.0",
|
|
38
38
|
"@ledgerhq/logs": "6.12.0",
|
|
39
|
-
"@ledgerhq/ledger-key-ring-protocol": "0.5.1
|
|
40
|
-
"@ledgerhq/types-cryptoassets": "7.
|
|
41
|
-
"@ledgerhq/types-live": "6.53.0
|
|
39
|
+
"@ledgerhq/ledger-key-ring-protocol": "0.5.1",
|
|
40
|
+
"@ledgerhq/types-cryptoassets": "7.17.0",
|
|
41
|
+
"@ledgerhq/types-live": "6.53.0"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/jest": "^29.5.10",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
|
|
92
92
|
"lint:fix": "pnpm lint --fix",
|
|
93
93
|
"typecheck": "tsc --noEmit",
|
|
94
|
-
"unimported": "
|
|
94
|
+
"unimported": "pnpm knip --directory ../.. -W libs/live-wallet",
|
|
95
95
|
"test": "jest"
|
|
96
96
|
}
|
|
97
97
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { log } from "@ledgerhq/logs";
|
|
2
|
-
import walletsync, { DistantState, LocalState } from "
|
|
2
|
+
import walletsync, { DistantState, LocalState } from "./root";
|
|
3
3
|
import { UpdateEvent } from "../cloudsync/sdk";
|
|
4
4
|
import { WalletSyncDataManagerResolutionContext } from "./types";
|
|
5
5
|
import { WSState } from "../store";
|
package/src/walletsync/index.ts
CHANGED
|
@@ -1,43 +1,17 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { ExtractLocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
-
import { createAggregator } from "./aggregator";
|
|
4
1
|
import { createWalletSyncWatchLoop, VisualConfig, WatchConfig } from "./createWalletSyncWatchLoop";
|
|
5
|
-
export { createWalletSyncWatchLoop };
|
|
6
|
-
export type { VisualConfig, WatchConfig };
|
|
7
|
-
export { trustchainLifecycle } from "./trustchainLifecyle";
|
|
8
|
-
export * from "./incrementalUpdates";
|
|
9
|
-
|
|
10
|
-
// Maintain here the list of modules to aggregate for WalletSync data
|
|
11
|
-
// New modules can be added over time, it's also possible to remove modules but don't replace modules because the schema of a field must not change.
|
|
12
|
-
|
|
13
|
-
import accounts from "./modules/accounts";
|
|
14
|
-
import accountNames from "./modules/accountNames";
|
|
15
2
|
import { CloudSyncSDK } from "../cloudsync";
|
|
16
3
|
import { MemberCredentials, Trustchain } from "@ledgerhq/ledger-key-ring-protocol/types";
|
|
4
|
+
import root, { DistantState, LocalState, Schema } from "./root";
|
|
17
5
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* for all the different fields and delegate/dispatch/aggregate the data
|
|
28
|
-
* to each module.
|
|
29
|
-
*/
|
|
30
|
-
const root = createAggregator(modules);
|
|
31
|
-
|
|
32
|
-
type Root = typeof root;
|
|
33
|
-
export type LocalState = ExtractLocalState<Root>;
|
|
34
|
-
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
35
|
-
export type Schema = ExtractSchema<Root>;
|
|
36
|
-
export type DistantState = z.infer<Schema>;
|
|
37
|
-
|
|
38
|
-
export default root;
|
|
39
|
-
|
|
40
|
-
export const liveSlug = "live";
|
|
6
|
+
export {
|
|
7
|
+
createWalletSyncWatchLoop,
|
|
8
|
+
type VisualConfig,
|
|
9
|
+
type WatchConfig,
|
|
10
|
+
} from "./createWalletSyncWatchLoop";
|
|
11
|
+
export * from "./trustchainLifecyle";
|
|
12
|
+
export * from "./incrementalUpdates";
|
|
13
|
+
export * from "./root";
|
|
14
|
+
export { default } from "./root";
|
|
41
15
|
|
|
42
16
|
/**
|
|
43
17
|
* specialized version of createWalletSyncWatchLoop for the root WalletSyncDataManager.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ExtractLocalState, ExtractSchema, ExtractUpdateEvent } from "./types";
|
|
3
|
+
import { createAggregator } from "./aggregator";
|
|
4
|
+
|
|
5
|
+
// Maintain here the list of modules to aggregate for WalletSync data
|
|
6
|
+
// New modules can be added over time, it's also possible to remove modules but don't replace modules because the schema of a field must not change.
|
|
7
|
+
|
|
8
|
+
import accounts from "./modules/accounts";
|
|
9
|
+
import accountNames from "./modules/accountNames";
|
|
10
|
+
|
|
11
|
+
const modules = {
|
|
12
|
+
accounts,
|
|
13
|
+
accountNames,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* This is the root WalletSyncDataManager that manage the data as a whole
|
|
18
|
+
* for all the different fields and delegate/dispatch/aggregate the data
|
|
19
|
+
* to each module.
|
|
20
|
+
*/
|
|
21
|
+
const root = createAggregator(modules);
|
|
22
|
+
|
|
23
|
+
type Root = typeof root;
|
|
24
|
+
export type LocalState = ExtractLocalState<Root>;
|
|
25
|
+
export type UpdateEvent = ExtractUpdateEvent<Root>;
|
|
26
|
+
export type Schema = ExtractSchema<Root>;
|
|
27
|
+
export type DistantState = z.infer<Schema>;
|
|
28
|
+
|
|
29
|
+
export default root;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { TrustchainLifecycle } from "@ledgerhq/ledger-key-ring-protocol/types";
|
|
2
2
|
import getCloudSyncApi from "../cloudsync/api";
|
|
3
|
-
import { liveSlug } from ".";
|
|
4
3
|
import { WSState } from "../store";
|
|
5
4
|
import { makeCipher } from "../cloudsync/cipher";
|
|
6
5
|
|
|
6
|
+
export const liveSlug = "live";
|
|
7
|
+
|
|
7
8
|
/**
|
|
8
9
|
* implements to provide to TrustchainSdk the glue with cloudsync/walletsync
|
|
9
10
|
*/
|
package/.unimportedrc.json
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entry": [
|
|
3
|
-
"src/walletsync/index.ts",
|
|
4
|
-
"src/cloudsync/index.ts",
|
|
5
|
-
"src/liveqr/cross.ts",
|
|
6
|
-
"src/liveqr/importAccounts.ts",
|
|
7
|
-
"src/ordering.ts",
|
|
8
|
-
"src/addAccounts.ts",
|
|
9
|
-
"src/store.ts",
|
|
10
|
-
"src/accountName.ts"
|
|
11
|
-
],
|
|
12
|
-
"ignoreUnresolved": ["bufferutil", "utf-8-validate"],
|
|
13
|
-
"ignorePatterns": [
|
|
14
|
-
"**/node_modules/**",
|
|
15
|
-
"**/__tests__/**",
|
|
16
|
-
"**/*.test.ts",
|
|
17
|
-
"walletsync/__mocks__/**"
|
|
18
|
-
]
|
|
19
|
-
}
|