@ssv-labs/ssv-sdk 0.0.5 → 0.1.0

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.
Files changed (83) hide show
  1. package/dist/KeyShares-7biQfDev.js +19422 -0
  2. package/dist/KeyShares-DEqBZits.mjs +19423 -0
  3. package/dist/api/subgraph/index.d.ts +15 -54
  4. package/dist/config/chains.d.ts +18 -10
  5. package/dist/contract-interactions/types.d.ts +3 -1
  6. package/dist/globals-BZbDG7rK.mjs +472 -0
  7. package/dist/globals-iY-Y-uDY.js +471 -0
  8. package/dist/graphql/graphql.d.ts +10 -33
  9. package/dist/keys.js +9 -0
  10. package/dist/keys.mjs +9 -0
  11. package/dist/libs/api/index.d.ts +9 -69
  12. package/dist/libs/cluster/index.d.ts +11 -5632
  13. package/dist/libs/cluster/methods/deposit.d.ts +1 -1
  14. package/dist/libs/cluster/methods/exit-validators.d.ts +1 -1
  15. package/dist/libs/cluster/methods/index.d.ts +1 -1
  16. package/dist/libs/cluster/methods/liquidate-cluster.d.ts +1 -1
  17. package/dist/libs/cluster/methods/reactivate-cluster.d.ts +1 -1
  18. package/dist/libs/cluster/methods/register-validators.d.ts +6 -4
  19. package/dist/libs/cluster/methods/remove-validators.d.ts +1 -1
  20. package/dist/libs/cluster/methods/set-fee-recipient.d.ts +1 -1
  21. package/dist/libs/cluster/methods/withdraw.d.ts +1 -1
  22. package/dist/libs/operator/index.d.ts +119 -901
  23. package/dist/libs/operator/methods.d.ts +3 -3
  24. package/dist/libs/ssv-keys/BLS/index.d.ts +2 -0
  25. package/dist/libs/ssv-keys/Encryption/Encryption.d.ts +7 -0
  26. package/dist/libs/ssv-keys/Encryption/__test__/RsaKeys.d.ts +3 -0
  27. package/dist/libs/ssv-keys/Encryption/utils.d.ts +55 -0
  28. package/dist/libs/ssv-keys/EthereumKeyStore/EthereumKeyStore.d.ts +23 -0
  29. package/dist/libs/ssv-keys/EthereumKeyStore/index.d.ts +1 -0
  30. package/dist/libs/ssv-keys/KeyShares/KeyShares.d.ts +32 -0
  31. package/dist/libs/ssv-keys/KeyShares/KeySharesData/KeySharesData.d.ts +21 -0
  32. package/dist/libs/ssv-keys/KeyShares/KeySharesData/KeySharesPayload.d.ts +32 -0
  33. package/dist/libs/ssv-keys/KeyShares/KeySharesData/OperatorData.d.ts +10 -0
  34. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/encrypted-key.d.ts +6 -0
  35. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/index.d.ts +6 -0
  36. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/match.d.ts +6 -0
  37. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/operator-public-key.d.ts +6 -0
  38. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/operator-unique.d.ts +6 -0
  39. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/owner-address.d.ts +6 -0
  40. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/owner-nonce.d.ts +6 -0
  41. package/dist/libs/ssv-keys/KeyShares/KeySharesData/validators/public-key.d.ts +6 -0
  42. package/dist/libs/ssv-keys/KeyShares/KeySharesItem.d.ts +60 -0
  43. package/dist/libs/ssv-keys/SSVKeys.d.ts +66 -0
  44. package/dist/libs/ssv-keys/Threshold/Threshold.d.ts +28 -0
  45. package/dist/libs/ssv-keys/Threshold/__test__/helper/share_signatures.d.ts +7 -0
  46. package/dist/libs/ssv-keys/Threshold/index.d.ts +1 -0
  47. package/dist/libs/ssv-keys/exceptions/base.d.ts +4 -0
  48. package/dist/libs/ssv-keys/exceptions/bls.d.ts +9 -0
  49. package/dist/libs/ssv-keys/exceptions/index.d.ts +2 -0
  50. package/dist/libs/ssv-keys/exceptions/keyshares.d.ts +5 -0
  51. package/dist/libs/ssv-keys/exceptions/keystore.d.ts +27 -0
  52. package/dist/libs/ssv-keys/exceptions/operator.d.ts +22 -0
  53. package/dist/libs/ssv-keys/helpers/operator.helper.d.ts +7 -0
  54. package/dist/libs/ssv-keys/helpers/web3.helper.d.ts +36 -0
  55. package/dist/libs/ssv-keys/index.d.ts +4 -0
  56. package/dist/libs/ssv-keys/interfaces/IEncryptShare.d.ts +5 -0
  57. package/dist/libs/ssv-keys/interfaces/IKeySharesData.d.ts +18 -0
  58. package/dist/libs/ssv-keys/interfaces/IKeySharesPayload.d.ts +13 -0
  59. package/dist/libs/ssv-keys/interfaces/IOperator.d.ts +4 -0
  60. package/dist/libs/ssv-keys/interfaces/IOperatorData.d.ts +5 -0
  61. package/dist/libs/ssv-keys/interfaces/IShares.d.ts +10 -0
  62. package/dist/libs/ssv-keys/interfaces/index.d.ts +6 -0
  63. package/dist/libs/ssv-keys/validators/index.d.ts +2 -0
  64. package/dist/libs/ssv-keys/validators/operatorPublicKey.validator.d.ts +1 -0
  65. package/dist/libs/ssv-keys/validators/operatorsLength.validator.d.ts +1 -0
  66. package/dist/libs/utils/index.d.ts +8 -18
  67. package/dist/libs/utils/methods/keyshares.d.ts +5 -2
  68. package/dist/libs/utils/methods/keystores.d.ts +2 -2
  69. package/dist/main.d.ts +1 -0
  70. package/dist/main.js +3862 -34136
  71. package/dist/main.mjs +3920 -34193
  72. package/dist/mock/api.d.ts +1 -1
  73. package/dist/types/contract-interactions.d.ts +2 -2
  74. package/dist/utils/cluster.d.ts +1 -1
  75. package/dist/utils/contract.d.ts +2 -1
  76. package/dist/utils/keyshares.d.ts +2 -2
  77. package/dist/utils/number.d.ts +1 -1
  78. package/dist/utils/zod/config.d.ts +1 -1
  79. package/dist/utils.js +1 -1
  80. package/dist/utils.mjs +34 -34
  81. package/package.json +29 -14
  82. package/dist/globals-DsbufPrE.mjs +0 -5541
  83. package/dist/globals-fh7gkHKO.js +0 -5539
