@gearbox-protocol/sdk 14.12.0-next.65 → 14.12.0-next.67
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/common-utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/apy/calculate-safe-borrow-rate.js +3 -3
- package/dist/cjs/common-utils/utils/assets-math.js +7 -7
- package/dist/cjs/common-utils/utils/creditAccount/calc-health-factor.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/debt.js +2 -2
- package/dist/cjs/common-utils/utils/creditAccount/quota-utils.js +5 -5
- package/dist/cjs/common-utils/utils/index.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +5 -5
- package/dist/cjs/common-utils/utils/strategies/strategy-info/calculate-total-points.js +2 -2
- package/dist/cjs/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +2 -2
- package/dist/cjs/common-utils/utils/validation/validate-open-account-pool-status.js +4 -4
- package/dist/cjs/dev/index.js +2 -1
- package/dist/cjs/dev/kycUtils.js +1 -1
- package/dist/cjs/dev/midasUtils.js +104 -0
- package/dist/cjs/model/history.js +28 -0
- package/dist/cjs/model/history.schema.js +84 -0
- package/dist/cjs/model/index.js +64 -0
- package/dist/cjs/model/liquidations.js +23 -0
- package/dist/cjs/model/liquidations.schema.js +91 -0
- package/dist/cjs/model/opportunities.js +55 -0
- package/dist/cjs/model/opportunities.schema.js +220 -0
- package/dist/cjs/model/package.json +1 -0
- package/dist/cjs/model/positions.js +1 -0
- package/dist/cjs/model/primitives.js +1 -0
- package/dist/cjs/model/primitives.schema.js +85 -0
- package/dist/cjs/new-sdk/AbstractNamespace.js +158 -0
- package/dist/cjs/new-sdk/GearboxSDK.js +122 -0
- package/dist/cjs/new-sdk/index.js +11 -0
- package/dist/cjs/new-sdk/opportunities/OpportunitiesNamespace.js +122 -0
- package/dist/cjs/new-sdk/opportunities/index.js +4 -0
- package/dist/cjs/new-sdk/opportunities/types.js +1 -0
- package/dist/cjs/new-sdk/package.json +1 -0
- package/dist/cjs/new-sdk/types.js +22 -0
- package/dist/cjs/new-sdk/utils/history.js +1 -0
- package/dist/cjs/new-sdk/utils/index.js +2 -0
- package/dist/cjs/offchain/GearboxAPI.js +33 -0
- package/dist/cjs/offchain/index.js +8 -0
- package/dist/cjs/offchain/opportunities/OffchainOpportunities.js +97 -0
- package/dist/cjs/offchain/opportunities/index.js +4 -0
- package/dist/cjs/offchain/package.json +1 -0
- package/dist/cjs/offchain/types.js +1 -0
- package/dist/cjs/preview/preview/buildDelayedPreview.js +5 -5
- package/dist/cjs/rewards/rewards/api.js +2 -2
- package/dist/cjs/rewards/rewards/extra-apy.js +2 -2
- package/dist/cjs/sdk/MultichainSDK.js +18 -2
- package/dist/cjs/sdk/OnchainSDK.js +8 -1
- package/dist/cjs/sdk/accounts/index.js +2 -0
- package/dist/cjs/sdk/accounts/liquidations/LiquidationsService.js +150 -106
- package/dist/cjs/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/cjs/sdk/accounts/liquidations/constants.js +13 -0
- package/dist/cjs/sdk/accounts/liquidations/index.js +2 -0
- package/dist/cjs/sdk/base/MultichainConstruct.js +80 -0
- package/dist/cjs/sdk/base/TokensMeta.js +51 -0
- package/dist/cjs/sdk/base/index.js +2 -0
- package/dist/cjs/sdk/chain/chains.js +76 -0
- package/dist/cjs/sdk/chain/index.js +4 -0
- package/dist/cjs/sdk/core/errors.js +13 -0
- package/dist/cjs/sdk/core/index.js +2 -1
- package/dist/cjs/sdk/index.js +25 -1
- package/dist/cjs/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/cjs/sdk/market/MarketSuite.js +163 -0
- package/dist/cjs/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/cjs/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/cjs/sdk/market/math.js +104 -0
- package/dist/cjs/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/cjs/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/cjs/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/cjs/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +27 -0
- package/dist/cjs/sdk/market/pool/math.js +44 -0
- package/dist/cjs/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
- package/dist/cjs/sdk/opportunities/MultichainOpportunitiesService.js +60 -0
- package/dist/cjs/sdk/opportunities/OpportunitiesService.js +103 -0
- package/dist/cjs/sdk/opportunities/index.js +12 -0
- package/dist/cjs/sdk/types/multichain.js +1 -0
- package/dist/cjs/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/cjs/sdk/utils/index.js +3 -0
- package/dist/cjs/sdk/utils/zod.js +12 -0
- package/dist/esm/common-utils/index.js +1 -1
- package/dist/esm/common-utils/utils/apy/calculate-safe-borrow-rate.js +1 -1
- package/dist/esm/common-utils/utils/assets-math.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/calc-health-factor.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/debt.js +1 -1
- package/dist/esm/common-utils/utils/creditAccount/quota-utils.js +1 -1
- package/dist/esm/common-utils/utils/index.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-leverage-factor.js +1 -1
- package/dist/esm/common-utils/utils/strategies/leverage/calculate-max-strategy-debt.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/calculate-total-points.js +1 -1
- package/dist/esm/common-utils/utils/strategies/strategy-info/get-cm-you-can-earn.js +1 -1
- package/dist/esm/common-utils/utils/validation/validate-open-account-pool-status.js +1 -1
- package/dist/esm/dev/AccountOpener.js +1 -1
- package/dist/esm/dev/index.js +3 -3
- package/dist/esm/dev/kycUtils.js +1 -1
- package/dist/esm/dev/midasUtils.js +105 -2
- package/dist/esm/dev/withdrawalUtils.js +1 -1
- package/dist/esm/model/history.js +26 -0
- package/dist/esm/model/history.schema.js +76 -0
- package/dist/esm/model/index.js +9 -0
- package/dist/esm/model/liquidations.js +22 -0
- package/dist/esm/model/liquidations.schema.js +83 -0
- package/dist/esm/model/opportunities.js +51 -0
- package/dist/esm/model/opportunities.schema.js +198 -0
- package/dist/esm/model/package.json +1 -0
- package/dist/esm/model/positions.js +1 -0
- package/dist/esm/model/primitives.js +1 -0
- package/dist/esm/model/primitives.schema.js +75 -0
- package/dist/esm/new-sdk/AbstractNamespace.js +157 -0
- package/dist/esm/new-sdk/GearboxSDK.js +121 -0
- package/dist/esm/new-sdk/index.js +7 -0
- package/dist/esm/new-sdk/opportunities/OpportunitiesNamespace.js +121 -0
- package/dist/esm/new-sdk/opportunities/index.js +3 -0
- package/dist/esm/new-sdk/opportunities/types.js +1 -0
- package/dist/esm/new-sdk/package.json +1 -0
- package/dist/esm/new-sdk/types.js +21 -0
- package/dist/esm/new-sdk/utils/history.js +1 -0
- package/dist/esm/new-sdk/utils/index.js +2 -0
- package/dist/esm/offchain/GearboxAPI.js +32 -0
- package/dist/esm/offchain/index.js +5 -0
- package/dist/esm/offchain/opportunities/OffchainOpportunities.js +95 -0
- package/dist/esm/offchain/opportunities/index.js +2 -0
- package/dist/esm/offchain/package.json +1 -0
- package/dist/esm/offchain/types.js +1 -0
- package/dist/esm/preview/preview/buildDelayedPreview.js +1 -1
- package/dist/esm/preview/simulate/simulatePoolOperation.js +1 -1
- package/dist/esm/preview/trace/extractTransfers.js +1 -1
- package/dist/esm/rewards/rewards/api.js +1 -1
- package/dist/esm/rewards/rewards/extra-apy.js +1 -1
- package/dist/esm/sdk/MultichainSDK.js +18 -2
- package/dist/esm/sdk/OnchainSDK.js +8 -1
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +2 -2
- package/dist/esm/sdk/accounts/index.js +2 -2
- package/dist/esm/sdk/accounts/liquidations/LiquidationsService.js +153 -109
- package/dist/esm/sdk/accounts/liquidations/MultichainLiquidationsService.js +32 -38
- package/dist/esm/sdk/accounts/liquidations/constants.js +12 -1
- package/dist/esm/sdk/accounts/liquidations/index.js +2 -2
- 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 +79 -0
- package/dist/esm/sdk/base/TokensMeta.js +53 -2
- package/dist/esm/sdk/base/index.js +2 -1
- package/dist/esm/sdk/chain/chains.js +74 -2
- 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/errors.js +13 -1
- package/dist/esm/sdk/core/index.js +2 -2
- package/dist/esm/sdk/index.js +11 -5
- package/dist/esm/sdk/market/MarketConfiguratorContract.js +14 -0
- package/dist/esm/sdk/market/MarketSuite.js +163 -0
- package/dist/esm/sdk/market/credit/CreditFacadeV310BaseContract.js +1 -1
- package/dist/esm/sdk/market/credit/CreditManagerV310Contract.js +26 -0
- package/dist/esm/sdk/market/credit/CreditSuite.js +102 -0
- package/dist/esm/sdk/market/math.js +98 -0
- package/dist/esm/sdk/market/oracle/PriceOracleBaseContract.js +52 -0
- package/dist/esm/sdk/market/pool/LinearInterestRateModelContract.js +30 -0
- package/dist/esm/sdk/market/pool/PoolQuotaKeeperV310Contract.js +26 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +28 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +28 -1
- package/dist/esm/sdk/market/pool/math.js +41 -0
- package/dist/esm/sdk/market/pricefeeds/AbstractPriceFeed.js +17 -0
- 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 +59 -0
- package/dist/esm/sdk/opportunities/OpportunitiesService.js +102 -0
- package/dist/esm/sdk/opportunities/index.js +4 -0
- package/dist/esm/sdk/pools/PoolService.js +1 -1
- package/dist/esm/sdk/types/multichain.js +1 -0
- package/dist/esm/{common-utils → sdk}/utils/bigint-math.js +11 -11
- package/dist/esm/sdk/utils/index.js +3 -2
- package/dist/esm/sdk/utils/viem/simulateWithPriceUpdates.js +1 -1
- package/dist/esm/sdk/utils/zod.js +13 -2
- package/dist/types/common-utils/index.d.ts +1 -1
- package/dist/types/common-utils/utils/index.d.ts +1 -1
- package/dist/types/dev/index.d.ts +2 -2
- package/dist/types/dev/midasUtils.d.ts +31 -2
- package/dist/types/model/history.d.ts +105 -0
- package/dist/types/model/history.schema.d.ts +66 -0
- package/dist/types/model/index.d.ts +9 -0
- package/dist/types/model/liquidations.d.ts +230 -0
- package/dist/types/model/liquidations.schema.d.ts +292 -0
- package/dist/types/model/opportunities.d.ts +543 -0
- package/dist/types/model/opportunities.schema.d.ts +1066 -0
- package/dist/types/model/positions.d.ts +11 -0
- package/dist/types/model/primitives.d.ts +193 -0
- package/dist/types/model/primitives.schema.d.ts +81 -0
- package/dist/types/new-sdk/AbstractNamespace.d.ts +119 -0
- package/dist/types/new-sdk/GearboxSDK.d.ts +78 -0
- package/dist/types/new-sdk/index.d.ts +9 -0
- package/dist/types/new-sdk/opportunities/OpportunitiesNamespace.d.ts +69 -0
- package/dist/types/new-sdk/opportunities/index.d.ts +3 -0
- package/dist/types/new-sdk/opportunities/types.d.ts +66 -0
- package/dist/types/new-sdk/types.d.ts +149 -0
- package/dist/types/new-sdk/utils/history.d.ts +44 -0
- package/dist/types/new-sdk/utils/index.d.ts +2 -0
- package/dist/types/offchain/GearboxAPI.d.ts +31 -0
- package/dist/types/offchain/index.d.ts +5 -0
- package/dist/types/offchain/opportunities/OffchainOpportunities.d.ts +69 -0
- package/dist/types/offchain/opportunities/index.d.ts +2 -0
- package/dist/types/offchain/types.d.ts +50 -0
- package/dist/types/sdk/MultichainSDK.d.ts +15 -2
- package/dist/types/sdk/OnchainSDK.d.ts +9 -3
- package/dist/types/sdk/accounts/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/LiquidationsService.d.ts +24 -16
- package/dist/types/sdk/accounts/liquidations/MultichainLiquidationsService.d.ts +26 -20
- package/dist/types/sdk/accounts/liquidations/constants.d.ts +12 -1
- package/dist/types/sdk/accounts/liquidations/index.d.ts +3 -3
- package/dist/types/sdk/accounts/liquidations/types.d.ts +34 -309
- package/dist/types/sdk/base/MultichainConstruct.d.ts +57 -0
- package/dist/types/sdk/base/TokensMeta.d.ts +26 -0
- package/dist/types/sdk/base/index.d.ts +2 -1
- package/dist/types/sdk/chain/chains.d.ts +68 -1
- package/dist/types/sdk/chain/index.d.ts +2 -2
- package/dist/types/sdk/core/errors.d.ts +10 -1
- package/dist/types/sdk/core/index.d.ts +2 -2
- package/dist/types/sdk/index.d.ts +15 -8
- package/dist/types/sdk/market/MarketConfiguratorContract.d.ts +9 -0
- package/dist/types/sdk/market/MarketSuite.d.ts +109 -1
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +14 -0
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +47 -0
- package/dist/types/sdk/market/credit/types.d.ts +22 -0
- package/dist/types/sdk/market/index.d.ts +2 -2
- package/dist/types/sdk/market/math.d.ts +74 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +23 -0
- package/dist/types/sdk/market/oracle/types.d.ts +46 -0
- package/dist/types/sdk/market/pool/LinearInterestRateModelContract.d.ts +12 -0
- package/dist/types/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts +22 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +23 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +18 -0
- package/dist/types/sdk/market/pool/math.d.ts +57 -0
- package/dist/types/sdk/market/pool/types.d.ts +23 -0
- package/dist/types/sdk/market/pricefeeds/AbstractPriceFeed.d.ts +6 -0
- package/dist/types/sdk/market/pricefeeds/types.d.ts +10 -0
- package/dist/types/sdk/opportunities/MultichainOpportunitiesService.d.ts +40 -0
- package/dist/types/sdk/opportunities/OpportunitiesService.d.ts +47 -0
- package/dist/types/sdk/opportunities/index.d.ts +4 -0
- package/dist/types/sdk/types/index.d.ts +2 -1
- package/dist/types/sdk/types/multichain.d.ts +65 -0
- package/dist/types/sdk/types/state.d.ts +1 -1
- package/dist/types/sdk/types/transactions.d.ts +3 -0
- package/dist/types/{common-utils → sdk}/utils/bigint-math.d.ts +7 -11
- package/dist/types/sdk/utils/index.d.ts +3 -2
- package/dist/types/sdk/utils/zod.d.ts +6 -2
- package/package.json +16 -1
- package/dist/cjs/sdk/accounts/liquidations/helpers.js +0 -201
- package/dist/esm/sdk/accounts/liquidations/helpers.js +0 -192
- package/dist/types/sdk/accounts/liquidations/helpers.d.ts +0 -140
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { Bps } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { IBaseContract, PoolState, QuotaKeeperState, QuotaState } from "../../base/types.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
3
5
|
import { PoolQuotaKeeperStateHuman } from "../../types/state-human.js";
|
|
4
6
|
import "../../utils/index.js";
|
|
5
7
|
import { ConstructOptions } from "../../base/Construct.js";
|
|
6
8
|
import "../../types/index.js";
|
|
7
9
|
import { BaseContract } from "../../base/BaseContract.js";
|
|
8
10
|
import "../../base/index.js";
|
|
9
|
-
import { ContractEventName, Log } from "viem";
|
|
11
|
+
import { Address, ContractEventName, Log } from "viem";
|
|
10
12
|
//#region src/sdk/market/pool/PoolQuotaKeeperV310Contract.d.ts
|
|
11
13
|
declare const abi: readonly [{
|
|
12
14
|
readonly type: "function";
|
|
@@ -477,6 +479,25 @@ declare class PoolQuotaKeeperV310Contract extends BaseContract<abi> implements I
|
|
|
477
479
|
readonly decimals: number;
|
|
478
480
|
readonly quotas: AddressMap<QuotaState>;
|
|
479
481
|
constructor(options: ConstructOptions, pool: PoolState, pqk: QuotaKeeperState);
|
|
482
|
+
/**
|
|
483
|
+
* Whether the market still accepts quota for a token: a token whose quota is
|
|
484
|
+
* inactive or whose limit is exhausted can no longer back a new position.
|
|
485
|
+
*
|
|
486
|
+
* @param token - Token address.
|
|
487
|
+
*/
|
|
488
|
+
hasActiveQuota(token: Address): boolean;
|
|
489
|
+
/**
|
|
490
|
+
* Every token the market still accepts quota for, see
|
|
491
|
+
* {@link hasActiveQuota}.
|
|
492
|
+
*/
|
|
493
|
+
get activeQuotaTokens(): Address[];
|
|
494
|
+
/**
|
|
495
|
+
* Annual quota rate paid on a quoted token, in basis points, or `0` when the
|
|
496
|
+
* market does not quote it.
|
|
497
|
+
*
|
|
498
|
+
* @param token - Quoted token address.
|
|
499
|
+
*/
|
|
500
|
+
quotaRate(token: Address): Bps;
|
|
480
501
|
stateHuman(raw?: boolean): PoolQuotaKeeperStateHuman;
|
|
481
502
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
482
503
|
}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { Bps } from "../../../model/primitives.js";
|
|
1
2
|
import { MarketData } from "../../base/types.js";
|
|
3
|
+
import { RateCurve } from "../../../model/opportunities.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
2
5
|
import { IRWAFactory } from "../rwa/types.js";
|
|
3
6
|
import { PoolSuiteStateHuman } from "../../types/state-human.js";
|
|
4
7
|
import { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
|
|
@@ -82,6 +85,26 @@ declare class PoolSuite extends SDKConstruct {
|
|
|
82
85
|
* suites.
|
|
83
86
|
*/
|
|
84
87
|
get underlying(): Address;
|
|
88
|
+
/**
|
|
89
|
+
* {@inheritDoc IPoolContract.unwrappedUnderlying}
|
|
90
|
+
*/
|
|
91
|
+
get unwrappedUnderlying(): Address;
|
|
92
|
+
/**
|
|
93
|
+
* {@inheritDoc IPoolContract.utilization}
|
|
94
|
+
*/
|
|
95
|
+
get utilization(): Bps;
|
|
96
|
+
/**
|
|
97
|
+
* Whether the pool is paused, which blocks borrowing across every connected
|
|
98
|
+
* credit suite.
|
|
99
|
+
*/
|
|
100
|
+
get isPaused(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Interest rate curve of the pool's rate model.
|
|
103
|
+
*
|
|
104
|
+
* @throws If the market uses an interest-rate model that is not linear, and
|
|
105
|
+
* therefore has no curve the SDK can evaluate.
|
|
106
|
+
*/
|
|
107
|
+
get rateCurve(): RateCurve;
|
|
85
108
|
/**
|
|
86
109
|
* RWA factory associated with the pool's underlying, undefined for non-RWA markets.
|
|
87
110
|
*/
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Bps } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { CreditManagerDebtParams, PoolState } from "../../base/types.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
3
5
|
import { IRWAFactory } from "../rwa/types.js";
|
|
4
6
|
import { PoolStateHuman } from "../../types/state-human.js";
|
|
5
7
|
import { IPoolContract } from "./types.js";
|
|
@@ -1141,6 +1143,22 @@ declare class PoolV310Contract extends BaseContract<abi> implements IPoolContrac
|
|
|
1141
1143
|
readonly creditManagerDebtParams: AddressMap<CreditManagerDebtParams>;
|
|
1142
1144
|
constructor(sdk: OnchainSDK, data: PoolState);
|
|
1143
1145
|
get rwaFactory(): IRWAFactory | undefined;
|
|
1146
|
+
/**
|
|
1147
|
+
* {@inheritDoc IPoolContract.borrowed}
|
|
1148
|
+
*/
|
|
1149
|
+
get borrowed(): bigint;
|
|
1150
|
+
/**
|
|
1151
|
+
* {@inheritDoc IPoolContract.totalAssets}
|
|
1152
|
+
*/
|
|
1153
|
+
get totalAssets(): bigint;
|
|
1154
|
+
/**
|
|
1155
|
+
* {@inheritDoc IPoolContract.utilization}
|
|
1156
|
+
*/
|
|
1157
|
+
get utilization(): Bps;
|
|
1158
|
+
/**
|
|
1159
|
+
* {@inheritDoc IPoolContract.unwrappedUnderlying}
|
|
1160
|
+
*/
|
|
1161
|
+
get unwrappedUnderlying(): Address;
|
|
1144
1162
|
stateHuman(raw?: boolean): PoolStateHuman;
|
|
1145
1163
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
1146
1164
|
/**
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Bps } from "../../../model/primitives.js";
|
|
2
|
+
import "../../../model/index.js";
|
|
3
|
+
//#region src/sdk/market/pool/math.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Interest rate model parameters, all in basis points except the flag.
|
|
6
|
+
**/
|
|
7
|
+
interface RateModelParams {
|
|
8
|
+
/**
|
|
9
|
+
* Utilization at the first kink.
|
|
10
|
+
**/
|
|
11
|
+
U1: Bps;
|
|
12
|
+
/**
|
|
13
|
+
* Utilization at the second kink.
|
|
14
|
+
**/
|
|
15
|
+
U2: Bps;
|
|
16
|
+
/**
|
|
17
|
+
* Rate at zero utilization.
|
|
18
|
+
**/
|
|
19
|
+
Rbase: Bps;
|
|
20
|
+
/**
|
|
21
|
+
* Rate added between zero utilization and {@link U1}.
|
|
22
|
+
**/
|
|
23
|
+
Rslope1: Bps;
|
|
24
|
+
/**
|
|
25
|
+
* Rate added between {@link U1} and {@link U2}.
|
|
26
|
+
**/
|
|
27
|
+
Rslope2: Bps;
|
|
28
|
+
/**
|
|
29
|
+
* Rate added between {@link U2} and full utilization.
|
|
30
|
+
**/
|
|
31
|
+
Rslope3: Bps;
|
|
32
|
+
/**
|
|
33
|
+
* Whether borrowing past {@link U2} is forbidden.
|
|
34
|
+
**/
|
|
35
|
+
isBorrowingMoreU2Forbidden: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Base rate borrowers pay at a given utilization, in basis points, following
|
|
39
|
+
* the linear interest rate model's three segments.
|
|
40
|
+
*
|
|
41
|
+
* The result excludes the per-credit-manager interest fee: the model belongs to
|
|
42
|
+
* the pool, and every credit manager of a market can charge a different one.
|
|
43
|
+
**/
|
|
44
|
+
declare function borrowRateAtUtilization(utilization: Bps, params: RateModelParams): Bps;
|
|
45
|
+
/**
|
|
46
|
+
* Rate depositors earn at a given utilization, in basis points: the interest
|
|
47
|
+
* borrowers pay, spread over the pool's whole liquidity.
|
|
48
|
+
**/
|
|
49
|
+
declare function supplyRateAtUtilization(utilization: Bps, params: RateModelParams): Bps;
|
|
50
|
+
/**
|
|
51
|
+
* Utilizations the rate curve is sampled at: a fixed grid plus both kinks of
|
|
52
|
+
* the model, so the borrow leg is exact and the supply leg — which is
|
|
53
|
+
* quadratic between kinks — is smooth.
|
|
54
|
+
**/
|
|
55
|
+
declare function rateCurveUtilizations(params: RateModelParams): Bps[];
|
|
56
|
+
//#endregion
|
|
57
|
+
export { RateModelParams, borrowRateAtUtilization, rateCurveUtilizations, supplyRateAtUtilization };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { Bps } from "../../../model/primitives.js";
|
|
1
2
|
import { AddressMap } from "../../utils/AddressMap.js";
|
|
2
3
|
import { CreditManagerDebtParams, IBaseContract } from "../../base/types.js";
|
|
4
|
+
import "../../../model/index.js";
|
|
3
5
|
import { IRWAFactory } from "../rwa/types.js";
|
|
4
6
|
import { InterestRateModelStateHuman, PoolStateHuman, RateKeeperStateHuman } from "../../types/state-human.js";
|
|
5
7
|
import { PoolQuotaKeeperV310Contract } from "./PoolQuotaKeeperV310Contract.js";
|
|
@@ -119,6 +121,27 @@ interface IPoolContract extends IBaseContract {
|
|
|
119
121
|
* is an RWA token. `undefined` for regular ERC-20 underlyings.
|
|
120
122
|
*/
|
|
121
123
|
readonly rwaFactory: IRWAFactory | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* Liquidity currently drawn by credit managers, i.e. the part of the
|
|
126
|
+
* expected liquidity that is not sitting in the pool. Never negative.
|
|
127
|
+
*/
|
|
128
|
+
readonly borrowed: bigint;
|
|
129
|
+
/**
|
|
130
|
+
* Underlying the pool's shares are worth, converted at the current share
|
|
131
|
+
* rate. Unlike {@link totalSupply}, this is denominated in the underlying.
|
|
132
|
+
*/
|
|
133
|
+
readonly totalAssets: bigint;
|
|
134
|
+
/**
|
|
135
|
+
* Share of the pool's capital currently borrowed, in basis points.
|
|
136
|
+
*/
|
|
137
|
+
readonly utilization: Bps;
|
|
138
|
+
/**
|
|
139
|
+
* The token the pool's underlying wraps, or the underlying itself when it
|
|
140
|
+
* wraps nothing. An RWA market borrows a compliance wrapper that converts
|
|
141
|
+
* one-for-one with an ordinary token, and only that token means anything to
|
|
142
|
+
* a reader.
|
|
143
|
+
*/
|
|
144
|
+
readonly unwrappedUnderlying: Address;
|
|
122
145
|
stateHuman: (raw?: boolean) => PoolStateHuman;
|
|
123
146
|
/**
|
|
124
147
|
* Deposits underlying assets into the pool on behalf of a user with a
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { PriceFeedAnswer, PriceFeedTreeNode } from "../../base/types.js";
|
|
2
|
+
import { PriceFeedData } from "../../../model/opportunities.js";
|
|
3
|
+
import "../../../model/index.js";
|
|
2
4
|
import { PriceFeedStateHuman } from "../../types/state-human.js";
|
|
3
5
|
import { IPriceFeedContract, IUpdatablePriceFeedContract, PriceFeedContractType } from "./types.js";
|
|
4
6
|
import { PriceFeedRef } from "./PriceFeedRef.js";
|
|
@@ -35,6 +37,10 @@ declare abstract class AbstractPriceFeedContract<const abi extends Abi | readonl
|
|
|
35
37
|
get priceFeedType(): PriceFeedContractType;
|
|
36
38
|
stateHuman(raw?: boolean): UnionOmit<PriceFeedStateHuman, "stalenessPeriod">;
|
|
37
39
|
updatableDependencies(): IUpdatablePriceFeedContract[];
|
|
40
|
+
/**
|
|
41
|
+
* {@inheritDoc IPriceFeedContract.describe}
|
|
42
|
+
*/
|
|
43
|
+
describe(): PriceFeedData;
|
|
38
44
|
}
|
|
39
45
|
//#endregion
|
|
40
46
|
export { AbstractPriceFeedContract, PartialPriceFeedInitError, PartialPriceFeedTreeNode, PriceFeedConstructorArgs };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { IBaseContract, PriceFeedAnswer } from "../../base/types.js";
|
|
2
|
+
import { PriceFeedData } from "../../../model/opportunities.js";
|
|
3
|
+
import "../../../model/index.js";
|
|
2
4
|
import { PriceFeedStateHuman } from "../../types/state-human.js";
|
|
3
5
|
import { PriceFeedRef } from "./PriceFeedRef.js";
|
|
4
6
|
import { IPriceUpdateTx, RawTx } from "../../types/transactions.js";
|
|
@@ -77,6 +79,14 @@ interface IPriceFeedContract extends IBaseContract {
|
|
|
77
79
|
* including this feed itself when it is updatable.
|
|
78
80
|
**/
|
|
79
81
|
updatableDependencies: () => IUpdatablePriceFeedContract[];
|
|
82
|
+
/**
|
|
83
|
+
* Describes this feed and the feeds it reads from the way the shared read
|
|
84
|
+
* model does.
|
|
85
|
+
*
|
|
86
|
+
* A feed whose dependencies were never loaded is described as a leaf rather
|
|
87
|
+
* than throwing: the tree decorates a detail screen, nobody computes with it.
|
|
88
|
+
**/
|
|
89
|
+
describe: () => PriceFeedData;
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
82
92
|
* Extended price feed interface for feeds whose price can be refreshed
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { MultichainResult } from "../types/multichain.js";
|
|
2
|
+
import { PluginsMap } from "../plugins/types.js";
|
|
3
|
+
import "../plugins/index.js";
|
|
4
|
+
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
5
|
+
import "../../model/index.js";
|
|
6
|
+
import "../types/index.js";
|
|
7
|
+
import { MultichainConstruct } from "../base/MultichainConstruct.js";
|
|
8
|
+
import "../base/index.js";
|
|
9
|
+
//#region src/sdk/opportunities/MultichainOpportunitiesService.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Cross-chain counterpart of {@link OpportunitiesService}.
|
|
12
|
+
*
|
|
13
|
+
* Fans out over every chain configured in {@link MultichainSDK}. A chain that
|
|
14
|
+
* fails is logged and skipped so one dead RPC does not empty the list; its
|
|
15
|
+
* failure is reported in {@link MultichainResult.meta}.
|
|
16
|
+
*
|
|
17
|
+
* Detail reads need no fan-out: an opportunity key names its chain.
|
|
18
|
+
*
|
|
19
|
+
* @typeParam Plugins - Map of attached plugin types.
|
|
20
|
+
**/
|
|
21
|
+
declare class MultichainOpportunitiesService<const Plugins extends PluginsMap = {}> extends MultichainConstruct<Plugins> {
|
|
22
|
+
#private;
|
|
23
|
+
/**
|
|
24
|
+
* Opportunities of all queried chains, see {@link OpportunitiesService.list}.
|
|
25
|
+
*
|
|
26
|
+
* A filter that names chains narrows the fan-out itself, so chains whose rows
|
|
27
|
+
* would be discarded are never queried and never appear in the meta.
|
|
28
|
+
**/
|
|
29
|
+
list(filter?: OpportunityFilter): Promise<MultichainResult<Opportunity[]>>;
|
|
30
|
+
/**
|
|
31
|
+
* {@inheritDoc OpportunitiesService.getPool}
|
|
32
|
+
**/
|
|
33
|
+
getPool(key: PoolOpportunityKey): Promise<PoolOpportunityDetail>;
|
|
34
|
+
/**
|
|
35
|
+
* {@inheritDoc OpportunitiesService.getStrategy}
|
|
36
|
+
**/
|
|
37
|
+
getStrategy(key: StrategyOpportunityKey): Promise<StrategyOpportunityDetail>;
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { MultichainOpportunitiesService };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Opportunity, OpportunityFilter, PoolOpportunityDetail, PoolOpportunityKey, StrategyOpportunityDetail, StrategyOpportunityKey } from "../../model/opportunities.js";
|
|
2
|
+
import "../../model/index.js";
|
|
3
|
+
import { SDKConstruct } from "../base/SDKConstruct.js";
|
|
4
|
+
import "../base/index.js";
|
|
5
|
+
//#region src/sdk/opportunities/OpportunitiesService.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Builds the `opportunities` read model from the chain.
|
|
8
|
+
*
|
|
9
|
+
* Everything except the credit-account totals comes from the market state the
|
|
10
|
+
* SDK already holds, so a list costs one RPC round-trip at most. Yield figures
|
|
11
|
+
* that fold in incentives, points or history are deliberately absent: they are
|
|
12
|
+
* the backend's job, and this service never guesses them.
|
|
13
|
+
*
|
|
14
|
+
* The rows themselves are assembled by the market wrappers — see
|
|
15
|
+
* {@link MarketSuite.opportunities} — because every value in them is market
|
|
16
|
+
* state. What is left here is the one thing no single market can answer: how
|
|
17
|
+
* much the credit accounts of a strategy are worth.
|
|
18
|
+
**/
|
|
19
|
+
declare class OpportunitiesService extends SDKConstruct {
|
|
20
|
+
#private;
|
|
21
|
+
/**
|
|
22
|
+
* Every pool and strategy of every loaded market on this chain.
|
|
23
|
+
*
|
|
24
|
+
* Strategies are measured by the value locked in their credit accounts, so
|
|
25
|
+
* the list issues one credit-account query unless the filter rules strategies
|
|
26
|
+
* out entirely.
|
|
27
|
+
*
|
|
28
|
+
* @param filter - Optional narrowing, applied to the built rows.
|
|
29
|
+
**/
|
|
30
|
+
list(filter?: OpportunityFilter): Promise<Opportunity[]>;
|
|
31
|
+
/**
|
|
32
|
+
* A single pool opportunity plus its interest rate curve and quotas.
|
|
33
|
+
*
|
|
34
|
+
* @throws If no loaded market has this pool.
|
|
35
|
+
**/
|
|
36
|
+
getPool(key: PoolOpportunityKey): Promise<PoolOpportunityDetail>;
|
|
37
|
+
/**
|
|
38
|
+
* A single strategy opportunity plus the rate curve of the pool it borrows
|
|
39
|
+
* from and the price feeds its liquidation price depends on.
|
|
40
|
+
*
|
|
41
|
+
* @throws If the credit manager is unknown, or does not accept the requested
|
|
42
|
+
* collateral as a strategy.
|
|
43
|
+
**/
|
|
44
|
+
getStrategy(key: StrategyOpportunityKey): Promise<StrategyOpportunityDetail>;
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { OpportunitiesService };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps } from "../market/math.js";
|
|
2
|
+
import { MultichainOpportunitiesService } from "./MultichainOpportunitiesService.js";
|
|
3
|
+
import { OpportunitiesService } from "./OpportunitiesService.js";
|
|
4
|
+
export { MultichainOpportunitiesService, OpportunitiesService, additionalBorrowApyBps, borrowApyBps, maxLeverage, rayToBps, usdToNumber, utilizationBps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ILogger, LogFn } from "./logger.js";
|
|
2
|
+
import { MultichainNetworkMeta, MultichainNetworkProps, MultichainNetworksProps, MultichainResult, WithMultichain } from "./multichain.js";
|
|
2
3
|
import { AddressProviderV3StateHuman, AliasLossPolicyStateHuman, AssetPriceFeedStateHuman, BalancerWeightedPriceFeedStateHuman, BaseContractStateHuman, BasePriceFeedStateHuman, BotListStateHuman, BoundedOracleStateHuman, ConstantOracleStateHuman, CoreStateHuman, CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerDebtParamsHuman, CreditManagerStateHuman, CreditSuiteStateHuman, GaugeParamsHuman, GaugeStateHuman, GearStakingV3StateHuman, GearboxStateHuman, InterestRateModelStateHuman, LPPriceFeedStateHuman, LinearInterestRateModelStateHuman, LossPolicyStateHuman, MarketStateHuman, MultichainStateHuman, PoolQuotaKeeperStateHuman, PoolStateHuman, PoolSuiteStateHuman, PriceFeedStateHuman, PriceOracleStateHuman, QuotaParamsHuman, RateKeeperStateHuman, RedstonePriceFeedStateHuman, TumblerStateHuman, ZapperStateHuman } from "./state-human.js";
|
|
3
4
|
import { ContractMethod, IPriceUpdateTx, MultiCall, RawTx } from "./transactions.js";
|
|
4
5
|
import { GearboxState, MultichainState } from "./state.js";
|
|
5
|
-
export type { AddressProviderV3StateHuman, AliasLossPolicyStateHuman, AssetPriceFeedStateHuman, BalancerWeightedPriceFeedStateHuman, BaseContractStateHuman, BasePriceFeedStateHuman, BotListStateHuman, BoundedOracleStateHuman, ConstantOracleStateHuman, ContractMethod, CoreStateHuman, CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerDebtParamsHuman, CreditManagerStateHuman, CreditSuiteStateHuman, GaugeParamsHuman, GaugeStateHuman, GearStakingV3StateHuman, GearboxState, GearboxStateHuman, ILogger, IPriceUpdateTx, InterestRateModelStateHuman, LPPriceFeedStateHuman, LinearInterestRateModelStateHuman, LogFn, LossPolicyStateHuman, MarketStateHuman, MultiCall, MultichainState, MultichainStateHuman, PoolQuotaKeeperStateHuman, PoolStateHuman, PoolSuiteStateHuman, PriceFeedStateHuman, PriceOracleStateHuman, QuotaParamsHuman, RateKeeperStateHuman, RawTx, RedstonePriceFeedStateHuman, TumblerStateHuman, ZapperStateHuman };
|
|
6
|
+
export type { AddressProviderV3StateHuman, AliasLossPolicyStateHuman, AssetPriceFeedStateHuman, BalancerWeightedPriceFeedStateHuman, BaseContractStateHuman, BasePriceFeedStateHuman, BotListStateHuman, BoundedOracleStateHuman, ConstantOracleStateHuman, ContractMethod, CoreStateHuman, CreditConfiguratorStateHuman, CreditFacadeStateHuman, CreditManagerDebtParamsHuman, CreditManagerStateHuman, CreditSuiteStateHuman, GaugeParamsHuman, GaugeStateHuman, GearStakingV3StateHuman, GearboxState, GearboxStateHuman, ILogger, IPriceUpdateTx, InterestRateModelStateHuman, LPPriceFeedStateHuman, LinearInterestRateModelStateHuman, LogFn, LossPolicyStateHuman, MarketStateHuman, MultiCall, MultichainNetworkMeta, MultichainNetworkProps, MultichainNetworksProps, MultichainResult, MultichainState, MultichainStateHuman, PoolQuotaKeeperStateHuman, PoolStateHuman, PoolSuiteStateHuman, PriceFeedStateHuman, PriceOracleStateHuman, QuotaParamsHuman, RateKeeperStateHuman, RawTx, RedstonePriceFeedStateHuman, TumblerStateHuman, WithMultichain, ZapperStateHuman };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { NetworkType } from "../chain/chains.js";
|
|
2
|
+
//#region src/sdk/types/multichain.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Selects the chain for single-account methods of a multichain service.
|
|
5
|
+
**/
|
|
6
|
+
interface MultichainNetworkProps {
|
|
7
|
+
/**
|
|
8
|
+
* Network the entity lives on.
|
|
9
|
+
**/
|
|
10
|
+
network: NetworkType;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Restricts which chains a multichain list method queries.
|
|
14
|
+
**/
|
|
15
|
+
interface MultichainNetworksProps {
|
|
16
|
+
/**
|
|
17
|
+
* Networks to query. All chains configured in {@link MultichainSDK} when
|
|
18
|
+
* omitted.
|
|
19
|
+
**/
|
|
20
|
+
networks?: NetworkType[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Adds chain-scoping props `T` only when the service spans multiple chains.
|
|
24
|
+
**/
|
|
25
|
+
type WithMultichain<Multichain extends boolean, T extends object> = Multichain extends true ? T : {};
|
|
26
|
+
/**
|
|
27
|
+
* Outcome of a fan-out request on a single chain.
|
|
28
|
+
**/
|
|
29
|
+
interface MultichainNetworkMeta {
|
|
30
|
+
/**
|
|
31
|
+
* Network the request was sent to.
|
|
32
|
+
**/
|
|
33
|
+
network: NetworkType;
|
|
34
|
+
/**
|
|
35
|
+
* Whether the per-chain request succeeded.
|
|
36
|
+
**/
|
|
37
|
+
status: "success" | "error";
|
|
38
|
+
/**
|
|
39
|
+
* Rejection reason of the per-chain request. Only set when
|
|
40
|
+
* {@link status} is `"error"`.
|
|
41
|
+
**/
|
|
42
|
+
error?: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Result of a multichain fan-out request: the combined payload of all
|
|
46
|
+
* successful chains plus the outcome of every queried chain.
|
|
47
|
+
*
|
|
48
|
+
* Methods with no payload use `MultichainResult<void>`, i.e. `result` is
|
|
49
|
+
* `undefined` and only {@link meta} carries information.
|
|
50
|
+
*
|
|
51
|
+
* @typeParam T - Combined payload type.
|
|
52
|
+
**/
|
|
53
|
+
interface MultichainResult<T> {
|
|
54
|
+
/**
|
|
55
|
+
* Combined payload of the chains that responded successfully. Chains that
|
|
56
|
+
* failed contribute nothing and are reported in {@link meta}.
|
|
57
|
+
**/
|
|
58
|
+
result: T;
|
|
59
|
+
/**
|
|
60
|
+
* Per-chain request outcome, one entry per queried chain.
|
|
61
|
+
**/
|
|
62
|
+
meta: MultichainNetworkMeta[];
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
export { MultichainNetworkMeta, MultichainNetworkProps, MultichainNetworksProps, MultichainResult, WithMultichain };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WithdrawalsState } from "../accounts/withdrawal-compressor/types.js";
|
|
2
1
|
import { NetworkType } from "../chain/chains.js";
|
|
2
|
+
import { WithdrawalsState } from "../accounts/withdrawal-compressor/types.js";
|
|
3
3
|
import { MarketData } from "../base/types.js";
|
|
4
4
|
import { PluginStatesMap, PluginsMap } from "../plugins/types.js";
|
|
5
5
|
import "../plugins/index.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region src/
|
|
1
|
+
//#region src/sdk/utils/bigint-math.d.ts
|
|
2
2
|
/**
|
|
3
3
|
* Utility namespace for common `bigint` operations.
|
|
4
4
|
*
|
|
@@ -16,20 +16,16 @@ declare class BigIntMath {
|
|
|
16
16
|
static abs: (x: bigint) => bigint;
|
|
17
17
|
/**
|
|
18
18
|
* Returns the greater of two bigint values.
|
|
19
|
-
*
|
|
20
|
-
* @
|
|
21
|
-
* @param b Second candidate value.
|
|
22
|
-
* @returns The larger value between `a` and `b`.
|
|
19
|
+
* @param values - The values to find the maximum of.
|
|
20
|
+
* @returns The maximum value.
|
|
23
21
|
*/
|
|
24
|
-
static max: (
|
|
22
|
+
static max: (...values: bigint[]) => bigint;
|
|
25
23
|
/**
|
|
26
24
|
* Returns the smaller of two bigint values.
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
* @param b Second candidate value.
|
|
30
|
-
* @returns The smaller value between `a` and `b`.
|
|
25
|
+
* @param values - The values to find the minimum of.
|
|
26
|
+
* @returns The minimum value.
|
|
31
27
|
*/
|
|
32
|
-
static min: (
|
|
28
|
+
static min: (...values: bigint[]) => bigint;
|
|
33
29
|
/**
|
|
34
30
|
* Returns the negative form of a bigint if it is currently positive.
|
|
35
31
|
*
|
|
@@ -2,6 +2,7 @@ import { AddressMap } from "./AddressMap.js";
|
|
|
2
2
|
import { AddressSet } from "./AddressSet.js";
|
|
3
3
|
import { AssetsMap } from "./AssetsMap.js";
|
|
4
4
|
import { functionArgsToMap, functionArgsToRecord, getFunctionSignature } from "./abi-decode.js";
|
|
5
|
+
import { BigIntMath } from "./bigint-math.js";
|
|
5
6
|
import { bytes32ToString } from "./bytes32ToString.js";
|
|
6
7
|
import { childLogger } from "./childLogger.js";
|
|
7
8
|
import { createRawTx } from "./createRawTx.js";
|
|
@@ -15,5 +16,5 @@ import { Methods, PartialRecord, SupportedValue, TypedObjectUtils } from "./mapp
|
|
|
15
16
|
import { RetryOptions, retry } from "./retry.js";
|
|
16
17
|
import { toAddress } from "./toAddress.js";
|
|
17
18
|
import { PickSomeRequired } from "./type-utils.js";
|
|
18
|
-
import { ZodAddress } from "./zod.js";
|
|
19
|
-
export { AddressMap, AddressSet, AssetsMap, EtherscanURLParam, FilterDustUSDOptions, IsDustOptions, Methods, PartialRecord, PickSomeRequired, RetryOptions, SupportedValue, TypedObjectUtils, ZodAddress, bytes32ToString, childLogger, createRawTx, etherscanApiUrl, etherscanUrl, filterDust, filterDustUSD, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, getFunctionSignature, hexEq, isDust, json_parse, json_stringify, numberWithCommas, percentFmt, rayToNumber, retry, shortAddress, shortHash, toAddress, toBN, toBigInt, toSignificant };
|
|
19
|
+
import { ZodAddress, ZodHex } from "./zod.js";
|
|
20
|
+
export { AddressMap, AddressSet, AssetsMap, BigIntMath, EtherscanURLParam, FilterDustUSDOptions, IsDustOptions, Methods, PartialRecord, PickSomeRequired, RetryOptions, SupportedValue, TypedObjectUtils, ZodAddress, ZodHex, bytes32ToString, childLogger, createRawTx, etherscanApiUrl, etherscanUrl, filterDust, filterDustUSD, fmtBinaryMask, formatBN, formatBNvalue, formatDuration, formatLeverage, formatNumberToString_, formatPercentage, formatTimestamp, functionArgsToMap, functionArgsToRecord, getFunctionSignature, hexEq, isDust, json_parse, json_stringify, numberWithCommas, percentFmt, rayToNumber, retry, shortAddress, shortHash, toAddress, toBN, toBigInt, toSignificant };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { Address } from "viem";
|
|
1
|
+
import { Address, Hex } from "viem";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
//#region src/sdk/utils/zod.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Like Address from abitype/zod, but converts an address into an address that is checksum encoded.
|
|
6
6
|
*/
|
|
7
7
|
declare const ZodAddress: () => z.ZodPipe<z.ZodString, z.ZodTransform<Address, string>>;
|
|
8
|
+
/**
|
|
9
|
+
* A `0x`-prefixed hex string, as viem's Hex.
|
|
10
|
+
*/
|
|
11
|
+
declare const ZodHex: () => z.ZodPipe<z.ZodString, z.ZodTransform<Hex, string>>;
|
|
8
12
|
//#endregion
|
|
9
|
-
export { ZodAddress };
|
|
13
|
+
export { ZodAddress, ZodHex };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/sdk",
|
|
3
|
-
"version": "14.12.0-next.
|
|
3
|
+
"version": "14.12.0-next.67",
|
|
4
4
|
"description": "Gearbox SDK",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,21 @@
|
|
|
29
29
|
"import": "./dist/esm/history/index.js",
|
|
30
30
|
"default": "./dist/cjs/history/index.js"
|
|
31
31
|
},
|
|
32
|
+
"./model": {
|
|
33
|
+
"types": "./dist/types/model/index.d.ts",
|
|
34
|
+
"import": "./dist/esm/model/index.js",
|
|
35
|
+
"default": "./dist/cjs/model/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./new-sdk": {
|
|
38
|
+
"types": "./dist/types/new-sdk/index.d.ts",
|
|
39
|
+
"import": "./dist/esm/new-sdk/index.js",
|
|
40
|
+
"default": "./dist/cjs/new-sdk/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./offchain": {
|
|
43
|
+
"types": "./dist/types/offchain/index.d.ts",
|
|
44
|
+
"import": "./dist/esm/offchain/index.js",
|
|
45
|
+
"default": "./dist/cjs/offchain/index.js"
|
|
46
|
+
},
|
|
32
47
|
"./plugins/*": {
|
|
33
48
|
"types": "./dist/types/plugins/*/index.d.ts",
|
|
34
49
|
"import": "./dist/esm/plugins/*/index.js",
|