@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 +18 -3
- package/dist/index.js.map +1 -1
- package/dist/main.js +18 -3
- package/dist/main.js.map +1 -1
- package/dist/mcp-server.js +18 -3
- package/dist/mcp-server.js.map +1 -1
- package/package.json +1 -1
- package/skills/defi-cli/package.json +1 -1
package/dist/mcp-server.js
CHANGED
|
@@ -7454,7 +7454,18 @@ var Executor = class _Executor {
|
|
|
7454
7454
|
* Check allowance for a single token/spender pair and send an approve tx if needed.
|
|
7455
7455
|
* Only called in broadcast mode (not dry-run).
|
|
7456
7456
|
*/
|
|
7457
|
+
/**
|
|
7458
|
+
* Recognize the standard native-token sentinels:
|
|
7459
|
+
* - 0x0000…0000 — defi-cli's internal marker for native gas tokens
|
|
7460
|
+
* - 0xeeee…eeee — 1inch / KyberSwap / OpenOcean canonical sentinel
|
|
7461
|
+
* Any address normalised to lowercase matches case-insensitively.
|
|
7462
|
+
*/
|
|
7463
|
+
static isNativeSentinel(token) {
|
|
7464
|
+
const t = token.toLowerCase();
|
|
7465
|
+
return t === "0x0000000000000000000000000000000000000000" || t === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
7466
|
+
}
|
|
7457
7467
|
async checkAndApprove(token, spender, amount, owner, publicClient, walletClient) {
|
|
7468
|
+
if (_Executor.isNativeSentinel(token)) return;
|
|
7458
7469
|
const allowance = await publicClient.readContract({
|
|
7459
7470
|
address: token,
|
|
7460
7471
|
abi: ERC20_ABI4,
|
|
@@ -7535,9 +7546,12 @@ var Executor = class _Executor {
|
|
|
7535
7546
|
/**
|
|
7536
7547
|
* Fetch EIP-1559 fee params. Returns [maxFeePerGas, maxPriorityFeePerGas].
|
|
7537
7548
|
*
|
|
7538
|
-
* Strategy: read the latest block's `baseFeePerGas` and
|
|
7539
|
-
*
|
|
7540
|
-
*
|
|
7549
|
+
* Strategy: read the latest block's `baseFeePerGas` and apply the conservative
|
|
7550
|
+
* formula `maxFee = baseFee * 1.25 + priorityFee` (one block of head-room — the
|
|
7551
|
+
* 12.5% per-block max bump). The canonical 2× wastes budget on chains where
|
|
7552
|
+
* baseFee is already elevated (e.g., Mantle ~50 gwei → 100 gwei doubled the
|
|
7553
|
+
* MNT requirement and broke multi-step flows). Falls back to
|
|
7554
|
+
* `getGasPrice() + priorityFee` only when
|
|
7541
7555
|
* the chain doesn't expose `baseFeePerGas` (pre-1559).
|
|
7542
7556
|
*
|
|
7543
7557
|
* Why not gasPrice * 2: `getGasPrice()` returns `baseFee + priorityFee`, so
|
|
@@ -7600,6 +7614,7 @@ var Executor = class _Executor {
|
|
|
7600
7614
|
if (tx.approvals && tx.approvals.length > 0) {
|
|
7601
7615
|
const pendingApprovals = [];
|
|
7602
7616
|
for (const approval of tx.approvals) {
|
|
7617
|
+
if (_Executor.isNativeSentinel(approval.token)) continue;
|
|
7603
7618
|
try {
|
|
7604
7619
|
const allowance = await client.readContract({
|
|
7605
7620
|
address: approval.token,
|