@metamask-previews/transaction-pay-controller 23.1.0-preview-a65eb72 → 23.1.0-preview-e37aff3

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.
Files changed (80) hide show
  1. package/CHANGELOG.md +0 -5
  2. package/dist/TransactionPayController-method-action-types.cjs.map +1 -1
  3. package/dist/TransactionPayController-method-action-types.d.cts +1 -5
  4. package/dist/TransactionPayController-method-action-types.d.cts.map +1 -1
  5. package/dist/TransactionPayController-method-action-types.d.mts +1 -5
  6. package/dist/TransactionPayController-method-action-types.d.mts.map +1 -1
  7. package/dist/TransactionPayController-method-action-types.mjs.map +1 -1
  8. package/dist/TransactionPayController.cjs +3 -9
  9. package/dist/TransactionPayController.cjs.map +1 -1
  10. package/dist/TransactionPayController.d.cts +2 -3
  11. package/dist/TransactionPayController.d.cts.map +1 -1
  12. package/dist/TransactionPayController.d.mts +2 -3
  13. package/dist/TransactionPayController.d.mts.map +1 -1
  14. package/dist/TransactionPayController.mjs +3 -9
  15. package/dist/TransactionPayController.mjs.map +1 -1
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.cts.map +1 -1
  19. package/dist/index.d.mts +2 -2
  20. package/dist/index.d.mts.map +1 -1
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/strategy/fiat/fiat-submit.cjs +101 -27
  23. package/dist/strategy/fiat/fiat-submit.cjs.map +1 -1
  24. package/dist/strategy/fiat/fiat-submit.d.cts.map +1 -1
  25. package/dist/strategy/fiat/fiat-submit.d.mts.map +1 -1
  26. package/dist/strategy/fiat/fiat-submit.mjs +101 -27
  27. package/dist/strategy/fiat/fiat-submit.mjs.map +1 -1
  28. package/dist/strategy/fiat/utils.cjs +1 -66
  29. package/dist/strategy/fiat/utils.cjs.map +1 -1
  30. package/dist/strategy/fiat/utils.d.cts +0 -32
  31. package/dist/strategy/fiat/utils.d.cts.map +1 -1
  32. package/dist/strategy/fiat/utils.d.mts +0 -32
  33. package/dist/strategy/fiat/utils.d.mts.map +1 -1
  34. package/dist/strategy/fiat/utils.mjs +0 -63
  35. package/dist/strategy/fiat/utils.mjs.map +1 -1
  36. package/dist/types.cjs.map +1 -1
  37. package/dist/types.d.cts +0 -22
  38. package/dist/types.d.cts.map +1 -1
  39. package/dist/types.d.mts +0 -22
  40. package/dist/types.d.mts.map +1 -1
  41. package/dist/types.mjs.map +1 -1
  42. package/dist/utils/feature-flags.cjs +1 -41
  43. package/dist/utils/feature-flags.cjs.map +1 -1
  44. package/dist/utils/feature-flags.d.cts +0 -22
  45. package/dist/utils/feature-flags.d.cts.map +1 -1
  46. package/dist/utils/feature-flags.d.mts +0 -22
  47. package/dist/utils/feature-flags.d.mts.map +1 -1
  48. package/dist/utils/feature-flags.mjs +0 -38
  49. package/dist/utils/feature-flags.mjs.map +1 -1
  50. package/dist/utils/quotes.cjs +2 -3
  51. package/dist/utils/quotes.cjs.map +1 -1
  52. package/dist/utils/quotes.d.cts.map +1 -1
  53. package/dist/utils/quotes.d.mts.map +1 -1
  54. package/dist/utils/quotes.mjs +2 -3
  55. package/dist/utils/quotes.mjs.map +1 -1
  56. package/dist/utils/totals.cjs +7 -41
  57. package/dist/utils/totals.cjs.map +1 -1
  58. package/dist/utils/totals.d.cts +1 -3
  59. package/dist/utils/totals.d.cts.map +1 -1
  60. package/dist/utils/totals.d.mts +1 -3
  61. package/dist/utils/totals.d.mts.map +1 -1
  62. package/dist/utils/totals.mjs +7 -41
  63. package/dist/utils/totals.mjs.map +1 -1
  64. package/package.json +1 -1
  65. package/dist/strategy/fiat/fiat-submit-simple.cjs +0 -61
  66. package/dist/strategy/fiat/fiat-submit-simple.cjs.map +0 -1
  67. package/dist/strategy/fiat/fiat-submit-simple.d.cts +0 -23
  68. package/dist/strategy/fiat/fiat-submit-simple.d.cts.map +0 -1
  69. package/dist/strategy/fiat/fiat-submit-simple.d.mts +0 -23
  70. package/dist/strategy/fiat/fiat-submit-simple.d.mts.map +0 -1
  71. package/dist/strategy/fiat/fiat-submit-simple.mjs +0 -57
  72. package/dist/strategy/fiat/fiat-submit-simple.mjs.map +0 -1
  73. package/dist/strategy/fiat/fiat-submit-with-calldata.cjs +0 -185
  74. package/dist/strategy/fiat/fiat-submit-with-calldata.cjs.map +0 -1
  75. package/dist/strategy/fiat/fiat-submit-with-calldata.d.cts +0 -27
  76. package/dist/strategy/fiat/fiat-submit-with-calldata.d.cts.map +0 -1
  77. package/dist/strategy/fiat/fiat-submit-with-calldata.d.mts +0 -27
  78. package/dist/strategy/fiat/fiat-submit-with-calldata.d.mts.map +0 -1
  79. package/dist/strategy/fiat/fiat-submit-with-calldata.mjs +0 -181
  80. package/dist/strategy/fiat/fiat-submit-with-calldata.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAkOA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB;IAChE,aAAa;IACb,iBAAiB;IACjB,eAAe;CAChB,CAAC","sourcesContent":["import type {\n AssetsControllerGetStateForTransactionPayAction,\n AssetsControllerStateChangeEvent,\n} from '@metamask/assets-controller';\nimport type {\n CurrencyRateControllerGetStateAction,\n CurrencyRateStateChange,\n TokenBalancesControllerGetStateAction,\n} from '@metamask/assets-controllers';\nimport type { TokenRatesControllerGetStateAction } from '@metamask/assets-controllers';\nimport type { TokenRatesControllerStateChangeEvent } from '@metamask/assets-controllers';\nimport type {\n TokensControllerGetStateAction,\n TokensControllerStateChangeEvent,\n} from '@metamask/assets-controllers';\nimport type { AccountTrackerControllerGetStateAction } from '@metamask/assets-controllers';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { BridgeControllerFetchQuotesAction } from '@metamask/bridge-controller';\nimport type { BridgeStatusControllerStateChangeEvent } from '@metamask/bridge-status-controller';\nimport type {\n BridgeStatusControllerGetStateAction,\n BridgeStatusControllerSubmitTxAction,\n} from '@metamask/bridge-status-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerSignTypedMessageAction,\n KeyringTypes,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { NetworkControllerFindNetworkClientIdByChainIdAction } from '@metamask/network-controller';\nimport type { NetworkControllerGetNetworkClientByIdAction } from '@metamask/network-controller';\nimport type { NetworkControllerGetNetworkConfigurationByChainIdAction } from '@metamask/network-controller';\nimport type { Quote as RampsQuote } from '@metamask/ramps-controller';\nimport type {\n RampsControllerGetOrderAction,\n RampsControllerGetQuotesAction,\n} from '@metamask/ramps-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type {\n AuthorizationList,\n TransactionControllerAddTransactionBatchAction,\n TransactionControllerEstimateGasAction,\n TransactionControllerEstimateGasBatchAction,\n TransactionControllerUnapprovedTransactionAddedEvent,\n} from '@metamask/transaction-controller';\nimport type {\n BatchTransaction,\n BatchTransactionParams,\n TransactionControllerAddTransactionAction,\n TransactionControllerGetGasFeeTokensAction,\n TransactionControllerGetStateAction,\n TransactionControllerStateChangeEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { Hex, Json } from '@metamask/utils';\nimport type { Draft } from 'immer';\n\nimport type {\n CONTROLLER_NAME,\n PaymentOverride,\n TransactionPayStrategy,\n} from './constants';\nimport type { TransactionPayControllerMethodActions } from './TransactionPayController-method-action-types';\n\nexport type AllowedActions =\n | AccountTrackerControllerGetStateAction\n | AssetsControllerGetStateForTransactionPayAction\n | BridgeControllerFetchQuotesAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | CurrencyRateControllerGetStateAction\n | GetGasFeeState\n | KeyringControllerGetStateAction\n | KeyringControllerSignTypedMessageAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | RampsControllerGetOrderAction\n | RampsControllerGetQuotesAction\n | RemoteFeatureFlagControllerGetStateAction\n | TokenBalancesControllerGetStateAction\n | TokenRatesControllerGetStateAction\n | TokensControllerGetStateAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerAddTransactionBatchAction\n | TransactionControllerEstimateGasAction\n | TransactionControllerEstimateGasBatchAction\n | TransactionControllerGetGasFeeTokensAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction;\n\nexport type AllowedEvents =\n | AssetsControllerStateChangeEvent\n | BridgeStatusControllerStateChangeEvent\n | CurrencyRateStateChange\n | TokenRatesControllerStateChangeEvent\n | TokensControllerStateChangeEvent\n | TransactionControllerStateChangeEvent\n | TransactionControllerUnapprovedTransactionAddedEvent;\n\nexport type TransactionPayControllerGetStateAction = ControllerGetStateAction<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState\n>;\n\n/** Configurable properties of a transaction. */\nexport type TransactionConfig = {\n /**\n * Optional address to override the default account used by the transaction.\n * When `isPostQuote` is true, used as the recipient of the MM Pay transfer.\n * When `isPostQuote` is false, it provides the funds and pays for gas.\n */\n accountOverride?: Hex;\n\n /**\n * Whether the source of funds is HyperLiquid (HyperCore).\n * When true, the Relay strategy uses the HyperLiquid 2-step withdrawal\n * flow: (1) authorize nonce-mapping, (2) sendAsset to Relay solver.\n */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Whether the user has selected the maximum amount. */\n isMaxAmount?: boolean;\n\n /**\n * Whether this is a post-quote transaction.\n * When true, the paymentToken represents the destination token,\n * and the quote source is derived from the transaction's output token.\n */\n isPostQuote?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request. Use this for post-quote flows where the user's funds originate\n * from a smart contract account (e.g. Predict Safe proxy) so that refunds\n * go back to that account rather than the EOA.\n */\n refundTo?: Hex;\n};\n\n/** Callback to update transaction config. */\nexport type TransactionConfigCallback = (config: TransactionConfig) => void;\n\n/** Request passed to {@link GetPaymentOverrideDataCallback}. */\nexport type GetPaymentOverrideDataRequest = {\n /** Amount of the source token in human-readable format. */\n amount: string;\n\n /** Metadata of the original transaction. */\n transaction: TransactionMeta;\n\n /** Pay-controller state for the transaction. */\n transactionData: TransactionData;\n};\n\n/** Response returned by {@link GetPaymentOverrideDataCallback}. */\nexport type GetPaymentOverrideDataResponse = {\n /** Batch transaction params to prepend to the submit batch. */\n calls: BatchTransactionParams[];\n};\n\n/**\n * Callback invoked during submit when `paymentOverride` is defined.\n * Returns batch transaction params to prepend to the submit batch.\n */\nexport type GetPaymentOverrideDataCallback = (\n request: GetPaymentOverrideDataRequest,\n) => Promise<GetPaymentOverrideDataResponse>;\n\nexport type GetAmountDataRequest = {\n /** Raw token amount (atomic units) to encode into calldata. */\n amount: string;\n\n /** Metadata of the transaction whose nested calls need updating. */\n transaction: TransactionMeta;\n};\n\nexport type GetAmountDataResponse = {\n /** Per-nested-call data updates; empty when no update is needed. */\n updates: { nestedTransactionIndex: number; data: Hex }[];\n};\n\n/**\n * Optional callback that re-encodes nested transaction calldata for a given\n * token amount. Used by transaction types with non-standard nested data\n * (e.g. vault approve + deposit) that cannot be derived from the amount alone\n * without client-side context (vault config, RPC providers, etc.).\n */\nexport type GetAmountDataCallback = (\n request: GetAmountDataRequest,\n) => Promise<GetAmountDataResponse>;\n\n/** Callback to update fiat payment state. */\nexport type TransactionFiatPaymentCallback = (\n fiatPayment: TransactionFiatPayment,\n) => void;\n\nexport type TransactionPayControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState\n >;\n\nexport type TransactionPayControllerActions =\n | TransactionPayControllerGetStateAction\n | TransactionPayControllerMethodActions;\n\nexport type TransactionPayControllerEvents =\n TransactionPayControllerStateChangeEvent;\n\nexport type TransactionPayControllerMessenger = Messenger<\n typeof CONTROLLER_NAME,\n TransactionPayControllerActions | AllowedActions,\n TransactionPayControllerEvents | AllowedEvents\n>;\n\n/**\n * Keyring types that support EIP-7702 authorization signing.\n * Hardware wallets, snap keyrings, and custody keyrings are excluded.\n */\nexport const KEYRING_TYPES_SUPPORTING_7702: `${KeyringTypes}`[] = [\n 'HD Key Tree',\n 'Simple Key Pair',\n 'Money Keyring',\n];\n\n/** Options for the TransactionPayController. */\nexport type TransactionPayControllerOptions = {\n /** Optional callback to re-encode nested transaction calldata for a given amount. */\n getAmountData?: GetAmountDataCallback;\n\n /** Callback to convert a transaction into a redeem delegation. */\n getDelegationTransaction: GetDelegationTransactionCallback;\n\n /**\n * Optional callback invoked during quote execution when `paymentOverride` is defined.\n * Returns additional transactions to be submitted alongside the quote batch.\n */\n getPaymentOverrideData?: GetPaymentOverrideDataCallback;\n\n /** Callback to select the PayStrategy for a transaction. */\n getStrategy?: (transaction: TransactionMeta) => TransactionPayStrategy;\n\n /** Callback to select ordered PayStrategies for a transaction. */\n getStrategies?: (transaction: TransactionMeta) => TransactionPayStrategy[];\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Callbacks for the Polymarket relayer; required only for the Polymarket deposit-wallet flow. */\n polymarket?: PolymarketCallbacks;\n\n /** Initial state of the controller. */\n state?: Partial<TransactionPayControllerState>;\n};\n\n/** State of the TransactionPayController. */\nexport type TransactionPayControllerState = {\n /** State relating to each transaction, keyed by transaction ID. */\n transactionData: Record<string, TransactionData>;\n};\n\n/** State relating to a single transaction. */\nexport type TransactionData = {\n /**\n * Optional address to override the default account used by the transaction.\n * When `isPostQuote` is true, used as the recipient of the MM Pay transfer.\n * When `isPostQuote` is false, it provides the funds and pays for gas.\n */\n accountOverride?: Hex;\n\n /** Fiat payment method state. */\n fiatPayment?: TransactionFiatPayment;\n\n /** Whether quotes are currently being retrieved. */\n isLoading: boolean;\n\n /** Whether the user has selected the maximum amount. */\n isMaxAmount?: boolean;\n\n /**\n * Whether this is a post-quote transaction.\n * When true, the paymentToken represents the destination token,\n * and the quote source is derived from the transaction's output token.\n * Used when funds need to be moved after a transaction completes\n * (e.g., bridging output to a different token/chain).\n */\n isPostQuote?: boolean;\n\n /** Whether the source of funds is HyperLiquid (HyperCore). */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request.\n */\n refundTo?: Hex;\n\n /**\n * Token selected for the transaction.\n * - For standard flows (isPostQuote=false): This is the SOURCE/payment token\n * - For post-quote flows (isPostQuote=true): This is the DESTINATION token\n */\n paymentToken?: TransactionPaymentToken;\n\n /** Quotes retrieved for the transaction. */\n quotes?: TransactionPayQuote<Json>[];\n\n /** Timestamp of when quotes were last updated. */\n quotesLastUpdated?: number;\n\n /** Amounts of payment token required for each required token. */\n sourceAmounts?: TransactionPaySourceAmount[];\n\n /** Tokens required by the transaction. */\n tokens: TransactionPayRequiredToken[];\n\n /** Calculated totals for the transaction. */\n totals?: TransactionPayTotals;\n};\n\n/** Fiat payment state stored per transaction. */\nexport type TransactionFiatPayment = {\n /** Entered fiat amount for the selected payment method. */\n amountFiat?: string;\n\n /** CAIP-19 asset id derived from the transaction type for the fiat on-ramp. */\n caipAssetId?: string;\n\n /** Order identifier in normalized format (/providers/{provider}/orders/{id}). */\n orderId?: string;\n\n /** The ramps quote received from the ramps provider. */\n rampsQuote?: RampsQuote;\n\n /** Selected fiat payment method ID. */\n selectedPaymentMethodId?: string;\n};\n\n/** A token required by a transaction. */\nexport type TransactionPayRequiredToken = {\n /** Address of the required token. */\n address: Hex;\n\n /** Whether to allow quotes that return less than the minimum amount requested. */\n allowUnderMinimum: boolean;\n\n /** Amount required in the selected currency. */\n amountFiat: string;\n\n /** Amount required in a human-readable format factoring token decimals. */\n amountHuman: string;\n\n /** Amount required in atomic format without factoring token decimals. */\n amountRaw: string;\n\n /** Amount required in USD. */\n amountUsd: string;\n\n /** Balance of the required token in the selected currency. */\n balanceFiat: string;\n\n /** Balance of the required token in a human-readable format factoring token decimals. */\n balanceHuman: string;\n\n /** Balance of the required token in atomic format without factoring token decimals. */\n balanceRaw: string;\n\n /** Balance of the required token in USD. */\n balanceUsd: string;\n\n /** Chain ID of the required token. */\n chainId: Hex;\n\n /** Decimals of the required token. */\n decimals: number;\n\n /** Whether to skip transfer of this token if balance is already sufficient. */\n skipIfBalance: boolean;\n\n /** Symbol of the required token. */\n symbol: string;\n};\n\n/** Amount of payment token required by a required token. */\nexport type TransactionPaySourceAmount = {\n /** Amount of payment token required in the selected currency. */\n sourceAmountHuman: string;\n\n /** Amount of payment token required in atomic format without factoring token decimals. */\n sourceAmountRaw: string;\n\n /** Balance of the source token in atomic format (for post-quote flows). */\n sourceBalanceRaw?: string;\n\n /** Chain ID of the source token (for post-quote flows). */\n sourceChainId?: Hex;\n\n /** Address of the source token (for post-quote flows). */\n sourceTokenAddress?: Hex;\n\n /** Address of the target token. */\n targetTokenAddress: Hex;\n};\n\n/** Source token used to pay for required tokens. */\nexport type TransactionPaymentToken = {\n /** Address of the payment token. */\n address: Hex;\n\n /** Balance of the payment token in the selected currency. */\n balanceFiat: string;\n\n /** Balance of the payment token in a human-readable format factoring token decimals. */\n balanceHuman: string;\n\n /** Balance of the payment token in atomic format without factoring token decimals. */\n balanceRaw: string;\n\n /** Balance of the payment token in USD. */\n balanceUsd: string;\n\n /** Chain ID of the payment token. */\n chainId: Hex;\n\n /** Decimals of the payment token. */\n decimals: number;\n\n /** Symbol of the payment token. */\n symbol: string;\n};\n\n/** Callback to update state for a single transaction. */\nexport type UpdateTransactionDataCallback = (\n /** ID of the transaction to update. */\n transactionId: string,\n /** Function that receives a draft of the transaction data to update. */\n fn: (data: Draft<TransactionData>) => void,\n) => void;\n\n/** Conversion rates from the native currency to other currencies. */\nexport type FiatRates = {\n /** Conversion rate for the native currency to the selected fiat currency. */\n fiatRate: string;\n\n /** Conversion rate for the native currency to USD. */\n usdRate: string;\n};\n\n/** Request for a quote to retrieve a required token. */\nexport type QuoteRequest = {\n /** Address of the user's account. */\n from: Hex;\n\n /** Whether the transaction is a maximum amount transaction. */\n isMaxAmount?: boolean;\n\n /** Whether this is a post-quote flow. */\n isPostQuote?: boolean;\n\n /** Whether the source of funds is HyperLiquid (HyperCore). */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request.\n */\n refundTo?: Hex;\n\n /** Balance of the source token in atomic format without factoring token decimals. */\n sourceBalanceRaw: string;\n\n /** Chain ID of the source token. */\n sourceChainId: Hex;\n\n /** Address of the source token. */\n sourceTokenAddress: Hex;\n\n /** Amount of the required token in atomic format without factoring token decimals. */\n sourceTokenAmount: string;\n\n /** Minimum amount required of the target token in atomic format without factoring token decimals. */\n targetAmountMinimum: string;\n\n /** Chain ID of the target token. */\n targetChainId: Hex;\n\n /** Address of the target token. */\n targetTokenAddress: Hex;\n};\n\n/** Fees associated with a transaction pay quote. */\nexport type TransactionPayFees = {\n /** Whether a gas fee token is used to pay source network fees. */\n isSourceGasFeeToken?: boolean;\n\n /** Whether a gas fee token is used to pay target network fees. */\n isTargetGasFeeToken?: boolean;\n\n /** Fee charged by MetaMask. */\n metaMask: FiatValue;\n\n /** Fee charged by the quote provider. */\n provider: FiatValue;\n\n /** Fee charged by fiat on-ramp provider (breakdown of the provider total). */\n providerFiat?: FiatValue;\n\n /** Network fee for transactions on the source network. */\n sourceNetwork: {\n estimate: Amount;\n max: Amount;\n };\n\n /** Network fee for transactions on the target network. */\n targetNetwork: FiatValue;\n};\n\n/** Quote returned to retrieve a required token using the payment token. */\nexport type TransactionPayQuote<OriginalQuote> = {\n /** Additional amount provided by the quote beyond the minimum requested. */\n dust: FiatValue;\n\n /** Duration estimated for the transaction to complete in seconds. */\n estimatedDuration: number;\n\n /** Fees associated with the transaction pay quote. */\n fees: TransactionPayFees;\n\n /** Raw quote data returned by the provider. */\n original: OriginalQuote;\n\n /** Associated quote request. */\n request: QuoteRequest;\n\n /** Amount of source token required. */\n sourceAmount: Amount;\n\n /** Name of the strategy used to retrieve the quote. */\n strategy: TransactionPayStrategy;\n\n /** Amount of target token provided. */\n targetAmount: FiatValue;\n};\n\n/** Request to get quotes for a transaction. */\nexport type PayStrategyGetQuotesRequest = {\n /** Whether the account supports EIP-7702 authorization signing. */\n accountSupports7702: boolean;\n\n /** Selected fiat payment method ID, if applicable. */\n fiatPaymentMethod?: string;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quote requests for required tokens. */\n requests: QuoteRequest[];\n\n /**\n * Signal that aborts when a newer quote request supersedes this one.\n * Strategies that perform their own network IO should forward this to\n * their fetch calls so cancelled requests release network resources.\n */\n signal?: AbortSignal;\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to submit quotes for a transaction. */\nexport type PayStrategyExecuteRequest<OriginalRequest> = {\n /** Whether the account supports EIP-7702 authorization signing. */\n accountSupports7702: boolean;\n\n /** Callback to determine if the transaction is a smart transaction. */\n isSmartTransaction: (chainId: Hex) => boolean;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes to be submitted. */\n quotes: TransactionPayQuote<OriginalRequest>[];\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to get batch transactions for quotes. */\nexport type PayStrategyGetBatchRequest<OriginalQuote> = {\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes for required tokens. */\n quotes: TransactionPayQuote<OriginalQuote>[];\n\n /** Signal that aborts when a newer quote request supersedes this one. */\n signal?: AbortSignal;\n};\n\n/** Request to check whether retrieved quotes can be executed by a strategy. */\nexport type PayStrategyCheckQuoteSupportRequest<OriginalQuote> = {\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes returned by the strategy. */\n quotes: TransactionPayQuote<OriginalQuote>[];\n\n /** Signal that aborts when a newer quote request supersedes this one. */\n signal?: AbortSignal;\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to get refresh interval for a specific strategy. */\nexport type PayStrategyGetRefreshIntervalRequest = {\n /** Chain ID of the source or payment token. */\n chainId: Hex;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n};\n\n/** Strategy used to obtain required tokens for a transaction. */\nexport type PayStrategy<OriginalQuote> = {\n /**\n * Check if the strategy supports the given request.\n * Defaults to true if not implemented.\n */\n supports?: (\n request: PayStrategyGetQuotesRequest,\n ) => boolean | Promise<boolean>;\n\n /** Retrieve quotes for required tokens. */\n getQuotes: (\n request: PayStrategyGetQuotesRequest,\n ) => Promise<TransactionPayQuote<OriginalQuote>[]>;\n\n /**\n * Check if the returned quotes are supported after provider quote\n * construction and gas planning.\n *\n * Use this for limitations that are only knowable once quote metadata is\n * available, such as whether execution will require an EIP-7702\n * authorization list.\n */\n checkQuoteSupport?: (\n request: PayStrategyCheckQuoteSupportRequest<OriginalQuote>,\n ) => boolean | Promise<boolean>;\n\n /** Retrieve batch transactions for quotes, if supported by the strategy. */\n getBatchTransactions?: (\n request: PayStrategyGetBatchRequest<OriginalQuote>,\n ) => Promise<BatchTransaction[]>;\n\n /**\n * Retrieve refresh interval for the strategy, if applicable.\n * Defaults to 30 seconds.\n */\n getRefreshInterval?: (\n request: PayStrategyGetRefreshIntervalRequest,\n ) => Promise<number | undefined>;\n\n /** Execute or submit the quotes to obtain required tokens. */\n execute: (request: PayStrategyExecuteRequest<OriginalQuote>) => Promise<{\n transactionHash?: Hex;\n }>;\n};\n\n/** Single fiat value in alternate currencies. */\nexport type FiatValue = {\n /** Value in the selected fiat currency. */\n fiat: string;\n\n /** Value in USD. */\n usd: string;\n};\n\n/** Calculated totals for a target transaction and all quotes. */\nexport type TransactionPayTotals = {\n /** Total estimated duration for the target transaction and all quotes. */\n estimatedDuration: number;\n\n /** Total fees for the target transaction and all quotes. */\n fees: TransactionPayFees;\n\n /** Total amount of source token required. */\n sourceAmount: Amount;\n\n /** Total amount of target token provided. */\n targetAmount: FiatValue;\n\n /** Overall total cost for the target transaction and all quotes. */\n total: FiatValue;\n};\n\n/** Request to update the payment token for a transaction. */\nexport type UpdatePaymentTokenRequest = {\n /** ID of the transaction to update. */\n transactionId: string;\n\n /** Address of the new payment token. */\n tokenAddress: Hex;\n\n /** Chain ID of the new payment token. */\n chainId: Hex;\n};\n\n/** Request to update fiat payment state for a transaction. */\nexport type UpdateFiatPaymentRequest = {\n /** ID of the transaction to update. */\n transactionId: string;\n\n /** Callback to mutate fiat payment state. */\n callback: TransactionFiatPaymentCallback;\n};\n\n/** Callback to convert a transaction to a redeem delegation. */\nexport type GetDelegationTransactionCallback = ({\n transaction,\n}: {\n transaction: TransactionMeta;\n}) => Promise<{\n authorizationList?: AuthorizationList;\n data: Hex;\n to: Hex;\n value: Hex;\n}>;\n\n/** Client-supplied callbacks for the Polymarket relayer protocol. */\nexport type PolymarketCallbacks = {\n /** Derive the deposit-wallet address (CREATE2) for the given EOA. */\n getDepositWalletAddress: (params: { eoa: Hex }) => Promise<Hex>;\n\n /** Sign and broadcast a deposit-wallet batch, returning the source hash. */\n submitDepositWalletBatch: (params: {\n eoa: Hex;\n depositWallet: Hex;\n calls: { target: Hex; data: Hex; value: string }[];\n }) => Promise<{ sourceHash: Hex }>;\n};\n\n/** Single amount in alternate formats. */\nexport type Amount = FiatValue & {\n /** Amount in human-readable format factoring token decimals. */\n human: string;\n\n /** Amount in atomic format without factoring token decimals. */\n raw: string;\n};\n"]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA2MA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB;IAChE,aAAa;IACb,iBAAiB;IACjB,eAAe;CAChB,CAAC","sourcesContent":["import type {\n AssetsControllerGetStateForTransactionPayAction,\n AssetsControllerStateChangeEvent,\n} from '@metamask/assets-controller';\nimport type {\n CurrencyRateControllerGetStateAction,\n CurrencyRateStateChange,\n TokenBalancesControllerGetStateAction,\n} from '@metamask/assets-controllers';\nimport type { TokenRatesControllerGetStateAction } from '@metamask/assets-controllers';\nimport type { TokenRatesControllerStateChangeEvent } from '@metamask/assets-controllers';\nimport type {\n TokensControllerGetStateAction,\n TokensControllerStateChangeEvent,\n} from '@metamask/assets-controllers';\nimport type { AccountTrackerControllerGetStateAction } from '@metamask/assets-controllers';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { BridgeControllerFetchQuotesAction } from '@metamask/bridge-controller';\nimport type { BridgeStatusControllerStateChangeEvent } from '@metamask/bridge-status-controller';\nimport type {\n BridgeStatusControllerGetStateAction,\n BridgeStatusControllerSubmitTxAction,\n} from '@metamask/bridge-status-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerSignTypedMessageAction,\n KeyringTypes,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { NetworkControllerFindNetworkClientIdByChainIdAction } from '@metamask/network-controller';\nimport type { NetworkControllerGetNetworkClientByIdAction } from '@metamask/network-controller';\nimport type { NetworkControllerGetNetworkConfigurationByChainIdAction } from '@metamask/network-controller';\nimport type { Quote as RampsQuote } from '@metamask/ramps-controller';\nimport type {\n RampsControllerGetOrderAction,\n RampsControllerGetQuotesAction,\n} from '@metamask/ramps-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type {\n AuthorizationList,\n TransactionControllerAddTransactionBatchAction,\n TransactionControllerEstimateGasAction,\n TransactionControllerEstimateGasBatchAction,\n TransactionControllerUnapprovedTransactionAddedEvent,\n} from '@metamask/transaction-controller';\nimport type {\n BatchTransaction,\n BatchTransactionParams,\n TransactionControllerAddTransactionAction,\n TransactionControllerGetGasFeeTokensAction,\n TransactionControllerGetStateAction,\n TransactionControllerStateChangeEvent,\n TransactionControllerUpdateTransactionAction,\n TransactionMeta,\n} from '@metamask/transaction-controller';\nimport type { Hex, Json } from '@metamask/utils';\nimport type { Draft } from 'immer';\n\nimport type {\n CONTROLLER_NAME,\n PaymentOverride,\n TransactionPayStrategy,\n} from './constants';\nimport type { TransactionPayControllerMethodActions } from './TransactionPayController-method-action-types';\n\nexport type AllowedActions =\n | AccountTrackerControllerGetStateAction\n | AssetsControllerGetStateForTransactionPayAction\n | BridgeControllerFetchQuotesAction\n | BridgeStatusControllerGetStateAction\n | BridgeStatusControllerSubmitTxAction\n | CurrencyRateControllerGetStateAction\n | GetGasFeeState\n | KeyringControllerGetStateAction\n | KeyringControllerSignTypedMessageAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | RampsControllerGetOrderAction\n | RampsControllerGetQuotesAction\n | RemoteFeatureFlagControllerGetStateAction\n | TokenBalancesControllerGetStateAction\n | TokenRatesControllerGetStateAction\n | TokensControllerGetStateAction\n | TransactionControllerAddTransactionAction\n | TransactionControllerAddTransactionBatchAction\n | TransactionControllerEstimateGasAction\n | TransactionControllerEstimateGasBatchAction\n | TransactionControllerGetGasFeeTokensAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction;\n\nexport type AllowedEvents =\n | AssetsControllerStateChangeEvent\n | BridgeStatusControllerStateChangeEvent\n | CurrencyRateStateChange\n | TokenRatesControllerStateChangeEvent\n | TokensControllerStateChangeEvent\n | TransactionControllerStateChangeEvent\n | TransactionControllerUnapprovedTransactionAddedEvent;\n\nexport type TransactionPayControllerGetStateAction = ControllerGetStateAction<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState\n>;\n\n/** Configurable properties of a transaction. */\nexport type TransactionConfig = {\n /**\n * Optional address to override the default account used by the transaction.\n * When `isPostQuote` is true, used as the recipient of the MM Pay transfer.\n * When `isPostQuote` is false, it provides the funds and pays for gas.\n */\n accountOverride?: Hex;\n\n /**\n * Whether the source of funds is HyperLiquid (HyperCore).\n * When true, the Relay strategy uses the HyperLiquid 2-step withdrawal\n * flow: (1) authorize nonce-mapping, (2) sendAsset to Relay solver.\n */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Whether the user has selected the maximum amount. */\n isMaxAmount?: boolean;\n\n /**\n * Whether this is a post-quote transaction.\n * When true, the paymentToken represents the destination token,\n * and the quote source is derived from the transaction's output token.\n */\n isPostQuote?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request. Use this for post-quote flows where the user's funds originate\n * from a smart contract account (e.g. Predict Safe proxy) so that refunds\n * go back to that account rather than the EOA.\n */\n refundTo?: Hex;\n};\n\n/** Callback to update transaction config. */\nexport type TransactionConfigCallback = (config: TransactionConfig) => void;\n\n/** Request passed to {@link GetPaymentOverrideDataCallback}. */\nexport type GetPaymentOverrideDataRequest = {\n /** Amount of the source token in human-readable format. */\n amount: string;\n\n /** Metadata of the original transaction. */\n transaction: TransactionMeta;\n\n /** Pay-controller state for the transaction. */\n transactionData: TransactionData;\n};\n\n/** Response returned by {@link GetPaymentOverrideDataCallback}. */\nexport type GetPaymentOverrideDataResponse = {\n /** Batch transaction params to prepend to the submit batch. */\n calls: BatchTransactionParams[];\n};\n\n/**\n * Callback invoked during submit when `paymentOverride` is defined.\n * Returns batch transaction params to prepend to the submit batch.\n */\nexport type GetPaymentOverrideDataCallback = (\n request: GetPaymentOverrideDataRequest,\n) => Promise<GetPaymentOverrideDataResponse>;\n\n/** Callback to update fiat payment state. */\nexport type TransactionFiatPaymentCallback = (\n fiatPayment: TransactionFiatPayment,\n) => void;\n\nexport type TransactionPayControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState\n >;\n\nexport type TransactionPayControllerActions =\n | TransactionPayControllerGetStateAction\n | TransactionPayControllerMethodActions;\n\nexport type TransactionPayControllerEvents =\n TransactionPayControllerStateChangeEvent;\n\nexport type TransactionPayControllerMessenger = Messenger<\n typeof CONTROLLER_NAME,\n TransactionPayControllerActions | AllowedActions,\n TransactionPayControllerEvents | AllowedEvents\n>;\n\n/**\n * Keyring types that support EIP-7702 authorization signing.\n * Hardware wallets, snap keyrings, and custody keyrings are excluded.\n */\nexport const KEYRING_TYPES_SUPPORTING_7702: `${KeyringTypes}`[] = [\n 'HD Key Tree',\n 'Simple Key Pair',\n 'Money Keyring',\n];\n\n/** Options for the TransactionPayController. */\nexport type TransactionPayControllerOptions = {\n /** Callback to convert a transaction into a redeem delegation. */\n getDelegationTransaction: GetDelegationTransactionCallback;\n\n /**\n * Optional callback invoked during quote execution when `paymentOverride` is defined.\n * Returns additional transactions to be submitted alongside the quote batch.\n */\n getPaymentOverrideData?: GetPaymentOverrideDataCallback;\n\n /** Callback to select the PayStrategy for a transaction. */\n getStrategy?: (transaction: TransactionMeta) => TransactionPayStrategy;\n\n /** Callback to select ordered PayStrategies for a transaction. */\n getStrategies?: (transaction: TransactionMeta) => TransactionPayStrategy[];\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Callbacks for the Polymarket relayer; required only for the Polymarket deposit-wallet flow. */\n polymarket?: PolymarketCallbacks;\n\n /** Initial state of the controller. */\n state?: Partial<TransactionPayControllerState>;\n};\n\n/** State of the TransactionPayController. */\nexport type TransactionPayControllerState = {\n /** State relating to each transaction, keyed by transaction ID. */\n transactionData: Record<string, TransactionData>;\n};\n\n/** State relating to a single transaction. */\nexport type TransactionData = {\n /**\n * Optional address to override the default account used by the transaction.\n * When `isPostQuote` is true, used as the recipient of the MM Pay transfer.\n * When `isPostQuote` is false, it provides the funds and pays for gas.\n */\n accountOverride?: Hex;\n\n /** Fiat payment method state. */\n fiatPayment?: TransactionFiatPayment;\n\n /** Whether quotes are currently being retrieved. */\n isLoading: boolean;\n\n /** Whether the user has selected the maximum amount. */\n isMaxAmount?: boolean;\n\n /**\n * Whether this is a post-quote transaction.\n * When true, the paymentToken represents the destination token,\n * and the quote source is derived from the transaction's output token.\n * Used when funds need to be moved after a transaction completes\n * (e.g., bridging output to a different token/chain).\n */\n isPostQuote?: boolean;\n\n /** Whether the source of funds is HyperLiquid (HyperCore). */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request.\n */\n refundTo?: Hex;\n\n /**\n * Token selected for the transaction.\n * - For standard flows (isPostQuote=false): This is the SOURCE/payment token\n * - For post-quote flows (isPostQuote=true): This is the DESTINATION token\n */\n paymentToken?: TransactionPaymentToken;\n\n /** Quotes retrieved for the transaction. */\n quotes?: TransactionPayQuote<Json>[];\n\n /** Timestamp of when quotes were last updated. */\n quotesLastUpdated?: number;\n\n /** Amounts of payment token required for each required token. */\n sourceAmounts?: TransactionPaySourceAmount[];\n\n /** Tokens required by the transaction. */\n tokens: TransactionPayRequiredToken[];\n\n /** Calculated totals for the transaction. */\n totals?: TransactionPayTotals;\n};\n\n/** Fiat payment state stored per transaction. */\nexport type TransactionFiatPayment = {\n /** Entered fiat amount for the selected payment method. */\n amountFiat?: string;\n\n /** CAIP-19 asset id derived from the transaction type for the fiat on-ramp. */\n caipAssetId?: string;\n\n /** Order identifier in normalized format (/providers/{provider}/orders/{id}). */\n orderId?: string;\n\n /** The ramps quote received from the ramps provider. */\n rampsQuote?: RampsQuote;\n\n /** Selected fiat payment method ID. */\n selectedPaymentMethodId?: string;\n};\n\n/** A token required by a transaction. */\nexport type TransactionPayRequiredToken = {\n /** Address of the required token. */\n address: Hex;\n\n /** Whether to allow quotes that return less than the minimum amount requested. */\n allowUnderMinimum: boolean;\n\n /** Amount required in the selected currency. */\n amountFiat: string;\n\n /** Amount required in a human-readable format factoring token decimals. */\n amountHuman: string;\n\n /** Amount required in atomic format without factoring token decimals. */\n amountRaw: string;\n\n /** Amount required in USD. */\n amountUsd: string;\n\n /** Balance of the required token in the selected currency. */\n balanceFiat: string;\n\n /** Balance of the required token in a human-readable format factoring token decimals. */\n balanceHuman: string;\n\n /** Balance of the required token in atomic format without factoring token decimals. */\n balanceRaw: string;\n\n /** Balance of the required token in USD. */\n balanceUsd: string;\n\n /** Chain ID of the required token. */\n chainId: Hex;\n\n /** Decimals of the required token. */\n decimals: number;\n\n /** Whether to skip transfer of this token if balance is already sufficient. */\n skipIfBalance: boolean;\n\n /** Symbol of the required token. */\n symbol: string;\n};\n\n/** Amount of payment token required by a required token. */\nexport type TransactionPaySourceAmount = {\n /** Amount of payment token required in the selected currency. */\n sourceAmountHuman: string;\n\n /** Amount of payment token required in atomic format without factoring token decimals. */\n sourceAmountRaw: string;\n\n /** Balance of the source token in atomic format (for post-quote flows). */\n sourceBalanceRaw?: string;\n\n /** Chain ID of the source token (for post-quote flows). */\n sourceChainId?: Hex;\n\n /** Address of the source token (for post-quote flows). */\n sourceTokenAddress?: Hex;\n\n /** Address of the target token. */\n targetTokenAddress: Hex;\n};\n\n/** Source token used to pay for required tokens. */\nexport type TransactionPaymentToken = {\n /** Address of the payment token. */\n address: Hex;\n\n /** Balance of the payment token in the selected currency. */\n balanceFiat: string;\n\n /** Balance of the payment token in a human-readable format factoring token decimals. */\n balanceHuman: string;\n\n /** Balance of the payment token in atomic format without factoring token decimals. */\n balanceRaw: string;\n\n /** Balance of the payment token in USD. */\n balanceUsd: string;\n\n /** Chain ID of the payment token. */\n chainId: Hex;\n\n /** Decimals of the payment token. */\n decimals: number;\n\n /** Symbol of the payment token. */\n symbol: string;\n};\n\n/** Callback to update state for a single transaction. */\nexport type UpdateTransactionDataCallback = (\n /** ID of the transaction to update. */\n transactionId: string,\n /** Function that receives a draft of the transaction data to update. */\n fn: (data: Draft<TransactionData>) => void,\n) => void;\n\n/** Conversion rates from the native currency to other currencies. */\nexport type FiatRates = {\n /** Conversion rate for the native currency to the selected fiat currency. */\n fiatRate: string;\n\n /** Conversion rate for the native currency to USD. */\n usdRate: string;\n};\n\n/** Request for a quote to retrieve a required token. */\nexport type QuoteRequest = {\n /** Address of the user's account. */\n from: Hex;\n\n /** Whether the transaction is a maximum amount transaction. */\n isMaxAmount?: boolean;\n\n /** Whether this is a post-quote flow. */\n isPostQuote?: boolean;\n\n /** Whether the source of funds is HyperLiquid (HyperCore). */\n isHyperliquidSource?: boolean;\n\n /** Whether the source of funds is a Polymarket deposit wallet. */\n isPolymarketDepositWallet?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /**\n * Optional address to receive refunds if the quote provider transaction fails.\n * When set, overrides the default refund recipient (EOA) in the quote\n * request.\n */\n refundTo?: Hex;\n\n /** Balance of the source token in atomic format without factoring token decimals. */\n sourceBalanceRaw: string;\n\n /** Chain ID of the source token. */\n sourceChainId: Hex;\n\n /** Address of the source token. */\n sourceTokenAddress: Hex;\n\n /** Amount of the required token in atomic format without factoring token decimals. */\n sourceTokenAmount: string;\n\n /** Minimum amount required of the target token in atomic format without factoring token decimals. */\n targetAmountMinimum: string;\n\n /** Chain ID of the target token. */\n targetChainId: Hex;\n\n /** Address of the target token. */\n targetTokenAddress: Hex;\n};\n\n/** Fees associated with a transaction pay quote. */\nexport type TransactionPayFees = {\n /** Whether a gas fee token is used to pay source network fees. */\n isSourceGasFeeToken?: boolean;\n\n /** Whether a gas fee token is used to pay target network fees. */\n isTargetGasFeeToken?: boolean;\n\n /** Fee charged by MetaMask. */\n metaMask: FiatValue;\n\n /** Fee charged by the quote provider. */\n provider: FiatValue;\n\n /** Fee charged by fiat on-ramp provider (breakdown of the provider total). */\n providerFiat?: FiatValue;\n\n /** Network fee for transactions on the source network. */\n sourceNetwork: {\n estimate: Amount;\n max: Amount;\n };\n\n /** Network fee for transactions on the target network. */\n targetNetwork: FiatValue;\n};\n\n/** Quote returned to retrieve a required token using the payment token. */\nexport type TransactionPayQuote<OriginalQuote> = {\n /** Additional amount provided by the quote beyond the minimum requested. */\n dust: FiatValue;\n\n /** Duration estimated for the transaction to complete in seconds. */\n estimatedDuration: number;\n\n /** Fees associated with the transaction pay quote. */\n fees: TransactionPayFees;\n\n /** Raw quote data returned by the provider. */\n original: OriginalQuote;\n\n /** Associated quote request. */\n request: QuoteRequest;\n\n /** Amount of source token required. */\n sourceAmount: Amount;\n\n /** Name of the strategy used to retrieve the quote. */\n strategy: TransactionPayStrategy;\n\n /** Amount of target token provided. */\n targetAmount: FiatValue;\n};\n\n/** Request to get quotes for a transaction. */\nexport type PayStrategyGetQuotesRequest = {\n /** Whether the account supports EIP-7702 authorization signing. */\n accountSupports7702: boolean;\n\n /** Selected fiat payment method ID, if applicable. */\n fiatPaymentMethod?: string;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quote requests for required tokens. */\n requests: QuoteRequest[];\n\n /**\n * Signal that aborts when a newer quote request supersedes this one.\n * Strategies that perform their own network IO should forward this to\n * their fetch calls so cancelled requests release network resources.\n */\n signal?: AbortSignal;\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to submit quotes for a transaction. */\nexport type PayStrategyExecuteRequest<OriginalRequest> = {\n /** Whether the account supports EIP-7702 authorization signing. */\n accountSupports7702: boolean;\n\n /** Callback to determine if the transaction is a smart transaction. */\n isSmartTransaction: (chainId: Hex) => boolean;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes to be submitted. */\n quotes: TransactionPayQuote<OriginalRequest>[];\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to get batch transactions for quotes. */\nexport type PayStrategyGetBatchRequest<OriginalQuote> = {\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes for required tokens. */\n quotes: TransactionPayQuote<OriginalQuote>[];\n\n /** Signal that aborts when a newer quote request supersedes this one. */\n signal?: AbortSignal;\n};\n\n/** Request to check whether retrieved quotes can be executed by a strategy. */\nexport type PayStrategyCheckQuoteSupportRequest<OriginalQuote> = {\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n\n /** Quotes returned by the strategy. */\n quotes: TransactionPayQuote<OriginalQuote>[];\n\n /** Signal that aborts when a newer quote request supersedes this one. */\n signal?: AbortSignal;\n\n /** Metadata of the original target transaction. */\n transaction: TransactionMeta;\n};\n\n/** Request to get refresh interval for a specific strategy. */\nexport type PayStrategyGetRefreshIntervalRequest = {\n /** Chain ID of the source or payment token. */\n chainId: Hex;\n\n /** Controller messenger. */\n messenger: TransactionPayControllerMessenger;\n};\n\n/** Strategy used to obtain required tokens for a transaction. */\nexport type PayStrategy<OriginalQuote> = {\n /**\n * Check if the strategy supports the given request.\n * Defaults to true if not implemented.\n */\n supports?: (\n request: PayStrategyGetQuotesRequest,\n ) => boolean | Promise<boolean>;\n\n /** Retrieve quotes for required tokens. */\n getQuotes: (\n request: PayStrategyGetQuotesRequest,\n ) => Promise<TransactionPayQuote<OriginalQuote>[]>;\n\n /**\n * Check if the returned quotes are supported after provider quote\n * construction and gas planning.\n *\n * Use this for limitations that are only knowable once quote metadata is\n * available, such as whether execution will require an EIP-7702\n * authorization list.\n */\n checkQuoteSupport?: (\n request: PayStrategyCheckQuoteSupportRequest<OriginalQuote>,\n ) => boolean | Promise<boolean>;\n\n /** Retrieve batch transactions for quotes, if supported by the strategy. */\n getBatchTransactions?: (\n request: PayStrategyGetBatchRequest<OriginalQuote>,\n ) => Promise<BatchTransaction[]>;\n\n /**\n * Retrieve refresh interval for the strategy, if applicable.\n * Defaults to 30 seconds.\n */\n getRefreshInterval?: (\n request: PayStrategyGetRefreshIntervalRequest,\n ) => Promise<number | undefined>;\n\n /** Execute or submit the quotes to obtain required tokens. */\n execute: (request: PayStrategyExecuteRequest<OriginalQuote>) => Promise<{\n transactionHash?: Hex;\n }>;\n};\n\n/** Single fiat value in alternate currencies. */\nexport type FiatValue = {\n /** Value in the selected fiat currency. */\n fiat: string;\n\n /** Value in USD. */\n usd: string;\n};\n\n/** Calculated totals for a target transaction and all quotes. */\nexport type TransactionPayTotals = {\n /** Total estimated duration for the target transaction and all quotes. */\n estimatedDuration: number;\n\n /** Total fees for the target transaction and all quotes. */\n fees: TransactionPayFees;\n\n /** Total amount of source token required. */\n sourceAmount: Amount;\n\n /** Total amount of target token provided. */\n targetAmount: FiatValue;\n\n /** Overall total cost for the target transaction and all quotes. */\n total: FiatValue;\n};\n\n/** Request to update the payment token for a transaction. */\nexport type UpdatePaymentTokenRequest = {\n /** ID of the transaction to update. */\n transactionId: string;\n\n /** Address of the new payment token. */\n tokenAddress: Hex;\n\n /** Chain ID of the new payment token. */\n chainId: Hex;\n};\n\n/** Request to update fiat payment state for a transaction. */\nexport type UpdateFiatPaymentRequest = {\n /** ID of the transaction to update. */\n transactionId: string;\n\n /** Callback to mutate fiat payment state. */\n callback: TransactionFiatPaymentCallback;\n};\n\n/** Callback to convert a transaction to a redeem delegation. */\nexport type GetDelegationTransactionCallback = ({\n transaction,\n}: {\n transaction: TransactionMeta;\n}) => Promise<{\n authorizationList?: AuthorizationList;\n data: Hex;\n to: Hex;\n value: Hex;\n}>;\n\n/** Client-supplied callbacks for the Polymarket relayer protocol. */\nexport type PolymarketCallbacks = {\n /** Derive the deposit-wallet address (CREATE2) for the given EOA. */\n getDepositWalletAddress: (params: { eoa: Hex }) => Promise<Hex>;\n\n /** Sign and broadcast a deposit-wallet batch, returning the source hash. */\n submitDepositWalletBatch: (params: {\n eoa: Hex;\n depositWallet: Hex;\n calls: { target: Hex; data: Hex; value: string }[];\n }) => Promise<{ sourceHash: Hex }>;\n};\n\n/** Single amount in alternate formats. */\nexport type Amount = FiatValue & {\n /** Amount in human-readable format factoring token decimals. */\n human: string;\n\n /** Amount in atomic format without factoring token decimals. */\n raw: string;\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEIP7702Chain = exports.getFiatMaxRateDriftPercent = exports.getFiatFeeReserveMultiplier = exports.getFiatAssetPerTransactionType = exports.getAssetsUnifyStateFeature = exports.getSlippage = exports.getGasBuffer = exports.getFallbackGas = exports.getServerPollingTimeout = exports.getServerPollingInterval = exports.getRelayPollingTimeout = exports.getRelayPollingInterval = exports.getRelayOriginGasOverhead = exports.isChainExcludedFromInfura = exports.isRelayExecuteEnabled = exports.getPayStrategiesConfig = exports.getFeatureFlags = exports.getStrategy = exports.getStrategyOrder = exports.DEFAULT_STRATEGY_ORDER = exports.DEFAULT_SERVER_BASE_URL = exports.DEFAULT_ACROSS_API_BASE = exports.DEFAULT_SLIPPAGE = exports.DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD = exports.DEFAULT_RELAY_QUOTE_URL = exports.DEFAULT_RELAY_EXECUTE_URL = exports.DEFAULT_FALLBACK_GAS_MAX = exports.DEFAULT_FALLBACK_GAS_ESTIMATE = exports.DEFAULT_GAS_BUFFER = void 0;
3
+ exports.isEIP7702Chain = exports.getFiatAssetPerTransactionType = exports.getAssetsUnifyStateFeature = exports.getSlippage = exports.getGasBuffer = exports.getFallbackGas = exports.getServerPollingTimeout = exports.getServerPollingInterval = exports.getRelayPollingTimeout = exports.getRelayPollingInterval = exports.getRelayOriginGasOverhead = exports.isChainExcludedFromInfura = exports.isRelayExecuteEnabled = exports.getPayStrategiesConfig = exports.getFeatureFlags = exports.getStrategy = exports.getStrategyOrder = exports.DEFAULT_STRATEGY_ORDER = exports.DEFAULT_SERVER_BASE_URL = exports.DEFAULT_ACROSS_API_BASE = exports.DEFAULT_SLIPPAGE = exports.DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD = exports.DEFAULT_RELAY_QUOTE_URL = exports.DEFAULT_RELAY_EXECUTE_URL = exports.DEFAULT_FALLBACK_GAS_MAX = exports.DEFAULT_FALLBACK_GAS_ESTIMATE = exports.DEFAULT_GAS_BUFFER = void 0;
4
4
  const utils_1 = require("@metamask/utils");
5
5
  const lodash_1 = require("lodash");
6
6
  const constants_1 = require("../constants.cjs");
@@ -449,46 +449,6 @@ function getFiatAssetPerTransactionType(messenger, transactionType) {
449
449
  constants_2.ETH_MAINNET_FIAT_ASSET);
450
450
  }
451
451
  exports.getFiatAssetPerTransactionType = getFiatAssetPerTransactionType;
452
- const DEFAULT_FEE_RESERVE_MULTIPLIER = 1;
453
- const DEFAULT_MAX_RATE_DRIFT_PERCENT = 10;
454
- /**
455
- * Returns the fee reserve multiplier for fiat three-phase submit.
456
- *
457
- * Controls how much of the original relay fee is reserved from the discovery
458
- * quote source amount to prevent EXACT_OUTPUT cost overruns.
459
- * Defaults to 1 (100% of the original fee).
460
- *
461
- * @param messenger - Controller messenger.
462
- * @returns The fee reserve multiplier.
463
- */
464
- function getFiatFeeReserveMultiplier(messenger) {
465
- const state = messenger.call('RemoteFeatureFlagController:getState');
466
- const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat;
467
- const multiplier = fiatFlags?.feeReserveMultiplier;
468
- return typeof multiplier === 'number' && multiplier > 0
469
- ? multiplier
470
- : DEFAULT_FEE_RESERVE_MULTIPLIER;
471
- }
472
- exports.getFiatFeeReserveMultiplier = getFiatFeeReserveMultiplier;
473
- /**
474
- * Returns the maximum allowed relay rate drift percentage for fiat submit.
475
- *
476
- * Controls how much the relay exchange rate can drift between the original
477
- * quoting phase and the post-settlement discovery quote before failing.
478
- * Defaults to 10%.
479
- *
480
- * @param messenger - Controller messenger.
481
- * @returns The maximum rate drift percentage.
482
- */
483
- function getFiatMaxRateDriftPercent(messenger) {
484
- const state = messenger.call('RemoteFeatureFlagController:getState');
485
- const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat;
486
- const maxDrift = fiatFlags?.maxRateDriftPercent;
487
- return typeof maxDrift === 'number' && maxDrift > 0
488
- ? maxDrift
489
- : DEFAULT_MAX_RATE_DRIFT_PERCENT;
490
- }
491
- exports.getFiatMaxRateDriftPercent = getFiatMaxRateDriftPercent;
492
452
  /**
493
453
  * Checks if a chain supports EIP-7702.
494
454
  *
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.cjs","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":";;;AAEA,2CAAqD;AACrD,mCAA8B;AAE9B,gDAAgF;AAChF,0CAA0C;AAE1C,8DAGoC;AACpC,+DAIqC;AACrC,gEAGsC;AAGtC,MAAM,GAAG,GAAG,IAAA,0BAAkB,EAAC,sBAAa,EAAE,eAAe,CAAC,CAAC;AAIlD,QAAA,kBAAkB,GAAG,GAAG,CAAC;AACzB,QAAA,6BAA6B,GAAG,MAAM,CAAC;AACvC,QAAA,wBAAwB,GAAG,OAAO,CAAC;AACnC,QAAA,yBAAyB,GAAG,6BAAiB,CAAC;AAC9C,QAAA,uBAAuB,GAAG,2BAAe,CAAC;AAC1C,QAAA,iCAAiC,GAAG,QAAQ,CAAC;AAC7C,QAAA,gBAAgB,GAAG,KAAK,CAAC;AACzB,QAAA,uBAAuB,GAAG,2BAA2B,CAAC;AACtD,QAAA,uBAAuB,GAAG,2BAAe,CAAC;AAC1C,QAAA,sBAAsB,GAAkB;IACnD,kCAAsB,CAAC,MAAM;IAC7B,kCAAsB,CAAC,KAAK;IAC5B,kCAAsB,CAAC,MAAM;CAC9B,CAAC;AA4IF,SAAS,YAAY,CAAC,KAAyB;IAC7C,OAAO,KAAK,EAAE,WAAW,EAAqB,CAAC;AACjD,CAA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AAI,CAAC,sCAAsC,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,sBAEjC,CAAC;IAEd,MAAM,eAAe,GAAG,YAAY,EAAE,eAAe,IAAI,EAAE,CAAC;IAE5D,OAAO,eAAe,CAAC,IAAI,CACzB,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CACjE,CAAC;AACJ,CAAC;AAdD,wCAcC","sourcesContent":["import type { TransactionType } from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { uniq } from 'lodash';\n\nimport { isTransactionPayStrategy, TransactionPayStrategy } from '../constants';\nimport { projectLogger } from '../logger';\nimport type { TransactionPayFiatAsset } from '../strategy/fiat/constants';\nimport {\n ETH_MAINNET_FIAT_ASSET,\n FIAT_ASSET_ID_BY_TX_TYPE,\n} from '../strategy/fiat/constants';\nimport {\n RELAY_EXECUTE_URL,\n RELAY_POLLING_INTERVAL,\n RELAY_QUOTE_URL,\n} from '../strategy/relay/constants';\nimport {\n SERVER_POLLING_INTERVAL,\n SERVER_URL_BASE,\n} from '../strategy/server/constants';\nimport type { TransactionPayControllerMessenger } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'feature-flags');\n\ntype StrategyOrder = TransactionPayStrategy[];\n\nexport const DEFAULT_GAS_BUFFER = 1.0;\nexport const DEFAULT_FALLBACK_GAS_ESTIMATE = 900000;\nexport const DEFAULT_FALLBACK_GAS_MAX = 1500000;\nexport const DEFAULT_RELAY_EXECUTE_URL = RELAY_EXECUTE_URL;\nexport const DEFAULT_RELAY_QUOTE_URL = RELAY_QUOTE_URL;\nexport const DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD = '300000';\nexport const DEFAULT_SLIPPAGE = 0.005;\nexport const DEFAULT_ACROSS_API_BASE = 'https://app.across.to/api';\nexport const DEFAULT_SERVER_BASE_URL = SERVER_URL_BASE;\nexport const DEFAULT_STRATEGY_ORDER: StrategyOrder = [\n TransactionPayStrategy.Server,\n TransactionPayStrategy.Relay,\n TransactionPayStrategy.Across,\n];\n\ntype FeatureFlagsRaw = {\n gasBuffer?: {\n default?: number;\n perChainConfig?: Record<\n Hex,\n {\n name?: string;\n buffer?: number;\n }\n >;\n };\n relayDisabledGasStationChains?: Hex[];\n relayExecuteUrl?: string;\n relayFallbackGas?: {\n estimate?: number;\n max?: number;\n };\n relayQuoteUrl?: string;\n slippage?: number;\n slippageTokens?: Record<Hex, Record<Hex, number>>;\n strategyOrder?: string[];\n strategyOverrides?: StrategyOverridesRaw;\n payStrategies?: PayStrategiesConfigRaw;\n};\n\ntype StrategyOverrideRaw = {\n default?: unknown;\n chains?: Record<string, unknown>;\n tokens?: Record<string, Record<string, unknown>>;\n};\n\ntype StrategyOverridesRaw = {\n default?: StrategyOverrideRaw;\n transactionTypes?: Record<string, StrategyOverrideRaw>;\n};\n\ntype StrategyOverride = {\n chains: Record<Hex, TransactionPayStrategy[]>;\n default?: TransactionPayStrategy[];\n tokens: Record<Hex, Record<Hex, TransactionPayStrategy[]>>;\n};\n\ntype StrategyOverrides = {\n default?: StrategyOverride;\n transactionTypes: Record<string, StrategyOverride>;\n};\n\ntype FiatFlags = {\n assetPerTransactionType?: Partial<\n Record<TransactionType, TransactionPayFiatAsset>\n >;\n feeReserveMultiplier?: number;\n maxRateDriftPercent?: number;\n};\n\ntype StrategyRoutingConfig = {\n payStrategies: {\n across: {\n enabled: boolean;\n };\n server: {\n enabled: boolean;\n };\n relay: {\n enabled: boolean;\n };\n };\n strategyOverrides: StrategyOverrides;\n strategyOrder: TransactionPayStrategy[];\n};\n\nexport type FeatureFlags = {\n relayDisabledGasStationChains: Hex[];\n relayExecuteUrl: string;\n relayFallbackGas: {\n estimate: number;\n max: number;\n };\n relayQuoteUrl: string;\n slippage: number;\n};\n\nexport type AcrossConfigRaw = {\n apiBase?: string;\n enabled?: boolean;\n fallbackGas?: {\n estimate?: number;\n max?: number;\n };\n};\n\nexport type AcrossConfig = {\n apiBase: string;\n enabled: boolean;\n fallbackGas: {\n estimate: number;\n max: number;\n };\n};\n\nexport type PayStrategiesConfigRaw = {\n across?: AcrossConfigRaw;\n relay?: {\n enabled?: boolean;\n originGasOverhead?: string;\n pollingInterval?: number;\n pollingTimeout?: number;\n };\n};\n\ntype FeatureFlagsExtendedRaw = {\n excludeChainIdsFromInfura?: Hex[];\n payStrategies?: {\n relay?: {\n gaslessEnabled?: boolean;\n };\n server?: {\n enabled?: boolean;\n baseUrl?: string;\n pollingInterval?: number;\n pollingTimeout?: number;\n };\n };\n};\n\nexport type PayStrategiesConfig = {\n across: AcrossConfig;\n server: {\n enabled: boolean;\n baseUrl: string;\n pollingInterval: number;\n pollingTimeout?: number;\n };\n relay: {\n enabled: boolean;\n };\n};\n\nfunction normalizeHex(value: string | undefined): Hex | undefined {\n return value?.toLowerCase() as Hex | undefined;\n}\n\nfunction normalizeStrategy(\n strategy: unknown,\n): TransactionPayStrategy | undefined {\n if (typeof strategy !== 'string') {\n return undefined;\n }\n\n const normalizedStrategy = strategy.toLowerCase() as TransactionPayStrategy;\n\n return isTransactionPayStrategy(normalizedStrategy)\n ? normalizedStrategy\n : undefined;\n}\n\nfunction normalizeStrategyList(strategies: unknown): TransactionPayStrategy[] {\n if (!Array.isArray(strategies)) {\n return [];\n }\n\n return uniq(\n strategies\n .map((strategy) => normalizeStrategy(strategy))\n .filter(\n (strategy): strategy is TransactionPayStrategy =>\n strategy !== undefined,\n ),\n );\n}\n\nfunction normalizeStrategyOverride(\n override: StrategyOverrideRaw | undefined,\n): StrategyOverride {\n const chains = Object.entries(override?.chains ?? {}).reduce<\n Record<Hex, TransactionPayStrategy[]>\n >((result, [chainId, strategies]) => {\n const normalizedStrategies = normalizeStrategyList(strategies);\n\n if (normalizedStrategies.length) {\n result[normalizeHex(chainId) as Hex] = normalizedStrategies;\n }\n\n return result;\n }, {});\n\n const tokens = Object.entries(override?.tokens ?? {}).reduce<\n Record<Hex, Record<Hex, TransactionPayStrategy[]>>\n >((result, [chainId, tokenOverrides]) => {\n const normalizedTokenOverrides = Object.entries(\n tokenOverrides ?? {},\n ).reduce<Record<Hex, TransactionPayStrategy[]>>(\n (tokenResult, [tokenAddress, strategies]) => {\n const normalizedStrategies = normalizeStrategyList(strategies);\n\n if (normalizedStrategies.length) {\n tokenResult[normalizeHex(tokenAddress) as Hex] = normalizedStrategies;\n }\n\n return tokenResult;\n },\n {},\n );\n\n if (Object.keys(normalizedTokenOverrides).length) {\n result[normalizeHex(chainId) as Hex] = normalizedTokenOverrides;\n }\n\n return result;\n }, {});\n\n const defaultStrategies = normalizeStrategyList(override?.default);\n\n return {\n chains,\n default: defaultStrategies.length ? defaultStrategies : undefined,\n tokens,\n };\n}\n\nfunction normalizeStrategyRoutingConfig(\n featureFlags: FeatureFlagsRaw,\n extendedFeatureFlags: FeatureFlagsExtendedRaw,\n): StrategyRoutingConfig {\n const strategyOrder = normalizeStrategyList(featureFlags.strategyOrder);\n\n return {\n payStrategies: {\n across: {\n enabled: featureFlags.payStrategies?.across?.enabled ?? false,\n },\n server: {\n enabled: extendedFeatureFlags.payStrategies?.server?.enabled ?? false,\n },\n relay: {\n enabled: featureFlags.payStrategies?.relay?.enabled ?? true,\n },\n },\n strategyOverrides: {\n default: featureFlags.strategyOverrides?.default\n ? normalizeStrategyOverride(featureFlags.strategyOverrides.default)\n : undefined,\n transactionTypes: Object.entries(\n featureFlags.strategyOverrides?.transactionTypes ?? {},\n ).reduce<Record<string, StrategyOverride>>((result, [type, override]) => {\n result[type] = normalizeStrategyOverride(override);\n return result;\n }, {}),\n },\n strategyOrder:\n strategyOrder.length > 0 ? strategyOrder : [...DEFAULT_STRATEGY_ORDER],\n };\n}\n\nfunction getStrategyRoutingConfig(\n messenger: TransactionPayControllerMessenger,\n): StrategyRoutingConfig {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags = state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined;\n const extendedFeatureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n\n return normalizeStrategyRoutingConfig(\n featureFlags ?? {},\n extendedFeatureFlags,\n );\n}\n\nfunction filterEnabledStrategies(\n strategies: readonly TransactionPayStrategy[],\n routingConfig: StrategyRoutingConfig,\n): TransactionPayStrategy[] {\n return strategies.filter((strategy) => {\n if (strategy === TransactionPayStrategy.Across) {\n return routingConfig.payStrategies.across.enabled;\n }\n\n if (strategy === TransactionPayStrategy.Relay) {\n return routingConfig.payStrategies.relay.enabled;\n }\n\n if (strategy === TransactionPayStrategy.Server) {\n return routingConfig.payStrategies.server.enabled;\n }\n\n return true;\n });\n}\n\nfunction getTokenOverrideStrategies(\n override: StrategyOverride | undefined,\n normalizedChainId: Hex | undefined,\n normalizedTokenAddress: Hex | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n if (!override || !normalizedChainId || !normalizedTokenAddress) {\n return undefined;\n }\n\n return override.tokens[normalizedChainId]?.[normalizedTokenAddress];\n}\n\nfunction getChainOverrideStrategies(\n override: StrategyOverride | undefined,\n normalizedChainId: Hex | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n if (!override || !normalizedChainId) {\n return undefined;\n }\n\n return override.chains[normalizedChainId];\n}\n\nfunction getDefaultOverrideStrategies(\n override: StrategyOverride | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n return override?.default;\n}\n\n/**\n * Get ordered list of strategies to try for a route.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Optional chain ID used to match route overrides.\n * @param tokenAddress - Optional token address used to match route overrides.\n * @param transactionType - Optional transaction type used to match route\n * overrides.\n * @param fiatPaymentMethodId - Optional fiat payment method ID used to match route overrides.\n * @returns Ordered strategy list.\n */\nexport function getStrategyOrder(\n messenger: TransactionPayControllerMessenger,\n chainId?: Hex,\n tokenAddress?: Hex,\n transactionType?: string,\n fiatPaymentMethodId?: string,\n): StrategyOrder {\n // If fiat payment method is selected, use Fiat strategy only\n if (fiatPaymentMethodId) {\n return [TransactionPayStrategy.Fiat];\n }\n\n const routingConfig = getStrategyRoutingConfig(messenger);\n const normalizedChainId = normalizeHex(chainId);\n const normalizedTokenAddress = normalizeHex(tokenAddress);\n const transactionTypeOverride = transactionType\n ? routingConfig.strategyOverrides.transactionTypes[transactionType]\n : undefined;\n\n const candidates: (readonly TransactionPayStrategy[] | undefined)[] = [\n getTokenOverrideStrategies(\n transactionTypeOverride,\n normalizedChainId,\n normalizedTokenAddress,\n ),\n getChainOverrideStrategies(transactionTypeOverride, normalizedChainId),\n getTokenOverrideStrategies(\n routingConfig.strategyOverrides.default,\n normalizedChainId,\n normalizedTokenAddress,\n ),\n getChainOverrideStrategies(\n routingConfig.strategyOverrides.default,\n normalizedChainId,\n ),\n getDefaultOverrideStrategies(transactionTypeOverride),\n getDefaultOverrideStrategies(routingConfig.strategyOverrides.default),\n ];\n\n // Overrides are authoritative. Once a route matches a specific override\n // scope, disabled strategies do not inherit candidates from lower-precedence\n // scopes.\n for (const strategies of candidates) {\n if (strategies) {\n return filterEnabledStrategies(strategies, routingConfig);\n }\n }\n\n return filterEnabledStrategies(routingConfig.strategyOrder, routingConfig);\n}\n\n/**\n * Get the preferred strategy for a route.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Optional chain ID used to match route overrides.\n * @param tokenAddress - Optional token address used to match route overrides.\n * @param transactionType - Optional transaction type used to match route\n * overrides.\n * @returns The preferred strategy, if any.\n */\nexport function getStrategy(\n messenger: TransactionPayControllerMessenger,\n chainId?: Hex,\n tokenAddress?: Hex,\n transactionType?: string,\n): TransactionPayStrategy | undefined {\n return getStrategyOrder(messenger, chainId, tokenAddress, transactionType)[0];\n}\n\n/**\n * Get feature flags related to the controller.\n *\n * @param messenger - Controller messenger.\n * @returns Feature flags.\n */\nexport function getFeatureFlags(\n messenger: TransactionPayControllerMessenger,\n): FeatureFlags {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n\n const estimate =\n featureFlags.relayFallbackGas?.estimate ?? DEFAULT_FALLBACK_GAS_ESTIMATE;\n\n const max = featureFlags.relayFallbackGas?.max ?? DEFAULT_FALLBACK_GAS_MAX;\n\n const relayExecuteUrl =\n featureFlags.relayExecuteUrl ?? DEFAULT_RELAY_EXECUTE_URL;\n\n const relayQuoteUrl = featureFlags.relayQuoteUrl ?? DEFAULT_RELAY_QUOTE_URL;\n\n const relayDisabledGasStationChains =\n featureFlags.relayDisabledGasStationChains ?? [];\n\n const slippage = featureFlags.slippage ?? DEFAULT_SLIPPAGE;\n\n const result: FeatureFlags = {\n relayDisabledGasStationChains,\n relayExecuteUrl,\n relayFallbackGas: {\n estimate,\n max,\n },\n relayQuoteUrl,\n slippage,\n };\n\n log('Feature flags:', { raw: featureFlags, result });\n\n return result;\n}\n\n/**\n * Get Pay Strategies configuration.\n *\n * @param messenger - Controller messenger.\n * @returns Pay Strategies configuration.\n */\nexport function getPayStrategiesConfig(\n messenger: TransactionPayControllerMessenger,\n): PayStrategiesConfig {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n const extendedFeatureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n const payStrategies = featureFlags.payStrategies ?? {};\n const extendedPayStrategies = extendedFeatureFlags.payStrategies ?? {};\n\n const acrossRaw = payStrategies.across ?? {};\n const serverRaw = extendedPayStrategies.server ?? {};\n const relayRaw = payStrategies.relay ?? {};\n\n const across = {\n apiBase: acrossRaw.apiBase ?? DEFAULT_ACROSS_API_BASE,\n enabled: acrossRaw.enabled ?? false,\n fallbackGas: {\n estimate:\n acrossRaw.fallbackGas?.estimate ?? DEFAULT_FALLBACK_GAS_ESTIMATE,\n max: acrossRaw.fallbackGas?.max ?? DEFAULT_FALLBACK_GAS_MAX,\n },\n };\n\n const server = {\n enabled: serverRaw.enabled ?? false,\n baseUrl: serverRaw.baseUrl ?? DEFAULT_SERVER_BASE_URL,\n pollingInterval: serverRaw.pollingInterval ?? SERVER_POLLING_INTERVAL,\n pollingTimeout: serverRaw.pollingTimeout,\n };\n\n const relay = {\n enabled: relayRaw.enabled ?? true,\n };\n\n return {\n across,\n server,\n relay,\n };\n}\n\n/**\n * Whether the Relay /execute gasless flow is enabled.\n *\n * @param messenger - Controller messenger.\n * @returns True if the execute flow is enabled.\n */\nexport function isRelayExecuteEnabled(\n messenger: TransactionPayControllerMessenger,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n return featureFlags.payStrategies?.relay?.gaslessEnabled ?? false;\n}\n\n/**\n * Whether a chain is excluded from preferring Infura for balance queries.\n *\n * When a chain ID appears in the `confirmations_pay_extended.excludeChainIdsFromInfura`\n * feature flag array, the Infura RPC endpoint should not be forced for that chain.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to check.\n * @returns True if the chain should skip the Infura preference.\n */\nexport function isChainExcludedFromInfura(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n\n const excludedChains = featureFlags.excludeChainIdsFromInfura ?? [];\n\n return excludedChains.some(\n (excluded) => excluded.toLowerCase() === chainId.toLowerCase(),\n );\n}\n\n/**\n * Get the origin gas overhead to include in Relay quote requests\n * for EIP-7702 chains.\n *\n * @param messenger - Controller messenger.\n * @returns Origin gas overhead as a decimal string.\n */\nexport function getRelayOriginGasOverhead(\n messenger: TransactionPayControllerMessenger,\n): string {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return (\n featureFlags.payStrategies?.relay?.originGasOverhead ??\n DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD\n );\n}\n\n/**\n * Get the relay status polling interval in milliseconds.\n * Falls back to the constant default when not configured.\n *\n * @param messenger - Controller messenger.\n * @returns Polling interval in milliseconds.\n */\nexport function getRelayPollingInterval(\n messenger: TransactionPayControllerMessenger,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return (\n featureFlags.payStrategies?.relay?.pollingInterval ?? RELAY_POLLING_INTERVAL\n );\n}\n\n/**\n * Get the relay status polling timeout in milliseconds.\n * Returns 0 or undefined to indicate no timeout.\n *\n * @param messenger - Controller messenger.\n * @returns Polling timeout in milliseconds, or undefined when not configured.\n */\nexport function getRelayPollingTimeout(\n messenger: TransactionPayControllerMessenger,\n): number | undefined {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return featureFlags.payStrategies?.relay?.pollingTimeout;\n}\n\n/**\n * Get the server strategy status polling interval in milliseconds.\n *\n * @param messenger - Controller messenger.\n * @returns Polling interval in milliseconds.\n */\nexport function getServerPollingInterval(\n messenger: TransactionPayControllerMessenger,\n): number {\n return getPayStrategiesConfig(messenger).server.pollingInterval;\n}\n\n/**\n * Get the server strategy status polling timeout in milliseconds.\n *\n * @param messenger - Controller messenger.\n * @returns Polling timeout in milliseconds, or undefined when not configured.\n */\nexport function getServerPollingTimeout(\n messenger: TransactionPayControllerMessenger,\n): number | undefined {\n return getPayStrategiesConfig(messenger).server.pollingTimeout;\n}\n\n/**\n * Get fallback gas limits for quote/submit flows.\n *\n * @param messenger - Controller messenger.\n * @returns Fallback gas limits.\n */\nexport function getFallbackGas(\n messenger: TransactionPayControllerMessenger,\n): FeatureFlags['relayFallbackGas'] {\n return getFeatureFlags(messenger).relayFallbackGas;\n}\n\n/**\n * Get the gas buffer value for a specific chain ID.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to get gas buffer for.\n * @returns Gas buffer value.\n */\nexport function getGasBuffer(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n\n return (\n featureFlags.gasBuffer?.perChainConfig?.[chainId]?.buffer ??\n featureFlags.gasBuffer?.default ??\n DEFAULT_GAS_BUFFER\n );\n}\n\n/**\n * Get the slippage value for a specific chain ID and token address.\n * Falls back to the general slippage feature flag, then the static default.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to get slippage for.\n * @param tokenAddress - Token address to get slippage for.\n * @returns Slippage value as a decimal (e.g., 0.005 for 0.5%).\n */\nexport function getSlippage(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n tokenAddress: Hex,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n const { slippageTokens } = featureFlags;\n\n const tokenMap = getCaseInsensitive(slippageTokens, chainId);\n const tokenSlippage = getCaseInsensitive(tokenMap, tokenAddress);\n\n if (tokenSlippage !== undefined) {\n log('Using token-specific slippage', {\n chainId,\n tokenAddress,\n slippage: tokenSlippage,\n });\n return tokenSlippage;\n }\n\n const slippage = featureFlags.slippage ?? DEFAULT_SLIPPAGE;\n log('Using default slippage', { chainId, tokenAddress, slippage });\n return slippage;\n}\n\n/**\n * Get the AssetsUnifyState feature flag state.\n *\n * @param messenger - Controller messenger.\n * @returns True if the assets unify state feature is enabled, false otherwise.\n */\nexport function getAssetsUnifyStateFeature(\n messenger: TransactionPayControllerMessenger,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const assetsUnifyState = state.remoteFeatureFlags.assetsUnifyState as\n | {\n enabled: boolean;\n featureVersion: string | null;\n }\n | undefined;\n\n const AssetsUnifyStateFeatureVersion = '1';\n\n return (\n Boolean(assetsUnifyState?.enabled) &&\n assetsUnifyState?.featureVersion === AssetsUnifyStateFeatureVersion\n );\n}\n\n/**\n * Get a value from a record using a case-insensitive key lookup.\n *\n * @param record - The record to search.\n * @param key - The key to look up (case-insensitive).\n * @returns The value if found, undefined otherwise.\n */\nfunction getCaseInsensitive<Value>(\n record: Record<string, Value> | undefined,\n key: string,\n): Value | undefined {\n if (!record) {\n return undefined;\n }\n\n const normalizedKey = key.toLowerCase();\n const entry = Object.entries(record).find(\n ([k]) => k.toLowerCase() === normalizedKey,\n );\n\n return entry?.[1];\n}\n\n/**\n * Get the fiat asset for a specific transaction type.\n *\n * Resolution order:\n * 1. Feature flag override (`confirmations_pay_fiat.assetPerTransactionType`)\n * 2. Hardcoded constant (`FIAT_ASSET_ID_BY_TX_TYPE`)\n * 3. ETH mainnet fallback\n *\n * @param messenger - Controller messenger.\n * @param transactionType - Transaction type to look up.\n * @returns The fiat asset for the given transaction type.\n */\nexport function getFiatAssetPerTransactionType(\n messenger: TransactionPayControllerMessenger,\n transactionType?: TransactionType,\n): TransactionPayFiatAsset {\n if (!transactionType) {\n return ETH_MAINNET_FIAT_ASSET;\n }\n\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat as\n | FiatFlags\n | undefined;\n\n return (\n fiatFlags?.assetPerTransactionType?.[transactionType] ??\n FIAT_ASSET_ID_BY_TX_TYPE[transactionType] ??\n ETH_MAINNET_FIAT_ASSET\n );\n}\n\nconst DEFAULT_FEE_RESERVE_MULTIPLIER = 1;\nconst DEFAULT_MAX_RATE_DRIFT_PERCENT = 10;\n\n/**\n * Returns the fee reserve multiplier for fiat three-phase submit.\n *\n * Controls how much of the original relay fee is reserved from the discovery\n * quote source amount to prevent EXACT_OUTPUT cost overruns.\n * Defaults to 1 (100% of the original fee).\n *\n * @param messenger - Controller messenger.\n * @returns The fee reserve multiplier.\n */\nexport function getFiatFeeReserveMultiplier(\n messenger: TransactionPayControllerMessenger,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat as\n | FiatFlags\n | undefined;\n\n const multiplier = fiatFlags?.feeReserveMultiplier;\n\n return typeof multiplier === 'number' && multiplier > 0\n ? multiplier\n : DEFAULT_FEE_RESERVE_MULTIPLIER;\n}\n\n/**\n * Returns the maximum allowed relay rate drift percentage for fiat submit.\n *\n * Controls how much the relay exchange rate can drift between the original\n * quoting phase and the post-settlement discovery quote before failing.\n * Defaults to 10%.\n *\n * @param messenger - Controller messenger.\n * @returns The maximum rate drift percentage.\n */\nexport function getFiatMaxRateDriftPercent(\n messenger: TransactionPayControllerMessenger,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat as\n | FiatFlags\n | undefined;\n\n const maxDrift = fiatFlags?.maxRateDriftPercent;\n\n return typeof maxDrift === 'number' && maxDrift > 0\n ? maxDrift\n : DEFAULT_MAX_RATE_DRIFT_PERCENT;\n}\n\n/**\n * Checks if a chain supports EIP-7702.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to check.\n * @returns Whether the chain supports EIP-7702.\n */\nexport function isEIP7702Chain(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const eip7702Flags = state.remoteFeatureFlags.confirmations_eip_7702 as\n | { supportedChains?: Hex[] }\n | undefined;\n\n const supportedChains = eip7702Flags?.supportedChains ?? [];\n\n return supportedChains.some(\n (supported) => supported.toLowerCase() === chainId.toLowerCase(),\n );\n}\n"]}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AsC,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,CAAC,sBAEjC,CAAC;IAEd,MAAM,eAAe,GAAG,YAAY,EAAE,eAAe,IAAI,EAAE,CAAC;IAE5D,OAAO,eAAe,CAAC,IAAI,CACzB,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,WAAW,EAAE,CACjE,CAAC;AACJ,CAAC;AAdD,wCAcC","sourcesContent":["import type { TransactionType } from '@metamask/transaction-controller';\nimport type { Hex } from '@metamask/utils';\nimport { createModuleLogger } from '@metamask/utils';\nimport { uniq } from 'lodash';\n\nimport { isTransactionPayStrategy, TransactionPayStrategy } from '../constants';\nimport { projectLogger } from '../logger';\nimport type { TransactionPayFiatAsset } from '../strategy/fiat/constants';\nimport {\n ETH_MAINNET_FIAT_ASSET,\n FIAT_ASSET_ID_BY_TX_TYPE,\n} from '../strategy/fiat/constants';\nimport {\n RELAY_EXECUTE_URL,\n RELAY_POLLING_INTERVAL,\n RELAY_QUOTE_URL,\n} from '../strategy/relay/constants';\nimport {\n SERVER_POLLING_INTERVAL,\n SERVER_URL_BASE,\n} from '../strategy/server/constants';\nimport type { TransactionPayControllerMessenger } from '../types';\n\nconst log = createModuleLogger(projectLogger, 'feature-flags');\n\ntype StrategyOrder = TransactionPayStrategy[];\n\nexport const DEFAULT_GAS_BUFFER = 1.0;\nexport const DEFAULT_FALLBACK_GAS_ESTIMATE = 900000;\nexport const DEFAULT_FALLBACK_GAS_MAX = 1500000;\nexport const DEFAULT_RELAY_EXECUTE_URL = RELAY_EXECUTE_URL;\nexport const DEFAULT_RELAY_QUOTE_URL = RELAY_QUOTE_URL;\nexport const DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD = '300000';\nexport const DEFAULT_SLIPPAGE = 0.005;\nexport const DEFAULT_ACROSS_API_BASE = 'https://app.across.to/api';\nexport const DEFAULT_SERVER_BASE_URL = SERVER_URL_BASE;\nexport const DEFAULT_STRATEGY_ORDER: StrategyOrder = [\n TransactionPayStrategy.Server,\n TransactionPayStrategy.Relay,\n TransactionPayStrategy.Across,\n];\n\ntype FeatureFlagsRaw = {\n gasBuffer?: {\n default?: number;\n perChainConfig?: Record<\n Hex,\n {\n name?: string;\n buffer?: number;\n }\n >;\n };\n relayDisabledGasStationChains?: Hex[];\n relayExecuteUrl?: string;\n relayFallbackGas?: {\n estimate?: number;\n max?: number;\n };\n relayQuoteUrl?: string;\n slippage?: number;\n slippageTokens?: Record<Hex, Record<Hex, number>>;\n strategyOrder?: string[];\n strategyOverrides?: StrategyOverridesRaw;\n payStrategies?: PayStrategiesConfigRaw;\n};\n\ntype StrategyOverrideRaw = {\n default?: unknown;\n chains?: Record<string, unknown>;\n tokens?: Record<string, Record<string, unknown>>;\n};\n\ntype StrategyOverridesRaw = {\n default?: StrategyOverrideRaw;\n transactionTypes?: Record<string, StrategyOverrideRaw>;\n};\n\ntype StrategyOverride = {\n chains: Record<Hex, TransactionPayStrategy[]>;\n default?: TransactionPayStrategy[];\n tokens: Record<Hex, Record<Hex, TransactionPayStrategy[]>>;\n};\n\ntype StrategyOverrides = {\n default?: StrategyOverride;\n transactionTypes: Record<string, StrategyOverride>;\n};\n\ntype FiatFlags = {\n assetPerTransactionType?: Partial<\n Record<TransactionType, TransactionPayFiatAsset>\n >;\n};\n\ntype StrategyRoutingConfig = {\n payStrategies: {\n across: {\n enabled: boolean;\n };\n server: {\n enabled: boolean;\n };\n relay: {\n enabled: boolean;\n };\n };\n strategyOverrides: StrategyOverrides;\n strategyOrder: TransactionPayStrategy[];\n};\n\nexport type FeatureFlags = {\n relayDisabledGasStationChains: Hex[];\n relayExecuteUrl: string;\n relayFallbackGas: {\n estimate: number;\n max: number;\n };\n relayQuoteUrl: string;\n slippage: number;\n};\n\nexport type AcrossConfigRaw = {\n apiBase?: string;\n enabled?: boolean;\n fallbackGas?: {\n estimate?: number;\n max?: number;\n };\n};\n\nexport type AcrossConfig = {\n apiBase: string;\n enabled: boolean;\n fallbackGas: {\n estimate: number;\n max: number;\n };\n};\n\nexport type PayStrategiesConfigRaw = {\n across?: AcrossConfigRaw;\n relay?: {\n enabled?: boolean;\n originGasOverhead?: string;\n pollingInterval?: number;\n pollingTimeout?: number;\n };\n};\n\ntype FeatureFlagsExtendedRaw = {\n excludeChainIdsFromInfura?: Hex[];\n payStrategies?: {\n relay?: {\n gaslessEnabled?: boolean;\n };\n server?: {\n enabled?: boolean;\n baseUrl?: string;\n pollingInterval?: number;\n pollingTimeout?: number;\n };\n };\n};\n\nexport type PayStrategiesConfig = {\n across: AcrossConfig;\n server: {\n enabled: boolean;\n baseUrl: string;\n pollingInterval: number;\n pollingTimeout?: number;\n };\n relay: {\n enabled: boolean;\n };\n};\n\nfunction normalizeHex(value: string | undefined): Hex | undefined {\n return value?.toLowerCase() as Hex | undefined;\n}\n\nfunction normalizeStrategy(\n strategy: unknown,\n): TransactionPayStrategy | undefined {\n if (typeof strategy !== 'string') {\n return undefined;\n }\n\n const normalizedStrategy = strategy.toLowerCase() as TransactionPayStrategy;\n\n return isTransactionPayStrategy(normalizedStrategy)\n ? normalizedStrategy\n : undefined;\n}\n\nfunction normalizeStrategyList(strategies: unknown): TransactionPayStrategy[] {\n if (!Array.isArray(strategies)) {\n return [];\n }\n\n return uniq(\n strategies\n .map((strategy) => normalizeStrategy(strategy))\n .filter(\n (strategy): strategy is TransactionPayStrategy =>\n strategy !== undefined,\n ),\n );\n}\n\nfunction normalizeStrategyOverride(\n override: StrategyOverrideRaw | undefined,\n): StrategyOverride {\n const chains = Object.entries(override?.chains ?? {}).reduce<\n Record<Hex, TransactionPayStrategy[]>\n >((result, [chainId, strategies]) => {\n const normalizedStrategies = normalizeStrategyList(strategies);\n\n if (normalizedStrategies.length) {\n result[normalizeHex(chainId) as Hex] = normalizedStrategies;\n }\n\n return result;\n }, {});\n\n const tokens = Object.entries(override?.tokens ?? {}).reduce<\n Record<Hex, Record<Hex, TransactionPayStrategy[]>>\n >((result, [chainId, tokenOverrides]) => {\n const normalizedTokenOverrides = Object.entries(\n tokenOverrides ?? {},\n ).reduce<Record<Hex, TransactionPayStrategy[]>>(\n (tokenResult, [tokenAddress, strategies]) => {\n const normalizedStrategies = normalizeStrategyList(strategies);\n\n if (normalizedStrategies.length) {\n tokenResult[normalizeHex(tokenAddress) as Hex] = normalizedStrategies;\n }\n\n return tokenResult;\n },\n {},\n );\n\n if (Object.keys(normalizedTokenOverrides).length) {\n result[normalizeHex(chainId) as Hex] = normalizedTokenOverrides;\n }\n\n return result;\n }, {});\n\n const defaultStrategies = normalizeStrategyList(override?.default);\n\n return {\n chains,\n default: defaultStrategies.length ? defaultStrategies : undefined,\n tokens,\n };\n}\n\nfunction normalizeStrategyRoutingConfig(\n featureFlags: FeatureFlagsRaw,\n extendedFeatureFlags: FeatureFlagsExtendedRaw,\n): StrategyRoutingConfig {\n const strategyOrder = normalizeStrategyList(featureFlags.strategyOrder);\n\n return {\n payStrategies: {\n across: {\n enabled: featureFlags.payStrategies?.across?.enabled ?? false,\n },\n server: {\n enabled: extendedFeatureFlags.payStrategies?.server?.enabled ?? false,\n },\n relay: {\n enabled: featureFlags.payStrategies?.relay?.enabled ?? true,\n },\n },\n strategyOverrides: {\n default: featureFlags.strategyOverrides?.default\n ? normalizeStrategyOverride(featureFlags.strategyOverrides.default)\n : undefined,\n transactionTypes: Object.entries(\n featureFlags.strategyOverrides?.transactionTypes ?? {},\n ).reduce<Record<string, StrategyOverride>>((result, [type, override]) => {\n result[type] = normalizeStrategyOverride(override);\n return result;\n }, {}),\n },\n strategyOrder:\n strategyOrder.length > 0 ? strategyOrder : [...DEFAULT_STRATEGY_ORDER],\n };\n}\n\nfunction getStrategyRoutingConfig(\n messenger: TransactionPayControllerMessenger,\n): StrategyRoutingConfig {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags = state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined;\n const extendedFeatureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n\n return normalizeStrategyRoutingConfig(\n featureFlags ?? {},\n extendedFeatureFlags,\n );\n}\n\nfunction filterEnabledStrategies(\n strategies: readonly TransactionPayStrategy[],\n routingConfig: StrategyRoutingConfig,\n): TransactionPayStrategy[] {\n return strategies.filter((strategy) => {\n if (strategy === TransactionPayStrategy.Across) {\n return routingConfig.payStrategies.across.enabled;\n }\n\n if (strategy === TransactionPayStrategy.Relay) {\n return routingConfig.payStrategies.relay.enabled;\n }\n\n if (strategy === TransactionPayStrategy.Server) {\n return routingConfig.payStrategies.server.enabled;\n }\n\n return true;\n });\n}\n\nfunction getTokenOverrideStrategies(\n override: StrategyOverride | undefined,\n normalizedChainId: Hex | undefined,\n normalizedTokenAddress: Hex | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n if (!override || !normalizedChainId || !normalizedTokenAddress) {\n return undefined;\n }\n\n return override.tokens[normalizedChainId]?.[normalizedTokenAddress];\n}\n\nfunction getChainOverrideStrategies(\n override: StrategyOverride | undefined,\n normalizedChainId: Hex | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n if (!override || !normalizedChainId) {\n return undefined;\n }\n\n return override.chains[normalizedChainId];\n}\n\nfunction getDefaultOverrideStrategies(\n override: StrategyOverride | undefined,\n): readonly TransactionPayStrategy[] | undefined {\n return override?.default;\n}\n\n/**\n * Get ordered list of strategies to try for a route.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Optional chain ID used to match route overrides.\n * @param tokenAddress - Optional token address used to match route overrides.\n * @param transactionType - Optional transaction type used to match route\n * overrides.\n * @param fiatPaymentMethodId - Optional fiat payment method ID used to match route overrides.\n * @returns Ordered strategy list.\n */\nexport function getStrategyOrder(\n messenger: TransactionPayControllerMessenger,\n chainId?: Hex,\n tokenAddress?: Hex,\n transactionType?: string,\n fiatPaymentMethodId?: string,\n): StrategyOrder {\n // If fiat payment method is selected, use Fiat strategy only\n if (fiatPaymentMethodId) {\n return [TransactionPayStrategy.Fiat];\n }\n\n const routingConfig = getStrategyRoutingConfig(messenger);\n const normalizedChainId = normalizeHex(chainId);\n const normalizedTokenAddress = normalizeHex(tokenAddress);\n const transactionTypeOverride = transactionType\n ? routingConfig.strategyOverrides.transactionTypes[transactionType]\n : undefined;\n\n const candidates: (readonly TransactionPayStrategy[] | undefined)[] = [\n getTokenOverrideStrategies(\n transactionTypeOverride,\n normalizedChainId,\n normalizedTokenAddress,\n ),\n getChainOverrideStrategies(transactionTypeOverride, normalizedChainId),\n getTokenOverrideStrategies(\n routingConfig.strategyOverrides.default,\n normalizedChainId,\n normalizedTokenAddress,\n ),\n getChainOverrideStrategies(\n routingConfig.strategyOverrides.default,\n normalizedChainId,\n ),\n getDefaultOverrideStrategies(transactionTypeOverride),\n getDefaultOverrideStrategies(routingConfig.strategyOverrides.default),\n ];\n\n // Overrides are authoritative. Once a route matches a specific override\n // scope, disabled strategies do not inherit candidates from lower-precedence\n // scopes.\n for (const strategies of candidates) {\n if (strategies) {\n return filterEnabledStrategies(strategies, routingConfig);\n }\n }\n\n return filterEnabledStrategies(routingConfig.strategyOrder, routingConfig);\n}\n\n/**\n * Get the preferred strategy for a route.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Optional chain ID used to match route overrides.\n * @param tokenAddress - Optional token address used to match route overrides.\n * @param transactionType - Optional transaction type used to match route\n * overrides.\n * @returns The preferred strategy, if any.\n */\nexport function getStrategy(\n messenger: TransactionPayControllerMessenger,\n chainId?: Hex,\n tokenAddress?: Hex,\n transactionType?: string,\n): TransactionPayStrategy | undefined {\n return getStrategyOrder(messenger, chainId, tokenAddress, transactionType)[0];\n}\n\n/**\n * Get feature flags related to the controller.\n *\n * @param messenger - Controller messenger.\n * @returns Feature flags.\n */\nexport function getFeatureFlags(\n messenger: TransactionPayControllerMessenger,\n): FeatureFlags {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n\n const estimate =\n featureFlags.relayFallbackGas?.estimate ?? DEFAULT_FALLBACK_GAS_ESTIMATE;\n\n const max = featureFlags.relayFallbackGas?.max ?? DEFAULT_FALLBACK_GAS_MAX;\n\n const relayExecuteUrl =\n featureFlags.relayExecuteUrl ?? DEFAULT_RELAY_EXECUTE_URL;\n\n const relayQuoteUrl = featureFlags.relayQuoteUrl ?? DEFAULT_RELAY_QUOTE_URL;\n\n const relayDisabledGasStationChains =\n featureFlags.relayDisabledGasStationChains ?? [];\n\n const slippage = featureFlags.slippage ?? DEFAULT_SLIPPAGE;\n\n const result: FeatureFlags = {\n relayDisabledGasStationChains,\n relayExecuteUrl,\n relayFallbackGas: {\n estimate,\n max,\n },\n relayQuoteUrl,\n slippage,\n };\n\n log('Feature flags:', { raw: featureFlags, result });\n\n return result;\n}\n\n/**\n * Get Pay Strategies configuration.\n *\n * @param messenger - Controller messenger.\n * @returns Pay Strategies configuration.\n */\nexport function getPayStrategiesConfig(\n messenger: TransactionPayControllerMessenger,\n): PayStrategiesConfig {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n const extendedFeatureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n const payStrategies = featureFlags.payStrategies ?? {};\n const extendedPayStrategies = extendedFeatureFlags.payStrategies ?? {};\n\n const acrossRaw = payStrategies.across ?? {};\n const serverRaw = extendedPayStrategies.server ?? {};\n const relayRaw = payStrategies.relay ?? {};\n\n const across = {\n apiBase: acrossRaw.apiBase ?? DEFAULT_ACROSS_API_BASE,\n enabled: acrossRaw.enabled ?? false,\n fallbackGas: {\n estimate:\n acrossRaw.fallbackGas?.estimate ?? DEFAULT_FALLBACK_GAS_ESTIMATE,\n max: acrossRaw.fallbackGas?.max ?? DEFAULT_FALLBACK_GAS_MAX,\n },\n };\n\n const server = {\n enabled: serverRaw.enabled ?? false,\n baseUrl: serverRaw.baseUrl ?? DEFAULT_SERVER_BASE_URL,\n pollingInterval: serverRaw.pollingInterval ?? SERVER_POLLING_INTERVAL,\n pollingTimeout: serverRaw.pollingTimeout,\n };\n\n const relay = {\n enabled: relayRaw.enabled ?? true,\n };\n\n return {\n across,\n server,\n relay,\n };\n}\n\n/**\n * Whether the Relay /execute gasless flow is enabled.\n *\n * @param messenger - Controller messenger.\n * @returns True if the execute flow is enabled.\n */\nexport function isRelayExecuteEnabled(\n messenger: TransactionPayControllerMessenger,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n return featureFlags.payStrategies?.relay?.gaslessEnabled ?? false;\n}\n\n/**\n * Whether a chain is excluded from preferring Infura for balance queries.\n *\n * When a chain ID appears in the `confirmations_pay_extended.excludeChainIdsFromInfura`\n * feature flag array, the Infura RPC endpoint should not be forced for that chain.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to check.\n * @returns True if the chain should skip the Infura preference.\n */\nexport function isChainExcludedFromInfura(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay_extended as\n | FeatureFlagsExtendedRaw\n | undefined) ?? {};\n\n const excludedChains = featureFlags.excludeChainIdsFromInfura ?? [];\n\n return excludedChains.some(\n (excluded) => excluded.toLowerCase() === chainId.toLowerCase(),\n );\n}\n\n/**\n * Get the origin gas overhead to include in Relay quote requests\n * for EIP-7702 chains.\n *\n * @param messenger - Controller messenger.\n * @returns Origin gas overhead as a decimal string.\n */\nexport function getRelayOriginGasOverhead(\n messenger: TransactionPayControllerMessenger,\n): string {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return (\n featureFlags.payStrategies?.relay?.originGasOverhead ??\n DEFAULT_RELAY_ORIGIN_GAS_OVERHEAD\n );\n}\n\n/**\n * Get the relay status polling interval in milliseconds.\n * Falls back to the constant default when not configured.\n *\n * @param messenger - Controller messenger.\n * @returns Polling interval in milliseconds.\n */\nexport function getRelayPollingInterval(\n messenger: TransactionPayControllerMessenger,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return (\n featureFlags.payStrategies?.relay?.pollingInterval ?? RELAY_POLLING_INTERVAL\n );\n}\n\n/**\n * Get the relay status polling timeout in milliseconds.\n * Returns 0 or undefined to indicate no timeout.\n *\n * @param messenger - Controller messenger.\n * @returns Polling timeout in milliseconds, or undefined when not configured.\n */\nexport function getRelayPollingTimeout(\n messenger: TransactionPayControllerMessenger,\n): number | undefined {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n return featureFlags.payStrategies?.relay?.pollingTimeout;\n}\n\n/**\n * Get the server strategy status polling interval in milliseconds.\n *\n * @param messenger - Controller messenger.\n * @returns Polling interval in milliseconds.\n */\nexport function getServerPollingInterval(\n messenger: TransactionPayControllerMessenger,\n): number {\n return getPayStrategiesConfig(messenger).server.pollingInterval;\n}\n\n/**\n * Get the server strategy status polling timeout in milliseconds.\n *\n * @param messenger - Controller messenger.\n * @returns Polling timeout in milliseconds, or undefined when not configured.\n */\nexport function getServerPollingTimeout(\n messenger: TransactionPayControllerMessenger,\n): number | undefined {\n return getPayStrategiesConfig(messenger).server.pollingTimeout;\n}\n\n/**\n * Get fallback gas limits for quote/submit flows.\n *\n * @param messenger - Controller messenger.\n * @returns Fallback gas limits.\n */\nexport function getFallbackGas(\n messenger: TransactionPayControllerMessenger,\n): FeatureFlags['relayFallbackGas'] {\n return getFeatureFlags(messenger).relayFallbackGas;\n}\n\n/**\n * Get the gas buffer value for a specific chain ID.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to get gas buffer for.\n * @returns Gas buffer value.\n */\nexport function getGasBuffer(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n\n return (\n featureFlags.gasBuffer?.perChainConfig?.[chainId]?.buffer ??\n featureFlags.gasBuffer?.default ??\n DEFAULT_GAS_BUFFER\n );\n}\n\n/**\n * Get the slippage value for a specific chain ID and token address.\n * Falls back to the general slippage feature flag, then the static default.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to get slippage for.\n * @param tokenAddress - Token address to get slippage for.\n * @returns Slippage value as a decimal (e.g., 0.005 for 0.5%).\n */\nexport function getSlippage(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n tokenAddress: Hex,\n): number {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const featureFlags =\n (state.remoteFeatureFlags?.confirmations_pay as\n | FeatureFlagsRaw\n | undefined) ?? {};\n const { slippageTokens } = featureFlags;\n\n const tokenMap = getCaseInsensitive(slippageTokens, chainId);\n const tokenSlippage = getCaseInsensitive(tokenMap, tokenAddress);\n\n if (tokenSlippage !== undefined) {\n log('Using token-specific slippage', {\n chainId,\n tokenAddress,\n slippage: tokenSlippage,\n });\n return tokenSlippage;\n }\n\n const slippage = featureFlags.slippage ?? DEFAULT_SLIPPAGE;\n log('Using default slippage', { chainId, tokenAddress, slippage });\n return slippage;\n}\n\n/**\n * Get the AssetsUnifyState feature flag state.\n *\n * @param messenger - Controller messenger.\n * @returns True if the assets unify state feature is enabled, false otherwise.\n */\nexport function getAssetsUnifyStateFeature(\n messenger: TransactionPayControllerMessenger,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const assetsUnifyState = state.remoteFeatureFlags.assetsUnifyState as\n | {\n enabled: boolean;\n featureVersion: string | null;\n }\n | undefined;\n\n const AssetsUnifyStateFeatureVersion = '1';\n\n return (\n Boolean(assetsUnifyState?.enabled) &&\n assetsUnifyState?.featureVersion === AssetsUnifyStateFeatureVersion\n );\n}\n\n/**\n * Get a value from a record using a case-insensitive key lookup.\n *\n * @param record - The record to search.\n * @param key - The key to look up (case-insensitive).\n * @returns The value if found, undefined otherwise.\n */\nfunction getCaseInsensitive<Value>(\n record: Record<string, Value> | undefined,\n key: string,\n): Value | undefined {\n if (!record) {\n return undefined;\n }\n\n const normalizedKey = key.toLowerCase();\n const entry = Object.entries(record).find(\n ([k]) => k.toLowerCase() === normalizedKey,\n );\n\n return entry?.[1];\n}\n\n/**\n * Get the fiat asset for a specific transaction type.\n *\n * Resolution order:\n * 1. Feature flag override (`confirmations_pay_fiat.assetPerTransactionType`)\n * 2. Hardcoded constant (`FIAT_ASSET_ID_BY_TX_TYPE`)\n * 3. ETH mainnet fallback\n *\n * @param messenger - Controller messenger.\n * @param transactionType - Transaction type to look up.\n * @returns The fiat asset for the given transaction type.\n */\nexport function getFiatAssetPerTransactionType(\n messenger: TransactionPayControllerMessenger,\n transactionType?: TransactionType,\n): TransactionPayFiatAsset {\n if (!transactionType) {\n return ETH_MAINNET_FIAT_ASSET;\n }\n\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat as\n | FiatFlags\n | undefined;\n\n return (\n fiatFlags?.assetPerTransactionType?.[transactionType] ??\n FIAT_ASSET_ID_BY_TX_TYPE[transactionType] ??\n ETH_MAINNET_FIAT_ASSET\n );\n}\n\n/**\n * Checks if a chain supports EIP-7702.\n *\n * @param messenger - Controller messenger.\n * @param chainId - Chain ID to check.\n * @returns Whether the chain supports EIP-7702.\n */\nexport function isEIP7702Chain(\n messenger: TransactionPayControllerMessenger,\n chainId: Hex,\n): boolean {\n const state = messenger.call('RemoteFeatureFlagController:getState');\n const eip7702Flags = state.remoteFeatureFlags.confirmations_eip_7702 as\n | { supportedChains?: Hex[] }\n | undefined;\n\n const supportedChains = eip7702Flags?.supportedChains ?? [];\n\n return supportedChains.some(\n (supported) => supported.toLowerCase() === chainId.toLowerCase(),\n );\n}\n"]}
@@ -199,28 +199,6 @@ export declare function getAssetsUnifyStateFeature(messenger: TransactionPayCont
199
199
  * @returns The fiat asset for the given transaction type.
200
200
  */
201
201
  export declare function getFiatAssetPerTransactionType(messenger: TransactionPayControllerMessenger, transactionType?: TransactionType): TransactionPayFiatAsset;
202
- /**
203
- * Returns the fee reserve multiplier for fiat three-phase submit.
204
- *
205
- * Controls how much of the original relay fee is reserved from the discovery
206
- * quote source amount to prevent EXACT_OUTPUT cost overruns.
207
- * Defaults to 1 (100% of the original fee).
208
- *
209
- * @param messenger - Controller messenger.
210
- * @returns The fee reserve multiplier.
211
- */
212
- export declare function getFiatFeeReserveMultiplier(messenger: TransactionPayControllerMessenger): number;
213
- /**
214
- * Returns the maximum allowed relay rate drift percentage for fiat submit.
215
- *
216
- * Controls how much the relay exchange rate can drift between the original
217
- * quoting phase and the post-settlement discovery quote before failing.
218
- * Defaults to 10%.
219
- *
220
- * @param messenger - Controller messenger.
221
- * @returns The maximum rate drift percentage.
222
- */
223
- export declare function getFiatMaxRateDriftPercent(messenger: TransactionPayControllerMessenger): number;
224
202
  /**
225
203
  * Checks if a chain supports EIP-7702.
226
204
  *
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.cts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,EAA4B,sBAAsB,EAAE,yBAAqB;AAEhF,OAAO,KAAK,EAAE,uBAAuB,EAAE,uCAAmC;AAc1E,OAAO,KAAK,EAA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;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,iCAAiC,EAC5C,eAAe,CAAC,EAAE,eAAe,GAChC,uBAAuB,CAezB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,iCAAiC,EAC5C,OAAO,EAAE,GAAG,GACX,OAAO,CAWT"}
@@ -199,28 +199,6 @@ export declare function getAssetsUnifyStateFeature(messenger: TransactionPayCont
199
199
  * @returns The fiat asset for the given transaction type.
200
200
  */
201
201
  export declare function getFiatAssetPerTransactionType(messenger: TransactionPayControllerMessenger, transactionType?: TransactionType): TransactionPayFiatAsset;
202
- /**
203
- * Returns the fee reserve multiplier for fiat three-phase submit.
204
- *
205
- * Controls how much of the original relay fee is reserved from the discovery
206
- * quote source amount to prevent EXACT_OUTPUT cost overruns.
207
- * Defaults to 1 (100% of the original fee).
208
- *
209
- * @param messenger - Controller messenger.
210
- * @returns The fee reserve multiplier.
211
- */
212
- export declare function getFiatFeeReserveMultiplier(messenger: TransactionPayControllerMessenger): number;
213
- /**
214
- * Returns the maximum allowed relay rate drift percentage for fiat submit.
215
- *
216
- * Controls how much the relay exchange rate can drift between the original
217
- * quoting phase and the post-settlement discovery quote before failing.
218
- * Defaults to 10%.
219
- *
220
- * @param messenger - Controller messenger.
221
- * @returns The maximum rate drift percentage.
222
- */
223
- export declare function getFiatMaxRateDriftPercent(messenger: TransactionPayControllerMessenger): number;
224
202
  /**
225
203
  * Checks if a chain supports EIP-7702.
226
204
  *
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.mts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAI3C,OAAO,EAA4B,sBAAsB,EAAE,yBAAqB;AAEhF,OAAO,KAAK,EAAE,uBAAuB,EAAE,uCAAmC;AAc1E,OAAO,KAAK,EAAE,i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GAWG;AACH,wBAAgB,8BAA8B,CAC5C,SAAS,EAAE,iCAAiC,EAC5C,eAAe,CAAC,EAAE,eAAe,GAChC,uBAAuB,CAezB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,iCAAiC,EAC5C,OAAO,EAAE,GAAG,GACX,OAAO,CAWT"}
@@ -431,44 +431,6 @@ export function getFiatAssetPerTransactionType(messenger, transactionType) {
431
431
  FIAT_ASSET_ID_BY_TX_TYPE[transactionType] ??
432
432
  ETH_MAINNET_FIAT_ASSET);
433
433
  }
434
- const DEFAULT_FEE_RESERVE_MULTIPLIER = 1;
435
- const DEFAULT_MAX_RATE_DRIFT_PERCENT = 10;
436
- /**
437
- * Returns the fee reserve multiplier for fiat three-phase submit.
438
- *
439
- * Controls how much of the original relay fee is reserved from the discovery
440
- * quote source amount to prevent EXACT_OUTPUT cost overruns.
441
- * Defaults to 1 (100% of the original fee).
442
- *
443
- * @param messenger - Controller messenger.
444
- * @returns The fee reserve multiplier.
445
- */
446
- export function getFiatFeeReserveMultiplier(messenger) {
447
- const state = messenger.call('RemoteFeatureFlagController:getState');
448
- const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat;
449
- const multiplier = fiatFlags?.feeReserveMultiplier;
450
- return typeof multiplier === 'number' && multiplier > 0
451
- ? multiplier
452
- : DEFAULT_FEE_RESERVE_MULTIPLIER;
453
- }
454
- /**
455
- * Returns the maximum allowed relay rate drift percentage for fiat submit.
456
- *
457
- * Controls how much the relay exchange rate can drift between the original
458
- * quoting phase and the post-settlement discovery quote before failing.
459
- * Defaults to 10%.
460
- *
461
- * @param messenger - Controller messenger.
462
- * @returns The maximum rate drift percentage.
463
- */
464
- export function getFiatMaxRateDriftPercent(messenger) {
465
- const state = messenger.call('RemoteFeatureFlagController:getState');
466
- const fiatFlags = state.remoteFeatureFlags?.confirmations_pay_fiat;
467
- const maxDrift = fiatFlags?.maxRateDriftPercent;
468
- return typeof maxDrift === 'number' && maxDrift > 0
469
- ? maxDrift
470
- : DEFAULT_MAX_RATE_DRIFT_PERCENT;
471
- }
472
434
  /**
473
435
  * Checks if a chain supports EIP-7702.
474
436
  *