@gearbox-protocol/sdk 13.3.0-next.3 → 13.3.1
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/charts/credit-manager-payload.js +16 -0
- package/dist/cjs/common-utils/charts/credit-manager.js +134 -0
- package/dist/cjs/common-utils/charts/credit-session.js +257 -0
- package/dist/cjs/common-utils/charts/credit-sessions-payload.js +16 -0
- package/dist/cjs/common-utils/charts/graph-payload.js +16 -0
- package/dist/cjs/common-utils/charts/index.js +36 -0
- package/dist/cjs/common-utils/charts/pool-payload.js +16 -0
- package/dist/cjs/common-utils/charts/pool.js +199 -0
- package/dist/cjs/common-utils/charts/token-data.js +91 -0
- package/dist/cjs/common-utils/index.js +4 -0
- package/dist/cjs/common-utils/static/index.js +28 -0
- package/dist/cjs/common-utils/static/migration-config.js +16 -0
- package/dist/cjs/common-utils/static/pool-config.js +16 -0
- package/dist/cjs/common-utils/static/strategy.js +16 -0
- package/dist/cjs/common-utils/static/trading-pair.js +16 -0
- package/dist/cjs/common-utils/utils/{assetsMath.js → assets-math.js} +13 -13
- package/dist/cjs/common-utils/utils/{bigintMath.js → bigint-math.js} +3 -3
- package/dist/cjs/common-utils/utils/creditAccount/{calcHealthFactor.js → calc-health-factor.js} +9 -9
- package/dist/cjs/common-utils/utils/creditAccount/{calcOverallAPY.js → calc-overall-apy.js} +8 -8
- package/dist/cjs/common-utils/utils/creditAccount/{calcQuotaBorrowRate.js → calc-quota-borrow-rate.js} +3 -3
- package/dist/cjs/common-utils/utils/creditAccount/{calcRelativeBaseBorrowRate.js → calc-relative-base-borrow-rate.js} +3 -3
- package/dist/cjs/common-utils/utils/creditAccount/debt.js +4 -4
- package/dist/cjs/common-utils/utils/creditAccount/{getTimeToLiquidation.js → get-time-to-liquidation.js} +3 -3
- package/dist/cjs/common-utils/utils/creditAccount/index.js +16 -16
- package/dist/cjs/common-utils/utils/creditAccount/{liquidationPrice.js → liquidation-price.js} +3 -3
- package/dist/cjs/common-utils/utils/creditAccount/{quotaUtils.js → quota-utils.js} +8 -8
- package/dist/cjs/common-utils/utils/creditAccount/sort.js +3 -3
- package/dist/cjs/common-utils/utils/index.js +6 -8
- package/dist/cjs/common-utils/utils/{priceMath.js → price-math.js} +3 -3
- package/dist/cjs/dev/AccountOpener.js +5 -45
- package/dist/cjs/plugins/zappers/ZappersPlugin.js +144 -0
- package/dist/cjs/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +6 -110
- package/dist/cjs/plugins/zappers/index.js +26 -0
- package/dist/cjs/plugins/zappers/package.json +1 -0
- package/dist/cjs/rewards/apy/index.js +24 -0
- package/dist/cjs/rewards/apy/output-details.js +16 -0
- package/dist/cjs/rewards/apy/output.js +16 -0
- package/dist/cjs/rewards/index.js +24 -0
- package/dist/cjs/rewards/package.json +1 -0
- package/dist/cjs/rewards/rewards/api.js +226 -0
- package/dist/cjs/rewards/rewards/apy.js +177 -0
- package/dist/cjs/rewards/rewards/common.js +16 -0
- package/dist/cjs/rewards/rewards/extra-apy.js +132 -0
- package/dist/cjs/rewards/rewards/index.js +28 -0
- package/dist/cjs/rewards/rewards/merkl-api.js +52 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +104 -462
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +5 -16
- package/dist/cjs/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/cjs/sdk/base/TokensMeta.js +32 -255
- package/dist/cjs/sdk/base/index.js +0 -2
- package/dist/cjs/sdk/chain/chains.js +1 -2
- package/dist/cjs/sdk/constants/index.js +2 -0
- package/dist/cjs/sdk/{base/token-types.js → constants/phantom-tokens.js} +3 -9
- package/dist/cjs/sdk/market/MarketRegister.js +2 -2
- package/dist/cjs/sdk/market/MarketSuite.js +0 -6
- package/dist/cjs/sdk/market/index.js +1 -3
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -17
- package/dist/cjs/sdk/market/pool/index.js +0 -4
- package/dist/cjs/sdk/pools/AbstractPoolService.js +137 -0
- package/dist/cjs/{abi/iStateSerializer.js → sdk/pools/PoolServiceV310.js} +8 -14
- package/dist/cjs/sdk/pools/createPoolService.js +35 -0
- package/dist/cjs/sdk/pools/index.js +4 -2
- package/dist/cjs/sdk/utils/AddressMap.js +1 -1
- package/dist/cjs/sdk/utils/viem/sendRawTx.js +0 -16
- package/dist/esm/common-utils/charts/credit-manager.js +115 -0
- package/dist/esm/common-utils/charts/credit-session.js +233 -0
- package/dist/esm/common-utils/charts/credit-sessions-payload.js +0 -0
- package/dist/esm/common-utils/charts/graph-payload.js +0 -0
- package/dist/esm/common-utils/charts/index.js +8 -0
- package/dist/esm/common-utils/charts/pool-payload.js +0 -0
- package/dist/esm/common-utils/charts/pool.js +179 -0
- package/dist/esm/common-utils/charts/token-data.js +67 -0
- package/dist/esm/common-utils/index.js +2 -0
- package/dist/esm/common-utils/static/index.js +4 -0
- package/dist/esm/common-utils/static/migration-config.js +0 -0
- package/dist/esm/common-utils/static/pool-config.js +0 -0
- package/dist/esm/common-utils/static/strategy.js +0 -0
- package/dist/esm/common-utils/static/trading-pair.js +0 -0
- package/dist/esm/common-utils/utils/{assetsMath.js → assets-math.js} +2 -2
- package/dist/esm/common-utils/utils/creditAccount/{calcHealthFactor.js → calc-health-factor.js} +2 -2
- package/dist/esm/common-utils/utils/creditAccount/{calcOverallAPY.js → calc-overall-apy.js} +1 -1
- package/dist/esm/common-utils/utils/creditAccount/debt.js +2 -2
- package/dist/esm/common-utils/utils/creditAccount/index.js +8 -8
- package/dist/esm/common-utils/utils/creditAccount/{quotaUtils.js → quota-utils.js} +1 -1
- package/dist/esm/common-utils/utils/creditAccount/sort.js +1 -1
- package/dist/esm/common-utils/utils/index.js +3 -4
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/plugins/zappers/ZappersPlugin.js +126 -0
- package/dist/esm/{sdk/market/ZapperRegister.js → plugins/zappers/extraZappers.js} +2 -109
- package/dist/esm/plugins/zappers/index.js +3 -0
- package/dist/esm/plugins/zappers/package.json +1 -0
- package/dist/esm/plugins/zappers/types.js +0 -0
- package/dist/esm/rewards/apy/index.js +2 -0
- package/dist/esm/rewards/apy/output-details.js +0 -0
- package/dist/esm/rewards/apy/output.js +0 -0
- package/dist/esm/rewards/index.js +2 -0
- package/dist/esm/rewards/package.json +1 -0
- package/dist/esm/rewards/rewards/api.js +204 -0
- package/dist/esm/rewards/rewards/apy.js +160 -0
- package/dist/esm/rewards/rewards/common.js +0 -0
- package/dist/esm/rewards/rewards/extra-apy.js +101 -0
- package/dist/esm/rewards/rewards/index.js +4 -0
- package/dist/esm/rewards/rewards/merkl-api.js +18 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +104 -462
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +5 -16
- package/dist/esm/sdk/base/ChainContractsRegister.js +1 -1
- package/dist/esm/sdk/base/TokensMeta.js +32 -261
- package/dist/esm/sdk/base/index.js +0 -1
- package/dist/esm/sdk/chain/chains.js +1 -2
- package/dist/esm/sdk/constants/index.js +1 -0
- package/dist/esm/sdk/{base/token-types.js → constants/phantom-tokens.js} +0 -4
- package/dist/esm/sdk/market/MarketRegister.js +2 -2
- package/dist/esm/sdk/market/MarketSuite.js +0 -6
- package/dist/esm/sdk/market/index.js +0 -1
- package/dist/esm/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +2 -17
- package/dist/esm/sdk/market/pool/index.js +0 -2
- package/dist/esm/sdk/pools/AbstractPoolService.js +113 -0
- package/dist/esm/sdk/pools/PoolServiceV310.js +6 -0
- package/dist/esm/sdk/pools/createPoolService.js +11 -0
- package/dist/esm/sdk/pools/index.js +2 -1
- package/dist/esm/sdk/utils/AddressMap.js +1 -1
- package/dist/esm/sdk/utils/viem/sendRawTx.js +1 -19
- package/dist/types/common-utils/charts/credit-manager-payload.d.ts +50 -0
- package/dist/types/common-utils/charts/credit-manager.d.ts +48 -0
- package/dist/types/common-utils/charts/credit-session.d.ts +111 -0
- package/dist/types/common-utils/charts/credit-sessions-payload.d.ts +111 -0
- package/dist/types/common-utils/charts/graph-payload.d.ts +10 -0
- package/dist/types/common-utils/charts/index.d.ts +8 -0
- package/dist/types/common-utils/charts/pool-payload.d.ts +111 -0
- package/dist/types/common-utils/charts/pool.d.ts +91 -0
- package/dist/types/common-utils/charts/token-data.d.ts +20 -0
- package/dist/types/common-utils/index.d.ts +2 -0
- package/dist/types/common-utils/static/index.d.ts +4 -0
- package/dist/types/common-utils/static/migration-config.d.ts +10 -0
- package/dist/types/common-utils/static/pool-config.d.ts +11 -0
- package/dist/types/common-utils/static/strategy.d.ts +78 -0
- package/dist/types/common-utils/static/trading-pair.d.ts +15 -0
- package/dist/types/common-utils/utils/creditAccount/index.d.ts +8 -8
- package/dist/types/common-utils/utils/index.d.ts +3 -4
- package/dist/types/plugins/zappers/ZappersPlugin.d.ts +18 -0
- package/dist/types/plugins/zappers/extraZappers.d.ts +6 -0
- package/dist/types/plugins/zappers/index.d.ts +3 -0
- package/dist/types/plugins/zappers/types.d.ts +12 -0
- package/dist/types/rewards/apy/index.d.ts +2 -0
- package/dist/types/rewards/apy/output-details.d.ts +96 -0
- package/dist/types/rewards/apy/output.d.ts +22 -0
- package/dist/types/rewards/index.d.ts +2 -0
- package/dist/types/rewards/rewards/api.d.ts +49 -0
- package/dist/types/rewards/rewards/apy.d.ts +41 -0
- package/dist/types/rewards/rewards/common.d.ts +16 -0
- package/dist/types/rewards/rewards/extra-apy.d.ts +30 -0
- package/dist/types/rewards/rewards/index.d.ts +4 -0
- package/dist/types/rewards/rewards/merkl-api.d.ts +45 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +27 -123
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +8 -108
- package/dist/types/sdk/base/TokensMeta.d.ts +18 -34
- package/dist/types/sdk/base/index.d.ts +0 -1
- package/dist/types/sdk/base/types.d.ts +1 -0
- package/dist/types/sdk/chain/chains.d.ts +1 -1
- package/dist/types/sdk/constants/index.d.ts +1 -0
- package/dist/types/sdk/constants/phantom-tokens.d.ts +2 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +2 -2
- package/dist/types/sdk/market/MarketSuite.d.ts +0 -3
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +0 -2
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/index.d.ts +0 -2
- package/dist/types/sdk/pools/AbstractPoolService.d.ts +9 -0
- package/dist/types/sdk/pools/PoolServiceV310.d.ts +4 -0
- package/dist/types/sdk/pools/createPoolService.d.ts +3 -0
- package/dist/types/sdk/pools/index.d.ts +2 -1
- package/dist/types/sdk/pools/types.d.ts +63 -84
- package/dist/types/sdk/utils/AddressMap.d.ts +1 -1
- package/dist/types/sdk/utils/viem/sendRawTx.d.ts +1 -5
- package/package.json +6 -1
- package/dist/cjs/abi/310/iSecuritizeDegenNFT.js +0 -263
- package/dist/cjs/abi/310/iSecuritizeKYCFactory.js +0 -278
- package/dist/cjs/common-utils/utils/endpoints.js +0 -65
- package/dist/cjs/sdk/market/pool/SecuritizeKYCFactory.js +0 -97
- package/dist/cjs/sdk/pools/PoolService.js +0 -391
- package/dist/esm/abi/310/iSecuritizeDegenNFT.js +0 -239
- package/dist/esm/abi/310/iSecuritizeKYCFactory.js +0 -254
- package/dist/esm/abi/iStateSerializer.js +0 -12
- package/dist/esm/common-utils/utils/endpoints.js +0 -41
- package/dist/esm/sdk/market/pool/SecuritizeKYCFactory.js +0 -73
- package/dist/esm/sdk/pools/PoolService.js +0 -371
- package/dist/types/abi/310/iSecuritizeDegenNFT.d.ts +0 -324
- package/dist/types/abi/310/iSecuritizeKYCFactory.d.ts +0 -322
- package/dist/types/abi/iStateSerializer.d.ts +0 -11
- package/dist/types/common-utils/utils/endpoints.d.ts +0 -27
- package/dist/types/sdk/base/token-types.d.ts +0 -33
- package/dist/types/sdk/market/ZapperRegister.d.ts +0 -17
- package/dist/types/sdk/market/pool/SecuritizeKYCFactory.d.ts +0 -345
- package/dist/types/sdk/market/types.d.ts +0 -10
- package/dist/types/sdk/pools/PoolService.d.ts +0 -14
- /package/dist/cjs/{sdk/market → plugins/zappers}/types.js +0 -0
- /package/dist/esm/{sdk/market/types.js → common-utils/charts/credit-manager-payload.js} +0 -0
- /package/dist/esm/common-utils/utils/{bigintMath.js → bigint-math.js} +0 -0
- /package/dist/esm/common-utils/utils/creditAccount/{calcQuotaBorrowRate.js → calc-quota-borrow-rate.js} +0 -0
- /package/dist/esm/common-utils/utils/creditAccount/{calcRelativeBaseBorrowRate.js → calc-relative-base-borrow-rate.js} +0 -0
- /package/dist/esm/common-utils/utils/creditAccount/{getTimeToLiquidation.js → get-time-to-liquidation.js} +0 -0
- /package/dist/esm/common-utils/utils/creditAccount/{liquidationPrice.js → liquidation-price.js} +0 -0
- /package/dist/esm/common-utils/utils/{priceMath.js → price-math.js} +0 -0
- /package/dist/types/common-utils/utils/{assetsMath.d.ts → assets-math.d.ts} +0 -0
- /package/dist/types/common-utils/utils/{bigintMath.d.ts → bigint-math.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{calcHealthFactor.d.ts → calc-health-factor.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{calcOverallAPY.d.ts → calc-overall-apy.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{calcQuotaBorrowRate.d.ts → calc-quota-borrow-rate.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{calcRelativeBaseBorrowRate.d.ts → calc-relative-base-borrow-rate.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{getTimeToLiquidation.d.ts → get-time-to-liquidation.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{liquidationPrice.d.ts → liquidation-price.d.ts} +0 -0
- /package/dist/types/common-utils/utils/creditAccount/{quotaUtils.d.ts → quota-utils.d.ts} +0 -0
- /package/dist/types/common-utils/utils/{priceMath.d.ts → price-math.d.ts} +0 -0
|
@@ -2,10 +2,10 @@ import type { Address } from "viem";
|
|
|
2
2
|
import type { CreditAccountData } from "../base/index.js";
|
|
3
3
|
import { SDKConstruct } from "../base/index.js";
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { OnDemandPriceUpdates, UpdatePriceFeedsResult } from "../market/index.js";
|
|
6
6
|
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
7
|
-
import type {
|
|
8
|
-
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult,
|
|
7
|
+
import type { MultiCall } from "../types/index.js";
|
|
8
|
+
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CreditAccountOperationResult, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, PriceUpdatesOptions, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
9
9
|
export interface CreditAccountServiceOptions {
|
|
10
10
|
batchSize?: number;
|
|
11
11
|
}
|
|
@@ -21,14 +21,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
21
21
|
* @returns
|
|
22
22
|
*/
|
|
23
23
|
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
24
|
-
/**
|
|
25
|
-
* Returns credit account data for a single account with the investor address resolved.
|
|
26
|
-
* Loads CA via getCreditAccountData; for KYC underlyings fetches the investor from the KYC factory's getInvestor(creditAccount), otherwise uses the account owner.
|
|
27
|
-
* @param account - Credit account address
|
|
28
|
-
* @param blockNumber - Optional block number for the read
|
|
29
|
-
* @returns CreditAccountDataWithInvestor (CA data + investor address), or undefined if the account is not found
|
|
30
|
-
*/
|
|
31
|
-
getCreditAccountDataWithInvestor(account: Address, blockNumber?: bigint): Promise<CreditAccountDataWithInvestor | undefined>;
|
|
32
24
|
/**
|
|
33
25
|
* Methods to get all credit accounts with some optional filtering
|
|
34
26
|
* Performs all necessary price feed updates under the hood
|
|
@@ -37,31 +29,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
37
29
|
* @param blockNumber
|
|
38
30
|
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
39
31
|
*/
|
|
40
|
-
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint
|
|
41
|
-
/**
|
|
42
|
-
* Returns all credit accounts matching the filter, with investor set on each item.
|
|
43
|
-
* Delegates to getCreditAccounts; when options.owner is set, also loads KYC credit accounts for that owner and merges them into the list. Result is sorted by health factor ascending.
|
|
44
|
-
* @param options - Filter options (owner, creditManager, health factor, etc.)
|
|
45
|
-
* @param blockNumber - Optional block number for the read
|
|
46
|
-
* @returns Array of credit accounts (with investor field), sorted by health factor ascending
|
|
47
|
-
*/
|
|
48
|
-
getCreditAccountsWithInvestor(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountDataWithInvestor>>;
|
|
49
|
-
protected getKYCCreditAccountsOfOwner(owner: Address, priceUpdateTxs: IPriceUpdateTx<{
|
|
50
|
-
priceFeed: `0x${string}`;
|
|
51
|
-
timestamp: number;
|
|
52
|
-
}>[], blockNumber?: bigint): Promise<Array<CreditAccountDataWithInvestor>>;
|
|
53
|
-
/**
|
|
54
|
-
* Loads credit account data for the given addresses using simulateWithPriceUpdates.
|
|
55
|
-
* Applies the provided price update txs before reading, so returned data is consistent with up-to-date prices.
|
|
56
|
-
* @param accounts - Credit account addresses to load
|
|
57
|
-
* @param priceUpdateTxs - Price feed update txs to simulate before the read (e.g. from generatePriceFeedsUpdateTxs)
|
|
58
|
-
* @param blockNumber - Optional block number for the read
|
|
59
|
-
* @returns Array of CreditAccountData in the same order as accounts (throws if any getCreditAccountData call reverts)
|
|
60
|
-
*/
|
|
61
|
-
loadSpecifiedAccounts(accounts: Address[], priceUpdateTxs: IPriceUpdateTx<{
|
|
62
|
-
priceFeed: `0x${string}`;
|
|
63
|
-
timestamp: number;
|
|
64
|
-
}>[], blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
32
|
+
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
65
33
|
/**
|
|
66
34
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards)
|
|
67
35
|
Assosiates rewards by adapter + stakedPhantomToken
|
|
@@ -136,7 +104,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
136
104
|
positive value for debt increase.
|
|
137
105
|
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
138
106
|
*/
|
|
139
|
-
changeDebt({ creditAccount, amount,
|
|
107
|
+
changeDebt({ creditAccount, amount, addCollateral, }: ChangeDeptProps): Promise<CreditAccountOperationResult>;
|
|
140
108
|
/**
|
|
141
109
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
142
110
|
- Swap is executed in the following order: price update -> execute swap path -> update quotas
|
|
@@ -173,25 +141,31 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
173
141
|
* @returns
|
|
174
142
|
*/
|
|
175
143
|
claimDelayed({ creditAccount, minQuota, averageQuota, claimableNow, }: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
176
|
-
/**
|
|
177
|
-
* Returns address to which approval should be given on collateral token
|
|
178
|
-
* It's credit manager for classical markets and special wallet for KYC markets
|
|
179
|
-
* @param options - {@link GetApprovalAddressProps}
|
|
180
|
-
* @returns
|
|
181
|
-
**/
|
|
182
|
-
getApprovalAddress(options: GetApprovalAddressProps): Promise<Address>;
|
|
183
144
|
/**
|
|
184
145
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
146
|
+
- Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
147
|
+
-> update quotas -> (optionally: execute swap path for trading/strategy) ->
|
|
148
|
+
-> (optionally: withdraw debt for lending)
|
|
149
|
+
- Basic open credit account: price update -> increase debt -> add collateral -> update quotas
|
|
150
|
+
- Lending: price update -> increase debt -> add collateral -> update quotas -> withdraw debt
|
|
151
|
+
- Strategy/trading: price update -> increase debt -> add collateral -> update quotas -> execute swap path
|
|
152
|
+
- In strategy is possible situation when collateral is added, but not swapped; the only swapped value in this case will be debt
|
|
153
|
+
* @param {bigint} ethAmount - native token amount to attach to tx
|
|
154
|
+
* @param {Address} creditManager - address of credit manager to open credit account on
|
|
155
|
+
* @param {Array<Asset>} collateral - array of collateral which can be just directly added or swapped using the path {@link Asset}
|
|
156
|
+
* @param {Record<Address, PermitResult>} permits - permits of collateral tokens (in any permittable token is present) {@link PermitResult}
|
|
157
|
+
* @param {bigint} debt - debt to open credit account with
|
|
158
|
+
* @param {boolean} withdrawDebt - flag to withdraw debt to wallet after opening credit account;
|
|
159
|
+
used for borrowing functionality
|
|
160
|
+
* @param {bigint} referralCode - referral code to open credit account with
|
|
161
|
+
* @param {Address} to - wallet address to transfer credit account to\
|
|
162
|
+
* @param {Array<MultiCall>} calls - array of MultiCall from router methods findOpenStrategyPath {@link MultiCall}.
|
|
163
|
+
Used for trading and strategy functionality
|
|
164
|
+
* @param {Array<Asset>} averageQuota - average quota for tokens after open {@link Asset}
|
|
165
|
+
* @param {Array<Asset>} minQuota - minimum quota for tokens after open {@link Asset}
|
|
192
166
|
* @returns All necessary data to execute the transaction (call, credit facade)
|
|
193
|
-
|
|
194
|
-
openCA(
|
|
167
|
+
*/
|
|
168
|
+
openCA({ ethAmount, creditManager, collateral, permits, debt, withdrawDebt, referralCode, to, calls: openPathCalls, minQuota, averageQuota, }: OpenCAProps): Promise<CreditAccountOperationResult>;
|
|
195
169
|
/**
|
|
196
170
|
* Returns borrow rate with 4 digits precision (10000 = 100%)
|
|
197
171
|
* @param ca
|
|
@@ -203,42 +177,6 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
203
177
|
* @param ca
|
|
204
178
|
*/
|
|
205
179
|
getOptimalHFForPartialLiquidation(ca: CreditAccountData): bigint;
|
|
206
|
-
/**
|
|
207
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
208
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
209
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
210
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
211
|
-
* @param creditManager - Credit manager address
|
|
212
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
213
|
-
*/
|
|
214
|
-
getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
215
|
-
/**
|
|
216
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
217
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
218
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
219
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
220
|
-
* @param creditManager - Credit manager address
|
|
221
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
222
|
-
*/
|
|
223
|
-
getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
224
|
-
/**
|
|
225
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
226
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
227
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
228
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
229
|
-
* @param creditManager - Credit manager address
|
|
230
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
231
|
-
*/
|
|
232
|
-
getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
233
|
-
/**
|
|
234
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
235
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
236
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
237
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
238
|
-
* @param creditManager - Credit manager address
|
|
239
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
240
|
-
*/
|
|
241
|
-
getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
242
180
|
/**
|
|
243
181
|
* Returns raw txs that are needed to update all price feeds so that all credit accounts (possibly from different markets) compute
|
|
244
182
|
*
|
|
@@ -274,38 +212,4 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
274
212
|
private get marketConfigurators();
|
|
275
213
|
private get rewardCompressor();
|
|
276
214
|
private get peripheryCompressor();
|
|
277
|
-
/**
|
|
278
|
-
* Wrapper that selects between credit facade and KYC factory
|
|
279
|
-
* @param suite
|
|
280
|
-
* @param to
|
|
281
|
-
* @param calls
|
|
282
|
-
* @param referralCode
|
|
283
|
-
* @returns
|
|
284
|
-
*/
|
|
285
|
-
protected openCreditAccountTx(suite: CreditSuite, to: Address, calls: MultiCall[], referralCode?: bigint): Promise<RawTx>;
|
|
286
|
-
/**
|
|
287
|
-
* Wrapper that selects between credit facade and KYC factory
|
|
288
|
-
* @param suite
|
|
289
|
-
* @param creditAccount
|
|
290
|
-
* @param calls
|
|
291
|
-
* @returns
|
|
292
|
-
*/
|
|
293
|
-
protected multicallTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[]): Promise<RawTx>;
|
|
294
|
-
/**
|
|
295
|
-
* Wrapper that selects between credit facade and KYC factory
|
|
296
|
-
* @param suite
|
|
297
|
-
* @param creditAccount
|
|
298
|
-
* @param calls
|
|
299
|
-
* @param operation
|
|
300
|
-
* @returns
|
|
301
|
-
*/
|
|
302
|
-
protected closeCreditAccountTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[], operation: CloseOptions): Promise<RawTx>;
|
|
303
|
-
/**
|
|
304
|
-
* Returns all KYC credit account addresses for an investor across the given market suites.
|
|
305
|
-
* Resolves KYC factory per suite, then multicalls each factory's getCreditAccounts(investor).
|
|
306
|
-
* @param investor - Owner address to query
|
|
307
|
-
* @param suites - Market suites (KYC factories are resolved for each; undefined entries are skipped)
|
|
308
|
-
* @returns Flat array of credit account addresses from all KYC markets
|
|
309
|
-
*/
|
|
310
|
-
protected getKYCCaOfInvestor(investor: Address, suites: Array<MarketSuite | undefined>): Promise<`0x${string}`[]>;
|
|
311
215
|
}
|
|
@@ -12,7 +12,7 @@ export declare class CreditAccountServiceV310 extends AbstractCreditAccountServi
|
|
|
12
12
|
/**
|
|
13
13
|
* Implements {@link ICreditAccountsService.repayCreditAccount}
|
|
14
14
|
*/
|
|
15
|
-
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim,
|
|
15
|
+
repayCreditAccount({ operation, collateralAssets, assetsToWithdraw, creditAccount: ca, permits, to, tokensToClaim, }: RepayCreditAccountProps): Promise<CreditAccountOperationResult>;
|
|
16
16
|
/**
|
|
17
17
|
* Implements {@link ICreditAccountsService.repayAndLiquidateCreditAccount}
|
|
18
18
|
*/
|
|
@@ -5,7 +5,7 @@ import type { ConnectedBotData, Construct, CreditAccountData } from "../base/ind
|
|
|
5
5
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
6
6
|
import type { CreditSuite, OnDemandPriceUpdates, UpdatePriceFeedsResult } from "../market/index.js";
|
|
7
7
|
import type { Asset, CreditAccountTokensSlice, RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
8
|
-
import type {
|
|
8
|
+
import type { MultiCall, RawTx } from "../types/index.js";
|
|
9
9
|
export type GetCreditAccountsArgs = ContractFunctionArgs<typeof creditAccountCompressorAbi, "pure" | "view", "getCreditAccounts">;
|
|
10
10
|
export interface CreditAccountFilter {
|
|
11
11
|
owner: Address;
|
|
@@ -83,10 +83,6 @@ export interface CloseCreditAccountProps {
|
|
|
83
83
|
closePath?: RouterCloseResult;
|
|
84
84
|
}
|
|
85
85
|
export interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
|
|
86
|
-
/**
|
|
87
|
-
* Swap calls for repay
|
|
88
|
-
*/
|
|
89
|
-
calls?: Array<MultiCall>;
|
|
90
86
|
/**
|
|
91
87
|
* close or zeroDebt
|
|
92
88
|
*/
|
|
@@ -267,9 +263,8 @@ export interface OpenCAProps extends PrepareUpdateQuotasProps {
|
|
|
267
263
|
/**
|
|
268
264
|
* Flag to withdraw debt to wallet after opening credit account;
|
|
269
265
|
* used for borrowing functionality
|
|
270
|
-
* If true, will withdraw underlying token, otherwise will withdraw specified token
|
|
271
266
|
*/
|
|
272
|
-
|
|
267
|
+
withdrawDebt?: boolean;
|
|
273
268
|
/**
|
|
274
269
|
* Permits of collateral tokens (in any permittable token is present) {@link PermitResult}
|
|
275
270
|
*/
|
|
@@ -279,19 +274,10 @@ export interface OpenCAProps extends PrepareUpdateQuotasProps {
|
|
|
279
274
|
* Used for trading and strategy functionality
|
|
280
275
|
*/
|
|
281
276
|
calls: Array<MultiCall>;
|
|
282
|
-
/**
|
|
283
|
-
* Slot for optional call to execute after main tx.
|
|
284
|
-
* For example: add bots
|
|
285
|
-
*/
|
|
286
|
-
callsAfter?: Array<MultiCall>;
|
|
287
277
|
/**
|
|
288
278
|
* Address of credit manager to open credit account on
|
|
289
279
|
*/
|
|
290
280
|
creditManager: Address;
|
|
291
|
-
/**
|
|
292
|
-
* Optional address of credit account to reopen
|
|
293
|
-
*/
|
|
294
|
-
reopenCreditAccount?: Address;
|
|
295
281
|
/**
|
|
296
282
|
* Wallet address to transfer credit account to
|
|
297
283
|
*/
|
|
@@ -314,13 +300,9 @@ export interface ChangeDeptProps {
|
|
|
314
300
|
*/
|
|
315
301
|
amount: bigint;
|
|
316
302
|
/**
|
|
317
|
-
*
|
|
303
|
+
* If true, will add collateral to the credit account
|
|
318
304
|
*/
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Assets to wrap
|
|
322
|
-
*/
|
|
323
|
-
wrapAsset?: [Asset];
|
|
305
|
+
addCollateral: boolean;
|
|
324
306
|
}
|
|
325
307
|
export interface FullyLiquidateProps {
|
|
326
308
|
/**
|
|
@@ -436,19 +418,6 @@ export interface LlamathenaProportionalWithdrawProps extends PrepareUpdateQuotas
|
|
|
436
418
|
*/
|
|
437
419
|
creditAccount: RouterCASlice;
|
|
438
420
|
}
|
|
439
|
-
/**
|
|
440
|
-
* Options to get approval address for collateral token
|
|
441
|
-
*/
|
|
442
|
-
export type GetApprovalAddressProps = {
|
|
443
|
-
creditManager: Address;
|
|
444
|
-
borrower: Address;
|
|
445
|
-
} | {
|
|
446
|
-
creditManager: Address;
|
|
447
|
-
creditAccount: Address;
|
|
448
|
-
};
|
|
449
|
-
export type CreditAccountDataWithInvestor = CreditAccountData & {
|
|
450
|
-
investor: Address;
|
|
451
|
-
};
|
|
452
421
|
export interface ICreditAccountsService extends Construct {
|
|
453
422
|
sdk: GearboxSDK;
|
|
454
423
|
/**
|
|
@@ -459,41 +428,15 @@ export interface ICreditAccountsService extends Construct {
|
|
|
459
428
|
* @returns
|
|
460
429
|
*/
|
|
461
430
|
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
462
|
-
/**
|
|
463
|
-
* Returns credit account data for a single account with the investor address resolved (from KYC factory when applicable).
|
|
464
|
-
* @param account - Credit account address
|
|
465
|
-
* @param blockNumber - Optional block number for the read
|
|
466
|
-
* @returns CreditAccountDataWithInvestor, or undefined if the account is not found
|
|
467
|
-
*/
|
|
468
|
-
getCreditAccountDataWithInvestor(account: Address, blockNumber?: bigint): Promise<CreditAccountDataWithInvestor | undefined>;
|
|
469
431
|
/**
|
|
470
432
|
* Methods to get all credit accounts with some optional filtering
|
|
471
433
|
* Performs all necessary price feed updates under the hood
|
|
472
434
|
*
|
|
473
435
|
* @param options
|
|
474
436
|
* @param blockNumber
|
|
475
|
-
* @
|
|
476
|
-
* @returns Credit accounts sorted by health factor ascending
|
|
477
|
-
*/
|
|
478
|
-
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint, priceUpdate?: UpdatePriceFeedsResult): Promise<Array<CreditAccountData>>;
|
|
479
|
-
/**
|
|
480
|
-
* Returns all credit accounts matching the filter with investor set on each; when options.owner is set, includes KYC CAs for that owner.
|
|
481
|
-
* @param options - Filter options (owner, creditManager, health factor, etc.)
|
|
482
|
-
* @param blockNumber - Optional block number for the read
|
|
483
|
-
* @returns Credit accounts (with investor) sorted by health factor ascending
|
|
484
|
-
*/
|
|
485
|
-
getCreditAccountsWithInvestor(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountDataWithInvestor>>;
|
|
486
|
-
/**
|
|
487
|
-
* Loads credit account data for the given addresses using simulateWithPriceUpdates (with price updates applied before the read).
|
|
488
|
-
* @param accounts - Credit account addresses to load
|
|
489
|
-
* @param priceUpdateTxs - Price feed update txs to simulate before the read (e.g. from generatePriceFeedsUpdateTxs)
|
|
490
|
-
* @param blockNumber - Optional block number for the read
|
|
491
|
-
* @returns Array of CreditAccountData in the same order as accounts
|
|
437
|
+
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
492
438
|
*/
|
|
493
|
-
|
|
494
|
-
priceFeed: `0x${string}`;
|
|
495
|
-
timestamp: number;
|
|
496
|
-
}>[], blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
439
|
+
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
497
440
|
/**
|
|
498
441
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards)
|
|
499
442
|
* Assosiates rewards by adapter + stakedPhantomToken
|
|
@@ -522,9 +465,9 @@ export interface ICreditAccountsService extends Construct {
|
|
|
522
465
|
/**
|
|
523
466
|
* Generates transaction to liquidate credit account
|
|
524
467
|
* @param props - {@link FullyLiquidateProps}
|
|
525
|
-
* @returns
|
|
468
|
+
* @returns
|
|
526
469
|
*/
|
|
527
|
-
fullyLiquidate(props: FullyLiquidateProps): Promise<
|
|
470
|
+
fullyLiquidate(props: FullyLiquidateProps): Promise<CloseCreditAccountResult>;
|
|
528
471
|
/**
|
|
529
472
|
* Closes credit account or closes credit account and keeps it open with zero debt.
|
|
530
473
|
* - Ca is closed in the following order: price update -> close path to swap all tokens into underlying ->
|
|
@@ -587,13 +530,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
587
530
|
* @returns
|
|
588
531
|
*/
|
|
589
532
|
claimDelayed(props: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
590
|
-
/**
|
|
591
|
-
* Returns address to which approval should be given on collateral token
|
|
592
|
-
* It's credit manager for classical markets and special wallet for KYC markets
|
|
593
|
-
* @param props - {@link GetApprovalAddressProps}
|
|
594
|
-
* @returns
|
|
595
|
-
*/
|
|
596
|
-
getApprovalAddress(props: GetApprovalAddressProps): Promise<Address>;
|
|
597
533
|
/**
|
|
598
534
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
599
535
|
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
@@ -638,42 +574,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
638
574
|
* @returns
|
|
639
575
|
*/
|
|
640
576
|
getPriceUpdatesForFacade(options: PriceUpdatesOptions): Promise<Array<MultiCall>>;
|
|
641
|
-
/**
|
|
642
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
643
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
644
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
645
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
646
|
-
* @param creditManager - Credit manager address
|
|
647
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
648
|
-
*/
|
|
649
|
-
getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
650
|
-
/**
|
|
651
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
652
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
653
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
654
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
655
|
-
* @param creditManager - Credit manager address
|
|
656
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
657
|
-
*/
|
|
658
|
-
getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
659
|
-
/**
|
|
660
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
661
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
662
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
663
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
664
|
-
* @param creditManager - Credit manager address
|
|
665
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
666
|
-
*/
|
|
667
|
-
getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
668
|
-
/**
|
|
669
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
670
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
671
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
672
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
673
|
-
* @param creditManager - Credit manager address
|
|
674
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
675
|
-
*/
|
|
676
|
-
getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
677
577
|
/**
|
|
678
578
|
* Withdraws a single collateral from credit account to wallet to and updates quotas;
|
|
679
579
|
* technically can withdraw several tokens at once
|
|
@@ -1,56 +1,40 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Address, Chain, PublicClient, Transport } from "viem";
|
|
2
|
+
import type { PhantomTokenContractType } from "../constants/index.js";
|
|
2
3
|
import type { Asset } from "../router/index.js";
|
|
3
|
-
import type { ILogger } from "../types/logger.js";
|
|
4
4
|
import { AddressMap } from "../utils/index.js";
|
|
5
|
-
import
|
|
5
|
+
import type { TokenMetaData } from "./types.js";
|
|
6
6
|
export interface FormatBNOptions {
|
|
7
7
|
precision?: number;
|
|
8
8
|
symbol?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export interface TokenMetaDataExtended extends TokenMetaData {
|
|
11
|
+
/**
|
|
12
|
+
* Undefined if token is not a phantom token
|
|
13
|
+
*/
|
|
14
|
+
phantomTokenType?: PhantomTokenContractType;
|
|
15
|
+
}
|
|
16
|
+
export declare class TokensMeta extends AddressMap<TokenMetaDataExtended> {
|
|
11
17
|
#private;
|
|
12
|
-
constructor(client: PublicClient<Transport, Chain
|
|
18
|
+
constructor(client: PublicClient<Transport, Chain>);
|
|
13
19
|
reset(): void;
|
|
14
|
-
upsert(address: string, value: TokenMetaData | undefined): void;
|
|
15
20
|
symbol(token: Address): string;
|
|
16
21
|
decimals(token: Address): number;
|
|
17
22
|
/**
|
|
18
|
-
* Returns
|
|
19
|
-
*
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
isPhantomToken(t: TokenMetaData): t is PhantomTokenMeta;
|
|
23
|
-
/**
|
|
24
|
-
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
25
|
-
* @param t
|
|
26
|
-
* @returns
|
|
23
|
+
* Returns the phantom token type for a given token, or undefined for normal tokens
|
|
24
|
+
* Throws if the phantom token data is not loaded
|
|
27
25
|
*/
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Returns true if the token is a DSToken, throws if the token data is not loaded
|
|
31
|
-
* @param t
|
|
32
|
-
* @returns
|
|
33
|
-
*/
|
|
34
|
-
isDSToken(t: TokenMetaData): t is DSTokenMeta;
|
|
26
|
+
phantomTokenType(token: Address): PhantomTokenContractType | undefined;
|
|
35
27
|
/**
|
|
36
28
|
* Returns a map of all phantom tokens
|
|
37
|
-
* Throws if token data is not loaded
|
|
38
|
-
*/
|
|
39
|
-
get phantomTokens(): AddressMap<PhantomTokenMeta>;
|
|
40
|
-
/**
|
|
41
|
-
* Returns a map of all KYC underlying tokens
|
|
42
|
-
* Throws if token data is not loaded
|
|
29
|
+
* Throws if the phantom token data is not loaded
|
|
43
30
|
*/
|
|
44
|
-
get
|
|
45
|
-
get dsTokens(): AddressMap<DSTokenMeta>;
|
|
31
|
+
get phantomTokens(): AddressMap<TokenMetaDataExtended>;
|
|
46
32
|
formatBN(asset: Asset, options?: FormatBNOptions): string;
|
|
47
33
|
formatBN(token: Address, amount: number | bigint | string | undefined, options?: FormatBNOptions): string;
|
|
48
34
|
findBySymbol(symbol: string): TokenMetaData | undefined;
|
|
49
35
|
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
50
36
|
/**
|
|
51
|
-
* Loads token
|
|
52
|
-
*
|
|
53
|
-
* @param tokens - tokens to load data for, defaults to all tokens
|
|
37
|
+
* Loads phantom token data for all known tokens from chain
|
|
54
38
|
*/
|
|
55
|
-
|
|
39
|
+
loadPhantomTokens(): Promise<void>;
|
|
56
40
|
}
|
|
@@ -35,6 +35,7 @@ export type CreditManagerState = CreditSuiteState["creditManager"];
|
|
|
35
35
|
export type CreditFacadeState = CreditSuiteState["creditFacade"];
|
|
36
36
|
export type CreditConfiguratorState = CreditSuiteState["creditConfigurator"];
|
|
37
37
|
export type AdapterData = Unarray<CreditSuiteState["adapters"]>;
|
|
38
|
+
export type TokenMetaData = Unarray<MarketData["tokens"]>;
|
|
38
39
|
export type PoolState = MarketData["pool"];
|
|
39
40
|
export type QuotaKeeperState = MarketData["quotaKeeper"];
|
|
40
41
|
export type QuotaState = Unarray<QuotaKeeperState["quotas"]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Address, Chain } from "viem";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
|
-
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs"
|
|
3
|
+
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs";
|
|
4
4
|
export interface GearboxChain extends Chain {
|
|
5
5
|
network: NetworkType;
|
|
6
6
|
defaultMarketConfigurators: Record<Address, Curator>;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const PHANTOM_TOKEN_CONTRACT_TYPES: readonly ["PHANTOM_TOKEN::CONVEX", "PHANTOM_TOKEN::INFINIFI_UNWIND", "PHANTOM_TOKEN::INFRARED", "PHANTOM_TOKEN::MELLOW_WITHDRAWAL", "PHANTOM_TOKEN::MIDAS_REDEMPTION", "PHANTOM_TOKEN::STAKING_REWARDS", "PHANTOM_TOKEN::UPSHIFT_WITHDRAW"];
|
|
2
|
+
export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { MarketData, MarketFilter } from "../base/index.js";
|
|
3
|
+
import { SDKConstruct } from "../base/index.js";
|
|
3
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
4
5
|
import type { MarketStateHuman } from "../types/index.js";
|
|
5
6
|
import { AddressMap } from "../utils/index.js";
|
|
@@ -8,8 +9,7 @@ import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
|
8
9
|
import { MarketSuite } from "./MarketSuite.js";
|
|
9
10
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
10
11
|
import type { PoolSuite } from "./pool/index.js";
|
|
11
|
-
|
|
12
|
-
export declare class MarketRegister extends ZapperRegister {
|
|
12
|
+
export declare class MarketRegister extends SDKConstruct {
|
|
13
13
|
#private;
|
|
14
14
|
constructor(sdk: GearboxSDK, ignoreMarkets?: Address[]);
|
|
15
15
|
hydrate(state: MarketData[]): void;
|
|
@@ -8,7 +8,6 @@ import { type ILossPolicyContract } from "./loss-policy/index.js";
|
|
|
8
8
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
9
9
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
10
10
|
import { PoolSuite } from "./pool/index.js";
|
|
11
|
-
import type { SecuritizeKYCFactory } from "./pool/SecuritizeKYCFactory.js";
|
|
12
11
|
export declare class MarketSuite extends SDKConstruct {
|
|
13
12
|
readonly acl: Address;
|
|
14
13
|
readonly treasury: Address;
|
|
@@ -22,8 +21,6 @@ export declare class MarketSuite extends SDKConstruct {
|
|
|
22
21
|
*/
|
|
23
22
|
readonly state: MarketData;
|
|
24
23
|
constructor(sdk: GearboxSDK, marketData: MarketData);
|
|
25
|
-
get underlying(): Address;
|
|
26
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
27
24
|
get dirty(): boolean;
|
|
28
25
|
get watchAddresses(): Set<Address>;
|
|
29
26
|
stateHuman(raw?: boolean): MarketStateHuman;
|
|
@@ -6,7 +6,6 @@ import type { PoolSuiteStateHuman } from "../../types/index.js";
|
|
|
6
6
|
import type { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
|
|
7
7
|
import { GaugeContract } from "./GaugeContract.js";
|
|
8
8
|
import { LinearInterestRateModelContract } from "./LinearInterestRateModelContract.js";
|
|
9
|
-
import type { SecuritizeKYCFactory } from "./SecuritizeKYCFactory.js";
|
|
10
9
|
import { TumblerContract } from "./TumblerContract.js";
|
|
11
10
|
import type { IInterestRateModelContract, IRateKeeperContract, PoolContract, PoolQuotaKeeperContract } from "./types.js";
|
|
12
11
|
export declare class PoolSuite extends SDKConstruct {
|
|
@@ -21,7 +20,6 @@ export declare class PoolSuite extends SDKConstruct {
|
|
|
21
20
|
get linearModel(): LinearInterestRateModelContract;
|
|
22
21
|
get marketConfigurator(): MarketConfiguratorContract;
|
|
23
22
|
get underlying(): Address;
|
|
24
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
25
23
|
get dirty(): boolean;
|
|
26
24
|
get watchAddresses(): Set<Address>;
|
|
27
25
|
stateHuman(raw?: boolean): PoolSuiteStateHuman;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { ContractEventName, DecodeFunctionDataReturnType, Log } from "viem";
|
|
2
|
-
import type { CreditManagerDebtParams, PoolState } from "../../base/index.js";
|
|
2
|
+
import type { ConstructOptions, CreditManagerDebtParams, PoolState } from "../../base/index.js";
|
|
3
3
|
import { BaseContract } from "../../base/index.js";
|
|
4
|
-
import type { GearboxSDK } from "../../GearboxSDK.js";
|
|
5
4
|
import type { PoolStateHuman } from "../../types/index.js";
|
|
6
5
|
import { AddressMap } from "../../utils/index.js";
|
|
7
|
-
import { SecuritizeKYCFactory } from "./SecuritizeKYCFactory.js";
|
|
8
6
|
declare const abi: readonly [{
|
|
9
7
|
readonly type: "function";
|
|
10
8
|
readonly inputs: readonly [];
|
|
@@ -1132,10 +1130,8 @@ type abi = typeof abi;
|
|
|
1132
1130
|
export interface PoolV310Contract extends Omit<PoolState, "baseParams" | "creditManagerDebtParams" | "name">, BaseContract<abi> {
|
|
1133
1131
|
}
|
|
1134
1132
|
export declare class PoolV310Contract extends BaseContract<abi> {
|
|
1135
|
-
#private;
|
|
1136
1133
|
readonly creditManagerDebtParams: AddressMap<CreditManagerDebtParams>;
|
|
1137
|
-
constructor(
|
|
1138
|
-
getKYCFactory(): Promise<SecuritizeKYCFactory | undefined>;
|
|
1134
|
+
constructor(options: ConstructOptions, data: PoolState);
|
|
1139
1135
|
stateHuman(raw?: boolean): PoolStateHuman;
|
|
1140
1136
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
1141
1137
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SDKConstruct } from "../base/index.js";
|
|
2
|
+
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
3
|
+
import type { AddLiquidityCall, AddLiquidityProps, RemoveLiquidityCall, RemoveLiquidityProps } from "./types.js";
|
|
4
|
+
export declare abstract class AbstractPoolService extends SDKConstruct {
|
|
5
|
+
#private;
|
|
6
|
+
constructor(sdk: GearboxSDK, version: number);
|
|
7
|
+
addLiquidity({ collateral, pool, account, zapper, permit, nativeTokenAddress, referralCode, migrate, }: AddLiquidityProps): AddLiquidityCall;
|
|
8
|
+
removeLiquidity({ pool, amount, account, zapper, permit, }: RemoveLiquidityProps): RemoveLiquidityCall;
|
|
9
|
+
}
|