liquid-sdk 1.6.5 → 1.7.1

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 CHANGED
@@ -53,6 +53,16 @@ interface DevBuyParams {
53
53
  /** Address to receive the purchased tokens */
54
54
  recipient: Address;
55
55
  }
56
+ interface VaultExtensionParams {
57
+ /** Address that can claim vested tokens */
58
+ admin: Address;
59
+ /** Percentage of supply to lock, in BPS (1–9000 = 0.01%–90%) */
60
+ allocationBps: number;
61
+ /** Lockup duration in seconds (minimum 604800 = 7 days). Tokens are fully locked during this period. */
62
+ lockupDuration: number;
63
+ /** Vesting duration in seconds after lockup ends (0 = no vesting, tokens unlock all at once) */
64
+ vestingDuration?: number;
65
+ }
56
66
  interface DeployTokenParams {
57
67
  name: string;
58
68
  symbol: string;
@@ -236,6 +246,30 @@ declare class LiquidSDK {
236
246
  * The paired token must be WETH for simple dev buys.
237
247
  */
238
248
  buildDevBuyExtension(devBuy: DevBuyParams): ExtensionConfig;
249
+ /**
250
+ * Build a vault extension config for token deployment.
251
+ *
252
+ * Locks a percentage of the token supply with a lockup period
253
+ * followed by optional linear vesting.
254
+ *
255
+ * @param vault - Vault parameters
256
+ * @returns ExtensionConfig to include in `deployToken({ extensions })`
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * const vaultExt = sdk.buildVaultExtension({
261
+ * admin: account.address,
262
+ * allocationBps: 2000, // 20% of supply
263
+ * lockupDuration: 2592000, // 30 days in seconds
264
+ * vestingDuration: 7776000, // 90 days linear vesting after lockup
265
+ * });
266
+ * const result = await sdk.deployToken({
267
+ * name: "My Token", symbol: "MTK",
268
+ * extensions: [vaultExt],
269
+ * });
270
+ * ```
271
+ */
272
+ buildVaultExtension(vault: VaultExtensionParams): ExtensionConfig;
239
273
  /**
240
274
  * Validate a DeploymentConfig before sending to the contract.
241
275
  * Catches common mistakes client-side with clear error messages.
@@ -313,6 +347,8 @@ declare class LiquidSDK {
313
347
  collectRewardsWithoutUnlock(tokenAddress: Address, lockerAddress?: Address): Promise<Hash>;
314
348
  updateRewardRecipient(tokenAddress: Address, rewardIndex: bigint, newRecipient: Address, lockerAddress?: Address): Promise<Hash>;
315
349
  isExtensionEnabled(extensionAddress: Address): Promise<boolean>;
350
+ getMevDescendingFeesBlockDelay(): Promise<bigint>;
351
+ /** @deprecated Use getMevDescendingFeesBlockDelay() */
316
352
  getMevBlockDelay(): Promise<bigint>;
317
353
  getPoolUnlockTime(poolId: Hex): Promise<bigint>;
318
354
  /**
@@ -1603,6 +1639,29 @@ declare const LiquidPoolExtensionAllowlistAbi: readonly [{
1603
1639
  readonly stateMutability: "view";
1604
1640
  }];
1605
1641
 
1642
+ declare const LiquidMevDescendingFeesAbi: readonly [{
1643
+ readonly type: "function";
1644
+ readonly name: "blockDelay";
1645
+ readonly inputs: readonly [];
1646
+ readonly outputs: readonly [{
1647
+ readonly name: "";
1648
+ readonly type: "uint256";
1649
+ }];
1650
+ readonly stateMutability: "view";
1651
+ }, {
1652
+ readonly type: "function";
1653
+ readonly name: "poolUnlockTime";
1654
+ readonly inputs: readonly [{
1655
+ readonly name: "poolId";
1656
+ readonly type: "bytes32";
1657
+ }];
1658
+ readonly outputs: readonly [{
1659
+ readonly name: "";
1660
+ readonly type: "uint256";
1661
+ }];
1662
+ readonly stateMutability: "view";
1663
+ }];
1664
+
1606
1665
  declare const LiquidMevBlockDelayAbi: readonly [{
1607
1666
  readonly type: "function";
1608
1667
  readonly name: "blockDelay";
@@ -2482,4 +2541,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
2482
2541
  */
2483
2542
  declare function parseMetadata(metadataString: string): LiquidMetadata | null;
2484
2543
 
2485
- export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
2544
+ export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidMevDescendingFeesAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, type VaultExtensionParams, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
package/dist/index.d.ts CHANGED
@@ -53,6 +53,16 @@ interface DevBuyParams {
53
53
  /** Address to receive the purchased tokens */
54
54
  recipient: Address;
55
55
  }
56
+ interface VaultExtensionParams {
57
+ /** Address that can claim vested tokens */
58
+ admin: Address;
59
+ /** Percentage of supply to lock, in BPS (1–9000 = 0.01%–90%) */
60
+ allocationBps: number;
61
+ /** Lockup duration in seconds (minimum 604800 = 7 days). Tokens are fully locked during this period. */
62
+ lockupDuration: number;
63
+ /** Vesting duration in seconds after lockup ends (0 = no vesting, tokens unlock all at once) */
64
+ vestingDuration?: number;
65
+ }
56
66
  interface DeployTokenParams {
57
67
  name: string;
58
68
  symbol: string;
@@ -236,6 +246,30 @@ declare class LiquidSDK {
236
246
  * The paired token must be WETH for simple dev buys.
237
247
  */
238
248
  buildDevBuyExtension(devBuy: DevBuyParams): ExtensionConfig;
249
+ /**
250
+ * Build a vault extension config for token deployment.
251
+ *
252
+ * Locks a percentage of the token supply with a lockup period
253
+ * followed by optional linear vesting.
254
+ *
255
+ * @param vault - Vault parameters
256
+ * @returns ExtensionConfig to include in `deployToken({ extensions })`
257
+ *
258
+ * @example
259
+ * ```typescript
260
+ * const vaultExt = sdk.buildVaultExtension({
261
+ * admin: account.address,
262
+ * allocationBps: 2000, // 20% of supply
263
+ * lockupDuration: 2592000, // 30 days in seconds
264
+ * vestingDuration: 7776000, // 90 days linear vesting after lockup
265
+ * });
266
+ * const result = await sdk.deployToken({
267
+ * name: "My Token", symbol: "MTK",
268
+ * extensions: [vaultExt],
269
+ * });
270
+ * ```
271
+ */
272
+ buildVaultExtension(vault: VaultExtensionParams): ExtensionConfig;
239
273
  /**
240
274
  * Validate a DeploymentConfig before sending to the contract.
241
275
  * Catches common mistakes client-side with clear error messages.
@@ -313,6 +347,8 @@ declare class LiquidSDK {
313
347
  collectRewardsWithoutUnlock(tokenAddress: Address, lockerAddress?: Address): Promise<Hash>;
314
348
  updateRewardRecipient(tokenAddress: Address, rewardIndex: bigint, newRecipient: Address, lockerAddress?: Address): Promise<Hash>;
315
349
  isExtensionEnabled(extensionAddress: Address): Promise<boolean>;
350
+ getMevDescendingFeesBlockDelay(): Promise<bigint>;
351
+ /** @deprecated Use getMevDescendingFeesBlockDelay() */
316
352
  getMevBlockDelay(): Promise<bigint>;
317
353
  getPoolUnlockTime(poolId: Hex): Promise<bigint>;
318
354
  /**
@@ -1603,6 +1639,29 @@ declare const LiquidPoolExtensionAllowlistAbi: readonly [{
1603
1639
  readonly stateMutability: "view";
1604
1640
  }];
1605
1641
 
1642
+ declare const LiquidMevDescendingFeesAbi: readonly [{
1643
+ readonly type: "function";
1644
+ readonly name: "blockDelay";
1645
+ readonly inputs: readonly [];
1646
+ readonly outputs: readonly [{
1647
+ readonly name: "";
1648
+ readonly type: "uint256";
1649
+ }];
1650
+ readonly stateMutability: "view";
1651
+ }, {
1652
+ readonly type: "function";
1653
+ readonly name: "poolUnlockTime";
1654
+ readonly inputs: readonly [{
1655
+ readonly name: "poolId";
1656
+ readonly type: "bytes32";
1657
+ }];
1658
+ readonly outputs: readonly [{
1659
+ readonly name: "";
1660
+ readonly type: "uint256";
1661
+ }];
1662
+ readonly stateMutability: "view";
1663
+ }];
1664
+
1606
1665
  declare const LiquidMevBlockDelayAbi: readonly [{
1607
1666
  readonly type: "function";
1608
1667
  readonly name: "blockDelay";
@@ -2482,4 +2541,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
2482
2541
  */
2483
2542
  declare function parseMetadata(metadataString: string): LiquidMetadata | null;
2484
2543
 
2485
- export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
2544
+ export { ADDRESSES, type AirdropInfo, type BidInAuctionParams, type BidInAuctionResult, DEFAULTS, DEFAULT_CHAIN, DEFAULT_CHAIN_ID, DEFAULT_RPC_URL, DEFAULT_TRANCHES_USD, type DeployTokenParams, type DeployTokenResult, type DeploymentConfig, type DeploymentInfo, type DevBuyParams, type DynamicFeeConfig, ERC20Abi, EXTERNAL, type ExtensionConfig, FEE, FeePreference, type GetTokensOptions, LiquidAirdropV2Abi, type LiquidContext, LiquidFactoryAbi, LiquidFeeLockerAbi, LiquidHookDynamicFeeV2Abi, LiquidLpLockerAbi, type LiquidMetadata, LiquidMevBlockDelayAbi, LiquidMevDescendingFeesAbi, LiquidPoolExtensionAllowlistAbi, LiquidSDK, type LiquidSDKConfig, LiquidSniperAuctionV2Abi, LiquidSniperUtilV2Abi, LiquidTokenAbi, LiquidUniv4EthDevBuyAbi, LiquidVaultAbi, type LockerConfig, type MarketCapTranche, type MarketCapTrancheUSD, type MevModuleConfig, POOL_POSITIONS, type PoolConfig, type PoolDynamicConfigVars, type PoolDynamicFeeVars, type PoolKey, type PoolPosition, type PositionArrays, type PositionConfig, type SniperAuctionConfig, type SniperAuctionFeeConfig, type SniperAuctionState, type SocialMediaUrl, TOKEN, type TokenConfig, type TokenCreatedEvent, type TokenRewardInfo, type VaultAllocation, type VaultExtensionParams, buildContext, buildMetadata, createDefaultPositions, createPositions, createPositionsUSD, describePositions, encodeDynamicFeePoolData, encodeFeeConversionLockerData, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ __export(index_exports, {
36
36
  LiquidHookDynamicFeeV2Abi: () => LiquidHookDynamicFeeV2Abi,
37
37
  LiquidLpLockerAbi: () => LiquidLpLockerAbi,
38
38
  LiquidMevBlockDelayAbi: () => LiquidMevBlockDelayAbi,
39
+ LiquidMevDescendingFeesAbi: () => LiquidMevDescendingFeesAbi,
39
40
  LiquidPoolExtensionAllowlistAbi: () => LiquidPoolExtensionAllowlistAbi,
40
41
  LiquidSDK: () => LiquidSDK,
41
42
  LiquidSniperAuctionV2Abi: () => LiquidSniperAuctionV2Abi,
@@ -873,8 +874,8 @@ var LiquidPoolExtensionAllowlistAbi = [
873
874
  }
874
875
  ];
875
876
 
876
- // src/abis/LiquidMevBlockDelay.ts
877
- var LiquidMevBlockDelayAbi = [
877
+ // src/abis/LiquidMevDescendingFees.ts
878
+ var LiquidMevDescendingFeesAbi = [
878
879
  {
879
880
  type: "function",
880
881
  name: "blockDelay",
@@ -1143,6 +1144,63 @@ var LiquidSDK = class {
1143
1144
  extensionData
1144
1145
  };
1145
1146
  }
1147
+ /**
1148
+ * Build a vault extension config for token deployment.
1149
+ *
1150
+ * Locks a percentage of the token supply with a lockup period
1151
+ * followed by optional linear vesting.
1152
+ *
1153
+ * @param vault - Vault parameters
1154
+ * @returns ExtensionConfig to include in `deployToken({ extensions })`
1155
+ *
1156
+ * @example
1157
+ * ```typescript
1158
+ * const vaultExt = sdk.buildVaultExtension({
1159
+ * admin: account.address,
1160
+ * allocationBps: 2000, // 20% of supply
1161
+ * lockupDuration: 2592000, // 30 days in seconds
1162
+ * vestingDuration: 7776000, // 90 days linear vesting after lockup
1163
+ * });
1164
+ * const result = await sdk.deployToken({
1165
+ * name: "My Token", symbol: "MTK",
1166
+ * extensions: [vaultExt],
1167
+ * });
1168
+ * ```
1169
+ */
1170
+ buildVaultExtension(vault) {
1171
+ const MIN_LOCKUP = 604800;
1172
+ const MAX_BPS = 9e3;
1173
+ if (vault.allocationBps < 1 || vault.allocationBps > MAX_BPS) {
1174
+ throw new Error(`Vault allocationBps must be 1\u2013${MAX_BPS} (0.01%\u201390%). Got ${vault.allocationBps}.`);
1175
+ }
1176
+ if (vault.lockupDuration < MIN_LOCKUP) {
1177
+ throw new Error(`Vault lockupDuration must be \u2265 ${MIN_LOCKUP} seconds (7 days). Got ${vault.lockupDuration}.`);
1178
+ }
1179
+ if (vault.vestingDuration !== void 0 && vault.vestingDuration < 0) {
1180
+ throw new Error("Vault vestingDuration cannot be negative.");
1181
+ }
1182
+ const extensionData = (0, import_viem2.encodeAbiParameters)(
1183
+ [
1184
+ { type: "address" },
1185
+ // admin
1186
+ { type: "uint256" },
1187
+ // lockupDuration
1188
+ { type: "uint256" }
1189
+ // vestingDuration
1190
+ ],
1191
+ [
1192
+ vault.admin,
1193
+ BigInt(vault.lockupDuration),
1194
+ BigInt(vault.vestingDuration ?? 0)
1195
+ ]
1196
+ );
1197
+ return {
1198
+ extension: ADDRESSES.VAULT,
1199
+ msgValue: 0n,
1200
+ extensionBps: vault.allocationBps,
1201
+ extensionData
1202
+ };
1203
+ }
1146
1204
  // ── Validation ─────────────────────────────────────────────────
1147
1205
  /**
1148
1206
  * Validate a DeploymentConfig before sending to the contract.
@@ -1863,18 +1921,22 @@ var LiquidSDK = class {
1863
1921
  args: [extensionAddress]
1864
1922
  });
1865
1923
  }
1866
- // ── MEV Block Delay ─────────────────────────────────────────────────
1867
- async getMevBlockDelay() {
1924
+ // ── MEV Descending Fees ─────────────────────────────────────────────
1925
+ async getMevDescendingFeesBlockDelay() {
1868
1926
  return await this.publicClient.readContract({
1869
1927
  address: ADDRESSES.MEV_DESCENDING_FEES,
1870
- abi: LiquidMevBlockDelayAbi,
1928
+ abi: LiquidMevDescendingFeesAbi,
1871
1929
  functionName: "blockDelay"
1872
1930
  });
1873
1931
  }
1932
+ /** @deprecated Use getMevDescendingFeesBlockDelay() */
1933
+ async getMevBlockDelay() {
1934
+ return this.getMevDescendingFeesBlockDelay();
1935
+ }
1874
1936
  async getPoolUnlockTime(poolId) {
1875
1937
  return await this.publicClient.readContract({
1876
1938
  address: ADDRESSES.MEV_DESCENDING_FEES,
1877
- abi: LiquidMevBlockDelayAbi,
1939
+ abi: LiquidMevDescendingFeesAbi,
1878
1940
  functionName: "poolUnlockTime",
1879
1941
  args: [poolId]
1880
1942
  });
@@ -2021,6 +2083,24 @@ var LiquidSDK = class {
2021
2083
  }
2022
2084
  };
2023
2085
 
2086
+ // src/abis/LiquidMevBlockDelay.ts
2087
+ var LiquidMevBlockDelayAbi = [
2088
+ {
2089
+ type: "function",
2090
+ name: "blockDelay",
2091
+ inputs: [],
2092
+ outputs: [{ name: "", type: "uint256" }],
2093
+ stateMutability: "view"
2094
+ },
2095
+ {
2096
+ type: "function",
2097
+ name: "poolUnlockTime",
2098
+ inputs: [{ name: "poolId", type: "bytes32" }],
2099
+ outputs: [{ name: "", type: "uint256" }],
2100
+ stateMutability: "view"
2101
+ }
2102
+ ];
2103
+
2024
2104
  // src/abis/LiquidUniv4EthDevBuy.ts
2025
2105
  var LiquidUniv4EthDevBuyAbi = [
2026
2106
  {
@@ -2296,6 +2376,7 @@ function describePositions(positions, ethPriceUSD) {
2296
2376
  LiquidHookDynamicFeeV2Abi,
2297
2377
  LiquidLpLockerAbi,
2298
2378
  LiquidMevBlockDelayAbi,
2379
+ LiquidMevDescendingFeesAbi,
2299
2380
  LiquidPoolExtensionAllowlistAbi,
2300
2381
  LiquidSDK,
2301
2382
  LiquidSniperAuctionV2Abi,