@metamask-previews/transaction-controller 69.6.1-preview-4f4c98e → 69.6.1-preview-eb263b0ee
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -5
- package/dist/TransactionController-method-action-types.cjs +7 -0
- package/dist/TransactionController-method-action-types.cjs.map +1 -0
- package/dist/{TransactionController-method-action-types.d.ts → TransactionController-method-action-types.d.cts} +2 -2
- package/dist/TransactionController-method-action-types.d.cts.map +1 -0
- package/dist/TransactionController-method-action-types.d.mts +413 -0
- package/dist/TransactionController-method-action-types.d.mts.map +1 -0
- package/dist/{TransactionController-method-action-types.js → TransactionController-method-action-types.mjs} +1 -1
- package/dist/TransactionController-method-action-types.mjs.map +1 -0
- package/dist/TransactionController.cjs +2444 -0
- package/dist/TransactionController.cjs.map +1 -0
- package/dist/{TransactionController.d.ts → TransactionController.d.cts} +18 -18
- package/dist/TransactionController.d.cts.map +1 -0
- package/dist/TransactionController.d.mts +751 -0
- package/dist/TransactionController.d.mts.map +1 -0
- package/dist/{TransactionController.js → TransactionController.mjs} +50 -49
- package/dist/TransactionController.mjs.map +1 -0
- package/dist/api/accounts-api.cjs +57 -0
- package/dist/api/accounts-api.cjs.map +1 -0
- package/dist/api/{accounts-api.d.ts → accounts-api.d.cts} +1 -1
- package/dist/api/accounts-api.d.cts.map +1 -0
- package/dist/api/accounts-api.d.mts +44 -0
- package/dist/api/accounts-api.d.mts.map +1 -0
- package/dist/api/{accounts-api.js → accounts-api.mjs} +5 -5
- package/dist/api/accounts-api.mjs.map +1 -0
- package/dist/api/simulation-api.cjs +116 -0
- package/dist/api/simulation-api.cjs.map +1 -0
- package/dist/api/{simulation-api.d.ts → simulation-api.d.cts} +3 -3
- package/dist/api/simulation-api.d.cts.map +1 -0
- package/dist/api/simulation-api.d.mts +196 -0
- package/dist/api/simulation-api.d.mts.map +1 -0
- package/dist/api/{simulation-api.js → simulation-api.mjs} +8 -7
- package/dist/api/simulation-api.mjs.map +1 -0
- package/dist/constants.cjs +111 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/{constants.d.ts → constants.d.cts} +37 -37
- package/dist/constants.d.cts.map +1 -0
- package/dist/constants.d.mts +78 -0
- package/dist/constants.d.mts.map +1 -0
- package/dist/{constants.js → constants.mjs} +1 -1
- package/dist/constants.mjs.map +1 -0
- package/dist/errors.cjs +37 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/{errors.d.ts → errors.d.cts} +2 -2
- package/dist/errors.d.cts.map +1 -0
- package/dist/errors.d.mts +19 -0
- package/dist/errors.d.mts.map +1 -0
- package/dist/{errors.js → errors.mjs} +2 -2
- package/dist/errors.mjs.map +1 -0
- package/dist/gas-flows/DefaultGasFeeFlow.cjs +85 -0
- package/dist/gas-flows/{DefaultGasFeeFlow.js.map → DefaultGasFeeFlow.cjs.map} +1 -1
- package/dist/gas-flows/{DefaultGasFeeFlow.d.ts → DefaultGasFeeFlow.d.cts} +2 -2
- package/dist/gas-flows/DefaultGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts +10 -0
- package/dist/gas-flows/DefaultGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{DefaultGasFeeFlow.js → DefaultGasFeeFlow.mjs} +6 -6
- package/dist/gas-flows/DefaultGasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/LineaGasFeeFlow.cjs +111 -0
- package/dist/gas-flows/LineaGasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{LineaGasFeeFlow.d.ts → LineaGasFeeFlow.d.cts} +3 -3
- package/dist/gas-flows/LineaGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/LineaGasFeeFlow.d.mts +16 -0
- package/dist/gas-flows/LineaGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{LineaGasFeeFlow.js → LineaGasFeeFlow.mjs} +7 -7
- package/dist/gas-flows/LineaGasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/MantleLayer1GasFeeFlow.cjs +66 -0
- package/dist/gas-flows/MantleLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{MantleLayer1GasFeeFlow.d.ts → MantleLayer1GasFeeFlow.d.cts} +5 -5
- package/dist/gas-flows/MantleLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/MantleLayer1GasFeeFlow.d.mts +21 -0
- package/dist/gas-flows/MantleLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{MantleLayer1GasFeeFlow.js → MantleLayer1GasFeeFlow.mjs} +6 -6
- package/dist/gas-flows/MantleLayer1GasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs +59 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{OptimismLayer1GasFeeFlow.d.ts → OptimismLayer1GasFeeFlow.d.cts} +4 -4
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts +14 -0
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{OptimismLayer1GasFeeFlow.js → OptimismLayer1GasFeeFlow.mjs} +5 -5
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs +201 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{OracleLayer1GasFeeFlow.d.ts → OracleLayer1GasFeeFlow.d.cts} +5 -5
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts +57 -0
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{OracleLayer1GasFeeFlow.js → OracleLayer1GasFeeFlow.mjs} +15 -8
- package/dist/gas-flows/OracleLayer1GasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs +123 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{RandomisedEstimationsGasFeeFlow.d.ts → RandomisedEstimationsGasFeeFlow.d.cts} +4 -4
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts +28 -0
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{RandomisedEstimationsGasFeeFlow.js → RandomisedEstimationsGasFeeFlow.mjs} +8 -8
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs +24 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{ScrollLayer1GasFeeFlow.d.ts → ScrollLayer1GasFeeFlow.d.cts} +5 -5
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts +16 -0
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{ScrollLayer1GasFeeFlow.js → ScrollLayer1GasFeeFlow.mjs} +3 -3
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.mjs.map +1 -0
- package/dist/gas-flows/TestGasFeeFlow.cjs +73 -0
- package/dist/gas-flows/TestGasFeeFlow.cjs.map +1 -0
- package/dist/gas-flows/{TestGasFeeFlow.d.ts → TestGasFeeFlow.d.cts} +2 -2
- package/dist/gas-flows/TestGasFeeFlow.d.cts.map +1 -0
- package/dist/gas-flows/TestGasFeeFlow.d.mts +12 -0
- package/dist/gas-flows/TestGasFeeFlow.d.mts.map +1 -0
- package/dist/gas-flows/{TestGasFeeFlow.js → TestGasFeeFlow.mjs} +3 -3
- package/dist/gas-flows/TestGasFeeFlow.mjs.map +1 -0
- package/dist/helpers/GasFeePoller.cjs +334 -0
- package/dist/helpers/GasFeePoller.cjs.map +1 -0
- package/dist/helpers/{GasFeePoller.d.ts → GasFeePoller.d.cts} +10 -7
- package/dist/helpers/GasFeePoller.d.cts.map +1 -0
- package/dist/helpers/GasFeePoller.d.mts +66 -0
- package/dist/helpers/GasFeePoller.d.mts.map +1 -0
- package/dist/helpers/{GasFeePoller.js → GasFeePoller.mjs} +9 -9
- package/dist/helpers/GasFeePoller.mjs.map +1 -0
- package/dist/helpers/MethodDataHelper.cjs +84 -0
- package/dist/helpers/MethodDataHelper.cjs.map +1 -0
- package/dist/helpers/{MethodDataHelper.d.ts → MethodDataHelper.d.cts} +7 -4
- package/dist/helpers/MethodDataHelper.d.cts.map +1 -0
- package/dist/helpers/MethodDataHelper.d.mts +16 -0
- package/dist/helpers/MethodDataHelper.d.mts.map +1 -0
- package/dist/helpers/{MethodDataHelper.js → MethodDataHelper.mjs} +7 -7
- package/dist/helpers/MethodDataHelper.mjs.map +1 -0
- package/dist/helpers/MultichainTrackingHelper.cjs +231 -0
- package/dist/helpers/MultichainTrackingHelper.cjs.map +1 -0
- package/dist/helpers/{MultichainTrackingHelper.d.ts → MultichainTrackingHelper.d.cts} +5 -5
- package/dist/helpers/MultichainTrackingHelper.d.cts.map +1 -0
- package/dist/helpers/MultichainTrackingHelper.d.mts +56 -0
- package/dist/helpers/MultichainTrackingHelper.d.mts.map +1 -0
- package/dist/helpers/{MultichainTrackingHelper.js → MultichainTrackingHelper.mjs} +8 -8
- package/dist/helpers/MultichainTrackingHelper.mjs.map +1 -0
- package/dist/helpers/PendingTransactionTracker.cjs +407 -0
- package/dist/helpers/PendingTransactionTracker.cjs.map +1 -0
- package/dist/helpers/{PendingTransactionTracker.d.ts → PendingTransactionTracker.d.cts} +8 -5
- package/dist/helpers/PendingTransactionTracker.d.cts.map +1 -0
- package/dist/helpers/PendingTransactionTracker.d.mts +54 -0
- package/dist/helpers/PendingTransactionTracker.d.mts.map +1 -0
- package/dist/helpers/{PendingTransactionTracker.js → PendingTransactionTracker.mjs} +15 -14
- package/dist/helpers/PendingTransactionTracker.mjs.map +1 -0
- package/dist/helpers/ResimulateHelper.cjs +274 -0
- package/dist/helpers/ResimulateHelper.cjs.map +1 -0
- package/dist/helpers/{ResimulateHelper.d.ts → ResimulateHelper.d.cts} +3 -3
- package/dist/helpers/ResimulateHelper.d.cts.map +1 -0
- package/dist/helpers/ResimulateHelper.d.mts +36 -0
- package/dist/helpers/ResimulateHelper.d.mts.map +1 -0
- package/dist/helpers/{ResimulateHelper.js → ResimulateHelper.mjs} +8 -7
- package/dist/helpers/ResimulateHelper.mjs.map +1 -0
- package/dist/helpers/TransactionPoller.cjs +175 -0
- package/dist/helpers/TransactionPoller.cjs.map +1 -0
- package/dist/helpers/{TransactionPoller.d.ts → TransactionPoller.d.cts} +5 -5
- package/dist/helpers/TransactionPoller.d.cts.map +1 -0
- package/dist/helpers/TransactionPoller.d.mts +37 -0
- package/dist/helpers/TransactionPoller.d.mts.map +1 -0
- package/dist/helpers/{TransactionPoller.js → TransactionPoller.mjs} +11 -10
- package/dist/helpers/TransactionPoller.mjs.map +1 -0
- package/dist/hooks/CollectPublishHook.cjs +94 -0
- package/dist/hooks/CollectPublishHook.cjs.map +1 -0
- package/dist/hooks/{CollectPublishHook.d.ts → CollectPublishHook.d.cts} +3 -3
- package/dist/hooks/CollectPublishHook.d.cts.map +1 -0
- package/dist/hooks/CollectPublishHook.d.mts +29 -0
- package/dist/hooks/CollectPublishHook.d.mts.map +1 -0
- package/dist/hooks/{CollectPublishHook.js → CollectPublishHook.mjs} +5 -4
- package/dist/hooks/CollectPublishHook.mjs.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs +126 -0
- package/dist/hooks/ExtraTransactionsPublishHook.cjs.map +1 -0
- package/dist/hooks/{ExtraTransactionsPublishHook.d.ts → ExtraTransactionsPublishHook.d.cts} +3 -3
- package/dist/hooks/ExtraTransactionsPublishHook.d.cts.map +1 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts +19 -0
- package/dist/hooks/ExtraTransactionsPublishHook.d.mts.map +1 -0
- package/dist/hooks/{ExtraTransactionsPublishHook.js → ExtraTransactionsPublishHook.mjs} +3 -3
- package/dist/hooks/ExtraTransactionsPublishHook.mjs.map +1 -0
- package/dist/hooks/SequentialPublishBatchHook.cjs +112 -0
- package/dist/hooks/SequentialPublishBatchHook.cjs.map +1 -0
- package/dist/hooks/{SequentialPublishBatchHook.d.ts → SequentialPublishBatchHook.d.cts} +4 -4
- package/dist/hooks/SequentialPublishBatchHook.d.cts.map +1 -0
- package/dist/hooks/SequentialPublishBatchHook.d.mts +22 -0
- package/dist/hooks/SequentialPublishBatchHook.d.mts.map +1 -0
- package/dist/hooks/{SequentialPublishBatchHook.js → SequentialPublishBatchHook.mjs} +4 -4
- package/dist/hooks/SequentialPublishBatchHook.mjs.map +1 -0
- package/dist/index.cjs +40 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +16 -16
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +12 -0
- package/dist/index.mjs.map +1 -0
- package/dist/logger.cjs +9 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/{logger.d.ts → logger.d.cts} +3 -2
- package/dist/logger.d.cts.map +1 -0
- package/dist/logger.d.mts +6 -0
- package/dist/logger.d.mts.map +1 -0
- package/dist/{logger.js → logger.mjs} +2 -2
- package/dist/logger.mjs.map +1 -0
- package/dist/types.cjs +382 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types.d.ts → types.d.cts} +8 -8
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +1887 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/{types.js → types.mjs} +1 -1
- package/dist/types.mjs.map +1 -0
- package/dist/utils/balance-changes.cjs +592 -0
- package/dist/utils/balance-changes.cjs.map +1 -0
- package/dist/utils/{balance-changes.d.ts → balance-changes.d.cts} +5 -5
- package/dist/utils/balance-changes.d.cts.map +1 -0
- package/dist/utils/balance-changes.d.mts +38 -0
- package/dist/utils/balance-changes.d.mts.map +1 -0
- package/dist/utils/{balance-changes.js → balance-changes.mjs} +20 -13
- package/dist/utils/balance-changes.mjs.map +1 -0
- package/dist/utils/balance.cjs +44 -0
- package/dist/utils/balance.cjs.map +1 -0
- package/dist/utils/{balance.d.ts → balance.d.cts} +5 -5
- package/dist/utils/balance.d.cts.map +1 -0
- package/dist/utils/balance.d.mts +26 -0
- package/dist/utils/balance.d.mts.map +1 -0
- package/dist/utils/{balance.js → balance.mjs} +3 -3
- package/dist/utils/balance.mjs.map +1 -0
- package/dist/utils/batch.cjs +712 -0
- package/dist/utils/batch.cjs.map +1 -0
- package/dist/utils/{batch.d.ts → batch.d.cts} +8 -8
- package/dist/utils/batch.d.cts.map +1 -0
- package/dist/utils/batch.d.mts +58 -0
- package/dist/utils/batch.d.mts.map +1 -0
- package/dist/utils/{batch.js → batch.mjs} +18 -18
- package/dist/utils/batch.mjs.map +1 -0
- package/dist/utils/eip7702.cjs +354 -0
- package/dist/utils/eip7702.cjs.map +1 -0
- package/dist/utils/{eip7702.d.ts → eip7702.d.cts} +5 -5
- package/dist/utils/eip7702.d.cts.map +1 -0
- package/dist/utils/eip7702.d.mts +137 -0
- package/dist/utils/eip7702.d.mts.map +1 -0
- package/dist/utils/{eip7702.js → eip7702.mjs} +12 -12
- package/dist/utils/eip7702.mjs.map +1 -0
- package/dist/utils/external-transactions.cjs +36 -0
- package/dist/utils/external-transactions.cjs.map +1 -0
- package/dist/utils/{external-transactions.d.ts → external-transactions.d.cts} +2 -2
- package/dist/utils/external-transactions.d.cts.map +1 -0
- package/dist/utils/external-transactions.d.mts +10 -0
- package/dist/utils/external-transactions.d.mts.map +1 -0
- package/dist/utils/{external-transactions.js → external-transactions.mjs} +3 -3
- package/dist/utils/external-transactions.mjs.map +1 -0
- package/dist/utils/feature-flags.cjs +255 -0
- package/dist/utils/feature-flags.cjs.map +1 -0
- package/dist/utils/{feature-flags.d.ts → feature-flags.d.cts} +3 -3
- package/dist/utils/feature-flags.d.cts.map +1 -0
- package/dist/utils/feature-flags.d.mts +313 -0
- package/dist/utils/feature-flags.d.mts.map +1 -0
- package/dist/utils/{feature-flags.js → feature-flags.mjs} +5 -5
- package/dist/utils/feature-flags.mjs.map +1 -0
- package/dist/utils/first-time-interaction.cjs +69 -0
- package/dist/utils/first-time-interaction.cjs.map +1 -0
- package/dist/utils/{first-time-interaction.d.ts → first-time-interaction.d.cts} +3 -3
- package/dist/utils/first-time-interaction.d.cts.map +1 -0
- package/dist/utils/first-time-interaction.d.mts +30 -0
- package/dist/utils/first-time-interaction.d.mts.map +1 -0
- package/dist/utils/{first-time-interaction.js → first-time-interaction.mjs} +6 -6
- package/dist/utils/first-time-interaction.mjs.map +1 -0
- package/dist/utils/gas-fee-tokens.cjs +174 -0
- package/dist/utils/gas-fee-tokens.cjs.map +1 -0
- package/dist/utils/{gas-fee-tokens.d.ts → gas-fee-tokens.d.cts} +5 -5
- package/dist/utils/gas-fee-tokens.d.cts.map +1 -0
- package/dist/utils/gas-fee-tokens.d.mts +46 -0
- package/dist/utils/gas-fee-tokens.d.mts.map +1 -0
- package/dist/utils/{gas-fee-tokens.js → gas-fee-tokens.mjs} +9 -9
- package/dist/utils/gas-fee-tokens.mjs.map +1 -0
- package/dist/utils/gas-fees.cjs +424 -0
- package/dist/utils/gas-fees.cjs.map +1 -0
- package/dist/utils/{gas-fees.d.ts → gas-fees.d.cts} +5 -5
- package/dist/utils/gas-fees.d.cts.map +1 -0
- package/dist/utils/gas-fees.d.mts +57 -0
- package/dist/utils/gas-fees.d.mts.map +1 -0
- package/dist/utils/{gas-fees.js → gas-fees.mjs} +9 -9
- package/dist/utils/gas-fees.mjs.map +1 -0
- package/dist/utils/gas-flow.cjs +81 -0
- package/dist/utils/gas-flow.cjs.map +1 -0
- package/dist/utils/{gas-flow.d.ts → gas-flow.d.cts} +6 -6
- package/dist/utils/gas-flow.d.cts.map +1 -0
- package/dist/utils/gas-flow.d.mts +29 -0
- package/dist/utils/gas-flow.d.mts.map +1 -0
- package/dist/utils/{gas-flow.js → gas-flow.mjs} +3 -3
- package/dist/utils/gas-flow.mjs.map +1 -0
- package/dist/utils/gas.cjs +545 -0
- package/dist/utils/gas.cjs.map +1 -0
- package/dist/utils/{gas.d.ts → gas.d.cts} +6 -5
- package/dist/utils/gas.d.cts.map +1 -0
- package/dist/utils/gas.d.mts +116 -0
- package/dist/utils/gas.d.mts.map +1 -0
- package/dist/utils/{gas.js → gas.mjs} +11 -11
- package/dist/utils/gas.mjs.map +1 -0
- package/dist/utils/layer1-gas-fee-flow.cjs +73 -0
- package/dist/utils/layer1-gas-fee-flow.cjs.map +1 -0
- package/dist/utils/{layer1-gas-fee-flow.d.ts → layer1-gas-fee-flow.d.cts} +4 -4
- package/dist/utils/layer1-gas-fee-flow.d.cts.map +1 -0
- package/dist/utils/layer1-gas-fee-flow.d.mts +28 -0
- package/dist/utils/layer1-gas-fee-flow.d.mts.map +1 -0
- package/dist/utils/{layer1-gas-fee-flow.js → layer1-gas-fee-flow.mjs} +3 -3
- package/dist/utils/layer1-gas-fee-flow.mjs.map +1 -0
- package/dist/utils/nonce.cjs +93 -0
- package/dist/utils/nonce.cjs.map +1 -0
- package/dist/utils/{nonce.d.ts → nonce.d.cts} +3 -3
- package/dist/utils/nonce.d.cts.map +1 -0
- package/dist/utils/nonce.d.mts +26 -0
- package/dist/utils/nonce.d.mts.map +1 -0
- package/dist/utils/{nonce.js → nonce.mjs} +4 -4
- package/dist/utils/nonce.mjs.map +1 -0
- package/dist/utils/prepare.cjs +97 -0
- package/dist/utils/prepare.cjs.map +1 -0
- package/dist/utils/{prepare.d.ts → prepare.d.cts} +5 -5
- package/dist/utils/prepare.d.cts.map +1 -0
- package/dist/utils/prepare.d.mts +22 -0
- package/dist/utils/prepare.d.mts.map +1 -0
- package/dist/utils/{prepare.js → prepare.mjs} +6 -5
- package/dist/utils/prepare.mjs.map +1 -0
- package/dist/utils/provider.cjs +106 -0
- package/dist/utils/provider.cjs.map +1 -0
- package/dist/utils/{provider.d.ts → provider.d.cts} +4 -4
- package/dist/utils/provider.d.cts.map +1 -0
- package/dist/utils/provider.d.mts +65 -0
- package/dist/utils/provider.d.mts.map +1 -0
- package/dist/utils/{provider.js → provider.mjs} +3 -3
- package/dist/utils/provider.mjs.map +1 -0
- package/dist/utils/recipient.cjs +31 -0
- package/dist/utils/recipient.cjs.map +1 -0
- package/dist/utils/{recipient.d.ts → recipient.d.cts} +2 -2
- package/dist/utils/recipient.d.cts.map +1 -0
- package/dist/utils/recipient.d.mts +13 -0
- package/dist/utils/recipient.d.mts.map +1 -0
- package/dist/utils/{recipient.js → recipient.mjs} +3 -3
- package/dist/utils/recipient.mjs.map +1 -0
- package/dist/utils/retry.cjs +93 -0
- package/dist/utils/retry.cjs.map +1 -0
- package/dist/utils/{retry.d.ts → retry.d.cts} +2 -2
- package/dist/utils/retry.d.cts.map +1 -0
- package/dist/utils/retry.d.mts +11 -0
- package/dist/utils/retry.d.mts.map +1 -0
- package/dist/utils/{retry.js → retry.mjs} +3 -3
- package/dist/utils/retry.mjs.map +1 -0
- package/dist/utils/revert-reason.cjs +192 -0
- package/dist/utils/revert-reason.cjs.map +1 -0
- package/dist/utils/{revert-reason.d.ts → revert-reason.d.cts} +5 -5
- package/dist/utils/revert-reason.d.cts.map +1 -0
- package/dist/utils/revert-reason.d.mts +57 -0
- package/dist/utils/revert-reason.d.mts.map +1 -0
- package/dist/utils/{revert-reason.js → revert-reason.mjs} +4 -4
- package/dist/utils/revert-reason.mjs.map +1 -0
- package/dist/utils/signature.cjs +26 -0
- package/dist/utils/signature.cjs.map +1 -0
- package/dist/utils/{signature.d.ts → signature.d.cts} +2 -2
- package/dist/utils/signature.d.cts.map +1 -0
- package/dist/utils/signature.d.mts +11 -0
- package/dist/utils/signature.d.mts.map +1 -0
- package/dist/utils/{signature.js → signature.mjs} +3 -3
- package/dist/utils/signature.mjs.map +1 -0
- package/dist/utils/swaps.cjs +332 -0
- package/dist/utils/swaps.cjs.map +1 -0
- package/dist/utils/{swaps.d.ts → swaps.d.cts} +5 -5
- package/dist/utils/swaps.d.cts.map +1 -0
- package/dist/utils/swaps.d.mts +90 -0
- package/dist/utils/swaps.d.mts.map +1 -0
- package/dist/utils/{swaps.js → swaps.mjs} +8 -7
- package/dist/utils/swaps.mjs.map +1 -0
- package/dist/utils/transaction-type.cjs +159 -0
- package/dist/utils/transaction-type.cjs.map +1 -0
- package/dist/utils/{transaction-type.d.ts → transaction-type.d.cts} +6 -6
- package/dist/utils/transaction-type.d.cts.map +1 -0
- package/dist/utils/transaction-type.d.mts +44 -0
- package/dist/utils/transaction-type.d.mts.map +1 -0
- package/dist/utils/{transaction-type.js → transaction-type.mjs} +6 -6
- package/dist/utils/transaction-type.mjs.map +1 -0
- package/dist/utils/utils.cjs +287 -0
- package/dist/utils/utils.cjs.map +1 -0
- package/dist/utils/{utils.d.ts → utils.d.cts} +4 -4
- package/dist/utils/utils.d.cts.map +1 -0
- package/dist/utils/utils.d.mts +101 -0
- package/dist/utils/utils.d.mts.map +1 -0
- package/dist/utils/{utils.js → utils.mjs} +12 -5
- package/dist/utils/utils.mjs.map +1 -0
- package/dist/utils/validation.cjs +389 -0
- package/dist/utils/validation.cjs.map +1 -0
- package/dist/utils/{validation.d.ts → validation.d.cts} +4 -4
- package/dist/utils/validation.d.cts.map +1 -0
- package/dist/utils/validation.d.mts +66 -0
- package/dist/utils/validation.d.mts.map +1 -0
- package/dist/utils/{validation.js → validation.mjs} +8 -8
- package/dist/utils/validation.mjs.map +1 -0
- package/package.json +19 -15
- package/dist/TransactionController-method-action-types.d.ts.map +0 -1
- package/dist/TransactionController-method-action-types.js.map +0 -1
- package/dist/TransactionController.d.ts.map +0 -1
- package/dist/TransactionController.js.map +0 -1
- package/dist/api/accounts-api.d.ts.map +0 -1
- package/dist/api/accounts-api.js.map +0 -1
- package/dist/api/simulation-api.d.ts.map +0 -1
- package/dist/api/simulation-api.js.map +0 -1
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/gas-flows/DefaultGasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/LineaGasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/LineaGasFeeFlow.js.map +0 -1
- package/dist/gas-flows/MantleLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/MantleLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/OptimismLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/OracleLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/RandomisedEstimationsGasFeeFlow.js.map +0 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/ScrollLayer1GasFeeFlow.js.map +0 -1
- package/dist/gas-flows/TestGasFeeFlow.d.ts.map +0 -1
- package/dist/gas-flows/TestGasFeeFlow.js.map +0 -1
- package/dist/helpers/GasFeePoller.d.ts.map +0 -1
- package/dist/helpers/GasFeePoller.js.map +0 -1
- package/dist/helpers/MethodDataHelper.d.ts.map +0 -1
- package/dist/helpers/MethodDataHelper.js.map +0 -1
- package/dist/helpers/MultichainTrackingHelper.d.ts.map +0 -1
- package/dist/helpers/MultichainTrackingHelper.js.map +0 -1
- package/dist/helpers/PendingTransactionTracker.d.ts.map +0 -1
- package/dist/helpers/PendingTransactionTracker.js.map +0 -1
- package/dist/helpers/ResimulateHelper.d.ts.map +0 -1
- package/dist/helpers/ResimulateHelper.js.map +0 -1
- package/dist/helpers/TransactionPoller.d.ts.map +0 -1
- package/dist/helpers/TransactionPoller.js.map +0 -1
- package/dist/hooks/CollectPublishHook.d.ts.map +0 -1
- package/dist/hooks/CollectPublishHook.js.map +0 -1
- package/dist/hooks/ExtraTransactionsPublishHook.d.ts.map +0 -1
- package/dist/hooks/ExtraTransactionsPublishHook.js.map +0 -1
- package/dist/hooks/SequentialPublishBatchHook.d.ts.map +0 -1
- package/dist/hooks/SequentialPublishBatchHook.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -12
- package/dist/index.js.map +0 -1
- package/dist/logger.d.ts.map +0 -1
- package/dist/logger.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/balance-changes.d.ts.map +0 -1
- package/dist/utils/balance-changes.js.map +0 -1
- package/dist/utils/balance.d.ts.map +0 -1
- package/dist/utils/balance.js.map +0 -1
- package/dist/utils/batch.d.ts.map +0 -1
- package/dist/utils/batch.js.map +0 -1
- package/dist/utils/eip7702.d.ts.map +0 -1
- package/dist/utils/eip7702.js.map +0 -1
- package/dist/utils/external-transactions.d.ts.map +0 -1
- package/dist/utils/external-transactions.js.map +0 -1
- package/dist/utils/feature-flags.d.ts.map +0 -1
- package/dist/utils/feature-flags.js.map +0 -1
- package/dist/utils/first-time-interaction.d.ts.map +0 -1
- package/dist/utils/first-time-interaction.js.map +0 -1
- package/dist/utils/gas-fee-tokens.d.ts.map +0 -1
- package/dist/utils/gas-fee-tokens.js.map +0 -1
- package/dist/utils/gas-fees.d.ts.map +0 -1
- package/dist/utils/gas-fees.js.map +0 -1
- package/dist/utils/gas-flow.d.ts.map +0 -1
- package/dist/utils/gas-flow.js.map +0 -1
- package/dist/utils/gas.d.ts.map +0 -1
- package/dist/utils/gas.js.map +0 -1
- package/dist/utils/layer1-gas-fee-flow.d.ts.map +0 -1
- package/dist/utils/layer1-gas-fee-flow.js.map +0 -1
- package/dist/utils/nonce.d.ts.map +0 -1
- package/dist/utils/nonce.js.map +0 -1
- package/dist/utils/prepare.d.ts.map +0 -1
- package/dist/utils/prepare.js.map +0 -1
- package/dist/utils/provider.d.ts.map +0 -1
- package/dist/utils/provider.js.map +0 -1
- package/dist/utils/recipient.d.ts.map +0 -1
- package/dist/utils/recipient.js.map +0 -1
- package/dist/utils/retry.d.ts.map +0 -1
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/revert-reason.d.ts.map +0 -1
- package/dist/utils/revert-reason.js.map +0 -1
- package/dist/utils/signature.d.ts.map +0 -1
- package/dist/utils/signature.js.map +0 -1
- package/dist/utils/swaps.d.ts.map +0 -1
- package/dist/utils/swaps.js.map +0 -1
- package/dist/utils/transaction-type.d.ts.map +0 -1
- package/dist/utils/transaction-type.js.map +0 -1
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js.map +0 -1
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js.map +0 -1
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import type { Hex } from "@metamask/utils";
|
|
2
|
+
import type { TransactionControllerMessenger } from "../TransactionController.mjs";
|
|
3
|
+
/**
|
|
4
|
+
* Feature flags supporting the transaction controller.
|
|
5
|
+
*/
|
|
6
|
+
export declare enum FeatureFlag {
|
|
7
|
+
EIP7702 = "confirmations_eip_7702",
|
|
8
|
+
GasBuffer = "confirmations_gas_buffer",
|
|
9
|
+
Transactions = "confirmations_transactions"
|
|
10
|
+
}
|
|
11
|
+
type GasEstimateFallback = {
|
|
12
|
+
/**
|
|
13
|
+
* The fixed gas estimate fallback for a transaction.
|
|
14
|
+
*/
|
|
15
|
+
fixed?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The percentage multiplier gas estimate fallback for a transaction.
|
|
18
|
+
*/
|
|
19
|
+
percentage?: number;
|
|
20
|
+
/**
|
|
21
|
+
* The maximum gas limit the fallback can resolve to, representing the chain's
|
|
22
|
+
* per-transaction gas cap. Clamps the `fixed` or `percentage`-derived fallback
|
|
23
|
+
* so it can never exceed the gas limit the RPC will accept (e.g. ~33.5M on
|
|
24
|
+
* Polygon, whereas 35% of its ~140M block gas limit would otherwise be ~49M).
|
|
25
|
+
*/
|
|
26
|
+
maxGasLimit?: number;
|
|
27
|
+
};
|
|
28
|
+
export type TransactionControllerFeatureFlags = {
|
|
29
|
+
/** Feature flags to support EIP-7702 / type-4 transactions. */
|
|
30
|
+
[FeatureFlag.EIP7702]?: {
|
|
31
|
+
/**
|
|
32
|
+
* All contracts that support EIP-7702 batch transactions.
|
|
33
|
+
* Keyed by chain ID.
|
|
34
|
+
* First entry in each array is the contract that standard EOAs will be upgraded to.
|
|
35
|
+
*/
|
|
36
|
+
contracts?: Record<Hex, {
|
|
37
|
+
/** Address of the smart contract. */
|
|
38
|
+
address: Hex;
|
|
39
|
+
/** Signature to verify the contract is authentic. */
|
|
40
|
+
signature: Hex;
|
|
41
|
+
}[]>;
|
|
42
|
+
/** Chains enabled for EIP-7702 batch transactions. */
|
|
43
|
+
supportedChains?: Hex[];
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Buffers added to gas limit estimations.
|
|
47
|
+
* Values are multipliers such as `1.5` meaning 150% of the original gas limit.
|
|
48
|
+
*/
|
|
49
|
+
[FeatureFlag.GasBuffer]?: {
|
|
50
|
+
/** Fallback buffer for all chains and transactions. */
|
|
51
|
+
default?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Buffer for included network RPCs only and not those added by user.
|
|
54
|
+
* Takes priority over `default`.
|
|
55
|
+
*/
|
|
56
|
+
included?: number;
|
|
57
|
+
/** Buffers for specific chains. */
|
|
58
|
+
perChainConfig?: {
|
|
59
|
+
[chainId: Hex]: {
|
|
60
|
+
/**
|
|
61
|
+
* Buffer for the chain for all transactions.
|
|
62
|
+
* Takes priority over non-chain `included`.
|
|
63
|
+
*/
|
|
64
|
+
base?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Buffer if network RPC is included and not added by user.
|
|
67
|
+
* Takes priority over `base`.
|
|
68
|
+
*/
|
|
69
|
+
included?: number;
|
|
70
|
+
/**
|
|
71
|
+
* Buffer for the chain for EIP-7702 / type 4 transactions only.
|
|
72
|
+
* Only if `data` included and `to` matches `from`.
|
|
73
|
+
* Takes priority over `included` and `base`.
|
|
74
|
+
*/
|
|
75
|
+
eip7702?: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/** Miscellaneous feature flags to support the transaction controller. */
|
|
80
|
+
[FeatureFlag.Transactions]?: {
|
|
81
|
+
/** Maximum number of transactions that can be in an external batch. */
|
|
82
|
+
batchSizeLimit?: number;
|
|
83
|
+
/** Maximum number of entries in the submit history. */
|
|
84
|
+
submitHistoryLimit?: number;
|
|
85
|
+
/** Maximum number of transactions stored in state. */
|
|
86
|
+
transactionHistoryLimit?: number;
|
|
87
|
+
/**
|
|
88
|
+
* Accelerated polling is used to speed up the polling process for
|
|
89
|
+
* transactions that are not yet confirmed.
|
|
90
|
+
*/
|
|
91
|
+
acceleratedPolling?: {
|
|
92
|
+
/** Accelerated polling parameters on a per-chain basis. */
|
|
93
|
+
perChainConfig?: {
|
|
94
|
+
[chainId: Hex]: {
|
|
95
|
+
/**
|
|
96
|
+
* Block time in milliseconds.
|
|
97
|
+
*/
|
|
98
|
+
blockTime?: number;
|
|
99
|
+
/**
|
|
100
|
+
* Maximum number of polling requests that can be made in a row, before
|
|
101
|
+
* the normal polling resumes.
|
|
102
|
+
*/
|
|
103
|
+
countMax?: number;
|
|
104
|
+
/** Interval between polling requests in milliseconds. */
|
|
105
|
+
intervalMs?: number;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
/** Default `countMax` in case no chain-specific parameter is set. */
|
|
109
|
+
defaultCountMax?: number;
|
|
110
|
+
/** Default `intervalMs` in case no chain-specific parameter is set. */
|
|
111
|
+
defaultIntervalMs?: number;
|
|
112
|
+
};
|
|
113
|
+
gasFeeRandomisation?: {
|
|
114
|
+
/** Randomised gas fee digits per chainId. */
|
|
115
|
+
randomisedGasFeeDigits?: Record<Hex, number>;
|
|
116
|
+
/** Number of digits to preserve for randomised gas fee digits. */
|
|
117
|
+
preservedNumberOfDigits?: number;
|
|
118
|
+
};
|
|
119
|
+
/** Gas estimate fallback is used as a fallback in case of failure to obtain the gas estimate values. */
|
|
120
|
+
gasEstimateFallback?: {
|
|
121
|
+
/** Gas estimate fallback per-chain basis. */
|
|
122
|
+
perChainConfig?: {
|
|
123
|
+
[chainId: Hex]: GasEstimateFallback;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Default gas estimate fallback.
|
|
127
|
+
* This value is used when no specific gas estimate fallback is found for a chain ID.
|
|
128
|
+
*/
|
|
129
|
+
default?: GasEstimateFallback;
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* Number of attempts to wait before automatically marking a transaction as failed
|
|
133
|
+
* if it has no receipt status and hash is not found on the network.
|
|
134
|
+
*/
|
|
135
|
+
timeoutAttempts?: {
|
|
136
|
+
/** Automatic fail threshold on a per-chain basis. */
|
|
137
|
+
perChainConfig?: {
|
|
138
|
+
[chainId: Hex]: number;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Default automatic fail threshold.
|
|
142
|
+
* This value is used when no specific threshold is found for a chain ID.
|
|
143
|
+
*/
|
|
144
|
+
default?: number;
|
|
145
|
+
};
|
|
146
|
+
/**
|
|
147
|
+
* Replacement of underpriced dapp-suggested gas fees.
|
|
148
|
+
* If enabled, dapp-suggested EIP-1559 fees with a `maxFeePerGas` below the
|
|
149
|
+
* current low estimate are replaced with the wallet's suggested fees, as
|
|
150
|
+
* they are unlikely to be included in a block before fee values change.
|
|
151
|
+
*/
|
|
152
|
+
replaceUnderpricedDappGasFees?: {
|
|
153
|
+
/** Enablement on a per-chain basis. */
|
|
154
|
+
perChainConfig?: {
|
|
155
|
+
[chainId: Hex]: boolean;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* Default enablement.
|
|
159
|
+
* This value is used when no specific value is found for a chain ID.
|
|
160
|
+
*/
|
|
161
|
+
default?: boolean;
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Replacement of underpriced saved (advanced) gas fee preferences.
|
|
165
|
+
* If enabled, saved custom fees with a `maxBaseFee` below the current low
|
|
166
|
+
* estimate are ignored in favour of the wallet's suggested fees, as they
|
|
167
|
+
* are unlikely to be included in a block before fee values change.
|
|
168
|
+
* Level-based saved preferences track current estimates and are never
|
|
169
|
+
* ignored.
|
|
170
|
+
*/
|
|
171
|
+
replaceUnderpricedSavedGasFees?: {
|
|
172
|
+
/** Enablement on a per-chain basis. */
|
|
173
|
+
perChainConfig?: {
|
|
174
|
+
[chainId: Hex]: boolean;
|
|
175
|
+
};
|
|
176
|
+
/**
|
|
177
|
+
* Default enablement.
|
|
178
|
+
* This value is used when no specific value is found for a chain ID.
|
|
179
|
+
*/
|
|
180
|
+
default?: boolean;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* Retrieves the supported EIP-7702 chains.
|
|
186
|
+
*
|
|
187
|
+
* @param messenger - The controller messenger instance.
|
|
188
|
+
* @returns The supported chains.
|
|
189
|
+
*/
|
|
190
|
+
export declare function getEIP7702SupportedChains(messenger: TransactionControllerMessenger): Hex[];
|
|
191
|
+
/**
|
|
192
|
+
* Retrieves the supported EIP-7702 contract addresses for a given chain ID.
|
|
193
|
+
*
|
|
194
|
+
* @param chainId - The chain ID.
|
|
195
|
+
* @param messenger - The controller messenger instance.
|
|
196
|
+
* @param publicKey - The public key used to validate the contract authenticity.
|
|
197
|
+
* @returns The supported contract addresses.
|
|
198
|
+
*/
|
|
199
|
+
export declare function getEIP7702ContractAddresses(chainId: Hex, messenger: TransactionControllerMessenger, publicKey: Hex): Hex[];
|
|
200
|
+
/**
|
|
201
|
+
* Retrieves the EIP-7702 upgrade contract address.
|
|
202
|
+
*
|
|
203
|
+
* @param chainId - The chain ID.
|
|
204
|
+
* @param messenger - The controller messenger instance.
|
|
205
|
+
* @param publicKey - The public key used to validate the contract authenticity.
|
|
206
|
+
* @returns The upgrade contract address.
|
|
207
|
+
*/
|
|
208
|
+
export declare function getEIP7702UpgradeContractAddress(chainId: Hex, messenger: TransactionControllerMessenger, publicKey: Hex): Hex | undefined;
|
|
209
|
+
/**
|
|
210
|
+
* Retrieves the batch size limit.
|
|
211
|
+
* Defaults to 10 if not set.
|
|
212
|
+
*
|
|
213
|
+
* @param messenger - The controller messenger instance.
|
|
214
|
+
* @returns The batch size limit.
|
|
215
|
+
*/
|
|
216
|
+
export declare function getBatchSizeLimit(messenger: TransactionControllerMessenger): number;
|
|
217
|
+
/**
|
|
218
|
+
* Retrieves the submit history limit.
|
|
219
|
+
* Defaults to 100 if not set.
|
|
220
|
+
*
|
|
221
|
+
* @param messenger - The controller messenger instance.
|
|
222
|
+
* @returns The submit history limit.
|
|
223
|
+
*/
|
|
224
|
+
export declare function getSubmitHistoryLimit(messenger: TransactionControllerMessenger): number;
|
|
225
|
+
/**
|
|
226
|
+
* Retrieves the transaction history limit.
|
|
227
|
+
* Defaults to 40 if not set.
|
|
228
|
+
*
|
|
229
|
+
* @param messenger - The controller messenger instance.
|
|
230
|
+
* @returns The transaction history limit.
|
|
231
|
+
*/
|
|
232
|
+
export declare function getTransactionHistoryLimit(messenger: TransactionControllerMessenger): number | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Retrieves the accelerated polling parameters for a given chain ID.
|
|
235
|
+
*
|
|
236
|
+
* @param chainId - The chain ID.
|
|
237
|
+
* @param messenger - The controller messenger instance.
|
|
238
|
+
* @returns The accelerated polling parameters: `countMax` and `intervalMs`.
|
|
239
|
+
*/
|
|
240
|
+
export declare function getAcceleratedPollingParams(chainId: Hex, messenger: TransactionControllerMessenger): {
|
|
241
|
+
blockTime: number;
|
|
242
|
+
countMax: number;
|
|
243
|
+
intervalMs: number;
|
|
244
|
+
};
|
|
245
|
+
/**
|
|
246
|
+
* Retrieves the gas fee randomisation parameters.
|
|
247
|
+
*
|
|
248
|
+
* @param messenger - The controller messenger instance.
|
|
249
|
+
* @returns The gas fee randomisation parameters.
|
|
250
|
+
*/
|
|
251
|
+
export declare function getGasFeeRandomisation(messenger: TransactionControllerMessenger): {
|
|
252
|
+
randomisedGasFeeDigits: Record<Hex, number>;
|
|
253
|
+
preservedNumberOfDigits: number | undefined;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* Retrieves the gas estimate fallback for a given chain ID.
|
|
257
|
+
* Defaults to the default gas estimate fallback if not set.
|
|
258
|
+
*
|
|
259
|
+
* @param chainId - The chain ID.
|
|
260
|
+
* @param messenger - The controller messenger instance.
|
|
261
|
+
* @returns The gas estimate fallback.
|
|
262
|
+
*/
|
|
263
|
+
export declare function getGasEstimateFallback(chainId: Hex, messenger: TransactionControllerMessenger): {
|
|
264
|
+
fixed?: number;
|
|
265
|
+
percentage: number;
|
|
266
|
+
maxGasLimit?: number;
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Retrieves the gas buffers for a given chain ID.
|
|
270
|
+
*
|
|
271
|
+
* @param request - The request object.
|
|
272
|
+
* @param request.chainId - The chain ID.
|
|
273
|
+
* @param request.isCustomRPC - Whether the network RPC is added by the user.
|
|
274
|
+
* @param request.isUpgradeWithData - Whether the transaction is an EIP-7702 upgrade combined with a call.
|
|
275
|
+
* @param request.messenger - The controller messenger instance.
|
|
276
|
+
* @returns The gas buffers.
|
|
277
|
+
*/
|
|
278
|
+
export declare function getGasEstimateBuffer({ chainId, isCustomRPC, isUpgradeWithData, messenger, }: {
|
|
279
|
+
chainId: Hex;
|
|
280
|
+
isCustomRPC: boolean;
|
|
281
|
+
isUpgradeWithData: boolean;
|
|
282
|
+
messenger: TransactionControllerMessenger;
|
|
283
|
+
}): number;
|
|
284
|
+
/**
|
|
285
|
+
* Retrieves the incoming transactions polling interval.
|
|
286
|
+
* Retrieves the number of attempts to wait before automatically marking a transaction as dropped
|
|
287
|
+
* if it has no receipt status.
|
|
288
|
+
*
|
|
289
|
+
* @param chainId - The chain ID.
|
|
290
|
+
* @param messenger - The controller messenger instance.
|
|
291
|
+
* @returns The threshold number of attempts, or undefined if the feature is disabled.
|
|
292
|
+
*/
|
|
293
|
+
export declare function getTimeoutAttempts(chainId: Hex, messenger: TransactionControllerMessenger): number | undefined;
|
|
294
|
+
/**
|
|
295
|
+
* Retrieves whether underpriced dapp-suggested gas fees should be replaced
|
|
296
|
+
* with the wallet's suggested fees.
|
|
297
|
+
*
|
|
298
|
+
* @param chainId - The chain ID.
|
|
299
|
+
* @param messenger - The controller messenger instance.
|
|
300
|
+
* @returns Whether the replacement is enabled.
|
|
301
|
+
*/
|
|
302
|
+
export declare function getReplaceUnderpricedDappGasFeesEnabled(chainId: Hex, messenger: TransactionControllerMessenger): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* Retrieves whether underpriced saved (advanced) gas fee preferences should be
|
|
305
|
+
* ignored in favour of the wallet's suggested fees.
|
|
306
|
+
*
|
|
307
|
+
* @param chainId - The chain ID.
|
|
308
|
+
* @param messenger - The controller messenger instance.
|
|
309
|
+
* @returns Whether the replacement is enabled.
|
|
310
|
+
*/
|
|
311
|
+
export declare function getReplaceUnderpricedSavedGasFeesEnabled(chainId: Hex, messenger: TransactionControllerMessenger): boolean;
|
|
312
|
+
export {};
|
|
313
|
+
//# sourceMappingURL=feature-flags.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.d.mts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAG3C,OAAO,KAAK,EAAE,8BAA8B,EAAE,qCAAoC;AAalF;;GAEG;AACH,oBAAY,WAAW;IACrB,OAAO,2BAA2B;IAClC,SAAS,6BAA6B;IACtC,YAAY,+BAA+B;CAC5C;AAED,KAAK,mBAAmB,GAAG;IACz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,GACxC;IACD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAmBA;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,SAAS,GACV,EAAE;IACD,OAAO,EAAE,GAAG,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,EAAE,8BAA8B,CAAC;CAC3C,GAAG,MAAM,CAoBT;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,8BAA8B,GACxC,MAAM,GAAG,SAAS,CAUpB;AAED;;;;;;;GAOG;AACH,wBAAgB,uCAAuC,CACrD,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,8BAA8B,GACxC,OAAO,CAWT;AAED;;;;;;;GAOG;AACH,wBAAgB,wCAAwC,CACtD,OAAO,EAAE,GAAG,EACZ,SAAS,EAAE,8BAA8B,GACxC,OAAO,CAWT"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createModuleLogger } from
|
|
2
|
-
import { projectLogger } from
|
|
3
|
-
import { isValidSignature } from
|
|
4
|
-
import { padHexToEvenLength } from
|
|
1
|
+
import { createModuleLogger } from "@metamask/utils";
|
|
2
|
+
import { projectLogger } from "../logger.mjs";
|
|
3
|
+
import { isValidSignature } from "./signature.mjs";
|
|
4
|
+
import { padHexToEvenLength } from "./utils.mjs";
|
|
5
5
|
const DEFAULT_BATCH_SIZE_LIMIT = 10;
|
|
6
6
|
const DEFAULT_ACCELERATED_POLLING_COUNT_MAX = 10;
|
|
7
7
|
const DEFAULT_ACCELERATED_POLLING_INTERVAL_MS = 3 * 1000;
|
|
@@ -236,4 +236,4 @@ function getFeatureFlags(messenger) {
|
|
|
236
236
|
return undefined;
|
|
237
237
|
}
|
|
238
238
|
}
|
|
239
|
-
//# sourceMappingURL=feature-flags.
|
|
239
|
+
//# sourceMappingURL=feature-flags.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature-flags.mjs","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,wBAAwB;AAGrD,OAAO,EAAE,aAAa,EAAE,sBAAqB;AAE7C,OAAO,EAAE,gBAAgB,EAAE,wBAAuB;AAClD,OAAO,EAAE,kBAAkB,EAAE,oBAAmB;AAEhD,MAAM,wBAAwB,GAAG,EAAE,CAAC;AACpC,MAAM,qCAAqC,GAAG,EAAE,CAAC;AACjD,MAAM,uCAAuC,GAAG,CAAC,GAAG,IAAI,CAAC;AACzD,MAAM,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AACrC,MAAM,2CAA2C,GAAG,EAAE,CAAC;AACvD,MAAM,2BAA2B,GAAG,CAAC,CAAC;AACtC,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C;;GAEG;AACH,MAAM,CAAN,IAAY,WAIX;AAJD,WAAY,WAAW;IACrB,iDAAkC,CAAA;IAClC,qDAAsC,CAAA;IACtC,0DAA2C,CAAA;AAC7C,CAAC,EAJW,WAAW,KAAX,WAAW,QAItB;AA+MD,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,UAAU,yBAAyB,CACvC,SAAyC;IAEzC,MAAM,YAAY,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;IAChD,OAAO,YAAY,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,eAAe,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CACzC,OAAY,EACZ,SAAyC,EACzC,SAAc;IAEd,MAA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,CAAC;QAErB,GAAG,CAAC,yBAAyB,EAAE,YAAY,CAAC,CAAC;QAE7C,OAAO,YAAiD,CAAC;IAC3D,CAAC;IAAC,MAAM,CAAC;QACP,GAAG,CAAC,2CAA2C,CAAC,CAAC;QACjD,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC","sourcesContent":["import { createModuleLogger } from '@metamask/utils';\nimport type { Hex } from '@metamask/utils';\n\nimport { projectLogger } from '../logger.js';\nimport type { TransactionControllerMessenger } from '../TransactionController.js';\nimport { isValidSignature } from './signature.js';\nimport { padHexToEvenLength } from './utils.js';\n\nconst DEFAULT_BATCH_SIZE_LIMIT = 10;\nconst DEFAULT_ACCELERATED_POLLING_COUNT_MAX = 10;\nconst DEFAULT_ACCELERATED_POLLING_INTERVAL_MS = 3 * 1000;\nconst DEFAULT_BLOCK_TIME = 12 * 1000;\nconst DEFAULT_GAS_ESTIMATE_FALLBACK_BLOCK_PERCENT = 35;\nconst DEFAULT_GAS_ESTIMATE_BUFFER = 1;\nconst DEFAULT_SUBMIT_HISTORY_LIMIT = 100;\nconst DEFAULT_TRANSACTION_HISTORY_LIMIT = 40;\n\n/**\n * Feature flags supporting the transaction controller.\n */\nexport enum FeatureFlag {\n EIP7702 = 'confirmations_eip_7702',\n GasBuffer = 'confirmations_gas_buffer',\n Transactions = 'confirmations_transactions',\n}\n\ntype GasEstimateFallback = {\n /**\n * The fixed gas estimate fallback for a transaction.\n */\n fixed?: number;\n\n /**\n * The percentage multiplier gas estimate fallback for a transaction.\n */\n percentage?: number;\n\n /**\n * The maximum gas limit the fallback can resolve to, representing the chain's\n * per-transaction gas cap. Clamps the `fixed` or `percentage`-derived fallback\n * so it can never exceed the gas limit the RPC will accept (e.g. ~33.5M on\n * Polygon, whereas 35% of its ~140M block gas limit would otherwise be ~49M).\n */\n maxGasLimit?: number;\n};\n\nexport type TransactionControllerFeatureFlags = {\n /** Feature flags to support EIP-7702 / type-4 transactions. */\n [FeatureFlag.EIP7702]?: {\n /**\n * All contracts that support EIP-7702 batch transactions.\n * Keyed by chain ID.\n * First entry in each array is the contract that standard EOAs will be upgraded to.\n */\n contracts?: Record<\n Hex,\n {\n /** Address of the smart contract. */\n address: Hex;\n\n /** Signature to verify the contract is authentic. */\n signature: Hex;\n }[]\n >;\n\n /** Chains enabled for EIP-7702 batch transactions. */\n supportedChains?: Hex[];\n };\n\n /**\n * Buffers added to gas limit estimations.\n * Values are multipliers such as `1.5` meaning 150% of the original gas limit.\n */\n [FeatureFlag.GasBuffer]?: {\n /** Fallback buffer for all chains and transactions. */\n default?: number;\n\n /**\n * Buffer for included network RPCs only and not those added by user.\n * Takes priority over `default`.\n */\n included?: number;\n\n /** Buffers for specific chains. */\n perChainConfig?: {\n [chainId: Hex]: {\n /**\n * Buffer for the chain for all transactions.\n * Takes priority over non-chain `included`.\n */\n base?: number;\n\n /**\n * Buffer if network RPC is included and not added by user.\n * Takes priority over `base`.\n */\n included?: number;\n\n /**\n * Buffer for the chain for EIP-7702 / type 4 transactions only.\n * Only if `data` included and `to` matches `from`.\n * Takes priority over `included` and `base`.\n */\n eip7702?: number;\n };\n };\n };\n\n /** Miscellaneous feature flags to support the transaction controller. */\n [FeatureFlag.Transactions]?: {\n /** Maximum number of transactions that can be in an external batch. */\n batchSizeLimit?: number;\n\n /** Maximum number of entries in the submit history. */\n submitHistoryLimit?: number;\n\n /** Maximum number of transactions stored in state. */\n transactionHistoryLimit?: number;\n\n /**\n * Accelerated polling is used to speed up the polling process for\n * transactions that are not yet confirmed.\n */\n acceleratedPolling?: {\n /** Accelerated polling parameters on a per-chain basis. */\n perChainConfig?: {\n [chainId: Hex]: {\n /**\n * Block time in milliseconds.\n */\n blockTime?: number;\n\n /**\n * Maximum number of polling requests that can be made in a row, before\n * the normal polling resumes.\n */\n countMax?: number;\n\n /** Interval between polling requests in milliseconds. */\n intervalMs?: number;\n };\n };\n\n /** Default `countMax` in case no chain-specific parameter is set. */\n defaultCountMax?: number;\n\n /** Default `intervalMs` in case no chain-specific parameter is set. */\n defaultIntervalMs?: number;\n };\n\n gasFeeRandomisation?: {\n /** Randomised gas fee digits per chainId. */\n randomisedGasFeeDigits?: Record<Hex, number>;\n\n /** Number of digits to preserve for randomised gas fee digits. */\n preservedNumberOfDigits?: number;\n };\n\n /** Gas estimate fallback is used as a fallback in case of failure to obtain the gas estimate values. */\n gasEstimateFallback?: {\n /** Gas estimate fallback per-chain basis. */\n perChainConfig?: {\n [chainId: Hex]: GasEstimateFallback;\n };\n\n /**\n * Default gas estimate fallback.\n * This value is used when no specific gas estimate fallback is found for a chain ID.\n */\n default?: GasEstimateFallback;\n };\n\n /**\n * Number of attempts to wait before automatically marking a transaction as failed\n * if it has no receipt status and hash is not found on the network.\n */\n timeoutAttempts?: {\n /** Automatic fail threshold on a per-chain basis. */\n perChainConfig?: {\n [chainId: Hex]: number;\n };\n\n /**\n * Default automatic fail threshold.\n * This value is used when no specific threshold is found for a chain ID.\n */\n default?: number;\n };\n\n /**\n * Replacement of underpriced dapp-suggested gas fees.\n * If enabled, dapp-suggested EIP-1559 fees with a `maxFeePerGas` below the\n * current low estimate are replaced with the wallet's suggested fees, as\n * they are unlikely to be included in a block before fee values change.\n */\n replaceUnderpricedDappGasFees?: {\n /** Enablement on a per-chain basis. */\n perChainConfig?: {\n [chainId: Hex]: boolean;\n };\n\n /**\n * Default enablement.\n * This value is used when no specific value is found for a chain ID.\n */\n default?: boolean;\n };\n\n /**\n * Replacement of underpriced saved (advanced) gas fee preferences.\n * If enabled, saved custom fees with a `maxBaseFee` below the current low\n * estimate are ignored in favour of the wallet's suggested fees, as they\n * are unlikely to be included in a block before fee values change.\n * Level-based saved preferences track current estimates and are never\n * ignored.\n */\n replaceUnderpricedSavedGasFees?: {\n /** Enablement on a per-chain basis. */\n perChainConfig?: {\n [chainId: Hex]: boolean;\n };\n\n /**\n * Default enablement.\n * This value is used when no specific value is found for a chain ID.\n */\n default?: boolean;\n };\n };\n};\n\nconst log = createModuleLogger(projectLogger, 'feature-flags');\n\n/**\n * Retrieves the supported EIP-7702 chains.\n *\n * @param messenger - The controller messenger instance.\n * @returns The supported chains.\n */\nexport function getEIP7702SupportedChains(\n messenger: TransactionControllerMessenger,\n): Hex[] {\n const featureFlags = getFeatureFlags(messenger);\n return featureFlags?.[FeatureFlag.EIP7702]?.supportedChains ?? [];\n}\n\n/**\n * Retrieves the supported EIP-7702 contract addresses for a given chain ID.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @param publicKey - The public key used to validate the contract authenticity.\n * @returns The supported contract addresses.\n */\nexport function getEIP7702ContractAddresses(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n publicKey: Hex,\n): Hex[] {\n const featureFlags = getFeatureFlags(messenger);\n\n const contracts =\n featureFlags?.[FeatureFlag.EIP7702]?.contracts?.[\n chainId.toLowerCase() as Hex\n ] ?? [];\n\n return contracts\n .filter((contract) =>\n isValidSignature(\n [contract.address, padHexToEvenLength(chainId) as Hex],\n contract.signature,\n publicKey,\n ),\n )\n .map((contract) => contract.address);\n}\n\n/**\n * Retrieves the EIP-7702 upgrade contract address.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @param publicKey - The public key used to validate the contract authenticity.\n * @returns The upgrade contract address.\n */\nexport function getEIP7702UpgradeContractAddress(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n publicKey: Hex,\n): Hex | undefined {\n return getEIP7702ContractAddresses(chainId, messenger, publicKey)?.[0];\n}\n\n/**\n * Retrieves the batch size limit.\n * Defaults to 10 if not set.\n *\n * @param messenger - The controller messenger instance.\n * @returns The batch size limit.\n */\nexport function getBatchSizeLimit(\n messenger: TransactionControllerMessenger,\n): number {\n const featureFlags = getFeatureFlags(messenger);\n return (\n featureFlags?.[FeatureFlag.Transactions]?.batchSizeLimit ??\n DEFAULT_BATCH_SIZE_LIMIT\n );\n}\n\n/**\n * Retrieves the submit history limit.\n * Defaults to 100 if not set.\n *\n * @param messenger - The controller messenger instance.\n * @returns The submit history limit.\n */\nexport function getSubmitHistoryLimit(\n messenger: TransactionControllerMessenger,\n): number {\n const featureFlags = getFeatureFlags(messenger);\n return (\n featureFlags?.[FeatureFlag.Transactions]?.submitHistoryLimit ??\n DEFAULT_SUBMIT_HISTORY_LIMIT\n );\n}\n\n/**\n * Retrieves the transaction history limit.\n * Defaults to 40 if not set.\n *\n * @param messenger - The controller messenger instance.\n * @returns The transaction history limit.\n */\nexport function getTransactionHistoryLimit(\n messenger: TransactionControllerMessenger,\n): number | undefined {\n const featureFlags = getFeatureFlags(messenger);\n\n if (!featureFlags) {\n return undefined;\n }\n\n return (\n featureFlags[FeatureFlag.Transactions]?.transactionHistoryLimit ??\n DEFAULT_TRANSACTION_HISTORY_LIMIT\n );\n}\n\n/**\n * Retrieves the accelerated polling parameters for a given chain ID.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @returns The accelerated polling parameters: `countMax` and `intervalMs`.\n */\nexport function getAcceleratedPollingParams(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n): { blockTime: number; countMax: number; intervalMs: number } {\n const featureFlags = getFeatureFlags(messenger);\n\n const acceleratedPollingParams =\n featureFlags?.[FeatureFlag.Transactions]?.acceleratedPolling;\n\n const countMax =\n acceleratedPollingParams?.perChainConfig?.[chainId]?.countMax ??\n acceleratedPollingParams?.defaultCountMax ??\n DEFAULT_ACCELERATED_POLLING_COUNT_MAX;\n\n const intervalMs =\n acceleratedPollingParams?.perChainConfig?.[chainId]?.intervalMs ??\n acceleratedPollingParams?.defaultIntervalMs ??\n DEFAULT_ACCELERATED_POLLING_INTERVAL_MS;\n\n const blockTime =\n acceleratedPollingParams?.perChainConfig?.[chainId]?.blockTime ??\n DEFAULT_BLOCK_TIME;\n\n return { blockTime, countMax, intervalMs };\n}\n\n/**\n * Retrieves the gas fee randomisation parameters.\n *\n * @param messenger - The controller messenger instance.\n * @returns The gas fee randomisation parameters.\n */\nexport function getGasFeeRandomisation(\n messenger: TransactionControllerMessenger,\n): {\n randomisedGasFeeDigits: Record<Hex, number>;\n preservedNumberOfDigits: number | undefined;\n} {\n const featureFlags = getFeatureFlags(messenger);\n\n const gasFeeRandomisation =\n featureFlags?.[FeatureFlag.Transactions]?.gasFeeRandomisation ?? {};\n\n return {\n randomisedGasFeeDigits: gasFeeRandomisation.randomisedGasFeeDigits ?? {},\n preservedNumberOfDigits: gasFeeRandomisation.preservedNumberOfDigits,\n };\n}\n\n/**\n * Retrieves the gas estimate fallback for a given chain ID.\n * Defaults to the default gas estimate fallback if not set.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @returns The gas estimate fallback.\n */\nexport function getGasEstimateFallback(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n): {\n fixed?: number;\n percentage: number;\n maxGasLimit?: number;\n} {\n const featureFlags = getFeatureFlags(messenger);\n\n const gasEstimateFallbackFlags =\n featureFlags?.[FeatureFlag.Transactions]?.gasEstimateFallback;\n\n const chainFlags = gasEstimateFallbackFlags?.perChainConfig?.[chainId];\n\n const percentage =\n chainFlags?.percentage ??\n gasEstimateFallbackFlags?.default?.percentage ??\n DEFAULT_GAS_ESTIMATE_FALLBACK_BLOCK_PERCENT;\n\n const fixed = chainFlags?.fixed ?? gasEstimateFallbackFlags?.default?.fixed;\n\n const maxGasLimit =\n chainFlags?.maxGasLimit ?? gasEstimateFallbackFlags?.default?.maxGasLimit;\n\n return { fixed, percentage, maxGasLimit };\n}\n\n/**\n * Retrieves the gas buffers for a given chain ID.\n *\n * @param request - The request object.\n * @param request.chainId - The chain ID.\n * @param request.isCustomRPC - Whether the network RPC is added by the user.\n * @param request.isUpgradeWithData - Whether the transaction is an EIP-7702 upgrade combined with a call.\n * @param request.messenger - The controller messenger instance.\n * @returns The gas buffers.\n */\nexport function getGasEstimateBuffer({\n chainId,\n isCustomRPC,\n isUpgradeWithData,\n messenger,\n}: {\n chainId: Hex;\n isCustomRPC: boolean;\n isUpgradeWithData: boolean;\n messenger: TransactionControllerMessenger;\n}): number {\n const featureFlags = getFeatureFlags(messenger);\n const gasBufferFlags = featureFlags?.[FeatureFlag.GasBuffer];\n const chainFlags = gasBufferFlags?.perChainConfig?.[chainId];\n const chainIncludedRPCBuffer = isCustomRPC ? undefined : chainFlags?.included;\n\n const defaultIncludedRPCBuffer = isCustomRPC\n ? undefined\n : gasBufferFlags?.included;\n\n const upgradeBuffer = isUpgradeWithData ? chainFlags?.eip7702 : undefined;\n\n return (\n upgradeBuffer ??\n chainIncludedRPCBuffer ??\n chainFlags?.base ??\n defaultIncludedRPCBuffer ??\n gasBufferFlags?.default ??\n DEFAULT_GAS_ESTIMATE_BUFFER\n );\n}\n\n/**\n * Retrieves the incoming transactions polling interval.\n * Retrieves the number of attempts to wait before automatically marking a transaction as dropped\n * if it has no receipt status.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @returns The threshold number of attempts, or undefined if the feature is disabled.\n */\nexport function getTimeoutAttempts(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n): number | undefined {\n const featureFlags = getFeatureFlags(messenger);\n\n const timeoutAttemptsFlags =\n featureFlags?.[FeatureFlag.Transactions]?.timeoutAttempts;\n\n return (\n timeoutAttemptsFlags?.perChainConfig?.[chainId] ??\n timeoutAttemptsFlags?.default\n );\n}\n\n/**\n * Retrieves whether underpriced dapp-suggested gas fees should be replaced\n * with the wallet's suggested fees.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @returns Whether the replacement is enabled.\n */\nexport function getReplaceUnderpricedDappGasFeesEnabled(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n): boolean {\n const featureFlags = getFeatureFlags(messenger);\n\n const replaceUnderpricedDappGasFeesFlags =\n featureFlags?.[FeatureFlag.Transactions]?.replaceUnderpricedDappGasFees;\n\n return (\n replaceUnderpricedDappGasFeesFlags?.perChainConfig?.[chainId] ??\n replaceUnderpricedDappGasFeesFlags?.default ??\n false\n );\n}\n\n/**\n * Retrieves whether underpriced saved (advanced) gas fee preferences should be\n * ignored in favour of the wallet's suggested fees.\n *\n * @param chainId - The chain ID.\n * @param messenger - The controller messenger instance.\n * @returns Whether the replacement is enabled.\n */\nexport function getReplaceUnderpricedSavedGasFeesEnabled(\n chainId: Hex,\n messenger: TransactionControllerMessenger,\n): boolean {\n const featureFlags = getFeatureFlags(messenger);\n\n const replaceUnderpricedSavedGasFeesFlags =\n featureFlags?.[FeatureFlag.Transactions]?.replaceUnderpricedSavedGasFees;\n\n return (\n replaceUnderpricedSavedGasFeesFlags?.perChainConfig?.[chainId] ??\n replaceUnderpricedSavedGasFeesFlags?.default ??\n false\n );\n}\n\n/**\n * Retrieves the relevant feature flags from the remote feature flag controller.\n *\n * @param messenger - The messenger instance.\n * @returns The feature flags.\n */\nfunction getFeatureFlags(\n messenger: TransactionControllerMessenger,\n): TransactionControllerFeatureFlags | undefined {\n try {\n const featureFlags = messenger.call(\n 'RemoteFeatureFlagController:getState',\n ).remoteFeatureFlags;\n\n log('Retrieved feature flags', featureFlags);\n\n return featureFlags as TransactionControllerFeatureFlags;\n } catch {\n log('RemoteFeatureFlagController not available');\n return undefined;\n }\n}\n"]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateFirstTimeInteraction = void 0;
|
|
4
|
+
const utils_1 = require("@metamask/utils");
|
|
5
|
+
const accounts_api_js_1 = require("../api/accounts-api.cjs");
|
|
6
|
+
const logger_js_1 = require("../logger.cjs");
|
|
7
|
+
const recipient_js_1 = require("./recipient.cjs");
|
|
8
|
+
const validation_js_1 = require("./validation.cjs");
|
|
9
|
+
/**
|
|
10
|
+
* Updates the first-time interaction status for a transaction.
|
|
11
|
+
*
|
|
12
|
+
* @param params - The parameters for updating first time interaction.
|
|
13
|
+
* @param params.existingTransactions - The existing transactions.
|
|
14
|
+
* @param params.getTransaction - Function to get a transaction by ID.
|
|
15
|
+
* @param params.isFirstTimeInteractionEnabled - The function to check if first time interaction is enabled.
|
|
16
|
+
* @param params.trace - The trace callback.
|
|
17
|
+
* @param params.traceContext - The trace context.
|
|
18
|
+
* @param params.transactionMeta - The transaction meta object.
|
|
19
|
+
* @param params.updateTransaction - Function to update transaction internal state.
|
|
20
|
+
* @returns Promise that resolves when the update is complete.
|
|
21
|
+
*/
|
|
22
|
+
async function updateFirstTimeInteraction({ existingTransactions, getTransaction, isFirstTimeInteractionEnabled, trace, traceContext, transactionMeta, updateTransaction, }) {
|
|
23
|
+
if (!isFirstTimeInteractionEnabled()) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const { chainId, id: transactionId, txParams: { from }, } = transactionMeta;
|
|
27
|
+
const recipient = (0, recipient_js_1.getEffectiveRecipient)(transactionMeta);
|
|
28
|
+
const request = {
|
|
29
|
+
chainId: (0, utils_1.hexToNumber)(chainId),
|
|
30
|
+
to: recipient,
|
|
31
|
+
from,
|
|
32
|
+
};
|
|
33
|
+
(0, validation_js_1.validateParamTo)(recipient);
|
|
34
|
+
const recipientLower = recipient?.toLowerCase();
|
|
35
|
+
const existingTransaction = existingTransactions.find((tx) => tx.id !== transactionId &&
|
|
36
|
+
tx.chainId === chainId &&
|
|
37
|
+
tx.txParams?.from?.toLowerCase() === from?.toLowerCase() &&
|
|
38
|
+
(0, recipient_js_1.getEffectiveRecipient)(tx)?.toLowerCase() === recipientLower);
|
|
39
|
+
// Skip API call only if we already have a tx with same from and same effective recipient (e.g. duplicate or pending).
|
|
40
|
+
// For token transfers (ERC20/ERC721/ERC1155), effective recipient is decoded from data; using txParams.to
|
|
41
|
+
// would wrongly match any send of the same token contract.
|
|
42
|
+
if (existingTransaction) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const { count } = await trace({ name: 'Account Address Relationship', parentContext: traceContext }, () => (0, accounts_api_js_1.getAccountAddressRelationship)(request));
|
|
47
|
+
const isFirstTimeInteraction = count === undefined ? undefined : count === 0;
|
|
48
|
+
const finalTransactionMeta = getTransaction(transactionId);
|
|
49
|
+
/* istanbul ignore if */
|
|
50
|
+
if (!finalTransactionMeta) {
|
|
51
|
+
(0, logger_js_1.projectLogger)('Cannot update first time interaction as transaction not found', transactionId);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
updateTransaction({
|
|
55
|
+
transactionId,
|
|
56
|
+
note: 'TransactionController#updateFirstInteraction - Update first time interaction',
|
|
57
|
+
}, (txMeta) => {
|
|
58
|
+
txMeta.isFirstTimeInteraction = isFirstTimeInteraction;
|
|
59
|
+
});
|
|
60
|
+
(0, logger_js_1.projectLogger)('Updated first time interaction', transactionId, {
|
|
61
|
+
isFirstTimeInteraction,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
(0, logger_js_1.projectLogger)('Error fetching account address relationship, skipping first time interaction update', error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.updateFirstTimeInteraction = updateFirstTimeInteraction;
|
|
69
|
+
//# sourceMappingURL=first-time-interaction.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-time-interaction.cjs","sourceRoot":"","sources":["../../src/utils/first-time-interaction.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAE9C,6DAAuE;AAEvE,6CAAoD;AAEpD,kDAAuD;AACvD,oDAAkD;AAkBlD;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,0BAA0B,CAAC,EAC/C,oBAAoB,EACpB,cAAc,EACd,6BAA6B,EAC7B,KAAK,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,GACiB;IAClC,IAAI,CAAC,6BAA6B,EAAE,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,MAAM,EACJ,OAAO,EACP,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,GACnB,GAAG,eAAe,CAAC;IAEpB,MAAM,SAAS,GAAG,IAAA,oCAAqB,E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C,MAAM,EAAE,EAAE;YACT,MAAM,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACzD,CAAC,CACF,CAAC;QAEF,IAAA,yBAAG,EAAC,gCAAgC,EAAE,aAAa,EAAE;YACnD,sBAAsB;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAA,yBAAG,EACD,qFAAqF,EACrF,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC;AApFD,gEAoFC","sourcesContent":["import type { TraceContext, TraceCallback } from '@metamask/controller-utils';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { getAccountAddressRelationship } from '../api/accounts-api.js';\nimport type { GetAccountAddressRelationshipRequest } from '../api/accounts-api.js';\nimport { projectLogger as log } from '../logger.js';\nimport type { TransactionMeta } from '../types.js';\nimport { getEffectiveRecipient } from './recipient.js';\nimport { validateParamTo } from './validation.js';\n\ntype UpdateFirstTimeInteractionRequest = {\n existingTransactions: TransactionMeta[];\n getTransaction: (transactionId: string) => TransactionMeta | undefined;\n isFirstTimeInteractionEnabled: () => boolean;\n trace: TraceCallback;\n traceContext?: TraceContext;\n transactionMeta: TransactionMeta;\n updateTransaction: (\n updateParams: {\n transactionId: string;\n note: string;\n },\n updater: (txMeta: TransactionMeta) => void,\n ) => void;\n};\n\n/**\n * Updates the first-time interaction status for a transaction.\n *\n * @param params - The parameters for updating first time interaction.\n * @param params.existingTransactions - The existing transactions.\n * @param params.getTransaction - Function to get a transaction by ID.\n * @param params.isFirstTimeInteractionEnabled - The function to check if first time interaction is enabled.\n * @param params.trace - The trace callback.\n * @param params.traceContext - The trace context.\n * @param params.transactionMeta - The transaction meta object.\n * @param params.updateTransaction - Function to update transaction internal state.\n * @returns Promise that resolves when the update is complete.\n */\nexport async function updateFirstTimeInteraction({\n existingTransactions,\n getTransaction,\n isFirstTimeInteractionEnabled,\n trace,\n traceContext,\n transactionMeta,\n updateTransaction,\n}: UpdateFirstTimeInteractionRequest): Promise<void> {\n if (!isFirstTimeInteractionEnabled()) {\n return;\n }\n\n const {\n chainId,\n id: transactionId,\n txParams: { from },\n } = transactionMeta;\n\n const recipient = getEffectiveRecipient(transactionMeta);\n\n const request: GetAccountAddressRelationshipRequest = {\n chainId: hexToNumber(chainId),\n to: recipient as string,\n from,\n };\n\n validateParamTo(recipient);\n\n const recipientLower = recipient?.toLowerCase();\n const existingTransaction = existingTransactions.find(\n (tx) =>\n tx.id !== transactionId &&\n tx.chainId === chainId &&\n tx.txParams?.from?.toLowerCase() === from?.toLowerCase() &&\n getEffectiveRecipient(tx)?.toLowerCase() === recipientLower,\n );\n\n // Skip API call only if we already have a tx with same from and same effective recipient (e.g. duplicate or pending).\n // For token transfers (ERC20/ERC721/ERC1155), effective recipient is decoded from data; using txParams.to\n // would wrongly match any send of the same token contract.\n if (existingTransaction) {\n return;\n }\n\n try {\n const { count } = await trace(\n { name: 'Account Address Relationship', parentContext: traceContext },\n () => getAccountAddressRelationship(request),\n );\n\n const isFirstTimeInteraction =\n count === undefined ? undefined : count === 0;\n\n const finalTransactionMeta = getTransaction(transactionId);\n\n /* istanbul ignore if */\n if (!finalTransactionMeta) {\n log(\n 'Cannot update first time interaction as transaction not found',\n transactionId,\n );\n return;\n }\n\n updateTransaction(\n {\n transactionId,\n note: 'TransactionController#updateFirstInteraction - Update first time interaction',\n },\n (txMeta) => {\n txMeta.isFirstTimeInteraction = isFirstTimeInteraction;\n },\n );\n\n log('Updated first time interaction', transactionId, {\n isFirstTimeInteraction,\n });\n } catch (error) {\n log(\n 'Error fetching account address relationship, skipping first time interaction update',\n error,\n );\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { TraceContext, TraceCallback } from
|
|
2
|
-
import type { TransactionMeta } from
|
|
1
|
+
import type { TraceContext, TraceCallback } from "@metamask/controller-utils";
|
|
2
|
+
import type { TransactionMeta } from "../types.cjs";
|
|
3
3
|
type UpdateFirstTimeInteractionRequest = {
|
|
4
4
|
existingTransactions: TransactionMeta[];
|
|
5
5
|
getTransaction: (transactionId: string) => TransactionMeta | undefined;
|
|
@@ -27,4 +27,4 @@ type UpdateFirstTimeInteractionRequest = {
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function updateFirstTimeInteraction({ existingTransactions, getTransaction, isFirstTimeInteractionEnabled, trace, traceContext, transactionMeta, updateTransaction, }: UpdateFirstTimeInteractionRequest): Promise<void>;
|
|
29
29
|
export {};
|
|
30
|
-
//# sourceMappingURL=first-time-interaction.d.
|
|
30
|
+
//# sourceMappingURL=first-time-interaction.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-time-interaction.d.cts","sourceRoot":"","sources":["../../src/utils/first-time-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,mCAAmC;AAM9E,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAoB;AAInD,KAAK,iCAAiC,GAAG;IACvC,oBAAoB,EAAE,eAAe,EAAE,CAAC;IACxC,cAAc,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACvE,6BAA6B,EAAE,MAAM,OAAO,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,CACjB,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,EACD,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,KACvC,IAAI,CAAC;CACX,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,oBAAoB,EACpB,cAAc,EACd,6BAA6B,EAC7B,KAAK,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,GAClB,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EnD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { TraceContext, TraceCallback } from "@metamask/controller-utils";
|
|
2
|
+
import type { TransactionMeta } from "../types.mjs";
|
|
3
|
+
type UpdateFirstTimeInteractionRequest = {
|
|
4
|
+
existingTransactions: TransactionMeta[];
|
|
5
|
+
getTransaction: (transactionId: string) => TransactionMeta | undefined;
|
|
6
|
+
isFirstTimeInteractionEnabled: () => boolean;
|
|
7
|
+
trace: TraceCallback;
|
|
8
|
+
traceContext?: TraceContext;
|
|
9
|
+
transactionMeta: TransactionMeta;
|
|
10
|
+
updateTransaction: (updateParams: {
|
|
11
|
+
transactionId: string;
|
|
12
|
+
note: string;
|
|
13
|
+
}, updater: (txMeta: TransactionMeta) => void) => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Updates the first-time interaction status for a transaction.
|
|
17
|
+
*
|
|
18
|
+
* @param params - The parameters for updating first time interaction.
|
|
19
|
+
* @param params.existingTransactions - The existing transactions.
|
|
20
|
+
* @param params.getTransaction - Function to get a transaction by ID.
|
|
21
|
+
* @param params.isFirstTimeInteractionEnabled - The function to check if first time interaction is enabled.
|
|
22
|
+
* @param params.trace - The trace callback.
|
|
23
|
+
* @param params.traceContext - The trace context.
|
|
24
|
+
* @param params.transactionMeta - The transaction meta object.
|
|
25
|
+
* @param params.updateTransaction - Function to update transaction internal state.
|
|
26
|
+
* @returns Promise that resolves when the update is complete.
|
|
27
|
+
*/
|
|
28
|
+
export declare function updateFirstTimeInteraction({ existingTransactions, getTransaction, isFirstTimeInteractionEnabled, trace, traceContext, transactionMeta, updateTransaction, }: UpdateFirstTimeInteractionRequest): Promise<void>;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=first-time-interaction.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-time-interaction.d.mts","sourceRoot":"","sources":["../../src/utils/first-time-interaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,mCAAmC;AAM9E,OAAO,KAAK,EAAE,eAAe,EAAE,qBAAoB;AAInD,KAAK,iCAAiC,GAAG;IACvC,oBAAoB,EAAE,eAAe,EAAE,CAAC;IACxC,cAAc,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,eAAe,GAAG,SAAS,CAAC;IACvE,6BAA6B,EAAE,MAAM,OAAO,CAAC;IAC7C,KAAK,EAAE,aAAa,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,eAAe,EAAE,eAAe,CAAC;IACjC,iBAAiB,EAAE,CACjB,YAAY,EAAE;QACZ,aAAa,EAAE,MAAM,CAAC;QACtB,IAAI,EAAE,MAAM,CAAC;KACd,EACD,OAAO,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,KACvC,IAAI,CAAC;CACX,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAsB,0BAA0B,CAAC,EAC/C,oBAAoB,EACpB,cAAc,EACd,6BAA6B,EAC7B,KAAK,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,GAClB,EAAE,iCAAiC,GAAG,OAAO,CAAC,IAAI,CAAC,CA4EnD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { hexToNumber } from
|
|
2
|
-
import { getAccountAddressRelationship } from
|
|
3
|
-
import { projectLogger as log } from
|
|
4
|
-
import { getEffectiveRecipient } from
|
|
5
|
-
import { validateParamTo } from
|
|
1
|
+
import { hexToNumber } from "@metamask/utils";
|
|
2
|
+
import { getAccountAddressRelationship } from "../api/accounts-api.mjs";
|
|
3
|
+
import { projectLogger as log } from "../logger.mjs";
|
|
4
|
+
import { getEffectiveRecipient } from "./recipient.mjs";
|
|
5
|
+
import { validateParamTo } from "./validation.mjs";
|
|
6
6
|
/**
|
|
7
7
|
* Updates the first-time interaction status for a transaction.
|
|
8
8
|
*
|
|
@@ -62,4 +62,4 @@ export async function updateFirstTimeInteraction({ existingTransactions, getTran
|
|
|
62
62
|
log('Error fetching account address relationship, skipping first time interaction update', error);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
//# sourceMappingURL=first-time-interaction.
|
|
65
|
+
//# sourceMappingURL=first-time-interaction.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"first-time-interaction.mjs","sourceRoot":"","sources":["../../src/utils/first-time-interaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAE9C,OAAO,EAAE,6BAA6B,EAAE,gCAA+B;AAEvE,OAAO,EAAE,aAAa,IAAI,GAAG,EAAE,sBAAqB;AAEpD,OAAO,EAAE,qBAAqB,EAAE,wBAAuB;AACvD,OAAO,EAAE,eAAe,EAAE,yBAAwB;AAkBlD;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAAC,EAC/C,oBAAoB,EACpB,cAAc,EACd,6BAA6B,EAC7B,KAAK,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,GACiB;IAClC,IAAI,CAAC,6BAA6B,EAAE,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,MAAM,EACJ,OAAO,EACP,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,EAAE,IAAI,EAAE,GACnB,GAAG,eAAe,CAAC;IAEpB,MAAM,SAAS,GAAG,qBAAqB,CAAC,eAAe,CAAC,CAAC;IAEzD,MAAM,OAAO,GAAyC;QACpD,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC;QAC7B,EAAE,EAAE,SAAmB;QACvB,IAAI;KACL,CAAC;IAEF,eAAe,CAAC,SAAS,CAAC,CAAC;IAE3B,MAAM,cAAc,GAAG,SAAS,EAAE,WAAW,EAAE,CAAC;IAChD,MAAM,mBAAmB,GAAG,oBAAoB,CAAC,IAAI,CACnD,CAAC,EAAE,EAAE,EAAE,CACL,EAAE,CAAC,EAAE,KAAK,aAAa;QACvB,EAAE,CAAC,OAAO,KAAK,OAAO;QACtB,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,IAAI,EAAE,WAAW,EAAE;QACxD,qBAAqB,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,KAAK,cAAc,CAC9D,CAAC;IAEF,sHAAsH;IACtH,0GAA0G;IAC1G,2DAA2D;IAC3D,IAAI,mBAAmB,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,KAAK,CAC3B,EAAE,IAAI,EAAE,8BAA8B,EAAE,aAAa,EAAE,YAAY,EAAE,EACrE,GAAG,EAAE,CAAC,6BAA6B,CAAC,OAAO,CAAC,CAC7C,CAAC;QAEF,MAAM,sBAAsB,GAC1B,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC;QAEhD,MAAM,oBAAoB,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;QAE3D,wBAAwB;QACxB,IAAI,CAAC,oBAAoB,EAAE,CAAC;YAC1B,GAAG,CACD,+DAA+D,EAC/D,aAAa,CACd,CAAC;YACF,OAAO;QACT,CAAC;QAED,iBAAiB,CACf;YACE,aAAa;YACb,IAAI,EAAE,8EAA8E;SACrF,EACD,CAAC,MAAM,EAAE,EAAE;YACT,MAAM,CAAC,sBAAsB,GAAG,sBAAsB,CAAC;QACzD,CAAC,CACF,CAAC;QAEF,GAAG,CAAC,gCAAgC,EAAE,aAAa,EAAE;YACnD,sBAAsB;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CACD,qFAAqF,EACrF,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { TraceContext, TraceCallback } from '@metamask/controller-utils';\nimport { hexToNumber } from '@metamask/utils';\n\nimport { getAccountAddressRelationship } from '../api/accounts-api.js';\nimport type { GetAccountAddressRelationshipRequest } from '../api/accounts-api.js';\nimport { projectLogger as log } from '../logger.js';\nimport type { TransactionMeta } from '../types.js';\nimport { getEffectiveRecipient } from './recipient.js';\nimport { validateParamTo } from './validation.js';\n\ntype UpdateFirstTimeInteractionRequest = {\n existingTransactions: TransactionMeta[];\n getTransaction: (transactionId: string) => TransactionMeta | undefined;\n isFirstTimeInteractionEnabled: () => boolean;\n trace: TraceCallback;\n traceContext?: TraceContext;\n transactionMeta: TransactionMeta;\n updateTransaction: (\n updateParams: {\n transactionId: string;\n note: string;\n },\n updater: (txMeta: TransactionMeta) => void,\n ) => void;\n};\n\n/**\n * Updates the first-time interaction status for a transaction.\n *\n * @param params - The parameters for updating first time interaction.\n * @param params.existingTransactions - The existing transactions.\n * @param params.getTransaction - Function to get a transaction by ID.\n * @param params.isFirstTimeInteractionEnabled - The function to check if first time interaction is enabled.\n * @param params.trace - The trace callback.\n * @param params.traceContext - The trace context.\n * @param params.transactionMeta - The transaction meta object.\n * @param params.updateTransaction - Function to update transaction internal state.\n * @returns Promise that resolves when the update is complete.\n */\nexport async function updateFirstTimeInteraction({\n existingTransactions,\n getTransaction,\n isFirstTimeInteractionEnabled,\n trace,\n traceContext,\n transactionMeta,\n updateTransaction,\n}: UpdateFirstTimeInteractionRequest): Promise<void> {\n if (!isFirstTimeInteractionEnabled()) {\n return;\n }\n\n const {\n chainId,\n id: transactionId,\n txParams: { from },\n } = transactionMeta;\n\n const recipient = getEffectiveRecipient(transactionMeta);\n\n const request: GetAccountAddressRelationshipRequest = {\n chainId: hexToNumber(chainId),\n to: recipient as string,\n from,\n };\n\n validateParamTo(recipient);\n\n const recipientLower = recipient?.toLowerCase();\n const existingTransaction = existingTransactions.find(\n (tx) =>\n tx.id !== transactionId &&\n tx.chainId === chainId &&\n tx.txParams?.from?.toLowerCase() === from?.toLowerCase() &&\n getEffectiveRecipient(tx)?.toLowerCase() === recipientLower,\n );\n\n // Skip API call only if we already have a tx with same from and same effective recipient (e.g. duplicate or pending).\n // For token transfers (ERC20/ERC721/ERC1155), effective recipient is decoded from data; using txParams.to\n // would wrongly match any send of the same token contract.\n if (existingTransaction) {\n return;\n }\n\n try {\n const { count } = await trace(\n { name: 'Account Address Relationship', parentContext: traceContext },\n () => getAccountAddressRelationship(request),\n );\n\n const isFirstTimeInteraction =\n count === undefined ? undefined : count === 0;\n\n const finalTransactionMeta = getTransaction(transactionId);\n\n /* istanbul ignore if */\n if (!finalTransactionMeta) {\n log(\n 'Cannot update first time interaction as transaction not found',\n transactionId,\n );\n return;\n }\n\n updateTransaction(\n {\n transactionId,\n note: 'TransactionController#updateFirstInteraction - Update first time interaction',\n },\n (txMeta) => {\n txMeta.isFirstTimeInteraction = isFirstTimeInteraction;\n },\n );\n\n log('Updated first time interaction', transactionId, {\n isFirstTimeInteraction,\n });\n } catch (error) {\n log(\n 'Error fetching account address relationship, skipping first time interaction update',\n error,\n );\n }\n}\n"]}
|