liquid-sdk 1.3.0 → 1.3.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/README.md +4 -9
- package/dist/index.d.mts +34 -2
- package/dist/index.d.ts +34 -2
- package/dist/index.js +48 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,25 +13,20 @@ npm install liquid-sdk viem
|
|
|
13
13
|
## Quick Start
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
import {
|
|
16
|
+
import { createWalletClient, http } from "viem";
|
|
17
17
|
import { privateKeyToAccount } from "viem/accounts";
|
|
18
18
|
import { base } from "viem/chains";
|
|
19
19
|
import { LiquidSDK } from "liquid-sdk";
|
|
20
20
|
|
|
21
21
|
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
|
|
22
22
|
|
|
23
|
-
const publicClient = createPublicClient({
|
|
24
|
-
chain: base,
|
|
25
|
-
transport: http(),
|
|
26
|
-
});
|
|
27
|
-
|
|
28
23
|
const walletClient = createWalletClient({
|
|
29
24
|
account,
|
|
30
25
|
chain: base,
|
|
31
26
|
transport: http(),
|
|
32
27
|
});
|
|
33
28
|
|
|
34
|
-
const liquid = new LiquidSDK({
|
|
29
|
+
const liquid = new LiquidSDK({ walletClient });
|
|
35
30
|
```
|
|
36
31
|
|
|
37
32
|
## Deploy a Token
|
|
@@ -219,11 +214,11 @@ import {
|
|
|
219
214
|
#### Constructor
|
|
220
215
|
|
|
221
216
|
```typescript
|
|
222
|
-
new LiquidSDK({
|
|
217
|
+
new LiquidSDK({ walletClient, publicClient? })
|
|
223
218
|
```
|
|
224
219
|
|
|
225
|
-
- `publicClient` (required) - viem `PublicClient` connected to Base
|
|
226
220
|
- `walletClient` (optional) - viem `WalletClient` for write operations
|
|
221
|
+
- `publicClient` (optional) - viem `PublicClient` connected to Base (auto-created if omitted)
|
|
227
222
|
|
|
228
223
|
#### Methods
|
|
229
224
|
|
package/dist/index.d.mts
CHANGED
|
@@ -194,7 +194,7 @@ interface TokenRewardInfo {
|
|
|
194
194
|
rewardRecipients: Address[];
|
|
195
195
|
}
|
|
196
196
|
interface LiquidSDKConfig {
|
|
197
|
-
publicClient
|
|
197
|
+
publicClient?: any;
|
|
198
198
|
walletClient?: any;
|
|
199
199
|
}
|
|
200
200
|
interface DeployTokenResult {
|
|
@@ -2311,6 +2311,38 @@ interface SniperAuctionConfig {
|
|
|
2311
2311
|
* ```
|
|
2312
2312
|
*/
|
|
2313
2313
|
declare function encodeSniperAuctionData(config: SniperAuctionConfig): Hex;
|
|
2314
|
+
/**
|
|
2315
|
+
* Fee preference for LP_LOCKER_FEE_CONVERSION.
|
|
2316
|
+
* Determines which token each reward recipient receives their fees in.
|
|
2317
|
+
*
|
|
2318
|
+
* - `Both` (0): No conversion, fees paid in whichever token accrues
|
|
2319
|
+
* - `Paired` (1): Convert fees to paired token (usually WETH)
|
|
2320
|
+
* - `Liquid` (2): Convert fees to the liquid token
|
|
2321
|
+
*/
|
|
2322
|
+
declare enum FeePreference {
|
|
2323
|
+
Both = 0,
|
|
2324
|
+
Paired = 1,
|
|
2325
|
+
Liquid = 2
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Encode lockerData for LP_LOCKER_FEE_CONVERSION.
|
|
2329
|
+
*
|
|
2330
|
+
* The fee conversion locker requires a `FeeIn[]` array with one entry per
|
|
2331
|
+
* reward recipient, specifying how each recipient wants their fees.
|
|
2332
|
+
*
|
|
2333
|
+
* @param feePreferences - Array of FeePreference values, one per reward recipient
|
|
2334
|
+
* @returns Encoded lockerData hex string
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* ```ts
|
|
2338
|
+
* // Single recipient, fees converted to ETH
|
|
2339
|
+
* const lockerData = encodeFeeConversionLockerData([FeePreference.Paired]);
|
|
2340
|
+
*
|
|
2341
|
+
* // Two recipients: first gets ETH, second gets the token
|
|
2342
|
+
* const lockerData = encodeFeeConversionLockerData([FeePreference.Paired, FeePreference.Liquid]);
|
|
2343
|
+
* ```
|
|
2344
|
+
*/
|
|
2345
|
+
declare function encodeFeeConversionLockerData(feePreferences: FeePreference[]): Hex;
|
|
2314
2346
|
|
|
2315
2347
|
/** Provenance — who launched the token and from where. */
|
|
2316
2348
|
interface LiquidContext {
|
|
@@ -2364,4 +2396,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
|
|
|
2364
2396
|
*/
|
|
2365
2397
|
declare function parseMetadata(metadataString: string): LiquidMetadata | null;
|
|
2366
2398
|
|
|
2367
|
-
export { ADDRESSES, type AirdropInfo, 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, 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, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
|
|
2399
|
+
export { ADDRESSES, type AirdropInfo, 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -194,7 +194,7 @@ interface TokenRewardInfo {
|
|
|
194
194
|
rewardRecipients: Address[];
|
|
195
195
|
}
|
|
196
196
|
interface LiquidSDKConfig {
|
|
197
|
-
publicClient
|
|
197
|
+
publicClient?: any;
|
|
198
198
|
walletClient?: any;
|
|
199
199
|
}
|
|
200
200
|
interface DeployTokenResult {
|
|
@@ -2311,6 +2311,38 @@ interface SniperAuctionConfig {
|
|
|
2311
2311
|
* ```
|
|
2312
2312
|
*/
|
|
2313
2313
|
declare function encodeSniperAuctionData(config: SniperAuctionConfig): Hex;
|
|
2314
|
+
/**
|
|
2315
|
+
* Fee preference for LP_LOCKER_FEE_CONVERSION.
|
|
2316
|
+
* Determines which token each reward recipient receives their fees in.
|
|
2317
|
+
*
|
|
2318
|
+
* - `Both` (0): No conversion, fees paid in whichever token accrues
|
|
2319
|
+
* - `Paired` (1): Convert fees to paired token (usually WETH)
|
|
2320
|
+
* - `Liquid` (2): Convert fees to the liquid token
|
|
2321
|
+
*/
|
|
2322
|
+
declare enum FeePreference {
|
|
2323
|
+
Both = 0,
|
|
2324
|
+
Paired = 1,
|
|
2325
|
+
Liquid = 2
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Encode lockerData for LP_LOCKER_FEE_CONVERSION.
|
|
2329
|
+
*
|
|
2330
|
+
* The fee conversion locker requires a `FeeIn[]` array with one entry per
|
|
2331
|
+
* reward recipient, specifying how each recipient wants their fees.
|
|
2332
|
+
*
|
|
2333
|
+
* @param feePreferences - Array of FeePreference values, one per reward recipient
|
|
2334
|
+
* @returns Encoded lockerData hex string
|
|
2335
|
+
*
|
|
2336
|
+
* @example
|
|
2337
|
+
* ```ts
|
|
2338
|
+
* // Single recipient, fees converted to ETH
|
|
2339
|
+
* const lockerData = encodeFeeConversionLockerData([FeePreference.Paired]);
|
|
2340
|
+
*
|
|
2341
|
+
* // Two recipients: first gets ETH, second gets the token
|
|
2342
|
+
* const lockerData = encodeFeeConversionLockerData([FeePreference.Paired, FeePreference.Liquid]);
|
|
2343
|
+
* ```
|
|
2344
|
+
*/
|
|
2345
|
+
declare function encodeFeeConversionLockerData(feePreferences: FeePreference[]): Hex;
|
|
2314
2346
|
|
|
2315
2347
|
/** Provenance — who launched the token and from where. */
|
|
2316
2348
|
interface LiquidContext {
|
|
@@ -2364,4 +2396,4 @@ declare function parseContext(contextString: string): LiquidContext | null;
|
|
|
2364
2396
|
*/
|
|
2365
2397
|
declare function parseMetadata(metadataString: string): LiquidMetadata | null;
|
|
2366
2398
|
|
|
2367
|
-
export { ADDRESSES, type AirdropInfo, 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, 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, encodeSniperAuctionData, encodeStaticFeePoolData, getTickFromMarketCapETH, getTickFromMarketCapStable, getTickFromMarketCapUSD, marketCapFromTickETH, marketCapFromTickUSD, parseContext, parseMetadata };
|
|
2399
|
+
export { ADDRESSES, type AirdropInfo, 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 };
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(index_exports, {
|
|
|
29
29
|
ERC20Abi: () => ERC20Abi,
|
|
30
30
|
EXTERNAL: () => EXTERNAL,
|
|
31
31
|
FEE: () => FEE,
|
|
32
|
+
FeePreference: () => FeePreference,
|
|
32
33
|
LiquidAirdropV2Abi: () => LiquidAirdropV2Abi,
|
|
33
34
|
LiquidFactoryAbi: () => LiquidFactoryAbi,
|
|
34
35
|
LiquidFeeLockerAbi: () => LiquidFeeLockerAbi,
|
|
@@ -51,6 +52,7 @@ __export(index_exports, {
|
|
|
51
52
|
createPositionsUSD: () => createPositionsUSD,
|
|
52
53
|
describePositions: () => describePositions,
|
|
53
54
|
encodeDynamicFeePoolData: () => encodeDynamicFeePoolData,
|
|
55
|
+
encodeFeeConversionLockerData: () => encodeFeeConversionLockerData,
|
|
54
56
|
encodeSniperAuctionData: () => encodeSniperAuctionData,
|
|
55
57
|
encodeStaticFeePoolData: () => encodeStaticFeePoolData,
|
|
56
58
|
getTickFromMarketCapETH: () => getTickFromMarketCapETH,
|
|
@@ -260,6 +262,25 @@ function encodeSniperAuctionData(config) {
|
|
|
260
262
|
}
|
|
261
263
|
]);
|
|
262
264
|
}
|
|
265
|
+
var FeePreference = /* @__PURE__ */ ((FeePreference2) => {
|
|
266
|
+
FeePreference2[FeePreference2["Both"] = 0] = "Both";
|
|
267
|
+
FeePreference2[FeePreference2["Paired"] = 1] = "Paired";
|
|
268
|
+
FeePreference2[FeePreference2["Liquid"] = 2] = "Liquid";
|
|
269
|
+
return FeePreference2;
|
|
270
|
+
})(FeePreference || {});
|
|
271
|
+
function encodeFeeConversionLockerData(feePreferences) {
|
|
272
|
+
return (0, import_viem.encodeAbiParameters)(
|
|
273
|
+
[
|
|
274
|
+
{
|
|
275
|
+
type: "tuple",
|
|
276
|
+
components: [
|
|
277
|
+
{ name: "feePreference", type: "uint8[]" }
|
|
278
|
+
]
|
|
279
|
+
}
|
|
280
|
+
],
|
|
281
|
+
[{ feePreference: feePreferences }]
|
|
282
|
+
);
|
|
283
|
+
}
|
|
263
284
|
|
|
264
285
|
// src/utils/context.ts
|
|
265
286
|
function buildContext(input) {
|
|
@@ -1061,7 +1082,10 @@ var LiquidSDK = class {
|
|
|
1061
1082
|
publicClient;
|
|
1062
1083
|
walletClient;
|
|
1063
1084
|
constructor(config) {
|
|
1064
|
-
this.publicClient = config.publicClient
|
|
1085
|
+
this.publicClient = config.publicClient ?? (0, import_viem2.createPublicClient)({
|
|
1086
|
+
chain: import_chains2.base,
|
|
1087
|
+
transport: (0, import_viem2.http)()
|
|
1088
|
+
});
|
|
1065
1089
|
this.walletClient = config.walletClient;
|
|
1066
1090
|
}
|
|
1067
1091
|
// ── Dev Buy Helper ───────────────────────────────────────────────
|
|
@@ -1235,16 +1259,27 @@ var LiquidSDK = class {
|
|
|
1235
1259
|
DEFAULTS.PAIRED_FEE_BPS
|
|
1236
1260
|
)
|
|
1237
1261
|
},
|
|
1238
|
-
lockerConfig: {
|
|
1239
|
-
locker
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1262
|
+
lockerConfig: (() => {
|
|
1263
|
+
const locker = params.locker ?? DEFAULTS.LOCKER;
|
|
1264
|
+
const rewardRecipients = params.rewardRecipients ?? [account];
|
|
1265
|
+
const rewardBps = params.rewardBps ?? [1e4];
|
|
1266
|
+
let lockerData = params.lockerData ?? "0x";
|
|
1267
|
+
if (lockerData === "0x" && (0, import_viem2.getAddress)(locker) === (0, import_viem2.getAddress)(ADDRESSES.LP_LOCKER_FEE_CONVERSION)) {
|
|
1268
|
+
lockerData = encodeFeeConversionLockerData(
|
|
1269
|
+
rewardRecipients.map(() => 1 /* Paired */)
|
|
1270
|
+
);
|
|
1271
|
+
}
|
|
1272
|
+
return {
|
|
1273
|
+
locker,
|
|
1274
|
+
rewardAdmins: params.rewardAdmins ?? [account],
|
|
1275
|
+
rewardRecipients,
|
|
1276
|
+
rewardBps,
|
|
1277
|
+
tickLower: params.tickLower ?? POOL_POSITIONS.Liquid.map((p) => p.tickLower),
|
|
1278
|
+
tickUpper: params.tickUpper ?? POOL_POSITIONS.Liquid.map((p) => p.tickUpper),
|
|
1279
|
+
positionBps: params.positionBps ?? POOL_POSITIONS.Liquid.map((p) => p.positionBps),
|
|
1280
|
+
lockerData
|
|
1281
|
+
};
|
|
1282
|
+
})(),
|
|
1248
1283
|
mevModuleConfig: {
|
|
1249
1284
|
mevModule: params.mevModule ?? DEFAULTS.MEV_MODULE,
|
|
1250
1285
|
mevModuleData: params.mevModuleData ?? encodeSniperAuctionData({
|
|
@@ -2125,6 +2160,7 @@ function describePositions(positions, ethPriceUSD) {
|
|
|
2125
2160
|
ERC20Abi,
|
|
2126
2161
|
EXTERNAL,
|
|
2127
2162
|
FEE,
|
|
2163
|
+
FeePreference,
|
|
2128
2164
|
LiquidAirdropV2Abi,
|
|
2129
2165
|
LiquidFactoryAbi,
|
|
2130
2166
|
LiquidFeeLockerAbi,
|
|
@@ -2147,6 +2183,7 @@ function describePositions(positions, ethPriceUSD) {
|
|
|
2147
2183
|
createPositionsUSD,
|
|
2148
2184
|
describePositions,
|
|
2149
2185
|
encodeDynamicFeePoolData,
|
|
2186
|
+
encodeFeeConversionLockerData,
|
|
2150
2187
|
encodeSniperAuctionData,
|
|
2151
2188
|
encodeStaticFeePoolData,
|
|
2152
2189
|
getTickFromMarketCapETH,
|