liquid-sdk 1.7.3 → 1.7.5
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/AGENT_README.md +112 -46
- package/CHANGELOG.md +17 -0
- package/README.md +239 -119
- package/dist/index.d.mts +55 -26
- package/dist/index.d.ts +55 -26
- package/dist/index.js +47 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -3
- package/dist/index.mjs.map +1 -1
- package/llms.txt +6 -6
- package/package.json +1 -1
- package/skills/bid-in-auction.md +4 -2
- package/skills/deploy-token.md +1 -1
- package/skills/index-tokens.md +2 -2
- package/skills/sdk-overview.md +8 -8
package/dist/index.mjs
CHANGED
|
@@ -34,6 +34,9 @@ var ADDRESSES = {
|
|
|
34
34
|
var EXTERNAL = {
|
|
35
35
|
POOL_MANAGER: "0x498581fF718922c3f8e6A244956aF099B2652b2b",
|
|
36
36
|
WETH: "0x4200000000000000000000000000000000000006",
|
|
37
|
+
/** DIEM — Liquid's intelligence-economy token. Also a pair token for
|
|
38
|
+
* agent-token launches (see `createLiquidPositionsUSD`). */
|
|
39
|
+
DIEM: "0xF4d97F2da56e8c3098f3a8D538DB630A2606a024",
|
|
37
40
|
UNIVERSAL_ROUTER: "0x6fF5693b99212Da76ad316178A184AB56D299b43",
|
|
38
41
|
PERMIT2: "0x000000000022D473030F116dDEE9F6B43aC78BA3"
|
|
39
42
|
};
|
|
@@ -1385,7 +1388,16 @@ var LiquidSDK = class {
|
|
|
1385
1388
|
account: this.walletClient.account
|
|
1386
1389
|
});
|
|
1387
1390
|
gas = estimated * 120n / 100n;
|
|
1388
|
-
} catch {
|
|
1391
|
+
} catch (err) {
|
|
1392
|
+
const e = err;
|
|
1393
|
+
const looksLikeRevert = e?.name === "ContractFunctionExecutionError" || e?.name === "CallExecutionError" || typeof e?.shortMessage === "string" && /reverted|revert reason|execution reverted/i.test(e.shortMessage);
|
|
1394
|
+
if (looksLikeRevert) throw err;
|
|
1395
|
+
if (typeof console !== "undefined" && console.warn) {
|
|
1396
|
+
console.warn(
|
|
1397
|
+
"[liquid-sdk] deployToken gas estimation failed; falling back to 6M gas limit:",
|
|
1398
|
+
e?.shortMessage ?? err
|
|
1399
|
+
);
|
|
1400
|
+
}
|
|
1389
1401
|
gas = 6000000n;
|
|
1390
1402
|
}
|
|
1391
1403
|
const txHash = await this.walletClient.writeContract({
|
|
@@ -1795,7 +1807,7 @@ var LiquidSDK = class {
|
|
|
1795
1807
|
address: weth,
|
|
1796
1808
|
abi: ERC20Abi,
|
|
1797
1809
|
functionName: "approve",
|
|
1798
|
-
args: [ADDRESSES.SNIPER_UTIL_V2, params.amountIn
|
|
1810
|
+
args: [ADDRESSES.SNIPER_UTIL_V2, params.amountIn],
|
|
1799
1811
|
chain: base2,
|
|
1800
1812
|
account
|
|
1801
1813
|
});
|
|
@@ -2379,6 +2391,33 @@ function createDefaultPositions(startingMarketCapUSD, ethPriceUSD, tickSpacing =
|
|
|
2379
2391
|
tickIfToken0IsLiquid: positions.tickLower[0]
|
|
2380
2392
|
};
|
|
2381
2393
|
}
|
|
2394
|
+
function shiftPositions(positions, shiftBy) {
|
|
2395
|
+
return positions.map((p) => ({
|
|
2396
|
+
tickLower: p.tickLower + shiftBy,
|
|
2397
|
+
tickUpper: p.tickUpper + shiftBy,
|
|
2398
|
+
positionBps: p.positionBps
|
|
2399
|
+
}));
|
|
2400
|
+
}
|
|
2401
|
+
function createLiquidPositionsUSD(startingMarketCapUSD, pairedTokenPriceUSD, tickSpacing = 200) {
|
|
2402
|
+
if (pairedTokenPriceUSD <= 0) {
|
|
2403
|
+
throw new Error("pairedTokenPriceUSD must be positive");
|
|
2404
|
+
}
|
|
2405
|
+
const startingTick = getTickFromMarketCapUSD(
|
|
2406
|
+
startingMarketCapUSD,
|
|
2407
|
+
pairedTokenPriceUSD,
|
|
2408
|
+
tickSpacing
|
|
2409
|
+
);
|
|
2410
|
+
const shifted = shiftPositions(
|
|
2411
|
+
POOL_POSITIONS.Liquid,
|
|
2412
|
+
startingTick - DEFAULTS.TICK_IF_TOKEN0_IS_LIQUID
|
|
2413
|
+
);
|
|
2414
|
+
return {
|
|
2415
|
+
tickLower: shifted.map((p) => p.tickLower),
|
|
2416
|
+
tickUpper: shifted.map((p) => p.tickUpper),
|
|
2417
|
+
positionBps: shifted.map((p) => p.positionBps),
|
|
2418
|
+
tickIfToken0IsLiquid: startingTick
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2382
2421
|
function describePositions(positions, ethPriceUSD) {
|
|
2383
2422
|
return positions.tickLower.map((_, i) => {
|
|
2384
2423
|
const lowerETH = Math.pow(1.0001, positions.tickLower[i]) * 1e11;
|
|
@@ -2427,6 +2466,7 @@ export {
|
|
|
2427
2466
|
buildContext,
|
|
2428
2467
|
buildMetadata,
|
|
2429
2468
|
createDefaultPositions,
|
|
2469
|
+
createLiquidPositionsUSD,
|
|
2430
2470
|
createPositions,
|
|
2431
2471
|
createPositionsUSD,
|
|
2432
2472
|
describePositions,
|
|
@@ -2440,6 +2480,7 @@ export {
|
|
|
2440
2480
|
marketCapFromTickETH,
|
|
2441
2481
|
marketCapFromTickUSD,
|
|
2442
2482
|
parseContext,
|
|
2443
|
-
parseMetadata
|
|
2483
|
+
parseMetadata,
|
|
2484
|
+
shiftPositions
|
|
2444
2485
|
};
|
|
2445
2486
|
//# sourceMappingURL=index.mjs.map
|