@gearbox-protocol/sdk 14.12.0-next.81 → 14.12.0-next.83
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 +3 -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.schema.js +9 -6
- 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 +12 -0
- package/dist/cjs/new-sdk/utils/index.js +6 -0
- package/dist/cjs/new-sdk/utils/mergeChains.js +76 -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/liquidations/MultichainLiquidationsService.js +38 -14
- 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/opportunities/MultichainOpportunitiesService.js +18 -32
- package/dist/cjs/sdk/opportunities/OpportunitiesService.js +1 -4
- package/dist/cjs/sdk/positions/MultichainPositionsService.js +6 -29
- package/dist/cjs/sdk/positions/PositionsService.js +1 -2
- 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 +3 -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.schema.js +9 -6
- 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 +11 -0
- package/dist/esm/new-sdk/utils/index.js +3 -1
- package/dist/esm/new-sdk/utils/mergeChains.js +73 -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/liquidations/LiquidationsService.js +1 -1
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +38 -14
- 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 +1 -1
- 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/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 +1 -1
- package/dist/esm/sdk/positions/MultichainPositionsService.js +6 -29
- package/dist/esm/sdk/positions/PositionsService.js +1 -2
- 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 +5 -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 +7 -6
- package/dist/types/model/response.schema.d.ts +41 -32
- 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 +20 -40
- package/dist/types/new-sdk/opportunities/index.d.ts +2 -2
- package/dist/types/new-sdk/opportunities/types.d.ts +72 -26
- package/dist/types/new-sdk/positions/PositionsNamespace.d.ts +18 -38
- package/dist/types/new-sdk/positions/index.d.ts +2 -2
- package/dist/types/new-sdk/positions/types.d.ts +68 -24
- package/dist/types/new-sdk/types.d.ts +24 -77
- package/dist/types/new-sdk/utils/filterResponse.d.ts +19 -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 +22 -0
- package/dist/types/new-sdk/utils/types.d.ts +43 -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/index.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 +9 -15
- 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 +5 -5
- package/dist/types/sdk/market/MarketSuite.d.ts +1 -1
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +13 -16
- package/dist/types/sdk/positions/MultichainPositionsService.d.ts +2 -12
- package/dist/types/sdk/types/index.d.ts +2 -2
- package/dist/types/sdk/types/multichain.d.ts +8 -43
- package/package.json +1 -1
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import { ChainNotConfiguredError } from "../core/errors.js";
|
|
2
1
|
//#region src/sdk/base/MultichainConstruct.ts
|
|
3
2
|
/**
|
|
4
3
|
* @internal
|
|
5
4
|
* Base class for services that fan out over the chains of a
|
|
6
5
|
* {@link MultichainSDK}, the cross-chain counterpart of {@link SDKConstruct}.
|
|
7
6
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* reported in {@link MultichainResult.meta}.
|
|
7
|
+
* A fan-out soft-fails: a chain that rejects is logged as a warning and
|
|
8
|
+
* contributes no payload, while the remaining chains still return their rows.
|
|
9
|
+
* A single-chain request throws instead.
|
|
12
10
|
*
|
|
13
11
|
* @typeParam Plugins - Map of attached plugin types.
|
|
14
12
|
**/
|
|
@@ -22,58 +20,99 @@ var MultichainConstruct = class {
|
|
|
22
20
|
* chains that responded successfully.
|
|
23
21
|
**/
|
|
24
22
|
async queryChains(props) {
|
|
25
|
-
const { values,
|
|
23
|
+
const { values, chains } = await this.#settle(props);
|
|
26
24
|
return {
|
|
27
|
-
|
|
28
|
-
meta
|
|
25
|
+
data: values.flat(),
|
|
26
|
+
meta: { chains }
|
|
29
27
|
};
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
30
|
* Fans out a request with no payload, reporting the outcome of every queried
|
|
33
|
-
* chain in
|
|
31
|
+
* chain in `meta.chains`.
|
|
34
32
|
**/
|
|
35
33
|
async runChains(props) {
|
|
36
|
-
const {
|
|
34
|
+
const { chains } = await this.#settle(props);
|
|
37
35
|
return {
|
|
38
|
-
|
|
39
|
-
meta
|
|
36
|
+
data: void 0,
|
|
37
|
+
meta: { chains }
|
|
40
38
|
};
|
|
41
39
|
}
|
|
42
40
|
/**
|
|
43
|
-
* Runs
|
|
44
|
-
*
|
|
41
|
+
* Runs a request against one chain and reports the block it was read at.
|
|
42
|
+
* Throws when the chain is not configured, not attached, or rejects the read.
|
|
45
43
|
**/
|
|
46
|
-
async
|
|
47
|
-
const
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
async queryChain({ network, block = "state", run }) {
|
|
45
|
+
const sdk = this.sdk.chain(network);
|
|
46
|
+
const at = await this.#resolveBlock(sdk, block);
|
|
47
|
+
return {
|
|
48
|
+
data: await run(sdk, at),
|
|
49
|
+
meta: { chains: [succeeded(sdk.chainId, at)] }
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Runs the request on every queried chain in parallel.
|
|
54
|
+
**/
|
|
55
|
+
async #settle({ chainIds, label, block = "state", run }) {
|
|
56
|
+
const wanted = chainIds && new Set(chainIds);
|
|
57
|
+
const requested = [];
|
|
58
|
+
for (const [network, sdk] of this.sdk.chains) if (!wanted || wanted.has(sdk.chainId)) requested.push([network, sdk]);
|
|
59
|
+
const settled = await Promise.allSettled(requested.map(async ([, sdk]) => {
|
|
60
|
+
const at = await this.#resolveBlock(sdk, block);
|
|
61
|
+
return {
|
|
62
|
+
data: await run(sdk, at),
|
|
63
|
+
at
|
|
64
|
+
};
|
|
52
65
|
}));
|
|
53
66
|
const values = [];
|
|
54
|
-
const
|
|
55
|
-
settled.
|
|
56
|
-
const network = requested[i];
|
|
67
|
+
const chains = [];
|
|
68
|
+
for (let i = 0; i < settled.length; i++) {
|
|
69
|
+
const [network, sdk] = requested[i];
|
|
70
|
+
const result = settled[i];
|
|
57
71
|
if (result.status === "fulfilled") {
|
|
58
|
-
values.push(result.value);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
status: "success"
|
|
62
|
-
});
|
|
63
|
-
return;
|
|
72
|
+
values.push(result.value.data);
|
|
73
|
+
chains.push(succeeded(sdk.chainId, result.value.at));
|
|
74
|
+
continue;
|
|
64
75
|
}
|
|
65
|
-
(
|
|
66
|
-
|
|
67
|
-
|
|
76
|
+
(sdk.logger ?? this.sdk.logger)?.warn(result.reason, `failed to ${label} on ${network}`);
|
|
77
|
+
chains.push({
|
|
78
|
+
chainId: sdk.chainId,
|
|
68
79
|
status: "error",
|
|
80
|
+
source: "onchain",
|
|
69
81
|
error: result.reason
|
|
70
82
|
});
|
|
71
|
-
}
|
|
83
|
+
}
|
|
72
84
|
return {
|
|
73
85
|
values,
|
|
74
|
-
|
|
86
|
+
chains
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Block a chain's read is pinned to and reported at.
|
|
91
|
+
**/
|
|
92
|
+
async #resolveBlock(sdk, source) {
|
|
93
|
+
if (source === "state") return {
|
|
94
|
+
blockNumber: sdk.currentBlock,
|
|
95
|
+
timestamp: sdk.timestamp
|
|
96
|
+
};
|
|
97
|
+
if (typeof source === "bigint") return {
|
|
98
|
+
blockNumber: source,
|
|
99
|
+
timestamp: (await sdk.client.getBlock({ blockNumber: source })).timestamp
|
|
100
|
+
};
|
|
101
|
+
const block = await sdk.client.getBlock({ blockTag: "latest" });
|
|
102
|
+
return {
|
|
103
|
+
blockNumber: block.number,
|
|
104
|
+
timestamp: block.timestamp
|
|
75
105
|
};
|
|
76
106
|
}
|
|
77
107
|
};
|
|
108
|
+
function succeeded(chainId, at) {
|
|
109
|
+
return {
|
|
110
|
+
chainId,
|
|
111
|
+
status: "success",
|
|
112
|
+
source: "onchain",
|
|
113
|
+
blockNumber: Number(at.blockNumber),
|
|
114
|
+
timestamp: Number(at.timestamp)
|
|
115
|
+
};
|
|
116
|
+
}
|
|
78
117
|
//#endregion
|
|
79
118
|
export { MultichainConstruct };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
2
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
3
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
4
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
5
3
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
6
4
|
import { getAssetType } from "../chain/chains.js";
|
|
7
5
|
import { formatBN } from "../utils/formatter.js";
|
|
8
6
|
import "../utils/index.js";
|
|
7
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
8
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
9
9
|
//#region src/sdk/base/TokensMeta.ts
|
|
10
10
|
/**
|
|
11
11
|
* Registry of token metadata (symbol, decimals, phantom type) keyed by address.
|
|
@@ -354,6 +354,16 @@ function getNetworkType(chainId) {
|
|
|
354
354
|
return network;
|
|
355
355
|
}
|
|
356
356
|
/**
|
|
357
|
+
* Chain IDs of chains named as {@link NetworkType} labels or as IDs already,
|
|
358
|
+
* e.g. `sdk.opportunities.list({ chainIds: toChainIds(["Mainnet"]) })`.
|
|
359
|
+
*
|
|
360
|
+
* @param scope - Chains as labels, or already as IDs.
|
|
361
|
+
* @throws If any entry is not a supported network.
|
|
362
|
+
**/
|
|
363
|
+
function toChainIds(scope) {
|
|
364
|
+
return scope.map((entry) => getChain(entry).id);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
357
367
|
* Type guard that checks whether a chain ID belongs to a supported Gearbox network.
|
|
358
368
|
*
|
|
359
369
|
* @param chainId - Numeric chain ID, or `undefined`.
|
|
@@ -451,4 +461,4 @@ function isSunsetStrategy(creditManager, collateral, network) {
|
|
|
451
461
|
return !!chains[network].sunsetStrategies?.some((s) => isAddressEqual(s.creditManager, creditManager) && isAddressEqual(s.collateral, collateral));
|
|
452
462
|
}
|
|
453
463
|
//#endregion
|
|
454
|
-
export { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork };
|
|
464
|
+
export { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork } from "./chains.js";
|
|
1
|
+
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds } from "./chains.js";
|
|
2
2
|
import { detectNetwork } from "./detectNetwork.js";
|
|
3
|
-
export { NetworkType, SUPPORTED_NETWORKS, chains, detectNetwork, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork };
|
|
3
|
+
export { NetworkType, SUPPORTED_NETWORKS, chains, detectNetwork, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
2
1
|
import { AP_MARKET_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR } from "../constants/address-provider.js";
|
|
3
2
|
import { isV310 } from "../constants/versions.js";
|
|
4
3
|
import "../constants/index.js";
|
|
5
4
|
import { hexEq } from "../utils/hex.js";
|
|
5
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
6
6
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
7
7
|
//#region src/sdk/core/createAddressProvider.ts
|
|
8
8
|
const OVERRIDE_ADDRESSES = { Mainnet: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
|
|
2
1
|
import { AddressProviderV310Contract } from "./AddressProviderV310Contract.js";
|
|
3
2
|
import { createAddressProvider, hydrateAddressProvider } from "./createAddressProvider.js";
|
|
3
|
+
import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./errors.js";
|
|
4
4
|
import "./types.js";
|
|
5
5
|
export { AddressProviderV310Contract, ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, createAddressProvider, hydrateAddressProvider };
|
package/dist/esm/sdk/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { bytes32ToString } from "./utils/bytes32ToString.js";
|
|
|
8
8
|
import { childLogger } from "./utils/childLogger.js";
|
|
9
9
|
import { createRawTx } from "./utils/createRawTx.js";
|
|
10
10
|
import { TypedObjectUtils } from "./utils/mappers.js";
|
|
11
|
-
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork } from "./chain/chains.js";
|
|
11
|
+
import { NetworkType, SUPPORTED_NETWORKS, chains, findCuratorMarketConfigurator, getAssetType, getChain, getCuratorName, getNetworkType, isPublicNetwork, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, toChainIds } from "./chain/chains.js";
|
|
12
12
|
import { detectNetwork } from "./chain/detectNetwork.js";
|
|
13
13
|
import "./chain/index.js";
|
|
14
14
|
import { etherscanApiUrl, etherscanUrl } from "./utils/etherscan.js";
|
|
@@ -35,7 +35,6 @@ import { ChainContractsRegister } from "./base/ChainContractsRegister.js";
|
|
|
35
35
|
import { Construct } from "./base/Construct.js";
|
|
36
36
|
import { BaseContract, ContractParseError } from "./base/BaseContract.js";
|
|
37
37
|
import { MissingSerializedParamsError } from "./base/errors.js";
|
|
38
|
-
import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
|
|
39
38
|
import { MultichainConstruct } from "./base/MultichainConstruct.js";
|
|
40
39
|
import { PlaceholderContract } from "./base/PlaceholderContract.js";
|
|
41
40
|
import { SDKConstruct } from "./base/SDKConstruct.js";
|
|
@@ -128,6 +127,7 @@ import { createWithdrawalCompressor } from "./accounts/withdrawal-compressor/cre
|
|
|
128
127
|
import "./accounts/index.js";
|
|
129
128
|
import { AddressProviderV310Contract } from "./core/AddressProviderV310Contract.js";
|
|
130
129
|
import { createAddressProvider, hydrateAddressProvider } from "./core/createAddressProvider.js";
|
|
130
|
+
import { ChainNotConfiguredError, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError } from "./core/errors.js";
|
|
131
131
|
import "./core/index.js";
|
|
132
132
|
import { MultichainOpportunitiesService } from "./opportunities/MultichainOpportunitiesService.js";
|
|
133
133
|
import { OpportunitiesService } from "./opportunities/OpportunitiesService.js";
|
|
@@ -148,4 +148,4 @@ import { OnchainSDK, STATE_VERSION } from "./OnchainSDK.js";
|
|
|
148
148
|
import { MultichainSDK } from "./MultichainSDK.js";
|
|
149
149
|
import { attachOptionsSchema, onchainSDKOptionsSchema } from "./options.js";
|
|
150
150
|
import "./types/index.js";
|
|
151
|
-
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, SimulationError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, expectedBalanceDeltas, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
|
|
151
|
+
export { ADDRESS_0X0, ADDRESS_PROVIDER_V310, AP_ACCOUNT_FACTORY, AP_ACL, AP_BOT_LIST, AP_BYTECODE_REPOSITORY, AP_CONTRACTS_REGISTER, AP_CONTROLLER_TIMELOCK, AP_CREDIT_ACCOUNT_COMPRESSOR, AP_CREDIT_SUITE_COMPRESSOR, AP_DATA_COMPRESSOR, AP_DELEVERAGE_BOT_HV, AP_DELEVERAGE_BOT_LV, AP_DELEVERAGE_BOT_PEGGED, AP_GAUGE_COMPRESSOR, AP_GEAR_STAKING, AP_GEAR_TOKEN, AP_INFLATION_ATTACK_BLOCKER, AP_INSOLVENCY_CHECKER, AP_MARKET_COMPRESSOR, AP_MARKET_CONFIGURATOR, AP_PARTIAL_LIQUIDATION_BOT, AP_PERIPHERY_COMPRESSOR, AP_PRICE_FEED_COMPRESSOR, AP_PRICE_FEED_STORE, AP_PRICE_ORACLE, AP_REDEMPTION_LOGGER, AP_REWARDS_COMPRESSOR, AP_ROUTER, AP_RWA_COMPRESSOR, AP_TOKEN_COMPRESSOR, AP_TREASURY, AP_WETH_GATEWAY, AP_WETH_TOKEN, AP_ZAPPER_REGISTER, AP_ZERO_PRICE_FEED, AbstractLPPriceFeedContract, AbstractPriceFeedContract, AbstractWithdrawalCompressorContract, AccountBotsService, AddressMap, AddressProviderV310Contract, AddressSet, AssetsMap, BLOCKS_PER_WEEK_BY_NETWORK, BalancerStablePriceFeedContract, BalancerWeightedPriceFeedContract, BaseContract, BasePlugin, BigIntMath, BotPermissions, BoundedPriceFeedContract, ChainContractsRegister, ChainNotConfiguredError, CompositePriceFeedContract, Construct, ContractParseError, CreditAccountCompressor, CreditAccountCompressorV310Contract, CreditAccountOperationsService, CreditAccountsServiceV310, CreditConfiguratorV310Contract, CreditFacadeV310BaseContract, CreditFacadeV310Contract, CreditManagerV310Contract, CreditSuite, CurveCryptoPriceFeedContract, CurveStablePriceFeedContract, CurveUSDPriceFeedContract, DELAYED_INTENT_TYPES, DELAYED_INTENT_VERSION, DUST_THRESHOLD, Erc4626PriceFeedContract, ExternalPriceFeedContract, GaugeContract, IERC20ZapperContract, IETHZapperContract, InvalidDelayedIntentError, LEVERAGE_DECIMALS, LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS, LinearInterestRateModelContract, LiquidationsService, MAX_INT, MAX_UINT16, MAX_UINT256, MIN_INT96, MULTICALL_ADDRESS, MarketRegister, MarketSuite, MellowLRTPriceFeedContract, MidasLiquidatorContract, MissingSerializedParamsError, MultichainConstruct, MultichainLiquidationsService, MultichainOpportunitiesService, MultichainPositionsService, MultichainSDK, NATIVE_ADDRESS, NOT_DEPLOYED, NO_VERSION, NetworkType, OnchainSDK, OpportunitiesService, PARTIAL_LIQUIDATION_BUFFER_BPS, PERCENTAGE_DECIMALS, PERCENTAGE_FACTOR, PERCENTAGE_FACTOR_1KK, PERIPHERY_CONTRACTS, PHANTOM_TOKEN_CONTRACT_TYPES, PHANTOM_TOKEN_MIDAS_REDEMPTION, PHANTOM_TOKEN_SECURITIZE_REDEMPTION, PRICE_DECIMALS, PRICE_DECIMALS_POW, PartialPriceFeedInitError, PendleTWAPPTPriceFeed, PeripheryCompressorV310Contract, PlaceholderAdapterContract, PlaceholderContract, PluginStateVersionError, PoolService, PoolSuite, PoolV310Contract, PositionsService, PriceFeedRef, PriceFeedRegister, PriceOracleV310Contract, PythPriceFeed, RAMP_DURATION_BY_NETWORK, RAY, RAY_DECIMALS_POW, RWARegistry, RWA_FACTORY_SECURITIZE, RWA_FACTORY_TYPES, RWA_LIQUIDATOR_MIDAS, RWA_LIQUIDATOR_SECURITIZE, RWA_ON_DEMAND_LP_MONOPOLIZED, RWA_UNDERLYING_DEFAULT, RWA_UNDERLYING_ON_DEMAND, RedemptionLoggerV310Contract, RedstonePriceFeedContract, RouterV310Contract, SDKConstruct, SECONDS_PER_YEAR, SECURITIZE_REGISTER_VAULT_TYPES, SLIPPAGE_DECIMALS, STATE_VERSION, SUPPORTED_NETWORKS, SdkAlreadyAttachedError, SdkChainMismatchError, SdkMissingChainStateError, SdkNotAttachedError, SdkStateVersionMismatchError, SdkSyncFailedError, SecuritizeLiquidatorContract, SecuritizeRWAFactory, SimulateWithPriceUpdatesError, SimulationError, TokensMeta, TypedObjectUtils, UnsupportedZapperFunctionError, VERSION_RANGE_310, VotingContractStatus, WAD, WAD_DECIMALS_POW, WithdrawalCompressorV310Contract, WithdrawalCompressorV311Contract, WithdrawalCompressorV313Contract, WstETHPriceFeedContract, YearnPriceFeedContract, ZapperContract, ZeroPriceFeedContract, ZodAddress, ZodBigInt, ZodHex, additionalBorrowApyBps, assetsMap, attachOptionsSchema, borrowApyBps, botPermissionsToString, bytes32ToString, chains, childLogger, createAdapter, createAddressProvider, createPriceOracle, createRawTx, createRedemptionLogger, createRouter, createWithdrawalCompressor, createZapper, abi as creditFacadeV310Abi, decodeDelayedIntent, detectNetwork, dominantCollateral, encodeDelayedIntent, estimateRawTxGas, etherscanApiUrl, etherscanUrl, executeDelegatedMulticalls, expectedBalanceDeltas, fetchPythPayloads, fetchRedstonePayloads, filterDust, filterDustUSD, findCuratorMarketConfigurator, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, generateCastTraceCall, getAssetType, getCastTraceArgs, getChain, getCuratorName, getFunctionSignature, getNetworkType, getRawPriceUpdates, getSimulateWithPriceUpdatesError, getWithdrawalCompressorAddress, halfRAY, healthFactorBps, hexEq, hydrateAddressProvider, iCreditAccountAbi, isDust, isLPPriceFeed, isPublicNetwork, isRWAFactory, isRWAToken, isSunsetPool, isSunsetStrategy, isSupportedNetwork, isUpdatablePriceFeed, isV310, isVersionRange, json_parse, json_stringify, maxLeverage, minSeizedAmount, mustGetDominantCollateral, numberWithCommas, onchainSDKOptionsSchema, optimalHFForPartialLiquidation, optimalRepaidAmount, percentFmt, positionLeverage, primaryInstantOutput, rayToBps, rayToNumber, retry, sendRawTx, shortAddress, shortHash, simulateCall, simulateMulticall, simulateWithPriceUpdates, toAddress, toBN, toBigInt, toChainIds, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal, toSignificant, toWithdrawalStatus, usdToNumber, utilizationBps, watchBlocksAsync };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iCreditFacadeMulticallV310Abi, iCreditFacadeV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
4
3
|
import "../../base/index.js";
|
|
4
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
5
5
|
//#region src/sdk/market/credit/CreditFacadeV310BaseContract.ts
|
|
6
6
|
const abi = [
|
|
7
7
|
...iCreditFacadeV310Abi,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
4
3
|
import { RAY } from "../../constants/math.js";
|
|
@@ -7,6 +6,7 @@ import { formatBN, formatBNvalue, percentFmt } from "../../utils/formatter.js";
|
|
|
7
6
|
import "../../utils/index.js";
|
|
8
7
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
9
8
|
import "../../base/index.js";
|
|
9
|
+
import { iPausableAbi } from "../../../abi/iPausable.js";
|
|
10
10
|
import { utilizationBps } from "../math.js";
|
|
11
11
|
//#region src/sdk/market/pool/PoolV310Contract.ts
|
|
12
12
|
const abi = [...iPoolV310Abi, ...iPausableAbi];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
2
1
|
import { ZapperContract } from "./ZapperContract.js";
|
|
2
|
+
import { iethZapperAbi } from "../../../abi/iETHZapper.js";
|
|
3
3
|
//#region src/sdk/market/zapper/IETHZapperContract.ts
|
|
4
4
|
const abi = iethZapperAbi;
|
|
5
5
|
var IETHZapperContract = class extends ZapperContract {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
3
|
+
import { iZapperAbi } from "../../../abi/iZapper.js";
|
|
4
4
|
import { UnsupportedZapperFunctionError } from "./errors.js";
|
|
5
5
|
//#region src/sdk/market/zapper/ZapperContract.ts
|
|
6
6
|
/**
|
|
@@ -1,61 +1,47 @@
|
|
|
1
|
-
import { getNetworkType } from "../chain/chains.js";
|
|
2
1
|
import { MultichainConstruct } from "../base/MultichainConstruct.js";
|
|
3
2
|
import "../base/index.js";
|
|
4
|
-
import { isFilterSet } from "../../model/filters.js";
|
|
5
|
-
import "../../model/index.js";
|
|
6
3
|
//#region src/sdk/opportunities/MultichainOpportunitiesService.ts
|
|
7
4
|
/**
|
|
8
|
-
* Cross-chain counterpart of {@link OpportunitiesService}.
|
|
9
|
-
*
|
|
10
|
-
* Fans out over every chain configured in {@link MultichainSDK}. A chain that
|
|
11
|
-
* fails is logged and skipped so one dead RPC does not empty the list; its
|
|
12
|
-
* failure is reported in {@link MultichainResult.meta}.
|
|
13
|
-
*
|
|
14
|
-
* Detail reads need no fan-out: an opportunity key names its chain.
|
|
5
|
+
* Cross-chain counterpart of {@link OpportunitiesService}. Every read walks
|
|
6
|
+
* loaded market state, so the block it reports is the SDK's snapshot.
|
|
15
7
|
*
|
|
16
8
|
* @typeParam Plugins - Map of attached plugin types.
|
|
17
9
|
**/
|
|
18
10
|
var MultichainOpportunitiesService = class extends MultichainConstruct {
|
|
19
11
|
/**
|
|
20
12
|
* Opportunities of all queried chains, see {@link OpportunitiesService.list}.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* would be discarded are never queried and never appear in the meta.
|
|
13
|
+
* A filter that names chains narrows the fan-out itself, so a chain whose
|
|
14
|
+
* rows would be discarded is never queried and never appears in the meta.
|
|
24
15
|
**/
|
|
25
16
|
async list(filter) {
|
|
26
17
|
return this.queryChains({
|
|
27
|
-
|
|
18
|
+
chainIds: filter?.chainIds,
|
|
28
19
|
label: "list opportunities",
|
|
29
20
|
run: (sdk) => sdk.opportunities.list(filter)
|
|
30
21
|
});
|
|
31
22
|
}
|
|
32
23
|
/**
|
|
33
24
|
* {@inheritDoc OpportunitiesService.getPool}
|
|
25
|
+
*
|
|
26
|
+
* The key names its chain, so there is no fan-out. Throws when that chain
|
|
27
|
+
* cannot answer.
|
|
34
28
|
**/
|
|
35
29
|
async getPool(key) {
|
|
36
|
-
return this.
|
|
30
|
+
return this.queryChain({
|
|
31
|
+
network: key.chainId,
|
|
32
|
+
run: (sdk) => sdk.opportunities.getPool(key)
|
|
33
|
+
});
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
36
|
* {@inheritDoc OpportunitiesService.getStrategy}
|
|
37
|
+
*
|
|
38
|
+
* See {@link MultichainOpportunitiesService.getPool}.
|
|
40
39
|
**/
|
|
41
40
|
async getStrategy(key) {
|
|
42
|
-
return this.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
* the SDK does not support are dropped here rather than reported as failures:
|
|
47
|
-
* a filter naming them is a narrowing, not a request.
|
|
48
|
-
**/
|
|
49
|
-
#networksOf(filter) {
|
|
50
|
-
const chainIds = filter?.chainIds;
|
|
51
|
-
if (!isFilterSet(chainIds)) return;
|
|
52
|
-
const networks = [];
|
|
53
|
-
for (const chainId of chainIds) try {
|
|
54
|
-
networks.push(getNetworkType(chainId));
|
|
55
|
-
} catch {
|
|
56
|
-
this.sdk.logger?.debug(`ignoring unsupported chain ${chainId} in opportunities filter`);
|
|
57
|
-
}
|
|
58
|
-
return networks;
|
|
41
|
+
return this.queryChain({
|
|
42
|
+
network: key.chainId,
|
|
43
|
+
run: (sdk) => sdk.opportunities.getStrategy(key)
|
|
44
|
+
});
|
|
59
45
|
}
|
|
60
46
|
};
|
|
61
47
|
//#endregion
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
2
2
|
import "../base/index.js";
|
|
3
|
-
import { isFilterSet } from "../../model/filters.js";
|
|
4
|
-
import "../../model/index.js";
|
|
5
3
|
//#region src/sdk/opportunities/OpportunitiesService.ts
|
|
6
4
|
/**
|
|
7
5
|
* Builds the `opportunities` read model from the chain.
|
|
@@ -23,8 +21,7 @@ var OpportunitiesService = class extends SDKConstruct {
|
|
|
23
21
|
* @param filter - Optional narrowing, applied to the built rows.
|
|
24
22
|
**/
|
|
25
23
|
async list(filter) {
|
|
26
|
-
|
|
27
|
-
if (isFilterSet(chainIds) && !chainIds.includes(this.chainId)) return [];
|
|
24
|
+
if (filter?.chainIds && !filter.chainIds.includes(this.chainId)) return [];
|
|
28
25
|
return this.sdk.marketRegister.markets.flatMap((market) => market.opportunities(filter));
|
|
29
26
|
}
|
|
30
27
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
2
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
3
3
|
import "../constants/addresses.js";
|
|
4
4
|
import { RAY } from "../constants/math.js";
|
|
5
5
|
import "../constants/index.js";
|
|
@@ -1,50 +1,27 @@
|
|
|
1
|
-
import { getNetworkType } from "../chain/chains.js";
|
|
2
1
|
import { MultichainConstruct } from "../base/MultichainConstruct.js";
|
|
3
2
|
import "../base/index.js";
|
|
4
|
-
import { isFilterSet } from "../../model/filters.js";
|
|
5
|
-
import "../../model/index.js";
|
|
6
3
|
//#region src/sdk/positions/MultichainPositionsService.ts
|
|
7
4
|
/**
|
|
8
5
|
* Cross-chain counterpart of {@link PositionsService}.
|
|
9
6
|
*
|
|
10
|
-
* Fans out over every chain configured in {@link MultichainSDK}. A chain that
|
|
11
|
-
* fails is logged and skipped so one dead RPC does not hide the positions a
|
|
12
|
-
* wallet holds elsewhere; its failure is reported in
|
|
13
|
-
* {@link MultichainResult.meta}.
|
|
14
|
-
*
|
|
15
7
|
* @typeParam Plugins - Map of attached plugin types.
|
|
16
8
|
**/
|
|
17
9
|
var MultichainPositionsService = class extends MultichainConstruct {
|
|
18
10
|
/**
|
|
19
11
|
* Positions of a wallet on all queried chains, see
|
|
20
12
|
* {@link PositionsService.list}.
|
|
21
|
-
*
|
|
22
|
-
* A filter that names chains narrows the fan-out itself, so chains whose rows
|
|
23
|
-
* would be discarded are never queried and never appear in the meta.
|
|
24
13
|
**/
|
|
25
14
|
async list(props) {
|
|
26
15
|
return this.queryChains({
|
|
27
|
-
|
|
16
|
+
chainIds: props.filter?.chainIds,
|
|
28
17
|
label: "list positions",
|
|
29
|
-
|
|
18
|
+
block: "latest",
|
|
19
|
+
run: (sdk, block) => sdk.positions.list({
|
|
20
|
+
...props,
|
|
21
|
+
blockNumber: block.blockNumber
|
|
22
|
+
})
|
|
30
23
|
});
|
|
31
24
|
}
|
|
32
|
-
/**
|
|
33
|
-
* Chains named by the filter, or `undefined` to query all of them. Chain ids
|
|
34
|
-
* the SDK does not support are dropped here rather than reported as failures:
|
|
35
|
-
* a filter naming them is a narrowing, not a request.
|
|
36
|
-
**/
|
|
37
|
-
#networksOf(filter) {
|
|
38
|
-
const chainIds = filter?.chainIds;
|
|
39
|
-
if (!isFilterSet(chainIds)) return;
|
|
40
|
-
const networks = [];
|
|
41
|
-
for (const chainId of chainIds) try {
|
|
42
|
-
networks.push(getNetworkType(chainId));
|
|
43
|
-
} catch {
|
|
44
|
-
this.sdk.logger?.debug(`ignoring unsupported chain ${chainId} in positions filter`);
|
|
45
|
-
}
|
|
46
|
-
return networks;
|
|
47
|
-
}
|
|
48
25
|
};
|
|
49
26
|
//#endregion
|
|
50
27
|
export { MultichainPositionsService };
|
|
@@ -18,8 +18,7 @@ var PositionsService = class extends SDKConstruct {
|
|
|
18
18
|
**/
|
|
19
19
|
async list(props) {
|
|
20
20
|
const { wallet, filter, blockNumber } = props;
|
|
21
|
-
|
|
22
|
-
if (isFilterSet(chainIds) && !chainIds.includes(this.chainId)) return [];
|
|
21
|
+
if (filter?.chainIds && !filter.chainIds.includes(this.chainId)) return [];
|
|
23
22
|
const wantedKind = filter?.kind;
|
|
24
23
|
const wanted = (kind) => !isFilterSet(wantedKind) || wantedKind === kind;
|
|
25
24
|
const isZeroDebt = filter?.isZeroDebt;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { errorAbis } from "../../../abi/errors.js";
|
|
2
|
-
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
3
2
|
import { generateCastTraceCall } from "./cast.js";
|
|
3
|
+
import { iUpdatablePriceFeedAbi } from "../../../abi/iUpdatablePriceFeed.js";
|
|
4
4
|
import { simulateMulticall } from "./simulateMulticall.js";
|
|
5
5
|
import { BaseError, CallExecutionError, ContractFunctionRevertedError, decodeFunctionData, decodeFunctionResult, encodeFunctionData, parseAbi } from "viem";
|
|
6
6
|
import { getAction, parseAccount } from "viem/utils";
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { ChainId } from "./primitives.js";
|
|
1
2
|
//#region src/model/filters.d.ts
|
|
2
3
|
/**
|
|
3
|
-
* The
|
|
4
|
-
* says "do not narrow", and how a predicate asks whether it narrows at all.
|
|
4
|
+
* The part of a filter that scopes it to chains, which every list filter has.
|
|
5
5
|
**/
|
|
6
|
+
interface ChainScopedFilter {
|
|
7
|
+
/**
|
|
8
|
+
* Keep only entities from these chains.
|
|
9
|
+
**/
|
|
10
|
+
chainIds?: ChainId[];
|
|
11
|
+
}
|
|
6
12
|
/**
|
|
7
13
|
* Sentinel a filter condition can be set to instead of being omitted.
|
|
8
14
|
**/
|
|
@@ -27,4 +33,4 @@ type Filterable<T> = T | FilterAll;
|
|
|
27
33
|
**/
|
|
28
34
|
declare function isFilterSet<T>(condition: Filterable<T> | undefined): condition is T;
|
|
29
35
|
//#endregion
|
|
30
|
-
export { FILTER_ALL, FilterAll, Filterable, isFilterSet };
|
|
36
|
+
export { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Filterable } from "./filters.js";
|
|
1
2
|
import { z } from "zod/v4";
|
|
2
3
|
//#region src/model/filters.schema.d.ts
|
|
3
4
|
/**
|
|
@@ -16,5 +17,10 @@ declare const booleanParamSchema: z.ZodEnum<{
|
|
|
16
17
|
false: "false";
|
|
17
18
|
true: "true";
|
|
18
19
|
}>;
|
|
20
|
+
/**
|
|
21
|
+
* A boolean condition as a URL can carry it: a condition that does not narrow
|
|
22
|
+
* is absent rather than spelled out, see {@link booleanParamSchema}.
|
|
23
|
+
**/
|
|
24
|
+
declare function encodeFlag(condition: Filterable<boolean> | undefined): "true" | "false" | undefined;
|
|
19
25
|
//#endregion
|
|
20
|
-
export { booleanParamSchema, filterAllSchema, filterable };
|
|
26
|
+
export { booleanParamSchema, encodeFlag, filterAllSchema, filterable };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Curator, CuratorName } from "./curators.js";
|
|
2
1
|
import { Amount, AssetType, Bps, ChainId, Leverage, Timestamp, Token, TokenAmount, TxCall } from "./primitives.js";
|
|
2
|
+
import { Curator, CuratorName } from "./curators.js";
|
|
3
3
|
import { curatorNameSchema, curatorSchema } from "./curators.schema.js";
|
|
4
|
-
import { FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
5
|
-
import { booleanParamSchema, filterAllSchema, filterable } from "./filters.schema.js";
|
|
4
|
+
import { ChainScopedFilter, FILTER_ALL, FilterAll, Filterable, isFilterSet } from "./filters.js";
|
|
5
|
+
import { booleanParamSchema, encodeFlag, filterAllSchema, filterable } from "./filters.schema.js";
|
|
6
6
|
import { ApyBreakdown, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityId, OpportunityKey, OpportunityKind, PointRewards, PointsProgram, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, Rewards, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, TokenRewards, matchesOpportunityFilter, opportunityId, poolOpportunityId, strategyOpportunityId } from "./opportunities.js";
|
|
7
7
|
import { DelayedReceivedAsset, InstantReceivedAsset, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, ReceivedAsset, matchesLiquidatableAccountFilter } from "./liquidations.js";
|
|
8
8
|
import { PnlBreakdown, PointsProgramPnL, PointsRewardsPnL, PoolPosition, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionId, PositionKey, PositionKind, RewardsPnL, StrategyPosition, StrategyPositionKey, StrategyPositionRef, TokenRewardsPnL, liquidationPositionId, matchesPositionFilter, poolPositionId, positionId, strategyPositionId } from "./positions.js";
|
|
@@ -10,8 +10,8 @@ import { HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, Histor
|
|
|
10
10
|
import { historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, opportunityHistoryQuerySchema, poolHistoryMetricSchema, poolPositionHistoryMetricSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, strategyHistoryMetricSchema, strategyPositionHistoryMetricSchema } from "./history.schema.js";
|
|
11
11
|
import { delayedReceivedAssetSchema, instantReceivedAssetSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionSchema, receivedAssetSchema } from "./liquidations.schema.js";
|
|
12
12
|
import { apyBreakdownSchema, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pointRewardsSchema, pointsProgramSchema, poolOpportunityDetailSchema, poolOpportunityKeySchema, poolOpportunitySchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, rewardsSchema, strategyOpportunityDetailSchema, strategyOpportunityKeySchema, strategyOpportunitySchema, tokenRewardsSchema } from "./opportunities.schema.js";
|
|
13
|
-
import { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
13
|
+
import { pnlBreakdownSchema, pointsProgramPnLSchema, pointsRewardsPnLSchema, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionKeySchema, positionKindSchema, positionSchema, rewardsPnLSchema, strategyPositionKeySchema, strategyPositionSchema, tokenRewardsPnLSchema } from "./positions.schema.js";
|
|
14
14
|
import { amountSchema, assetTypeSchema, bpsSchema, chainIdSchema, leverageSchema, timestampSchema, tokenAmountSchema, tokenSchema, txCallSchema } from "./primitives.schema.js";
|
|
15
15
|
import { ChainFailed, ChainMetadata, ChainScoped, ChainSucceeded, DataResponse, DataSource, ResponseMetadata } from "./response.js";
|
|
16
16
|
import { chainFailedSchema, chainMetadataSchema, chainSucceededSchema, dataSourceSchema, responseMetadataSchema, responseSchema } from "./response.schema.js";
|
|
17
|
-
export { Amount, ApyBreakdown, AssetType, Bps, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainSucceeded, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable, HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, HistorySeries, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityHistoryQuery, OpportunityId, OpportunityKey, OpportunityKind, POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolHistoryMetric, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionHistoryMetric, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionHistoryMetric, PositionHistoryQuery, PositionId, PositionKey, PositionKind, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, StrategyHistoryMetric, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionHistoryMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenRewards, TokenRewardsPnL, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, booleanParamSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, filterAllSchema, filterable, historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityHistoryQuerySchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolHistoryMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionHistoryMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyHistoryMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionHistoryMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
|
|
17
|
+
export { Amount, ApyBreakdown, AssetType, Bps, ChainFailed, ChainId, ChainMetadata, ChainScoped, ChainScopedFilter, ChainSucceeded, Curator, CuratorName, DataResponse, DataSource, DelayedReceivedAsset, FILTER_ALL, FilterAll, Filterable, HistoryChartMetadata, HistoryMetric, HistoryPoint, HistoryRange, HistorySeries, InstantReceivedAsset, Leverage, LiquidatableAccount, LiquidatableAccountFilter, LiquidationApproval, LiquidationDetails, LiquidationPosition, Opportunity, OpportunityBase, OpportunityDetail, OpportunityFilter, OpportunityHistoryQuery, OpportunityId, OpportunityKey, OpportunityKind, POOL_HISTORY_METRICS, POOL_POSITION_HISTORY_METRICS, PnlBreakdown, PointRewards, PointsProgram, PointsProgramPnL, PointsRewardsPnL, PoolHistoryMetric, PoolOpportunity, PoolOpportunityDetail, PoolOpportunityKey, PoolOpportunityRef, PoolPosition, PoolPositionHistoryMetric, PoolPositionKey, PoolPositionRef, Position, PositionCollateral, PositionFilter, PositionHistoryMetric, PositionHistoryQuery, PositionId, PositionKey, PositionKind, PriceFeedData, PriceFeedSummary, QuotaAsset, RateCurve, RateCurvePoint, ReceivedAsset, ResponseMetadata, Rewards, RewardsPnL, STRATEGY_HISTORY_METRICS, STRATEGY_POSITION_HISTORY_METRICS, StrategyHistoryMetric, StrategyOpportunity, StrategyOpportunityDetail, StrategyOpportunityKey, StrategyOpportunityRef, StrategyPosition, StrategyPositionHistoryMetric, StrategyPositionKey, StrategyPositionRef, Timestamp, Token, TokenAmount, TokenRewards, TokenRewardsPnL, TxCall, amountSchema, apyBreakdownSchema, assetTypeSchema, booleanParamSchema, bpsSchema, chainFailedSchema, chainIdSchema, chainMetadataSchema, chainSucceededSchema, curatorNameSchema, curatorSchema, dataSourceSchema, delayedReceivedAssetSchema, encodeFlag, filterAllSchema, filterable, historyChartMetadataSchema, historyMetricSchema, historyPointSchema, historyRangeSchema, historySeriesSchema, instantReceivedAssetSchema, isFilterSet, leverageSchema, liquidatableAccountFilterSchema, liquidatableAccountSchema, liquidationApprovalSchema, liquidationDetailsSchema, liquidationPositionId, liquidationPositionSchema, matchesLiquidatableAccountFilter, matchesOpportunityFilter, matchesPositionFilter, opportunityBaseSchema, opportunityDetailSchema, opportunityFilterQueryParamsSchema, opportunityFilterQuerySchema, opportunityFilterSchema, opportunityHistoryQuerySchema, opportunityId, opportunityKeySchema, opportunityKindSchema, opportunitySchema, pnlBreakdownSchema, pointRewardsSchema, pointsProgramPnLSchema, pointsProgramSchema, pointsRewardsPnLSchema, poolHistoryMetricSchema, poolOpportunityDetailSchema, poolOpportunityId, poolOpportunityKeySchema, poolOpportunitySchema, poolPositionHistoryMetricSchema, poolPositionId, poolPositionKeySchema, poolPositionSchema, positionCollateralSchema, positionFilterQueryParamsSchema, positionFilterQuerySchema, positionFilterSchema, positionHistoryMetricSchema, positionHistoryQuerySchema, positionId, positionKeySchema, positionKindSchema, positionSchema, priceFeedDataSchema, priceFeedSummarySchema, quotaAssetSchema, rateCurvePointSchema, rateCurveSchema, receivedAssetSchema, responseMetadataSchema, responseSchema, rewardsPnLSchema, rewardsSchema, strategyHistoryMetricSchema, strategyOpportunityDetailSchema, strategyOpportunityId, strategyOpportunityKeySchema, strategyOpportunitySchema, strategyPositionHistoryMetricSchema, strategyPositionId, strategyPositionKeySchema, strategyPositionSchema, timestampSchema, tokenAmountSchema, tokenRewardsPnLSchema, tokenRewardsSchema, tokenSchema, txCallSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AssetType, ChainId, Timestamp, Token, TokenAmount, TxCall } from "./primitives.js";
|
|
2
|
-
import { Filterable } from "./filters.js";
|
|
2
|
+
import { ChainScopedFilter, Filterable } from "./filters.js";
|
|
3
3
|
import { Address } from "viem";
|
|
4
4
|
//#region src/model/liquidations.d.ts
|
|
5
5
|
/**
|
|
@@ -10,11 +10,7 @@ import { Address } from "viem";
|
|
|
10
10
|
* `"all"` to say the same thing explicitly, which is what a UI whose state has
|
|
11
11
|
* an "any" option holds, see {@link Filterable}. Conditions combine with AND.
|
|
12
12
|
**/
|
|
13
|
-
interface LiquidatableAccountFilter {
|
|
14
|
-
/**
|
|
15
|
-
* Keep only accounts on these chains.
|
|
16
|
-
**/
|
|
17
|
-
chainIds?: Filterable<ChainId[]>;
|
|
13
|
+
interface LiquidatableAccountFilter extends ChainScopedFilter {
|
|
18
14
|
/**
|
|
19
15
|
* Keep only accounts whose underlying — the token of
|
|
20
16
|
* {@link LiquidatableAccount.totalValue} — is of this class.
|
|
@@ -8,7 +8,7 @@ import { z } from "zod/v4";
|
|
|
8
8
|
* {@link LiquidatableAccountFilter}
|
|
9
9
|
**/
|
|
10
10
|
declare const liquidatableAccountFilterSchema: z.ZodObject<{
|
|
11
|
-
chainIds: z.ZodOptional<z.
|
|
11
|
+
chainIds: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
12
12
|
underlyingType: z.ZodOptional<z.ZodUnion<[z.ZodUnion<readonly [z.ZodLiteral<"Stable">, z.ZodLiteral<"ETH">, z.ZodLiteral<"BTC">]>, z.ZodLiteral<"all">]>>;
|
|
13
13
|
paused: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
|
|
14
14
|
rwa: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodLiteral<"all">]>>;
|