@pancakeswap/infinity-sdk 1.0.3 → 1.0.4
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
CHANGED
|
@@ -6354,6 +6354,30 @@ var clPoolIdToPoolKey = async ({
|
|
|
6354
6354
|
}) => {
|
|
6355
6355
|
return poolIdToPoolKey({ poolId, poolType: "CL" /* CLAMM */, publicClient });
|
|
6356
6356
|
};
|
|
6357
|
+
|
|
6358
|
+
// src/utils/findHookByAddress.ts
|
|
6359
|
+
var findHookByAddress = async ({
|
|
6360
|
+
poolId,
|
|
6361
|
+
publicClient,
|
|
6362
|
+
chainId,
|
|
6363
|
+
poolType,
|
|
6364
|
+
hookAddress
|
|
6365
|
+
}) => {
|
|
6366
|
+
if (!hookAddress) {
|
|
6367
|
+
return null;
|
|
6368
|
+
}
|
|
6369
|
+
const whiteListedHook = findHook(hookAddress, chainId);
|
|
6370
|
+
if (whiteListedHook) {
|
|
6371
|
+
return whiteListedHook;
|
|
6372
|
+
}
|
|
6373
|
+
const poolKey = await poolIdToPoolKey({ poolId, publicClient, poolType });
|
|
6374
|
+
const hook = {
|
|
6375
|
+
address: hookAddress,
|
|
6376
|
+
poolType: poolType === "CL" ? "CL" /* CLAMM */ : "Bin" /* Bin */,
|
|
6377
|
+
hooksRegistration: poolKey?.parameters.hooksRegistration
|
|
6378
|
+
};
|
|
6379
|
+
return hook;
|
|
6380
|
+
};
|
|
6357
6381
|
var encodeBinPositionModifyLiquidities = (calls, deadline) => {
|
|
6358
6382
|
return viem.encodeFunctionData({
|
|
6359
6383
|
abi: BinPositionManagerAbi,
|
|
@@ -7693,6 +7717,7 @@ exports.encodeHooksRegistration = encodeHooksRegistration;
|
|
|
7693
7717
|
exports.encodePoolKey = encodePoolKey;
|
|
7694
7718
|
exports.encodePoolParameters = encodePoolParameters;
|
|
7695
7719
|
exports.findHook = findHook;
|
|
7720
|
+
exports.findHookByAddress = findHookByAddress;
|
|
7696
7721
|
exports.getAddBinParams = getAddBinParams;
|
|
7697
7722
|
exports.getAmounts = getAmounts;
|
|
7698
7723
|
exports.getBidAskLiquidityShape = getBidAskLiquidityShape;
|
package/dist/index.mjs
CHANGED
|
@@ -6348,6 +6348,30 @@ var clPoolIdToPoolKey = async ({
|
|
|
6348
6348
|
}) => {
|
|
6349
6349
|
return poolIdToPoolKey({ poolId, poolType: "CL" /* CLAMM */, publicClient });
|
|
6350
6350
|
};
|
|
6351
|
+
|
|
6352
|
+
// src/utils/findHookByAddress.ts
|
|
6353
|
+
var findHookByAddress = async ({
|
|
6354
|
+
poolId,
|
|
6355
|
+
publicClient,
|
|
6356
|
+
chainId,
|
|
6357
|
+
poolType,
|
|
6358
|
+
hookAddress
|
|
6359
|
+
}) => {
|
|
6360
|
+
if (!hookAddress) {
|
|
6361
|
+
return null;
|
|
6362
|
+
}
|
|
6363
|
+
const whiteListedHook = findHook(hookAddress, chainId);
|
|
6364
|
+
if (whiteListedHook) {
|
|
6365
|
+
return whiteListedHook;
|
|
6366
|
+
}
|
|
6367
|
+
const poolKey = await poolIdToPoolKey({ poolId, publicClient, poolType });
|
|
6368
|
+
const hook = {
|
|
6369
|
+
address: hookAddress,
|
|
6370
|
+
poolType: poolType === "CL" ? "CL" /* CLAMM */ : "Bin" /* Bin */,
|
|
6371
|
+
hooksRegistration: poolKey?.parameters.hooksRegistration
|
|
6372
|
+
};
|
|
6373
|
+
return hook;
|
|
6374
|
+
};
|
|
6351
6375
|
var encodeBinPositionModifyLiquidities = (calls, deadline) => {
|
|
6352
6376
|
return encodeFunctionData({
|
|
6353
6377
|
abi: BinPositionManagerAbi,
|
|
@@ -7583,4 +7607,4 @@ var Pool = class {
|
|
|
7583
7607
|
}
|
|
7584
7608
|
};
|
|
7585
7609
|
|
|
7586
|
-
export { ACTIONS, ACTIONS_ABI, ACTION_CONSTANTS, ActionsPlanner, BASIS_POINT_MAX, BIN_DYNAMIC_FEE_HOOKS_BY_CHAIN, BIN_DYNAMIC_FEE_HOOK_REGISTRATION_BITMAP, BIN_SHAPE_DISTRIBUTION_SUM, BinLiquidityShape, BinMigratorAbi, BinPoolManagerAbi, BinPositionManagerAbi, BinQuoterAbi, CLMigratorAbi, CLPoolManagerAbi, CLPositionManagerAbi, CLQuoterAbi, CL_DYNAMIC_FEE_HOOKS_BY_CHAIN, CL_DYNAMIC_FEE_HOOK_REGISTRATION_BITMAP, DYNAMIC_FEE_FLAG, FARMING_OFFCHAIN_ABI, FARMING_OFFCHAIN_CL_HELPER_ABI, HOOKS_REGISTRATION_OFFSET, HOOK_CATEGORY, HookType, INFINITY_SUPPORTED_CHAINS, INFI_BIN_MIGRATOR_ADDRESSES, INFI_BIN_POOL_MANAGER_ADDRESSES, INFI_BIN_POSITION_MANAGER_ADDRESSES, INFI_BIN_PROTOCOL_FEE_CONTROLLER_ADDRESSES, INFI_BIN_QUOTER_ADDRESSES, INFI_CL_LP_FEES_HELPER_ADDRESSES, INFI_CL_MIGRATOR_ADDRESSES, INFI_CL_POOL_MANAGER_ADDRESSES, INFI_CL_POSITION_MANAGER_ADDRESSES, INFI_CL_PROTOCOL_FEE_CONTROLLER_ADDRESSES, INFI_CL_QUOTER_ADDRESSES, INFI_CL_TICK_LENS_ADDRESSES, INFI_FARMING_DISTRIBUTOR_ADDRESSES, INFI_MIXED_QUOTER_ADDRESSES, INFI_VAULT_ADDRESSES, MAX_BIN_STEP, MAX_PROTOCOL_FEE, MAX_TICK_SPACING, MIN_BIN_STEP, MIN_TICK_SPACING, MixedQuoterAbi, ONE_HUNDRED_PERCENT_FEE, POOL_TYPE, PRECISION, Permit2ForwardAbi, Pool, ProtocolFeeControllerAbi, REAL_ID_SHIFT, SCALE, SCALE_OFFSET, SQUARED_PRECISION, TEN_PERCENT_FEE, TreeMath, VaultAbi, addBinLiquidityMulticall, addCLLiquidityMulticall, binPoolIdToPoolKey, binPoolMintCalldata, binPoolSwapCalldata, clPoolIdToPoolKey, convert128x128ToDecimalPrice, convertBinIdsToRelative, convertDecimalPriceTo128x128, createBinPool, decodeBinPoolParameters, decodeCLPoolParameters, decodeHooksRegistration, decodePoolKey, dynamicHooksList4 as dynamicHooksList, encodeBinPoolParameters, encodeBinPositionManagerAddLiquidityCalldata, encodeBinPositionManagerInitializePoolCalldata, encodeBinPositionManagerRemoveLiquidityCalldata, encodeBinPositionModifyLiquidities, encodeCLPoolDonateCalldata, encodeCLPoolInitializeCalldata, encodeCLPoolModifyLiquidityCalldata, encodeCLPoolParameters, encodeCLPoolSwapCalldata, encodeCLPositionManagerBurnCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerInitializePoolCalldata, encodeCLPositionManagerMintCalldata, encodeCLPositionModifyLiquidities, encodeClaimCalldata, encodeHooksRegistration, encodePoolKey, encodePoolParameters, findHook, getAddBinParams, getAmounts, getBidAskLiquidityShape, getBinIds, getBinPoolTokenPrice, getCLPool, getCurrencyPriceFromId, getCurveLiquidityShape, getExternalFeeAmt, getFeeAmount, getFeeAmountFrom, getIdFromCurrencyPrice, getIdFromInvertedPrice, getIdFromPrice, getIdSlippage, getInvertedPriceFromId, getIsInitializedByPoolKey, getLiquidityShape, getNextNonEmptyBin, getPool, getPoolId, getPriceFromId, getPriceX128FromId, getSpotLiquidityShape, getSwapIn, getSwapOut, hooksList, isDynamicFeeHook, isDynamicFeeHookForSupportedChains, isInfinitySupported, mulShiftRoundDown, mulShiftRoundUp, parsePoolKey, parseProtocolFees, parseProtocolFeesToNumbers, parseReserveOfBin, poolIdToPoolKey, shiftDivRoundDown, shiftDivRoundUp, swap };
|
|
7610
|
+
export { ACTIONS, ACTIONS_ABI, ACTION_CONSTANTS, ActionsPlanner, BASIS_POINT_MAX, BIN_DYNAMIC_FEE_HOOKS_BY_CHAIN, BIN_DYNAMIC_FEE_HOOK_REGISTRATION_BITMAP, BIN_SHAPE_DISTRIBUTION_SUM, BinLiquidityShape, BinMigratorAbi, BinPoolManagerAbi, BinPositionManagerAbi, BinQuoterAbi, CLMigratorAbi, CLPoolManagerAbi, CLPositionManagerAbi, CLQuoterAbi, CL_DYNAMIC_FEE_HOOKS_BY_CHAIN, CL_DYNAMIC_FEE_HOOK_REGISTRATION_BITMAP, DYNAMIC_FEE_FLAG, FARMING_OFFCHAIN_ABI, FARMING_OFFCHAIN_CL_HELPER_ABI, HOOKS_REGISTRATION_OFFSET, HOOK_CATEGORY, HookType, INFINITY_SUPPORTED_CHAINS, INFI_BIN_MIGRATOR_ADDRESSES, INFI_BIN_POOL_MANAGER_ADDRESSES, INFI_BIN_POSITION_MANAGER_ADDRESSES, INFI_BIN_PROTOCOL_FEE_CONTROLLER_ADDRESSES, INFI_BIN_QUOTER_ADDRESSES, INFI_CL_LP_FEES_HELPER_ADDRESSES, INFI_CL_MIGRATOR_ADDRESSES, INFI_CL_POOL_MANAGER_ADDRESSES, INFI_CL_POSITION_MANAGER_ADDRESSES, INFI_CL_PROTOCOL_FEE_CONTROLLER_ADDRESSES, INFI_CL_QUOTER_ADDRESSES, INFI_CL_TICK_LENS_ADDRESSES, INFI_FARMING_DISTRIBUTOR_ADDRESSES, INFI_MIXED_QUOTER_ADDRESSES, INFI_VAULT_ADDRESSES, MAX_BIN_STEP, MAX_PROTOCOL_FEE, MAX_TICK_SPACING, MIN_BIN_STEP, MIN_TICK_SPACING, MixedQuoterAbi, ONE_HUNDRED_PERCENT_FEE, POOL_TYPE, PRECISION, Permit2ForwardAbi, Pool, ProtocolFeeControllerAbi, REAL_ID_SHIFT, SCALE, SCALE_OFFSET, SQUARED_PRECISION, TEN_PERCENT_FEE, TreeMath, VaultAbi, addBinLiquidityMulticall, addCLLiquidityMulticall, binPoolIdToPoolKey, binPoolMintCalldata, binPoolSwapCalldata, clPoolIdToPoolKey, convert128x128ToDecimalPrice, convertBinIdsToRelative, convertDecimalPriceTo128x128, createBinPool, decodeBinPoolParameters, decodeCLPoolParameters, decodeHooksRegistration, decodePoolKey, dynamicHooksList4 as dynamicHooksList, encodeBinPoolParameters, encodeBinPositionManagerAddLiquidityCalldata, encodeBinPositionManagerInitializePoolCalldata, encodeBinPositionManagerRemoveLiquidityCalldata, encodeBinPositionModifyLiquidities, encodeCLPoolDonateCalldata, encodeCLPoolInitializeCalldata, encodeCLPoolModifyLiquidityCalldata, encodeCLPoolParameters, encodeCLPoolSwapCalldata, encodeCLPositionManagerBurnCalldata, encodeCLPositionManagerDecreaseLiquidityCalldata, encodeCLPositionManagerIncreaseLiquidityCalldata, encodeCLPositionManagerInitializePoolCalldata, encodeCLPositionManagerMintCalldata, encodeCLPositionModifyLiquidities, encodeClaimCalldata, encodeHooksRegistration, encodePoolKey, encodePoolParameters, findHook, findHookByAddress, getAddBinParams, getAmounts, getBidAskLiquidityShape, getBinIds, getBinPoolTokenPrice, getCLPool, getCurrencyPriceFromId, getCurveLiquidityShape, getExternalFeeAmt, getFeeAmount, getFeeAmountFrom, getIdFromCurrencyPrice, getIdFromInvertedPrice, getIdFromPrice, getIdSlippage, getInvertedPriceFromId, getIsInitializedByPoolKey, getLiquidityShape, getNextNonEmptyBin, getPool, getPoolId, getPriceFromId, getPriceX128FromId, getSpotLiquidityShape, getSwapIn, getSwapOut, hooksList, isDynamicFeeHook, isDynamicFeeHookForSupportedChains, isInfinitySupported, mulShiftRoundDown, mulShiftRoundUp, parsePoolKey, parseProtocolFees, parseProtocolFeesToNumbers, parseReserveOfBin, poolIdToPoolKey, shiftDivRoundDown, shiftDivRoundUp, swap };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Hex, PublicClient } from 'viem';
|
|
2
|
+
import { hooksList } from '../constants';
|
|
3
|
+
import { HookData, PoolType } from '../types';
|
|
4
|
+
export declare const findHookByAddress: ({ poolId, publicClient, chainId, poolType, hookAddress, }: {
|
|
5
|
+
poolId: Hex | undefined;
|
|
6
|
+
chainId: keyof typeof hooksList;
|
|
7
|
+
publicClient: PublicClient | undefined;
|
|
8
|
+
poolType: PoolType;
|
|
9
|
+
hookAddress?: `0x${string}`;
|
|
10
|
+
}) => Promise<HookData | null>;
|
|
11
|
+
//# sourceMappingURL=findHookByAddress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findHookByAddress.d.ts","sourceRoot":"","sources":["../../src/utils/findHookByAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AACxC,OAAO,EAAY,SAAS,EAAE,MAAM,cAAc,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAa,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExD,eAAO,MAAM,iBAAiB,8DAM3B;IACD,MAAM,EAAE,GAAG,GAAG,SAAS,CAAA;IACvB,OAAO,EAAE,MAAM,OAAO,SAAS,CAAA;IAC/B,YAAY,EAAE,YAAY,GAAG,SAAS,CAAA;IACtC,QAAQ,EAAE,QAAQ,CAAA;IAClB,WAAW,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;CAC5B,6BAiBA,CAAA"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,QAAQ,CAAA;AACtB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAA;AAChC,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,aAAa,CAAA;AAC3B,cAAc,uBAAuB,CAAA;AACrC,cAAc,QAAQ,CAAA;AACtB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mBAAmB,CAAA;AACjC,cAAc,qBAAqB,CAAA"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "1.0.
|
|
7
|
+
"version": "1.0.4",
|
|
8
8
|
"description": "⚒️ An SDK for building applications on top of Pancakeswap Infinity",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist"
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
"bignumber.js": "^9.0.0",
|
|
22
22
|
"tiny-invariant": "^1.3.3",
|
|
23
23
|
"viem": "2.31.3",
|
|
24
|
-
"@pancakeswap/chains": "0.
|
|
25
|
-
"@pancakeswap/swap-sdk-core": "1.
|
|
26
|
-
"@pancakeswap/v3-sdk": "3.9.
|
|
27
|
-
"@pancakeswap/permit2-sdk": "1.1.
|
|
24
|
+
"@pancakeswap/chains": "0.6.0",
|
|
25
|
+
"@pancakeswap/swap-sdk-core": "1.5.0",
|
|
26
|
+
"@pancakeswap/v3-sdk": "3.9.5",
|
|
27
|
+
"@pancakeswap/permit2-sdk": "1.1.5"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"tsup": "^6.7.0",
|
|
31
|
-
"@pancakeswap/swap-sdk-evm": "1.1.
|
|
32
|
-
"@pancakeswap/utils": "
|
|
31
|
+
"@pancakeswap/swap-sdk-evm": "1.1.5",
|
|
32
|
+
"@pancakeswap/utils": "8.0.0"
|
|
33
33
|
},
|
|
34
34
|
"engines": {
|
|
35
35
|
"node": ">=10"
|