@gearbox-protocol/sdk 14.0.0 → 14.1.0
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/abi/kyc/iDSRegistryService.js +149 -0
- package/dist/cjs/abi/kyc/iDSToken.js +71 -0
- package/dist/cjs/abi/kyc/iKYCCompressor.js +196 -0
- package/dist/cjs/abi/kyc/iKYCFactory.js +122 -0
- package/dist/cjs/abi/kyc/iKYCUnderlying.js +401 -0
- package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +326 -0
- package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +319 -0
- package/dist/cjs/dev/AccountOpener.js +45 -5
- package/dist/cjs/sdk/OnchainSDK.js +55 -5
- package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +335 -21
- package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +7 -1
- package/dist/cjs/sdk/base/TokensMeta.js +22 -42
- package/dist/cjs/sdk/base/token-types.js +9 -0
- package/dist/cjs/sdk/chain/chains.js +18 -1
- package/dist/cjs/sdk/constants/address-provider.js +3 -0
- package/dist/cjs/sdk/market/MarketRegister.js +70 -116
- package/dist/cjs/sdk/market/MarketSuite.js +3 -0
- package/dist/cjs/sdk/market/index.js +2 -0
- package/dist/cjs/sdk/market/kyc/KYCRegistry.js +269 -0
- package/dist/cjs/sdk/market/kyc/index.js +26 -0
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +242 -0
- package/dist/cjs/sdk/market/kyc/securitize/constants.js +28 -0
- package/dist/cjs/sdk/market/kyc/securitize/index.js +26 -0
- package/dist/cjs/sdk/market/kyc/securitize/types.js +16 -0
- package/dist/cjs/sdk/{accounts/utils.js → market/kyc/types.js} +11 -15
- package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/cjs/sdk/market/pool/PoolV310Contract.js +11 -2
- package/dist/cjs/sdk/market/pool/index.js +2 -0
- package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/cjs/sdk/options.js +6 -0
- package/dist/cjs/sdk/pools/PoolService.js +104 -12
- package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +38 -0
- package/dist/cjs/sdk/utils/viem/index.js +2 -0
- package/dist/esm/abi/kyc/iDSRegistryService.js +125 -0
- package/dist/esm/abi/kyc/iDSToken.js +47 -0
- package/dist/esm/abi/kyc/iKYCCompressor.js +172 -0
- package/dist/esm/abi/kyc/iKYCFactory.js +98 -0
- package/dist/esm/abi/kyc/iKYCUnderlying.js +377 -0
- package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +302 -0
- package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +295 -0
- package/dist/esm/dev/AccountOpener.js +47 -6
- package/dist/esm/sdk/OnchainSDK.js +57 -5
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +336 -22
- package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +7 -1
- package/dist/esm/sdk/base/TokensMeta.js +22 -44
- package/dist/esm/sdk/base/token-types.js +6 -0
- package/dist/esm/sdk/chain/chains.js +18 -1
- package/dist/esm/sdk/constants/address-provider.js +2 -0
- package/dist/esm/sdk/market/MarketRegister.js +74 -118
- package/dist/esm/sdk/market/MarketSuite.js +3 -0
- package/dist/esm/sdk/market/index.js +1 -0
- package/dist/esm/sdk/market/kyc/KYCRegistry.js +253 -0
- package/dist/esm/sdk/market/kyc/index.js +3 -0
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +218 -0
- package/dist/esm/sdk/market/kyc/securitize/constants.js +4 -0
- package/dist/esm/sdk/market/kyc/securitize/index.js +3 -0
- package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
- package/dist/esm/sdk/market/kyc/types.js +9 -0
- package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
- package/dist/esm/sdk/market/pool/PoolV310Contract.js +11 -2
- package/dist/esm/sdk/market/pool/index.js +1 -0
- package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
- package/dist/esm/sdk/options.js +6 -0
- package/dist/esm/sdk/pools/PoolService.js +109 -13
- package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +14 -0
- package/dist/esm/sdk/utils/viem/index.js +1 -0
- package/dist/types/abi/kyc/iDSRegistryService.d.ts +191 -0
- package/dist/types/abi/kyc/iDSToken.d.ts +67 -0
- package/dist/types/abi/kyc/iKYCCompressor.d.ts +228 -0
- package/dist/types/abi/kyc/iKYCFactory.d.ts +139 -0
- package/dist/types/abi/kyc/iKYCUnderlying.d.ts +548 -0
- package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +404 -0
- package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +376 -0
- package/dist/types/sdk/OnchainSDK.d.ts +19 -1
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +59 -6
- package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
- package/dist/types/sdk/accounts/types.d.ts +114 -14
- package/dist/types/sdk/base/TokensMeta.d.ts +14 -3
- package/dist/types/sdk/base/token-types.d.ts +44 -4
- package/dist/types/sdk/base/types.d.ts +116 -2
- package/dist/types/sdk/chain/chains.d.ts +5 -1
- package/dist/types/sdk/constants/address-provider.d.ts +1 -0
- package/dist/types/sdk/market/MarketRegister.d.ts +6 -9
- package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
- package/dist/types/sdk/market/index.d.ts +1 -0
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +52 -0
- package/dist/types/sdk/market/kyc/index.d.ts +3 -0
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +429 -0
- package/dist/types/sdk/market/kyc/securitize/constants.d.ts +1 -0
- package/dist/types/sdk/market/kyc/securitize/index.d.ts +3 -0
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +136 -0
- package/dist/types/sdk/market/kyc/types.d.ts +171 -0
- package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +3 -2
- package/dist/types/sdk/market/oracle/types.d.ts +3 -10
- package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
- package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
- package/dist/types/sdk/market/pool/index.d.ts +1 -0
- package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
- package/dist/types/sdk/market/types.d.ts +1 -1
- package/dist/types/sdk/options.d.ts +1 -0
- package/dist/types/sdk/pools/PoolService.d.ts +8 -8
- package/dist/types/sdk/pools/types.d.ts +1 -1
- package/dist/types/sdk/types/state-human.d.ts +2 -0
- package/dist/types/sdk/types/state.d.ts +5 -0
- package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +28 -0
- package/dist/types/sdk/utils/viem/index.d.ts +1 -0
- package/package.json +1 -1
- package/dist/esm/sdk/accounts/utils.js +0 -14
- package/dist/types/sdk/accounts/utils.d.ts +0 -2
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
|
|
2
|
+
import type { Address, ContractFunctionParameters } from "viem";
|
|
3
|
+
import type { iKYCCompressorAbi } from "../../../abi/kyc/iKYCCompressor.js";
|
|
4
|
+
import type { GetOpenAccountRequirementsProps } from "../../accounts/types.js";
|
|
5
|
+
import type { IBaseContract, Unarray } from "../../base/index.js";
|
|
6
|
+
import type { MultiCall, RawTx } from "../../types/index.js";
|
|
7
|
+
import type { SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman, SecuritizeOpenAccountRequirements, SecuritizeOperationParams } from "./securitize/index.js";
|
|
8
|
+
import { KYC_FACTORY_SECURITIZE } from "./securitize/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Discriminated union of all known KYC factory contract type strings.
|
|
11
|
+
**/
|
|
12
|
+
export declare const KYC_FACTORY_TYPES: readonly ["KYC_FACTORY::SECURITIZE"];
|
|
13
|
+
/**
|
|
14
|
+
* String literal union of known KYC factory types.
|
|
15
|
+
**/
|
|
16
|
+
export type KYCFactoryType = (typeof KYC_FACTORY_TYPES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*
|
|
20
|
+
* Type-level registry mapping each {@link KYCFactoryType} to its associated
|
|
21
|
+
* data types. Adding a new KYC factory requires a single new entry here;
|
|
22
|
+
* all derived types update automatically.
|
|
23
|
+
**/
|
|
24
|
+
interface KYCFactoryTypeMap {
|
|
25
|
+
[KYC_FACTORY_SECURITIZE]: {
|
|
26
|
+
investorData: SecuritizeInvestorData;
|
|
27
|
+
openAccountRequirements: SecuritizeOpenAccountRequirements;
|
|
28
|
+
stateHuman: SecuritizeKYCFactoryStateHuman;
|
|
29
|
+
operationParams: SecuritizeOperationParams;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Investor data decoded from the KYC compressor, defaults to union of all factory types
|
|
34
|
+
* Can be discriminated by type
|
|
35
|
+
**/
|
|
36
|
+
export type KYCInvestorData<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["investorData"];
|
|
37
|
+
/**
|
|
38
|
+
* Open-account requirements for a KYC factory, defaults to union of all factory types
|
|
39
|
+
* Can be discriminated by type
|
|
40
|
+
**/
|
|
41
|
+
export type KYCOpenAccountRequirements<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["openAccountRequirements"];
|
|
42
|
+
/**
|
|
43
|
+
* Open credit account/Multicall extra params type for a KYC factory, defaults to union of all factory types
|
|
44
|
+
* Can be discriminated by type
|
|
45
|
+
**/
|
|
46
|
+
export type KYCOperationParams<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["operationParams"];
|
|
47
|
+
/**
|
|
48
|
+
* Raw return type of `KYCCompressor.getKYCMarketsData`.
|
|
49
|
+
**/
|
|
50
|
+
export type KYCCompressorResponse = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iKYCCompressorAbi, "getKYCMarketsData">["outputs"]>;
|
|
51
|
+
/**
|
|
52
|
+
* On-chain state of a KYC underlying token.
|
|
53
|
+
**/
|
|
54
|
+
export type KYCUnderlyingData = Unarray<KYCCompressorResponse[0]>;
|
|
55
|
+
/**
|
|
56
|
+
* On-chain state of a KYC factory.
|
|
57
|
+
**/
|
|
58
|
+
export type KYCFactoryData = Unarray<KYCCompressorResponse[1]>;
|
|
59
|
+
/**
|
|
60
|
+
* Typed contract call parameters for `KYCCompressor.getKYCMarketsData`.
|
|
61
|
+
**/
|
|
62
|
+
export type KYCCompressorCall = ContractFunctionParameters<typeof iKYCCompressorAbi, "view", "getKYCMarketsData">;
|
|
63
|
+
/**
|
|
64
|
+
* Single element of the `KYCCompressor.getKYCInvestorData` return array.
|
|
65
|
+
* Contains per-factory credit accounts and factory-specific extra details.
|
|
66
|
+
**/
|
|
67
|
+
export type KYCCompressorInvestorData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iKYCCompressorAbi, "getKYCInvestorData">["outputs"]>[0]>;
|
|
68
|
+
/**
|
|
69
|
+
* Full KYC compressor response, used as the persisted/hydrated state.
|
|
70
|
+
**/
|
|
71
|
+
export type KYCState = KYCCompressorResponse;
|
|
72
|
+
/**
|
|
73
|
+
* Human-readable KYC factory state, union of all factory types.
|
|
74
|
+
**/
|
|
75
|
+
export type KYCFactoryStateHuman = KYCFactoryTypeMap[KYCFactoryType]["stateHuman"];
|
|
76
|
+
/**
|
|
77
|
+
* Human-readable snapshot of the full KYC registry state.
|
|
78
|
+
**/
|
|
79
|
+
export interface KYCStateHuman {
|
|
80
|
+
/** State of each loaded KYC factory. */
|
|
81
|
+
factories: KYCFactoryStateHuman[];
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Shared interface for all KYC factory contracts.
|
|
85
|
+
*
|
|
86
|
+
* Parameterised by a single factory type literal `T` which indexes into
|
|
87
|
+
* {@link KYCFactoryTypeMap} to derive all associated data types.
|
|
88
|
+
*
|
|
89
|
+
* @typeParam T - factory type
|
|
90
|
+
**/
|
|
91
|
+
export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends IBaseContract {
|
|
92
|
+
/**
|
|
93
|
+
* Narrowed factory type discriminant
|
|
94
|
+
**/
|
|
95
|
+
readonly contractType: T;
|
|
96
|
+
/**
|
|
97
|
+
* @internal
|
|
98
|
+
*
|
|
99
|
+
* Decodes factory-specific extra details from the compressor's investor data.
|
|
100
|
+
* Each factory knows how to decode its own extra details.
|
|
101
|
+
*
|
|
102
|
+
* @param data - raw KYCCompressor InvestorData
|
|
103
|
+
**/
|
|
104
|
+
decodeInvestorData(data: KYCCompressorInvestorData): KYCInvestorData<T>;
|
|
105
|
+
/**
|
|
106
|
+
* Returns the investor address for a credit account.
|
|
107
|
+
* @param creditAccount - credit account address
|
|
108
|
+
* @param fromCache - if true, use and update an in-memory cache
|
|
109
|
+
* (creditAccount → investor). On cache miss, loads from contract and
|
|
110
|
+
* stores the result for future calls.
|
|
111
|
+
**/
|
|
112
|
+
getInvestor(creditAccount: Address, fromCache?: boolean): Promise<Address>;
|
|
113
|
+
/**
|
|
114
|
+
* Returns address to which approval should be given on collateral token
|
|
115
|
+
*
|
|
116
|
+
* @param options - either `{ creditManager, creditAccount }` for an
|
|
117
|
+
* existing account or `{ creditManager, borrower }` for a new one
|
|
118
|
+
**/
|
|
119
|
+
getApprovalAddress(options: {
|
|
120
|
+
creditManager: Address;
|
|
121
|
+
borrower: Address;
|
|
122
|
+
} | {
|
|
123
|
+
creditManager: Address;
|
|
124
|
+
creditAccount: Address;
|
|
125
|
+
}): Promise<Address>;
|
|
126
|
+
/**
|
|
127
|
+
* Returns the wallet address for a credit account.
|
|
128
|
+
* Wallet is a smart contract that owns the credit account, and
|
|
129
|
+
* it is different from the investor address (actual user).
|
|
130
|
+
* @param creditAccount - credit account address
|
|
131
|
+
**/
|
|
132
|
+
getWallet(creditAccount: Address): Promise<Address>;
|
|
133
|
+
/**
|
|
134
|
+
* Creates a raw transaction to perform operations on a credit account.
|
|
135
|
+
* Similar to {@link CreditFacadeV310Contract.multicall}.
|
|
136
|
+
*
|
|
137
|
+
* @param creditAccount - credit account address
|
|
138
|
+
* @param calls - calls to perform
|
|
139
|
+
* @param options - factory-specific parameters (e.g. tokens to
|
|
140
|
+
* register, signatures to cache). Undefined value means that no KYC actions are required
|
|
141
|
+
**/
|
|
142
|
+
multicall(creditAccount: Address, calls: MultiCall[], options?: KYCOperationParams<T>): RawTx;
|
|
143
|
+
/**
|
|
144
|
+
* Checks if the user can open a credit account with this factory.
|
|
145
|
+
* @param investor - investor address
|
|
146
|
+
* @param props - {@link GetOpenAccountRequirementsProps}
|
|
147
|
+
* @returns open account requirements for the investor, or `undefined` if the
|
|
148
|
+
* user can open a credit account without any further actions
|
|
149
|
+
**/
|
|
150
|
+
getOpenAccountRequirements(investor: Address, props: GetOpenAccountRequirementsProps): Promise<KYCOpenAccountRequirements<T> | undefined>;
|
|
151
|
+
/**
|
|
152
|
+
* Creates a raw transaction to open a credit account.
|
|
153
|
+
* Similar to {@link CreditFacadeV310Contract.openCreditAccount}.
|
|
154
|
+
*
|
|
155
|
+
* @param creditManager - credit manager address
|
|
156
|
+
* @param calls - initial calls to perform
|
|
157
|
+
* @param options - factory-specific parameters (e.g. tokens to
|
|
158
|
+
* register, signatures to cache).
|
|
159
|
+
* Undefined value means that no KYC actions are required (e.g. when we open second credit account)
|
|
160
|
+
**/
|
|
161
|
+
openCreditAccount(creditManager: Address, calls: MultiCall[], options?: KYCOperationParams<T>): RawTx;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Narrows an {@link IKYCFactory} to a specific factory type.
|
|
165
|
+
*
|
|
166
|
+
* @param factory - factory instance to check
|
|
167
|
+
* @param type - expected factory type literal
|
|
168
|
+
* @returns `true` if `factory.factoryType === type`
|
|
169
|
+
**/
|
|
170
|
+
export declare function isKYCFactory<T extends KYCFactoryType>(factory: IKYCFactory, type: T): factory is IKYCFactory<T>;
|
|
171
|
+
export {};
|
|
@@ -5,10 +5,11 @@ import { BaseContract } from "../../base/index.js";
|
|
|
5
5
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
6
6
|
import type { PriceOracleStateHuman } from "../../types/index.js";
|
|
7
7
|
import { AddressMap } from "../../utils/index.js";
|
|
8
|
+
import type { DelegatedMulticall } from "../../utils/viem/index.js";
|
|
8
9
|
import type { IPriceFeedContract, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
|
|
9
10
|
import { PriceFeedRef } from "../pricefeeds/index.js";
|
|
10
11
|
import PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
|
|
11
|
-
import type {
|
|
12
|
+
import type { IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
|
|
12
13
|
/**
|
|
13
14
|
* Base implementation of the Gearbox price oracle.
|
|
14
15
|
*
|
|
@@ -74,7 +75,7 @@ export declare abstract class PriceOracleBaseContract<abi extends Abi | readonly
|
|
|
74
75
|
/**
|
|
75
76
|
* {@inheritDoc IPriceOracleContract.syncStateMulticall}
|
|
76
77
|
**/
|
|
77
|
-
syncStateMulticall():
|
|
78
|
+
syncStateMulticall(): DelegatedMulticall;
|
|
78
79
|
/**
|
|
79
80
|
* {@inheritDoc IPriceOracleContract.watchAddresses}
|
|
80
81
|
**/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { Address
|
|
2
|
-
import type { priceFeedCompressorAbi } from "../../../abi/compressors/priceFeedCompressor.js";
|
|
1
|
+
import type { Address } from "viem";
|
|
3
2
|
import type { IBaseContract } from "../../base/index.js";
|
|
4
3
|
import type { MultiCall, PriceOracleStateHuman } from "../../types/index.js";
|
|
5
4
|
import type { AddressMap } from "../../utils/index.js";
|
|
5
|
+
import type { DelegatedMulticall } from "../../utils/viem/index.js";
|
|
6
6
|
import type { IPriceFeedContract, PriceFeedRef, PriceUpdate, UpdatePriceFeedsResult } from "../pricefeeds/index.js";
|
|
7
7
|
import type PriceFeedAnswerMap from "./PriceFeedAnswerMap.js";
|
|
8
8
|
/**
|
|
@@ -71,7 +71,7 @@ export interface IPriceOracleContract extends IBaseContract {
|
|
|
71
71
|
/**
|
|
72
72
|
* @internal
|
|
73
73
|
**/
|
|
74
|
-
syncStateMulticall: () =>
|
|
74
|
+
syncStateMulticall: () => DelegatedMulticall;
|
|
75
75
|
/**
|
|
76
76
|
* Checks whether the given price feed address appears anywhere in this
|
|
77
77
|
* oracle's feed tree (including as a dependency of a composite feed,
|
|
@@ -124,10 +124,3 @@ export interface IPriceOracleContract extends IBaseContract {
|
|
|
124
124
|
**/
|
|
125
125
|
stateHuman: (raw?: boolean) => PriceOracleStateHuman;
|
|
126
126
|
}
|
|
127
|
-
/**
|
|
128
|
-
* @internal
|
|
129
|
-
**/
|
|
130
|
-
export interface DelegatedOracleMulticall {
|
|
131
|
-
call: ContractFunctionParameters<typeof priceFeedCompressorAbi, "view", "getPriceOracleState">;
|
|
132
|
-
onResult: (resp: ContractFunctionReturnType<typeof priceFeedCompressorAbi, "view", "getPriceOracleState">) => void;
|
|
133
|
-
}
|
|
@@ -3,6 +3,7 @@ import type { MarketData } from "../../base/index.js";
|
|
|
3
3
|
import { SDKConstruct } from "../../base/index.js";
|
|
4
4
|
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
5
5
|
import type { PoolSuiteStateHuman } from "../../types/index.js";
|
|
6
|
+
import type { IKYCFactory } from "../kyc/types.js";
|
|
6
7
|
import type { MarketConfiguratorContract } from "../MarketConfiguratorContract.js";
|
|
7
8
|
import { GaugeContract } from "./GaugeContract.js";
|
|
8
9
|
import { LinearInterestRateModelContract } from "./LinearInterestRateModelContract.js";
|
|
@@ -20,6 +21,7 @@ export declare class PoolSuite extends SDKConstruct {
|
|
|
20
21
|
get linearModel(): LinearInterestRateModelContract;
|
|
21
22
|
get marketConfigurator(): MarketConfiguratorContract;
|
|
22
23
|
get underlying(): Address;
|
|
24
|
+
get kycFactory(): IKYCFactory | undefined;
|
|
23
25
|
get dirty(): boolean;
|
|
24
26
|
get watchAddresses(): Set<Address>;
|
|
25
27
|
stateHuman(raw?: boolean): PoolSuiteStateHuman;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ContractEventName, DecodeFunctionDataReturnType, Log } from "viem";
|
|
2
|
-
import type {
|
|
2
|
+
import type { CreditManagerDebtParams, PoolState } from "../../base/index.js";
|
|
3
3
|
import { BaseContract } from "../../base/index.js";
|
|
4
|
+
import type { OnchainSDK } from "../../OnchainSDK.js";
|
|
4
5
|
import type { PoolStateHuman } from "../../types/index.js";
|
|
5
6
|
import { AddressMap } from "../../utils/index.js";
|
|
7
|
+
import type { IKYCFactory } from "../kyc/types.js";
|
|
6
8
|
declare const abi: readonly [{
|
|
7
9
|
readonly type: "function";
|
|
8
10
|
readonly inputs: readonly [];
|
|
@@ -1130,8 +1132,10 @@ type abi = typeof abi;
|
|
|
1130
1132
|
export interface PoolV310Contract extends Omit<PoolState, "baseParams" | "creditManagerDebtParams" | "name">, BaseContract<abi> {
|
|
1131
1133
|
}
|
|
1132
1134
|
export declare class PoolV310Contract extends BaseContract<abi> {
|
|
1135
|
+
#private;
|
|
1133
1136
|
readonly creditManagerDebtParams: AddressMap<CreditManagerDebtParams>;
|
|
1134
|
-
constructor(
|
|
1137
|
+
constructor(sdk: OnchainSDK, data: PoolState);
|
|
1138
|
+
get kycFactory(): IKYCFactory | undefined;
|
|
1135
1139
|
stateHuman(raw?: boolean): PoolStateHuman;
|
|
1136
1140
|
processLog(log: Log<bigint, number, false, undefined, undefined, abi, ContractEventName<abi>>): void;
|
|
1137
1141
|
protected stringifyFunctionParams(params: DecodeFunctionDataReturnType<abi>): string[];
|
|
@@ -152,7 +152,7 @@ export declare class PriceFeedRegister extends SDKConstruct implements IHooks<Pr
|
|
|
152
152
|
* Loads PARTIAL information about all updatable price feeds from MarketCompressor
|
|
153
153
|
* Discovered price feeds are not saved anywhere in PriceFeedRegister, and can later be used to load price feed updates
|
|
154
154
|
*/
|
|
155
|
-
getPartialUpdatablePriceFeeds(configurators: Address[]
|
|
155
|
+
getPartialUpdatablePriceFeeds(configurators: Address[]): Promise<IPriceFeedContract[]>;
|
|
156
156
|
/**
|
|
157
157
|
* Instantiates the appropriate price feed contract wrapper based on
|
|
158
158
|
* the `contractType` discriminator in the node's base params.
|
|
@@ -5,6 +5,6 @@ import type { Unarray } from "../base/index.js";
|
|
|
5
5
|
type CompressorZapperData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof peripheryCompressorAbi, "getZappers">["outputs"]>>;
|
|
6
6
|
export interface ZapperData extends CompressorZapperData {
|
|
7
7
|
pool: Address;
|
|
8
|
-
type: "migration" | "base";
|
|
8
|
+
type: "migration" | "kyc" | "base";
|
|
9
9
|
}
|
|
10
10
|
export {};
|
|
@@ -16,6 +16,7 @@ export declare const OnchainSDKOptionsSchema: z.ZodObject<{
|
|
|
16
16
|
export declare const AttachOptionsSchema: z.ZodObject<{
|
|
17
17
|
addressProvider: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>;
|
|
18
18
|
marketConfigurators: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
19
|
+
kycFactories: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
19
20
|
blockNumber: z.ZodOptional<z.ZodUnion<readonly [z.ZodBigInt, z.ZodNumber]>>;
|
|
20
21
|
ignoreUpdateablePrices: z.ZodOptional<z.ZodBoolean>;
|
|
21
22
|
ignoreMarkets: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>>>;
|
|
@@ -4,35 +4,35 @@ import type { AddLiquidityProps, DepositMetadata, IPoolsService, PoolServiceCall
|
|
|
4
4
|
export declare class PoolService extends SDKConstruct implements IPoolsService {
|
|
5
5
|
#private;
|
|
6
6
|
/**
|
|
7
|
-
* @
|
|
7
|
+
* {@inheritDoc IPoolsService.getDepositTokensIn}
|
|
8
8
|
*/
|
|
9
9
|
getDepositTokensIn(pool: Address): Address[];
|
|
10
10
|
/**
|
|
11
|
-
* @
|
|
11
|
+
* {@inheritDoc IPoolsService.getDepositTokensOut}
|
|
12
12
|
*/
|
|
13
13
|
getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
14
14
|
/**
|
|
15
|
-
* @
|
|
15
|
+
* {@inheritDoc IPoolsService.getDepositMetadata}
|
|
16
16
|
*/
|
|
17
17
|
getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
|
|
18
18
|
/**
|
|
19
|
-
* @
|
|
19
|
+
* {@inheritDoc IPoolsService.addLiquidity}
|
|
20
20
|
*/
|
|
21
21
|
addLiquidity(props: AddLiquidityProps): PoolServiceCall | undefined;
|
|
22
22
|
/**
|
|
23
|
-
* @
|
|
23
|
+
* {@inheritDoc IPoolsService.getWithdrawalTokensIn}
|
|
24
24
|
*/
|
|
25
25
|
getWithdrawalTokensIn(pool: Address): Address[];
|
|
26
26
|
/**
|
|
27
|
-
* @
|
|
27
|
+
* {@inheritDoc IPoolsService.getWithdrawalTokensOut}
|
|
28
28
|
*/
|
|
29
29
|
getWithdrawalTokensOut(pool: Address, tokenIn: Address): Address[];
|
|
30
30
|
/**
|
|
31
|
-
* @
|
|
31
|
+
* {@inheritDoc IPoolsService.removeLiquidity}
|
|
32
32
|
*/
|
|
33
33
|
removeLiquidity(props: RemoveLiquidityProps): PoolServiceCall;
|
|
34
34
|
/**
|
|
35
|
-
* @
|
|
35
|
+
* {@inheritDoc IPoolsService.getWithdrawalMetadata}
|
|
36
36
|
*/
|
|
37
37
|
getWithdrawalMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): WithdrawalMetadata;
|
|
38
38
|
}
|
|
@@ -52,7 +52,7 @@ export interface RemoveLiquidityProps {
|
|
|
52
52
|
permit: PermitResult | undefined;
|
|
53
53
|
meta: WithdrawalMetadata;
|
|
54
54
|
}
|
|
55
|
-
export type MarketType = "classic";
|
|
55
|
+
export type MarketType = "kyc-on-demand" | "kyc-default" | "classic";
|
|
56
56
|
export interface DepositMetadata {
|
|
57
57
|
/**
|
|
58
58
|
* Zapper that will perform the deposit, undefined in case of direct pool underlying deposit
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Address } from "viem";
|
|
2
2
|
import type { TokenMetaData } from "../base/index.js";
|
|
3
3
|
import type { PriceFeedContractType } from "../market/index.js";
|
|
4
|
+
import type { KYCStateHuman } from "../market/kyc/index.js";
|
|
4
5
|
export interface BaseContractStateHuman {
|
|
5
6
|
address: string;
|
|
6
7
|
version: number;
|
|
@@ -200,6 +201,7 @@ export interface GearboxStateHuman {
|
|
|
200
201
|
markets: MarketStateHuman[];
|
|
201
202
|
plugins: Record<string, unknown>;
|
|
202
203
|
tokens: TokenMetaData[];
|
|
204
|
+
kyc: KYCStateHuman;
|
|
203
205
|
}
|
|
204
206
|
/**
|
|
205
207
|
* Human-readable state for all chains managed by {@link MultichainSDK}.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { MarketData } from "../base/index.js";
|
|
2
2
|
import type { NetworkType } from "../chain/chains.js";
|
|
3
3
|
import type { AddressProviderState } from "../core/index.js";
|
|
4
|
+
import type { KYCState } from "../market/kyc/index.js";
|
|
4
5
|
import type { PluginStatesMap, PluginsMap } from "../plugins/index.js";
|
|
5
6
|
/**
|
|
6
7
|
* Complete serialisable snapshot of the SDK state for a single chain.
|
|
@@ -40,6 +41,10 @@ export interface GearboxState<Plugins extends PluginsMap = {}> {
|
|
|
40
41
|
* All loaded market data.
|
|
41
42
|
**/
|
|
42
43
|
markets: MarketData[];
|
|
44
|
+
/**
|
|
45
|
+
* KYC compressor state snapshot, if KYC factories were loaded.
|
|
46
|
+
**/
|
|
47
|
+
kyc?: KYCState;
|
|
43
48
|
/**
|
|
44
49
|
* Per-plugin serialised state.
|
|
45
50
|
**/
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Chain, Client, ContractFunctionParameters, Transport } from "viem";
|
|
2
|
+
import type { IPriceUpdateTx } from "../../types/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* A contract call paired with a callback that receives its decoded result.
|
|
5
|
+
* Used to compose batched on-chain reads that are executed together inside a
|
|
6
|
+
* single {@link simulateWithPriceUpdates} call.
|
|
7
|
+
**/
|
|
8
|
+
export interface DelegatedMulticall {
|
|
9
|
+
/** Contract call parameters (ABI, address, function name, args). */
|
|
10
|
+
call: ContractFunctionParameters;
|
|
11
|
+
/** Callback invoked with the decoded return value after simulation. */
|
|
12
|
+
onResult: (resp: unknown) => void;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Executes multiple contract read calls in a single
|
|
16
|
+
* {@link simulateWithPriceUpdates} batch and dispatches each result to its
|
|
17
|
+
* corresponding {@link DelegatedMulticall.onResult} callback.
|
|
18
|
+
*
|
|
19
|
+
* @param client - Viem public client.
|
|
20
|
+
* @param multicalls - Calls to execute with their result handlers.
|
|
21
|
+
* @param opts - Price-update transactions, target block number, and optional
|
|
22
|
+
* gas limit forwarded to the simulation.
|
|
23
|
+
**/
|
|
24
|
+
export declare function executeDelegatedMulticalls(client: Client<Transport, Chain>, multicalls: DelegatedMulticall[], opts: {
|
|
25
|
+
priceUpdates: IPriceUpdateTx[];
|
|
26
|
+
blockNumber: bigint;
|
|
27
|
+
gas?: bigint;
|
|
28
|
+
}): Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function stringifyGetCreditAccountsArgs(args) {
|
|
2
|
-
const s = JSON.stringify(args, replacer);
|
|
3
|
-
return JSON.parse(s);
|
|
4
|
-
}
|
|
5
|
-
function replacer(_key, value) {
|
|
6
|
-
if (typeof value === "bigint") {
|
|
7
|
-
return value.toString();
|
|
8
|
-
} else {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
export {
|
|
13
|
-
stringifyGetCreditAccountsArgs
|
|
14
|
-
};
|