@gearbox-protocol/sdk 13.7.0-kyc.3 → 14.0.0-next.10
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/dev/AccountOpener.js +5 -45
- package/dist/cjs/dev/RevolverTransport.js +10 -4
- package/dist/cjs/dev/index.js +0 -2
- package/dist/cjs/dev/logSplitterTransport.js +10 -1
- package/dist/cjs/permissionless/utils/create2.js +2 -2
- package/dist/cjs/permissionless/utils/price-update/get-price-feeds.js +11 -5
- package/dist/cjs/permissionless/utils/price-update/get-price-update-tx.js +11 -5
- package/dist/cjs/permissionless/utils/price-update/get-prices.js +12 -6
- package/dist/cjs/sdk/MultichainSDK.js +232 -0
- package/dist/cjs/sdk/OnchainSDK.js +478 -0
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +16 -324
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/cjs/sdk/base/TokensMeta.js +42 -22
- package/dist/cjs/sdk/base/token-types.js +0 -9
- package/dist/cjs/sdk/chain/chains.js +1 -2
- package/dist/cjs/sdk/constants/address-provider.js +0 -3
- package/dist/cjs/sdk/core/errors.js +77 -0
- package/dist/cjs/sdk/core/index.js +2 -0
- package/dist/cjs/sdk/index.js +4 -2
- package/dist/cjs/sdk/market/MarketRegister.js +116 -70
- package/dist/cjs/sdk/market/MarketSuite.js +0 -3
- package/dist/cjs/sdk/market/index.js +0 -2
- package/dist/cjs/sdk/market/pool/PoolSuite.js +0 -3
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +2 -11
- package/dist/cjs/sdk/market/pool/index.js +0 -2
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
- package/dist/cjs/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -23
- package/dist/cjs/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
- package/dist/cjs/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
- package/dist/cjs/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
- package/dist/cjs/sdk/market/pricefeeds/updates/index.js +3 -0
- package/dist/cjs/sdk/options.js +24 -52
- package/dist/cjs/sdk/plugins/BasePlugin.js +11 -4
- package/dist/cjs/sdk/pools/PoolService.js +12 -104
- package/dist/cjs/sdk/utils/formatter.js +99 -20
- package/dist/cjs/sdk/utils/viem/index.js +3 -3
- package/dist/cjs/sdk/utils/viem/watchBlocksAsync.js +76 -0
- package/dist/esm/dev/AccountOpener.js +6 -47
- package/dist/esm/dev/RevolverTransport.js +10 -4
- package/dist/esm/dev/index.js +0 -1
- package/dist/esm/dev/logSplitterTransport.js +10 -1
- package/dist/esm/permissionless/utils/create2.js +1 -1
- package/dist/esm/permissionless/utils/price-update/get-price-feeds.js +12 -6
- package/dist/esm/permissionless/utils/price-update/get-price-update-tx.js +13 -7
- package/dist/esm/permissionless/utils/price-update/get-prices.js +13 -7
- package/dist/esm/sdk/MultichainSDK.js +217 -0
- package/dist/esm/sdk/OnchainSDK.js +472 -0
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +17 -328
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +1 -7
- package/dist/esm/sdk/base/TokensMeta.js +44 -22
- package/dist/esm/sdk/base/token-types.js +0 -6
- package/dist/esm/sdk/chain/chains.js +1 -2
- package/dist/esm/sdk/constants/address-provider.js +0 -2
- package/dist/esm/sdk/core/errors.js +48 -0
- package/dist/esm/sdk/core/index.js +1 -0
- package/dist/esm/sdk/index.js +2 -1
- package/dist/esm/sdk/market/MarketRegister.js +118 -74
- package/dist/esm/sdk/market/MarketSuite.js +0 -3
- 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 -11
- package/dist/esm/sdk/market/pool/index.js +0 -1
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +10 -3
- package/dist/esm/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.js +20 -13
- package/dist/esm/sdk/market/pricefeeds/updates/PythUpdater.js +7 -4
- package/dist/esm/sdk/market/pricefeeds/updates/RedstoneUpdater.js +4 -4
- package/dist/esm/sdk/market/pricefeeds/updates/fetchPythPayloads.js +1 -1
- package/dist/esm/sdk/market/pricefeeds/updates/index.js +2 -0
- package/dist/esm/sdk/options.js +22 -51
- package/dist/esm/sdk/plugins/BasePlugin.js +11 -4
- package/dist/esm/sdk/pools/PoolService.js +13 -109
- package/dist/esm/sdk/utils/formatter.js +99 -10
- package/dist/esm/sdk/utils/viem/index.js +1 -1
- package/dist/esm/sdk/utils/viem/watchBlocksAsync.js +52 -0
- package/dist/types/dev/RevolverTransport.d.ts +2 -1
- package/dist/types/dev/calcLiquidatableLTs.d.ts +2 -2
- package/dist/types/dev/claimFromFaucet.d.ts +2 -2
- package/dist/types/dev/create2.d.ts +3 -4
- package/dist/types/dev/index.d.ts +0 -1
- package/dist/types/dev/logSplitterTransport.d.ts +3 -1
- package/dist/types/dev/migrateFaucet.d.ts +2 -2
- package/dist/types/dev/mint/AbstractMinter.d.ts +2 -2
- package/dist/types/dev/mint/FallbackMinter.d.ts +2 -2
- package/dist/types/dev/mint/factory.d.ts +2 -2
- package/dist/types/dev/replaceStorage.d.ts +1 -1
- package/dist/types/permissionless/utils/price-update/get-updatable-feeds.d.ts +2 -2
- package/dist/types/plugins/accounts/AccountsPlugin.d.ts +2 -2
- package/dist/types/plugins/accounts-counter/AccountsCounterPlugin.d.ts +2 -2
- package/dist/types/plugins/adapters/AdaptersPlugin.d.ts +2 -2
- package/dist/types/plugins/apy/ApyPlugin.d.ts +2 -2
- package/dist/types/plugins/bots/BotsPlugin.d.ts +2 -2
- package/dist/types/plugins/bots/PartialLiquidationBotV310Contract.d.ts +2 -2
- package/dist/types/plugins/degen-distributors/DegenDistributorsPlugin.d.ts +2 -2
- package/dist/types/plugins/delayed-withdrawal/DelayedWithdrawalPlugin.d.ts +2 -2
- package/dist/types/sdk/MultichainSDK.d.ts +144 -0
- package/dist/types/sdk/OnchainSDK.d.ts +257 -0
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +4 -54
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/createCreditAccountService.d.ts +2 -2
- package/dist/types/sdk/accounts/types.d.ts +15 -95
- package/dist/types/sdk/base/SDKConstruct.d.ts +4 -4
- package/dist/types/sdk/base/TokensMeta.d.ts +3 -14
- package/dist/types/sdk/base/token-types.d.ts +4 -44
- package/dist/types/sdk/base/types.d.ts +2 -116
- package/dist/types/sdk/chain/chains.d.ts +1 -5
- package/dist/types/sdk/constants/address-provider.d.ts +0 -1
- package/dist/types/sdk/core/createAddressProvider.d.ts +3 -3
- package/dist/types/sdk/core/errors.d.ts +51 -0
- package/dist/types/sdk/core/index.d.ts +1 -0
- package/dist/types/sdk/index.d.ts +2 -1
- package/dist/types/sdk/market/MarketRegister.d.ts +11 -8
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -4
- package/dist/types/sdk/market/adapters/createAdapter.d.ts +2 -2
- package/dist/types/sdk/market/credit/CreditConfiguratorV310Contract.d.ts +3 -3
- package/dist/types/sdk/market/credit/CreditManagerV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/credit/CreditSuite.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditConfigurator.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditFacade.d.ts +2 -2
- package/dist/types/sdk/market/credit/createCreditManager.d.ts +2 -2
- package/dist/types/sdk/market/credit/types.d.ts +1 -1
- package/dist/types/sdk/market/index.d.ts +0 -1
- package/dist/types/sdk/market/loss-policy/AliasLossPolicyV310Contract.d.ts +3 -3
- package/dist/types/sdk/market/loss-policy/createLossPolicy.d.ts +2 -2
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +5 -6
- package/dist/types/sdk/market/oracle/PriceOracleV310Contract.d.ts +2 -2
- package/dist/types/sdk/market/oracle/createPriceOracle.d.ts +2 -2
- package/dist/types/sdk/market/oracle/types.d.ts +10 -3
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -4
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +2 -6
- package/dist/types/sdk/market/pool/createInterestRateModel.d.ts +2 -2
- package/dist/types/sdk/market/pool/createPool.d.ts +2 -2
- package/dist/types/sdk/market/pool/createPoolQuotaKeeper.d.ts +2 -2
- package/dist/types/sdk/market/pool/createRateKeeper.d.ts +2 -2
- package/dist/types/sdk/market/pool/index.d.ts +0 -1
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/PythAccumulatorUpdateData.d.ts +12 -13
- package/dist/types/sdk/market/pricefeeds/updates/PythUpdater.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/RedstoneUpdater.d.ts +8 -3
- package/dist/types/sdk/market/pricefeeds/updates/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/updates/types.d.ts +4 -0
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +15 -16
- package/dist/types/sdk/plugins/BasePlugin.d.ts +12 -6
- package/dist/types/sdk/plugins/errors.d.ts +2 -2
- package/dist/types/sdk/plugins/types.d.ts +16 -6
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +2 -3
- package/dist/types/sdk/router/AbstractRouterContract.d.ts +3 -3
- package/dist/types/sdk/router/RouterV310Contract.d.ts +2 -2
- package/dist/types/sdk/router/createRouter.d.ts +2 -2
- package/dist/types/sdk/router/helpers.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +10 -2
- package/dist/types/sdk/types/state.d.ts +14 -8
- package/dist/types/sdk/utils/filterDust.d.ts +2 -2
- package/dist/types/sdk/utils/formatter.d.ts +1 -1
- package/dist/types/sdk/utils/isDust.d.ts +2 -2
- package/dist/types/sdk/utils/toAddress.d.ts +1 -1
- package/dist/types/sdk/utils/viem/getLogsPaginated.d.ts +1 -2
- package/dist/types/sdk/utils/viem/getLogsSafe.d.ts +1 -1
- package/dist/types/sdk/utils/viem/index.d.ts +1 -1
- package/dist/types/sdk/utils/viem/simulateWithPriceUpdates.d.ts +1 -2
- package/dist/types/sdk/utils/viem/watchBlocksAsync.d.ts +74 -0
- package/package.json +3 -6
- package/dist/cjs/abi/kyc/iDSRegistryService.js +0 -70
- package/dist/cjs/abi/kyc/iDSToken.js +0 -71
- package/dist/cjs/abi/kyc/iKYCCompressor.js +0 -196
- package/dist/cjs/abi/kyc/iKYCFactory.js +0 -122
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +0 -401
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +0 -326
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +0 -319
- package/dist/cjs/dev/CachedStateSubscriber.js +0 -78
- package/dist/cjs/sdk/GearboxSDK.js +0 -696
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +0 -269
- package/dist/cjs/sdk/market/kyc/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -244
- package/dist/cjs/sdk/market/kyc/securitize/constants.js +0 -28
- package/dist/cjs/sdk/market/kyc/securitize/index.js +0 -26
- package/dist/cjs/sdk/market/kyc/securitize/types.js +0 -16
- package/dist/cjs/sdk/market/kyc/types.js +0 -34
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +0 -38
- package/dist/esm/abi/kyc/iDSRegistryService.js +0 -46
- package/dist/esm/abi/kyc/iDSToken.js +0 -47
- package/dist/esm/abi/kyc/iKYCCompressor.js +0 -172
- package/dist/esm/abi/kyc/iKYCFactory.js +0 -98
- package/dist/esm/abi/kyc/iKYCUnderlying.js +0 -377
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +0 -302
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +0 -295
- package/dist/esm/dev/CachedStateSubscriber.js +0 -54
- package/dist/esm/sdk/GearboxSDK.js +0 -689
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +0 -253
- package/dist/esm/sdk/market/kyc/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +0 -220
- package/dist/esm/sdk/market/kyc/securitize/constants.js +0 -4
- package/dist/esm/sdk/market/kyc/securitize/index.js +0 -3
- package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
- package/dist/esm/sdk/market/kyc/types.js +0 -9
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +0 -14
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +0 -71
- package/dist/types/abi/kyc/iDSToken.d.ts +0 -67
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +0 -228
- package/dist/types/abi/kyc/iKYCFactory.d.ts +0 -139
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +0 -548
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +0 -404
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +0 -376
- package/dist/types/dev/CachedStateSubscriber.d.ts +0 -21
- package/dist/types/sdk/GearboxSDK.d.ts +0 -324
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +0 -52
- package/dist/types/sdk/market/kyc/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +0 -428
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +0 -1
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +0 -3
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +0 -127
- package/dist/types/sdk/market/kyc/types.d.ts +0 -170
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +0 -28
|
@@ -2,9 +2,8 @@ import type { Address, ContractFunctionArgs, GetContractReturnType, Hex, PublicC
|
|
|
2
2
|
import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
|
|
3
3
|
import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
4
4
|
import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
|
|
5
|
-
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
6
5
|
import type { CreditSuite, PriceUpdate } from "../market/index.js";
|
|
7
|
-
import type {
|
|
6
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
8
7
|
import type { Asset, RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
9
8
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
10
9
|
/**
|
|
@@ -183,10 +182,6 @@ export interface CloseCreditAccountProps {
|
|
|
183
182
|
closePath?: RouterCloseResult;
|
|
184
183
|
}
|
|
185
184
|
export interface RepayCreditAccountProps extends RepayAndLiquidateCreditAccountProps {
|
|
186
|
-
/**
|
|
187
|
-
* Swap calls for repay
|
|
188
|
-
*/
|
|
189
|
-
calls?: Array<MultiCall>;
|
|
190
185
|
/**
|
|
191
186
|
* close or zeroDebt
|
|
192
187
|
*/
|
|
@@ -444,10 +439,6 @@ export interface ChangeDeptProps {
|
|
|
444
439
|
* Assets to add as collateral
|
|
445
440
|
*/
|
|
446
441
|
collateral?: [Asset];
|
|
447
|
-
/**
|
|
448
|
-
* Assets to wrap
|
|
449
|
-
*/
|
|
450
|
-
wrapAsset?: [Asset];
|
|
451
442
|
}
|
|
452
443
|
export interface FullyLiquidateProps {
|
|
453
444
|
/**
|
|
@@ -591,46 +582,25 @@ export type GetConnectedMigrationBotsResult = {
|
|
|
591
582
|
})[];
|
|
592
583
|
botAddress: Address;
|
|
593
584
|
} | undefined;
|
|
594
|
-
/**
|
|
595
|
-
* Options to get approval address for collateral token
|
|
596
|
-
*/
|
|
597
|
-
export type GetApprovalAddressProps = {
|
|
598
|
-
creditManager: Address;
|
|
599
|
-
borrower: Address;
|
|
600
|
-
} | {
|
|
601
|
-
creditManager: Address;
|
|
602
|
-
creditAccount: Address;
|
|
603
|
-
};
|
|
604
585
|
export interface ICreditAccountsService extends Construct {
|
|
605
|
-
sdk:
|
|
586
|
+
sdk: OnchainSDK;
|
|
606
587
|
/**
|
|
607
|
-
* Returns single credit account data
|
|
608
|
-
*
|
|
609
|
-
*
|
|
610
|
-
* @param
|
|
611
|
-
* @
|
|
612
|
-
* @returns Credit account data with investor, or undefined
|
|
588
|
+
* Returns single credit account data, or undefined if it's not found
|
|
589
|
+
* Performs all necessary price feed updates under the hood
|
|
590
|
+
* @param account
|
|
591
|
+
* @param blockNumber
|
|
592
|
+
* @returns
|
|
613
593
|
*/
|
|
614
|
-
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData
|
|
594
|
+
getCreditAccountData(account: Address, blockNumber?: bigint): Promise<CreditAccountData | undefined>;
|
|
615
595
|
/**
|
|
616
|
-
*
|
|
617
|
-
* Performs all necessary price feed updates under the hood
|
|
596
|
+
* Methods to get all credit accounts with some optional filtering
|
|
597
|
+
* Performs all necessary price feed updates under the hood
|
|
618
598
|
*
|
|
619
|
-
* @param options
|
|
620
|
-
* @param blockNumber
|
|
621
|
-
* @returns
|
|
599
|
+
* @param options
|
|
600
|
+
* @param blockNumber
|
|
601
|
+
* @returns returned credit accounts are sorted by health factor in ascending order
|
|
622
602
|
*/
|
|
623
603
|
getCreditAccounts(options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData>>;
|
|
624
|
-
/**
|
|
625
|
-
* Returns all credit accounts for a borrower,
|
|
626
|
-
* both normal and KYC accounts with investor resolved on each.
|
|
627
|
-
*
|
|
628
|
-
* @param borrower - Actual owner of credit account
|
|
629
|
-
* @param options - Filter options (creditManager, health factor, etc.)
|
|
630
|
-
* @param blockNumber - Optional block number for the read
|
|
631
|
-
* @returns Credit accounts (with investor) sorted by health factor ascending
|
|
632
|
-
*/
|
|
633
|
-
getBorrowerCreditAccounts(borrower: Address, options?: GetCreditAccountsOptions, blockNumber?: bigint): Promise<Array<CreditAccountData<true>>>;
|
|
634
604
|
/**
|
|
635
605
|
* Method to get all claimable rewards for credit account (ex. stkUSDS SKY rewards).
|
|
636
606
|
* Associates rewards by adapter + stakedPhantomToken.
|
|
@@ -659,9 +629,9 @@ export interface ICreditAccountsService extends Construct {
|
|
|
659
629
|
/**
|
|
660
630
|
* Generates transaction to liquidate credit account
|
|
661
631
|
* @param props - {@link FullyLiquidateProps}
|
|
662
|
-
* @returns
|
|
632
|
+
* @returns
|
|
663
633
|
*/
|
|
664
|
-
fullyLiquidate(props: FullyLiquidateProps): Promise<
|
|
634
|
+
fullyLiquidate(props: FullyLiquidateProps): Promise<CloseCreditAccountResult>;
|
|
665
635
|
/**
|
|
666
636
|
* Closes credit account or closes credit account and keeps it open with zero debt.
|
|
667
637
|
* - Ca is closed in the following order: price update -> close path to swap all tokens into underlying ->
|
|
@@ -724,20 +694,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
724
694
|
* @returns
|
|
725
695
|
*/
|
|
726
696
|
claimDelayed(props: ClaimDelayedProps): Promise<CreditAccountOperationResult>;
|
|
727
|
-
/**
|
|
728
|
-
* Returns address to which approval should be given on collateral token
|
|
729
|
-
* It's credit manager for classical markets and special wallet for KYC markets
|
|
730
|
-
* @param props - {@link GetApprovalAddressProps}
|
|
731
|
-
* @returns
|
|
732
|
-
*/
|
|
733
|
-
getApprovalAddress(props: GetApprovalAddressProps): Promise<Address>;
|
|
734
|
-
/**
|
|
735
|
-
* Returns open account requirements for a borrower
|
|
736
|
-
* @param borrower - Borrower address
|
|
737
|
-
* @param props - {@link OpenCAProps}
|
|
738
|
-
* @returns Open account requirements or undefined if the user can open a credit account without any further actions
|
|
739
|
-
*/
|
|
740
|
-
getOpenAccountRequirements(borrower: Address, props: Pick<OpenCAProps, "creditManager">): Promise<OpenAccountRequirements | undefined>;
|
|
741
697
|
/**
|
|
742
698
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
743
699
|
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
@@ -793,42 +749,6 @@ export interface ICreditAccountsService extends Construct {
|
|
|
793
749
|
botMulticall(creditAccount: RouterCASlice, calls: Array<MultiCall>, options?: {
|
|
794
750
|
ignoreReservePrices?: boolean;
|
|
795
751
|
}): Promise<RawTx>;
|
|
796
|
-
/**
|
|
797
|
-
* Returns multicall entries to redeem (unwrap) KYC ERC-4626 vault shares into underlying for the given credit manager.
|
|
798
|
-
* Used when withdrawing debt from a KYC market: redeems adapter vault shares so the underlying can be withdrawn.
|
|
799
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
800
|
-
* @param amount - Number of vault shares (adapter tokens) to redeem
|
|
801
|
-
* @param creditManager - Credit manager address
|
|
802
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
803
|
-
*/
|
|
804
|
-
getKYCUnwrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
805
|
-
/**
|
|
806
|
-
* Returns multicall entries to deposit (wrap) underlying into KYC ERC-4626 vault shares for the given credit manager.
|
|
807
|
-
* Used when adding debt on a KYC market: deposits underlying into the adapter vault so shares are minted on the account.
|
|
808
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
809
|
-
* @param amount - Amount of underlying assets to deposit into the vault (in underlying decimals)
|
|
810
|
-
* @param creditManager - Credit manager address
|
|
811
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
812
|
-
*/
|
|
813
|
-
getKYCWrapCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
814
|
-
/**
|
|
815
|
-
* Returns multicall entries to call redeemDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
816
|
-
* Redeems the leftover vault shares (e.g. after repaying debt) so the account does not hold excess KYC vault tokens.
|
|
817
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
818
|
-
* @param amount - Leftover vault share amount to redeem (in adapter/vault decimals)
|
|
819
|
-
* @param creditManager - Credit manager address
|
|
820
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
821
|
-
*/
|
|
822
|
-
getRedeemDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
823
|
-
/**
|
|
824
|
-
* Returns multicall entries to call depositDiff on the KYC ERC-4626 adapter for the given credit manager.
|
|
825
|
-
* Deposits the leftover underlying (e.g. after decreasing debt) into the vault so the account does not hold excess underlying.
|
|
826
|
-
* Only applies when the credit manager's underlying is KYC-gated and has an ERC-4626 adapter configured.
|
|
827
|
-
* @param amount - Leftover underlying amount to deposit into the vault (in underlying decimals)
|
|
828
|
-
* @param creditManager - Credit manager address
|
|
829
|
-
* @returns Array of MultiCall to pass to credit facade multicall, or undefined if underlying is not KYC or no adapter is configured
|
|
830
|
-
*/
|
|
831
|
-
getDepositDiffCalls(amount: bigint, creditManager: Address): Promise<Array<MultiCall> | undefined>;
|
|
832
752
|
/**
|
|
833
753
|
* Withdraws a single collateral from credit account to wallet to and updates quotas;
|
|
834
754
|
* technically can withdraw several tokens at once
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
2
2
|
import type { PluginsMap } from "../plugins/index.js";
|
|
3
3
|
import { Construct } from "./Construct.js";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
6
6
|
* Extended base class for SDK components that need a reference to the
|
|
7
|
-
* top-level {@link
|
|
7
|
+
* top-level {@link OnchainSDK} instance (and its plugins).
|
|
8
8
|
*
|
|
9
9
|
* Prefer this over {@link Construct} when the component accesses SDK-level
|
|
10
10
|
* services such as market registers, plugins, or hooks.
|
|
@@ -12,6 +12,6 @@ import { Construct } from "./Construct.js";
|
|
|
12
12
|
* @typeParam Plugins - Map of attached plugin types.
|
|
13
13
|
*/
|
|
14
14
|
export declare class SDKConstruct<const Plugins extends PluginsMap = {}> extends Construct {
|
|
15
|
-
readonly sdk:
|
|
16
|
-
constructor(sdk:
|
|
15
|
+
readonly sdk: OnchainSDK<Plugins>;
|
|
16
|
+
constructor(sdk: OnchainSDK<Plugins>);
|
|
17
17
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address, type Chain, type PublicClient, type Transport } from "viem";
|
|
2
2
|
import type { Asset } from "../router/index.js";
|
|
3
3
|
import type { ILogger } from "../types/logger.js";
|
|
4
4
|
import { AddressMap } from "../utils/index.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { PhantomTokenMeta, TokenMetaData } from "./token-types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Options for {@link TokensMeta.formatBN}.
|
|
8
8
|
**/
|
|
@@ -50,22 +50,11 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
50
50
|
* @returns
|
|
51
51
|
*/
|
|
52
52
|
isPhantomToken(t: TokenMetaData): t is PhantomTokenMeta;
|
|
53
|
-
/**
|
|
54
|
-
* Returns true if the token is a KYC underlying token, throws if the token data is not loaded
|
|
55
|
-
* @param t
|
|
56
|
-
* @returns
|
|
57
|
-
*/
|
|
58
|
-
isKYCUnderlying(t: TokenMetaData): t is KYCTokenMeta;
|
|
59
53
|
/**
|
|
60
54
|
* Returns a map of all phantom tokens
|
|
61
55
|
* Throws if token data is not loaded
|
|
62
56
|
*/
|
|
63
57
|
get phantomTokens(): AddressMap<PhantomTokenMeta>;
|
|
64
|
-
/**
|
|
65
|
-
* Returns a map of all KYC underlying tokens
|
|
66
|
-
* Throws if token data is not loaded
|
|
67
|
-
*/
|
|
68
|
-
get kycUnderlyings(): AddressMap<KYCTokenMeta>;
|
|
69
58
|
/**
|
|
70
59
|
* Formats a raw token amount into a human-readable decimal string,
|
|
71
60
|
* dividing by `10^decimals` for the token.
|
|
@@ -96,7 +85,7 @@ export declare class TokensMeta extends AddressMap<TokenMetaData> {
|
|
|
96
85
|
mustFindBySymbol(symbol: string): TokenMetaData;
|
|
97
86
|
/**
|
|
98
87
|
* Loads token information about phantom tokens
|
|
99
|
-
*
|
|
88
|
+
* Other special tokens may be loaded here in the future
|
|
100
89
|
*
|
|
101
90
|
* @param tokens - tokens to load data for, defaults to all tokens
|
|
102
91
|
*/
|
|
@@ -1,53 +1,13 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
1
|
import type { MarketData, Unarray } from "./types.js";
|
|
3
2
|
type TokenData = Unarray<MarketData["tokens"]>;
|
|
4
3
|
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"];
|
|
5
|
-
export declare const KYC_UNDERLYING_DEFAULT = "KYC_UNDERLYING::DEFAULT";
|
|
6
|
-
export declare const KYC_UNDERLYING_ON_DEMAND = "KYC_UNDERLYING::ON_DEMAND";
|
|
7
|
-
export type KYCUnderlyingContractType = typeof KYC_UNDERLYING_DEFAULT | typeof KYC_UNDERLYING_ON_DEMAND;
|
|
8
|
-
export declare const KYC_ON_DEMAND_LP_MONOPOLIZED = "ON_DEMAND_LP::MONOPOLIZED";
|
|
9
|
-
export type KYCOnDemandLpContractType = typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
|
|
10
4
|
export type PhantomTokenContractType = (typeof PHANTOM_TOKEN_CONTRACT_TYPES)[number];
|
|
11
|
-
export
|
|
5
|
+
export type SimpleTokenMeta = TokenData & {
|
|
6
|
+
isDSToken?: boolean;
|
|
12
7
|
contractType?: string;
|
|
13
|
-
}
|
|
8
|
+
};
|
|
14
9
|
export type PhantomTokenMeta = SimpleTokenMeta & {
|
|
15
10
|
contractType: PhantomTokenContractType;
|
|
16
11
|
};
|
|
17
|
-
export
|
|
18
|
-
contractType: typeof KYC_UNDERLYING_DEFAULT;
|
|
19
|
-
kycFactory: Address;
|
|
20
|
-
asset: Address;
|
|
21
|
-
}
|
|
22
|
-
export interface LPMonopolizedPoolMeta {
|
|
23
|
-
pool: Address;
|
|
24
|
-
wrappedUnderlying: Address;
|
|
25
|
-
unwrappedUnderlying: Address;
|
|
26
|
-
depositAllowance: bigint;
|
|
27
|
-
claimableAmount: bigint;
|
|
28
|
-
}
|
|
29
|
-
export interface KYCOnDemandLPMonopolizedMeta {
|
|
30
|
-
addr: Address;
|
|
31
|
-
version: bigint;
|
|
32
|
-
contractType: typeof KYC_ON_DEMAND_LP_MONOPOLIZED;
|
|
33
|
-
marketConfigurator: Address;
|
|
34
|
-
/**
|
|
35
|
-
* Only this user can deposit into the pool and withdraw
|
|
36
|
-
* Other users should not see it at all
|
|
37
|
-
*/
|
|
38
|
-
depositor: Address;
|
|
39
|
-
pools: LPMonopolizedPoolMeta[];
|
|
40
|
-
}
|
|
41
|
-
export type KYCOnDemandLPMeta = KYCOnDemandLPMonopolizedMeta;
|
|
42
|
-
export interface KYCOnDemandTokenMeta extends SimpleTokenMeta {
|
|
43
|
-
contractType: typeof KYC_UNDERLYING_ON_DEMAND;
|
|
44
|
-
kycFactory: Address;
|
|
45
|
-
asset: Address;
|
|
46
|
-
pool: Address;
|
|
47
|
-
marketConfigurator: Address;
|
|
48
|
-
allowedDepositors: Address[];
|
|
49
|
-
liquidityProvider: KYCOnDemandLPMeta;
|
|
50
|
-
}
|
|
51
|
-
export type KYCTokenMeta = KYCDefaultTokenMeta | KYCOnDemandTokenMeta;
|
|
52
|
-
export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta | KYCTokenMeta;
|
|
12
|
+
export type TokenMetaData = SimpleTokenMeta | PhantomTokenMeta;
|
|
53
13
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
|
|
2
2
|
import type { Address, Hex } from "viem";
|
|
3
|
+
import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAccountCompressor.js";
|
|
3
4
|
import type { gaugeCompressorAbi } from "../../abi/compressors/gaugeCompressor.js";
|
|
4
5
|
import type { marketCompressorAbi } from "../../abi/compressors/marketCompressor.js";
|
|
5
6
|
import type { peripheryCompressorAbi } from "../../abi/compressors/peripheryCompressor.js";
|
|
@@ -62,125 +63,10 @@ export interface BaseState {
|
|
|
62
63
|
* Filter criteria for querying markets.
|
|
63
64
|
**/
|
|
64
65
|
export type MarketFilter = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof marketCompressorAbi, "getMarkets">["inputs"]>[0];
|
|
65
|
-
/**
|
|
66
|
-
* Info on credit account's assets
|
|
67
|
-
**/
|
|
68
|
-
export interface TokenInfo {
|
|
69
|
-
/**
|
|
70
|
-
* Token address.
|
|
71
|
-
**/
|
|
72
|
-
token: Address;
|
|
73
|
-
/**
|
|
74
|
-
* Token mask in the credit manager.
|
|
75
|
-
**/
|
|
76
|
-
mask: bigint;
|
|
77
|
-
/**
|
|
78
|
-
* Account's balance of token.
|
|
79
|
-
**/
|
|
80
|
-
balance: bigint;
|
|
81
|
-
/**
|
|
82
|
-
* Account's quota of token.
|
|
83
|
-
**/
|
|
84
|
-
quota: bigint;
|
|
85
|
-
/**
|
|
86
|
-
* Whether balance call was successful.
|
|
87
|
-
**/
|
|
88
|
-
success: boolean;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* On-chain state of a credit account.
|
|
92
|
-
*
|
|
93
|
-
* @remarks
|
|
94
|
-
* Fields from `totalDebtUSD` through `healthFactor` are not filled when
|
|
95
|
-
* `success` is `false`.
|
|
96
|
-
*
|
|
97
|
-
**/
|
|
98
|
-
export interface CreditAccountDataPayload {
|
|
99
|
-
/**
|
|
100
|
-
* Credit account address.
|
|
101
|
-
**/
|
|
102
|
-
creditAccount: Address;
|
|
103
|
-
/**
|
|
104
|
-
* Credit manager account is opened in.
|
|
105
|
-
**/
|
|
106
|
-
creditManager: Address;
|
|
107
|
-
/**
|
|
108
|
-
* Facade connected to account's credit manager.
|
|
109
|
-
**/
|
|
110
|
-
creditFacade: Address;
|
|
111
|
-
/**
|
|
112
|
-
* Credit manager's underlying token.
|
|
113
|
-
**/
|
|
114
|
-
underlying: Address;
|
|
115
|
-
/**
|
|
116
|
-
* Credit account's owner (contract address for KYC accounts, EOA for
|
|
117
|
-
* normal accounts).
|
|
118
|
-
**/
|
|
119
|
-
owner: Address;
|
|
120
|
-
/**
|
|
121
|
-
* Expiration timestamp, in case facade is expirable.
|
|
122
|
-
**/
|
|
123
|
-
expirationDate: number;
|
|
124
|
-
/**
|
|
125
|
-
* Bitmask of tokens enabled on credit account as collateral.
|
|
126
|
-
**/
|
|
127
|
-
enabledTokensMask: bigint;
|
|
128
|
-
/**
|
|
129
|
-
* Credit account's debt principal in underlying.
|
|
130
|
-
**/
|
|
131
|
-
debt: bigint;
|
|
132
|
-
/**
|
|
133
|
-
* Base and quota interest accrued on the credit account.
|
|
134
|
-
**/
|
|
135
|
-
accruedInterest: bigint;
|
|
136
|
-
/**
|
|
137
|
-
* Fees accrued on the credit account.
|
|
138
|
-
**/
|
|
139
|
-
accruedFees: bigint;
|
|
140
|
-
/**
|
|
141
|
-
* Account's total debt in USD.
|
|
142
|
-
**/
|
|
143
|
-
totalDebtUSD: bigint;
|
|
144
|
-
/**
|
|
145
|
-
* Account's total value in USD.
|
|
146
|
-
**/
|
|
147
|
-
totalValueUSD: bigint;
|
|
148
|
-
/**
|
|
149
|
-
* Account's threshold-weighted value in USD.
|
|
150
|
-
**/
|
|
151
|
-
twvUSD: bigint;
|
|
152
|
-
/**
|
|
153
|
-
* Account's total value in underlying.
|
|
154
|
-
**/
|
|
155
|
-
totalValue: bigint;
|
|
156
|
-
/**
|
|
157
|
-
* Account's health factor, i.e. ratio of `twvUSD` to `totalDebtUSD`,
|
|
158
|
-
* with 18 decimals precision.
|
|
159
|
-
**/
|
|
160
|
-
healthFactor: bigint;
|
|
161
|
-
/**
|
|
162
|
-
* Whether collateral calculation was successful.
|
|
163
|
-
**/
|
|
164
|
-
success: boolean;
|
|
165
|
-
/**
|
|
166
|
-
* Info on credit account's enabled tokens and tokens with non-zero balance.
|
|
167
|
-
**/
|
|
168
|
-
tokens: readonly TokenInfo[];
|
|
169
|
-
}
|
|
170
66
|
/**
|
|
171
67
|
* Full on-chain snapshot of a single credit account.
|
|
172
|
-
*
|
|
173
|
-
* @typeParam WithInvestor - When `true`, the result includes an `investor`
|
|
174
|
-
* field (`Address | undefined`). Defaults to `false` (no investor field).
|
|
175
68
|
**/
|
|
176
|
-
export type CreditAccountData
|
|
177
|
-
/**
|
|
178
|
-
* Investor EOA address (the real person behind the account).
|
|
179
|
-
* - KYC accounts: resolved from KYC factory, always defined.
|
|
180
|
-
* - Normal accounts: `undefined` (owner IS the investor).
|
|
181
|
-
**/
|
|
182
|
-
investor: Address | undefined;
|
|
183
|
-
} : CreditAccountDataPayload;
|
|
69
|
+
export type CreditAccountData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof creditAccountCompressorAbi, "getCreditAccountData">["outputs"]>>;
|
|
184
70
|
/**
|
|
185
71
|
* Reward distribution details for a single reward token.
|
|
186
72
|
**/
|
|
@@ -4,7 +4,7 @@ import { z } from "zod/v4";
|
|
|
4
4
|
* Known curator names that manage Gearbox markets.
|
|
5
5
|
*
|
|
6
6
|
**/
|
|
7
|
-
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs"
|
|
7
|
+
export type Curator = "Chaos Labs" | "K3" | "cp0x" | "Re7" | "Invariant Group" | "Tulipa" | "M11 Credit" | "kpk" | "Hyperithm" | "UltraYield" | "TelosC" | "Gami Labs";
|
|
8
8
|
/**
|
|
9
9
|
* Extended viem {@link Chain} with Gearbox-specific metadata.
|
|
10
10
|
*
|
|
@@ -20,10 +20,6 @@ export interface GearboxChain extends Chain {
|
|
|
20
20
|
* Market configurator addresses operated by known curators on this chain.
|
|
21
21
|
**/
|
|
22
22
|
defaultMarketConfigurators: Record<Address, Curator>;
|
|
23
|
-
/**
|
|
24
|
-
* Known KYC factory addresses on this chain
|
|
25
|
-
*/
|
|
26
|
-
kycFactories?: Address[];
|
|
27
23
|
/**
|
|
28
24
|
* Market configurators used in test/staging environments.
|
|
29
25
|
**/
|
|
@@ -31,7 +31,6 @@ export declare const AP_WETH_GATEWAY = "WETH_GATEWAY";
|
|
|
31
31
|
export declare const AP_WETH_TOKEN = "WETH_TOKEN";
|
|
32
32
|
export declare const AP_ZAPPER_REGISTER = "ZAPPER_REGISTER";
|
|
33
33
|
export declare const AP_ZERO_PRICE_FEED = "ZERO_PRICE_FEED";
|
|
34
|
-
export declare const AP_KYC_COMPRESSOR = "GLOBAL::KYC_COMPRESSOR";
|
|
35
34
|
/**
|
|
36
35
|
* Default address provider address for v3.1.0
|
|
37
36
|
* Is determenistic and does not depend on the network type
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
3
3
|
import type { AddressProviderState, IAddressProviderContract } from "./types.js";
|
|
4
|
-
export declare function createAddressProvider(sdk:
|
|
5
|
-
export declare function hydrateAddressProvider(sdk:
|
|
4
|
+
export declare function createAddressProvider(sdk: OnchainSDK, address: Address): Promise<IAddressProviderContract>;
|
|
5
|
+
export declare function hydrateAddressProvider(sdk: OnchainSDK, state: AddressProviderState): IAddressProviderContract;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { BaseError } from "viem";
|
|
2
|
+
import type { NetworkType } from "../chain/chains.js";
|
|
3
|
+
/**
|
|
4
|
+
* Thrown when accessing SDK state before {@link OnchainSDK.attach} or
|
|
5
|
+
* {@link OnchainSDK.hydrate} has been called.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SdkNotAttachedError extends BaseError {
|
|
8
|
+
name: string;
|
|
9
|
+
constructor();
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Thrown when calling {@link OnchainSDK.attach} or {@link OnchainSDK.hydrate}
|
|
13
|
+
* on an instance that has already been initialised.
|
|
14
|
+
*/
|
|
15
|
+
export declare class SdkAlreadyAttachedError extends BaseError {
|
|
16
|
+
name: string;
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Thrown during hydration when the serialised state's `version` field does not
|
|
21
|
+
* match the SDK's expected {@link STATE_VERSION}.
|
|
22
|
+
*/
|
|
23
|
+
export declare class SdkStateVersionMismatchError extends BaseError {
|
|
24
|
+
name: string;
|
|
25
|
+
constructor(expected: number, actual: number);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Thrown when the viem client's `chainId` does not match the expected chain ID
|
|
29
|
+
* for the configured {@link NetworkType}.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SdkChainMismatchError extends BaseError {
|
|
32
|
+
name: string;
|
|
33
|
+
constructor(expected: NetworkType | number, actual: NetworkType | number);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Thrown during {@link MultichainSDK.hydrate} when the serialised state is
|
|
37
|
+
* missing an entry for a configured chain.
|
|
38
|
+
*/
|
|
39
|
+
export declare class SdkMissingChainStateError extends BaseError {
|
|
40
|
+
name: string;
|
|
41
|
+
constructor(network: NetworkType);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Thrown by {@link MultichainSDK.syncState} when one or more per-chain syncs
|
|
45
|
+
* fail. Wraps the individual errors keyed by network.
|
|
46
|
+
*/
|
|
47
|
+
export declare class SdkSyncFailedError extends BaseError {
|
|
48
|
+
name: string;
|
|
49
|
+
readonly perChainErrors: Partial<Record<NetworkType, unknown>>;
|
|
50
|
+
constructor(perChainErrors: Partial<Record<NetworkType, unknown>>);
|
|
51
|
+
}
|
|
@@ -3,8 +3,9 @@ export * from "./base/index.js";
|
|
|
3
3
|
export * from "./chain/index.js";
|
|
4
4
|
export * from "./constants/index.js";
|
|
5
5
|
export * from "./core/index.js";
|
|
6
|
-
export * from "./
|
|
6
|
+
export * from "./MultichainSDK.js";
|
|
7
7
|
export * from "./market/index.js";
|
|
8
|
+
export * from "./OnchainSDK.js";
|
|
8
9
|
export * from "./options.js";
|
|
9
10
|
export * from "./plugins/index.js";
|
|
10
11
|
export * from "./pools/index.js";
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { MarketData, MarketFilter } from "../base/index.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
4
4
|
import type { MarketStateHuman } from "../types/index.js";
|
|
5
5
|
import { AddressMap } from "../utils/index.js";
|
|
6
|
-
import { type DelegatedMulticall } from "../utils/viem/index.js";
|
|
7
6
|
import type { CreditSuite } from "./credit/index.js";
|
|
8
7
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
9
8
|
import { MarketSuite } from "./MarketSuite.js";
|
|
@@ -23,7 +22,7 @@ export declare class MarketRegister extends ZapperRegister {
|
|
|
23
22
|
* @param sdk - Top-level SDK instance.
|
|
24
23
|
* @param ignoreMarkets - Pool addresses of markets to exclude from loading.
|
|
25
24
|
**/
|
|
26
|
-
constructor(sdk:
|
|
25
|
+
constructor(sdk: OnchainSDK, ignoreMarkets?: Address[]);
|
|
27
26
|
/**
|
|
28
27
|
* Restores market state from a previously serialized snapshot,
|
|
29
28
|
* bypassing on-chain reads.
|
|
@@ -31,13 +30,13 @@ export declare class MarketRegister extends ZapperRegister {
|
|
|
31
30
|
**/
|
|
32
31
|
hydrate(state: MarketData[]): void;
|
|
33
32
|
/**
|
|
34
|
-
*
|
|
35
|
-
* Returns delegated multicalls for loading all markets from the on-chain
|
|
36
|
-
* market compressor. Used by the SDK to compose batched RPC calls.
|
|
33
|
+
* Fetches all markets from the on-chain for the given market configurators.
|
|
37
34
|
*
|
|
38
|
-
* @param
|
|
35
|
+
* @param marketConfigurators - Addresses of market configurator contracts to query.
|
|
36
|
+
* @param ignoreUpdateablePrices - When `true`, skips generating off-chain
|
|
37
|
+
* price updates before loading
|
|
39
38
|
**/
|
|
40
|
-
|
|
39
|
+
loadMarkets(marketConfigurators: Address[], ignoreUpdateablePrices?: boolean): Promise<void>;
|
|
41
40
|
/**
|
|
42
41
|
* The active filter used to scope market compressor queries.
|
|
43
42
|
* @throws If the register has not been hydrated or attached yet.
|
|
@@ -53,6 +52,10 @@ export declare class MarketRegister extends ZapperRegister {
|
|
|
53
52
|
* @param ignoreUpdateablePrices - When `true`, skips off-chain price updates.
|
|
54
53
|
**/
|
|
55
54
|
syncState(ignoreUpdateablePrices?: boolean): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Loads new prices and price feeds for given oracles from PriceFeedCompressor, defaults to all oracles
|
|
57
|
+
*/
|
|
58
|
+
updatePrices(oracles?: Address[]): Promise<void>;
|
|
56
59
|
get watchAddresses(): Set<Address>;
|
|
57
60
|
/**
|
|
58
61
|
* Serializable snapshot of all loaded markets, suitable for hydration.
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { MarketData } from "../base/index.js";
|
|
3
3
|
import { SDKConstruct } from "../base/index.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { OnchainSDK } from "../OnchainSDK.js";
|
|
5
5
|
import type { MarketStateHuman } from "../types/index.js";
|
|
6
6
|
import { CreditSuite } from "./credit/index.js";
|
|
7
|
-
import type { IKYCFactory } from "./kyc/types.js";
|
|
8
7
|
import { type ILossPolicyContract } from "./loss-policy/index.js";
|
|
9
8
|
import { MarketConfiguratorContract } from "./MarketConfiguratorContract.js";
|
|
10
9
|
import type { IPriceOracleContract } from "./oracle/index.js";
|
|
@@ -21,9 +20,8 @@ export declare class MarketSuite extends SDKConstruct {
|
|
|
21
20
|
* Original data received from compressor
|
|
22
21
|
*/
|
|
23
22
|
readonly state: MarketData;
|
|
24
|
-
constructor(sdk:
|
|
23
|
+
constructor(sdk: OnchainSDK, marketData: MarketData);
|
|
25
24
|
get underlying(): Address;
|
|
26
|
-
get kycFactory(): IKYCFactory | undefined;
|
|
27
25
|
get dirty(): boolean;
|
|
28
26
|
get watchAddresses(): Set<Address>;
|
|
29
27
|
stateHuman(raw?: boolean): MarketStateHuman;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AdapterData } from "../../base/index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
3
3
|
import type { PluginsMap } from "../../plugins/index.js";
|
|
4
4
|
import type { IAdapterContract } from "./types.js";
|
|
5
|
-
export declare function createAdapter<const Plugins extends PluginsMap>(sdk:
|
|
5
|
+
export declare function createAdapter<const Plugins extends PluginsMap>(sdk: OnchainSDK<Plugins>, args: AdapterData): IAdapterContract;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ContractEventName, DecodeFunctionDataReturnType, GetEventArgs, Log } from "viem";
|
|
2
2
|
import type { CreditSuiteState } from "../../base/index.js";
|
|
3
3
|
import { BaseContract } from "../../base/index.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
5
|
import type { ICreditConfiguratorContract } from "./types.js";
|
|
6
6
|
declare const abi: readonly [{
|
|
7
7
|
readonly type: "function";
|
|
@@ -488,9 +488,9 @@ export type RampEvent = GetEventArgs<abi, "ScheduleTokenLiquidationThresholdRamp
|
|
|
488
488
|
Required: true;
|
|
489
489
|
}>;
|
|
490
490
|
export declare class CreditConfiguratorV310Contract extends BaseContract<abi> implements ICreditConfiguratorContract {
|
|
491
|
-
readonly sdk:
|
|
491
|
+
readonly sdk: OnchainSDK;
|
|
492
492
|
isPaused: boolean;
|
|
493
|
-
constructor(sdk:
|
|
493
|
+
constructor(sdk: OnchainSDK, { creditConfigurator, creditManager }: CreditSuiteState);
|
|
494
494
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
495
495
|
checkRamps(): Promise<RampEvent[]>;
|
|
496
496
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
@@ -2,7 +2,7 @@ import type { Address, ContractEventName, Log } from "viem";
|
|
|
2
2
|
import { iCreditManagerV310Abi } from "../../../abi/310/generated.js";
|
|
3
3
|
import type { CreditManagerState, CreditSuiteState } from "../../base/index.js";
|
|
4
4
|
import { BaseContract } from "../../base/index.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
6
|
import type { CreditManagerStateHuman } from "../../types/index.js";
|
|
7
7
|
import { AddressMap } from "../../utils/index.js";
|
|
8
8
|
import type { IAdapterContract } from "../adapters/index.js";
|
|
@@ -992,7 +992,7 @@ export declare class CreditManagerV310Contract extends BaseContract<abi> impleme
|
|
|
992
992
|
* Mapping token address => liquidation threshold
|
|
993
993
|
*/
|
|
994
994
|
readonly liquidationThresholds: AddressMap<number>;
|
|
995
|
-
constructor(sdk:
|
|
995
|
+
constructor(sdk: OnchainSDK, { creditManager, adapters }: CreditSuiteState);
|
|
996
996
|
stateHuman(raw?: boolean): CreditManagerStateHuman;
|
|
997
997
|
get collateralTokens(): Address[];
|
|
998
998
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|