@anywalletkit/protocol-swap2-0x 0.1.6 → 0.2.0

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 (56) hide show
  1. package/README.md +12 -6
  2. package/dist/activity.cjs +4 -3
  3. package/dist/activity.cjs.map +1 -1
  4. package/dist/activity.d.cts +6 -1
  5. package/dist/activity.d.ts +6 -1
  6. package/dist/activity.js +3 -3
  7. package/dist/chains.cjs +16 -2
  8. package/dist/chains.cjs.map +1 -1
  9. package/dist/chains.d.cts +26 -6
  10. package/dist/chains.d.ts +26 -6
  11. package/dist/chains.js +5 -1
  12. package/dist/{chunk-CWZCAJBY.js → chunk-AMZ5DXN2.js} +17 -3
  13. package/dist/chunk-AMZ5DXN2.js.map +1 -0
  14. package/dist/{chunk-RLNXMQJH.js → chunk-PLQSYP6W.js} +9 -6
  15. package/dist/chunk-PLQSYP6W.js.map +1 -0
  16. package/dist/{chunk-ALMGGQS4.js → chunk-SAI3RXOP.js} +6 -6
  17. package/dist/{chunk-ALMGGQS4.js.map → chunk-SAI3RXOP.js.map} +1 -1
  18. package/dist/{chunk-QFOKBJXP.js → chunk-V4HUFBY2.js} +5 -5
  19. package/dist/chunk-V4HUFBY2.js.map +1 -0
  20. package/dist/{chunk-AX4RNHWE.js → chunk-VPQZVV5O.js} +2 -2
  21. package/dist/{chunk-NK3PQGI4.js → chunk-YHRPT6BS.js} +20 -5
  22. package/dist/chunk-YHRPT6BS.js.map +1 -0
  23. package/dist/index.cjs +39 -10
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +2 -2
  26. package/dist/index.d.ts +2 -2
  27. package/dist/index.js +14 -6
  28. package/dist/protocol.cjs +34 -9
  29. package/dist/protocol.cjs.map +1 -1
  30. package/dist/protocol.d.cts +1 -1
  31. package/dist/protocol.d.ts +1 -1
  32. package/dist/protocol.js +5 -5
  33. package/dist/provider.cjs +34 -9
  34. package/dist/provider.cjs.map +1 -1
  35. package/dist/provider.d.cts +5 -5
  36. package/dist/provider.d.ts +5 -5
  37. package/dist/provider.js +4 -4
  38. package/dist/remote.cjs +34 -9
  39. package/dist/remote.cjs.map +1 -1
  40. package/dist/remote.d.cts +1 -1
  41. package/dist/remote.d.ts +1 -1
  42. package/dist/remote.js +5 -5
  43. package/dist/{settler-KDFcfsKv.d.cts → settler-CeJFLW5t.d.cts} +21 -4
  44. package/dist/{settler-BpRGkBVV.d.ts → settler-DBLrnepW.d.ts} +21 -4
  45. package/dist/settler.cjs +20 -4
  46. package/dist/settler.cjs.map +1 -1
  47. package/dist/settler.d.cts +1 -1
  48. package/dist/settler.d.ts +1 -1
  49. package/dist/settler.js +6 -2
  50. package/module.json +1 -0
  51. package/package.json +4 -4
  52. package/dist/chunk-CWZCAJBY.js.map +0 -1
  53. package/dist/chunk-NK3PQGI4.js.map +0 -1
  54. package/dist/chunk-QFOKBJXP.js.map +0 -1
  55. package/dist/chunk-RLNXMQJH.js.map +0 -1
  56. /package/dist/{chunk-AX4RNHWE.js.map → chunk-VPQZVV5O.js.map} +0 -0
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, zeroExChain, zeroExChainId, zeroExChains } from './chains.cjs';
2
- export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExTransaction, r as createSettlerResolver, s as decodeSettlerExecute, t as isZeroExNative, z as zeroExSettlerAddress, u as zeroExSettlerNonce } from './settler-KDFcfsKv.cjs';
1
+ export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_GAS_CAP_CEILING, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, isZeroExGasCap, zeroExChain, zeroExChainId, zeroExChains } from './chains.cjs';
2
+ export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExGasLimit, r as checkZeroExTransaction, s as createSettlerResolver, t as decodeSettlerExecute, u as isZeroExNative, z as zeroExMaxGasLimit, v as zeroExSettlerAddress, w as zeroExSettlerNonce } from './settler-CeJFLW5t.cjs';
3
3
  export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExPreflightDeposit, zeroExProvider } from './provider.cjs';
