@metamask-previews/transaction-pay-controller 31.2.1-preview-e80304db4 → 31.2.1-preview-1d88b8ba5
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 +23 -1
- package/dist/TransactionPayController.d.ts.map +1 -1
- package/dist/TransactionPayController.js +4 -5
- package/dist/TransactionPayController.js.map +1 -1
- package/dist/actions/update-payment-token.d.ts.map +1 -1
- package/dist/actions/update-payment-token.js +51 -22
- package/dist/actions/update-payment-token.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/strategy/across/AcrossStrategy.d.ts.map +1 -1
- package/dist/strategy/across/AcrossStrategy.js +6 -1
- package/dist/strategy/across/AcrossStrategy.js.map +1 -1
- package/dist/strategy/across/across-quotes.js +7 -4
- package/dist/strategy/across/across-quotes.js.map +1 -1
- package/dist/strategy/across/across-submit.d.ts.map +1 -1
- package/dist/strategy/across/across-submit.js +3 -1
- package/dist/strategy/across/across-submit.js.map +1 -1
- package/dist/strategy/fiat/FiatStrategy.d.ts +1 -0
- package/dist/strategy/fiat/FiatStrategy.d.ts.map +1 -1
- package/dist/strategy/fiat/FiatStrategy.js +4 -0
- package/dist/strategy/fiat/FiatStrategy.js.map +1 -1
- package/dist/strategy/fiat/fiat-direct-musd.d.ts.map +1 -1
- package/dist/strategy/fiat/fiat-direct-musd.js +4 -2
- package/dist/strategy/fiat/fiat-direct-musd.js.map +1 -1
- package/dist/strategy/fiat/fiat-quotes.d.ts.map +1 -1
- package/dist/strategy/fiat/fiat-quotes.js +4 -2
- package/dist/strategy/fiat/fiat-quotes.js.map +1 -1
- package/dist/strategy/fiat/fiat-submit.d.ts.map +1 -1
- package/dist/strategy/fiat/fiat-submit.js +5 -2
- package/dist/strategy/fiat/fiat-submit.js.map +1 -1
- package/dist/strategy/fiat/fiat-test-funding.d.ts.map +1 -1
- package/dist/strategy/fiat/fiat-test-funding.js +3 -5
- package/dist/strategy/fiat/fiat-test-funding.js.map +1 -1
- package/dist/strategy/relay/RelayStrategy.d.ts +4 -0
- package/dist/strategy/relay/RelayStrategy.d.ts.map +1 -1
- package/dist/strategy/relay/RelayStrategy.js +6 -1
- package/dist/strategy/relay/RelayStrategy.js.map +1 -1
- package/dist/strategy/relay/relay-quotes.d.ts.map +1 -1
- package/dist/strategy/relay/relay-quotes.js +10 -6
- package/dist/strategy/relay/relay-quotes.js.map +1 -1
- package/dist/strategy/relay/relay-submit-execute.d.ts.map +1 -1
- package/dist/strategy/relay/relay-submit-execute.js +3 -1
- package/dist/strategy/relay/relay-submit-execute.js.map +1 -1
- package/dist/strategy/relay/relay-submit.d.ts.map +1 -1
- package/dist/strategy/relay/relay-submit.js +8 -6
- package/dist/strategy/relay/relay-submit.js.map +1 -1
- package/dist/strategy/relay/relay-validation.d.ts.map +1 -1
- package/dist/strategy/relay/relay-validation.js +5 -2
- package/dist/strategy/relay/relay-validation.js.map +1 -1
- package/dist/strategy/server/ServerStrategy.d.ts.map +1 -1
- package/dist/strategy/server/ServerStrategy.js +4 -0
- package/dist/strategy/server/ServerStrategy.js.map +1 -1
- package/dist/strategy/server/server-quotes.d.ts.map +1 -1
- package/dist/strategy/server/server-quotes.js +54 -11
- package/dist/strategy/server/server-quotes.js.map +1 -1
- package/dist/strategy/server/server-submit.d.ts.map +1 -1
- package/dist/strategy/server/server-submit.js +9 -6
- package/dist/strategy/server/server-submit.js.map +1 -1
- package/dist/strategy/server/server-support.d.ts +1 -3
- package/dist/strategy/server/server-support.d.ts.map +1 -1
- package/dist/strategy/server/server-support.js +0 -5
- package/dist/strategy/server/server-support.js.map +1 -1
- package/dist/strategy/server/server-validation.d.ts.map +1 -1
- package/dist/strategy/server/server-validation.js +3 -1
- package/dist/strategy/server/server-validation.js.map +1 -1
- package/dist/types.d.ts +60 -25
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/account.d.ts +54 -0
- package/dist/utils/account.d.ts.map +1 -1
- package/dist/utils/account.js +124 -0
- package/dist/utils/account.js.map +1 -1
- package/dist/utils/gas-payment.d.ts +12 -3
- package/dist/utils/gas-payment.d.ts.map +1 -1
- package/dist/utils/gas-payment.js +2 -2
- package/dist/utils/gas-payment.js.map +1 -1
- package/dist/utils/max-gas-station.d.ts.map +1 -1
- package/dist/utils/max-gas-station.js +9 -5
- package/dist/utils/max-gas-station.js.map +1 -1
- package/dist/utils/max-quote.js +3 -2
- package/dist/utils/max-quote.js.map +1 -1
- package/dist/utils/no-op-quote.d.ts +3 -3
- package/dist/utils/no-op-quote.d.ts.map +1 -1
- package/dist/utils/no-op-quote.js +4 -3
- package/dist/utils/no-op-quote.js.map +1 -1
- package/dist/utils/perps.d.ts.map +1 -1
- package/dist/utils/perps.js +5 -2
- package/dist/utils/perps.js.map +1 -1
- package/dist/utils/post-quote.js +4 -3
- package/dist/utils/post-quote.js.map +1 -1
- package/dist/utils/quotes.d.ts.map +1 -1
- package/dist/utils/quotes.js +99 -25
- package/dist/utils/quotes.js.map +1 -1
- package/dist/utils/source-amounts.d.ts.map +1 -1
- package/dist/utils/source-amounts.js +25 -4
- package/dist/utils/source-amounts.js.map +1 -1
- package/dist/utils/token.d.ts +84 -1
- package/dist/utils/token.d.ts.map +1 -1
- package/dist/utils/token.js +144 -13
- package/dist/utils/token.js.map +1 -1
- package/dist/utils/validation.d.ts.map +1 -1
- package/dist/utils/validation.js +14 -11
- package/dist/utils/validation.js.map +1 -1
- package/package.json +2 -1
|
@@ -18,9 +18,7 @@ export declare enum ServerUnsupportedReason {
|
|
|
18
18
|
/** The parent transaction type is not in the remote-flag allowlist. */
|
|
19
19
|
DisabledTransactionType = "disabledTransactionType",
|
|
20
20
|
/** Reserving the HyperLiquid activation fee is not implemented. */
|
|
21
|
-
HyperliquidActivationFee = "hyperliquidActivationFee"
|
|
22
|
-
/** Two-phase max-amount gas station probing is not implemented. */
|
|
23
|
-
MaxAmount = "maxAmount"
|
|
21
|
+
HyperliquidActivationFee = "hyperliquidActivationFee"
|
|
24
22
|
}
|
|
25
23
|
/**
|
|
26
24
|
* Determine whether the server strategy can handle a set of quote requests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-support.d.ts","sourceRoot":"","sources":["../../../src/strategy/server/server-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,EAAE,eAAe,EAAO,CAAC;AAE9E,4DAA4D;AAC5D,oBAAY,uBAAuB;IACjC,kEAAkE;IAClE,sBAAsB,2BAA2B;IAEjD,uEAAuE;IACvE,uBAAuB,4BAA4B;IAEnD,mEAAmE;IACnE,wBAAwB,6BAA6B;
|
|
1
|
+
{"version":3,"file":"server-support.d.ts","sourceRoot":"","sources":["../../../src/strategy/server/server-support.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAEL,eAAe,EAChB,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,EAAE,eAAe,EAAO,CAAC;AAE9E,4DAA4D;AAC5D,oBAAY,uBAAuB;IACjC,kEAAkE;IAClE,sBAAsB,2BAA2B;IAEjD,uEAAuE;IACvE,uBAAuB,4BAA4B;IAEnD,mEAAmE;IACnE,wBAAwB,6BAA6B;CACtD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,uBAAuB,EACvB,QAAQ,EACR,WAAW,GACZ,EAAE;IACD,uBAAuB,EAAE,eAAe,EAAE,CAAC;IAC3C,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B,GAAG,uBAAuB,GAAG,SAAS,CActC"}
|
|
@@ -18,8 +18,6 @@ export var ServerUnsupportedReason;
|
|
|
18
18
|
ServerUnsupportedReason["DisabledTransactionType"] = "disabledTransactionType";
|
|
19
19
|
/** Reserving the HyperLiquid activation fee is not implemented. */
|
|
20
20
|
ServerUnsupportedReason["HyperliquidActivationFee"] = "hyperliquidActivationFee";
|
|
21
|
-
/** Two-phase max-amount gas station probing is not implemented. */
|
|
22
|
-
ServerUnsupportedReason["MaxAmount"] = "maxAmount";
|
|
23
21
|
})(ServerUnsupportedReason || (ServerUnsupportedReason = {}));
|
|
24
22
|
/**
|
|
25
23
|
* Determine whether the server strategy can handle a set of quote requests.
|
|
@@ -69,9 +67,6 @@ function getRequestUnsupportedReason(request) {
|
|
|
69
67
|
if (request.isDirectMusdMoneyAccount === true) {
|
|
70
68
|
return ServerUnsupportedReason.DirectMusdMoneyAccount;
|
|
71
69
|
}
|
|
72
|
-
if (request.isMaxAmount === true) {
|
|
73
|
-
return ServerUnsupportedReason.MaxAmount;
|
|
74
|
-
}
|
|
75
70
|
return undefined;
|
|
76
71
|
}
|
|
77
72
|
//# sourceMappingURL=server-support.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-support.js","sourceRoot":"","sources":["../../../src/strategy/server/server-support.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAI1C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAsB,EAAE,CAAC;AAE9E,4DAA4D;AAC5D,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"server-support.js","sourceRoot":"","sources":["../../../src/strategy/server/server-support.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,GAEnB,MAAM,kCAAkC,CAAC;AAI1C;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAsB,EAAE,CAAC;AAE9E,4DAA4D;AAC5D,MAAM,CAAN,IAAY,uBASX;AATD,WAAY,uBAAuB;IACjC,kEAAkE;IAClE,4EAAiD,CAAA;IAEjD,uEAAuE;IACvE,8EAAmD,CAAA;IAEnD,mEAAmE;IACnE,gFAAqD,CAAA;AACvD,CAAC,EATW,uBAAuB,KAAvB,uBAAuB,QASlC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,0BAA0B,CAAC,EACzC,uBAAuB,EACvB,QAAQ,EACR,WAAW,GAKZ;IACC,IAAI,CAAC,kBAAkB,CAAC,WAAW,EAAE,uBAAuB,CAAC,EAAE,CAAC;QAC9D,OAAO,uBAAuB,CAAC,uBAAuB,CAAC;IACzD,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,2BAA2B,CAAC,OAAO,CAAC,CAAC;QAEpD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;;;GAMG;AACH,SAAS,2BAA2B,CAClC,OAAqB;IAErB,IAAI,OAAO,CAAC,2BAA2B,KAAK,SAAS,EAAE,CAAC;QACtD,OAAO,uBAAuB,CAAC,wBAAwB,CAAC;IAC1D,CAAC;IAED,IAAI,OAAO,CAAC,wBAAwB,KAAK,IAAI,EAAE,CAAC;QAC9C,OAAO,uBAAuB,CAAC,sBAAsB,CAAC;IACxD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\nimport {\n hasTransactionType,\n TransactionType,\n} from '@metamask/transaction-controller';\n\nimport type { QuoteRequest } from '../../types.js';\n\n/**\n * Parent transaction types enabled for the server strategy by default.\n *\n * Intentionally empty so that turning on `payStrategies.server.enabled` alone\n * never diverts live traffic away from the relay strategy. Flows are opted in\n * one at a time via the `payStrategies.server.enabledTransactionTypes` remote\n * feature flag, which lets a single flow be validated in isolation before the\n * next one is added.\n */\nexport const DEFAULT_SERVER_ENABLED_TRANSACTION_TYPES: TransactionType[] = [];\n\n/** Why the server strategy declined to handle a request. */\nexport enum ServerUnsupportedReason {\n /** The direct mUSD Money Account fiat flow is not implemented. */\n DirectMusdMoneyAccount = 'directMusdMoneyAccount',\n\n /** The parent transaction type is not in the remote-flag allowlist. */\n DisabledTransactionType = 'disabledTransactionType',\n\n /** Reserving the HyperLiquid activation fee is not implemented. */\n HyperliquidActivationFee = 'hyperliquidActivationFee',\n}\n\n/**\n * Determine whether the server strategy can handle a set of quote requests.\n *\n * Gating has two independent layers:\n *\n * 1. A remote-flag allowlist of transaction types, so flows can be rolled out\n * and rolled back one at a time.\n * 2. Code-level capability guards for request shapes the server strategy does\n * not implement yet. These cannot be overridden by the flag; each one is\n * deleted as the corresponding capability lands.\n *\n * A transaction can carry several types across its nested transactions, so\n * both layers match against the transaction and its nested transactions.\n *\n * @param options - Options bag.\n * @param options.enabledTransactionTypes - Transaction types opted in via\n * remote feature flag.\n * @param options.requests - Quote requests for required tokens.\n * @param options.transaction - Metadata of the original target transaction.\n * @returns The first reason the requests are unsupported, or `undefined` if\n * every request is supported.\n */\nexport function getServerUnsupportedReason({\n enabledTransactionTypes,\n requests,\n transaction,\n}: {\n enabledTransactionTypes: TransactionType[];\n requests: QuoteRequest[];\n transaction?: TransactionMeta;\n}): ServerUnsupportedReason | undefined {\n if (!hasTransactionType(transaction, enabledTransactionTypes)) {\n return ServerUnsupportedReason.DisabledTransactionType;\n }\n\n for (const request of requests) {\n const reason = getRequestUnsupportedReason(request);\n\n if (reason) {\n return reason;\n }\n }\n\n return undefined;\n}\n\n/**\n * Determine whether a single quote request uses a capability the server\n * strategy has not implemented yet.\n *\n * @param request - Quote request for a required token.\n * @returns The reason the request is unsupported, or `undefined`.\n */\nfunction getRequestUnsupportedReason(\n request: QuoteRequest,\n): ServerUnsupportedReason | undefined {\n if (request.hyperliquidActivationFeeUsd !== undefined) {\n return ServerUnsupportedReason.HyperliquidActivationFee;\n }\n\n if (request.isDirectMusdMoneyAccount === true) {\n return ServerUnsupportedReason.DirectMusdMoneyAccount;\n }\n\n return undefined;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-validation.d.ts","sourceRoot":"","sources":["../../../src/strategy/server/server-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,OAAO,KAAK,EACV,iCAAiC,EACjC,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"server-validation.d.ts","sourceRoot":"","sources":["../../../src/strategy/server/server-validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAIxE,OAAO,KAAK,EACV,iCAAiC,EACjC,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAyBxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAI9C,MAAM,MAAM,2BAA2B,GAAG;IACxC,SAAS,EAAE,iCAAiC,CAAC;IAC7C,MAAM,EAAE,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;IAC3C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
|
@@ -5,6 +5,7 @@ import { getEIP7702UpgradeContractAddress, isServerValidationEnabled, } from '..
|
|
|
5
5
|
import { GasPaymentMode } from '../../utils/gas-payment.js';
|
|
6
6
|
import { buildPolymarketDepositWalletSimulation, isPredictWithdraw, } from '../../utils/polymarket/withdraw.js';
|
|
7
7
|
import { build7702BatchSimulation, buildCallsSimulation, buildDelegationSimulation, } from '../../utils/simulation.js';
|
|
8
|
+
import { getEvmQuoteSource } from '../../utils/token.js';
|
|
8
9
|
import { validateQuotes } from '../../utils/validation.js';
|
|
9
10
|
import { getServerDepositData } from './deposit-step.js';
|
|
10
11
|
import { getServerExecuteDelegation, getServerGasPayment, getServerSubmitParams, } from './server-submit.js';
|
|
@@ -67,7 +68,8 @@ function shouldSkipValidation(quote, transaction, messenger) {
|
|
|
67
68
|
return false;
|
|
68
69
|
}
|
|
69
70
|
async function buildServerSimulation(quote, messenger, transaction) {
|
|
70
|
-
const { from,
|
|
71
|
+
const { from, targetChainId } = quote.request;
|
|
72
|
+
const { chainId: sourceChainId } = getEvmQuoteSource(quote.request);
|
|
71
73
|
const context = { from, sourceChainId, targetChainId };
|
|
72
74
|
if (quote.request.isPolymarketDepositWallet) {
|
|
73
75
|
log('Building deposit wallet simulation', context);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-validation.js","sourceRoot":"","sources":["../../../src/strategy/server/server-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,sCAAsC,EACtC,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO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Q,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,aAAa,CAAC,EAAE,CAAC;QACtE,GAAG,CAAC,iDAAiD,EAAE;YACrD,IAAI,EAAE,OAAO,CAAC,IAAI;SACnB,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,6EAA6E;IAC7E,wEAAwE;IACxE,kEAAkE;IAClE,IAAI,sBAAsB,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;QAC/C,GAAG,CAAC,oDAAoD,EAAE;YACxD,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAC;QACH,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,KAAK,UAAU,qBAAqB,CAClC,KAAuC,EACvC,SAA4C,EAC5C,WAA4B;IAE5B,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"server-validation.js","sourceRoot":"","sources":["../../../src/strategy/server/server-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAKhD,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EACL,gCAAgC,EAChC,yBAAyB,GAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EACL,sCAAsC,EACtC,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,iBAAiB,EAAE,MA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CAAC,GAAG;SACxC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,mBAAmB,CAAC,KAAK,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IAEtE,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,CAAC,UAAU,EAAE,CAAC;QAClD,GAAG,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;QAE5C,MAAM,UAAU,GAAG,MAAM,0BAA0B,CACjD,KAAK,EACL,MAAM,EACN,SAAS,EACT,WAAW,CACZ,CAAC;QAEF,OAAO,yBAAyB,CAAC,EAAE,GAAG,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACtD,GAAG,CAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;QAE/C,wEAAwE;QACxE,yEAAyE;QACzE,6DAA6D;QAC7D,wDAAwD;QACxD,OAAO,wBAAwB,CAAC;YAC9B,oBAAoB,EAAE,gCAAgC,CACpD,SAAS,EACT,aAAa,CACd;YACD,KAAK,EAAE,MAAM;YACb,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,GAAG,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;IAE3C,OAAO,oBAAoB,CAAC,MAAM,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\nimport { createModuleLogger } from '@metamask/utils';\n\nimport { projectLogger } from '../../logger.js';\nimport type {\n TransactionPayControllerMessenger,\n TransactionPayQuote,\n} from '../../types.js';\nimport { isMpcMoneyAccountPayer } from '../../utils/account.js';\nimport {\n getEIP7702UpgradeContractAddress,\n isServerValidationEnabled,\n} from '../../utils/feature-flags.js';\nimport { GasPaymentMode } from '../../utils/gas-payment.js';\nimport {\n buildPolymarketDepositWalletSimulation,\n isPredictWithdraw,\n} from '../../utils/polymarket/withdraw.js';\nimport {\n build7702BatchSimulation,\n buildCallsSimulation,\n buildDelegationSimulation,\n} from '../../utils/simulation.js';\nimport type { QuoteSimulation } from '../../utils/simulation.js';\nimport { getEvmQuoteSource } from '../../utils/token.js';\nimport { validateQuotes } from '../../utils/validation.js';\nimport { getServerDepositData } from './deposit-step.js';\nimport {\n getServerExecuteDelegation,\n getServerGasPayment,\n getServerSubmitParams,\n} from './server-submit.js';\nimport type { ServerQuote } from './types.js';\n\nconst log = createModuleLogger(projectLogger, 'server-validation');\n\nexport type ValidateServerQuotesRequest = {\n messenger: TransactionPayControllerMessenger;\n quotes: TransactionPayQuote<ServerQuote>[];\n signal?: AbortSignal;\n transaction: TransactionMeta;\n};\n\n/**\n * Validate server quotes by checking the live source balance and simulating\n * the transactions each quote would submit on the source chain.\n *\n * Gated by the `payStrategies.server.validationEnabled` feature flag.\n *\n * @param request - Validation request.\n */\nexport async function validateServerQuotes(\n request: ValidateServerQuotesRequest,\n): Promise<void> {\n const { messenger, quotes, signal, transaction } = request;\n\n if (!isServerValidationEnabled(messenger, transaction)) {\n return;\n }\n\n await validateQuotes({\n buildSimulation: async (quote) =>\n shouldSkipValidation(quote, transaction, messenger)\n ? undefined\n : await buildServerSimulation(quote, messenger, transaction),\n messenger,\n quotes,\n signal,\n });\n}\n\nfunction shouldSkipValidation(\n quote: TransactionPayQuote<ServerQuote>,\n transaction: TransactionMeta,\n messenger: TransactionPayControllerMessenger,\n): boolean {\n const { request } = quote;\n\n if (request.isHyperliquidSource) {\n log('Skipping quote validation: Hyperliquid source', {\n from: request.from,\n });\n return true;\n }\n\n // Legacy Safe Predict withdraws convert USDC.e to pUSD outside the calls the\n // controller can see, so they cannot be faithfully simulated and are skipped.\n if (\n isPredictWithdraw(request, transaction) &&\n !request.isPolymarketDepositWallet\n ) {\n log('Skipping quote validation: legacy Safe Predict withdraw', {\n from: request.from,\n });\n return true;\n }\n\n if (!quote.original.steps.some((step) => step.type === 'transaction')) {\n log('Skipping quote validation: no transaction steps', {\n from: request.from,\n });\n return true;\n }\n\n // Simulation rebuilds the submit calls, which signs a delegation through the\n // client payment-override callback. Skip that for an MPC Money payer so\n // quote refresh does not prompt for MFA ahead of the real submit.\n if (isMpcMoneyAccountPayer(messenger, request)) {\n log('Skipping quote validation: MPC Money account payer', {\n from: request.from,\n refundTo: request.refundTo,\n });\n return true;\n }\n\n return false;\n}\n\nasync function buildServerSimulation(\n quote: TransactionPayQuote<ServerQuote>,\n messenger: TransactionPayControllerMessenger,\n transaction: TransactionMeta,\n): Promise<QuoteSimulation> {\n const { from, targetChainId } = quote.request;\n const { chainId: sourceChainId } = getEvmQuoteSource(quote.request);\n const context = { from, sourceChainId, targetChainId };\n\n if (quote.request.isPolymarketDepositWallet) {\n log('Building deposit wallet simulation', context);\n\n return await buildPolymarketDepositWalletSimulation({\n depositData: getServerDepositData(quote.original),\n from,\n messenger,\n sourceAmountRaw: quote.sourceAmount.raw,\n });\n }\n\n const params = await getServerSubmitParams(quote, messenger, transaction);\n const gasPayment = getServerGasPayment(quote, messenger, transaction);\n\n if (gasPayment.mode === GasPaymentMode.Delegation) {\n log('Building execute simulation', context);\n\n const delegation = await getServerExecuteDelegation(\n quote,\n params,\n messenger,\n transaction,\n );\n\n return buildDelegationSimulation({ ...delegation, from });\n }\n\n if (params.length > 1 && quote.original.client.is7702) {\n log('Building 7702 batch simulation', context);\n\n // The batch is an ERC-7821 `execute` on the sender's own account, so an\n // authorization is always included as the live upgrade state is unknown.\n // The gas limit is omitted since it was estimated without an\n // authorization for accounts that are already upgraded.\n return build7702BatchSimulation({\n authorizationAddress: getEIP7702UpgradeContractAddress(\n messenger,\n sourceChainId,\n ),\n calls: params,\n from,\n });\n }\n\n log('Building normal simulation', context);\n\n return buildCallsSimulation(params);\n}\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { AccountTreeControllerGetAccountContextAction, AccountTreeControllerGetAccountGroupObjectAction } from '@metamask/account-tree-controller';
|
|
1
2
|
import type { AccountsControllerGetStateAction } from '@metamask/accounts-controller';
|
|
2
3
|
import type { AssetsControllerGetStateAction, AssetsControllerStateChangeEvent } from '@metamask/assets-controller';
|
|
3
4
|
import type { ControllerStateChangeEvent } from '@metamask/base-controller';
|
|
@@ -14,21 +15,27 @@ import type { RemoteFeatureFlagControllerGetStateAction } from '@metamask/remote
|
|
|
14
15
|
import type { SentinelApiServiceActions } from '@metamask/sentinel-api-service';
|
|
15
16
|
import type { AuthorizationList, TransactionControllerAddTransactionBatchAction, TransactionControllerEstimateGasAction, TransactionControllerEstimateGasBatchAction, TransactionControllerUnapprovedTransactionAddedEvent } from '@metamask/transaction-controller';
|
|
16
17
|
import type { BatchTransaction, BatchTransactionParams, TransactionControllerAddTransactionAction, TransactionControllerGetGasFeeTokensAction, TransactionControllerGetStateAction, TransactionControllerStateChangeEvent, TransactionControllerUpdateTransactionAction, TransactionMeta } from '@metamask/transaction-controller';
|
|
17
|
-
import type { Hex, Json } from '@metamask/utils';
|
|
18
|
+
import type { CaipAccountId, CaipAssetType, CaipChainId, Hex, Json } from '@metamask/utils';
|
|
18
19
|
import type { Draft } from 'immer';
|
|
19
20
|
import type { CONTROLLER_NAME, PaymentOverride, TransactionPayClientId, TransactionPayStrategy } from './constants.js';
|
|
20
21
|
import type { TransactionPayControllerMethodActions } from './TransactionPayController-method-action-types.js';
|
|
21
|
-
export type AllowedActions = AccountsControllerGetStateAction | AssetsControllerGetStateAction | GetGasFeeState | KeyringControllerGetStateAction | KeyringControllerSignTypedMessageAction | NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerGetNetworkConfigurationByChainIdAction | RampsControllerGetOrderAction | RampsControllerGetQuoteWithFeesAction | RemoteFeatureFlagControllerGetStateAction | SentinelApiServiceActions | TransactionControllerAddTransactionAction | TransactionControllerAddTransactionBatchAction | TransactionControllerEstimateGasAction | TransactionControllerEstimateGasBatchAction | TransactionControllerGetGasFeeTokensAction | TransactionControllerGetStateAction | TransactionControllerUpdateTransactionAction;
|
|
22
|
+
export type AllowedActions = AccountTreeControllerGetAccountContextAction | AccountTreeControllerGetAccountGroupObjectAction | AccountsControllerGetStateAction | AssetsControllerGetStateAction | GetGasFeeState | KeyringControllerGetStateAction | KeyringControllerSignTypedMessageAction | NetworkControllerFindNetworkClientIdByChainIdAction | NetworkControllerGetNetworkClientByIdAction | NetworkControllerGetNetworkConfigurationByChainIdAction | RampsControllerGetOrderAction | RampsControllerGetQuoteWithFeesAction | RemoteFeatureFlagControllerGetStateAction | SentinelApiServiceActions | TransactionControllerAddTransactionAction | TransactionControllerAddTransactionBatchAction | TransactionControllerEstimateGasAction | TransactionControllerEstimateGasBatchAction | TransactionControllerGetGasFeeTokensAction | TransactionControllerGetStateAction | TransactionControllerUpdateTransactionAction;
|
|
22
23
|
export type AllowedEvents = AssetsControllerStateChangeEvent | KeyringControllerUnlockEvent | TransactionControllerStateChangeEvent | TransactionControllerUnapprovedTransactionAddedEvent;
|
|
23
24
|
export type TransactionPayControllerGetStateAction = ControllerGetStateAction<typeof CONTROLLER_NAME, TransactionPayControllerState>;
|
|
24
25
|
/** Configurable properties of a transaction. */
|
|
25
26
|
export type TransactionConfig = {
|
|
26
27
|
/**
|
|
27
|
-
* Optional
|
|
28
|
+
* Optional ID of an `InternalAccount` to override the default account used
|
|
29
|
+
* by the transaction.
|
|
28
30
|
* When `isPostQuote` is true, used as the recipient of the MM Pay transfer.
|
|
29
31
|
* When `isPostQuote` is false, it provides the funds and pays for gas.
|
|
32
|
+
*
|
|
33
|
+
* An EVM account overrides the EVM account. The account holding a non-EVM
|
|
34
|
+
* payment token is the override account when it supports the payment token
|
|
35
|
+
* chain, otherwise the account in the same account group as the override
|
|
36
|
+
* account, or as the transaction account, that supports that chain.
|
|
30
37
|
*/
|
|
31
|
-
accountOverride?:
|
|
38
|
+
accountOverride?: string;
|
|
32
39
|
/**
|
|
33
40
|
* Whether the target transaction (or `paymentOverride` batch) is executed
|
|
34
41
|
* atomically with the Relay quote. Defaults to `true` (embedded in the quote
|
|
@@ -179,7 +186,7 @@ export type TransactionPayControllerOptions = {
|
|
|
179
186
|
};
|
|
180
187
|
/** State of the TransactionPayController. */
|
|
181
188
|
export type TransactionPayControllerState = {
|
|
182
|
-
/**
|
|
189
|
+
/** Transient state relating to each transaction, keyed by transaction ID. */
|
|
183
190
|
transactionData: Record<string, TransactionData>;
|
|
184
191
|
};
|
|
185
192
|
/** Optional fiat execution configuration. */
|
|
@@ -192,11 +199,17 @@ export type TransactionPayFiatOptions = {
|
|
|
192
199
|
/** State relating to a single transaction. */
|
|
193
200
|
export type TransactionData = {
|
|
194
201
|
/**
|
|
195
|
-
* Optional
|
|
202
|
+
* Optional ID of an `InternalAccount` to override the default account used
|
|
203
|
+
* by the transaction.
|
|
196
204
|
* When `isPostQuote` is true, used as the recipient of the MM Pay transfer.
|
|
197
205
|
* When `isPostQuote` is false, it provides the funds and pays for gas.
|
|
206
|
+
*
|
|
207
|
+
* An EVM account overrides the EVM account. The account holding a non-EVM
|
|
208
|
+
* payment token is the override account when it supports the payment token
|
|
209
|
+
* chain, otherwise the account in the same account group as the override
|
|
210
|
+
* account, or as the transaction account, that supports that chain.
|
|
198
211
|
*/
|
|
199
|
-
accountOverride?:
|
|
212
|
+
accountOverride?: string;
|
|
200
213
|
/**
|
|
201
214
|
* Whether the target transaction is executed atomically with the Relay
|
|
202
215
|
* quote. See {@link TransactionConfig.atomic}.
|
|
@@ -337,8 +350,11 @@ export type QuoteErrorInfo = {
|
|
|
337
350
|
};
|
|
338
351
|
/** Source token used to pay for required tokens. */
|
|
339
352
|
export type TransactionPaymentToken = {
|
|
340
|
-
/**
|
|
341
|
-
|
|
353
|
+
/**
|
|
354
|
+
* CAIP-19 asset type of the payment token, as keyed in `AssetsController`
|
|
355
|
+
* state. The chain and, for EVM tokens, the token address are derived from it.
|
|
356
|
+
*/
|
|
357
|
+
assetId: CaipAssetType;
|
|
342
358
|
/** Balance of the payment token in the selected currency. */
|
|
343
359
|
balanceFiat: string;
|
|
344
360
|
/** Balance of the payment token in a human-readable format factoring token decimals. */
|
|
@@ -347,13 +363,21 @@ export type TransactionPaymentToken = {
|
|
|
347
363
|
balanceRaw: string;
|
|
348
364
|
/** Balance of the payment token in USD. */
|
|
349
365
|
balanceUsd: string;
|
|
350
|
-
/** Chain ID of the payment token. */
|
|
351
|
-
chainId: Hex;
|
|
352
366
|
/** Decimals of the payment token. */
|
|
353
367
|
decimals: number;
|
|
354
368
|
/** Symbol of the payment token. */
|
|
355
369
|
symbol: string;
|
|
356
370
|
};
|
|
371
|
+
/**
|
|
372
|
+
* Payment token on an EVM chain, with its chain ID and token address derived
|
|
373
|
+
* from its asset ID. Used internally by the EVM quote and balance paths.
|
|
374
|
+
*/
|
|
375
|
+
export type EvmPaymentToken = TransactionPaymentToken & {
|
|
376
|
+
/** Address of the payment token, derived from its asset ID. */
|
|
377
|
+
address: Hex;
|
|
378
|
+
/** Chain ID of the payment token, derived from its asset ID. */
|
|
379
|
+
chainId: Hex;
|
|
380
|
+
};
|
|
357
381
|
/** Callback to update state for a single transaction. */
|
|
358
382
|
export type UpdateTransactionDataCallback = (
|
|
359
383
|
/** ID of the transaction to update. */
|
|
@@ -367,7 +391,14 @@ export type FiatRates = {
|
|
|
367
391
|
/** Conversion rate for the native currency to USD. */
|
|
368
392
|
usdRate: string;
|
|
369
393
|
};
|
|
370
|
-
/**
|
|
394
|
+
/**
|
|
395
|
+
* Request for a quote to retrieve a required token.
|
|
396
|
+
*
|
|
397
|
+
* The source is identified by its CAIP-19 asset type and CAIP-10 account for
|
|
398
|
+
* every protocol. Strategies support or reject a request based on the
|
|
399
|
+
* protocol of `sourceAssetId`, and EVM strategies derive the Hex chain ID and
|
|
400
|
+
* token address from it.
|
|
401
|
+
*/
|
|
371
402
|
export type QuoteRequest = {
|
|
372
403
|
/**
|
|
373
404
|
* Selected account receiving post-quote output.
|
|
@@ -403,12 +434,15 @@ export type QuoteRequest = {
|
|
|
403
434
|
refundTo?: Hex;
|
|
404
435
|
/** Whether to skip processTransactions in relay-quotes. Defaults to `isPostQuote`. */
|
|
405
436
|
skipProcessTransactions?: boolean;
|
|
437
|
+
/** CAIP-10 account ID of the account holding the source token. */
|
|
438
|
+
sourceAccountId: CaipAccountId;
|
|
439
|
+
/**
|
|
440
|
+
* CAIP-19 asset type of the source token. The protocol of its chain selects
|
|
441
|
+
* the strategy execution path.
|
|
442
|
+
*/
|
|
443
|
+
sourceAssetId: CaipAssetType;
|
|
406
444
|
/** Balance of the source token in atomic format without factoring token decimals. */
|
|
407
445
|
sourceBalanceRaw: string;
|
|
408
|
-
/** Chain ID of the source token. */
|
|
409
|
-
sourceChainId: Hex;
|
|
410
|
-
/** Address of the source token. */
|
|
411
|
-
sourceTokenAddress: Hex;
|
|
412
446
|
/** Amount of the required token in atomic format without factoring token decimals. */
|
|
413
447
|
sourceTokenAmount: string;
|
|
414
448
|
/** Minimum amount required of the target token in atomic format without factoring token decimals. */
|
|
@@ -492,7 +526,10 @@ export type PayStrategyGetQuotesRequest = {
|
|
|
492
526
|
from: Hex;
|
|
493
527
|
/** Controller messenger. */
|
|
494
528
|
messenger: TransactionPayControllerMessenger;
|
|
495
|
-
/**
|
|
529
|
+
/**
|
|
530
|
+
* Quote requests for required tokens. Strategies support or reject the
|
|
531
|
+
* requests based on the protocol of their `sourceAssetId`.
|
|
532
|
+
*/
|
|
496
533
|
requests: QuoteRequest[];
|
|
497
534
|
/**
|
|
498
535
|
* Signal that aborts when a newer quote request supersedes this one.
|
|
@@ -504,7 +541,7 @@ export type PayStrategyGetQuotesRequest = {
|
|
|
504
541
|
transaction: TransactionMeta;
|
|
505
542
|
};
|
|
506
543
|
/** Request to submit quotes for a transaction. */
|
|
507
|
-
export type PayStrategyExecuteRequest<
|
|
544
|
+
export type PayStrategyExecuteRequest<OriginalQuote> = {
|
|
508
545
|
/** Whether the account supports EIP-7702 authorization signing. */
|
|
509
546
|
accountSupports7702: boolean;
|
|
510
547
|
/** Callback to determine if the transaction is a smart transaction. */
|
|
@@ -512,7 +549,7 @@ export type PayStrategyExecuteRequest<OriginalRequest> = {
|
|
|
512
549
|
/** Controller messenger. */
|
|
513
550
|
messenger: TransactionPayControllerMessenger;
|
|
514
551
|
/** Quotes to be submitted. */
|
|
515
|
-
quotes: TransactionPayQuote<
|
|
552
|
+
quotes: TransactionPayQuote<OriginalQuote>[];
|
|
516
553
|
/** Metadata of the original target transaction. */
|
|
517
554
|
transaction: TransactionMeta;
|
|
518
555
|
};
|
|
@@ -538,8 +575,8 @@ export type PayStrategyCheckQuoteSupportRequest<OriginalQuote> = {
|
|
|
538
575
|
};
|
|
539
576
|
/** Request to get refresh interval for a specific strategy. */
|
|
540
577
|
export type PayStrategyGetRefreshIntervalRequest = {
|
|
541
|
-
/**
|
|
542
|
-
chainId:
|
|
578
|
+
/** CAIP-2 chain ID of the source asset. */
|
|
579
|
+
chainId: CaipChainId;
|
|
543
580
|
/** Controller messenger. */
|
|
544
581
|
messenger: TransactionPayControllerMessenger;
|
|
545
582
|
/** ID of the transaction whose refresh interval is being resolved. */
|
|
@@ -601,10 +638,8 @@ export type TransactionPayTotals = {
|
|
|
601
638
|
export type UpdatePaymentTokenRequest = {
|
|
602
639
|
/** ID of the transaction to update. */
|
|
603
640
|
transactionId: string;
|
|
604
|
-
/**
|
|
605
|
-
|
|
606
|
-
/** Chain ID of the new payment token. */
|
|
607
|
-
chainId: Hex;
|
|
641
|
+
/** CAIP-19 asset type of the new payment token. */
|
|
642
|
+
assetId: CaipAssetType;
|
|
608
643
|
};
|
|
609
644
|
/** Request to update fiat payment state for a transaction. */
|
|
610
645
|
export type UpdateFiatPaymentRequest = {
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":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ings":"","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} 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/** 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 * Selected account receiving post-quote output.\n * See {@link TransactionConfig.accountOverride}.\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 /** 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 * Account sending the quotes: `txParams.from` for post-quote flows,\n * otherwise `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"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AccountTreeControllerGetAccountContextAction,\n AccountTreeControllerGetAccountGroupObjectAction,\n} from '@metamask/account-tree-controller';\nimport 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} 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 {\n CaipAccountId,\n CaipAssetType,\n CaipChainId,\n Hex,\n Json,\n} 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 | AccountTreeControllerGetAccountContextAction\n | AccountTreeControllerGetAccountGroupObjectAction\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 ID of an `InternalAccount` to override the default account used\n * 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 * An EVM account overrides the EVM account. The account holding a non-EVM\n * payment token is the override account when it supports the payment token\n * chain, otherwise the account in the same account group as the override\n * account, or as the transaction account, that supports that chain.\n */\n accountOverride?: string;\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/** 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 /** Transient 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 ID of an `InternalAccount` to override the default account used\n * 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 * An EVM account overrides the EVM account. The account holding a non-EVM\n * payment token is the override account when it supports the payment token\n * chain, otherwise the account in the same account group as the override\n * account, or as the transaction account, that supports that chain.\n */\n accountOverride?: string;\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 /**\n * CAIP-19 asset type of the payment token, as keyed in `AssetsController`\n * state. The chain and, for EVM tokens, the token address are derived from it.\n */\n assetId: CaipAssetType;\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 /** Decimals of the payment token. */\n decimals: number;\n\n /** Symbol of the payment token. */\n symbol: string;\n};\n\n/**\n * Payment token on an EVM chain, with its chain ID and token address derived\n * from its asset ID. Used internally by the EVM quote and balance paths.\n */\nexport type EvmPaymentToken = TransactionPaymentToken & {\n /** Address of the payment token, derived from its asset ID. */\n address: Hex;\n\n /** Chain ID of the payment token, derived from its asset ID. */\n chainId: Hex;\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/**\n * Request for a quote to retrieve a required token.\n *\n * The source is identified by its CAIP-19 asset type and CAIP-10 account for\n * every protocol. Strategies support or reject a request based on the\n * protocol of `sourceAssetId`, and EVM strategies derive the Hex chain ID and\n * token address from it.\n */\nexport type QuoteRequest = {\n /**\n * Selected account receiving post-quote output.\n * See {@link TransactionConfig.accountOverride}.\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 /** 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 /** CAIP-10 account ID of the account holding the source token. */\n sourceAccountId: CaipAccountId;\n\n /**\n * CAIP-19 asset type of the source token. The protocol of its chain selects\n * the strategy execution path.\n */\n sourceAssetId: CaipAssetType;\n\n /** Balance of the source token in atomic format without factoring token decimals. */\n sourceBalanceRaw: string;\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 * Account sending the quotes: `txParams.from` for post-quote flows,\n * otherwise `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 /**\n * Quote requests for required tokens. Strategies support or reject the\n * requests based on the protocol of their `sourceAssetId`.\n */\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<OriginalQuote> = {\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<OriginalQuote>[];\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 /** CAIP-2 chain ID of the source asset. */\n chainId: CaipChainId;\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 /** CAIP-19 asset type of the new payment token. */\n assetId: CaipAssetType;\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"]}
|