edge-core-js 2.44.0 → 2.46.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/CHANGELOG.md +12 -1
- package/README.md +4 -4
- package/android/src/main/assets/edge-core-js/edge-core.js +1 -1
- package/android/src/main/assets/edge-core-js/fbcba1e9b05cb4dd9870.js +2 -0
- package/android/src/main/assets/edge-core-js/web-worker-0.js +1 -1
- package/lib/core/account/account-api.js +35 -1
- package/lib/core/account/memory-wallet.js +2 -1
- package/lib/core/actions.js +15 -0
- package/lib/core/currency/wallet/currency-wallet-api.js +16 -0
- package/lib/core/currency/wallet/currency-wallet-cleaners.js +4 -0
- package/lib/core/currency/wallet/currency-wallet-files.js +57 -3
- package/lib/core/currency/wallet/currency-wallet-pixie.js +36 -6
- package/lib/core/currency/wallet/currency-wallet-reducer.js +14 -0
- package/lib/core/login/splitting.js +5 -9
- package/lib/node/index.js +3934 -3805
- package/lib/types/types.js +9 -0
- package/package.json +6 -11
- package/src/types/types.ts +9 -0
- package/types.js +90 -90
- package/android/src/main/assets/edge-core-js/27cab3e7ba7549594ad5.js +0 -2
- package/lib/flow/error.js +0 -448
- package/lib/flow/exports.js +0 -140
- package/lib/flow/fake-types.js +0 -187
- package/lib/flow/server-cleaners.js +0 -444
- package/lib/flow/server-types.js +0 -342
- package/lib/flow/type-helpers.js +0 -60
- package/lib/flow/types.js +0 -2250
- package/lib/node/index.js.flow +0 -4
- package/types.js.flow +0 -4
- /package/android/src/main/assets/edge-core-js/{27cab3e7ba7549594ad5.js.LICENSE.txt → fbcba1e9b05cb4dd9870.js.LICENSE.txt} +0 -0
|
@@ -16,6 +16,7 @@ import { update } from 'yaob'
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
|
|
19
20
|
import { makeJsonFile } from '../../../util/file-helpers'
|
|
20
21
|
import { makePeriodicTask, } from '../../../util/periodic-task'
|
|
21
22
|
import { snooze } from '../../../util/snooze'
|
|
@@ -45,9 +46,14 @@ import {
|
|
|
45
46
|
loadSeenTxCheckpointFile,
|
|
46
47
|
loadTokensFile,
|
|
47
48
|
loadTxFileNames,
|
|
49
|
+
loadWalletSettingsFile,
|
|
48
50
|
writeTokensFile
|
|
49
51
|
} from './currency-wallet-files'
|
|
50
|
-
import {
|
|
52
|
+
import {
|
|
53
|
+
|
|
54
|
+
initialTokenIds,
|
|
55
|
+
initialWalletSettings
|
|
56
|
+
} from './currency-wallet-reducer'
|
|
51
57
|
import { tokenIdsToCurrencyCodes, uniqueStrings } from './enabled-tokens'
|
|
52
58
|
|
|
53
59
|
|
|
@@ -118,6 +124,11 @@ export const walletPixie = combinePixies({
|
|
|
118
124
|
// so the engine can start in the right state:
|
|
119
125
|
await loadTokensFile(input)
|
|
120
126
|
|
|
127
|
+
const { hasWalletSettings = false } = walletState.currencyInfo
|
|
128
|
+
if (hasWalletSettings) {
|
|
129
|
+
await loadWalletSettingsFile(input)
|
|
130
|
+
}
|
|
131
|
+
|
|
121
132
|
// Start the engine:
|
|
122
133
|
const accountState = state.accounts[accountId]
|
|
123
134
|
const engine = await plugin.makeCurrencyEngine(publicWalletInfo, {
|
|
@@ -138,7 +149,8 @@ export const walletPixie = combinePixies({
|
|
|
138
149
|
// User settings:
|
|
139
150
|
customTokens: _nullishCoalesce(accountState.customTokens[pluginId], () => ( {})),
|
|
140
151
|
enabledTokenIds: input.props.walletState.allEnabledTokenIds,
|
|
141
|
-
userSettings: _nullishCoalesce(accountState.userSettings[pluginId], () => ( {}))
|
|
152
|
+
userSettings: _nullishCoalesce(accountState.userSettings[pluginId], () => ( {})),
|
|
153
|
+
walletSettings: input.props.walletState.walletSettings
|
|
142
154
|
})
|
|
143
155
|
input.onOutput(engine)
|
|
144
156
|
|
|
@@ -462,7 +474,8 @@ export const walletPixie = combinePixies({
|
|
|
462
474
|
|
|
463
475
|
watcher(input) {
|
|
464
476
|
let lastState
|
|
465
|
-
let
|
|
477
|
+
let lastUserSettings = {}
|
|
478
|
+
let lastWalletSettings = initialWalletSettings
|
|
466
479
|
let lastTokens = {}
|
|
467
480
|
let lastEnabledTokenIds = initialTokenIds
|
|
468
481
|
|
|
@@ -480,11 +493,12 @@ export const walletPixie = combinePixies({
|
|
|
480
493
|
lastState = walletState
|
|
481
494
|
|
|
482
495
|
// Update engine settings:
|
|
483
|
-
const userSettings =
|
|
484
|
-
|
|
496
|
+
const userSettings =
|
|
497
|
+
_nullishCoalesce(accountState.userSettings[pluginId], () => ( lastUserSettings))
|
|
498
|
+
if (lastUserSettings !== userSettings && engine != null) {
|
|
485
499
|
await engine.changeUserSettings(userSettings)
|
|
486
500
|
}
|
|
487
|
-
|
|
501
|
+
lastUserSettings = userSettings
|
|
488
502
|
|
|
489
503
|
// Update the custom tokens:
|
|
490
504
|
const customTokens = _nullishCoalesce(accountState.customTokens[pluginId], () => ( lastTokens))
|
|
@@ -505,6 +519,22 @@ export const walletPixie = combinePixies({
|
|
|
505
519
|
}
|
|
506
520
|
lastTokens = customTokens
|
|
507
521
|
|
|
522
|
+
// Update wallet-scoped settings:
|
|
523
|
+
const { hasWalletSettings = false } = walletState.currencyInfo
|
|
524
|
+
const { walletSettings } = walletState
|
|
525
|
+
const settingsChanged = lastWalletSettings !== walletSettings
|
|
526
|
+
|
|
527
|
+
if (
|
|
528
|
+
settingsChanged &&
|
|
529
|
+
_optionalChain([engine, 'optionalAccess', _5 => _5.changeWalletSettings]) != null &&
|
|
530
|
+
hasWalletSettings
|
|
531
|
+
) {
|
|
532
|
+
await engine.changeWalletSettings(walletSettings).catch(error => {
|
|
533
|
+
input.props.onError(error)
|
|
534
|
+
})
|
|
535
|
+
}
|
|
536
|
+
lastWalletSettings = walletSettings
|
|
537
|
+
|
|
508
538
|
// Update enabled tokens:
|
|
509
539
|
const { allEnabledTokenIds } = walletState
|
|
510
540
|
if (lastEnabledTokenIds !== allEnabledTokenIds && engine != null) {
|
|
@@ -15,6 +15,7 @@ import { buildReducer, filterReducer, memoizeReducer } from 'redux-keto'
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
|
|
18
19
|
import { compare } from '../../../util/compare'
|
|
19
20
|
|
|
20
21
|
import { findCurrencyPluginId } from '../../plugins/plugins-selectors'
|
|
@@ -117,6 +118,9 @@ import { uniqueStrings } from './enabled-tokens'
|
|
|
117
118
|
|
|
118
119
|
|
|
119
120
|
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
export const initialWalletSettings = {}
|
|
120
124
|
|
|
121
125
|
// Used for detectedTokenIds & enabledTokenIds:
|
|
122
126
|
export const initialTokenIds = []
|
|
@@ -250,6 +254,16 @@ const currencyWalletInner = buildReducer
|
|
|
250
254
|
}
|
|
251
255
|
},
|
|
252
256
|
|
|
257
|
+
walletSettings(state = initialWalletSettings, action) {
|
|
258
|
+
switch (action.type) {
|
|
259
|
+
case 'CURRENCY_WALLET_LOADED_WALLET_SETTINGS_FILE':
|
|
260
|
+
case 'CURRENCY_WALLET_CHANGED_WALLET_SETTINGS':
|
|
261
|
+
return action.payload.walletSettings
|
|
262
|
+
default:
|
|
263
|
+
return state
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
|
|
253
267
|
engineFailure(state = null, action) {
|
|
254
268
|
if (action.type === 'CURRENCY_ENGINE_FAILED') {
|
|
255
269
|
const { error } = action.payload
|
|
@@ -172,18 +172,14 @@ export async function splitWalletInfo(
|
|
|
172
172
|
// Restore anything that has simply been deleted:
|
|
173
173
|
if (toRestore.length > 0) {
|
|
174
174
|
const newStates = {}
|
|
175
|
-
let hasChanges = false
|
|
176
175
|
for (const existingWalletInfo of toRestore) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
deleted: false,
|
|
182
|
-
migratedFromWalletId: existingWalletInfo.migratedFromWalletId
|
|
183
|
-
}
|
|
176
|
+
newStates[existingWalletInfo.id] = {
|
|
177
|
+
archived: false,
|
|
178
|
+
deleted: false,
|
|
179
|
+
migratedFromWalletId: existingWalletInfo.migratedFromWalletId
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
|
-
|
|
182
|
+
await changeWalletStates(ai, accountId, newStates)
|
|
187
183
|
}
|
|
188
184
|
|
|
189
185
|
// Add the keys to the login:
|