@ssv-labs/ssv-sdk 0.1.3 → 1.0.1

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 (59) hide show
  1. package/README.html +4 -7
  2. package/README.md +37 -26
  3. package/dist/{KeyShares-B_4l2THg.js → KeyShares-Bk9uzOlK.js} +194 -51
  4. package/dist/{KeyShares-ClzHwMUy.mjs → KeyShares-Dlp4Pa3b.mjs} +198 -55
  5. package/dist/abi/mainnet/v4/getter.d.ts +699 -74
  6. package/dist/abi/mainnet/v4/setter.d.ts +939 -59
  7. package/dist/api/subgraph/index.d.ts +36 -1
  8. package/dist/config/create.d.ts +2 -2
  9. package/dist/config/globals.d.ts +3 -0
  10. package/dist/{globals-CDOcDUnk.mjs → config-BdEJjnYA.mjs} +107 -79
  11. package/dist/{globals-DsaKgq3v.js → config-ClGS9Tic.js} +73 -45
  12. package/dist/contract-interactions/create.d.ts +1 -1
  13. package/dist/contract-interactions/types.d.ts +9 -3
  14. package/dist/graphql/graphql.d.ts +4663 -922
  15. package/dist/keys.js +1 -1
  16. package/dist/keys.mjs +5 -5
  17. package/dist/libs/api/index.d.ts +2 -0
  18. package/dist/libs/cluster/index.d.ts +3 -1
  19. package/dist/libs/cluster/methods/deposit.d.ts +150 -4
  20. package/dist/libs/cluster/methods/exit-validators.d.ts +149 -0
  21. package/dist/libs/cluster/methods/index.d.ts +3 -1
  22. package/dist/libs/cluster/methods/liquidate-cluster.d.ts +149 -0
  23. package/dist/libs/cluster/methods/liquidate-ssv.d.ts +430 -0
  24. package/dist/libs/cluster/methods/migrate-cluster-to-eth.d.ts +431 -0
  25. package/dist/libs/cluster/methods/reactivate-cluster.d.ts +149 -0
  26. package/dist/libs/cluster/methods/register-validators.d.ts +2222 -309
  27. package/dist/libs/cluster/methods/remove-validators.d.ts +149 -0
  28. package/dist/libs/cluster/methods/set-fee-recipient.d.ts +149 -0
  29. package/dist/libs/cluster/methods/withdraw.d.ts +149 -0
  30. package/dist/libs/dao/index.d.ts +8 -0
  31. package/dist/libs/dao/methods/commit-root.d.ts +432 -0
  32. package/dist/libs/dao/methods/index.d.ts +3 -0
  33. package/dist/libs/dao/methods/update-network-fee-ssv.d.ts +430 -0
  34. package/dist/libs/dao/methods/withdraw-network-ssv-earnings.d.ts +430 -0
  35. package/dist/libs/operator/index.d.ts +1525 -32
  36. package/dist/libs/operator/methods.d.ts +1731 -2
  37. package/dist/libs/ssv-keys/Encryption/__test__/RsaKeys.d.ts +1 -1
  38. package/dist/libs/ssv-keys/KeyShares/KeySharesItem.d.ts +1 -1
  39. package/dist/libs/ssv-keys/SSVKeys.d.ts +1 -1
  40. package/dist/libs/ssv-keys/exceptions/index.d.ts +1 -1
  41. package/dist/libs/ssv-keys/index.d.ts +1 -1
  42. package/dist/libs/ssv-keys/interfaces/index.d.ts +2 -2
  43. package/dist/libs/utils/index.d.ts +6 -4
  44. package/dist/libs/utils/methods/calc-deposit-from-runway.d.ts +11 -0
  45. package/dist/libs/utils/methods/get-cluster-balance.d.ts +3 -1
  46. package/dist/libs/utils/methods/keyshares.d.ts +4 -2
  47. package/dist/libs/utils/methods/keystores.d.ts +4 -4
  48. package/dist/main.d.ts +1 -0
  49. package/dist/main.js +2714 -729
  50. package/dist/main.mjs +2746 -761
  51. package/dist/sdk.d.ts +8 -4
  52. package/dist/types/contract-interactions.d.ts +11 -0
  53. package/dist/types/methods.d.ts +4 -3
  54. package/dist/utils/cluster.d.ts +3 -3
  55. package/dist/utils/funding.d.ts +29 -0
  56. package/dist/utils/zod/config.d.ts +1 -1
  57. package/dist/utils.js +38 -38
  58. package/dist/utils.mjs +34 -34
  59. package/package.json +18 -6
package/dist/main.js CHANGED
@@ -1,384 +1,56 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require$$0 = require("fs");
4
- const require$$1 = require("path");
5
- const require$$2 = require("os");
6
- const crypto$1 = require("crypto");
7
- const globals = require("./globals-DsaKgq3v.js");
3
+ const config = require("./config-ClGS9Tic.js");
8
4
  const lodashEs = require("lodash-es");
9
5
  const viem = require("viem");
10
6
  const graphqlRequest = require("graphql-request");
11
- const KeyShares = require("./KeyShares-B_4l2THg.js");
12
- var main = { exports: {} };
13
- const version$1 = "16.6.1";
14
- const require$$4 = {
15
- version: version$1
16
- };
17
- const fs = require$$0;
18
- const path = require$$1;
19
- const os = require$$2;
20
- const crypto = crypto$1;
21
- const packageJson = require$$4;
22
- const version = packageJson.version;
23
- const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
24
- function parse(src) {
25
- const obj = {};
26
- let lines = src.toString();
27
- lines = lines.replace(/\r\n?/mg, "\n");
28
- let match;
29
- while ((match = LINE.exec(lines)) != null) {
30
- const key = match[1];
31
- let value = match[2] || "";
32
- value = value.trim();
33
- const maybeQuote = value[0];
34
- value = value.replace(/^(['"`])([\s\S]*)\1$/mg, "$2");
35
- if (maybeQuote === '"') {
36
- value = value.replace(/\\n/g, "\n");
37
- value = value.replace(/\\r/g, "\r");
38
- }
39
- obj[key] = value;
40
- }
41
- return obj;
42
- }
43
- function _parseVault(options2) {
44
- options2 = options2 || {};
45
- const vaultPath = _vaultPath(options2);
46
- options2.path = vaultPath;
47
- const result = DotenvModule.configDotenv(options2);
48
- if (!result.parsed) {
49
- const err = new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
50
- err.code = "MISSING_DATA";
51
- throw err;
52
- }
53
- const keys = _dotenvKey(options2).split(",");
54
- const length = keys.length;
55
- let decrypted;
56
- for (let i = 0; i < length; i++) {
57
- try {
58
- const key = keys[i].trim();
59
- const attrs = _instructions(result, key);
60
- decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
61
- break;
62
- } catch (error) {
63
- if (i + 1 >= length) {
64
- throw error;
65
- }
66
- }
67
- }
68
- return DotenvModule.parse(decrypted);
69
- }
70
- function _warn(message) {
71
- console.log(`[dotenv@${version}][WARN] ${message}`);
72
- }
73
- function _debug(message) {
74
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
75
- }
76
- function _log(message) {
77
- console.log(`[dotenv@${version}] ${message}`);
78
- }
79
- function _dotenvKey(options2) {
80
- if (options2 && options2.DOTENV_KEY && options2.DOTENV_KEY.length > 0) {
81
- return options2.DOTENV_KEY;
82
- }
83
- if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) {
84
- return process.env.DOTENV_KEY;
85
- }
86
- return "";
87
- }
88
- function _instructions(result, dotenvKey) {
89
- let uri;
90
- try {
91
- uri = new URL(dotenvKey);
92
- } catch (error) {
93
- if (error.code === "ERR_INVALID_URL") {
94
- const err = new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
95
- err.code = "INVALID_DOTENV_KEY";
96
- throw err;
97
- }
98
- throw error;
99
- }
100
- const key = uri.password;
101
- if (!key) {
102
- const err = new Error("INVALID_DOTENV_KEY: Missing key part");
103
- err.code = "INVALID_DOTENV_KEY";
104
- throw err;
105
- }
106
- const environment = uri.searchParams.get("environment");
107
- if (!environment) {
108
- const err = new Error("INVALID_DOTENV_KEY: Missing environment part");
109
- err.code = "INVALID_DOTENV_KEY";
110
- throw err;
111
- }
112
- const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
113
- const ciphertext = result.parsed[environmentKey];
114
- if (!ciphertext) {
115
- const err = new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
116
- err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
117
- throw err;
118
- }
119
- return { ciphertext, key };
120
- }
121
- function _vaultPath(options2) {
122
- let possibleVaultPath = null;
123
- if (options2 && options2.path && options2.path.length > 0) {
124
- if (Array.isArray(options2.path)) {
125
- for (const filepath of options2.path) {
126
- if (fs.existsSync(filepath)) {
127
- possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
128
- }
129
- }
130
- } else {
131
- possibleVaultPath = options2.path.endsWith(".vault") ? options2.path : `${options2.path}.vault`;
132
- }
133
- } else {
134
- possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
135
- }
136
- if (fs.existsSync(possibleVaultPath)) {
137
- return possibleVaultPath;
138
- }
139
- return null;
140
- }
141
- function _resolveHome(envPath) {
142
- return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
143
- }
144
- function _configVault(options2) {
145
- const debug = Boolean(options2 && options2.debug);
146
- const quiet = options2 && "quiet" in options2 ? options2.quiet : true;
147
- if (debug || !quiet) {
148
- _log("Loading env from encrypted .env.vault");
149
- }
150
- const parsed = DotenvModule._parseVault(options2);
151
- let processEnv = process.env;
152
- if (options2 && options2.processEnv != null) {
153
- processEnv = options2.processEnv;
154
- }
155
- DotenvModule.populate(processEnv, parsed, options2);
156
- return { parsed };
157
- }
158
- function configDotenv(options2) {
159
- const dotenvPath = path.resolve(process.cwd(), ".env");
160
- let encoding = "utf8";
161
- const debug = Boolean(options2 && options2.debug);
162
- const quiet = options2 && "quiet" in options2 ? options2.quiet : true;
163
- if (options2 && options2.encoding) {
164
- encoding = options2.encoding;
165
- } else {
166
- if (debug) {
167
- _debug("No encoding is specified. UTF-8 is used by default");
168
- }
169
- }
170
- let optionPaths = [dotenvPath];
171
- if (options2 && options2.path) {
172
- if (!Array.isArray(options2.path)) {
173
- optionPaths = [_resolveHome(options2.path)];
174
- } else {
175
- optionPaths = [];
176
- for (const filepath of options2.path) {
177
- optionPaths.push(_resolveHome(filepath));
178
- }
179
- }
180
- }
181
- let lastError;
182
- const parsedAll = {};
183
- for (const path2 of optionPaths) {
184
- try {
185
- const parsed = DotenvModule.parse(fs.readFileSync(path2, { encoding }));
186
- DotenvModule.populate(parsedAll, parsed, options2);
187
- } catch (e) {
188
- if (debug) {
189
- _debug(`Failed to load ${path2} ${e.message}`);
190
- }
191
- lastError = e;
192
- }
193
- }
194
- let processEnv = process.env;
195
- if (options2 && options2.processEnv != null) {
196
- processEnv = options2.processEnv;
197
- }
198
- DotenvModule.populate(processEnv, parsedAll, options2);
199
- if (debug || !quiet) {
200
- const keysCount = Object.keys(parsedAll).length;
201
- const shortPaths = [];
202
- for (const filePath of optionPaths) {
203
- try {
204
- const relative = path.relative(process.cwd(), filePath);
205
- shortPaths.push(relative);
206
- } catch (e) {
207
- if (debug) {
208
- _debug(`Failed to load ${filePath} ${e.message}`);
209
- }
210
- lastError = e;
211
- }
212
- }
213
- _log(`injecting env (${keysCount}) from ${shortPaths.join(",")}`);
214
- }
215
- if (lastError) {
216
- return { parsed: parsedAll, error: lastError };
217
- } else {
218
- return { parsed: parsedAll };
219
- }
220
- }
221
- function config(options2) {
222
- if (_dotenvKey(options2).length === 0) {
223
- return DotenvModule.configDotenv(options2);
224
- }
225
- const vaultPath = _vaultPath(options2);
226
- if (!vaultPath) {
227
- _warn(`You set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}. Did you forget to build it?`);
228
- return DotenvModule.configDotenv(options2);
229
- }
230
- return DotenvModule._configVault(options2);
231
- }
232
- function decrypt(encrypted, keyStr) {
233
- const key = Buffer.from(keyStr.slice(-64), "hex");
234
- let ciphertext = Buffer.from(encrypted, "base64");
235
- const nonce = ciphertext.subarray(0, 12);
236
- const authTag = ciphertext.subarray(-16);
237
- ciphertext = ciphertext.subarray(12, -16);
238
- try {
239
- const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
240
- aesgcm.setAuthTag(authTag);
241
- return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
242
- } catch (error) {
243
- const isRange = error instanceof RangeError;
244
- const invalidKeyLength = error.message === "Invalid key length";
245
- const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
246
- if (isRange || invalidKeyLength) {
247
- const err = new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
248
- err.code = "INVALID_DOTENV_KEY";
249
- throw err;
250
- } else if (decryptionFailed) {
251
- const err = new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
252
- err.code = "DECRYPTION_FAILED";
253
- throw err;
254
- } else {
255
- throw error;
256
- }
257
- }
258
- }
259
- function populate(processEnv, parsed, options2 = {}) {
260
- const debug = Boolean(options2 && options2.debug);
261
- const override = Boolean(options2 && options2.override);
262
- if (typeof parsed !== "object") {
263
- const err = new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
264
- err.code = "OBJECT_REQUIRED";
265
- throw err;
266
- }
267
- for (const key of Object.keys(parsed)) {
268
- if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
269
- if (override === true) {
270
- processEnv[key] = parsed[key];
271
- }
272
- if (debug) {
273
- if (override === true) {
274
- _debug(`"${key}" is already defined and WAS overwritten`);
275
- } else {
276
- _debug(`"${key}" is already defined and was NOT overwritten`);
277
- }
278
- }
279
- } else {
280
- processEnv[key] = parsed[key];
281
- }
282
- }
283
- }
284
- const DotenvModule = {
285
- configDotenv,
286
- _configVault,
287
- _parseVault,
288
- config,
289
- decrypt,
290
- parse,
291
- populate
292
- };
293
- main.exports.configDotenv = DotenvModule.configDotenv;
294
- main.exports._configVault = DotenvModule._configVault;
295
- main.exports._parseVault = DotenvModule._parseVault;
296
- main.exports.config = DotenvModule.config;
297
- main.exports.decrypt = DotenvModule.decrypt;
298
- main.exports.parse = DotenvModule.parse;
299
- main.exports.populate = DotenvModule.populate;
300
- main.exports = DotenvModule;
301
- var mainExports = main.exports;
302
- const options = {};
303
- if (process.env.DOTENV_CONFIG_ENCODING != null) {
304
- options.encoding = process.env.DOTENV_CONFIG_ENCODING;
305
- }
306
- if (process.env.DOTENV_CONFIG_PATH != null) {
307
- options.path = process.env.DOTENV_CONFIG_PATH;
308
- }
309
- if (process.env.DOTENV_CONFIG_QUIET != null) {
310
- options.quiet = process.env.DOTENV_CONFIG_QUIET;
311
- }
312
- if (process.env.DOTENV_CONFIG_DEBUG != null) {
313
- options.debug = process.env.DOTENV_CONFIG_DEBUG;
314
- }
315
- if (process.env.DOTENV_CONFIG_OVERRIDE != null) {
316
- options.override = process.env.DOTENV_CONFIG_OVERRIDE;
317
- }
318
- if (process.env.DOTENV_CONFIG_DOTENV_KEY != null) {
319
- options.DOTENV_KEY = process.env.DOTENV_CONFIG_DOTENV_KEY;
320
- }
321
- var envOptions = options;
322
- const re = /^dotenv_config_(encoding|path|quiet|debug|override|DOTENV_KEY)=(.+)$/;
323
- var cliOptions = function optionMatcher(args) {
324
- const options2 = args.reduce(function(acc, cur) {
325
- const matches = cur.match(re);
326
- if (matches) {
327
- acc[matches[1]] = matches[2];
328
- }
329
- return acc;
330
- }, {});
331
- if (!("quiet" in options2)) {
332
- options2.quiet = "true";
333
- }
334
- return options2;
335
- };
336
- (function() {
337
- mainExports.config(
338
- Object.assign(
339
- {},
340
- envOptions,
341
- cliOptions(process.argv)
342
- )
343
- );
344
- })();
345
- const GetClusterSnapshotDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterSnapshot" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }] } }] } }] };
346
- const GetClusterDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetCluster" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatorIds" } }] } }] } }] };
347
- const GetClustersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusters" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "clusters" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "owner" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatorIds" } }] } }] } }] };
7
+ const KeyShares = require("./KeyShares-Bk9uzOlK.js");
8
+ var ClusterFeeAssetTypes = /* @__PURE__ */ ((ClusterFeeAssetTypes2) => {
9
+ ClusterFeeAssetTypes2["ETH"] = "ETH";
10
+ ClusterFeeAssetTypes2["SSV"] = "SSV";
11
+ return ClusterFeeAssetTypes2;
12
+ })(ClusterFeeAssetTypes || {});
13
+ const GetClusterSnapshotDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterSnapshot" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "effectiveBalance" } }] } }] } }] };
14
+ const GetClusterDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetCluster" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "owner" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeAsset" } }, { "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatorIds" } }, { "kind": "Field", "name": { "kind": "Name", "value": "effectiveBalance" } }] } }] } }] };
15
+ const GetClustersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusters" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "clusters" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "owner" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeAsset" } }, { "kind": "Field", "name": { "kind": "Name", "value": "active" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "operatorIds" } }, { "kind": "Field", "name": { "kind": "Name", "value": "effectiveBalance" } }] } }] } }] };
348
16
  const GetOwnerNonceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOwnerNonce" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "account" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nonce" } }] } }] } }] };
349
17
  const GetOwnerNonceByBlockDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOwnerNonceByBlock" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "block" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "account" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "block" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "number" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "block" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nonce" } }] } }] } }] };
350
18
  const GetOperatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOperator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "operator" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "publicKey" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "isPrivate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelistedContract" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelisted" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] } }] };
351
- const GetOperatorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOperators" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "publicKey" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "isPrivate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelistedContract" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelisted" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] } }] };
19
+ const GetOperatorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOperators" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }, { "kind": "Field", "name": { "kind": "Name", "value": "publicKey" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "isPrivate" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelistedContract" } }, { "kind": "Field", "name": { "kind": "Name", "value": "fee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "whitelisted" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] } }] };
352
20
  const GetValidatorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetValidators" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ids" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Bytes" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "validators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "ids" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
353
21
  const GetValidatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetValidator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "validator" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "id" } }] } }] } }] };
354
- const GetClusterBalanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterBalance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_meta" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "number" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "daovalues" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "networkFee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThreshold" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateral" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "fee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumber" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }] } }] } }] };
22
+ const GetClusterBalanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterBalance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_meta" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "number" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "daovalues" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "networkFee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumberSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThreshold" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThresholdSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateral" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateralSSV" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "fee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumberSSV" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "feeAsset" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "effectiveBalance" } }] } }] } }] };
23
+ const GetDaoValuesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetDaoValues" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "daovalues" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "networkFee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumberSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThreshold" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThresholdSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateral" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateralSSV" } }] } }] } }] };
355
24
  const getOwnerNonce = (client, args) => {
356
25
  const document = typeof args.block === "number" ? GetOwnerNonceByBlockDocument : GetOwnerNonceDocument;
357
- return client.request(document, args).then((r) => r.account?.nonce || "0").catch(() => "0");
26
+ return client.request(document, args).then((r) => r.account?.nonce ?? "0");
358
27
  };
359
- const getClusterSnapshot = (client, args) => client.request(GetClusterSnapshotDocument, args).then((res) => res.cluster);
28
+ const toSolidityCluster = (client, args) => client.request(GetClusterSnapshotDocument, args).then((res) => res.cluster);
29
+ const getClusterSnapshot = (client, args) => toSolidityCluster(client, args);
360
30
  const getCluster = (client, args) => client.request(GetClusterDocument, args).then((res) => res.cluster);
361
31
  const getClusters = (client, args) => client.request(GetClustersDocument, args).then((res) => res.clusters);
362
32
  const getOperator = (client, args) => client.request(GetOperatorDocument, args).then((res) => {
363
33
  if (!res.operator) return null;
364
34
  return {
365
35
  ...res.operator,
366
- publicKey: globals.decodeOperatorPublicKey(res.operator.publicKey),
36
+ publicKey: config.decodeOperatorPublicKey(res.operator.publicKey),
367
37
  whitelisted: res.operator.whitelisted.map((v) => v.id)
368
38
  };
369
39
  });
370
40
  const getOperators = (client, args) => client.request(GetOperatorsDocument, args).then(
371
41
  (res) => res.operators.map((o) => ({
372
42
  ...o,
373
- publicKey: globals.decodeOperatorPublicKey(o.publicKey),
43
+ publicKey: config.decodeOperatorPublicKey(o.publicKey),
374
44
  whitelisted: o.whitelisted.map((v) => v.id)
375
45
  }))
376
46
  );
