@gearbox-protocol/sdk 13.6.0-kyc.2 → 13.6.0-kyc.3

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.
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var iDSRegistryService_exports = {};
20
+ __export(iDSRegistryService_exports, {
21
+ iDSRegistryServiceAbi: () => iDSRegistryServiceAbi
22
+ });
23
+ module.exports = __toCommonJS(iDSRegistryService_exports);
24
+ const iDSRegistryServiceAbi = [
25
+ {
26
+ type: "function",
27
+ name: "addWallet",
28
+ inputs: [
29
+ { name: "wallet", type: "address", internalType: "address" },
30
+ { name: "investorId", type: "string", internalType: "string" }
31
+ ],
32
+ outputs: [],
33
+ stateMutability: "nonpayable"
34
+ },
35
+ {
36
+ type: "function",
37
+ name: "getInvestor",
38
+ inputs: [{ name: "wallet", type: "address", internalType: "address" }],
39
+ outputs: [{ name: "", type: "string", internalType: "string" }],
40
+ stateMutability: "view"
41
+ },
42
+ {
43
+ type: "function",
44
+ name: "isInvestor",
45
+ inputs: [{ name: "investorId", type: "string", internalType: "string" }],
46
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
47
+ stateMutability: "view"
48
+ },
49
+ {
50
+ type: "function",
51
+ name: "isWallet",
52
+ inputs: [{ name: "wallet", type: "address", internalType: "address" }],
53
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
54
+ stateMutability: "view"
55
+ },
56
+ {
57
+ type: "function",
58
+ name: "registerInvestor",
59
+ inputs: [
60
+ { name: "investorId", type: "string", internalType: "string" },
61
+ { name: "collisionHash", type: "string", internalType: "string" }
62
+ ],
63
+ outputs: [],
64
+ stateMutability: "nonpayable"
65
+ }
66
+ ];
67
+ // Annotate the CommonJS export names for ESM import in node:
68
+ 0 && (module.exports = {
69
+ iDSRegistryServiceAbi
70
+ });
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var iDSToken_exports = {};
20
+ __export(iDSToken_exports, {
21
+ iDSTokenAbi: () => iDSTokenAbi
22
+ });
23
+ module.exports = __toCommonJS(iDSToken_exports);
24
+ const iDSTokenAbi = [
25
+ {
26
+ type: "function",
27
+ name: "REGISTRY_SERVICE",
28
+ inputs: [],
29
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
30
+ stateMutability: "view"
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "TRUST_SERVICE",
35
+ inputs: [],
36
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
37
+ stateMutability: "view"
38
+ },
39
+ {
40
+ type: "function",
41
+ name: "burn",
42
+ inputs: [
43
+ { name: "from", type: "address", internalType: "address" },
44
+ { name: "amount", type: "uint256", internalType: "uint256" },
45
+ { name: "reason", type: "string", internalType: "string" }
46
+ ],
47
+ outputs: [],
48
+ stateMutability: "nonpayable"
49
+ },
50
+ {
51
+ type: "function",
52
+ name: "getDSService",
53
+ inputs: [{ name: "serviceId", type: "uint256", internalType: "uint256" }],
54
+ outputs: [{ name: "", type: "address", internalType: "address" }],
55
+ stateMutability: "view"
56
+ },
57
+ {
58
+ type: "function",
59
+ name: "issueTokens",
60
+ inputs: [
61
+ { name: "to", type: "address", internalType: "address" },
62
+ { name: "amount", type: "uint256", internalType: "uint256" }
63
+ ],
64
+ outputs: [],
65
+ stateMutability: "nonpayable"
66
+ }
67
+ ];
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ iDSTokenAbi
71
+ });
@@ -251,7 +251,7 @@ class GearboxSDK extends import_base.ChainContractsRegister {
251
251
  );
252
252
  await this.#addressProvider.syncState(this.currentBlock);
253
253
  this.#marketRegister = new import_MarketRegister.MarketRegister(this, ignoreMarkets);
