@gearbox-protocol/sdk 13.7.0-kyc.5 → 13.7.0-kyc.7

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.
@@ -22,6 +22,62 @@ __export(iDSRegistryService_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(iDSRegistryService_exports);
24
24
  const iDSRegistryServiceAbi = [
25
+ {
26
+ type: "function",
27
+ name: "ACCREDITED",
28
+ inputs: [],
29
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
30
+ stateMutability: "view"
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "APPROVED",
35
+ inputs: [],
36
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
37
+ stateMutability: "view"
38
+ },
39
+ {
40
+ type: "function",
41
+ name: "KYC_APPROVED",
42
+ inputs: [],
43
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
44
+ stateMutability: "view"
45
+ },
46
+ {
47
+ type: "function",
48
+ name: "NONE",
49
+ inputs: [],
50
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
51
+ stateMutability: "view"
52
+ },
53
+ {
54
+ type: "function",
55
+ name: "PENDING",
56
+ inputs: [],
57
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
58
+ stateMutability: "view"
59
+ },
60
+ {
61
+ type: "function",
62
+ name: "PROFESSIONAL",
63
+ inputs: [],
64
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
65
+ stateMutability: "view"
66
+ },
67
+ {
68
+ type: "function",
69
+ name: "QUALIFIED",
70
+ inputs: [],
71
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
72
+ stateMutability: "view"
73
+ },
74
+ {
75
+ type: "function",
76
+ name: "REJECTED",
77
+ inputs: [],
78
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
79
+ stateMutability: "view"
80
+ },
25
81
  {
26
82
  type: "function",
27
83
  name: "addWallet",
@@ -62,6 +118,29 @@ const iDSRegistryServiceAbi = [
62
118
  ],
63
119
  outputs: [],
64
120
  stateMutability: "nonpayable"
121
+ },
122
+ {
123
+ type: "function",
124
+ name: "setAttribute",
125
+ inputs: [
126
+ { name: "investorId", type: "string", internalType: "string" },
127
+ { name: "attributeId", type: "uint8", internalType: "uint8" },
128
+ { name: "value", type: "uint256", internalType: "uint256" },
129
+ { name: "expiry", type: "uint256", internalType: "uint256" },
130
+ { name: "proof", type: "string", internalType: "string" }
131
+ ],
132
+ outputs: [],
133
+ stateMutability: "nonpayable"
134
+ },
135
+ {
136
+ type: "function",
137
+ name: "setCountry",
138
+ inputs: [
139
+ { name: "investorId", type: "string", internalType: "string" },
140
+ { name: "country", type: "string", internalType: "string" }
141
+ ],
142
+ outputs: [],
143
+ stateMutability: "nonpayable"
65
144
  }
66
145
  ];
67
146
  // Annotate the CommonJS export names for ESM import in node:
@@ -840,7 +840,8 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
840
840
  calls: openPathCalls,
841
841
  callsAfter,
842
842
  minQuota,
843
- averageQuota
843
+ averageQuota,
844
+ kycOptions
844
845
  } = props;
845
846
  const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
846
847
  const cm = cmSuite.creditManager;
@@ -874,7 +875,13 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
874
875
  if (reopenCreditAccount) {
875
876
  tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
876
877
  } else {
877
- tx = await this.openCreditAccountTx(cmSuite, to, calls, referralCode);
878
+ tx = await this.openCreditAccountTx(
879
+ cmSuite,
880
+ to,
881
+ calls,
882
+ referralCode,
883
+ kycOptions
884
+ );
878
885
  }
879
886
  tx.value = ethAmount.toString(10);
880
887
  return { calls, tx, creditFacade: cmSuite.creditFacade };
@@ -1343,9 +1350,6 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
1343
1350
  const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
1344
1351
  const factory = marketSuite.kycFactory;
