@gearbox-protocol/sdk 16.0.0-next.35 → 16.0.0-next.36
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/model/delayed-intent.schema.js +35 -0
- package/dist/cjs/model/index.js +5 -0
- package/dist/cjs/model/withdrawals.js +1 -0
- package/dist/cjs/model/withdrawals.schema.js +39 -0
- package/dist/cjs/onchain/accounts/CreditAccountsServiceV310.js +0 -10
- package/dist/cjs/onchain/positions/MultichainPositionsService.js +14 -0
- package/dist/cjs/onchain/positions/PositionsService.js +60 -0
- package/dist/cjs/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/cjs/sdk/prepare/PrepareApi.js +22 -1
- package/dist/esm/model/delayed-intent.schema.js +34 -0
- package/dist/esm/model/index.js +3 -1
- package/dist/esm/model/withdrawals.js +1 -0
- package/dist/esm/model/withdrawals.schema.js +36 -0
- package/dist/esm/onchain/accounts/CreditAccountsServiceV310.js +0 -10
- package/dist/esm/onchain/positions/MultichainPositionsService.js +14 -0
- package/dist/esm/onchain/positions/PositionsService.js +60 -0
- package/dist/esm/sdk/positions/PositionsNamespace.js +6 -0
- package/dist/esm/sdk/prepare/PrepareApi.js +22 -1
- package/dist/types/model/delayed-intent.schema.d.ts +28 -0
- package/dist/types/model/index.d.ts +3 -1
- package/dist/types/model/withdrawals.d.ts +87 -0
- package/dist/types/model/withdrawals.schema.d.ts +243 -0
- package/dist/types/onchain/accounts/CreditAccountsServiceV310.d.ts +1 -5
- package/dist/types/onchain/accounts/index.d.ts +2 -2
- package/dist/types/onchain/accounts/intents/types.d.ts +2 -1
- package/dist/types/onchain/accounts/types.d.ts +2 -27
- package/dist/types/onchain/index.d.ts +3 -3
- package/dist/types/onchain/positions/MultichainPositionsService.d.ts +7 -1
- package/dist/types/onchain/positions/PositionsService.d.ts +9 -1
- package/dist/types/onchain/positions/index.d.ts +2 -2
- package/dist/types/onchain/positions/types.d.ts +31 -2
- package/dist/types/sdk/positions/PositionsNamespace.d.ts +8 -2
- package/dist/types/sdk/positions/types.d.ts +11 -3
- package/dist/types/sdk/prepare/types.d.ts +6 -5
- package/package.json +1 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ChainId } from "../../model/primitives.js";
|
|
1
2
|
import { Position, PositionFilter } from "../../model/positions.js";
|
|
2
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { PositionWithdrawals } from "../../model/withdrawals.js";
|
|
3
5
|
import "../../model/index.js";
|
|
4
|
-
import { WithBlock } from "../types/multichain.js";
|
|
6
|
+
import { WithBlock, WithMultichain } from "../types/multichain.js";
|
|
5
7
|
import { Asset, CreditAccountData } from "../base/types.js";
|
|
6
8
|
import "../types/index.js";
|
|
7
9
|
import "../base/index.js";
|
|
@@ -33,6 +35,28 @@ interface ListPositionsPropsBase {
|
|
|
33
35
|
* {@link MultichainPositionsService.list}.
|
|
34
36
|
**/
|
|
35
37
|
type ListPositionsProps<Multichain extends boolean = false> = ListPositionsPropsBase & WithBlock<Multichain>;
|
|
38
|
+
/**
|
|
39
|
+
* Chain-independent part of {@link GetCurrentWithdrawalsProps}.
|
|
40
|
+
*
|
|
41
|
+
* {@link GetCurrentWithdrawalsPropsBase.blockNumber} is kept on the
|
|
42
|
+
* multichain form because the method already targets a single chain.
|
|
43
|
+
**/
|
|
44
|
+
interface GetCurrentWithdrawalsPropsBase {
|
|
45
|
+
/**
|
|
46
|
+
* Credit account whose delayed withdrawals to read.
|
|
47
|
+
**/
|
|
48
|
+
creditAccount: Address;
|
|
49
|
+
/**
|
|
50
|
+
* Block to read at. Defaults to the latest block.
|
|
51
|
+
**/
|
|
52
|
+
blockNumber?: bigint;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Props for {@link PositionsService.getCurrentWithdrawals}.
|
|
56
|
+
**/
|
|
57
|
+
type GetCurrentWithdrawalsProps<Multichain extends boolean = false> = GetCurrentWithdrawalsPropsBase & WithMultichain<Multichain, {
|
|
58
|
+
chainId: ChainId;
|
|
59
|
+
}>;
|
|
36
60
|
/**
|
|
37
61
|
* Cross-chain reads of the positions namespace: everything a wallet holds.
|
|
38
62
|
**/
|
|
@@ -41,6 +65,11 @@ interface IMultichainPositionsService {
|
|
|
41
65
|
* Positions of a wallet on all queried chains.
|
|
42
66
|
**/
|
|
43
67
|
list(props: ListPositionsProps<true>): Promise<DataResponse<Position[]>>;
|
|
68
|
+
/**
|
|
69
|
+
* Delayed withdrawals of one credit account, see
|
|
70
|
+
* {@link PositionsService.getCurrentWithdrawals}.
|
|
71
|
+
**/
|
|
72
|
+
getCurrentWithdrawals(props: GetCurrentWithdrawalsProps<true>): Promise<DataResponse<PositionWithdrawals>>;
|
|
44
73
|
}
|
|
45
74
|
/**
|
|
46
75
|
* Props for {@link PositionsService.listStrategyPositions}.
|
|
@@ -96,4 +125,4 @@ interface AccountSnapshot {
|
|
|
96
125
|
**/
|
|
97
126
|
declare function accountSnapshotFromCreditAccountData(ca: CreditAccountData): AccountSnapshot;
|
|
98
127
|
//#endregion
|
|
99
|
-
export { AccountSnapshot, IMultichainPositionsService, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, accountSnapshotFromCreditAccountData };
|
|
128
|
+
export { AccountSnapshot, GetCurrentWithdrawalsProps, GetCurrentWithdrawalsPropsBase, IMultichainPositionsService, ListPositionsProps, ListPositionsPropsBase, ListStrategyPositionsProps, accountSnapshotFromCreditAccountData };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
2
|
import { PoolPositionRef, Position, PositionFilter, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { PositionWithdrawals } from "../../model/withdrawals.js";
|
|
4
5
|
import "../../model/index.js";
|
|
6
|
+
import { GetCurrentWithdrawalsProps } from "../../onchain/positions/types.js";
|
|
5
7
|
import { MultichainSDK } from "../../onchain/MultichainSDK.js";
|
|
6
8
|
import "../../onchain/index.js";
|
|
7
9
|
import { GearboxAPI } from "../../offchain/GearboxAPI.js";
|
|
8
10
|
import "../../offchain/index.js";
|
|
9
11
|
import { FilterResult } from "../utils/types.js";
|
|
10
12
|
import "../utils/index.js";
|
|
11
|
-
import { IPositionMergers, IPositionsBase, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch } from "./types.js";
|
|
13
|
+
import { IPositionMergers, IPositionsBase, IPositionsOffchainBranch, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOnchainOnly } from "./types.js";
|
|
12
14
|
import { NamespaceOptions } from "../types.js";
|
|
13
15
|
import { AbstractNamespace } from "../AbstractNamespace.js";
|
|
14
16
|
import { Address } from "viem";
|
|
@@ -17,7 +19,7 @@ import { Address } from "viem";
|
|
|
17
19
|
* The `positions` namespace of a {@link GearboxSDK}, see
|
|
18
20
|
* {@link IPositionsByMode} for what each mode offers.
|
|
19
21
|
**/
|
|
20
|
-
declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positions"], GearboxAPI["positions"]> implements IPositionsBase, IPositionsOffchainOnly, IPositionsOnchainBranch, IPositionsOffchainBranch {
|
|
22
|
+
declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positions"], GearboxAPI["positions"]> implements IPositionsBase, IPositionsOffchainOnly, IPositionsOnchainOnly, IPositionsOnchainBranch, IPositionsOffchainBranch {
|
|
21
23
|
/**
|
|
22
24
|
* {@inheritDoc IPositionsBase.merge}
|
|
23
25
|
**/
|
|
@@ -40,6 +42,10 @@ declare class PositionsNamespace extends AbstractNamespace<MultichainSDK["positi
|
|
|
40
42
|
**/
|
|
41
43
|
charts<const Metrics extends readonly PoolPositionChartMetric[]>(key: PoolPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
42
44
|
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
45
|
+
/**
|
|
46
|
+
* {@inheritDoc IPositionsOnchainOnly.getCurrentWithdrawals}
|
|
47
|
+
**/
|
|
48
|
+
getCurrentWithdrawals(props: GetCurrentWithdrawalsProps<true>): Promise<DataResponse<PositionWithdrawals>>;
|
|
43
49
|
}
|
|
44
50
|
//#endregion
|
|
45
51
|
export { PositionsNamespace };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ChartBundle, ChartRange, PoolPositionChartMetric, StrategyPositionChartMetric } from "../../model/charts.js";
|
|
2
2
|
import { PoolPositionRef, Position, PositionFilter, PositionsTotals, StrategyPositionRef } from "../../model/positions.js";
|
|
3
3
|
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { PositionWithdrawals } from "../../model/withdrawals.js";
|
|
4
5
|
import "../../model/index.js";
|
|
5
|
-
import { IMultichainPositionsService } from "../../onchain/positions/types.js";
|
|
6
|
+
import { GetCurrentWithdrawalsProps, IMultichainPositionsService } from "../../onchain/positions/types.js";
|
|
6
7
|
import "../../onchain/index.js";
|
|
7
8
|
import { IOffchainPositions } from "../../offchain/positions/types.js";
|
|
8
9
|
import "../../offchain/index.js";
|
|
@@ -58,9 +59,16 @@ interface IPositionsOffchainOnly {
|
|
|
58
59
|
charts<const Metrics extends readonly StrategyPositionChartMetric[]>(key: StrategyPositionRef, metrics: Metrics, range: ChartRange): Promise<DataResponse<ChartBundle<Metrics>>>;
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
|
-
* Reads only the chain can answer.
|
|
62
|
+
* Reads only the chain can answer.
|
|
62
63
|
**/
|
|
63
|
-
interface IPositionsOnchainOnly {
|
|
64
|
+
interface IPositionsOnchainOnly {
|
|
65
|
+
/**
|
|
66
|
+
* Delayed withdrawals of one credit account: claimable rows carry the
|
|
67
|
+
* adapter call and recorded intent a claim is built from; pending rows
|
|
68
|
+
* name when they mature. Absent in `offchain` mode.
|
|
69
|
+
**/
|
|
70
|
+
getCurrentWithdrawals(props: GetCurrentWithdrawalsProps<true>): Promise<DataResponse<PositionWithdrawals>>;
|
|
71
|
+
}
|
|
64
72
|
/**
|
|
65
73
|
* The chain on its own, for a consumer that shows each source as it arrives.
|
|
66
74
|
* Absent in `offchain` mode.
|
|
@@ -2,8 +2,8 @@ import { Bps } from "../../model/primitives.js";
|
|
|
2
2
|
import { PoolOpportunityKey, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
3
3
|
import { PositionCollateral, StrategyPosition, StrategyPositionKey } from "../../model/positions.js";
|
|
4
4
|
import { DataResponse } from "../../model/response.js";
|
|
5
|
+
import { PositionClaimableWithdrawal } from "../../model/withdrawals.js";
|
|
5
6
|
import "../../model/index.js";
|
|
6
|
-
import { ClaimableWithdrawal } from "../../onchain/accounts/withdrawal-compressor/types.js";
|
|
7
7
|
import { Asset } from "../../onchain/base/types.js";
|
|
8
8
|
import { MultiCall } from "../../onchain/types/transactions.js";
|
|
9
9
|
import { PoolSimulation } from "../../onchain/pools/types.js";
|
|
@@ -326,13 +326,14 @@ interface LpRedeemParams {
|
|
|
326
326
|
interface FinalizeParams extends PrepareOptions {
|
|
327
327
|
/**
|
|
328
328
|
* The matured withdrawal to claim, from
|
|
329
|
-
* `sdk.
|
|
329
|
+
* `sdk.positions.getCurrentWithdrawals()`.
|
|
330
330
|
**/
|
|
331
|
-
claimable:
|
|
331
|
+
claimable: PositionClaimableWithdrawal;
|
|
332
332
|
/**
|
|
333
333
|
* The operation to resume. Defaults to the one the request recorded in the
|
|
334
|
-
* withdrawal's `extraData`, which is what
|
|
335
|
-
* decodes; pass it explicitly
|
|
334
|
+
* withdrawal's `extraData`, which is what
|
|
335
|
+
* {@link PositionClaimableWithdrawal.intent} decodes; pass it explicitly
|
|
336
|
+
* when the compressor is too old to report it.
|
|
336
337
|
**/
|
|
337
338
|
intent?: ResumableIntent;
|
|
338
339
|
}
|