@metamask-previews/account-tree-controller 8.0.0-preview-4f4c98e → 8.0.0-preview-eb263b0ee
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 +0 -1
- package/dist/AccountTreeController-method-action-types.cjs +7 -0
- package/dist/AccountTreeController-method-action-types.cjs.map +1 -0
- package/dist/{AccountTreeController-method-action-types.d.ts → AccountTreeController-method-action-types.d.cts} +2 -2
- package/dist/AccountTreeController-method-action-types.d.cts.map +1 -0
- package/dist/AccountTreeController-method-action-types.d.mts +256 -0
- package/dist/AccountTreeController-method-action-types.d.mts.map +1 -0
- package/dist/{AccountTreeController-method-action-types.js → AccountTreeController-method-action-types.mjs} +1 -1
- package/dist/AccountTreeController-method-action-types.mjs.map +1 -0
- package/dist/AccountTreeController.cjs +1247 -0
- package/dist/AccountTreeController.cjs.map +1 -0
- package/dist/{AccountTreeController.d.ts → AccountTreeController.d.cts} +17 -17
- package/dist/AccountTreeController.d.cts.map +1 -0
- package/dist/AccountTreeController.d.mts +269 -0
- package/dist/AccountTreeController.d.mts.map +1 -0
- package/dist/{AccountTreeController.js → AccountTreeController.mjs} +15 -15
- package/dist/AccountTreeController.mjs.map +1 -0
- package/dist/backup-and-sync/analytics/index.cjs +19 -0
- package/dist/backup-and-sync/analytics/index.cjs.map +1 -0
- package/dist/backup-and-sync/analytics/index.d.cts +3 -0
- package/dist/backup-and-sync/analytics/index.d.cts.map +1 -0
- package/dist/backup-and-sync/analytics/index.d.mts +3 -0
- package/dist/backup-and-sync/analytics/index.d.mts.map +1 -0
- package/dist/backup-and-sync/analytics/index.mjs +3 -0
- package/dist/backup-and-sync/analytics/index.mjs.map +1 -0
- package/dist/backup-and-sync/analytics/segment.cjs +38 -0
- package/dist/backup-and-sync/analytics/segment.cjs.map +1 -0
- package/dist/backup-and-sync/analytics/{segment.d.ts → segment.d.cts} +10 -10
- package/dist/backup-and-sync/analytics/segment.d.cts.map +1 -0
- package/dist/backup-and-sync/analytics/segment.d.mts +37 -0
- package/dist/backup-and-sync/analytics/segment.d.mts.map +1 -0
- package/dist/backup-and-sync/analytics/{segment.js → segment.mjs} +1 -1
- package/dist/backup-and-sync/analytics/segment.mjs.map +1 -0
- package/dist/backup-and-sync/analytics/traces.cjs +24 -0
- package/dist/backup-and-sync/analytics/traces.cjs.map +1 -0
- package/dist/backup-and-sync/analytics/{traces.d.ts → traces.d.cts} +3 -3
- package/dist/backup-and-sync/analytics/traces.d.cts.map +1 -0
- package/dist/backup-and-sync/analytics/traces.d.mts +16 -0
- package/dist/backup-and-sync/analytics/traces.d.mts.map +1 -0
- package/dist/backup-and-sync/analytics/{traces.js → traces.mjs} +1 -1
- package/dist/backup-and-sync/analytics/traces.mjs.map +1 -0
- package/dist/backup-and-sync/authentication/index.cjs +18 -0
- package/dist/backup-and-sync/authentication/index.cjs.map +1 -0
- package/dist/backup-and-sync/authentication/index.d.cts +2 -0
- package/dist/backup-and-sync/authentication/index.d.cts.map +1 -0
- package/dist/backup-and-sync/authentication/index.d.mts +2 -0
- package/dist/backup-and-sync/authentication/index.d.mts.map +1 -0
- package/dist/backup-and-sync/authentication/index.mjs +2 -0
- package/dist/backup-and-sync/authentication/index.mjs.map +1 -0
- package/dist/backup-and-sync/authentication/utils.cjs +23 -0
- package/dist/backup-and-sync/authentication/utils.cjs.map +1 -0
- package/dist/backup-and-sync/authentication/{utils.d.ts → utils.d.cts} +3 -3
- package/dist/backup-and-sync/authentication/utils.d.cts.map +1 -0
- package/dist/backup-and-sync/authentication/utils.d.mts +12 -0
- package/dist/backup-and-sync/authentication/utils.d.mts.map +1 -0
- package/dist/backup-and-sync/authentication/{utils.js → utils.mjs} +2 -2
- package/dist/backup-and-sync/authentication/utils.mjs.map +1 -0
- package/dist/backup-and-sync/service/atomic-sync-queue.cjs +123 -0
- package/dist/backup-and-sync/service/atomic-sync-queue.cjs.map +1 -0
- package/dist/backup-and-sync/service/{atomic-sync-queue.d.ts → atomic-sync-queue.d.cts} +1 -1
- package/dist/backup-and-sync/service/atomic-sync-queue.d.cts.map +1 -0
- package/dist/backup-and-sync/service/atomic-sync-queue.d.mts +43 -0
- package/dist/backup-and-sync/service/atomic-sync-queue.d.mts.map +1 -0
- package/dist/backup-and-sync/service/{atomic-sync-queue.js → atomic-sync-queue.mjs} +3 -3
- package/dist/backup-and-sync/service/atomic-sync-queue.mjs.map +1 -0
- package/dist/backup-and-sync/service/index.cjs +403 -0
- package/dist/backup-and-sync/service/index.cjs.map +1 -0
- package/dist/backup-and-sync/service/{index.d.ts → index.d.cts} +4 -4
- package/dist/backup-and-sync/service/index.d.cts.map +1 -0
- package/dist/backup-and-sync/service/index.d.mts +84 -0
- package/dist/backup-and-sync/service/index.d.mts.map +1 -0
- package/dist/backup-and-sync/service/{index.js → index.mjs} +9 -9
- package/dist/backup-and-sync/service/index.mjs.map +1 -0
- package/dist/backup-and-sync/syncing/group.cjs +190 -0
- package/dist/backup-and-sync/syncing/group.cjs.map +1 -0
- package/dist/backup-and-sync/syncing/{group.d.ts → group.d.cts} +6 -6
- package/dist/backup-and-sync/syncing/group.d.cts.map +1 -0
- package/dist/backup-and-sync/syncing/group.d.mts +48 -0
- package/dist/backup-and-sync/syncing/group.d.mts.map +1 -0
- package/dist/backup-and-sync/syncing/{group.js → group.mjs} +9 -9
- package/dist/backup-and-sync/syncing/group.mjs.map +1 -0
- package/dist/backup-and-sync/syncing/index.cjs +21 -0
- package/dist/backup-and-sync/syncing/index.cjs.map +1 -0
- package/dist/backup-and-sync/syncing/index.d.cts +5 -0
- package/dist/backup-and-sync/syncing/index.d.cts.map +1 -0
- package/dist/backup-and-sync/syncing/index.d.mts +5 -0
- package/dist/backup-and-sync/syncing/index.d.mts.map +1 -0
- package/dist/backup-and-sync/syncing/index.mjs +5 -0
- package/dist/backup-and-sync/syncing/index.mjs.map +1 -0
- package/dist/backup-and-sync/syncing/legacy.cjs +74 -0
- package/dist/backup-and-sync/syncing/legacy.cjs.map +1 -0
- package/dist/backup-and-sync/syncing/{legacy.d.ts → legacy.d.cts} +3 -3
- package/dist/backup-and-sync/syncing/legacy.d.cts.map +1 -0
- package/dist/backup-and-sync/syncing/legacy.d.mts +15 -0
- package/dist/backup-and-sync/syncing/legacy.d.mts.map +1 -0
- package/dist/backup-and-sync/syncing/{legacy.js → legacy.mjs} +8 -8
- package/dist/backup-and-sync/syncing/legacy.mjs.map +1 -0
- package/dist/backup-and-sync/syncing/metadata.cjs +56 -0
- package/dist/backup-and-sync/syncing/metadata.cjs.map +1 -0
- package/dist/backup-and-sync/syncing/{metadata.d.ts → metadata.d.cts} +4 -4
- package/dist/backup-and-sync/syncing/metadata.d.cts.map +1 -0
- package/dist/backup-and-sync/syncing/metadata.d.mts +39 -0
- package/dist/backup-and-sync/syncing/metadata.d.mts.map +1 -0
- package/dist/backup-and-sync/syncing/{metadata.js → metadata.mjs} +9 -2
- package/dist/backup-and-sync/syncing/metadata.mjs.map +1 -0
- package/dist/backup-and-sync/syncing/wallet.cjs +64 -0
- package/dist/backup-and-sync/syncing/wallet.cjs.map +1 -0
- package/dist/backup-and-sync/syncing/{wallet.d.ts → wallet.d.cts} +4 -4
- package/dist/backup-and-sync/syncing/wallet.d.cts.map +1 -0
- package/dist/backup-and-sync/syncing/wallet.d.mts +23 -0
- package/dist/backup-and-sync/syncing/wallet.d.mts.map +1 -0
- package/dist/backup-and-sync/syncing/{wallet.js → wallet.mjs} +6 -6
- package/dist/backup-and-sync/syncing/wallet.mjs.map +1 -0
- package/dist/backup-and-sync/types.cjs +41 -0
- package/dist/backup-and-sync/types.cjs.map +1 -0
- package/dist/backup-and-sync/{types.d.ts → types.d.cts} +12 -12
- package/dist/backup-and-sync/types.d.cts.map +1 -0
- package/dist/backup-and-sync/types.d.mts +131 -0
- package/dist/backup-and-sync/types.d.mts.map +1 -0
- package/dist/backup-and-sync/{types.js → types.mjs} +2 -2
- package/dist/backup-and-sync/types.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/constants.cjs +8 -0
- package/dist/backup-and-sync/user-storage/constants.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/{constants.d.ts → constants.d.cts} +1 -1
- package/dist/backup-and-sync/user-storage/constants.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/constants.d.mts +5 -0
- package/dist/backup-and-sync/user-storage/constants.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/{constants.js → constants.mjs} +1 -1
- package/dist/backup-and-sync/user-storage/constants.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/format-utils.cjs +115 -0
- package/dist/backup-and-sync/user-storage/format-utils.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/{format-utils.d.ts → format-utils.d.cts} +4 -4
- package/dist/backup-and-sync/user-storage/format-utils.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/format-utils.d.mts +54 -0
- package/dist/backup-and-sync/user-storage/format-utils.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/{format-utils.js → format-utils.mjs} +6 -6
- package/dist/backup-and-sync/user-storage/format-utils.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/index.cjs +21 -0
- package/dist/backup-and-sync/user-storage/index.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/index.d.cts +5 -0
- package/dist/backup-and-sync/user-storage/index.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/index.d.mts +5 -0
- package/dist/backup-and-sync/user-storage/index.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/index.mjs +5 -0
- package/dist/backup-and-sync/user-storage/index.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/network-operations.cjs +193 -0
- package/dist/backup-and-sync/user-storage/network-operations.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/{network-operations.d.ts → network-operations.d.cts} +4 -4
- package/dist/backup-and-sync/user-storage/network-operations.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/network-operations.d.mts +80 -0
- package/dist/backup-and-sync/user-storage/network-operations.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/{network-operations.js → network-operations.mjs} +7 -7
- package/dist/backup-and-sync/user-storage/network-operations.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/network-utils.cjs +33 -0
- package/dist/backup-and-sync/user-storage/network-utils.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/{network-utils.d.ts → network-utils.d.cts} +1 -1
- package/dist/backup-and-sync/user-storage/network-utils.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/network-utils.d.mts +10 -0
- package/dist/backup-and-sync/user-storage/network-utils.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/{network-utils.js → network-utils.mjs} +1 -1
- package/dist/backup-and-sync/user-storage/network-utils.mjs.map +1 -0
- package/dist/backup-and-sync/user-storage/validation.cjs +76 -0
- package/dist/backup-and-sync/user-storage/validation.cjs.map +1 -0
- package/dist/backup-and-sync/user-storage/{validation.d.ts → validation.d.cts} +2 -2
- package/dist/backup-and-sync/user-storage/validation.d.cts.map +1 -0
- package/dist/backup-and-sync/user-storage/validation.d.mts +23 -0
- package/dist/backup-and-sync/user-storage/validation.d.mts.map +1 -0
- package/dist/backup-and-sync/user-storage/{validation.js → validation.mjs} +3 -3
- package/dist/backup-and-sync/user-storage/validation.mjs.map +1 -0
- package/dist/backup-and-sync/utils/controller.cjs +88 -0
- package/dist/backup-and-sync/utils/controller.cjs.map +1 -0
- package/dist/backup-and-sync/utils/{controller.d.ts → controller.d.cts} +6 -6
- package/dist/backup-and-sync/utils/controller.d.cts.map +1 -0
- package/dist/backup-and-sync/utils/controller.d.mts +57 -0
- package/dist/backup-and-sync/utils/controller.d.mts.map +1 -0
- package/dist/backup-and-sync/utils/{controller.js → controller.mjs} +3 -3
- package/dist/backup-and-sync/utils/controller.mjs.map +1 -0
- package/dist/backup-and-sync/utils/errors.cjs +14 -0
- package/dist/backup-and-sync/utils/errors.cjs.map +1 -0
- package/dist/backup-and-sync/utils/{errors.d.ts → errors.d.cts} +1 -1
- package/dist/backup-and-sync/utils/errors.d.cts.map +1 -0
- package/dist/backup-and-sync/utils/errors.d.mts +8 -0
- package/dist/backup-and-sync/utils/errors.d.mts.map +1 -0
- package/dist/backup-and-sync/utils/{errors.js → errors.mjs} +1 -1
- package/dist/backup-and-sync/utils/errors.mjs.map +1 -0
- package/dist/backup-and-sync/utils/index.cjs +23 -0
- package/dist/backup-and-sync/utils/index.cjs.map +1 -0
- package/dist/backup-and-sync/utils/index.d.cts +4 -0
- package/dist/backup-and-sync/utils/index.d.cts.map +1 -0
- package/dist/backup-and-sync/utils/index.d.mts +4 -0
- package/dist/backup-and-sync/utils/index.d.mts.map +1 -0
- package/dist/backup-and-sync/utils/index.mjs +4 -0
- package/dist/backup-and-sync/utils/index.mjs.map +1 -0
- package/dist/backup-and-sync/utils/mutation-tracker.cjs +29 -0
- package/dist/backup-and-sync/utils/mutation-tracker.cjs.map +1 -0
- package/dist/backup-and-sync/utils/{mutation-tracker.d.ts → mutation-tracker.d.cts} +2 -2
- package/dist/backup-and-sync/utils/mutation-tracker.d.cts.map +1 -0
- package/dist/backup-and-sync/utils/mutation-tracker.d.mts +9 -0
- package/dist/backup-and-sync/utils/mutation-tracker.d.mts.map +1 -0
- package/dist/backup-and-sync/utils/{mutation-tracker.js → mutation-tracker.mjs} +1 -1
- package/dist/backup-and-sync/utils/mutation-tracker.mjs.map +1 -0
- package/dist/group.cjs +60 -0
- package/dist/group.cjs.map +1 -0
- package/dist/{group.d.ts → group.d.cts} +8 -8
- package/dist/group.d.cts.map +1 -0
- package/dist/group.d.mts +97 -0
- package/dist/group.d.mts.map +1 -0
- package/dist/{group.js → group.mjs} +2 -2
- package/dist/group.mjs.map +1 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +13 -13
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +13 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +7 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.cjs +7 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/{logger.d.ts → logger.d.cts} +2 -1
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +4 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/{logger.js → logger.mjs} +2 -2
- package/dist/logger.mjs.map +1 -0
- package/dist/rule.cjs +32 -0
- package/dist/rule.cjs.map +1 -0
- package/dist/{rule.d.ts → rule.d.cts} +7 -7
- package/dist/rule.d.cts.map +1 -0
- package/dist/rule.d.mts +83 -0
- package/dist/rule.d.mts.map +1 -0
- package/dist/{rule.js → rule.mjs} +1 -1
- package/dist/rule.mjs.map +1 -0
- package/dist/rules/entropy.cjs +78 -0
- package/dist/rules/entropy.cjs.map +1 -0
- package/dist/rules/{entropy.d.ts → entropy.d.cts} +7 -7
- package/dist/rules/entropy.d.cts.map +1 -0
- package/dist/rules/entropy.d.mts +16 -0
- package/dist/rules/entropy.d.mts.map +1 -0
- package/dist/rules/{entropy.js → entropy.mjs} +5 -5
- package/dist/rules/entropy.mjs.map +1 -0
- package/dist/rules/keyring.cjs +151 -0
- package/dist/rules/keyring.cjs.map +1 -0
- package/dist/rules/{keyring.d.ts → keyring.d.cts} +10 -10
- package/dist/rules/keyring.d.cts.map +1 -0
- package/dist/rules/keyring.d.mts +32 -0
- package/dist/rules/keyring.d.mts.map +1 -0
- package/dist/rules/{keyring.js → keyring.mjs} +7 -7
- package/dist/rules/keyring.mjs.map +1 -0
- package/dist/rules/snap.cjs +80 -0
- package/dist/rules/snap.cjs.map +1 -0
- package/dist/rules/{snap.d.ts → snap.d.cts} +6 -6
- package/dist/rules/snap.d.cts.map +1 -0
- package/dist/rules/snap.d.mts +14 -0
- package/dist/rules/snap.d.mts.map +1 -0
- package/dist/rules/{snap.js → snap.mjs} +8 -8
- package/dist/rules/snap.mjs.map +1 -0
- package/dist/state/export.cjs +230 -0
- package/dist/state/export.cjs.map +1 -0
- package/dist/state/{export.d.ts → export.d.cts} +6 -6
- package/dist/state/export.d.cts.map +1 -0
- package/dist/state/export.d.mts +40 -0
- package/dist/state/export.d.mts.map +1 -0
- package/dist/state/{export.js → export.mjs} +9 -8
- package/dist/state/export.mjs.map +1 -0
- package/dist/state/id-map.cjs +65 -0
- package/dist/state/id-map.cjs.map +1 -0
- package/dist/state/{id-map.d.ts → id-map.d.cts} +3 -3
- package/dist/state/id-map.d.cts.map +1 -0
- package/dist/state/id-map.d.mts +41 -0
- package/dist/state/id-map.d.mts.map +1 -0
- package/dist/state/{id-map.js → id-map.mjs} +2 -2
- package/dist/state/id-map.mjs.map +1 -0
- package/dist/state/import.cjs +285 -0
- package/dist/state/import.cjs.map +1 -0
- package/dist/state/{import.d.ts → import.d.cts} +4 -4
- package/dist/state/import.d.cts.map +1 -0
- package/dist/state/import.d.mts +29 -0
- package/dist/state/import.d.mts.map +1 -0
- package/dist/state/{import.js → import.mjs} +9 -8
- package/dist/state/import.mjs.map +1 -0
- package/dist/state/payload.cjs +169 -0
- package/dist/state/payload.cjs.map +1 -0
- package/dist/state/{payload.d.ts → payload.d.cts} +31 -31
- package/dist/state/payload.d.cts.map +1 -0
- package/dist/state/payload.d.mts +294 -0
- package/dist/state/payload.d.mts.map +1 -0
- package/dist/state/{payload.js → payload.mjs} +4 -4
- package/dist/state/payload.mjs.map +1 -0
- package/dist/state/snapshot.cjs +202 -0
- package/dist/state/snapshot.cjs.map +1 -0
- package/dist/state/{snapshot.d.ts → snapshot.d.cts} +3 -3
- package/dist/state/snapshot.d.cts.map +1 -0
- package/dist/state/snapshot.d.mts +120 -0
- package/dist/state/snapshot.d.mts.map +1 -0
- package/dist/state/{snapshot.js → snapshot.mjs} +3 -3
- package/dist/state/snapshot.mjs.map +1 -0
- package/dist/state/utils.cjs +68 -0
- package/dist/state/utils.cjs.map +1 -0
- package/dist/state/{utils.d.ts → utils.d.cts} +3 -3
- package/dist/state/utils.d.cts.map +1 -0
- package/dist/state/utils.d.mts +49 -0
- package/dist/state/utils.d.mts.map +1 -0
- package/dist/state/{utils.js → utils.mjs} +2 -2
- package/dist/state/utils.mjs.map +1 -0
- package/dist/type-utils.cjs +3 -0
- package/dist/type-utils.cjs.map +1 -0
- package/dist/{type-utils.d.ts → type-utils.d.cts} +1 -1
- package/dist/type-utils.d.cts.map +1 -0
- package/dist/type-utils.d.mts +18 -0
- package/dist/type-utils.d.mts.map +1 -0
- package/dist/type-utils.mjs +2 -0
- package/dist/type-utils.mjs.map +1 -0
- package/dist/types.cjs +3 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +16 -16
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +120 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +2 -0
- package/dist/types.mjs.map +1 -0
- package/dist/wallet.cjs +3 -0
- package/dist/wallet.cjs.map +1 -0
- package/dist/{wallet.d.ts → wallet.d.cts} +9 -9
- package/dist/wallet.d.cts.map +1 -0
- package/dist/wallet.d.mts +99 -0
- package/dist/wallet.d.mts.map +1 -0
- package/dist/wallet.mjs +2 -0
- package/dist/wallet.mjs.map +1 -0
- package/package.json +17 -13
- package/dist/AccountTreeController-method-action-types.d.ts.map +0 -1
- package/dist/AccountTreeController-method-action-types.js.map +0 -1
- package/dist/AccountTreeController.d.ts.map +0 -1
- package/dist/AccountTreeController.js.map +0 -1
- package/dist/backup-and-sync/analytics/index.d.ts +0 -3
- package/dist/backup-and-sync/analytics/index.d.ts.map +0 -1
- package/dist/backup-and-sync/analytics/index.js +0 -3
- package/dist/backup-and-sync/analytics/index.js.map +0 -1
- package/dist/backup-and-sync/analytics/segment.d.ts.map +0 -1
- package/dist/backup-and-sync/analytics/segment.js.map +0 -1
- package/dist/backup-and-sync/analytics/traces.d.ts.map +0 -1
- package/dist/backup-and-sync/analytics/traces.js.map +0 -1
- package/dist/backup-and-sync/authentication/index.d.ts +0 -2
- package/dist/backup-and-sync/authentication/index.d.ts.map +0 -1
- package/dist/backup-and-sync/authentication/index.js +0 -2
- package/dist/backup-and-sync/authentication/index.js.map +0 -1
- package/dist/backup-and-sync/authentication/utils.d.ts.map +0 -1
- package/dist/backup-and-sync/authentication/utils.js.map +0 -1
- package/dist/backup-and-sync/service/atomic-sync-queue.d.ts.map +0 -1
- package/dist/backup-and-sync/service/atomic-sync-queue.js.map +0 -1
- package/dist/backup-and-sync/service/index.d.ts.map +0 -1
- package/dist/backup-and-sync/service/index.js.map +0 -1
- package/dist/backup-and-sync/syncing/group.d.ts.map +0 -1
- package/dist/backup-and-sync/syncing/group.js.map +0 -1
- package/dist/backup-and-sync/syncing/index.d.ts +0 -5
- package/dist/backup-and-sync/syncing/index.d.ts.map +0 -1
- package/dist/backup-and-sync/syncing/index.js +0 -5
- package/dist/backup-and-sync/syncing/index.js.map +0 -1
- package/dist/backup-and-sync/syncing/legacy.d.ts.map +0 -1
- package/dist/backup-and-sync/syncing/legacy.js.map +0 -1
- package/dist/backup-and-sync/syncing/metadata.d.ts.map +0 -1
- package/dist/backup-and-sync/syncing/metadata.js.map +0 -1
- package/dist/backup-and-sync/syncing/wallet.d.ts.map +0 -1
- package/dist/backup-and-sync/syncing/wallet.js.map +0 -1
- package/dist/backup-and-sync/types.d.ts.map +0 -1
- package/dist/backup-and-sync/types.js.map +0 -1
- package/dist/backup-and-sync/user-storage/constants.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/constants.js.map +0 -1
- package/dist/backup-and-sync/user-storage/format-utils.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/format-utils.js.map +0 -1
- package/dist/backup-and-sync/user-storage/index.d.ts +0 -5
- package/dist/backup-and-sync/user-storage/index.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/index.js +0 -5
- package/dist/backup-and-sync/user-storage/index.js.map +0 -1
- package/dist/backup-and-sync/user-storage/network-operations.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/network-operations.js.map +0 -1
- package/dist/backup-and-sync/user-storage/network-utils.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/network-utils.js.map +0 -1
- package/dist/backup-and-sync/user-storage/validation.d.ts.map +0 -1
- package/dist/backup-and-sync/user-storage/validation.js.map +0 -1
- package/dist/backup-and-sync/utils/controller.d.ts.map +0 -1
- package/dist/backup-and-sync/utils/controller.js.map +0 -1
- package/dist/backup-and-sync/utils/errors.d.ts.map +0 -1
- package/dist/backup-and-sync/utils/errors.js.map +0 -1
- package/dist/backup-and-sync/utils/index.d.ts +0 -4
- package/dist/backup-and-sync/utils/index.d.ts.map +0 -1
- package/dist/backup-and-sync/utils/index.js +0 -4
- package/dist/backup-and-sync/utils/index.js.map +0 -1
- package/dist/backup-and-sync/utils/mutation-tracker.d.ts.map +0 -1
- package/dist/backup-and-sync/utils/mutation-tracker.js.map +0 -1
- package/dist/group.d.ts.map +0 -1
- package/dist/group.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/rule.d.ts.map +0 -1
- package/dist/rule.js.map +0 -1
- package/dist/rules/entropy.d.ts.map +0 -1
- package/dist/rules/entropy.js.map +0 -1
- package/dist/rules/keyring.d.ts.map +0 -1
- package/dist/rules/keyring.js.map +0 -1
- package/dist/rules/snap.d.ts.map +0 -1
- package/dist/rules/snap.js.map +0 -1
- package/dist/state/export.d.ts.map +0 -1
- package/dist/state/export.js.map +0 -1
- package/dist/state/id-map.d.ts.map +0 -1
- package/dist/state/id-map.js.map +0 -1
- package/dist/state/import.d.ts.map +0 -1
- package/dist/state/import.js.map +0 -1
- package/dist/state/payload.d.ts.map +0 -1
- package/dist/state/payload.js.map +0 -1
- package/dist/state/snapshot.d.ts.map +0 -1
- package/dist/state/snapshot.js.map +0 -1
- package/dist/state/utils.d.ts.map +0 -1
- package/dist/state/utils.js.map +0 -1
- package/dist/type-utils.d.ts.map +0 -1
- package/dist/type-utils.js +0 -2
- package/dist/type-utils.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/wallet.d.ts.map +0 -1
- package/dist/wallet.js +0 -2
- package/dist/wallet.js.map +0 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { AccountGroupId, AccountGroupType, AccountWalletId, AccountWalletType } from "@metamask/account-api";
|
|
2
|
+
import type { TraceCallback } from "@metamask/controller-utils";
|
|
3
|
+
import type { InternalAccount } from "@metamask/keyring-internal-api";
|
|
4
|
+
import type { Infer, Struct } from "@metamask/superstruct";
|
|
5
|
+
import type { AccountTreeController } from "../AccountTreeController.mjs";
|
|
6
|
+
import type { AccountGroupMultichainAccountObject, AccountTreeGroupPersistedMetadata } from "../group.mjs";
|
|
7
|
+
import type { RuleResult } from "../rule.mjs";
|
|
8
|
+
import type { AccountTreeControllerMessenger } from "../types.mjs";
|
|
9
|
+
import type { AccountTreeWalletPersistedMetadata } from "../wallet.mjs";
|
|
10
|
+
import type { BackupAndSyncEmitAnalyticsEventParams } from "./analytics/index.mjs";
|
|
11
|
+
/**
|
|
12
|
+
* Superstruct schema for UserStorageSyncedWallet validation.
|
|
13
|
+
*/
|
|
14
|
+
export declare const UserStorageSyncedWalletSchema: Struct<{
|
|
15
|
+
name?: {
|
|
16
|
+
value: string;
|
|
17
|
+
lastUpdatedAt: number;
|
|
18
|
+
} | undefined;
|
|
19
|
+
isLegacyAccountSyncingDisabled?: boolean | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
name: Struct<{
|
|
22
|
+
value: string;
|
|
23
|
+
lastUpdatedAt: number;
|
|
24
|
+
} | undefined, {
|
|
25
|
+
value: Struct<string, unknown>;
|
|
26
|
+
lastUpdatedAt: Struct<number, null>;
|
|
27
|
+
}>;
|
|
28
|
+
isLegacyAccountSyncingDisabled: Struct<boolean | undefined, null>;
|
|
29
|
+
}>;
|
|
30
|
+
/**
|
|
31
|
+
* Superstruct schema for UserStorageSyncedWalletGroup validation.
|
|
32
|
+
*/
|
|
33
|
+
export declare const UserStorageSyncedWalletGroupSchema: Struct<{
|
|
34
|
+
groupIndex: number;
|
|
35
|
+
name?: {
|
|
36
|
+
value: string;
|
|
37
|
+
lastUpdatedAt: number;
|
|
38
|
+
} | undefined;
|
|
39
|
+
pinned?: {
|
|
40
|
+
value: boolean;
|
|
41
|
+
lastUpdatedAt: number;
|
|
42
|
+
} | undefined;
|
|
43
|
+
hidden?: {
|
|
44
|
+
value: boolean;
|
|
45
|
+
lastUpdatedAt: number;
|
|
46
|
+
} | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
name: Struct<{
|
|
49
|
+
value: string;
|
|
50
|
+
lastUpdatedAt: number;
|
|
51
|
+
} | undefined, {
|
|
52
|
+
value: Struct<string, unknown>;
|
|
53
|
+
lastUpdatedAt: Struct<number, null>;
|
|
54
|
+
}>;
|
|
55
|
+
pinned: Struct<{
|
|
56
|
+
value: boolean;
|
|
57
|
+
lastUpdatedAt: number;
|
|
58
|
+
} | undefined, {
|
|
59
|
+
value: Struct<boolean, unknown>;
|
|
60
|
+
lastUpdatedAt: Struct<number, null>;
|
|
61
|
+
}>;
|
|
62
|
+
hidden: Struct<{
|
|
63
|
+
value: boolean;
|
|
64
|
+
lastUpdatedAt: number;
|
|
65
|
+
} | undefined, {
|
|
66
|
+
value: Struct<boolean, unknown>;
|
|
67
|
+
lastUpdatedAt: Struct<number, null>;
|
|
68
|
+
}>;
|
|
69
|
+
groupIndex: Struct<number, null>;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Superstruct schema for LegacyUserStorageSyncedAccount validation.
|
|
73
|
+
*/
|
|
74
|
+
export declare const LegacyUserStorageSyncedAccountSchema: Struct<{
|
|
75
|
+
v?: string | undefined;
|
|
76
|
+
i?: string | undefined;
|
|
77
|
+
a?: string | undefined;
|
|
78
|
+
n?: string | undefined;
|
|
79
|
+
nlu?: number | undefined;
|
|
80
|
+
}, {
|
|
81
|
+
v: Struct<string | undefined, null>;
|
|
82
|
+
i: Struct<string | undefined, null>;
|
|
83
|
+
a: Struct<string | undefined, null>;
|
|
84
|
+
n: Struct<string | undefined, null>;
|
|
85
|
+
nlu: Struct<number | undefined, null>;
|
|
86
|
+
}>;
|
|
87
|
+
export type UserStorageSyncedWallet = AccountTreeWalletPersistedMetadata & Infer<typeof UserStorageSyncedWalletSchema>;
|
|
88
|
+
export type UserStorageSyncedWalletGroup = AccountTreeGroupPersistedMetadata & {
|
|
89
|
+
groupIndex: AccountGroupMultichainAccountObject['metadata']['entropy']['groupIndex'];
|
|
90
|
+
} & Infer<typeof UserStorageSyncedWalletGroupSchema>;
|
|
91
|
+
export type LegacyUserStorageSyncedAccount = Infer<typeof LegacyUserStorageSyncedAccountSchema>;
|
|
92
|
+
/**
|
|
93
|
+
* Tracks whether the current full sync run performed a real write, so the
|
|
94
|
+
* service can gate emission of the full-sync trace.
|
|
95
|
+
*
|
|
96
|
+
* Writes are split by durability:
|
|
97
|
+
* - Remote writes (pushes to user storage) are durable and always count.
|
|
98
|
+
* - Local writes can be reverted by a per-wallet rollback, so the service
|
|
99
|
+
* reads the flag before a wallet and writes it back if that wallet rolls back.
|
|
100
|
+
*/
|
|
101
|
+
export type SyncMutationTracker = {
|
|
102
|
+
/** Sets (or clears) the durable remote-write flag — a push to user storage. */
|
|
103
|
+
setRemoteWrite: (value: boolean) => void;
|
|
104
|
+
/** Gets the local-write flag — a write a per-wallet rollback would revert. */
|
|
105
|
+
getLocalWrite: () => boolean;
|
|
106
|
+
/** Sets, clears, or restores the local-write flag. */
|
|
107
|
+
setLocalWrite: (value: boolean) => void;
|
|
108
|
+
/** Whether any write (remote or local) is currently recorded. */
|
|
109
|
+
hasOccurred: () => boolean;
|
|
110
|
+
/** Clears all recorded writes at the start of a sync run. */
|
|
111
|
+
reset: () => void;
|
|
112
|
+
};
|
|
113
|
+
export type BackupAndSyncContext = {
|
|
114
|
+
messenger: AccountTreeControllerMessenger;
|
|
115
|
+
controller: AccountTreeController;
|
|
116
|
+
controllerStateUpdateFn: AccountTreeController['update'];
|
|
117
|
+
traceFn: TraceCallback;
|
|
118
|
+
groupIdToWalletId: Map<AccountGroupId, AccountWalletId>;
|
|
119
|
+
emitAnalyticsEventFn: (event: BackupAndSyncEmitAnalyticsEventParams) => void;
|
|
120
|
+
mutationTracker?: SyncMutationTracker;
|
|
121
|
+
};
|
|
122
|
+
export type LegacyAccountSyncingContext = {
|
|
123
|
+
listAccounts: () => InternalAccount[];
|
|
124
|
+
getEntropyRule: () => {
|
|
125
|
+
match: (account: InternalAccount) => RuleResult<AccountWalletType.Entropy, AccountGroupType.MultichainAccount> | undefined;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export type AtomicSyncEvent = {
|
|
129
|
+
execute: () => Promise<void>;
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/backup-and-sync/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EAClB,8BAA8B;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,mCAAmC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,uCAAuC;AAQtE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B;AAE3D,OAAO,KAAK,EAAE,qBAAqB,EAAE,qCAAoC;AACzE,OAAO,KAAK,EACV,mCAAmC,EACnC,iCAAiC,EAClC,qBAAoB;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAmB;AAC7C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qBAAoB;AAClE,OAAO,KAAK,EAAE,kCAAkC,EAAE,sBAAqB;AACvE,OAAO,KAAK,EAAE,qCAAqC,EAAE,8BAA6B;AAclF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;EAGxC,CAAC;AAEH;;GAEG;AACH,eAAO,MAA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2B,GAAG;IACxC,YAAY,EAAE,MAAM,eAAe,EAAE,CAAC;IACtC,cAAc,EAAE,MAAM;QACpB,KAAK,EAAE,CACL,OAAO,EAAE,eAAe,KAEtB,UAAU,CACR,iBAAiB,CAAC,OAAO,EACzB,gBAAgB,CAAC,iBAAiB,CACnC,GACD,SAAS,CAAC;KACf,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { object, string, boolean, number, optional
|
|
1
|
+
import { object, string, boolean, number, optional } from "@metamask/superstruct";
|
|
2
2
|
/**
|
|
3
3
|
* Schema for an updatable field with value and timestamp.
|
|
4
4
|
*
|
|
@@ -35,4 +35,4 @@ export const LegacyUserStorageSyncedAccountSchema = object({
|
|
|
35
35
|
n: optional(string()),
|
|
36
36
|
nlu: optional(number()),
|
|
37
37
|
});
|
|
38
|
-
//# sourceMappingURL=types.
|
|
38
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/backup-and-sync/types.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,MAAM,EACN,MAAM,EACN,OAAO,EACP,MAAM,EACN,QAAQ,EACT,8BAA8B;AAa/B;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,CAAI,WAAsB,EAAE,EAAE,CACzD,MAAM,CAAC;IACL,KAAK,EAAE,WAAW;IAClB,aAAa,EAAE,MAAM,EAAE;CACxB,CAAC,CAAC;AAEL;;GAEG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,MAAM,CAAC;IAClD,IAAI,EAAE,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,8BAA8B,EAAE,QAAQ,CAAC,OAAO,EAAE,CAAC;CACpD,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,MAAM,CAAC;IACvD,IAAI,EAAE,QAAQ,CAAC,oBAAoB,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,MAAM,EAAE,QAAQ,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,UAAU,EAAE,MAAM,EAAE;CACrB,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACrB,CAAC,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IACrB,GAAG,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACxB,CAAC,CAAC","sourcesContent":["import type {\n AccountGroupId,\n AccountGroupType,\n AccountWalletId,\n AccountWalletType,\n} from '@metamask/account-api';\nimport type { TraceCallback } from '@metamask/controller-utils';\nimport type { InternalAccount } from '@metamask/keyring-internal-api';\nimport {\n object,\n string,\n boolean,\n number,\n optional,\n} from '@metamask/superstruct';\nimport type { Infer, Struct } from '@metamask/superstruct';\n\nimport type { AccountTreeController } from '../AccountTreeController.js';\nimport type {\n AccountGroupMultichainAccountObject,\n AccountTreeGroupPersistedMetadata,\n} from '../group.js';\nimport type { RuleResult } from '../rule.js';\nimport type { AccountTreeControllerMessenger } from '../types.js';\nimport type { AccountTreeWalletPersistedMetadata } from '../wallet.js';\nimport type { BackupAndSyncEmitAnalyticsEventParams } from './analytics/index.js';\n\n/**\n * Schema for an updatable field with value and timestamp.\n *\n * @param valueSchema - The schema for the value field.\n * @returns A superstruct schema for an updatable field.\n */\nconst UpdatableFieldSchema = <T>(valueSchema: Struct<T>) =>\n object({\n value: valueSchema,\n lastUpdatedAt: number(),\n });\n\n/**\n * Superstruct schema for UserStorageSyncedWallet validation.\n */\nexport const UserStorageSyncedWalletSchema = object({\n name: optional(UpdatableFieldSchema(string())),\n isLegacyAccountSyncingDisabled: optional(boolean()),\n});\n\n/**\n * Superstruct schema for UserStorageSyncedWalletGroup validation.\n */\nexport const UserStorageSyncedWalletGroupSchema = object({\n name: optional(UpdatableFieldSchema(string())),\n pinned: optional(UpdatableFieldSchema(boolean())),\n hidden: optional(UpdatableFieldSchema(boolean())),\n groupIndex: number(),\n});\n\n/**\n * Superstruct schema for LegacyUserStorageSyncedAccount validation.\n */\nexport const LegacyUserStorageSyncedAccountSchema = object({\n v: optional(string()),\n i: optional(string()),\n a: optional(string()),\n n: optional(string()),\n nlu: optional(number()),\n});\n\nexport type UserStorageSyncedWallet = AccountTreeWalletPersistedMetadata &\n Infer<typeof UserStorageSyncedWalletSchema>;\n\nexport type UserStorageSyncedWalletGroup = AccountTreeGroupPersistedMetadata & {\n groupIndex: AccountGroupMultichainAccountObject['metadata']['entropy']['groupIndex'];\n} & Infer<typeof UserStorageSyncedWalletGroupSchema>;\n\nexport type LegacyUserStorageSyncedAccount = Infer<\n typeof LegacyUserStorageSyncedAccountSchema\n>;\n\n/**\n * Tracks whether the current full sync run performed a real write, so the\n * service can gate emission of the full-sync trace.\n *\n * Writes are split by durability:\n * - Remote writes (pushes to user storage) are durable and always count.\n * - Local writes can be reverted by a per-wallet rollback, so the service\n * reads the flag before a wallet and writes it back if that wallet rolls back.\n */\nexport type SyncMutationTracker = {\n /** Sets (or clears) the durable remote-write flag — a push to user storage. */\n setRemoteWrite: (value: boolean) => void;\n /** Gets the local-write flag — a write a per-wallet rollback would revert. */\n getLocalWrite: () => boolean;\n /** Sets, clears, or restores the local-write flag. */\n setLocalWrite: (value: boolean) => void;\n /** Whether any write (remote or local) is currently recorded. */\n hasOccurred: () => boolean;\n /** Clears all recorded writes at the start of a sync run. */\n reset: () => void;\n};\n\nexport type BackupAndSyncContext = {\n messenger: AccountTreeControllerMessenger;\n controller: AccountTreeController;\n controllerStateUpdateFn: AccountTreeController['update'];\n traceFn: TraceCallback;\n groupIdToWalletId: Map<AccountGroupId, AccountWalletId>;\n emitAnalyticsEventFn: (event: BackupAndSyncEmitAnalyticsEventParams) => void;\n mutationTracker?: SyncMutationTracker;\n};\n\nexport type LegacyAccountSyncingContext = {\n listAccounts: () => InternalAccount[];\n getEntropyRule: () => {\n match: (\n account: InternalAccount,\n ) =>\n | RuleResult<\n AccountWalletType.Entropy,\n AccountGroupType.MultichainAccount\n >\n | undefined;\n };\n};\n\nexport type AtomicSyncEvent = {\n execute: () => Promise<void>;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.USER_STORAGE_GROUPS_FEATURE_KEY = exports.USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = exports.USER_STORAGE_WALLETS_FEATURE_KEY = exports.USER_STORAGE_FEATURE_PREFIX = void 0;
|
|
4
|
+
exports.USER_STORAGE_FEATURE_PREFIX = 'multichain_accounts';
|
|
5
|
+
exports.USER_STORAGE_WALLETS_FEATURE_KEY = `${exports.USER_STORAGE_FEATURE_PREFIX}_wallets`;
|
|
6
|
+
exports.USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = 'wallet';
|
|
7
|
+
exports.USER_STORAGE_GROUPS_FEATURE_KEY = `${exports.USER_STORAGE_FEATURE_PREFIX}_groups`;
|
|
8
|
+
//# sourceMappingURL=constants.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG,qBAAqB,CAAC;AAEpD,QAAA,gCAAgC,GAAG,GAAG,mCAA2B,UAAU,CAAC;AAC5E,QAAA,sCAAsC,GAAG,QAAQ,CAAC;AAElD,QAAA,+BAA+B,GAAG,GAAG,mCAA2B,SAAS,CAAC","sourcesContent":["export const USER_STORAGE_FEATURE_PREFIX = 'multichain_accounts';\n\nexport const USER_STORAGE_WALLETS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_wallets`;\nexport const USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = 'wallet';\n\nexport const USER_STORAGE_GROUPS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_groups`;\n"]}
|
|
@@ -2,4 +2,4 @@ export declare const USER_STORAGE_FEATURE_PREFIX = "multichain_accounts";
|
|
|
2
2
|
export declare const USER_STORAGE_WALLETS_FEATURE_KEY = "multichain_accounts_wallets";
|
|
3
3
|
export declare const USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = "wallet";
|
|
4
4
|
export declare const USER_STORAGE_GROUPS_FEATURE_KEY = "multichain_accounts_groups";
|
|
5
|
-
//# sourceMappingURL=constants.d.
|
|
5
|
+
//# sourceMappingURL=constants.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE,eAAO,MAAM,gCAAgC,gCAA2C,CAAC;AACzF,eAAO,MAAM,sCAAsC,WAAW,CAAC;AAE/D,eAAO,MAAM,+BAA+B,+BAA0C,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const USER_STORAGE_FEATURE_PREFIX = "multichain_accounts";
|
|
2
|
+
export declare const USER_STORAGE_WALLETS_FEATURE_KEY = "multichain_accounts_wallets";
|
|
3
|
+
export declare const USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = "wallet";
|
|
4
|
+
export declare const USER_STORAGE_GROUPS_FEATURE_KEY = "multichain_accounts_groups";
|
|
5
|
+
//# sourceMappingURL=constants.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE,eAAO,MAAM,gCAAgC,gCAA2C,CAAC;AACzF,eAAO,MAAM,sCAAsC,WAAW,CAAC;AAE/D,eAAO,MAAM,+BAA+B,+BAA0C,CAAC"}
|
|
@@ -2,4 +2,4 @@ export const USER_STORAGE_FEATURE_PREFIX = 'multichain_accounts';
|
|
|
2
2
|
export const USER_STORAGE_WALLETS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_wallets`;
|
|
3
3
|
export const USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = 'wallet';
|
|
4
4
|
export const USER_STORAGE_GROUPS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_groups`;
|
|
5
|
-
//# sourceMappingURL=constants.
|
|
5
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,qBAAqB,CAAC;AAEjE,MAAM,CAAC,MAAM,gCAAgC,GAAG,GAAG,2BAA2B,UAAU,CAAC;AACzF,MAAM,CAAC,MAAM,sCAAsC,GAAG,QAAQ,CAAC;AAE/D,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,2BAA2B,SAAS,CAAC","sourcesContent":["export const USER_STORAGE_FEATURE_PREFIX = 'multichain_accounts';\n\nexport const USER_STORAGE_WALLETS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_wallets`;\nexport const USER_STORAGE_WALLETS_FEATURE_ENTRY_KEY = 'wallet';\n\nexport const USER_STORAGE_GROUPS_FEATURE_KEY = `${USER_STORAGE_FEATURE_PREFIX}_groups`;\n"]}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseLegacyAccountFromUserStorageResponse = exports.parseGroupFromUserStorageResponse = exports.parseWalletFromUserStorageResponse = exports.formatGroupForUserStorageUsage = exports.formatWalletForUserStorageUsage = void 0;
|
|
4
|
+
const superstruct_1 = require("@metamask/superstruct");
|
|
5
|
+
const logger_js_1 = require("../../logger.cjs");
|
|
6
|
+
const types_js_1 = require("../types.cjs");
|
|
7
|
+
const errors_js_1 = require("../utils/errors.cjs");
|
|
8
|
+
const validation_js_1 = require("./validation.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Formats the wallet for user storage usage.
|
|
11
|
+
* This function extracts the necessary metadata from the wallet
|
|
12
|
+
* and formats it according to the user storage requirements.
|
|
13
|
+
*
|
|
14
|
+
* @param context - The backup and sync context.
|
|
15
|
+
* @param wallet - The wallet object to format.
|
|
16
|
+
* @returns The formatted wallet for user storage.
|
|
17
|
+
*/
|
|
18
|
+
const formatWalletForUserStorageUsage = (context, wallet) => {
|
|
19
|
+
// This can be null if the user has not manually set a name
|
|
20
|
+
const persistedWalletMetadata = context.controller.state.accountWalletsMetadata[wallet.id];
|
|
21
|
+
return {
|
|
22
|
+
...(persistedWalletMetadata ?? {}),
|
|
23
|
+
isLegacyAccountSyncingDisabled: true, // If we're here, it means legacy account syncing has been performed at least once, so we can disable it for this wallet.
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.formatWalletForUserStorageUsage = formatWalletForUserStorageUsage;
|
|
27
|
+
/**
|
|
28
|
+
* Formats the group for user storage usage.
|
|
29
|
+
* This function extracts the necessary metadata from the group
|
|
30
|
+
* and formats it according to the user storage requirements.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The backup and sync context.
|
|
33
|
+
* @param group - The group object to format.
|
|
34
|
+
* @returns The formatted group for user storage.
|
|
35
|
+
*/
|
|
36
|
+
const formatGroupForUserStorageUsage = (context, group) => {
|
|
37
|
+
// This can be null if the user has not manually set a name, pinned or hidden the group
|
|
38
|
+
const persistedGroupMetadata = context.controller.state.accountGroupsMetadata[group.id];
|
|
39
|
+
const { groupIndex } = group.metadata.entropy;
|
|
40
|
+
try {
|
|
41
|
+
// We mask and we try catch, since `mask` will throw if the persisted metadata has
|
|
42
|
+
// fields with wrong types.
|
|
43
|
+
return (0, superstruct_1.mask)({
|
|
44
|
+
...(persistedGroupMetadata ?? {}),
|
|
45
|
+
groupIndex,
|
|
46
|
+
}, types_js_1.UserStorageSyncedWalletGroupSchema);
|
|
47
|
+
}
|
|
48
|
+
catch (error) {
|
|
49
|
+
(0, logger_js_1.backupAndSyncLogger)(`Error trying to format group for user storage usage: ${(0, errors_js_1.toErrorMessage)(error)}`);
|
|
50
|
+
// If anything goes wrong with this group, we use blank metadata for it.
|
|
51
|
+
return { groupIndex };
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
exports.formatGroupForUserStorageUsage = formatGroupForUserStorageUsage;
|
|
55
|
+
/**
|
|
56
|
+
* Parses the wallet from user storage response.
|
|
57
|
+
* This function attempts to parse the wallet data from a string format
|
|
58
|
+
* and returns it as a UserStorageSyncedWallet object.
|
|
59
|
+
*
|
|
60
|
+
* @param wallet - The wallet data in string format.
|
|
61
|
+
* @returns The parsed UserStorageSyncedWallet object.
|
|
62
|
+
* @throws If the wallet data is not in valid JSON format or fails validation.
|
|
63
|
+
*/
|
|
64
|
+
const parseWalletFromUserStorageResponse = (wallet) => {
|
|
65
|
+
try {
|
|
66
|
+
const walletData = JSON.parse(wallet);
|
|
67
|
+
(0, validation_js_1.assertValidUserStorageWallet)(walletData);
|
|
68
|
+
return walletData;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
throw new Error(`Error trying to parse wallet from user storage response: ${(0, errors_js_1.toErrorMessage)(error)}`);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
exports.parseWalletFromUserStorageResponse = parseWalletFromUserStorageResponse;
|
|
75
|
+
/**
|
|
76
|
+
* Parses the group from user storage response.
|
|
77
|
+
* This function attempts to parse the group data from a string format
|
|
78
|
+
* and returns it as a UserStorageSyncedWalletGroup object.
|
|
79
|
+
*
|
|
80
|
+
* @param group - The group data in string format.
|
|
81
|
+
* @returns The parsed UserStorageSyncedWalletGroup object.
|
|
82
|
+
* @throws If the group data is not in valid JSON format or fails validation.
|
|
83
|
+
*/
|
|
84
|
+
const parseGroupFromUserStorageResponse = (group) => {
|
|
85
|
+
try {
|
|
86
|
+
const groupData = JSON.parse(group);
|
|
87
|
+
(0, validation_js_1.assertValidUserStorageGroup)(groupData);
|
|
88
|
+
return groupData;
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
throw new Error(`Error trying to parse group from user storage response: ${(0, errors_js_1.toErrorMessage)(error)}`);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.parseGroupFromUserStorageResponse = parseGroupFromUserStorageResponse;
|
|
95
|
+
/**
|
|
96
|
+
* Parses the legacy account from user storage response.
|
|
97
|
+
* This function attempts to parse the account data from a string format
|
|
98
|
+
* and returns it as a LegacyUserStorageSyncedAccount object.
|
|
99
|
+
*
|
|
100
|
+
* @param account - The account data in string format.
|
|
101
|
+
* @returns The parsed LegacyUserStorageSyncedAccount object.
|
|
102
|
+
* @throws If the account data is not in valid JSON format or fails validation.
|
|
103
|
+
*/
|
|
104
|
+
const parseLegacyAccountFromUserStorageResponse = (account) => {
|
|
105
|
+
try {
|
|
106
|
+
const accountData = JSON.parse(account);
|
|
107
|
+
(0, validation_js_1.assertValidLegacyUserStorageAccount)(accountData);
|
|
108
|
+
return accountData;
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
throw new Error(`Error trying to parse legacy account from user storage response: ${(0, errors_js_1.toErrorMessage)(error)}`);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
exports.parseLegacyAccountFromUserStorageResponse = parseLegacyAccountFromUserStorageResponse;
|
|
115
|
+
//# sourceMappingURL=format-utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.cjs","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/format-utils.ts"],"names":[],"mappings":";;;AAAA,uDAA6C;AAG7C,gDAAsD;AAQtD,2CAAiE;AACjE,mDAAoD;AACpD,oDAIyB;AAEzB;;;;;;;;GAQG;AACI,MAAM,+BAA+B,GAAG,CAC7C,OAA6B,EAC7B,MAAkC,EACT,EAAE;IAC3B,2DAA2D;IAC3D,MAAM,uBAAuB,GAC3B,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAE7D,OAAO;QACL,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC;QAClC,8BAA8B,EAAE,IAAI,EAAE,yHAAyH;KAChK,CAAC;AACJ,CAAC,CAAC;AAZW,QAAA,+BAA+B,mCAY1C;AAEF;;;;;;;;GAQG;AACI,MAAM,8BAA8B,GAAG,CAC5C,OAA6B,EAC7B,KAA0C,EACZ,EAAE;IAChC,uFAAuF;IACvF,MAAM,sBAAsB,GAC1B,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;IAE9C,IAAI,CAAC;QACH,kFAAkF;QAClF,2BAA2B;QAC3B,OAAO,IAAA,kBAAI,EACT;YACE,GAAG,CAAC,sBAAsB,IAAI,EAAE,CAAC;YACjC,UAAU;SACX,EACD,6CAAkC,CACnC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,+BAAmB,EACjB,wDAAwD,IAAA,0BAAc,EAAC,KAAK,CAAC,EAAE,CAChF,CAAC;QAEF,wEAAwE;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,KAAK,CAAC,EAAE,CAC5F,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAZW,QAAA,yCAAyC,6CAYpD","sourcesContent":["import { mask } from '@metamask/superstruct';\n\nimport type { AccountGroupMultichainAccountObject } from '../../group.js';\nimport { backupAndSyncLogger } from '../../logger.js';\nimport type { AccountWalletEntropyObject } from '../../wallet.js';\nimport type {\n BackupAndSyncContext,\n LegacyUserStorageSyncedAccount,\n UserStorageSyncedWallet,\n UserStorageSyncedWalletGroup,\n} from '../types.js';\nimport { UserStorageSyncedWalletGroupSchema } from '../types.js';\nimport { toErrorMessage } from '../utils/errors.js';\nimport {\n assertValidUserStorageWallet,\n assertValidUserStorageGroup,\n assertValidLegacyUserStorageAccount,\n} from './validation.js';\n\n/**\n * Formats the wallet for user storage usage.\n * This function extracts the necessary metadata from the wallet\n * and formats it according to the user storage requirements.\n *\n * @param context - The backup and sync context.\n * @param wallet - The wallet object to format.\n * @returns The formatted wallet for user storage.\n */\nexport const formatWalletForUserStorageUsage = (\n context: BackupAndSyncContext,\n wallet: AccountWalletEntropyObject,\n): UserStorageSyncedWallet => {\n // This can be null if the user has not manually set a name\n const persistedWalletMetadata =\n context.controller.state.accountWalletsMetadata[wallet.id];\n\n return {\n ...(persistedWalletMetadata ?? {}),\n isLegacyAccountSyncingDisabled: true, // If we're here, it means legacy account syncing has been performed at least once, so we can disable it for this wallet.\n };\n};\n\n/**\n * Formats the group for user storage usage.\n * This function extracts the necessary metadata from the group\n * and formats it according to the user storage requirements.\n *\n * @param context - The backup and sync context.\n * @param group - The group object to format.\n * @returns The formatted group for user storage.\n */\nexport const formatGroupForUserStorageUsage = (\n context: BackupAndSyncContext,\n group: AccountGroupMultichainAccountObject,\n): UserStorageSyncedWalletGroup => {\n // This can be null if the user has not manually set a name, pinned or hidden the group\n const persistedGroupMetadata =\n context.controller.state.accountGroupsMetadata[group.id];\n const { groupIndex } = group.metadata.entropy;\n\n try {\n // We mask and we try catch, since `mask` will throw if the persisted metadata has\n // fields with wrong types.\n return mask(\n {\n ...(persistedGroupMetadata ?? {}),\n groupIndex,\n },\n UserStorageSyncedWalletGroupSchema,\n );\n } catch (error) {\n backupAndSyncLogger(\n `Error trying to format group for user storage usage: ${toErrorMessage(error)}`,\n );\n\n // If anything goes wrong with this group, we use blank metadata for it.\n return { groupIndex };\n }\n};\n\n/**\n * Parses the wallet from user storage response.\n * This function attempts to parse the wallet data from a string format\n * and returns it as a UserStorageSyncedWallet object.\n *\n * @param wallet - The wallet data in string format.\n * @returns The parsed UserStorageSyncedWallet object.\n * @throws If the wallet data is not in valid JSON format or fails validation.\n */\nexport const parseWalletFromUserStorageResponse = (\n wallet: string,\n): UserStorageSyncedWallet => {\n try {\n const walletData = JSON.parse(wallet);\n assertValidUserStorageWallet(walletData);\n return walletData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse wallet from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n\n/**\n * Parses the group from user storage response.\n * This function attempts to parse the group data from a string format\n * and returns it as a UserStorageSyncedWalletGroup object.\n *\n * @param group - The group data in string format.\n * @returns The parsed UserStorageSyncedWalletGroup object.\n * @throws If the group data is not in valid JSON format or fails validation.\n */\nexport const parseGroupFromUserStorageResponse = (\n group: string,\n): UserStorageSyncedWalletGroup => {\n try {\n const groupData = JSON.parse(group);\n assertValidUserStorageGroup(groupData);\n return groupData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse group from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n\n/**\n * Parses the legacy account from user storage response.\n * This function attempts to parse the account data from a string format\n * and returns it as a LegacyUserStorageSyncedAccount object.\n *\n * @param account - The account data in string format.\n * @returns The parsed LegacyUserStorageSyncedAccount object.\n * @throws If the account data is not in valid JSON format or fails validation.\n */\nexport const parseLegacyAccountFromUserStorageResponse = (\n account: string,\n): LegacyUserStorageSyncedAccount => {\n try {\n const accountData = JSON.parse(account);\n assertValidLegacyUserStorageAccount(accountData);\n return accountData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse legacy account from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AccountGroupMultichainAccountObject } from
|
|
2
|
-
import type { AccountWalletEntropyObject } from
|
|
3
|
-
import type { BackupAndSyncContext, LegacyUserStorageSyncedAccount, UserStorageSyncedWallet, UserStorageSyncedWalletGroup } from
|
|
1
|
+
import type { AccountGroupMultichainAccountObject } from "../../group.cjs";
|
|
2
|
+
import type { AccountWalletEntropyObject } from "../../wallet.cjs";
|
|
3
|
+
import type { BackupAndSyncContext, LegacyUserStorageSyncedAccount, UserStorageSyncedWallet, UserStorageSyncedWalletGroup } from "../types.cjs";
|
|
4
4
|
/**
|
|
5
5
|
* Formats the wallet for user storage usage.
|
|
6
6
|
* This function extracts the necessary metadata from the wallet
|
|
@@ -51,4 +51,4 @@ export declare const parseGroupFromUserStorageResponse: (group: string) => UserS
|
|
|
51
51
|
* @throws If the account data is not in valid JSON format or fails validation.
|
|
52
52
|
*/
|
|
53
53
|
export declare const parseLegacyAccountFromUserStorageResponse: (account: string) => LegacyUserStorageSyncedAccount;
|
|
54
|
-
//# sourceMappingURL=format-utils.d.
|
|
54
|
+
//# sourceMappingURL=format-utils.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.d.cts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/format-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mCAAmC,EAAE,wBAAuB;AAE1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAwB;AAClE,OAAO,KAAK,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,qBAAoB;AASrB;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,YACjC,oBAAoB,UACrB,0BAA0B,KACjC,uBASF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,YAChC,oBAAoB,SACtB,mCAAmC,KACzC,4BAwBF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,WACrC,MAAM,KACb,uBAUF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,UACrC,MAAM,KACZ,4BAUF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC,YAC3C,MAAM,KACd,8BAUF,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { AccountGroupMultichainAccountObject } from "../../group.mjs";
|
|
2
|
+
import type { AccountWalletEntropyObject } from "../../wallet.mjs";
|
|
3
|
+
import type { BackupAndSyncContext, LegacyUserStorageSyncedAccount, UserStorageSyncedWallet, UserStorageSyncedWalletGroup } from "../types.mjs";
|
|
4
|
+
/**
|
|
5
|
+
* Formats the wallet for user storage usage.
|
|
6
|
+
* This function extracts the necessary metadata from the wallet
|
|
7
|
+
* and formats it according to the user storage requirements.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The backup and sync context.
|
|
10
|
+
* @param wallet - The wallet object to format.
|
|
11
|
+
* @returns The formatted wallet for user storage.
|
|
12
|
+
*/
|
|
13
|
+
export declare const formatWalletForUserStorageUsage: (context: BackupAndSyncContext, wallet: AccountWalletEntropyObject) => UserStorageSyncedWallet;
|
|
14
|
+
/**
|
|
15
|
+
* Formats the group for user storage usage.
|
|
16
|
+
* This function extracts the necessary metadata from the group
|
|
17
|
+
* and formats it according to the user storage requirements.
|
|
18
|
+
*
|
|
19
|
+
* @param context - The backup and sync context.
|
|
20
|
+
* @param group - The group object to format.
|
|
21
|
+
* @returns The formatted group for user storage.
|
|
22
|
+
*/
|
|
23
|
+
export declare const formatGroupForUserStorageUsage: (context: BackupAndSyncContext, group: AccountGroupMultichainAccountObject) => UserStorageSyncedWalletGroup;
|
|
24
|
+
/**
|
|
25
|
+
* Parses the wallet from user storage response.
|
|
26
|
+
* This function attempts to parse the wallet data from a string format
|
|
27
|
+
* and returns it as a UserStorageSyncedWallet object.
|
|
28
|
+
*
|
|
29
|
+
* @param wallet - The wallet data in string format.
|
|
30
|
+
* @returns The parsed UserStorageSyncedWallet object.
|
|
31
|
+
* @throws If the wallet data is not in valid JSON format or fails validation.
|
|
32
|
+
*/
|
|
33
|
+
export declare const parseWalletFromUserStorageResponse: (wallet: string) => UserStorageSyncedWallet;
|
|
34
|
+
/**
|
|
35
|
+
* Parses the group from user storage response.
|
|
36
|
+
* This function attempts to parse the group data from a string format
|
|
37
|
+
* and returns it as a UserStorageSyncedWalletGroup object.
|
|
38
|
+
*
|
|
39
|
+
* @param group - The group data in string format.
|
|
40
|
+
* @returns The parsed UserStorageSyncedWalletGroup object.
|
|
41
|
+
* @throws If the group data is not in valid JSON format or fails validation.
|
|
42
|
+
*/
|
|
43
|
+
export declare const parseGroupFromUserStorageResponse: (group: string) => UserStorageSyncedWalletGroup;
|
|
44
|
+
/**
|
|
45
|
+
* Parses the legacy account from user storage response.
|
|
46
|
+
* This function attempts to parse the account data from a string format
|
|
47
|
+
* and returns it as a LegacyUserStorageSyncedAccount object.
|
|
48
|
+
*
|
|
49
|
+
* @param account - The account data in string format.
|
|
50
|
+
* @returns The parsed LegacyUserStorageSyncedAccount object.
|
|
51
|
+
* @throws If the account data is not in valid JSON format or fails validation.
|
|
52
|
+
*/
|
|
53
|
+
export declare const parseLegacyAccountFromUserStorageResponse: (account: string) => LegacyUserStorageSyncedAccount;
|
|
54
|
+
//# sourceMappingURL=format-utils.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.d.mts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/format-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mCAAmC,EAAE,wBAAuB;AAE1E,OAAO,KAAK,EAAE,0BAA0B,EAAE,yBAAwB;AAClE,OAAO,KAAK,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,uBAAuB,EACvB,4BAA4B,EAC7B,qBAAoB;AASrB;;;;;;;;GAQG;AACH,eAAO,MAAM,+BAA+B,YACjC,oBAAoB,UACrB,0BAA0B,KACjC,uBASF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,YAChC,oBAAoB,SACtB,mCAAmC,KACzC,4BAwBF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kCAAkC,WACrC,MAAM,KACb,uBAUF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iCAAiC,UACrC,MAAM,KACZ,4BAUF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yCAAyC,YAC3C,MAAM,KACd,8BAUF,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { mask } from
|
|
2
|
-
import { backupAndSyncLogger } from
|
|
3
|
-
import { UserStorageSyncedWalletGroupSchema } from
|
|
4
|
-
import { toErrorMessage } from
|
|
5
|
-
import { assertValidUserStorageWallet, assertValidUserStorageGroup, assertValidLegacyUserStorageAccount
|
|
1
|
+
import { mask } from "@metamask/superstruct";
|
|
2
|
+
import { backupAndSyncLogger } from "../../logger.mjs";
|
|
3
|
+
import { UserStorageSyncedWalletGroupSchema } from "../types.mjs";
|
|
4
|
+
import { toErrorMessage } from "../utils/errors.mjs";
|
|
5
|
+
import { assertValidUserStorageWallet, assertValidUserStorageGroup, assertValidLegacyUserStorageAccount } from "./validation.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Formats the wallet for user storage usage.
|
|
8
8
|
* This function extracts the necessary metadata from the wallet
|
|
@@ -104,4 +104,4 @@ export const parseLegacyAccountFromUserStorageResponse = (account) => {
|
|
|
104
104
|
throw new Error(`Error trying to parse legacy account from user storage response: ${toErrorMessage(error)}`);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
|
-
//# sourceMappingURL=format-utils.
|
|
107
|
+
//# sourceMappingURL=format-utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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@metamask/superstruct';\n\nimport type { AccountGroupMultichainAccountObject } from '../../group.js';\nimport { backupAndSyncLogger } from '../../logger.js';\nimport type { AccountWalletEntropyObject } from '../../wallet.js';\nimport type {\n BackupAndSyncContext,\n LegacyUserStorageSyncedAccount,\n UserStorageSyncedWallet,\n UserStorageSyncedWalletGroup,\n} from '../types.js';\nimport { UserStorageSyncedWalletGroupSchema } from '../types.js';\nimport { toErrorMessage } from '../utils/errors.js';\nimport {\n assertValidUserStorageWallet,\n assertValidUserStorageGroup,\n assertValidLegacyUserStorageAccount,\n} from './validation.js';\n\n/**\n * Formats the wallet for user storage usage.\n * This function extracts the necessary metadata from the wallet\n * and formats it according to the user storage requirements.\n *\n * @param context - The backup and sync context.\n * @param wallet - The wallet object to format.\n * @returns The formatted wallet for user storage.\n */\nexport const formatWalletForUserStorageUsage = (\n context: BackupAndSyncContext,\n wallet: AccountWalletEntropyObject,\n): UserStorageSyncedWallet => {\n // This can be null if the user has not manually set a name\n const persistedWalletMetadata =\n context.controller.state.accountWalletsMetadata[wallet.id];\n\n return {\n ...(persistedWalletMetadata ?? {}),\n isLegacyAccountSyncingDisabled: true, // If we're here, it means legacy account syncing has been performed at least once, so we can disable it for this wallet.\n };\n};\n\n/**\n * Formats the group for user storage usage.\n * This function extracts the necessary metadata from the group\n * and formats it according to the user storage requirements.\n *\n * @param context - The backup and sync context.\n * @param group - The group object to format.\n * @returns The formatted group for user storage.\n */\nexport const formatGroupForUserStorageUsage = (\n context: BackupAndSyncContext,\n group: AccountGroupMultichainAccountObject,\n): UserStorageSyncedWalletGroup => {\n // This can be null if the user has not manually set a name, pinned or hidden the group\n const persistedGroupMetadata =\n context.controller.state.accountGroupsMetadata[group.id];\n const { groupIndex } = group.metadata.entropy;\n\n try {\n // We mask and we try catch, since `mask` will throw if the persisted metadata has\n // fields with wrong types.\n return mask(\n {\n ...(persistedGroupMetadata ?? {}),\n groupIndex,\n },\n UserStorageSyncedWalletGroupSchema,\n );\n } catch (error) {\n backupAndSyncLogger(\n `Error trying to format group for user storage usage: ${toErrorMessage(error)}`,\n );\n\n // If anything goes wrong with this group, we use blank metadata for it.\n return { groupIndex };\n }\n};\n\n/**\n * Parses the wallet from user storage response.\n * This function attempts to parse the wallet data from a string format\n * and returns it as a UserStorageSyncedWallet object.\n *\n * @param wallet - The wallet data in string format.\n * @returns The parsed UserStorageSyncedWallet object.\n * @throws If the wallet data is not in valid JSON format or fails validation.\n */\nexport const parseWalletFromUserStorageResponse = (\n wallet: string,\n): UserStorageSyncedWallet => {\n try {\n const walletData = JSON.parse(wallet);\n assertValidUserStorageWallet(walletData);\n return walletData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse wallet from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n\n/**\n * Parses the group from user storage response.\n * This function attempts to parse the group data from a string format\n * and returns it as a UserStorageSyncedWalletGroup object.\n *\n * @param group - The group data in string format.\n * @returns The parsed UserStorageSyncedWalletGroup object.\n * @throws If the group data is not in valid JSON format or fails validation.\n */\nexport const parseGroupFromUserStorageResponse = (\n group: string,\n): UserStorageSyncedWalletGroup => {\n try {\n const groupData = JSON.parse(group);\n assertValidUserStorageGroup(groupData);\n return groupData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse group from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n\n/**\n * Parses the legacy account from user storage response.\n * This function attempts to parse the account data from a string format\n * and returns it as a LegacyUserStorageSyncedAccount object.\n *\n * @param account - The account data in string format.\n * @returns The parsed LegacyUserStorageSyncedAccount object.\n * @throws If the account data is not in valid JSON format or fails validation.\n */\nexport const parseLegacyAccountFromUserStorageResponse = (\n account: string,\n): LegacyUserStorageSyncedAccount => {\n try {\n const accountData = JSON.parse(account);\n assertValidLegacyUserStorageAccount(accountData);\n return accountData;\n } catch (error: unknown) {\n throw new Error(\n `Error trying to parse legacy account from user storage response: ${toErrorMessage(error)}`,\n );\n }\n};\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./format-utils.cjs"), exports);
|
|
18
|
+
__exportStar(require("./network-utils.cjs"), exports);
|
|
19
|
+
__exportStar(require("./network-operations.cjs"), exports);
|
|
20
|
+
__exportStar(require("./validation.cjs"), exports);
|
|
21
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAkC;AAClC,sDAAmC;AACnC,2DAAwC;AACxC,mDAAgC","sourcesContent":["export * from './format-utils.js';\nexport * from './network-utils.js';\nexport * from './network-operations.js';\nexport * from './validation.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/index.ts"],"names":[],"mappings":"AAAA,mCAAkC;AAClC,oCAAmC;AACnC,yCAAwC;AACxC,iCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/index.ts"],"names":[],"mappings":"AAAA,mCAAkC;AAClC,oCAAmC;AACnC,yCAAwC;AACxC,iCAAgC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/backup-and-sync/user-storage/index.ts"],"names":[],"mappings":"AAAA,mCAAkC;AAClC,oCAAmC;AACnC,yCAAwC;AACxC,iCAAgC","sourcesContent":["export * from './format-utils.js';\nexport * from './network-utils.js';\nexport * from './network-operations.js';\nexport * from './validation.js';\n"]}
|