@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.
Files changed (109) hide show
  1. package/dist/cjs/abi/kyc/iDSRegistryService.js +149 -0
  2. package/dist/cjs/abi/kyc/iDSToken.js +71 -0
  3. package/dist/cjs/abi/kyc/iKYCCompressor.js +196 -0
  4. package/dist/cjs/abi/kyc/iKYCFactory.js +122 -0
  5. package/dist/cjs/abi/kyc/iKYCUnderlying.js +401 -0
  6. package/dist/cjs/abi/kyc/iSecuritizeDegenNFT.js +326 -0
  7. package/dist/cjs/abi/kyc/iSecuritizeKYCFactory.js +319 -0
  8. package/dist/cjs/dev/AccountOpener.js +45 -5
  9. package/dist/cjs/sdk/OnchainSDK.js +55 -5
  10. package/dist/cjs/sdk/accounts/AbstractCreditAccountsService.js +335 -21
  11. package/dist/cjs/sdk/accounts/CreditAccountsServiceV310.js +7 -1
  12. package/dist/cjs/sdk/base/TokensMeta.js +22 -42
  13. package/dist/cjs/sdk/base/token-types.js +9 -0
  14. package/dist/cjs/sdk/chain/chains.js +18 -1
  15. package/dist/cjs/sdk/constants/address-provider.js +3 -0
  16. package/dist/cjs/sdk/market/MarketRegister.js +70 -116
  17. package/dist/cjs/sdk/market/MarketSuite.js +3 -0
  18. package/dist/cjs/sdk/market/index.js +2 -0
  19. package/dist/cjs/sdk/market/kyc/KYCRegistry.js +269 -0
  20. package/dist/cjs/sdk/market/kyc/index.js +26 -0
  21. package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +242 -0
  22. package/dist/cjs/sdk/market/kyc/securitize/constants.js +28 -0
  23. package/dist/cjs/sdk/market/kyc/securitize/index.js +26 -0
  24. package/dist/cjs/sdk/market/kyc/securitize/types.js +16 -0
  25. package/dist/cjs/sdk/{accounts/utils.js → market/kyc/types.js} +11 -15
  26. package/dist/cjs/sdk/market/pool/PoolSuite.js +3 -0
  27. package/dist/cjs/sdk/market/pool/PoolV310Contract.js +11 -2
  28. package/dist/cjs/sdk/market/pool/index.js +2 -0
  29. package/dist/cjs/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  30. package/dist/cjs/sdk/options.js +6 -0
  31. package/dist/cjs/sdk/pools/PoolService.js +104 -12
  32. package/dist/cjs/sdk/utils/viem/executeDelegatedMulticalls.js +38 -0
  33. package/dist/cjs/sdk/utils/viem/index.js +2 -0
  34. package/dist/esm/abi/kyc/iDSRegistryService.js +125 -0
  35. package/dist/esm/abi/kyc/iDSToken.js +47 -0
  36. package/dist/esm/abi/kyc/iKYCCompressor.js +172 -0
  37. package/dist/esm/abi/kyc/iKYCFactory.js +98 -0
  38. package/dist/esm/abi/kyc/iKYCUnderlying.js +377 -0
  39. package/dist/esm/abi/kyc/iSecuritizeDegenNFT.js +302 -0
  40. package/dist/esm/abi/kyc/iSecuritizeKYCFactory.js +295 -0
  41. package/dist/esm/dev/AccountOpener.js +47 -6
  42. package/dist/esm/sdk/OnchainSDK.js +57 -5
  43. package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +336 -22
  44. package/dist/esm/sdk/accounts/CreditAccountsServiceV310.js +7 -1
  45. package/dist/esm/sdk/base/TokensMeta.js +22 -44
  46. package/dist/esm/sdk/base/token-types.js +6 -0
  47. package/dist/esm/sdk/chain/chains.js +18 -1
  48. package/dist/esm/sdk/constants/address-provider.js +2 -0
  49. package/dist/esm/sdk/market/MarketRegister.js +74 -118
  50. package/dist/esm/sdk/market/MarketSuite.js +3 -0
  51. package/dist/esm/sdk/market/index.js +1 -0
  52. package/dist/esm/sdk/market/kyc/KYCRegistry.js +253 -0
  53. package/dist/esm/sdk/market/kyc/index.js +3 -0
  54. package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +218 -0
  55. package/dist/esm/sdk/market/kyc/securitize/constants.js +4 -0
  56. package/dist/esm/sdk/market/kyc/securitize/index.js +3 -0
  57. package/dist/esm/sdk/market/kyc/securitize/types.js +0 -0
  58. package/dist/esm/sdk/market/kyc/types.js +9 -0
  59. package/dist/esm/sdk/market/pool/PoolSuite.js +3 -0
  60. package/dist/esm/sdk/market/pool/PoolV310Contract.js +11 -2
  61. package/dist/esm/sdk/market/pool/index.js +1 -0
  62. package/dist/esm/sdk/market/pricefeeds/PriceFeedsRegister.js +3 -3
  63. package/dist/esm/sdk/options.js +6 -0
  64. package/dist/esm/sdk/pools/PoolService.js +109 -13
  65. package/dist/esm/sdk/utils/viem/executeDelegatedMulticalls.js +14 -0
  66. package/dist/esm/sdk/utils/viem/index.js +1 -0
  67. package/dist/types/abi/kyc/iDSRegistryService.d.ts +191 -0
  68. package/dist/types/abi/kyc/iDSToken.d.ts +67 -0
  69. package/dist/types/abi/kyc/iKYCCompressor.d.ts +228 -0
  70. package/dist/types/abi/kyc/iKYCFactory.d.ts +139 -0
  71. package/dist/types/abi/kyc/iKYCUnderlying.d.ts +548 -0
  72. package/dist/types/abi/kyc/iSecuritizeDegenNFT.d.ts +404 -0
  73. package/dist/types/abi/kyc/iSecuritizeKYCFactory.d.ts +376 -0
  74. package/dist/types/sdk/OnchainSDK.d.ts +19 -1
  75. package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +59 -6
  76. package/dist/types/sdk/accounts/CreditAccountsServiceV310.d.ts +1 -1
  77. package/dist/types/sdk/accounts/types.d.ts +114 -14
  78. package/dist/types/sdk/base/TokensMeta.d.ts +14 -3
  79. package/dist/types/sdk/base/token-types.d.ts +44 -4
  80. package/dist/types/sdk/base/types.d.ts +116 -2
  81. package/dist/types/sdk/chain/chains.d.ts +5 -1
  82. package/dist/types/sdk/constants/address-provider.d.ts +1 -0
  83. package/dist/types/sdk/market/MarketRegister.d.ts +6 -9
  84. package/dist/types/sdk/market/MarketSuite.d.ts +2 -0
  85. package/dist/types/sdk/market/index.d.ts +1 -0
  86. package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +52 -0
  87. package/dist/types/sdk/market/kyc/index.d.ts +3 -0
  88. package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +429 -0
  89. package/dist/types/sdk/market/kyc/securitize/constants.d.ts +1 -0
  90. package/dist/types/sdk/market/kyc/securitize/index.d.ts +3 -0
  91. package/dist/types/sdk/market/kyc/securitize/types.d.ts +136 -0
  92. package/dist/types/sdk/market/kyc/types.d.ts +171 -0
  93. package/dist/types/sdk/market/oracle/PriceOracleBaseContract.d.ts +3 -2
  94. package/dist/types/sdk/market/oracle/types.d.ts +3 -10
  95. package/dist/types/sdk/market/pool/PoolSuite.d.ts +2 -0
  96. package/dist/types/sdk/market/pool/PoolV310Contract.d.ts +6 -2
  97. package/dist/types/sdk/market/pool/index.d.ts +1 -0
  98. package/dist/types/sdk/market/pricefeeds/PriceFeedsRegister.d.ts +1 -1
  99. package/dist/types/sdk/market/types.d.ts +1 -1
  100. package/dist/types/sdk/options.d.ts +1 -0
  101. package/dist/types/sdk/pools/PoolService.d.ts +8 -8
  102. package/dist/types/sdk/pools/types.d.ts +1 -1
  103. package/dist/types/sdk/types/state-human.d.ts +2 -0
  104. package/dist/types/sdk/types/state.d.ts +5 -0
  105. package/dist/types/sdk/utils/viem/executeDelegatedMulticalls.d.ts +28 -0
  106. package/dist/types/sdk/utils/viem/index.d.ts +1 -0
  107. package/package.json +1 -1
  108. package/dist/esm/sdk/accounts/utils.js +0 -14
  109. 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 { DelegatedOracleMulticall, IPriceOracleContract, OnDemandPriceUpdates, PriceFeedsForTokensOptions } from "./types.js";
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(): DelegatedOracleMulticall;
78
+ syncStateMulticall(): DelegatedMulticall;
78
79
  /**
79
80
  * {@inheritDoc IPriceOracleContract.watchAddresses}
80
81
  **/
