@metamask/transaction-pay-controller 22.2.0 → 22.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +36 -1
  2. package/dist/constants.cjs +6 -2
  3. package/dist/constants.cjs.map +1 -1
  4. package/dist/constants.d.cts +1 -0
  5. package/dist/constants.d.cts.map +1 -1
  6. package/dist/constants.d.mts +1 -0
  7. package/dist/constants.d.mts.map +1 -1
  8. package/dist/constants.mjs +5 -1
  9. package/dist/constants.mjs.map +1 -1
  10. package/dist/strategy/across/AcrossStrategy.cjs +6 -5
  11. package/dist/strategy/across/AcrossStrategy.cjs.map +1 -1
  12. package/dist/strategy/across/AcrossStrategy.d.cts.map +1 -1
  13. package/dist/strategy/across/AcrossStrategy.d.mts.map +1 -1
  14. package/dist/strategy/across/AcrossStrategy.mjs +6 -5
  15. package/dist/strategy/across/AcrossStrategy.mjs.map +1 -1
  16. package/dist/strategy/across/authorization-list.cjs +25 -0
  17. package/dist/strategy/across/authorization-list.cjs.map +1 -0
  18. package/dist/strategy/across/authorization-list.d.cts +16 -0
  19. package/dist/strategy/across/authorization-list.d.cts.map +1 -0
  20. package/dist/strategy/across/authorization-list.d.mts +16 -0
  21. package/dist/strategy/across/authorization-list.d.mts.map +1 -0
  22. package/dist/strategy/across/authorization-list.mjs +21 -0
  23. package/dist/strategy/across/authorization-list.mjs.map +1 -0
  24. package/dist/strategy/across/requests.cjs +1 -0
  25. package/dist/strategy/across/requests.cjs.map +1 -1
  26. package/dist/strategy/across/requests.d.cts.map +1 -1
  27. package/dist/strategy/across/requests.d.mts.map +1 -1
  28. package/dist/strategy/across/requests.mjs +1 -0
  29. package/dist/strategy/across/requests.mjs.map +1 -1
  30. package/dist/strategy/relay/relay-quotes.cjs +18 -1
  31. package/dist/strategy/relay/relay-quotes.cjs.map +1 -1
  32. package/dist/strategy/relay/relay-quotes.mjs +18 -1
  33. package/dist/strategy/relay/relay-quotes.mjs.map +1 -1
  34. package/dist/strategy/relay/relay-submit.cjs +37 -7
  35. package/dist/strategy/relay/relay-submit.cjs.map +1 -1
  36. package/dist/strategy/relay/relay-submit.mjs +37 -7
  37. package/dist/strategy/relay/relay-submit.mjs.map +1 -1
  38. package/dist/types.cjs.map +1 -1
  39. package/dist/types.d.cts +6 -6
  40. package/dist/types.d.mts +6 -6
  41. package/dist/types.mjs.map +1 -1
  42. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -7,6 +7,39 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [22.3.1]
