@gearbox-protocol/sdk 14.12.0-next.80 → 14.12.0-next.82
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/filters.js +0 -4
- package/dist/cjs/model/filters.schema.js +10 -1
- package/dist/cjs/model/index.js +11 -0
- package/dist/cjs/model/liquidations.js +1 -1
- package/dist/cjs/model/liquidations.schema.js +1 -1
- package/dist/cjs/model/opportunities.js +1 -1
- package/dist/cjs/model/opportunities.schema.js +6 -13
- package/dist/cjs/model/positions.js +1 -1
- package/dist/cjs/model/positions.schema.js +33 -1
- package/dist/cjs/model/response.js +1 -0
- package/dist/cjs/model/response.schema.js +64 -0
- package/dist/cjs/new-sdk/AbstractNamespace.js +46 -128
- package/dist/cjs/new-sdk/GearboxSDK.js +55 -42
- package/dist/cjs/new-sdk/errors/AllSourcesFailedError.js +20 -0
- package/dist/cjs/new-sdk/errors/MissingSourceError.js +25 -0
- package/dist/cjs/new-sdk/errors/NoSourceServedError.js +20 -0
- package/dist/cjs/new-sdk/errors/SourceChainMismatchError.js +34 -0
- package/dist/cjs/new-sdk/errors/SourceUnavailableError.js +25 -0
- package/dist/cjs/new-sdk/errors/assertSameChains.js +12 -0
- package/dist/cjs/new-sdk/errors/everyChainFailed.js +11 -0
- package/dist/cjs/new-sdk/errors/index.js +15 -0
- package/dist/cjs/new-sdk/index.js +23 -3
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +37 -89
- package/dist/cjs/new-sdk/positions/PositionsNamespace.js +27 -94
- package/dist/cjs/new-sdk/types.js +0 -21
- package/dist/cjs/new-sdk/utils/filterResponse.js +21 -0
- package/dist/cjs/new-sdk/utils/index.js +6 -0
- package/dist/cjs/new-sdk/utils/mergeChains.js +81 -0
- package/dist/cjs/new-sdk/utils/types.js +1 -0
- package/dist/cjs/offchain/AbstractOffchainNamespace.js +42 -65
- package/dist/cjs/offchain/GearboxAPI.js +12 -8
- package/dist/cjs/offchain/errors/OffchainInvalidJsonError.js +19 -0
- package/dist/cjs/offchain/errors/OffchainNotConfiguredError.js +20 -0
- package/dist/cjs/offchain/errors/OffchainNotImplementedError.js +19 -0
- package/dist/cjs/offchain/errors/OffchainRequestFailedError.js +24 -0
- package/dist/cjs/offchain/errors/OffchainStatusError.js +20 -0
- package/dist/cjs/offchain/errors/OffchainTransportError.js +31 -0
- package/dist/cjs/offchain/errors/OffchainValidationError.js +26 -0
- package/dist/cjs/offchain/errors/backendMessage.js +28 -0
- package/dist/cjs/offchain/errors/errorCause.js +12 -0
- package/dist/cjs/offchain/errors/index.js +21 -0
- package/dist/cjs/offchain/errors/readResponseBody.js +15 -0
- package/dist/cjs/offchain/index.js +22 -5
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +6 -3
- package/dist/cjs/offchain/positions/OffchainPositions.js +15 -21
- package/dist/cjs/offchain/types.js +0 -75
- package/dist/cjs/sdk/MultichainSDK.js +1 -1
- package/dist/cjs/sdk/OnchainSDK.js +1 -1
- package/dist/cjs/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +6 -6
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +26 -20
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +38 -14
- package/dist/cjs/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +7 -5
- package/dist/cjs/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +3 -2
- package/dist/cjs/sdk/base/MultichainConstruct.js +73 -34
- package/dist/cjs/sdk/chain/chains.js +11 -0
- package/dist/cjs/sdk/chain/index.js +1 -0
- package/dist/cjs/sdk/core/index.js +1 -1
- package/dist/cjs/sdk/index.js +2 -1
- package/dist/cjs/sdk/market/rwa/RWARegistry.js +4 -2
- package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +18 -32
- package/dist/cjs/sdk/opportunities/OpportunitiesService.js +1 -4
- package/dist/cjs/sdk/pools/PoolService.js +2 -1
- package/dist/cjs/sdk/positions/MultichainPositionsService.js +6 -29
- package/dist/cjs/sdk/positions/PositionsService.js +12 -6
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/filters.js +0 -4
- package/dist/esm/model/filters.schema.js +10 -2
- package/dist/esm/model/index.js +5 -3
- package/dist/esm/model/liquidations.js +1 -1
- package/dist/esm/model/liquidations.schema.js +1 -1
- package/dist/esm/model/opportunities.js +1 -1
- package/dist/esm/model/opportunities.schema.js +4 -11
- package/dist/esm/model/positions.js +1 -1
- package/dist/esm/model/positions.schema.js +33 -3
- package/dist/esm/model/response.js +1 -0
- package/dist/esm/model/response.schema.js +58 -0
- package/dist/esm/new-sdk/AbstractNamespace.js +46 -128
- package/dist/esm/new-sdk/GearboxSDK.js +55 -42
- package/dist/esm/new-sdk/errors/AllSourcesFailedError.js +19 -0
- package/dist/esm/new-sdk/errors/MissingSourceError.js +24 -0
- package/dist/esm/new-sdk/errors/NoSourceServedError.js +19 -0
- package/dist/esm/new-sdk/errors/SourceChainMismatchError.js +33 -0
- package/dist/esm/new-sdk/errors/SourceUnavailableError.js +24 -0
- package/dist/esm/new-sdk/errors/assertSameChains.js +11 -0
- package/dist/esm/new-sdk/errors/everyChainFailed.js +10 -0
- package/dist/esm/new-sdk/errors/index.js +8 -0
- package/dist/esm/new-sdk/index.js +13 -3
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +38 -90
- package/dist/esm/new-sdk/positions/PositionsNamespace.js +28 -95
- package/dist/esm/new-sdk/types.js +1 -21
- package/dist/esm/new-sdk/utils/filterResponse.js +20 -0
- package/dist/esm/new-sdk/utils/index.js +3 -1
- package/dist/esm/new-sdk/utils/mergeChains.js +78 -0
- package/dist/esm/new-sdk/utils/types.js +1 -0
- package/dist/esm/offchain/AbstractOffchainNamespace.js +41 -64
- package/dist/esm/offchain/GearboxAPI.js +12 -8
- package/dist/esm/offchain/errors/OffchainInvalidJsonError.js +18 -0
- package/dist/esm/offchain/errors/OffchainNotConfiguredError.js +19 -0
- package/dist/esm/offchain/errors/OffchainNotImplementedError.js +18 -0
- package/dist/esm/offchain/errors/OffchainRequestFailedError.js +23 -0
- package/dist/esm/offchain/errors/OffchainStatusError.js +19 -0
- package/dist/esm/offchain/errors/OffchainTransportError.js +30 -0
- package/dist/esm/offchain/errors/OffchainValidationError.js +25 -0
- package/dist/esm/offchain/errors/backendMessage.js +27 -0
- package/dist/esm/offchain/errors/errorCause.js +11 -0
- package/dist/esm/offchain/errors/index.js +11 -0
- package/dist/esm/offchain/errors/readResponseBody.js +14 -0
- package/dist/esm/offchain/index.js +13 -2
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +6 -3
- package/dist/esm/offchain/positions/OffchainPositions.js +15 -21
- package/dist/esm/offchain/types.js +1 -72
- package/dist/esm/plugins/adapters/contracts/ERC4626AdapterContract.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +1 -1
- package/dist/esm/sdk/OnchainSDK.js +1 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/credit-account-compressor/CreditAccountCompressor.js +6 -6
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +27 -21
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +38 -14
- package/dist/esm/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.js +7 -5
- package/dist/esm/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.js +1 -1
- package/dist/esm/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.js +4 -3
- package/dist/esm/sdk/base/MultichainConstruct.js +73 -34
- package/dist/esm/sdk/base/TokensMeta.js +2 -2
- package/dist/esm/sdk/chain/chains.js +11 -1
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/chain/index.js +2 -2
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/core/index.js +1 -1
- package/dist/esm/sdk/index.js +3 -3
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +1 -1
- package/dist/esm/sdk/market/rwa/RWARegistry.js +4 -2
- package/dist/esm/sdk/market/zapper/IETHZapperContract.js +1 -1
- package/dist/esm/sdk/market/zapper/ZapperContract.js +1 -1
- package/dist/esm/sdk/opportunities/MultichainOpportunitiesService.js +18 -32
- package/dist/esm/sdk/opportunities/OpportunitiesService.js +1 -4
- package/dist/esm/sdk/pools/PoolService.js +3 -2
- package/dist/esm/sdk/positions/MultichainPositionsService.js +6 -29
- package/dist/esm/sdk/positions/PositionsService.js +12 -6
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/model/filters.d.ts +9 -3
- package/dist/types/model/filters.schema.d.ts +7 -1
- package/dist/types/model/index.d.ts +7 -5
- package/dist/types/model/liquidations.d.ts +2 -6
- package/dist/types/model/liquidations.schema.d.ts +1 -1
- package/dist/types/model/opportunities.d.ts +3 -7
- package/dist/types/model/opportunities.schema.d.ts +2 -2
- package/dist/types/model/positions.d.ts +2 -6
- package/dist/types/model/positions.schema.d.ts +32 -2
- package/dist/types/model/response.d.ts +105 -0
- package/dist/types/model/response.schema.d.ts +98 -0
- package/dist/types/new-sdk/AbstractNamespace.d.ts +33 -98
- package/dist/types/new-sdk/GearboxSDK.d.ts +10 -25
- package/dist/types/new-sdk/errors/AllSourcesFailedError.d.ts +11 -0
- package/dist/types/new-sdk/errors/MissingSourceError.d.ts +23 -0
- package/dist/types/new-sdk/errors/NoSourceServedError.d.ts +17 -0
- package/dist/types/new-sdk/errors/SourceChainMismatchError.d.ts +35 -0
- package/dist/types/new-sdk/errors/SourceUnavailableError.d.ts +22 -0
- package/dist/types/new-sdk/errors/assertSameChains.d.ts +11 -0
- package/dist/types/new-sdk/errors/everyChainFailed.d.ts +10 -0
- package/dist/types/new-sdk/errors/index.d.ts +8 -0
- package/dist/types/new-sdk/index.d.ts +17 -6
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +19 -40
- package/dist/types/new-sdk/opportunities/index.d.ts +2 -2
- package/dist/types/new-sdk/opportunities/types.d.ts +80 -26
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +17 -38
- package/dist/types/new-sdk/positions/index.d.ts +2 -2
- package/dist/types/new-sdk/positions/types.d.ts +74 -24
- package/dist/types/new-sdk/types.d.ts +24 -77
- package/dist/types/new-sdk/utils/filterResponse.d.ts +16 -0
- package/dist/types/new-sdk/utils/history.d.ts +6 -36
- package/dist/types/new-sdk/utils/index.d.ts +5 -2
- package/dist/types/new-sdk/utils/mergeChains.d.ts +20 -0
- package/dist/types/new-sdk/utils/types.d.ts +11 -0
- package/dist/types/offchain/AbstractOffchainNamespace.d.ts +21 -28
- package/dist/types/offchain/GearboxAPI.d.ts +13 -9
- package/dist/types/offchain/errors/OffchainInvalidJsonError.d.ts +16 -0
- package/dist/types/offchain/errors/OffchainNotConfiguredError.d.ts +16 -0
- package/dist/types/offchain/errors/OffchainNotImplementedError.d.ts +15 -0
- package/dist/types/offchain/errors/OffchainRequestFailedError.d.ts +12 -0
- package/dist/types/offchain/errors/OffchainStatusError.d.ts +16 -0
- package/dist/types/offchain/errors/OffchainTransportError.d.ts +43 -0
- package/dist/types/offchain/errors/OffchainValidationError.d.ts +21 -0
- package/dist/types/offchain/errors/backendMessage.d.ts +9 -0
- package/dist/types/offchain/errors/errorCause.d.ts +22 -0
- package/dist/types/offchain/errors/index.d.ts +11 -0
- package/dist/types/offchain/errors/readResponseBody.d.ts +8 -0
- package/dist/types/offchain/index.d.ts +13 -2
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +9 -8
- package/dist/types/offchain/positions/OffchainPositions.d.ts +9 -15
- package/dist/types/offchain/types.d.ts +7 -88
- package/dist/types/sdk/accounts/credit-account-compressor/types.d.ts +4 -0
- package/dist/types/sdk/accounts/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +15 -14
- package/dist/types/sdk/accounts/liquidations/index.d.ts +2 -2
- package/dist/types/sdk/accounts/liquidations/types.d.ts +32 -16
- package/dist/types/sdk/accounts/withdrawal-compressor/AbstractWithdrawalCompressorContract.d.ts +4 -4
- package/dist/types/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.d.ts +2 -2
- package/dist/types/sdk/accounts/withdrawal-compressor/index.d.ts +2 -2
- package/dist/types/sdk/accounts/withdrawal-compressor/types.d.ts +26 -4
- package/dist/types/sdk/base/MultichainConstruct.d.ts +63 -14
- package/dist/types/sdk/base/index.d.ts +2 -2
- package/dist/types/sdk/chain/chains.d.ts +10 -2
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +7 -7
- package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
- package/dist/types/sdk/market/rwa/RWARegistry.d.ts +2 -1
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +13 -16
- package/dist/types/sdk/pools/types.d.ts +4 -0
- package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -12
- package/dist/types/sdk/positions/index.d.ts +2 -2
- package/dist/types/sdk/positions/types.d.ts +14 -5
- package/dist/types/sdk/types/index.d.ts +2 -2
- package/dist/types/sdk/types/multichain.d.ts +16 -36
- package/package.json +1 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ILogger } from "../sdk/types/logger.js";
|
|
2
|
+
import { ChainId } from "../model/primitives.js";
|
|
3
|
+
import { ChainScopedFilter } from "../model/filters.js";
|
|
2
4
|
import { HistoryMetric, HistoryRange, HistorySeries } from "../model/history.js";
|
|
3
|
-
import {
|
|
5
|
+
import { DataResponse } from "../model/response.js";
|
|
6
|
+
import { GearboxAPIOptions } from "./types.js";
|
|
4
7
|
import { z } from "zod/v4";
|
|
5
8
|
//#region src/offchain/AbstractOffchainNamespace.d.ts
|
|
6
9
|
/**
|
|
@@ -23,8 +26,7 @@ interface OffchainGetRequest<S extends z.ZodType> {
|
|
|
23
26
|
**/
|
|
24
27
|
query?: OffchainQuery;
|
|
25
28
|
/**
|
|
26
|
-
* Schema the payload is decoded with.
|
|
27
|
-
* into read model values, so it is required rather than optional.
|
|
29
|
+
* Schema the payload is decoded with.
|
|
28
30
|
**/
|
|
29
31
|
schema: S;
|
|
30
32
|
}
|
|
@@ -39,49 +41,40 @@ interface OffchainHistoryRequest<M extends HistoryMetric> {
|
|
|
39
41
|
**/
|
|
40
42
|
path: string;
|
|
41
43
|
/**
|
|
42
|
-
* Metric the response must carry
|
|
43
|
-
* {@link AbstractOffchainNamespace.readHistory}.
|
|
44
|
+
* Metric the response must carry.
|
|
44
45
|
**/
|
|
45
46
|
metric: M;
|
|
46
|
-
/**
|
|
47
|
-
* Window to cover.
|
|
48
|
-
**/
|
|
49
47
|
range: HistoryRange;
|
|
50
48
|
}
|
|
51
49
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* A namespace is a set of routes: it knows which path answers which read and
|
|
55
|
-
* which schema describes the payload. Everything under that — where the
|
|
56
|
-
* backend is, how long a request may take, how a failure is reported and how a
|
|
57
|
-
* response becomes read model values — lives here, so a namespace holds
|
|
50
|
+
* Base class of every {@link GearboxAPI} namespace: issues the requests,
|
|
51
|
+
* decodes the responses and reports the failures, so that a namespace holds
|
|
58
52
|
* nothing but its routes.
|
|
59
53
|
**/
|
|
60
54
|
declare abstract class AbstractOffchainNamespace {
|
|
61
55
|
#private;
|
|
62
56
|
protected readonly logger?: ILogger;
|
|
63
|
-
protected constructor(name: string, options
|
|
57
|
+
protected constructor(name: string, options: GearboxAPIOptions);
|
|
64
58
|
/**
|
|
65
59
|
* Base URL every read of this namespace is issued against.
|
|
66
60
|
**/
|
|
67
61
|
get baseUrl(): string | undefined;
|
|
68
62
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
* Chains one read covers: the configured ones, narrowed by the filter when it
|
|
64
|
+
* names any. A filter naming a chain this client does not cover narrows
|
|
65
|
+
* nothing.
|
|
66
|
+
**/
|
|
67
|
+
protected scopedChainIds(filter?: ChainScopedFilter): ChainId[];
|
|
68
|
+
/**
|
|
69
|
+
* Reads one endpoint and decodes its payload. Timeouts, non-2xx answers and
|
|
70
|
+
* schema skew throw, since none of them is a {@link DataResponse}.
|
|
74
71
|
**/
|
|
75
|
-
protected get<S extends z.ZodType>(request: OffchainGetRequest<S>): Promise<
|
|
72
|
+
protected get<S extends z.ZodType>(request: OffchainGetRequest<S>): Promise<DataResponse<z.output<S>>>;
|
|
76
73
|
/**
|
|
77
|
-
* Reads one historical series.
|
|
78
|
-
*
|
|
79
|
-
* The requested metric is pinned in the schema, which is what upholds the
|
|
80
|
-
* `HistorySeries<M>` a caller gets back: a response carrying a different
|
|
81
|
-
* metric is version skew and fails validation like any other mismatch,
|
|
82
|
-
* rather than being cast into the requested shape.
|
|
74
|
+
* Reads one historical series. A response carrying a metric other than the
|
|
75
|
+
* requested one fails validation.
|
|
83
76
|
**/
|
|
84
|
-
protected readHistory<M extends HistoryMetric>(request: OffchainHistoryRequest<M>): Promise<
|
|
77
|
+
protected readHistory<M extends HistoryMetric>(request: OffchainHistoryRequest<M>): Promise<DataResponse<HistorySeries<M>>>;
|
|
85
78
|
}
|
|
86
79
|
//#endregion
|
|
87
80
|
export { AbstractOffchainNamespace, OffchainGetRequest, OffchainHistoryRequest, OffchainQuery };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainId } from "../model/primitives.js";
|
|
1
2
|
import { GearboxAPIOptions } from "./types.js";
|
|
2
3
|
import { OffchainOpportunities } from "./opportunities/OffchainOpportunities.js";
|
|
3
4
|
import "./opportunities/index.js";
|
|
@@ -11,18 +12,21 @@ import "./positions/index.js";
|
|
|
11
12
|
* call reads the same way against either source:
|
|
12
13
|
*
|
|
13
14
|
* ```ts
|
|
14
|
-
* const api = new GearboxAPI({
|
|
15
|
-
*
|
|
15
|
+
* const api = new GearboxAPI({
|
|
16
|
+
* baseUrl: "https://api.gearbox.fi",
|
|
17
|
+
* chainIds: [1, 42161],
|
|
18
|
+
* });
|
|
19
|
+
* const { data } = await api.opportunities.list({ kind: "strategy" });
|
|
16
20
|
* ```
|
|
17
21
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* transport and schema validation.
|
|
21
|
-
*
|
|
22
|
-
* The transport is not implemented yet; see {@link OffchainOpportunities} and
|
|
23
|
-
* {@link OffchainPositions} for what each stubbed endpoint currently answers.
|
|
22
|
+
* Every read is scoped to {@link GearboxAPIOptions.chainIds}, so a client only
|
|
23
|
+
* ever sees the chains it was built for even though the backend knows more.
|
|
24
24
|
**/
|
|
25
25
|
declare class GearboxAPI {
|
|
26
|
+
/**
|
|
27
|
+
* Chains every read of this client is scoped to.
|
|
28
|
+
**/
|
|
29
|
+
readonly chainIds: readonly ChainId[];
|
|
26
30
|
/**
|
|
27
31
|
* Namespace for pool and strategy opportunities.
|
|
28
32
|
**/
|
|
@@ -31,7 +35,7 @@ declare class GearboxAPI {
|
|
|
31
35
|
* Namespace for the positions a wallet holds.
|
|
32
36
|
**/
|
|
33
37
|
readonly positions: OffchainPositions;
|
|
34
|
-
constructor(options
|
|
38
|
+
constructor(options: GearboxAPIOptions);
|
|
35
39
|
}
|
|
36
40
|
//#endregion
|
|
37
41
|
export { GearboxAPI };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OffchainTransportError } from "./OffchainTransportError.js";
|
|
2
|
+
//#region src/offchain/errors/OffchainInvalidJsonError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when the backend answered in the 2xx range with a body that is not
|
|
5
|
+
* JSON, so there is nothing to validate against the read model.
|
|
6
|
+
**/
|
|
7
|
+
declare class OffchainInvalidJsonError extends OffchainTransportError {
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Status the backend answered with.
|
|
11
|
+
**/
|
|
12
|
+
readonly status: number;
|
|
13
|
+
constructor(url: string, status: number, cause: unknown);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { OffchainInvalidJsonError };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
//#region src/offchain/errors/OffchainNotConfiguredError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a read is issued against a client that was never told where the
|
|
5
|
+
* backend is.
|
|
6
|
+
**/
|
|
7
|
+
declare class OffchainNotConfiguredError extends BaseError {
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Path that was read, below the base URL that is missing.
|
|
11
|
+
**/
|
|
12
|
+
readonly path: string;
|
|
13
|
+
constructor(path: string);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { OffchainNotConfiguredError };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
//#region src/offchain/errors/OffchainNotImplementedError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown by the endpoints that are not implemented yet.
|
|
5
|
+
**/
|
|
6
|
+
declare class OffchainNotImplementedError extends BaseError {
|
|
7
|
+
name: string;
|
|
8
|
+
/**
|
|
9
|
+
* Endpoint that was asked for.
|
|
10
|
+
**/
|
|
11
|
+
readonly endpoint: string;
|
|
12
|
+
constructor(endpoint: string);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { OffchainNotImplementedError };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { OffchainTransportError } from "./OffchainTransportError.js";
|
|
2
|
+
//#region src/offchain/errors/OffchainRequestFailedError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when a request to the backend never completed: the network was down,
|
|
5
|
+
* or it took longer than {@link GearboxAPIOptions.timeout}.
|
|
6
|
+
**/
|
|
7
|
+
declare class OffchainRequestFailedError extends OffchainTransportError {
|
|
8
|
+
name: string;
|
|
9
|
+
constructor(url: string, cause: unknown);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { OffchainRequestFailedError };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { OffchainTransportError } from "./OffchainTransportError.js";
|
|
2
|
+
//#region src/offchain/errors/OffchainStatusError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when the backend answered with a status outside the 2xx range. What it
|
|
5
|
+
* said about it, when it said anything, is the `details` of the error.
|
|
6
|
+
**/
|
|
7
|
+
declare class OffchainStatusError extends OffchainTransportError {
|
|
8
|
+
name: string;
|
|
9
|
+
/**
|
|
10
|
+
* Status the backend answered with.
|
|
11
|
+
**/
|
|
12
|
+
readonly status: number;
|
|
13
|
+
constructor(url: string, status: number, body?: string);
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { OffchainStatusError };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
//#region src/offchain/errors/OffchainTransportError.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* What every transport failure of a backend read names, see
|
|
5
|
+
* {@link OffchainTransportError}.
|
|
6
|
+
**/
|
|
7
|
+
interface OffchainTransportErrorParams {
|
|
8
|
+
/**
|
|
9
|
+
* URL that was requested, query included.
|
|
10
|
+
**/
|
|
11
|
+
url: string;
|
|
12
|
+
/**
|
|
13
|
+
* Status the backend answered with, absent when the request never completed.
|
|
14
|
+
**/
|
|
15
|
+
status?: number;
|
|
16
|
+
/**
|
|
17
|
+
* Value that was caught, normalised by {@link errorCause}.
|
|
18
|
+
**/
|
|
19
|
+
cause?: unknown;
|
|
20
|
+
/**
|
|
21
|
+
* What the backend itself said. Used only when there is no {@link cause},
|
|
22
|
+
* whose message viem reports instead.
|
|
23
|
+
**/
|
|
24
|
+
details?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Thrown when the backend could not be reached, or answered with something
|
|
28
|
+
* other than a JSON body in the 2xx range. Its subclasses say which of the
|
|
29
|
+
* three it was; catch this one to catch all of them.
|
|
30
|
+
**/
|
|
31
|
+
declare abstract class OffchainTransportError extends BaseError {
|
|
32
|
+
/**
|
|
33
|
+
* URL that was requested, query included.
|
|
34
|
+
**/
|
|
35
|
+
readonly url: string;
|
|
36
|
+
/**
|
|
37
|
+
* Status the backend answered with, absent when the request never completed.
|
|
38
|
+
**/
|
|
39
|
+
readonly status?: number;
|
|
40
|
+
protected constructor(shortMessage: string, params: OffchainTransportErrorParams);
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { OffchainTransportError, OffchainTransportErrorParams };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
//#region src/offchain/errors/OffchainValidationError.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Thrown when the backend answered, but with a payload the read model does not
|
|
6
|
+
* describe, i.e. the two are of different versions.
|
|
7
|
+
**/
|
|
8
|
+
declare class OffchainValidationError extends BaseError {
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* URL whose payload failed to validate.
|
|
12
|
+
**/
|
|
13
|
+
readonly url: string;
|
|
14
|
+
/**
|
|
15
|
+
* The zod failure itself, e.g. for `z.treeifyError(error.zodError)`.
|
|
16
|
+
**/
|
|
17
|
+
readonly zodError: z.core.$ZodError;
|
|
18
|
+
constructor(url: string, zodError: z.core.$ZodError);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { OffchainValidationError };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/offchain/errors/backendMessage.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Why a non-2xx response failed, in the backend's own words: the `message` of a
|
|
4
|
+
* Gearbox backend error body, the whole body when it is not one, and nothing
|
|
5
|
+
* when it said nothing at all.
|
|
6
|
+
**/
|
|
7
|
+
declare function backendMessage(body: string | undefined): string | undefined;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { backendMessage };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/offchain/errors/errorCause.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The `cause` / `details` pair viem's `BaseError` accepts, see
|
|
4
|
+
* {@link errorCause}.
|
|
5
|
+
**/
|
|
6
|
+
interface ErrorCause {
|
|
7
|
+
/**
|
|
8
|
+
* The caught value when it was an `Error`, so `walk()` reaches it.
|
|
9
|
+
**/
|
|
10
|
+
cause?: Error;
|
|
11
|
+
/**
|
|
12
|
+
* The caught value stringified, when it was not an `Error`.
|
|
13
|
+
**/
|
|
14
|
+
details?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Turns a caught `unknown` into what viem's `BaseError` takes: it types `cause`
|
|
18
|
+
* as an `Error`, so anything else can only be reported as `details`.
|
|
19
|
+
**/
|
|
20
|
+
declare function errorCause(error: unknown): ErrorCause;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { ErrorCause, errorCause };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { backendMessage } from "./backendMessage.js";
|
|
2
|
+
import { ErrorCause, errorCause } from "./errorCause.js";
|
|
3
|
+
import { OffchainTransportError, OffchainTransportErrorParams } from "./OffchainTransportError.js";
|
|
4
|
+
import { OffchainInvalidJsonError } from "./OffchainInvalidJsonError.js";
|
|
5
|
+
import { OffchainNotConfiguredError } from "./OffchainNotConfiguredError.js";
|
|
6
|
+
import { OffchainNotImplementedError } from "./OffchainNotImplementedError.js";
|
|
7
|
+
import { OffchainRequestFailedError } from "./OffchainRequestFailedError.js";
|
|
8
|
+
import { OffchainStatusError } from "./OffchainStatusError.js";
|
|
9
|
+
import { OffchainValidationError } from "./OffchainValidationError.js";
|
|
10
|
+
import { readResponseBody } from "./readResponseBody.js";
|
|
11
|
+
export { ErrorCause, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, backendMessage, errorCause, readResponseBody };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/offchain/errors/readResponseBody.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Body of a failed response as text, or nothing when it cannot be read: a
|
|
4
|
+
* failure explaining a failure is not itself worth throwing.
|
|
5
|
+
**/
|
|
6
|
+
declare function readResponseBody(response: Response): Promise<string | undefined>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { readResponseBody };
|
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
import { GearboxAPIOptions
|
|
1
|
+
import { GearboxAPIOptions } from "./types.js";
|
|
2
2
|
import { AbstractOffchainNamespace, OffchainGetRequest, OffchainHistoryRequest, OffchainQuery } from "./AbstractOffchainNamespace.js";
|
|
3
|
+
import { backendMessage } from "./errors/backendMessage.js";
|
|
4
|
+
import { ErrorCause, errorCause } from "./errors/errorCause.js";
|
|
5
|
+
import { OffchainTransportError, OffchainTransportErrorParams } from "./errors/OffchainTransportError.js";
|
|
6
|
+
import { OffchainInvalidJsonError } from "./errors/OffchainInvalidJsonError.js";
|
|
7
|
+
import { OffchainNotConfiguredError } from "./errors/OffchainNotConfiguredError.js";
|
|
8
|
+
import { OffchainNotImplementedError } from "./errors/OffchainNotImplementedError.js";
|
|
9
|
+
import { OffchainRequestFailedError } from "./errors/OffchainRequestFailedError.js";
|
|
10
|
+
import { OffchainStatusError } from "./errors/OffchainStatusError.js";
|
|
11
|
+
import { OffchainValidationError } from "./errors/OffchainValidationError.js";
|
|
12
|
+
import { readResponseBody } from "./errors/readResponseBody.js";
|
|
13
|
+
import "./errors/index.js";
|
|
3
14
|
import { OffchainOpportunities } from "./opportunities/OffchainOpportunities.js";
|
|
4
15
|
import "./opportunities/index.js";
|
|
5
16
|
import { OffchainPositions } from "./positions/OffchainPositions.js";
|
|
6
17
|
import "./positions/index.js";
|
|
7
18
|
import { GearboxAPI } from "./GearboxAPI.js";
|
|
8
|
-
export { AbstractOffchainNamespace, GearboxAPI, GearboxAPIOptions, OffchainGetRequest, OffchainHistoryRequest, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery,
|
|
19
|
+
export { AbstractOffchainNamespace, ErrorCause, GearboxAPI, GearboxAPIOptions, OffchainGetRequest, OffchainHistoryRequest, OffchainInvalidJsonError, OffchainNotConfiguredError, OffchainNotImplementedError, OffchainOpportunities, OffchainPositions, OffchainQuery, OffchainRequestFailedError, OffchainStatusError, OffchainTransportError, OffchainTransportErrorParams, OffchainValidationError, backendMessage, errorCause, readResponseBody };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
2
2
|
import { HistoryMetric, HistorySeries, OpportunityHistoryQuery } from "../../model/history.js";
|
|
3
|
-
import {
|
|
3
|
+
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { GearboxAPIOptions } from "../types.js";
|
|
4
5
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
5
6
|
//#region src/offchain/opportunities/OffchainOpportunities.d.ts
|
|
6
7
|
/**
|
|
@@ -8,24 +9,24 @@ import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
|
8
9
|
**/
|
|
9
10
|
declare class OffchainOpportunities extends AbstractOffchainNamespace {
|
|
10
11
|
#private;
|
|
11
|
-
constructor(options
|
|
12
|
+
constructor(options: GearboxAPIOptions);
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
* {@link OpportunityFilter}.
|
|
14
|
+
* Opportunities of the chains this client covers, optionally narrowed further
|
|
15
|
+
* by {@link OpportunityFilter}.
|
|
15
16
|
**/
|
|
16
|
-
list(filter?: OpportunityFilter): Promise<
|
|
17
|
+
list(filter?: OpportunityFilter): Promise<DataResponse<Opportunity[]>>;
|
|
17
18
|
/**
|
|
18
19
|
* Detailed view of one pool opportunity.
|
|
19
20
|
**/
|
|
20
|
-
getPool(key: PoolOpportunityKey): Promise<
|
|
21
|
+
getPool(key: PoolOpportunityKey): Promise<DataResponse<PoolOpportunityDetail>>;
|
|
21
22
|
/**
|
|
22
23
|
* Detailed view of one strategy opportunity.
|
|
23
24
|
**/
|
|
24
|
-
getStrategy(key: StrategyOpportunityKey): Promise<
|
|
25
|
+
getStrategy(key: StrategyOpportunityKey): Promise<DataResponse<StrategyOpportunityDetail>>;
|
|
25
26
|
/**
|
|
26
27
|
* One historical series of one opportunity
|
|
27
28
|
**/
|
|
28
|
-
getHistory<M extends HistoryMetric>(query: OpportunityHistoryQuery<M>): Promise<
|
|
29
|
+
getHistory<M extends HistoryMetric>(query: OpportunityHistoryQuery<M>): Promise<DataResponse<HistorySeries<M>>>;
|
|
29
30
|
}
|
|
30
31
|
//#endregion
|
|
31
32
|
export { OffchainOpportunities };
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
import { Position
|
|
1
|
+
import { Position } from "../../model/positions.js";
|
|
2
2
|
import { HistorySeries, PositionHistoryMetric, PositionHistoryQuery } from "../../model/history.js";
|
|
3
|
-
import {
|
|
3
|
+
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import { ListPositionsPropsBase } from "../../sdk/positions/types.js";
|
|
5
|
+
import { GearboxAPIOptions } from "../types.js";
|
|
4
6
|
import { AbstractOffchainNamespace } from "../AbstractOffchainNamespace.js";
|
|
5
|
-
import { Address } from "viem";
|
|
6
7
|
//#region src/offchain/positions/OffchainPositions.d.ts
|
|
7
8
|
/**
|
|
8
9
|
* Backend counterpart of the `positions` namespace.
|
|
9
10
|
**/
|
|
10
11
|
declare class OffchainPositions extends AbstractOffchainNamespace {
|
|
11
|
-
|
|
12
|
+
#private;
|
|
13
|
+
constructor(options: GearboxAPIOptions);
|
|
12
14
|
/**
|
|
13
15
|
* Everything a wallet holds, optionally narrowed by {@link PositionFilter}.
|
|
14
|
-
*
|
|
15
|
-
* @returns An empty list until the backend client is implemented.
|
|
16
16
|
**/
|
|
17
|
-
list(
|
|
17
|
+
list(props: ListPositionsPropsBase): Promise<DataResponse<Position[]>>;
|
|
18
18
|
/**
|
|
19
|
-
* One historical series of one position.
|
|
20
|
-
* it from the chain would mean an archive read per point.
|
|
21
|
-
*
|
|
22
|
-
* The requested metric types the response, so a caller asking for one metric
|
|
23
|
-
* does not have to narrow the union back down. When the transport lands,
|
|
24
|
-
* validation is what upholds it: a response carrying a different metric than
|
|
25
|
-
* the one asked for is a version-skew error like any other.
|
|
19
|
+
* One historical series of one position.
|
|
26
20
|
*
|
|
27
21
|
* @returns An empty series until the backend client is implemented.
|
|
28
22
|
**/
|
|
29
|
-
getHistory<M extends PositionHistoryMetric>(query: PositionHistoryQuery<M>): Promise<
|
|
23
|
+
getHistory<M extends PositionHistoryMetric>(query: PositionHistoryQuery<M>): Promise<DataResponse<HistorySeries<M>>>;
|
|
30
24
|
}
|
|
31
25
|
//#endregion
|
|
32
26
|
export { OffchainPositions };
|
|
@@ -1,93 +1,15 @@
|
|
|
1
1
|
import { ILogger } from "../sdk/types/logger.js";
|
|
2
|
-
import {
|
|
2
|
+
import { ChainId } from "../model/primitives.js";
|
|
3
3
|
//#region src/offchain/types.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* Outcome of the single request that serves a backend read. Unlike the
|
|
6
|
-
* on-chain source there is no per-chain breakdown here: one HTTP call covers
|
|
7
|
-
* every chain, so splitting it per chain would be fabricated.
|
|
8
|
-
**/
|
|
9
|
-
interface OffchainSourceMeta {
|
|
10
|
-
/**
|
|
11
|
-
* Whether the backend served the request.
|
|
12
|
-
**/
|
|
13
|
-
status: "success" | "error";
|
|
14
|
-
/**
|
|
15
|
-
* Rejection reason. Only set when {@link status} is `"error"`.
|
|
16
|
-
**/
|
|
17
|
-
error?: unknown;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* What every {@link GearboxAPI} read returns: the payload plus the outcome of
|
|
21
|
-
* the request that produced it, in the same shape the combined SDK exposes.
|
|
22
|
-
*
|
|
23
|
-
* @typeParam T - Payload type.
|
|
24
|
-
**/
|
|
25
|
-
interface OffchainResult<T> {
|
|
26
|
-
/**
|
|
27
|
-
* Requested payload.
|
|
28
|
-
**/
|
|
29
|
-
result: T;
|
|
30
|
-
/**
|
|
31
|
-
* Outcome of the backend request.
|
|
32
|
-
**/
|
|
33
|
-
meta: OffchainSourceMeta;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Thrown by the endpoints that have no stub answer, so that a caller in
|
|
37
|
-
* `offchain` mode fails loudly instead of reading an empty detail page as a
|
|
38
|
-
* missing entity.
|
|
39
|
-
*
|
|
40
|
-
* Lives here rather than in one namespace because every stubbed namespace
|
|
41
|
-
* throws it.
|
|
42
|
-
**/
|
|
43
|
-
declare class OffchainNotImplementedError extends Error {
|
|
44
|
-
constructor(endpoint: string);
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Thrown when a read is issued against a client that was never told where the
|
|
48
|
-
* backend is.
|
|
49
|
-
**/
|
|
50
|
-
declare class OffchainNotConfiguredError extends Error {
|
|
51
|
-
constructor(path: string);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Thrown when the backend could not be reached, or answered with a status
|
|
55
|
-
* outside the 2xx range.
|
|
56
|
-
**/
|
|
57
|
-
declare class OffchainTransportError extends Error {
|
|
58
|
-
/**
|
|
59
|
-
* URL that was requested, query included.
|
|
60
|
-
**/
|
|
61
|
-
readonly url: string;
|
|
62
|
-
/**
|
|
63
|
-
* Status the backend answered with, absent when the request never completed.
|
|
64
|
-
**/
|
|
65
|
-
readonly status?: number;
|
|
66
|
-
constructor(url: string, reason: string, status?: number);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Thrown when the backend answered, but with a payload the read model does not
|
|
70
|
-
* describe.
|
|
71
|
-
*
|
|
72
|
-
* This is version skew rather than a bad request, and it is deliberately
|
|
73
|
-
* handled like a transport error: the combined SDK drops the backend's
|
|
74
|
-
* contribution in `both` mode and fails the read in `offchain` mode.
|
|
75
|
-
**/
|
|
76
|
-
declare class OffchainValidationError extends Error {
|
|
77
|
-
/**
|
|
78
|
-
* URL whose payload failed to validate.
|
|
79
|
-
**/
|
|
80
|
-
readonly url: string;
|
|
81
|
-
/**
|
|
82
|
-
* What did not match, in the order zod reported it.
|
|
83
|
-
**/
|
|
84
|
-
readonly issues: readonly z.core.$ZodIssue[];
|
|
85
|
-
constructor(url: string, issues: readonly z.core.$ZodIssue[]);
|
|
86
|
-
}
|
|
87
4
|
/**
|
|
88
5
|
* Options for creating a {@link GearboxAPI} instance.
|
|
89
6
|
**/
|
|
90
7
|
interface GearboxAPIOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Chains this client reads, which every request names. A caller who thinks in
|
|
10
|
+
* network labels converts with {@link toChainIds}.
|
|
11
|
+
**/
|
|
12
|
+
chainIds: ChainId[];
|
|
91
13
|
/**
|
|
92
14
|
* Base URL of the Gearbox backend, without a trailing slash.
|
|
93
15
|
*
|
|
@@ -100,10 +22,7 @@ interface GearboxAPIOptions {
|
|
|
100
22
|
* @defaultValue 30 seconds
|
|
101
23
|
**/
|
|
102
24
|
timeout?: number;
|
|
103
|
-
/**
|
|
104
|
-
* Logger used for transport and validation diagnostics.
|
|
105
|
-
**/
|
|
106
25
|
logger?: ILogger;
|
|
107
26
|
}
|
|
108
27
|
//#endregion
|
|
109
|
-
export { GearboxAPIOptions
|
|
28
|
+
export { GearboxAPIOptions };
|
|
@@ -159,6 +159,10 @@ interface ListStrategyPositionsProps {
|
|
|
159
159
|
* Whether to include accounts that carry no debt.
|
|
160
160
|
**/
|
|
161
161
|
includeZeroDebt: boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Block to read at. Defaults to the latest block.
|
|
164
|
+
**/
|
|
165
|
+
blockNumber?: bigint;
|
|
162
166
|
}
|
|
163
167
|
//#endregion
|
|
164
168
|
export { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
|
|
1
|
+
import { ClaimableWithdrawal, CurrentWithdrawals, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, GetExternalAccountCurrentWithdrawalsProps, GetWithdrawalRequestResultProps, IRedemptionLoggerContract, IWithdrawalCompressorContract, PendingWithdrawal, RedemptionLog, RequestableWithdrawal, WithdrawableAsset, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, toWithdrawalStatus } from "./withdrawal-compressor/types.js";
|
|
2
2
|
import { CreditAccountDataCall, CreditAccountFilter, CreditAccountReadOptions, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsTarget, CreditManagerFilter, GetCreditAccountsArgs, GetCreditAccountsOptions, ListStrategyPositionsProps } from "./credit-account-compressor/types.js";
|
|
3
3
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
4
4
|
import { CreditAccountCompressorV310Contract } from "./credit-account-compressor/CreditAccountCompressorV310Contract.js";
|
|
@@ -24,8 +24,8 @@ import { CreditAccountSlice, IntentPreviewResult } from "./intents/types.js";
|
|
|
24
24
|
import { primaryInstantOutput } from "./intents/operations/claim-delayed/index.js";
|
|
25
25
|
import { CreditAccountOperationsService } from "./intents/index.js";
|
|
26
26
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./liquidations/constants.js";
|
|
27
|
-
import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps,
|
|
27
|
+
import { BuildLiquidationTxProps, BuildLiquidationTxPropsBase, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, LoadRWALiquidatorsProps, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, RWALiquidatorInfo } from "./liquidations/types.js";
|
|
28
28
|
import { LiquidationsService } from "./liquidations/LiquidationsService.js";
|
|
29
29
|
import { MultichainLiquidationsService } from "./liquidations/MultichainLiquidationsService.js";
|
|
30
30
|
import "./liquidations/index.js";
|
|
31
|
-
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions,
|
|
31
|
+
export { AbstractWithdrawalCompressorContract, AccountBotsService, AccountToCheck, AssembleCaOperationsProps, AssembleClaimDelayedCallsProps, AssembleCloseCreditAccountCallsProps, AssembleRepayCreditAccountCallsProps, AssembleStartDelayedWithdrawalCallsProps, BotStatusCall, BotsDirectResponse, BuildLiquidationTxProps, BuildLiquidationTxPropsBase, CMSlice, ClaimFarmRewardsProps, ClaimableWithdrawal, CloseCreditAccountResult, ConnectedBotsCall, ConnectedBotsPerAccount, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountDataCall, CreditAccountFilter, CreditAccountOperationResult, CreditAccountOperationsService, CreditAccountReadOptions, type CreditAccountSlice, CreditAccountsCall, CreditAccountsQuery, CreditAccountsReadOptions, CreditAccountsServiceV310, CreditAccountsTarget, CreditManagerFilter, CreditManagerOperationResult, CurrentWithdrawals, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DelayedAddCollateralIntent, DelayedCloseAccountIntent, DelayedDecreaseLeverageIntent, DelayedDepositAndIncreaseLeverageIntent, DelayedDepositIntent, DelayedIncreaseLeverageIntent, DelayedIntent, DelayedIntentExtended, DelayedWithdrawCollateralIntent, EncodableCreditAccountOperation, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResponse, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsArgs, GetCreditAccountsOptions, GetExternalAccountCurrentWithdrawalsProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationDetailsPropsBase, GetLiquidationPositionsProps, GetLiquidationPositionsPropsBase, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, GetWithdrawalRequestResultProps, ICreditAccountsService, IRedemptionLoggerContract, IWithdrawalCompressorContract, type IntentPreviewResult, InvalidDelayedIntentError, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LiquidationsService, ListStrategyPositionsProps, LoadRWALiquidatorsProps, MulticallWithFailure, MultichainLiquidationsService, OnchainLiquidationCall, OnchainLiquidationData, OnchainLiquidationOutput, OnchainRequestableWithdrawal, OpenCAProps, PartiallyLiquidateProps, PendingWithdrawal, PeripheryCompressorV310Contract, PreviewDelayedWithdrawalProps, RWALiquidatorInfo, RedemptionLog, RedemptionLoggerV310Contract, RequestableWithdrawal, Rewards, SetBotProps, SetBotResult, WithdrawableAsset, WithdrawalCompressorLocation, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WithdrawalCompressorVersion, WithdrawalOutput, WithdrawalStatus, WithdrawalsState, createRedemptionLogger, createWithdrawalCompressor, decodeDelayedIntent, encodeDelayedIntent, getWithdrawalCompressorAddress, iCreditAccountAbi, primaryInstantOutput, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toWithdrawalStatus };
|
|
@@ -3,7 +3,7 @@ import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "..
|
|
|
3
3
|
import "../../../model/index.js";
|
|
4
4
|
import { SDKConstruct } from "../../base/SDKConstruct.js";
|
|
5
5
|
import "../../base/index.js";
|
|
6
|
-
import { BuildLiquidationTxProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationPositionsProps } from "./types.js";
|
|
6
|
+
import { BuildLiquidationTxProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationPositionsProps, LoadRWALiquidatorsProps } from "./types.js";
|
|
7
7
|
//#region src/sdk/accounts/liquidations/LiquidationsService.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* Service for discovering liquidatable credit accounts and previewing manual
|
|
@@ -40,7 +40,7 @@ declare class LiquidationsService extends SDKConstruct {
|
|
|
40
40
|
* deployed for the markets of the chain and registers them in the SDK
|
|
41
41
|
* contracts register.
|
|
42
42
|
**/
|
|
43
|
-
loadRWALiquidators(): Promise<void>;
|
|
43
|
+
loadRWALiquidators(props?: LoadRWALiquidatorsProps): Promise<void>;
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
export { LiquidationsService };
|