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

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.
@@ -66,7 +66,7 @@ class PoolPointsAPI {
66
66
  }
67
67
  static async getTokenTotal(token, network, tokensList) {
68
68
  const chainId = import_sdk.chains[network]?.id;
69
- const url = `https://charts-server.fly.dev/api/getBalanceAt?asset=${token}&chainId=${chainId}`;
69
+ const url = `https://api.gearbox.foundation/v1/getBalanceAt?asset=${token}&chainId=${chainId}`;
70
70
  const result = await import_axios.default.get(url);
71
71
  const balance = result.data.result.reduce(
72
72
  (sum, r) => r.effective_balance + sum,
@@ -82,6 +82,7 @@ const chains = {
82
82
  "0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit",
83
83
  "0x610627d8d01a413bdd9b0a0b60070da7dd1e54ad": "Securitize"
84
84
  },
85
+ kycFactories: [],
85
86
  isPublic: true,
86
87
  wellKnownToken: {
87
88
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -99,6 +100,7 @@ const chains = {
99
100
  defaultMarketConfigurators: {
100
101
  "0x01023850b360b88de0d0f84015bbba1eba57fe7e": "Chaos Labs"
101
102
  },
103
+ kycFactories: [],
102
104
  isPublic: true,
103
105
  wellKnownToken: {
104
106
  address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
@@ -117,6 +119,7 @@ const chains = {
117
119
  "0x2a15969CE5320868eb609680751cF8896DD92De5": "Chaos Labs",
118
120
  "0x9dddd1b9ce0ac8aa0c80e4ec141600b9bf0101c3": "UltraYield"
119
121
  },
122
+ kycFactories: [],
120
123
  isPublic: true,
121
124
  wellKnownToken: {
122
125
  address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
@@ -132,6 +135,7 @@ const chains = {
132
135
  ...import_chains.base,
133
136
  network: "Base",
134
137
  defaultMarketConfigurators: {},
138
+ kycFactories: [],
135
139
  isPublic: false,
136
140
  wellKnownToken: {
137
141
  address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
@@ -148,6 +152,7 @@ const chains = {
148
152
  defaultMarketConfigurators: {
149
153
  "0x8FFDd1F1433674516f83645a768E8900A2A5D076": "Chaos Labs"
150
154
  },
155
+ kycFactories: [],
151
156
  isPublic: true,
152
157
  blockExplorers: {
153
158
  default: {
@@ -169,6 +174,7 @@ const chains = {
169
174
  ...import_chains.megaeth,
170
175
  network: "MegaETH",
171
176
  defaultMarketConfigurators: {},
177
+ kycFactories: [],
172
178
  isPublic: false,
173
179
  wellKnownToken: {
174
180
  address: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
@@ -190,6 +196,7 @@ const chains = {
190
196
  "0x16956912813ab9a38d95730b52a8cf53e860a7c5": "Tulipa",
191
197
  "0x7c6ee1bf9c1eb3ee55bdbdc1e8d0317aab718e0a": "UltraYield"
192
198
  },
199
+ kycFactories: [],
193
200
  isPublic: true,
194
201
  wellKnownToken: {
195
202
  address: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
@@ -203,6 +210,7 @@ const chains = {
203
210
  ...import_chains.berachain,
204
211
  network: "Berachain",
205
212
  defaultMarketConfigurators: {},
213
+ kycFactories: [],
206
214
  isPublic: false,
207
215
  blockExplorers: {
208
216
  default: {
@@ -224,6 +232,7 @@ const chains = {
224
232
  ...import_chains.avalanche,
225
233
  network: "Avalanche",
226
234
  defaultMarketConfigurators: {},
235
+ kycFactories: [],
227
236
  isPublic: false,
228
237
  wellKnownToken: {
229
238
  address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
@@ -242,6 +251,7 @@ const chains = {
242
251
  "0x92dc4ee43e9b207e16fbf3fd1a6933563c0a0d35": "Re7"
243
252
  },
244
253
  testMarketConfigurators: {},
254
+ kycFactories: [],
245
255
  isPublic: true,
246
256
  wellKnownToken: {
247
257
  address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
@@ -256,6 +266,7 @@ const chains = {
256
266
  ...import_chains.worldchain,
257
267
  network: "WorldChain",
258
268
  defaultMarketConfigurators: {},
269
+ kycFactories: [],
259
270
  isPublic: false,
260
271
  wellKnownToken: {
261
272
  address: "0x79a02482a880bce3f13e09da970dc34db4cd24d1",
@@ -270,6 +281,7 @@ const chains = {
270
281
  defaultMarketConfigurators: {
271
282
  "0x577424f0e6f50db668cc1bc76babb87e36732291": "Re7"
272
283
  },
284
+ kycFactories: [],
273
285
  isPublic: true,
274
286
  wellKnownToken: {
275
287
  address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
@@ -284,6 +296,7 @@ const chains = {
284
296
  defaultMarketConfigurators: {
285
297
  "0xc9961b8a0c763779690577f2c76962c086af2fe3": "Invariant Group"
286
298
  },
299
+ kycFactories: [],
287
300
  isPublic: true,
288
301
  wellKnownToken: {
289
302
  address: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
@@ -303,6 +316,7 @@ const chains = {
303
316
  defaultMarketConfigurators: {
304
317
  "0x25778dbf0e56b7feb8358c4aa2f6f9e19a1c145a": "Re7"
305
318
  },
319
+ kycFactories: [],
306
320
  isPublic: true,
307
321
  wellKnownToken: {
308
322
  address: "0xF242275d3a6527d877f2c927a82D9b057609cc71",
@@ -319,6 +333,7 @@ const chains = {
319
333
  "0xce1cf71a28837daaa7b92d00ca4ef2fd649c2a67": "Hyperithm",
320
334
  "0x9655f82b585b11cee8a05576ed8efcf755cec04b": "TelosC"
321
335
  },
336
+ kycFactories: [],
322
337
  isPublic: true,
323
338
  wellKnownToken: {
324
339
  address: "0x5d72a9d9a9510cd8cbdba12ac62593a58930a948",
@@ -345,6 +360,7 @@ const chains = {
345
360
  defaultMarketConfigurators: {
346
361
  "0x1ca8b92aa7233a9f8f7ba031ac45c878141adff0": "Invariant Group"
347
362
  },
363
+ kycFactories: [],
348
364
  isPublic: true,
349
365
  wellKnownToken: {
350
366
  address: "0x67B302E35Aef5EEE8c32D934F5856869EF428330",
@@ -90,6 +90,7 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
90
90
  extraDetails
91
91
  );
92
92
  return {
93
+ type: import_constants.KYC_FACTORY_SECURITIZE,
93
94
  factory: this.address,
94
95
  cachedSignatures: [...cachedSignatures],
95
96
  registerVaultMessages: [...registerVaultMessages],
@@ -154,21 +155,19 @@ class SecuritizeKYCFactory extends import_base.BaseContract {
154
155
  const [investorData] = await this.#sdk.kyc.getInvestorData(investor, [
155
156
  this.address
156
157
  ]);
157
- const desiredTokens = new import_utils.AddressSet([props.tokenOutAddress]);
158
+ const tokensToRegister = new import_utils.AddressSet([props.tokenOutAddress]);
158
159
  const registredTokens = new import_utils.AddressSet(investorData.registeredTokens);
159
160
  const signedTokens = new import_utils.AddressSet(
160
161
  investorData.cachedSignatures.map((s) => s.token)
161
162
  );
162
- const unsignedTokens = desiredTokens.difference(signedTokens);
163
- const tokensToRegister = desiredTokens.difference(registredTokens);
163
+ const unsignedTokens = tokensToRegister.difference(signedTokens);
164
+ const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
164
165
  const requiredSignatures = investorData.registerVaultMessages.filter(
165
166
  (m) => unsignedTokens.has(m.token)
166
167
  );
167
- if (tokensToRegister.size === 0 && requiredSignatures.length === 0) {
168
- return void 0;
169
- }
170
168
  return {
171
169
  type: import_constants.KYC_FACTORY_SECURITIZE,
170
+ securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
172
171
  tokensToRegister: Array.from(tokensToRegister),
173
172
  requiredSignatures
174
173
  };
@@ -36,7 +36,7 @@ class PoolPointsAPI {
36
36
  }
37
37
  static async getTokenTotal(token, network, tokensList) {
38
38
  const chainId = chains[network]?.id;
39
- const url = `https://charts-server.fly.dev/api/getBalanceAt?asset=${token}&chainId=${chainId}`;
39
+ const url = `https://api.gearbox.foundation/v1/getBalanceAt?asset=${token}&chainId=${chainId}`;
40
40
  const result = await axios.get(url);
41
41
  const balance = result.data.result.reduce(
42
42
  (sum, r) => r.effective_balance + sum,
@@ -68,6 +68,7 @@ const chains = {
68
68
  "0x99df7330bf42d596af2e9d9836d4fc2077c574aa": "M11 Credit",
69
69
  "0x610627d8d01a413bdd9b0a0b60070da7dd1e54ad": "Securitize"
70
70
  },
71
+ kycFactories: [],
71
72
  isPublic: true,
72
73
  wellKnownToken: {
73
74
  address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
@@ -85,6 +86,7 @@ const chains = {
85
86
  defaultMarketConfigurators: {
86
87
  "0x01023850b360b88de0d0f84015bbba1eba57fe7e": "Chaos Labs"
87
88
  },
89
+ kycFactories: [],
88
90
  isPublic: true,
89
91
  wellKnownToken: {
90
92
  address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
@@ -103,6 +105,7 @@ const chains = {
103
105
  "0x2a15969CE5320868eb609680751cF8896DD92De5": "Chaos Labs",
104
106
  "0x9dddd1b9ce0ac8aa0c80e4ec141600b9bf0101c3": "UltraYield"
105
107
  },
108
+ kycFactories: [],
106
109
  isPublic: true,
107
110
  wellKnownToken: {
108
111
  address: "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
@@ -118,6 +121,7 @@ const chains = {
118
121
  ...base,
119
122
  network: "Base",
120
123
  defaultMarketConfigurators: {},
124
+ kycFactories: [],
121
125
  isPublic: false,
122
126
  wellKnownToken: {
123
127
  address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
@@ -134,6 +138,7 @@ const chains = {
134
138
  defaultMarketConfigurators: {
135
139
  "0x8FFDd1F1433674516f83645a768E8900A2A5D076": "Chaos Labs"
136
140
  },
141
+ kycFactories: [],
137
142
  isPublic: true,
138
143
  blockExplorers: {
139
144
  default: {
@@ -155,6 +160,7 @@ const chains = {
155
160
  ...megaeth,
156
161
  network: "MegaETH",
157
162
  defaultMarketConfigurators: {},
163
+ kycFactories: [],
158
164
  isPublic: false,
159
165
  wellKnownToken: {
160
166
  address: "0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7",
@@ -176,6 +182,7 @@ const chains = {
176
182
  "0x16956912813ab9a38d95730b52a8cf53e860a7c5": "Tulipa",
177
183
  "0x7c6ee1bf9c1eb3ee55bdbdc1e8d0317aab718e0a": "UltraYield"
178
184
  },
185
+ kycFactories: [],
179
186
  isPublic: true,
180
187
  wellKnownToken: {
181
188
  address: "0xe7cd86e13AC4309349F30B3435a9d337750fC82D",
@@ -189,6 +196,7 @@ const chains = {
189
196
  ...berachain,
190
197
  network: "Berachain",
191
198
  defaultMarketConfigurators: {},
199
+ kycFactories: [],
192
200
  isPublic: false,
193
201
  blockExplorers: {
194
202
  default: {
@@ -210,6 +218,7 @@ const chains = {
210
218
  ...avalanche,
211
219
  network: "Avalanche",
212
220
  defaultMarketConfigurators: {},
221
+ kycFactories: [],
213
222
  isPublic: false,
214
223
  wellKnownToken: {
215
224
  address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
@@ -228,6 +237,7 @@ const chains = {
228
237
  "0x92dc4ee43e9b207e16fbf3fd1a6933563c0a0d35": "Re7"
229
238
  },
230
239
  testMarketConfigurators: {},
240
+ kycFactories: [],
231
241
  isPublic: true,
232
242
  wellKnownToken: {
233
243
  address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d",
@@ -242,6 +252,7 @@ const chains = {
242
252
  ...worldchain,
243
253
  network: "WorldChain",
244
254
  defaultMarketConfigurators: {},
255
+ kycFactories: [],
245
256
  isPublic: false,
246
257
  wellKnownToken: {
247
258
  address: "0x79a02482a880bce3f13e09da970dc34db4cd24d1",
@@ -256,6 +267,7 @@ const chains = {
256
267
  defaultMarketConfigurators: {
257
268
  "0x577424f0e6f50db668cc1bc76babb87e36732291": "Re7"
258
269
  },
270
+ kycFactories: [],
259
271
  isPublic: true,
260
272
  wellKnownToken: {
261
273
  address: "0x796Ea11Fa2dD751eD01b53C372fFDB4AAa8f00F9",
@@ -270,6 +282,7 @@ const chains = {
270
282
  defaultMarketConfigurators: {
271
283
  "0xc9961b8a0c763779690577f2c76962c086af2fe3": "Invariant Group"
272
284
  },
285
+ kycFactories: [],
273
286
  isPublic: true,
274
287
  wellKnownToken: {
275
288
  address: "0xad11a8BEb98bbf61dbb1aa0F6d6F2ECD87b35afA",
@@ -289,6 +302,7 @@ const chains = {
289
302
  defaultMarketConfigurators: {
290
303
  "0x25778dbf0e56b7feb8358c4aa2f6f9e19a1c145a": "Re7"
291
304
  },
305
+ kycFactories: [],
292
306
  isPublic: true,
293
307
  wellKnownToken: {
294
308
  address: "0xF242275d3a6527d877f2c927a82D9b057609cc71",
@@ -305,6 +319,7 @@ const chains = {
305
319
  "0xce1cf71a28837daaa7b92d00ca4ef2fd649c2a67": "Hyperithm",
306
320
  "0x9655f82b585b11cee8a05576ed8efcf755cec04b": "TelosC"
307
321
  },
322
+ kycFactories: [],
308
323
  isPublic: true,
309
324
  wellKnownToken: {
310
325
  address: "0x5d72a9d9a9510cd8cbdba12ac62593a58930a948",
@@ -331,6 +346,7 @@ const chains = {
331
346
  defaultMarketConfigurators: {
332
347
  "0x1ca8b92aa7233a9f8f7ba031ac45c878141adff0": "Invariant Group"
333
348
  },
349
+ kycFactories: [],
334
350
  isPublic: true,
335
351
  wellKnownToken: {
336
352
  address: "0x67B302E35Aef5EEE8c32D934F5856869EF428330",
@@ -67,6 +67,7 @@ class SecuritizeKYCFactory extends BaseContract {
67
67
  extraDetails
68
68
  );
69
69
  return {
70
+ type: KYC_FACTORY_SECURITIZE,
70
71
  factory: this.address,
71
72
  cachedSignatures: [...cachedSignatures],
72
73
  registerVaultMessages: [...registerVaultMessages],
@@ -131,21 +132,19 @@ class SecuritizeKYCFactory extends BaseContract {
131
132
  const [investorData] = await this.#sdk.kyc.getInvestorData(investor, [
132
133
  this.address
133
134
  ]);
134
- const desiredTokens = new AddressSet([props.tokenOutAddress]);
135
+ const tokensToRegister = new AddressSet([props.tokenOutAddress]);
135
136
  const registredTokens = new AddressSet(investorData.registeredTokens);
136
137
  const signedTokens = new AddressSet(
137
138
  investorData.cachedSignatures.map((s) => s.token)
138
139
  );
139
- const unsignedTokens = desiredTokens.difference(signedTokens);
140
- const tokensToRegister = desiredTokens.difference(registredTokens);
140
+ const unsignedTokens = tokensToRegister.difference(signedTokens);
141
+ const securitizeTokensToRegister = tokensToRegister.difference(registredTokens);
141
142
  const requiredSignatures = investorData.registerVaultMessages.filter(
142
143
  (m) => unsignedTokens.has(m.token)
143
144
  );
144
- if (tokensToRegister.size === 0 && requiredSignatures.length === 0) {
145
- return void 0;
146
- }
147
145
  return {
148
146
  type: KYC_FACTORY_SECURITIZE,
147
+ securitizeTokensToRegister: Array.from(securitizeTokensToRegister),
149
148
  tokensToRegister: Array.from(tokensToRegister),
150
149
  requiredSignatures
151
150
  };
@@ -23,7 +23,7 @@ export interface GearboxChain extends Chain {
23
23
  /**
24
24
  * Known KYC factory addresses on this chain
25
25
  */
26
- kycFactories?: Address[];
26
+ kycFactories: Address[];
27
27
  /**
28
28
  * Market configurators used in test/staging environments.
29
29
  **/
@@ -77,6 +77,7 @@ export interface SecuritizeCreditAccountData {
77
77
  * extra details for a Securitize factory.
78
78
  **/
79
79
  export interface SecuritizeInvestorData {
80
+ type: typeof KYC_FACTORY_SECURITIZE;
80
81
  /** Securitize KYC factory address that produced this data. */
81
82
  factory: Address;
82
83
  /** Credit accounts owned by the investor through this factory. */
@@ -118,6 +119,13 @@ export interface SecuritizeOpenAccountRequirements {
118
119
  type: typeof KYC_FACTORY_SECURITIZE;
119
120
  /**
120
121
  * User must visit securitize website to register these tokens
122
+ * May be empty if user already registered all required tokens
123
+ */
124
+ securitizeTokensToRegister: Address[];
125
+ /**
126
+ * Desired tokens to register for this operation, must be always present on open credit account
127
+ * Come from strategy configuration
128
+ * Passed to openCreditAccount contract call on securitize factory
121
129
  */
122
130
  tokensToRegister: Address[];
123
131
  /**
@@ -31,14 +31,17 @@ interface KYCFactoryTypeMap {
31
31
  }
32
32
  /**
33
33
  * Investor data decoded from the KYC compressor, defaults to union of all factory types
34
+ * Can be discriminated by type
34
35
  **/
35
36
  export type KYCInvestorData<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["investorData"];
36
37
  /**
37
38
  * Open-account requirements for a KYC factory, defaults to union of all factory types
39
+ * Can be discriminated by type
38
40
  **/
39
41
  export type KYCOpenAccountRequirements<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["openAccountRequirements"];
40
42
  /**
41
43
  * Open credit account/Multicall extra params type for a KYC factory, defaults to union of all factory types
44
+ * Can be discriminated by type
42
45
  **/
43
46
  export type KYCOperationParams<T extends KYCFactoryType = KYCFactoryType> = KYCFactoryTypeMap[T]["operationParams"];
44
47
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "13.7.0-kyc.7",
3
+ "version": "13.7.0-kyc.9",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",