@gearbox-protocol/sdk 15.1.0-next.15 → 15.1.0-next.16
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/new-sdk/GearboxSDK.js +9 -0
- package/dist/cjs/new-sdk/index.js +3 -0
- package/dist/cjs/new-sdk/liquidations/LiquidationsNamespace.js +45 -0
- package/dist/cjs/new-sdk/liquidations/index.js +4 -0
- package/dist/cjs/new-sdk/liquidations/types.js +1 -0
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/new-sdk/GearboxSDK.js +9 -0
- package/dist/esm/new-sdk/index.js +3 -1
- package/dist/esm/new-sdk/liquidations/LiquidationsNamespace.js +44 -0
- package/dist/esm/new-sdk/liquidations/index.js +3 -0
- package/dist/esm/new-sdk/liquidations/types.js +1 -0
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.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/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/TokensMeta.js +3 -3
- package/dist/esm/sdk/chain/detectNetwork.js +1 -1
- package/dist/esm/sdk/core/createAddressProvider.js +1 -1
- package/dist/esm/sdk/market/adapters/contracts/AccountMigratorAdapterContract.js +1 -1
- package/dist/esm/sdk/market/adapters/contracts/ERC4626AdapterContract.js +1 -1
- 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/pools/PoolService.js +1 -1
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/types/new-sdk/GearboxSDK.d.ts +8 -0
- package/dist/types/new-sdk/index.d.ts +4 -1
- package/dist/types/new-sdk/liquidations/LiquidationsNamespace.d.ts +35 -0
- package/dist/types/new-sdk/liquidations/index.d.ts +3 -0
- package/dist/types/new-sdk/liquidations/types.d.ts +46 -0
- package/package.json +1 -1
|
@@ -7,6 +7,8 @@ const require_new_sdk_errors_MissingSourceError = require("./errors/MissingSourc
|
|
|
7
7
|
require("./errors/index.js");
|
|
8
8
|
const require_offchain_GearboxAPI = require("../offchain/GearboxAPI.js");
|
|
9
9
|
require("../offchain/index.js");
|
|
10
|
+
const require_new_sdk_liquidations_LiquidationsNamespace = require("./liquidations/LiquidationsNamespace.js");
|
|
11
|
+
require("./liquidations/index.js");
|
|
10
12
|
require("./utils/mergeChains.js");
|
|
11
13
|
require("./utils/index.js");
|
|
12
14
|
const require_new_sdk_opportunities_OpportunitiesNamespace = require("./opportunities/OpportunitiesNamespace.js");
|
|
@@ -58,6 +60,12 @@ var GearboxSDK = class {
|
|
|
58
60
|
**/
|
|
59
61
|
positions;
|
|
60
62
|
/**
|
|
63
|
+
* Namespace for liquidatable credit accounts and delayed-withdrawal
|
|
64
|
+
* positions a liquidator holds. Onchain-only, hence gated by mode like
|
|
65
|
+
* every other chain read: absent in `offchain` mode.
|
|
66
|
+
**/
|
|
67
|
+
liquidations;
|
|
68
|
+
/**
|
|
61
69
|
* Namespace for on-chain previews of raw operation calldata. Onchain-only,
|
|
62
70
|
* hence gated by mode like every other chain read: absent in `offchain`
|
|
63
71
|
* mode.
|
|
@@ -125,6 +133,7 @@ var GearboxSDK = class {
|
|
|
125
133
|
};
|
|
126
134
|
this.opportunities = new require_new_sdk_opportunities_OpportunitiesNamespace.OpportunitiesNamespace(this.#onchain, this.#offchain, namespaceOptions);
|
|
127
135
|
this.positions = new require_new_sdk_positions_PositionsNamespace.PositionsNamespace(this.#onchain, this.#offchain, namespaceOptions);
|
|
136
|
+
this.liquidations = this.#onchain ? new require_new_sdk_liquidations_LiquidationsNamespace.LiquidationsNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
128
137
|
this.preview = this.#onchain ? new require_new_sdk_preview_PreviewNamespace.PreviewNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
129
138
|
const backend = this.#offchain;
|
|
130
139
|
this.notices = backend ? (subject) => backend.notices.list(subject) : void 0;
|
|
@@ -8,6 +8,8 @@ const require_new_sdk_errors_NoSourceServedError = require("./errors/NoSourceSer
|
|
|
8
8
|
const require_new_sdk_errors_SourceUnavailableError = require("./errors/SourceUnavailableError.js");
|
|
9
9
|
require("./errors/index.js");
|
|
10
10
|
const require_new_sdk_AbstractNamespace = require("./AbstractNamespace.js");
|
|
11
|
+
const require_new_sdk_liquidations_LiquidationsNamespace = require("./liquidations/LiquidationsNamespace.js");
|
|
12
|
+
require("./liquidations/index.js");
|
|
11
13
|
const require_new_sdk_execute_ExecuteApi = require("./execute/ExecuteApi.js");
|
|
12
14
|
require("./execute/index.js");
|
|
13
15
|
const require_new_sdk_prepare_PrepareApi = require("./prepare/PrepareApi.js");
|
|
@@ -29,6 +31,7 @@ exports.DEFAULT_MAX_OFFCHAIN_LAG = require_new_sdk_utils_mergeChains.DEFAULT_MAX
|
|
|
29
31
|
exports.DEFAULT_MAX_STATE_AGE = require_new_sdk_GearboxSDK.DEFAULT_MAX_STATE_AGE;
|
|
30
32
|
exports.ExecuteApi = require_new_sdk_execute_ExecuteApi.ExecuteApi;
|
|
31
33
|
exports.GearboxSDK = require_new_sdk_GearboxSDK.GearboxSDK;
|
|
34
|
+
exports.LiquidationsNamespace = require_new_sdk_liquidations_LiquidationsNamespace.LiquidationsNamespace;
|
|
32
35
|
exports.MissingSourceError = require_new_sdk_errors_MissingSourceError.MissingSourceError;
|
|
33
36
|
exports.NoSourceServedError = require_new_sdk_errors_NoSourceServedError.NoSourceServedError;
|
|
34
37
|
exports.OpportunitiesNamespace = require_new_sdk_opportunities_OpportunitiesNamespace.OpportunitiesNamespace;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_sdk_chain_chains = require("../../sdk/chain/chains.js");
|
|
3
|
+
require("../../sdk/index.js");
|
|
4
|
+
//#region src/new-sdk/liquidations/LiquidationsNamespace.ts
|
|
5
|
+
/**
|
|
6
|
+
* {@inheritDoc Liquidations}
|
|
7
|
+
**/
|
|
8
|
+
var LiquidationsNamespace = class {
|
|
9
|
+
#onchain;
|
|
10
|
+
#ensureFresh;
|
|
11
|
+
constructor(onchain, options) {
|
|
12
|
+
this.#onchain = onchain;
|
|
13
|
+
this.#ensureFresh = options.ensureFresh;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* {@inheritDoc Liquidations.getLiquidatableAccounts}
|
|
17
|
+
**/
|
|
18
|
+
async getLiquidatableAccounts(props) {
|
|
19
|
+
await this.#ensureFresh?.(props?.chainIds);
|
|
20
|
+
return this.#onchain.liquidations.getLiquidatableAccounts(props);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc Liquidations.getLiquidationDetails}
|
|
24
|
+
**/
|
|
25
|
+
async getLiquidationDetails(props) {
|
|
26
|
+
await this.#ensureFresh?.(require_sdk_chain_chains.toChainIds([props.network]));
|
|
27
|
+
return this.#onchain.liquidations.getLiquidationDetails(props);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* {@inheritDoc Liquidations.buildLiquidationTx}
|
|
31
|
+
**/
|
|
32
|
+
async buildLiquidationTx(props) {
|
|
33
|
+
await this.#ensureFresh?.(require_sdk_chain_chains.toChainIds([props.network]));
|
|
34
|
+
return this.#onchain.liquidations.buildLiquidationTx(props);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* {@inheritDoc Liquidations.getLiquidationPositions}
|
|
38
|
+
**/
|
|
39
|
+
async getLiquidationPositions(props) {
|
|
40
|
+
await this.#ensureFresh?.(props.chainIds);
|
|
41
|
+
return this.#onchain.liquidations.getLiquidationPositions(props);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
exports.LiquidationsNamespace = LiquidationsNamespace;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_new_sdk_liquidations_LiquidationsNamespace = require("./LiquidationsNamespace.js");
|
|
3
|
+
require("./types.js");
|
|
4
|
+
exports.LiquidationsNamespace = require_new_sdk_liquidations_LiquidationsNamespace.LiquidationsNamespace;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ierc20Abi } from "../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../sdk/utils/AddressMap.js";
|
|
4
3
|
import { AddressSet } from "../sdk/utils/AddressSet.js";
|
|
5
4
|
import { AssetsMap } from "../sdk/utils/AssetsMap.js";
|
|
6
5
|
import { childLogger } from "../sdk/utils/childLogger.js";
|
|
6
|
+
import { ierc20Abi } from "../abi/iERC20.js";
|
|
7
7
|
import "../sdk/constants/addresses.js";
|
|
8
8
|
import { MAX_UINT256, PERCENTAGE_FACTOR } from "../sdk/constants/math.js";
|
|
9
9
|
import { SDKConstruct } from "../sdk/base/SDKConstruct.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { getNetworkType } from "../sdk/chain/chains.js";
|
|
3
2
|
import { getWithdrawalCompressorAddress } from "../sdk/accounts/withdrawal-compressor/addresses.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import "../sdk/index.js";
|
|
5
5
|
import { iMidasDataFeedAbi, iMidasRedemptionVaultAbi, midasGatewayAbi, midasRedeemerAbi, midasRedemptionVaultPhantomTokenAbi, securitizeRedeemerAbi, securitizeRedemptionGatewayAbi, securitizeRedemptionPhantomTokenAbi } from "./withdrawalAbi.js";
|
|
6
6
|
import { erc20Abi, hexToString, parseAbi, parseEther } from "viem";
|
|
@@ -6,6 +6,8 @@ import { MissingSourceError } from "./errors/MissingSourceError.js";
|
|
|
6
6
|
import "./errors/index.js";
|
|
7
7
|
import { GearboxAPI } from "../offchain/GearboxAPI.js";
|
|
8
8
|
import "../offchain/index.js";
|
|
9
|
+
import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
|
|
10
|
+
import "./liquidations/index.js";
|
|
9
11
|
import "./utils/mergeChains.js";
|
|
10
12
|
import "./utils/index.js";
|
|
11
13
|
import { OpportunitiesNamespace } from "./opportunities/OpportunitiesNamespace.js";
|
|
@@ -57,6 +59,12 @@ var GearboxSDK = class {
|
|
|
57
59
|
**/
|
|
58
60
|
positions;
|
|
59
61
|
/**
|
|
62
|
+
* Namespace for liquidatable credit accounts and delayed-withdrawal
|
|
63
|
+
* positions a liquidator holds. Onchain-only, hence gated by mode like
|
|
64
|
+
* every other chain read: absent in `offchain` mode.
|
|
65
|
+
**/
|
|
66
|
+
liquidations;
|
|
67
|
+
/**
|
|
60
68
|
* Namespace for on-chain previews of raw operation calldata. Onchain-only,
|
|
61
69
|
* hence gated by mode like every other chain read: absent in `offchain`
|
|
62
70
|
* mode.
|
|
@@ -124,6 +132,7 @@ var GearboxSDK = class {
|
|
|
124
132
|
};
|
|
125
133
|
this.opportunities = new OpportunitiesNamespace(this.#onchain, this.#offchain, namespaceOptions);
|
|
126
134
|
this.positions = new PositionsNamespace(this.#onchain, this.#offchain, namespaceOptions);
|
|
135
|
+
this.liquidations = this.#onchain ? new LiquidationsNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
127
136
|
this.preview = this.#onchain ? new PreviewNamespace(this.#onchain, namespaceOptions) : void 0;
|
|
128
137
|
const backend = this.#offchain;
|
|
129
138
|
this.notices = backend ? (subject) => backend.notices.list(subject) : void 0;
|
|
@@ -7,6 +7,8 @@ import { NoSourceServedError } from "./errors/NoSourceServedError.js";
|
|
|
7
7
|
import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
8
8
|
import "./errors/index.js";
|
|
9
9
|
import { AbstractNamespace } from "./AbstractNamespace.js";
|
|
10
|
+
import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
|
|
11
|
+
import "./liquidations/index.js";
|
|
10
12
|
import { ExecuteApi } from "./execute/ExecuteApi.js";
|
|
11
13
|
import "./execute/index.js";
|
|
12
14
|
import { PrepareApi } from "./prepare/PrepareApi.js";
|
|
@@ -22,4 +24,4 @@ import { PreviewNamespace } from "./preview/PreviewNamespace.js";
|
|
|
22
24
|
import "./preview/index.js";
|
|
23
25
|
import { DEFAULT_MAX_STATE_AGE, GearboxSDK } from "./GearboxSDK.js";
|
|
24
26
|
import "./types.js";
|
|
25
|
-
export { AbstractNamespace, AllSourcesFailedError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, ExecuteApi, GearboxSDK, MissingSourceError, NoSourceServedError, OpportunitiesNamespace, PositionsNamespace, PrepareApi, PreviewNamespace, SourceChainMismatchError, SourceUnavailableError, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
27
|
+
export { AbstractNamespace, AllSourcesFailedError, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, ExecuteApi, GearboxSDK, LiquidationsNamespace, MissingSourceError, NoSourceServedError, OpportunitiesNamespace, PositionsNamespace, PrepareApi, PreviewNamespace, SourceChainMismatchError, SourceUnavailableError, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { toChainIds } from "../../sdk/chain/chains.js";
|
|
2
|
+
import "../../sdk/index.js";
|
|
3
|
+
//#region src/new-sdk/liquidations/LiquidationsNamespace.ts
|
|
4
|
+
/**
|
|
5
|
+
* {@inheritDoc Liquidations}
|
|
6
|
+
**/
|
|
7
|
+
var LiquidationsNamespace = class {
|
|
8
|
+
#onchain;
|
|
9
|
+
#ensureFresh;
|
|
10
|
+
constructor(onchain, options) {
|
|
11
|
+
this.#onchain = onchain;
|
|
12
|
+
this.#ensureFresh = options.ensureFresh;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc Liquidations.getLiquidatableAccounts}
|
|
16
|
+
**/
|
|
17
|
+
async getLiquidatableAccounts(props) {
|
|
18
|
+
await this.#ensureFresh?.(props?.chainIds);
|
|
19
|
+
return this.#onchain.liquidations.getLiquidatableAccounts(props);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* {@inheritDoc Liquidations.getLiquidationDetails}
|
|
23
|
+
**/
|
|
24
|
+
async getLiquidationDetails(props) {
|
|
25
|
+
await this.#ensureFresh?.(toChainIds([props.network]));
|
|
26
|
+
return this.#onchain.liquidations.getLiquidationDetails(props);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* {@inheritDoc Liquidations.buildLiquidationTx}
|
|
30
|
+
**/
|
|
31
|
+
async buildLiquidationTx(props) {
|
|
32
|
+
await this.#ensureFresh?.(toChainIds([props.network]));
|
|
33
|
+
return this.#onchain.liquidations.buildLiquidationTx(props);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* {@inheritDoc Liquidations.getLiquidationPositions}
|
|
37
|
+
**/
|
|
38
|
+
async getLiquidationPositions(props) {
|
|
39
|
+
await this.#ensureFresh?.(props.chainIds);
|
|
40
|
+
return this.#onchain.liquidations.getLiquidationPositions(props);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//#endregion
|
|
44
|
+
export { LiquidationsNamespace };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
2
1
|
import { iPoolV310Abi } from "../../abi/310/generated.js";
|
|
2
|
+
import { iZapperAbi } from "../../abi/iZapper.js";
|
|
3
3
|
import { asPreviewSimulationError } from "./errors.js";
|
|
4
4
|
//#region src/preview/simulate/simulatePoolOperation.ts
|
|
5
5
|
function previewRead(operation) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
2
1
|
import { iCreditFacadeV310Abi } from "../../abi/310/generated.js";
|
|
3
2
|
import { AddressMap } from "../../sdk/utils/AddressMap.js";
|
|
3
|
+
import { ierc20Abi } from "../../abi/iERC20.js";
|
|
4
4
|
import "../../sdk/index.js";
|
|
5
5
|
import { UnexpectedFacadeEventOrderError } from "./errors.js";
|
|
6
6
|
import { getAddress, isAddressEqual, parseEventLogs } from "viem";
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
2
|
-
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
3
1
|
import { AP_REWARDS_COMPRESSOR } from "../constants/address-provider.js";
|
|
4
2
|
import { ADDRESS_0X0 } from "../constants/addresses.js";
|
|
5
3
|
import { MAX_UINT256 } from "../constants/math.js";
|
|
@@ -10,6 +8,8 @@ import "../base/index.js";
|
|
|
10
8
|
import { AccountBotsService } from "./bots/AccountBotsService.js";
|
|
11
9
|
import "./bots/index.js";
|
|
12
10
|
import { rewardsCompressorAbi } from "../../abi/compressors/rewardsCompressor.js";
|
|
11
|
+
import { iBaseRewardPoolAbi } from "../../abi/iBaseRewardPool.js";
|
|
12
|
+
import { ierc4626AdapterAbi } from "../../abi/ierc4626Adapter.js";
|
|
13
13
|
import { expectedBalanceDeltas } from "../market/credit/expectedBalanceDeltas.js";
|
|
14
14
|
import "../market/index.js";
|
|
15
15
|
import { CreditAccountCompressor } from "./credit-account-compressor/CreditAccountCompressor.js";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
2
1
|
import { AddressSet } from "../../utils/AddressSet.js";
|
|
3
2
|
import { bytes32ToString } from "../../utils/bytes32ToString.js";
|
|
4
3
|
import { ADDRESS_0X0 } from "../../constants/addresses.js";
|
|
@@ -20,6 +19,7 @@ import { SecuritizeLiquidatorContract } from "../../market/rwa/securitize/Securi
|
|
|
20
19
|
import "../../market/rwa/securitize/index.js";
|
|
21
20
|
import "../../market/index.js";
|
|
22
21
|
import { LIQUIDATION_APPROVAL_BUFFER, LIQUIDATION_COMPRESSOR_V313_ADDRESS } from "./constants.js";
|
|
22
|
+
import { iLiquidationCompressorV313Abi } from "../../../abi/ILiquidationCompressorV313.js";
|
|
23
23
|
//#region src/sdk/accounts/liquidations/LiquidationsService.ts
|
|
24
24
|
/**
|
|
25
25
|
* Service for discovering liquidatable credit accounts and previewing manual
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
2
1
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
3
2
|
import "../../base/index.js";
|
|
4
3
|
import { decodeDelayedIntent } from "./intent-codec.js";
|
|
4
|
+
import { iRedemptionLoggerV310Abi } from "../../../abi/iRedemptionLoggerV310.js";
|
|
5
5
|
import { InvalidDelayedIntentError } from "./errors.js";
|
|
6
6
|
//#region src/sdk/accounts/withdrawal-compressor/RedemptionLoggerV310Contract.ts
|
|
7
7
|
const abi = iRedemptionLoggerV310Abi;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV310Abi } from "../../../abi/IWithdrawalCompressorV310.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV310Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV310Abi;
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
2
1
|
import { AbstractWithdrawalCompressorContract } from "./AbstractWithdrawalCompressorContract.js";
|
|
2
|
+
import { iWithdrawalCompressorV311Abi } from "../../../abi/IWithdrawalCompressorV311.js";
|
|
3
3
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV311Contract.ts
|
|
4
4
|
const abi = iWithdrawalCompressorV311Abi;
|
|
5
5
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
2
1
|
import { encodeDelayedIntent } from "./intent-codec.js";
|
|
3
2
|
import { AbstractWithdrawalCompressorContract, iCreditAccountAbi, toClaimableWithdrawal, toPendingWithdrawal, toRequestableWithdrawal } from "./AbstractWithdrawalCompressorContract.js";
|
|
3
|
+
import { iWithdrawalCompressorV313Abi } from "../../../abi/IWithdrawalCompressorV313.js";
|
|
4
4
|
import { toWithdrawalStatus } from "./types.js";
|
|
5
5
|
//#region src/sdk/accounts/withdrawal-compressor/WithdrawalCompressorV313Contract.ts
|
|
6
6
|
const abi = iWithdrawalCompressorV313Abi;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
2
|
-
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
3
|
-
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
4
1
|
import { AddressMap } from "../utils/AddressMap.js";
|
|
5
2
|
import { AddressSet } from "../utils/AddressSet.js";
|
|
6
3
|
import { bytes32ToString } from "../utils/bytes32ToString.js";
|
|
7
4
|
import { getAssetType } from "../chain/chains.js";
|
|
8
5
|
import { formatBN } from "../utils/formatter.js";
|
|
9
6
|
import "../utils/index.js";
|
|
7
|
+
import { iExpirableAbi } from "../../abi/iExpirable.js";
|
|
8
|
+
import { iStateSerializerAbi } from "../../abi/iStateSerializer.js";
|
|
9
|
+
import { iVersionAbi } from "../../abi/iVersion.js";
|
|
10
10
|
import { executeMulticallBatches } from "../utils/viem/executeMulticallBatches.js";
|
|
11
11
|
//#region src/sdk/base/TokensMeta.ts
|
|
12
12
|
/**
|
|
@@ -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 { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
2
1
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
2
|
+
import { accountMigratorAbi } from "../../../../abi/AccountMigrator.js";
|
|
3
3
|
//#region src/sdk/market/adapters/contracts/AccountMigratorAdapterContract.ts
|
|
4
4
|
const abi = accountMigratorAbi;
|
|
5
5
|
const protocolAbi = accountMigratorAbi;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
2
1
|
import { MissingSerializedParamsError } from "../../../base/errors.js";
|
|
3
2
|
import "../../../base/index.js";
|
|
3
|
+
import { ierc4626AdapterAbi } from "../../../../abi/ierc4626Adapter.js";
|
|
4
4
|
import { iERC4626Abi } from "../abi/targetContractAbi.js";
|
|
5
5
|
import { fnSigToName, swapFromTransfers } from "../transferHelpers.js";
|
|
6
6
|
import { AbstractAdapterContract } from "./AbstractAdapter.js";
|
|
@@ -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 { calcUtilization } 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,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 { PERCENTAGE_FACTOR, RAY } from "../constants/math.js";
|
|
5
5
|
import "../constants/index.js";
|
|
@@ -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,6 +1,8 @@
|
|
|
1
1
|
import { NetworkType } from "../sdk/chain/chains.js";
|
|
2
2
|
import "../sdk/index.js";
|
|
3
3
|
import { GearboxSDKOptions, Mode, NoticesByMode, OffchainByMode, OnchainByMode } from "./types.js";
|
|
4
|
+
import { LiquidationsByMode } from "./liquidations/types.js";
|
|
5
|
+
import "./liquidations/index.js";
|
|
4
6
|
import { Opportunities } from "./opportunities/types.js";
|
|
5
7
|
import "./opportunities/index.js";
|
|
6
8
|
import { Positions } from "./positions/types.js";
|
|
@@ -50,6 +52,12 @@ declare class GearboxSDK<const M extends Mode = Mode> {
|
|
|
50
52
|
* Namespace for the positions a wallet holds.
|
|
51
53
|
**/
|
|
52
54
|
readonly positions: Positions<M>;
|
|
55
|
+
/**
|
|
56
|
+
* Namespace for liquidatable credit accounts and delayed-withdrawal
|
|
57
|
+
* positions a liquidator holds. Onchain-only, hence gated by mode like
|
|
58
|
+
* every other chain read: absent in `offchain` mode.
|
|
59
|
+
**/
|
|
60
|
+
readonly liquidations: LiquidationsByMode[M];
|
|
53
61
|
/**
|
|
54
62
|
* Namespace for on-chain previews of raw operation calldata. Onchain-only,
|
|
55
63
|
* hence gated by mode like every other chain read: absent in `offchain`
|
|
@@ -4,6 +4,9 @@ import { filterResponse } from "./utils/filterResponse.js";
|
|
|
4
4
|
import { DEFAULT_MAX_OFFCHAIN_LAG, mergeChainList, mergeChainOne } from "./utils/mergeChains.js";
|
|
5
5
|
import "./utils/index.js";
|
|
6
6
|
import { AbstractNamespace, MergedQuery } from "./AbstractNamespace.js";
|
|
7
|
+
import { Liquidations, LiquidationsByMode } from "./liquidations/types.js";
|
|
8
|
+
import { LiquidationsNamespace } from "./liquidations/LiquidationsNamespace.js";
|
|
9
|
+
import "./liquidations/index.js";
|
|
7
10
|
import { AddCollateralParams, AdjustLeverageParams, DelayedStrategySimulate, DepositStrategyParams, FinalizeParams, LpParams, LpRedeemParams, LpSimulate, OpenStrategyParams, OpenStrategySimulate, OpportunitiesPrepare, PoolInput, PositionInput, PrepareOptions, RepayStrategyParams, StrategyInput, StrategyRoutesSimulate, StrategySimulate, WithdrawCollateralParams, WithdrawStrategyParams } from "./prepare/types.js";
|
|
8
11
|
import { ChainOf, PrepareApi } from "./prepare/PrepareApi.js";
|
|
9
12
|
import "./prepare/index.js";
|
|
@@ -27,4 +30,4 @@ import { SourceUnavailableError } from "./errors/SourceUnavailableError.js";
|
|
|
27
30
|
import { assertSameChains } from "./errors/assertSameChains.js";
|
|
28
31
|
import { everyChainFailed } from "./errors/everyChainFailed.js";
|
|
29
32
|
import "./errors/index.js";
|
|
30
|
-
export { AbstractNamespace, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, ChainOf, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategySimulate, DepositStrategyParams, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinalizeParams, GearboxSDK, GearboxSDKOptions, type ListMerger, LpParams, LpRedeemParams, LpSimulate, type MergeListResult, MergedQuery, MissingSourceError, Mode, NamespaceOptions, NoSourceServedError, NoticesByMode, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenPrepareRequest, OpenStrategyParams, OpenStrategySimulate, Opportunities, OpportunitiesBase, OpportunitiesByMode, OpportunitiesExecute, OpportunitiesMerged, OpportunitiesNamespace, OpportunitiesOffchainBranch, OpportunitiesOffchainOnly, OpportunitiesOnchainBranch, OpportunitiesOnchainOnly, OpportunitiesPrepare, OpportunityMergers, PlainMultichainSDKOptions, PoolInput, PoolPrepareRequest, PositionInput, PositionMergers, Positions, PositionsBase, PositionsByMode, PositionsMerged, PositionsNamespace, PositionsOffchainBranch, PositionsOffchainOnly, PositionsOnchainBranch, PositionsOnchainOnly, PrepareApi, PrepareOptions, PrepareRequest, Preview, PreviewByMode, PreviewNamespace, RepayStrategyParams, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyRoutesSimulate, StrategySimulate, WithdrawCollateralParams, WithdrawStrategyParams, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
33
|
+
export { AbstractNamespace, AccountPrepareRequest, AddCollateralParams, AdjustLeverageParams, AllSourcesFailedError, ChainOf, ChainRef, DEFAULT_MAX_OFFCHAIN_LAG, DEFAULT_MAX_STATE_AGE, DelayedStrategySimulate, DepositStrategyParams, EnsureFreshChains, type EntityMerger, ExecuteApi, type FilterResult, FinalizeParams, GearboxSDK, GearboxSDKOptions, Liquidations, LiquidationsByMode, LiquidationsNamespace, type ListMerger, LpParams, LpRedeemParams, LpSimulate, type MergeListResult, MergedQuery, MissingSourceError, Mode, NamespaceOptions, NoSourceServedError, NoticesByMode, OffchainByMode, OffchainSource, OnchainByMode, OnchainSource, OpenPrepareRequest, OpenStrategyParams, OpenStrategySimulate, Opportunities, OpportunitiesBase, OpportunitiesByMode, OpportunitiesExecute, OpportunitiesMerged, OpportunitiesNamespace, OpportunitiesOffchainBranch, OpportunitiesOffchainOnly, OpportunitiesOnchainBranch, OpportunitiesOnchainOnly, OpportunitiesPrepare, OpportunityMergers, PlainMultichainSDKOptions, PoolInput, PoolPrepareRequest, PositionInput, PositionMergers, Positions, PositionsBase, PositionsByMode, PositionsMerged, PositionsNamespace, PositionsOffchainBranch, PositionsOffchainOnly, PositionsOnchainBranch, PositionsOnchainOnly, PrepareApi, PrepareOptions, PrepareRequest, Preview, PreviewByMode, PreviewNamespace, RepayStrategyParams, SourceChainMismatchError, SourceUnavailableError, StrategyInput, StrategyRoutesSimulate, StrategySimulate, WithdrawCollateralParams, WithdrawStrategyParams, assertSameChains, everyChainFailed, filterResponse, mergeChainList, mergeChainOne };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { TxCall } from "../../model/primitives.js";
|
|
2
|
+
import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "../../model/liquidations.js";
|
|
3
|
+
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import "../../model/index.js";
|
|
5
|
+
import { MultichainSDK } from "../../sdk/MultichainSDK.js";
|
|
6
|
+
import { BuildLiquidationTxProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationPositionsProps } from "../../sdk/accounts/liquidations/types.js";
|
|
7
|
+
import "../../sdk/index.js";
|
|
8
|
+
import { NamespaceOptions } from "../types.js";
|
|
9
|
+
import { Liquidations } from "./types.js";
|
|
10
|
+
//#region src/new-sdk/liquidations/LiquidationsNamespace.d.ts
|
|
11
|
+
/**
|
|
12
|
+
* {@inheritDoc Liquidations}
|
|
13
|
+
**/
|
|
14
|
+
declare class LiquidationsNamespace implements Liquidations {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(onchain: MultichainSDK, options: NamespaceOptions);
|
|
17
|
+
/**
|
|
18
|
+
* {@inheritDoc Liquidations.getLiquidatableAccounts}
|
|
19
|
+
**/
|
|
20
|
+
getLiquidatableAccounts(props?: GetLiquidatableAccountsProps<true>): Promise<DataResponse<LiquidatableAccount[]>>;
|
|
21
|
+
/**
|
|
22
|
+
* {@inheritDoc Liquidations.getLiquidationDetails}
|
|
23
|
+
**/
|
|
24
|
+
getLiquidationDetails(props: GetLiquidationDetailsProps<true>): Promise<DataResponse<LiquidationDetails>>;
|
|
25
|
+
/**
|
|
26
|
+
* {@inheritDoc Liquidations.buildLiquidationTx}
|
|
27
|
+
**/
|
|
28
|
+
buildLiquidationTx(props: BuildLiquidationTxProps<true>): Promise<DataResponse<TxCall>>;
|
|
29
|
+
/**
|
|
30
|
+
* {@inheritDoc Liquidations.getLiquidationPositions}
|
|
31
|
+
**/
|
|
32
|
+
getLiquidationPositions(props: GetLiquidationPositionsProps<true>): Promise<DataResponse<LiquidationPosition[]>>;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { LiquidationsNamespace };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TxCall } from "../../model/primitives.js";
|
|
2
|
+
import { LiquidatableAccount, LiquidationDetails, LiquidationPosition } from "../../model/liquidations.js";
|
|
3
|
+
import { DataResponse } from "../../model/response.js";
|
|
4
|
+
import "../../model/index.js";
|
|
5
|
+
import { BuildLiquidationTxProps, GetLiquidatableAccountsProps, GetLiquidationDetailsProps, GetLiquidationPositionsProps } from "../../sdk/accounts/liquidations/types.js";
|
|
6
|
+
import "../../sdk/index.js";
|
|
7
|
+
//#region src/new-sdk/liquidations/types.d.ts
|
|
8
|
+
/**
|
|
9
|
+
* On-chain discovery of liquidatable credit accounts and delayed-withdrawal
|
|
10
|
+
* positions a liquidator wallet holds.
|
|
11
|
+
**/
|
|
12
|
+
interface Liquidations {
|
|
13
|
+
/**
|
|
14
|
+
* All liquidatable credit accounts: health factor below 1 plus accounts of
|
|
15
|
+
* expired credit managers with outstanding debt. Optionally narrowed.
|
|
16
|
+
**/
|
|
17
|
+
getLiquidatableAccounts(props?: GetLiquidatableAccountsProps<true>): Promise<DataResponse<LiquidatableAccount[]>>;
|
|
18
|
+
/**
|
|
19
|
+
* Detailed view of one liquidatable credit account, including the assets the
|
|
20
|
+
* liquidator receives. Throws when the chain cannot answer.
|
|
21
|
+
**/
|
|
22
|
+
getLiquidationDetails(props: GetLiquidationDetailsProps<true>): Promise<DataResponse<LiquidationDetails>>;
|
|
23
|
+
/**
|
|
24
|
+
* Transaction that fully liquidates a credit account. The reported block is
|
|
25
|
+
* the one the transaction was built against.
|
|
26
|
+
**/
|
|
27
|
+
buildLiquidationTx(props: BuildLiquidationTxProps<true>): Promise<DataResponse<TxCall>>;
|
|
28
|
+
/**
|
|
29
|
+
* Delayed-withdrawal positions (redemption receipts) owned by a liquidator
|
|
30
|
+
* wallet, optionally scoped to some of the SDK's chains.
|
|
31
|
+
**/
|
|
32
|
+
getLiquidationPositions(props: GetLiquidationPositionsProps<true>): Promise<DataResponse<LiquidationPosition[]>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* `sdk.liquidations` per mode: an on-chain read, absent when the SDK reads no
|
|
36
|
+
* chain.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
**/
|
|
40
|
+
interface LiquidationsByMode {
|
|
41
|
+
onchain: Liquidations;
|
|
42
|
+
offchain: undefined;
|
|
43
|
+
both: Liquidations;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Liquidations, LiquidationsByMode };
|