@@ -1,8 +1,8 @@
1
- import type { Address, ContractFunctionParameters, ContractFunctionReturnType } from "viem";
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: () => DelegatedOracleMulticall;
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 { ConstructOptions, CreditManagerDebtParams, PoolState } from "../../base/index.js";
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(options: ConstructOptions, data: PoolState);
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[];
@@ -1,4 +1,5 @@
1
1
  export * from "./GaugeContract.js";
2
2
  export * from "./LinearInterestRateModelContract.js";
3
3
  export * from "./PoolSuite.js";
4
+ export * from "./PoolV310Contract.js";
4
5
  export * from "./types.js";
@@ -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[], pools?: Address[]): Promise<IPriceFeedContract[]>;
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
- * @inheritdoc IPoolsService.getDepositTokensIn
7
+ * {@inheritDoc IPoolsService.getDepositTokensIn}
8
8
  */
9
9
  getDepositTokensIn(pool: Address): Address[];
10
10
  /**
11
- * @inheritdoc IPoolsService.getDepositTokensOut
11
+ * {@inheritDoc IPoolsService.getDepositTokensOut}
12
12
  */
13
13
  getDepositTokensOut(pool: Address, tokenIn: Address): Address[];
14
14
  /**
15
- * @inheritdoc IPoolsService.getDepositMetadata
15
+ * {@inheritDoc IPoolsService.getDepositMetadata}
16
16
  */
