@hypurrquant/defi-cli 1.0.10 → 1.0.11

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/dist/index.js CHANGED
@@ -7337,7 +7337,18 @@ var Executor = class _Executor {
7337
7337
  * Check allowance for a single token/spender pair and send an approve tx if needed.
7338
7338
  * Only called in broadcast mode (not dry-run).
7339
7339
  */
7340
+ /**
7341
+ * Recognize the standard native-token sentinels:
7342
+ * - 0x0000…0000 — defi-cli's internal marker for native gas tokens
7343
+ * - 0xeeee…eeee — 1inch / KyberSwap / OpenOcean canonical sentinel
7344
+ * Any address normalised to lowercase matches case-insensitively.
7345
+ */
7346
+ static isNativeSentinel(token) {
7347
+ const t = token.toLowerCase();
7348
+ return t === "0x0000000000000000000000000000000000000000" || t === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
7349
+ }
7340
7350
  async checkAndApprove(token, spender, amount, owner, publicClient, walletClient) {
7351
+ if (_Executor.isNativeSentinel(token)) return;
7341
7352
  const allowance = await publicClient.readContract({
7342
7353
  address: token,
7343
7354
  abi: ERC20_ABI,
@@ -7418,9 +7429,12 @@ var Executor = class _Executor {
7418
7429
  /**
7419
7430
  * Fetch EIP-1559 fee params. Returns [maxFeePerGas, maxPriorityFeePerGas].
7420
7431
  *
7421
- * Strategy: read the latest block's `baseFeePerGas` and use the canonical
7422
- * EIP-1559 formula `maxFee = baseFee * 2 + priorityFee` (1 block of head-room
7423
- * after a 12.5% bump). Falls back to `getGasPrice() + priorityFee` only when
7432
+ * Strategy: read the latest block's `baseFeePerGas` and apply the conservative
7433
+ * formula `maxFee = baseFee * 1.25 + priorityFee` (one block of head-room — the
7434
+ * 12.5% per-block max bump). The canonical wastes budget on chains where
7435
+ * baseFee is already elevated (e.g., Mantle ~50 gwei → 100 gwei doubled the
7436
+ * MNT requirement and broke multi-step flows). Falls back to
7437
+ * `getGasPrice() + priorityFee` only when
7424
7438
  * the chain doesn't expose `baseFeePerGas` (pre-1559).
7425
7439
  *
7426
7440
  * Why not gasPrice * 2: `getGasPrice()` returns `baseFee + priorityFee`, so
@@ -7483,6 +7497,7 @@ var Executor = class _Executor {
7483
7497
  if (tx.approvals && tx.approvals.length > 0) {
7484
7498
  const pendingApprovals = [];
7485
7499
  for (const approval of tx.approvals) {
7500
+ if (_Executor.isNativeSentinel(approval.token)) continue;
7486
7501
  try {
7487
7502
  const allowance = await client.readContract({
7488
7503
  address: approval.token,