@gearbox-protocol/sdk 13.7.0-kyc.4 → 13.7.0-kyc.5
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/sdk/accounts/AbstractCreditAccountsService.js +22 -13
- package/dist/cjs/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +2 -2
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +22 -16
- package/dist/esm/sdk/market/kyc/securitize/SecuritizeKYCFactory.js +2 -2
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +9 -6
- package/dist/types/sdk/accounts/types.d.ts +2 -2
- package/dist/types/sdk/market/kyc/KYCRegistry.d.ts +2 -2
- package/dist/types/sdk/market/kyc/securitize/SecuritizeKYCFactory.d.ts +3 -3
- package/dist/types/sdk/market/kyc/securitize/types.d.ts +2 -1
- package/dist/types/sdk/market/kyc/types.d.ts +23 -28
- package/package.json +1 -1
|
@@ -35,7 +35,6 @@ var import_base = require("../base/index.js");
|
|
|
35
35
|
var import_chains = require("../chain/chains.js");
|
|
36
36
|
var import_constants = require("../constants/index.js");
|
|
37
37
|
var import_market = require("../market/index.js");
|
|
38
|
-
var import_kyc = require("../market/kyc/index.js");
|
|
39
38
|
var import_router = require("../router/index.js");
|
|
40
39
|
var import_utils = require("../utils/index.js");
|
|
41
40
|
var import_viem2 = require("../utils/viem/index.js");
|
|
@@ -1337,19 +1336,21 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1337
1336
|
* @param to
|
|
1338
1337
|
* @param calls
|
|
1339
1338
|
* @param referralCode
|
|
1339
|
+
* @param kycOptions
|
|
1340
1340
|
* @returns
|
|
1341
1341
|
*/
|
|
1342
|
-
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1342
|
+
async openCreditAccountTx(suite, to, calls, referralCode, kycOptions) {
|
|
1343
1343
|
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
1344
1344
|
const factory = marketSuite.kycFactory;
|
|
1345
|
-
if (factory
|
|
1346
|
-
|
|
1347
|
-
(
|
|
1345
|
+
if (factory) {
|
|
1346
|
+
if (!kycOptions) {
|
|
1347
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1348
|
+
}
|
|
1349
|
+
return factory.openCreditAccount(
|
|
1350
|
+
suite.creditManager.address,
|
|
1351
|
+
calls,
|
|
1352
|
+
kycOptions
|
|
1348
1353
|
);
|
|
1349
|
-
return factory.openCreditAccount(suite.creditManager.address, calls, {
|
|
1350
|
-
tokensToRegister,
|
|
1351
|
-
signaturesToCache: []
|
|
1352
|
-
});
|
|
1353
1354
|
}
|
|
1354
1355
|
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1355
1356
|
}
|
|
@@ -1358,15 +1359,19 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1358
1359
|
* @param suite
|
|
1359
1360
|
* @param creditAccount
|
|
1360
1361
|
* @param calls
|
|
1362
|
+
* @param options
|
|
1361
1363
|
* @returns
|
|
1362
1364
|
*/
|
|
1363
|
-
async multicallTx(suite, creditAccount, calls) {
|
|
1365
|
+
async multicallTx(suite, creditAccount, calls, kycOptions) {
|
|
1364
1366
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1365
1367
|
suite.creditManager.address
|
|
1366
1368
|
);
|
|
1367
1369
|
const factory = marketSuite.kycFactory;
|
|
1368
1370
|
if (factory) {
|
|
1369
|
-
|
|
1371
|
+
if (!kycOptions) {
|
|
1372
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1373
|
+
}
|
|
1374
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1370
1375
|
}
|
|
1371
1376
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1372
1377
|
}
|
|
@@ -1376,9 +1381,10 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1376
1381
|
* @param creditAccount
|
|
1377
1382
|
* @param calls
|
|
1378
1383
|
* @param operation
|
|
1384
|
+
* @param kycOptions
|
|
1379
1385
|
* @returns
|
|
1380
1386
|
*/
|
|
1381
|
-
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1387
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation, kycOptions) {
|
|
1382
1388
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1383
1389
|
suite.creditManager.address
|
|
1384
1390
|
);
|
|
@@ -1392,7 +1398,10 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1392
1398
|
return suite.creditFacade.closeCreditAccount(creditAccount, calls);
|
|
1393
1399
|
}
|
|
1394
1400
|
if (factory) {
|
|
1395
|
-
|
|
1401
|
+
if (!kycOptions) {
|
|
1402
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1403
|
+
}
|
|
1404
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1396
1405
|
}
|
|
1397
1406
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1398
1407
|
}
|
|
@@ -141,7 +141,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
141
141
|
* {@inheritDoc IKYCFactory.multicall}
|
|
142
142
|
*/
|
|
143
143
|
multicall(creditAccount, calls, options) {
|
|
144
|
-
const { tokensToRegister
|
|
144
|
+
const { tokensToRegister, signaturesToCache } = options;
|
|
145
145
|
return this.createRawTx({
|
|
146
146
|
functionName: "multicall",
|
|
147
147
|
args: [creditAccount, calls, tokensToRegister, signaturesToCache]
|
|
@@ -177,7 +177,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
|
|
|
177
177
|
* {@inheritDoc IKYCFactory.openCreditAccount}
|
|
178
178
|
*/
|
|
179
179
|
openCreditAccount(creditManager, calls, options) {
|
|
180
|
-
const { tokensToRegister
|
|
180
|
+
const { tokensToRegister, signaturesToCache } = options;
|
|
181
181
|
return this.createRawTx({
|
|
182
182
|
functionName: "openCreditAccount",
|
|
183
183
|
args: [creditManager, calls, tokensToRegister, signaturesToCache]
|
|
@@ -26,10 +26,6 @@ import {
|
|
|
26
26
|
import {
|
|
27
27
|
getRawPriceUpdates
|
|
28
28
|
} from "../market/index.js";
|
|
29
|
-
import {
|
|
30
|
-
isKYCFactory,
|
|
31
|
-
KYC_FACTORY_SECURITIZE
|
|
32
|
-
} from "../market/kyc/index.js";
|
|
33
29
|
import { assetsMap } from "../router/index.js";
|
|
34
30
|
import { AddressMap, AddressSet, hexEq } from "../utils/index.js";
|
|
35
31
|
import { simulateWithPriceUpdates } from "../utils/viem/index.js";
|
|
@@ -1335,19 +1331,21 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1335
1331
|
* @param to
|
|
1336
1332
|
* @param calls
|
|
1337
1333
|
* @param referralCode
|
|
1334
|
+
* @param kycOptions
|
|
1338
1335
|
* @returns
|
|
1339
1336
|
*/
|
|
1340
|
-
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1337
|
+
async openCreditAccountTx(suite, to, calls, referralCode, kycOptions) {
|
|
1341
1338
|
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
1342
1339
|
const factory = marketSuite.kycFactory;
|
|
1343
|
-
if (factory
|
|
1344
|
-
|
|
1345
|
-
(
|
|
1340
|
+
if (factory) {
|
|
1341
|
+
if (!kycOptions) {
|
|
1342
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1343
|
+
}
|
|
1344
|
+
return factory.openCreditAccount(
|
|
1345
|
+
suite.creditManager.address,
|
|
1346
|
+
calls,
|
|
1347
|
+
kycOptions
|
|
1346
1348
|
);
|
|
1347
|
-
return factory.openCreditAccount(suite.creditManager.address, calls, {
|
|
1348
|
-
tokensToRegister,
|
|
1349
|
-
signaturesToCache: []
|
|
1350
|
-
});
|
|
1351
1349
|
}
|
|
1352
1350
|
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1353
1351
|
}
|
|
@@ -1356,15 +1354,19 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1356
1354
|
* @param suite
|
|
1357
1355
|
* @param creditAccount
|
|
1358
1356
|
* @param calls
|
|
1357
|
+
* @param options
|
|
1359
1358
|
* @returns
|
|
1360
1359
|
*/
|
|
1361
|
-
async multicallTx(suite, creditAccount, calls) {
|
|
1360
|
+
async multicallTx(suite, creditAccount, calls, kycOptions) {
|
|
1362
1361
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1363
1362
|
suite.creditManager.address
|
|
1364
1363
|
);
|
|
1365
1364
|
const factory = marketSuite.kycFactory;
|
|
1366
1365
|
if (factory) {
|
|
1367
|
-
|
|
1366
|
+
if (!kycOptions) {
|
|
1367
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1368
|
+
}
|
|
1369
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1368
1370
|
}
|
|
1369
1371
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1370
1372
|
}
|
|
@@ -1374,9 +1376,10 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1374
1376
|
* @param creditAccount
|
|
1375
1377
|
* @param calls
|
|
1376
1378
|
* @param operation
|
|
1379
|
+
* @param kycOptions
|
|
1377
1380
|
* @returns
|
|
1378
1381
|
*/
|
|
1379
|
-
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1382
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation, kycOptions) {
|
|
1380
1383
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1381
1384
|
suite.creditManager.address
|
|
1382
1385
|
);
|
|
@@ -1390,7 +1393,10 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1390
1393
|
return suite.creditFacade.closeCreditAccount(creditAccount, calls);
|
|
1391
1394
|
}
|
|
1392
1395
|
if (factory) {
|
|
1393
|
-
|
|
1396
|
+
if (!kycOptions) {
|
|
1397
|
+
throw new Error("KYC options are required for KYC factories");
|
|
1398
|
+
}
|
|
1399
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1394
1400
|
}
|
|
1395
1401
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1396
1402
|
}
|
|
@@ -118,7 +118,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
118
118
|
* {@inheritDoc IKYCFactory.multicall}
|
|
119
119
|
*/
|
|
120
120
|
multicall(creditAccount, calls, options) {
|
|
121
|
-
const { tokensToRegister
|
|
121
|
+
const { tokensToRegister, signaturesToCache } = options;
|
|
122
122
|
return this.createRawTx({
|
|
123
123
|
functionName: "multicall",
|
|
124
124
|
args: [creditAccount, calls, tokensToRegister, signaturesToCache]
|
|
@@ -154,7 +154,7 @@ class SecuritizeKYCFactory extends BaseContract {
|
|
|
154
154
|
* {@inheritDoc IKYCFactory.openCreditAccount}
|
|
155
155
|
*/
|
|
156
156
|
openCreditAccount(creditManager, calls, options) {
|
|
157
|
-
const { tokensToRegister
|
|
157
|
+
const { tokensToRegister, signaturesToCache } = options;
|
|
158
158
|
return this.createRawTx({
|
|
159
159
|
functionName: "openCreditAccount",
|
|
160
160
|
args: [creditManager, calls, tokensToRegister, signaturesToCache]
|
|
@@ -2,9 +2,9 @@ import type { Address } from "viem";
|
|
|
2
2
|
import type { CreditAccountData } from "../base/index.js";
|
|
3
3
|
import { SDKConstruct } from "../base/index.js";
|
|
4
4
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
5
|
-
import type { CreditSuite } from "../market/index.js";
|
|
5
|
+
import type { CreditSuite, KYCOperationParams } from "../market/index.js";
|
|
6
6
|
import { type PriceUpdate, type UpdatePriceFeedsResult } from "../market/index.js";
|
|
7
|
-
import { type
|
|
7
|
+
import { type KYCOpenAccountRequirements } from "../market/kyc/index.js";
|
|
8
8
|
import { type Asset, type RouterCASlice } from "../router/index.js";
|
|
9
9
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
10
10
|
import type { AccountToCheck, AddCollateralProps, ChangeDeptProps, ClaimDelayedProps, CloseCreditAccountProps, CloseCreditAccountResult, CloseOptions, CreditAccountOperationResult, CreditAccountTokensSlice, ExecuteSwapProps, FullyLiquidateProps, FullyLiquidateResult, GetApprovalAddressProps, GetConnectedBotsResult, GetConnectedMigrationBotsResult, GetCreditAccountsOptions, GetOpenAccountRequirementsProps, GetPendingWithdrawalsProps, GetPendingWithdrawalsResult, OpenCAProps, PermitResult, PrepareUpdateQuotasProps, PreviewDelayedWithdrawalProps, PreviewDelayedWithdrawalResult, Rewards, StartDelayedWithdrawalProps, UpdateQuotasProps } from "./types.js";
|
|
@@ -101,7 +101,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
101
101
|
/**
|
|
102
102
|
* {@inheritDoc ICreditAccountsService.getOpenAccountRequirements}
|
|
103
103
|
*/
|
|
104
|
-
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<
|
|
104
|
+
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<KYCOpenAccountRequirements | undefined>;
|
|
105
105
|
/**
|
|
106
106
|
* {@inheritDoc ICreditAccountsService.openCA}
|
|
107
107
|
**/
|
|
@@ -200,24 +200,27 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
|
|
|
200
200
|
* @param to
|
|
201
201
|
* @param calls
|
|
202
202
|
* @param referralCode
|
|
203
|
+
* @param kycOptions
|
|
203
204
|
* @returns
|
|
204
205
|
*/
|
|
205
|
-
protected openCreditAccountTx(suite: CreditSuite, to: Address, calls: MultiCall[], referralCode?: bigint): Promise<RawTx>;
|
|
206
|
+
protected openCreditAccountTx(suite: CreditSuite, to: Address, calls: MultiCall[], referralCode?: bigint, kycOptions?: KYCOperationParams): Promise<RawTx>;
|
|
206
207
|
/**
|
|
207
208
|
* Wrapper that selects between credit facade and KYC factory
|
|
208
209
|
* @param suite
|
|
209
210
|
* @param creditAccount
|
|
210
211
|
* @param calls
|
|
212
|
+
* @param options
|
|
211
213
|
* @returns
|
|
212
214
|
*/
|
|
213
|
-
protected multicallTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[]): Promise<RawTx>;
|
|
215
|
+
protected multicallTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[], kycOptions?: KYCOperationParams): Promise<RawTx>;
|
|
214
216
|
/**
|
|
215
217
|
* Wrapper that selects between credit facade and KYC factory
|
|
216
218
|
* @param suite
|
|
217
219
|
* @param creditAccount
|
|
218
220
|
* @param calls
|
|
219
221
|
* @param operation
|
|
222
|
+
* @param kycOptions
|
|
220
223
|
* @returns
|
|
221
224
|
*/
|
|
222
|
-
protected closeCreditAccountTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[], operation: CloseOptions): Promise<RawTx>;
|
|
225
|
+
protected closeCreditAccountTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[], operation: CloseOptions, kycOptions?: KYCOperationParams): Promise<RawTx>;
|
|
223
226
|
}
|
|
@@ -4,7 +4,7 @@ import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompress
|
|
|
4
4
|
import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
|
|
5
5
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
6
6
|
import type { CreditSuite, PriceUpdate } from "../market/index.js";
|
|
7
|
-
import type {
|
|
7
|
+
import type { KYCOpenAccountRequirements } from "../market/kyc/index.js";
|
|
8
8
|
import type { Asset, RouterCASlice, RouterCloseResult } from "../router/index.js";
|
|
9
9
|
import type { MultiCall, RawTx } from "../types/index.js";
|
|
10
10
|
/**
|
|
@@ -748,7 +748,7 @@ export interface ICreditAccountsService extends Construct {
|
|
|
748
748
|
* @param props - {@link GetOpenAccountRequirementsProps} you can pass StrategyConfigPayload here
|
|
749
749
|
* @returns Open account requirements or undefined if the user can open a credit account without any further actions
|
|
750
750
|
*/
|
|
751
|
-
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<
|
|
751
|
+
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<KYCOpenAccountRequirements | undefined>;
|
|
752
752
|
/**
|
|
753
753
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
754
754
|
* - Open credit account is executed in the following order: price update -> increase debt -> add collateral ->
|
|
@@ -2,7 +2,7 @@ import type { Address } from "abitype";
|
|
|
2
2
|
import { SDKConstruct } from "../../base/index.js";
|
|
3
3
|
import type { DelegatedMulticall } from "../../utils/viem/index.js";
|
|
4
4
|
import { SecuritizeKYCFactory } from "./securitize/index.js";
|
|
5
|
-
import type {
|
|
5
|
+
import type { KYCCompressorResponse, KYCInvestorData, KYCState, KYCStateHuman } from "./types.js";
|
|
6
6
|
/**
|
|
7
7
|
* Registry of KYC underlying tokens and KYC factory contracts.
|
|
8
8
|
*
|
|
@@ -32,7 +32,7 @@ export declare class KYCRegistry extends SDKConstruct {
|
|
|
32
32
|
* @param factories_ - Optional subset of factory addresses to query.
|
|
33
33
|
* When omitted, all loaded factories are used.
|
|
34
34
|
*/
|
|
35
|
-
getInvestorData(investor: Address, factories_?: Address[]): Promise<
|
|
35
|
+
getInvestorData(investor: Address, factories_?: Address[]): Promise<KYCInvestorData[]>;
|
|
36
36
|
/** All loaded KYC factory instances. */
|
|
37
37
|
get factories(): SecuritizeKYCFactory[];
|
|
38
38
|
/** Raw KYC compressor response, or `undefined` before attach/hydrate. */
|
|
@@ -5,7 +5,7 @@ import type { GearboxSDK } from "../../../GearboxSDK.js";
|
|
|
5
5
|
import type { MultiCall, RawTx } from "../../../types/index.js";
|
|
6
6
|
import type { IKYCFactory, KYCCompressorInvestorData, KYCFactoryData } from "../types.js";
|
|
7
7
|
import { KYC_FACTORY_SECURITIZE } from "./constants.js";
|
|
8
|
-
import type { DStokenData, SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman,
|
|
8
|
+
import type { DStokenData, SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman, SecuritizeOpenAccountRequirements, SecuritizeOperationParams } from "./types.js";
|
|
9
9
|
declare const abi: readonly [{
|
|
10
10
|
readonly type: "function";
|
|
11
11
|
readonly name: "contractType";
|
|
@@ -415,7 +415,7 @@ export declare class SecuritizeKYCFactory extends BaseContract<abi> implements I
|
|
|
415
415
|
/**
|
|
416
416
|
* {@inheritDoc IKYCFactory.multicall}
|
|
417
417
|
*/
|
|
418
|
-
multicall(creditAccount: Address, calls: MultiCall[], options
|
|
418
|
+
multicall(creditAccount: Address, calls: MultiCall[], options: SecuritizeOperationParams): RawTx;
|
|
419
419
|
/**
|
|
420
420
|
* {@inheritDoc IKYCFactory.getOpenAccountRequirements}
|
|
421
421
|
*/
|
|
@@ -423,7 +423,7 @@ export declare class SecuritizeKYCFactory extends BaseContract<abi> implements I
|
|
|
423
423
|
/**
|
|
424
424
|
* {@inheritDoc IKYCFactory.openCreditAccount}
|
|
425
425
|
*/
|
|
426
|
-
openCreditAccount(creditManager: Address, calls: MultiCall[], options
|
|
426
|
+
openCreditAccount(creditManager: Address, calls: MultiCall[], options: SecuritizeOperationParams): RawTx;
|
|
427
427
|
stateHuman(_raw?: boolean): SecuritizeKYCFactoryStateHuman;
|
|
428
428
|
}
|
|
429
429
|
export {};
|
|
@@ -107,7 +107,8 @@ export interface SecuritizeKYCFactoryStateHuman extends BaseContractStateHuman {
|
|
|
107
107
|
* Factory-specific parameters for {@link SecuritizeKYCFactory.multicall}
|
|
108
108
|
* and {@link SecuritizeKYCFactory.openCreditAccount}.
|
|
109
109
|
**/
|
|
110
|
-
export interface
|
|
110
|
+
export interface SecuritizeOperationParams {
|
|
111
|
+
type: typeof KYC_FACTORY_SECURITIZE;
|
|
111
112
|
/** DSToken addresses to register for this operation. */
|
|
112
113
|
tokensToRegister: Address[];
|
|
113
114
|
/** Cached EIP-712 registration signatures to store on-chain. */
|
|
@@ -4,7 +4,7 @@ import type { iKYCCompressorAbi } from "../../../abi/kyc/iKYCCompressor.js";
|
|
|
4
4
|
import type { GetOpenAccountRequirementsProps } from "../../accounts/types.js";
|
|
5
5
|
import type { IBaseContract, Unarray } from "../../base/index.js";
|
|
6
6
|
import type { MultiCall, RawTx } from "../../types/index.js";
|
|
7
|
-
import type { SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman,
|
|
7
|
+
import type { SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman, SecuritizeOpenAccountRequirements, SecuritizeOperationParams } from "./securitize/index.js";
|
|
8
8
|
import { KYC_FACTORY_SECURITIZE } from "./securitize/index.js";
|
|
9
9
|
/**
|
|
10
10
|
* Discriminated union of all known KYC factory contract type strings.
|
|
@@ -19,23 +19,28 @@ export type KYCFactoryType = (typeof KYC_FACTORY_TYPES)[number];
|
|
|
19
19
|
*
|
|
20
20
|
* Type-level registry mapping each {@link KYCFactoryType} to its associated
|
|
21
21
|
* data types. Adding a new KYC factory requires a single new entry here;
|
|
22
|
-
* all derived types
|
|
23
|
-
* etc.) update automatically.
|
|
22
|
+
* all derived types update automatically.
|
|
24
23
|
**/
|
|
25
24
|
interface KYCFactoryTypeMap {
|
|
26
25
|
[KYC_FACTORY_SECURITIZE]: {
|
|
27
26
|
investorData: SecuritizeInvestorData;
|
|
28
27
|
openAccountRequirements: SecuritizeOpenAccountRequirements;
|
|
29
28
|
stateHuman: SecuritizeKYCFactoryStateHuman;
|
|
30
|
-
|
|
29
|
+
operationParams: SecuritizeOperationParams;
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
|
-
/**
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type
|
|
37
|
-
/**
|
|
38
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Investor data decoded from the KYC compressor, defaults to union of all factory types
|
|
34
|
+
**/
|
|
35
|
+
export type KYCInvestorData<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["investorData"];
|
|
36
|
+
/**
|
|
37
|
+
* Open-account requirements for a KYC factory, defaults to union of all factory types
|
|
38
|
+
**/
|
|
39
|
+
export type KYCOpenAccountRequirements<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["openAccountRequirements"];
|
|
40
|
+
/**
|
|
41
|
+
* Open credit account/Multicall extra params type for a KYC factory, defaults to union of all factory types
|
|
42
|
+
**/
|
|
43
|
+
export type KYCOperationParams<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["operationParams"];
|
|
39
44
|
/**
|
|
40
45
|
* Raw return type of `KYCCompressor.getKYCMarketsData`.
|
|
41
46
|
**/
|
|
@@ -61,10 +66,6 @@ export type KYCCompressorInvestorData = Unarray<AbiParametersToPrimitiveTypes<Ex
|
|
|
61
66
|
* Full KYC compressor response, used as the persisted/hydrated state.
|
|
62
67
|
**/
|
|
63
68
|
export type KYCState = KYCCompressorResponse;
|
|
64
|
-
/**
|
|
65
|
-
* Investor data decoded from the KYC compressor, union of all factory types.
|
|
66
|
-
**/
|
|
67
|
-
export type InvestorData = KYCFactoryTypeMap[KYCFactoryType]["investorData"];
|
|
68
69
|
/**
|
|
69
70
|
* Human-readable KYC factory state, union of all factory types.
|
|
70
71
|
**/
|
|
@@ -76,10 +77,6 @@ export interface KYCStateHuman {
|
|
|
76
77
|
/** State of each loaded KYC factory. */
|
|
77
78
|
factories: KYCFactoryStateHuman[];
|
|
78
79
|
}
|
|
79
|
-
/**
|
|
80
|
-
* Open-account requirements for any KYC factory (union of all factory types).
|
|
81
|
-
**/
|
|
82
|
-
export type OpenAccountRequirements = KYCFactoryTypeMap[KYCFactoryType]["openAccountRequirements"];
|
|
83
80
|
/**
|
|
84
81
|
* Shared interface for all KYC factory contracts.
|
|
85
82
|
*
|
|
@@ -101,7 +98,7 @@ export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends
|
|
|
101
98
|
*
|
|
102
99
|
* @param data - raw KYCCompressor InvestorData
|
|
103
100
|
**/
|
|
104
|
-
decodeInvestorData(data: KYCCompressorInvestorData):
|
|
101
|
+
decodeInvestorData(data: KYCCompressorInvestorData): KYCInvestorData<T>;
|
|
105
102
|
/**
|
|
106
103
|
* Returns the investor address for a credit account.
|
|
107
104
|
* @param creditAccount - credit account address
|
|
@@ -136,11 +133,10 @@ export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends
|
|
|
136
133
|
*
|
|
137
134
|
* @param creditAccount - credit account address
|
|
138
135
|
* @param calls - calls to perform
|
|
139
|
-
* @param options -
|
|
140
|
-
* register, signatures to cache).
|
|
141
|
-
* uses sensible defaults (typically empty arrays).
|
|
136
|
+
* @param options - factory-specific parameters (e.g. tokens to
|
|
137
|
+
* register, signatures to cache).
|
|
142
138
|
**/
|
|
143
|
-
multicall(creditAccount: Address, calls: MultiCall[], options
|
|
139
|
+
multicall(creditAccount: Address, calls: MultiCall[], options: KYCOperationParams<T>): RawTx;
|
|
144
140
|
/**
|
|
145
141
|
* Checks if the user can open a credit account with this factory.
|
|
146
142
|
* @param investor - investor address
|
|
@@ -148,18 +144,17 @@ export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends
|
|
|
148
144
|
* @returns open account requirements for the investor, or `undefined` if the
|
|
149
145
|
* user can open a credit account without any further actions
|
|
150
146
|
**/
|
|
151
|
-
getOpenAccountRequirements(investor: Address, props: GetOpenAccountRequirementsProps): Promise<
|
|
147
|
+
getOpenAccountRequirements(investor: Address, props: GetOpenAccountRequirementsProps): Promise<KYCOpenAccountRequirements<T> | undefined>;
|
|
152
148
|
/**
|
|
153
149
|
* Creates a raw transaction to open a credit account.
|
|
154
150
|
* Similar to {@link CreditFacadeV310Contract.openCreditAccount}.
|
|
155
151
|
*
|
|
156
152
|
* @param creditManager - credit manager address
|
|
157
153
|
* @param calls - initial calls to perform
|
|
158
|
-
* @param options -
|
|
159
|
-
* register, signatures to cache).
|
|
160
|
-
* uses sensible defaults (typically empty arrays).
|
|
154
|
+
* @param options - factory-specific parameters (e.g. tokens to
|
|
155
|
+
* register, signatures to cache).
|
|
161
156
|
**/
|
|
162
|
-
openCreditAccount(creditManager: Address, calls: MultiCall[], options
|
|
157
|
+
openCreditAccount(creditManager: Address, calls: MultiCall[], options: KYCOperationParams<T>): RawTx;
|
|
163
158
|
}
|
|
164
159
|
/**
|
|
165
160
|
* Narrows an {@link IKYCFactory} to a specific factory type.
|