377
47
  const getValidators = (client, args) => client.request(GetValidatorsDocument, args).then((res) => res.validators);
378
48
  const getValidator = (client, args) => client.request(GetValidatorDocument, args).then((res) => res.validator);
379
49
  const getClusterBalance$1 = (client, args) => client.request(GetClusterBalanceDocument, args);
50
+ const getDaoValues = (client, args) => client.request(GetDaoValuesDocument, args).then((res) => res.daovalues);
380
51
  const getQueries = (client) => ({
381
52
  getOwnerNonce: getOwnerNonce.bind(null, client),
53
+ toSolidityCluster: toSolidityCluster.bind(null, client),
382
54
  getClusterSnapshot: getClusterSnapshot.bind(null, client),
383
55
  getCluster: getCluster.bind(null, client),
384
56
  getClusters: getClusters.bind(null, client),
@@ -386,7 +58,8 @@ const getQueries = (client) => ({
386
58
  getOperators: getOperators.bind(null, client),
387
59
  getValidators: getValidators.bind(null, client),
388
60
  getValidator: getValidator.bind(null, client),
389
- getClusterBalance: getClusterBalance$1.bind(null, client)
61
+ getClusterBalance: getClusterBalance$1.bind(null, client),
62
+ getDaoValues: getDaoValues.bind(null, client)
390
63
  });
391
64
  const MainnetV4GetterABI = [
392
65
  {
@@ -405,6 +78,11 @@ const MainnetV4GetterABI = [
405
78
  name: "AddressIsWhitelistingContract",
406
79
  type: "error"
407
80
  },
81
+ {
82
+ inputs: [],
83
+ name: "AlreadyVoted",
84
+ type: "error"
85
+ },
408
86
  {
409
87
  inputs: [],
410
88
  name: "ApprovalNotWithinTimeframe",
@@ -454,7 +132,7 @@ const MainnetV4GetterABI = [
454
132
  },
455
133
  {
456
134
  inputs: [],
457
- name: "ClusterDoesNotExists",
135
+ name: "ClusterDoesNotExist",
458
136
  type: "error"
459
137
  },
460
138
  {
@@ -467,6 +145,21 @@ const MainnetV4GetterABI = [
467
145
  name: "ClusterNotLiquidatable",
468
146
  type: "error"
469
147
  },
148
+ {
149
+ inputs: [],
150
+ name: "EBBelowMinimum",
151
+ type: "error"
152
+ },
153
+ {
154
+ inputs: [],
155
+ name: "EBExceedsMaximum",
156
+ type: "error"
157
+ },
158
+ {
159
+ inputs: [],
160
+ name: "ETHTransferFailed",
161
+ type: "error"
162
+ },
470
163
  {
471
164
  inputs: [],
472
165
  name: "EmptyPublicKeysList",
@@ -514,11 +207,32 @@ const MainnetV4GetterABI = [
514
207
  name: "FeeTooLow",
515
208
  type: "error"
516
209
  },
210
+ {
211
+ inputs: [],
212
+ name: "FutureBlockNumber",
213
+ type: "error"
214
+ },
517
215
  {
518
216
  inputs: [],
519
217
  name: "IncorrectClusterState",
520
218
  type: "error"
521
219
  },
220
+ {
221
+ inputs: [],
222
+ name: "IncorrectClusterVersion",
223
+ type: "error"
224
+ },
225
+ {
226
+ inputs: [
227
+ {
228
+ internalType: "uint8",
229
+ name: "operatorVersion",
230
+ type: "uint8"
231
+ }
232
+ ],
233
+ name: "IncorrectOperatorVersion",
234
+ type: "error"
235
+ },
522
236
  {
523
237
  inputs: [],
524
238
  name: "IncorrectValidatorState",
@@ -542,7 +256,17 @@ const MainnetV4GetterABI = [
542
256
  },
543
257
  {
544
258
  inputs: [],
545
- name: "InvalidContractAddress",
259
+ name: "InsufficientCSSVSupply",
260
+ type: "error"
261
+ },
262
+ {
263
+ inputs: [],
264
+ name: "InvalidOperatorFeeIncreaseLimit",
265
+ type: "error"
266
+ },
267
+ {
268
+ inputs: [],
269
+ name: "InvalidOperatorFeeRange",
546
270
  type: "error"
547
271
  },
548
272
  {
@@ -550,11 +274,31 @@ const MainnetV4GetterABI = [
550
274
  name: "InvalidOperatorIdsLength",
551
275
  type: "error"
552
276
  },
277
+ {
278
+ inputs: [],
279
+ name: "InvalidOracleId",
280
+ type: "error"
281
+ },
282
+ {
283
+ inputs: [],
284
+ name: "InvalidProof",
285
+ type: "error"
286
+ },
553
287
  {
554
288
  inputs: [],
555
289
  name: "InvalidPublicKeyLength",
556
290
  type: "error"
557
291
  },
292
+ {
293
+ inputs: [],
294
+ name: "InvalidQuorum",
295
+ type: "error"
296
+ },
297
+ {
298
+ inputs: [],
299
+ name: "InvalidToken",
300
+ type: "error"
301
+ },
558
302
  {
559
303
  inputs: [],
560
304
  name: "InvalidWhitelistAddressesLength",
@@ -571,11 +315,31 @@ const MainnetV4GetterABI = [
571
315
  name: "InvalidWhitelistingContract",
572
316
  type: "error"
573
317
  },
318
+ {
319
+ inputs: [],
320
+ name: "LegacyOperatorFeeDeclarationInvalid",
321
+ type: "error"
322
+ },
323
+ {
324
+ inputs: [],
325
+ name: "MaxPrecisionExceeded",
326
+ type: "error"
327
+ },
328
+ {
329
+ inputs: [],
330
+ name: "MaxRequestsAmountReached",
331
+ type: "error"
332
+ },
574
333
  {
575
334
  inputs: [],
576
335
  name: "MaxValueExceeded",
577
336
  type: "error"
578
337
  },
338
+ {
339
+ inputs: [],
340
+ name: "MustUseLatestRoot",
341
+ type: "error"
342
+ },
579
343
  {
580
344
  inputs: [],
581
345
  name: "NewBlockPeriodIsBelowMinimum",
@@ -588,7 +352,22 @@ const MainnetV4GetterABI = [
588
352
  },
589
353
  {
590
354
  inputs: [],
591
- name: "NotAuthorized",
355
+ name: "NotCSSV",
356
+ type: "error"
357
+ },
358
+ {
359
+ inputs: [],
360
+ name: "NotOracle",
361
+ type: "error"
362
+ },
363
+ {
364
+ inputs: [],
365
+ name: "NothingToClaim",
366
+ type: "error"
367
+ },
368
+ {
369
+ inputs: [],
370
+ name: "NothingToWithdraw",
592
371
  type: "error"
593
372
  },
594
373
  {
@@ -606,16 +385,46 @@ const MainnetV4GetterABI = [
606
385
  name: "OperatorsListNotUnique",
607
386
  type: "error"
608
387
  },
388
+ {
389
+ inputs: [],
390
+ name: "OracleAlreadyAssigned",
391
+ type: "error"
392
+ },
609
393
  {
610
394
  inputs: [],
611
395
  name: "PublicKeysSharesLengthMismatch",
612
396
  type: "error"
613
397
  },
398
+ {
399
+ inputs: [],
400
+ name: "RootNotFound",
401
+ type: "error"
402
+ },
614
403
  {
615
404
  inputs: [],
616
405
  name: "SameFeeChangeNotAllowed",
617
406
  type: "error"
618
407
  },
408
+ {
409
+ inputs: [],
410
+ name: "SameOracleAddressNotAllowed",
411
+ type: "error"
412
+ },
413
+ {
414
+ inputs: [],
415
+ name: "StakeTooLow",
416
+ type: "error"
417
+ },
418
+ {
419
+ inputs: [],
420
+ name: "StaleBlockNumber",
421
+ type: "error"
422
+ },
423
+ {
424
+ inputs: [],
425
+ name: "StaleUpdate",
426
+ type: "error"
427
+ },
619
428
  {
620
429
  inputs: [],
621
430
  name: "TargetModuleDoesNotExist",
@@ -642,6 +451,16 @@ const MainnetV4GetterABI = [
642
451
  name: "UnsortedOperatorsList",
643
452
  type: "error"
644
453
  },
454
+ {
455
+ inputs: [],
456
+ name: "UnstakeAmountExceedsBalance",
457
+ type: "error"
458
+ },
459
+ {
460
+ inputs: [],
461
+ name: "UpdateTooFrequent",
462
+ type: "error"
463
+ },
645
464
  {
646
465
  inputs: [],
647
466
  name: "ValidatorAlreadyExists",
@@ -658,16 +477,47 @@ const MainnetV4GetterABI = [
658
477
  name: "ValidatorAlreadyExistsWithData",
659
478
  type: "error"
660
479
  },
480
+ {
481
+ inputs: [
482
+ {
483
+ internalType: "bytes",
484
+ name: "publicKey",
485
+ type: "bytes"
486
+ },
487
+ {
488
+ internalType: "address",
489
+ name: "owner",
490
+ type: "address"
491
+ }
492
+ ],
493
+ name: "ValidatorAlreadyRegistered",
494
+ type: "error"
495
+ },
661
496
  {
662
497
  inputs: [],
663
498
  name: "ValidatorDoesNotExist",
664
499
  type: "error"
665
500
  },
501
+ {
502
+ inputs: [],
503
+ name: "ZeroAddress",
504
+ type: "error"
505
+ },
666
506
  {
667
507
  inputs: [],
668
508
  name: "ZeroAddressNotAllowed",
669
509
  type: "error"
670
510
  },
511
+ {
512
+ inputs: [],
513
+ name: "ZeroAmount",
514
+ type: "error"
515
+ },
516
+ {
517
+ inputs: [],
518
+ name: "ZeroCSSVSupply",
519
+ type: "error"
520
+ },
671
521
  {
672
522
  anonymous: false,
673
523
  inputs: [
@@ -764,6 +614,19 @@ const MainnetV4GetterABI = [
764
614
  name: "Upgraded",
765
615
  type: "event"
766
616
  },
617
+ {
618
+ inputs: [],
619
+ name: "accEthPerShare",
620
+ outputs: [
621
+ {
622
+ internalType: "uint256",
623
+ name: "",
624
+ type: "uint256"
625
+ }
626
+ ],
627
+ stateMutability: "view",
628
+ type: "function"
629
+ },
767
630
  {
768
631
  inputs: [],
769
632
  name: "acceptOwnership",
@@ -771,6 +634,32 @@ const MainnetV4GetterABI = [
771
634
  stateMutability: "nonpayable",
772
635
  type: "function"
773
636
  },
637
+ {
638
+ inputs: [],
639
+ name: "cooldownDuration",
640
+ outputs: [
641
+ {
642
+ internalType: "uint256",
643
+ name: "",
644
+ type: "uint256"
645
+ }
646
+ ],
647
+ stateMutability: "view",
648
+ type: "function"
649
+ },
650
+ {
651
+ inputs: [],
652
+ name: "getActiveOracleIds",
653
+ outputs: [
654
+ {
655
+ internalType: "uint32[4]",
656
+ name: "",
657
+ type: "uint32[4]"
658
+ }
659
+ ],
660
+ stateMutability: "view",
661
+ type: "function"
662
+ },
774
663
  {
775
664
  inputs: [
776
665
  {
@@ -820,7 +709,7 @@ const MainnetV4GetterABI = [
820
709
  outputs: [
821
710
  {
822
711
  internalType: "uint256",
823
- name: "",
712
+ name: "balance",
824
713
  type: "uint256"
825
714
  }
826
715
  ],
@@ -872,11 +761,11 @@ const MainnetV4GetterABI = [
872
761
  type: "tuple"
873
762
  }
874
763
  ],
875
- name: "getBurnRate",
764
+ name: "getBalanceSSV",
876
765
  outputs: [
877
766
  {
878
767
  internalType: "uint256",
879
- name: "",
768
+ name: "balance",
880
769
  type: "uint256"
881
770
  }
882
771
  ],
@@ -884,7 +773,218 @@ const MainnetV4GetterABI = [
884
773
  type: "function"
885
774
  },
886
775
  {
887
- inputs: [],
776
+ inputs: [
777
+ {
778
+ internalType: "address",
779
+ name: "clusterOwner",
780
+ type: "address"
781
+ },
782
+ {
783
+ internalType: "uint64[]",
784
+ name: "operatorIds",
785
+ type: "uint64[]"
786
+ },
787
+ {
788
+ components: [
789
+ {
790
+ internalType: "uint32",
791
+ name: "validatorCount",
792
+ type: "uint32"
793
+ },
794
+ {
795
+ internalType: "uint64",
796
+ name: "networkFeeIndex",
797
+ type: "uint64"
798
+ },
799
+ {
800
+ internalType: "uint64",
801
+ name: "index",
802
+ type: "uint64"
803
+ },
804
+ {
805
+ internalType: "bool",
806
+ name: "active",
807
+ type: "bool"
808
+ },
809
+ {
810
+ internalType: "uint256",
811
+ name: "balance",
812
+ type: "uint256"
813
+ }
814
+ ],
815
+ internalType: "struct ISSVNetworkCore.Cluster",
816
+ name: "cluster",
817
+ type: "tuple"
818
+ }
819
+ ],
820
+ name: "getBurnRate",
821
+ outputs: [
822
+ {
823
+ internalType: "uint256",
824
+ name: "",
825
+ type: "uint256"
826
+ }
827
+ ],
828
+ stateMutability: "view",
829
+ type: "function"
830
+ },
831
+ {
832
+ inputs: [
833
+ {
834
+ internalType: "address",
835
+ name: "clusterOwner",
836
+ type: "address"
837
+ },
838
+ {
839
+ internalType: "uint64[]",
840
+ name: "operatorIds",
841
+ type: "uint64[]"
842
+ },
843
+ {
844
+ components: [
845
+ {
846
+ internalType: "uint32",
847
+ name: "validatorCount",
848
+ type: "uint32"
849
+ },
850
+ {
851
+ internalType: "uint64",
852
+ name: "networkFeeIndex",
853
+ type: "uint64"
854
+ },
855
+ {
856
+ internalType: "uint64",
857
+ name: "index",
858
+ type: "uint64"
859
+ },
860
+ {
861
+ internalType: "bool",
862
+ name: "active",
863
+ type: "bool"
864
+ },
865
+ {
866
+ internalType: "uint256",
867
+ name: "balance",
868
+ type: "uint256"
869
+ }
870
+ ],
871
+ internalType: "struct ISSVNetworkCore.Cluster",
872
+ name: "cluster",
873
+ type: "tuple"
874
+ }
875
+ ],
876
+ name: "getBurnRateSSV",
877
+ outputs: [
878
+ {
879
+ internalType: "uint256",
880
+ name: "",
881
+ type: "uint256"
882
+ }
883
+ ],
884
+ stateMutability: "view",
885
+ type: "function"
886
+ },
887
+ {
888
+ inputs: [
889
+ {
890
+ internalType: "address",
891
+ name: "owner",
892
+ type: "address"
893
+ },
894
+ {
895
+ internalType: "uint64[]",
896
+ name: "operatorIds",
897
+ type: "uint64[]"
898
+ }
899
+ ],
900
+ name: "getClusterAssetType",
901
+ outputs: [
902
+ {
903
+ internalType: "uint8",
904
+ name: "",
905
+ type: "uint8"
906
+ }
907
+ ],
908
+ stateMutability: "view",
909
+ type: "function"
910
+ },
911
+ {
912
+ inputs: [
913
+ {
914
+ internalType: "uint64",
915
+ name: "blockNum",
916
+ type: "uint64"
917
+ }
918
+ ],
919
+ name: "getCommittedRoot",
920
+ outputs: [
921
+ {
922
+ internalType: "bytes32",
923
+ name: "",
924
+ type: "bytes32"
925
+ }
926
+ ],
927
+ stateMutability: "view",
928
+ type: "function"
929
+ },
930
+ {
931
+ inputs: [
932
+ {
933
+ internalType: "address",
934
+ name: "clusterOwner",
935
+ type: "address"
936
+ },
937
+ {
938
+ internalType: "uint64[]",
939
+ name: "operatorIds",
940
+ type: "uint64[]"
941
+ },
942
+ {
943
+ components: [
944
+ {
945
+ internalType: "uint32",
946
+ name: "validatorCount",
947
+ type: "uint32"
948
+ },
949
+ {
950
+ internalType: "uint64",
951
+ name: "networkFeeIndex",
952
+ type: "uint64"
953
+ },
954
+ {
955
+ internalType: "uint64",
956
+ name: "index",
957
+ type: "uint64"
958
+ },
959
+ {
960
+ internalType: "bool",
961
+ name: "active",
962
+ type: "bool"
963
+ },
964
+ {
965
+ internalType: "uint256",
966
+ name: "balance",
967
+ type: "uint256"
968
+ }
969
+ ],
970
+ internalType: "struct ISSVNetworkCore.Cluster",
971
+ name: "cluster",
972
+ type: "tuple"
973
+ }
974
+ ],
975
+ name: "getEffectiveBalance",
976
+ outputs: [
977
+ {
978
+ internalType: "uint32",
979
+ name: "effectiveBalance",
980
+ type: "uint32"
981
+ }
982
+ ],
983
+ stateMutability: "view",
984
+ type: "function"
985
+ },
986
+ {
987
+ inputs: [],
888
988
  name: "getLiquidationThresholdPeriod",
889
989
  outputs: [
890
990
  {
@@ -896,14 +996,92 @@ const MainnetV4GetterABI = [
896
996
  stateMutability: "view",
897
997
  type: "function"
898
998
  },
999
+ {
1000
+ inputs: [],
1001
+ name: "getLiquidationThresholdPeriodSSV",
1002
+ outputs: [
1003
+ {
1004
+ internalType: "uint64",
1005
+ name: "",
1006
+ type: "uint64"
1007
+ }
1008
+ ],
1009
+ stateMutability: "view",
1010
+ type: "function"
1011
+ },
899
1012
  {
900
1013
  inputs: [],
901
1014
  name: "getMaximumOperatorFee",
902
1015
  outputs: [
903
1016
  {
904
- internalType: "uint64",
1017
+ internalType: "uint256",
1018
+ name: "",
1019
+ type: "uint256"
1020
+ }
1021
+ ],
1022
+ stateMutability: "view",
1023
+ type: "function"
1024
+ },
1025
+ {
1026
+ inputs: [],
1027
+ name: "getMaximumOperatorFeeSSV",
1028
+ outputs: [
1029
+ {
1030
+ internalType: "uint256",
1031
+ name: "",
1032
+ type: "uint256"
1033
+ }
1034
+ ],
1035
+ stateMutability: "view",
1036
+ type: "function"
1037
+ },
1038
+ {
1039
+ inputs: [],
1040
+ name: "getMinimumLiquidationCollateral",
1041
+ outputs: [
1042
+ {
1043
+ internalType: "uint256",
1044
+ name: "",
1045
+ type: "uint256"
1046
+ }
1047
+ ],
1048
+ stateMutability: "view",
1049
+ type: "function"
1050
+ },
1051
+ {
1052
+ inputs: [],
1053
+ name: "getMinimumLiquidationCollateralSSV",
1054
+ outputs: [
1055
+ {
1056
+ internalType: "uint256",
1057
+ name: "",
1058
+ type: "uint256"
1059
+ }
1060
+ ],
1061
+ stateMutability: "view",
1062
+ type: "function"
1063
+ },
1064
+ {
1065
+ inputs: [],
1066
+ name: "getMinimumOperatorEthFee",
1067
+ outputs: [
1068
+ {
1069
+ internalType: "uint256",
1070
+ name: "",
1071
+ type: "uint256"
1072
+ }
1073
+ ],
1074
+ stateMutability: "view",
1075
+ type: "function"
1076
+ },
1077
+ {
1078
+ inputs: [],
1079
+ name: "getNetworkEarnings",
1080
+ outputs: [
1081
+ {
1082
+ internalType: "uint256",
905
1083
  name: "",
906
- type: "uint64"
1084
+ type: "uint256"
907
1085
  }
908
1086
  ],
909
1087
  stateMutability: "view",
@@ -911,7 +1089,7 @@ const MainnetV4GetterABI = [
911
1089
  },
912
1090
  {
913
1091
  inputs: [],
914
- name: "getMinimumLiquidationCollateral",
1092
+ name: "getNetworkEarningsSSV",
915
1093
  outputs: [
916
1094
  {
917
1095
  internalType: "uint256",
@@ -924,7 +1102,7 @@ const MainnetV4GetterABI = [
924
1102
  },
925
1103
  {
926
1104
  inputs: [],
927
- name: "getNetworkEarnings",
1105
+ name: "getNetworkFee",
928
1106
  outputs: [
929
1107
  {
930
1108
  internalType: "uint256",
@@ -937,7 +1115,7 @@ const MainnetV4GetterABI = [
937
1115
  },
938
1116
  {
939
1117
  inputs: [],
940
- name: "getNetworkFee",
1118
+ name: "getNetworkFeeSSV",
941
1119
  outputs: [
942
1120
  {
943
1121
  internalType: "uint256",
@@ -972,34 +1150,92 @@ const MainnetV4GetterABI = [
972
1150
  name: "getOperatorById",
973
1151
  outputs: [
974
1152
  {
975
- internalType: "address",
976
- name: "",
977
- type: "address"
978
- },
979
- {
980
- internalType: "uint256",
981
- name: "",
982
- type: "uint256"
983
- },
984
- {
985
- internalType: "uint32",
986
- name: "",
987
- type: "uint32"
988
- },
989
- {
990
- internalType: "address",
1153
+ components: [
1154
+ {
1155
+ internalType: "address",
1156
+ name: "owner",
1157
+ type: "address"
1158
+ },
1159
+ {
1160
+ internalType: "uint256",
1161
+ name: "fee",
1162
+ type: "uint256"
1163
+ },
1164
+ {
1165
+ internalType: "uint32",
1166
+ name: "validatorCount",
1167
+ type: "uint32"
1168
+ },
1169
+ {
1170
+ internalType: "address",
1171
+ name: "whitelistedAddress",
1172
+ type: "address"
1173
+ },
1174
+ {
1175
+ internalType: "bool",
1176
+ name: "isPrivate",
1177
+ type: "bool"
1178
+ },
1179
+ {
1180
+ internalType: "bool",
1181
+ name: "isActive",
1182
+ type: "bool"
1183
+ }
1184
+ ],
1185
+ internalType: "struct ISSVViewsTypes.OperatorData",
991
1186
  name: "",
992
- type: "address"
993
- },
1187
+ type: "tuple"
1188
+ }
1189
+ ],
1190
+ stateMutability: "view",
1191
+ type: "function"
1192
+ },
1193
+ {
1194
+ inputs: [
994
1195
  {
995
- internalType: "bool",
996
- name: "",
997
- type: "bool"
998
- },
1196
+ internalType: "uint64",
1197
+ name: "operatorId",
1198
+ type: "uint64"
1199
+ }
1200
+ ],
1201
+ name: "getOperatorByIdSSV",
1202
+ outputs: [
999
1203
  {
1000
- internalType: "bool",
1204
+ components: [
1205
+ {
1206
+ internalType: "address",
1207
+ name: "owner",
1208
+ type: "address"
1209
+ },
1210
+ {
1211
+ internalType: "uint256",
1212
+ name: "fee",
1213
+ type: "uint256"
1214
+ },
1215
+ {
1216
+ internalType: "uint32",
1217
+ name: "validatorCount",
1218
+ type: "uint32"
1219
+ },
1220
+ {
1221
+ internalType: "address",
1222
+ name: "whitelistedAddress",
1223
+ type: "address"
1224
+ },
1225
+ {
1226
+ internalType: "bool",
1227
+ name: "isPrivate",
1228
+ type: "bool"
1229
+ },
1230
+ {
1231
+ internalType: "bool",
1232
+ name: "isActive",
1233
+ type: "bool"
1234
+ }
1235
+ ],
1236
+ internalType: "struct ISSVViewsTypes.OperatorData",
1001
1237
  name: "",
1002
- type: "bool"
1238
+ type: "tuple"
1003
1239
  }
1004
1240
  ],
1005
1241
  stateMutability: "view",
@@ -1016,24 +1252,50 @@ const MainnetV4GetterABI = [
1016
1252
  name: "getOperatorDeclaredFee",
1017
1253
  outputs: [
1018
1254
  {
1019
- internalType: "bool",
1020
- name: "",
1021
- type: "bool"
1022
- },
1023
- {
1024
- internalType: "uint256",
1255
+ components: [
1256
+ {
1257
+ internalType: "bool",
1258
+ name: "isFeeDeclared",
1259
+ type: "bool"
1260
+ },
1261
+ {
1262
+ internalType: "uint256",
1263
+ name: "fee",
1264
+ type: "uint256"
1265
+ },
1266
+ {
1267
+ internalType: "uint64",
1268
+ name: "approvalBeginTime",
1269
+ type: "uint64"
1270
+ },
1271
+ {
1272
+ internalType: "uint64",
1273
+ name: "approvalEndTime",
1274
+ type: "uint64"
1275
+ }
1276
+ ],
1277
+ internalType: "struct ISSVViewsTypes.OperatorDeclaredFeeData",
1025
1278
  name: "",
1026
- type: "uint256"
1027
- },
1279
+ type: "tuple"
1280
+ }
1281
+ ],
1282
+ stateMutability: "view",
1283
+ type: "function"
1284
+ },
1285
+ {
1286
+ inputs: [
1028
1287
  {
1029
1288
  internalType: "uint64",
1030
- name: "",
1289
+ name: "id",
1031
1290
  type: "uint64"
1032
- },
1291
+ }
1292
+ ],
1293
+ name: "getOperatorEarnings",
1294
+ outputs: [
1033
1295
  {
1034
- internalType: "uint64",
1296
+ internalType: "uint256",
1035
1297
  name: "",
1036
- type: "uint64"
1298
+ type: "uint256"
1037
1299
  }
1038
1300
  ],
1039
1301
  stateMutability: "view",
@@ -1047,7 +1309,7 @@ const MainnetV4GetterABI = [
1047
1309
  type: "uint64"
1048
1310
  }
1049
1311
  ],
1050
- name: "getOperatorEarnings",
1312
+ name: "getOperatorEarningsSSV",
1051
1313
  outputs: [
1052
1314
  {
1053
1315
  internalType: "uint256",
@@ -1095,16 +1357,93 @@ const MainnetV4GetterABI = [
1095
1357
  name: "getOperatorFeePeriods",
1096
1358
  outputs: [
1097
1359
  {
1098
- internalType: "uint64",
1360
+ components: [
1361
+ {
1362
+ internalType: "uint64",
1363
+ name: "declarePeriod",
1364
+ type: "uint64"
1365
+ },
1366
+ {
1367
+ internalType: "uint64",
1368
+ name: "executePeriod",
1369
+ type: "uint64"
1370
+ }
1371
+ ],
1372
+ internalType: "struct ISSVViewsTypes.OperatorFeePeriodsData",
1099
1373
  name: "",
1100
- type: "uint64"
1101
- },
1374
+ type: "tuple"
1375
+ }
1376
+ ],
1377
+ stateMutability: "view",
1378
+ type: "function"
1379
+ },
1380
+ {
1381
+ inputs: [
1102
1382
  {
1103
1383
  internalType: "uint64",
1104
- name: "",
1384
+ name: "operatorId",
1105
1385
  type: "uint64"
1106
1386
  }
1107
1387
  ],
1388
+ name: "getOperatorFeeSSV",
1389
+ outputs: [
1390
+ {
1391
+ internalType: "uint256",
1392
+ name: "",
1393
+ type: "uint256"
1394
+ }
1395
+ ],
1396
+ stateMutability: "view",
1397
+ type: "function"
1398
+ },
1399
+ {
1400
+ inputs: [
1401
+ {
1402
+ internalType: "uint32",
1403
+ name: "oracleId",
1404
+ type: "uint32"
1405
+ }
1406
+ ],
1407
+ name: "getOracle",
1408
+ outputs: [
1409
+ {
1410
+ internalType: "address",
1411
+ name: "",
1412
+ type: "address"
1413
+ }
1414
+ ],
1415
+ stateMutability: "view",
1416
+ type: "function"
1417
+ },
1418
+ {
1419
+ inputs: [
1420
+ {
1421
+ internalType: "uint32",
1422
+ name: "oracleId",
1423
+ type: "uint32"
1424
+ }
1425
+ ],
1426
+ name: "getOracleWeight",
1427
+ outputs: [
1428
+ {
1429
+ internalType: "uint256",
1430
+ name: "",
1431
+ type: "uint256"
1432
+ }
1433
+ ],
1434
+ stateMutability: "view",
1435
+ type: "function"
1436
+ },
1437
+ {
1438
+ inputs: [],
1439
+ name: "getQuorumBps",
1440
+ outputs: [
1441
+ {
1442
+ internalType: "uint16",
1443
+ name: "",
1444
+ type: "uint16"
1445
+ }
1446
+ ],
1108
1447
  stateMutability: "view",
1109
1448
  type: "function"
1110
1449
  },
@@ -1213,11 +1552,67 @@ const MainnetV4GetterABI = [
1213
1552
  type: "address"
1214
1553
  }
1215
1554
  ],
1216
- name: "isAddressWhitelistedInWhitelistingContract",
1555
+ name: "isAddressWhitelistedInWhitelistingContract",
1556
+ outputs: [
1557
+ {
1558
+ internalType: "bool",
1559
+ name: "isWhitelisted",
1560
+ type: "bool"
1561
+ }
1562
+ ],
1563
+ stateMutability: "view",
1564
+ type: "function"
1565
+ },
1566
+ {
1567
+ inputs: [
1568
+ {
1569
+ internalType: "address",
1570
+ name: "clusterOwner",
1571
+ type: "address"
1572
+ },
1573
+ {
1574
+ internalType: "uint64[]",
1575
+ name: "operatorIds",
1576
+ type: "uint64[]"
1577
+ },
1578
+ {
1579
+ components: [
1580
+ {
1581
+ internalType: "uint32",
1582
+ name: "validatorCount",
1583
+ type: "uint32"
1584
+ },
1585
+ {
1586
+ internalType: "uint64",
1587
+ name: "networkFeeIndex",
1588
+ type: "uint64"
1589
+ },
1590
+ {
1591
+ internalType: "uint64",
1592
+ name: "index",
1593
+ type: "uint64"
1594
+ },
1595
+ {
1596
+ internalType: "bool",
1597
+ name: "active",
1598
+ type: "bool"
1599
+ },
1600
+ {
1601
+ internalType: "uint256",
1602
+ name: "balance",
1603
+ type: "uint256"
1604
+ }
1605
+ ],
1606
+ internalType: "struct ISSVNetworkCore.Cluster",
1607
+ name: "cluster",
1608
+ type: "tuple"
1609
+ }
1610
+ ],
1611
+ name: "isLiquidatable",
1217
1612
  outputs: [
1218
1613
  {
1219
1614
  internalType: "bool",
1220
- name: "isWhitelisted",
1615
+ name: "",
1221
1616
  type: "bool"
1222
1617
  }
1223
1618
  ],
@@ -1269,7 +1664,7 @@ const MainnetV4GetterABI = [
1269
1664
  type: "tuple"
1270
1665
  }
1271
1666
  ],
1272
- name: "isLiquidatable",
1667
+ name: "isLiquidatableSSV",
1273
1668
  outputs: [
1274
1669
  {
1275
1670
  internalType: "bool",
@@ -1381,6 +1776,56 @@ const MainnetV4GetterABI = [
1381
1776
  stateMutability: "view",
1382
1777
  type: "function"
1383
1778
  },
1779
+ {
1780
+ inputs: [
1781
+ {
1782
+ internalType: "address",
1783
+ name: "user",
1784
+ type: "address"
1785
+ }
1786
+ ],
1787
+ name: "pendingUnstake",
1788
+ outputs: [
1789
+ {
1790
+ components: [
1791
+ {
1792
+ internalType: "uint256",
1793
+ name: "amount",
1794
+ type: "uint256"
1795
+ },
1796
+ {
1797
+ internalType: "uint256",
1798
+ name: "unlockTime",
1799
+ type: "uint256"
1800
+ }
1801
+ ],
1802
+ internalType: "struct ISSVViewsTypes.UnstakeRequestsData[]",
1803
+ name: "",
1804
+ type: "tuple[]"
1805
+ }
1806
+ ],
1807
+ stateMutability: "view",
1808
+ type: "function"
1809
+ },
1810
+ {
1811
+ inputs: [
1812
+ {
1813
+ internalType: "address",
1814
+ name: "user",
1815
+ type: "address"
1816
+ }
1817
+ ],
1818
+ name: "previewClaimableEth",
1819
+ outputs: [
1820
+ {
1821
+ internalType: "uint256",
1822
+ name: "",
1823
+ type: "uint256"
1824
+ }
1825
+ ],
1826
+ stateMutability: "view",
1827
+ type: "function"
1828
+ },
1384
1829
  {
1385
1830
  inputs: [],
1386
1831
  name: "proxiableUUID",
@@ -1414,6 +1859,51 @@ const MainnetV4GetterABI = [
1414
1859
  stateMutability: "view",
1415
1860
  type: "function"
1416
1861
  },
1862
+ {
1863
+ inputs: [
1864
+ {
1865
+ internalType: "address",
1866
+ name: "user",
1867
+ type: "address"
1868
+ }
1869
+ ],
1870
+ name: "stakedBalanceOf",
1871
+ outputs: [
1872
+ {
1873
+ internalType: "uint256",
1874
+ name: "",
1875
+ type: "uint256"
1876
+ }
1877
+ ],
1878
+ stateMutability: "view",
1879
+ type: "function"
1880
+ },
1881
+ {
1882
+ inputs: [],
1883
+ name: "stakingEthPoolBalance",
1884
+ outputs: [
1885
+ {
1886
+ internalType: "uint256",
1887
+ name: "",
1888
+ type: "uint256"
1889
+ }
1890
+ ],
1891
+ stateMutability: "view",
1892
+ type: "function"
1893
+ },
1894
+ {
1895
+ inputs: [],
1896
+ name: "totalStaked",
1897
+ outputs: [
1898
+ {
1899
+ internalType: "uint256",
1900
+ name: "",
1901
+ type: "uint256"
1902
+ }
1903
+ ],
1904
+ stateMutability: "view",
1905
+ type: "function"
1906
+ },
1417
1907
  {
1418
1908
  inputs: [
1419
1909
  {
@@ -1476,6 +1966,11 @@ const MainnetV4SetterABI = [
1476
1966
  name: "AddressIsWhitelistingContract",
1477
1967
  type: "error"
1478
1968
  },
1969
+ {
1970
+ inputs: [],
1971
+ name: "AlreadyVoted",
1972
+ type: "error"
1973
+ },
1479
1974
  {
1480
1975
  inputs: [],
1481
1976
  name: "ApprovalNotWithinTimeframe",
@@ -1525,7 +2020,7 @@ const MainnetV4SetterABI = [
1525
2020
  },
1526
2021
  {
1527
2022
  inputs: [],
1528
- name: "ClusterDoesNotExists",
2023
+ name: "ClusterDoesNotExist",
1529
2024
  type: "error"
1530
2025
  },
1531
2026
  {
@@ -1538,6 +2033,21 @@ const MainnetV4SetterABI = [
1538
2033
  name: "ClusterNotLiquidatable",
1539
2034
  type: "error"
1540
2035
  },
2036
+ {
2037
+ inputs: [],
2038
+ name: "EBBelowMinimum",
2039
+ type: "error"
2040
+ },
2041
+ {
2042
+ inputs: [],
2043
+ name: "EBExceedsMaximum",
2044
+ type: "error"
2045
+ },
2046
+ {
2047
+ inputs: [],
2048
+ name: "ETHTransferFailed",
2049
+ type: "error"
2050
+ },
1541
2051
  {
1542
2052
  inputs: [],
1543
2053
  name: "EmptyPublicKeysList",
@@ -1585,11 +2095,32 @@ const MainnetV4SetterABI = [
1585
2095
  name: "FeeTooLow",
1586
2096
  type: "error"
1587
2097
  },
2098
+ {
2099
+ inputs: [],
2100
+ name: "FutureBlockNumber",
2101
+ type: "error"
2102
+ },
1588
2103
  {
1589
2104
  inputs: [],
1590
2105
  name: "IncorrectClusterState",
1591
2106
  type: "error"
1592
2107
  },
2108
+ {
2109
+ inputs: [],
2110
+ name: "IncorrectClusterVersion",
2111
+ type: "error"
2112
+ },
2113
+ {
2114
+ inputs: [
2115
+ {
2116
+ internalType: "uint8",
2117
+ name: "operatorVersion",
2118
+ type: "uint8"
2119
+ }
2120
+ ],
2121
+ name: "IncorrectOperatorVersion",
2122
+ type: "error"
2123
+ },
1593
2124
  {
1594
2125
  inputs: [],
1595
2126
  name: "IncorrectValidatorState",
@@ -1613,7 +2144,17 @@ const MainnetV4SetterABI = [
1613
2144
  },
1614
2145
  {
1615
2146
  inputs: [],
1616
- name: "InvalidContractAddress",
2147
+ name: "InsufficientCSSVSupply",
2148
+ type: "error"
2149
+ },
2150
+ {
2151
+ inputs: [],
2152
+ name: "InvalidOperatorFeeIncreaseLimit",
2153
+ type: "error"
2154
+ },
2155
+ {
2156
+ inputs: [],
2157
+ name: "InvalidOperatorFeeRange",
1617
2158
  type: "error"
1618
2159
  },
1619
2160
  {
@@ -1621,11 +2162,31 @@ const MainnetV4SetterABI = [
1621
2162
  name: "InvalidOperatorIdsLength",
1622
2163
  type: "error"
1623
2164
  },
2165
+ {
2166
+ inputs: [],
2167
+ name: "InvalidOracleId",
2168
+ type: "error"
2169
+ },
2170
+ {
2171
+ inputs: [],
2172
+ name: "InvalidProof",
2173
+ type: "error"
2174
+ },
1624
2175
  {
1625
2176
  inputs: [],
1626
2177
  name: "InvalidPublicKeyLength",
1627
2178
  type: "error"
1628
2179
  },
2180
+ {
2181
+ inputs: [],
2182
+ name: "InvalidQuorum",
2183
+ type: "error"
2184
+ },
2185
+ {
2186
+ inputs: [],
2187
+ name: "InvalidToken",
2188
+ type: "error"
2189
+ },
1629
2190
  {
1630
2191
  inputs: [],
1631
2192
  name: "InvalidWhitelistAddressesLength",
@@ -1642,11 +2203,31 @@ const MainnetV4SetterABI = [
1642
2203
  name: "InvalidWhitelistingContract",
1643
2204
  type: "error"
1644
2205
  },
2206
+ {
2207
+ inputs: [],
2208
+ name: "LegacyOperatorFeeDeclarationInvalid",
2209
+ type: "error"
2210
+ },
2211
+ {
2212
+ inputs: [],
2213
+ name: "MaxPrecisionExceeded",
2214
+ type: "error"
2215
+ },
2216
+ {
2217
+ inputs: [],
2218
+ name: "MaxRequestsAmountReached",
2219
+ type: "error"
2220
+ },
1645
2221
  {
1646
2222
  inputs: [],
1647
2223
  name: "MaxValueExceeded",
1648
2224
  type: "error"
1649
2225
  },
2226
+ {
2227
+ inputs: [],
2228
+ name: "MustUseLatestRoot",
2229
+ type: "error"
2230
+ },
1650
2231
  {
1651
2232
  inputs: [],
1652
2233
  name: "NewBlockPeriodIsBelowMinimum",
@@ -1659,7 +2240,22 @@ const MainnetV4SetterABI = [
1659
2240
  },
1660
2241
  {
1661
2242
  inputs: [],
1662
- name: "NotAuthorized",
2243
+ name: "NotCSSV",
2244
+ type: "error"
2245
+ },
2246
+ {
2247
+ inputs: [],
2248
+ name: "NotOracle",
2249
+ type: "error"
2250
+ },
2251
+ {
2252
+ inputs: [],
2253
+ name: "NothingToClaim",
2254
+ type: "error"
2255
+ },
2256
+ {
2257
+ inputs: [],
2258
+ name: "NothingToWithdraw",
1663
2259
  type: "error"
1664
2260
  },
1665
2261
  {
@@ -1677,16 +2273,46 @@ const MainnetV4SetterABI = [
1677
2273
  name: "OperatorsListNotUnique",
1678
2274
  type: "error"
1679
2275
  },
2276
+ {
2277
+ inputs: [],
2278
+ name: "OracleAlreadyAssigned",
2279
+ type: "error"
2280
+ },
1680
2281
  {
1681
2282
  inputs: [],
1682
2283
  name: "PublicKeysSharesLengthMismatch",
1683
2284
  type: "error"
1684
2285
  },
2286
+ {
2287
+ inputs: [],
2288
+ name: "RootNotFound",
2289
+ type: "error"
2290
+ },
1685
2291
  {
1686
2292
  inputs: [],
1687
2293
  name: "SameFeeChangeNotAllowed",
1688
2294
  type: "error"
1689
2295
  },
2296
+ {
2297
+ inputs: [],
2298
+ name: "SameOracleAddressNotAllowed",
2299
+ type: "error"
2300
+ },
2301
+ {
2302
+ inputs: [],
2303
+ name: "StakeTooLow",
2304
+ type: "error"
2305
+ },
2306
+ {
2307
+ inputs: [],
2308
+ name: "StaleBlockNumber",
2309
+ type: "error"
2310
+ },
2311
+ {
2312
+ inputs: [],
2313
+ name: "StaleUpdate",
2314
+ type: "error"
2315
+ },
1690
2316
  {
1691
2317
  inputs: [],
1692
2318
  name: "TargetModuleDoesNotExist",
@@ -1700,43 +2326,84 @@ const MainnetV4SetterABI = [
1700
2326
  type: "uint8"
1701
2327
  }
1702
2328
  ],
1703
- name: "TargetModuleDoesNotExistWithData",
2329
+ name: "TargetModuleDoesNotExistWithData",
2330
+ type: "error"
2331
+ },
2332
+ {
2333
+ inputs: [],
2334
+ name: "TokenTransferFailed",
2335
+ type: "error"
2336
+ },
2337
+ {
2338
+ inputs: [],
2339
+ name: "UnsortedOperatorsList",
2340
+ type: "error"
2341
+ },
2342
+ {
2343
+ inputs: [],
2344
+ name: "UnstakeAmountExceedsBalance",
2345
+ type: "error"
2346
+ },
2347
+ {
2348
+ inputs: [],
2349
+ name: "UpdateTooFrequent",
2350
+ type: "error"
2351
+ },
2352
+ {
2353
+ inputs: [],
2354
+ name: "ValidatorAlreadyExists",
2355
+ type: "error"
2356
+ },
2357
+ {
2358
+ inputs: [
2359
+ {
2360
+ internalType: "bytes",
2361
+ name: "publicKey",
2362
+ type: "bytes"
2363
+ }
2364
+ ],
2365
+ name: "ValidatorAlreadyExistsWithData",
2366
+ type: "error"
2367
+ },
2368
+ {
2369
+ inputs: [
2370
+ {
2371
+ internalType: "bytes",
2372
+ name: "publicKey",
2373
+ type: "bytes"
2374
+ },
2375
+ {
2376
+ internalType: "address",
2377
+ name: "owner",
2378
+ type: "address"
2379
+ }
2380
+ ],
2381
+ name: "ValidatorAlreadyRegistered",
1704
2382
  type: "error"
1705
2383
  },
1706
2384
  {
1707
2385
  inputs: [],
1708
- name: "TokenTransferFailed",
2386
+ name: "ValidatorDoesNotExist",
1709
2387
  type: "error"
1710
2388
  },
1711
2389
  {
1712
2390
  inputs: [],
1713
- name: "UnsortedOperatorsList",
2391
+ name: "ZeroAddress",
1714
2392
  type: "error"
1715
2393
  },
1716
2394
  {
1717
2395
  inputs: [],
1718
- name: "ValidatorAlreadyExists",
1719
- type: "error"
1720
- },
1721
- {
1722
- inputs: [
1723
- {
1724
- internalType: "bytes",
1725
- name: "publicKey",
1726
- type: "bytes"
1727
- }
1728
- ],
1729
- name: "ValidatorAlreadyExistsWithData",
2396
+ name: "ZeroAddressNotAllowed",
1730
2397
  type: "error"
1731
2398
  },
1732
2399
  {
1733
2400
  inputs: [],
1734
- name: "ValidatorDoesNotExist",
2401
+ name: "ZeroAmount",
1735
2402
  type: "error"
1736
2403
  },
1737
2404
  {
1738
2405
  inputs: [],
1739
- name: "ZeroAddressNotAllowed",
2406
+ name: "ZeroCSSVSupply",
1740
2407
  type: "error"
1741
2408
  },
1742
2409
  {
@@ -1771,6 +2438,70 @@ const MainnetV4SetterABI = [
1771
2438
  name: "BeaconUpgraded",
1772
2439
  type: "event"
1773
2440
  },
2441
+ {
2442
+ anonymous: false,
2443
+ inputs: [
2444
+ {
2445
+ indexed: true,
2446
+ internalType: "address",
2447
+ name: "owner",
2448
+ type: "address"
2449
+ },
2450
+ {
2451
+ indexed: false,
2452
+ internalType: "uint64[]",
2453
+ name: "operatorIds",
2454
+ type: "uint64[]"
2455
+ },
2456
+ {
2457
+ indexed: true,
2458
+ internalType: "uint64",
2459
+ name: "blockNum",
2460
+ type: "uint64"
2461
+ },
2462
+ {
2463
+ indexed: false,
2464
+ internalType: "uint32",
2465
+ name: "effectiveBalance",
2466
+ type: "uint32"
2467
+ },
2468
+ {
2469
+ components: [
2470
+ {
2471
+ internalType: "uint32",
2472
+ name: "validatorCount",
2473
+ type: "uint32"
2474
+ },
2475
+ {
2476
+ internalType: "uint64",
2477
+ name: "networkFeeIndex",
2478
+ type: "uint64"
2479
+ },
2480
+ {
2481
+ internalType: "uint64",
2482
+ name: "index",
2483
+ type: "uint64"
2484
+ },
2485
+ {
2486
+ internalType: "bool",
2487
+ name: "active",
2488
+ type: "bool"
2489
+ },
2490
+ {
2491
+ internalType: "uint256",
2492
+ name: "balance",
2493
+ type: "uint256"
2494
+ }
2495
+ ],
2496
+ indexed: false,
2497
+ internalType: "struct ISSVNetworkCore.Cluster",
2498
+ name: "cluster",
2499
+ type: "tuple"
2500
+ }
2501
+ ],
2502
+ name: "ClusterBalanceUpdated",
2503
+ type: "event"
2504
+ },
1774
2505
  {
1775
2506
  anonymous: false,
1776
2507
  inputs: [
@@ -1881,6 +2612,76 @@ const MainnetV4SetterABI = [
1881
2612
  name: "ClusterLiquidated",
1882
2613
  type: "event"
1883
2614
  },
2615
+ {
2616
+ anonymous: false,
2617
+ inputs: [
2618
+ {
2619
+ indexed: true,
2620
+ internalType: "address",
2621
+ name: "owner",
2622
+ type: "address"
2623
+ },
2624
+ {
2625
+ indexed: false,
2626
+ internalType: "uint64[]",
2627
+ name: "operatorIds",
2628
+ type: "uint64[]"
2629
+ },
2630
+ {
2631
+ indexed: false,
2632
+ internalType: "uint256",
2633
+ name: "ethDeposited",
2634
+ type: "uint256"
2635
+ },
2636
+ {
2637
+ indexed: false,
2638
+ internalType: "uint256",
2639
+ name: "ssvRefunded",
2640
+ type: "uint256"
2641
+ },
2642
+ {
2643
+ indexed: false,
2644
+ internalType: "uint32",
2645
+ name: "effectiveBalance",
2646
+ type: "uint32"
2647
+ },
2648
+ {
2649
+ components: [
2650
+ {
2651
+ internalType: "uint32",
2652
+ name: "validatorCount",
2653
+ type: "uint32"
2654
+ },
2655
+ {
2656
+ internalType: "uint64",
2657
+ name: "networkFeeIndex",
2658
+ type: "uint64"
2659
+ },
2660
+ {
2661
+ internalType: "uint64",
2662
+ name: "index",
2663
+ type: "uint64"
2664
+ },
2665
+ {
2666
+ internalType: "bool",
2667
+ name: "active",
2668
+ type: "bool"
2669
+ },
2670
+ {
2671
+ internalType: "uint256",
2672
+ name: "balance",
2673
+ type: "uint256"
2674
+ }
2675
+ ],
2676
+ indexed: false,
2677
+ internalType: "struct ISSVNetworkCore.Cluster",
2678
+ name: "cluster",
2679
+ type: "tuple"
2680
+ }
2681
+ ],
2682
+ name: "ClusterMigratedToETH",
2683
+ type: "event"
2684
+ },
1884
2685
  {
1885
2686
  anonymous: false,
1886
2687
  inputs: [
@@ -1983,12 +2784,127 @@ const MainnetV4SetterABI = [
1983
2784
  }
1984
2785
  ],
1985
2786
  indexed: false,
1986
- internalType: "struct ISSVNetworkCore.Cluster",
1987
- name: "cluster",
1988
- type: "tuple"
2787
+ internalType: "struct ISSVNetworkCore.Cluster",
2788
+ name: "cluster",
2789
+ type: "tuple"
2790
+ }
2791
+ ],
2792
+ name: "ClusterWithdrawn",
2793
+ type: "event"
2794
+ },
2795
+ {
2796
+ anonymous: false,
2797
+ inputs: [
2798
+ {
2799
+ indexed: false,
2800
+ internalType: "uint64",
2801
+ name: "newCooldownDuration",
2802
+ type: "uint64"
2803
+ }
2804
+ ],
2805
+ name: "CooldownDurationUpdated",
2806
+ type: "event"
2807
+ },
2808
+ {
2809
+ anonymous: false,
2810
+ inputs: [
2811
+ {
2812
+ indexed: false,
2813
+ internalType: "uint64",
2814
+ name: "value",
2815
+ type: "uint64"
2816
+ }
2817
+ ],
2818
+ name: "DeclareOperatorFeePeriodUpdated",
2819
+ type: "event"
2820
+ },
2821
+ {
2822
+ anonymous: false,
2823
+ inputs: [
2824
+ {
2825
+ indexed: true,
2826
+ internalType: "address",
2827
+ name: "token",
2828
+ type: "address"
2829
+ },
2830
+ {
2831
+ indexed: true,
2832
+ internalType: "address",
2833
+ name: "to",
2834
+ type: "address"
2835
+ },
2836
+ {
2837
+ indexed: false,
2838
+ internalType: "uint256",
2839
+ name: "amount",
2840
+ type: "uint256"
2841
+ }
2842
+ ],
2843
+ name: "ERC20Rescued",
2844
+ type: "event"
2845
+ },
2846
+ {
2847
+ anonymous: false,
2848
+ inputs: [
2849
+ {
2850
+ indexed: false,
2851
+ internalType: "uint64",
2852
+ name: "value",
2853
+ type: "uint64"
2854
+ }
2855
+ ],
2856
+ name: "ExecuteOperatorFeePeriodUpdated",
2857
+ type: "event"
2858
+ },
2859
+ {
2860
+ anonymous: false,
2861
+ inputs: [
2862
+ {
2863
+ indexed: true,
2864
+ internalType: "address",
2865
+ name: "owner",
2866
+ type: "address"
2867
+ },
2868
+ {
2869
+ indexed: false,
2870
+ internalType: "address",
2871
+ name: "recipientAddress",
2872
+ type: "address"
2873
+ }
2874
+ ],
2875
+ name: "FeeRecipientAddressUpdated",
2876
+ type: "event"
2877
+ },
2878
+ {
2879
+ anonymous: false,
2880
+ inputs: [
2881
+ {
2882
+ indexed: false,
2883
+ internalType: "uint256",
2884
+ name: "newFeesWei",
2885
+ type: "uint256"
2886
+ },
2887
+ {
2888
+ indexed: false,
2889
+ internalType: "uint256",
2890
+ name: "accEthPerShare",
2891
+ type: "uint256"
2892
+ }
2893
+ ],
2894
+ name: "FeesSynced",
2895
+ type: "event"
2896
+ },
2897
+ {
2898
+ anonymous: false,
2899
+ inputs: [
2900
+ {
2901
+ indexed: false,
2902
+ internalType: "uint8",
2903
+ name: "version",
2904
+ type: "uint8"
1989
2905
  }
1990
2906
  ],
1991
- name: "ClusterWithdrawn",
2907
+ name: "Initialized",
1992
2908
  type: "event"
1993
2909
  },
1994
2910
  {
@@ -2001,7 +2917,7 @@ const MainnetV4SetterABI = [
2001
2917
  type: "uint64"
2002
2918
  }
2003
2919
  ],
2004
- name: "DeclareOperatorFeePeriodUpdated",
2920
+ name: "LiquidationThresholdPeriodSSVUpdated",
2005
2921
  type: "event"
2006
2922
  },
2007
2923
  {
@@ -2014,26 +2930,20 @@ const MainnetV4SetterABI = [
2014
2930
  type: "uint64"
2015
2931
  }
2016
2932
  ],
2017
- name: "ExecuteOperatorFeePeriodUpdated",
2933
+ name: "LiquidationThresholdPeriodUpdated",
2018
2934
  type: "event"
2019
2935
  },
2020
2936
  {
2021
2937
  anonymous: false,
2022
2938
  inputs: [
2023
- {
2024
- indexed: true,
2025
- internalType: "address",
2026
- name: "owner",
2027
- type: "address"
2028
- },
2029
2939
  {
2030
2940
  indexed: false,
2031
- internalType: "address",
2032
- name: "recipientAddress",
2033
- type: "address"
2941
+ internalType: "uint32",
2942
+ name: "newMinBlocksBetweenUpdates",
2943
+ type: "uint32"
2034
2944
  }
2035
2945
  ],
2036
- name: "FeeRecipientAddressUpdated",
2946
+ name: "MinBlocksBetweenUpdatesUpdated",
2037
2947
  type: "event"
2038
2948
  },
2039
2949
  {
@@ -2041,12 +2951,12 @@ const MainnetV4SetterABI = [
2041
2951
  inputs: [
2042
2952
  {
2043
2953
  indexed: false,
2044
- internalType: "uint8",
2045
- name: "version",
2046
- type: "uint8"
2954
+ internalType: "uint256",
2955
+ name: "value",
2956
+ type: "uint256"
2047
2957
  }
2048
2958
  ],
2049
- name: "Initialized",
2959
+ name: "MinimumLiquidationCollateralSSVUpdated",
2050
2960
  type: "event"
2051
2961
  },
2052
2962
  {
@@ -2054,12 +2964,12 @@ const MainnetV4SetterABI = [
2054
2964
  inputs: [
2055
2965
  {
2056
2966
  indexed: false,
2057
- internalType: "uint64",
2967
+ internalType: "uint256",
2058
2968
  name: "value",
2059
- type: "uint64"
2969
+ type: "uint256"
2060
2970
  }
2061
2971
  ],
2062
- name: "LiquidationThresholdPeriodUpdated",
2972
+ name: "MinimumLiquidationCollateralUpdated",
2063
2973
  type: "event"
2064
2974
  },
2065
2975
  {
@@ -2068,11 +2978,11 @@ const MainnetV4SetterABI = [
2068
2978
  {
2069
2979
  indexed: false,
2070
2980
  internalType: "uint256",
2071
- name: "value",
2981
+ name: "minFee",
2072
2982
  type: "uint256"
2073
2983
  }
2074
2984
  ],
2075
- name: "MinimumLiquidationCollateralUpdated",
2985
+ name: "MinimumOperatorEthFeeUpdated",
2076
2986
  type: "event"
2077
2987
  },
2078
2988
  {
@@ -2132,6 +3042,25 @@ const MainnetV4SetterABI = [
2132
3042
  name: "NetworkFeeUpdated",
2133
3043
  type: "event"
2134
3044
  },
3045
+ {
3046
+ anonymous: false,
3047
+ inputs: [
3048
+ {
3049
+ indexed: false,
3050
+ internalType: "uint256",
3051
+ name: "oldFee",
3052
+ type: "uint256"
3053
+ },
3054
+ {
3055
+ indexed: false,
3056
+ internalType: "uint256",
3057
+ name: "newFee",
3058
+ type: "uint256"
3059
+ }
3060
+ ],
3061
+ name: "NetworkFeeUpdatedSSV",
3062
+ type: "event"
3063
+ },
2135
3064
  {
2136
3065
  anonymous: false,
2137
3066
  inputs: [
@@ -2262,9 +3191,9 @@ const MainnetV4SetterABI = [
2262
3191
  inputs: [
2263
3192
  {
2264
3193
  indexed: false,
2265
- internalType: "uint64",
3194
+ internalType: "uint256",
2266
3195
  name: "maxFee",
2267
- type: "uint64"
3196
+ type: "uint256"
2268
3197
  }
2269
3198
  ],
2270
3199
  name: "OperatorMaximumFeeUpdated",
@@ -2356,7 +3285,221 @@ const MainnetV4SetterABI = [
2356
3285
  type: "address"
2357
3286
  }
2358
3287
  ],
2359
- name: "OperatorWhitelistUpdated",
3288
+ name: "OperatorWhitelistUpdated",
3289
+ type: "event"
3290
+ },
3291
+ {
3292
+ anonymous: false,
3293
+ inputs: [
3294
+ {
3295
+ indexed: false,
3296
+ internalType: "uint64[]",
3297
+ name: "operatorIds",
3298
+ type: "uint64[]"
3299
+ },
3300
+ {
3301
+ indexed: false,
3302
+ internalType: "address",
3303
+ name: "whitelistingContract",
3304
+ type: "address"
3305
+ }
3306
+ ],
3307
+ name: "OperatorWhitelistingContractUpdated",
3308
+ type: "event"
3309
+ },
3310
+ {
3311
+ anonymous: false,
3312
+ inputs: [
3313
+ {
3314
+ indexed: true,
3315
+ internalType: "address",
3316
+ name: "owner",
3317
+ type: "address"
3318
+ },
3319
+ {
3320
+ indexed: true,
3321
+ internalType: "uint64",
3322
+ name: "operatorId",
3323
+ type: "uint64"
3324
+ },
3325
+ {
3326
+ indexed: false,
3327
+ internalType: "uint256",
3328
+ name: "value",
3329
+ type: "uint256"
3330
+ }
3331
+ ],
3332
+ name: "OperatorWithdrawn",
3333
+ type: "event"
3334
+ },
3335
+ {
3336
+ anonymous: false,
3337
+ inputs: [
3338
+ {
3339
+ indexed: true,
3340
+ internalType: "address",
3341
+ name: "owner",
3342
+ type: "address"
3343
+ },
3344
+ {
3345
+ indexed: true,
3346
+ internalType: "uint64",
3347
+ name: "operatorId",
3348
+ type: "uint64"
3349
+ },
3350
+ {
3351
+ indexed: false,
3352
+ internalType: "uint256",
3353
+ name: "value",
3354
+ type: "uint256"
3355
+ }
3356
+ ],
3357
+ name: "OperatorWithdrawnSSV",
3358
+ type: "event"
3359
+ },
3360
+ {
3361
+ anonymous: false,
3362
+ inputs: [
3363
+ {
3364
+ indexed: true,
3365
+ internalType: "uint32",
3366
+ name: "oracleId",
3367
+ type: "uint32"
3368
+ },
3369
+ {
3370
+ indexed: true,
3371
+ internalType: "address",
3372
+ name: "oldOracle",
3373
+ type: "address"
3374
+ },
3375
+ {
3376
+ indexed: true,
3377
+ internalType: "address",
3378
+ name: "newOracle",
3379
+ type: "address"
3380
+ }
3381
+ ],
3382
+ name: "OracleReplaced",
3383
+ type: "event"
3384
+ },
3385
+ {
3386
+ anonymous: false,
3387
+ inputs: [
3388
+ {
3389
+ indexed: true,
3390
+ internalType: "address",
3391
+ name: "previousOwner",
3392
+ type: "address"
3393
+ },
3394
+ {
3395
+ indexed: true,
3396
+ internalType: "address",
3397
+ name: "newOwner",
3398
+ type: "address"
3399
+ }
3400
+ ],
3401
+ name: "OwnershipTransferStarted",
3402
+ type: "event"
3403
+ },
3404
+ {
3405
+ anonymous: false,
3406
+ inputs: [
3407
+ {
3408
+ indexed: true,
3409
+ internalType: "address",
3410
+ name: "previousOwner",
3411
+ type: "address"
3412
+ },
3413
+ {
3414
+ indexed: true,
3415
+ internalType: "address",
3416
+ name: "newOwner",
3417
+ type: "address"
3418
+ }
3419
+ ],
3420
+ name: "OwnershipTransferred",
3421
+ type: "event"
3422
+ },
3423
+ {
3424
+ anonymous: false,
3425
+ inputs: [
3426
+ {
3427
+ indexed: false,
3428
+ internalType: "uint16",
3429
+ name: "newQuorum",
3430
+ type: "uint16"
3431
+ }
3432
+ ],
3433
+ name: "QuorumUpdated",
3434
+ type: "event"
3435
+ },
3436
+ {
3437
+ anonymous: false,
3438
+ inputs: [
3439
+ {
3440
+ indexed: true,
3441
+ internalType: "address",
3442
+ name: "user",
3443
+ type: "address"
3444
+ },
3445
+ {
3446
+ indexed: false,
3447
+ internalType: "uint256",
3448
+ name: "amount",
3449
+ type: "uint256"
3450
+ }
3451
+ ],
3452
+ name: "RewardsClaimed",
3453
+ type: "event"
3454
+ },
3455
+ {
3456
+ anonymous: false,
3457
+ inputs: [
3458
+ {
3459
+ indexed: true,
3460
+ internalType: "address",
3461
+ name: "user",
3462
+ type: "address"
3463
+ },
3464
+ {
3465
+ indexed: false,
3466
+ internalType: "uint256",
3467
+ name: "pending",
3468
+ type: "uint256"
3469
+ },
3470
+ {
3471
+ indexed: false,
3472
+ internalType: "uint256",
3473
+ name: "accrued",
3474
+ type: "uint256"
3475
+ },
3476
+ {
3477
+ indexed: false,
3478
+ internalType: "uint256",
3479
+ name: "userIndex",
3480
+ type: "uint256"
3481
+ }
3482
+ ],
3483
+ name: "RewardsSettled",
3484
+ type: "event"
3485
+ },
3486
+ {
3487
+ anonymous: false,
3488
+ inputs: [
3489
+ {
3490
+ indexed: true,
3491
+ internalType: "bytes32",
3492
+ name: "merkleRoot",
3493
+ type: "bytes32"
3494
+ },
3495
+ {
3496
+ indexed: true,
3497
+ internalType: "uint64",
3498
+ name: "blockNum",
3499
+ type: "uint64"
3500
+ }
3501
+ ],
3502
+ name: "RootCommitted",
2360
3503
  type: "event"
2361
3504
  },
2362
3505
  {
@@ -2364,18 +3507,18 @@ const MainnetV4SetterABI = [
2364
3507
  inputs: [
2365
3508
  {
2366
3509
  indexed: false,
2367
- internalType: "uint64[]",
2368
- name: "operatorIds",
2369
- type: "uint64[]"
3510
+ internalType: "string",
3511
+ name: "version",
3512
+ type: "string"
2370
3513
  },
2371
3514
  {
2372
3515
  indexed: false,
2373
- internalType: "address",
2374
- name: "whitelistingContract",
2375
- type: "address"
3516
+ internalType: "uint256",
3517
+ name: "blockNumber",
3518
+ type: "uint256"
2376
3519
  }
2377
3520
  ],
2378
- name: "OperatorWhitelistingContractUpdated",
3521
+ name: "SSVNetworkUpgradeBlock",
2379
3522
  type: "event"
2380
3523
  },
2381
3524
  {
@@ -2384,23 +3527,17 @@ const MainnetV4SetterABI = [
2384
3527
  {
2385
3528
  indexed: true,
2386
3529
  internalType: "address",
2387
- name: "owner",
3530
+ name: "user",
2388
3531
  type: "address"
2389
3532
  },
2390
- {
2391
- indexed: true,
2392
- internalType: "uint64",
2393
- name: "operatorId",
2394
- type: "uint64"
2395
- },
2396
3533
  {
2397
3534
  indexed: false,
2398
3535
  internalType: "uint256",
2399
- name: "value",
3536
+ name: "amount",
2400
3537
  type: "uint256"
2401
3538
  }
2402
3539
  ],
2403
- name: "OperatorWithdrawn",
3540
+ name: "Staked",
2404
3541
  type: "event"
2405
3542
  },
2406
3543
  {
@@ -2409,17 +3546,23 @@ const MainnetV4SetterABI = [
2409
3546
  {
2410
3547
  indexed: true,
2411
3548
  internalType: "address",
2412
- name: "previousOwner",
3549
+ name: "user",
2413
3550
  type: "address"
2414
3551
  },
2415
3552
  {
2416
- indexed: true,
2417
- internalType: "address",
2418
- name: "newOwner",
2419
- type: "address"
3553
+ indexed: false,
3554
+ internalType: "uint256",
3555
+ name: "amount",
3556
+ type: "uint256"
3557
+ },
3558
+ {
3559
+ indexed: false,
3560
+ internalType: "uint256",
3561
+ name: "unlockTime",
3562
+ type: "uint256"
2420
3563
  }
2421
3564
  ],
2422
- name: "OwnershipTransferStarted",
3565
+ name: "UnstakeRequested",
2423
3566
  type: "event"
2424
3567
  },
2425
3568
  {
@@ -2428,17 +3571,17 @@ const MainnetV4SetterABI = [
2428
3571
  {
2429
3572
  indexed: true,
2430
3573
  internalType: "address",
2431
- name: "previousOwner",
3574
+ name: "user",
2432
3575
  type: "address"
2433
3576
  },
2434
3577
  {
2435
- indexed: true,
2436
- internalType: "address",
2437
- name: "newOwner",
2438
- type: "address"
3578
+ indexed: false,
3579
+ internalType: "uint256",
3580
+ name: "amount",
3581
+ type: "uint256"
2439
3582
  }
2440
3583
  ],
2441
- name: "OwnershipTransferred",
3584
+ name: "UnstakedWithdrawn",
2442
3585
  type: "event"
2443
3586
  },
2444
3587
  {
@@ -2601,6 +3744,49 @@ const MainnetV4SetterABI = [
2601
3744
  name: "ValidatorRemoved",
2602
3745
  type: "event"
2603
3746
  },
3747
+ {
3748
+ anonymous: false,
3749
+ inputs: [
3750
+ {
3751
+ indexed: true,
3752
+ internalType: "bytes32",
3753
+ name: "merkleRoot",
3754
+ type: "bytes32"
3755
+ },
3756
+ {
3757
+ indexed: true,
3758
+ internalType: "uint64",
3759
+ name: "blockNum",
3760
+ type: "uint64"
3761
+ },
3762
+ {
3763
+ indexed: false,
3764
+ internalType: "uint256",
3765
+ name: "accumulatedWeight",
3766
+ type: "uint256"
3767
+ },
3768
+ {
3769
+ indexed: false,
3770
+ internalType: "uint256",
3771
+ name: "quorum",
3772
+ type: "uint256"
3773
+ },
3774
+ {
3775
+ indexed: false,
3776
+ internalType: "uint32",
3777
+ name: "oracleId",
3778
+ type: "uint32"
3779
+ },
3780
+ {
3781
+ indexed: false,
3782
+ internalType: "address",
3783
+ name: "oracle",
3784
+ type: "address"
3785
+ }
3786
+ ],
3787
+ name: "WeightedRootProposed",
3788
+ type: "event"
3789
+ },
2604
3790
  {
2605
3791
  stateMutability: "nonpayable",
2606
3792
  type: "fallback"
@@ -2647,11 +3833,6 @@ const MainnetV4SetterABI = [
2647
3833
  name: "sharesData",
2648
3834
  type: "bytes[]"
2649
3835
  },
2650
- {
2651
- internalType: "uint256",
2652
- name: "amount",
2653
- type: "uint256"
2654
- },
2655
3836
  {
2656
3837
  components: [
2657
3838
  {
@@ -2687,7 +3868,7 @@ const MainnetV4SetterABI = [
2687
3868
  ],
2688
3869
  name: "bulkRegisterValidator",
2689
3870
  outputs: [],
2690
- stateMutability: "nonpayable",
3871
+ stateMutability: "payable",
2691
3872
  type: "function"
2692
3873
  },
2693
3874
  {
@@ -2753,6 +3934,31 @@ const MainnetV4SetterABI = [
2753
3934
  stateMutability: "nonpayable",
2754
3935
  type: "function"
2755
3936
  },
3937
+ {
3938
+ inputs: [],
3939
+ name: "claimEthRewards",
3940
+ outputs: [],
3941
+ stateMutability: "nonpayable",
3942
+ type: "function"
3943
+ },
3944
+ {
3945
+ inputs: [
3946
+ {
3947
+ internalType: "bytes32",
3948
+ name: "merkleRoot",
3949
+ type: "bytes32"
3950
+ },
3951
+ {
3952
+ internalType: "uint64",
3953
+ name: "blockNum",
3954
+ type: "uint64"
3955
+ }
3956
+ ],
3957
+ name: "commitRoot",
3958
+ outputs: [],
3959
+ stateMutability: "nonpayable",
3960
+ type: "function"
3961
+ },
2756
3962
  {
2757
3963
  inputs: [
2758
3964
  {
@@ -2783,11 +3989,6 @@ const MainnetV4SetterABI = [
2783
3989
  name: "operatorIds",
2784
3990
  type: "uint64[]"
2785
3991
  },
2786
- {
2787
- internalType: "uint256",
2788
- name: "amount",
2789
- type: "uint256"
2790
- },
2791
3992
  {
2792
3993
  components: [
2793
3994
  {
@@ -2823,7 +4024,7 @@ const MainnetV4SetterABI = [
2823
4024
  ],
2824
4025
  name: "deposit",
2825
4026
  outputs: [],
2826
- stateMutability: "nonpayable",
4027
+ stateMutability: "payable",
2827
4028
  type: "function"
2828
4029
  },
2829
4030
  {
@@ -2898,48 +4099,160 @@ const MainnetV4SetterABI = [
2898
4099
  type: "address"
2899
4100
  },
2900
4101
  {
2901
- internalType: "uint64",
2902
- name: "minimumBlocksBeforeLiquidation_",
2903
- type: "uint64"
2904
- },
4102
+ components: [
4103
+ {
4104
+ internalType: "uint64",
4105
+ name: "minimumBlocksBeforeLiquidation",
4106
+ type: "uint64"
4107
+ },
4108
+ {
4109
+ internalType: "uint256",
4110
+ name: "minimumLiquidationCollateral",
4111
+ type: "uint256"
4112
+ },
4113
+ {
4114
+ internalType: "uint32",
4115
+ name: "validatorsPerOperatorLimit",
4116
+ type: "uint32"
4117
+ },
4118
+ {
4119
+ internalType: "uint64",
4120
+ name: "declareOperatorFeePeriod",
4121
+ type: "uint64"
4122
+ },
4123
+ {
4124
+ internalType: "uint64",
4125
+ name: "executeOperatorFeePeriod",
4126
+ type: "uint64"
4127
+ },
4128
+ {
4129
+ internalType: "uint64",
4130
+ name: "operatorMaxFeeIncrease",
4131
+ type: "uint64"
4132
+ },
4133
+ {
4134
+ internalType: "uint32[4]",
4135
+ name: "defaultOracleIds",
4136
+ type: "uint32[4]"
4137
+ },
4138
+ {
4139
+ internalType: "uint16",
4140
+ name: "quorumBps",
4141
+ type: "uint16"
4142
+ }
4143
+ ],
4144
+ internalType: "struct ISSVNetwork.NetworkInitParams",
4145
+ name: "params",
4146
+ type: "tuple"
4147
+ }
4148
+ ],
4149
+ name: "initialize",
4150
+ outputs: [],
4151
+ stateMutability: "nonpayable",
4152
+ type: "function"
4153
+ },
4154
+ {
4155
+ inputs: [
2905
4156
  {
2906
- internalType: "uint256",
2907
- name: "minimumLiquidationCollateral_",
2908
- type: "uint256"
4157
+ internalType: "address",
4158
+ name: "clusterOwner",
4159
+ type: "address"
2909
4160
  },
2910
4161
  {
2911
- internalType: "uint32",
2912
- name: "validatorsPerOperatorLimit_",
2913
- type: "uint32"
4162
+ internalType: "uint64[]",
4163
+ name: "operatorIds",
4164
+ type: "uint64[]"
2914
4165
  },
2915
4166
  {
2916
- internalType: "uint64",
2917
- name: "declareOperatorFeePeriod_",
2918
- type: "uint64"
4167
+ components: [
4168
+ {
4169
+ internalType: "uint32",
4170
+ name: "validatorCount",
4171
+ type: "uint32"
4172
+ },
4173
+ {
4174
+ internalType: "uint64",
4175
+ name: "networkFeeIndex",
4176
+ type: "uint64"
4177
+ },
4178
+ {
4179
+ internalType: "uint64",
4180
+ name: "index",
4181
+ type: "uint64"
4182
+ },
4183
+ {
4184
+ internalType: "bool",
4185
+ name: "active",
4186
+ type: "bool"
4187
+ },
4188
+ {
4189
+ internalType: "uint256",
4190
+ name: "balance",
4191
+ type: "uint256"
4192
+ }
4193
+ ],
4194
+ internalType: "struct ISSVNetworkCore.Cluster",
4195
+ name: "cluster",
4196
+ type: "tuple"
4197
+ }
4198
+ ],
4199
+ name: "liquidate",
4200
+ outputs: [],
4201
+ stateMutability: "nonpayable",
4202
+ type: "function"
4203
+ },
4204
+ {
4205
+ inputs: [
4206
+ {
4207
+ internalType: "address",
4208
+ name: "clusterOwner",
4209
+ type: "address"
2919
4210
  },
2920
4211
  {
2921
- internalType: "uint64",
2922
- name: "executeOperatorFeePeriod_",
2923
- type: "uint64"
4212
+ internalType: "uint64[]",
4213
+ name: "operatorIds",
4214
+ type: "uint64[]"
2924
4215
  },
2925
4216
  {
2926
- internalType: "uint64",
2927
- name: "operatorMaxFeeIncrease_",
2928
- type: "uint64"
4217
+ components: [
4218
+ {
4219
+ internalType: "uint32",
4220
+ name: "validatorCount",
4221
+ type: "uint32"
4222
+ },
4223
+ {
4224
+ internalType: "uint64",
4225
+ name: "networkFeeIndex",
4226
+ type: "uint64"
4227
+ },
4228
+ {
4229
+ internalType: "uint64",
4230
+ name: "index",
4231
+ type: "uint64"
4232
+ },
4233
+ {
4234
+ internalType: "bool",
4235
+ name: "active",
4236
+ type: "bool"
4237
+ },
4238
+ {
4239
+ internalType: "uint256",
4240
+ name: "balance",
4241
+ type: "uint256"
4242
+ }
4243
+ ],
4244
+ internalType: "struct ISSVNetworkCore.Cluster",
4245
+ name: "cluster",
4246
+ type: "tuple"
2929
4247
  }
2930
4248
  ],
2931
- name: "initialize",
4249
+ name: "liquidateSSV",
2932
4250
  outputs: [],
2933
4251
  stateMutability: "nonpayable",
2934
4252
  type: "function"
2935
4253
  },
2936
4254
  {
2937
4255
  inputs: [
2938
- {
2939
- internalType: "address",
2940
- name: "clusterOwner",
2941
- type: "address"
2942
- },
2943
4256
  {
2944
4257
  internalType: "uint64[]",
2945
4258
  name: "operatorIds",
@@ -2978,7 +4291,30 @@ const MainnetV4SetterABI = [
2978
4291
  type: "tuple"
2979
4292
  }
2980
4293
  ],
2981
- name: "liquidate",
4294
+ name: "migrateClusterToETH",
4295
+ outputs: [],
4296
+ stateMutability: "payable",
4297
+ type: "function"
4298
+ },
4299
+ {
4300
+ inputs: [
4301
+ {
4302
+ internalType: "address",
4303
+ name: "from",
4304
+ type: "address"
4305
+ },
4306
+ {
4307
+ internalType: "address",
4308
+ name: "to",
4309
+ type: "address"
4310
+ },
4311
+ {
4312
+ internalType: "uint256",
4313
+ name: "amount",
4314
+ type: "uint256"
4315
+ }
4316
+ ],
4317
+ name: "onCSSVTransfer",
2982
4318
  outputs: [],
2983
4319
  stateMutability: "nonpayable",
2984
4320
  type: "function"
@@ -3029,11 +4365,6 @@ const MainnetV4SetterABI = [
3029
4365
  name: "operatorIds",
3030
4366
  type: "uint64[]"
3031
4367
  },
3032
- {
3033
- internalType: "uint256",
3034
- name: "amount",
3035
- type: "uint256"
3036
- },
3037
4368
  {
3038
4369
  components: [
3039
4370
  {
@@ -3069,7 +4400,7 @@ const MainnetV4SetterABI = [
3069
4400
  ],
3070
4401
  name: "reactivate",
3071
4402
  outputs: [],
3072
- stateMutability: "nonpayable",
4403
+ stateMutability: "payable",
3073
4404
  type: "function"
3074
4405
  },
3075
4406
  {
@@ -3136,11 +4467,6 @@ const MainnetV4SetterABI = [
3136
4467
  name: "sharesData",
3137
4468
  type: "bytes"
3138
4469
  },
3139
- {
3140
- internalType: "uint256",
3141
- name: "amount",
3142
- type: "uint256"
3143
- },
3144
4470
  {
3145
4471
  components: [
3146
4472
  {
@@ -3176,7 +4502,7 @@ const MainnetV4SetterABI = [
3176
4502
  ],
3177
4503
  name: "registerValidator",
3178
4504
  outputs: [],
3179
- stateMutability: "nonpayable",
4505
+ stateMutability: "payable",
3180
4506
  type: "function"
3181
4507
  },
3182
4508
  {
@@ -3280,6 +4606,60 @@ const MainnetV4SetterABI = [
3280
4606
  stateMutability: "nonpayable",
3281
4607
  type: "function"
3282
4608
  },
4609
+ {
4610
+ inputs: [
4611
+ {
4612
+ internalType: "uint32",
4613
+ name: "oracleId",
4614
+ type: "uint32"
4615
+ },
4616
+ {
4617
+ internalType: "address",
4618
+ name: "newOracle",
4619
+ type: "address"
4620
+ }
4621
+ ],
4622
+ name: "replaceOracle",
4623
+ outputs: [],
4624
+ stateMutability: "nonpayable",
4625
+ type: "function"
4626
+ },
4627
+ {
4628
+ inputs: [
4629
+ {
4630
+ internalType: "uint256",
4631
+ name: "amount",
4632
+ type: "uint256"
4633
+ }
4634
+ ],
4635
+ name: "requestUnstake",
4636
+ outputs: [],
4637
+ stateMutability: "nonpayable",
4638
+ type: "function"
4639
+ },
4640
+ {
4641
+ inputs: [
4642
+ {
4643
+ internalType: "address",
4644
+ name: "token",
4645
+ type: "address"
4646
+ },
4647
+ {
4648
+ internalType: "address",
4649
+ name: "to",
4650
+ type: "address"
4651
+ },
4652
+ {
4653
+ internalType: "uint256",
4654
+ name: "amount",
4655
+ type: "uint256"
4656
+ }
4657
+ ],
4658
+ name: "rescueERC20",
4659
+ outputs: [],
4660
+ stateMutability: "nonpayable",
4661
+ type: "function"
4662
+ },
3283
4663
  {
3284
4664
  inputs: [
3285
4665
  {
@@ -3355,6 +4735,26 @@ const MainnetV4SetterABI = [
3355
4735
  stateMutability: "nonpayable",
3356
4736
  type: "function"
3357
4737
  },
4738
+ {
4739
+ inputs: [
4740
+ {
4741
+ internalType: "uint256",
4742
+ name: "amount",
4743
+ type: "uint256"
4744
+ }
4745
+ ],
4746
+ name: "stake",
4747
+ outputs: [],
4748
+ stateMutability: "nonpayable",
4749
+ type: "function"
4750
+ },
4751
+ {
4752
+ inputs: [],
4753
+ name: "syncFees",
4754
+ outputs: [],
4755
+ stateMutability: "nonpayable",
4756
+ type: "function"
4757
+ },
3358
4758
  {
3359
4759
  inputs: [
3360
4760
  {
@@ -3368,6 +4768,71 @@ const MainnetV4SetterABI = [
3368
4768
  stateMutability: "nonpayable",
3369
4769
  type: "function"
3370
4770
  },
4771
+ {
4772
+ inputs: [
4773
+ {
4774
+ internalType: "uint64",
4775
+ name: "blockNum",
4776
+ type: "uint64"
4777
+ },
4778
+ {
4779
+ internalType: "address",
4780
+ name: "clusterOwner",
4781
+ type: "address"
4782
+ },
4783
+ {
4784
+ internalType: "uint64[]",
4785
+ name: "operatorIds",
4786
+ type: "uint64[]"
4787
+ },
4788
+ {
4789
+ components: [
4790
+ {
4791
+ internalType: "uint32",
4792
+ name: "validatorCount",
4793
+ type: "uint32"
4794
+ },
4795
+ {
4796
+ internalType: "uint64",
4797
+ name: "networkFeeIndex",
4798
+ type: "uint64"
4799
+ },
4800
+ {
4801
+ internalType: "uint64",
4802
+ name: "index",
4803
+ type: "uint64"
4804
+ },
4805
+ {
4806
+ internalType: "bool",
4807
+ name: "active",
4808
+ type: "bool"
4809
+ },
4810
+ {
4811
+ internalType: "uint256",
4812
+ name: "balance",
4813
+ type: "uint256"
4814
+ }
4815
+ ],
4816
+ internalType: "struct ISSVNetworkCore.Cluster",
4817
+ name: "cluster",
4818
+ type: "tuple"
4819
+ },
4820
+ {
4821
+ internalType: "uint32",
4822
+ name: "effectiveBalance",
4823
+ type: "uint32"
4824
+ },
4825
+ {
4826
+ internalType: "bytes32[]",
4827
+ name: "merkleProof",
4828
+ type: "bytes32[]"
4829
+ }
4830
+ ],
4831
+ name: "updateClusterBalance",
4832
+ outputs: [],
4833
+ stateMutability: "nonpayable",
4834
+ type: "function"
4835
+ },
3371
4836
  {
3372
4837
  inputs: [
3373
4838
  {
@@ -3411,15 +4876,41 @@ const MainnetV4SetterABI = [
3411
4876
  inputs: [
3412
4877
  {
3413
4878
  internalType: "uint64",
3414
- name: "maxFee",
4879
+ name: "blocks",
3415
4880
  type: "uint64"
3416
4881
  }
3417
4882
  ],
4883
+ name: "updateLiquidationThresholdPeriodSSV",
4884
+ outputs: [],
4885
+ stateMutability: "nonpayable",
4886
+ type: "function"
4887
+ },
4888
+ {
4889
+ inputs: [
4890
+ {
4891
+ internalType: "uint256",
4892
+ name: "maxFee",
4893
+ type: "uint256"
4894
+ }
4895
+ ],
3418
4896
  name: "updateMaximumOperatorFee",
3419
4897
  outputs: [],
3420
4898
  stateMutability: "nonpayable",
3421
4899
  type: "function"
3422
4900
  },
4901
+ {
4902
+ inputs: [
4903
+ {
4904
+ internalType: "uint32",
4905
+ name: "blocks",
4906
+ type: "uint32"
4907
+ }
4908
+ ],
4909
+ name: "updateMinBlocksBetweenUpdates",
4910
+ outputs: [],
4911
+ stateMutability: "nonpayable",
4912
+ type: "function"
4913
+ },
3423
4914
  {
3424
4915
  inputs: [
3425
4916
  {
@@ -3433,6 +4924,32 @@ const MainnetV4SetterABI = [
3433
4924
  stateMutability: "nonpayable",
3434
4925
  type: "function"
3435
4926
  },
4927
+ {
4928
+ inputs: [
4929
+ {
4930
+ internalType: "uint256",
4931
+ name: "amount",
4932
+ type: "uint256"
4933
+ }
4934
+ ],
4935
+ name: "updateMinimumLiquidationCollateralSSV",
4936
+ outputs: [],
4937
+ stateMutability: "nonpayable",
4938
+ type: "function"
4939
+ },
4940
+ {
4941
+ inputs: [
4942
+ {
4943
+ internalType: "uint256",
4944
+ name: "minFee",
4945
+ type: "uint256"
4946
+ }
4947
+ ],
4948
+ name: "updateMinimumOperatorEthFee",
4949
+ outputs: [],
4950
+ stateMutability: "nonpayable",
4951
+ type: "function"
4952
+ },
3436
4953
  {
3437
4954
  inputs: [
3438
4955
  {
@@ -3446,7 +4963,46 @@ const MainnetV4SetterABI = [
3446
4963
  type: "address"
3447
4964
  }
3448
4965
  ],
3449
- name: "updateModule",
4966
+ name: "updateModule",
4967
+ outputs: [],
4968
+ stateMutability: "nonpayable",
4969
+ type: "function"
4970
+ },
4971
+ {
4972
+ inputs: [
4973
+ {
4974
+ internalType: "uint256",
4975
+ name: "fee",
4976
+ type: "uint256"
4977
+ }
4978
+ ],
4979
+ name: "updateNetworkFee",
4980
+ outputs: [],
4981
+ stateMutability: "nonpayable",
4982
+ type: "function"
4983
+ },
4984
+ {
4985
+ inputs: [
4986
+ {
4987
+ internalType: "uint256",
4988
+ name: "fee",
4989
+ type: "uint256"
4990
+ }
4991
+ ],
4992
+ name: "updateNetworkFeeSSV",
4993
+ outputs: [],
4994
+ stateMutability: "nonpayable",
4995
+ type: "function"
4996
+ },
4997
+ {
4998
+ inputs: [
4999
+ {
5000
+ internalType: "uint64",
5001
+ name: "percentage",
5002
+ type: "uint64"
5003
+ }
5004
+ ],
5005
+ name: "updateOperatorFeeIncreaseLimit",
3450
5006
  outputs: [],
3451
5007
  stateMutability: "nonpayable",
3452
5008
  type: "function"
@@ -3454,12 +5010,12 @@ const MainnetV4SetterABI = [
3454
5010
  {
3455
5011
  inputs: [
3456
5012
  {
3457
- internalType: "uint256",
3458
- name: "fee",
3459
- type: "uint256"
5013
+ internalType: "uint16",
5014
+ name: "quorum",
5015
+ type: "uint16"
3460
5016
  }
3461
5017
  ],
3462
- name: "updateNetworkFee",
5018
+ name: "updateQuorumBps",
3463
5019
  outputs: [],
3464
5020
  stateMutability: "nonpayable",
3465
5021
  type: "function"
@@ -3468,11 +5024,11 @@ const MainnetV4SetterABI = [
3468
5024
  inputs: [
3469
5025
  {
3470
5026
  internalType: "uint64",
3471
- name: "percentage",
5027
+ name: "duration",
3472
5028
  type: "uint64"
3473
5029
  }
3474
5030
  ],
3475
- name: "updateOperatorFeeIncreaseLimit",
5031
+ name: "updateUnstakeCooldownDuration",
3476
5032
  outputs: [],
3477
5033
  stateMutability: "nonpayable",
3478
5034
  type: "function"
@@ -3571,6 +5127,32 @@ const MainnetV4SetterABI = [
3571
5127
  stateMutability: "nonpayable",
3572
5128
  type: "function"
3573
5129
  },
5130
+ {
5131
+ inputs: [
5132
+ {
5133
+ internalType: "uint64",
5134
+ name: "operatorId",
5135
+ type: "uint64"
5136
+ }
5137
+ ],
5138
+ name: "withdrawAllOperatorEarningsSSV",
5139
+ outputs: [],
5140
+ stateMutability: "nonpayable",
5141
+ type: "function"
5142
+ },
5143
+ {
5144
+ inputs: [
5145
+ {
5146
+ internalType: "uint64",
5147
+ name: "operatorId",
5148
+ type: "uint64"
5149
+ }
5150
+ ],
5151
+ name: "withdrawAllVersionOperatorEarnings",
5152
+ outputs: [],
5153
+ stateMutability: "nonpayable",
5154
+ type: "function"
5155
+ },
3574
5156
  {
3575
5157
  inputs: [
3576
5158
  {
@@ -3579,7 +5161,7 @@ const MainnetV4SetterABI = [
3579
5161
  type: "uint256"
3580
5162
  }
3581
5163
  ],
3582
- name: "withdrawNetworkEarnings",
5164
+ name: "withdrawNetworkSSVEarnings",
3583
5165
  outputs: [],
3584
5166
  stateMutability: "nonpayable",
3585
5167
  type: "function"
@@ -3601,6 +5183,31 @@ const MainnetV4SetterABI = [
3601
5183
  outputs: [],
3602
5184
  stateMutability: "nonpayable",
3603
5185
  type: "function"
5186
+ },
5187
+ {
5188
+ inputs: [
5189
+ {
5190
+ internalType: "uint64",
5191
+ name: "operatorId",
5192
+ type: "uint64"
5193
+ },
5194
+ {
5195
+ internalType: "uint256",
5196
+ name: "amount",
5197
+ type: "uint256"
5198
+ }
5199
+ ],
5200
+ name: "withdrawOperatorEarningsSSV",
5201
+ outputs: [],
5202
+ stateMutability: "nonpayable",
5203
+ type: "function"
5204
+ },
5205
+ {
5206
+ inputs: [],
5207
+ name: "withdrawUnlocked",
5208
+ outputs: [],
5209
+ stateMutability: "nonpayable",
5210
+ type: "function"
3604
5211
  }
3605
5212
  ];
3606
5213
  const TokenABI = [
@@ -3983,23 +5590,41 @@ const TokenABI = [
3983
5590
  type: "function"
3984
5591
  }
3985
5592
  ];
5593
+ class MissingAbiParameterError extends Error {
5594
+ code = "MISSING_ABI_PARAMETER";
5595
+ functionName;
5596
+ parameterName;
5597
+ parameterIndex;
5598
+ constructor({
5599
+ functionName,
5600
+ parameterName,
5601
+ parameterIndex
5602
+ }) {
5603
+ super(
5604
+ `Missing required ABI parameter "${parameterName}" for function "${functionName}" at index ${parameterIndex}.`
5605
+ );
5606
+ this.name = "MissingAbiParameterError";
5607
+ this.functionName = functionName;
5608
+ this.parameterName = parameterName;
5609
+ this.parameterIndex = parameterIndex;
5610
+ }
5611
+ }
3986
5612
  const paramsToArray = ({
3987
5613
  params,
3988
5614
  abiFunction
3989
5615
  }) => {
3990
- return globals.stringifyBigints(
3991
- abiFunction.inputs.reduce(
3992
- (acc, param) => {
3993
- if (param.name && !lodashEs.isUndefined(params[param.name])) {
3994
- return [...acc, params[param.name]];
3995
- } else {
3996
- console.error(`Missing argument for ${param}`);
3997
- }
3998
- return acc;
3999
- },
4000
- []
4001
- )
4002
- );
5616
+ const args = abiFunction.inputs.map((param, parameterIndex) => {
5617
+ const parameterName = param.name;
5618
+ if (!parameterName || lodashEs.isUndefined(params[parameterName])) {
5619
+ throw new MissingAbiParameterError({
5620
+ functionName: abiFunction.name,
5621
+ parameterName: parameterName || `<unnamed_${parameterIndex}>`,
5622
+ parameterIndex
5623
+ });
5624
+ }
5625
+ return params[parameterName];
5626
+ });
5627
+ return config.stringifyBigints(args);
4003
5628
  };
4004
5629
  function normalize(strArray) {
4005
5630
  const resultArray = [];
@@ -4063,59 +5688,84 @@ function urlJoin(...args) {
4063
5688
  const parts = Array.from(Array.isArray(args[0]) ? args[0] : args);
4064
5689
  return normalize(parts);
4065
5690
  }
4066
- const ABIS = [TokenABI, MainnetV4SetterABI];
5691
+ const ensureWritableWallet = (walletClient, functionName) => {
5692
+ if (!walletClient) {
5693
+ throw new Error(
5694
+ `Wallet client is required for write method "${functionName}". Provide walletClient in SDK config.`
5695
+ );
5696
+ }
5697
+ if (!walletClient.account) {
5698
+ throw new Error(
5699
+ `Wallet client account is required for write method "${functionName}".`
5700
+ );
5701
+ }
5702
+ return walletClient;
5703
+ };
4067
5704
  const createWriter = ({
4068
5705
  abi,
4069
5706
  publicClient,
4070
5707
  walletClient,
4071
- contractAddress
5708
+ contractAddress,
5709
+ eventSources = [{ abi, address: contractAddress }]
4072
5710
  }) => {
4073
5711
  const writeFnsMainnet = abi.filter(
4074
5712
  (item) => item.type === "function" && (item.stateMutability === "nonpayable" || item.stateMutability === "payable")
4075
5713
  );
4076
5714
  return Object.fromEntries(
4077
5715
  writeFnsMainnet.map((fn) => {
4078
- const simulate = async (options2) => publicClient.simulateContract({
4079
- ...options2,
4080
- address: contractAddress,
4081
- abi,
4082
- functionName: fn.name,
4083
- args: paramsToArray({ params: options2.args, abiFunction: fn }),
4084
- account: walletClient.account
4085
- });
5716
+ const getWriteArgs = (params) => {
5717
+ if (fn.inputs.length === 0) {
5718
+ return void 0;
5719
+ }
5720
+ return paramsToArray({
5721
+ params: params ?? {},
5722
+ abiFunction: fn
5723
+ });
5724
+ };
5725
+ const simulate = async (options = {}) => {
5726
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5727
+ return publicClient.simulateContract({
5728
+ ...options,
5729
+ address: contractAddress,
5730
+ abi,
5731
+ functionName: fn.name,
5732
+ args: getWriteArgs(options.args),
5733
+ account: writableWallet.account
5734
+ });
5735
+ };
4086
5736
  const getTransactionData = (params) => {
4087
5737
  return viem.encodeFunctionData({
4088
5738
  abi,
4089
5739
  functionName: fn.name,
4090
- args: paramsToArray({ params, abiFunction: fn })
5740
+ args: getWriteArgs(params)
4091
5741
  });
4092
5742
  };
4093
- const func = async (options2) => {
4094
- const { request } = await simulate(options2);
4095
- const hash = await walletClient.writeContract(request);
5743
+ const func = async (options = {}) => {
5744
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5745
+ const { request } = await simulate(options);
5746
+ const hash = await writableWallet.writeContract(
5747
+ request
5748
+ );
4096
5749
  return {
4097
5750
  hash,
4098
5751
  wait: () => publicClient.waitForTransactionReceipt({ hash }).then((receipt) => ({
4099
5752
  ...receipt,
4100
5753
  events: receipt.logs.reduce(
4101
5754
  (acc, log) => {
4102
- try {
4103
- const event = viem.decodeEventLog({
4104
- abi,
4105
- data: log.data,
4106
- topics: log.topics
4107
- });
4108
- acc.push(event);
4109
- } catch {
4110
- for (const eventAbi of ABIS) {
4111
- globals.tryCatch(() => {
4112
- const event = viem.decodeEventLog({
4113
- abi: eventAbi,
4114
- data: log.data,
4115
- topics: log.topics
4116
- });
4117
- acc.push(event);
4118
- });
5755
+ for (const eventSource of eventSources) {
5756
+ if (!viem.isAddressEqual(log.address, eventSource.address)) {
5757
+ continue;
5758
+ }
5759
+ const [event] = config.tryCatch(
5760
+ () => viem.decodeEventLog({
5761
+ abi: eventSource.abi,
5762
+ data: log.data,
5763
+ topics: log.topics
5764
+ })
5765
+ );
5766
+ if (event) {
5767
+ acc.push(event);
5768
+ break;
4119
5769
  }
4120
5770
  }
4121
5771
  return acc;
@@ -4178,7 +5828,7 @@ const createSSVAPI = (endpoint) => {
4178
5828
  return getSSVAPI(endpoint);
4179
5829
  };
4180
5830
  const isConfig = (props) => {
4181
- return typeof props === "object" && props !== null && "publicClient" in props && "walletClient" in props && "chain" in props && "api" in props && "contractAddresses" in props && "contract" in props && "subgraph" in props && "rest" in props;
5831
+ return typeof props === "object" && props !== null && "publicClient" in props && "chain" in props && "api" in props && "contractAddresses" in props && "contract" in props && "subgraph" in props && "rest" in props;
4182
5832
  };
4183
5833
  const createContractInteractions = ({
4184
5834
  walletClient,
@@ -4191,7 +5841,17 @@ const createContractInteractions = ({
4191
5841
  abi: MainnetV4SetterABI,
4192
5842
  walletClient,
4193
5843
  publicClient,
4194
- contractAddress: addresses.setter
5844
+ contractAddress: addresses.setter,
5845
+ eventSources: [
5846
+ {
5847
+ abi: MainnetV4SetterABI,
5848
+ address: addresses.setter
5849
+ },
5850
+ {
5851
+ abi: TokenABI,
5852
+ address: addresses.token
5853
+ }
5854
+ ]
4195
5855
  }),
4196
5856
  read: createReader({
4197
5857
  abi: MainnetV4GetterABI,
@@ -4209,16 +5869,22 @@ const createContractInteractions = ({
4209
5869
  abi: TokenABI,
4210
5870
  walletClient,
4211
5871
  publicClient,
4212
- contractAddress: addresses.token
5872
+ contractAddress: addresses.token,
5873
+ eventSources: [
5874
+ {
5875
+ abi: TokenABI,
5876
+ address: addresses.token
5877
+ }
5878
+ ]
4213
5879
  })
4214
5880
  }
4215
5881
  };
4216
5882
  };
4217
5883
  const createConfig = (props) => {
4218
- const { walletClient, publicClient, extendedConfig } = globals.configArgsSchema.parse(props);
5884
+ const { walletClient, publicClient, extendedConfig } = config.configArgsSchema.parse(props);
4219
5885
  const hasAPIKey = Boolean(extendedConfig?.subgraph?.apiKey);
4220
- const chainId = walletClient.chain.id;
4221
- const chainContracts = globals.contracts[chainId];
5886
+ const chainId = publicClient.chain.id;
5887
+ const chainContracts = config.contracts[chainId];
4222
5888
  const addresses = {
4223
5889
  setter: extendedConfig?.contracts?.setter || chainContracts.setter,
4224
5890
  getter: extendedConfig?.contracts?.getter || chainContracts.getter,
@@ -4229,16 +5895,20 @@ const createConfig = (props) => {
4229
5895
  publicClient,
4230
5896
  addresses
4231
5897
  });
4232
- const graphEndpoint = extendedConfig?.subgraph?.endpoint || (hasAPIKey ? globals.paid_graph_endpoints[chainId] : globals.graph_endpoints[chainId]);
4233
- const restEndpoint = extendedConfig?.rest?.endpoint || globals.rest_endpoints[chainId];
5898
+ const graphEndpoint = extendedConfig?.subgraph?.endpoint || (hasAPIKey ? config.paid_graph_endpoints[chainId] : config.graph_endpoints[chainId]);
5899
+ const restEndpoint = extendedConfig?.rest?.endpoint || config.rest_endpoints[chainId];
4234
5900
  const graphQLClient = new graphqlRequest.GraphQLClient(
4235
5901
  graphEndpoint,
4236
- hasAPIKey ? { headers: { Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}` } } : void 0
5902
+ hasAPIKey ? {
5903
+ headers: {
5904
+ Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}`
5905
+ }
5906
+ } : void 0
4237
5907
  );
4238
5908
  return {
4239
5909
  publicClient,
4240
5910
  walletClient,
4241
- chain: walletClient.chain,
5911
+ chain: publicClient.chain,
4242
5912
  api: {
4243
5913
  ...createQueries(graphQLClient),
4244
5914
  ...createSSVAPI(restEndpoint)
@@ -4254,31 +5924,17 @@ const createConfig = (props) => {
4254
5924
  contract
4255
5925
  };
4256
5926
  };
4257
- const deposit = async (config2, { args: { id, amount }, ...writeOptions }, options2 = {}) => {
4258
- const cluster = await config2.api.getCluster({ id });
5927
+ const deposit = async (config$1, { args: { id, amount }, ...writeOptions }) => {
5928
+ const cluster = await config$1.api.getCluster({ id });
4259
5929
  if (!cluster) {
4260
5930
  throw new Error("Cluster not found");
4261
5931
  }
4262
- const snapshot = globals.getClusterSnapshot(cluster);
4263
- if (options2?.approve) {
4264
- const allowance = await config2.contract.token.read.allowance({
4265
- owner: config2.walletClient.account.address,
4266
- spender: config2.contractAddresses.setter
4267
- });
4268
- if (allowance < amount) {
4269
- await config2.contract.token.write.approve({
4270
- args: {
4271
- spender: config2.contractAddresses.setter,
4272
- amount
4273
- }
4274
- }).then((tx) => tx.wait());
4275
- }
4276
- }
4277
- return config2.contract.ssv.write.deposit({
5932
+ const snapshot = config.toSolidityCluster(cluster);
5933
+ return config$1.contract.ssv.write.deposit({
5934
+ value: amount,
4278
5935
  args: {
4279
- amount,
4280
5936
  cluster: snapshot,
4281
- clusterOwner: config2.walletClient.account.address,
5937
+ clusterOwner: cluster.owner.id,
4282
5938
  operatorIds: cluster.operatorIds.map(BigInt)
4283
5939
  },
4284
5940
  ...writeOptions
@@ -4302,58 +5958,97 @@ const exitValidators = async (config2, { args: { publicKeys, operatorIds }, ...w
4302
5958
  ...writeOptions
4303
5959
  });
4304
5960
  };
4305
- const liquidateCluster = async (config2, { args: { id }, ...writeOptions }) => {
4306
- const cluster = await config2.api.getCluster({ id });
5961
+ const liquidateCluster = async (config$1, { args: { id }, ...writeOptions }) => {
5962
+ const cluster = await config$1.api.getCluster({ id });
4307
5963
  if (!cluster) {
4308
5964
  throw new Error("Cluster not found");
4309
5965
  }
4310
- return config2.contract.ssv.write.liquidate({
5966
+ return config$1.contract.ssv.write.liquidate({
4311
5967
  args: {
4312
- cluster: globals.getClusterSnapshot(cluster),
4313
- clusterOwner: config2.walletClient.account.address,
5968
+ cluster: config.toSolidityCluster(cluster),
5969
+ clusterOwner: cluster.owner.id,
4314
5970
  operatorIds: cluster.operatorIds.map(BigInt)
4315
5971
  },
4316
5972
  ...writeOptions
4317
5973
  });
4318
5974
  };
4319
- const reactivateCluster = async (config2, { args: { id, amount }, ...writeOptions }) => {
4320
- const cluster = await config2.api.getCluster({ id });
5975
+ const liquidateSSV = async (config$1, { args: { id }, ...writeOptions }) => {
5976
+ const cluster = await config$1.api.getCluster({ id });
4321
5977
  if (!cluster) {
4322
5978
  throw new Error("Cluster not found");
4323
5979
  }
4324
- return config2.contract.ssv.write.reactivate({
5980
+ return config$1.contract.ssv.write.liquidateSSV({
4325
5981
  args: {
4326
- cluster: globals.getClusterSnapshot(cluster),
4327
- amount,
5982
+ clusterOwner: cluster.owner.id,
5983
+ operatorIds: cluster.operatorIds.map(BigInt),
5984
+ cluster: config.toSolidityCluster(cluster)
5985
+ },
5986
+ ...writeOptions
5987
+ });
5988
+ };
5989
+ const migrateClusterToETH = async (config$1, { args: { id, amount }, ...writeOptions }) => {
5990
+ const cluster = await config$1.api.getCluster({ id });
5991
+ if (!cluster) {
5992
+ throw new Error("Cluster not found");
5993
+ }
5994
+ return config$1.contract.ssv.write.migrateClusterToETH({
5995
+ value: amount,
5996
+ args: {
5997
+ operatorIds: cluster.operatorIds.map(BigInt),
5998
+ cluster: config.toSolidityCluster(cluster)
5999
+ },
6000
+ ...writeOptions
6001
+ });
6002
+ };
6003
+ const reactivateCluster = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6004
+ const cluster = await config$1.api.getCluster({ id });
6005
+ if (!cluster) {
6006
+ throw new Error("Cluster not found");
6007
+ }
6008
+ return config$1.contract.ssv.write.reactivate({
6009
+ value: amount,
6010
+ args: {
6011
+ cluster: config.toSolidityCluster(cluster),
4328
6012
  operatorIds: cluster.operatorIds.map(BigInt)
4329
6013
  },
4330
6014
  ...writeOptions
4331
6015
  });
4332
6016
  };
4333
- const registerValidators = async (config2, { args: { keyshares, depositAmount = 0n }, ...writeOptions }) => {
6017
+ const registerValidators = async (config$1, {
6018
+ args: { keyshares, depositAmount = 0n },
6019
+ ...writeOptions
6020
+ }) => {
4334
6021
  const shares = keyshares.map((share) => {
4335
- return globals.isKeySharesItem(share) ? share.payload : share;
6022
+ return config.isKeySharesItem(share) ? share.payload : share;
4336
6023
  });
4337
6024
  const operatorIds = shares[0].operatorIds;
4338
6025
  const clusterSize = operatorIds.length;
4339
- const limit = globals.registerValidatorsByClusterSizeLimits[clusterSize];
6026
+ const limit = config.registerValidatorsByClusterSizeLimits[clusterSize];
4340
6027
  if (!limit) {
4341
6028
  throw new Error(
4342
- `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(globals.registerValidatorsByClusterSizeLimits).join(", ")}`
6029
+ `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(config.registerValidatorsByClusterSizeLimits).join(", ")}`
4343
6030
  );
4344
6031
  }
4345
6032
  if (shares.length > limit) {
4346
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6033
+ throw new Error(
6034
+ `You can't register more than ${limit} validators in a single transaction`
6035
+ );
6036
+ }
6037
+ const ownerAddress = config$1.walletClient?.account?.address;
6038
+ if (!ownerAddress) {
6039
+ throw new Error(
6040
+ "walletClient with account is required for write operations"
6041
+ );
4347
6042
  }
4348
- const clusterId = globals.createClusterId(config2.walletClient.account.address, operatorIds);
4349
- const cluster = await config2.api.getCluster({
6043
+ const clusterId = config.createClusterId(ownerAddress, operatorIds);
6044
+ const cluster = await config$1.api.getCluster({
4350
6045
  id: clusterId
4351
6046
  });
4352
- const snapshot = cluster ? globals.getClusterSnapshot(cluster) : globals.createEmptyCluster();
6047
+ const snapshot = cluster ? config.toSolidityCluster(cluster) : config.createEmptyCluster();
4353
6048
  if (shares.length === 1) {
4354
- return config2.contract.ssv.write.registerValidator({
6049
+ return config$1.contract.ssv.write.registerValidator({
6050
+ value: depositAmount,
4355
6051
  args: {
4356
- amount: depositAmount,
4357
6052
  cluster: snapshot,
4358
6053
  operatorIds: operatorIds.map(BigInt),
4359
6054
  publicKey: shares[0].publicKey,
@@ -4362,10 +6057,10 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4362
6057
  ...writeOptions
4363
6058
  });
4364
6059
  }
4365
- return config2.contract.ssv.write.bulkRegisterValidator({
6060
+ return config$1.contract.ssv.write.bulkRegisterValidator({
6061
+ value: depositAmount,
4366
6062
  args: {
4367
6063
  cluster: snapshot,
4368
- amount: depositAmount,
4369
6064
  operatorIds: operatorIds.map(BigInt),
4370
6065
  publicKeys: shares.map((share) => share.publicKey),
4371
6066
  sharesData: shares.map((share) => share.sharesData)
@@ -4373,38 +6068,44 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4373
6068
  ...writeOptions
4374
6069
  });
4375
6070
  };
4376
- const registerValidatorsRawData = async (config2, { args: { keyshares, depositAmount = 0n } }) => {
6071
+ const registerValidatorsRawData = async (config$1, { args: { keyshares, ownerAddress } }) => {
4377
6072
  const shares = keyshares.map((share) => {
4378
- return globals.isKeySharesItem(share) ? share.payload : share;
6073
+ return config.isKeySharesItem(share) ? share.payload : share;
4379
6074
  });
4380
6075
  const operatorIds = shares[0].operatorIds;
4381
6076
  const clusterSize = operatorIds.length;
4382
- const limit = globals.registerValidatorsByClusterSizeLimits[clusterSize];
6077
+ const limit = config.registerValidatorsByClusterSizeLimits[clusterSize];
4383
6078
  if (!limit) {
4384
6079
  throw new Error(
4385
- `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(globals.registerValidatorsByClusterSizeLimits).join(", ")}`
6080
+ `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(config.registerValidatorsByClusterSizeLimits).join(", ")}`
4386
6081
  );
4387
6082
  }
4388
6083
  if (shares.length > limit) {
4389
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6084
+ throw new Error(
6085
+ `You can't register more than ${limit} validators in a single transaction`
6086
+ );
6087
+ }
6088
+ const resolvedOwnerAddress = ownerAddress ?? config$1.walletClient?.account?.address;
6089
+ if (!resolvedOwnerAddress) {
6090
+ throw new Error(
6091
+ "ownerAddress is required when walletClient.account.address is not available"
6092
+ );
4390
6093
  }
4391
- const clusterId = globals.createClusterId(config2.walletClient.account.address, operatorIds);
4392
- const cluster = await config2.api.getCluster({
6094
+ const clusterId = config.createClusterId(resolvedOwnerAddress, operatorIds);
6095
+ const cluster = await config$1.api.getCluster({
4393
6096
  id: clusterId
4394
6097
  });
4395
- const snapshot = cluster ? globals.getClusterSnapshot(cluster) : globals.createEmptyCluster();
6098
+ const snapshot = cluster ? config.toSolidityCluster(cluster) : config.createEmptyCluster();
4396
6099
  if (shares.length === 1) {
4397
- return config2.contract.ssv.write.registerValidator.getTransactionData({
4398
- amount: depositAmount,
6100
+ return config$1.contract.ssv.write.registerValidator.getTransactionData({
4399
6101
  cluster: snapshot,
4400
6102
  operatorIds: operatorIds.map(BigInt),
4401
6103
  publicKey: shares[0].publicKey,
4402
6104
  sharesData: shares[0].sharesData
4403
6105
  });
4404
6106
  }
4405
- return config2.contract.ssv.write.bulkRegisterValidator.getTransactionData({
6107
+ return config$1.contract.ssv.write.bulkRegisterValidator.getTransactionData({
4406
6108
  cluster: snapshot,
4407
- amount: depositAmount,
4408
6109
  operatorIds: operatorIds.map(BigInt),
4409
6110
  publicKeys: shares.map((share) => share.publicKey),
4410
6111
  sharesData: shares.map((share) => share.sharesData)
@@ -4412,11 +6113,17 @@ const registerValidatorsRawData = async (config2, { args: { keyshares, depositAm
4412
6113
  };
4413
6114
  const ssvKeys$1 = new KeyShares.SSVKeys();
4414
6115
  const validateSharesPostRegistration = async (config2, args) => {
6116
+ const ownerAddress = args.ownerAddress ?? config2.walletClient?.account?.address;
6117
+ if (!ownerAddress) {
6118
+ throw new Error(
6119
+ "ownerAddress is required when walletClient.account.address is not available"
6120
+ );
6121
+ }
4415
6122
  const receipt = await config2.publicClient.waitForTransactionReceipt({
4416
6123
  hash: args.txHash
4417
6124
  });
4418
6125
  const ownerNonce = await config2.api.getOwnerNonce({
4419
- owner: config2.walletClient.account.address,
6126
+ owner: ownerAddress,
4420
6127
  block: Number(receipt.blockNumber) - 1
4421
6128
  });
4422
6129
  if (lodashEs.isUndefined(ownerNonce)) {
@@ -4427,7 +6134,7 @@ const validateSharesPostRegistration = async (config2, args) => {
4427
6134
  address: config2.contractAddresses.setter,
4428
6135
  eventName: "ValidatorAdded",
4429
6136
  args: {
4430
- owner: config2.walletClient.account.address
6137
+ owner: ownerAddress
4431
6138
  },
4432
6139
  fromBlock: receipt.blockNumber,
4433
6140
  toBlock: receipt.blockNumber
@@ -4443,7 +6150,7 @@ const validateSharesPostRegistration = async (config2, args) => {
4443
6150
  blockNumber: Number(receipt.blockNumber),
4444
6151
  operatorsCount: e.args.operatorIds.length,
4445
6152
  isAccountExists: false,
4446
- ownerAddress: config2.walletClient.account.address,
6153
+ ownerAddress,
4447
6154
  ownerNonce: Number(ownerNonce) + index,
4448
6155
  shares: e.args.shares,
4449
6156
  validatorPublicKey: e.args.publicKey
@@ -4460,24 +6167,24 @@ const validateSharesPostRegistration = async (config2, args) => {
4460
6167
  block: Number(receipt.blockNumber)
4461
6168
  };
4462
6169
  };
4463
- const removeValidators = async (config2, { args: { id, publicKeys }, ...writeOptions }) => {
4464
- const cluster = await config2.api.getCluster({ id });
6170
+ const removeValidators = async (config$1, { args: { id, publicKeys }, ...writeOptions }) => {
6171
+ const cluster = await config$1.api.getCluster({ id });
4465
6172
  if (!cluster) {
4466
6173
  throw new Error("Cluster not found");
4467
6174
  }
4468
6175
  if (publicKeys.length === 1) {
4469
- return config2.contract.ssv.write.removeValidator({
6176
+ return config$1.contract.ssv.write.removeValidator({
4470
6177
  args: {
4471
- cluster: globals.getClusterSnapshot(cluster),
6178
+ cluster: config.toSolidityCluster(cluster),
4472
6179
  publicKey: publicKeys[0],
4473
6180
  operatorIds: cluster.operatorIds.map(BigInt)
4474
6181
  },
4475
6182
  ...writeOptions
4476
6183
  });
4477
6184
  }
4478
- return config2.contract.ssv.write.bulkRemoveValidator({
6185
+ return config$1.contract.ssv.write.bulkRemoveValidator({
4479
6186
  args: {
4480
- cluster: globals.getClusterSnapshot(cluster),
6187
+ cluster: config.toSolidityCluster(cluster),
4481
6188
  publicKeys,
4482
6189
  operatorIds: cluster.operatorIds.map(BigInt)
4483
6190
  },
@@ -4492,15 +6199,15 @@ const setFeeRecipient = async (config2, { args: { recipient }, ...writeOptions }
4492
6199
  ...writeOptions
4493
6200
  });
4494
6201
  };
4495
- const withdraw$1 = async (config2, { args: { id, amount }, ...writeOptions }) => {
4496
- const cluster = await config2.api.getCluster({ id });
6202
+ const withdraw$1 = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6203
+ const cluster = await config$1.api.getCluster({ id });
4497
6204
  if (!cluster) {
4498
6205
  throw new Error("Cluster not found");
4499
6206
  }
4500
- return config2.contract.ssv.write.withdraw({
6207
+ return config$1.contract.ssv.write.withdraw({
4501
6208
  args: {
4502
6209
  amount,
4503
- cluster: globals.getClusterSnapshot(cluster),
6210
+ cluster: config.toSolidityCluster(cluster),
4504
6211
  operatorIds: cluster.operatorIds.map(BigInt)
4505
6212
  },
4506
6213
  ...writeOptions
@@ -4510,17 +6217,61 @@ const createClusterManager = (config2) => ({
4510
6217
  deposit: deposit.bind(null, config2),
4511
6218
  withdraw: withdraw$1.bind(null, config2),
4512
6219
  liquidate: liquidateCluster.bind(null, config2),
6220
+ liquidateSSV: liquidateSSV.bind(null, config2),
4513
6221
  reactivate: reactivateCluster.bind(null, config2),
6222
+ migrateClusterToETH: migrateClusterToETH.bind(
6223
+ null,
6224
+ config2
6225
+ ),
4514
6226
  removeValidators: removeValidators.bind(null, config2),
4515
6227
  setFeeRecipient: setFeeRecipient.bind(null, config2),
4516
6228
  exitValidators: exitValidators.bind(null, config2),
4517
6229
  registerValidators: registerValidators.bind(null, config2),
4518
- registerValidatorsRawData: registerValidatorsRawData.bind(null, config2),
6230
+ registerValidatorsRawData: registerValidatorsRawData.bind(
6231
+ null,
6232
+ config2
6233
+ ),
4519
6234
  validateSharesPostRegistration: validateSharesPostRegistration.bind(
4520
6235
  null,
4521
6236
  config2
4522
6237
  )
4523
6238
  });
6239
+ const commitRoot = async (config2, { args: { merkleRoot, blockNum }, ...writeOptions }) => {
6240
+ return config2.contract.ssv.write.commitRoot({
6241
+ args: {
6242
+ merkleRoot,
6243
+ blockNum
6244
+ },
6245
+ ...writeOptions
6246
+ });
6247
+ };
6248
+ const updateNetworkFeeSSV = async (config2, { args: { fee }, ...writeOptions }) => {
6249
+ return config2.contract.ssv.write.updateNetworkFeeSSV({
6250
+ args: {
6251
+ fee
6252
+ },
6253
+ ...writeOptions
6254
+ });
6255
+ };
6256
+ const withdrawNetworkSSVEarnings = async (config2, { args: { amount }, ...writeOptions }) => {
6257
+ return config2.contract.ssv.write.withdrawNetworkSSVEarnings({
6258
+ args: {
6259
+ amount
6260
+ },
6261
+ ...writeOptions
6262
+ });
6263
+ };
6264
+ const createDaoManager = (config2) => ({
6265
+ commitRoot: commitRoot.bind(null, config2),
6266
+ updateNetworkFeeSSV: updateNetworkFeeSSV.bind(
6267
+ null,
6268
+ config2
6269
+ ),
6270
+ withdrawNetworkSSVEarnings: withdrawNetworkSSVEarnings.bind(
6271
+ null,
6272
+ config2
6273
+ )
6274
+ });
4524
6275
  const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions }) => {
4525
6276
  const balance = await config2.contract.ssv.read.getOperatorEarnings({
4526
6277
  id: BigInt(operatorId)
@@ -4542,17 +6293,69 @@ const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions
4542
6293
  ...writeOptions
4543
6294
  });
4544
6295
  };
4545
- const registerOperator = async (config2, { args: { isPrivate, yearlyFee, publicKey }, ...writeOptions }) => {
4546
- return config2.contract.ssv.write.registerOperator({
6296
+ const withdrawOperatorEarningsSSV = async (config2, {
6297
+ args: { operatorId, amount },
6298
+ ...writeOptions
6299
+ }) => {
6300
+ const balance = await config2.contract.ssv.read.getOperatorEarningsSSV({
6301
+ id: BigInt(operatorId)
6302
+ });
6303
+ const isWithdrawingAll = amount >= balance;
6304
+ if (isWithdrawingAll) {
6305
+ return config2.contract.ssv.write.withdrawAllOperatorEarningsSSV({
6306
+ args: {
6307
+ operatorId: BigInt(operatorId)
6308
+ },
6309
+ ...writeOptions
6310
+ });
6311
+ }
6312
+ return config2.contract.ssv.write.withdrawOperatorEarningsSSV({
6313
+ args: {
6314
+ operatorId: BigInt(operatorId),
6315
+ amount
6316
+ },
6317
+ ...writeOptions
6318
+ });
6319
+ };
6320
+ const withdrawAllOperatorEarningsSSV = async (config2, { args: { operatorId }, ...writeOptions }) => {
6321
+ return config2.contract.ssv.write.withdrawAllOperatorEarningsSSV({
6322
+ args: {
6323
+ operatorId: BigInt(operatorId)
6324
+ },
6325
+ ...writeOptions
6326
+ });
6327
+ };
6328
+ const withdrawAllVersionOperatorEarnings = async (config2, {
6329
+ args: { operatorId },
6330
+ ...writeOptions
6331
+ }) => {
6332
+ return config2.contract.ssv.write.withdrawAllVersionOperatorEarnings({
6333
+ args: {
6334
+ operatorId: BigInt(operatorId)
6335
+ },
6336
+ ...writeOptions
6337
+ });
6338
+ };
6339
+ const registerOperator = async (config$1, {
6340
+ args: { isPrivate, yearlyFee, publicKey },
6341
+ ...writeOptions
6342
+ }) => {
6343
+ return config$1.contract.ssv.write.registerOperator({
4547
6344
  args: {
4548
6345
  publicKey: viem.encodeAbiParameters(viem.parseAbiParameters("string"), [publicKey]),
4549
- fee: globals.roundOperatorFee(yearlyFee / globals.globals.BLOCKS_PER_YEAR),
6346
+ fee: config.roundOperatorFee(
6347
+ yearlyFee / config.globals.BLOCKS_PER_YEAR,
6348
+ config.globals.ETH_DEDUCTED_DIGITS
6349
+ ),
4550
6350
  setPrivate: isPrivate
4551
6351
  },
4552
6352
  ...writeOptions
4553
6353
  });
4554
6354
  };
4555
- const setOperatorWhitelists = async (config2, { args: { operatorIds, contractAddress }, ...writeOptions }) => {
6355
+ const setOperatorWhitelists = async (config2, {
6356
+ args: { operatorIds, contractAddress },
6357
+ ...writeOptions
6358
+ }) => {
4556
6359
  const isWhitelistingContract = await config2.contract.ssv.read.isWhitelistingContract({
4557
6360
  contractAddress
4558
6361
  });
@@ -4588,70 +6391,163 @@ const createOperatorManager = (config2) => ({
4588
6391
  registerOperator: registerOperator.bind(null, config2),
4589
6392
  removeOperator: config2.contract.ssv.write.removeOperator,
4590
6393
  withdraw: withdraw.bind(null, config2),
6394
+ withdrawOperatorEarningsSSV: withdrawOperatorEarningsSSV.bind(
6395
+ null,
6396
+ config2
6397
+ ),
6398
+ withdrawAllOperatorEarningsSSV: withdrawAllOperatorEarningsSSV.bind(
6399
+ null,
6400
+ config2
6401
+ ),
6402
+ withdrawAllVersionOperatorEarnings: withdrawAllVersionOperatorEarnings.bind(
6403
+ null,
6404
+ config2
6405
+ ),
4591
6406
  setOperatorWhitelists: config2.contract.ssv.write.setOperatorsWhitelists,
4592
6407
  removeOperatorWhitelists: config2.contract.ssv.write.removeOperatorsWhitelists,
4593
6408
  setOperatorsPrivate: config2.contract.ssv.write.setOperatorsPrivateUnchecked,
4594
6409
  setOperatorsPublic: config2.contract.ssv.write.setOperatorsPublicUnchecked,
4595
- setOperatorWhitelistingContract: setOperatorWhitelists.bind(null, config2),
6410
+ setOperatorWhitelistingContract: setOperatorWhitelists.bind(
6411
+ null,
6412
+ config2
6413
+ ),
4596
6414
  removeOperatorWhitelistingContract: config2.contract.ssv.write.removeOperatorsWhitelists,
4597
6415
  declareOperatorFee: config2.contract.ssv.write.declareOperatorFee,
4598
6416
  executeOperatorFee: config2.contract.ssv.write.executeOperatorFee,
4599
6417
  cancelDeclaredOperatorFee: config2.contract.ssv.write.cancelDeclaredOperatorFee,
4600
6418
  reduceOperatorFee: config2.contract.ssv.write.reduceOperatorFee
4601
6419
  });
4602
- const getClusterBalance = async (config2, { operatorIds }) => {
4603
- const query = await config2.api.getClusterBalance({
4604
- daoAddress: config2.contractAddresses.setter,
6420
+ const getClusterBalance = async (config$1, { operatorIds, ownerAddress }) => {
6421
+ const resolvedOwnerAddress = ownerAddress ?? config$1.walletClient?.account?.address;
6422
+ if (!resolvedOwnerAddress) {
6423
+ throw new Error(
6424
+ "ownerAddress is required when walletClient.account.address is not available"
6425
+ );
6426
+ }
6427
+ const query = await config$1.api.getClusterBalance({
6428
+ daoAddress: config$1.contractAddresses.setter,
4605
6429
  operatorIds: operatorIds.map(String),
4606
- clusterId: globals.createClusterId(config2.walletClient.account.address, operatorIds)
6430
+ clusterId: config.createClusterId(resolvedOwnerAddress, operatorIds)
4607
6431
  });
4608
6432
  if (!query.cluster || !query.daovalues || !query._meta) {
4609
6433
  throw new Error("Could not fetch cluster balance");
4610
6434
  }
4611
- const cumulativeNetworkFee = BigInt(query.daovalues.networkFeeIndex) + (BigInt(query._meta.block.number) - BigInt(query.daovalues.networkFeeIndexBlockNumber)) * BigInt(query.daovalues.networkFee) - BigInt(query.cluster.networkFeeIndex) * 10000000n;
6435
+ const isSsvCluster = query.cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6436
+ const networkFee = BigInt(
6437
+ isSsvCluster ? query.daovalues.networkFeeSSV : query.daovalues.networkFee
6438
+ );
6439
+ const networkFeeIndex = BigInt(
6440
+ isSsvCluster ? query.daovalues.networkFeeIndexSSV : query.daovalues.networkFeeIndex
6441
+ );
6442
+ const networkFeeIndexBlockNumber = BigInt(
6443
+ isSsvCluster ? query.daovalues.networkFeeIndexBlockNumberSSV : query.daovalues.networkFeeIndexBlockNumber
6444
+ );
6445
+ const minimumLiquidationCollateral = BigInt(
6446
+ isSsvCluster ? query.daovalues.minimumLiquidationCollateralSSV : query.daovalues.minimumLiquidationCollateral
6447
+ );
6448
+ const liquidationThreshold = BigInt(
6449
+ isSsvCluster ? query.daovalues.liquidationThresholdSSV : query.daovalues.liquidationThreshold
6450
+ );
6451
+ const scallingCoefficient = isSsvCluster ? config.globals.SSV_DEDUCTED_DIGITS : config.globals.ETH_DEDUCTED_DIGITS;
6452
+ const cumulativeNetworkFee = networkFeeIndex + (BigInt(query._meta.block.number) - networkFeeIndexBlockNumber) * networkFee - BigInt(query.cluster.networkFeeIndex) * scallingCoefficient;
4612
6453
  const cumulativeOperatorFee = query.operators.reduce(
4613
6454
  (acc, operator) => {
4614
- return acc + BigInt(operator.feeIndex) + (BigInt(query._meta.block.number) - BigInt(operator.feeIndexBlockNumber)) * BigInt(operator.fee);
6455
+ const fee = isSsvCluster ? operator.feeSSV : operator.fee;
6456
+ const feeIndex = isSsvCluster ? operator.feeIndexSSV : operator.feeIndex;
6457
+ const feeIndexBlockNumber = isSsvCluster ? operator.feeIndexBlockNumberSSV : operator.feeIndexBlockNumber;
6458
+ return acc + BigInt(feeIndex) + (BigInt(query._meta.block.number) - BigInt(feeIndexBlockNumber)) * BigInt(fee);
4615
6459
  },
4616
- -BigInt(query.cluster.index) * 10000000n
6460
+ -BigInt(query.cluster.index) * scallingCoefficient
6461
+ );
6462
+ const operatorsFee = query.operators.reduce(
6463
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6464
+ 0n
4617
6465
  );
4618
- const operatorsFee = query.operators.reduce((acc, operator) => acc + BigInt(operator.fee), 0n);
4619
- const calculatedClusterBalance = BigInt(query.cluster.balance) - (cumulativeNetworkFee + cumulativeOperatorFee) * BigInt(query.cluster.validatorCount) || 1n;
4620
- const burnRate = (operatorsFee + BigInt(query.daovalues.networkFee)) * BigInt(query.cluster.validatorCount) || 1n;
4621
- const mLc = BigInt(query.daovalues.minimumLiquidationCollateral);
4622
- const LC = globals.bigintMax(mLc, burnRate * BigInt(query.daovalues.liquidationThreshold));
4623
- const runwaySSV = calculatedClusterBalance - LC;
4624
- const operationalRunway = runwaySSV / burnRate / globals.globals.BLOCKS_PER_DAY;
6466
+ const effectiveBalanceValidatorUnits = BigInt(query.cluster.effectiveBalance) * BigInt(config.globals.VUNITS_PRECISION) / 32n;
6467
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(config.globals.VUNITS_PRECISION);
6468
+ const calculatedClusterBalance = BigInt(query.cluster.balance) - (cumulativeNetworkFee + cumulativeOperatorFee) * validatorUnits || 1n;
6469
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6470
+ const LC = config.bigintMax(
6471
+ minimumLiquidationCollateral,
6472
+ burnRate * liquidationThreshold
6473
+ );
6474
+ const runway = calculatedClusterBalance - LC;
6475
+ const operationalRunway = runway / burnRate / config.globals.BLOCKS_PER_DAY;
4625
6476
  return {
4626
6477
  balance: calculatedClusterBalance,
4627
6478
  operationalRunway
4628
6479
  };
4629
6480
  };
4630
- const validateSharesPreRegistration = async (config2, { keyshares, operatorIds }) => {
4631
- const operators = await config2.api.getOperators({ operatorIds });
4632
- const shares = await validateKeysharesJSON({
4633
- account: config2.walletClient.account.address,
6481
+ const isKeySharesPayload = (value) => {
6482
+ return !!value && typeof value === "object" && "sharesData" in value && "publicKey" in value && "operatorIds" in value;
6483
+ };
6484
+ const isKeySharesPayloadList = (value) => {
6485
+ return Array.isArray(value) && value.every(isKeySharesPayload);
6486
+ };
6487
+ const buildKeysharesFromPayloads = (payloads) => {
6488
+ const shares = payloads.map((payload) => {
6489
+ const item = new KeyShares.KeySharesItem();
6490
+ item.payload.update(payload);
6491
+ return item;
6492
+ });
6493
+ config.ensureValidatorsUniqueness(shares);
6494
+ return shares;
6495
+ };
6496
+ const validateSharesPreRegistration = async (config$1, { keyshares, operatorIds, ownerAddress }) => {
6497
+ const account = ownerAddress ?? config$1.walletClient?.account?.address;
6498
+ if (!account) {
6499
+ throw new Error(
6500
+ "ownerAddress is required when walletClient.account.address is not available"
6501
+ );
6502
+ }
6503
+ const operators = await config$1.api.getOperators({ operatorIds });
6504
+ if (operators.length !== operatorIds.length) {
6505
+ throw new config.KeysharesValidationError(
6506
+ config.KeysharesValidationErrors.OperatorDoesNotExist
6507
+ );
6508
+ }
6509
+ const usesPayloads = isKeySharesPayloadList(keyshares);
6510
+ const shares = usesPayloads ? buildKeysharesFromPayloads(keyshares) : await validateKeysharesJSON({
6511
+ account,
4634
6512
  operators,
4635
6513
  keyshares
4636
6514
  });
6515
+ if (usesPayloads) {
6516
+ const shareOperatorIds = config.validateConsistentOperatorIds(shares);
6517
+ const sortedOperatorIds = config.sortNumbers(
6518
+ operators.map((operator) => Number(operator.id))
6519
+ );
6520
+ if (!lodashEs.isEqual(config.sortNumbers(shareOperatorIds), config.sortNumbers(sortedOperatorIds))) {
6521
+ throw new config.KeysharesValidationError(
6522
+ config.KeysharesValidationErrors.ClusterMismatch
6523
+ );
6524
+ }
6525
+ }
4637
6526
  const statuses = await Promise.all(
4638
6527
  shares.map((share) => {
4639
- return config2.api.getValidator({ id: share.data.publicKey }).then((res) => [share, Boolean(res)]).catch(() => [share, false]);
6528
+ return config$1.api.getValidator({ id: share.data.publicKey }).then((res) => [share, Boolean(res)]);
4640
6529
  })
4641
6530
  );
4642
6531
  if (statuses.every(([, isRegistered]) => isRegistered)) {
4643
6532
  throw new Error("All validators are already registered");
4644
6533
  }
4645
- const nonce = await config2.api.getOwnerNonce({ owner: config2.walletClient.account.address }).then((nonce2) => {
6534
+ const shouldValidateNonce = shares.every(
6535
+ (share) => typeof share.data.ownerNonce === "number"
6536
+ );
6537
+ const nonce = shouldValidateNonce ? await config$1.api.getOwnerNonce({ owner: account }).then((nonce2) => {
4646
6538
  if (!nonce2) throw new Error("Failed to get owner nonce");
4647
6539
  return Number(nonce2);
4648
- });
6540
+ }) : null;
4649
6541
  let i = 0;
4650
6542
  const sharesWithStatuses = statuses.reduce(
4651
6543
  (acc, [share, isRegistered]) => {
4652
6544
  if (isRegistered) {
4653
6545
  acc.registered.push(share);
4654
6546
  } else {
6547
+ if (!shouldValidateNonce) {
6548
+ acc.available.push(share);
6549
+ return acc;
6550
+ }
4655
6551
  const validNonce = nonce + i === share.data.ownerNonce;
4656
6552
  if (validNonce) i++;
4657
6553
  if (validNonce) {
@@ -4669,13 +6565,17 @@ const validateSharesPreRegistration = async (config2, { keyshares, operatorIds }
4669
6565
  `No available keyshares to register. ${sharesWithStatuses.incorrect.length} keyshares have incorrect nonce and ${sharesWithStatuses.registered.length} are already registered`
4670
6566
  );
4671
6567
  }
4672
- const limit = await config2.contract.ssv.read.getValidatorsPerOperatorLimit();
6568
+ const limit = await config$1.contract.ssv.read.getValidatorsPerOperatorLimit();
4673
6569
  for (const operator of operators) {
4674
- if (!await canAccountUseOperator(config2, operator, config2.walletClient.account.address)) {
4675
- throw new Error(`Operator ${operator.id} is private and the account is not whitelisted`);
6570
+ if (!await canAccountUseOperator(config$1, operator, account)) {
6571
+ throw new Error(
6572
+ `Operator ${operator.id} is private and the account is not whitelisted`
6573
+ );
4676
6574
  }
4677
6575
  if (Number(operator.validatorCount) + sharesWithStatuses.available.length > limit) {
4678
- throw new Error(`Operator ${operator.id} has reached the limit of ${limit} validators`);
6576
+ throw new Error(
6577
+ `Operator ${operator.id} has reached the limit of ${limit} validators`
6578
+ );
4679
6579
  }
4680
6580
  }
4681
6581
  return sharesWithStatuses;
@@ -4686,9 +6586,9 @@ const validateKeysharesJSON = async ({
4686
6586
  keyshares
4687
6587
  }) => {
4688
6588
  const shares = (await KeyShares.KeyShares.fromJson(keyshares)).list();
4689
- globals.ensureNoKeysharesErrors(shares);
4690
- globals.ensureValidatorsUniqueness(shares);
4691
- globals.validateConsistentOperatorPublicKeys(shares, operators);
6589
+ config.ensureNoKeysharesErrors(shares);
6590
+ config.ensureValidatorsUniqueness(shares);
6591
+ config.validateConsistentOperatorPublicKeys(shares, operators);
4692
6592
  await Promise.all(
4693
6593
  shares.map(
4694
6594
  (share) => share.validateSingleShares(share.payload.sharesData, {
@@ -4698,17 +6598,24 @@ const validateKeysharesJSON = async ({
4698
6598
  })
4699
6599
  )
4700
6600
  );
4701
- const shareOperatorIds = globals.validateConsistentOperatorIds(shares);
4702
- const operatorIds = globals.sortNumbers(operators.map((operator) => Number(operator.id)));
4703
- if (!lodashEs.isEqual(globals.sortNumbers(shareOperatorIds), globals.sortNumbers(operatorIds))) {
4704
- throw new globals.KeysharesValidationError(globals.KeysharesValidationErrors.ClusterMismatch);
6601
+ const shareOperatorIds = config.validateConsistentOperatorIds(shares);
6602
+ const operatorIds = config.sortNumbers(
6603
+ operators.map((operator) => Number(operator.id))
6604
+ );
6605
+ if (!lodashEs.isEqual(config.sortNumbers(shareOperatorIds), config.sortNumbers(operatorIds))) {
6606
+ throw new config.KeysharesValidationError(
6607
+ config.KeysharesValidationErrors.ClusterMismatch
6608
+ );
4705
6609
  }
4706
6610
  return shares;
4707
6611
  };
4708
6612
  const ssvKeys = new KeyShares.SSVKeys();
4709
6613
  const createAndEncryptShares = async (privateKey, operators) => {
4710
6614
  const threshold = await ssvKeys.createThreshold(privateKey, operators);
4711
- const encryptedShares = await ssvKeys.encryptShares(operators, threshold.shares);
6615
+ const encryptedShares = await ssvKeys.encryptShares(
6616
+ operators,
6617
+ threshold.shares
6618
+ );
4712
6619
  return {
4713
6620
  threshold,
4714
6621
  encryptedShares
@@ -4719,29 +6626,31 @@ const generateKeyShares = async (args) => {
4719
6626
  const shares = [];
4720
6627
  for (let i = 0; i < keystores.length; i++) {
4721
6628
  const keystore = keystores[i];
4722
- const extracted = await ssvKeys.extractKeys(keystore, args.keystore_password);
4723
- const operators = args.operator_keys.map((key, index) => ({
4724
- id: args.operator_ids[index],
6629
+ const extracted = await ssvKeys.extractKeys(
6630
+ keystore,
6631
+ args.keystorePassword
6632
+ );
6633
+ const operators = args.operatorKeys.map((key, index) => ({
6634
+ id: args.operatorIds[index],
4725
6635
  operatorKey: key
4726
6636
  }));
4727
6637
  const { threshold, encryptedShares } = await createAndEncryptShares(
4728
6638
  extracted.privateKey,
4729
6639
  operators
4730
6640
  );
4731
- shares.push(
4732
- await new KeyShares.KeySharesItem().buildPayload(
4733
- {
4734
- publicKey: threshold.publicKey,
4735
- operators,
4736
- encryptedShares
4737
- },
4738
- {
4739
- ownerAddress: args.owner_address,
4740
- ownerNonce: args.nonce + i,
4741
- privateKey: extracted.privateKey
4742
- }
4743
- )
6641
+ const payload = await new KeyShares.KeySharesItem().buildPayload(
6642
+ {
6643
+ publicKey: threshold.publicKey,
6644
+ operators,
6645
+ encryptedShares
6646
+ },
6647
+ {
6648
+ ownerAddress: args.ownerAddress,
6649
+ ownerNonce: args.nonce + i,
6650
+ privateKey: extracted.privateKey
6651
+ }
4744
6652
  );
6653
+ shares.push(payload);
4745
6654
  }
4746
6655
  return shares;
4747
6656
  };
@@ -4755,16 +6664,73 @@ const getOperatorCapacity = async (config2, operatorId) => {
4755
6664
  if (!operator) return 0;
4756
6665
  return limit - Number(operator.validatorCount);
4757
6666
  };
6667
+ const computeDailyAmount = (value, days) => {
6668
+ const scale = 10 ** 6;
6669
+ const scaledDays = BigInt(days * scale);
6670
+ return value * scaledDays * BigInt(config.globals.BLOCKS_PER_DAY) / BigInt(scale);
6671
+ };
6672
+ const calcDepositFromRunway = async (config$1, { clusterId, runway }) => {
6673
+ const cluster = await config$1.api.getCluster({ id: clusterId });
6674
+ if (!cluster) {
6675
+ throw new Error("Cluster not found");
6676
+ }
6677
+ const operators = await config$1.api.getOperators({
6678
+ operatorIds: cluster.operatorIds
6679
+ });
6680
+ if (!operators) {
6681
+ throw new Error("Operators not found");
6682
+ }
6683
+ const daoValues = await config$1.api.getDaoValues({
6684
+ daoAddress: config$1.contractAddresses.setter
6685
+ });
6686
+ if (!daoValues) {
6687
+ throw new Error("DAO values not found");
6688
+ }
6689
+ const isSsvCluster = cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6690
+ const operatorsFee = operators.reduce(
6691
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6692
+ 0n
6693
+ );
6694
+ const networkFee = BigInt(
6695
+ isSsvCluster ? daoValues.networkFeeSSV : daoValues.networkFee
6696
+ );
6697
+ const minimumLiquidationCollateral = BigInt(
6698
+ isSsvCluster ? daoValues.minimumLiquidationCollateralSSV : daoValues.minimumLiquidationCollateral
6699
+ );
6700
+ const liquidationThreshold = BigInt(
6701
+ isSsvCluster ? daoValues.liquidationThresholdSSV : daoValues.liquidationThreshold
6702
+ );
6703
+ const effectiveBalanceValidatorUnits = BigInt(cluster.effectiveBalance) * BigInt(config.globals.VUNITS_PRECISION) / 32n;
6704
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(config.globals.VUNITS_PRECISION) || 1n;
6705
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6706
+ const liquidationCollateral = config.bigintMax(
6707
+ minimumLiquidationCollateral,
6708
+ burnRate * liquidationThreshold
6709
+ );
6710
+ const residualBalance = computeDailyAmount(burnRate, runway);
6711
+ return residualBalance + liquidationCollateral;
6712
+ };
4758
6713
  const createUtils = (config2) => ({
4759
6714
  generateKeyShares,
4760
6715
  validateKeysharesJSON,
4761
- validateSharesPreRegistration: validateSharesPreRegistration.bind(null, config2),
4762
- getOperatorCapacity: getOperatorCapacity.bind(null, config2),
4763
- getClusterBalance: getClusterBalance.bind(null, config2)
6716
+ validateSharesPreRegistration: validateSharesPreRegistration.bind(
6717
+ null,
6718
+ config2
6719
+ ),
6720
+ getOperatorCapacity: getOperatorCapacity.bind(
6721
+ null,
6722
+ config2
6723
+ ),
6724
+ getClusterBalance: getClusterBalance.bind(null, config2),
6725
+ calcDepositFromRunway: calcDepositFromRunway.bind(
6726
+ null,
6727
+ config2
6728
+ )
4764
6729
  });
4765
6730
  class SSVSDK {
4766
6731
  config;
4767
6732
  clusters;
6733
+ dao;
4768
6734
  operators;
4769
6735
  api;
4770
6736
  contract;
@@ -4772,22 +6738,38 @@ class SSVSDK {
4772
6738
  constructor(props) {
4773
6739
  this.config = isConfig(props) ? props : createConfig(props);
4774
6740
  this.clusters = createClusterManager(this.config);
6741
+ this.dao = createDaoManager(this.config);
4775
6742
  this.operators = createOperatorManager(this.config);
4776
6743
  this.api = this.config.api;
4777
6744
  this.contract = this.config.contract;
4778
6745
  this.utils = createUtils(this.config);
4779
6746
  }
6747
+ connectWallet(walletClient) {
6748
+ config.configArgsSchema.parse({
6749
+ publicClient: this.config.publicClient,
6750
+ walletClient
6751
+ });
6752
+ this.config.walletClient = walletClient;
6753
+ this.config.contract = createContractInteractions({
6754
+ walletClient,
6755
+ publicClient: this.config.publicClient,
6756
+ addresses: this.config.contractAddresses
6757
+ });
6758
+ this.contract = this.config.contract;
6759
+ this.operators = createOperatorManager(this.config);
6760
+ return this;
6761
+ }
4780
6762
  }
4781
- exports.chainIds = globals.chainIds;
4782
- exports.chains = globals.chains;
4783
- exports.contracts = globals.contracts;
4784
- exports.globals = globals.globals;
4785
- exports.graph_endpoints = globals.graph_endpoints;
4786
- exports.hoodi = globals.hoodi;
4787
- exports.networks = globals.networks;
4788
- exports.paid_graph_endpoints = globals.paid_graph_endpoints;
4789
- exports.registerValidatorsByClusterSizeLimits = globals.registerValidatorsByClusterSizeLimits;
4790
- exports.rest_endpoints = globals.rest_endpoints;
6763
+ exports.chainIds = config.chainIds;
6764
+ exports.chains = config.chains;
6765
+ exports.contracts = config.contracts;
6766
+ exports.globals = config.globals;
6767
+ exports.graph_endpoints = config.graph_endpoints;
6768
+ exports.hoodi = config.hoodi;
6769
+ exports.networks = config.networks;
6770
+ exports.paid_graph_endpoints = config.paid_graph_endpoints;
6771
+ exports.registerValidatorsByClusterSizeLimits = config.registerValidatorsByClusterSizeLimits;
6772
+ exports.rest_endpoints = config.rest_endpoints;
4791
6773
  exports.KeyShares = KeyShares.KeyShares;
4792
6774
  exports.KeySharesItem = KeyShares.KeySharesItem;
4793
6775
  exports.OperatorPublicKeyError = KeyShares.OperatorPublicKeyError;
@@ -4798,6 +6780,7 @@ exports.SSVSDK = SSVSDK;
4798
6780
  exports.createClusterManager = createClusterManager;
4799
6781
  exports.createConfig = createConfig;
4800
6782
  exports.createContractInteractions = createContractInteractions;
6783
+ exports.createDaoManager = createDaoManager;
4801
6784
  exports.createOperatorManager = createOperatorManager;
4802
6785
  exports.createQueries = createQueries;
4803
6786
  exports.createReader = createReader;
@@ -4808,6 +6791,7 @@ exports.getCluster = getCluster;
4808
6791
  exports.getClusterBalance = getClusterBalance$1;
4809
6792
  exports.getClusterSnapshot = getClusterSnapshot;
4810
6793
  exports.getClusters = getClusters;
6794
+ exports.getDaoValues = getDaoValues;
4811
6795
  exports.getOperator = getOperator;
4812
6796
  exports.getOperators = getOperators;
4813
6797
  exports.getOwnerNonce = getOwnerNonce;
@@ -4815,3 +6799,4 @@ exports.getQueries = getQueries;
4815
6799
  exports.getValidator = getValidator;
4816
6800
  exports.getValidators = getValidators;
4817
6801
  exports.isConfig = isConfig;
6802
+ exports.toSolidityCluster = toSolidityCluster;