@gearbox-protocol/sdk 16.0.0-next.46 → 16.0.0-next.47
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/cjs/onchain/index.js +0 -2
- package/dist/cjs/onchain/market/MarketSuite.js +9 -1
- package/dist/cjs/onchain/market/credit/CreditSuite.js +1 -2
- package/dist/cjs/onchain/market/pool/PoolV310Contract.js +25 -0
- package/dist/cjs/onchain/pools/PoolService.js +5 -56
- package/dist/cjs/onchain/pools/index.js +0 -2
- package/dist/cjs/preview/preview/previewPoolPositionOperation.js +31 -12
- package/dist/cjs/preview/simulate/index.js +1 -1
- package/dist/cjs/preview/simulate/simulateOperation.js +1 -1
- package/dist/cjs/preview/simulate/simulatePoolOperation.js +2 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +5 -6
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/onchain/accounts/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/onchain/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +1 -1
- package/dist/esm/onchain/base/TokensMeta.js +3 -3
- package/dist/esm/onchain/core/createAddressProvider.js +1 -1
- package/dist/esm/onchain/index.js +2 -2
- package/dist/esm/onchain/market/MarketSuite.js +9 -1
- package/dist/esm/onchain/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/onchain/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/onchain/market/credit/CreditSuite.js +1 -2
- package/dist/esm/onchain/market/pool/PoolV310Contract.js +26 -1
- package/dist/esm/onchain/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/onchain/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/onchain/pools/PoolService.js +7 -56
- package/dist/esm/onchain/pools/index.js +2 -2
- package/dist/esm/onchain/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/preview/preview/previewPoolPositionOperation.js +33 -14
- package/dist/esm/preview/simulate/index.js +1 -1
- package/dist/esm/preview/simulate/simulateOperation.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +2 -2
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/prepare/PrepareApi.js +5 -6
- package/dist/types/model/positions.d.ts +4 -1
- package/dist/types/model/previews.d.ts +28 -12
- package/dist/types/onchain/index.d.ts +3 -3
- package/dist/types/onchain/market/MarketSuite.d.ts +6 -0
- package/dist/types/onchain/market/pool/PoolV310Contract.d.ts +12 -0
- package/dist/types/onchain/market/pool/types.d.ts +18 -0
- package/dist/types/onchain/pools/PoolService.d.ts +2 -29
- package/dist/types/onchain/pools/index.d.ts +3 -3
- package/dist/types/onchain/pools/types.d.ts +1 -40
- package/dist/types/preview/simulate/simulatePoolOperation.d.ts +18 -1
- package/dist/types/preview/simulate/types.d.ts +12 -4
- package/dist/types/sdk/prepare/types.d.ts +6 -4
- package/package.json +1 -1
|
@@ -5,7 +5,24 @@ import { PreviewOperationOptions } from "../types.js";
|
|
|
5
5
|
import "../parse/index.js";
|
|
6
6
|
import { PreviewSimulationError } from "./errors.js";
|
|
7
7
|
import { PoolOperationSimulationResult, SimulationInput } from "./types.js";
|
|
8
|
+
import { ContractFunctionParameters } from "viem";
|
|
8
9
|
//#region src/preview/simulate/simulatePoolOperation.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Builds the preview read that converts the operation's known amount into its
|
|
12
|
+
* counterpart. Direct operations read the pool's ERC4626 preview; zapper-routed
|
|
13
|
+
* operations (only ever `Deposit`/`Redeem`) read the zapper's
|
|
14
|
+
* `previewDeposit`/`previewRedeem`, which account for the zapper's own
|
|
15
|
+
* conversion in addition to the pool's.
|
|
16
|
+
*/
|
|
17
|
+
declare function previewContract(operation: PoolOperation): ContractFunctionParameters;
|
|
18
|
+
/**
|
|
19
|
+
* Maps a pool operation and its preview result to the amounts of tokens going
|
|
20
|
+
* in (user -> pool) and out (pool -> user). `previewAmount` is the counterpart
|
|
21
|
+
* amount returned by the matching preview read (shares for deposit/withdraw,
|
|
22
|
+
* assets for mint/redeem, and the zapper's converted amount for zapper-routed
|
|
23
|
+
* deposit/redeem).
|
|
24
|
+
*/
|
|
25
|
+
declare function amountsInOut(operation: PoolOperation, previewAmount: bigint): PoolOperationSimulationResult;
|
|
9
26
|
/**
|
|
10
27
|
* Simulates a pool deposit/mint/withdraw/redeem (direct or zapper-routed) and
|
|
11
28
|
* returns the resulting token amounts going in and out. Throws a
|
|
@@ -22,4 +39,4 @@ import { PoolOperationSimulationResult, SimulationInput } from "./types.js";
|
|
|
22
39
|
*/
|
|
23
40
|
declare function simulatePoolOperation(input: SimulationInput<PoolOperation>, options?: PreviewOperationOptions): Promise<SDKReturn<PoolOperationSimulationResult, PreviewSimulationError>>;
|
|
24
41
|
//#endregion
|
|
25
|
-
export { simulatePoolOperation };
|
|
42
|
+
export { amountsInOut, previewContract, simulatePoolOperation };
|
|
@@ -26,13 +26,21 @@ interface SimulationInput<Op extends Operation = Operation> {
|
|
|
26
26
|
*/
|
|
27
27
|
interface PoolOperationSimulationResult {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
29
|
+
* User -> pool.
|
|
30
|
+
*
|
|
31
|
+
* Deposit/mint: underlying (or zapper input); `withdrawFee` does not apply.
|
|
32
|
+
*
|
|
33
|
+
* Withdraw/redeem: shares burned. On withdraw, `previewWithdraw` inflates
|
|
34
|
+
* that burn for `withdrawFee`; on redeem, the shares from calldata.
|
|
31
35
|
**/
|
|
32
36
|
amountIn: bigint;
|
|
33
37
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* Pool -> user.
|
|
39
|
+
*
|
|
40
|
+
* Deposit/mint: shares minted (or zapper output); `withdrawFee` does not apply.
|
|
41
|
+
*
|
|
42
|
+
* Withdraw/redeem: underlying paid out. On withdraw, the requested amount;
|
|
43
|
+
* on redeem, `previewRedeem` after `withdrawFee`.
|
|
36
44
|
**/
|
|
37
45
|
amountOut: bigint;
|
|
38
46
|
}
|
|
@@ -31,14 +31,16 @@ interface LpState extends PoolSimulation {
|
|
|
31
31
|
curator: Curator;
|
|
32
32
|
/**
|
|
33
33
|
* The wallet's position in this pool once the operation has run, in the
|
|
34
|
-
* market's underlying
|
|
35
|
-
* or burns. A first deposit lands at the size of the deposit itself.
|
|
34
|
+
* market's underlying.
|
|
36
35
|
*
|
|
37
36
|
* Denominated like {@link PoolPosition.netValue}, so a screen showing both
|
|
38
37
|
* reads one token: on an RWA market that is the unwrapped asset — USDC
|
|
39
38
|
* rather than the dcUSDC the pool actually holds.
|
|
39
|
+
*
|
|
40
|
+
* Does not account for withdrawal fee: this is what the remaining shares
|
|
41
|
+
* are worth, not what leaving with them would pay.
|
|
40
42
|
**/
|
|
41
|
-
|
|
43
|
+
netValue: TokenAmount;
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* What a pool deposit or withdrawal comes to.
|
|
@@ -414,7 +416,7 @@ interface IOpportunitiesPrepare {
|
|
|
414
416
|
*
|
|
415
417
|
* The trade itself is the pool's share rate applied to the amount, which is
|
|
416
418
|
* loaded already; the wait is for the one thing that is not, the shares the
|
|
417
|
-
* wallet holds, without which {@link LpState.
|
|
419
|
+
* wallet holds, without which {@link LpState.netValue} cannot be said.
|
|
418
420
|
**/
|
|
419
421
|
deposit(pool: PoolInput, params: LpParams): Promise<SDKReturn<LpResult, UnsupportedTokenPairError | UnexpectedFailureError>>;
|
|
420
422
|
/**
|