254
- this.#kyc = new import_kyc.KYCRegister(this);
254
+ this.#kyc = new import_kyc.KYCRegistry(this);
255
255
  if (!marketConfigurators.length) {
256
256
  this.logger?.warn(
257
257
  "no market configurators provided, skipping market loading"
@@ -324,7 +324,7 @@ class GearboxSDK extends import_base.ChainContractsRegister {
324
324
  );
325
325
  this.#marketRegister = new import_MarketRegister.MarketRegister(this, ignoreMarkets);
326
326
  this.#marketRegister.hydrate(state.markets);
327
- this.#kyc = new import_kyc.KYCRegister(this);
327
+ this.#kyc = new import_kyc.KYCRegistry(this);
328
328
  this.#kyc.setState(state.kyc);
329
329
  this.#attachConfig = {
330
330
  ...opts,
@@ -16,18 +16,18 @@ var __copyProps = (to, from, except, desc) => {
16
16
  return to;
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var KYCRegister_exports = {};
20
- __export(KYCRegister_exports, {
21
- KYCRegister: () => KYCRegister
19
+ var KYCRegistry_exports = {};
20
+ __export(KYCRegistry_exports, {
21
+ KYCRegistry: () => KYCRegistry
22
22
  });
23
- module.exports = __toCommonJS(KYCRegister_exports);
23
+ module.exports = __toCommonJS(KYCRegistry_exports);
24
24
  var import_viem = require("viem");
25
25
  var import_iKYCCompressor = require("../../../abi/kyc/iKYCCompressor.js");
26
26
  var import_base = require("../../base/index.js");
27
27
  var import_constants = require("../../constants/index.js");
28
28
  var import_utils = require("../../utils/index.js");
29
29
  var import_securitize = require("./securitize/index.js");
30
- class KYCRegister extends import_base.SDKConstruct {
30
+ class KYCRegistry extends import_base.SDKConstruct {
31
31
  #state;
32
32
  #factories = new import_utils.AddressMap();
33
33
  /**
@@ -38,7 +38,6 @@ class KYCRegister extends import_base.SDKConstruct {
38
38
  *
39
39
  * @param configurators - Market configurators to query.
40
40
  * @param kycFactories - KYC factory contracts to query.
41
- * @returns
42
41
  */
43
42
  getLoadMulticalls(configurators, kycFactories = []) {
44
43
  if (!kycFactories.length) return [];
@@ -59,11 +58,14 @@ class KYCRegister extends import_base.SDKConstruct {
59
58
  ];
60
59
  }
61
60
  /**
62
- * Returns the investor data for a given investor and optional list of factories.
63
- * If no factories are provided, all factories will be used.
64
- * @param investor
65
- * @param factories_
66
- * @returns
61
+ * Fetches decoded investor data from the on-chain KYC compressor.
62
+ *
63
+ * Each factory produces its own investor data (e.g. registered tokens,
64
+ * cached signatures, EIP-712 messages to sign).
65
+ *
66
+ * @param investor - Investor EOA address.
67
+ * @param factories_ - Optional subset of factory addresses to query.
68
+ * When omitted, all loaded factories are used.
67
69
  */
68
70
  async getInvestorData(investor, factories_) {
69
71
  const [kycCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
@@ -89,17 +91,29 @@ class KYCRegister extends import_base.SDKConstruct {
89
91
  }
90
92
  return result;
91
93
  }
94
+ /** All loaded KYC factory instances. */
92
95
  get factories() {
93
96
  return this.#factories.values();
94
97
  }
98
+ /** Raw KYC compressor response, or `undefined` before attach/hydrate. */
95
99
  get state() {
96
100
  return this.#state;
97
101
  }
102
+ /**
103
+ * Returns a human-readable snapshot of the KYC state.
104
+ */
98
105
  stateHuman(raw) {
99
106
  return {
100
107
  factories: this.factories.map((f) => f.stateHuman(raw))
101
108
  };
102
109
  }
110
+ /**
111
+ * @internal
112
+ *
113
+ * Replaces the internal state with a new KYC compressor response.
114
+ * Rebuilds token metadata for KYC underlyings and re-instantiates factory
115
+ * wrappers.
116
+ */
103
117
  setState(resp) {
104
118
  this.#state = resp;
105
119
  for (const u of resp?.[0] ?? []) {
@@ -251,5 +265,5 @@ class KYCRegister extends import_base.SDKConstruct {
251
265
  }
252
266
  // Annotate the CommonJS export names for ESM import in node:
253
267
  0 && (module.exports = {
254
- KYCRegister
268
+ KYCRegistry
255
269
  });
@@ -15,10 +15,10 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var kyc_exports = {};
17
17
  module.exports = __toCommonJS(kyc_exports);
18
- __reExport(kyc_exports, require("./KYCRegister.js"), module.exports);
18
+ __reExport(kyc_exports, require("./KYCRegistry.js"), module.exports);
19
19
  __reExport(kyc_exports, require("./types.js"), module.exports);
20
20
  // Annotate the CommonJS export names for ESM import in node:
21
21
  0 && (module.exports = {
22
- ...require("./KYCRegister.js"),
22
+ ...require("./KYCRegistry.js"),
23
23
  ...require("./types.js")
24
24
  });
@@ -0,0 +1,46 @@
1
+ const iDSRegistryServiceAbi = [
2
+ {
3
+ type: "function",
4
+ name: "addWallet",
5
+ inputs: [
6
+ { name: "wallet", type: "address", internalType: "address" },
7
+ { name: "investorId", type: "string", internalType: "string" }
8
+ ],
9
+ outputs: [],
10
+ stateMutability: "nonpayable"
11
+ },
12
+ {
13
+ type: "function",
14
+ name: "getInvestor",
15
+ inputs: [{ name: "wallet", type: "address", internalType: "address" }],
16
+ outputs: [{ name: "", type: "string", internalType: "string" }],
17
+ stateMutability: "view"
18
+ },
19
+ {
20
+ type: "function",
21
+ name: "isInvestor",
22
+ inputs: [{ name: "investorId", type: "string", internalType: "string" }],
23
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
24
+ stateMutability: "view"
25
+ },
26
+ {
27
+ type: "function",
28
+ name: "isWallet",
29
+ inputs: [{ name: "wallet", type: "address", internalType: "address" }],
30
+ outputs: [{ name: "", type: "bool", internalType: "bool" }],
31
+ stateMutability: "view"
32
+ },
33
+ {
34
+ type: "function",
35
+ name: "registerInvestor",
36
+ inputs: [
37
+ { name: "investorId", type: "string", internalType: "string" },
38
+ { name: "collisionHash", type: "string", internalType: "string" }
39
+ ],
40
+ outputs: [],
41
+ stateMutability: "nonpayable"
42
+ }
43
+ ];
44
+ export {
45
+ iDSRegistryServiceAbi
46
+ };
@@ -0,0 +1,47 @@
1
+ const iDSTokenAbi = [
2
+ {
3
+ type: "function",
4
+ name: "REGISTRY_SERVICE",
5
+ inputs: [],
6
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
7
+ stateMutability: "view"
8
+ },
9
+ {
10
+ type: "function",
11
+ name: "TRUST_SERVICE",
12
+ inputs: [],
13
+ outputs: [{ name: "", type: "uint256", internalType: "uint256" }],
14
+ stateMutability: "view"
15
+ },
16
+ {
17
+ type: "function",
18
+ name: "burn",
19
+ inputs: [
20
+ { name: "from", type: "address", internalType: "address" },
21
+ { name: "amount", type: "uint256", internalType: "uint256" },
22
+ { name: "reason", type: "string", internalType: "string" }
23
+ ],
24
+ outputs: [],
25
+ stateMutability: "nonpayable"
26
+ },
27
+ {
28
+ type: "function",
29
+ name: "getDSService",
30
+ inputs: [{ name: "serviceId", type: "uint256", internalType: "uint256" }],
31
+ outputs: [{ name: "", type: "address", internalType: "address" }],
32
+ stateMutability: "view"
33
+ },
34
+ {
35
+ type: "function",
36
+ name: "issueTokens",
37
+ inputs: [
38
+ { name: "to", type: "address", internalType: "address" },
39
+ { name: "amount", type: "uint256", internalType: "uint256" }
40
+ ],
41
+ outputs: [],
42
+ stateMutability: "nonpayable"
43
+ }
44
+ ];
45
+ export {
46
+ iDSTokenAbi
47
+ };
@@ -16,7 +16,7 @@ import {
16
16
  VERSION_RANGE_310
17
17
  } from "./constants/index.js";
18
18
  import { createAddressProvider, hydrateAddressProvider } from "./core/index.js";
19
- import { KYCRegister } from "./market/kyc/index.js";
19
+ import { KYCRegistry } from "./market/kyc/index.js";
20
20
  import { MarketRegister } from "./market/MarketRegister.js";
21
21
  import { PriceFeedRegister } from "./market/pricefeeds/index.js";
22
22
  import {
@@ -245,7 +245,7 @@ class GearboxSDK extends ChainContractsRegister {
245
245
  );
246
246
  await this.#addressProvider.syncState(this.currentBlock);
247
247
  this.#marketRegister = new MarketRegister(this, ignoreMarkets);
248
- this.#kyc = new KYCRegister(this);
248
+ this.#kyc = new KYCRegistry(this);
249
249
  if (!marketConfigurators.length) {
250
250
  this.logger?.warn(
251
251
  "no market configurators provided, skipping market loading"
@@ -318,7 +318,7 @@ class GearboxSDK extends ChainContractsRegister {
318
318
  );
319
319
  this.#marketRegister = new MarketRegister(this, ignoreMarkets);
320
320
  this.#marketRegister.hydrate(state.markets);
321
- this.#kyc = new KYCRegister(this);
321
+ this.#kyc = new KYCRegistry(this);
322
322
  this.#kyc.setState(state.kyc);
323
323
  this.#attachConfig = {
324
324
  ...opts,
@@ -12,7 +12,7 @@ import {
12
12
  KYC_FACTORY_SECURITIZE,
13
13
  SecuritizeKYCFactory
14
14
  } from "./securitize/index.js";
15
- class KYCRegister extends SDKConstruct {
15
+ class KYCRegistry extends SDKConstruct {
16
16
  #state;
17
17
  #factories = new AddressMap();
18
18
  /**
@@ -23,7 +23,6 @@ class KYCRegister extends SDKConstruct {
23
23
  *
24
24
  * @param configurators - Market configurators to query.
25
25
  * @param kycFactories - KYC factory contracts to query.
26
- * @returns
27
26
  */
28
27
  getLoadMulticalls(configurators, kycFactories = []) {
29
28
  if (!kycFactories.length) return [];
@@ -44,11 +43,14 @@ class KYCRegister extends SDKConstruct {
44
43
  ];
45
44
  }
46
45
  /**
47
- * Returns the investor data for a given investor and optional list of factories.
48
- * If no factories are provided, all factories will be used.
49
- * @param investor
50
- * @param factories_
51
- * @returns
46
+ * Fetches decoded investor data from the on-chain KYC compressor.
47
+ *
48
+ * Each factory produces its own investor data (e.g. registered tokens,
49
+ * cached signatures, EIP-712 messages to sign).
50
+ *
51
+ * @param investor - Investor EOA address.
52
+ * @param factories_ - Optional subset of factory addresses to query.
53
+ * When omitted, all loaded factories are used.
52
54
  */
53
55
  async getInvestorData(investor, factories_) {
54
56
  const [kycCompressorAddress] = this.sdk.addressProvider.mustGetLatest(
@@ -74,17 +76,29 @@ class KYCRegister extends SDKConstruct {
74
76
  }
75
77
  return result;
76
78
  }
79
+ /** All loaded KYC factory instances. */
77
80
  get factories() {
78
81
  return this.#factories.values();
79
82
  }
83
+ /** Raw KYC compressor response, or `undefined` before attach/hydrate. */
80
84
  get state() {
81
85
  return this.#state;
82
86
  }
87
+ /**
88
+ * Returns a human-readable snapshot of the KYC state.
89
+ */
83
90
  stateHuman(raw) {
84
91
  return {
85
92
  factories: this.factories.map((f) => f.stateHuman(raw))
86
93
  };
87
94
  }
95
+ /**
96
+ * @internal
97
+ *
98
+ * Replaces the internal state with a new KYC compressor response.
99
+ * Rebuilds token metadata for KYC underlyings and re-instantiates factory
100
+ * wrappers.
101
+ */
88
102
  setState(resp) {
89
103
  this.#state = resp;
90
104
  for (const u of resp?.[0] ?? []) {
@@ -235,5 +249,5 @@ class KYCRegister extends SDKConstruct {
235
249
  }
236
250
  }
237
251
  export {
238
- KYCRegister
252
+ KYCRegistry
239
253
  };
@@ -1,2 +1,2 @@
1
- export * from "./KYCRegister.js";
1
+ export * from "./KYCRegistry.js";
2
2
  export * from "./types.js";
@@ -0,0 +1,71 @@
1
+ export declare const iDSRegistryServiceAbi: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "addWallet";
4
+ readonly inputs: readonly [{
5
+ readonly name: "wallet";
6
+ readonly type: "address";
7
+ readonly internalType: "address";
8
+ }, {
9
+ readonly name: "investorId";
10
+ readonly type: "string";
11
+ readonly internalType: "string";
12
+ }];
13
+ readonly outputs: readonly [];
14
+ readonly stateMutability: "nonpayable";
15
+ }, {
16
+ readonly type: "function";
17
+ readonly name: "getInvestor";
18
+ readonly inputs: readonly [{
19
+ readonly name: "wallet";
20
+ readonly type: "address";
21
+ readonly internalType: "address";
22
+ }];
23
+ readonly outputs: readonly [{
24
+ readonly name: "";
25
+ readonly type: "string";
26
+ readonly internalType: "string";
27
+ }];
28
+ readonly stateMutability: "view";
29
+ }, {
30
+ readonly type: "function";
31
+ readonly name: "isInvestor";
32
+ readonly inputs: readonly [{
33
+ readonly name: "investorId";
34
+ readonly type: "string";
35
+ readonly internalType: "string";
36
+ }];
37
+ readonly outputs: readonly [{
38
+ readonly name: "";
39
+ readonly type: "bool";
40
+ readonly internalType: "bool";
41
+ }];
42
+ readonly stateMutability: "view";
43
+ }, {
44
+ readonly type: "function";
45
+ readonly name: "isWallet";
46
+ readonly inputs: readonly [{
47
+ readonly name: "wallet";
48
+ readonly type: "address";
49
+ readonly internalType: "address";
50
+ }];
51
+ readonly outputs: readonly [{
52
+ readonly name: "";
53
+ readonly type: "bool";
54
+ readonly internalType: "bool";
55
+ }];
56
+ readonly stateMutability: "view";
57
+ }, {
58
+ readonly type: "function";
59
+ readonly name: "registerInvestor";
60
+ readonly inputs: readonly [{
61
+ readonly name: "investorId";
62
+ readonly type: "string";
63
+ readonly internalType: "string";
64
+ }, {
65
+ readonly name: "collisionHash";
66
+ readonly type: "string";
67
+ readonly internalType: "string";
68
+ }];
69
+ readonly outputs: readonly [];
70
+ readonly stateMutability: "nonpayable";
71
+ }];
@@ -0,0 +1,67 @@
1
+ export declare const iDSTokenAbi: readonly [{
2
+ readonly type: "function";
3
+ readonly name: "REGISTRY_SERVICE";
4
+ readonly inputs: readonly [];
5
+ readonly outputs: readonly [{
6
+ readonly name: "";
7
+ readonly type: "uint256";
8
+ readonly internalType: "uint256";
9
+ }];
10
+ readonly stateMutability: "view";
11
+ }, {
12
+ readonly type: "function";
13
+ readonly name: "TRUST_SERVICE";
14
+ readonly inputs: readonly [];
15
+ readonly outputs: readonly [{
16
+ readonly name: "";
17
+ readonly type: "uint256";
18
+ readonly internalType: "uint256";
19
+ }];
20
+ readonly stateMutability: "view";
21
+ }, {
22
+ readonly type: "function";
23
+ readonly name: "burn";
24
+ readonly inputs: readonly [{
25
+ readonly name: "from";
26
+ readonly type: "address";
27
+ readonly internalType: "address";
28
+ }, {
29
+ readonly name: "amount";
30
+ readonly type: "uint256";
31
+ readonly internalType: "uint256";
32
+ }, {
33
+ readonly name: "reason";
34
+ readonly type: "string";
35
+ readonly internalType: "string";
36
+ }];
37
+ readonly outputs: readonly [];
38
+ readonly stateMutability: "nonpayable";
39
+ }, {
40
+ readonly type: "function";
41
+ readonly name: "getDSService";
42
+ readonly inputs: readonly [{
43
+ readonly name: "serviceId";
44
+ readonly type: "uint256";
45
+ readonly internalType: "uint256";
46
+ }];
47
+ readonly outputs: readonly [{
48
+ readonly name: "";
49
+ readonly type: "address";
50
+ readonly internalType: "address";
51
+ }];
52
+ readonly stateMutability: "view";
53
+ }, {
54
+ readonly type: "function";
55
+ readonly name: "issueTokens";
56
+ readonly inputs: readonly [{
57
+ readonly name: "to";
58
+ readonly type: "address";
59
+ readonly internalType: "address";
60
+ }, {
61
+ readonly name: "amount";
62
+ readonly type: "uint256";
63
+ readonly internalType: "uint256";
64
+ }];
65
+ readonly outputs: readonly [];
66
+ readonly stateMutability: "nonpayable";
67
+ }];
@@ -6,7 +6,7 @@ import { ChainContractsRegister } from "./base/index.js";
6
6
  import type { GearboxChain, NetworkType } from "./chain/chains.js";
7
7
  import type { VersionRange } from "./constants/index.js";
8
8
  import type { IAddressProviderContract } from "./core/index.js";
9
- import { KYCRegister } from "./market/kyc/index.js";
9
+ import { KYCRegistry } from "./market/kyc/index.js";
10
10
  import { MarketRegister } from "./market/MarketRegister.js";
11
11
  import { PriceFeedRegister } from "./market/pricefeeds/index.js";
12
12
  import type { SDKOptions } from "./options.js";
@@ -305,7 +305,7 @@ export declare class GearboxSDK<const Plugins extends PluginsMap = {}> extends C
305
305
  *
306
306
  * @throws If the SDK has not been attached or hydrated yet.
307
307
  **/
308
- get kyc(): KYCRegister;
308
+ get kyc(): KYCRegistry;
309
309
  /**
310
310
  * Resolves the appropriate router contract for a given credit manager,
311
311
  * credit facade, or explicit version range.
@@ -0,0 +1,52 @@
1
+ import type { Address } from "abitype";
2
+ import { SDKConstruct } from "../../base/index.js";
3
+ import type { DelegatedMulticall } from "../../utils/viem/index.js";
4
+ import { SecuritizeKYCFactory } from "./securitize/index.js";
5
+ import type { InvestorData, KYCCompressorResponse, KYCState, KYCStateHuman } from "./types.js";
6
+ /**
7
+ * Registry of KYC underlying tokens and KYC factory contracts.
8
+ *
9
+ * Populated from the on-chain {@link https://github.com/Gearbox-protocol/periphery-v3 KYCCompressor}
10
+ * during SDK attach/hydrate. Provides methods to query investor-level data and
11
+ * to resolve KYC factory instances by address.
12
+ **/
13
+ export declare class KYCRegistry extends SDKConstruct {
14
+ #private;
15
+ /**
16
+ * @internal
17
+ *
18
+ * Returns delegated multicalls for loading all KYC underlying tokens from the on-chain KYC compressor.
19
+ * Used by the SDK to compose batched RPC calls.
20
+ *
21
+ * @param configurators - Market configurators to query.
22
+ * @param kycFactories - KYC factory contracts to query.
23
+ */
24
+ getLoadMulticalls(configurators: Address[], kycFactories?: Address[]): DelegatedMulticall[];
25
+ /**
26
+ * Fetches decoded investor data from the on-chain KYC compressor.
27
+ *
28
+ * Each factory produces its own investor data (e.g. registered tokens,
29
+ * cached signatures, EIP-712 messages to sign).
30
+ *
31
+ * @param investor - Investor EOA address.
32
+ * @param factories_ - Optional subset of factory addresses to query.
33
+ * When omitted, all loaded factories are used.
34
+ */
35
+ getInvestorData(investor: Address, factories_?: Address[]): Promise<InvestorData[]>;
36
+ /** All loaded KYC factory instances. */
37
+ get factories(): SecuritizeKYCFactory[];
38
+ /** Raw KYC compressor response, or `undefined` before attach/hydrate. */
39
+ get state(): KYCState | undefined;
40
+ /**
41
+ * Returns a human-readable snapshot of the KYC state.
42
+ */
43
+ stateHuman(raw?: boolean): KYCStateHuman;
44
+ /**
45
+ * @internal
46
+ *
47
+ * Replaces the internal state with a new KYC compressor response.
48
+ * Rebuilds token metadata for KYC underlyings and re-instantiates factory
49
+ * wrappers.
50
+ */
51
+ setState(resp?: KYCCompressorResponse): void;
52
+ }
@@ -1,2 +1,2 @@
1
- export * from "./KYCRegister.js";
1
+ export * from "./KYCRegistry.js";
2
2
  export * from "./types.js";
@@ -2,40 +2,85 @@ import type { Address, Hex } from "viem";
2
2
  import type { BaseContractStateHuman } from "../../../types/index.js";
3
3
  import type { OpenAccountRequirements } from "../types.js";
4
4
  import type { KYC_FACTORY_SECURITIZE } from "./constants.js";
5
+ /**
6
+ * Cached registration signature for a single DSToken, stored in the
7
+ * @see SecuritizeDegenNFT in https://github.com/Gearbox-protocol/periphery-v3
8
+ *
9
+ **/
5
10
  export interface SecuritizeRegisterMessage {
11
+ /** DSToken address the signature authorises. */
6
12
  token: Address;
13
+ /** EIP-712 deadline + raw signature bytes. */
7
14
  signature: SecuritizeSignature;
8
15
  }
16
+ /**
17
+ * Deadline-bound EIP-712 signature produced by the investor.
18
+ *
19
+ **/
9
20
  export interface SecuritizeSignature {
21
+ /** Unix timestamp after which the signature is no longer valid. */
10
22
  deadline: bigint;
23
+ /** Raw EIP-712 signature bytes. */
11
24
  signature: Hex;
12
25
  }
26
+ /**
27
+ * EIP-712 typed-data message that must be signed by the investor to allow the
28
+ * KYC factory to register a credit account as a vault in Securitize's VaultRegistrar
29
+ * @see VaultRegistrar in https://github.com/Gearbox-protocol/periphery-v3
30
+ *
31
+ **/
13
32
  export interface SecuritizeRegisterVaultMessage {
33
+ /** EIP-712 domain from the VaultRegistrar contract. */
14
34
  domain: {
15
35
  name: string;
16
36
  version: string;
17
37
  chainId: bigint;
18
38
  verifyingContract: Address;
19
39
  };
40
+ /** Investor EOA that will sign the message. */
20
41
  investor: Address;
42
+ /** Operator address (the DegenNFT contract). */
21
43
  operator: Address;
44
+ /** DSToken address to register for. */
22
45
  token: Address;
46
+ /** Monotonic nonce from VaultRegistrar (investor, operator). */
23
47
  nonce: bigint;
48
+ /** Unix timestamp after which the message is no longer valid. */
24
49
  deadline: bigint;
25
50
  }
51
+ /**
52
+ * Per-credit-account data decoded from the KYC compressor's
53
+ * `getCreditAccountData` extra details for a Securitize factory.
54
+ **/
26
55
  export interface SecuritizeCreditAccountData {
56
+ /** Credit account address. */
27
57
  creditAccount: Address;
58
+ /** SecuritizeWallet proxy that owns the credit account. */
28
59
  wallet: Address;
60
+ /** Whether the Securitize admin has frozen this account. */
29
61
  frozen: boolean;
62
+ /** DSToken addresses where this credit account is registered as a vault. */
30
63
  registeredTokens: Address[];
31
64
  }
65
+ /**
66
+ * Investor-level data decoded from the KYC compressor's `getKYCInvestorData`
67
+ * extra details for a Securitize factory.
68
+ **/
32
69
  export interface SecuritizeInvestorData {
70
+ /** Securitize KYC factory address that produced this data. */
33
71
  factory: Address;
72
+ /** Credit accounts owned by the investor through this factory. */
34
73
  creditAccounts: SecuritizeCreditAccountData[];
74
+ /** DSToken addresses where the investor is already registered. */
35
75
  registeredTokens: Address[];
76
+ /** Cached signatures still valid and reusable for registration. */
36
77
  cachedSignatures: SecuritizeRegisterMessage[];
78
+ /** EIP-712 messages the investor must sign to register new vaults. */
37
79
  registerVaultMessages: SecuritizeRegisterVaultMessage[];
38
80
  }
81
+ /**
82
+ * Human-readable serialisation of {@link SecuritizeKYCFactory} state.
83
+ **/
39
84
  export interface SecuritizeKYCFactoryStateHuman extends BaseContractStateHuman {
40
85
  owner: string;
41
86
  degenNFT: string;
@@ -4,8 +4,17 @@ import type { iKYCCompressorAbi } from "../../../abi/kyc/iKYCCompressor.js";
4
4
  import type { IBaseContract, Unarray } from "../../base/index.js";
5
5
  import type { MultiCall, RawTx } from "../../types/index.js";
6
6
  import type { SecuritizeInvestorData, SecuritizeKYCFactoryStateHuman, SecuritizeRegisterMessage } from "./securitize/types.js";
7
+ /**
8
+ * Discriminated union of all known KYC factory contract type strings.
9
+ **/
7
10
  export declare const KYC_FACTORY_TYPES: readonly ["KYC_FACTORY::SECURITIZE"];
11
+ /**
12
+ * String literal union of known KYC factory types.
13
+ **/
8
14
  export type KYCFactoryType = (typeof KYC_FACTORY_TYPES)[number];
15
+ /**
16
+ * Raw return type of `KYCCompressor.getKYCMarketsData`.
17
+ **/
9
18
  export type KYCCompressorResponse = AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iKYCCompressorAbi, "getKYCMarketsData">["outputs"]>;
10
19
  /**
11
20
  * On-chain state of a KYC underlying token.
@@ -13,24 +22,58 @@ export type KYCCompressorResponse = AbiParametersToPrimitiveTypes<ExtractAbiFunc
13
22
  export type KYCUnderlyingData = Unarray<KYCCompressorResponse[0]>;
14
23
  /**
15
24
  * On-chain state of a KYC factory.
16
- */
25
+ **/
17
26
  export type KYCFactoryData = Unarray<KYCCompressorResponse[1]>;
18
- export type KYCCOmpressorCall = ContractFunctionParameters<typeof iKYCCompressorAbi, "view", "getKYCMarketsData">;
27
+ /**
28
+ * Typed contract call parameters for `KYCCompressor.getKYCMarketsData`.
29
+ **/
30
+ export type KYCCompressorCall = ContractFunctionParameters<typeof iKYCCompressorAbi, "view", "getKYCMarketsData">;
31
+ /**
32
+ * Single element of the `KYCCompressor.getKYCInvestorData` return array.
33
+ * Contains per-factory credit accounts and factory-specific extra details.
34
+ **/
19
35
  export type KYCCompressorInvestorData = Unarray<AbiParametersToPrimitiveTypes<ExtractAbiFunction<typeof iKYCCompressorAbi, "getKYCInvestorData">["outputs"]>[0]>;
36
+ /**
37
+ * Full KYC compressor response, used as the persisted/hydrated state.
38
+ **/
20
39
  export type KYCState = KYCCompressorResponse;
40
+ /**
41
+ * Decoded DSToken data from the SecuritizeDegenNFT contract.
42
+ * Mirrors `ISecuritizeDegenNFT.DSTokenData`.
43
+ **/
21
44
  export interface DStokenData {
45
+ /** DSToken address. */
22
46
  address: Address;
47
+ /** Securitize VaultRegistrar for this token. */
23
48
  registrar: Address;
49
+ /** Addresses authorised to register vaults for this token. */
24
50
  operators: Address[];
25
51
  }
52
+ /**
53
+ * Investor data decoded from the KYC compressor.
54
+ **/
26
55
  export type InvestorData = SecuritizeInvestorData;
56
+ /**
57
+ * Human-readable KYC factory state.
58
+ **/
27
59
  export type KYCFactoryStateHuman = SecuritizeKYCFactoryStateHuman;
60
+ /**
61
+ * Human-readable snapshot of the full KYC registry state.
62
+ **/
28
63
  export interface KYCStateHuman {
64
+ /** State of each loaded KYC factory. */
29
65
  factories: KYCFactoryStateHuman[];
30
66
  }
67
+ /**
68
+ * Base type returned by {@link IKYCFactory.getOpenAccountRequirements} when an
69
+ * investor needs to perform additional steps before opening a credit account.
70
+ * Each KYC factory implementation extends this with factory-specific fields
71
+ * (e.g. tokens to register, signatures to provide).
72
+ *
73
+ **/
31
74
  export interface OpenAccountRequirements {
32
75
  /**
33
- * KYC factory type
76
+ * Discriminant identifying which KYC factory produced these requirements.
34
77
  */
35
78
  type: KYCFactoryType;
36
79
  }
@@ -1,9 +1,26 @@
1
1
  import type { Chain, Client, ContractFunctionParameters, Transport } from "viem";
2
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
+ **/
3
8
  export interface DelegatedMulticall {
9
+ /** Contract call parameters (ABI, address, function name, args). */
4
10
  call: ContractFunctionParameters;
11
+ /** Callback invoked with the decoded return value after simulation. */
5
12
  onResult: (resp: unknown) => void;
6
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
+ **/
7
24
  export declare function executeDelegatedMulticalls(client: Client<Transport, Chain>, multicalls: DelegatedMulticall[], opts: {
8
25
  priceUpdates: IPriceUpdateTx[];
9
26
  blockNumber: bigint;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "13.6.0-kyc.2",
3
+ "version": "13.6.0-kyc.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",
@@ -1,31 +0,0 @@
1
- import type { Address } from "abitype";
2
- import { SDKConstruct } from "../../base/index.js";
3
- import type { DelegatedMulticall } from "../../utils/viem/index.js";
4
- import { SecuritizeKYCFactory } from "./securitize/index.js";
5
- import type { InvestorData, KYCCompressorResponse, KYCState, KYCStateHuman } from "./types.js";
6
- export declare class KYCRegister extends SDKConstruct {
7
- #private;
8
- /**
9
- * @internal
10
- *
11
- * Returns delegated multicalls for loading all KYC underlying tokens from the on-chain KYC compressor.
12
- * Used by the SDK to compose batched RPC calls.
13
- *
14
- * @param configurators - Market configurators to query.
15
- * @param kycFactories - KYC factory contracts to query.
16
- * @returns
17
- */
18
- getLoadMulticalls(configurators: Address[], kycFactories?: Address[]): DelegatedMulticall[];
19
- /**
20
- * Returns the investor data for a given investor and optional list of factories.
21
- * If no factories are provided, all factories will be used.
22
- * @param investor
23
- * @param factories_
24
- * @returns
25
- */
26
- getInvestorData(investor: Address, factories_?: Address[]): Promise<InvestorData[]>;
27
- get factories(): SecuritizeKYCFactory[];
28
- get state(): KYCState | undefined;
29
- stateHuman(raw?: boolean): KYCStateHuman;
30
- setState(resp?: KYCCompressorResponse): void;
31
- }