11
+
12
+ ### Changed
13
+
14
+ - Bump `@metamask/assets-controller` from `^7.1.0` to `^7.1.1` ([#8774](https://github.com/MetaMask/core/pull/8774))
15
+ - Bump `@metamask/assets-controllers` from `^107.0.0` to `^108.0.0` ([#8774](https://github.com/MetaMask/core/pull/8774))
16
+ - Bump `@metamask/bridge-controller` from `^72.0.3` to `^72.0.4` ([#8774](https://github.com/MetaMask/core/pull/8774))
17
+ - Bump `@metamask/bridge-status-controller` from `^71.1.3` to `^71.1.4` ([#8774](https://github.com/MetaMask/core/pull/8774))
18
+ - Bump `@metamask/network-controller` from `^31.1.0` to `^32.0.0` ([#8774](https://github.com/MetaMask/core/pull/8774))
19
+ - Bump `@metamask/controller-utils` from `^12.0.0` to `^12.1.0` ([#8774](https://github.com/MetaMask/core/pull/8774))
20
+
21
+ ## [22.3.0]
22
+
23
+ ### Added
24
+
25
+ - Add `POLYGON_PUSD_ADDRESS` constant and treat Polymarket pUSD as a Polygon stablecoin in display/fiat-rate logic ([#8735](https://github.com/MetaMask/core/pull/8735))
26
+ - Add Across strategy plumbing to identify post-quote Predict withdraw requests ([#8759](https://github.com/MetaMask/core/pull/8759))
27
+
28
+ ### Changed
29
+
30
+ - Bump `@metamask/network-controller` from `^31.0.0` to `^31.1.0` ([#8765](https://github.com/MetaMask/core/pull/8765))
31
+ - Bump `@metamask/assets-controller` from `^7.0.1` to `^7.1.0` ([#8773](https://github.com/MetaMask/core/pull/8773))
32
+ - Bump `@metamask/assets-controllers` from `^106.0.1` to `^107.0.0` ([#8773](https://github.com/MetaMask/core/pull/8773))
33
+ - Bump `@metamask/bridge-controller` from `^72.0.2` to `^72.0.3` ([#8773](https://github.com/MetaMask/core/pull/8773))
34
+ - Bump `@metamask/bridge-status-controller` from `^71.1.2` to `^71.1.3` ([#8773](https://github.com/MetaMask/core/pull/8773))
35
+
36
+ ### Fixed
37
+
38
+ - Predict same-chain withdraw quote no longer falls back to block-gas-limit (~30M+) on swap-only Relay routes ([#8735](https://github.com/MetaMask/core/pull/8735))
39
+ - `fromOverride = Safe proxy` is now gated on the route having a `deposit` step. Same-chain destinations route through DEX swap aggregators that reject contract callers (anti-MEV `msg.sender == tx.origin` checks etc.) — for those, the relay params' EOA `from` is used so simulation succeeds.
40
+ - Gas-fee-token lookup still uses the Safe proxy for ALL Predict withdraws (gated on `isPredictWithdraw && refundTo`), preserving the gasless flow for users who hold pUSD in the Safe but no native POL on the EOA.
41
+ - Fix post-quote relay submission when `accountOverride` is set by replacing the prepended original transaction with a delegation transaction so the override account can submit it ([#8615](https://github.com/MetaMask/core/pull/8615))
42
+
10
43
  ## [22.2.0]
11
44
 
12
45
  ### Changed
@@ -834,7 +867,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
834
867
 
835
868
  - Initial release ([#6820](https://github.com/MetaMask/core/pull/6820))
836
869
 
837
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.2.0...HEAD
870
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.3.1...HEAD
871
+ [22.3.1]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.3.0...@metamask/transaction-pay-controller@22.3.1
872
+ [22.3.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.2.0...@metamask/transaction-pay-controller@22.3.0
838
873
  [22.2.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.1.0...@metamask/transaction-pay-controller@22.2.0
839
874
  [22.1.0]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.0.2...@metamask/transaction-pay-controller@22.1.0
840
875
  [22.0.2]: https://github.com/MetaMask/core/compare/@metamask/transaction-pay-controller@22.0.1...@metamask/transaction-pay-controller@22.0.2
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTransactionPayStrategy = exports.TransactionPayStrategy = exports.STABLECOINS = exports.SLIP44_COIN_TYPE_BY_CHAIN = exports.USDC_DECIMALS = exports.HYPERCORE_USDC_DECIMALS = exports.HYPERCORE_USDC_ADDRESS = exports.POLYGON_USDCE_ADDRESS = exports.ARBITRUM_USDC_ADDRESS = exports.NATIVE_TOKEN_ADDRESS = exports.CHAIN_ID_HYPERCORE = exports.CHAIN_ID_POLYGON = exports.CHAIN_ID_MAINNET = exports.CHAIN_ID_ARBITRUM = exports.CONTROLLER_NAME = void 0;
3
+ exports.isTransactionPayStrategy = exports.TransactionPayStrategy = exports.STABLECOINS = exports.SLIP44_COIN_TYPE_BY_CHAIN = exports.USDC_DECIMALS = exports.HYPERCORE_USDC_DECIMALS = exports.HYPERCORE_USDC_ADDRESS = exports.POLYGON_PUSD_ADDRESS = exports.POLYGON_USDCE_ADDRESS = exports.ARBITRUM_USDC_ADDRESS = exports.NATIVE_TOKEN_ADDRESS = exports.CHAIN_ID_HYPERCORE = exports.CHAIN_ID_POLYGON = exports.CHAIN_ID_MAINNET = exports.CHAIN_ID_ARBITRUM = exports.CONTROLLER_NAME = void 0;
4
4
  exports.CONTROLLER_NAME = 'TransactionPayController';
5
5
  exports.CHAIN_ID_ARBITRUM = '0xa4b1';
6
6
  exports.CHAIN_ID_MAINNET = '0x1';
@@ -9,6 +9,7 @@ exports.CHAIN_ID_HYPERCORE = '0x539';
9
9
  exports.NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000000';
10
10
  exports.ARBITRUM_USDC_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
11
11
  exports.POLYGON_USDCE_ADDRESS = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174';
12
+ exports.POLYGON_PUSD_ADDRESS = '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB';
12
13
  exports.HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';
13
14
  exports.HYPERCORE_USDC_DECIMALS = 8;
14
15
  exports.USDC_DECIMALS = 6;
@@ -29,7 +30,10 @@ exports.STABLECOINS = {
29
30
  '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC
30
31
  '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT
31
32
  ],
32
- [exports.CHAIN_ID_POLYGON]: [exports.POLYGON_USDCE_ADDRESS.toLowerCase()],
33
+ [exports.CHAIN_ID_POLYGON]: [
34
+ exports.POLYGON_USDCE_ADDRESS.toLowerCase(),
35
+ exports.POLYGON_PUSD_ADDRESS.toLowerCase(),
36
+ ],
33
37
  [exports.CHAIN_ID_HYPERCORE]: [exports.HYPERCORE_USDC_ADDRESS], // USDC
34
38
  };
35
39
  var TransactionPayStrategy;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,iBAAiB,GAAG,QAAe,CAAC;AACpC,QAAA,gBAAgB,GAAG,KAAY,CAAC;AAChC,QAAA,gBAAgB,GAAG,MAAa,CAAC;AACjC,QAAA,kBAAkB,GAAG,OAAc,CAAC;AAEpC,QAAA,oBAAoB,GAC/B,4CAAmD,CAAC;AAEzC,QAAA,qBAAqB,GAChC,4CAAmD,CAAC;AAEzC,QAAA,qBAAqB,GAChC,4CAAmD,CAAC;AAEzC,QAAA,sBAAsB,GAAG,oCAAoC,CAAC;AAE9D,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAC5B,QAAA,aAAa,GAAG,CAAC,CAAC;AAElB,QAAA,yBAAyB,GAAwB;IAC5D,CAAC,wBAAgB,CAAC,EAAE,GAAG,EAAE,MAAM;CAChC,CAAC;AAEW,QAAA,WAAW,GAAuB;IAC7C,UAAU;IACV,KAAK,EAAE;QACL,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,yBAAiB,CAAC,EAAE,CAAC,6BAAqB,CAAC,WAAW,EAAS,CAAC;IACjE,QAAQ;IACR,QAAQ,EAAE;QACR,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,wBAAgB,CAAC,EAAE,CAAC,6BAAqB,CAAC,WAAW,EAAS,CAAC;IAChE,CAAC,0BAAkB,CAAC,EAAE,CAAC,8BAAsB,CAAC,EAAE,OAAO;CACxD,CAAC;AAEF,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,uCAAa,CAAA;AACf,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC;AAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAExE;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,QAAiB;IAEjB,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAkC,CAAC,CAAC;AAClE,CAAC;AAJD,4DAIC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nexport const CONTROLLER_NAME = 'TransactionPayController';\nexport const CHAIN_ID_ARBITRUM = '0xa4b1' as Hex;\nexport const CHAIN_ID_MAINNET = '0x1' as Hex;\nexport const CHAIN_ID_POLYGON = '0x89' as Hex;\nexport const CHAIN_ID_HYPERCORE = '0x539' as Hex;\n\nexport const NATIVE_TOKEN_ADDRESS =\n '0x0000000000000000000000000000000000000000' as Hex;\n\nexport const ARBITRUM_USDC_ADDRESS =\n '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' as Hex;\n\nexport const POLYGON_USDCE_ADDRESS =\n '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' as Hex;\n\nexport const HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';\n\nexport const HYPERCORE_USDC_DECIMALS = 8;\nexport const USDC_DECIMALS = 6;\n\nexport const SLIP44_COIN_TYPE_BY_CHAIN: Record<Hex, number> = {\n [CHAIN_ID_POLYGON]: 966, // POL\n};\n\nexport const STABLECOINS: Record<Hex, Hex[]> = {\n // Mainnet\n '0x1': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC\n '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT\n ],\n [CHAIN_ID_ARBITRUM]: [ARBITRUM_USDC_ADDRESS.toLowerCase() as Hex],\n // Linea\n '0xe708': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC\n '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT\n ],\n [CHAIN_ID_POLYGON]: [POLYGON_USDCE_ADDRESS.toLowerCase() as Hex],\n [CHAIN_ID_HYPERCORE]: [HYPERCORE_USDC_ADDRESS], // USDC\n};\n\nexport enum TransactionPayStrategy {\n Across = 'across',\n Bridge = 'bridge',\n Fiat = 'fiat',\n Relay = 'relay',\n Test = 'test',\n}\n\nconst VALID_STRATEGIES = new Set(Object.values(TransactionPayStrategy));\n\n/**\n * Checks if a value is a valid transaction pay strategy.\n *\n * @param strategy - Candidate strategy value.\n * @returns True if the value is a valid strategy.\n */\nexport function isTransactionPayStrategy(\n strategy: unknown,\n): strategy is TransactionPayStrategy {\n return VALID_STRATEGIES.has(strategy as TransactionPayStrategy);\n}\n"]}
1
+ {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,eAAe,GAAG,0BAA0B,CAAC;AAC7C,QAAA,iBAAiB,GAAG,QAAe,CAAC;AACpC,QAAA,gBAAgB,GAAG,KAAY,CAAC;AAChC,QAAA,gBAAgB,GAAG,MAAa,CAAC;AACjC,QAAA,kBAAkB,GAAG,OAAc,CAAC;AAEpC,QAAA,oBAAoB,GAC/B,4CAAmD,CAAC;AAEzC,QAAA,qBAAqB,GAChC,4CAAmD,CAAC;AAEzC,QAAA,qBAAqB,GAChC,4CAAmD,CAAC;AAEzC,QAAA,oBAAoB,GAC/B,4CAAmD,CAAC;AAEzC,QAAA,sBAAsB,GAAG,oCAAoC,CAAC;AAE9D,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAC5B,QAAA,aAAa,GAAG,CAAC,CAAC;AAElB,QAAA,yBAAyB,GAAwB;IAC5D,CAAC,wBAAgB,CAAC,EAAE,GAAG,EAAE,MAAM;CAChC,CAAC;AAEW,QAAA,WAAW,GAAuB;IAC7C,UAAU;IACV,KAAK,EAAE;QACL,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,yBAAiB,CAAC,EAAE,CAAC,6BAAqB,CAAC,WAAW,EAAS,CAAC;IACjE,QAAQ;IACR,QAAQ,EAAE;QACR,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,wBAAgB,CAAC,EAAE;QAClB,6BAAqB,CAAC,WAAW,EAAS;QAC1C,4BAAoB,CAAC,WAAW,EAAS;KAC1C;IACD,CAAC,0BAAkB,CAAC,EAAE,CAAC,8BAAsB,CAAC,EAAE,OAAO;CACxD,CAAC;AAEF,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,uCAAa,CAAA;AACf,CAAC,EANW,sBAAsB,sCAAtB,sBAAsB,QAMjC;AAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAExE;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,QAAiB;IAEjB,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAkC,CAAC,CAAC;AAClE,CAAC;AAJD,4DAIC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nexport const CONTROLLER_NAME = 'TransactionPayController';\nexport const CHAIN_ID_ARBITRUM = '0xa4b1' as Hex;\nexport const CHAIN_ID_MAINNET = '0x1' as Hex;\nexport const CHAIN_ID_POLYGON = '0x89' as Hex;\nexport const CHAIN_ID_HYPERCORE = '0x539' as Hex;\n\nexport const NATIVE_TOKEN_ADDRESS =\n '0x0000000000000000000000000000000000000000' as Hex;\n\nexport const ARBITRUM_USDC_ADDRESS =\n '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' as Hex;\n\nexport const POLYGON_USDCE_ADDRESS =\n '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' as Hex;\n\nexport const POLYGON_PUSD_ADDRESS =\n '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB' as Hex;\n\nexport const HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';\n\nexport const HYPERCORE_USDC_DECIMALS = 8;\nexport const USDC_DECIMALS = 6;\n\nexport const SLIP44_COIN_TYPE_BY_CHAIN: Record<Hex, number> = {\n [CHAIN_ID_POLYGON]: 966, // POL\n};\n\nexport const STABLECOINS: Record<Hex, Hex[]> = {\n // Mainnet\n '0x1': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC\n '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT\n ],\n [CHAIN_ID_ARBITRUM]: [ARBITRUM_USDC_ADDRESS.toLowerCase() as Hex],\n // Linea\n '0xe708': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC\n '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT\n ],\n [CHAIN_ID_POLYGON]: [\n POLYGON_USDCE_ADDRESS.toLowerCase() as Hex,\n POLYGON_PUSD_ADDRESS.toLowerCase() as Hex,\n ],\n [CHAIN_ID_HYPERCORE]: [HYPERCORE_USDC_ADDRESS], // USDC\n};\n\nexport enum TransactionPayStrategy {\n Across = 'across',\n Bridge = 'bridge',\n Fiat = 'fiat',\n Relay = 'relay',\n Test = 'test',\n}\n\nconst VALID_STRATEGIES = new Set(Object.values(TransactionPayStrategy));\n\n/**\n * Checks if a value is a valid transaction pay strategy.\n *\n * @param strategy - Candidate strategy value.\n * @returns True if the value is a valid strategy.\n */\nexport function isTransactionPayStrategy(\n strategy: unknown,\n): strategy is TransactionPayStrategy {\n return VALID_STRATEGIES.has(strategy as TransactionPayStrategy);\n}\n"]}
@@ -7,6 +7,7 @@ export declare const CHAIN_ID_HYPERCORE: `0x${string}`;
7
7
  export declare const NATIVE_TOKEN_ADDRESS: `0x${string}`;
8
8
  export declare const ARBITRUM_USDC_ADDRESS: `0x${string}`;
9
9
  export declare const POLYGON_USDCE_ADDRESS: `0x${string}`;
10
+ export declare const POLYGON_PUSD_ADDRESS: `0x${string}`;
10
11
  export declare const HYPERCORE_USDC_ADDRESS = "0x00000000000000000000000000000000";
11
12
  export declare const HYPERCORE_USDC_DECIMALS = 8;
12
13
  export declare const USDC_DECIMALS = 6;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE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CAAC;AAEtD,eAAO,MAAM,oBAAoB,eACoB,CAAC;AAEtD,eAAO,MAAM,sBAAsB,uCAAuC,CAAC;AAE3E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,GAAG,EAAE,MAAM,CAEzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAmB1C,CAAC;AAEF,oBAAY,sBAAsB;IAChC,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAID;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,sBAAsB,CAEpC"}
@@ -7,6 +7,7 @@ export declare const CHAIN_ID_HYPERCORE: `0x${string}`;
7
7
  export declare const NATIVE_TOKEN_ADDRESS: `0x${string}`;
8
8
  export declare const ARBITRUM_USDC_ADDRESS: `0x${string}`;
9
9
  export declare const POLYGON_USDCE_ADDRESS: `0x${string}`;
10
+ export declare const POLYGON_PUSD_ADDRESS: `0x${string}`;
10
11
  export declare const HYPERCORE_USDC_ADDRESS = "0x00000000000000000000000000000000";
11
12
  export declare const HYPERCORE_USDC_DECIMALS = 8;
12
13
  export declare const USDC_DECIMALS = 6;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,wBAAwB;AAE3C,eAAO,MAAM,eAAe,6BAA6B,CAAC;AAC1D,eAAO,MAAM,iBAAiB,eAAkB,CAAC;AACjD,eAAO,MAAM,gBAAgB,eAAe,CAAC;AAC7C,eAAO,MAAM,gBAAgB,eAAgB,CAAC;AAC9C,eAAO,MAAM,kBAAkB,eAAiB,CAAC;AAEjD,eAAO,MAAM,o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AE,MAAM,CAEzD,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,CAmB1C,CAAC;AAEF,oBAAY,sBAAsB;IAChC,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,IAAI,SAAS;CACd;AAID;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,sBAAsB,CAEpC"}
@@ -6,6 +6,7 @@ export const CHAIN_ID_HYPERCORE = '0x539';
6
6
  export const NATIVE_TOKEN_ADDRESS = '0x0000000000000000000000000000000000000000';
7
7
  export const ARBITRUM_USDC_ADDRESS = '0xaf88d065e77c8cC2239327C5EDb3A432268e5831';
8
8
  export const POLYGON_USDCE_ADDRESS = '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174';
9
+ export const POLYGON_PUSD_ADDRESS = '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB';
9
10
  export const HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';
10
11
  export const HYPERCORE_USDC_DECIMALS = 8;
11
12
  export const USDC_DECIMALS = 6;
@@ -26,7 +27,10 @@ export const STABLECOINS = {
26
27
  '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC
27
28
  '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT
28
29
  ],
29
- [CHAIN_ID_POLYGON]: [POLYGON_USDCE_ADDRESS.toLowerCase()],
30
+ [CHAIN_ID_POLYGON]: [
31
+ POLYGON_USDCE_ADDRESS.toLowerCase(),
32
+ POLYGON_PUSD_ADDRESS.toLowerCase(),
33
+ ],
30
34
  [CHAIN_ID_HYPERCORE]: [HYPERCORE_USDC_ADDRESS], // USDC
31
35
  };
32
36
  export var TransactionPayStrategy;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAA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CAAA;IACjB,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,uCAAa,CAAA;AACf,CAAC,EANW,sBAAsB,KAAtB,sBAAsB,QAMjC;AAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAiB;IAEjB,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAkC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nexport const CONTROLLER_NAME = 'TransactionPayController';\nexport const CHAIN_ID_ARBITRUM = '0xa4b1' as Hex;\nexport const CHAIN_ID_MAINNET = '0x1' as Hex;\nexport const CHAIN_ID_POLYGON = '0x89' as Hex;\nexport const CHAIN_ID_HYPERCORE = '0x539' as Hex;\n\nexport const NATIVE_TOKEN_ADDRESS =\n '0x0000000000000000000000000000000000000000' as Hex;\n\nexport const ARBITRUM_USDC_ADDRESS =\n '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' as Hex;\n\nexport const POLYGON_USDCE_ADDRESS =\n '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' as Hex;\n\nexport const HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';\n\nexport const HYPERCORE_USDC_DECIMALS = 8;\nexport const USDC_DECIMALS = 6;\n\nexport const SLIP44_COIN_TYPE_BY_CHAIN: Record<Hex, number> = {\n [CHAIN_ID_POLYGON]: 966, // POL\n};\n\nexport const STABLECOINS: Record<Hex, Hex[]> = {\n // Mainnet\n '0x1': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC\n '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT\n ],\n [CHAIN_ID_ARBITRUM]: [ARBITRUM_USDC_ADDRESS.toLowerCase() as Hex],\n // Linea\n '0xe708': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC\n '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT\n ],\n [CHAIN_ID_POLYGON]: [POLYGON_USDCE_ADDRESS.toLowerCase() as Hex],\n [CHAIN_ID_HYPERCORE]: [HYPERCORE_USDC_ADDRESS], // USDC\n};\n\nexport enum TransactionPayStrategy {\n Across = 'across',\n Bridge = 'bridge',\n Fiat = 'fiat',\n Relay = 'relay',\n Test = 'test',\n}\n\nconst VALID_STRATEGIES = new Set(Object.values(TransactionPayStrategy));\n\n/**\n * Checks if a value is a valid transaction pay strategy.\n *\n * @param strategy - Candidate strategy value.\n * @returns True if the value is a valid strategy.\n */\nexport function isTransactionPayStrategy(\n strategy: unknown,\n): strategy is TransactionPayStrategy {\n return VALID_STRATEGIES.has(strategy as TransactionPayStrategy);\n}\n"]}
1
+ {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,eAAe,GAAG,0BAA0B,CAAC;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAe,CAAC;AACjD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAY,CAAC;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAa,CAAC;AAC9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAc,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,4CAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAChC,4CAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,qBAAqB,GAChC,4CAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,oBAAoB,GAC/B,4CAAmD,CAAC;AAEtD,MAAM,CAAC,MAAM,sBAAsB,GAAG,oCAAoC,CAAC;AAE3E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,yBAAyB,GAAwB;IAC5D,CAAC,gBAAgB,CAAC,EAAE,GAAG,EAAE,MAAM;CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAuB;IAC7C,UAAU;IACV,KAAK,EAAE;QACL,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,iBAAiB,CAAC,EAAE,CAAC,qBAAqB,CAAC,WAAW,EAAS,CAAC;IACjE,QAAQ;IACR,QAAQ,EAAE;QACR,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;QACrD,4CAA4C,EAAE,OAAO;KACtD;IACD,CAAC,gBAAgB,CAAC,EAAE;QAClB,qBAAqB,CAAC,WAAW,EAAS;QAC1C,oBAAoB,CAAC,WAAW,EAAS;KAC1C;IACD,CAAC,kBAAkB,CAAC,EAAE,CAAC,sBAAsB,CAAC,EAAE,OAAO;CACxD,CAAC;AAEF,MAAM,CAAN,IAAY,sBAMX;AAND,WAAY,sBAAsB;IAChC,2CAAiB,CAAA;IACjB,2CAAiB,CAAA;IACjB,uCAAa,CAAA;IACb,yCAAe,CAAA;IACf,uCAAa,CAAA;AACf,CAAC,EANW,sBAAsB,KAAtB,sBAAsB,QAMjC;AAED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,QAAiB;IAEjB,OAAO,gBAAgB,CAAC,GAAG,CAAC,QAAkC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import type { Hex } from '@metamask/utils';\n\nexport const CONTROLLER_NAME = 'TransactionPayController';\nexport const CHAIN_ID_ARBITRUM = '0xa4b1' as Hex;\nexport const CHAIN_ID_MAINNET = '0x1' as Hex;\nexport const CHAIN_ID_POLYGON = '0x89' as Hex;\nexport const CHAIN_ID_HYPERCORE = '0x539' as Hex;\n\nexport const NATIVE_TOKEN_ADDRESS =\n '0x0000000000000000000000000000000000000000' as Hex;\n\nexport const ARBITRUM_USDC_ADDRESS =\n '0xaf88d065e77c8cC2239327C5EDb3A432268e5831' as Hex;\n\nexport const POLYGON_USDCE_ADDRESS =\n '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' as Hex;\n\nexport const POLYGON_PUSD_ADDRESS =\n '0xC011a7E12a19f7B1f670d46F03B03f3342E82DFB' as Hex;\n\nexport const HYPERCORE_USDC_ADDRESS = '0x00000000000000000000000000000000';\n\nexport const HYPERCORE_USDC_DECIMALS = 8;\nexport const USDC_DECIMALS = 6;\n\nexport const SLIP44_COIN_TYPE_BY_CHAIN: Record<Hex, number> = {\n [CHAIN_ID_POLYGON]: 966, // POL\n};\n\nexport const STABLECOINS: Record<Hex, Hex[]> = {\n // Mainnet\n '0x1': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC\n '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT\n ],\n [CHAIN_ID_ARBITRUM]: [ARBITRUM_USDC_ADDRESS.toLowerCase() as Hex],\n // Linea\n '0xe708': [\n '0xaca92e438df0b2401ff60da7e4337b687a2435da', // MUSD\n '0x176211869ca2b568f2a7d4ee941e073a821ee1ff', // USDC\n '0xa219439258ca9da29e9cc4ce5596924745e12b93', // USDT\n ],\n [CHAIN_ID_POLYGON]: [\n POLYGON_USDCE_ADDRESS.toLowerCase() as Hex,\n POLYGON_PUSD_ADDRESS.toLowerCase() as Hex,\n ],\n [CHAIN_ID_HYPERCORE]: [HYPERCORE_USDC_ADDRESS], // USDC\n};\n\nexport enum TransactionPayStrategy {\n Across = 'across',\n Bridge = 'bridge',\n Fiat = 'fiat',\n Relay = 'relay',\n Test = 'test',\n}\n\nconst VALID_STRATEGIES = new Set(Object.values(TransactionPayStrategy));\n\n/**\n * Checks if a value is a valid transaction pay strategy.\n *\n * @param strategy - Candidate strategy value.\n * @returns True if the value is a valid strategy.\n */\nexport function isTransactionPayStrategy(\n strategy: unknown,\n): strategy is TransactionPayStrategy {\n return VALID_STRATEGIES.has(strategy as TransactionPayStrategy);\n}\n"]}
@@ -3,9 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AcrossStrategy = void 0;
4
4
  const transaction_controller_1 = require("@metamask/transaction-controller");
5
5
  const feature_flags_1 = require("../../utils/feature-flags.cjs");
6
+ const transaction_1 = require("../../utils/transaction.cjs");
6
7
  const across_actions_1 = require("./across-actions.cjs");
7
8
  const across_quotes_1 = require("./across-quotes.cjs");
8
9
  const across_submit_1 = require("./across-submit.cjs");
10
+ const authorization_list_1 = require("./authorization-list.cjs");
9
11
  const perps_1 = require("./perps.cjs");
10
12
  const requests_1 = require("./requests.cjs");
11
13
  class AcrossStrategy {
@@ -31,14 +33,13 @@ class AcrossStrategy {
31
33
  return false;
32
34
  }
33
35
  }
34
- // Across cannot submit EIP-7702 authorization lists. This pre-quote check
35
- // catches transactions where the authorization list is already present.
36
- // First-time 7702 upgrades discovered during gas planning are handled in
37
- // `checkQuoteSupport` below.
38
- if (request.transaction.txParams?.authorizationList?.length) {
36
+ if ((0, authorization_list_1.hasUnsupportedTransactionAuthorizationList)(request.transaction, actionableRequests)) {
39
37
  return false;
40
38
  }
41
39
  return actionableRequests.every((singleRequest) => {
40
+ if (singleRequest.isPostQuote) {
41
+ return (0, transaction_1.isPredictWithdrawTransaction)(request.transaction);
42
+ }
42
43
  try {
43
44
  (0, across_actions_1.getAcrossDestination)(request.transaction, singleRequest);
44
45
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"AcrossStrategy.cjs","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":";;;AAAA,6EAAmE;AASnE,iEAAmE;AACnE,yDAAwD;AACxD,uDAAkD;AAClD,uDAAqD;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E;YAChD,IAAI,CAAC;gBACH,IAAA,qCAAoB,EAAC,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;gBACzD,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CACf,OAAyD;QAEzD,oEAAoE;QACpE,4EAA4E;QAC5E,4DAA4D;QAC5D,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,yBAAyB,CAC7D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,IAAA,+BAAe,EAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA+C;QAE/C,OAAO,IAAA,kCAAkB,EAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AA7ED,wCA6EC","sourcesContent":["import { TransactionType } from '@metamask/transaction-controller';\n\nimport type {\n PayStrategy,\n PayStrategyCheckQuoteSupportRequest,\n PayStrategyExecuteRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types';\nimport { getPayStrategiesConfig } from '../../utils/feature-flags';\nimport { getAcrossDestination } from './across-actions';\nimport { getAcrossQuotes } from './across-quotes';\nimport { submitAcrossQuotes } from './across-submit';\nimport { isSupportedAcrossPerpsDepositRequest } from './perps';\nimport { isAcrossQuoteRequest } from './requests';\nimport type { AcrossQuote } from './types';\n\nexport class AcrossStrategy implements PayStrategy<AcrossQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n\n if (!config.across.enabled) {\n return false;\n }\n\n const actionableRequests = request.requests.filter(isAcrossQuoteRequest);\n\n if (actionableRequests.length === 0) {\n return false;\n }\n\n if (request.transaction?.type === TransactionType.perpsDeposit) {\n const supportsPerpsDeposit = actionableRequests.every((singleRequest) =>\n isSupportedAcrossPerpsDepositRequest(\n singleRequest,\n request.transaction?.type,\n ),\n );\n\n if (!supportsPerpsDeposit) {\n return false;\n }\n } else {\n // Across doesn't support same-chain swaps (e.g. mUSD conversions).\n const hasSameChainRequest = actionableRequests.some(\n (singleRequest) =>\n singleRequest.sourceChainId === singleRequest.targetChainId,\n );\n\n if (hasSameChainRequest) {\n return false;\n }\n }\n\n // Across cannot submit EIP-7702 authorization lists. This pre-quote check\n // catches transactions where the authorization list is already present.\n // First-time 7702 upgrades discovered during gas planning are handled in\n // `checkQuoteSupport` below.\n if (request.transaction.txParams?.authorizationList?.length) {\n return false;\n }\n\n return actionableRequests.every((singleRequest) => {\n try {\n getAcrossDestination(request.transaction, singleRequest);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n checkQuoteSupport(\n request: PayStrategyCheckQuoteSupportRequest<AcrossQuote>,\n ): boolean {\n // Gas planning can discover that TransactionController would add an\n // authorization list for a first-time 7702 upgrade. `is7702` alone is not a\n // blocker because it also covers already-upgraded accounts.\n return !request.quotes.some(\n (quote) => quote.original.metamask.requiresAuthorizationList,\n );\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<AcrossQuote>[]> {\n return getAcrossQuotes(request);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<AcrossQuote>,\n ): ReturnType<PayStrategy<AcrossQuote>['execute']> {\n return submitAcrossQuotes(request);\n }\n}\n"]}
1
+ {"version":3,"file":"AcrossStrategy.cjs","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":";;;AAAA,6EAAmE;AASnE,iEAAmE;AACnE,6DAAuE;AACvE,yDAAwD;AACxD,uDAAkD;AAClD,uDAAqD;AACrD,iEAAkF;AAClF,uCAA+D;AAC/D,6CAAkD;AAGlD,MAAa,cAAc;IACzB,QAAQ,CAAC,OAAoC;QAC3C,MAAM,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CAAoB,EAAC,OAAO,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;gBACzD,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CACf,OAAyD;QAEzD,oEAAoE;QACpE,4EAA4E;QAC5E,4DAA4D;QAC5D,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,yBAAyB,CAC7D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,IAAA,+BAAe,EAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA+C;QAE/C,OAAO,IAAA,kCAAkB,EAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF;AAlFD,wCAkFC","sourcesContent":["import { TransactionType } from '@metamask/transaction-controller';\n\nimport type {\n PayStrategy,\n PayStrategyCheckQuoteSupportRequest,\n PayStrategyExecuteRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types';\nimport { getPayStrategiesConfig } from '../../utils/feature-flags';\nimport { isPredictWithdrawTransaction } from '../../utils/transaction';\nimport { getAcrossDestination } from './across-actions';\nimport { getAcrossQuotes } from './across-quotes';\nimport { submitAcrossQuotes } from './across-submit';\nimport { hasUnsupportedTransactionAuthorizationList } from './authorization-list';\nimport { isSupportedAcrossPerpsDepositRequest } from './perps';\nimport { isAcrossQuoteRequest } from './requests';\nimport type { AcrossQuote } from './types';\n\nexport class AcrossStrategy implements PayStrategy<AcrossQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n\n if (!config.across.enabled) {\n return false;\n }\n\n const actionableRequests = request.requests.filter(isAcrossQuoteRequest);\n\n if (actionableRequests.length === 0) {\n return false;\n }\n\n if (request.transaction?.type === TransactionType.perpsDeposit) {\n const supportsPerpsDeposit = actionableRequests.every((singleRequest) =>\n isSupportedAcrossPerpsDepositRequest(\n singleRequest,\n request.transaction?.type,\n ),\n );\n\n if (!supportsPerpsDeposit) {\n return false;\n }\n } else {\n // Across doesn't support same-chain swaps (e.g. mUSD conversions).\n const hasSameChainRequest = actionableRequests.some(\n (singleRequest) =>\n singleRequest.sourceChainId === singleRequest.targetChainId,\n );\n\n if (hasSameChainRequest) {\n return false;\n }\n }\n\n if (\n hasUnsupportedTransactionAuthorizationList(\n request.transaction,\n actionableRequests,\n )\n ) {\n return false;\n }\n\n return actionableRequests.every((singleRequest) => {\n if (singleRequest.isPostQuote) {\n return isPredictWithdrawTransaction(request.transaction);\n }\n\n try {\n getAcrossDestination(request.transaction, singleRequest);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n checkQuoteSupport(\n request: PayStrategyCheckQuoteSupportRequest<AcrossQuote>,\n ): boolean {\n // Gas planning can discover that TransactionController would add an\n // authorization list for a first-time 7702 upgrade. `is7702` alone is not a\n // blocker because it also covers already-upgraded accounts.\n return !request.quotes.some(\n (quote) => quote.original.metamask.requiresAuthorizationList,\n );\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<AcrossQuote>[]> {\n return getAcrossQuotes(request);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<AcrossQuote>,\n ): ReturnType<PayStrategy<AcrossQuote>['execute']> {\n return submitAcrossQuotes(request);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"AcrossStrategy.d.cts","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACpB,wBAAoB;AAOrB,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAE3C,qBAAa,cAAe,YAAW,WAAW,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO;IAsDvD,iBAAiB,CACf,OAAO,EAAE,mCAAmC,CAAC,WAAW,CAAC,GACxD,OAAO;IASJ,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;IAIxC,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC9C,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;CAGnD"}
1
+ {"version":3,"file":"AcrossStrategy.d.cts","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACpB,wBAAoB;AASrB,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAE3C,qBAAa,cAAe,YAAW,WAAW,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO;IA2DvD,iBAAiB,CACf,OAAO,EAAE,mCAAmC,CAAC,WAAW,CAAC,GACxD,OAAO;IASJ,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;IAIxC,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC9C,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;CAGnD"}
@@ -1 +1 @@
1
- {"version":3,"file":"AcrossStrategy.d.mts","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACpB,wBAAoB;AAOrB,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAE3C,qBAAa,cAAe,YAAW,WAAW,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO;IAsDvD,iBAAiB,CACf,OAAO,EAAE,mCAAmC,CAAC,WAAW,CAAC,GACxD,OAAO;IASJ,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;IAIxC,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC9C,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;CAGnD"}
1
+ {"version":3,"file":"AcrossStrategy.d.mts","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,WAAW,EACX,mCAAmC,EACnC,yBAAyB,EACzB,2BAA2B,EAC3B,mBAAmB,EACpB,wBAAoB;AASrB,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAgB;AAE3C,qBAAa,cAAe,YAAW,WAAW,CAAC,WAAW,CAAC;IAC7D,QAAQ,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO;IA2DvD,iBAAiB,CACf,OAAO,EAAE,mCAAmC,CAAC,WAAW,CAAC,GACxD,OAAO;IASJ,SAAS,CACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,mBAAmB,CAAC,WAAW,CAAC,EAAE,CAAC;IAIxC,OAAO,CACX,OAAO,EAAE,yBAAyB,CAAC,WAAW,CAAC,GAC9C,UAAU,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;CAGnD"}
@@ -1,8 +1,10 @@
1
1
  import { TransactionType } from "@metamask/transaction-controller";
2
2
  import { getPayStrategiesConfig } from "../../utils/feature-flags.mjs";
3
+ import { isPredictWithdrawTransaction } from "../../utils/transaction.mjs";
3
4
  import { getAcrossDestination } from "./across-actions.mjs";
4
5
  import { getAcrossQuotes } from "./across-quotes.mjs";
5
6
  import { submitAcrossQuotes } from "./across-submit.mjs";
7
+ import { hasUnsupportedTransactionAuthorizationList } from "./authorization-list.mjs";
6
8
  import { isSupportedAcrossPerpsDepositRequest } from "./perps.mjs";
7
9
  import { isAcrossQuoteRequest } from "./requests.mjs";
8
10
  export class AcrossStrategy {
@@ -28,14 +30,13 @@ export class AcrossStrategy {
28
30
  return false;
29
31
  }
30
32
  }
31
- // Across cannot submit EIP-7702 authorization lists. This pre-quote check
32
- // catches transactions where the authorization list is already present.
33
- // First-time 7702 upgrades discovered during gas planning are handled in
34
- // `checkQuoteSupport` below.
35
- if (request.transaction.txParams?.authorizationList?.length) {
33
+ if (hasUnsupportedTransactionAuthorizationList(request.transaction, actionableRequests)) {
36
34
  return false;
37
35
  }
38
36
  return actionableRequests.every((singleRequest) => {
37
+ if (singleRequest.isPostQuote) {
38
+ return isPredictWithdrawTransaction(request.transaction);
39
+ }
39
40
  try {
40
41
  getAcrossDestination(request.transaction, singleRequest);
41
42
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"AcrossStrategy.mjs","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yCAAyC;AASnE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AACnE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EAAE,eAAe,EAAE,4BAAwB;AAClD,OAAO,EAAE,kBAAkB,EAAE,4BAAwB;AACrD,OAAO,EAAE,oCAAoC,EAAE,oBAAgB;AAC/D,OAAO,EAAE,oBAAoB,EAAE,uBAAmB;AAGlD,MAAM,OAAO,cAAc;IACzB,QAAQ,CAAC,OAAoC;QAC3C,MAAM,MAAM,GAAG,sBAAsB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAEzD,IAAI,CAAC,MAAM,CAAC,M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AC;IACL,CAAC;IAED,iBAAiB,CACf,OAAyD;QAEzD,oEAAoE;QACpE,4EAA4E;QAC5E,4DAA4D;QAC5D,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,yBAAyB,CAC7D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA+C;QAE/C,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import { TransactionType } from '@metamask/transaction-controller';\n\nimport type {\n PayStrategy,\n PayStrategyCheckQuoteSupportRequest,\n PayStrategyExecuteRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types';\nimport { getPayStrategiesConfig } from '../../utils/feature-flags';\nimport { getAcrossDestination } from './across-actions';\nimport { getAcrossQuotes } from './across-quotes';\nimport { submitAcrossQuotes } from './across-submit';\nimport { isSupportedAcrossPerpsDepositRequest } from './perps';\nimport { isAcrossQuoteRequest } from './requests';\nimport type { AcrossQuote } from './types';\n\nexport class AcrossStrategy implements PayStrategy<AcrossQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n\n if (!config.across.enabled) {\n return false;\n }\n\n const actionableRequests = request.requests.filter(isAcrossQuoteRequest);\n\n if (actionableRequests.length === 0) {\n return false;\n }\n\n if (request.transaction?.type === TransactionType.perpsDeposit) {\n const supportsPerpsDeposit = actionableRequests.every((singleRequest) =>\n isSupportedAcrossPerpsDepositRequest(\n singleRequest,\n request.transaction?.type,\n ),\n );\n\n if (!supportsPerpsDeposit) {\n return false;\n }\n } else {\n // Across doesn't support same-chain swaps (e.g. mUSD conversions).\n const hasSameChainRequest = actionableRequests.some(\n (singleRequest) =>\n singleRequest.sourceChainId === singleRequest.targetChainId,\n );\n\n if (hasSameChainRequest) {\n return false;\n }\n }\n\n // Across cannot submit EIP-7702 authorization lists. This pre-quote check\n // catches transactions where the authorization list is already present.\n // First-time 7702 upgrades discovered during gas planning are handled in\n // `checkQuoteSupport` below.\n if (request.transaction.txParams?.authorizationList?.length) {\n return false;\n }\n\n return actionableRequests.every((singleRequest) => {\n try {\n getAcrossDestination(request.transaction, singleRequest);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n checkQuoteSupport(\n request: PayStrategyCheckQuoteSupportRequest<AcrossQuote>,\n ): boolean {\n // Gas planning can discover that TransactionController would add an\n // authorization list for a first-time 7702 upgrade. `is7702` alone is not a\n // blocker because it also covers already-upgraded accounts.\n return !request.quotes.some(\n (quote) => quote.original.metamask.requiresAuthorizationList,\n );\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<AcrossQuote>[]> {\n return getAcrossQuotes(request);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<AcrossQuote>,\n ): ReturnType<PayStrategy<AcrossQuote>['execute']> {\n return submitAcrossQuotes(request);\n }\n}\n"]}
1
+ {"version":3,"file":"AcrossStrategy.mjs","sourceRoot":"","sources":["../../../src/strategy/across/AcrossStrategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,yCAAyC;AASnE,OAAO,EAAE,sBAAsB,EAAE,sCAAkC;AACnE,OAAO,EAAE,4BAA4B,EAAE,oCAAgC;AACvE,OAAO,EAAE,oBAAoB,EAAE,6BAAyB;AACxD,OAAO,EAAE,eAAe,EAAE,4BAAwB;AAClD,OAAO,EAAE,kBAAkB,EAAE,4BAAwB;AACrD,OAAO,EAAE,0CAA0C,EAAE,iCAA6B;AAClF,OAAO,EAAE,oCAAoC,EAAE,oBAAgB;AAC/D,OAAO,EAAE,oBAAoB,EAAE,uBAAmB;AAGlD,MAAM,OAAO,cAAc;IACzB,QAAQ,CAAC,OAAoC;QA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AAC,WAAW,EAAE,aAAa,CAAC,CAAC;gBACzD,OAAO,IAAI,CAAC;YACd,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,iBAAiB,CACf,OAAyD;QAEzD,oEAAoE;QACpE,4EAA4E;QAC5E,4DAA4D;QAC5D,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CACzB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,yBAAyB,CAC7D,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,SAAS,CACb,OAAoC;QAEpC,OAAO,eAAe,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,KAAK,CAAC,OAAO,CACX,OAA+C;QAE/C,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import { TransactionType } from '@metamask/transaction-controller';\n\nimport type {\n PayStrategy,\n PayStrategyCheckQuoteSupportRequest,\n PayStrategyExecuteRequest,\n PayStrategyGetQuotesRequest,\n TransactionPayQuote,\n} from '../../types';\nimport { getPayStrategiesConfig } from '../../utils/feature-flags';\nimport { isPredictWithdrawTransaction } from '../../utils/transaction';\nimport { getAcrossDestination } from './across-actions';\nimport { getAcrossQuotes } from './across-quotes';\nimport { submitAcrossQuotes } from './across-submit';\nimport { hasUnsupportedTransactionAuthorizationList } from './authorization-list';\nimport { isSupportedAcrossPerpsDepositRequest } from './perps';\nimport { isAcrossQuoteRequest } from './requests';\nimport type { AcrossQuote } from './types';\n\nexport class AcrossStrategy implements PayStrategy<AcrossQuote> {\n supports(request: PayStrategyGetQuotesRequest): boolean {\n const config = getPayStrategiesConfig(request.messenger);\n\n if (!config.across.enabled) {\n return false;\n }\n\n const actionableRequests = request.requests.filter(isAcrossQuoteRequest);\n\n if (actionableRequests.length === 0) {\n return false;\n }\n\n if (request.transaction?.type === TransactionType.perpsDeposit) {\n const supportsPerpsDeposit = actionableRequests.every((singleRequest) =>\n isSupportedAcrossPerpsDepositRequest(\n singleRequest,\n request.transaction?.type,\n ),\n );\n\n if (!supportsPerpsDeposit) {\n return false;\n }\n } else {\n // Across doesn't support same-chain swaps (e.g. mUSD conversions).\n const hasSameChainRequest = actionableRequests.some(\n (singleRequest) =>\n singleRequest.sourceChainId === singleRequest.targetChainId,\n );\n\n if (hasSameChainRequest) {\n return false;\n }\n }\n\n if (\n hasUnsupportedTransactionAuthorizationList(\n request.transaction,\n actionableRequests,\n )\n ) {\n return false;\n }\n\n return actionableRequests.every((singleRequest) => {\n if (singleRequest.isPostQuote) {\n return isPredictWithdrawTransaction(request.transaction);\n }\n\n try {\n getAcrossDestination(request.transaction, singleRequest);\n return true;\n } catch {\n return false;\n }\n });\n }\n\n checkQuoteSupport(\n request: PayStrategyCheckQuoteSupportRequest<AcrossQuote>,\n ): boolean {\n // Gas planning can discover that TransactionController would add an\n // authorization list for a first-time 7702 upgrade. `is7702` alone is not a\n // blocker because it also covers already-upgraded accounts.\n return !request.quotes.some(\n (quote) => quote.original.metamask.requiresAuthorizationList,\n );\n }\n\n async getQuotes(\n request: PayStrategyGetQuotesRequest,\n ): Promise<TransactionPayQuote<AcrossQuote>[]> {\n return getAcrossQuotes(request);\n }\n\n async execute(\n request: PayStrategyExecuteRequest<AcrossQuote>,\n ): ReturnType<PayStrategy<AcrossQuote>['execute']> {\n return submitAcrossQuotes(request);\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasUnsupportedTransactionAuthorizationList = void 0;
4
+ const transaction_1 = require("../../utils/transaction.cjs");
5
+ /**
6
+ * Check whether an authorization list on the original transaction is unsupported by Across.
7
+ *
8
+ * Predict withdraw post-quote requests do not use Across destination actions;
9
+ * the original withdrawal is submitted by MetaMask on the source chain before
10
+ * the Across deposit leg. That keeps a source-chain authorization list out of
11
+ * Across' post-swap action payload.
12
+ *
13
+ * @param transaction - Original transaction metadata.
14
+ * @param requests - Across quote requests.
15
+ * @returns `true` if the authorization list should block Across.
16
+ */
17
+ function hasUnsupportedTransactionAuthorizationList(transaction, requests) {
18
+ if (!transaction.txParams?.authorizationList?.length) {
19
+ return false;
20
+ }
21
+ return (!(0, transaction_1.isPredictWithdrawTransaction)(transaction) ||
22
+ requests.some((request) => request.isPostQuote !== true));
23
+ }
24
+ exports.hasUnsupportedTransactionAuthorizationList = hasUnsupportedTransactionAuthorizationList;
25
+ //# sourceMappingURL=authorization-list.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-list.cjs","sourceRoot":"","sources":["../../../src/strategy/across/authorization-list.ts"],"names":[],"mappings":";;;AAGA,6DAAuE;AAEvE;;;;;;;;;;;GAWG;AACH,SAAgB,0CAA0C,CACxD,WAA4B,EAC5B,QAAwB;IAExB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,CAAC,IAAA,0CAA4B,EAAC,WAAW,CAAC;QAC1C,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CACzD,CAAC;AACJ,CAAC;AAZD,gGAYC","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\n\nimport type { QuoteRequest } from '../../types';\nimport { isPredictWithdrawTransaction } from '../../utils/transaction';\n\n/**\n * Check whether an authorization list on the original transaction is unsupported by Across.\n *\n * Predict withdraw post-quote requests do not use Across destination actions;\n * the original withdrawal is submitted by MetaMask on the source chain before\n * the Across deposit leg. That keeps a source-chain authorization list out of\n * Across' post-swap action payload.\n *\n * @param transaction - Original transaction metadata.\n * @param requests - Across quote requests.\n * @returns `true` if the authorization list should block Across.\n */\nexport function hasUnsupportedTransactionAuthorizationList(\n transaction: TransactionMeta,\n requests: QuoteRequest[],\n): boolean {\n if (!transaction.txParams?.authorizationList?.length) {\n return false;\n }\n\n return (\n !isPredictWithdrawTransaction(transaction) ||\n requests.some((request) => request.isPostQuote !== true)\n );\n}\n"]}
@@ -0,0 +1,16 @@
1
+ import type { TransactionMeta } from "@metamask/transaction-controller";
2
+ import type { QuoteRequest } from "../../types.cjs";
3
+ /**
4
+ * Check whether an authorization list on the original transaction is unsupported by Across.
5
+ *
6
+ * Predict withdraw post-quote requests do not use Across destination actions;
7
+ * the original withdrawal is submitted by MetaMask on the source chain before
8
+ * the Across deposit leg. That keeps a source-chain authorization list out of
9
+ * Across' post-swap action payload.
10
+ *
11
+ * @param transaction - Original transaction metadata.
12
+ * @param requests - Across quote requests.
13
+ * @returns `true` if the authorization list should block Across.
14
+ */
15
+ export declare function hasUnsupportedTransactionAuthorizationList(transaction: TransactionMeta, requests: QuoteRequest[]): boolean;
16
+ //# sourceMappingURL=authorization-list.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-list.d.cts","sourceRoot":"","sources":["../../../src/strategy/across/authorization-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAGhD;;;;;;;;;;;GAWG;AACH,wBAAgB,0CAA0C,CACxD,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,YAAY,EAAE,GACvB,OAAO,CAST"}
@@ -0,0 +1,16 @@
1
+ import type { TransactionMeta } from "@metamask/transaction-controller";
2
+ import type { QuoteRequest } from "../../types.mjs";
3
+ /**
4
+ * Check whether an authorization list on the original transaction is unsupported by Across.
5
+ *
6
+ * Predict withdraw post-quote requests do not use Across destination actions;
7
+ * the original withdrawal is submitted by MetaMask on the source chain before
8
+ * the Across deposit leg. That keeps a source-chain authorization list out of
9
+ * Across' post-swap action payload.
10
+ *
11
+ * @param transaction - Original transaction metadata.
12
+ * @param requests - Across quote requests.
13
+ * @returns `true` if the authorization list should block Across.
14
+ */
15
+ export declare function hasUnsupportedTransactionAuthorizationList(transaction: TransactionMeta, requests: QuoteRequest[]): boolean;
16
+ //# sourceMappingURL=authorization-list.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-list.d.mts","sourceRoot":"","sources":["../../../src/strategy/across/authorization-list.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,yCAAyC;AAExE,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAGhD;;;;;;;;;;;GAWG;AACH,wBAAgB,0CAA0C,CACxD,WAAW,EAAE,eAAe,EAC5B,QAAQ,EAAE,YAAY,EAAE,GACvB,OAAO,CAST"}
@@ -0,0 +1,21 @@
1
+ import { isPredictWithdrawTransaction } from "../../utils/transaction.mjs";
2
+ /**
3
+ * Check whether an authorization list on the original transaction is unsupported by Across.
4
+ *
5
+ * Predict withdraw post-quote requests do not use Across destination actions;
6
+ * the original withdrawal is submitted by MetaMask on the source chain before
7
+ * the Across deposit leg. That keeps a source-chain authorization list out of
8
+ * Across' post-swap action payload.
9
+ *
10
+ * @param transaction - Original transaction metadata.
11
+ * @param requests - Across quote requests.
12
+ * @returns `true` if the authorization list should block Across.
13
+ */
14
+ export function hasUnsupportedTransactionAuthorizationList(transaction, requests) {
15
+ if (!transaction.txParams?.authorizationList?.length) {
16
+ return false;
17
+ }
18
+ return (!isPredictWithdrawTransaction(transaction) ||
19
+ requests.some((request) => request.isPostQuote !== true));
20
+ }
21
+ //# sourceMappingURL=authorization-list.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorization-list.mjs","sourceRoot":"","sources":["../../../src/strategy/across/authorization-list.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,oCAAgC;AAEvE;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0CAA0C,CACxD,WAA4B,EAC5B,QAAwB;IAExB,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CACL,CAAC,4BAA4B,CAAC,WAAW,CAAC;QAC1C,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,KAAK,IAAI,CAAC,CACzD,CAAC;AACJ,CAAC","sourcesContent":["import type { TransactionMeta } from '@metamask/transaction-controller';\n\nimport type { QuoteRequest } from '../../types';\nimport { isPredictWithdrawTransaction } from '../../utils/transaction';\n\n/**\n * Check whether an authorization list on the original transaction is unsupported by Across.\n *\n * Predict withdraw post-quote requests do not use Across destination actions;\n * the original withdrawal is submitted by MetaMask on the source chain before\n * the Across deposit leg. That keeps a source-chain authorization list out of\n * Across' post-swap action payload.\n *\n * @param transaction - Original transaction metadata.\n * @param requests - Across quote requests.\n * @returns `true` if the authorization list should block Across.\n */\nexport function hasUnsupportedTransactionAuthorizationList(\n transaction: TransactionMeta,\n requests: QuoteRequest[],\n): boolean {\n if (!transaction.txParams?.authorizationList?.length) {\n return false;\n }\n\n return (\n !isPredictWithdrawTransaction(transaction) ||\n requests.some((request) => request.isPostQuote !== true)\n );\n}\n"]}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isAcrossQuoteRequest = void 0;
4
4
  function isAcrossQuoteRequest(request) {
5
5
  return (request.isMaxAmount === true ||
6
+ request.isPostQuote === true ||
6
7
  (request.targetAmountMinimum !== undefined &&
7
8
  request.targetAmountMinimum !== '0'));
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requests.cjs","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAAC,OAAqB;IACxD,OAAO,CACL,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;YACxC,OAAO,CAAC,mBAAmB,KAAK,GAAG,CAAC,CACvC,CAAC;AACJ,CAAC;AAND,oDAMC","sourcesContent":["import type { QuoteRequest } from '../../types';\n\nexport function isAcrossQuoteRequest(request: QuoteRequest): boolean {\n return (\n request.isMaxAmount === true ||\n (request.targetAmountMinimum !== undefined &&\n request.targetAmountMinimum !== '0')\n );\n}\n"]}
1
+ {"version":3,"file":"requests.cjs","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":";;;AAEA,SAAgB,oBAAoB,CAAC,OAAqB;IACxD,OAAO,CACL,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;YACxC,OAAO,CAAC,mBAAmB,KAAK,GAAG,CAAC,CACvC,CAAC;AACJ,CAAC;AAPD,oDAOC","sourcesContent":["import type { QuoteRequest } from '../../types';\n\nexport function isAcrossQuoteRequest(request: QuoteRequest): boolean {\n return (\n request.isMaxAmount === true ||\n request.isPostQuote === true ||\n (request.targetAmountMinimum !== undefined &&\n request.targetAmountMinimum !== '0')\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.cts","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAEhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAMnE"}
1
+ {"version":3,"file":"requests.d.cts","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAEhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAOnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"requests.d.mts","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAEhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAMnE"}
1
+ {"version":3,"file":"requests.d.mts","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,wBAAoB;AAEhD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAOnE"}
@@ -1,5 +1,6 @@
1
1
  export function isAcrossQuoteRequest(request) {
2
2
  return (request.isMaxAmount === true ||
3
+ request.isPostQuote === true ||
3
4
  (request.targetAmountMinimum !== undefined &&
4
5
  request.targetAmountMinimum !== '0'));
5
6
  }
@@ -1 +1 @@
1
- {"version":3,"file":"requests.mjs","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,OAAqB;IACxD,OAAO,CACL,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;YACxC,OAAO,CAAC,mBAAmB,KAAK,GAAG,CAAC,CACvC,CAAC;AACJ,CAAC","sourcesContent":["import type { QuoteRequest } from '../../types';\n\nexport function isAcrossQuoteRequest(request: QuoteRequest): boolean {\n return (\n request.isMaxAmount === true ||\n (request.targetAmountMinimum !== undefined &&\n request.targetAmountMinimum !== '0')\n );\n}\n"]}
1
+ {"version":3,"file":"requests.mjs","sourceRoot":"","sources":["../../../src/strategy/across/requests.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,OAAqB;IACxD,OAAO,CACL,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,OAAO,CAAC,WAAW,KAAK,IAAI;QAC5B,CAAC,OAAO,CAAC,mBAAmB,KAAK,SAAS;YACxC,OAAO,CAAC,mBAAmB,KAAK,GAAG,CAAC,CACvC,CAAC;AACJ,CAAC","sourcesContent":["import type { QuoteRequest } from '../../types';\n\nexport function isAcrossQuoteRequest(request: QuoteRequest): boolean {\n return (\n request.isMaxAmount === true ||\n request.isPostQuote === true ||\n (request.targetAmountMinimum !== undefined &&\n request.targetAmountMinimum !== '0')\n );\n}\n"]}
@@ -414,7 +414,17 @@ async function calculateSourceNetworkCost(quote, messenger, request, transaction
414
414
  .map((item) => item.data);
415
415
  const { chainId, data, maxFeePerGas, maxPriorityFeePerGas, to, value } = relayParams[0];
416
416
  const isPredictWithdraw = request.isPostQuote && (0, transaction_1.isPredictWithdrawTransaction)(transaction);
417
- const fromOverride = isPredictWithdraw ? request.refundTo : undefined;
417
+ // `fromOverride = Safe proxy` is only valid for deposit-style Relay routes
418
+ // where the deposit contract reads the user's source-token balance directly.
419
+ // Same-chain destinations route through DEX swap aggregators that frequently
420
+ // reject contract callers (anti-MEV `msg.sender == tx.origin` checks,
421
+ // ERC777-style callback interfaces, native wrap/unwrap requiring caller
422
+ // native balance). Simulating those from the Safe proxy reverts and breaks
423
+ // gas estimation. For swap-only routes, fall back to the relay params'
424
+ // EOA `from` so simulation succeeds.
425
+ const hasDepositStep = quote.steps.some((step) => step.id === 'deposit');
426
+ const useFromOverride = isPredictWithdraw && hasDepositStep;
427
+ const fromOverride = useFromOverride ? request.refundTo : undefined;
418
428
  const relayOnlyGas = await calculateSourceNetworkGasLimit(relayParams, messenger, fromOverride);
419
429
  const { gasLimits, is7702, totalGasEstimate, totalGasLimit } = request.isPostQuote
420
430
  ? combinePostQuoteGas(relayOnlyGas, transaction)
@@ -462,6 +472,13 @@ async function calculateSourceNetworkCost(quote, messenger, request, transaction
462
472
  nativeBalance,
463
473
  max: max.raw,
464
474
  });
475
+ // Gas-fee-token lookup must use the Safe proxy for ALL Predict withdraws,
476
+ // not only deposit-style routes. The user's source token (pUSD) lives in
477
+ // the Safe; the EOA is empty until the Safe.execTransaction sub-call runs
478
+ // mid-batch. Querying the EOA for gas-fee-token availability would always
479
+ // return nothing and force users to hold POL.
480
+ // (`useFromOverride` only governs the gas-estimation `from` address, where
481
+ // swap-style routes need EOA because DEX routers reject contract callers.)
465
482
  if (isPredictWithdraw && request.refundTo) {
466
483
  log('Using proxy address for predict withdraw gas station simulation', {
467
484
  proxyAddress: request.refundTo,