4
4
  export { ZeroExPinsConfig, ZeroExRemoteOptions, ZeroExRemoteProvider, ZeroExVerifyContext, zeroExKnownSpenders, zeroExPins, zeroExRefusalReason, zeroExRemoteProvider, zeroExVerifyBuild, zeroExVerifyQuote } from './remote.cjs';
5
5
  export { ZeroExSwap2Config, ZeroExSwap2Protocol, ZeroExSwap2Protocol as default } from './protocol.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, zeroExChain, zeroExChainId, zeroExChains } from './chains.js';
2
- export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExTransaction, r as createSettlerResolver, s as decodeSettlerExecute, t as isZeroExNative, z as zeroExSettlerAddress, u as zeroExSettlerNonce } from './settler-BpRGkBVV.js';
1
+ export { ZEROEX_ALLOWANCE_HOLDER, ZEROEX_CHAINS, ZEROEX_GAS_CAP_CEILING, ZEROEX_NATIVE, ZEROEX_PERMIT2, ZEROEX_SETTLER_MAX_NONCE, ZEROEX_SETTLER_NONCE_MARGIN, ZEROEX_SETTLER_REGISTRY, ZEROEX_TAKER_FEATURE, ZeroExChain, isZeroExGasCap, zeroExChain, zeroExChainId, zeroExChains } from './chains.js';
2
+ export { R as REGISTRY_OWNER_OF_SELECTOR, a as REGISTRY_PREV_SELECTOR, S as SETTLER_EXECUTE_SELECTOR, b as SETTLER_NATIVE_CHECK_SELECTOR, c as SETTLER_PERMIT_ACTIONS, d as SettlerAction, e as SettlerExecute, f as SettlerResolver, g as SettlerResolverConfig, Z as ZEROEX_MAX_GAS_LIMIT, h as ZEROEX_MAX_NATIVE_QUOTE_SECONDS, i as ZEROEX_MAX_PERMIT_SECONDS, j as ZEROEX_NATIVE_QUOTE_SKEW_SECONDS, k as ZEROEX_SETTLER_LOOKAHEAD, l as ZEROEX_SETTLER_SHIM_INIT_HASH, m as ZeroExCheckedTransaction, n as ZeroExExpectation, o as ZeroExTransaction, p as ZeroExTransactionError, q as checkZeroExGasLimit, r as checkZeroExTransaction, s as createSettlerResolver, t as decodeSettlerExecute, u as isZeroExNative, z as zeroExMaxGasLimit, v as zeroExSettlerAddress, w as zeroExSettlerNonce } from './settler-DBLrnepW.js';
3
3
  export { ZEROEX_DEFAULT_BASE_URL, ZEROEX_PROVIDER, ZeroExProvider, ZeroExProviderConfig, zeroExFees, zeroExPreflightDeposit, zeroExProvider } from './provider.js';
4
4
  export { ZeroExPinsConfig, ZeroExRemoteOptions, ZeroExRemoteProvider, ZeroExVerifyContext, zeroExKnownSpenders, zeroExPins, zeroExRefusalReason, zeroExRemoteProvider, zeroExVerifyBuild, zeroExVerifyQuote } from './remote.js';
5
5
  export { ZeroExSwap2Config, ZeroExSwap2Protocol, ZeroExSwap2Protocol as default } from './protocol.js';
