@apex_labs/sdk 0.1.0 → 0.1.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/README.md +72 -72
- package/dist/index.cjs +138 -82
- package/dist/index.d.cts +240 -194
- package/dist/index.d.ts +240 -194
- package/dist/index.js +119 -82
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21677,18 +21677,18 @@ var veApexTokenAbi = VeApexToken_default;
|
|
|
21677
21677
|
// src/apex.ts
|
|
21678
21678
|
import invariant from "tiny-invariant";
|
|
21679
21679
|
var APEX_CL_POOL_INIT_CODE_HASH = "0x729244f9ae271982f4db70bf3f8e3365ebd0885c52025b09324c6c1f79aae32c";
|
|
21680
|
-
var
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
|
|
21687
|
-
|
|
21688
|
-
|
|
21689
|
-
return
|
|
21690
|
-
})(
|
|
21691
|
-
var
|
|
21680
|
+
var CLFeeAmount = /* @__PURE__ */ ((CLFeeAmount2) => {
|
|
21681
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_01"] = 100] = "FEE_0_01";
|
|
21682
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_02"] = 200] = "FEE_0_02";
|
|
21683
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_05"] = 500] = "FEE_0_05";
|
|
21684
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_10"] = 1e3] = "FEE_0_10";
|
|
21685
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_20"] = 2e3] = "FEE_0_20";
|
|
21686
|
+
CLFeeAmount2[CLFeeAmount2["FEE_0_30"] = 3e3] = "FEE_0_30";
|
|
21687
|
+
CLFeeAmount2[CLFeeAmount2["FEE_1_00"] = 1e4] = "FEE_1_00";
|
|
21688
|
+
CLFeeAmount2[CLFeeAmount2["FEE_2_00"] = 2e4] = "FEE_2_00";
|
|
21689
|
+
return CLFeeAmount2;
|
|
21690
|
+
})(CLFeeAmount || {});
|
|
21691
|
+
var CL_TICK_SPACINGS = {
|
|
21692
21692
|
[100 /* FEE_0_01 */]: 1,
|
|
21693
21693
|
[200 /* FEE_0_02 */]: 4,
|
|
21694
21694
|
[500 /* FEE_0_05 */]: 10,
|
|
@@ -21699,25 +21699,25 @@ var APEX_CL_TICK_SPACINGS = {
|
|
|
21699
21699
|
[2e4 /* FEE_2_00 */]: 400
|
|
21700
21700
|
};
|
|
21701
21701
|
var APEX_CL_PROTOCOL_FEE_DENOMINATOR = 10000n;
|
|
21702
|
-
function
|
|
21703
|
-
Object.assign(TICK_SPACINGS,
|
|
21702
|
+
function installCLFeeTiers() {
|
|
21703
|
+
Object.assign(TICK_SPACINGS, CL_TICK_SPACINGS);
|
|
21704
21704
|
}
|
|
21705
|
-
|
|
21706
|
-
function
|
|
21707
|
-
return Object.prototype.hasOwnProperty.call(
|
|
21705
|
+
installCLFeeTiers();
|
|
21706
|
+
function isCLFeeAmount(_fee) {
|
|
21707
|
+
return Object.prototype.hasOwnProperty.call(CL_TICK_SPACINGS, _fee);
|
|
21708
21708
|
}
|
|
21709
|
-
function
|
|
21710
|
-
invariant(
|
|
21709
|
+
function toCLFeeAmount(_fee) {
|
|
21710
|
+
invariant(isCLFeeAmount(_fee), `unsupported CL fee tier: ${_fee}`);
|
|
21711
21711
|
return _fee;
|
|
21712
21712
|
}
|
|
21713
21713
|
function asPancakeFeeAmount(_fee) {
|
|
21714
|
-
return
|
|
21714
|
+
return toCLFeeAmount(_fee);
|
|
21715
21715
|
}
|
|
21716
|
-
function
|
|
21717
|
-
return
|
|
21716
|
+
function getCLTickSpacing(_fee) {
|
|
21717
|
+
return CL_TICK_SPACINGS[toCLFeeAmount(_fee)];
|
|
21718
21718
|
}
|
|
21719
|
-
function
|
|
21720
|
-
|
|
21719
|
+
function createCLPool(_params) {
|
|
21720
|
+
installCLFeeTiers();
|
|
21721
21721
|
return new Pool(
|
|
21722
21722
|
_params.tokenA,
|
|
21723
21723
|
_params.tokenB,
|
|
@@ -21737,13 +21737,19 @@ function computeCLPoolAddress(_params) {
|
|
|
21737
21737
|
initCodeHashManualOverride: _params.config.clInitCodeHash ?? APEX_CL_POOL_INIT_CODE_HASH
|
|
21738
21738
|
});
|
|
21739
21739
|
}
|
|
21740
|
+
var APEX_CL_TICK_SPACINGS = CL_TICK_SPACINGS;
|
|
21741
|
+
var installApexFeeTiers = installCLFeeTiers;
|
|
21742
|
+
var isApexCLFeeAmount = isCLFeeAmount;
|
|
21743
|
+
var toApexFeeAmount = toCLFeeAmount;
|
|
21744
|
+
var getApexTickSpacing = getCLTickSpacing;
|
|
21745
|
+
var createApexPool = createCLPool;
|
|
21740
21746
|
var computeApexCLPoolAddress = computeCLPoolAddress;
|
|
21741
21747
|
|
|
21742
21748
|
// src/classic.ts
|
|
21743
21749
|
import invariant2 from "tiny-invariant";
|
|
21744
21750
|
import { concatHex, encodePacked as encodePacked2, getAddress as getAddress2, isAddress, keccak256 as keccak2562 } from "viem";
|
|
21745
21751
|
var APEX_CLASSIC_FEE_DENOMINATOR = 1000000n;
|
|
21746
|
-
var APEX_CLASSIC_PAIR_INIT_CODE_HASH = "
|
|
21752
|
+
var APEX_CLASSIC_PAIR_INIT_CODE_HASH = "0xf6b4be77658ce9f596d71610cf47612241d96a56c091415efa2ec2cdbc7c719c";
|
|
21747
21753
|
function normalizeAddress(_address) {
|
|
21748
21754
|
invariant2(isAddress(_address), `invalid address: ${_address}`);
|
|
21749
21755
|
return getAddress2(_address);
|
|
@@ -21769,7 +21775,7 @@ function computeClassicPoolAddress(_params) {
|
|
|
21769
21775
|
);
|
|
21770
21776
|
}
|
|
21771
21777
|
var computeApexClassicPairAddress = computeClassicPoolAddress;
|
|
21772
|
-
function
|
|
21778
|
+
function quoteClassicExactInput(_params) {
|
|
21773
21779
|
const tokenIn = normalizeAddress(_params.tokenIn);
|
|
21774
21780
|
const token0 = normalizeAddress(_params.token0);
|
|
21775
21781
|
const token1 = normalizeAddress(_params.token1);
|
|
@@ -21796,6 +21802,7 @@ function quoteApexClassicExactInput(_params) {
|
|
|
21796
21802
|
invariant2(amountOut > 0n, "INSUFFICIENT_OUTPUT_AMOUNT");
|
|
21797
21803
|
return amountOut - 1n;
|
|
21798
21804
|
}
|
|
21805
|
+
var quoteApexClassicExactInput = quoteClassicExactInput;
|
|
21799
21806
|
function getVolatileAmountOut(_params) {
|
|
21800
21807
|
const reserveA = _params.tokenIn === _params.token0 ? _params.reserve0 : _params.reserve1;
|
|
21801
21808
|
const reserveB = _params.tokenIn === _params.token0 ? _params.reserve1 : _params.reserve0;
|
|
@@ -21869,8 +21876,8 @@ import {
|
|
|
21869
21876
|
zeroAddress
|
|
21870
21877
|
} from "viem";
|
|
21871
21878
|
import invariant3 from "tiny-invariant";
|
|
21872
|
-
var
|
|
21873
|
-
var
|
|
21879
|
+
var MAX_UINT128 = (1n << 128n) - 1n;
|
|
21880
|
+
var ClassicChef = class _ClassicChef {
|
|
21874
21881
|
constructor() {
|
|
21875
21882
|
}
|
|
21876
21883
|
static encodeDeposit(_params) {
|
|
@@ -21881,7 +21888,7 @@ var ApexClassicFarm = class _ApexClassicFarm {
|
|
|
21881
21888
|
});
|
|
21882
21889
|
}
|
|
21883
21890
|
static depositCallParameters(_params) {
|
|
21884
|
-
return { calldata:
|
|
21891
|
+
return { calldata: _ClassicChef.encodeDeposit(_params), value: "0x0" };
|
|
21885
21892
|
}
|
|
21886
21893
|
static encodeWithdraw(_params) {
|
|
21887
21894
|
return encodeFunctionData2({
|
|
@@ -21891,7 +21898,7 @@ var ApexClassicFarm = class _ApexClassicFarm {
|
|
|
21891
21898
|
});
|
|
21892
21899
|
}
|
|
21893
21900
|
static withdrawCallParameters(_params) {
|
|
21894
|
-
return { calldata:
|
|
21901
|
+
return { calldata: _ClassicChef.encodeWithdraw(_params), value: "0x0" };
|
|
21895
21902
|
}
|
|
21896
21903
|
static encodeHarvest(_params) {
|
|
21897
21904
|
return encodeFunctionData2({
|
|
@@ -21901,7 +21908,7 @@ var ApexClassicFarm = class _ApexClassicFarm {
|
|
|
21901
21908
|
});
|
|
21902
21909
|
}
|
|
21903
21910
|
static harvestCallParameters(_params) {
|
|
21904
|
-
return { calldata:
|
|
21911
|
+
return { calldata: _ClassicChef.encodeHarvest(_params), value: "0x0" };
|
|
21905
21912
|
}
|
|
21906
21913
|
static encodeEmergencyWithdraw(_params) {
|
|
21907
21914
|
return encodeFunctionData2({
|
|
@@ -21912,7 +21919,7 @@ var ApexClassicFarm = class _ApexClassicFarm {
|
|
|
21912
21919
|
}
|
|
21913
21920
|
static emergencyWithdrawCallParameters(_params) {
|
|
21914
21921
|
return {
|
|
21915
|
-
calldata:
|
|
21922
|
+
calldata: _ClassicChef.encodeEmergencyWithdraw(_params),
|
|
21916
21923
|
value: "0x0"
|
|
21917
21924
|
};
|
|
21918
21925
|
}
|
|
@@ -21924,7 +21931,7 @@ var ApexClassicFarm = class _ApexClassicFarm {
|
|
|
21924
21931
|
});
|
|
21925
21932
|
}
|
|
21926
21933
|
};
|
|
21927
|
-
var
|
|
21934
|
+
var CLMasterChef = class _CLMasterChef {
|
|
21928
21935
|
constructor() {
|
|
21929
21936
|
}
|
|
21930
21937
|
static encodeMintAndStake(_params, _options) {
|
|
@@ -21941,12 +21948,12 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
21941
21948
|
});
|
|
21942
21949
|
}
|
|
21943
21950
|
static mintAndStakeCallParameters(_params, _options) {
|
|
21944
|
-
const calldata =
|
|
21951
|
+
const calldata = _CLMasterChef.encodeMintAndStake(_params, _options);
|
|
21945
21952
|
const value = toBigInt2(_options.value ?? 0n);
|
|
21946
21953
|
return {
|
|
21947
|
-
calldata: value === 0n ? calldata :
|
|
21954
|
+
calldata: value === 0n ? calldata : _CLMasterChef.encodeNfpMulticall([
|
|
21948
21955
|
calldata,
|
|
21949
|
-
|
|
21956
|
+
_CLMasterChef.encodeNfpRefundETH()
|
|
21950
21957
|
]),
|
|
21951
21958
|
value: toHexValue(value)
|
|
21952
21959
|
};
|
|
@@ -21960,8 +21967,8 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
21960
21967
|
}
|
|
21961
21968
|
static increaseLiquidityCallParameters(_params, _value = 0n) {
|
|
21962
21969
|
return {
|
|
21963
|
-
calldata:
|
|
21964
|
-
|
|
21970
|
+
calldata: _CLMasterChef.encodeMulticall([
|
|
21971
|
+
_CLMasterChef.encodeIncreaseLiquidity(_params)
|
|
21965
21972
|
]),
|
|
21966
21973
|
value: toHexValue(_value)
|
|
21967
21974
|
};
|
|
@@ -21981,8 +21988,8 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
21981
21988
|
{
|
|
21982
21989
|
tokenId: toBigInt2(_params.tokenId),
|
|
21983
21990
|
recipient: zeroAddress,
|
|
21984
|
-
amount0Max: toBigInt2(_params.amount0Max ??
|
|
21985
|
-
amount1Max: toBigInt2(_params.amount1Max ??
|
|
21991
|
+
amount0Max: toBigInt2(_params.amount0Max ?? MAX_UINT128),
|
|
21992
|
+
amount1Max: toBigInt2(_params.amount1Max ?? MAX_UINT128)
|
|
21986
21993
|
},
|
|
21987
21994
|
normalizeAddress2(_params.recipient)
|
|
21988
21995
|
]
|
|
@@ -21990,8 +21997,8 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
21990
21997
|
}
|
|
21991
21998
|
static collectCallParameters(_params) {
|
|
21992
21999
|
return {
|
|
21993
|
-
calldata:
|
|
21994
|
-
|
|
22000
|
+
calldata: _CLMasterChef.encodeMulticall([
|
|
22001
|
+
_CLMasterChef.encodeCollectTo(_params)
|
|
21995
22002
|
]),
|
|
21996
22003
|
value: "0x0"
|
|
21997
22004
|
};
|
|
@@ -22002,9 +22009,9 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22002
22009
|
"tokenId mismatch"
|
|
22003
22010
|
);
|
|
22004
22011
|
return {
|
|
22005
|
-
calldata:
|
|
22006
|
-
|
|
22007
|
-
|
|
22012
|
+
calldata: _CLMasterChef.encodeMulticall([
|
|
22013
|
+
_CLMasterChef.encodeDecreaseLiquidity(_decreaseParams),
|
|
22014
|
+
_CLMasterChef.encodeCollectTo(_collectParams)
|
|
22008
22015
|
]),
|
|
22009
22016
|
value: "0x0"
|
|
22010
22017
|
};
|
|
@@ -22015,14 +22022,14 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22015
22022
|
"tokenId mismatch"
|
|
22016
22023
|
);
|
|
22017
22024
|
return {
|
|
22018
|
-
calldata:
|
|
22019
|
-
|
|
22025
|
+
calldata: _CLMasterChef.encodeMulticall([
|
|
22026
|
+
_CLMasterChef.encodeHarvest({
|
|
22020
22027
|
tokenId: _decreaseParams.tokenId,
|
|
22021
22028
|
to: _collectParams.recipient
|
|
22022
22029
|
}),
|
|
22023
|
-
|
|
22024
|
-
|
|
22025
|
-
|
|
22030
|
+
_CLMasterChef.encodeDecreaseLiquidity(_decreaseParams),
|
|
22031
|
+
_CLMasterChef.encodeCollectTo(_collectParams),
|
|
22032
|
+
_CLMasterChef.encodeBurn({ tokenId: _decreaseParams.tokenId })
|
|
22026
22033
|
]),
|
|
22027
22034
|
value: "0x0"
|
|
22028
22035
|
};
|
|
@@ -22036,7 +22043,7 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22036
22043
|
}
|
|
22037
22044
|
static harvestCallParameters(_params) {
|
|
22038
22045
|
return {
|
|
22039
|
-
calldata:
|
|
22046
|
+
calldata: _CLMasterChef.encodeMulticall([_CLMasterChef.encodeHarvest(_params)]),
|
|
22040
22047
|
value: "0x0"
|
|
22041
22048
|
};
|
|
22042
22049
|
}
|
|
@@ -22049,8 +22056,8 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22049
22056
|
}
|
|
22050
22057
|
static withdrawCallParameters(_params) {
|
|
22051
22058
|
return {
|
|
22052
|
-
calldata:
|
|
22053
|
-
|
|
22059
|
+
calldata: _CLMasterChef.encodeMulticall([
|
|
22060
|
+
_CLMasterChef.encodeWithdraw(_params)
|
|
22054
22061
|
]),
|
|
22055
22062
|
value: "0x0"
|
|
22056
22063
|
};
|
|
@@ -22064,7 +22071,7 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22064
22071
|
}
|
|
22065
22072
|
static burnCallParameters(_params) {
|
|
22066
22073
|
return {
|
|
22067
|
-
calldata:
|
|
22074
|
+
calldata: _CLMasterChef.encodeMulticall([_CLMasterChef.encodeBurn(_params)]),
|
|
22068
22075
|
value: "0x0"
|
|
22069
22076
|
};
|
|
22070
22077
|
}
|
|
@@ -22091,6 +22098,9 @@ var ApexCLFarm = class _ApexCLFarm {
|
|
|
22091
22098
|
});
|
|
22092
22099
|
}
|
|
22093
22100
|
};
|
|
22101
|
+
var APEX_MAX_UINT128 = MAX_UINT128;
|
|
22102
|
+
var ApexClassicFarm = ClassicChef;
|
|
22103
|
+
var ApexCLFarm = CLMasterChef;
|
|
22094
22104
|
function formatMintParams(_params) {
|
|
22095
22105
|
return {
|
|
22096
22106
|
token0: normalizeAddress2(_params.token0),
|
|
@@ -22160,7 +22170,7 @@ var APEX_MIXED_ROUTE_CLASSIC_VOLATILE = 8388609;
|
|
|
22160
22170
|
var APEX_MIXED_ROUTE_PANCAKE_CLASSIC_PLACEHOLDER = APEX_MIXED_ROUTE_CLASSIC_STABLE;
|
|
22161
22171
|
var APEX_MIXED_ROUTE_PANCAKE_VOLATILE_FLAG = 1;
|
|
22162
22172
|
var APEX_MIXED_ROUTE_PANCAKE_STABLE_FLAG = 2;
|
|
22163
|
-
function
|
|
22173
|
+
function encodeMixedRouteToPath(_hops, _exactOutput = false) {
|
|
22164
22174
|
invariant4(_hops.length > 0, "empty route");
|
|
22165
22175
|
assertContinuousRoute(_hops);
|
|
22166
22176
|
const hops = _exactOutput ? reverseRoute(_hops) : [..._hops];
|
|
@@ -22172,7 +22182,7 @@ function encodeApexMixedRouteToPath(_hops, _exactOutput = false) {
|
|
|
22172
22182
|
}
|
|
22173
22183
|
return encodePacked3(types, values);
|
|
22174
22184
|
}
|
|
22175
|
-
function
|
|
22185
|
+
function encodeMixedRouteToPancakeQuoteParams(_hops, _exactOutput = false) {
|
|
22176
22186
|
invariant4(_hops.length > 0, "empty route");
|
|
22177
22187
|
assertContinuousRoute(_hops);
|
|
22178
22188
|
const hops = _exactOutput ? reverseRoute(_hops) : [..._hops];
|
|
@@ -22187,7 +22197,7 @@ function encodeApexMixedRouteToPancakeQuoteParams(_hops, _exactOutput = false) {
|
|
|
22187
22197
|
}
|
|
22188
22198
|
return { path: encodePacked3(types, values), flags };
|
|
22189
22199
|
}
|
|
22190
|
-
function
|
|
22200
|
+
function decodeMixedRoutePath(_path) {
|
|
22191
22201
|
const hex = _path.startsWith("0x") ? _path.slice(2) : _path;
|
|
22192
22202
|
invariant4(hex.length >= 86 && (hex.length - 40) % 46 === 0, "invalid path length");
|
|
22193
22203
|
const hops = [];
|
|
@@ -22238,6 +22248,9 @@ function pancakeRouteCode(_hop) {
|
|
|
22238
22248
|
}
|
|
22239
22249
|
return APEX_MIXED_ROUTE_PANCAKE_CLASSIC_PLACEHOLDER;
|
|
22240
22250
|
}
|
|
22251
|
+
var encodeApexMixedRouteToPath = encodeMixedRouteToPath;
|
|
22252
|
+
var encodeApexMixedRouteToPancakeQuoteParams = encodeMixedRouteToPancakeQuoteParams;
|
|
22253
|
+
var decodeApexMixedRoutePath = decodeMixedRoutePath;
|
|
22241
22254
|
function normalizeAddress3(_address) {
|
|
22242
22255
|
invariant4(isAddress3(_address), `invalid address: ${_address}`);
|
|
22243
22256
|
return getAddress4(_address);
|
|
@@ -22248,36 +22261,38 @@ function readAddress(_hex, _offset) {
|
|
|
22248
22261
|
|
|
22249
22262
|
// src/protocolFees.ts
|
|
22250
22263
|
var APEX_CL_PROTOCOL_FEE_SPACING = 65536n;
|
|
22251
|
-
function
|
|
22264
|
+
function packProtocolFees(_token0ProtocolFee, _token1ProtocolFee) {
|
|
22252
22265
|
return BigInt(_token0ProtocolFee) + BigInt(_token1ProtocolFee) * APEX_CL_PROTOCOL_FEE_SPACING;
|
|
22253
22266
|
}
|
|
22254
|
-
function
|
|
22267
|
+
function parseProtocolFeePacked(_feeProtocol) {
|
|
22255
22268
|
const packed = BigInt(_feeProtocol);
|
|
22256
22269
|
return {
|
|
22257
22270
|
token0ProtocolFee: packed % APEX_CL_PROTOCOL_FEE_SPACING,
|
|
22258
22271
|
token1ProtocolFee: packed / APEX_CL_PROTOCOL_FEE_SPACING
|
|
22259
22272
|
};
|
|
22260
22273
|
}
|
|
22274
|
+
var packApexProtocolFees = packProtocolFees;
|
|
22275
|
+
var parseApexProtocolFeePacked = parseProtocolFeePacked;
|
|
22261
22276
|
|
|
22262
22277
|
// src/smartRouter.ts
|
|
22263
22278
|
import invariant5 from "tiny-invariant";
|
|
22264
22279
|
import { encodeFunctionData as encodeFunctionData3, getAddress as getAddress5, isAddress as isAddress4 } from "viem";
|
|
22265
|
-
var
|
|
22280
|
+
var SmartRouter = class _SmartRouter {
|
|
22266
22281
|
constructor() {
|
|
22267
22282
|
}
|
|
22268
22283
|
static swapCallParameters(_calldata, _options) {
|
|
22269
22284
|
return callParameters(Array.isArray(_calldata) ? [..._calldata] : [_calldata], _options);
|
|
22270
22285
|
}
|
|
22271
22286
|
static exactInputSingleCallParameters(_params, _options) {
|
|
22272
|
-
return
|
|
22287
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeExactInputSingle(_params), _options);
|
|
22273
22288
|
}
|
|
22274
22289
|
static exactInputCallParameters(_params, _options) {
|
|
22275
|
-
return
|
|
22290
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeExactInput(_params), _options);
|
|
22276
22291
|
}
|
|
22277
22292
|
static mixedExactInputCallParameters(_params, _options) {
|
|
22278
|
-
return
|
|
22293
|
+
return _SmartRouter.exactInputCallParameters(
|
|
22279
22294
|
{
|
|
22280
|
-
path:
|
|
22295
|
+
path: encodeMixedRouteToPath(_params.hops),
|
|
22281
22296
|
recipient: _params.recipient,
|
|
22282
22297
|
amountIn: _params.amountIn,
|
|
22283
22298
|
amountOutMinimum: _params.amountOutMinimum
|
|
@@ -22286,16 +22301,16 @@ var ApexSmartRouter = class _ApexSmartRouter {
|
|
|
22286
22301
|
);
|
|
22287
22302
|
}
|
|
22288
22303
|
static exactOutputSingleCallParameters(_params, _options) {
|
|
22289
|
-
return
|
|
22304
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeExactOutputSingle(_params), _options);
|
|
22290
22305
|
}
|
|
22291
22306
|
static exactOutputCallParameters(_params, _options) {
|
|
22292
|
-
return
|
|
22307
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeExactOutput(_params), _options);
|
|
22293
22308
|
}
|
|
22294
22309
|
static classicExactInputCallParameters(_params, _options) {
|
|
22295
|
-
return
|
|
22310
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeClassicExactInput(_params), _options);
|
|
22296
22311
|
}
|
|
22297
22312
|
static stableExactInputCallParameters(_params, _options) {
|
|
22298
|
-
return
|
|
22313
|
+
return _SmartRouter.swapCallParameters(_SmartRouter.encodeStableExactInput(_params), _options);
|
|
22299
22314
|
}
|
|
22300
22315
|
static encodeExactInputSingle(_params) {
|
|
22301
22316
|
return encodeFunctionData3({
|
|
@@ -22419,17 +22434,18 @@ var ApexSmartRouter = class _ApexSmartRouter {
|
|
|
22419
22434
|
});
|
|
22420
22435
|
}
|
|
22421
22436
|
};
|
|
22437
|
+
var ApexSmartRouter = SmartRouter;
|
|
22422
22438
|
function callParameters(_calldatas, _options) {
|
|
22423
22439
|
for (const payment of _options.payments ?? []) _calldatas.push(encodePayment(payment));
|
|
22424
22440
|
return {
|
|
22425
|
-
calldata:
|
|
22441
|
+
calldata: SmartRouter.encodeMulticall(_calldatas, _options.deadlineOrPreviousBlockhash),
|
|
22426
22442
|
value: toHexValue2(_options.value ?? 0n)
|
|
22427
22443
|
};
|
|
22428
22444
|
}
|
|
22429
22445
|
function encodePayment(_payment) {
|
|
22430
|
-
if (_payment.kind === "REFUND_ETH") return
|
|
22431
|
-
if (_payment.kind === "UNWRAP_WETH9") return
|
|
22432
|
-
return
|
|
22446
|
+
if (_payment.kind === "REFUND_ETH") return SmartRouter.encodeRefundETH();
|
|
22447
|
+
if (_payment.kind === "UNWRAP_WETH9") return SmartRouter.encodeUnwrapWETH9(_payment.amountMinimum, _payment.recipient);
|
|
22448
|
+
return SmartRouter.encodeSweepToken(_payment.token, _payment.amountMinimum, _payment.recipient);
|
|
22433
22449
|
}
|
|
22434
22450
|
function normalizeAddress4(_address) {
|
|
22435
22451
|
invariant5(isAddress4(_address), `invalid address: ${_address}`);
|
|
@@ -22454,10 +22470,11 @@ function toHexValue2(_value) {
|
|
|
22454
22470
|
import { encodeFunctionData as encodeFunctionData4, getAddress as getAddress6, isAddress as isAddress5, zeroAddress as zeroAddress2 } from "viem";
|
|
22455
22471
|
import invariant6 from "tiny-invariant";
|
|
22456
22472
|
var APEX_VAULT_BPS = 1e4;
|
|
22457
|
-
function
|
|
22473
|
+
function getApexVaultCompoundBucket(_veNFT) {
|
|
22458
22474
|
return normalizeAddress5(_veNFT);
|
|
22459
22475
|
}
|
|
22460
|
-
var
|
|
22476
|
+
var apexVaultCompoundBucket = getApexVaultCompoundBucket;
|
|
22477
|
+
var ApexVault = class _ApexVault {
|
|
22461
22478
|
constructor() {
|
|
22462
22479
|
}
|
|
22463
22480
|
static encodeStake(_tokenId, _config) {
|
|
@@ -22470,7 +22487,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22470
22487
|
});
|
|
22471
22488
|
}
|
|
22472
22489
|
static stakeCallParameters(_tokenId, _config) {
|
|
22473
|
-
return { calldata:
|
|
22490
|
+
return { calldata: _ApexVault.encodeStake(_tokenId, _config), value: "0x0" };
|
|
22474
22491
|
}
|
|
22475
22492
|
static encodeSetUserConfig(_tokenId, _config) {
|
|
22476
22493
|
const formatted = formatVaultConfig(_config);
|
|
@@ -22482,7 +22499,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22482
22499
|
});
|
|
22483
22500
|
}
|
|
22484
22501
|
static setUserConfigCallParameters(_tokenId, _config) {
|
|
22485
|
-
return { calldata:
|
|
22502
|
+
return { calldata: _ApexVault.encodeSetUserConfig(_tokenId, _config), value: "0x0" };
|
|
22486
22503
|
}
|
|
22487
22504
|
static encodeClaim(_params) {
|
|
22488
22505
|
invariant6(_params.rewardTokens.length > 0, "empty reward token list");
|
|
@@ -22493,7 +22510,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22493
22510
|
});
|
|
22494
22511
|
}
|
|
22495
22512
|
static claimCallParameters(_params) {
|
|
22496
|
-
return { calldata:
|
|
22513
|
+
return { calldata: _ApexVault.encodeClaim(_params), value: "0x0" };
|
|
22497
22514
|
}
|
|
22498
22515
|
static encodeClaimAndExtendLock(_params) {
|
|
22499
22516
|
invariant6(_params.rewardTokens.length > 0, "empty reward token list");
|
|
@@ -22504,7 +22521,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22504
22521
|
});
|
|
22505
22522
|
}
|
|
22506
22523
|
static claimAndExtendLockCallParameters(_params) {
|
|
22507
|
-
return { calldata:
|
|
22524
|
+
return { calldata: _ApexVault.encodeClaimAndExtendLock(_params), value: "0x0" };
|
|
22508
22525
|
}
|
|
22509
22526
|
static encodeUnstake(_params) {
|
|
22510
22527
|
return encodeFunctionData4({
|
|
@@ -22514,7 +22531,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22514
22531
|
});
|
|
22515
22532
|
}
|
|
22516
22533
|
static unstakeCallParameters(_params) {
|
|
22517
|
-
return { calldata:
|
|
22534
|
+
return { calldata: _ApexVault.encodeUnstake(_params), value: "0x0" };
|
|
22518
22535
|
}
|
|
22519
22536
|
static encodeExtendLock(_params) {
|
|
22520
22537
|
return encodeFunctionData4({
|
|
@@ -22524,7 +22541,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22524
22541
|
});
|
|
22525
22542
|
}
|
|
22526
22543
|
static extendLockCallParameters(_params) {
|
|
22527
|
-
return { calldata:
|
|
22544
|
+
return { calldata: _ApexVault.encodeExtendLock(_params), value: "0x0" };
|
|
22528
22545
|
}
|
|
22529
22546
|
static encodeIncreaseAmount(_params) {
|
|
22530
22547
|
return encodeFunctionData4({
|
|
@@ -22534,7 +22551,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22534
22551
|
});
|
|
22535
22552
|
}
|
|
22536
22553
|
static increaseAmountCallParameters(_params) {
|
|
22537
|
-
return { calldata:
|
|
22554
|
+
return { calldata: _ApexVault.encodeIncreaseAmount(_params), value: "0x0" };
|
|
22538
22555
|
}
|
|
22539
22556
|
static encodeVeApexTokenApprove(_params) {
|
|
22540
22557
|
return encodeFunctionData4({
|
|
@@ -22558,6 +22575,7 @@ var ApexVaultPosition = class _ApexVaultPosition {
|
|
|
22558
22575
|
});
|
|
22559
22576
|
}
|
|
22560
22577
|
};
|
|
22578
|
+
var ApexVaultPosition = ApexVault;
|
|
22561
22579
|
function validateApexVaultUserConfig(_config) {
|
|
22562
22580
|
formatVaultConfig(_config);
|
|
22563
22581
|
}
|
|
@@ -22627,15 +22645,21 @@ export {
|
|
|
22627
22645
|
APEX_VAULT_BPS,
|
|
22628
22646
|
ApexCLFarm,
|
|
22629
22647
|
ApexClassicFarm,
|
|
22630
|
-
ApexFeeAmount,
|
|
22648
|
+
CLFeeAmount as ApexFeeAmount,
|
|
22631
22649
|
ApexSmartRouter,
|
|
22650
|
+
ApexVault,
|
|
22632
22651
|
ApexVaultPosition,
|
|
22652
|
+
CLFeeAmount,
|
|
22653
|
+
CLMasterChef,
|
|
22654
|
+
CL_TICK_SPACINGS,
|
|
22655
|
+
ClassicChef,
|
|
22633
22656
|
DEPLOYER_ADDRESSES,
|
|
22634
22657
|
FACTORY_ADDRESSES,
|
|
22635
22658
|
FeeAmount,
|
|
22636
22659
|
FeeCalculator,
|
|
22637
22660
|
FullMath,
|
|
22638
22661
|
LiquidityMath,
|
|
22662
|
+
MAX_UINT128,
|
|
22639
22663
|
MasterChefV3,
|
|
22640
22664
|
MaxUint128,
|
|
22641
22665
|
Multicall,
|
|
@@ -22650,6 +22674,7 @@ export {
|
|
|
22650
22674
|
PositionMath,
|
|
22651
22675
|
Route,
|
|
22652
22676
|
SelfPermit,
|
|
22677
|
+
SmartRouter,
|
|
22653
22678
|
SqrtPriceMath,
|
|
22654
22679
|
Staker,
|
|
22655
22680
|
SwapMath,
|
|
@@ -22680,9 +22705,13 @@ export {
|
|
|
22680
22705
|
computeCreate2Address,
|
|
22681
22706
|
computePoolAddress,
|
|
22682
22707
|
createApexPool,
|
|
22708
|
+
createCLPool,
|
|
22683
22709
|
decodeApexMixedRoutePath,
|
|
22710
|
+
decodeMixedRoutePath,
|
|
22684
22711
|
encodeApexMixedRouteToPancakeQuoteParams,
|
|
22685
22712
|
encodeApexMixedRouteToPath,
|
|
22713
|
+
encodeMixedRouteToPancakeQuoteParams,
|
|
22714
|
+
encodeMixedRouteToPath,
|
|
22686
22715
|
encodeRouteToPath,
|
|
22687
22716
|
encodeSqrtRatioX96,
|
|
22688
22717
|
feeCenterAbi,
|
|
@@ -22692,7 +22721,9 @@ export {
|
|
|
22692
22721
|
getAmountsAtNewPrice,
|
|
22693
22722
|
getAmountsByLiquidityAndPrice,
|
|
22694
22723
|
getApexTickSpacing,
|
|
22724
|
+
getApexVaultCompoundBucket,
|
|
22695
22725
|
getAverageLiquidity,
|
|
22726
|
+
getCLTickSpacing,
|
|
22696
22727
|
getCurrency0Price,
|
|
22697
22728
|
getCurrency1Price,
|
|
22698
22729
|
getDependentAmount,
|
|
@@ -22712,8 +22743,10 @@ export {
|
|
|
22712
22743
|
getPriceOfCurrency1,
|
|
22713
22744
|
hasInvolvedCurrency,
|
|
22714
22745
|
installApexFeeTiers,
|
|
22746
|
+
installCLFeeTiers,
|
|
22715
22747
|
interfaceMulticallAbi,
|
|
22716
22748
|
isApexCLFeeAmount,
|
|
22749
|
+
isCLFeeAmount,
|
|
22717
22750
|
isMint,
|
|
22718
22751
|
isPoolTickInRange,
|
|
22719
22752
|
isSorted,
|
|
@@ -22729,12 +22762,15 @@ export {
|
|
|
22729
22762
|
nonfungiblePositionManagerAbi,
|
|
22730
22763
|
normalizeAddress,
|
|
22731
22764
|
packApexProtocolFees,
|
|
22765
|
+
packProtocolFees,
|
|
22732
22766
|
pancakeV3PoolABI,
|
|
22733
22767
|
parseApexProtocolFeePacked,
|
|
22768
|
+
parseProtocolFeePacked,
|
|
22734
22769
|
parseProtocolFees,
|
|
22735
22770
|
peripheryPaymentsWithFeeABI,
|
|
22736
22771
|
priceToClosestTick,
|
|
22737
22772
|
quoteApexClassicExactInput,
|
|
22773
|
+
quoteClassicExactInput,
|
|
22738
22774
|
quoterABI,
|
|
22739
22775
|
quoterAbi,
|
|
22740
22776
|
quoterV2ABI,
|
|
@@ -22751,6 +22787,7 @@ export {
|
|
|
22751
22787
|
tickToPrice,
|
|
22752
22788
|
tickToPriceV2,
|
|
22753
22789
|
toApexFeeAmount,
|
|
22790
|
+
toCLFeeAmount,
|
|
22754
22791
|
toHex,
|
|
22755
22792
|
tradeComparator,
|
|
22756
22793
|
v3PoolAbi,
|