@@ -0,0 +1,471 @@
1
+ "use strict";
2
+ const lodashEs = require("lodash-es");
3
+ const viem = require("viem");
4
+ require("graphql-request");
5
+ const zod = require("zod");
6
+ const numberFormatter = new Intl.NumberFormat("en-US", {
7
+ useGrouping: true,
8
+ maximumFractionDigits: 2
9
+ });
10
+ const _percentageFormatter = new Intl.NumberFormat("en-US", {
11
+ style: "percent",
12
+ maximumFractionDigits: 2
13
+ });
14
+ const percentageFormatter = {
15
+ format: (value) => {
16
+ if (!value) return "0%";
17
+ return _percentageFormatter.format(value / 100);
18
+ }
19
+ };
20
+ const bigintFormatter = new Intl.NumberFormat("en-US", {
21
+ useGrouping: false,
22
+ maximumFractionDigits: 7
23
+ });
24
+ const ethFormatter = new Intl.NumberFormat("en-US", {
25
+ useGrouping: true,
26
+ maximumFractionDigits: 4
27
+ });
28
+ const formatSSV = (num, decimals = 18) => ethFormatter.format(+viem.formatUnits(num, decimals));
29
+ const formatBigintInput = (num, decimals = 18) => bigintFormatter.format(+viem.formatUnits(num, decimals));
30
+ const units = {
31
+ seconds: 1e3,
32
+ minutes: 6e4,
33
+ hours: 36e5,
34
+ days: 864e5,
35
+ weeks: 6048e5,
36
+ months: 2629746e3,
37
+ years: 31556952e3
38
+ };
39
+ const ms = (value, unit) => {
40
+ return value * units[unit];
41
+ };
42
+ const sortNumbers = (numbers) => {
43
+ return [...numbers].sort((a, b) => Number(a) - Number(b));
44
+ };
45
+ const getOperatorIds = (operators) => {
46
+ return sortNumbers(operators.map((operator) => operator.id));
47
+ };
48
+ const decodeOperatorPublicKey = (publicKey) => {
49
+ return viem.decodeAbiParameters([{ type: "string" }], publicKey)[0];
50
+ };
51
+ function defineChain(chain) {
52
+ return {
53
+ formatters: void 0,
54
+ fees: void 0,
55
+ serializers: void 0,
56
+ ...chain
57
+ };
58
+ }
59
+ const holesky = /* @__PURE__ */ defineChain({
60
+ id: 17e3,
61
+ name: "Holesky",
62
+ nativeCurrency: { name: "Holesky Ether", symbol: "ETH", decimals: 18 },
63
+ rpcUrls: {
64
+ default: {
65
+ http: ["https://ethereum-holesky-rpc.publicnode.com"]
66
+ }
67
+ },
68
+ blockExplorers: {
69
+ default: {
70
+ name: "Etherscan",
71
+ url: "https://holesky.etherscan.io",
72
+ apiUrl: "https://api-holesky.etherscan.io/api"
73
+ }
74
+ },
75
+ contracts: {
76
+ multicall3: {
77
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
78
+ blockCreated: 77
79
+ },
80
+ ensRegistry: {
81
+ address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",
82
+ blockCreated: 801613
83
+ },
84
+ ensUniversalResolver: {
85
+ address: "0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",
86
+ blockCreated: 973484
87
+ }
88
+ },
89
+ testnet: true
90
+ });
91
+ const mainnet = /* @__PURE__ */ defineChain({
92
+ id: 1,
93
+ name: "Ethereum",
94
+ nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
95
+ rpcUrls: {
96
+ default: {
97
+ http: ["https://eth.merkle.io"]
98
+ }
99
+ },
100
+ blockExplorers: {
101
+ default: {
102
+ name: "Etherscan",
103
+ url: "https://etherscan.io",
104
+ apiUrl: "https://api.etherscan.io/api"
105
+ }
106
+ },
107
+ contracts: {
108
+ ensRegistry: {
109
+ address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
110
+ },
111
+ ensUniversalResolver: {
112
+ address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
113
+ blockCreated: 19258213
114
+ },
115
+ multicall3: {
116
+ address: "0xca11bde05977b3631167028862be2a173976ca11",
117
+ blockCreated: 14353601
118
+ }
119
+ }
120
+ });
121
+ const hoodi = viem.defineChain({
122
+ id: 560048,
123
+ name: "Hoodi",
124
+ rpcUrls: {
125
+ default: {
126
+ http: ["https://rpc.hoodi.ethpandaops.io"]
127
+ }
128
+ },
129
+ nativeCurrency: {
130
+ name: "Hoodi Ether",
131
+ symbol: "ETH",
132
+ decimals: 18
133
+ },
134
+ testnet: true
135
+ });
136
+ const chains = {
137
+ mainnet,
138
+ holesky,
139
+ hoodi
140
+ };
141
+ const chainIds = Object.values(chains).map((chain) => chain.id);
142
+ const networks = Object.values(chains).map((chain) => chain.name);
143
+ const graph_endpoints = {
144
+ [mainnet.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-ethereum/version/latest",
145
+ [holesky.id]: "https://api.studio.thegraph.com/query/71118/ssv-network-holesky/version/latest",
146
+ [hoodi.id]: "https://graph-node-hoodi.stage.ops.ssvlabsinternal.com/subgraphs/name/ssv-bapps-hoodi"
147
+ };
148
+ const rest_endpoints = {
149
+ [mainnet.id]: "https://api.ssv.network/api/v4/mainnet",
150
+ [holesky.id]: "https://api.ssv.network/api/v4/holesky",
151
+ [hoodi.id]: "https://api.ssv.network/api/v4/hoodi"
152
+ };
153
+ const contracts = {
154
+ [mainnet.id]: {
155
+ setter: "0xDD9BC35aE942eF0cFa76930954a156B3fF30a4E1",
156
+ getter: "0xafE830B6Ee262ba11cce5F32fDCd760FFE6a66e4",
157
+ token: "0x9D65fF81a3c488d585bBfb0Bfe3c7707c7917f54"
158
+ },
159
+ [holesky.id]: {
160
+ setter: "0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA",
161
+ getter: "0x352A18AEe90cdcd825d1E37d9939dCA86C00e281",
162
+ token: "0xad45A78180961079BFaeEe349704F411dfF947C6"
163
+ },
164
+ [hoodi.id]: {
165
+ setter: "0x58410Bef803ECd7E63B23664C586A6DB72DAf59c",
166
+ getter: "0x5AdDb3f1529C5ec70D77400499eE4bbF328368fe",
167
+ token: "0x9F5d4Ec84fC4785788aB44F9de973cF34F7A038e"
168
+ }
169
+ };
170
+ const bigintMax = (...args) => {
171
+ return args.filter((x) => !lodashEs.isUndefined(x)).reduce((max, cur) => cur > max ? cur : max);
172
+ };
173
+ const bigintMin = (...args) => {
174
+ return args.filter((x) => !lodashEs.isUndefined(x)).reduce((min, cur) => cur < min ? cur : min);
175
+ };
176
+ const bigintRound = (value, precision) => {
177
+ const remainder = value % precision;
178
+ return remainder >= precision / 2n ? value + (precision - remainder) : value - remainder;
179
+ };
180
+ const bigintFloor = (value, precision = 10000000n) => {
181
+ return value - value % precision;
182
+ };
183
+ const bigintAbs = (n) => n < 0n ? -n : n;
184
+ const isBigIntChanged = (a, b, tolerance = viem.parseUnits("0.0001", 18)) => {
185
+ return bigintAbs(a - b) > tolerance;
186
+ };
187
+ const roundOperatorFee = (fee, precision = 10000000n) => {
188
+ return bigintRound(fee, precision);
189
+ };
190
+ const stringifyBigints = (anything) => {
191
+ return lodashEs.cloneDeepWith(anything, (value) => {
192
+ if (typeof value === "bigint") return value.toString();
193
+ });
194
+ };
195
+ const bigintifyNumbers = (numbers) => {
196
+ return lodashEs.cloneDeepWith(numbers, (value) => {
197
+ if (typeof value === "number") return BigInt(value);
198
+ });
199
+ };
200
+ const createClusterId = (ownerAddress, operatorIds) => {
201
+ if (!viem.isAddress(ownerAddress)) {
202
+ throw new Error("Invalid owner address");
203
+ }
204
+ return `${ownerAddress.toLowerCase()}-${operatorIds.join("-")}`;
205
+ };
206
+ const isClusterId = (clusterId) => {
207
+ const [ownerAddress, ...operatorIds] = clusterId.split("-");
208
+ return viem.isAddress(ownerAddress) && operatorIds.length >= 4 && operatorIds.every((id) => !isNaN(Number(id)));
209
+ };
210
+ const getClusterSnapshot = (cluster) => {
211
+ return {
212
+ active: cluster.active,
213
+ balance: BigInt(cluster.balance),
214
+ index: BigInt(cluster.index),
215
+ networkFeeIndex: BigInt(cluster.networkFeeIndex),
216
+ validatorCount: +cluster.validatorCount
217
+ };
218
+ };
219
+ const createEmptyCluster = (cluster = {}) => lodashEs.merge(
220
+ {
221
+ validatorCount: 0,
222
+ networkFeeIndex: 0n,
223
+ index: 0n,
224
+ balance: 0n,
225
+ active: true
226
+ },
227
+ cluster
228
+ );
229
+ const add0x = (value) => !value.startsWith("0x") ? `0x${value}` : value;
230
+ const isKeySharesItem = (item) => {
231
+ return !!item && typeof item === "object" && "data" in item && "payload" in item && "error" in item;
232
+ };
233
+ var KeysharesValidationErrors = /* @__PURE__ */ ((KeysharesValidationErrors2) => {
234
+ KeysharesValidationErrors2[KeysharesValidationErrors2["OperatorDoesNotExist"] = 0] = "OperatorDoesNotExist";
235
+ KeysharesValidationErrors2[KeysharesValidationErrors2["OperatorMismatch"] = 1] = "OperatorMismatch";
236
+ KeysharesValidationErrors2[KeysharesValidationErrors2["ValidatorAlreadyExists"] = 2] = "ValidatorAlreadyExists";
237
+ KeysharesValidationErrors2[KeysharesValidationErrors2["ClusterMismatch"] = 3] = "ClusterMismatch";
238
+ KeysharesValidationErrors2[KeysharesValidationErrors2["DuplicateValidatorKeys"] = 4] = "DuplicateValidatorKeys";
239
+ KeysharesValidationErrors2[KeysharesValidationErrors2["InconsistentOperatorPublicKeys"] = 5] = "InconsistentOperatorPublicKeys";
240
+ KeysharesValidationErrors2[KeysharesValidationErrors2["InconsistentOperators"] = 6] = "InconsistentOperators";
241
+ return KeysharesValidationErrors2;
242
+ })(KeysharesValidationErrors || {});
243
+ const KeysharesValidationErrorsMessages = {
244
+ [
245
+ 0
246
+ /* OperatorDoesNotExist */
247
+ ]: "Operator not found. Please verify the operator ID.",
248
+ [
249
+ 1
250
+ /* OperatorMismatch */
251
+ ]: "Operator details mismatch. Check provided information.",
252
+ [
253
+ 2
254
+ /* ValidatorAlreadyExists */
255
+ ]: "Validator public key already in use. Must be unique.",
256
+ [
257
+ 3
258
+ /* ClusterMismatch */
259
+ ]: "The operators in the provided keyshares do not match the provided operators. Please ensure the keyshares correspond to the cluster you are trying to register.",
260
+ [
261
+ 4
262
+ /* DuplicateValidatorKeys */
263
+ ]: "Duplicate validator keys detected. Each must be unique.",
264
+ [
265
+ 5
266
+ /* InconsistentOperatorPublicKeys */
267
+ ]: "Operator public keys mismatch. Verify operator data.",
268
+ [
269
+ 6
270
+ /* InconsistentOperators */
271
+ ]: "Inconsistent operator IDs across keyshares. Check all entries."
272
+ };
273
+ class KeysharesValidationError extends Error {
274
+ constructor(code) {
275
+ super(KeysharesValidationErrorsMessages[code]);
276
+ this.code = code;
277
+ }
278
+ }
279
+ const validateConsistentOperatorIds = (keyshares) => {
280
+ const operatorIds = sortNumbers(keyshares[0].payload.operatorIds);
281
+ keyshares.every(({ payload, data }) => {
282
+ const payloadOperatorIds = sortNumbers(payload.operatorIds).toString();
283
+ const dataOperatorIds = getOperatorIds(data.operators ?? []).toString();
284
+ const valid = payloadOperatorIds === dataOperatorIds && dataOperatorIds === operatorIds.toString();
285
+ if (!valid) {
286
+ throw new KeysharesValidationError(
287
+ 6
288
+ /* InconsistentOperators */
289
+ );
290
+ }
291
+ return true;
292
+ });
293
+ return operatorIds;
294
+ };
295
+ const ensureValidatorsUniqueness = (keyshares) => {
296
+ const set = new Set(keyshares.map(({ data }) => data.publicKey));
297
+ if (set.size !== keyshares.length) {
298
+ throw new KeysharesValidationError(
299
+ 4
300
+ /* DuplicateValidatorKeys */
301
+ );
302
+ }
303
+ return true;
304
+ };
305
+ const validateConsistentOperatorPublicKeys = (keyshares, operators) => {
306
+ const operatorsMap = new Map(operators.map((o) => [o.id, o.publicKey]));
307
+ const valid = keyshares.every(({ data }) => {
308
+ return data.operators?.every(({ id, operatorKey }) => {
309
+ return operatorsMap.get(id.toString()) === operatorKey;
310
+ });
311
+ });
312
+ if (!valid) {
313
+ throw new KeysharesValidationError(
314
+ 5
315
+ /* InconsistentOperatorPublicKeys */
316
+ );
317
+ }
318
+ return valid;
319
+ };
320
+ const ensureNoKeysharesErrors = (keyshares) => {
321
+ keyshares.forEach((share) => {
322
+ if (share.error) {
323
+ throw share.error;
324
+ }
325
+ });
326
+ return true;
327
+ };
328
+ const tryCatch = (fn) => {
329
+ try {
330
+ return [fn(), null];
331
+ } catch (e) {
332
+ return [null, e];
333
+ }
334
+ };
335
+ const configArgsSchema = zod.z.object({
336
+ publicClient: zod.z.custom().superRefine((val, ctx) => {
337
+ const client = val;
338
+ if (!client) {
339
+ ctx.addIssue({
340
+ code: zod.z.ZodIssueCode.custom,
341
+ message: "Public client must be provided"
342
+ });
343
+ return false;
344
+ }
345
+ if (client.chain === void 0) {
346
+ ctx.addIssue({
347
+ code: zod.z.ZodIssueCode.custom,
348
+ message: "Public client must have a chain property"
349
+ });
350
+ return false;
351
+ }
352
+ if (!chainIds.includes(client.chain?.id)) {
353
+ ctx.addIssue({
354
+ code: zod.z.ZodIssueCode.custom,
355
+ message: `Public client chain must be one of [${networks.join(", ")}]`
356
+ });
357
+ return false;
358
+ }
359
+ return true;
360
+ }),
361
+ walletClient: zod.z.custom().superRefine((val, ctx) => {
362
+ const client = val;
363
+ if (!client) {
364
+ ctx.addIssue({
365
+ code: zod.z.ZodIssueCode.custom,
366
+ message: "Wallet client must be provided"
367
+ });
368
+ return false;
369
+ }
370
+ if (client.chain === void 0) {
371
+ ctx.addIssue({
372
+ code: zod.z.ZodIssueCode.custom,
373
+ message: "Wallet client must have a chain property"
374
+ });
375
+ return false;
376
+ }
377
+ if (!chainIds.includes(client.chain?.id)) {
378
+ ctx.addIssue({
379
+ code: zod.z.ZodIssueCode.custom,
380
+ message: `Wallet client chain must be one of [${networks.join(", ")}]`
381
+ });
382
+ return false;
383
+ }
384
+ return true;
385
+ }),
386
+ _: zod.z.object({
387
+ graphUrl: zod.z.string().url().optional(),
388
+ restUrl: zod.z.string().url().optional(),
389
+ contractAddresses: zod.z.object({
390
+ setter: zod.z.string().optional(),
391
+ getter: zod.z.string().optional(),
392
+ token: zod.z.string().optional()
393
+ }).optional()
394
+ }).optional()
395
+ });
396
+ const globals = {
397
+ MAX_WEI_AMOUNT: 115792089237316195423570985008687907853269984665640564039457584007913129639935n,
398
+ CLUSTER_SIZES: {
399
+ QUAD_CLUSTER: 4,
400
+ SEPT_CLUSTER: 7,
401
+ DECA_CLUSTER: 10,
402
+ TRISKAIDEKA_CLUSTER: 13
403
+ },
404
+ FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE: {
405
+ QUAD_CLUSTER: 80,
406
+ SEPT_CLUSTER: 40,
407
+ DECA_CLUSTER: 30,
408
+ TRISKAIDEKA_CLUSTER: 20
409
+ },
410
+ BLOCKS_PER_DAY: 7160n,
411
+ OPERATORS_PER_PAGE: 50,
412
+ BLOCKS_PER_YEAR: 2613400n,
413
+ DEFAULT_CLUSTER_PERIOD: 730,
414
+ NUMBERS_OF_WEEKS_IN_YEAR: 52.1429,
415
+ MAX_VALIDATORS_COUNT_MULTI_FLOW: 50,
416
+ CLUSTER_VALIDITY_PERIOD_MINIMUM: 30,
417
+ OPERATOR_VALIDATORS_LIMIT_PRESERVE: 5,
418
+ MINIMUM_OPERATOR_FEE_PER_BLOCK: 1000000000n,
419
+ MIN_VALIDATORS_COUNT_PER_BULK_REGISTRATION: 1,
420
+ DEFAULT_ADDRESS_WHITELIST: "0x0000000000000000000000000000000000000000"
421
+ };
422
+ const registerValidatorsByClusterSizeLimits = {
423
+ [globals.CLUSTER_SIZES.QUAD_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.QUAD_CLUSTER,
424
+ [globals.CLUSTER_SIZES.SEPT_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.SEPT_CLUSTER,
425
+ [globals.CLUSTER_SIZES.DECA_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.DECA_CLUSTER,
426
+ [globals.CLUSTER_SIZES.TRISKAIDEKA_CLUSTER]: globals.FIXED_VALIDATORS_COUNT_PER_CLUSTER_SIZE.TRISKAIDEKA_CLUSTER
427
+ };
428
+ exports.KeysharesValidationError = KeysharesValidationError;
429
+ exports.KeysharesValidationErrors = KeysharesValidationErrors;
430
+ exports.KeysharesValidationErrorsMessages = KeysharesValidationErrorsMessages;
431
+ exports._percentageFormatter = _percentageFormatter;
432
+ exports.add0x = add0x;
433
+ exports.bigintAbs = bigintAbs;
434
+ exports.bigintFloor = bigintFloor;
435
+ exports.bigintFormatter = bigintFormatter;
436
+ exports.bigintMax = bigintMax;
437
+ exports.bigintMin = bigintMin;
438
+ exports.bigintRound = bigintRound;
439
+ exports.bigintifyNumbers = bigintifyNumbers;
440
+ exports.chainIds = chainIds;
441
+ exports.chains = chains;
442
+ exports.configArgsSchema = configArgsSchema;
443
+ exports.contracts = contracts;
444
+ exports.createClusterId = createClusterId;
445
+ exports.createEmptyCluster = createEmptyCluster;
446
+ exports.decodeOperatorPublicKey = decodeOperatorPublicKey;
447
+ exports.ensureNoKeysharesErrors = ensureNoKeysharesErrors;
448
+ exports.ensureValidatorsUniqueness = ensureValidatorsUniqueness;
449
+ exports.ethFormatter = ethFormatter;
450
+ exports.formatBigintInput = formatBigintInput;
451
+ exports.formatSSV = formatSSV;
452
+ exports.getClusterSnapshot = getClusterSnapshot;
453
+ exports.getOperatorIds = getOperatorIds;
454
+ exports.globals = globals;
455
+ exports.graph_endpoints = graph_endpoints;
456
+ exports.hoodi = hoodi;
457
+ exports.isBigIntChanged = isBigIntChanged;
458
+ exports.isClusterId = isClusterId;
459
+ exports.isKeySharesItem = isKeySharesItem;
460
+ exports.ms = ms;
461
+ exports.networks = networks;
462
+ exports.numberFormatter = numberFormatter;
463
+ exports.percentageFormatter = percentageFormatter;
464
+ exports.registerValidatorsByClusterSizeLimits = registerValidatorsByClusterSizeLimits;
465
+ exports.rest_endpoints = rest_endpoints;
466
+ exports.roundOperatorFee = roundOperatorFee;
467
+ exports.sortNumbers = sortNumbers;
468
+ exports.stringifyBigints = stringifyBigints;
469
+ exports.tryCatch = tryCatch;
470
+ exports.validateConsistentOperatorIds = validateConsistentOperatorIds;
471
+ exports.validateConsistentOperatorPublicKeys = validateConsistentOperatorPublicKeys;
@@ -3214,36 +3214,13 @@ export type GetClusterBalanceQuery = {
3214
3214
  balance: string;
3215
3215
  } | null;
3216
3216
  };
3217
- export declare const GetClusterSnapshotDocument: DocumentNode<GetClusterSnapshotQuery, Exact<{
3218
- id: Scalars['ID']['input'];
3219
- }>>;
3220
- export declare const GetClusterDocument: DocumentNode<GetClusterQuery, Exact<{
3221
- id: Scalars['ID']['input'];
3222
- }>>;
3223
- export declare const GetClustersDocument: DocumentNode<GetClustersQuery, Exact<{
3224
- owner: Scalars['String']['input'];
3225
- }>>;
3226
- export declare const GetOwnerNonceDocument: DocumentNode<GetOwnerNonceQuery, Exact<{
3227
- owner: Scalars['ID']['input'];
3228
- }>>;
3229
- export declare const GetOwnerNonceByBlockDocument: DocumentNode<GetOwnerNonceByBlockQuery, Exact<{
3230
- owner: Scalars['ID']['input'];
3231
- block?: InputMaybe<number> | undefined;
3232
- }>>;
3233
- export declare const GetOperatorDocument: DocumentNode<GetOperatorQuery, Exact<{
3234
- id: Scalars['ID']['input'];
3235
- }>>;
3236
- export declare const GetOperatorsDocument: DocumentNode<GetOperatorsQuery, Exact<{
3237
- operatorIds: Array<Scalars['String']['input']> | Scalars['String']['input'];
3238
- }>>;
3239
- export declare const GetValidatorsDocument: DocumentNode<GetValidatorsQuery, Exact<{
3240
- ids: Array<Scalars['Bytes']['input']> | Scalars['Bytes']['input'];
3241
- }>>;
3242
- export declare const GetValidatorDocument: DocumentNode<GetValidatorQuery, Exact<{
3243
- id: Scalars['ID']['input'];
3244
- }>>;
3245
- export declare const GetClusterBalanceDocument: DocumentNode<GetClusterBalanceQuery, Exact<{
3246
- clusterId: Scalars['ID']['input'];
3247
- daoAddress: Scalars['ID']['input'];
3248
- operatorIds: Array<Scalars['String']['input']> | Scalars['String']['input'];
3249
- }>>;
3217
+ export declare const GetClusterSnapshotDocument: DocumentNode<GetClusterSnapshotQuery, GetClusterSnapshotQueryVariables>;
3218
+ export declare const GetClusterDocument: DocumentNode<GetClusterQuery, GetClusterQueryVariables>;
3219
+ export declare const GetClustersDocument: DocumentNode<GetClustersQuery, GetClustersQueryVariables>;
3220
+ export declare const GetOwnerNonceDocument: DocumentNode<GetOwnerNonceQuery, GetOwnerNonceQueryVariables>;
3221
+ export declare const GetOwnerNonceByBlockDocument: DocumentNode<GetOwnerNonceByBlockQuery, GetOwnerNonceByBlockQueryVariables>;
3222
+ export declare const GetOperatorDocument: DocumentNode<GetOperatorQuery, GetOperatorQueryVariables>;
3223
+ export declare const GetOperatorsDocument: DocumentNode<GetOperatorsQuery, GetOperatorsQueryVariables>;
3224
+ export declare const GetValidatorsDocument: DocumentNode<GetValidatorsQuery, GetValidatorsQueryVariables>;
3225
+ export declare const GetValidatorDocument: DocumentNode<GetValidatorQuery, GetValidatorQueryVariables>;
3226
+ export declare const GetClusterBalanceDocument: DocumentNode<GetClusterBalanceQuery, GetClusterBalanceQueryVariables>;
package/dist/keys.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const KeyShares = require("./KeyShares-7biQfDev.js");
4
+ exports.KeyShares = KeyShares.KeyShares;
5
+ exports.KeySharesItem = KeyShares.KeySharesItem;
6
+ exports.OperatorPublicKeyError = KeyShares.OperatorPublicKeyError;
7
+ exports.OperatorsCountsMismatchError = KeyShares.OperatorsCountsMismatchError;
8
+ exports.SSVKeys = KeyShares.SSVKeys;
9
+ exports.SSVKeysException = KeyShares.SSVKeysException;
package/dist/keys.mjs ADDED
@@ -0,0 +1,9 @@
1
+ import { a, K, O, c, S, b } from "./KeyShares-DEqBZits.mjs";
2
+ export {
3
+ a as KeyShares,
4
+ K as KeySharesItem,
5
+ O as OperatorPublicKeyError,
6
+ c as OperatorsCountsMismatchError,
7
+ S as SSVKeys,
8
+ b as SSVKeysException
9
+ };
@@ -1,74 +1,14 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
2
  export declare const createQueries: (graphqlClient: GraphQLClient) => {
3
- getOwnerNonce: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
4
- owner: string;
5
- block?: import('../../graphql/graphql').InputMaybe<number> | undefined;
6
- }>) => Promise<string>>;
7
- getClusterSnapshot: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
8
- id: string;
9
- }>) => Promise<{
10
- active: boolean;
11
- validatorCount: string;
12
- balance: string;
13
- index: string;
14
- networkFeeIndex: string;
15
- } | null | undefined>>;
16
- getCluster: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
17
- id: string;
18
- }>) => Promise<{
19
- active: boolean;
20
- validatorCount: string;
21
- balance: string;
22
- index: string;
23
- networkFeeIndex: string;
24
- operatorIds: string[];
25
- } | null | undefined>>;
26
- getClusters: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
27
- owner: string;
28
- }>) => Promise<{
29
- id: string;
30
- active: boolean;
31
- validatorCount: string;
32
- balance: string;
33
- index: string;
34
- networkFeeIndex: string;
35
- operatorIds: string[];
36
- }[]>>;
37
- getOperator: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
38
- id: string;
39
- }>) => Promise<{
40
- publicKey: string;
41
- whitelisted: `0x${string}`[];
42
- id: string;
43
- validatorCount: string;
44
- isPrivate: boolean;
45
- whitelistedContract: `0x${string}`;
46
- } | null>>;
47
- getOperators: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
48
- operatorIds: string | string[];
49
- }>) => Promise<{
50
- publicKey: string;
51
- whitelisted: `0x${string}`[];
52
- id: string;
53
- validatorCount: string;
54
- isPrivate: boolean;
55
- whitelistedContract: `0x${string}`;
56
- }[]>>;
57
- getValidators: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
58
- ids: `0x${string}` | `0x${string}`[];
59
- }>) => Promise<{
60
- id: `0x${string}`;
61
- }[]>>;
62
- getValidator: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
63
- id: string;
64
- }>) => Promise<{
65
- id: `0x${string}`;
66
- } | null | undefined>>;
67
- getClusterBalance: import('../../types/methods').RemoveConfigArg<(client: GraphQLClient, args: import('../../graphql/graphql').Exact<{
68
- clusterId: string;
69
- daoAddress: string;
70
- operatorIds: string | string[];
71
- }>) => Promise<import('../../graphql/graphql').GetClusterBalanceQuery>>;
3
+ getOwnerNonce: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getOwnerNonce>;
4
+ getClusterSnapshot: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusterSnapshot>;
5
+ getCluster: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getCluster>;
6
+ getClusters: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusters>;
7
+ getOperator: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getOperator>;
8
+ getOperators: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getOperators>;
9
+ getValidators: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getValidators>;
10
+ getValidator: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getValidator>;
11
+ getClusterBalance: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusterBalance>;
72
12
  };
73
13
  export declare const createSSVAPI: (endpoint: string) => {
74
14
  checkOperatorDKGEnabled: (dkgAddresses: {