1345
1352
  if (factory) {
1346
- if (!kycOptions) {
1347
- throw new Error("KYC options are required for KYC factories");
1348
- }
1349
1353
  return factory.openCreditAccount(
1350
1354
  suite.creditManager.address,
1351
1355
  calls,
@@ -1359,7 +1363,7 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
1359
1363
  * @param suite
1360
1364
  * @param creditAccount
1361
1365
  * @param calls
1362
- * @param options
1366
+ * @param kycOptions
1363
1367
  * @returns
1364
1368
  */
1365
1369
  async multicallTx(suite, creditAccount, calls, kycOptions) {
@@ -1368,9 +1372,6 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
1368
1372
  );
1369
1373
  const factory = marketSuite.kycFactory;
1370
1374
  if (factory) {
1371
- if (!kycOptions) {
1372
- throw new Error("KYC options are required for KYC factories");
1373
- }
1374
1375
  return factory.multicall(creditAccount, calls, kycOptions);
1375
1376
  }
1376
1377
  return suite.creditFacade.multicall(creditAccount, calls);
@@ -1398,9 +1399,6 @@ class AbstractCreditAccountService extends import_base.SDKConstruct {
1398
1399
  return suite.creditFacade.closeCreditAccount(creditAccount, calls);
1399
1400
  }
1400
1401
  if (factory) {
1401
- if (!kycOptions) {
1402
- throw new Error("KYC options are required for KYC factories");
1403
- }
1404
1402
  return factory.multicall(creditAccount, calls, kycOptions);
1405
1403
  }
1406
1404
  return suite.creditFacade.multicall(creditAccount, calls);
@@ -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, signaturesToCache } = options;
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, signaturesToCache } = options;
180
+ const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
181
181
  return this.createRawTx({
182
182
  functionName: "openCreditAccount",
183
183
  args: [creditManager, calls, tokensToRegister, signaturesToCache]
@@ -1,4 +1,60 @@
1
1
  const iDSRegistryServiceAbi = [
2
+ {
3
+ type: "function",
4
+ name: "ACCREDITED",
5
+ inputs: [],
6
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
7
+ stateMutability: "view"
8
+ },
9
+ {
10
+ type: "function",
11
+ name: "APPROVED",
12
+ inputs: [],
13
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
14
+ stateMutability: "view"
15
+ },
16
+ {
17
+ type: "function",
18
+ name: "KYC_APPROVED",
19
+ inputs: [],
20
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
21
+ stateMutability: "view"
22
+ },
23
+ {
24
+ type: "function",
25
+ name: "NONE",
26
+ inputs: [],
27
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
28
+ stateMutability: "view"
29
+ },
30
+ {
31
+ type: "function",
32
+ name: "PENDING",
33
+ inputs: [],
34
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
35
+ stateMutability: "view"
36
+ },
37
+ {
38
+ type: "function",
39
+ name: "PROFESSIONAL",
40
+ inputs: [],
41
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
42
+ stateMutability: "view"
43
+ },
44
+ {
45
+ type: "function",
46
+ name: "QUALIFIED",
47
+ inputs: [],
48
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
49
+ stateMutability: "view"
50
+ },
51
+ {
52
+ type: "function",
53
+ name: "REJECTED",
54
+ inputs: [],
55
+ outputs: [{ name: "", type: "uint8", internalType: "uint8" }],
56
+ stateMutability: "view"
57
+ },
2
58
  {
3
59
  type: "function",
4
60
  name: "addWallet",
@@ -39,6 +95,29 @@ const iDSRegistryServiceAbi = [
39
95
  ],
40
96
  outputs: [],
41
97
  stateMutability: "nonpayable"
98
+ },
99
+ {
100
+ type: "function",
101
+ name: "setAttribute",
102
+ inputs: [
103
+ { name: "investorId", type: "string", internalType: "string" },
104
+ { name: "attributeId", type: "uint8", internalType: "uint8" },
105
+ { name: "value", type: "uint256", internalType: "uint256" },
106
+ { name: "expiry", type: "uint256", internalType: "uint256" },
107
+ { name: "proof", type: "string", internalType: "string" }
108
+ ],
109
+ outputs: [],
110
+ stateMutability: "nonpayable"
111
+ },
112
+ {
113
+ type: "function",
114
+ name: "setCountry",
115
+ inputs: [
116
+ { name: "investorId", type: "string", internalType: "string" },
117
+ { name: "country", type: "string", internalType: "string" }
118
+ ],
119
+ outputs: [],
120
+ stateMutability: "nonpayable"
42
121
  }
43
122
  ];
44
123
  export {
@@ -835,7 +835,8 @@ class AbstractCreditAccountService extends SDKConstruct {
835
835
  calls: openPathCalls,
836
836
  callsAfter,
837
837
  minQuota,
838
- averageQuota
838
+ averageQuota,
839
+ kycOptions
839
840
  } = props;
840
841
  const cmSuite = this.sdk.marketRegister.findCreditManager(creditManager);
841
842
  const cm = cmSuite.creditManager;
@@ -869,7 +870,13 @@ class AbstractCreditAccountService extends SDKConstruct {
869
870
  if (reopenCreditAccount) {
870
871
  tx = await this.multicallTx(cmSuite, reopenCreditAccount, calls);
871
872
  } else {
872
- tx = await this.openCreditAccountTx(cmSuite, to, calls, referralCode);
873
+ tx = await this.openCreditAccountTx(
874
+ cmSuite,
875
+ to,
876
+ calls,
877
+ referralCode,
878
+ kycOptions
879
+ );
873
880
  }
874
881
  tx.value = ethAmount.toString(10);
875
882
  return { calls, tx, creditFacade: cmSuite.creditFacade };
@@ -1338,9 +1345,6 @@ class AbstractCreditAccountService extends SDKConstruct {
1338
1345
  const marketSuite = this.sdk.marketRegister.findByPool(suite.pool);
1339
1346
  const factory = marketSuite.kycFactory;
1340
1347
  if (factory) {
1341
- if (!kycOptions) {
1342
- throw new Error("KYC options are required for KYC factories");
1343
- }
1344
1348
  return factory.openCreditAccount(
1345
1349
  suite.creditManager.address,
1346
1350
  calls,
@@ -1354,7 +1358,7 @@ class AbstractCreditAccountService extends SDKConstruct {
1354
1358
  * @param suite
1355
1359
  * @param creditAccount
1356
1360
  * @param calls
1357
- * @param options
1361
+ * @param kycOptions
1358
1362
  * @returns
1359
1363
  */
1360
1364
  async multicallTx(suite, creditAccount, calls, kycOptions) {
@@ -1363,9 +1367,6 @@ class AbstractCreditAccountService extends SDKConstruct {
1363
1367
  );
1364
1368
  const factory = marketSuite.kycFactory;
1365
1369
  if (factory) {
1366
- if (!kycOptions) {
1367
- throw new Error("KYC options are required for KYC factories");
1368
- }
1369
1370
  return factory.multicall(creditAccount, calls, kycOptions);
1370
1371
  }
1371
1372
  return suite.creditFacade.multicall(creditAccount, calls);
@@ -1393,9 +1394,6 @@ class AbstractCreditAccountService extends SDKConstruct {
1393
1394
  return suite.creditFacade.closeCreditAccount(creditAccount, calls);
1394
1395
  }
1395
1396
  if (factory) {
1396
- if (!kycOptions) {
1397
- throw new Error("KYC options are required for KYC factories");
1398
- }
1399
1397
  return factory.multicall(creditAccount, calls, kycOptions);
1400
1398
  }
1401
1399
  return suite.creditFacade.multicall(creditAccount, calls);
@@ -118,7 +118,7 @@ class SecuritizeKYCFactory extends BaseContract {
118
118
  * {@inheritDoc IKYCFactory.multicall}
119
119
  */
120
120
  multicall(creditAccount, calls, options) {
121
- const { tokensToRegister, signaturesToCache } = options;
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, signaturesToCache } = options;
157
+ const { tokensToRegister = [], signaturesToCache = [] } = options ?? {};
158
158
  return this.createRawTx({
159
159
  functionName: "openCreditAccount",
160
160
  args: [creditManager, calls, tokensToRegister, signaturesToCache]
@@ -1,4 +1,84 @@
1
1
  export declare const iDSRegistryServiceAbi: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "ACCREDITED";
4
+ readonly inputs: readonly [];
5
+ readonly outputs: readonly [{
6
+ readonly name: "";
7
+ readonly type: "uint8";
8
+ readonly internalType: "uint8";
9
+ }];
10
+ readonly stateMutability: "view";
11
+ }, {
12
+ readonly type: "function";
13
+ readonly name: "APPROVED";
14
+ readonly inputs: readonly [];
15
+ readonly outputs: readonly [{
16
+ readonly name: "";
17
+ readonly type: "uint8";
18
+ readonly internalType: "uint8";
19
+ }];
20
+ readonly stateMutability: "view";
21
+ }, {
22
+ readonly type: "function";
23
+ readonly name: "KYC_APPROVED";
24
+ readonly inputs: readonly [];
25
+ readonly outputs: readonly [{
26
+ readonly name: "";
27
+ readonly type: "uint8";
28
+ readonly internalType: "uint8";
29
+ }];
30
+ readonly stateMutability: "view";
31
+ }, {
32
+ readonly type: "function";
33
+ readonly name: "NONE";
34
+ readonly inputs: readonly [];
35
+ readonly outputs: readonly [{
36
+ readonly name: "";
37
+ readonly type: "uint8";
38
+ readonly internalType: "uint8";
39
+ }];
40
+ readonly stateMutability: "view";
41
+ }, {
42
+ readonly type: "function";
43
+ readonly name: "PENDING";
44
+ readonly inputs: readonly [];
45
+ readonly outputs: readonly [{
46
+ readonly name: "";
47
+ readonly type: "uint8";
48
+ readonly internalType: "uint8";
49
+ }];
50
+ readonly stateMutability: "view";
51
+ }, {
52
+ readonly type: "function";
53
+ readonly name: "PROFESSIONAL";
54
+ readonly inputs: readonly [];
55
+ readonly outputs: readonly [{
56
+ readonly name: "";
57
+ readonly type: "uint8";
58
+ readonly internalType: "uint8";
59
+ }];
60
+ readonly stateMutability: "view";
61
+ }, {
62
+ readonly type: "function";
63
+ readonly name: "QUALIFIED";
64
+ readonly inputs: readonly [];
65
+ readonly outputs: readonly [{
66
+ readonly name: "";
67
+ readonly type: "uint8";
68
+ readonly internalType: "uint8";
69
+ }];
70
+ readonly stateMutability: "view";
71
+ }, {
72
+ readonly type: "function";
73
+ readonly name: "REJECTED";
74
+ readonly inputs: readonly [];
75
+ readonly outputs: readonly [{
76
+ readonly name: "";
77
+ readonly type: "uint8";
78
+ readonly internalType: "uint8";
79
+ }];
80
+ readonly stateMutability: "view";
81
+ }, {
2
82
  readonly type: "function";
3
83
  readonly name: "addWallet";
4
84
  readonly inputs: readonly [{
@@ -68,4 +148,44 @@ export declare const iDSRegistryServiceAbi: readonly [{
68
148
  }];
69
149
  readonly outputs: readonly [];
70
150
  readonly stateMutability: "nonpayable";
151
+ }, {
152
+ readonly type: "function";
153
+ readonly name: "setAttribute";
154
+ readonly inputs: readonly [{
155
+ readonly name: "investorId";
156
+ readonly type: "string";
157
+ readonly internalType: "string";
158
+ }, {
159
+ readonly name: "attributeId";
160
+ readonly type: "uint8";
161
+ readonly internalType: "uint8";
162
+ }, {
163
+ readonly name: "value";
164
+ readonly type: "uint256";
165
+ readonly internalType: "uint256";
166
+ }, {
167
+ readonly name: "expiry";
168
+ readonly type: "uint256";
169
+ readonly internalType: "uint256";
170
+ }, {
171
+ readonly name: "proof";
172
+ readonly type: "string";
173
+ readonly internalType: "string";
174
+ }];
175
+ readonly outputs: readonly [];
176
+ readonly stateMutability: "nonpayable";
177
+ }, {
178
+ readonly type: "function";
179
+ readonly name: "setCountry";
180
+ readonly inputs: readonly [{
181
+ readonly name: "investorId";
182
+ readonly type: "string";
183
+ readonly internalType: "string";
184
+ }, {
185
+ readonly name: "country";
186
+ readonly type: "string";
187
+ readonly internalType: "string";
188
+ }];
189
+ readonly outputs: readonly [];
190
+ readonly stateMutability: "nonpayable";
71
191
  }];
@@ -209,7 +209,7 @@ export declare abstract class AbstractCreditAccountService extends SDKConstruct
209
209
  * @param suite
210
210
  * @param creditAccount
211
211
  * @param calls
212
- * @param options
212
+ * @param kycOptions
213
213
  * @returns
214
214
  */
215
215
  protected multicallTx(suite: CreditSuite, creditAccount: Address, calls: MultiCall[], kycOptions?: KYCOperationParams): Promise<RawTx>;
@@ -3,7 +3,7 @@ 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";
6
+ import type { CreditSuite, KYCOperationParams, PriceUpdate } from "../market/index.js";
7
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";
@@ -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
  /**
@@ -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: SecuritizeOperationParams): RawTx;
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: SecuritizeOperationParams): RawTx;
426
+ openCreditAccount(creditManager: Address, calls: MultiCall[], options?: SecuritizeOperationParams): RawTx;
427
427
  stateHuman(_raw?: boolean): SecuritizeKYCFactoryStateHuman;
428
428
  }
429
429
  export {};
@@ -134,9 +134,9 @@ export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends
134
134
  * @param creditAccount - credit account address
135
135
  * @param calls - calls to perform
136
136
  * @param options - factory-specific parameters (e.g. tokens to
137
- * register, signatures to cache).
137
+ * register, signatures to cache). Undefined value means that no KYC actions are required
138
138
  **/
139
- multicall(creditAccount: Address, calls: MultiCall[], options: KYCOperationParams<T>): RawTx;
139
+ multicall(creditAccount: Address, calls: MultiCall[], options?: KYCOperationParams<T>): RawTx;
140
140
  /**
141
141
  * Checks if the user can open a credit account with this factory.
142
142
  * @param investor - investor address
@@ -153,8 +153,9 @@ export interface IKYCFactory<T extends KYCFactoryType = KYCFactoryType> extends
153
153
  * @param calls - initial calls to perform
154
154
  * @param options - factory-specific parameters (e.g. tokens to
155
155
  * register, signatures to cache).
156
+ * Undefined value means that no KYC actions are required (e.g. when we open second credit account)
156
157
  **/
157
- openCreditAccount(creditManager: Address, calls: MultiCall[], options: KYCOperationParams<T>): RawTx;
158
+ openCreditAccount(creditManager: Address, calls: MultiCall[], options?: KYCOperationParams<T>): RawTx;
158
159
  }
159
160
  /**
160
161
  * Narrows an {@link IKYCFactory} to a specific factory type.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "13.7.0-kyc.5",
3
+ "version": "13.7.0-kyc.7",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",