17
17
  getDepositMetadata(pool: Address, tokenIn: Address, tokenOut?: Address): DepositMetadata;
18
18
  /**
19
- * @inheritdoc IPoolsService.addLiquidity
19
+ * {@inheritDoc IPoolsService.addLiquidity}
20
20
  */
21
21
  addLiquidity(props: AddLiquidityProps): PoolServiceCall | undefined;
22
22
  /**
23
- * @inheritdoc IPoolsService.getWithdrawalTokensIn
23
+ * {@inheritDoc IPoolsService.getWithdrawalTokensIn}
24
24
  */
25
25
  getWithdrawalTokensIn(pool: Address): Address[];
26
26
  /**
27
- * @inheritdoc IPoolsService.getWithdrawalTokensOut
27
+ * {@inheritDoc IPoolsService.getWithdrawalTokensOut}
28
28
  */
29
29
  getWithdrawalTokensOut(pool: Address, tokenIn: Address): Address[];
30
30
  /**
31
- * @inheritdoc IPoolsService.removeLiquidity
31
+ * {@inheritDoc IPoolsService.removeLiquidity}
32
32
  */
33
33
  removeLiquidity(props: RemoveLiquidityProps): PoolServiceCall;
34
34
  /**
35
- * @inheritdoc IPoolsService.getWithdrawalMetadata
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>;
@@ -1,4 +1,5 @@
1
1
  export * from "./cast.js";
2
+ export * from "./executeDelegatedMulticalls.js";
2
3
  export * from "./sendRawTx.js";
3
4
  export * from "./simulateMulticall.js";
4
5
  export * from "./simulateWithPriceUpdates.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.0.0",
3
+ "version": "14.1.0",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -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
- };
@@ -1,2 +0,0 @@
1
- import type { GetCreditAccountsArgs } from "./types.js";
2
- export declare function stringifyGetCreditAccountsArgs(args: GetCreditAccountsArgs): Record<any, any>;