@gearbox-protocol/sdk 13.7.0-kyc.4 → 13.7.0-kyc.6
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 -15
- package/dist/esm/sdk/accounts/AbstractCreditAccountsService.js +22 -18
- package/dist/types/sdk/accounts/AbstractCreditAccountsService.d.ts +9 -6
- package/dist/types/sdk/accounts/types.d.ts +12 -3
- 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 +24 -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");
|
|
@@ -841,7 +840,8 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
841
840
|
calls: openPathCalls,
|
|
842
841
|
callsAfter,
|
|
843
842
|
minQuota,
|
|
844
|
-
averageQuota
|
|
843
|
+
averageQuota,
|
|
844
|
+
kycOptions
|
|
845
845
|
} = props;
|
|
846
846
|
const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
847
847
|
const cm = cmSuite.creditManager;
|
|
@@ -875,7 +875,13 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
875
875
|
if (reopenCreditAccount) {
|
|
876
876
|
tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
|
|
877
877
|
} else {
|
|
878
|
-
tx = await this.openCreditAccountTx(
|
|
878
|
+
tx = await this.openCreditAccountTx(
|
|
879
|
+
cmSuite,
|
|
880
|
+
to,
|
|
881
|
+
calls,
|
|
882
|
+
referralCode,
|
|
883
|
+
kycOptions
|
|
884
|
+
);
|
|
879
885
|
}
|
|
880
886
|
tx.value = ethAmount.toString(10);
|
|
881
887
|
return { calls, tx, creditFacade: cmSuite.creditFacade };
|
|
@@ -1337,19 +1343,18 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1337
1343
|
* @param to
|
|
1338
1344
|
* @param calls
|
|
1339
1345
|
* @param referralCode
|
|
1346
|
+
* @param kycOptions
|
|
1340
1347
|
* @returns
|
|
1341
1348
|
*/
|
|
1342
|
-
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1349
|
+
async openCreditAccountTx(suite, to, calls, referralCode, kycOptions) {
|
|
1343
1350
|
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
1344
1351
|
const factory = marketSuite.kycFactory;
|
|
1345
|
-
if (factory
|
|
1346
|
-
|
|
1347
|
-
|
|
1352
|
+
if (factory) {
|
|
1353
|
+
return factory.openCreditAccount(
|
|
1354
|
+
suite.creditManager.address,
|
|
1355
|
+
calls,
|
|
1356
|
+
kycOptions
|
|
1348
1357
|
);
|
|
1349
|
-
return factory.openCreditAccount(suite.creditManager.address, calls, {
|
|
1350
|
-
tokensToRegister,
|
|
1351
|
-
signaturesToCache: []
|
|
1352
|
-
});
|
|
1353
1358
|
}
|
|
1354
1359
|
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1355
1360
|
}
|
|
@@ -1358,15 +1363,16 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1358
1363
|
* @param suite
|
|
1359
1364
|
* @param creditAccount
|
|
1360
1365
|
* @param calls
|
|
1366
|
+
* @param kycOptions
|
|
1361
1367
|
* @returns
|
|
1362
1368
|
*/
|
|
1363
|
-
async multicallTx(suite, creditAccount, calls) {
|
|
1369
|
+
async multicallTx(suite, creditAccount, calls, kycOptions) {
|
|
1364
1370
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1365
1371
|
suite.creditManager.address
|
|
1366
1372
|
);
|
|
1367
1373
|
const factory = marketSuite.kycFactory;
|
|
1368
1374
|
if (factory) {
|
|
1369
|
-
return factory.multicall(creditAccount, calls);
|
|
1375
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1370
1376
|
}
|
|
1371
1377
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1372
1378
|
}
|
|
@@ -1376,9 +1382,10 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1376
1382
|
* @param creditAccount
|
|
1377
1383
|
* @param calls
|
|
1378
1384
|
* @param operation
|
|
1385
|
+
* @param kycOptions
|
|
1379
1386
|
* @returns
|
|
1380
1387
|
*/
|
|
1381
|
-
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1388
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation, kycOptions) {
|
|
1382
1389
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1383
1390
|
suite.creditManager.address
|
|
1384
1391
|
);
|
|
@@ -1392,7 +1399,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
|
|
|
1392
1399
|
return suite.creditFacade.closeCreditAccount(creditAccount, calls);
|
|
1393
1400
|
}
|
|
1394
1401
|
if (factory) {
|
|
1395
|
-
return factory.multicall(creditAccount, calls);
|
|
1402
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1396
1403
|
}
|
|
1397
1404
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1398
1405
|
}
|
|
@@ -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";
|
|
@@ -839,7 +835,8 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
839
835
|
calls: openPathCalls,
|
|
840
836
|
callsAfter,
|
|
841
837
|
minQuota,
|
|
842
|
-
averageQuota
|
|
838
|
+
averageQuota,
|
|
839
|
+
kycOptions
|
|
843
840
|
} = props;
|
|
844
841
|
const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
|
|
845
842
|
const cm = cmSuite.creditManager;
|
|
@@ -873,7 +870,13 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
873
870
|
if (reopenCreditAccount) {
|
|
874
871
|
tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
|
|
875
872
|
} else {
|
|
876
|
-
tx = await this.openCreditAccountTx(
|
|
873
|
+
tx = await this.openCreditAccountTx(
|
|
874
|
+
cmSuite,
|
|
875
|
+
to,
|
|
876
|
+
calls,
|
|
877
|
+
referralCode,
|
|
878
|
+
kycOptions
|
|
879
|
+
);
|
|
877
880
|
}
|
|
878
881
|
tx.value = ethAmount.toString(10);
|
|
879
882
|
return { calls, tx, creditFacade: cmSuite.creditFacade };
|
|
@@ -1335,19 +1338,18 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1335
1338
|
* @param to
|
|
1336
1339
|
* @param calls
|
|
1337
1340
|
* @param referralCode
|
|
1341
|
+
* @param kycOptions
|
|
1338
1342
|
* @returns
|
|
1339
1343
|
*/
|
|
1340
|
-
async openCreditAccountTx(suite, to, calls, referralCode) {
|
|
1344
|
+
async openCreditAccountTx(suite, to, calls, referralCode, kycOptions) {
|
|
1341
1345
|
const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
|
|
1342
1346
|
const factory = marketSuite.kycFactory;
|
|
1343
|
-
if (factory
|
|
1344
|
-
|
|
1345
|
-
|
|
1347
|
+
if (factory) {
|
|
1348
|
+
return factory.openCreditAccount(
|
|
1349
|
+
suite.creditManager.address,
|
|
1350
|
+
calls,
|
|
1351
|
+
kycOptions
|
|
1346
1352
|
);
|
|
1347
|
-
return factory.openCreditAccount(suite.creditManager.address, calls, {
|
|
1348
|
-
tokensToRegister,
|
|
1349
|
-
signaturesToCache: []
|
|
1350
|
-
});
|
|
1351
1353
|
}
|
|
1352
1354
|
return suite.creditFacade.openCreditAccount(to, calls, referralCode ?? 0n);
|
|
1353
1355
|
}
|
|
@@ -1356,15 +1358,16 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1356
1358
|
* @param suite
|
|
1357
1359
|
* @param creditAccount
|
|
1358
1360
|
* @param calls
|
|
1361
|
+
* @param kycOptions
|
|
1359
1362
|
* @returns
|
|
1360
1363
|
*/
|
|
1361
|
-
async multicallTx(suite, creditAccount, calls) {
|
|
1364
|
+
async multicallTx(suite, creditAccount, calls, kycOptions) {
|
|
1362
1365
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1363
1366
|
suite.creditManager.address
|
|
1364
1367
|
);
|
|
1365
1368
|
const factory = marketSuite.kycFactory;
|
|
1366
1369
|
if (factory) {
|
|
1367
|
-
return factory.multicall(creditAccount, calls);
|
|
1370
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1368
1371
|
}
|
|
1369
1372
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1370
1373
|
}
|
|
@@ -1374,9 +1377,10 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1374
1377
|
* @param creditAccount
|
|
1375
1378
|
* @param calls
|
|
1376
1379
|
* @param operation
|
|
1380
|
+
* @param kycOptions
|
|
1377
1381
|
* @returns
|
|
1378
1382
|
*/
|
|
1379
|
-
async closeCreditAccountTx(suite, creditAccount, calls, operation) {
|
|
1383
|
+
async closeCreditAccountTx(suite, creditAccount, calls, operation, kycOptions) {
|
|
1380
1384
|
const marketSuite = this.sdk.marketRegister.findByCreditManager(
|
|
1381
1385
|
suite.creditManager.address
|
|
1382
1386
|
);
|
|
@@ -1390,7 +1394,7 @@ class AbstractCreditAccountService extends SDKConstruct {
|
|
|
1390
1394
|
return suite.creditFacade.closeCreditAccount(creditAccount, calls);
|
|
1391
1395
|
}
|
|
1392
1396
|
if (factory) {
|
|
1393
|
-
return factory.multicall(creditAccount, calls);
|
|
1397
|
+
return factory.multicall(creditAccount, calls, kycOptions);
|
|
1394
1398
|
}
|
|
1395
1399
|
return suite.creditFacade.multicall(creditAccount, calls);
|
|
1396
1400
|
}
|
|
@@ -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 kycOptions
|
|
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
|
}
|
|
@@ -3,8 +3,8 @@ import type { creditAccountCompressorAbi } from "../../abi/compressors/creditAcc
|
|
|
3
3
|
import type { iWithdrawalCompressorV310Abi } from "../../abi/IWithdrawalCompressorV310.js";
|
|
4
4
|
import type { ConnectedBotData, Construct, CreditAccountData } from "../base/index.js";
|
|
5
5
|
import type { GearboxSDK } from "../GearboxSDK.js";
|
|
6
|
-
import type { CreditSuite, PriceUpdate } from "../market/index.js";
|
|
7
|
-
import type {
|
|
6
|
+
import type { CreditSuite, KYCOperationParams, PriceUpdate } from "../market/index.js";
|
|
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
|
/**
|
|
@@ -427,6 +427,15 @@ export interface OpenCAProps extends PrepareUpdateQuotasProps {
|
|
|
427
427
|
* Referral code to open credit account with
|
|
428
428
|
*/
|
|
429
429
|
referralCode: bigint;
|
|
430
|
+
/**
|
|
431
|
+
* KYC options to open credit account with, required for KYC factories
|
|
432
|
+
* First we ask for getOpenAccountRequirements,
|
|
433
|
+
* then perform necessary actions (e.g. for Securitize, convert requiredSignatures to signaturesToCache)
|
|
434
|
+
* to produce KYCOperationParams
|
|
435
|
+
* If getOpenAccountRequirements returned undefined, we need to pass undefined here too;
|
|
436
|
+
* It means that no KYC actions are required (e.g. when we open second credit account)
|
|
437
|
+
*/
|
|
438
|
+
kycOptions?: KYCOperationParams;
|
|
430
439
|
}
|
|
431
440
|
export interface ChangeDeptProps {
|
|
432
441
|
/**
|
|
@@ -748,7 +757,7 @@ export interface ICreditAccountsService extends Construct {
|
|
|
748
757
|
* @param props - {@link GetOpenAccountRequirementsProps} you can pass StrategyConfigPayload here
|
|
749
758
|
* @returns Open account requirements or undefined if the user can open a credit account without any further actions
|
|
750
759
|
*/
|
|
751
|
-
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<
|
|
760
|
+
getOpenAccountRequirements(borrower: Address, creditManager: Address, props: GetOpenAccountRequirementsProps): Promise<KYCOpenAccountRequirements | undefined>;
|
|
752
761
|
/**
|
|
753
762
|
* Executes swap specified by given calls, update quotas of affected tokens
|
|
754
763
|
* - 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). Undefined value means that no KYC actions are required
|
|
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,18 @@ 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
|
-
*
|
|
154
|
+
* @param options - factory-specific parameters (e.g. tokens to
|
|
155
|
+
* register, signatures to cache).
|
|
156
|
+
* Undefined value means that no KYC actions are required (e.g. when we open second credit account)
|
|
161
157
|
**/
|
|
162
|
-
openCreditAccount(creditManager: Address, calls: MultiCall[], options?:
|
|
158
|
+
openCreditAccount(creditManager: Address, calls: MultiCall[], options?: KYCOperationParams<T>): RawTx;
|
|
163
159
|
}
|
|
164
160
|
/**
|
|
165
161
|
* Narrows an {@link IKYCFactory} to a specific factory type.
|