@apex_labs/sdk 0.1.2 → 0.2.0
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 +9 -13
- package/dist/index.cjs +20 -1156
- package/dist/index.d.cts +629 -7905
- package/dist/index.d.ts +629 -7905
- package/dist/index.js +16 -1056
- package/package.json +3 -4
- package/vendor/pancake-v3-sdk/README.md +0 -5
- package/vendor/pancake-v3-sdk/package.json +0 -19
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Apex SDK
|
|
2
2
|
|
|
3
|
-
SDK for Apex CL and Classic pools. It
|
|
3
|
+
SDK for Apex CL and Classic pools. It provides Apex fee tiers, deterministic pool address helpers, Classic AMM quoting, mixed CL/Classic path encoding, transaction builders, and exact ABI exports for Apex contracts.
|
|
4
4
|
|
|
5
5
|
## Setup
|
|
6
6
|
|
|
@@ -49,7 +49,6 @@ export const apex: ApexDeploymentConfig = {
|
|
|
49
49
|
import {
|
|
50
50
|
CLFeeAmount,
|
|
51
51
|
APEX_CL_POOL_INIT_CODE_HASH,
|
|
52
|
-
APEX_CL_TICK_SPACINGS,
|
|
53
52
|
APEX_CLASSIC_PAIR_INIT_CODE_HASH,
|
|
54
53
|
ClassicChef,
|
|
55
54
|
CLMasterChef,
|
|
@@ -61,7 +60,7 @@ import {
|
|
|
61
60
|
computeClassicPoolAddress,
|
|
62
61
|
quoteClassicExactInput,
|
|
63
62
|
encodeMixedRouteToPath,
|
|
64
|
-
|
|
63
|
+
encodeMixedRouteToQuoteParams,
|
|
65
64
|
decodeMixedRoutePath,
|
|
66
65
|
parseProtocolFeePacked,
|
|
67
66
|
clPoolAbi,
|
|
@@ -111,7 +110,7 @@ const pool = createCLPool({
|
|
|
111
110
|
});
|
|
112
111
|
```
|
|
113
112
|
|
|
114
|
-
`createCLPool` returns
|
|
113
|
+
`createCLPool` returns an Apex CL `Pool` model with Apex fee tiers installed. Position, trade, route, quoter, swap-router, and NFT-position-manager logic should use the classes exported by `@apex_labs/sdk`.
|
|
115
114
|
|
|
116
115
|
### Periphery ABIs
|
|
117
116
|
|
|
@@ -198,8 +197,7 @@ const path = encodeMixedRouteToPath([
|
|
|
198
197
|
```
|
|
199
198
|
|
|
200
199
|
Quote that path through `MixedQuoter.quoteExactInput(path, amountIn)`, then execute it with
|
|
201
|
-
`SmartRouter`. The high-level helpers
|
|
202
|
-
they encode the swap, then wrap it in `SmartRouter.multicall(deadlineOrPreviousBlockhash, data)`.
|
|
200
|
+
`SmartRouter`. The high-level helpers encode the swap, then wrap it in `SmartRouter.multicall(deadlineOrPreviousBlockhash, data)`.
|
|
203
201
|
|
|
204
202
|
```ts
|
|
205
203
|
const swap = SmartRouter.mixedExactInputCallParameters(
|
|
@@ -208,10 +206,10 @@ const swap = SmartRouter.mixedExactInputCallParameters(
|
|
|
208
206
|
);
|
|
209
207
|
```
|
|
210
208
|
|
|
211
|
-
|
|
209
|
+
For `MixedQuoter.quoteExactInput`, encode the route path and Classic-hop flags:
|
|
212
210
|
|
|
213
211
|
```ts
|
|
214
|
-
const { path, flags } =
|
|
212
|
+
const { path, flags } = encodeMixedRouteToQuoteParams(hops);
|
|
215
213
|
const quote = await publicClient.readContract({
|
|
216
214
|
address: apex.mixedQuoter,
|
|
217
215
|
abi: mixedQuoterAbi,
|
|
@@ -220,7 +218,7 @@ const quote = await publicClient.readContract({
|
|
|
220
218
|
});
|
|
221
219
|
```
|
|
222
220
|
|
|
223
|
-
For routes
|
|
221
|
+
For routes split by protocol:
|
|
224
222
|
|
|
225
223
|
```ts
|
|
226
224
|
// Classic volatile section
|
|
@@ -303,7 +301,7 @@ const close = CLMasterChef.closeAndBurnCallParameters(
|
|
|
303
301
|
);
|
|
304
302
|
```
|
|
305
303
|
|
|
306
|
-
This encodes `harvest -> decreaseLiquidity -> collectTo -> burn`. The harvest happens before liquidity is removed, so it is safe even when rewards are zero and keeps `burn` compatible with
|
|
304
|
+
This encodes `harvest -> decreaseLiquidity -> collectTo -> burn`. The harvest happens before liquidity is removed, so it is safe even when rewards are zero and keeps `burn` compatible with strict empty-position semantics.
|
|
307
305
|
|
|
308
306
|
### ApexVault UX
|
|
309
307
|
|
|
@@ -365,10 +363,8 @@ npm run build --prefix apex-sdk
|
|
|
365
363
|
|
|
366
364
|
## Notes
|
|
367
365
|
|
|
368
|
-
- Apex CL callbacks remain Pancake-compatible, so Pancake v3 periphery assumptions are preserved.
|
|
369
|
-
- The Pancake v3 SDK base is vendored under `vendor/pancake-v3-sdk`; Apex does not depend on the live `@pancakeswap/v3-sdk` npm package at runtime.
|
|
370
366
|
- Apex periphery exports include `NonfungiblePositionManager`, `SwapRouter`, `SmartRouter`, `Quoter`, `QuoterV2`, `MixedQuoter`, `TickLens`, and `InterfaceMulticall`.
|
|
371
|
-
- `MixedQuoter` supports
|
|
367
|
+
- `MixedQuoter` supports `quoteExactInput(bytes,uint256)` and `quoteExactInput(bytes,uint256[],uint256)` for Classic+CL route discovery.
|
|
372
368
|
- Apex CL pool addresses use the Apex `CLPoolDeployer`, not the factory, matching the contract salt `keccak256(abi.encode(token0, token1, fee))`.
|
|
373
369
|
- Apex Classic pair addresses use the Classic factory salt `keccak256(abi.encodePacked(token0, token1, stable))`.
|
|
374
370
|
- `APEX_CL_POOL_INIT_CODE_HASH` and `APEX_CLASSIC_PAIR_INIT_CODE_HASH` are exported and used by default; override them only if the compiled contract bytecode changes.
|