liquid-sdk 1.6.5 → 1.7.2
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.d.mts +79 -4
- package/dist/index.d.ts +79 -4
- package/dist/index.js +109 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +108 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -816,8 +816,8 @@ var LiquidPoolExtensionAllowlistAbi = [
|
|
|
816
816
|
}
|
|
817
817
|
];
|
|
818
818
|
|
|
819
|
-
// src/abis/
|
|
820
|
-
var
|
|
819
|
+
// src/abis/LiquidMevDescendingFees.ts
|
|
820
|
+
var LiquidMevDescendingFeesAbi = [
|
|
821
821
|
{
|
|
822
822
|
type: "function",
|
|
823
823
|
name: "blockDelay",
|
|
@@ -1086,6 +1086,63 @@ var LiquidSDK = class {
|
|
|
1086
1086
|
extensionData
|
|
1087
1087
|
};
|
|
1088
1088
|
}
|
|
1089
|
+
/**
|
|
1090
|
+
* Build a vault extension config for token deployment.
|
|
1091
|
+
*
|
|
1092
|
+
* Locks a percentage of the token supply with a lockup period
|
|
1093
|
+
* followed by optional linear vesting.
|
|
1094
|
+
*
|
|
1095
|
+
* @param vault - Vault parameters
|
|
1096
|
+
* @returns ExtensionConfig to include in `deployToken({ extensions })`
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* const vaultExt = sdk.buildVaultExtension({
|
|
1101
|
+
* admin: account.address,
|
|
1102
|
+
* allocationBps: 2000, // 20% of supply
|
|
1103
|
+
* lockupDuration: 2592000, // 30 days in seconds
|
|
1104
|
+
* vestingDuration: 7776000, // 90 days linear vesting after lockup
|
|
1105
|
+
* });
|
|
1106
|
+
* const result = await sdk.deployToken({
|
|
1107
|
+
* name: "My Token", symbol: "MTK",
|
|
1108
|
+
* extensions: [vaultExt],
|
|
1109
|
+
* });
|
|
1110
|
+
* ```
|
|
1111
|
+
*/
|
|
1112
|
+
buildVaultExtension(vault) {
|
|
1113
|
+
const MIN_LOCKUP = 604800;
|
|
1114
|
+
const MAX_BPS = 9e3;
|
|
1115
|
+
if (vault.allocationBps < 1 || vault.allocationBps > MAX_BPS) {
|
|
1116
|
+
throw new Error(`Vault allocationBps must be 1\u2013${MAX_BPS} (0.01%\u201390%). Got ${vault.allocationBps}.`);
|
|
1117
|
+
}
|
|
1118
|
+
if (vault.lockupDuration < MIN_LOCKUP) {
|
|
1119
|
+
throw new Error(`Vault lockupDuration must be \u2265 ${MIN_LOCKUP} seconds (7 days). Got ${vault.lockupDuration}.`);
|
|
1120
|
+
}
|
|
1121
|
+
if (vault.vestingDuration !== void 0 && vault.vestingDuration < 0) {
|
|
1122
|
+
throw new Error("Vault vestingDuration cannot be negative.");
|
|
1123
|
+
}
|
|
1124
|
+
const extensionData = encodeAbiParameters2(
|
|
1125
|
+
[
|
|
1126
|
+
{ type: "address" },
|
|
1127
|
+
// admin
|
|
1128
|
+
{ type: "uint256" },
|
|
1129
|
+
// lockupDuration
|
|
1130
|
+
{ type: "uint256" }
|
|
1131
|
+
// vestingDuration
|
|
1132
|
+
],
|
|
1133
|
+
[
|
|
1134
|
+
vault.admin,
|
|
1135
|
+
BigInt(vault.lockupDuration),
|
|
1136
|
+
BigInt(vault.vestingDuration ?? 0)
|
|
1137
|
+
]
|
|
1138
|
+
);
|
|
1139
|
+
return {
|
|
1140
|
+
extension: ADDRESSES.VAULT,
|
|
1141
|
+
msgValue: 0n,
|
|
1142
|
+
extensionBps: vault.allocationBps,
|
|
1143
|
+
extensionData
|
|
1144
|
+
};
|
|
1145
|
+
}
|
|
1089
1146
|
// ── Validation ─────────────────────────────────────────────────
|
|
1090
1147
|
/**
|
|
1091
1148
|
* Validate a DeploymentConfig before sending to the contract.
|
|
@@ -1413,23 +1470,39 @@ var LiquidSDK = class {
|
|
|
1413
1470
|
});
|
|
1414
1471
|
}
|
|
1415
1472
|
// ── Fee Claims ────────────────────────────────────────────────────
|
|
1416
|
-
|
|
1473
|
+
/**
|
|
1474
|
+
* Get uncollected fees for a fee owner.
|
|
1475
|
+
* @param feeOwner - Address that receives fees (reward recipient)
|
|
1476
|
+
* @param feeToken - The token fees are denominated in. Defaults to WETH
|
|
1477
|
+
* (correct for all pools using LP_LOCKER_FEE_CONVERSION).
|
|
1478
|
+
*/
|
|
1479
|
+
async getAvailableFees(feeOwner, feeToken = EXTERNAL.WETH) {
|
|
1417
1480
|
return await this.publicClient.readContract({
|
|
1418
1481
|
address: ADDRESSES.FEE_LOCKER,
|
|
1419
1482
|
abi: LiquidFeeLockerAbi,
|
|
1420
1483
|
functionName: "availableFees",
|
|
1421
|
-
args: [feeOwner,
|
|
1484
|
+
args: [feeOwner, feeToken]
|
|
1422
1485
|
});
|
|
1423
1486
|
}
|
|
1424
|
-
|
|
1487
|
+
/**
|
|
1488
|
+
* Get collected, claimable fees for a fee owner.
|
|
1489
|
+
* @param feeOwner - Address that receives fees (reward recipient)
|
|
1490
|
+
* @param feeToken - The token fees are denominated in. Defaults to WETH.
|
|
1491
|
+
*/
|
|
1492
|
+
async getFeesToClaim(feeOwner, feeToken = EXTERNAL.WETH) {
|
|
1425
1493
|
return await this.publicClient.readContract({
|
|
1426
1494
|
address: ADDRESSES.FEE_LOCKER,
|
|
1427
1495
|
abi: LiquidFeeLockerAbi,
|
|
1428
1496
|
functionName: "feesToClaim",
|
|
1429
|
-
args: [feeOwner,
|
|
1497
|
+
args: [feeOwner, feeToken]
|
|
1430
1498
|
});
|
|
1431
1499
|
}
|
|
1432
|
-
|
|
1500
|
+
/**
|
|
1501
|
+
* Claim all accumulated fees for a fee owner.
|
|
1502
|
+
* @param feeOwner - Address that receives fees (reward recipient)
|
|
1503
|
+
* @param feeToken - The token fees are denominated in. Defaults to WETH.
|
|
1504
|
+
*/
|
|
1505
|
+
async claimFees(feeOwner, feeToken = EXTERNAL.WETH) {
|
|
1433
1506
|
if (!this.walletClient?.account) {
|
|
1434
1507
|
throw new Error("walletClient with account required for claimFees");
|
|
1435
1508
|
}
|
|
@@ -1437,7 +1510,7 @@ var LiquidSDK = class {
|
|
|
1437
1510
|
address: ADDRESSES.FEE_LOCKER,
|
|
1438
1511
|
abi: LiquidFeeLockerAbi,
|
|
1439
1512
|
functionName: "claim",
|
|
1440
|
-
args: [feeOwner,
|
|
1513
|
+
args: [feeOwner, feeToken],
|
|
1441
1514
|
chain: base2,
|
|
1442
1515
|
account: this.walletClient.account
|
|
1443
1516
|
});
|
|
@@ -1806,18 +1879,22 @@ var LiquidSDK = class {
|
|
|
1806
1879
|
args: [extensionAddress]
|
|
1807
1880
|
});
|
|
1808
1881
|
}
|
|
1809
|
-
// ── MEV
|
|
1810
|
-
async
|
|
1882
|
+
// ── MEV Descending Fees ─────────────────────────────────────────────
|
|
1883
|
+
async getMevDescendingFeesBlockDelay() {
|
|
1811
1884
|
return await this.publicClient.readContract({
|
|
1812
1885
|
address: ADDRESSES.MEV_DESCENDING_FEES,
|
|
1813
|
-
abi:
|
|
1886
|
+
abi: LiquidMevDescendingFeesAbi,
|
|
1814
1887
|
functionName: "blockDelay"
|
|
1815
1888
|
});
|
|
1816
1889
|
}
|
|
1890
|
+
/** @deprecated Use getMevDescendingFeesBlockDelay() */
|
|
1891
|
+
async getMevBlockDelay() {
|
|
1892
|
+
return this.getMevDescendingFeesBlockDelay();
|
|
1893
|
+
}
|
|
1817
1894
|
async getPoolUnlockTime(poolId) {
|
|
1818
1895
|
return await this.publicClient.readContract({
|
|
1819
1896
|
address: ADDRESSES.MEV_DESCENDING_FEES,
|
|
1820
|
-
abi:
|
|
1897
|
+
abi: LiquidMevDescendingFeesAbi,
|
|
1821
1898
|
functionName: "poolUnlockTime",
|
|
1822
1899
|
args: [poolId]
|
|
1823
1900
|
});
|
|
@@ -1964,6 +2041,24 @@ var LiquidSDK = class {
|
|
|
1964
2041
|
}
|
|
1965
2042
|
};
|
|
1966
2043
|
|
|
2044
|
+
// src/abis/LiquidMevBlockDelay.ts
|
|
2045
|
+
var LiquidMevBlockDelayAbi = [
|
|
2046
|
+
{
|
|
2047
|
+
type: "function",
|
|
2048
|
+
name: "blockDelay",
|
|
2049
|
+
inputs: [],
|
|
2050
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2051
|
+
stateMutability: "view"
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
type: "function",
|
|
2055
|
+
name: "poolUnlockTime",
|
|
2056
|
+
inputs: [{ name: "poolId", type: "bytes32" }],
|
|
2057
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
2058
|
+
stateMutability: "view"
|
|
2059
|
+
}
|
|
2060
|
+
];
|
|
2061
|
+
|
|
1967
2062
|
// src/abis/LiquidUniv4EthDevBuy.ts
|
|
1968
2063
|
var LiquidUniv4EthDevBuyAbi = [
|
|
1969
2064
|
{
|
|
@@ -2238,6 +2333,7 @@ export {
|
|
|
2238
2333
|
LiquidHookDynamicFeeV2Abi,
|
|
2239
2334
|
LiquidLpLockerAbi,
|
|
2240
2335
|
LiquidMevBlockDelayAbi,
|
|
2336
|
+
LiquidMevDescendingFeesAbi,
|
|
2241
2337
|
LiquidPoolExtensionAllowlistAbi,
|
|
2242
2338
|
LiquidSDK,
|
|
2243
2339
|
LiquidSniperAuctionV2Abi,
|