@hypurrquant/defi-cli 1.0.9 → 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 +19 -4
- package/dist/index.js.map +1 -1
- package/dist/main.js +19 -4
- package/dist/main.js.map +1 -1
- package/dist/mcp-server.js +19 -4
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/defi-cli/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -7341,7 +7341,18 @@ var Executor = class _Executor {
|
|
|
7341
7341
|
* Check allowance for a single token/spender pair and send an approve tx if needed.
|
|
7342
7342
|
* Only called in broadcast mode (not dry-run).
|
|
7343
7343
|
*/
|
|
7344
|
+
/**
|
|
7345
|
+
* Recognize the standard native-token sentinels:
|
|
7346
|
+
* - 0x0000…0000 — defi-cli's internal marker for native gas tokens
|
|
7347
|
+
* - 0xeeee…eeee — 1inch / KyberSwap / OpenOcean canonical sentinel
|
|
7348
|
+
* Any address normalised to lowercase matches case-insensitively.
|
|
7349
|
+
*/
|
|
7350
|
+
static isNativeSentinel(token) {
|
|
7351
|
+
const t = token.toLowerCase();
|
|
7352
|
+
return t === "0x0000000000000000000000000000000000000000" || t === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
7353
|
+
}
|
|
7344
7354
|
async checkAndApprove(token, spender, amount, owner, publicClient, walletClient) {
|
|
7355
|
+
if (_Executor.isNativeSentinel(token)) return;
|
|
7345
7356
|
const allowance = await publicClient.readContract({
|
|
7346
7357
|
address: token,
|
|
7347
7358
|
abi: ERC20_ABI,
|
|
@@ -7422,9 +7433,12 @@ var Executor = class _Executor {
|
|
|
7422
7433
|
/**
|
|
7423
7434
|
* Fetch EIP-1559 fee params. Returns [maxFeePerGas, maxPriorityFeePerGas].
|
|
7424
7435
|
*
|
|
7425
|
-
* Strategy: read the latest block's `baseFeePerGas` and
|
|
7426
|
-
*
|
|
7427
|
-
*
|
|
7436
|
+
* Strategy: read the latest block's `baseFeePerGas` and apply the conservative
|
|
7437
|
+
* formula `maxFee = baseFee * 1.25 + priorityFee` (one block of head-room — the
|
|
7438
|
+
* 12.5% per-block max bump). The canonical 2× wastes budget on chains where
|
|
7439
|
+
* baseFee is already elevated (e.g., Mantle ~50 gwei → 100 gwei doubled the
|
|
7440
|
+
* MNT requirement and broke multi-step flows). Falls back to
|
|
7441
|
+
* `getGasPrice() + priorityFee` only when
|
|
7428
7442
|
* the chain doesn't expose `baseFeePerGas` (pre-1559).
|
|
7429
7443
|
*
|
|
7430
7444
|
* Why not gasPrice * 2: `getGasPrice()` returns `baseFee + priorityFee`, so
|
|
@@ -7443,7 +7457,7 @@ var Executor = class _Executor {
|
|
|
7443
7457
|
try {
|
|
7444
7458
|
const block = await client.getBlock({ blockTag: "latest" });
|
|
7445
7459
|
if (block.baseFeePerGas !== null && block.baseFeePerGas !== void 0) {
|
|
7446
|
-
const maxFee = block.baseFeePerGas *
|
|
7460
|
+
const maxFee = block.baseFeePerGas * 125n / 100n + priorityFee;
|
|
7447
7461
|
return [maxFee, priorityFee];
|
|
7448
7462
|
}
|
|
7449
7463
|
} catch {
|
|
@@ -7487,6 +7501,7 @@ var Executor = class _Executor {
|
|
|
7487
7501
|
if (tx.approvals && tx.approvals.length > 0) {
|
|
7488
7502
|
const pendingApprovals = [];
|
|
7489
7503
|
for (const approval of tx.approvals) {
|
|
7504
|
+
if (_Executor.isNativeSentinel(approval.token)) continue;
|
|
7490
7505
|
try {
|
|
7491
7506
|
const allowance = await client.readContract({
|
|
7492
7507
|
address: approval.token,
|