package/dist/index.js CHANGED
@@ -5,21 +5,21 @@ import {
5
5
  zeroExRemoteProvider,
6
6
  zeroExVerifyBuild,
7
7
  zeroExVerifyQuote
8
- } from "./chunk-ALMGGQS4.js";
8
+ } from "./chunk-SAI3RXOP.js";
9
9
  import {
10
10
  ZeroExSwap2Protocol
11
- } from "./chunk-AX4RNHWE.js";
11
+ } from "./chunk-VPQZVV5O.js";
12
12
  import {
13
13
  ZEROEX_DEFAULT_BASE_URL,
14
14
  ZEROEX_PROVIDER,
15
15
  zeroExFees,
16
16
  zeroExPreflightDeposit,
17
17
  zeroExProvider
18
- } from "./chunk-RLNXMQJH.js";
18
+ } from "./chunk-PLQSYP6W.js";
19
19
  import {
20
20
  ZEROEX_MODULE,
21
21
  describeZeroExActivity
22
- } from "./chunk-QFOKBJXP.js";
22
+ } from "./chunk-V4HUFBY2.js";
23
23
  import {
24
24
  REGISTRY_OWNER_OF_SELECTOR,
25
25
  REGISTRY_PREV_SELECTOR,
@@ -33,26 +33,30 @@ import {
33
33
  ZEROEX_SETTLER_LOOKAHEAD,
34
34
  ZEROEX_SETTLER_SHIM_INIT_HASH,
35
35
  ZeroExTransactionError,
36
+ checkZeroExGasLimit,
36
37
  checkZeroExTransaction,
37
38
  createSettlerResolver,
38
39
  decodeSettlerExecute,
39
40
  isZeroExNative,
41
+ zeroExMaxGasLimit,
40
42
  zeroExSettlerAddress,
41
43
  zeroExSettlerNonce
42
- } from "./chunk-NK3PQGI4.js";
44
+ } from "./chunk-YHRPT6BS.js";
43
45
  import {
44
46
  ZEROEX_ALLOWANCE_HOLDER,
45
47
  ZEROEX_CHAINS,
48
+ ZEROEX_GAS_CAP_CEILING,
46
49
  ZEROEX_NATIVE,
47
50
  ZEROEX_PERMIT2,
48
51
  ZEROEX_SETTLER_MAX_NONCE,
49
52
  ZEROEX_SETTLER_NONCE_MARGIN,
50
53
  ZEROEX_SETTLER_REGISTRY,
51
54
  ZEROEX_TAKER_FEATURE,
55
+ isZeroExGasCap,
52
56
  zeroExChain,
53
57
  zeroExChainId,
54
58
  zeroExChains
55
- } from "./chunk-CWZCAJBY.js";
59
+ } from "./chunk-AMZ5DXN2.js";
56
60
  export {
57
61
  REGISTRY_OWNER_OF_SELECTOR,
58
62
  REGISTRY_PREV_SELECTOR,
@@ -62,6 +66,7 @@ export {
62
66
  ZEROEX_ALLOWANCE_HOLDER,
63
67
  ZEROEX_CHAINS,
64
68
  ZEROEX_DEFAULT_BASE_URL,
69
+ ZEROEX_GAS_CAP_CEILING,
65
70
  ZEROEX_MAX_GAS_LIMIT,
66
71
  ZEROEX_MAX_NATIVE_QUOTE_SECONDS,
67
72
  ZEROEX_MAX_PERMIT_SECONDS,
@@ -78,17 +83,20 @@ export {
78
83
  ZEROEX_TAKER_FEATURE,
79
84
  ZeroExSwap2Protocol,
80
85
  ZeroExTransactionError,
86
+ checkZeroExGasLimit,
81
87
  checkZeroExTransaction,
82
88
  createSettlerResolver,
83
89
  decodeSettlerExecute,
84
90
  ZeroExSwap2Protocol as default,
85
91
  describeZeroExActivity,
92
+ isZeroExGasCap,
86
93
  isZeroExNative,
87
94
  zeroExChain,
88
95
  zeroExChainId,
89
96
  zeroExChains,
90
97
  zeroExFees,
91
98
  zeroExKnownSpenders,
99
+ zeroExMaxGasLimit,
92
100
  zeroExPins,
93
101
  zeroExPreflightDeposit,
94
102
  zeroExProvider,
package/dist/protocol.cjs CHANGED
@@ -41,14 +41,17 @@ var ZEROEX_PERMIT2 = import_util.PERMIT2_ADDRESS;
41
41
  var ZEROEX_SETTLER_REGISTRY = "0x00000000000004533Fe15556B1E086BB1A72cEae";
42
42
  var ZEROEX_TAKER_FEATURE = 2;
43
43
  var ZEROEX_NATIVE = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
44
+ var ZEROEX_GAS_CAP_CEILING = 30000000n;
45
+ var isZeroExGasCap = (v) => typeof v === "bigint" && v >= 1n && v <= ZEROEX_GAS_CAP_CEILING;
44
46
  var ZEROEX_SETTLER_NONCE_MARGIN = 2;
45
47
  var ZEROEX_SETTLER_MAX_NONCE = 1024;
46
- var chain = (name, wrappedNative, newestLiveNonce, previousLiveNonce) => Object.freeze({ name, registry: ZEROEX_SETTLER_REGISTRY, newestLiveNonce, previousLiveNonce, wrappedNative });
48
+ var chain = (name, wrappedNative, newestLiveNonce, previousLiveNonce, maxGasLimit) => Object.freeze({ name, registry: ZEROEX_SETTLER_REGISTRY, newestLiveNonce, previousLiveNonce, wrappedNative, ...maxGasLimit !== void 0 ? { maxGasLimit } : {} });
47
49
  var ZEROEX_CHAINS = Object.freeze({
48
50
  1: chain("Ethereum", "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 22, 21),
49
51
  10: chain("Optimism", "0x4200000000000000000000000000000000000006", 22, 21),
50
52
  56: chain("BNB Smart Chain", "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c", 24, 23),
51
53
  137: chain("Polygon", "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", 21, 20),
54
+ 143: chain("Monad", "0x3bd359C1119dA7Da1D913D1C4D2B7c461115433A", 12, 11, 15000000n),
52
55
  8453: chain("Base", "0x4200000000000000000000000000000000000006", 23, 22),
53
56
  42161: chain("Arbitrum", "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", 21, 20),
54
57
  43114: chain("Avalanche", "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", 21, 20)
@@ -77,7 +80,16 @@ function zeroExChains(overrides) {
77
80
  if (!Number.isSafeInteger(previous) || previous < 1 || previous > newest) {
78
81
  throw new Error(`zeroex: chain ${id} pins no previous live Settler deployment (previousLiveNonce, 1 to its newestLiveNonce)`);
79
82
  }
80
- out[id] = Object.freeze({ name: entry.name, registry: entry.registry, newestLiveNonce: newest, previousLiveNonce: previous, ...entry.wrappedNative ? { wrappedNative: entry.wrappedNative } : {} });
83
+ const gasCap = entry.maxGasLimit;
84
+ if (gasCap !== void 0 && !isZeroExGasCap(gasCap)) throw new Error(`zeroex: chain ${id} gas cap (maxGasLimit) is not a bigint from 1 to ${ZEROEX_GAS_CAP_CEILING}`);
85
+ out[id] = Object.freeze({
86
+ name: entry.name,
87
+ registry: entry.registry,
88
+ newestLiveNonce: newest,
89
+ previousLiveNonce: previous,
90
+ ...entry.wrappedNative ? { wrappedNative: entry.wrappedNative } : {},
91
+ ...gasCap !== void 0 ? { maxGasLimit: gasCap } : {}
92
+ });
81
93
  }
82
94
  return Object.freeze(out);
83
95
  }
@@ -310,6 +322,19 @@ function decodeSettlerExecute(data) {
310
322
  return Object.freeze({ recipient, buyToken, minAmountOut, zidAndAffiliate, actions: Object.freeze(actions), bodyLength, word });
311
323
  }
312
324
  var ZEROEX_MAX_GAS_LIMIT = 6000000n;
325
+ function zeroExMaxGasLimit(chain2, chainId) {
326
+ const cap = chain2.maxGasLimit;
327
+ if (cap === void 0) return ZEROEX_MAX_GAS_LIMIT;
328
+ if (!isZeroExGasCap(cap)) throw refuse(`the chain table's gas cap${chainId !== void 0 ? ` for chain ${chainId}` : ""} is not a bigint from 1 to ${ZEROEX_GAS_CAP_CEILING}`);
329
+ return cap;
330
+ }
331
+ function checkZeroExGasLimit(gasLimit, chain2, chainId) {
332
+ const cap = zeroExMaxGasLimit(chain2, chainId);
333
+ if (gasLimit === void 0) return;
334
+ if (typeof gasLimit !== "string" || !/^[0-9]{1,12}$/.test(gasLimit) || BigInt(gasLimit) === 0n || BigInt(gasLimit) > cap) {
335
+ throw refuse(`the transaction asks for more gas than any 0x swap needs (its gas limit must be 1 to ${cap} on chain ${chainId})`, "policy_refused");
336
+ }
337
+ }
313
338
  function checkZeroExTransaction(tx, expected) {
314
339
  if (!Number.isSafeInteger(expected.chainId) || expected.chainId <= 0) throw refuse("the swap names no EVM chain");
315
340
  if (!ADDRESS2.test(expected.recipient) || ZERO_ADDRESS2.test(expected.recipient)) throw refuse("the swap names no recipient");
@@ -333,9 +358,7 @@ function checkZeroExTransaction(tx, expected) {
333
358
  if (value > 0n && deployment !== pin.newestLiveNonce && deployment !== pin.previousLiveNonce) {
334
359
  throw refuse(deployment > pin.newestLiveNonce ? `the swap sends native coin to Settler deployment ${deployment} (${to}) on chain ${expected.chainId}, newer than the newest one live when this module's chain table was pinned (${pin.newestLiveNonce}) \u2014 a native-coin sale goes only to a pinned Settler: update @anywalletkit/protocol-swap2-0x` : `the swap sends native coin to Settler deployment ${deployment} (${to}) on chain ${expected.chainId}, which was not live when this module's chain table was pinned (${pin.newestLiveNonce} and ${pin.previousLiveNonce} were) \u2014 a native-coin sale goes only to a pinned Settler`, "vault_mismatch");
335
360
  }
336
- if (tx.gasLimit !== void 0 && (typeof tx.gasLimit !== "string" || !/^[0-9]{1,12}$/.test(tx.gasLimit) || BigInt(tx.gasLimit) === 0n || BigInt(tx.gasLimit) > ZEROEX_MAX_GAS_LIMIT)) {
337
- throw refuse("the transaction asks for more gas than any 0x swap needs", "policy_refused");
338
- }
361
+ checkZeroExGasLimit(tx.gasLimit, pin, expected.chainId);
339
362
  if (typeof tx.data !== "string") throw refuse("the transaction has no data", "policy_refused");
340
363
  const execute = decodeSettlerExecute(tx.data);
341
364
  if (!same(execute.recipient, expected.recipient)) throw refuse(`the swap pays ${execute.recipient}, not the recipient of this swap`, "recipient_mismatch");
@@ -379,9 +402,9 @@ function checkZeroExTransaction(tx, expected) {
379
402
 
380
403
  // src/activity.ts
381
404
  var ZEROEX_MODULE = "@anywalletkit/protocol-swap2-0x";
382
- function describeZeroExActivity(tx, ctx) {
405
+ function describeZeroExActivity(tx, ctx, chains = ZEROEX_CHAINS) {
383
406
  const chainId = zeroExChainId(tx.chain);
384
- const chain2 = zeroExChain(ZEROEX_CHAINS, chainId);
407
+ const chain2 = zeroExChain(chains, chainId);
385
408
  if (!chain2) return null;
386
409
  if ((0, import_activity.callSelector)(tx) !== SETTLER_EXECUTE_SELECTOR) return null;
387
410
  const target = tx.call?.to ?? tx.to;
@@ -532,7 +555,7 @@ function zeroExProvider(config) {
532
555
  };
533
556
  return {
534
557
  name: ZEROEX_PROVIDER,
535
- describeActivity: describeZeroExActivity,
558
+ describeActivity: (tx, ctx) => describeZeroExActivity(tx, ctx, chains),
536
559
  supportsSameChain: true,
537
560
  // The quoted gas limit is the API's word: a native sale (like a Permit2 call) goes out with the account's own estimate.
538
561
  ownGasEstimate: true,
@@ -843,7 +866,9 @@ async function zeroExPreflightDeposit(quote, tx, ctx) {
843
866
  throw (0, import_errors2.refusal)("policy_refused", "zeroex: the transaction is not the quoted swap. Nothing was sent; refresh the quote.");
844
867
  }
845
868
  const chainId = typeof quote.intentId === "string" ? Number(quote.intentId.split(":")[1]) : NaN;
846
- if (!zeroExChain(ctx.chains, chainId)) throw (0, import_errors2.refusal)("policy_refused", "zeroex: the quote names no chain this provider serves. Nothing was sent.");
869
+ const chain2 = zeroExChain(ctx.chains, chainId);
870
+ if (!chain2) throw (0, import_errors2.refusal)("policy_refused", "zeroex: the quote names no chain this provider serves. Nothing was sent.");
871
+ checkZeroExGasLimit(tx.gasLimit, chain2, chainId);
847
872
  const settlers = await ctx.resolver.resolve(chainId, { fresh: true });
848
873
  if (!settlers.some((s) => same2(s, quoted.to))) {
849
874
  throw (0, import_errors2.refusal)("vault_mismatch", "zeroex: the quoted 0x Settler is no longer in the on-chain registry. Nothing was sent; refresh the quote.");