@metamask-previews/bridge-status-controller 75.3.0-preview-3e34650c2 → 75.4.0-preview-4f4c98e
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 +13 -1
- package/dist/{bridge-status-controller-method-action-types.d.mts → bridge-status-controller-method-action-types.d.ts} +2 -2
- package/dist/bridge-status-controller-method-action-types.d.ts.map +1 -0
- package/dist/{bridge-status-controller-method-action-types.mjs → bridge-status-controller-method-action-types.js} +1 -1
- package/dist/bridge-status-controller-method-action-types.js.map +1 -0
- package/dist/{bridge-status-controller.d.cts → bridge-status-controller.d.ts} +20 -20
- package/dist/bridge-status-controller.d.ts.map +1 -0
- package/dist/{bridge-status-controller.intent.d.cts → bridge-status-controller.intent.d.ts} +6 -6
- package/dist/bridge-status-controller.intent.d.ts.map +1 -0
- package/dist/{bridge-status-controller.intent.mjs → bridge-status-controller.intent.js} +10 -11
- package/dist/bridge-status-controller.intent.js.map +1 -0
- package/dist/{bridge-status-controller.mjs → bridge-status-controller.js} +33 -31
- package/dist/bridge-status-controller.js.map +1 -0
- package/dist/{constants.d.cts → constants.d.ts} +3 -3
- package/dist/constants.d.ts.map +1 -0
- package/dist/{constants.mjs → constants.js} +2 -2
- package/dist/constants.js.map +1 -0
- package/dist/{index.d.cts → index.d.ts} +9 -9
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/quote-status-manager/{constants.d.mts → constants.d.ts} +1 -1
- package/dist/quote-status-manager/constants.d.ts.map +1 -0
- package/dist/quote-status-manager/{constants.mjs → constants.js} +1 -1
- package/dist/quote-status-manager/constants.js.map +1 -0
- package/dist/quote-status-manager/{errors.d.mts → errors.d.ts} +2 -2
- package/dist/quote-status-manager/errors.d.ts.map +1 -0
- package/dist/quote-status-manager/{errors.mjs → errors.js} +1 -1
- package/dist/quote-status-manager/errors.js.map +1 -0
- package/dist/quote-status-manager/{quote-status-api-service.d.cts → quote-status-api-service.d.ts} +5 -5
- package/dist/quote-status-manager/quote-status-api-service.d.ts.map +1 -0
- package/dist/quote-status-manager/{quote-status-api-service.mjs → quote-status-api-service.js} +10 -11
- package/dist/quote-status-manager/quote-status-api-service.js.map +1 -0
- package/dist/quote-status-manager/{quote-status-entry-store.d.cts → quote-status-entry-store.d.ts} +2 -2
- package/dist/quote-status-manager/quote-status-entry-store.d.ts.map +1 -0
- package/dist/quote-status-manager/{quote-status-entry-store.mjs → quote-status-entry-store.js} +3 -3
- package/dist/quote-status-manager/quote-status-entry-store.js.map +1 -0
- package/dist/quote-status-manager/{quote-status-get-with-retry-outcome.d.mts → quote-status-get-with-retry-outcome.d.ts} +4 -4
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.ts.map +1 -0
- package/dist/quote-status-manager/{quote-status-get-with-retry-outcome.mjs → quote-status-get-with-retry-outcome.js} +1 -3
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.js.map +1 -0
- package/dist/quote-status-manager/{quote-status-state-fsm.d.cts → quote-status-state-fsm.d.ts} +3 -3
- package/dist/quote-status-manager/quote-status-state-fsm.d.ts.map +1 -0
- package/dist/quote-status-manager/{quote-status-state-fsm.mjs → quote-status-state-fsm.js} +2 -2
- package/dist/quote-status-manager/quote-status-state-fsm.js.map +1 -0
- package/dist/quote-status-manager/{quote-status-update-with-retry-outcome.d.mts → quote-status-update-with-retry-outcome.d.ts} +3 -3
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.ts.map +1 -0
- package/dist/quote-status-manager/{quote-status-update-with-retry-outcome.mjs → quote-status-update-with-retry-outcome.js} +1 -2
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.js.map +1 -0
- package/dist/quote-status-manager/{quotes-status-manager.d.cts → quotes-status-manager.d.ts} +5 -5
- package/dist/quote-status-manager/quotes-status-manager.d.ts.map +1 -0
- package/dist/quote-status-manager/{quotes-status-manager.mjs → quotes-status-manager.js} +8 -11
- package/dist/quote-status-manager/quotes-status-manager.js.map +1 -0
- package/dist/quote-status-manager/{types.d.cts → types.d.ts} +8 -8
- package/dist/quote-status-manager/types.d.ts.map +1 -0
- package/dist/quote-status-manager/types.js +2 -0
- package/dist/quote-status-manager/types.js.map +1 -0
- package/dist/quote-status-manager/{utils.d.mts → utils.d.ts} +1 -1
- package/dist/quote-status-manager/utils.d.ts.map +1 -0
- package/dist/quote-status-manager/{utils.mjs → utils.js} +1 -1
- package/dist/quote-status-manager/utils.js.map +1 -0
- package/dist/quote-status-manager/{validators.d.cts → validators.d.ts} +43 -43
- package/dist/quote-status-manager/validators.d.ts.map +1 -0
- package/dist/quote-status-manager/{validators.mjs → validators.js} +4 -4
- package/dist/quote-status-manager/validators.js.map +1 -0
- package/dist/strategy/{batch-sell-strategy.d.mts → batch-sell-strategy.d.ts} +3 -3
- package/dist/strategy/batch-sell-strategy.d.ts.map +1 -0
- package/dist/strategy/{batch-sell-strategy.mjs → batch-sell-strategy.js} +4 -4
- package/dist/strategy/batch-sell-strategy.js.map +1 -0
- package/dist/strategy/{batch-strategy.d.cts → batch-strategy.d.ts} +3 -3
- package/dist/strategy/batch-strategy.d.ts.map +1 -0
- package/dist/strategy/{batch-strategy.mjs → batch-strategy.js} +3 -3
- package/dist/strategy/batch-strategy.js.map +1 -0
- package/dist/strategy/{evm-strategy.d.mts → evm-strategy.d.ts} +8 -8
- package/dist/strategy/evm-strategy.d.ts.map +1 -0
- package/dist/strategy/{evm-strategy.mjs → evm-strategy.js} +8 -8
- package/dist/strategy/evm-strategy.js.map +1 -0
- package/dist/strategy/{index.d.cts → index.d.ts} +3 -3
- package/dist/strategy/index.d.ts.map +1 -0
- package/dist/strategy/{index.mjs → index.js} +7 -7
- package/dist/strategy/index.js.map +1 -0
- package/dist/strategy/{intent-strategy.d.cts → intent-strategy.d.ts} +3 -3
- package/dist/strategy/intent-strategy.d.ts.map +1 -0
- package/dist/strategy/{intent-strategy.mjs → intent-strategy.js} +10 -10
- package/dist/strategy/{intent-strategy.cjs.map → intent-strategy.js.map} +1 -1
- package/dist/strategy/{non-evm-strategy.d.cts → non-evm-strategy.d.ts} +3 -3
- package/dist/strategy/non-evm-strategy.d.ts.map +1 -0
- package/dist/strategy/{non-evm-strategy.mjs → non-evm-strategy.js} +6 -6
- package/dist/strategy/non-evm-strategy.js.map +1 -0
- package/dist/strategy/{types.d.cts → types.d.ts} +7 -7
- package/dist/strategy/types.d.ts.map +1 -0
- package/dist/strategy/{types.mjs → types.js} +1 -1
- package/dist/strategy/types.js.map +1 -0
- package/dist/{types.d.cts → types.d.ts} +23 -17
- package/dist/types.d.ts.map +1 -0
- package/dist/{types.mjs → types.js} +1 -4
- package/dist/types.js.map +1 -0
- package/dist/utils/{accounts.d.cts → accounts.d.ts} +7 -7
- package/dist/utils/accounts.d.ts.map +1 -0
- package/dist/utils/{accounts.mjs → accounts.js} +1 -1
- package/dist/utils/accounts.js.map +1 -0
- package/dist/utils/authentication.d.ts +3 -0
- package/dist/utils/authentication.d.ts.map +1 -0
- package/dist/utils/{authentication.mjs → authentication.js} +1 -1
- package/dist/utils/authentication.js.map +1 -0
- package/dist/utils/{bridge-status.d.cts → bridge-status.d.ts} +4 -4
- package/dist/utils/bridge-status.d.ts.map +1 -0
- package/dist/utils/{bridge-status.mjs → bridge-status.js} +7 -8
- package/dist/utils/bridge-status.js.map +1 -0
- package/dist/utils/{bridge.d.cts → bridge.d.ts} +3 -3
- package/dist/utils/bridge.d.ts.map +1 -0
- package/dist/utils/{bridge.mjs → bridge.js} +2 -2
- package/dist/utils/bridge.js.map +1 -0
- package/dist/utils/{feature-flags.d.cts → feature-flags.d.ts} +2 -2
- package/dist/utils/feature-flags.d.ts.map +1 -0
- package/dist/utils/{feature-flags.mjs → feature-flags.js} +3 -3
- package/dist/utils/feature-flags.js.map +1 -0
- package/dist/utils/{gas.d.mts → gas.d.ts} +4 -4
- package/dist/utils/gas.d.ts.map +1 -0
- package/dist/utils/{gas.mjs → gas.js} +2 -2
- package/dist/utils/gas.js.map +1 -0
- package/dist/utils/{history.d.cts → history.d.ts} +3 -3
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/{history.mjs → history.js} +5 -4
- package/dist/utils/history.js.map +1 -0
- package/dist/utils/{intent-api.d.cts → intent-api.d.ts} +5 -5
- package/dist/utils/intent-api.d.ts.map +1 -0
- package/dist/utils/{intent-api.mjs → intent-api.js} +4 -4
- package/dist/utils/intent-api.js.map +1 -0
- package/dist/utils/{keyring.d.cts → keyring.d.ts} +3 -3
- package/dist/utils/keyring.d.ts.map +1 -0
- package/dist/utils/{keyring.mjs → keyring.js} +2 -2
- package/dist/utils/keyring.js.map +1 -0
- package/dist/utils/{metrics.d.cts → metrics.d.ts} +26 -23
- package/dist/utils/metrics.d.ts.map +1 -0
- package/dist/utils/{metrics.mjs → metrics.js} +23 -11
- package/dist/utils/metrics.js.map +1 -0
- package/dist/utils/{network.d.cts → network.d.ts} +4 -4
- package/dist/utils/network.d.ts.map +1 -0
- package/dist/utils/{network.mjs → network.js} +2 -2
- package/dist/utils/network.js.map +1 -0
- package/dist/utils/{snaps.d.cts → snaps.d.ts} +8 -8
- package/dist/utils/snaps.d.ts.map +1 -0
- package/dist/utils/{snaps.mjs → snaps.js} +4 -5
- package/dist/utils/snaps.js.map +1 -0
- package/dist/utils/{swap-received-amount.d.mts → swap-received-amount.d.ts} +5 -5
- package/dist/utils/swap-received-amount.d.ts.map +1 -0
- package/dist/utils/{swap-received-amount.mjs → swap-received-amount.js} +3 -3
- package/dist/utils/swap-received-amount.js.map +1 -0
- package/dist/utils/{trace.d.cts → trace.d.ts} +7 -7
- package/dist/utils/trace.d.ts.map +1 -0
- package/dist/utils/{trace.mjs → trace.js} +3 -3
- package/dist/utils/trace.js.map +1 -0
- package/dist/utils/{transaction.d.mts → transaction.d.ts} +17 -17
- package/dist/utils/transaction.d.ts.map +1 -0
- package/dist/utils/{transaction.mjs → transaction.js} +8 -8
- package/dist/utils/transaction.js.map +1 -0
- package/dist/utils/{validators.d.cts → validators.d.ts} +39 -82
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/{validators.mjs → validators.js} +3 -3
- package/dist/utils/validators.js.map +1 -0
- package/package.json +14 -18
- package/dist/bridge-status-controller-method-action-types.cjs +0 -7
- package/dist/bridge-status-controller-method-action-types.cjs.map +0 -1
- package/dist/bridge-status-controller-method-action-types.d.cts +0 -42
- package/dist/bridge-status-controller-method-action-types.d.cts.map +0 -1
- package/dist/bridge-status-controller-method-action-types.d.mts.map +0 -1
- package/dist/bridge-status-controller-method-action-types.mjs.map +0 -1
- package/dist/bridge-status-controller.cjs +0 -1141
- package/dist/bridge-status-controller.cjs.map +0 -1
- package/dist/bridge-status-controller.d.cts.map +0 -1
- package/dist/bridge-status-controller.d.mts +0 -155
- package/dist/bridge-status-controller.d.mts.map +0 -1
- package/dist/bridge-status-controller.intent.cjs +0 -116
- package/dist/bridge-status-controller.intent.cjs.map +0 -1
- package/dist/bridge-status-controller.intent.d.cts.map +0 -1
- package/dist/bridge-status-controller.intent.d.mts +0 -36
- package/dist/bridge-status-controller.intent.d.mts.map +0 -1
- package/dist/bridge-status-controller.intent.mjs.map +0 -1
- package/dist/bridge-status-controller.mjs.map +0 -1
- package/dist/constants.cjs +0 -31
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.mts +0 -18
- package/dist/constants.d.mts.map +0 -1
- package/dist/constants.mjs.map +0 -1
- package/dist/index.cjs +0 -24
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -9
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -9
- package/dist/index.mjs.map +0 -1
- package/dist/quote-status-manager/constants.cjs +0 -196
- package/dist/quote-status-manager/constants.cjs.map +0 -1
- package/dist/quote-status-manager/constants.d.cts +0 -152
- package/dist/quote-status-manager/constants.d.cts.map +0 -1
- package/dist/quote-status-manager/constants.d.mts.map +0 -1
- package/dist/quote-status-manager/constants.mjs.map +0 -1
- package/dist/quote-status-manager/errors.cjs +0 -57
- package/dist/quote-status-manager/errors.cjs.map +0 -1
- package/dist/quote-status-manager/errors.d.cts +0 -51
- package/dist/quote-status-manager/errors.d.cts.map +0 -1
- package/dist/quote-status-manager/errors.d.mts.map +0 -1
- package/dist/quote-status-manager/errors.mjs.map +0 -1
- package/dist/quote-status-manager/quote-status-api-service.cjs +0 -241
- package/dist/quote-status-manager/quote-status-api-service.cjs.map +0 -1
- package/dist/quote-status-manager/quote-status-api-service.d.cts.map +0 -1
- package/dist/quote-status-manager/quote-status-api-service.d.mts +0 -93
- package/dist/quote-status-manager/quote-status-api-service.d.mts.map +0 -1
- package/dist/quote-status-manager/quote-status-api-service.mjs.map +0 -1
- package/dist/quote-status-manager/quote-status-entry-store.cjs +0 -293
- package/dist/quote-status-manager/quote-status-entry-store.cjs.map +0 -1
- package/dist/quote-status-manager/quote-status-entry-store.d.cts.map +0 -1
- package/dist/quote-status-manager/quote-status-entry-store.d.mts +0 -157
- package/dist/quote-status-manager/quote-status-entry-store.d.mts.map +0 -1
- package/dist/quote-status-manager/quote-status-entry-store.mjs.map +0 -1
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs +0 -29
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.cjs.map +0 -1
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts +0 -32
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.cts.map +0 -1
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.d.mts.map +0 -1
- package/dist/quote-status-manager/quote-status-get-with-retry-outcome.mjs.map +0 -1
- package/dist/quote-status-manager/quote-status-state-fsm.cjs +0 -107
- package/dist/quote-status-manager/quote-status-state-fsm.cjs.map +0 -1
- package/dist/quote-status-manager/quote-status-state-fsm.d.cts.map +0 -1
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts +0 -57
- package/dist/quote-status-manager/quote-status-state-fsm.d.mts.map +0 -1
- package/dist/quote-status-manager/quote-status-state-fsm.mjs.map +0 -1
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs +0 -27
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.cjs.map +0 -1
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts +0 -30
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.cts.map +0 -1
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.d.mts.map +0 -1
- package/dist/quote-status-manager/quote-status-update-with-retry-outcome.mjs.map +0 -1
- package/dist/quote-status-manager/quotes-status-manager.cjs +0 -506
- package/dist/quote-status-manager/quotes-status-manager.cjs.map +0 -1
- package/dist/quote-status-manager/quotes-status-manager.d.cts.map +0 -1
- package/dist/quote-status-manager/quotes-status-manager.d.mts +0 -135
- package/dist/quote-status-manager/quotes-status-manager.d.mts.map +0 -1
- package/dist/quote-status-manager/quotes-status-manager.mjs.map +0 -1
- package/dist/quote-status-manager/types.cjs +0 -8
- package/dist/quote-status-manager/types.cjs.map +0 -1
- package/dist/quote-status-manager/types.d.cts.map +0 -1
- package/dist/quote-status-manager/types.d.mts +0 -164
- package/dist/quote-status-manager/types.d.mts.map +0 -1
- package/dist/quote-status-manager/types.mjs +0 -6
- package/dist/quote-status-manager/types.mjs.map +0 -1
- package/dist/quote-status-manager/utils.cjs +0 -11
- package/dist/quote-status-manager/utils.cjs.map +0 -1
- package/dist/quote-status-manager/utils.d.cts +0 -7
- package/dist/quote-status-manager/utils.d.cts.map +0 -1
- package/dist/quote-status-manager/utils.d.mts.map +0 -1
- package/dist/quote-status-manager/utils.mjs.map +0 -1
- package/dist/quote-status-manager/validators.cjs +0 -44
- package/dist/quote-status-manager/validators.cjs.map +0 -1
- package/dist/quote-status-manager/validators.d.cts.map +0 -1
- package/dist/quote-status-manager/validators.d.mts +0 -172
- package/dist/quote-status-manager/validators.d.mts.map +0 -1
- package/dist/quote-status-manager/validators.mjs.map +0 -1
- package/dist/strategy/batch-sell-strategy.cjs +0 -113
- package/dist/strategy/batch-sell-strategy.cjs.map +0 -1
- package/dist/strategy/batch-sell-strategy.d.cts +0 -10
- package/dist/strategy/batch-sell-strategy.d.cts.map +0 -1
- package/dist/strategy/batch-sell-strategy.d.mts.map +0 -1
- package/dist/strategy/batch-sell-strategy.mjs.map +0 -1
- package/dist/strategy/batch-strategy.cjs +0 -64
- package/dist/strategy/batch-strategy.cjs.map +0 -1
- package/dist/strategy/batch-strategy.d.cts.map +0 -1
- package/dist/strategy/batch-strategy.d.mts +0 -10
- package/dist/strategy/batch-strategy.d.mts.map +0 -1
- package/dist/strategy/batch-strategy.mjs.map +0 -1
- package/dist/strategy/evm-strategy.cjs +0 -149
- package/dist/strategy/evm-strategy.cjs.map +0 -1
- package/dist/strategy/evm-strategy.d.cts +0 -38
- package/dist/strategy/evm-strategy.d.cts.map +0 -1
- package/dist/strategy/evm-strategy.d.mts.map +0 -1
- package/dist/strategy/evm-strategy.mjs.map +0 -1
- package/dist/strategy/index.cjs +0 -72
- package/dist/strategy/index.cjs.map +0 -1
- package/dist/strategy/index.d.cts.map +0 -1
- package/dist/strategy/index.d.mts +0 -12
- package/dist/strategy/index.d.mts.map +0 -1
- package/dist/strategy/index.mjs.map +0 -1
- package/dist/strategy/intent-strategy.cjs +0 -160
- package/dist/strategy/intent-strategy.d.cts.map +0 -1
- package/dist/strategy/intent-strategy.d.mts +0 -17
- package/dist/strategy/intent-strategy.d.mts.map +0 -1
- package/dist/strategy/intent-strategy.mjs.map +0 -1
- package/dist/strategy/non-evm-strategy.cjs +0 -80
- package/dist/strategy/non-evm-strategy.cjs.map +0 -1
- package/dist/strategy/non-evm-strategy.d.cts.map +0 -1
- package/dist/strategy/non-evm-strategy.d.mts +0 -15
- package/dist/strategy/non-evm-strategy.d.mts.map +0 -1
- package/dist/strategy/non-evm-strategy.mjs.map +0 -1
- package/dist/strategy/types.cjs +0 -33
- package/dist/strategy/types.cjs.map +0 -1
- package/dist/strategy/types.d.cts.map +0 -1
- package/dist/strategy/types.d.mts +0 -116
- package/dist/strategy/types.d.mts.map +0 -1
- package/dist/strategy/types.mjs.map +0 -1
- package/dist/types.cjs +0 -44
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts +0 -302
- package/dist/types.d.mts.map +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/utils/accounts.cjs +0 -8
- package/dist/utils/accounts.cjs.map +0 -1
- package/dist/utils/accounts.d.cts.map +0 -1
- package/dist/utils/accounts.d.mts +0 -34
- package/dist/utils/accounts.d.mts.map +0 -1
- package/dist/utils/accounts.mjs.map +0 -1
- package/dist/utils/authentication.cjs +0 -15
- package/dist/utils/authentication.cjs.map +0 -1
- package/dist/utils/authentication.d.cts +0 -3
- package/dist/utils/authentication.d.cts.map +0 -1
- package/dist/utils/authentication.d.mts +0 -3
- package/dist/utils/authentication.d.mts.map +0 -1
- package/dist/utils/authentication.mjs.map +0 -1
- package/dist/utils/bridge-status.cjs +0 -157
- package/dist/utils/bridge-status.cjs.map +0 -1
- package/dist/utils/bridge-status.d.cts.map +0 -1
- package/dist/utils/bridge-status.d.mts +0 -23
- package/dist/utils/bridge-status.d.mts.map +0 -1
- package/dist/utils/bridge-status.mjs.map +0 -1
- package/dist/utils/bridge.cjs +0 -17
- package/dist/utils/bridge.cjs.map +0 -1
- package/dist/utils/bridge.d.cts.map +0 -1
- package/dist/utils/bridge.d.mts +0 -10
- package/dist/utils/bridge.d.mts.map +0 -1
- package/dist/utils/bridge.mjs.map +0 -1
- package/dist/utils/feature-flags.cjs +0 -12
- package/dist/utils/feature-flags.cjs.map +0 -1
- package/dist/utils/feature-flags.d.cts.map +0 -1
- package/dist/utils/feature-flags.d.mts +0 -3
- package/dist/utils/feature-flags.d.mts.map +0 -1
- package/dist/utils/feature-flags.mjs.map +0 -1
- package/dist/utils/gas.cjs +0 -35
- package/dist/utils/gas.cjs.map +0 -1
- package/dist/utils/gas.d.cts +0 -14
- package/dist/utils/gas.d.cts.map +0 -1
- package/dist/utils/gas.d.mts.map +0 -1
- package/dist/utils/gas.mjs.map +0 -1
- package/dist/utils/history.cjs +0 -199
- package/dist/utils/history.cjs.map +0 -1
- package/dist/utils/history.d.cts.map +0 -1
- package/dist/utils/history.d.mts +0 -54
- package/dist/utils/history.d.mts.map +0 -1
- package/dist/utils/history.mjs.map +0 -1
- package/dist/utils/intent-api.cjs +0 -143
- package/dist/utils/intent-api.cjs.map +0 -1
- package/dist/utils/intent-api.d.cts.map +0 -1
- package/dist/utils/intent-api.d.mts +0 -44
- package/dist/utils/intent-api.d.mts.map +0 -1
- package/dist/utils/intent-api.mjs.map +0 -1
- package/dist/utils/keyring.cjs +0 -12
- package/dist/utils/keyring.cjs.map +0 -1
- package/dist/utils/keyring.d.cts.map +0 -1
- package/dist/utils/keyring.d.mts +0 -8
- package/dist/utils/keyring.d.mts.map +0 -1
- package/dist/utils/keyring.mjs.map +0 -1
- package/dist/utils/metrics.cjs +0 -236
- package/dist/utils/metrics.cjs.map +0 -1
- package/dist/utils/metrics.d.cts.map +0 -1
- package/dist/utils/metrics.d.mts +0 -117
- package/dist/utils/metrics.d.mts.map +0 -1
- package/dist/utils/metrics.mjs.map +0 -1
- package/dist/utils/network.cjs +0 -23
- package/dist/utils/network.cjs.map +0 -1
- package/dist/utils/network.d.cts.map +0 -1
- package/dist/utils/network.d.mts +0 -7
- package/dist/utils/network.d.mts.map +0 -1
- package/dist/utils/network.mjs.map +0 -1
- package/dist/utils/snaps.cjs +0 -199
- package/dist/utils/snaps.cjs.map +0 -1
- package/dist/utils/snaps.d.cts.map +0 -1
- package/dist/utils/snaps.d.mts +0 -79
- package/dist/utils/snaps.d.mts.map +0 -1
- package/dist/utils/snaps.mjs.map +0 -1
- package/dist/utils/swap-received-amount.cjs +0 -94
- package/dist/utils/swap-received-amount.cjs.map +0 -1
- package/dist/utils/swap-received-amount.d.cts +0 -25
- package/dist/utils/swap-received-amount.d.cts.map +0 -1
- package/dist/utils/swap-received-amount.d.mts.map +0 -1
- package/dist/utils/swap-received-amount.mjs.map +0 -1
- package/dist/utils/trace.cjs +0 -58
- package/dist/utils/trace.cjs.map +0 -1
- package/dist/utils/trace.d.cts.map +0 -1
- package/dist/utils/trace.d.mts +0 -39
- package/dist/utils/trace.d.mts.map +0 -1
- package/dist/utils/trace.mjs.map +0 -1
- package/dist/utils/transaction.cjs +0 -395
- package/dist/utils/transaction.cjs.map +0 -1
- package/dist/utils/transaction.d.cts +0 -122
- package/dist/utils/transaction.d.cts.map +0 -1
- package/dist/utils/transaction.d.mts.map +0 -1
- package/dist/utils/transaction.mjs.map +0 -1
- package/dist/utils/validators.cjs +0 -67
- package/dist/utils/validators.cjs.map +0 -1
- package/dist/utils/validators.d.cts.map +0 -1
- package/dist/utils/validators.d.mts +0 -201
- package/dist/utils/validators.d.mts.map +0 -1
- package/dist/utils/validators.mjs.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE9D,eAAO,MAAM,mBAAmB,QAAY,CAAC;AAC7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,uCAAuC,QAA0B,CAAC;AAE/E,eAAO,MAAM,6BAA6B,2BAA2B,CAAC;AAEtE,eAAO,MAAM,sCAAsC,EAAE,2BAIlD,CAAC;AAEJ,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAEtC,oBAAY,SAAS;IACnB,kCAAkC,0CAA0C;IAC5E,0BAA0B,iCAAiC;IAC3D,gCAAgC,wCAAwC;IACxE,wBAAwB,+BAA+B;IAEvD,sBAAsB,6BAA6B;CACpD;AAED,eAAO,MAAM,qCAAqC,aAMjD,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FeatureId } from
|
|
1
|
+
import { FeatureId } from '@metamask/bridge-controller';
|
|
2
2
|
export const REFRESH_INTERVAL_MS = 10 * 1000; // 10 seconds
|
|
3
3
|
export const MAX_ATTEMPTS = 7; // at 7 attempts, delay is 10:40, cumulative time is 21:10
|
|
4
4
|
export const DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS = 2 * 24 * 60 * 60 * 1000; // 2 days
|
|
@@ -25,4 +25,4 @@ export const ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS = [
|
|
|
25
25
|
FeatureId.UNIFIED_SWAP_BRIDGE,
|
|
26
26
|
FeatureId.BATCH_SELL,
|
|
27
27
|
];
|
|
28
|
-
//# sourceMappingURL=constants.
|
|
28
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAIxD,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAC3D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,CAAC,0DAA0D;AACzF,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,SAAS;AAEzF,MAAM,CAAC,MAAM,6BAA6B,GAAG,wBAAwB,CAAC;AAEtE,MAAM,CAAC,MAAM,sCAAsC,GACjD;IACE,SAAS,EAAE,EAAE;IACb,sBAAsB,EAAE,EAAE;CAC3B,CAAC;AAEJ,MAAM,CAAC,MAAM,wBAAwB,GAAG,mCAAmC,CAAC;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC,MAAM,CAAN,IAAY,SAOX;AAPD,WAAY,SAAS;IACnB,yFAA4E,CAAA;IAC5E,wEAA2D,CAAA;IAC3D,qFAAwE,CAAA;IACxE,oEAAuD,CAAA;IACvD,wIAAwI;IACxI,gEAAmD,CAAA;AACrD,CAAC,EAPW,SAAS,KAAT,SAAS,QAOpB;AAED,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,SAAS,CAAC,wBAAwB;IAClC,SAAS,CAAC,uBAAuB;IACjC,SAAS,CAAC,iBAAiB;IAC3B,SAAS,CAAC,mBAAmB;IAC7B,SAAS,CAAC,UAAU;CACrB,CAAC","sourcesContent":["import { FeatureId } from '@metamask/bridge-controller';\n\nimport type { BridgeStatusControllerState } from './types.js';\n\nexport const REFRESH_INTERVAL_MS = 10 * 1000; // 10 seconds\nexport const MAX_ATTEMPTS = 7; // at 7 attempts, delay is 10:40, cumulative time is 21:10\nexport const DEFAULT_MAX_PENDING_HISTORY_ITEM_AGE_MS = 2 * 24 * 60 * 60 * 1000; // 2 days\n\nexport const BRIDGE_STATUS_CONTROLLER_NAME = 'BridgeStatusController';\n\nexport const DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE: BridgeStatusControllerState =\n {\n txHistory: {},\n quoteUpdateStatusStore: {},\n };\n\nexport const BRIDGE_PROD_API_BASE_URL = 'https://bridge.api.cx.metamask.io';\n\nexport const APPROVAL_DELAY_MS = 5000;\n\nexport enum TraceName {\n BridgeTransactionApprovalCompleted = 'Bridge Transaction Approval Completed',\n BridgeTransactionCompleted = 'Bridge Transaction Completed',\n SwapTransactionApprovalCompleted = 'Swap Transaction Approval Completed',\n SwapTransactionCompleted = 'Swap Transaction Completed',\n // For this constant only, \"Swap\" is the umbrella term for single-chain and cross-chain operations; use `swap_type` to distinguish them.\n SwapOperationCompleted = 'Swap Operation Completed',\n}\n\nexport const ALLOWED_FEATURE_IDS_FOR_STATUS_EVENTS = [\n FeatureId.QUICK_BUY_FOLLOW_TRADING,\n FeatureId.QUICK_BUY_TOKEN_DETAILS,\n FeatureId.QUICK_BUY_EXPLORE,\n FeatureId.UNIFIED_SWAP_BRIDGE,\n FeatureId.BATCH_SELL,\n];\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { QuoteStatusUpdateError, QuoteStatusGetError, } from
|
|
2
|
-
export { BaseQuoteStatusUpdateErrorTypes } from
|
|
3
|
-
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME, MAX_ATTEMPTS, } from
|
|
4
|
-
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash, StatusResponse, RefuelStatusResponse, BridgeHistoryItem, BridgeStatusControllerState, QuoteStatusPersistEntry, BridgeStatusControllerMessenger, BridgeStatusControllerActions, BridgeStatusControllerGetStateAction, BridgeStatusControllerEvents, BridgeStatusControllerStateChangeEvent, StartPollingForBridgeTxStatusArgs, StartPollingForBridgeTxStatusArgsSerialized, TokenAmountValuesSerialized, QuoteMetadataSerialized, } from
|
|
5
|
-
export type { BridgeStatusControllerStartPollingForBridgeTxStatusAction, BridgeStatusControllerWipeBridgeStatusAction, BridgeStatusControllerResetStateAction, BridgeStatusControllerSubmitTxAction, BridgeStatusControllerSubmitIntentAction, BridgeStatusControllerRestartPollingForFailedAttemptsAction, BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction, } from
|
|
6
|
-
export { BridgeId, BridgeStatusAction } from
|
|
7
|
-
export { BridgeStatusController } from
|
|
8
|
-
export { getBatchSellHistoryItemsForTxHash, isBatchSellHistoryItem, } from
|
|
9
|
-
//# sourceMappingURL=index.d.
|
|
1
|
+
export { QuoteStatusUpdateError, QuoteStatusGetError, } from './quote-status-manager/errors.js';
|
|
2
|
+
export { BaseQuoteStatusUpdateErrorTypes } from './quote-status-manager/constants.js';
|
|
3
|
+
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME, MAX_ATTEMPTS, } from './constants.js';
|
|
4
|
+
export type { FetchFunction, StatusRequest, StatusRequestDto, StatusRequestWithSrcTxHash, StatusResponse, RefuelStatusResponse, BridgeHistoryItem, BridgeStatusControllerState, QuoteStatusPersistEntry, BridgeStatusControllerMessenger, BridgeStatusControllerActions, BridgeStatusControllerGetStateAction, BridgeStatusControllerEvents, BridgeStatusControllerStateChangeEvent, StartPollingForBridgeTxStatusArgs, StartPollingForBridgeTxStatusArgsSerialized, TokenAmountValuesSerialized, QuoteMetadataSerialized, } from './types.js';
|
|
5
|
+
export type { BridgeStatusControllerStartPollingForBridgeTxStatusAction, BridgeStatusControllerWipeBridgeStatusAction, BridgeStatusControllerResetStateAction, BridgeStatusControllerSubmitTxAction, BridgeStatusControllerSubmitIntentAction, BridgeStatusControllerRestartPollingForFailedAttemptsAction, BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction, } from './bridge-status-controller-method-action-types.js';
|
|
6
|
+
export { BridgeId, BridgeStatusAction } from './types.js';
|
|
7
|
+
export { BridgeStatusController } from './bridge-status-controller.js';
|
|
8
|
+
export { getBatchSellHistoryItemsForTxHash, isBatchSellHistoryItem, } from './utils/history.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAGtF,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,EAC7B,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,0BAA0B,EAC1B,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,2BAA2B,EAC3B,uBAAuB,EACvB,+BAA+B,EAC/B,6BAA6B,EAC7B,oCAAoC,EACpC,4BAA4B,EAC5B,sCAAsC,EACtC,iCAAiC,EACjC,2CAA2C,EAC3C,2BAA2B,EAC3B,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,yDAAyD,EACzD,4CAA4C,EAC5C,sCAAsC,EACtC,oCAAoC,EACpC,wCAAwC,EACxC,2DAA2D,EAC3D,0DAA0D,GAC3D,MAAM,mDAAmD,CAAC;AAE3D,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Export custom error classes
|
|
2
|
+
export { QuoteStatusUpdateError, QuoteStatusGetError, } from './quote-status-manager/errors.js';
|
|
3
|
+
export { BaseQuoteStatusUpdateErrorTypes } from './quote-status-manager/constants.js';
|
|
4
|
+
// Export constants
|
|
5
|
+
export { REFRESH_INTERVAL_MS, DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE, BRIDGE_STATUS_CONTROLLER_NAME, MAX_ATTEMPTS, } from './constants.js';
|
|
6
|
+
export { BridgeId, BridgeStatusAction } from './types.js';
|
|
7
|
+
export { BridgeStatusController } from './bridge-status-controller.js';
|
|
8
|
+
export { getBatchSellHistoryItemsForTxHash, isBatchSellHistoryItem, } from './utils/history.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,+BAA+B,EAAE,MAAM,qCAAqC,CAAC;AAEtF,mBAAmB;AACnB,OAAO,EACL,mBAAmB,EACnB,sCAAsC,EACtC,6BAA6B,EAC7B,YAAY,GACb,MAAM,gBAAgB,CAAC;AAiCxB,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAE1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EACL,iCAAiC,EACjC,sBAAsB,GACvB,MAAM,oBAAoB,CAAC","sourcesContent":["// Export custom error classes\nexport {\n QuoteStatusUpdateError,\n QuoteStatusGetError,\n} from './quote-status-manager/errors.js';\nexport { BaseQuoteStatusUpdateErrorTypes } from './quote-status-manager/constants.js';\n\n// Export constants\nexport {\n REFRESH_INTERVAL_MS,\n DEFAULT_BRIDGE_STATUS_CONTROLLER_STATE,\n BRIDGE_STATUS_CONTROLLER_NAME,\n MAX_ATTEMPTS,\n} from './constants.js';\n\nexport type {\n FetchFunction,\n StatusRequest,\n StatusRequestDto,\n StatusRequestWithSrcTxHash,\n StatusResponse,\n RefuelStatusResponse,\n BridgeHistoryItem,\n BridgeStatusControllerState,\n QuoteStatusPersistEntry,\n BridgeStatusControllerMessenger,\n BridgeStatusControllerActions,\n BridgeStatusControllerGetStateAction,\n BridgeStatusControllerEvents,\n BridgeStatusControllerStateChangeEvent,\n StartPollingForBridgeTxStatusArgs,\n StartPollingForBridgeTxStatusArgsSerialized,\n TokenAmountValuesSerialized,\n QuoteMetadataSerialized,\n} from './types.js';\n\nexport type {\n BridgeStatusControllerStartPollingForBridgeTxStatusAction,\n BridgeStatusControllerWipeBridgeStatusAction,\n BridgeStatusControllerResetStateAction,\n BridgeStatusControllerSubmitTxAction,\n BridgeStatusControllerSubmitIntentAction,\n BridgeStatusControllerRestartPollingForFailedAttemptsAction,\n BridgeStatusControllerGetBridgeHistoryItemByTxMetaIdAction,\n} from './bridge-status-controller-method-action-types.js';\n\nexport { BridgeId, BridgeStatusAction } from './types.js';\n\nexport { BridgeStatusController } from './bridge-status-controller.js';\n\nexport {\n getBatchSellHistoryItemsForTxHash,\n isBatchSellHistoryItem,\n} from './utils/history.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,qCAAqC,QAAiB,CAAC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,6BAA6B,QAAqB,CAAC;AAEhE;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,+BAA+B,QAAsB,CAAC;AAEnE;;;;GAIG;AACH,oBAAY,wBAAwB;IAClC;;OAEG;IACH,MAAM,WAAW;IACjB;;OAEG;IACH,SAAS,cAAc;IACvB;;OAEG;IACH,gBAAgB,sBAAsB;IACtC;;OAEG;IACH,eAAe,qBAAqB;CACrC;AAED;;;;GAIG;AACH,oBAAY,iCAAiC;IAC3C,aAAa,oBAAoB,CAAE,mBAAmB;IACtD,gBAAgB,sBAAsB,CAAE,mBAAmB;IAC3D,wBAAwB,8BAA8B,CAAE,mBAAmB;IAC3E,6BAA6B,uCAAuC,CAAE,mBAAmB;IACzF,wBAAwB,gCAAgC,CAAE,mBAAmB;IAC7E,qBAAqB,4BAA4B,CAAE,mBAAmB;IACtE,iBAAiB,yBAAyB,CAAE,mBAAmB;IAC/D,kBAAkB,0BAA0B,CAAE,mBAAmB;IACjE;;OAEG;IACH,cAAc,qBAAqB,CAAE,mBAAmB;IACxD,yBAAyB,iCAAiC,CAAE,mBAAmB;IAC/E;;OAEG;IACH,0BAA0B,kCAAkC;CAC7D;AAED;;;GAGG;AACH,eAAO,MAAM,+BAA+B,ggBAUlC,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB,qKAK3B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,4CAA4C,qIAG/C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,sCAAsC,qCAGlD,CAAC;AAEF;;;;GAIG;AACH,oBAAY,gBAAgB;IAC1B,2DAA2D;IAC3D,SAAS,cAAc;IACvB,mDAAmD;IACnD,gBAAgB,qBAAqB;IACrC,+CAA+C;IAC/C,eAAe,oBAAoB;IACnC,+EAA+E;IAC/E,SAAS,cAAc;IACvB,8DAA8D;IAC9D,OAAO,YAAY;CACpB;AAED;;;;GAIG;AACH,eAAO,MAAM,+BAA+B;;;;;;CAO3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,kCAAkC,EAAE,MAAM,CACrD,gBAAgB,EAChB,SAAS,gBAAgB,EAAE,CAiB5B,CAAC;AAEF;;;GAGG;AACH,oBAAY,oCAAoC;IAC9C,iFAAiF;IACjF,QAAQ,aAAa;IACrB,2FAA2F;IAC3F,kBAAkB,uBAAuB;IACzC,2FAA2F;IAC3F,YAAY,iBAAiB;IAC7B,yEAAyE;IACzE,WAAW,gBAAgB;CAC5B"}
|
|
@@ -190,4 +190,4 @@ export var QuoteStatusFetchWithRetryOutcomeType;
|
|
|
190
190
|
/** The request was aborted (e.g. via abort signal) before completing. */
|
|
191
191
|
QuoteStatusFetchWithRetryOutcomeType["Interrupted"] = "interrupted";
|
|
192
192
|
})(QuoteStatusFetchWithRetryOutcomeType || (QuoteStatusFetchWithRetryOutcomeType = {}));
|
|
193
|
-
//# sourceMappingURL=constants.
|
|
193
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/quote-status-manager/constants.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;AAElF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,UAAU;AAE3E;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,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CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAAE;IAChC,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,EAAE;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAN,IAAY,oCASX;AATD,WAAY,oCAAoC;IAC9C,iFAAiF;IACjF,6DAAqB,CAAA;IACrB,2FAA2F;IAC3F,iFAAyC,CAAA;IACzC,2FAA2F;IAC3F,qEAA6B,CAAA;IAC7B,yEAAyE;IACzE,mEAA2B,CAAA;AAC7B,CAAC,EATW,oCAAoC,KAApC,oCAAoC,QAS/C","sourcesContent":["/**\n * How often the manager re-processes entries that have not yet reached a\n * terminal state (`Completed`/`Expired`).\n *\n * Drives the periodic retry timer in `QuoteStatusUpdateManager`: on each tick\n * every non-terminal entry is re-sent to the backend until it is accepted or\n * evicted. The timer only runs while there is outstanding work.\n */\nexport const QUOTE_STATUS_UPDATE_RETRY_INTERVAL_MS = 30 * 60 * 1000; // 30 minutes\n\n/**\n * Maximum lifetime of a tracked quote-status entry, measured from when it was\n * created.\n *\n * Once an entry is older than this it is considered `Expired`, evicted from the\n * store on the next read, and never retried again. This bounds how long the\n * manager keeps trying to report a status that the backend may never accept.\n */\nexport const QUOTE_STATUS_UPDATE_ENTRY_TTL = 3 * 60 * 60 * 1000; // 3 hours\n\n/**\n * Maximum age of a persisted `txHistory` item, measured from its `startTime`,\n * that is still eligible to have its quote-status entry backfilled on\n * startup.\n *\n * Used by `#seedQuoteStatusEntriesFromHistory` to skip history items whose\n * `startTime` predates this window: the backend's quote data itself is only\n * retained for a bounded period, so reporting a status for a quote older than\n * that would be rejected regardless of how fresh the locally-recreated entry\n * is. This is intentionally longer than `QUOTE_STATUS_UPDATE_ENTRY_TTL`\n * (which bounds an entry's local retry lifetime from creation, not the\n * underlying quote's age) so that swaps/bridges left in-flight across\n * multiple closed sessions still get a chance to be resumed.\n */\nexport const QUOTE_STATUS_BACKFILL_WINDOW_MS = 12 * 60 * 60 * 1000; // 12 hours\n\n/**\n * Quote lifecycle statuses as understood by the backend `quote/updateStatus`\n * API. These are the values sent over the wire (and echoed back in error\n * responses).\n */\nexport enum QuoteStatusBackendStatus {\n /**\n * Quote was served to the client. Unused locally, kept for parity with the backend enum.\n */\n Served = 'SERVED',\n /**\n * User has submitted the source transaction.\n */\n Submitted = 'SUBMITTED',\n /**\n * Transaction finalized successfully on-chain.\n */\n FinalizedSuccess = 'FINALIZED_SUCCESS',\n /**\n * Transaction failed or reverted on-chain.\n */\n FinalizedFailed = 'FINALIZED_FAILED',\n}\n\n/**\n * Machine-readable error `type` values returned by the backend\n * `quote/updateStatus` API on non-2xx responses. The comments record the HTTP\n * status the backend pairs with each type.\n */\nexport enum QuoteStatusUpdateBackendErrorType {\n QuoteNotFound = 'QUOTE_NOT_FOUND', // Http status: 404\n ConcurrentUpdate = 'CONCURRENT_UPDATE', // Http status: 409\n InvalidStatusTransaction = 'INVALID_STATUS_TRANSITION', // Http status: 400\n SrcTxHashRequiredForFinalized = 'SRC_TX_HASH_REQUIRED_FOR_FINALIZED', // Http status: 400\n PersistQuoteStatusFailed = 'PERSIST_QUOTE_STATUS_FAILED', // Http status: 400\n TransactionNotIndexed = 'TRANSACTION_NOT_INDEXED', // Http status: 409\n TxDataMissingHash = 'TX_DATA_MISSING_HASH', // Http status: 400\n TxDataMissingTrade = 'TX_DATA_MISSING_TRADE', // Http status: 400\n /**\n * On-chain tx payload does not match the served quote (EVM calldata, SVM message, TVM raw_data_hex).\n */\n TxDataMismatch = 'TX_DATA_MISMATCH', // Http status: 400\n SvmTradeDeserializeFailed = 'SVM_TRADE_DESERIALIZE_FAILED', // Http status: 400\n /**\n * Requested lifecycle status is inconsistent with observed on-chain tx status.\n */\n QuoteStatusOnChainMismatch = 'QUOTE_STATUS_ONCHAIN_MISMATCH', // Http status: 400\n}\n\n/**\n * Error types whose response payload carries no `currentStatus`. Used by the\n * response validator to define the base (non-mismatch) error response schema.\n */\nexport const BaseQuoteStatusUpdateErrorTypes = [\n QuoteStatusUpdateBackendErrorType.QuoteNotFound,\n QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,\n QuoteStatusUpdateBackendErrorType.SrcTxHashRequiredForFinalized,\n QuoteStatusUpdateBackendErrorType.PersistQuoteStatusFailed,\n QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,\n QuoteStatusUpdateBackendErrorType.TxDataMissingHash,\n QuoteStatusUpdateBackendErrorType.TxDataMissingTrade,\n QuoteStatusUpdateBackendErrorType.TxDataMismatch,\n QuoteStatusUpdateBackendErrorType.SvmTradeDeserializeFailed,\n] as const;\n\n/**\n * The full set of valid backend status values. Used by the response validator\n * to constrain the `currentStatus`/`newStatus` fields of error responses.\n */\nexport const QuoteStatusBackendValues = [\n QuoteStatusBackendStatus.Served,\n QuoteStatusBackendStatus.Submitted,\n QuoteStatusBackendStatus.FinalizedSuccess,\n QuoteStatusBackendStatus.FinalizedFailed,\n] as const;\n\n/**\n * Error types whose response payload includes a `currentStatus` describing the\n * backend's observed status. Used by the validator for the mismatch response\n * schema and by the manager to reconcile local state with the backend.\n */\nexport const QuoteStatusUpdateBackendOnChainMismatchTypes = [\n QuoteStatusUpdateBackendErrorType.InvalidStatusTransaction,\n QuoteStatusUpdateBackendErrorType.QuoteStatusOnChainMismatch,\n] as const;\n\n/**\n * Error types that represent transient backend conditions. A response with one\n * of these types is retried by `updateQuoteStatusWithRetry`; any other error\n * type is treated as non-retryable.\n */\nexport const QuoteStatusUpdateRetryableBackendTypes = [\n QuoteStatusUpdateBackendErrorType.ConcurrentUpdate,\n QuoteStatusUpdateBackendErrorType.TransactionNotIndexed,\n];\n\n/**\n * Local quote-status lifecycle states tracked by the state machine. These are\n * the states the manager owns; a subset maps onto backend statuses while\n * `Completed`/`Expired` are terminal, client-only states.\n */\nexport enum QuoteStatusState {\n /** Source transaction submitted; awaiting finalization. */\n Submitted = 'Submitted',\n /** Transaction finalized successfully on-chain. */\n FinalizedSuccess = 'FinalizedSuccess',\n /** Transaction failed or reverted on-chain. */\n FinalizedFailed = 'FinalizedFailed',\n /** Terminal: the backend accepted the final status; nothing left to report. */\n Completed = 'Completed',\n /** Terminal: the entry outlived its TTL and was abandoned. */\n Expired = 'Expired',\n}\n\n/**\n * Maps each local lifecycle state to the backend status to report for it, or\n * `null` for terminal states that require no backend update. The manager uses a\n * `null` mapping as the signal to remove the entry instead of calling the API.\n */\nexport const QuoteStatusStateToBackendStatus = {\n [QuoteStatusState.Submitted]: QuoteStatusBackendStatus.Submitted,\n [QuoteStatusState.FinalizedSuccess]:\n QuoteStatusBackendStatus.FinalizedSuccess,\n [QuoteStatusState.FinalizedFailed]: QuoteStatusBackendStatus.FinalizedFailed,\n [QuoteStatusState.Completed]: null,\n [QuoteStatusState.Expired]: null,\n};\n\n/**\n * Adjacency list defining the allowed forward-only transitions between\n * lifecycle states. Enforced by `QuoteStatusStateFsm`; terminal states map to\n * an empty array. Any state not present is treated as terminal.\n */\nexport const AllowedQuoteStatusStateTransitions: Record<\n QuoteStatusState,\n readonly QuoteStatusState[]\n> = {\n [QuoteStatusState.Submitted]: [\n QuoteStatusState.FinalizedFailed,\n QuoteStatusState.FinalizedSuccess,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.FinalizedFailed]: [\n QuoteStatusState.Completed,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.FinalizedSuccess]: [\n QuoteStatusState.Completed,\n QuoteStatusState.Expired,\n ],\n [QuoteStatusState.Completed]: [],\n [QuoteStatusState.Expired]: [],\n};\n\n/**\n * Outcome of a retrying status fetch call. Tells the\n * manager how to proceed after an update attempt completes.\n */\nexport enum QuoteStatusFetchWithRetryOutcomeType {\n /** The backend accepted the update (2xx); the entry can be finalized/removed. */\n Accepted = 'accepted',\n /** All retry attempts for a retryable error were used up; back off and try again later. */\n RetryableExhausted = 'retryableExhausted',\n /** The backend returned a non-retryable error; the entry must be reconciled or evicted. */\n NonRetryable = 'nonRetryable',\n /** The request was aborted (e.g. via abort signal) before completing. */\n Interrupted = 'interrupted',\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QuoteStatusGetErrorDetails, QuoteStatusUpdateErrorDetails } from
|
|
1
|
+
import { QuoteStatusGetErrorDetails, QuoteStatusUpdateErrorDetails } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Error thrown for quote status update failures.
|
|
4
4
|
*
|
|
@@ -48,4 +48,4 @@ export declare class QuoteStatusGetError extends Error {
|
|
|
48
48
|
*/
|
|
49
49
|
constructor(message: string, details: QuoteStatusGetErrorDetails, retryable?: boolean);
|
|
50
50
|
}
|
|
51
|
-
//# sourceMappingURL=errors.d.
|
|
51
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC9B,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,OAAO,CAAC,EAAE,6BAA6B,CAAC;IAEjD;;;;;;;;;;;;;OAaG;IACH,YAAY,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,6BAA6B,EAKlE;CACF;AAED;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,OAAO,CAAC,EAAE,0BAA0B,CAAC;IAE9C;;;;;OAKG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;;;;OAQG;IACH,YACE,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,0BAA0B,EACnC,SAAS,UAAQ,EAOlB;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/quote-status-manager/errors.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAG/C;;;;;;;;;;;;;OAaG;IACH,YAAY,OAAe,EAAE,OAAsC;QACjE,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,SAAS,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;QACzE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC,IAAI,CAAC;QACxC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAW5C;;;;;;;;OAQG;IACH,YACE,OAAe,EACf,OAAmC,EACnC,SAAS,GAAG,KAAK;QAEjB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC,IAAI,CAAC;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,mBAAmB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACF","sourcesContent":["import {\n QuoteStatusGetErrorDetails,\n QuoteStatusUpdateErrorDetails,\n} from './types.js';\n\n/**\n * Error thrown for quote status update failures.\n *\n * The error message is prefixed with the error type when provided, and\n * structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusUpdateError extends Error {\n readonly details?: QuoteStatusUpdateErrorDetails;\n\n /**\n * Creates a quote status update error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote update.\n * @param details.errorType - Optional category for known update failures.\n * @param details.quoteId - Unique quote identifier associated with the error.\n * @param details.txMetaId - Optional transaction metadata id associated with\n * the error.\n * @param details.srcTxHash - Optional source-chain transaction hash\n * associated with the error.\n * @param details.srcChainId - Optional source-chain id associated with the\n * error.\n */\n constructor(message: string, details: QuoteStatusUpdateErrorDetails) {\n super(`${details.errorType ? `[${details.errorType}] ` : ''}${message}`);\n this.details = details;\n this.name = QuoteStatusUpdateError.name;\n Object.setPrototypeOf(this, QuoteStatusUpdateError.prototype);\n }\n}\n\n/**\n * Error thrown for quote status fetch failures.\n *\n * Structured details are preserved on the instance for downstream handling.\n */\nexport class QuoteStatusGetError extends Error {\n readonly details?: QuoteStatusGetErrorDetails;\n\n /**\n * Whether the error is transient and the request may succeed on a retry.\n *\n * `true` for 5xx (server-side) HTTP errors; `false` for 4xx (client-side)\n * errors and response-validation failures.\n */\n readonly retryable: boolean;\n\n /**\n * Creates a quote status fetch error with structured context.\n *\n * @param message - Human-readable error message.\n * @param details - Structured metadata about the failed quote status fetch.\n * @param details.quoteId - Unique quote identifier associated with the error.\n * @param retryable - Whether the error is transient and may resolve on retry.\n * Defaults to `false`.\n */\n constructor(\n message: string,\n details: QuoteStatusGetErrorDetails,\n retryable = false,\n ) {\n super(message);\n this.details = details;\n this.retryable = retryable;\n this.name = QuoteStatusGetError.name;\n Object.setPrototypeOf(this, QuoteStatusGetError.prototype);\n }\n}\n"]}
|
package/dist/quote-status-manager/{quote-status-api-service.d.cts → quote-status-api-service.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { QuoteStatusBackendStatus } from
|
|
2
|
-
import { QuoteStatusGetWithRetryOutcome } from
|
|
3
|
-
import { QuoteStatusUpdateWithRetryOutcome } from
|
|
4
|
-
import { QuoteStatusApiServiceOptions, QuoteStatusGetResponse, QuoteStatusUpdateResponse } from
|
|
1
|
+
import { QuoteStatusBackendStatus } from './constants.js';
|
|
2
|
+
import { QuoteStatusGetWithRetryOutcome } from './quote-status-get-with-retry-outcome.js';
|
|
3
|
+
import { QuoteStatusUpdateWithRetryOutcome } from './quote-status-update-with-retry-outcome.js';
|
|
4
|
+
import { QuoteStatusApiServiceOptions, QuoteStatusGetResponse, QuoteStatusUpdateResponse } from './types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Service responsible for calling bridge quote status update APIs.
|
|
7
7
|
*
|
|
@@ -90,4 +90,4 @@ export declare class QuoteStatusApiService {
|
|
|
90
90
|
delayMsBetweenRetries: number;
|
|
91
91
|
}, signal?: AbortSignal): Promise<QuoteStatusGetWithRetryOutcome>;
|
|
92
92
|
}
|
|
93
|
-
//# sourceMappingURL=quote-status-api-service.d.
|
|
93
|
+
//# sourceMappingURL=quote-status-api-service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-api-service.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-api-service.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,wBAAwB,EAGzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAOpB;;;;;GAKG;AACH,qBAAa,qBAAqB;;IAahC;;;;;;;;;;OAUG;IACH,YAAY,EACV,SAAS,EACT,QAAQ,EACR,aAAa,EACb,aAAa,EACb,UAAU,EACV,OAAO,GACR,EAAE,4BAA4B,EAO9B;IAED;;;;;;;;;;;;;;OAcG;IACG,iBAAiB,CACrB,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,wBAAwB,CAAC;KACrC,EACD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CA4C3C;IAEK,cAAc,CAClB,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB,EACD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,sBAAsB,CAAC,CAoEjC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,0BAA0B,CAC9B,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,wBAAwB,CAAC;KACrC,EACD,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;KACvB,EACD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,iCAAiC,CAAC,CAyC5C;IAEK,uBAAuB,CAC3B,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM,CAAC;KACjB,EACD,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,qBAAqB,EAAE,MAAM,CAAC;KAC/B,EACD,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,8BAA8B,CAAC,CA0CzC;CACF"}
|
package/dist/quote-status-manager/{quote-status-api-service.mjs → quote-status-api-service.js}
RENAMED
|
@@ -10,16 +10,15 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _QuoteStatusApiService_messenger, _QuoteStatusApiService_clientId, _QuoteStatusApiService_clientProduct, _QuoteStatusApiService_clientVersion, _QuoteStatusApiService_apiBaseUrl, _QuoteStatusApiService_onError;
|
|
13
|
-
import { getClientHeaders } from
|
|
14
|
-
import { StructError } from
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { validateQuoteStatusGetResponse, validateQuoteStatusUpdateResponse } from "./validators.mjs";
|
|
13
|
+
import { getClientHeaders } from '@metamask/bridge-controller';
|
|
14
|
+
import { StructError } from '@metamask/superstruct';
|
|
15
|
+
import { getJwt } from '../utils/authentication.js';
|
|
16
|
+
import { QuoteStatusUpdateRetryableBackendTypes, QuoteStatusFetchWithRetryOutcomeType, } from './constants.js';
|
|
17
|
+
import { QuoteStatusGetError, QuoteStatusUpdateError } from './errors.js';
|
|
18
|
+
import { QuoteStatusGetWithRetryOutcome } from './quote-status-get-with-retry-outcome.js';
|
|
19
|
+
import { QuoteStatusUpdateWithRetryOutcome } from './quote-status-update-with-retry-outcome.js';
|
|
20
|
+
import { sleep } from './utils.js';
|
|
21
|
+
import { validateQuoteStatusGetResponse, validateQuoteStatusUpdateResponse, } from './validators.js';
|
|
23
22
|
/**
|
|
24
23
|
* Service responsible for calling bridge quote status update APIs.
|
|
25
24
|
*
|
|
@@ -234,4 +233,4 @@ export class QuoteStatusApiService {
|
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
_QuoteStatusApiService_messenger = new WeakMap(), _QuoteStatusApiService_clientId = new WeakMap(), _QuoteStatusApiService_clientProduct = new WeakMap(), _QuoteStatusApiService_clientVersion = new WeakMap(), _QuoteStatusApiService_apiBaseUrl = new WeakMap(), _QuoteStatusApiService_onError = new WeakMap();
|
|
237
|
-
//# sourceMappingURL=quote-status-api-service.
|
|
236
|
+
//# sourceMappingURL=quote-status-api-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-api-service.js","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-api-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGpD,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAEL,sCAAsC,EACtC,oCAAoC,GACrC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAC1E,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ACvC,oCAAoC,CAAC,kBAAkB,CACxD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { getClientHeaders } from '@metamask/bridge-controller';\nimport { StructError } from '@metamask/superstruct';\n\nimport { BridgeClientId, BridgeStatusControllerMessenger } from '../types.js';\nimport { getJwt } from '../utils/authentication.js';\nimport {\n QuoteStatusBackendStatus,\n QuoteStatusUpdateRetryableBackendTypes,\n QuoteStatusFetchWithRetryOutcomeType,\n} from './constants.js';\nimport { QuoteStatusGetError, QuoteStatusUpdateError } from './errors.js';\nimport { QuoteStatusGetWithRetryOutcome } from './quote-status-get-with-retry-outcome.js';\nimport { QuoteStatusUpdateWithRetryOutcome } from './quote-status-update-with-retry-outcome.js';\nimport {\n QuoteStatusApiServiceOptions,\n QuoteStatusGetResponse,\n QuoteStatusUpdateResponse,\n} from './types.js';\nimport { sleep } from './utils.js';\nimport {\n validateQuoteStatusGetResponse,\n validateQuoteStatusUpdateResponse,\n} from './validators.js';\n\n/**\n * Service responsible for calling bridge quote status update APIs.\n *\n * It performs authentication, sends properly-scoped client headers, and validates\n * error responses so callers can handle known update-status failures.\n */\nexport class QuoteStatusApiService {\n readonly #messenger: BridgeStatusControllerMessenger;\n\n readonly #clientId: BridgeClientId;\n\n readonly #clientProduct: string;\n\n readonly #clientVersion: string | undefined;\n\n readonly #apiBaseUrl: string;\n\n readonly #onError: ((error: QuoteStatusUpdateError) => void) | undefined;\n\n /**\n * Creates an API service for quote status update requests.\n *\n * @param options - Service dependencies and request configuration.\n * @param options.messenger - Messenger used to retrieve the authentication token.\n * @param options.clientId - Bridge client identifier used for request headers.\n * @param options.clientProduct - Product name sent in client product headers.\n * @param options.clientVersion - Optional client version sent in headers.\n * @param options.apiBaseUrl - Base URL for the quote status API.\n * @param options.onError - Optional callback for unexpected response-shape errors.\n */\n constructor({\n messenger,\n clientId,\n clientProduct,\n clientVersion,\n apiBaseUrl,\n onError,\n }: QuoteStatusApiServiceOptions) {\n this.#messenger = messenger;\n this.#clientId = clientId;\n this.#clientProduct = clientProduct;\n this.#clientVersion = clientVersion;\n this.#apiBaseUrl = apiBaseUrl;\n this.#onError = onError;\n }\n\n /**\n * Updates a quote status in the bridge quote-status API.\n *\n * The endpoint returns no payload on success (`2xx`) and a structured payload\n * on non-`2xx` responses. This method returns `null` for successful updates and\n * the validated error payload for unsuccessful updates.\n *\n * @param data - Request payload identifying quote and target status transition.\n * @param data.quoteId - Unique quote identifier to update.\n * @param data.srcTxHash - Source transaction hash associated with the quote.\n * @param data.newStatus - Target quote status to persist.\n * @param signal - Optional abort signal for canceling the request.\n * @returns `null` for `2xx` responses, or a validated error response for non-`2xx`.\n * @throws If the non-`2xx` response body does not match the expected schema.\n */\n async updateQuoteStatus(\n data: {\n quoteId: string;\n srcTxHash: string;\n newStatus: QuoteStatusBackendStatus;\n },\n signal?: AbortSignal,\n ): Promise<QuoteStatusUpdateResponse | null> {\n const jwt = await getJwt(this.#messenger);\n\n // This method uses `globalThis.fetch` and reads the raw\n // `Response` (including JSON on non-2xx). Wrappers like `handleFetch` that\n // throw on non-2xx would prevent typed error handling in callers.\n const res = await globalThis.fetch(\n `${this.#apiBaseUrl}/quote/updateStatus`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'x-metamask-clientproduct': this.#clientProduct,\n ...(this.#clientVersion\n ? { 'x-metamask-clientversion': this.#clientVersion }\n : {}),\n ...getClientHeaders({\n clientId: this.#clientId,\n jwt,\n }),\n },\n body: JSON.stringify(data),\n signal,\n },\n );\n\n if (res.ok) {\n return null;\n }\n\n const responseData = await res.json();\n\n try {\n validateQuoteStatusUpdateResponse(responseData);\n return responseData;\n } catch (error) {\n this.#onError?.(\n new QuoteStatusUpdateError(\n 'unexpected response shape from quote/updateStatus',\n { quoteId: data.quoteId, srcTxHash: data.srcTxHash },\n ),\n );\n throw error;\n }\n }\n\n async getQuoteStatus(\n data: {\n quoteId: string;\n },\n signal?: AbortSignal,\n ): Promise<QuoteStatusGetResponse> {\n const jwt = await getJwt(this.#messenger);\n\n // This method uses `globalThis.fetch` and reads the raw\n // `Response` (including JSON on non-2xx). Wrappers like `handleFetch` that\n // throw on non-2xx would prevent typed error handling in callers.\n const res = await globalThis.fetch(\n `${this.#apiBaseUrl}/getQuoteStatus?quoteId=${data.quoteId}`,\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n 'x-metamask-clientproduct': this.#clientProduct,\n ...(this.#clientVersion\n ? { 'x-metamask-clientversion': this.#clientVersion }\n : {}),\n ...getClientHeaders({\n clientId: this.#clientId,\n jwt,\n }),\n },\n signal,\n },\n );\n\n if (!res.ok) {\n // 5xx errors are transient (server-side); 4xx errors are client-side and\n // non-retryable. The `retryable` flag lets `getQuoteStatusWithRetry`\n // distinguish the two and only exit early for permanent failures.\n const retryable = res.status >= 500;\n const error = new QuoteStatusGetError(\n `request error to getQuoteStatus [${res.status}: ${res.statusText}]`,\n { quoteId: data.quoteId },\n retryable,\n );\n this.#onError?.(error);\n throw error;\n }\n\n const responseData = await res.json();\n\n try {\n validateQuoteStatusGetResponse(responseData);\n return responseData;\n } catch (error) {\n if (error instanceof StructError) {\n const validationFailures = [];\n\n for (const { path } of error.failures()) {\n const aggregatorId =\n (responseData as QuoteStatusGetResponse)?.submittedTx?.bridge ??\n ('unknown' as string);\n const pathString = path?.join('.') || 'unknown';\n validationFailures.push([aggregatorId, pathString].join('|'));\n }\n\n const validationError = new QuoteStatusGetError(\n 'unexpected response shape from getQuoteStatus',\n { quoteId: data.quoteId, validationFailures },\n );\n\n this.#onError?.(validationError);\n\n throw validationError;\n }\n\n throw error;\n }\n }\n\n /**\n * Updates a quote status, retrying on transient backend failures.\n *\n * Wraps {@link updateQuoteStatus} in a bounded retry loop. A request is only\n * retried when the backend returns an error whose type is in\n * {@link QuoteStatusUpdateRetryableBackendTypes}; any other error response\n * resolves immediately as non-retryable. Retries are spaced by\n * `options.delayMsBetweenRetries`, and both the abort signal and the optional\n * `options.retry` predicate are checked before each attempt so an\n * in-flight or pending retry can be cancelled (e.g. when the entry's status\n * changed while sleeping between retries).\n *\n * @param data - Request payload identifying the quote and target transition.\n * @param data.quoteId - Unique quote identifier to update.\n * @param data.srcTxHash - Source transaction hash associated with the quote.\n * @param data.newStatus - Target quote status to persist.\n * @param options - Retry configuration.\n * @param options.maxRetries - Maximum number of retries after the initial attempt.\n * @param options.delayMsBetweenRetries - Delay in milliseconds between attempts.\n * @param options.retry - Optional predicate checked before each attempt;\n * when it returns `false` the loop stops early and resolves as `Interrupted`.\n * @param signal - Optional abort signal for canceling the request and its retries.\n * @returns An outcome describing how the update resolved:\n * `Accepted` when the backend accepted the update, `NonRetryable` for a\n * non-retryable error response, `Interrupted` when aborted, or\n * `RetryableExhausted` when all retries were used up on retryable errors.\n * @throws If a request rejects for a reason other than the abort signal (e.g.\n * an unexpected response shape from {@link updateQuoteStatus}).\n */\n async updateQuoteStatusWithRetry(\n data: {\n quoteId: string;\n srcTxHash: string;\n newStatus: QuoteStatusBackendStatus;\n },\n options: {\n maxRetries: number;\n delayMsBetweenRetries: number;\n retry?: () => boolean;\n },\n signal?: AbortSignal,\n ): Promise<QuoteStatusUpdateWithRetryOutcome> {\n for (let attempt = 0; attempt <= options.maxRetries; attempt += 1) {\n if (attempt > 0) {\n await sleep(options.delayMsBetweenRetries);\n }\n\n if (signal?.aborted || options.retry?.() === false) {\n return new QuoteStatusUpdateWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Interrupted,\n );\n }\n\n try {\n const response = await this.updateQuoteStatus(data, signal);\n\n if (response === null) {\n return new QuoteStatusUpdateWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Accepted,\n );\n }\n\n if (!QuoteStatusUpdateRetryableBackendTypes.includes(response.type)) {\n return new QuoteStatusUpdateWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.NonRetryable,\n response,\n );\n }\n } catch (error) {\n if (signal?.aborted) {\n return new QuoteStatusUpdateWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Interrupted,\n );\n }\n\n throw error;\n }\n }\n\n return new QuoteStatusUpdateWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted,\n );\n }\n\n async getQuoteStatusWithRetry(\n data: {\n quoteId: string;\n },\n options: {\n maxRetries: number;\n delayMsBetweenRetries: number;\n },\n signal?: AbortSignal,\n ): Promise<QuoteStatusGetWithRetryOutcome> {\n for (let attempt = 0; attempt <= options.maxRetries; attempt += 1) {\n if (attempt > 0) {\n await sleep(options.delayMsBetweenRetries);\n }\n\n if (signal?.aborted) {\n return new QuoteStatusGetWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Interrupted,\n );\n }\n\n try {\n const response = await this.getQuoteStatus(data, signal);\n\n return new QuoteStatusGetWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Accepted,\n response,\n );\n } catch (error) {\n if (signal?.aborted) {\n return new QuoteStatusGetWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.Interrupted,\n );\n }\n\n // Only short-circuit for non-retryable errors (e.g. 4xx, validation\n // failures). Retryable errors (e.g. 5xx) fall through so the loop can\n // attempt the next retry instead of returning NonRetryable immediately.\n if (error instanceof QuoteStatusGetError && !error.retryable) {\n return new QuoteStatusGetWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.NonRetryable,\n undefined,\n error,\n );\n }\n }\n }\n\n return new QuoteStatusGetWithRetryOutcome(\n QuoteStatusFetchWithRetryOutcomeType.RetryableExhausted,\n );\n }\n}\n"]}
|
package/dist/quote-status-manager/{quote-status-entry-store.d.cts → quote-status-entry-store.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { QuoteStatusEntryStoreOptions, QuoteStatusPersistEntry, QuoteStatusRuntimeEntry } from
|
|
1
|
+
import { QuoteStatusEntryStoreOptions, QuoteStatusPersistEntry, QuoteStatusRuntimeEntry } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* In-memory store for quote status update entries.
|
|
4
4
|
*
|
|
@@ -154,4 +154,4 @@ export declare class QuoteStatusEntryStore {
|
|
|
154
154
|
*/
|
|
155
155
|
clear(): void;
|
|
156
156
|
}
|
|
157
|
-
//# sourceMappingURL=quote-status-entry-store.d.
|
|
157
|
+
//# sourceMappingURL=quote-status-entry-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-entry-store.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-entry-store.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,4BAA4B,EAC5B,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB;;;;;GAKG;AACH,qBAAa,qBAAqB;;IAKhC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CACT,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,SAAS,GAAG,WAAW,CAAC,GAC5D,MAAM,CAER;IAMD;;;;;;;OAOG;IACH,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,OAAO,GACR,EAAE,4BAA4B,EAwB9B;IAaD;;;;;;;;;;;;;;OAcG;IACH,GAAG,CACD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,IAAI,CAAC,uBAAuB,EAAE,WAAW,GAAG,eAAe,CAAC,GAClE,uBAAuB,CAuBzB;IAED;;;;;;;OAOG;IACH,MAAM,IAAI,gBAAgB,CAAC,uBAAuB,CAAC,CAGlD;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAWvD;IAED;;;;;;;;OAQG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;;OAQG;IACH,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAS9D;IAED;;;;;;;;;;;OAWG;IACH,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,uBAAuB,EAAE,CAU5D;IAED;;;;;;;;OAQG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,uBAAuB,GAAG,IAAI,CAQ/C;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,uBAAuB,GAAG,IAAI,CAM3C;IAiBD;;;;;;;;OAQG;IACH,kBAAkB,IAAI,IAAI,CAMzB;IAED;;;;;;;;OAQG;IACH,eAAe,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAGvD;IAED;;;;;;;;;;OAUG;IACH,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAO1D;IAED;;;;;;OAMG;IACH,KAAK,IAAI,IAAI,CAMZ;CACF"}
|
package/dist/quote-status-manager/{quote-status-entry-store.mjs → quote-status-entry-store.js}
RENAMED
|
@@ -10,8 +10,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _QuoteStatusEntryStore_instances, _QuoteStatusEntryStore_items, _QuoteStatusEntryStore_entryTtlMs, _QuoteStatusEntryStore_onPersistUpdates, _QuoteStatusEntryStore_subscribeToStatusUpdates, _QuoteStatusEntryStore_persistToState;
|
|
13
|
-
import { QuoteStatusState } from
|
|
14
|
-
import { QuoteStatusStateFsm } from
|
|
13
|
+
import { QuoteStatusState } from './constants.js';
|
|
14
|
+
import { QuoteStatusStateFsm } from './quote-status-state-fsm.js';
|
|
15
15
|
/**
|
|
16
16
|
* In-memory store for quote status update entries.
|
|
17
17
|
*
|
|
@@ -286,4 +286,4 @@ _QuoteStatusEntryStore_items = new WeakMap(), _QuoteStatusEntryStore_entryTtlMs
|
|
|
286
286
|
}
|
|
287
287
|
__classPrivateFieldGet(this, _QuoteStatusEntryStore_onPersistUpdates, "f").call(this, cloned);
|
|
288
288
|
};
|
|
289
|
-
//# sourceMappingURL=quote-status-entry-store.
|
|
289
|
+
//# sourceMappingURL=quote-status-entry-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-entry-store.js","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-entry-store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAOlE;;;;;GAKG;AACH,MAAM,OAAO,qBAAqB;IAKhC;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CACT,KAA6D;QAE7D,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/C,CAAC;IAMD;;;;;;;OAOG;IACH,YAAY,EACV,gBAAgB,EAChB,UAAU,EACV,OAAO,GACsB;;QAlCtB,+CAA6C;QAE7C,oDAAoB;QAgBpB,0DAEC;QAeR,uBAAA,IAAI,2CAAqB,gBAAgB,MAAA,CAAC;QAC1C,uBAAA,IAAI,qCAAe,UAAU,MAAA,CAAC;QAC9B,uBAAA,IAAI,gCAAU,IAAI,GAAG,CACnB,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YACjD,MAAM,mBAAmB,GAAG,IAAI,mBAAmB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAElE,OAAO;gBACL,GAAG;gBACH,2EAA2E;gBAC3E,wEAAwE;gBACxE,sEAAsE;gBACtE,qEAAqE;gBACrE,yCAAyC;gBACzC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,mBAAmB,EAAE;aAC1C,CAAC;QACJ,CAAC,CAAC,CACH,MAAA,CAAC;QAEF,4EAA4E;QAC5E,oEAAoE;QACpE,KAAK,MAAM,KAAK,IAAI,uBAAA,IAAI,oCAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YACzC,uBAAA,IAAI,yFAA0B,MAA9B,IA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KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,uBAAA,IAAI,+EAAgB,MAApB,IAAI,CAAkB,CAAC,CAAC;AAC3D,CAAC;IAqLC,MAAM,MAAM,GAA4C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,uBAAA,IAAI,oCAAO,EAAE,CAAC;QACvC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACzD,CAAC;IACD,uBAAA,IAAI,+CAAkB,MAAtB,IAAI,EAAmB,MAAM,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { QuoteStatusState } from './constants.js';\nimport { QuoteStatusStateFsm } from './quote-status-state-fsm.js';\nimport {\n QuoteStatusEntryStoreOptions,\n QuoteStatusPersistEntry,\n QuoteStatusRuntimeEntry,\n} from './types.js';\n\n/**\n * In-memory store for quote status update entries.\n *\n * The store deduplicates entries by key, tracks timestamps used for retries and\n * TTL eviction, and persists a cloned snapshot on each mutating operation.\n */\nexport class QuoteStatusEntryStore {\n readonly #items: Map<string, QuoteStatusRuntimeEntry>;\n\n readonly #entryTtlMs: number;\n\n /**\n * Creates a deterministic key for persisted quote status entries.\n *\n * @param entry - Entry identity fields.\n * @param entry.quoteId - Quote identifier.\n * @param entry.srcTxHash - Source transaction hash.\n * @returns Stable key in `${quoteId}:${srcTxHash}` format.\n */\n static hash(\n entry: Pick<QuoteStatusPersistEntry, 'quoteId' | 'srcTxHash'>,\n ): string {\n return `${entry.quoteId}:${entry.srcTxHash}`;\n }\n\n readonly #onPersistUpdates: (\n updates: Record<string, QuoteStatusPersistEntry>,\n ) => void;\n\n /**\n * Creates a quote status entry store.\n *\n * @param options - Store dependencies and retention configuration.\n * @param options.onPersistUpdates - Callback invoked with cloned snapshot updates.\n * @param options.entryTtlMs - Entry time-to-live in milliseconds.\n * @param options.initial - Optional initial persisted entries used to seed the store.\n */\n constructor({\n onPersistUpdates,\n entryTtlMs,\n initial,\n }: QuoteStatusEntryStoreOptions) {\n this.#onPersistUpdates = onPersistUpdates;\n this.#entryTtlMs = entryTtlMs;\n this.#items = new Map(\n Object.entries(initial ?? {}).map(([key, entry]) => {\n const quoteStatusStateFsm = new QuoteStatusStateFsm(entry.status);\n\n return [\n key,\n // Entries from `initialDeferredUpdates` come from Immer-managed controller\n // state, which deep-freezes all nested objects. Cloning each entry here\n // ensures the in-memory queue holds mutable objects so that mutations\n // (e.g. updating `status` or `lastAttemptAt`) work correctly without\n // throwing a \"read only property\" error.\n { ...entry, status: quoteStatusStateFsm },\n ];\n }),\n );\n\n // Subscribe each seeded FSM after the map (and `#onPersistUpdates`) are set\n // so that any later state transition persists the updated snapshot.\n for (const entry of this.#items.values()) {\n this.#subscribeToStatusUpdates(entry);\n }\n }\n\n /**\n * Subscribes the entry's FSM so that every state transition persists the\n * current snapshot. Kept in one place so seeded and runtime-added entries\n * behave identically.\n *\n * @param entry - Entry whose FSM should trigger persistence on transition.\n */\n #subscribeToStatusUpdates(entry: QuoteStatusRuntimeEntry): void {\n entry.status.onStateUpdate(() => this.#persistToState());\n }\n\n /**\n * Adds a new entry when the key is not already present.\n *\n * If an entry already exists, only a missing `txMetaId` is backfilled to avoid\n * resetting timestamps and creating duplicate submission updates.\n *\n * @param key - Unique map key for the entry.\n * @param value - Entry payload without internal timestamps.\n * @param value.quoteId - Quote identifier.\n * @param value.srcTxHash - Source transaction hash.\n * @param value.status - Latest quote status.\n * @param value.txMetaId - Optional transaction metadata identifier.\n * @returns The tracked entry (the existing one when the key is already\n * present, otherwise the newly created entry).\n */\n put(\n key: string,\n value: Omit<QuoteStatusRuntimeEntry, 'createdAt' | 'lastAttemptAt'>,\n ): QuoteStatusRuntimeEntry {\n // If an entry for this key is already in the queue\n // do not overwrite it. Re-enqueueing would reset state and\n // could cause duplicate SUBMITTED events.\n const existing = this.#items.get(key);\n if (existing) {\n if (!existing.txMetaId && value.txMetaId) {\n existing.txMetaId = value.txMetaId;\n this.#persistToState();\n }\n return existing;\n }\n\n const now = Date.now();\n const entry: QuoteStatusRuntimeEntry = {\n ...value,\n createdAt: now,\n lastAttemptAt: now,\n };\n this.#items.set(key, entry);\n this.#subscribeToStatusUpdates(entry);\n this.#persistToState();\n return entry;\n }\n\n /**\n * Returns an iterator over all tracked entries.\n *\n * Stale entries are transitioned to {@link QuoteStatusState.Expired} first (but\n * kept in the store), so the iterator reflects their up-to-date terminal state.\n *\n * @returns An iterator over the currently tracked entries.\n */\n values(): IterableIterator<QuoteStatusRuntimeEntry> {\n this.expireStaleEntries();\n return this.#items.values();\n }\n\n /**\n * Returns every tracked entry matching the provided quote identifier.\n *\n * Stale entries are transitioned to {@link QuoteStatusState.Expired} first so\n * callers observe their up-to-date terminal state.\n *\n * @param quoteId - Quote identifier to match.\n * @returns The matching entries (empty when none exist).\n */\n getByQuoteId(quoteId: string): QuoteStatusRuntimeEntry[] {\n this.expireStaleEntries();\n\n const matches: QuoteStatusRuntimeEntry[] = [];\n for (const entry of this.#items.values()) {\n if (entry.quoteId === quoteId) {\n matches.push(entry);\n }\n }\n\n return matches;\n }\n\n /**\n * Number of entries currently tracked by the store.\n *\n * Note that this includes terminal entries (`Completed`/`Expired`), which are\n * retained rather than evicted; call {@link expireStaleEntries} (or\n * {@link values}) first when an up-to-date view of entry states is required.\n *\n * @returns The count of tracked entries.\n */\n get size(): number {\n return this.#items.size;\n }\n\n /**\n * Looks up an entry by its transaction metadata identifier.\n *\n * If the matching entry has exceeded its TTL it is transitioned to\n * {@link QuoteStatusState.Expired} (but kept) before being returned.\n *\n * @param txMetaId - Transaction metadata identifier to search for.\n * @returns The matching entry, or `null` if none exists.\n */\n getByTxMetaId(txMetaId: string): QuoteStatusRuntimeEntry | null {\n for (const entry of this.#items.values()) {\n if (entry.txMetaId === txMetaId) {\n this.expireEntryIfStale(entry);\n return entry;\n }\n }\n\n return null;\n }\n\n /**\n * Looks up every entry sharing the given transaction metadata identifier.\n *\n * A single 7702/nested batch transaction submits multiple quotes under one\n * source tx hash and one `txMetaId`, producing several entries that must all\n * be finalized together. Each matching entry has its TTL checked (and is\n * transitioned to {@link QuoteStatusState.Expired} if stale) before being\n * returned.\n *\n * @param txMetaId - Transaction metadata identifier to search for.\n * @returns The matching entries (empty when none exist).\n */\n getAllByTxMetaId(txMetaId: string): QuoteStatusRuntimeEntry[] {\n const matches: QuoteStatusRuntimeEntry[] = [];\n for (const entry of this.#items.values()) {\n if (entry.txMetaId === txMetaId) {\n this.expireEntryIfStale(entry);\n matches.push(entry);\n }\n }\n\n return matches;\n }\n\n /**\n * Retrieves an entry by key.\n *\n * If the entry has exceeded its TTL it is transitioned to\n * {@link QuoteStatusState.Expired} (but kept) before being returned.\n *\n * @param key - Unique map key for the entry.\n * @returns The matching entry, or `null` if absent.\n */\n get(key: string): QuoteStatusRuntimeEntry | null {\n const entry = this.#items.get(key);\n if (!entry) {\n return null;\n }\n\n this.expireEntryIfStale(entry);\n return entry;\n }\n\n /**\n * Persists the current snapshot after an in-place mutation of a tracked entry.\n *\n * Used when fields such as `lastAttemptAt` are mutated directly on an entry\n * the caller already holds. No-ops if the entry is no longer tracked (e.g. the\n * store was cleared in the meantime), so persistence only reflects live entries.\n *\n * @param entry - The mutated entry to persist.\n */\n update(entry: QuoteStatusRuntimeEntry): void {\n if (!this.#items.has(QuoteStatusEntryStore.hash(entry))) {\n return;\n }\n\n this.#persistToState();\n }\n\n /**\n * Emits a cloned, serializable snapshot of all tracked entries via the\n * `onPersistUpdates` callback.\n *\n * Each entry's FSM is flattened to its plain `status` value so the snapshot\n * contains no class instances and is safe to store in controller state.\n */\n #persistToState(): void {\n const cloned: Record<string, QuoteStatusPersistEntry> = {};\n for (const [key, entry] of this.#items) {\n cloned[key] = { ...entry, status: entry.status.state };\n }\n this.#onPersistUpdates(cloned);\n }\n\n /**\n * Transitions every stale entry to {@link QuoteStatusState.Expired}, keeping it\n * in the store.\n *\n * Expired entries are retained so that later interactions with the same quote\n * (e.g. a duplicate `reportSubmitted`) can be recognized and rejected. Each\n * transition persists the updated snapshot via the entry's FSM subscription;\n * already-terminal entries cannot transition and are left untouched.\n */\n expireStaleEntries(): void {\n for (const entry of this.#items.values()) {\n if (this.entryHasExpired(entry)) {\n entry.status.transitionTo(QuoteStatusState.Expired);\n }\n }\n }\n\n /**\n * Determines whether an entry has outlived the configured TTL.\n *\n * Expiry is measured from the entry's `createdAt` timestamp, not its last\n * attempt, so an entry's total lifetime is bounded regardless of retries.\n *\n * @param entry - Entry to check.\n * @returns `true` if the entry's age exceeds the TTL.\n */\n entryHasExpired(entry: QuoteStatusRuntimeEntry): boolean {\n const now = Date.now();\n return now - entry.createdAt > this.#entryTtlMs;\n }\n\n /**\n * Transitions an entry to {@link QuoteStatusState.Expired} (keeping it) if it\n * has exceeded its TTL.\n *\n * The transition persists the updated snapshot via the entry's FSM\n * subscription. Already-terminal entries cannot transition and are left\n * untouched.\n *\n * @param entry - Entry to check and possibly expire.\n * @returns `true` if the entry was stale, otherwise `false`.\n */\n expireEntryIfStale(entry: QuoteStatusRuntimeEntry): boolean {\n if (this.entryHasExpired(entry)) {\n entry.status.transitionTo(QuoteStatusState.Expired);\n return true;\n }\n\n return false;\n }\n\n /**\n * Removes every entry from the store.\n *\n * Detaches each entry's FSM listeners before clearing to prevent leaks and\n * stale persist callbacks. Does not emit a persistence update; callers are\n * expected to use this during teardown.\n */\n clear(): void {\n for (const entry of this.#items.values()) {\n entry.status.removeAllListeners();\n }\n\n this.#items.clear();\n }\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { QuoteStatusFetchWithRetryOutcomeType } from
|
|
2
|
-
import { QuoteStatusGetError } from
|
|
3
|
-
import { QuoteStatusGetResponse } from
|
|
1
|
+
import { QuoteStatusFetchWithRetryOutcomeType } from './constants.js';
|
|
2
|
+
import { QuoteStatusGetError } from './errors.js';
|
|
3
|
+
import { QuoteStatusGetResponse } from './types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Result of a retrying quote status fetch
|
|
6
6
|
* ({@link QuoteStatusApiService.getQuoteStatusWithRetry}).
|
|
@@ -29,4 +29,4 @@ export declare class QuoteStatusGetWithRetryOutcome {
|
|
|
29
29
|
*/
|
|
30
30
|
constructor(outcome: QuoteStatusFetchWithRetryOutcomeType, response?: QuoteStatusGetResponse, error?: QuoteStatusGetError);
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=quote-status-get-with-retry-outcome.d.
|
|
32
|
+
//# sourceMappingURL=quote-status-get-with-retry-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-get-with-retry-outcome.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-get-with-retry-outcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEpD;;;;;;;;;GASG;AACH,qBAAa,8BAA8B;IACzC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAE3C,QAAQ,CAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC;IAErC;;;;OAIG;IACH,YACE,OAAO,EAAE,oCAAoC,EAC7C,QAAQ,CAAC,EAAE,sBAAsB,EACjC,KAAK,CAAC,EAAE,mBAAmB,EAK5B;CACF"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { QuoteStatusFetchWithRetryOutcomeType } from "./constants.mjs";
|
|
2
|
-
import { QuoteStatusGetError } from "./errors.mjs";
|
|
3
1
|
/**
|
|
4
2
|
* Result of a retrying quote status fetch
|
|
5
3
|
* ({@link QuoteStatusApiService.getQuoteStatusWithRetry}).
|
|
@@ -22,4 +20,4 @@ export class QuoteStatusGetWithRetryOutcome {
|
|
|
22
20
|
this.error = error;
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
|
-
//# sourceMappingURL=quote-status-get-with-retry-outcome.
|
|
23
|
+
//# sourceMappingURL=quote-status-get-with-retry-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-get-with-retry-outcome.js","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-get-with-retry-outcome.ts"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,MAAM,OAAO,8BAA8B;IAczC;;;;OAIG;IACH,YACE,OAA6C,EAC7C,QAAiC,EACjC,KAA2B;QAE3B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF","sourcesContent":["import { QuoteStatusFetchWithRetryOutcomeType } from './constants.js';\nimport { QuoteStatusGetError } from './errors.js';\nimport { QuoteStatusGetResponse } from './types.js';\n\n/**\n * Result of a retrying quote status fetch\n * ({@link QuoteStatusApiService.getQuoteStatusWithRetry}).\n *\n * Represents how a fetch attempt resolved so callers can branch on the\n * outcome without having to re-interpret raw HTTP responses or thrown errors.\n * The discriminating {@link type} indicates whether the fetch was accepted,\n * was interrupted, or exhausted its retries. The optional {@link response}\n * carries the backend quote status payload when the fetch succeeded.\n */\nexport class QuoteStatusGetWithRetryOutcome {\n /**\n * Discriminant describing how the fetch attempt resolved.\n */\n readonly type: QuoteStatusFetchWithRetryOutcomeType;\n\n /**\n * Backend quote status payload when the fetch was accepted\n * ({@link QuoteStatusFetchWithRetryOutcomeType.Accepted}).\n */\n readonly response?: QuoteStatusGetResponse;\n\n readonly error?: QuoteStatusGetError;\n\n /**\n * @param outcome - The outcome type describing how the fetch resolved.\n * @param response - Optional backend quote status payload when accepted.\n * @param error - Optional quote status fetch error when the outcome is non-retryable.\n */\n constructor(\n outcome: QuoteStatusFetchWithRetryOutcomeType,\n response?: QuoteStatusGetResponse,\n error?: QuoteStatusGetError,\n ) {\n this.type = outcome;\n this.response = response;\n this.error = error;\n }\n}\n"]}
|
package/dist/quote-status-manager/{quote-status-state-fsm.d.cts → quote-status-state-fsm.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QuoteStatusState } from
|
|
2
|
-
import type { QuoteStatusStateUpdateListener } from
|
|
1
|
+
import { QuoteStatusState } from './constants.js';
|
|
2
|
+
import type { QuoteStatusStateUpdateListener } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Finite state machine that enforces forward-only quote status transitions.
|
|
5
5
|
*/
|
|
@@ -54,4 +54,4 @@ export declare class QuoteStatusStateFsm {
|
|
|
54
54
|
state: QuoteStatusState;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
//# sourceMappingURL=quote-status-state-fsm.d.
|
|
57
|
+
//# sourceMappingURL=quote-status-state-fsm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-state-fsm.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-state-fsm.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAEV,8BAA8B,EAC/B,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,qBAAa,mBAAmB;;IAK9B;;;;;OAKG;IACH,YAAY,YAAY,GAAE,gBAA6C,EAEtE;IAED;;;;OAIG;IACH,IAAI,KAAK,IAAI,gBAAgB,CAE5B;IAED;;;;;OAKG;IACH,eAAe,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CAQpD;IAED;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,gBAAgB,GAAG,OAAO,CASjD;IAED;;;;;OAKG;IACH,aAAa,CAAC,QAAQ,EAAE,8BAA8B,GAAG,MAAM,IAAI,CAGlE;IAED;;OAEG;IACH,kBAAkB,IAAI,IAAI,CAEzB;IAWD;;;;OAIG;IACH,MAAM,IAAI;QAAE,KAAK,EAAE,gBAAgB,CAAA;KAAE,CAIpC;CACF"}
|
|
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _QuoteStatusStateFsm_instances, _QuoteStatusStateFsm_state, _QuoteStatusStateFsm_listeners, _QuoteStatusStateFsm_emitStateUpdate;
|
|
13
|
-
import { AllowedQuoteStatusStateTransitions, QuoteStatusState } from
|
|
13
|
+
import { AllowedQuoteStatusStateTransitions, QuoteStatusState, } from './constants.js';
|
|
14
14
|
/**
|
|
15
15
|
* Finite state machine that enforces forward-only quote status transitions.
|
|
16
16
|
*/
|
|
@@ -100,4 +100,4 @@ _QuoteStatusStateFsm_state = new WeakMap(), _QuoteStatusStateFsm_listeners = new
|
|
|
100
100
|
listener(event);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
//# sourceMappingURL=quote-status-state-fsm.
|
|
103
|
+
//# sourceMappingURL=quote-status-state-fsm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-state-fsm.js","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-state-fsm.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EACL,kCAAkC,EAClC,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAMxB;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAK9B;;;;;OAKG;IACH,YAAY,YAAY,GAAqB,gBAAgB,CAAC,SAAS;;QAVvE,6CAAyB;QAEhB,yCAAa,IAAI,GAAG,EAAkC,EAAC;QAS9D,uBAAA,IAAI,8BAAU,YAAY,MAAA,CAAC;IAC7B,CAAC;IAED;;;;OAI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H,CAAC","sourcesContent":["import {\n AllowedQuoteStatusStateTransitions,\n QuoteStatusState,\n} from './constants.js';\nimport type {\n QuoteStatusStateUpdateEvent,\n QuoteStatusStateUpdateListener,\n} from './types.js';\n\n/**\n * Finite state machine that enforces forward-only quote status transitions.\n */\nexport class QuoteStatusStateFsm {\n #state: QuoteStatusState;\n\n readonly #listeners = new Set<QuoteStatusStateUpdateListener>();\n\n /**\n * Creates a state machine with a default {@link QuoteStatusState.Submitted}\n * state.\n *\n * @param initialState - Optional initial state.\n */\n constructor(initialState: QuoteStatusState = QuoteStatusState.Submitted) {\n this.#state = initialState;\n }\n\n /**\n * Current lifecycle state.\n *\n * @returns The current quote status lifecycle state.\n */\n get state(): QuoteStatusState {\n return this.#state;\n }\n\n /**\n * Returns whether the current state can transition to the provided next state.\n *\n * @param nextState - Desired next state.\n * @returns `true` if the transition is valid.\n */\n canTransitionTo(nextState: QuoteStatusState): boolean {\n // Seeded persisted state may contain an unknown/legacy value that is not a\n // key in the transition map. Treat any such state as terminal (no allowed\n // transitions) instead of throwing on `undefined.includes(...)`.\n return (\n AllowedQuoteStatusStateTransitions[this.#state]?.includes(nextState) ??\n false\n );\n }\n\n /**\n * Transitions to the provided state if allowed.\n *\n * Emits a state update event when the transition succeeds.\n *\n * @param nextState - Desired next state.\n * @returns `true` if the transition was applied, otherwise `false`.\n */\n transitionTo(nextState: QuoteStatusState): boolean {\n if (!this.canTransitionTo(nextState)) {\n return false;\n }\n\n const previousState = this.#state;\n this.#state = nextState;\n this.#emitStateUpdate({ previousState, nextState });\n return true;\n }\n\n /**\n * Subscribes to state update events.\n *\n * @param listener - Callback invoked on each successful state transition.\n * @returns Unsubscribe function.\n */\n onStateUpdate(listener: QuoteStatusStateUpdateListener): () => void {\n this.#listeners.add(listener);\n return () => this.#listeners.delete(listener);\n }\n\n /**\n * Removes every subscribed state update listener.\n */\n removeAllListeners(): void {\n this.#listeners.clear();\n }\n\n #emitStateUpdate(event: QuoteStatusStateUpdateEvent): void {\n // Iterate over a snapshot so that a listener subscribing or unsubscribing\n // (including unsubscribing itself) during emission does not affect the\n // current notification pass.\n for (const listener of [...this.#listeners]) {\n listener(event);\n }\n }\n\n /**\n * Serializes the machine to a plain, persistable object.\n *\n * @returns The current lifecycle state wrapped in a plain object.\n */\n toJson(): { state: QuoteStatusState } {\n return {\n state: this.state,\n };\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { QuoteStatusFetchWithRetryOutcomeType } from
|
|
2
|
-
import { QuoteStatusUpdateResponse } from
|
|
1
|
+
import { QuoteStatusFetchWithRetryOutcomeType } from './constants.js';
|
|
2
|
+
import { QuoteStatusUpdateResponse } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Result of a retrying quote status update
|
|
5
5
|
* ({@link QuoteStatusApiService.updateQuoteStatusWithRetry}).
|
|
@@ -27,4 +27,4 @@ export declare class QuoteStatusUpdateWithRetryOutcome {
|
|
|
27
27
|
*/
|
|
28
28
|
constructor(outcome: QuoteStatusFetchWithRetryOutcomeType, response?: QuoteStatusUpdateResponse);
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=quote-status-update-with-retry-outcome.d.
|
|
30
|
+
//# sourceMappingURL=quote-status-update-with-retry-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-update-with-retry-outcome.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-update-with-retry-outcome.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,qBAAa,iCAAiC;IAC5C;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,oCAAoC,CAAC;IAEpD;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,yBAAyB,CAAC;IAE9C;;;OAGG;IACH,YACE,OAAO,EAAE,oCAAoC,EAC7C,QAAQ,CAAC,EAAE,yBAAyB,EAIrC;CACF"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { QuoteStatusFetchWithRetryOutcomeType } from "./constants.mjs";
|
|
2
1
|
/**
|
|
3
2
|
* Result of a retrying quote status update
|
|
4
3
|
* ({@link QuoteStatusApiService.updateQuoteStatusWithRetry}).
|
|
@@ -20,4 +19,4 @@ export class QuoteStatusUpdateWithRetryOutcome {
|
|
|
20
19
|
this.response = response;
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
|
-
//# sourceMappingURL=quote-status-update-with-retry-outcome.
|
|
22
|
+
//# sourceMappingURL=quote-status-update-with-retry-outcome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-status-update-with-retry-outcome.js","sourceRoot":"","sources":["../../src/quote-status-manager/quote-status-update-with-retry-outcome.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iCAAiC;IAY5C;;;OAGG;IACH,YACE,OAA6C,EAC7C,QAAoC;QAEpC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF","sourcesContent":["import { QuoteStatusFetchWithRetryOutcomeType } from './constants.js';\nimport { QuoteStatusUpdateResponse } from './types.js';\n\n/**\n * Result of a retrying quote status update\n * ({@link QuoteStatusApiService.updateQuoteStatusWithRetry}).\n *\n * Represents how an update attempt resolved so callers can branch on the\n * outcome without having to re-interpret raw HTTP responses or thrown errors.\n * The discriminating {@link type} indicates whether the update was accepted,\n * hit a non-retryable error, was interrupted, or exhausted its retries. The\n * optional {@link response} carries the backend error payload (when present),\n * which callers use to reconcile local state for non-retryable errors.\n */\nexport class QuoteStatusUpdateWithRetryOutcome {\n /**\n * Discriminant describing how the update attempt resolved.\n */\n readonly type: QuoteStatusFetchWithRetryOutcomeType;\n\n /**\n * Backend error response associated with the outcome, when one was returned\n * (typically for {@link QuoteStatusUpdateWithRetryOutcomeType.NonRetryable}).\n */\n readonly response?: QuoteStatusUpdateResponse;\n\n /**\n * @param outcome - The outcome type describing how the update resolved.\n * @param response - Optional backend error response associated with the outcome.\n */\n constructor(\n outcome: QuoteStatusFetchWithRetryOutcomeType,\n response?: QuoteStatusUpdateResponse,\n ) {\n this.type = outcome;\n this.response = response;\n }\n}\n"]}
|
package/dist/quote-status-manager/{quotes-status-manager.d.cts → quotes-status-manager.d.ts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BridgeClientId, BridgeStatusControllerMessenger } from
|
|
2
|
-
import { QuoteStatusUpdateError } from
|
|
3
|
-
import { QuoteStatusGetWithRetryOutcome } from
|
|
4
|
-
import { QuoteStatusPersistEntry } from
|
|
1
|
+
import { BridgeClientId, BridgeStatusControllerMessenger } from '../types.js';
|
|
2
|
+
import { QuoteStatusUpdateError } from './errors.js';
|
|
3
|
+
import { QuoteStatusGetWithRetryOutcome } from './quote-status-get-with-retry-outcome.js';
|
|
4
|
+
import { QuoteStatusPersistEntry } from './types.js';
|
|
5
5
|
/**
|
|
6
6
|
* Tracks bridge/swap quotes through their lifecycle and keeps the backend in
|
|
7
7
|
* sync with the latest known status of each quote.
|
|
@@ -132,4 +132,4 @@ export declare class QuoteStatusManager {
|
|
|
132
132
|
delayMsBetweenRetries?: number;
|
|
133
133
|
}): Promise<QuoteStatusGetWithRetryOutcome | undefined>;
|
|
134
134
|
}
|
|
135
|
-
//# sourceMappingURL=quotes-status-manager.d.
|
|
135
|
+
//# sourceMappingURL=quotes-status-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quotes-status-manager.d.ts","sourceRoot":"","sources":["../../src/quote-status-manager/quotes-status-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAa9E,OAAO,EAAE,sBAAsB,EAAE,MA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AE,MAAM,GAAG,MAAM,GAC3B,IAAI,CA+BN;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAGd;IAED;;;;;;;;;;;;;;OAcG;IACH,IAAI,IAAI,IAAI,CA+CX;IAED;;;;;;;;;;;;OAYG;IACG,SAAS,CACb,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,qBAAqB,CAAC,EAAE,MAAM,CAAC;KAIhC,GACA,OAAO,CAAC,8BAA8B,GAAG,SAAS,CAAC,CAmBrD;CAkYF"}
|
|
@@ -10,16 +10,13 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
12
|
var _QuoteStatusManager_instances, _QuoteStatusManager_messenger, _QuoteStatusManager_quoteStatusApiService, _QuoteStatusManager_quoteStatusEntryStore, _QuoteStatusManager_isEnabled, _QuoteStatusManager_onError, _QuoteStatusManager_updateIntervalMs, _QuoteStatusManager_retryIntervalId, _QuoteStatusManager_processInitial, _QuoteStatusManager_ensureRetryTimerRunning, _QuoteStatusManager_stopRetryTimer, _QuoteStatusManager_processRetries, _QuoteStatusManager_hasPendingUpdates, _QuoteStatusManager_stopRetryTimerIfIdle, _QuoteStatusManager_processEntry, _QuoteStatusManager_markCompleted, _QuoteStatusManager_markExpired, _QuoteStatusManager_handleNonRetryableUpdateStatusError;
|
|
13
|
-
import { TransactionStatus } from
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { QuoteStatusGetWithRetryOutcome } from "./quote-status-get-with-retry-outcome.mjs";
|
|
21
|
-
import { QuoteStatusStateFsm } from "./quote-status-state-fsm.mjs";
|
|
22
|
-
import { QuoteStatusUpdateWithRetryOutcome } from "./quote-status-update-with-retry-outcome.mjs";
|
|
13
|
+
import { TransactionStatus } from '@metamask/transaction-controller';
|
|
14
|
+
import { getTransactionMetaById, hasNestedSwapTransactions, isCrossChainTx, } from '../utils/transaction.js';
|
|
15
|
+
import { QuoteStatusState, QuoteStatusStateToBackendStatus, QuoteStatusUpdateBackendErrorType, QuoteStatusBackendStatus, QuoteStatusFetchWithRetryOutcomeType, } from './constants.js';
|
|
16
|
+
import { QuoteStatusUpdateError } from './errors.js';
|
|
17
|
+
import { QuoteStatusApiService } from './quote-status-api-service.js';
|
|
18
|
+
import { QuoteStatusEntryStore } from './quote-status-entry-store.js';
|
|
19
|
+
import { QuoteStatusStateFsm } from './quote-status-state-fsm.js';
|
|
23
20
|
/**
|
|
24
21
|
* Tracks bridge/swap quotes through their lifecycle and keeps the backend in
|
|
25
22
|
* sync with the latest known status of each quote.
|
|
@@ -499,4 +496,4 @@ _QuoteStatusManager_messenger = new WeakMap(), _QuoteStatusManager_quoteStatusAp
|
|
|
499
496
|
srcChainId: entry.srcChainId,
|
|
500
497
|
}));
|
|
501
498
|
};
|
|
502
|
-
//# sourceMappingURL=quotes-status-manager.
|
|
499
|
+
//# sourceMappingURL=quotes-status-manager.js.map
|