@metamask-previews/transaction-pay-controller 30.4.1-preview-dd61a447a → 30.4.3-preview-46de95678

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,13 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [30.4.3]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/assets-controller` from `^20.2.1` to `^20.2.2` ([#11300](https://github.com/MetaMask/core/pull/11300))
15
+ - Bump `@metamask/transaction-controller` from `^73.1.0` to `^73.1.1` ([#11300](https://github.com/MetaMask/core/pull/11300))
16
+
17
+ ### Fixed
18
+
19
+ - Re-derive source amounts, using the `getBalance` callback if provided, before each periodic requote ([#10911](https://github.com/MetaMask/core/pull/10911))
20
+ - Requote max-amount transactions using a per-transaction-type interval from the `maxBalanceRefreshInterval` feature flag ([#10911](https://github.com/MetaMask/core/pull/10911))
21
+
22
+ ## [30.4.2]
23
+
10
24
  ### Changed
11
25
 
12
- - Bump `@metamask/assets-controller` from `^20.2.0` to `^20.2.1` ([#11285](https://github.com/MetaMask/core/pull/11285))
13
26
  - Treat an unreadable live payment token balance as unknown rather than insufficient, so a failing RPC no longer blocks the transaction ([#11284](https://github.com/MetaMask/core/pull/11284))
14
27
  - The live balance check is a fast-fail optimisation; when the RPC request fails the check is now skipped, and quote simulation plus on-chain execution still reject a genuinely underfunded transaction.
15
28
  - Affects quote validation (`Unable to verify balance`) and both the Relay and server submit paths (`Cannot validate payment token balance`).
16
29
  - The `balance-unavailable` `QuoteErrorReason` is no longer emitted and is deprecated. It is kept in the union so existing consumers and historical analytics still type-check.
30
+ - Bump `@metamask/assets-controller` from `^20.2.0` to `^20.2.1` ([#11285](https://github.com/MetaMask/core/pull/11285))
31
+ - Bump `@metamask/gas-fee-controller` from `^27.0.0` to `^27.1.0` ([#11289](https://github.com/MetaMask/core/pull/11289))
32
+ - Bump `@metamask/transaction-controller` from `^73.0.0` to `^73.1.0` ([#11289](https://github.com/MetaMask/core/pull/11289))
17
33
 
18
34
  ### Fixed
19
35
 
@@ -1811,7 +1827,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1811
1827
 
1812
1828
  - Initial release ([#6820](https://github.com/MetaMask/core/pull/6820))
1813
1829
 
1814
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.4.1...HEAD
1830
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.4.3...HEAD
1831
+ [30.4.3]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.4.2...@metamask/transaction-pay-controller@30.4.3
1832
+ [30.4.2]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.4.1...@metamask/transaction-pay-controller@30.4.2
1815
1833
  [30.4.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.4.0...@metamask/transaction-pay-controller@30.4.1
1816
1834
  [30.4.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.3.3...@metamask/transaction-pay-controller@30.4.0
1817
1835
  [30.3.3]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@30.3.2...@metamask/transaction-pay-controller@30.3.3
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionPayController.d.ts","sourceRoot":"","sources":["../src/TransactionPayController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAMxE,OAAO,EACL,eAAe,EAEf,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EACV,qBAAqB,EAErB,gCAAgC,EAChC,8BAA8B,EAC9B,mBAAmB,EAEnB,yBA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AG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,CAAC,GAClE,UAAU,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,CAAC,CAE5D;IAED;;;;;;OAMG;IACH,kCAAkC,CAChC,GAAG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,GACnE,UAAU,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,CAE7D;CAiJF"}
1
+ {"version":3,"file":"TransactionPayController.d.ts","sourceRoot":"","sources":["../src/TransactionPayController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAMxE,OAAO,EACL,eAAe,EAEf,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAE7D,OAAO,KAAK,EACV,qBAAqB,EAErB,gCAAgC,EAChC,8BAA8B,EAC9B,mBAAmB,EAEnB,yBAAyB,EAEzB,iCAAiC,EACjC,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,EAC7B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAoCpB,qBAAa,wBAAyB,SAAQ,cAAc,CAC1D,OAAO,eAAe,EACtB,6BAA6B,EAC7B,iCAAiC,CAClC;;IAuBC,YAAY,EACV,QAAQ,EACR,WAAW,EACX,aAAa,EACb,UAAU,EACV,wBAAwB,EACxB,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,SAAS,EACT,UAAU,EACV,KAAK,GACN,EAAE,+BAA+B,EA0CjC;IAED;;;;;;;;OAQG;IACH,oBAAoB,CAClB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,yBAAyB,GAClC,IAAI,CA2BN;IAED;;;;;;;;;OASG;IACH,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAK3D;IAED;;;;;;;;;OASG;IACH,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,IAAI,CAKzD;IAED;;;;;;;;OAQG;IACH,WAAW,IAAI,sBAAsB,GAAG,SAAS,CAEhD;IAED;;;;;;;;;;;OAWG;IACH,wBAAwB,CACtB,GAAG,IAAI,EAAE,UAAU,CAAC,gCAAgC,CAAC,GACpD,UAAU,CAAC,gCAAgC,CAAC,CAE9C;IAED;;;;;;;;;OASG;IACH,aAAa,CACX,GAAG,IAAI,EAAE,UAAU,CAAC,qBAAqB,CAAC,GACzC,UAAU,CAAC,qBAAqB,CAAC,CAEnC;IAED;;;;;;OAMG;IACH,cAAc,IAAI,yBAAyB,GAAG,SAAS,CAEtD;IAED,sBAAsB,CACpB,GAAG,IAAI,EAAE,UAAU,CAAC,8BAA8B,CAAC,GAClD,UAAU,CAAC,8BAA8B,CAAC,CAI5C;IAED;;;;;;;;;OASG;IACH,WAAW,CAAC,WAAW,EAAE,eAAe,GAAG,sBAAsB,CAEhE;IAED;;;;;;OAMG;IACH,iCAAiC,CAC/B,GAAG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,CAAC,GAClE,UAAU,CAAC,mBAAmB,CAAC,yBAAyB,CAAC,CAAC,CAE5D;IAED;;;;;;OAMG;IACH,kCAAkC,CAChC,GAAG,IAAI,EAAE,UAAU,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,GACnE,UAAU,CAAC,mBAAmB,CAAC,0BAA0B,CAAC,CAAC,CAE7D;CAiJF"}
@@ -63,6 +63,7 @@ export class TransactionPayController extends BaseController {
63
63
  subscribeAssetChanges(messenger, () => this.state, this.#updateTransactionData.bind(this));
64
64
  // eslint-disable-next-line no-new
65
65
  new QuoteRefresher({
66
+ getBalance: this.#getBalance,
66
67
  getStrategies: this.#getStrategiesWithFallback.bind(this),
67
68
  messenger,
68
69
  updateTransactionData: this.#updateTransactionData.bind(this),
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionPayController.js","sourceRoot":"","sources":["../src/TransactionPayController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,eAAe,EACf,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAiB7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,yBAAyB,GAAG;IAChC,eAAe;IACf,aAAa;IACb,0BAA0B;IAC1B,gBAAgB;IAChB,wBAAwB;IACxB,aAAa;IACb,mCAAmC;IACnC,oCAAoC;IACpC,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;CACZ,CAAC;AAEX,MAAM,aAAa,GAAiD;IAClE,eAAe,EAAE;QACf,sBAAsB,EAAE,KAAK;QAC7B,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,IAAI;KACf;CACF,CAAC;AAEF,MAAM,eAAe,GAAG,GAAkC,EAAE,CAAC,CAAC;IAC5D,eAAe,EAAE,EAAE;CACpB,CAAC,CAAC;AAEH,MAAM,OAAO,wBAAyB,SAAQ,cAI7C;IACU,SAAS,CAA0B;IAEnC,YAAY,CAA6B;IAEzC,cAAc,CAAyB;IAEvC,WAAW,CAAsB;IAEjC,yBAAyB,CAAmC;IAE5D,uBAAuB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B,WAAW,CAAC,IAAI,EAChB,eAAe,EAAE,WAAW,EAAE,uBAAuB,CACtD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { StateMetadata } from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { TransactionMeta } from '@metamask/transaction-controller';\nimport type { Draft } from 'immer';\nimport { noop } from 'lodash-es';\n\nimport { updateFiatPayment } from './actions/update-fiat-payment.js';\nimport { updatePaymentToken } from './actions/update-payment-token.js';\nimport {\n CONTROLLER_NAME,\n isTransactionPayStrategy,\n TransactionPayStrategy,\n} from './constants.js';\nimport type { TransactionPayClientId } from './constants.js';\nimport { QuoteRefresher } from './helpers/QuoteRefresher.js';\nimport type {\n GetAmountDataCallback,\n GetBalanceCallback,\n GetDelegationTransactionCallback,\n GetPaymentOverrideDataCallback,\n PolymarketCallbacks,\n TransactionConfig,\n TransactionConfigCallback,\n TransactionData,\n TransactionPayControllerMessenger,\n TransactionPayFiatOptions,\n TransactionPayControllerOptions,\n TransactionPayControllerState,\n UpdateFiatPaymentRequest,\n UpdatePaymentTokenRequest,\n} from './types.js';\nimport { getStrategyOrder } from './utils/feature-flags.js';\nimport { updateQuotes } from './utils/quotes.js';\nimport { updateSourceAmounts } from './utils/source-amounts.js';\nimport {\n subscribeAssetChanges,\n subscribeTransactionChanges,\n} from './utils/transaction.js';\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getAmountData',\n 'getClientId',\n 'getDelegationTransaction',\n 'getFiatOptions',\n 'getPaymentOverrideData',\n 'getStrategy',\n 'polymarketGetDepositWalletAddress',\n 'polymarketSubmitDepositWalletBatch',\n 'setTransactionConfig',\n 'updateFiatPayment',\n 'updatePaymentToken',\n] as const;\n\nconst stateMetadata: StateMetadata<TransactionPayControllerState> = {\n transactionData: {\n includeInDebugSnapshot: false,\n includeInStateLogs: true,\n persist: false,\n usedInUi: true,\n },\n};\n\nconst getDefaultState = (): TransactionPayControllerState => ({\n transactionData: {},\n});\n\nexport class TransactionPayController extends BaseController<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState,\n TransactionPayControllerMessenger\n> {\n readonly #clientId?: TransactionPayClientId;\n\n readonly #fiatOptions?: TransactionPayFiatOptions;\n\n readonly #getAmountData?: GetAmountDataCallback;\n\n readonly #getBalance?: GetBalanceCallback;\n\n readonly #getDelegationTransaction: GetDelegationTransactionCallback;\n\n readonly #getPaymentOverrideData?: GetPaymentOverrideDataCallback;\n\n readonly #getStrategy?: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy;\n\n readonly #getStrategies?: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy[];\n\n readonly #polymarket?: PolymarketCallbacks;\n\n constructor({\n clientId,\n fiatOptions,\n getAmountData,\n getBalance,\n getDelegationTransaction,\n getPaymentOverrideData,\n getStrategy,\n getStrategies,\n messenger,\n polymarket,\n state,\n }: TransactionPayControllerOptions) {\n super({\n name: CONTROLLER_NAME,\n metadata: stateMetadata,\n messenger,\n state: { ...getDefaultState(), ...state },\n });\n\n this.#clientId = clientId;\n this.#fiatOptions = fiatOptions;\n this.#getAmountData = getAmountData;\n this.#getBalance = getBalance;\n this.#getDelegationTransaction = getDelegationTransaction;\n this.#getPaymentOverrideData = getPaymentOverrideData;\n this.#getStrategy = getStrategy;\n this.#getStrategies = getStrategies;\n this.#polymarket = polymarket;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n subscribeTransactionChanges(\n messenger,\n this.#updateTransactionData.bind(this),\n this.#removeTransactionData.bind(this),\n );\n\n subscribeAssetChanges(\n messenger,\n () => this.state,\n this.#updateTransactionData.bind(this),\n );\n\n // eslint-disable-next-line no-new\n new QuoteRefresher({\n getStrategies: this.#getStrategiesWithFallback.bind(this),\n messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Sets the transaction configuration.\n *\n * The callback receives the current configuration properties and can mutate\n * them in place. Updated values are written back to the transaction data.\n *\n * @param transactionId - The ID of the transaction to configure.\n * @param callback - A callback that receives a mutable {@link TransactionConfig} object.\n */\n setTransactionConfig(\n transactionId: string,\n callback: TransactionConfigCallback,\n ): void {\n this.#updateTransactionData(transactionId, (transactionData) => {\n const config: TransactionConfig = {\n accountOverride: transactionData.accountOverride,\n atomic: transactionData.atomic,\n isHyperliquidSource: transactionData.isHyperliquidSource,\n isMaxAmount: transactionData.isMaxAmount,\n isPolymarketDepositWallet: transactionData.isPolymarketDepositWallet,\n isPostQuote: transactionData.isPostQuote,\n isQuoteRequired: transactionData.isQuoteRequired,\n paymentOverride: transactionData.paymentOverride,\n refundTo: transactionData.refundTo,\n };\n\n const previousAccountOverride = config.accountOverride;\n\n callback(config);\n\n Object.assign(transactionData, config);\n\n if (\n !config.isPostQuote &&\n config.accountOverride !== previousAccountOverride\n ) {\n transactionData.paymentToken = undefined;\n }\n });\n }\n\n /**\n * Updates the payment token for a transaction.\n *\n * Resolves token metadata and balances, then stores the new payment token\n * in the transaction data. This triggers recalculation of source amounts\n * and quote retrieval.\n *\n * @param request - The payment token update request containing the\n * transaction ID, token address, and chain ID.\n */\n updatePaymentToken(request: UpdatePaymentTokenRequest): void {\n updatePaymentToken(request, {\n messenger: this.messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Updates the fiat payment state for a transaction.\n *\n * The request callback receives the current fiat payment state and can\n * mutate it to update properties such as the selected payment method or\n * fiat amount.\n *\n * @param request - The fiat payment update request containing the\n * transaction ID and a callback to mutate fiat payment state.\n */\n updateFiatPayment(request: UpdateFiatPaymentRequest): void {\n updateFiatPayment(request, {\n messenger: this.messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Returns the configured client identifier.\n *\n * Used to set the `X-Client-Id` header on intents API requests so the\n * server can distinguish Mobile from Extension traffic. This is\n * intentionally not stored in controller state.\n *\n * @returns The client identifier, if configured.\n */\n getClientId(): TransactionPayClientId | undefined {\n return this.#clientId;\n }\n\n /**\n * Gets the delegation transaction for a given transaction.\n *\n * Converts the provided transaction into a redeem delegation by delegating\n * to the configured callback. Returns the delegation transaction data\n * including the encoded call data, target address, value, and an optional\n * authorization list.\n *\n * @param args - The arguments forwarded to the {@link GetDelegationTransactionCallback},\n * containing the transaction metadata.\n * @returns A promise resolving to the delegation transaction data.\n */\n getDelegationTransaction(\n ...args: Parameters<GetDelegationTransactionCallback>\n ): ReturnType<GetDelegationTransactionCallback> {\n return this.#getDelegationTransaction(...args);\n }\n\n /**\n * Returns additional transactions for the paymentOverride flow.\n *\n * Delegates to the client-supplied {@link GetPaymentOverrideDataCallback}.\n * Called during quote execution when `paymentOverride` is defined on the transaction.\n * Returns an empty array when no callback is configured.\n *\n * @param args - The arguments forwarded to the {@link GetPaymentOverrideDataCallback}.\n * @returns A promise resolving to the additional transactions array.\n */\n getAmountData(\n ...args: Parameters<GetAmountDataCallback>\n ): ReturnType<GetAmountDataCallback> {\n return this.#getAmountData?.(...args) ?? Promise.resolve({ updates: [] });\n }\n\n /**\n * Returns optional fiat execution configuration.\n *\n * This is intentionally not stored in controller state.\n *\n * @returns Fiat execution options, if configured.\n */\n getFiatOptions(): TransactionPayFiatOptions | undefined {\n return this.#fiatOptions;\n }\n\n getPaymentOverrideData(\n ...args: Parameters<GetPaymentOverrideDataCallback>\n ): ReturnType<GetPaymentOverrideDataCallback> {\n return (\n this.#getPaymentOverrideData?.(...args) ?? Promise.resolve({ calls: [] })\n );\n }\n\n /**\n * Gets the preferred strategy for a transaction.\n *\n * Returns the first strategy from the ordered list of strategies applicable\n * to the given transaction. Falls back to the default strategy order derived\n * from feature flags when no custom strategy callback is configured.\n *\n * @param transaction - The transaction metadata to determine the strategy for.\n * @returns The preferred {@link TransactionPayStrategy} for the transaction.\n */\n getStrategy(transaction: TransactionMeta): TransactionPayStrategy {\n return this.#getStrategiesWithFallback(transaction)[0];\n }\n\n /**\n * Derives the Polymarket deposit-wallet address for an EOA via the\n * client-supplied callback.\n *\n * @param args - The arguments forwarded to {@link PolymarketCallbacks.getDepositWalletAddress}.\n * @returns A promise resolving to the deposit-wallet address.\n */\n polymarketGetDepositWalletAddress(\n ...args: Parameters<PolymarketCallbacks['getDepositWalletAddress']>\n ): ReturnType<PolymarketCallbacks['getDepositWalletAddress']> {\n return this.#requirePolymarket().getDepositWalletAddress(...args);\n }\n\n /**\n * Signs and broadcasts a Polymarket deposit-wallet batch via the\n * client-supplied callback.\n *\n * @param args - The arguments forwarded to {@link PolymarketCallbacks.submitDepositWalletBatch}.\n * @returns A promise resolving to the relayer-issued source hash.\n */\n polymarketSubmitDepositWalletBatch(\n ...args: Parameters<PolymarketCallbacks['submitDepositWalletBatch']>\n ): ReturnType<PolymarketCallbacks['submitDepositWalletBatch']> {\n return this.#requirePolymarket().submitDepositWalletBatch(...args);\n }\n\n #requirePolymarket(): PolymarketCallbacks {\n if (!this.#polymarket) {\n throw new Error('TransactionPayController: Polymarket callbacks missing');\n }\n return this.#polymarket;\n }\n\n #removeTransactionData(transactionId: string): void {\n this.update((state) => {\n delete state.transactionData[transactionId];\n });\n }\n\n #updateTransactionData(\n transactionId: string,\n fn: (transactionData: Draft<TransactionData>) => void,\n ): void {\n let shouldUpdateQuotes = false;\n\n this.update((state) => {\n const { transactionData } = state;\n let current = transactionData[transactionId];\n const originalPaymentToken = current?.paymentToken;\n const originalTokens = current?.tokens;\n const originalIsMaxAmount = current?.isMaxAmount;\n const originalIsPostQuote = current?.isPostQuote;\n const originalAccountOverride = current?.accountOverride;\n const originalFiatPaymentAmount = current?.fiatPayment?.amountFiat;\n const originalFiatPaymentMethodId =\n current?.fiatPayment?.selectedPaymentMethodId;\n\n if (!current) {\n transactionData[transactionId] = {\n fiatPayment: {},\n isLoading: false,\n tokens: [],\n };\n\n current = transactionData[transactionId];\n }\n\n fn(current);\n\n const isPaymentTokenUpdated =\n current.paymentToken?.address?.toLowerCase() !==\n originalPaymentToken?.address?.toLowerCase() ||\n current.paymentToken?.chainId !== originalPaymentToken?.chainId;\n\n const isPaymentTokenBalanceUpdated =\n current.paymentToken?.balanceRaw !== originalPaymentToken?.balanceRaw;\n\n const isTokensUpdated = current.tokens !== originalTokens;\n const isIsMaxUpdated = current.isMaxAmount !== originalIsMaxAmount;\n const isPostQuoteUpdated = current.isPostQuote !== originalIsPostQuote;\n const isAccountOverrideUpdated =\n current.accountOverride !== originalAccountOverride;\n const isFiatAmountUpdated =\n current.fiatPayment?.amountFiat !== originalFiatPaymentAmount;\n const isFiatPaymentMethodUpdated =\n current.fiatPayment?.selectedPaymentMethodId !==\n originalFiatPaymentMethodId;\n\n if (\n isPaymentTokenUpdated ||\n isIsMaxUpdated ||\n isTokensUpdated ||\n isPostQuoteUpdated ||\n isAccountOverrideUpdated\n ) {\n updateSourceAmounts(\n transactionId,\n /* oxlint-disable typescript/no-unnecessary-type-assertion */\n current as never,\n /* oxlint-enable typescript/no-unnecessary-type-assertion */\n this.messenger,\n this.#getBalance,\n );\n\n shouldUpdateQuotes = true;\n } else if (\n isPaymentTokenBalanceUpdated &&\n current.isMaxAmount &&\n !current.isPostQuote\n ) {\n // On max the source amount is the payment token balance, so a\n // refreshed balance must re-derive it, otherwise the amount stays at\n // whatever the balance was when the token was selected. Quotes are not\n // requested again here: the balance is refreshed by `updateQuotes`\n // itself, which reads the re-derived amounts before building requests.\n updateSourceAmounts(\n transactionId,\n /* oxlint-disable typescript/no-unnecessary-type-assertion */\n current as never,\n /* oxlint-enable typescript/no-unnecessary-type-assertion */\n this.messenger,\n this.#getBalance,\n );\n }\n\n if (isFiatAmountUpdated || isFiatPaymentMethodUpdated) {\n shouldUpdateQuotes = true;\n }\n });\n\n if (shouldUpdateQuotes) {\n updateQuotes({\n getStrategies: this.#getStrategiesWithFallback.bind(this),\n messenger: this.messenger,\n transactionData: this.state.transactionData[transactionId],\n transactionId,\n updateTransactionData: this.#updateTransactionData.bind(this),\n }).catch(noop);\n }\n }\n\n #getStrategiesWithFallback(\n transaction: TransactionMeta,\n ): TransactionPayStrategy[] {\n const transactionData = this.state.transactionData[transaction.id];\n\n const strategyCandidates: unknown[] =\n this.#getStrategies?.(transaction) ??\n (this.#getStrategy ? [this.#getStrategy(transaction)] : []);\n\n const validStrategies = strategyCandidates.filter(\n (strategy): strategy is TransactionPayStrategy =>\n isTransactionPayStrategy(strategy),\n );\n\n if (validStrategies.length) {\n return validStrategies;\n }\n\n const paymentToken = transactionData?.paymentToken;\n\n return getStrategyOrder(\n this.messenger,\n paymentToken?.chainId,\n paymentToken?.address,\n transaction.type,\n transactionData?.fiatPayment?.selectedPaymentMethodId,\n );\n }\n}\n"]}
1
+ {"version":3,"file":"TransactionPayController.js","sourceRoot":"","sources":["../src/TransactionPayController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAG3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,eAAe,EACf,wBAAwB,GAEzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAiB7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,qBAAqB,EACrB,2BAA2B,GAC5B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,yBAAyB,GAAG;IAChC,eAAe;IACf,aAAa;IACb,0BAA0B;IAC1B,gBAAgB;IAChB,wBAAwB;IACxB,aAAa;IACb,mCAAmC;IACnC,oCAAoC;IACpC,sBAAsB;IACtB,mBAAmB;IACnB,oBAAoB;CACZ,CAAC;AAEX,MAAM,aAAa,GAAiD;IAClE,eAAe,EAAE;QACf,sBAAsB,EAAE,KAAK;QAC7B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CAAC,EAAE,CAAC,CAAC;QAE9D,MAAM,eAAe,GAAG,kBAAkB,CAAC,MAAM,CAC/C,CAAC,QAAQ,EAAsC,EAAE,CAC/C,wBAAwB,CAAC,QAAQ,CAAC,CACrC,CAAC;QAEF,IAAI,eAAe,CAAC,MAAM,EAAE,CAAC;YAC3B,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,MAAM,YAAY,GAAG,eAAe,EAAE,YAAY,CAAC;QAEnD,OAAO,gBAAgB,CACrB,IAAI,CAAC,SAAS,EACd,YAAY,EAAE,OAAO,EACrB,YAAY,EAAE,OAAO,EACrB,WAAW,CAAC,IAAI,EAChB,eAAe,EAAE,WAAW,EAAE,uBAAuB,CACtD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { StateMetadata } from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { TransactionMeta } from '@metamask/transaction-controller';\nimport type { Draft } from 'immer';\nimport { noop } from 'lodash-es';\n\nimport { updateFiatPayment } from './actions/update-fiat-payment.js';\nimport { updatePaymentToken } from './actions/update-payment-token.js';\nimport {\n CONTROLLER_NAME,\n isTransactionPayStrategy,\n TransactionPayStrategy,\n} from './constants.js';\nimport type { TransactionPayClientId } from './constants.js';\nimport { QuoteRefresher } from './helpers/QuoteRefresher.js';\nimport type {\n GetAmountDataCallback,\n GetBalanceCallback,\n GetDelegationTransactionCallback,\n GetPaymentOverrideDataCallback,\n PolymarketCallbacks,\n TransactionConfig,\n TransactionConfigCallback,\n TransactionData,\n TransactionPayControllerMessenger,\n TransactionPayFiatOptions,\n TransactionPayControllerOptions,\n TransactionPayControllerState,\n UpdateFiatPaymentRequest,\n UpdatePaymentTokenRequest,\n} from './types.js';\nimport { getStrategyOrder } from './utils/feature-flags.js';\nimport { updateQuotes } from './utils/quotes.js';\nimport { updateSourceAmounts } from './utils/source-amounts.js';\nimport {\n subscribeAssetChanges,\n subscribeTransactionChanges,\n} from './utils/transaction.js';\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'getAmountData',\n 'getClientId',\n 'getDelegationTransaction',\n 'getFiatOptions',\n 'getPaymentOverrideData',\n 'getStrategy',\n 'polymarketGetDepositWalletAddress',\n 'polymarketSubmitDepositWalletBatch',\n 'setTransactionConfig',\n 'updateFiatPayment',\n 'updatePaymentToken',\n] as const;\n\nconst stateMetadata: StateMetadata<TransactionPayControllerState> = {\n transactionData: {\n includeInDebugSnapshot: false,\n includeInStateLogs: true,\n persist: false,\n usedInUi: true,\n },\n};\n\nconst getDefaultState = (): TransactionPayControllerState => ({\n transactionData: {},\n});\n\nexport class TransactionPayController extends BaseController<\n typeof CONTROLLER_NAME,\n TransactionPayControllerState,\n TransactionPayControllerMessenger\n> {\n readonly #clientId?: TransactionPayClientId;\n\n readonly #fiatOptions?: TransactionPayFiatOptions;\n\n readonly #getAmountData?: GetAmountDataCallback;\n\n readonly #getBalance?: GetBalanceCallback;\n\n readonly #getDelegationTransaction: GetDelegationTransactionCallback;\n\n readonly #getPaymentOverrideData?: GetPaymentOverrideDataCallback;\n\n readonly #getStrategy?: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy;\n\n readonly #getStrategies?: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy[];\n\n readonly #polymarket?: PolymarketCallbacks;\n\n constructor({\n clientId,\n fiatOptions,\n getAmountData,\n getBalance,\n getDelegationTransaction,\n getPaymentOverrideData,\n getStrategy,\n getStrategies,\n messenger,\n polymarket,\n state,\n }: TransactionPayControllerOptions) {\n super({\n name: CONTROLLER_NAME,\n metadata: stateMetadata,\n messenger,\n state: { ...getDefaultState(), ...state },\n });\n\n this.#clientId = clientId;\n this.#fiatOptions = fiatOptions;\n this.#getAmountData = getAmountData;\n this.#getBalance = getBalance;\n this.#getDelegationTransaction = getDelegationTransaction;\n this.#getPaymentOverrideData = getPaymentOverrideData;\n this.#getStrategy = getStrategy;\n this.#getStrategies = getStrategies;\n this.#polymarket = polymarket;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n subscribeTransactionChanges(\n messenger,\n this.#updateTransactionData.bind(this),\n this.#removeTransactionData.bind(this),\n );\n\n subscribeAssetChanges(\n messenger,\n () => this.state,\n this.#updateTransactionData.bind(this),\n );\n\n // eslint-disable-next-line no-new\n new QuoteRefresher({\n getBalance: this.#getBalance,\n getStrategies: this.#getStrategiesWithFallback.bind(this),\n messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Sets the transaction configuration.\n *\n * The callback receives the current configuration properties and can mutate\n * them in place. Updated values are written back to the transaction data.\n *\n * @param transactionId - The ID of the transaction to configure.\n * @param callback - A callback that receives a mutable {@link TransactionConfig} object.\n */\n setTransactionConfig(\n transactionId: string,\n callback: TransactionConfigCallback,\n ): void {\n this.#updateTransactionData(transactionId, (transactionData) => {\n const config: TransactionConfig = {\n accountOverride: transactionData.accountOverride,\n atomic: transactionData.atomic,\n isHyperliquidSource: transactionData.isHyperliquidSource,\n isMaxAmount: transactionData.isMaxAmount,\n isPolymarketDepositWallet: transactionData.isPolymarketDepositWallet,\n isPostQuote: transactionData.isPostQuote,\n isQuoteRequired: transactionData.isQuoteRequired,\n paymentOverride: transactionData.paymentOverride,\n refundTo: transactionData.refundTo,\n };\n\n const previousAccountOverride = config.accountOverride;\n\n callback(config);\n\n Object.assign(transactionData, config);\n\n if (\n !config.isPostQuote &&\n config.accountOverride !== previousAccountOverride\n ) {\n transactionData.paymentToken = undefined;\n }\n });\n }\n\n /**\n * Updates the payment token for a transaction.\n *\n * Resolves token metadata and balances, then stores the new payment token\n * in the transaction data. This triggers recalculation of source amounts\n * and quote retrieval.\n *\n * @param request - The payment token update request containing the\n * transaction ID, token address, and chain ID.\n */\n updatePaymentToken(request: UpdatePaymentTokenRequest): void {\n updatePaymentToken(request, {\n messenger: this.messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Updates the fiat payment state for a transaction.\n *\n * The request callback receives the current fiat payment state and can\n * mutate it to update properties such as the selected payment method or\n * fiat amount.\n *\n * @param request - The fiat payment update request containing the\n * transaction ID and a callback to mutate fiat payment state.\n */\n updateFiatPayment(request: UpdateFiatPaymentRequest): void {\n updateFiatPayment(request, {\n messenger: this.messenger,\n updateTransactionData: this.#updateTransactionData.bind(this),\n });\n }\n\n /**\n * Returns the configured client identifier.\n *\n * Used to set the `X-Client-Id` header on intents API requests so the\n * server can distinguish Mobile from Extension traffic. This is\n * intentionally not stored in controller state.\n *\n * @returns The client identifier, if configured.\n */\n getClientId(): TransactionPayClientId | undefined {\n return this.#clientId;\n }\n\n /**\n * Gets the delegation transaction for a given transaction.\n *\n * Converts the provided transaction into a redeem delegation by delegating\n * to the configured callback. Returns the delegation transaction data\n * including the encoded call data, target address, value, and an optional\n * authorization list.\n *\n * @param args - The arguments forwarded to the {@link GetDelegationTransactionCallback},\n * containing the transaction metadata.\n * @returns A promise resolving to the delegation transaction data.\n */\n getDelegationTransaction(\n ...args: Parameters<GetDelegationTransactionCallback>\n ): ReturnType<GetDelegationTransactionCallback> {\n return this.#getDelegationTransaction(...args);\n }\n\n /**\n * Returns additional transactions for the paymentOverride flow.\n *\n * Delegates to the client-supplied {@link GetPaymentOverrideDataCallback}.\n * Called during quote execution when `paymentOverride` is defined on the transaction.\n * Returns an empty array when no callback is configured.\n *\n * @param args - The arguments forwarded to the {@link GetPaymentOverrideDataCallback}.\n * @returns A promise resolving to the additional transactions array.\n */\n getAmountData(\n ...args: Parameters<GetAmountDataCallback>\n ): ReturnType<GetAmountDataCallback> {\n return this.#getAmountData?.(...args) ?? Promise.resolve({ updates: [] });\n }\n\n /**\n * Returns optional fiat execution configuration.\n *\n * This is intentionally not stored in controller state.\n *\n * @returns Fiat execution options, if configured.\n */\n getFiatOptions(): TransactionPayFiatOptions | undefined {\n return this.#fiatOptions;\n }\n\n getPaymentOverrideData(\n ...args: Parameters<GetPaymentOverrideDataCallback>\n ): ReturnType<GetPaymentOverrideDataCallback> {\n return (\n this.#getPaymentOverrideData?.(...args) ?? Promise.resolve({ calls: [] })\n );\n }\n\n /**\n * Gets the preferred strategy for a transaction.\n *\n * Returns the first strategy from the ordered list of strategies applicable\n * to the given transaction. Falls back to the default strategy order derived\n * from feature flags when no custom strategy callback is configured.\n *\n * @param transaction - The transaction metadata to determine the strategy for.\n * @returns The preferred {@link TransactionPayStrategy} for the transaction.\n */\n getStrategy(transaction: TransactionMeta): TransactionPayStrategy {\n return this.#getStrategiesWithFallback(transaction)[0];\n }\n\n /**\n * Derives the Polymarket deposit-wallet address for an EOA via the\n * client-supplied callback.\n *\n * @param args - The arguments forwarded to {@link PolymarketCallbacks.getDepositWalletAddress}.\n * @returns A promise resolving to the deposit-wallet address.\n */\n polymarketGetDepositWalletAddress(\n ...args: Parameters<PolymarketCallbacks['getDepositWalletAddress']>\n ): ReturnType<PolymarketCallbacks['getDepositWalletAddress']> {\n return this.#requirePolymarket().getDepositWalletAddress(...args);\n }\n\n /**\n * Signs and broadcasts a Polymarket deposit-wallet batch via the\n * client-supplied callback.\n *\n * @param args - The arguments forwarded to {@link PolymarketCallbacks.submitDepositWalletBatch}.\n * @returns A promise resolving to the relayer-issued source hash.\n */\n polymarketSubmitDepositWalletBatch(\n ...args: Parameters<PolymarketCallbacks['submitDepositWalletBatch']>\n ): ReturnType<PolymarketCallbacks['submitDepositWalletBatch']> {\n return this.#requirePolymarket().submitDepositWalletBatch(...args);\n }\n\n #requirePolymarket(): PolymarketCallbacks {\n if (!this.#polymarket) {\n throw new Error('TransactionPayController: Polymarket callbacks missing');\n }\n return this.#polymarket;\n }\n\n #removeTransactionData(transactionId: string): void {\n this.update((state) => {\n delete state.transactionData[transactionId];\n });\n }\n\n #updateTransactionData(\n transactionId: string,\n fn: (transactionData: Draft<TransactionData>) => void,\n ): void {\n let shouldUpdateQuotes = false;\n\n this.update((state) => {\n const { transactionData } = state;\n let current = transactionData[transactionId];\n const originalPaymentToken = current?.paymentToken;\n const originalTokens = current?.tokens;\n const originalIsMaxAmount = current?.isMaxAmount;\n const originalIsPostQuote = current?.isPostQuote;\n const originalAccountOverride = current?.accountOverride;\n const originalFiatPaymentAmount = current?.fiatPayment?.amountFiat;\n const originalFiatPaymentMethodId =\n current?.fiatPayment?.selectedPaymentMethodId;\n\n if (!current) {\n transactionData[transactionId] = {\n fiatPayment: {},\n isLoading: false,\n tokens: [],\n };\n\n current = transactionData[transactionId];\n }\n\n fn(current);\n\n const isPaymentTokenUpdated =\n current.paymentToken?.address?.toLowerCase() !==\n originalPaymentToken?.address?.toLowerCase() ||\n current.paymentToken?.chainId !== originalPaymentToken?.chainId;\n\n const isPaymentTokenBalanceUpdated =\n current.paymentToken?.balanceRaw !== originalPaymentToken?.balanceRaw;\n\n const isTokensUpdated = current.tokens !== originalTokens;\n const isIsMaxUpdated = current.isMaxAmount !== originalIsMaxAmount;\n const isPostQuoteUpdated = current.isPostQuote !== originalIsPostQuote;\n const isAccountOverrideUpdated =\n current.accountOverride !== originalAccountOverride;\n const isFiatAmountUpdated =\n current.fiatPayment?.amountFiat !== originalFiatPaymentAmount;\n const isFiatPaymentMethodUpdated =\n current.fiatPayment?.selectedPaymentMethodId !==\n originalFiatPaymentMethodId;\n\n if (\n isPaymentTokenUpdated ||\n isIsMaxUpdated ||\n isTokensUpdated ||\n isPostQuoteUpdated ||\n isAccountOverrideUpdated\n ) {\n updateSourceAmounts(\n transactionId,\n /* oxlint-disable typescript/no-unnecessary-type-assertion */\n current as never,\n /* oxlint-enable typescript/no-unnecessary-type-assertion */\n this.messenger,\n this.#getBalance,\n );\n\n shouldUpdateQuotes = true;\n } else if (\n isPaymentTokenBalanceUpdated &&\n current.isMaxAmount &&\n !current.isPostQuote\n ) {\n // On max the source amount is the payment token balance, so a\n // refreshed balance must re-derive it, otherwise the amount stays at\n // whatever the balance was when the token was selected. Quotes are not\n // requested again here: the balance is refreshed by `updateQuotes`\n // itself, which reads the re-derived amounts before building requests.\n updateSourceAmounts(\n transactionId,\n /* oxlint-disable typescript/no-unnecessary-type-assertion */\n current as never,\n /* oxlint-enable typescript/no-unnecessary-type-assertion */\n this.messenger,\n this.#getBalance,\n );\n }\n\n if (isFiatAmountUpdated || isFiatPaymentMethodUpdated) {\n shouldUpdateQuotes = true;\n }\n });\n\n if (shouldUpdateQuotes) {\n updateQuotes({\n getStrategies: this.#getStrategiesWithFallback.bind(this),\n messenger: this.messenger,\n transactionData: this.state.transactionData[transactionId],\n transactionId,\n updateTransactionData: this.#updateTransactionData.bind(this),\n }).catch(noop);\n }\n }\n\n #getStrategiesWithFallback(\n transaction: TransactionMeta,\n ): TransactionPayStrategy[] {\n const transactionData = this.state.transactionData[transaction.id];\n\n const strategyCandidates: unknown[] =\n this.#getStrategies?.(transaction) ??\n (this.#getStrategy ? [this.#getStrategy(transaction)] : []);\n\n const validStrategies = strategyCandidates.filter(\n (strategy): strategy is TransactionPayStrategy =>\n isTransactionPayStrategy(strategy),\n );\n\n if (validStrategies.length) {\n return validStrategies;\n }\n\n const paymentToken = transactionData?.paymentToken;\n\n return getStrategyOrder(\n this.messenger,\n paymentToken?.chainId,\n paymentToken?.address,\n transaction.type,\n transactionData?.fiatPayment?.selectedPaymentMethodId,\n );\n }\n}\n"]}
@@ -1,10 +1,11 @@
1
1
  import type { TransactionMeta } from '@metamask/transaction-controller';
2
2
  import { TransactionPayStrategy } from '../constants.js';
3
3
  import type { TransactionPayControllerMessenger } from '../index.js';
4
- import type { UpdateTransactionDataCallback } from '../types.js';
4
+ import type { GetBalanceCallback, UpdateTransactionDataCallback } from '../types.js';
5
5
  export declare class QuoteRefresher {
6
6
  #private;
7
- constructor({ getStrategies, messenger, updateTransactionData, }: {
7
+ constructor({ getBalance, getStrategies, messenger, updateTransactionData, }: {
8
+ getBalance?: GetBalanceCallback;
8
9
  getStrategies: (transaction: TransactionMeta) => TransactionPayStrategy[];
9
10
  messenger: TransactionPayControllerMessenger;
10
11
  updateTransactionData: UpdateTransactionDataCallback;
@@ -1 +1 @@
1
- {"version":3,"file":"QuoteRefresher.d.ts","sourceRoot":"","sources":["../../src/helpers/QuoteRefresher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,iCAAiC,EAElC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAOjE,qBAAa,cAAc;;IAezB,YAAY,EACV,aAAa,EACb,SAAS,EACT,qBAAqB,GACtB,EAAE;QACD,aAAa,EAAE,CAAC,WAAW,EAAE,eAAe,KAAK,sBAAsB,EAAE,CAAC;QAC1E,SAAS,EAAE,iCAAiC,CAAC;QAC7C,qBAAqB,EAAE,6BAA6B,CAAC;KACtD,EAWA;CAsEF"}
1
+ {"version":3,"file":"QuoteRefresher.d.ts","sourceRoot":"","sources":["../../src/helpers/QuoteRefresher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EACV,iCAAiC,EAElC,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACV,kBAAkB,EAClB,6BAA6B,EAC9B,MAAM,aAAa,CAAC;AAOrB,qBAAa,cAAc;;IAiBzB,YAAY,EACV,UAAU,EACV,aAAa,EACb,SAAS,EACT,qBAAqB,GACtB,EAAE;QACD,UAAU,CAAC,EAAE,kBAAkB,CAAC;QAChC,aAAa,EAAE,CAAC,WAAW,EAAE,eAAe,KAAK,sBAAsB,EAAE,CAAC;QAC1E,SAAS,EAAE,iCAAiC,CAAC;QAC7C,qBAAqB,EAAE,6BAA6B,CAAC;KACtD,EAYA;CAuEF"}
@@ -11,8 +11,10 @@ export class QuoteRefresher {
11
11
  #messenger;
12
12
  #timeoutId;
13
13
  #getStrategies;
14
+ #getBalance;
14
15
  #updateTransactionData;
15
- constructor({ getStrategies, messenger, updateTransactionData, }) {
16
+ constructor({ getBalance, getStrategies, messenger, updateTransactionData, }) {
17
+ this.#getBalance = getBalance;
16
18
  this.#getStrategies = getStrategies;
17
19
  this.#messenger = messenger;
18
20
  this.#isRunning = false;
@@ -38,7 +40,7 @@ export class QuoteRefresher {
38
40
  async #onInterval() {
39
41
  this.#isUpdating = true;
40
42
  try {
41
- await refreshQuotes(this.#messenger, this.#updateTransactionData, this.#getStrategies);
43
+ await refreshQuotes(this.#messenger, this.#updateTransactionData, this.#getStrategies, this.#getBalance);
42
44
  }
43
45
  catch (error) {
44
46
  log('Error refreshing quotes', error);
@@ -1 +1 @@
1
- {"version":3,"file":"QuoteRefresher.js","sourceRoot":"","sources":["../../src/helpers/QuoteRefresher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAKzD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,WAAW;AAExC,MAAM,GAAG,GAAG,kBAAkB,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;AAE/D,MAAM,OAAO,cAAc;IACzB,UAAU,CAAU;IAEpB,WAAW,CAAU;IAEZ,UAAU,CAAoC;IAEvD,UAAU,CAA6B;IAE9B,cAAc,CAEO;IAErB,sBAAsB,CAAgC;IAE/D,YAAY,EACV,aAAa,EACb,SAAS,EACT,qBAAqB,GAKtB;QACC,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,WAA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EAAE;YAChC,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC,EAAE,cAAc,CAAC,CAAC;IACrB,CAAC;IAED,cAAc,CAAC,KAAoC;QACjD,mEAAmE;QACnE,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAC1E,WAAW,CAAC,MAAM,EAAE,IAAI,CACtB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,sBAAsB,CAAC,IAAI,CAC1D,CACF,CAAC;QAEF,IAAI,SAAS,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,CAAC;aAAM,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport { noop } from 'lodash-es';\n\nimport { TransactionPayStrategy } from '../constants.js';\nimport type {\n TransactionPayControllerMessenger,\n TransactionPayControllerState,\n} from '../index.js';\nimport { projectLogger } from '../logger.js';\nimport type { UpdateTransactionDataCallback } from '../types.js';\nimport { refreshQuotes } from '../utils/quotes.js';\n\nconst CHECK_INTERVAL = 1000; // 1 Second\n\nconst log = createModuleLogger(projectLogger, 'quote-refresh');\n\nexport class QuoteRefresher {\n #isRunning: boolean;\n\n #isUpdating: boolean;\n\n readonly #messenger: TransactionPayControllerMessenger;\n\n #timeoutId: NodeJS.Timeout | undefined;\n\n readonly #getStrategies: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy[];\n\n readonly #updateTransactionData: UpdateTransactionDataCallback;\n\n constructor({\n getStrategies,\n messenger,\n updateTransactionData,\n }: {\n getStrategies: (transaction: TransactionMeta) => TransactionPayStrategy[];\n messenger: TransactionPayControllerMessenger;\n updateTransactionData: UpdateTransactionDataCallback;\n }) {\n this.#getStrategies = getStrategies;\n this.#messenger = messenger;\n this.#isRunning = false;\n this.#isUpdating = false;\n this.#updateTransactionData = updateTransactionData;\n\n messenger.subscribe(\n 'TransactionPayController:stateChange',\n this.#onStateChange.bind(this),\n );\n }\n\n #start(): void {\n this.#isRunning = true;\n\n log('Started');\n\n if (this.#isUpdating) {\n return;\n }\n\n this.#queueNextInterval();\n }\n\n #stop(): void {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n }\n\n this.#isRunning = false;\n\n log('Stopped');\n }\n\n async #onInterval(): Promise<void> {\n this.#isUpdating = true;\n\n try {\n await refreshQuotes(\n this.#messenger,\n this.#updateTransactionData,\n this.#getStrategies,\n );\n } catch (error) {\n log('Error refreshing quotes', error);\n } finally {\n this.#isUpdating = false;\n\n this.#queueNextInterval();\n }\n }\n\n #queueNextInterval(): void {\n if (!this.#isRunning) {\n return;\n }\n\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n }\n\n this.#timeoutId = setTimeout(() => {\n this.#onInterval().catch(noop);\n }, CHECK_INTERVAL);\n }\n\n #onStateChange(state: TransactionPayControllerState): void {\n // No-op quotes never refresh, so they don't need the refresh loop.\n const hasQuotes = Object.values(state.transactionData).some((transaction) =>\n transaction.quotes?.some(\n (quote) => quote.strategy !== TransactionPayStrategy.None,\n ),\n );\n\n if (hasQuotes && !this.#isRunning) {\n this.#start();\n } else if (!hasQuotes && this.#isRunning) {\n this.#stop();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"QuoteRefresher.js","sourceRoot":"","sources":["../../src/helpers/QuoteRefresher.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBA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AAC,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,EAAE,CAAC;QACf,CAAC;IACH,CAAC;CACF","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\nimport { createModuleLogger } from '@metamask/utils';\nimport { noop } from 'lodash-es';\n\nimport { TransactionPayStrategy } from '../constants.js';\nimport type {\n TransactionPayControllerMessenger,\n TransactionPayControllerState,\n} from '../index.js';\nimport { projectLogger } from '../logger.js';\nimport type {\n GetBalanceCallback,\n UpdateTransactionDataCallback,\n} from '../types.js';\nimport { refreshQuotes } from '../utils/quotes.js';\n\nconst CHECK_INTERVAL = 1000; // 1 Second\n\nconst log = createModuleLogger(projectLogger, 'quote-refresh');\n\nexport class QuoteRefresher {\n #isRunning: boolean;\n\n #isUpdating: boolean;\n\n readonly #messenger: TransactionPayControllerMessenger;\n\n #timeoutId: NodeJS.Timeout | undefined;\n\n readonly #getStrategies: (\n transaction: TransactionMeta,\n ) => TransactionPayStrategy[];\n\n readonly #getBalance?: GetBalanceCallback;\n\n readonly #updateTransactionData: UpdateTransactionDataCallback;\n\n constructor({\n getBalance,\n getStrategies,\n messenger,\n updateTransactionData,\n }: {\n getBalance?: GetBalanceCallback;\n getStrategies: (transaction: TransactionMeta) => TransactionPayStrategy[];\n messenger: TransactionPayControllerMessenger;\n updateTransactionData: UpdateTransactionDataCallback;\n }) {\n this.#getBalance = getBalance;\n this.#getStrategies = getStrategies;\n this.#messenger = messenger;\n this.#isRunning = false;\n this.#isUpdating = false;\n this.#updateTransactionData = updateTransactionData;\n\n messenger.subscribe(\n 'TransactionPayController:stateChange',\n this.#onStateChange.bind(this),\n );\n }\n\n #start(): void {\n this.#isRunning = true;\n\n log('Started');\n\n if (this.#isUpdating) {\n return;\n }\n\n this.#queueNextInterval();\n }\n\n #stop(): void {\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n }\n\n this.#isRunning = false;\n\n log('Stopped');\n }\n\n async #onInterval(): Promise<void> {\n this.#isUpdating = true;\n\n try {\n await refreshQuotes(\n this.#messenger,\n this.#updateTransactionData,\n this.#getStrategies,\n this.#getBalance,\n );\n } catch (error) {\n log('Error refreshing quotes', error);\n } finally {\n this.#isUpdating = false;\n\n this.#queueNextInterval();\n }\n }\n\n #queueNextInterval(): void {\n if (!this.#isRunning) {\n return;\n }\n\n if (this.#timeoutId) {\n clearTimeout(this.#timeoutId);\n }\n\n this.#timeoutId = setTimeout(() => {\n this.#onInterval().catch(noop);\n }, CHECK_INTERVAL);\n }\n\n #onStateChange(state: TransactionPayControllerState): void {\n // No-op quotes never refresh, so they don't need the refresh loop.\n const hasQuotes = Object.values(state.transactionData).some((transaction) =>\n transaction.quotes?.some(\n (quote) => quote.strategy !== TransactionPayStrategy.None,\n ),\n );\n\n if (hasQuotes && !this.#isRunning) {\n this.#start();\n } else if (!hasQuotes && this.#isRunning) {\n this.#stop();\n }\n }\n}\n"]}
@@ -1,8 +1,9 @@
1
- import type { PayStrategy, PayStrategyExecuteRequest, PayStrategyGetQuotesRequest, TransactionPayQuote } from '../../types.js';
1
+ import type { PayStrategy, PayStrategyExecuteRequest, PayStrategyGetRefreshIntervalRequest, PayStrategyGetQuotesRequest, TransactionPayQuote } from '../../types.js';
2
2
  import type { RelayQuote } from './types.js';
3
3
  export declare class RelayStrategy implements PayStrategy<RelayQuote> {
4
4
  supports(request: PayStrategyGetQuotesRequest): boolean;
5
5
  getQuotes(request: PayStrategyGetQuotesRequest): Promise<TransactionPayQuote<RelayQuote>[]>;
6
+ getRefreshInterval(request: PayStrategyGetRefreshIntervalRequest): Promise<number | undefined>;
6
7
  execute(request: PayStrategyExecuteRequest<RelayQuote>): ReturnType<PayStrategy<RelayQuote>['execute']>;
7
8
  }
8
9
  //# sourceMappingURL=RelayStrategy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RelayStrategy.d.ts","sourceRoot":"","sources":["../../../src/strategy/relay/RelayStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,qBAAa,aAAc,YAAW,WAAW,CAAC,UAAU,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAGtD;IAEK,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC,CAE5C;IAEK,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAC7C,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAEhD;CACF"}
1
+ {"version":3,"file":"RelayStrategy.d.ts","sourceRoot":"","sources":["../../../src/strategy/relay/RelayStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,yBAAyB,EACzB,oCAAoC,EACpC,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAQxB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,qBAAa,aAAc,YAAW,WAAW,CAAC,UAAU,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAGtD;IAEK,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,EAAE,CAAC,CAE5C;IAEK,kBAAkB,CACtB,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAY7B;IAEK,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAC7C,UAAU,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,CAEhD;CACF"}
@@ -1,4 +1,5 @@
1
- import { getPayStrategiesConfig } from '../../utils/feature-flags.js';
1
+ import { getMaxBalanceRefreshInterval, getPayStrategiesConfig, } from '../../utils/feature-flags.js';
2
+ import { getTransaction } from '../../utils/transaction.js';
2
3
  import { getRelayQuotes } from './relay-quotes.js';
3
4
  import { submitRelayQuotes } from './relay-submit.js';
4
5
  export class RelayStrategy {
@@ -9,6 +10,16 @@ export class RelayStrategy {
9
10
  async getQuotes(request) {
10
11
  return getRelayQuotes(request);
11
12
  }
13
+ async getRefreshInterval(request) {
14
+ const { messenger, transactionId } = request;
15
+ const transactionData = messenger.call('TransactionPayController:getState')
16
+ .transactionData[transactionId];
17
+ if (!transactionData?.isMaxAmount) {
18
+ return undefined;
19
+ }
20
+ const transaction = getTransaction(transactionId, messenger);
21
+ return getMaxBalanceRefreshInterval(messenger, transaction);
22
+ }
12
23
  async execute(request) {
13
24
  return await submitRelayQuotes(request);
14
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RelayStrategy.js","sourceRoot":"","sources":["../../../src/strategy/relay/RelayStrategy.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,OAAO,aAAa;IACxB,QAAQ,CAAC,OAAoC;QAC3C,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA8C;QAE9C,OAAO,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type {\n PayStrategy,\n PayStrategyExecuteRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types.js';\nimport { getPayStrategiesConfig } from '../../utils/feature-flags.js';\nimport { getRelayQuotes } from './relay-quotes.js';\nimport { submitRelayQuotes } from './relay-submit.js';\nimport type { RelayQuote } from './types.js';\n\nexport class RelayStrategy implements PayStrategy<RelayQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n return config.relay.enabled;\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<RelayQuote>[]> {\n return getRelayQuotes(request);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<RelayQuote>,\n ): ReturnType<PayStrategy<RelayQuote>['execute']> {\n return await submitRelayQuotes(request);\n }\n}\n"]}
1
+ {"version":3,"file":"RelayStrategy.js","sourceRoot":"","sources":["../../../src/strategy/relay/RelayStrategy.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,MAAM,OAAO,aAAa;IACxB,QAAQ,CAAC,OAAoC;QAC3C,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACzD,OAAO,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,OAA6C;QAE7C,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC;QAC7C,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,mCAAmC,CAAC;aACxE,eAAe,CAAC,aAAa,CAAC,CAAC;QAElC,IAAI,CAAC,eAAe,EAAE,WAAW,EAAE,CAAC;YAClC,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,WAAW,GAAG,cAAc,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;QAE7D,OAAO,4BAA4B,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA8C;QAE9C,OAAO,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAC1C,CAAC;CACF","sourcesContent":["import type {\n PayStrategy,\n PayStrategyExecuteRequest,\n PayStrategyGetRefreshIntervalRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types.js';\nimport {\n getMaxBalanceRefreshInterval,\n getPayStrategiesConfig,\n} from '../../utils/feature-flags.js';\nimport { getTransaction } from '../../utils/transaction.js';\nimport { getRelayQuotes } from './relay-quotes.js';\nimport { submitRelayQuotes } from './relay-submit.js';\nimport type { RelayQuote } from './types.js';\n\nexport class RelayStrategy implements PayStrategy<RelayQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n return config.relay.enabled;\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<RelayQuote>[]> {\n return getRelayQuotes(request);\n }\n\n async getRefreshInterval(\n request: PayStrategyGetRefreshIntervalRequest,\n ): Promise<number | undefined> {\n const { messenger, transactionId } = request;\n const transactionData = messenger.call('TransactionPayController:getState')\n .transactionData[transactionId];\n\n if (!transactionData?.isMaxAmount) {\n return undefined;\n }\n\n const transaction = getTransaction(transactionId, messenger);\n\n return getMaxBalanceRefreshInterval(messenger, transaction);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<RelayQuote>,\n ): ReturnType<PayStrategy<RelayQuote>['execute']> {\n return await submitRelayQuotes(request);\n }\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -542,6 +542,8 @@ export type PayStrategyGetRefreshIntervalRequest = {
542
542
  chainId: Hex;
543
543
  /** Controller messenger. */
544
544
  messenger: TransactionPayControllerMessenger;
545
+ /** ID of the transaction whose refresh interval is being resolved. */
546
+ transactionId: string;
545
547
  };
546
548
  /** Strategy used to obtain required tokens for a transaction. */
547
549
  export type PayStrategy<OriginalQuote> = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,KAAK,EACV,8BAA8B,EAC9B,gCAAgC,EACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,+BAA+B,EAC/B,uCAAuC,EACvC,4BAA4B,EAC5B,YAAY,EACb,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,mDAAmD,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,KAAK,EAAE,uDAAuD,EAAE,MAAM,8BAA8B,CAAC;AAC5G,OAAO,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,KAAK,EACV,6BAA6B,EAC7B,qCAAqC,EACtC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AAC1G,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,8CAA8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"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA8PA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB;IAChE,aAAa;IACb,iBAAiB;IACjB,eAAe;CAChB,CAAC","sourcesContent":["import type { AccountsControllerGetStateAction } from '@metamask/accounts-controller';\nimport type {\n AssetsControllerGetStateAction,\n AssetsControllerStateChangeEvent,\n} from '@metamask/assets-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerSignTypedMessageAction,\n KeyringControllerUnlockEvent,\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 RampsControllerGetQuoteWithFeesAction,\n} from '@metamask/ramps-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SentinelApiServiceActions } from '@metamask/sentinel-api-service';\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 TransactionPayClientId,\n TransactionPayStrategy,\n} from './constants.js';\nimport type { TransactionPayControllerMethodActions } from './TransactionPayController-method-action-types.js';\n\nexport type AllowedActions =\n | AccountsControllerGetStateAction\n | AssetsControllerGetStateAction\n | GetGasFeeState\n | KeyringControllerGetStateAction\n | KeyringControllerSignTypedMessageAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | RampsControllerGetOrderAction\n | RampsControllerGetQuoteWithFeesAction\n | RemoteFeatureFlagControllerGetStateAction\n | SentinelApiServiceActions\n | TransactionControllerAddTransactionAction\n | TransactionControllerAddTransactionBatchAction\n | TransactionControllerEstimateGasAction\n | TransactionControllerEstimateGasBatchAction\n | TransactionControllerGetGasFeeTokensAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction;\n\nexport type AllowedEvents =\n | AssetsControllerStateChangeEvent\n | KeyringControllerUnlockEvent\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 target transaction (or `paymentOverride` batch) is executed\n * atomically with the Relay quote. Defaults to `true` (embedded in the quote\n * and executed by the Relay solver). When `false`, Pay does not embed the\n * target/override calls in the quote; the quote only bridges the required\n * asset to `recipient`, and the calls are submitted separately after Relay\n * completion. Used by flows whose second-leg amount is only known after\n * Relay settles (EXACT_INPUT max flows) or that require the second leg to\n * originate from a different signer than the Relay solver.\n * For max deposits enabled by `payStrategies.relay.atomicMaxEnabled`, this\n * is a subsidy hint: atomic quotes are retried non-atomically if not\n * subsidized, and subsidized non-atomic quotes are upgraded to atomic.\n */\n atomic?: boolean;\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 /** When true, a quote is always fetched even when the source and target tokens are identical. */\n isQuoteRequired?: boolean;\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 /** Optional recipient address for the funding token transfer. */\n recipient?: Hex;\n\n /** Optional EIP-7702 authorization list from delegation. */\n authorizationList?: AuthorizationList;\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/** Request passed to {@link GetBalanceCallback}. */\nexport type GetBalanceRequest = {\n /** Metadata of the transaction whose source balance is being resolved. */\n transaction: TransactionMeta;\n /** Pay-controller state for the transaction. */\n transactionData: TransactionData;\n};\n\n/** Balance override returned by {@link GetBalanceCallback}. */\nexport type GetBalanceResponse = {\n /** Balance in atomic format without factoring token decimals. */\n balanceRaw: string;\n};\n\n/**\n * Optional client-supplied callback that overrides the built-in\n * pay-token / required-token balance lookup used for `isMaxAmount`\n * source-amount calculation. Enables alternate balance sources\n * (perps, predict, money-account, post-quote, etc.) without adding\n * conditional branches inside the controller. MUST be synchronous:\n * it runs inside the controller state-update block.\n * Return `undefined` to fall back to the built-in token balance.\n */\nexport type GetBalanceCallback = (\n request: GetBalanceRequest,\n) => GetBalanceResponse | undefined;\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 /**\n * Identifies the MetaMask client, sent as the `X-Client-Id` header on\n * requests to the intents API so the server can distinguish Mobile from\n * Extension traffic.\n */\n clientId?: TransactionPayClientId;\n\n /** Optional callback to re-encode nested transaction calldata for a given amount. */\n getAmountData?: GetAmountDataCallback;\n\n /** Optional callback to override the source balance used for max-amount calculation. */\n getBalance?: GetBalanceCallback;\n\n /** Callback to convert a transaction into a redeem delegation. */\n getDelegationTransaction: GetDelegationTransactionCallback;\n\n /** Optional fiat execution configuration. */\n fiatOptions?: TransactionPayFiatOptions;\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/** Optional fiat execution configuration. */\nexport type TransactionPayFiatOptions = {\n /** Test funding source used to bypass fiat on-ramp execution during local QA. */\n testFundingSource?: Hex;\n\n /** Optional human amount to transfer from the test funding source. */\n testAmountOverride?: string;\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 /**\n * Whether the target transaction is executed atomically with the Relay\n * quote. See {@link TransactionConfig.atomic}.\n */\n atomic?: boolean;\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 /** When true, a quote is always fetched even when the source and target tokens are identical. */\n isQuoteRequired?: boolean;\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 /** Most relevant structured validation error from the latest quote attempt. */\n quoteError?: QuoteErrorInfo;\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/**\n * Machine-readable discriminator for a quote validation failure.\n *\n * Used for analytics and tests. Human-readable copy is carried by `message`\n * and `detail` on {@link QuoteErrorInfo}.\n */\nexport type QuoteErrorReason =\n /**\n * @deprecated No longer emitted. An unreadable live balance is treated as\n * unknown rather than insufficient, so it no longer blocks the quote. Kept\n * so existing consumers and historical analytics still type-check.\n */\n | 'balance-unavailable'\n | 'insufficient-source-balance'\n | 'insufficient-transfer-balance'\n | 'no-quotes'\n | 'simulation-failed';\n\n/**\n * Structured description of why a quote failed validation.\n *\n * `message` and `detail` are formatted (English) copy ready to display; `reason`\n * is a machine-readable discriminator for analytics and tests.\n */\nexport type QuoteErrorInfo = {\n /** Short, display-ready summary of the failure. */\n message: string;\n\n /** Machine-readable discriminator for the failure. */\n reason: QuoteErrorReason;\n\n /** Optional display-ready detail rows (e.g. Required / Current / Missing). */\n detail?: string[];\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 /**\n * Whether the target transaction is executed atomically with the Relay\n * quote. See {@link TransactionConfig.atomic}.\n */\n atomic?: boolean;\n\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 /** Whether this quote is the direct mUSD-to-Money-Account fiat flow. */\n isDirectMusdMoneyAccount?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /** Optional recipient address for Relay requests. When set, overrides the default `from` address. */\n recipient?: Hex;\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 /** Whether to skip processTransactions in relay-quotes. Defaults to `isPostQuote`. */\n skipProcessTransactions?: boolean;\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 * One-time HyperLiquid activation fee (USD) reserved from the source amount\n * for an unactivated HyperCore account. The source amount sent to the\n * provider is reduced by this amount so HyperLiquid retains enough balance\n * for the fee, and the amount is surfaced as part of the provider fee.\n */\n hyperliquidActivationFeeUsd?: string;\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 /** Whether fees are subtracted from the destination amount, meaning the input amount is static. */\n isInputBased?: boolean;\n\n /** Whether the reported fees are already included in the source amount. */\n areFeesIncludedInSourceAmount?: boolean;\n\n /** Raw quote data returned by the provider. */\n original: OriginalQuote;\n\n /** Associated quote request. */\n request: QuoteRequest;\n\n /**\n * Whether the target calls could not be embedded in the quote and must be\n * submitted separately, on the target chain, once the quote settles.\n *\n * Set by the strategy at quote time, since only it knows whether the provider\n * accepted the calls. {@link TransactionConfig.atomic} is a hint rather than\n * a guarantee: a quote requested atomically still falls back to a second leg\n * when the provider cannot execute the calls itself.\n */\n requiresSecondLeg?: boolean;\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 /**\n * Resolved wallet address for the transaction.\n * This is `accountOverride ?? txParams.from`, pre-computed by the quote\n * orchestrator so that individual strategies do not need to re-derive it.\n */\n from: Hex;\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 /** Whether the selected quotes subtract fees from the destination amount, meaning the input amount is static. */\n isInputBased?: boolean;\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 isSubsidized,\n}: {\n transaction: TransactionMeta;\n isSubsidized?: boolean;\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.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA8PA;;;GAGG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAwB;IAChE,aAAa;IACb,iBAAiB;IACjB,eAAe;CAChB,CAAC","sourcesContent":["import type { AccountsControllerGetStateAction } from '@metamask/accounts-controller';\nimport type {\n AssetsControllerGetStateAction,\n AssetsControllerStateChangeEvent,\n} from '@metamask/assets-controller';\nimport type { ControllerStateChangeEvent } from '@metamask/base-controller';\nimport type { ControllerGetStateAction } from '@metamask/base-controller';\nimport type { GetGasFeeState } from '@metamask/gas-fee-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerSignTypedMessageAction,\n KeyringControllerUnlockEvent,\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 RampsControllerGetQuoteWithFeesAction,\n} from '@metamask/ramps-controller';\nimport type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote-feature-flag-controller';\nimport type { SentinelApiServiceActions } from '@metamask/sentinel-api-service';\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 TransactionPayClientId,\n TransactionPayStrategy,\n} from './constants.js';\nimport type { TransactionPayControllerMethodActions } from './TransactionPayController-method-action-types.js';\n\nexport type AllowedActions =\n | AccountsControllerGetStateAction\n | AssetsControllerGetStateAction\n | GetGasFeeState\n | KeyringControllerGetStateAction\n | KeyringControllerSignTypedMessageAction\n | NetworkControllerFindNetworkClientIdByChainIdAction\n | NetworkControllerGetNetworkClientByIdAction\n | NetworkControllerGetNetworkConfigurationByChainIdAction\n | RampsControllerGetOrderAction\n | RampsControllerGetQuoteWithFeesAction\n | RemoteFeatureFlagControllerGetStateAction\n | SentinelApiServiceActions\n | TransactionControllerAddTransactionAction\n | TransactionControllerAddTransactionBatchAction\n | TransactionControllerEstimateGasAction\n | TransactionControllerEstimateGasBatchAction\n | TransactionControllerGetGasFeeTokensAction\n | TransactionControllerGetStateAction\n | TransactionControllerUpdateTransactionAction;\n\nexport type AllowedEvents =\n | AssetsControllerStateChangeEvent\n | KeyringControllerUnlockEvent\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 target transaction (or `paymentOverride` batch) is executed\n * atomically with the Relay quote. Defaults to `true` (embedded in the quote\n * and executed by the Relay solver). When `false`, Pay does not embed the\n * target/override calls in the quote; the quote only bridges the required\n * asset to `recipient`, and the calls are submitted separately after Relay\n * completion. Used by flows whose second-leg amount is only known after\n * Relay settles (EXACT_INPUT max flows) or that require the second leg to\n * originate from a different signer than the Relay solver.\n * For max deposits enabled by `payStrategies.relay.atomicMaxEnabled`, this\n * is a subsidy hint: atomic quotes are retried non-atomically if not\n * subsidized, and subsidized non-atomic quotes are upgraded to atomic.\n */\n atomic?: boolean;\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 /** When true, a quote is always fetched even when the source and target tokens are identical. */\n isQuoteRequired?: boolean;\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 /** Optional recipient address for the funding token transfer. */\n recipient?: Hex;\n\n /** Optional EIP-7702 authorization list from delegation. */\n authorizationList?: AuthorizationList;\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/** Request passed to {@link GetBalanceCallback}. */\nexport type GetBalanceRequest = {\n /** Metadata of the transaction whose source balance is being resolved. */\n transaction: TransactionMeta;\n /** Pay-controller state for the transaction. */\n transactionData: TransactionData;\n};\n\n/** Balance override returned by {@link GetBalanceCallback}. */\nexport type GetBalanceResponse = {\n /** Balance in atomic format without factoring token decimals. */\n balanceRaw: string;\n};\n\n/**\n * Optional client-supplied callback that overrides the built-in\n * pay-token / required-token balance lookup used for `isMaxAmount`\n * source-amount calculation. Enables alternate balance sources\n * (perps, predict, money-account, post-quote, etc.) without adding\n * conditional branches inside the controller. MUST be synchronous:\n * it runs inside the controller state-update block.\n * Return `undefined` to fall back to the built-in token balance.\n */\nexport type GetBalanceCallback = (\n request: GetBalanceRequest,\n) => GetBalanceResponse | undefined;\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 /**\n * Identifies the MetaMask client, sent as the `X-Client-Id` header on\n * requests to the intents API so the server can distinguish Mobile from\n * Extension traffic.\n */\n clientId?: TransactionPayClientId;\n\n /** Optional callback to re-encode nested transaction calldata for a given amount. */\n getAmountData?: GetAmountDataCallback;\n\n /** Optional callback to override the source balance used for max-amount calculation. */\n getBalance?: GetBalanceCallback;\n\n /** Callback to convert a transaction into a redeem delegation. */\n getDelegationTransaction: GetDelegationTransactionCallback;\n\n /** Optional fiat execution configuration. */\n fiatOptions?: TransactionPayFiatOptions;\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/** Optional fiat execution configuration. */\nexport type TransactionPayFiatOptions = {\n /** Test funding source used to bypass fiat on-ramp execution during local QA. */\n testFundingSource?: Hex;\n\n /** Optional human amount to transfer from the test funding source. */\n testAmountOverride?: string;\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 /**\n * Whether the target transaction is executed atomically with the Relay\n * quote. See {@link TransactionConfig.atomic}.\n */\n atomic?: boolean;\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 /** When true, a quote is always fetched even when the source and target tokens are identical. */\n isQuoteRequired?: boolean;\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 /** Most relevant structured validation error from the latest quote attempt. */\n quoteError?: QuoteErrorInfo;\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/**\n * Machine-readable discriminator for a quote validation failure.\n *\n * Used for analytics and tests. Human-readable copy is carried by `message`\n * and `detail` on {@link QuoteErrorInfo}.\n */\nexport type QuoteErrorReason =\n /**\n * @deprecated No longer emitted. An unreadable live balance is treated as\n * unknown rather than insufficient, so it no longer blocks the quote. Kept\n * so existing consumers and historical analytics still type-check.\n */\n | 'balance-unavailable'\n | 'insufficient-source-balance'\n | 'insufficient-transfer-balance'\n | 'no-quotes'\n | 'simulation-failed';\n\n/**\n * Structured description of why a quote failed validation.\n *\n * `message` and `detail` are formatted (English) copy ready to display; `reason`\n * is a machine-readable discriminator for analytics and tests.\n */\nexport type QuoteErrorInfo = {\n /** Short, display-ready summary of the failure. */\n message: string;\n\n /** Machine-readable discriminator for the failure. */\n reason: QuoteErrorReason;\n\n /** Optional display-ready detail rows (e.g. Required / Current / Missing). */\n detail?: string[];\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 /**\n * Whether the target transaction is executed atomically with the Relay\n * quote. See {@link TransactionConfig.atomic}.\n */\n atomic?: boolean;\n\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 /** Whether this quote is the direct mUSD-to-Money-Account fiat flow. */\n isDirectMusdMoneyAccount?: boolean;\n\n /** Overrides the payment source for the transaction. */\n paymentOverride?: PaymentOverride;\n\n /** Optional recipient address for Relay requests. When set, overrides the default `from` address. */\n recipient?: Hex;\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 /** Whether to skip processTransactions in relay-quotes. Defaults to `isPostQuote`. */\n skipProcessTransactions?: boolean;\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 * One-time HyperLiquid activation fee (USD) reserved from the source amount\n * for an unactivated HyperCore account. The source amount sent to the\n * provider is reduced by this amount so HyperLiquid retains enough balance\n * for the fee, and the amount is surfaced as part of the provider fee.\n */\n hyperliquidActivationFeeUsd?: string;\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 /** Whether fees are subtracted from the destination amount, meaning the input amount is static. */\n isInputBased?: boolean;\n\n /** Whether the reported fees are already included in the source amount. */\n areFeesIncludedInSourceAmount?: boolean;\n\n /** Raw quote data returned by the provider. */\n original: OriginalQuote;\n\n /** Associated quote request. */\n request: QuoteRequest;\n\n /**\n * Whether the target calls could not be embedded in the quote and must be\n * submitted separately, on the target chain, once the quote settles.\n *\n * Set by the strategy at quote time, since only it knows whether the provider\n * accepted the calls. {@link TransactionConfig.atomic} is a hint rather than\n * a guarantee: a quote requested atomically still falls back to a second leg\n * when the provider cannot execute the calls itself.\n */\n requiresSecondLeg?: boolean;\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 /**\n * Resolved wallet address for the transaction.\n * This is `accountOverride ?? txParams.from`, pre-computed by the quote\n * orchestrator so that individual strategies do not need to re-derive it.\n */\n from: Hex;\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 /** ID of the transaction whose refresh interval is being resolved. */\n transactionId: string;\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 /** Whether the selected quotes subtract fees from the destination amount, meaning the input amount is static. */\n isInputBased?: boolean;\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 isSubsidized,\n}: {\n transaction: TransactionMeta;\n isSubsidized?: boolean;\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"]}
@@ -67,6 +67,9 @@ export type AtomicMaxEnabledConfig = {
67
67
  default?: boolean;
68
68
  transactionTypes?: Partial<Record<TransactionType, boolean>>;
69
69
  };
70
+ export type MaxBalanceRefreshIntervalConfig = {
71
+ [key in TransactionType]?: number;
72
+ };
70
73
  export type PayStrategiesConfig = {
71
74
  across: AcrossConfig;
72
75
  server: {
@@ -119,6 +122,7 @@ export declare function getFeatureFlags(messenger: TransactionPayControllerMesse
119
122
  * @returns Stablecoins keyed by chain ID.
120
123
  */
121
124
  export declare function getStablecoins(messenger: TransactionPayControllerMessenger): Record<Hex, Hex[]>;
125
+ export declare function getMaxBalanceRefreshInterval(messenger: TransactionPayControllerMessenger, transaction?: TransactionMeta): number | undefined;
122
126
  /**
123
127
  * Get Pay Strategies configuration.
124
128
  *
@@ -1 +1 @@
1
- {"version":3,"file":"feature-flags.d.ts","sourceRoot":"","sources":["../../src/utils/feature-flags.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAK3C,OAAO,EAGL,sBAAsB,EACvB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,+BAA+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