@ssv-labs/ssv-sdk 0.1.3 → 1.0.2

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 (61) hide show
  1. package/README.html +4 -7
  2. package/README.md +56 -29
  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 +50 -48
  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 +4799 -921
  15. package/dist/keys.js +1 -1
  16. package/dist/keys.mjs +5 -5
  17. package/dist/libs/api/index.d.ts +1 -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 +1732 -3
  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 +8 -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 +4 -1
  46. package/dist/libs/utils/methods/index.d.ts +1 -0
  47. package/dist/libs/utils/methods/keyshares.d.ts +4 -2
  48. package/dist/libs/utils/methods/keystores.d.ts +4 -4
  49. package/dist/libs/utils/methods/write-keyshares-file.d.ts +16 -0
  50. package/dist/main.d.ts +1 -0
  51. package/dist/main.js +2970 -733
  52. package/dist/main.mjs +2961 -746
  53. package/dist/sdk.d.ts +8 -4
  54. package/dist/types/contract-interactions.d.ts +11 -0
  55. package/dist/types/methods.d.ts +4 -3
  56. package/dist/utils/cluster.d.ts +3 -3
  57. package/dist/utils/funding.d.ts +29 -0
  58. package/dist/utils/zod/config.d.ts +1 -1
  59. package/dist/utils.js +38 -38
  60. package/dist/utils.mjs +34 -34
  61. package/package.json +18 -6
package/dist/main.js CHANGED
@@ -1,382 +1,177 @@
1
1
  "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
2
24
  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");
25
+ const config = require("./config-ClGS9Tic.js");
8
26
  const lodashEs = require("lodash-es");
9
27
  const viem = require("viem");
10
28
  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
- }
29
+ const KeyShares = require("./KeyShares-Bk9uzOlK.js");
30
+ var ClusterFeeAssetTypes = /* @__PURE__ */ ((ClusterFeeAssetTypes2) => {
31
+ ClusterFeeAssetTypes2["ETH"] = "ETH";
32
+ ClusterFeeAssetTypes2["SSV"] = "SSV";
33
+ return ClusterFeeAssetTypes2;
34
+ })(ClusterFeeAssetTypes || {});
35
+ 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": "_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": "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" } }] } }] } }] };
36
+ 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": "_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": "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" } }] } }] } }] };
37
+ 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": "_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": "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" } }] } }] } }] };
38
+ 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": "_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": "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" } }] } }] } }] };
39
+ 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" } }] } }] } }] };
40
+ 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": "_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": "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" } }] } }] } }] } }] };
41
+ 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": "_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": "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" } }] } }] } }] } }] };
42
+ 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": "_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": "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" } }] } }] } }] };
43
+ 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": "_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": "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" } }] } }] } }] };
44
+ 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" } }] } }] } }] };
45
+ 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": "_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" } }] } }] } }] };
46
+ const requireSafeNumber = (rawValue, fieldName) => {
47
+ if (rawValue === null || typeof rawValue === "undefined") {
48
+ throw new Error(`Could not resolve ${fieldName}`);
257
49
  }
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;
50
+ const value = BigInt(rawValue);
51
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
52
+ throw new Error(`${fieldName} exceeds MAX_SAFE_INTEGER`);
266
53
  }
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
- }
54
+ return Number(value);
55
+ };
56
+ const getSnapshotBlockNumber = (response) => {
57
+ if (response._meta?.block.number === null || typeof response._meta?.block.number === "undefined") {
58
+ throw new Error(
59
+ "Subgraph endpoint must support _meta.block.number for snapshot-aware SDK reads."
60
+ );
282
61
  }
283
- }
284
- const DotenvModule = {
285
- configDotenv,
286
- _configVault,
287
- _parseVault,
288
- config,
289
- decrypt,
290
- parse,
291
- populate
62
+ return requireSafeNumber(response._meta.block.number, "snapshot block number");
292
63
  };
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";
64
+ const mapOperator = (operator) => ({
65
+ ...operator,
66
+ publicKey: config.decodeOperatorPublicKey(operator.publicKey),
67
+ whitelisted: operator.whitelisted.map((v) => v.id)
68
+ });
69
+ const withSnapshotBlock = (response, payload) => ({
70
+ blockNumber: getSnapshotBlockNumber(response),
71
+ ...payload
72
+ });
73
+ const getOwnerNonce = async (client, args) => {
74
+ if (typeof args.block === "number") {
75
+ const response2 = await client.request(
76
+ GetOwnerNonceByBlockDocument,
77
+ args
78
+ );
79
+ return {
80
+ blockNumber: requireSafeNumber(args.block, "snapshot block number"),
81
+ nonce: requireSafeNumber(response2.account?.nonce ?? "0", "owner nonce")
82
+ };
333
83
  }
334
- return options2;
84
+ const response = await client.request(
85
+ GetOwnerNonceDocument,
86
+ args
87
+ );
88
+ return withSnapshotBlock(response, {
89
+ nonce: requireSafeNumber(response.account?.nonce ?? "0", "owner nonce")
90
+ });
335
91
  };
336
- (function() {
337
- mainExports.config(
338
- Object.assign(
339
- {},
340
- envOptions,
341
- cliOptions(process.argv)
342
- )
92
+ const getClusterSnapshot = async (client, args) => {
93
+ const response = await client.request(
94
+ GetClusterSnapshotDocument,
95
+ args
343
96
  );
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" } }] } }] } }] };
348
- 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
- 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
- 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" } }] } }] } }] } }] };
352
- 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
- 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" } }] } }] } }] };
355
- const getOwnerNonce = (client, args) => {
356
- const document = typeof args.block === "number" ? GetOwnerNonceByBlockDocument : GetOwnerNonceDocument;
357
- return client.request(document, args).then((r) => r.account?.nonce || "0").catch(() => "0");
97
+ return withSnapshotBlock(response, {
98
+ cluster: response.cluster
99
+ });
100
+ };
101
+ const getCluster = async (client, args) => {
102
+ const response = await client.request(
103
+ GetClusterDocument,
104
+ args
105
+ );
106
+ return withSnapshotBlock(response, {
107
+ cluster: response.cluster
108
+ });
109
+ };
110
+ const getClusters = async (client, args) => {
111
+ const response = await client.request(
112
+ GetClustersDocument,
113
+ args
114
+ );
115
+ return withSnapshotBlock(response, {
116
+ clusters: response.clusters
117
+ });
118
+ };
119
+ const getOperator = async (client, args) => {
120
+ const response = await client.request(
121
+ GetOperatorDocument,
122
+ args
123
+ );
124
+ return withSnapshotBlock(response, {
125
+ operator: response.operator ? mapOperator(response.operator) : null
126
+ });
127
+ };
128
+ const getOperators = async (client, args) => {
129
+ const response = await client.request(
130
+ GetOperatorsDocument,
131
+ args
132
+ );
133
+ return withSnapshotBlock(response, {
134
+ operators: response.operators.map(mapOperator)
135
+ });
136
+ };
137
+ const getValidators = async (client, args) => {
138
+ const response = await client.request(
139
+ GetValidatorsDocument,
140
+ args
141
+ );
142
+ return withSnapshotBlock(response, {
143
+ validators: response.validators
144
+ });
145
+ };
146
+ const getValidator = async (client, args) => {
147
+ const response = await client.request(
148
+ GetValidatorDocument,
149
+ args
150
+ );
151
+ return withSnapshotBlock(response, {
152
+ validator: response.validator
153
+ });
154
+ };
155
+ const getClusterBalance$1 = async (client, args) => {
156
+ const response = await client.request(
157
+ GetClusterBalanceDocument,
158
+ args
159
+ );
160
+ return withSnapshotBlock(response, {
161
+ cluster: response.cluster,
162
+ daovalues: response.daovalues,
163
+ operators: response.operators
164
+ });
165
+ };
166
+ const getDaoValues = async (client, args) => {
167
+ const response = await client.request(
168
+ GetDaoValuesDocument,
169
+ args
170
+ );
171
+ return withSnapshotBlock(response, {
172
+ daovalues: response.daovalues
173
+ });
358
174
  };
359
- const getClusterSnapshot = (client, args) => client.request(GetClusterSnapshotDocument, args).then((res) => res.cluster);
360
- const getCluster = (client, args) => client.request(GetClusterDocument, args).then((res) => res.cluster);
361
- const getClusters = (client, args) => client.request(GetClustersDocument, args).then((res) => res.clusters);
362
- const getOperator = (client, args) => client.request(GetOperatorDocument, args).then((res) => {
363
- if (!res.operator) return null;
364
- return {
365
- ...res.operator,
366
- publicKey: globals.decodeOperatorPublicKey(res.operator.publicKey),
367
- whitelisted: res.operator.whitelisted.map((v) => v.id)
368
- };
369
- });
370
- const getOperators = (client, args) => client.request(GetOperatorsDocument, args).then(
371
- (res) => res.operators.map((o) => ({
372
- ...o,
373
- publicKey: globals.decodeOperatorPublicKey(o.publicKey),
374
- whitelisted: o.whitelisted.map((v) => v.id)
375
- }))
376
- );
377
- const getValidators = (client, args) => client.request(GetValidatorsDocument, args).then((res) => res.validators);
378
- const getValidator = (client, args) => client.request(GetValidatorDocument, args).then((res) => res.validator);
379
- const getClusterBalance$1 = (client, args) => client.request(GetClusterBalanceDocument, args);
380
175
  const getQueries = (client) => ({
381
176
  getOwnerNonce: getOwnerNonce.bind(null, client),
382
177
  getClusterSnapshot: getClusterSnapshot.bind(null, client),
@@ -386,7 +181,8 @@ const getQueries = (client) => ({
386
181
  getOperators: getOperators.bind(null, client),
387
182
  getValidators: getValidators.bind(null, client),
388
183
  getValidator: getValidator.bind(null, client),
389
- getClusterBalance: getClusterBalance$1.bind(null, client)
184
+ getClusterBalance: getClusterBalance$1.bind(null, client),
185
+ getDaoValues: getDaoValues.bind(null, client)
390
186
  });
391
187
  const MainnetV4GetterABI = [
392
188
  {
@@ -405,6 +201,11 @@ const MainnetV4GetterABI = [
405
201
  name: "AddressIsWhitelistingContract",
406
202
  type: "error"
407
203
  },
204
+ {
205
+ inputs: [],
206
+ name: "AlreadyVoted",
207
+ type: "error"
208
+ },
408
209
  {
409
210
  inputs: [],
410
211
  name: "ApprovalNotWithinTimeframe",
@@ -454,7 +255,7 @@ const MainnetV4GetterABI = [
454
255
  },
455
256
  {
456
257
  inputs: [],
457
- name: "ClusterDoesNotExists",
258
+ name: "ClusterDoesNotExist",
458
259
  type: "error"
459
260
  },
460
261
  {
@@ -467,6 +268,21 @@ const MainnetV4GetterABI = [
467
268
  name: "ClusterNotLiquidatable",
468
269
  type: "error"
469
270
  },
271
+ {
272
+ inputs: [],
273
+ name: "EBBelowMinimum",
274
+ type: "error"
275
+ },
276
+ {
277
+ inputs: [],
278
+ name: "EBExceedsMaximum",
279
+ type: "error"
280
+ },
281
+ {
282
+ inputs: [],
283
+ name: "ETHTransferFailed",
284
+ type: "error"
285
+ },
470
286
  {
471
287
  inputs: [],
472
288
  name: "EmptyPublicKeysList",
@@ -514,11 +330,32 @@ const MainnetV4GetterABI = [
514
330
  name: "FeeTooLow",
515
331
  type: "error"
516
332
  },
333
+ {
334
+ inputs: [],
335
+ name: "FutureBlockNumber",
336
+ type: "error"
337
+ },
517
338
  {
518
339
  inputs: [],
519
340
  name: "IncorrectClusterState",
520
341
  type: "error"
521
342
  },
343
+ {
344
+ inputs: [],
345
+ name: "IncorrectClusterVersion",
346
+ type: "error"
347
+ },
348
+ {
349
+ inputs: [
350
+ {
351
+ internalType: "uint8",
352
+ name: "operatorVersion",
353
+ type: "uint8"
354
+ }
355
+ ],
356
+ name: "IncorrectOperatorVersion",
357
+ type: "error"
358
+ },
522
359
  {
523
360
  inputs: [],
524
361
  name: "IncorrectValidatorState",
@@ -542,7 +379,17 @@ const MainnetV4GetterABI = [
542
379
  },
543
380
  {
544
381
  inputs: [],
545
- name: "InvalidContractAddress",
382
+ name: "InsufficientCSSVSupply",
383
+ type: "error"
384
+ },
385
+ {
386
+ inputs: [],
387
+ name: "InvalidOperatorFeeIncreaseLimit",
388
+ type: "error"
389
+ },
390
+ {
391
+ inputs: [],
392
+ name: "InvalidOperatorFeeRange",
546
393
  type: "error"
547
394
  },
548
395
  {
@@ -550,11 +397,31 @@ const MainnetV4GetterABI = [
550
397
  name: "InvalidOperatorIdsLength",
551
398
  type: "error"
552
399
  },
400
+ {
401
+ inputs: [],
402
+ name: "InvalidOracleId",
403
+ type: "error"
404
+ },
405
+ {
406
+ inputs: [],
407
+ name: "InvalidProof",
408
+ type: "error"
409
+ },
553
410
  {
554
411
  inputs: [],
555
412
  name: "InvalidPublicKeyLength",
556
413
  type: "error"
557
414
  },
415
+ {
416
+ inputs: [],
417
+ name: "InvalidQuorum",
418
+ type: "error"
419
+ },
420
+ {
421
+ inputs: [],
422
+ name: "InvalidToken",
423
+ type: "error"
424
+ },
558
425
  {
559
426
  inputs: [],
560
427
  name: "InvalidWhitelistAddressesLength",
@@ -571,11 +438,31 @@ const MainnetV4GetterABI = [
571
438
  name: "InvalidWhitelistingContract",
572
439
  type: "error"
573
440
  },
441
+ {
442
+ inputs: [],
443
+ name: "LegacyOperatorFeeDeclarationInvalid",
444
+ type: "error"
445
+ },
446
+ {
447
+ inputs: [],
448
+ name: "MaxPrecisionExceeded",
449
+ type: "error"
450
+ },
451
+ {
452
+ inputs: [],
453
+ name: "MaxRequestsAmountReached",
454
+ type: "error"
455
+ },
574
456
  {
575
457
  inputs: [],
576
458
  name: "MaxValueExceeded",
577
459
  type: "error"
578
460
  },
461
+ {
462
+ inputs: [],
463
+ name: "MustUseLatestRoot",
464
+ type: "error"
465
+ },
579
466
  {
580
467
  inputs: [],
581
468
  name: "NewBlockPeriodIsBelowMinimum",
@@ -588,7 +475,22 @@ const MainnetV4GetterABI = [
588
475
  },
589
476
  {
590
477
  inputs: [],
591
- name: "NotAuthorized",
478
+ name: "NotCSSV",
479
+ type: "error"
480
+ },
481
+ {
482
+ inputs: [],
483
+ name: "NotOracle",
484
+ type: "error"
485
+ },
486
+ {
487
+ inputs: [],
488
+ name: "NothingToClaim",
489
+ type: "error"
490
+ },
491
+ {
492
+ inputs: [],
493
+ name: "NothingToWithdraw",
592
494
  type: "error"
593
495
  },
594
496
  {
@@ -606,16 +508,46 @@ const MainnetV4GetterABI = [
606
508
  name: "OperatorsListNotUnique",
607
509
  type: "error"
608
510
  },
511
+ {
512
+ inputs: [],
513
+ name: "OracleAlreadyAssigned",
514
+ type: "error"
515
+ },
609
516
  {
610
517
  inputs: [],
611
518
  name: "PublicKeysSharesLengthMismatch",
612
519
  type: "error"
613
520
  },
521
+ {
522
+ inputs: [],
523
+ name: "RootNotFound",
524
+ type: "error"
525
+ },
614
526
  {
615
527
  inputs: [],
616
528
  name: "SameFeeChangeNotAllowed",
617
529
  type: "error"
618
530
  },
531
+ {
532
+ inputs: [],
533
+ name: "SameOracleAddressNotAllowed",
534
+ type: "error"
535
+ },
536
+ {
537
+ inputs: [],
538
+ name: "StakeTooLow",
539
+ type: "error"
540
+ },
541
+ {
542
+ inputs: [],
543
+ name: "StaleBlockNumber",
544
+ type: "error"
545
+ },
546
+ {
547
+ inputs: [],
548
+ name: "StaleUpdate",
549
+ type: "error"
550
+ },
619
551
  {
620
552
  inputs: [],
621
553
  name: "TargetModuleDoesNotExist",
@@ -642,6 +574,16 @@ const MainnetV4GetterABI = [
642
574
  name: "UnsortedOperatorsList",
643
575
  type: "error"
644
576
  },
577
+ {
578
+ inputs: [],
579
+ name: "UnstakeAmountExceedsBalance",
580
+ type: "error"
581
+ },
582
+ {
583
+ inputs: [],
584
+ name: "UpdateTooFrequent",
585
+ type: "error"
586
+ },
645
587
  {
646
588
  inputs: [],
647
589
  name: "ValidatorAlreadyExists",
@@ -658,16 +600,47 @@ const MainnetV4GetterABI = [
658
600
  name: "ValidatorAlreadyExistsWithData",
659
601
  type: "error"
660
602
  },
603
+ {
604
+ inputs: [
605
+ {
606
+ internalType: "bytes",
607
+ name: "publicKey",
608
+ type: "bytes"
609
+ },
610
+ {
611
+ internalType: "address",
612
+ name: "owner",
613
+ type: "address"
614
+ }
615
+ ],
616
+ name: "ValidatorAlreadyRegistered",
617
+ type: "error"
618
+ },
661
619
  {
662
620
  inputs: [],
663
621
  name: "ValidatorDoesNotExist",
664
622
  type: "error"
665
623
  },
624
+ {
625
+ inputs: [],
626
+ name: "ZeroAddress",
627
+ type: "error"
628
+ },
666
629
  {
667
630
  inputs: [],
668
631
  name: "ZeroAddressNotAllowed",
669
632
  type: "error"
670
633
  },
634
+ {
635
+ inputs: [],
636
+ name: "ZeroAmount",
637
+ type: "error"
638
+ },
639
+ {
640
+ inputs: [],
641
+ name: "ZeroCSSVSupply",
642
+ type: "error"
643
+ },
671
644
  {
672
645
  anonymous: false,
673
646
  inputs: [
@@ -766,11 +739,50 @@ const MainnetV4GetterABI = [
766
739
  },
767
740
  {
768
741
  inputs: [],
769
- name: "acceptOwnership",
770
- outputs: [],
771
- stateMutability: "nonpayable",
772
- type: "function"
773
- },
742
+ name: "accEthPerShare",
743
+ outputs: [
744
+ {
745
+ internalType: "uint256",
746
+ name: "",
747
+ type: "uint256"
748
+ }
749
+ ],
750
+ stateMutability: "view",
751
+ type: "function"
752
+ },
753
+ {
754
+ inputs: [],
755
+ name: "acceptOwnership",
756
+ outputs: [],
757
+ stateMutability: "nonpayable",
758
+ type: "function"
759
+ },
760
+ {
761
+ inputs: [],
762
+ name: "cooldownDuration",
763
+ outputs: [
764
+ {
765
+ internalType: "uint256",
766
+ name: "",
767
+ type: "uint256"
768
+ }
769
+ ],
770
+ stateMutability: "view",
771
+ type: "function"
772
+ },
773
+ {
774
+ inputs: [],
775
+ name: "getActiveOracleIds",
776
+ outputs: [
777
+ {
778
+ internalType: "uint32[4]",
779
+ name: "",
780
+ type: "uint32[4]"
781
+ }
782
+ ],
783
+ stateMutability: "view",
784
+ type: "function"
785
+ },
774
786
  {
775
787
  inputs: [
776
788
  {
@@ -820,7 +832,63 @@ const MainnetV4GetterABI = [
820
832
  outputs: [
821
833
  {
822
834
  internalType: "uint256",
823
- name: "",
835
+ name: "balance",
836
+ type: "uint256"
837
+ }
838
+ ],
839
+ stateMutability: "view",
840
+ type: "function"
841
+ },
842
+ {
843
+ inputs: [
844
+ {
845
+ internalType: "address",
846
+ name: "clusterOwner",
847
+ type: "address"
848
+ },
849
+ {
850
+ internalType: "uint64[]",
851
+ name: "operatorIds",
852
+ type: "uint64[]"
853
+ },
854
+ {
855
+ components: [
856
+ {
857
+ internalType: "uint32",
858
+ name: "validatorCount",
859
+ type: "uint32"
860
+ },
861
+ {
862
+ internalType: "uint64",
863
+ name: "networkFeeIndex",
864
+ type: "uint64"
865
+ },
866
+ {
867
+ internalType: "uint64",
868
+ name: "index",
869
+ type: "uint64"
870
+ },
871
+ {
872
+ internalType: "bool",
873
+ name: "active",
874
+ type: "bool"
875
+ },
876
+ {
877
+ internalType: "uint256",
878
+ name: "balance",
879
+ type: "uint256"
880
+ }
881
+ ],
882
+ internalType: "struct ISSVNetworkCore.Cluster",
883
+ name: "cluster",
884
+ type: "tuple"
885
+ }
886
+ ],
887
+ name: "getBalanceSSV",
888
+ outputs: [
889
+ {
890
+ internalType: "uint256",
891
+ name: "balance",
824
892
  type: "uint256"
825
893
  }
826
894
  ],
@@ -883,6 +951,161 @@ const MainnetV4GetterABI = [
883
951
  stateMutability: "view",
884
952
  type: "function"
885
953
  },
954
+ {
955
+ inputs: [
956
+ {
957
+ internalType: "address",
958
+ name: "clusterOwner",
959
+ type: "address"
960
+ },
961
+ {
962
+ internalType: "uint64[]",
963
+ name: "operatorIds",
964
+ type: "uint64[]"
965
+ },
966
+ {
967
+ components: [
968
+ {
969
+ internalType: "uint32",
970
+ name: "validatorCount",
971
+ type: "uint32"
972
+ },
973
+ {
974
+ internalType: "uint64",
975
+ name: "networkFeeIndex",
976
+ type: "uint64"
977
+ },
978
+ {
979
+ internalType: "uint64",
980
+ name: "index",
981
+ type: "uint64"
982
+ },
983
+ {
984
+ internalType: "bool",
985
+ name: "active",
986
+ type: "bool"
987
+ },
988
+ {
989
+ internalType: "uint256",
990
+ name: "balance",
991
+ type: "uint256"
992
+ }
993
+ ],
994
+ internalType: "struct ISSVNetworkCore.Cluster",
995
+ name: "cluster",
996
+ type: "tuple"
997
+ }
998
+ ],
999
+ name: "getBurnRateSSV",
1000
+ outputs: [
1001
+ {
1002
+ internalType: "uint256",
1003
+ name: "",
1004
+ type: "uint256"
1005
+ }
1006
+ ],
1007
+ stateMutability: "view",
1008
+ type: "function"
1009
+ },
1010
+ {
1011
+ inputs: [
1012
+ {
1013
+ internalType: "address",
1014
+ name: "owner",
1015
+ type: "address"
1016
+ },
1017
+ {
1018
+ internalType: "uint64[]",
1019
+ name: "operatorIds",
1020
+ type: "uint64[]"
1021
+ }
1022
+ ],
1023
+ name: "getClusterAssetType",
1024
+ outputs: [
1025
+ {
1026
+ internalType: "uint8",
1027
+ name: "",
1028
+ type: "uint8"
1029
+ }
1030
+ ],
1031
+ stateMutability: "view",
1032
+ type: "function"
1033
+ },
1034
+ {
1035
+ inputs: [
1036
+ {
1037
+ internalType: "uint64",
1038
+ name: "blockNum",
1039
+ type: "uint64"
1040
+ }
1041
+ ],
1042
+ name: "getCommittedRoot",
1043
+ outputs: [
1044
+ {
1045
+ internalType: "bytes32",
1046
+ name: "",
1047
+ type: "bytes32"
1048
+ }
1049
+ ],
1050
+ stateMutability: "view",
1051
+ type: "function"
1052
+ },
1053
+ {
1054
+ inputs: [
1055
+ {
1056
+ internalType: "address",
1057
+ name: "clusterOwner",
1058
+ type: "address"
1059
+ },
1060
+ {
1061
+ internalType: "uint64[]",
1062
+ name: "operatorIds",
1063
+ type: "uint64[]"
1064
+ },
1065
+ {
1066
+ components: [
1067
+ {
1068
+ internalType: "uint32",
1069
+ name: "validatorCount",
1070
+ type: "uint32"
1071
+ },
1072
+ {
1073
+ internalType: "uint64",
1074
+ name: "networkFeeIndex",
1075
+ type: "uint64"
1076
+ },
1077
+ {
1078
+ internalType: "uint64",
1079
+ name: "index",
1080
+ type: "uint64"
1081
+ },
1082
+ {
1083
+ internalType: "bool",
1084
+ name: "active",
1085
+ type: "bool"
1086
+ },
1087
+ {
1088
+ internalType: "uint256",
1089
+ name: "balance",
1090
+ type: "uint256"
1091
+ }
1092
+ ],
1093
+ internalType: "struct ISSVNetworkCore.Cluster",
1094
+ name: "cluster",
1095
+ type: "tuple"
1096
+ }
1097
+ ],
1098
+ name: "getEffectiveBalance",
1099
+ outputs: [
1100
+ {
1101
+ internalType: "uint32",
1102
+ name: "effectiveBalance",
1103
+ type: "uint32"
1104
+ }
1105
+ ],
1106
+ stateMutability: "view",
1107
+ type: "function"
1108
+ },
886
1109
  {
887
1110
  inputs: [],
888
1111
  name: "getLiquidationThresholdPeriod",
@@ -898,7 +1121,7 @@ const MainnetV4GetterABI = [
898
1121
  },
899
1122
  {
900
1123
  inputs: [],
901
- name: "getMaximumOperatorFee",
1124
+ name: "getLiquidationThresholdPeriodSSV",
902
1125
  outputs: [
903
1126
  {
904
1127
  internalType: "uint64",
@@ -911,7 +1134,85 @@ const MainnetV4GetterABI = [
911
1134
  },
912
1135
  {
913
1136
  inputs: [],
914
- name: "getMinimumLiquidationCollateral",
1137
+ name: "getMaximumOperatorFee",
1138
+ outputs: [
1139
+ {
1140
+ internalType: "uint256",
1141
+ name: "",
1142
+ type: "uint256"
1143
+ }
1144
+ ],
1145
+ stateMutability: "view",
1146
+ type: "function"
1147
+ },
1148
+ {
1149
+ inputs: [],
1150
+ name: "getMaximumOperatorFeeSSV",
1151
+ outputs: [
1152
+ {
1153
+ internalType: "uint256",
1154
+ name: "",
1155
+ type: "uint256"
1156
+ }
1157
+ ],
1158
+ stateMutability: "view",
1159
+ type: "function"
1160
+ },
1161
+ {
1162
+ inputs: [],
1163
+ name: "getMinimumLiquidationCollateral",
1164
+ outputs: [
1165
+ {
1166
+ internalType: "uint256",
1167
+ name: "",
1168
+ type: "uint256"
1169
+ }
1170
+ ],
1171
+ stateMutability: "view",
1172
+ type: "function"
1173
+ },
1174
+ {
1175
+ inputs: [],
1176
+ name: "getMinimumLiquidationCollateralSSV",
1177
+ outputs: [
1178
+ {
1179
+ internalType: "uint256",
1180
+ name: "",
1181
+ type: "uint256"
1182
+ }
1183
+ ],
1184
+ stateMutability: "view",
1185
+ type: "function"
1186
+ },
1187
+ {
1188
+ inputs: [],
1189
+ name: "getMinimumOperatorEthFee",
1190
+ outputs: [
1191
+ {
1192
+ internalType: "uint256",
1193
+ name: "",
1194
+ type: "uint256"
1195
+ }
1196
+ ],
1197
+ stateMutability: "view",
1198
+ type: "function"
1199
+ },
1200
+ {
1201
+ inputs: [],
1202
+ name: "getNetworkEarnings",
1203
+ outputs: [
1204
+ {
1205
+ internalType: "uint256",
1206
+ name: "",
1207
+ type: "uint256"
1208
+ }
1209
+ ],
1210
+ stateMutability: "view",
1211
+ type: "function"
1212
+ },
1213
+ {
1214
+ inputs: [],
1215
+ name: "getNetworkEarningsSSV",
915
1216
  outputs: [
916
1217
  {
917
1218
  internalType: "uint256",
@@ -924,7 +1225,7 @@ const MainnetV4GetterABI = [
924
1225
  },
925
1226
  {
926
1227
  inputs: [],
927
- name: "getNetworkEarnings",
1228
+ name: "getNetworkFee",
928
1229
  outputs: [
929
1230
  {
930
1231
  internalType: "uint256",
@@ -937,7 +1238,7 @@ const MainnetV4GetterABI = [
937
1238
  },
938
1239
  {
939
1240
  inputs: [],
940
- name: "getNetworkFee",
1241
+ name: "getNetworkFeeSSV",
941
1242
  outputs: [
942
1243
  {
943
1244
  internalType: "uint256",
@@ -972,34 +1273,92 @@ const MainnetV4GetterABI = [
972
1273
  name: "getOperatorById",
973
1274
  outputs: [
974
1275
  {
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",
1276
+ components: [
1277
+ {
1278
+ internalType: "address",
1279
+ name: "owner",
1280
+ type: "address"
1281
+ },
1282
+ {
1283
+ internalType: "uint256",
1284
+ name: "fee",
1285
+ type: "uint256"
1286
+ },
1287
+ {
1288
+ internalType: "uint32",
1289
+ name: "validatorCount",
1290
+ type: "uint32"
1291
+ },
1292
+ {
1293
+ internalType: "address",
1294
+ name: "whitelistedAddress",
1295
+ type: "address"
1296
+ },
1297
+ {
1298
+ internalType: "bool",
1299
+ name: "isPrivate",
1300
+ type: "bool"
1301
+ },
1302
+ {
1303
+ internalType: "bool",
1304
+ name: "isActive",
1305
+ type: "bool"
1306
+ }
1307
+ ],
1308
+ internalType: "struct ISSVViewsTypes.OperatorData",
991
1309
  name: "",
992
- type: "address"
993
- },
1310
+ type: "tuple"
1311
+ }
1312
+ ],
1313
+ stateMutability: "view",
1314
+ type: "function"
1315
+ },
1316
+ {
1317
+ inputs: [
994
1318
  {
995
- internalType: "bool",
996
- name: "",
997
- type: "bool"
998
- },
1319
+ internalType: "uint64",
1320
+ name: "operatorId",
1321
+ type: "uint64"
1322
+ }
1323
+ ],
1324
+ name: "getOperatorByIdSSV",
1325
+ outputs: [
999
1326
  {
1000
- internalType: "bool",
1327
+ components: [
1328
+ {
1329
+ internalType: "address",
1330
+ name: "owner",
1331
+ type: "address"
1332
+ },
1333
+ {
1334
+ internalType: "uint256",
1335
+ name: "fee",
1336
+ type: "uint256"
1337
+ },
1338
+ {
1339
+ internalType: "uint32",
1340
+ name: "validatorCount",
1341
+ type: "uint32"
1342
+ },
1343
+ {
1344
+ internalType: "address",
1345
+ name: "whitelistedAddress",
1346
+ type: "address"
1347
+ },
1348
+ {
1349
+ internalType: "bool",
1350
+ name: "isPrivate",
1351
+ type: "bool"
1352
+ },
1353
+ {
1354
+ internalType: "bool",
1355
+ name: "isActive",
1356
+ type: "bool"
1357
+ }
1358
+ ],
1359
+ internalType: "struct ISSVViewsTypes.OperatorData",
1001
1360
  name: "",
1002
- type: "bool"
1361
+ type: "tuple"
1003
1362
  }
1004
1363
  ],
1005
1364
  stateMutability: "view",
@@ -1016,24 +1375,50 @@ const MainnetV4GetterABI = [
1016
1375
  name: "getOperatorDeclaredFee",
1017
1376
  outputs: [
1018
1377
  {
1019
- internalType: "bool",
1020
- name: "",
1021
- type: "bool"
1022
- },
1023
- {
1024
- internalType: "uint256",
1378
+ components: [
1379
+ {
1380
+ internalType: "bool",
1381
+ name: "isFeeDeclared",
1382
+ type: "bool"
1383
+ },
1384
+ {
1385
+ internalType: "uint256",
1386
+ name: "fee",
1387
+ type: "uint256"
1388
+ },
1389
+ {
1390
+ internalType: "uint64",
1391
+ name: "approvalBeginTime",
1392
+ type: "uint64"
1393
+ },
1394
+ {
1395
+ internalType: "uint64",
1396
+ name: "approvalEndTime",
1397
+ type: "uint64"
1398
+ }
1399
+ ],
1400
+ internalType: "struct ISSVViewsTypes.OperatorDeclaredFeeData",
1025
1401
  name: "",
1026
- type: "uint256"
1027
- },
1402
+ type: "tuple"
1403
+ }
1404
+ ],
1405
+ stateMutability: "view",
1406
+ type: "function"
1407
+ },
1408
+ {
1409
+ inputs: [
1028
1410
  {
1029
1411
  internalType: "uint64",
1030
- name: "",
1412
+ name: "id",
1031
1413
  type: "uint64"
1032
- },
1414
+ }
1415
+ ],
1416
+ name: "getOperatorEarnings",
1417
+ outputs: [
1033
1418
  {
1034
- internalType: "uint64",
1419
+ internalType: "uint256",
1035
1420
  name: "",
1036
- type: "uint64"
1421
+ type: "uint256"
1037
1422
  }
1038
1423
  ],
1039
1424
  stateMutability: "view",
@@ -1047,7 +1432,7 @@ const MainnetV4GetterABI = [
1047
1432
  type: "uint64"
1048
1433
  }
1049
1434
  ],
1050
- name: "getOperatorEarnings",
1435
+ name: "getOperatorEarningsSSV",
1051
1436
  outputs: [
1052
1437
  {
1053
1438
  internalType: "uint256",
@@ -1095,16 +1480,93 @@ const MainnetV4GetterABI = [
1095
1480
  name: "getOperatorFeePeriods",
1096
1481
  outputs: [
1097
1482
  {
1098
- internalType: "uint64",
1483
+ components: [
1484
+ {
1485
+ internalType: "uint64",
1486
+ name: "declarePeriod",
1487
+ type: "uint64"
1488
+ },
1489
+ {
1490
+ internalType: "uint64",
1491
+ name: "executePeriod",
1492
+ type: "uint64"
1493
+ }
1494
+ ],
1495
+ internalType: "struct ISSVViewsTypes.OperatorFeePeriodsData",
1099
1496
  name: "",
1100
- type: "uint64"
1101
- },
1497
+ type: "tuple"
1498
+ }
1499
+ ],
1500
+ stateMutability: "view",
1501
+ type: "function"
1502
+ },
1503
+ {
1504
+ inputs: [
1102
1505
  {
1103
1506
  internalType: "uint64",
1104
- name: "",
1507
+ name: "operatorId",
1105
1508
  type: "uint64"
1106
1509
  }
1107
1510
  ],
1511
+ name: "getOperatorFeeSSV",
1512
+ outputs: [
1513
+ {
1514
+ internalType: "uint256",
1515
+ name: "",
1516
+ type: "uint256"
1517
+ }
1518
+ ],
1519
+ stateMutability: "view",
1520
+ type: "function"
1521
+ },
1522
+ {
1523
+ inputs: [
1524
+ {
1525
+ internalType: "uint32",
1526
+ name: "oracleId",
1527
+ type: "uint32"
1528
+ }
1529
+ ],
1530
+ name: "getOracle",
1531
+ outputs: [
1532
+ {
1533
+ internalType: "address",
1534
+ name: "",
1535
+ type: "address"
1536
+ }
1537
+ ],
1538
+ stateMutability: "view",
1539
+ type: "function"
1540
+ },
1541
+ {
1542
+ inputs: [
1543
+ {
1544
+ internalType: "uint32",
1545
+ name: "oracleId",
1546
+ type: "uint32"
1547
+ }
1548
+ ],
1549
+ name: "getOracleWeight",
1550
+ outputs: [
1551
+ {
1552
+ internalType: "uint256",
1553
+ name: "",
1554
+ type: "uint256"
1555
+ }
1556
+ ],
1557
+ stateMutability: "view",
1558
+ type: "function"
1559
+ },
1560
+ {
1561
+ inputs: [],
1562
+ name: "getQuorumBps",
1563
+ outputs: [
1564
+ {
1565
+ internalType: "uint16",
1566
+ name: "",
1567
+ type: "uint16"
1568
+ }
1569
+ ],
1108
1570
  stateMutability: "view",
1109
1571
  type: "function"
1110
1572
  },
@@ -1213,11 +1675,67 @@ const MainnetV4GetterABI = [
1213
1675
  type: "address"
1214
1676
  }
1215
1677
  ],
1216
- name: "isAddressWhitelistedInWhitelistingContract",
1678
+ name: "isAddressWhitelistedInWhitelistingContract",
1679
+ outputs: [
1680
+ {
1681
+ internalType: "bool",
1682
+ name: "isWhitelisted",
1683
+ type: "bool"
1684
+ }
1685
+ ],
1686
+ stateMutability: "view",
1687
+ type: "function"
1688
+ },
1689
+ {
1690
+ inputs: [
1691
+ {
1692
+ internalType: "address",
1693
+ name: "clusterOwner",
1694
+ type: "address"
1695
+ },
1696
+ {
1697
+ internalType: "uint64[]",
1698
+ name: "operatorIds",
1699
+ type: "uint64[]"
1700
+ },
1701
+ {
1702
+ components: [
1703
+ {
1704
+ internalType: "uint32",
1705
+ name: "validatorCount",
1706
+ type: "uint32"
1707
+ },
1708
+ {
1709
+ internalType: "uint64",
1710
+ name: "networkFeeIndex",
1711
+ type: "uint64"
1712
+ },
1713
+ {
1714
+ internalType: "uint64",
1715
+ name: "index",
1716
+ type: "uint64"
1717
+ },
1718
+ {
1719
+ internalType: "bool",
1720
+ name: "active",
1721
+ type: "bool"
1722
+ },
1723
+ {
1724
+ internalType: "uint256",
1725
+ name: "balance",
1726
+ type: "uint256"
1727
+ }
1728
+ ],
1729
+ internalType: "struct ISSVNetworkCore.Cluster",
1730
+ name: "cluster",
1731
+ type: "tuple"
1732
+ }
1733
+ ],
1734
+ name: "isLiquidatable",
1217
1735
  outputs: [
1218
1736
  {
1219
1737
  internalType: "bool",
1220
- name: "isWhitelisted",
1738
+ name: "",
1221
1739
  type: "bool"
1222
1740
  }
1223
1741
  ],
@@ -1269,7 +1787,7 @@ const MainnetV4GetterABI = [
1269
1787
  type: "tuple"
1270
1788
  }
1271
1789
  ],
1272
- name: "isLiquidatable",
1790
+ name: "isLiquidatableSSV",
1273
1791
  outputs: [
1274
1792
  {
1275
1793
  internalType: "bool",
@@ -1381,6 +1899,56 @@ const MainnetV4GetterABI = [
1381
1899
  stateMutability: "view",
1382
1900
  type: "function"
1383
1901
  },
1902
+ {
1903
+ inputs: [
1904
+ {
1905
+ internalType: "address",
1906
+ name: "user",
1907
+ type: "address"
1908
+ }
1909
+ ],
1910
+ name: "pendingUnstake",
1911
+ outputs: [
1912
+ {
1913
+ components: [
1914
+ {
1915
+ internalType: "uint256",
1916
+ name: "amount",
1917
+ type: "uint256"
1918
+ },
1919
+ {
1920
+ internalType: "uint256",
1921
+ name: "unlockTime",
1922
+ type: "uint256"
1923
+ }
1924
+ ],
1925
+ internalType: "struct ISSVViewsTypes.UnstakeRequestsData[]",
1926
+ name: "",
1927
+ type: "tuple[]"
1928
+ }
1929
+ ],
1930
+ stateMutability: "view",
1931
+ type: "function"
1932
+ },
1933
+ {
1934
+ inputs: [
1935
+ {
1936
+ internalType: "address",
1937
+ name: "user",
1938
+ type: "address"
1939
+ }
1940
+ ],
1941
+ name: "previewClaimableEth",
1942
+ outputs: [
1943
+ {
1944
+ internalType: "uint256",
1945
+ name: "",
1946
+ type: "uint256"
1947
+ }
1948
+ ],
1949
+ stateMutability: "view",
1950
+ type: "function"
1951
+ },
1384
1952
  {
1385
1953
  inputs: [],
1386
1954
  name: "proxiableUUID",
@@ -1414,6 +1982,51 @@ const MainnetV4GetterABI = [
1414
1982
  stateMutability: "view",
1415
1983
  type: "function"
1416
1984
  },
1985
+ {
1986
+ inputs: [
1987
+ {
1988
+ internalType: "address",
1989
+ name: "user",
1990
+ type: "address"
1991
+ }
1992
+ ],
1993
+ name: "stakedBalanceOf",
1994
+ outputs: [
1995
+ {
1996
+ internalType: "uint256",
1997
+ name: "",
1998
+ type: "uint256"
1999
+ }
2000
+ ],
2001
+ stateMutability: "view",
2002
+ type: "function"
2003
+ },
2004
+ {
2005
+ inputs: [],
2006
+ name: "stakingEthPoolBalance",
2007
+ outputs: [
2008
+ {
2009
+ internalType: "uint256",
2010
+ name: "",
2011
+ type: "uint256"
2012
+ }
2013
+ ],
2014
+ stateMutability: "view",
2015
+ type: "function"
2016
+ },
2017
+ {
2018
+ inputs: [],
2019
+ name: "totalStaked",
2020
+ outputs: [
2021
+ {
2022
+ internalType: "uint256",
2023
+ name: "",
2024
+ type: "uint256"
2025
+ }
2026
+ ],
2027
+ stateMutability: "view",
2028
+ type: "function"
2029
+ },
1417
2030
  {
1418
2031
  inputs: [
1419
2032
  {
@@ -1476,6 +2089,11 @@ const MainnetV4SetterABI = [
1476
2089
  name: "AddressIsWhitelistingContract",
1477
2090
  type: "error"
1478
2091
  },
2092
+ {
2093
+ inputs: [],
2094
+ name: "AlreadyVoted",
2095
+ type: "error"
2096
+ },
1479
2097
  {
1480
2098
  inputs: [],
1481
2099
  name: "ApprovalNotWithinTimeframe",
@@ -1525,7 +2143,7 @@ const MainnetV4SetterABI = [
1525
2143
  },
1526
2144
  {
1527
2145
  inputs: [],
1528
- name: "ClusterDoesNotExists",
2146
+ name: "ClusterDoesNotExist",
1529
2147
  type: "error"
1530
2148
  },
1531
2149
  {
@@ -1538,6 +2156,21 @@ const MainnetV4SetterABI = [
1538
2156
  name: "ClusterNotLiquidatable",
1539
2157
  type: "error"
1540
2158
  },
2159
+ {
2160
+ inputs: [],
2161
+ name: "EBBelowMinimum",
2162
+ type: "error"
2163
+ },
2164
+ {
2165
+ inputs: [],
2166
+ name: "EBExceedsMaximum",
2167
+ type: "error"
2168
+ },
2169
+ {
2170
+ inputs: [],
2171
+ name: "ETHTransferFailed",
2172
+ type: "error"
2173
+ },
1541
2174
  {
1542
2175
  inputs: [],
1543
2176
  name: "EmptyPublicKeysList",
@@ -1585,11 +2218,32 @@ const MainnetV4SetterABI = [
1585
2218
  name: "FeeTooLow",
1586
2219
  type: "error"
1587
2220
  },
2221
+ {
2222
+ inputs: [],
2223
+ name: "FutureBlockNumber",
2224
+ type: "error"
2225
+ },
1588
2226
  {
1589
2227
  inputs: [],
1590
2228
  name: "IncorrectClusterState",
1591
2229
  type: "error"
1592
2230
  },
2231
+ {
2232
+ inputs: [],
2233
+ name: "IncorrectClusterVersion",
2234
+ type: "error"
2235
+ },
2236
+ {
2237
+ inputs: [
2238
+ {
2239
+ internalType: "uint8",
2240
+ name: "operatorVersion",
2241
+ type: "uint8"
2242
+ }
2243
+ ],
2244
+ name: "IncorrectOperatorVersion",
2245
+ type: "error"
2246
+ },
1593
2247
  {
1594
2248
  inputs: [],
1595
2249
  name: "IncorrectValidatorState",
@@ -1613,7 +2267,17 @@ const MainnetV4SetterABI = [
1613
2267
  },
1614
2268
  {
1615
2269
  inputs: [],
1616
- name: "InvalidContractAddress",
2270
+ name: "InsufficientCSSVSupply",
2271
+ type: "error"
2272
+ },
2273
+ {
2274
+ inputs: [],
2275
+ name: "InvalidOperatorFeeIncreaseLimit",
2276
+ type: "error"
2277
+ },
2278
+ {
2279
+ inputs: [],
2280
+ name: "InvalidOperatorFeeRange",
1617
2281
  type: "error"
1618
2282
  },
1619
2283
  {
@@ -1621,11 +2285,31 @@ const MainnetV4SetterABI = [
1621
2285
  name: "InvalidOperatorIdsLength",
1622
2286
  type: "error"
1623
2287
  },
2288
+ {
2289
+ inputs: [],
2290
+ name: "InvalidOracleId",
2291
+ type: "error"
2292
+ },
2293
+ {
2294
+ inputs: [],
2295
+ name: "InvalidProof",
2296
+ type: "error"
2297
+ },
1624
2298
  {
1625
2299
  inputs: [],
1626
2300
  name: "InvalidPublicKeyLength",
1627
2301
  type: "error"
1628
2302
  },
2303
+ {
2304
+ inputs: [],
2305
+ name: "InvalidQuorum",
2306
+ type: "error"
2307
+ },
2308
+ {
2309
+ inputs: [],
2310
+ name: "InvalidToken",
2311
+ type: "error"
2312
+ },
1629
2313
  {
1630
2314
  inputs: [],
1631
2315
  name: "InvalidWhitelistAddressesLength",
@@ -1642,11 +2326,31 @@ const MainnetV4SetterABI = [
1642
2326
  name: "InvalidWhitelistingContract",
1643
2327
  type: "error"
1644
2328
  },
2329
+ {
2330
+ inputs: [],
2331
+ name: "LegacyOperatorFeeDeclarationInvalid",
2332
+ type: "error"
2333
+ },
2334
+ {
2335
+ inputs: [],
2336
+ name: "MaxPrecisionExceeded",
2337
+ type: "error"
2338
+ },
2339
+ {
2340
+ inputs: [],
2341
+ name: "MaxRequestsAmountReached",
2342
+ type: "error"
2343
+ },
1645
2344
  {
1646
2345
  inputs: [],
1647
2346
  name: "MaxValueExceeded",
1648
2347
  type: "error"
1649
2348
  },
2349
+ {
2350
+ inputs: [],
2351
+ name: "MustUseLatestRoot",
2352
+ type: "error"
2353
+ },
1650
2354
  {
1651
2355
  inputs: [],
1652
2356
  name: "NewBlockPeriodIsBelowMinimum",
@@ -1659,7 +2363,22 @@ const MainnetV4SetterABI = [
1659
2363
  },
1660
2364
  {
1661
2365
  inputs: [],
1662
- name: "NotAuthorized",
2366
+ name: "NotCSSV",
2367
+ type: "error"
2368
+ },
2369
+ {
2370
+ inputs: [],
2371
+ name: "NotOracle",
2372
+ type: "error"
2373
+ },
2374
+ {
2375
+ inputs: [],
2376
+ name: "NothingToClaim",
2377
+ type: "error"
2378
+ },
2379
+ {
2380
+ inputs: [],
2381
+ name: "NothingToWithdraw",
1663
2382
  type: "error"
1664
2383
  },
1665
2384
  {
@@ -1677,16 +2396,46 @@ const MainnetV4SetterABI = [
1677
2396
  name: "OperatorsListNotUnique",
1678
2397
  type: "error"
1679
2398
  },
2399
+ {
2400
+ inputs: [],
2401
+ name: "OracleAlreadyAssigned",
2402
+ type: "error"
2403
+ },
1680
2404
  {
1681
2405
  inputs: [],
1682
2406
  name: "PublicKeysSharesLengthMismatch",
1683
2407
  type: "error"
1684
2408
  },
2409
+ {
2410
+ inputs: [],
2411
+ name: "RootNotFound",
2412
+ type: "error"
2413
+ },
1685
2414
  {
1686
2415
  inputs: [],
1687
2416
  name: "SameFeeChangeNotAllowed",
1688
2417
  type: "error"
1689
2418
  },
2419
+ {
2420
+ inputs: [],
2421
+ name: "SameOracleAddressNotAllowed",
2422
+ type: "error"
2423
+ },
2424
+ {
2425
+ inputs: [],
2426
+ name: "StakeTooLow",
2427
+ type: "error"
2428
+ },
2429
+ {
2430
+ inputs: [],
2431
+ name: "StaleBlockNumber",
2432
+ type: "error"
2433
+ },
2434
+ {
2435
+ inputs: [],
2436
+ name: "StaleUpdate",
2437
+ type: "error"
2438
+ },
1690
2439
  {
1691
2440
  inputs: [],
1692
2441
  name: "TargetModuleDoesNotExist",
@@ -1695,48 +2444,89 @@ const MainnetV4SetterABI = [
1695
2444
  {
1696
2445
  inputs: [
1697
2446
  {
1698
- internalType: "uint8",
1699
- name: "moduleId",
1700
- type: "uint8"
2447
+ internalType: "uint8",
2448
+ name: "moduleId",
2449
+ type: "uint8"
2450
+ }
2451
+ ],
2452
+ name: "TargetModuleDoesNotExistWithData",
2453
+ type: "error"
2454
+ },
2455
+ {
2456
+ inputs: [],
2457
+ name: "TokenTransferFailed",
2458
+ type: "error"
2459
+ },
2460
+ {
2461
+ inputs: [],
2462
+ name: "UnsortedOperatorsList",
2463
+ type: "error"
2464
+ },
2465
+ {
2466
+ inputs: [],
2467
+ name: "UnstakeAmountExceedsBalance",
2468
+ type: "error"
2469
+ },
2470
+ {
2471
+ inputs: [],
2472
+ name: "UpdateTooFrequent",
2473
+ type: "error"
2474
+ },
2475
+ {
2476
+ inputs: [],
2477
+ name: "ValidatorAlreadyExists",
2478
+ type: "error"
2479
+ },
2480
+ {
2481
+ inputs: [
2482
+ {
2483
+ internalType: "bytes",
2484
+ name: "publicKey",
2485
+ type: "bytes"
2486
+ }
2487
+ ],
2488
+ name: "ValidatorAlreadyExistsWithData",
2489
+ type: "error"
2490
+ },
2491
+ {
2492
+ inputs: [
2493
+ {
2494
+ internalType: "bytes",
2495
+ name: "publicKey",
2496
+ type: "bytes"
2497
+ },
2498
+ {
2499
+ internalType: "address",
2500
+ name: "owner",
2501
+ type: "address"
1701
2502
  }
1702
2503
  ],
1703
- name: "TargetModuleDoesNotExistWithData",
2504
+ name: "ValidatorAlreadyRegistered",
1704
2505
  type: "error"
1705
2506
  },
1706
2507
  {
1707
2508
  inputs: [],
1708
- name: "TokenTransferFailed",
2509
+ name: "ValidatorDoesNotExist",
1709
2510
  type: "error"
1710
2511
  },
1711
2512
  {
1712
2513
  inputs: [],
1713
- name: "UnsortedOperatorsList",
2514
+ name: "ZeroAddress",
1714
2515
  type: "error"
1715
2516
  },
1716
2517
  {
1717
2518
  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",
2519
+ name: "ZeroAddressNotAllowed",
1730
2520
  type: "error"
1731
2521
  },
1732
2522
  {
1733
2523
  inputs: [],
1734
- name: "ValidatorDoesNotExist",
2524
+ name: "ZeroAmount",
1735
2525
  type: "error"
1736
2526
  },
1737
2527
  {
1738
2528
  inputs: [],
1739
- name: "ZeroAddressNotAllowed",
2529
+ name: "ZeroCSSVSupply",
1740
2530
  type: "error"
1741
2531
  },
1742
2532
  {
@@ -1771,6 +2561,70 @@ const MainnetV4SetterABI = [
1771
2561
  name: "BeaconUpgraded",
1772
2562
  type: "event"
1773
2563
  },
2564
+ {
2565
+ anonymous: false,
2566
+ inputs: [
2567
+ {
2568
+ indexed: true,
2569
+ internalType: "address",
2570
+ name: "owner",
2571
+ type: "address"
2572
+ },
2573
+ {
2574
+ indexed: false,
2575
+ internalType: "uint64[]",
2576
+ name: "operatorIds",
2577
+ type: "uint64[]"
2578
+ },
2579
+ {
2580
+ indexed: true,
2581
+ internalType: "uint64",
2582
+ name: "blockNum",
2583
+ type: "uint64"
2584
+ },
2585
+ {
2586
+ indexed: false,
2587
+ internalType: "uint32",
2588
+ name: "effectiveBalance",
2589
+ type: "uint32"
2590
+ },
2591
+ {
2592
+ components: [
2593
+ {
2594
+ internalType: "uint32",
2595
+ name: "validatorCount",
2596
+ type: "uint32"
2597
+ },
2598
+ {
2599
+ internalType: "uint64",
2600
+ name: "networkFeeIndex",
2601
+ type: "uint64"
2602
+ },
2603
+ {
2604
+ internalType: "uint64",
2605
+ name: "index",
2606
+ type: "uint64"
2607
+ },
2608
+ {
2609
+ internalType: "bool",
2610
+ name: "active",
2611
+ type: "bool"
2612
+ },
2613
+ {
2614
+ internalType: "uint256",
2615
+ name: "balance",
2616
+ type: "uint256"
2617
+ }
2618
+ ],
2619
+ indexed: false,
2620
+ internalType: "struct ISSVNetworkCore.Cluster",
2621
+ name: "cluster",
2622
+ type: "tuple"
2623
+ }
2624
+ ],
2625
+ name: "ClusterBalanceUpdated",
2626
+ type: "event"
2627
+ },
1774
2628
  {
1775
2629
  anonymous: false,
1776
2630
  inputs: [
@@ -1881,6 +2735,76 @@ const MainnetV4SetterABI = [
1881
2735
  name: "ClusterLiquidated",
1882
2736
  type: "event"
1883
2737
  },
2738
+ {
2739
+ anonymous: false,
2740
+ inputs: [
2741
+ {
2742
+ indexed: true,
2743
+ internalType: "address",
2744
+ name: "owner",
2745
+ type: "address"
2746
+ },
2747
+ {
2748
+ indexed: false,
2749
+ internalType: "uint64[]",
2750
+ name: "operatorIds",
2751
+ type: "uint64[]"
2752
+ },
2753
+ {
2754
+ indexed: false,
2755
+ internalType: "uint256",
2756
+ name: "ethDeposited",
2757
+ type: "uint256"
2758
+ },
2759
+ {
2760
+ indexed: false,
2761
+ internalType: "uint256",
2762
+ name: "ssvRefunded",
2763
+ type: "uint256"
2764
+ },
2765
+ {
2766
+ indexed: false,
2767
+ internalType: "uint32",
2768
+ name: "effectiveBalance",
2769
+ type: "uint32"
2770
+ },
2771
+ {
2772
+ components: [
2773
+ {
2774
+ internalType: "uint32",
2775
+ name: "validatorCount",
2776
+ type: "uint32"
2777
+ },
2778
+ {
2779
+ internalType: "uint64",
2780
+ name: "networkFeeIndex",
2781
+ type: "uint64"
2782
+ },
2783
+ {
2784
+ internalType: "uint64",
2785
+ name: "index",
2786
+ type: "uint64"
2787
+ },
2788
+ {
2789
+ internalType: "bool",
2790
+ name: "active",
2791
+ type: "bool"
2792
+ },
2793
+ {
2794
+ internalType: "uint256",
2795
+ name: "balance",
2796
+ type: "uint256"
2797
+ }
2798
+ ],
2799
+ indexed: false,
2800
+ internalType: "struct ISSVNetworkCore.Cluster",
2801
+ name: "cluster",
2802
+ type: "tuple"
2803
+ }
2804
+ ],
2805
+ name: "ClusterMigratedToETH",
2806
+ type: "event"
2807
+ },
1884
2808
  {
1885
2809
  anonymous: false,
1886
2810
  inputs: [
@@ -1983,12 +2907,127 @@ const MainnetV4SetterABI = [
1983
2907
  }
1984
2908
  ],
1985
2909
  indexed: false,
1986
- internalType: "struct ISSVNetworkCore.Cluster",
1987
- name: "cluster",
1988
- type: "tuple"
2910
+ internalType: "struct ISSVNetworkCore.Cluster",
2911
+ name: "cluster",
2912
+ type: "tuple"
2913
+ }
2914
+ ],
2915
+ name: "ClusterWithdrawn",
2916
+ type: "event"
2917
+ },
2918
+ {
2919
+ anonymous: false,
2920
+ inputs: [
2921
+ {
2922
+ indexed: false,
2923
+ internalType: "uint64",
2924
+ name: "newCooldownDuration",
2925
+ type: "uint64"
2926
+ }
2927
+ ],
2928
+ name: "CooldownDurationUpdated",
2929
+ type: "event"
2930
+ },
2931
+ {
2932
+ anonymous: false,
2933
+ inputs: [
2934
+ {
2935
+ indexed: false,
2936
+ internalType: "uint64",
2937
+ name: "value",
2938
+ type: "uint64"
2939
+ }
2940
+ ],
2941
+ name: "DeclareOperatorFeePeriodUpdated",
2942
+ type: "event"
2943
+ },
2944
+ {
2945
+ anonymous: false,
2946
+ inputs: [
2947
+ {
2948
+ indexed: true,
2949
+ internalType: "address",
2950
+ name: "token",
2951
+ type: "address"
2952
+ },
2953
+ {
2954
+ indexed: true,
2955
+ internalType: "address",
2956
+ name: "to",
2957
+ type: "address"
2958
+ },
2959
+ {
2960
+ indexed: false,
2961
+ internalType: "uint256",
2962
+ name: "amount",
2963
+ type: "uint256"
2964
+ }
2965
+ ],
2966
+ name: "ERC20Rescued",
2967
+ type: "event"
2968
+ },
2969
+ {
2970
+ anonymous: false,
2971
+ inputs: [
2972
+ {
2973
+ indexed: false,
2974
+ internalType: "uint64",
2975
+ name: "value",
2976
+ type: "uint64"
2977
+ }
2978
+ ],
2979
+ name: "ExecuteOperatorFeePeriodUpdated",
2980
+ type: "event"
2981
+ },
2982
+ {
2983
+ anonymous: false,
2984
+ inputs: [
2985
+ {
2986
+ indexed: true,
2987
+ internalType: "address",
2988
+ name: "owner",
2989
+ type: "address"
2990
+ },
2991
+ {
2992
+ indexed: false,
2993
+ internalType: "address",
2994
+ name: "recipientAddress",
2995
+ type: "address"
2996
+ }
2997
+ ],
2998
+ name: "FeeRecipientAddressUpdated",
2999
+ type: "event"
3000
+ },
3001
+ {
3002
+ anonymous: false,
3003
+ inputs: [
3004
+ {
3005
+ indexed: false,
3006
+ internalType: "uint256",
3007
+ name: "newFeesWei",
3008
+ type: "uint256"
3009
+ },
3010
+ {
3011
+ indexed: false,
3012
+ internalType: "uint256",
3013
+ name: "accEthPerShare",
3014
+ type: "uint256"
3015
+ }
3016
+ ],
3017
+ name: "FeesSynced",
3018
+ type: "event"
3019
+ },
3020
+ {
3021
+ anonymous: false,
3022
+ inputs: [
3023
+ {
3024
+ indexed: false,
3025
+ internalType: "uint8",
3026
+ name: "version",
3027
+ type: "uint8"
1989
3028
  }
1990
3029
  ],
1991
- name: "ClusterWithdrawn",
3030
+ name: "Initialized",
1992
3031
  type: "event"
1993
3032
  },
1994
3033
  {
@@ -2001,7 +3040,7 @@ const MainnetV4SetterABI = [
2001
3040
  type: "uint64"
2002
3041
  }
2003
3042
  ],
2004
- name: "DeclareOperatorFeePeriodUpdated",
3043
+ name: "LiquidationThresholdPeriodSSVUpdated",
2005
3044
  type: "event"
2006
3045
  },
2007
3046
  {
@@ -2014,26 +3053,20 @@ const MainnetV4SetterABI = [
2014
3053
  type: "uint64"
2015
3054
  }
2016
3055
  ],
2017
- name: "ExecuteOperatorFeePeriodUpdated",
3056
+ name: "LiquidationThresholdPeriodUpdated",
2018
3057
  type: "event"
2019
3058
  },
2020
3059
  {
2021
3060
  anonymous: false,
2022
3061
  inputs: [
2023
- {
2024
- indexed: true,
2025
- internalType: "address",
2026
- name: "owner",
2027
- type: "address"
2028
- },
2029
3062
  {
2030
3063
  indexed: false,
2031
- internalType: "address",
2032
- name: "recipientAddress",
2033
- type: "address"
3064
+ internalType: "uint32",
3065
+ name: "newMinBlocksBetweenUpdates",
3066
+ type: "uint32"
2034
3067
  }
2035
3068
  ],
2036
- name: "FeeRecipientAddressUpdated",
3069
+ name: "MinBlocksBetweenUpdatesUpdated",
2037
3070
  type: "event"
2038
3071
  },
2039
3072
  {
@@ -2041,12 +3074,12 @@ const MainnetV4SetterABI = [
2041
3074
  inputs: [
2042
3075
  {
2043
3076
  indexed: false,
2044
- internalType: "uint8",
2045
- name: "version",
2046
- type: "uint8"
3077
+ internalType: "uint256",
3078
+ name: "value",
3079
+ type: "uint256"
2047
3080
  }
2048
3081
  ],
2049
- name: "Initialized",
3082
+ name: "MinimumLiquidationCollateralSSVUpdated",
2050
3083
  type: "event"
2051
3084
  },
2052
3085
  {
@@ -2054,12 +3087,12 @@ const MainnetV4SetterABI = [
2054
3087
  inputs: [
2055
3088
  {
2056
3089
  indexed: false,
2057
- internalType: "uint64",
3090
+ internalType: "uint256",
2058
3091
  name: "value",
2059
- type: "uint64"
3092
+ type: "uint256"
2060
3093
  }
2061
3094
  ],
2062
- name: "LiquidationThresholdPeriodUpdated",
3095
+ name: "MinimumLiquidationCollateralUpdated",
2063
3096
  type: "event"
2064
3097
  },
2065
3098
  {
@@ -2068,11 +3101,11 @@ const MainnetV4SetterABI = [
2068
3101
  {
2069
3102
  indexed: false,
2070
3103
  internalType: "uint256",
2071
- name: "value",
3104
+ name: "minFee",
2072
3105
  type: "uint256"
2073
3106
  }
2074
3107
  ],
2075
- name: "MinimumLiquidationCollateralUpdated",
3108
+ name: "MinimumOperatorEthFeeUpdated",
2076
3109
  type: "event"
2077
3110
  },
2078
3111
  {
@@ -2132,6 +3165,25 @@ const MainnetV4SetterABI = [
2132
3165
  name: "NetworkFeeUpdated",
2133
3166
  type: "event"
2134
3167
  },
3168
+ {
3169
+ anonymous: false,
3170
+ inputs: [
3171
+ {
3172
+ indexed: false,
3173
+ internalType: "uint256",
3174
+ name: "oldFee",
3175
+ type: "uint256"
3176
+ },
3177
+ {
3178
+ indexed: false,
3179
+ internalType: "uint256",
3180
+ name: "newFee",
3181
+ type: "uint256"
3182
+ }
3183
+ ],
3184
+ name: "NetworkFeeUpdatedSSV",
3185
+ type: "event"
3186
+ },
2135
3187
  {
2136
3188
  anonymous: false,
2137
3189
  inputs: [
@@ -2262,9 +3314,9 @@ const MainnetV4SetterABI = [
2262
3314
  inputs: [
2263
3315
  {
2264
3316
  indexed: false,
2265
- internalType: "uint64",
3317
+ internalType: "uint256",
2266
3318
  name: "maxFee",
2267
- type: "uint64"
3319
+ type: "uint256"
2268
3320
  }
2269
3321
  ],
2270
3322
  name: "OperatorMaximumFeeUpdated",
@@ -2403,6 +3455,75 @@ const MainnetV4SetterABI = [
2403
3455
  name: "OperatorWithdrawn",
2404
3456
  type: "event"
2405
3457
  },
3458
+ {
3459
+ anonymous: false,
3460
+ inputs: [
3461
+ {
3462
+ indexed: true,
3463
+ internalType: "address",
3464
+ name: "owner",
3465
+ type: "address"
3466
+ },
3467
+ {
3468
+ indexed: true,
3469
+ internalType: "uint64",
3470
+ name: "operatorId",
3471
+ type: "uint64"
3472
+ },
3473
+ {
3474
+ indexed: false,
3475
+ internalType: "uint256",
3476
+ name: "value",
3477
+ type: "uint256"
3478
+ }
3479
+ ],
3480
+ name: "OperatorWithdrawnSSV",
3481
+ type: "event"
3482
+ },
3483
+ {
3484
+ anonymous: false,
3485
+ inputs: [
3486
+ {
3487
+ indexed: true,
3488
+ internalType: "uint32",
3489
+ name: "oracleId",
3490
+ type: "uint32"
3491
+ },
3492
+ {
3493
+ indexed: true,
3494
+ internalType: "address",
3495
+ name: "oldOracle",
3496
+ type: "address"
3497
+ },
3498
+ {
3499
+ indexed: true,
3500
+ internalType: "address",
3501
+ name: "newOracle",
3502
+ type: "address"
3503
+ }
3504
+ ],
3505
+ name: "OracleReplaced",
3506
+ type: "event"
3507
+ },
3508
+ {
3509
+ anonymous: false,
3510
+ inputs: [
3511
+ {
3512
+ indexed: true,
3513
+ internalType: "address",
3514
+ name: "previousOwner",
3515
+ type: "address"
3516
+ },
3517
+ {
3518
+ indexed: true,
3519
+ internalType: "address",
3520
+ name: "newOwner",
3521
+ type: "address"
3522
+ }
3523
+ ],
3524
+ name: "OwnershipTransferStarted",
3525
+ type: "event"
3526
+ },
2406
3527
  {
2407
3528
  anonymous: false,
2408
3529
  inputs: [
@@ -2413,13 +3534,158 @@ const MainnetV4SetterABI = [
2413
3534
  type: "address"
2414
3535
  },
2415
3536
  {
2416
- indexed: true,
2417
- internalType: "address",
2418
- name: "newOwner",
2419
- type: "address"
3537
+ indexed: true,
3538
+ internalType: "address",
3539
+ name: "newOwner",
3540
+ type: "address"
3541
+ }
3542
+ ],
3543
+ name: "OwnershipTransferred",
3544
+ type: "event"
3545
+ },
3546
+ {
3547
+ anonymous: false,
3548
+ inputs: [
3549
+ {
3550
+ indexed: false,
3551
+ internalType: "uint16",
3552
+ name: "newQuorum",
3553
+ type: "uint16"
3554
+ }
3555
+ ],
3556
+ name: "QuorumUpdated",
3557
+ type: "event"
3558
+ },
3559
+ {
3560
+ anonymous: false,
3561
+ inputs: [
3562
+ {
3563
+ indexed: true,
3564
+ internalType: "address",
3565
+ name: "user",
3566
+ type: "address"
3567
+ },
3568
+ {
3569
+ indexed: false,
3570
+ internalType: "uint256",
3571
+ name: "amount",
3572
+ type: "uint256"
3573
+ }
3574
+ ],
3575
+ name: "RewardsClaimed",
3576
+ type: "event"
3577
+ },
3578
+ {
3579
+ anonymous: false,
3580
+ inputs: [
3581
+ {
3582
+ indexed: true,
3583
+ internalType: "address",
3584
+ name: "user",
3585
+ type: "address"
3586
+ },
3587
+ {
3588
+ indexed: false,
3589
+ internalType: "uint256",
3590
+ name: "pending",
3591
+ type: "uint256"
3592
+ },
3593
+ {
3594
+ indexed: false,
3595
+ internalType: "uint256",
3596
+ name: "accrued",
3597
+ type: "uint256"
3598
+ },
3599
+ {
3600
+ indexed: false,
3601
+ internalType: "uint256",
3602
+ name: "userIndex",
3603
+ type: "uint256"
3604
+ }
3605
+ ],
3606
+ name: "RewardsSettled",
3607
+ type: "event"
3608
+ },
3609
+ {
3610
+ anonymous: false,
3611
+ inputs: [
3612
+ {
3613
+ indexed: true,
3614
+ internalType: "bytes32",
3615
+ name: "merkleRoot",
3616
+ type: "bytes32"
3617
+ },
3618
+ {
3619
+ indexed: true,
3620
+ internalType: "uint64",
3621
+ name: "blockNum",
3622
+ type: "uint64"
3623
+ }
3624
+ ],
3625
+ name: "RootCommitted",
3626
+ type: "event"
3627
+ },
3628
+ {
3629
+ anonymous: false,
3630
+ inputs: [
3631
+ {
3632
+ indexed: false,
3633
+ internalType: "string",
3634
+ name: "version",
3635
+ type: "string"
3636
+ },
3637
+ {
3638
+ indexed: false,
3639
+ internalType: "uint256",
3640
+ name: "blockNumber",
3641
+ type: "uint256"
3642
+ }
3643
+ ],
3644
+ name: "SSVNetworkUpgradeBlock",
3645
+ type: "event"
3646
+ },
3647
+ {
3648
+ anonymous: false,
3649
+ inputs: [
3650
+ {
3651
+ indexed: true,
3652
+ internalType: "address",
3653
+ name: "user",
3654
+ type: "address"
3655
+ },
3656
+ {
3657
+ indexed: false,
3658
+ internalType: "uint256",
3659
+ name: "amount",
3660
+ type: "uint256"
3661
+ }
3662
+ ],
3663
+ name: "Staked",
3664
+ type: "event"
3665
+ },
3666
+ {
3667
+ anonymous: false,
3668
+ inputs: [
3669
+ {
3670
+ indexed: true,
3671
+ internalType: "address",
3672
+ name: "user",
3673
+ type: "address"
3674
+ },
3675
+ {
3676
+ indexed: false,
3677
+ internalType: "uint256",
3678
+ name: "amount",
3679
+ type: "uint256"
3680
+ },
3681
+ {
3682
+ indexed: false,
3683
+ internalType: "uint256",
3684
+ name: "unlockTime",
3685
+ type: "uint256"
2420
3686
  }
2421
3687
  ],
2422
- name: "OwnershipTransferStarted",
3688
+ name: "UnstakeRequested",
2423
3689
  type: "event"
2424
3690
  },
2425
3691
  {
@@ -2428,17 +3694,17 @@ const MainnetV4SetterABI = [
2428
3694
  {
2429
3695
  indexed: true,
2430
3696
  internalType: "address",
2431
- name: "previousOwner",
3697
+ name: "user",
2432
3698
  type: "address"
2433
3699
  },
2434
3700
  {
2435
- indexed: true,
2436
- internalType: "address",
2437
- name: "newOwner",
2438
- type: "address"
3701
+ indexed: false,
3702
+ internalType: "uint256",
3703
+ name: "amount",
3704
+ type: "uint256"
2439
3705
  }
2440
3706
  ],
2441
- name: "OwnershipTransferred",
3707
+ name: "UnstakedWithdrawn",
2442
3708
  type: "event"
2443
3709
  },
2444
3710
  {
@@ -2601,6 +3867,49 @@ const MainnetV4SetterABI = [
2601
3867
  name: "ValidatorRemoved",
2602
3868
  type: "event"
2603
3869
  },
3870
+ {
3871
+ anonymous: false,
3872
+ inputs: [
3873
+ {
3874
+ indexed: true,
3875
+ internalType: "bytes32",
3876
+ name: "merkleRoot",
3877
+ type: "bytes32"
3878
+ },
3879
+ {
3880
+ indexed: true,
3881
+ internalType: "uint64",
3882
+ name: "blockNum",
3883
+ type: "uint64"
3884
+ },
3885
+ {
3886
+ indexed: false,
3887
+ internalType: "uint256",
3888
+ name: "accumulatedWeight",
3889
+ type: "uint256"
3890
+ },
3891
+ {
3892
+ indexed: false,
3893
+ internalType: "uint256",
3894
+ name: "quorum",
3895
+ type: "uint256"
3896
+ },
3897
+ {
3898
+ indexed: false,
3899
+ internalType: "uint32",
3900
+ name: "oracleId",
3901
+ type: "uint32"
3902
+ },
3903
+ {
3904
+ indexed: false,
3905
+ internalType: "address",
3906
+ name: "oracle",
3907
+ type: "address"
3908
+ }
3909
+ ],
3910
+ name: "WeightedRootProposed",
3911
+ type: "event"
3912
+ },
2604
3913
  {
2605
3914
  stateMutability: "nonpayable",
2606
3915
  type: "fallback"
@@ -2647,11 +3956,6 @@ const MainnetV4SetterABI = [
2647
3956
  name: "sharesData",
2648
3957
  type: "bytes[]"
2649
3958
  },
2650
- {
2651
- internalType: "uint256",
2652
- name: "amount",
2653
- type: "uint256"
2654
- },
2655
3959
  {
2656
3960
  components: [
2657
3961
  {
@@ -2687,7 +3991,7 @@ const MainnetV4SetterABI = [
2687
3991
  ],
2688
3992
  name: "bulkRegisterValidator",
2689
3993
  outputs: [],
2690
- stateMutability: "nonpayable",
3994
+ stateMutability: "payable",
2691
3995
  type: "function"
2692
3996
  },
2693
3997
  {
@@ -2753,6 +4057,31 @@ const MainnetV4SetterABI = [
2753
4057
  stateMutability: "nonpayable",
2754
4058
  type: "function"
2755
4059
  },
4060
+ {
4061
+ inputs: [],
4062
+ name: "claimEthRewards",
4063
+ outputs: [],
4064
+ stateMutability: "nonpayable",
4065
+ type: "function"
4066
+ },
4067
+ {
4068
+ inputs: [
4069
+ {
4070
+ internalType: "bytes32",
4071
+ name: "merkleRoot",
4072
+ type: "bytes32"
4073
+ },
4074
+ {
4075
+ internalType: "uint64",
4076
+ name: "blockNum",
4077
+ type: "uint64"
4078
+ }
4079
+ ],
4080
+ name: "commitRoot",
4081
+ outputs: [],
4082
+ stateMutability: "nonpayable",
4083
+ type: "function"
4084
+ },
2756
4085
  {
2757
4086
  inputs: [
2758
4087
  {
@@ -2783,11 +4112,6 @@ const MainnetV4SetterABI = [
2783
4112
  name: "operatorIds",
2784
4113
  type: "uint64[]"
2785
4114
  },
2786
- {
2787
- internalType: "uint256",
2788
- name: "amount",
2789
- type: "uint256"
2790
- },
2791
4115
  {
2792
4116
  components: [
2793
4117
  {
@@ -2823,7 +4147,7 @@ const MainnetV4SetterABI = [
2823
4147
  ],
2824
4148
  name: "deposit",
2825
4149
  outputs: [],
2826
- stateMutability: "nonpayable",
4150
+ stateMutability: "payable",
2827
4151
  type: "function"
2828
4152
  },
2829
4153
  {
@@ -2898,37 +4222,104 @@ const MainnetV4SetterABI = [
2898
4222
  type: "address"
2899
4223
  },
2900
4224
  {
2901
- internalType: "uint64",
2902
- name: "minimumBlocksBeforeLiquidation_",
2903
- type: "uint64"
2904
- },
2905
- {
2906
- internalType: "uint256",
2907
- name: "minimumLiquidationCollateral_",
2908
- type: "uint256"
2909
- },
2910
- {
2911
- internalType: "uint32",
2912
- name: "validatorsPerOperatorLimit_",
2913
- type: "uint32"
2914
- },
4225
+ components: [
4226
+ {
4227
+ internalType: "uint64",
4228
+ name: "minimumBlocksBeforeLiquidation",
4229
+ type: "uint64"
4230
+ },
4231
+ {
4232
+ internalType: "uint256",
4233
+ name: "minimumLiquidationCollateral",
4234
+ type: "uint256"
4235
+ },
4236
+ {
4237
+ internalType: "uint32",
4238
+ name: "validatorsPerOperatorLimit",
4239
+ type: "uint32"
4240
+ },
4241
+ {
4242
+ internalType: "uint64",
4243
+ name: "declareOperatorFeePeriod",
4244
+ type: "uint64"
4245
+ },
4246
+ {
4247
+ internalType: "uint64",
4248
+ name: "executeOperatorFeePeriod",
4249
+ type: "uint64"
4250
+ },
4251
+ {
4252
+ internalType: "uint64",
4253
+ name: "operatorMaxFeeIncrease",
4254
+ type: "uint64"
4255
+ },
4256
+ {
4257
+ internalType: "uint32[4]",
4258
+ name: "defaultOracleIds",
4259
+ type: "uint32[4]"
4260
+ },
4261
+ {
4262
+ internalType: "uint16",
4263
+ name: "quorumBps",
4264
+ type: "uint16"
4265
+ }
4266
+ ],
4267
+ internalType: "struct ISSVNetwork.NetworkInitParams",
4268
+ name: "params",
4269
+ type: "tuple"
4270
+ }
4271
+ ],
4272
+ name: "initialize",
4273
+ outputs: [],
4274
+ stateMutability: "nonpayable",
4275
+ type: "function"
4276
+ },
4277
+ {
4278
+ inputs: [
2915
4279
  {
2916
- internalType: "uint64",
2917
- name: "declareOperatorFeePeriod_",
2918
- type: "uint64"
4280
+ internalType: "address",
4281
+ name: "clusterOwner",
4282
+ type: "address"
2919
4283
  },
2920
4284
  {
2921
- internalType: "uint64",
2922
- name: "executeOperatorFeePeriod_",
2923
- type: "uint64"
4285
+ internalType: "uint64[]",
4286
+ name: "operatorIds",
4287
+ type: "uint64[]"
2924
4288
  },
2925
4289
  {
2926
- internalType: "uint64",
2927
- name: "operatorMaxFeeIncrease_",
2928
- type: "uint64"
4290
+ components: [
4291
+ {
4292
+ internalType: "uint32",
4293
+ name: "validatorCount",
4294
+ type: "uint32"
4295
+ },
4296
+ {
4297
+ internalType: "uint64",
4298
+ name: "networkFeeIndex",
4299
+ type: "uint64"
4300
+ },
4301
+ {
4302
+ internalType: "uint64",
4303
+ name: "index",
4304
+ type: "uint64"
4305
+ },
4306
+ {
4307
+ internalType: "bool",
4308
+ name: "active",
4309
+ type: "bool"
4310
+ },
4311
+ {
4312
+ internalType: "uint256",
4313
+ name: "balance",
4314
+ type: "uint256"
4315
+ }
4316
+ ],
4317
+ internalType: "struct ISSVNetworkCore.Cluster",
4318
+ name: "cluster",
4319
+ type: "tuple"
2929
4320
  }
2930
4321
  ],
2931
- name: "initialize",
4322
+ name: "liquidate",
2932
4323
  outputs: [],
2933
4324
  stateMutability: "nonpayable",
2934
4325
  type: "function"
@@ -2978,7 +4369,75 @@ const MainnetV4SetterABI = [
2978
4369
  type: "tuple"
2979
4370
  }
2980
4371
  ],
2981
- name: "liquidate",
4372
+ name: "liquidateSSV",
4373
+ outputs: [],
4374
+ stateMutability: "nonpayable",
4375
+ type: "function"
4376
+ },
4377
+ {
4378
+ inputs: [
4379
+ {
4380
+ internalType: "uint64[]",
4381
+ name: "operatorIds",
4382
+ type: "uint64[]"
4383
+ },
4384
+ {
4385
+ components: [
4386
+ {
4387
+ internalType: "uint32",
4388
+ name: "validatorCount",
4389
+ type: "uint32"
4390
+ },
4391
+ {
4392
+ internalType: "uint64",
4393
+ name: "networkFeeIndex",
4394
+ type: "uint64"
4395
+ },
4396
+ {
4397
+ internalType: "uint64",
4398
+ name: "index",
4399
+ type: "uint64"
4400
+ },
4401
+ {
4402
+ internalType: "bool",
4403
+ name: "active",
4404
+ type: "bool"
4405
+ },
4406
+ {
4407
+ internalType: "uint256",
4408
+ name: "balance",
4409
+ type: "uint256"
4410
+ }
4411
+ ],
4412
+ internalType: "struct ISSVNetworkCore.Cluster",
4413
+ name: "cluster",
4414
+ type: "tuple"
4415
+ }
4416
+ ],
4417
+ name: "migrateClusterToETH",
4418
+ outputs: [],
4419
+ stateMutability: "payable",
4420
+ type: "function"
4421
+ },
4422
+ {
4423
+ inputs: [
4424
+ {
4425
+ internalType: "address",
4426
+ name: "from",
4427
+ type: "address"
4428
+ },
4429
+ {
4430
+ internalType: "address",
4431
+ name: "to",
4432
+ type: "address"
4433
+ },
4434
+ {
4435
+ internalType: "uint256",
4436
+ name: "amount",
4437
+ type: "uint256"
4438
+ }
4439
+ ],
4440
+ name: "onCSSVTransfer",
2982
4441
  outputs: [],
2983
4442
  stateMutability: "nonpayable",
2984
4443
  type: "function"
@@ -3029,11 +4488,6 @@ const MainnetV4SetterABI = [
3029
4488
  name: "operatorIds",
3030
4489
  type: "uint64[]"
3031
4490
  },
3032
- {
3033
- internalType: "uint256",
3034
- name: "amount",
3035
- type: "uint256"
3036
- },
3037
4491
  {
3038
4492
  components: [
3039
4493
  {
@@ -3069,7 +4523,7 @@ const MainnetV4SetterABI = [
3069
4523
  ],
3070
4524
  name: "reactivate",
3071
4525
  outputs: [],
3072
- stateMutability: "nonpayable",
4526
+ stateMutability: "payable",
3073
4527
  type: "function"
3074
4528
  },
3075
4529
  {
@@ -3136,11 +4590,6 @@ const MainnetV4SetterABI = [
3136
4590
  name: "sharesData",
3137
4591
  type: "bytes"
3138
4592
  },
3139
- {
3140
- internalType: "uint256",
3141
- name: "amount",
3142
- type: "uint256"
3143
- },
3144
4593
  {
3145
4594
  components: [
3146
4595
  {
@@ -3176,7 +4625,7 @@ const MainnetV4SetterABI = [
3176
4625
  ],
3177
4626
  name: "registerValidator",
3178
4627
  outputs: [],
3179
- stateMutability: "nonpayable",
4628
+ stateMutability: "payable",
3180
4629
  type: "function"
3181
4630
  },
3182
4631
  {
@@ -3280,6 +4729,60 @@ const MainnetV4SetterABI = [
3280
4729
  stateMutability: "nonpayable",
3281
4730
  type: "function"
3282
4731
  },
4732
+ {
4733
+ inputs: [
4734
+ {
4735
+ internalType: "uint32",
4736
+ name: "oracleId",
4737
+ type: "uint32"
4738
+ },
4739
+ {
4740
+ internalType: "address",
4741
+ name: "newOracle",
4742
+ type: "address"
4743
+ }
4744
+ ],
4745
+ name: "replaceOracle",
4746
+ outputs: [],
4747
+ stateMutability: "nonpayable",
4748
+ type: "function"
4749
+ },
4750
+ {
4751
+ inputs: [
4752
+ {
4753
+ internalType: "uint256",
4754
+ name: "amount",
4755
+ type: "uint256"
4756
+ }
4757
+ ],
4758
+ name: "requestUnstake",
4759
+ outputs: [],
4760
+ stateMutability: "nonpayable",
4761
+ type: "function"
4762
+ },
4763
+ {
4764
+ inputs: [
4765
+ {
4766
+ internalType: "address",
4767
+ name: "token",
4768
+ type: "address"
4769
+ },
4770
+ {
4771
+ internalType: "address",
4772
+ name: "to",
4773
+ type: "address"
4774
+ },
4775
+ {
4776
+ internalType: "uint256",
4777
+ name: "amount",
4778
+ type: "uint256"
4779
+ }
4780
+ ],
4781
+ name: "rescueERC20",
4782
+ outputs: [],
4783
+ stateMutability: "nonpayable",
4784
+ type: "function"
4785
+ },
3283
4786
  {
3284
4787
  inputs: [
3285
4788
  {
@@ -3355,6 +4858,26 @@ const MainnetV4SetterABI = [
3355
4858
  stateMutability: "nonpayable",
3356
4859
  type: "function"
3357
4860
  },
4861
+ {
4862
+ inputs: [
4863
+ {
4864
+ internalType: "uint256",
4865
+ name: "amount",
4866
+ type: "uint256"
4867
+ }
4868
+ ],
4869
+ name: "stake",
4870
+ outputs: [],
4871
+ stateMutability: "nonpayable",
4872
+ type: "function"
4873
+ },
4874
+ {
4875
+ inputs: [],
4876
+ name: "syncFees",
4877
+ outputs: [],
4878
+ stateMutability: "nonpayable",
4879
+ type: "function"
4880
+ },
3358
4881
  {
3359
4882
  inputs: [
3360
4883
  {
@@ -3368,6 +4891,71 @@ const MainnetV4SetterABI = [
3368
4891
  stateMutability: "nonpayable",
3369
4892
  type: "function"
3370
4893
  },
4894
+ {
4895
+ inputs: [
4896
+ {
4897
+ internalType: "uint64",
4898
+ name: "blockNum",
4899
+ type: "uint64"
4900
+ },
4901
+ {
4902
+ internalType: "address",
4903
+ name: "clusterOwner",
4904
+ type: "address"
4905
+ },
4906
+ {
4907
+ internalType: "uint64[]",
4908
+ name: "operatorIds",
4909
+ type: "uint64[]"
4910
+ },
4911
+ {
4912
+ components: [
4913
+ {
4914
+ internalType: "uint32",
4915
+ name: "validatorCount",
4916
+ type: "uint32"
4917
+ },
4918
+ {
4919
+ internalType: "uint64",
4920
+ name: "networkFeeIndex",
4921
+ type: "uint64"
4922
+ },
4923
+ {
4924
+ internalType: "uint64",
4925
+ name: "index",
4926
+ type: "uint64"
4927
+ },
4928
+ {
4929
+ internalType: "bool",
4930
+ name: "active",
4931
+ type: "bool"
4932
+ },
4933
+ {
4934
+ internalType: "uint256",
4935
+ name: "balance",
4936
+ type: "uint256"
4937
+ }
4938
+ ],
4939
+ internalType: "struct ISSVNetworkCore.Cluster",
4940
+ name: "cluster",
4941
+ type: "tuple"
4942
+ },
4943
+ {
4944
+ internalType: "uint32",
4945
+ name: "effectiveBalance",
4946
+ type: "uint32"
4947
+ },
4948
+ {
4949
+ internalType: "bytes32[]",
4950
+ name: "merkleProof",
4951
+ type: "bytes32[]"
4952
+ }
4953
+ ],
4954
+ name: "updateClusterBalance",
4955
+ outputs: [],
4956
+ stateMutability: "nonpayable",
4957
+ type: "function"
4958
+ },
3371
4959
  {
3372
4960
  inputs: [
3373
4961
  {
@@ -3411,15 +4999,41 @@ const MainnetV4SetterABI = [
3411
4999
  inputs: [
3412
5000
  {
3413
5001
  internalType: "uint64",
3414
- name: "maxFee",
5002
+ name: "blocks",
3415
5003
  type: "uint64"
3416
5004
  }
3417
5005
  ],
5006
+ name: "updateLiquidationThresholdPeriodSSV",
5007
+ outputs: [],
5008
+ stateMutability: "nonpayable",
5009
+ type: "function"
5010
+ },
5011
+ {
5012
+ inputs: [
5013
+ {
5014
+ internalType: "uint256",
5015
+ name: "maxFee",
5016
+ type: "uint256"
5017
+ }
5018
+ ],
3418
5019
  name: "updateMaximumOperatorFee",
3419
5020
  outputs: [],
3420
5021
  stateMutability: "nonpayable",
3421
5022
  type: "function"
3422
5023
  },
5024
+ {
5025
+ inputs: [
5026
+ {
5027
+ internalType: "uint32",
5028
+ name: "blocks",
5029
+ type: "uint32"
5030
+ }
5031
+ ],
5032
+ name: "updateMinBlocksBetweenUpdates",
5033
+ outputs: [],
5034
+ stateMutability: "nonpayable",
5035
+ type: "function"
5036
+ },
3423
5037
  {
3424
5038
  inputs: [
3425
5039
  {
@@ -3433,6 +5047,32 @@ const MainnetV4SetterABI = [
3433
5047
  stateMutability: "nonpayable",
3434
5048
  type: "function"
3435
5049
  },
5050
+ {
5051
+ inputs: [
5052
+ {
5053
+ internalType: "uint256",
5054
+ name: "amount",
5055
+ type: "uint256"
5056
+ }
5057
+ ],
5058
+ name: "updateMinimumLiquidationCollateralSSV",
5059
+ outputs: [],
5060
+ stateMutability: "nonpayable",
5061
+ type: "function"
5062
+ },
5063
+ {
5064
+ inputs: [
5065
+ {
5066
+ internalType: "uint256",
5067
+ name: "minFee",
5068
+ type: "uint256"
5069
+ }
5070
+ ],
5071
+ name: "updateMinimumOperatorEthFee",
5072
+ outputs: [],
5073
+ stateMutability: "nonpayable",
5074
+ type: "function"
5075
+ },
3436
5076
  {
3437
5077
  inputs: [
3438
5078
  {
@@ -3464,6 +5104,19 @@ const MainnetV4SetterABI = [
3464
5104
  stateMutability: "nonpayable",
3465
5105
  type: "function"
3466
5106
  },
5107
+ {
5108
+ inputs: [
5109
+ {
5110
+ internalType: "uint256",
5111
+ name: "fee",
5112
+ type: "uint256"
5113
+ }
5114
+ ],
5115
+ name: "updateNetworkFeeSSV",
5116
+ outputs: [],
5117
+ stateMutability: "nonpayable",
5118
+ type: "function"
5119
+ },
3467
5120
  {
3468
5121
  inputs: [
3469
5122
  {
@@ -3477,6 +5130,32 @@ const MainnetV4SetterABI = [
3477
5130
  stateMutability: "nonpayable",
3478
5131
  type: "function"
3479
5132
  },
5133
+ {
5134
+ inputs: [
5135
+ {
5136
+ internalType: "uint16",
5137
+ name: "quorum",
5138
+ type: "uint16"
5139
+ }
5140
+ ],
5141
+ name: "updateQuorumBps",
5142
+ outputs: [],
5143
+ stateMutability: "nonpayable",
5144
+ type: "function"
5145
+ },
5146
+ {
5147
+ inputs: [
5148
+ {
5149
+ internalType: "uint64",
5150
+ name: "duration",
5151
+ type: "uint64"
5152
+ }
5153
+ ],
5154
+ name: "updateUnstakeCooldownDuration",
5155
+ outputs: [],
5156
+ stateMutability: "nonpayable",
5157
+ type: "function"
5158
+ },
3480
5159
  {
3481
5160
  inputs: [
3482
5161
  {
@@ -3571,6 +5250,32 @@ const MainnetV4SetterABI = [
3571
5250
  stateMutability: "nonpayable",
3572
5251
  type: "function"
3573
5252
  },
5253
+ {
5254
+ inputs: [
5255
+ {
5256
+ internalType: "uint64",
5257
+ name: "operatorId",
5258
+ type: "uint64"
5259
+ }
5260
+ ],
5261
+ name: "withdrawAllOperatorEarningsSSV",
5262
+ outputs: [],
5263
+ stateMutability: "nonpayable",
5264
+ type: "function"
5265
+ },
5266
+ {
5267
+ inputs: [
5268
+ {
5269
+ internalType: "uint64",
5270
+ name: "operatorId",
5271
+ type: "uint64"
5272
+ }
5273
+ ],
5274
+ name: "withdrawAllVersionOperatorEarnings",
5275
+ outputs: [],
5276
+ stateMutability: "nonpayable",
5277
+ type: "function"
5278
+ },
3574
5279
  {
3575
5280
  inputs: [
3576
5281
  {
@@ -3579,7 +5284,7 @@ const MainnetV4SetterABI = [
3579
5284
  type: "uint256"
3580
5285
  }
3581
5286
  ],
3582
- name: "withdrawNetworkEarnings",
5287
+ name: "withdrawNetworkSSVEarnings",
3583
5288
  outputs: [],
3584
5289
  stateMutability: "nonpayable",
3585
5290
  type: "function"
@@ -3601,6 +5306,31 @@ const MainnetV4SetterABI = [
3601
5306
  outputs: [],
3602
5307
  stateMutability: "nonpayable",
3603
5308
  type: "function"
5309
+ },
5310
+ {
5311
+ inputs: [
5312
+ {
5313
+ internalType: "uint64",
5314
+ name: "operatorId",
5315
+ type: "uint64"
5316
+ },
5317
+ {
5318
+ internalType: "uint256",
5319
+ name: "amount",
5320
+ type: "uint256"
5321
+ }
5322
+ ],
5323
+ name: "withdrawOperatorEarningsSSV",
5324
+ outputs: [],
5325
+ stateMutability: "nonpayable",
5326
+ type: "function"
5327
+ },
5328
+ {
5329
+ inputs: [],
5330
+ name: "withdrawUnlocked",
5331
+ outputs: [],
5332
+ stateMutability: "nonpayable",
5333
+ type: "function"
3604
5334
  }
3605
5335
  ];
3606
5336
  const TokenABI = [
@@ -3983,23 +5713,41 @@ const TokenABI = [
3983
5713
  type: "function"
3984
5714
  }
3985
5715
  ];
5716
+ class MissingAbiParameterError extends Error {
5717
+ code = "MISSING_ABI_PARAMETER";
5718
+ functionName;
5719
+ parameterName;
5720
+ parameterIndex;
5721
+ constructor({
5722
+ functionName,
5723
+ parameterName,
5724
+ parameterIndex
5725
+ }) {
5726
+ super(
5727
+ `Missing required ABI parameter "${parameterName}" for function "${functionName}" at index ${parameterIndex}.`
5728
+ );
5729
+ this.name = "MissingAbiParameterError";
5730
+ this.functionName = functionName;
5731
+ this.parameterName = parameterName;
5732
+ this.parameterIndex = parameterIndex;
5733
+ }
5734
+ }
3986
5735
  const paramsToArray = ({
3987
5736
  params,
3988
5737
  abiFunction
3989
5738
  }) => {
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
- );
5739
+ const args = abiFunction.inputs.map((param, parameterIndex) => {
5740
+ const parameterName = param.name;
5741
+ if (!parameterName || lodashEs.isUndefined(params[parameterName])) {
5742
+ throw new MissingAbiParameterError({
5743
+ functionName: abiFunction.name,
5744
+ parameterName: parameterName || `<unnamed_${parameterIndex}>`,
5745
+ parameterIndex
5746
+ });
5747
+ }
5748
+ return params[parameterName];
5749
+ });
5750
+ return config.stringifyBigints(args);
4003
5751
  };
4004
5752
  function normalize(strArray) {
4005
5753
  const resultArray = [];
@@ -4063,59 +5811,84 @@ function urlJoin(...args) {
4063
5811
  const parts = Array.from(Array.isArray(args[0]) ? args[0] : args);
4064
5812
  return normalize(parts);
4065
5813
  }
4066
- const ABIS = [TokenABI, MainnetV4SetterABI];
5814
+ const ensureWritableWallet = (walletClient, functionName) => {
5815
+ if (!walletClient) {
5816
+ throw new Error(
5817
+ `Wallet client is required for write method "${functionName}". Provide walletClient in SDK config.`
5818
+ );
5819
+ }
5820
+ if (!walletClient.account) {
5821
+ throw new Error(
5822
+ `Wallet client account is required for write method "${functionName}".`
5823
+ );
5824
+ }
5825
+ return walletClient;
5826
+ };
4067
5827
  const createWriter = ({
4068
5828
  abi,
4069
5829
  publicClient,
4070
5830
  walletClient,
4071
- contractAddress
5831
+ contractAddress,
5832
+ eventSources = [{ abi, address: contractAddress }]
4072
5833
  }) => {
4073
5834
  const writeFnsMainnet = abi.filter(
4074
5835
  (item) => item.type === "function" && (item.stateMutability === "nonpayable" || item.stateMutability === "payable")
4075
5836
  );
4076
5837
  return Object.fromEntries(
4077
5838
  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
- });
5839
+ const getWriteArgs = (params) => {
5840
+ if (fn.inputs.length === 0) {
5841
+ return void 0;
5842
+ }
5843
+ return paramsToArray({
5844
+ params: params ?? {},
5845
+ abiFunction: fn
5846
+ });
5847
+ };
5848
+ const simulate = async (options = {}) => {
5849
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5850
+ return publicClient.simulateContract({
5851
+ ...options,
5852
+ address: contractAddress,
5853
+ abi,
5854
+ functionName: fn.name,
5855
+ args: getWriteArgs(options.args),
5856
+ account: writableWallet.account
5857
+ });
5858
+ };
4086
5859
  const getTransactionData = (params) => {
4087
5860
  return viem.encodeFunctionData({
4088
5861
  abi,
4089
5862
  functionName: fn.name,
4090
- args: paramsToArray({ params, abiFunction: fn })
5863
+ args: getWriteArgs(params)
4091
5864
  });
4092
5865
  };
4093
- const func = async (options2) => {
4094
- const { request } = await simulate(options2);
4095
- const hash = await walletClient.writeContract(request);
5866
+ const func = async (options = {}) => {
5867
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5868
+ const { request } = await simulate(options);
5869
+ const hash = await writableWallet.writeContract(
5870
+ request
5871
+ );
4096
5872
  return {
4097
5873
  hash,
4098
5874
  wait: () => publicClient.waitForTransactionReceipt({ hash }).then((receipt) => ({
4099
5875
  ...receipt,
4100
5876
  events: receipt.logs.reduce(
4101
5877
  (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
- });
5878
+ for (const eventSource of eventSources) {
5879
+ if (!viem.isAddressEqual(log.address, eventSource.address)) {
5880
+ continue;
5881
+ }
5882
+ const [event] = config.tryCatch(
5883
+ () => viem.decodeEventLog({
5884
+ abi: eventSource.abi,
5885
+ data: log.data,
5886
+ topics: log.topics
5887
+ })
5888
+ );
5889
+ if (event) {
5890
+ acc.push(event);
5891
+ break;
4119
5892
  }
4120
5893
  }
4121
5894
  return acc;
@@ -4178,7 +5951,7 @@ const createSSVAPI = (endpoint) => {
4178
5951
  return getSSVAPI(endpoint);
4179
5952
  };
4180
5953
  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;
5954
+ 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
5955
  };
4183
5956
  const createContractInteractions = ({
4184
5957
  walletClient,
@@ -4191,7 +5964,17 @@ const createContractInteractions = ({
4191
5964
  abi: MainnetV4SetterABI,
4192
5965
  walletClient,
4193
5966
  publicClient,
4194
- contractAddress: addresses.setter
5967
+ contractAddress: addresses.setter,
5968
+ eventSources: [
5969
+ {
5970
+ abi: MainnetV4SetterABI,
5971
+ address: addresses.setter
5972
+ },
5973
+ {
5974
+ abi: TokenABI,
5975
+ address: addresses.token
5976
+ }
5977
+ ]
4195
5978
  }),
4196
5979
  read: createReader({
4197
5980
  abi: MainnetV4GetterABI,
@@ -4209,16 +5992,22 @@ const createContractInteractions = ({
4209
5992
  abi: TokenABI,
4210
5993
  walletClient,
4211
5994
  publicClient,
4212
- contractAddress: addresses.token
5995
+ contractAddress: addresses.token,
5996
+ eventSources: [
5997
+ {
5998
+ abi: TokenABI,
5999
+ address: addresses.token
6000
+ }
6001
+ ]
4213
6002
  })
4214
6003
  }
4215
6004
  };
4216
6005
  };
4217
6006
  const createConfig = (props) => {
4218
- const { walletClient, publicClient, extendedConfig } = globals.configArgsSchema.parse(props);
6007
+ const { walletClient, publicClient, extendedConfig } = config.configArgsSchema.parse(props);
4219
6008
  const hasAPIKey = Boolean(extendedConfig?.subgraph?.apiKey);
4220
- const chainId = walletClient.chain.id;
4221
- const chainContracts = globals.contracts[chainId];
6009
+ const chainId = publicClient.chain.id;
6010
+ const chainContracts = config.contracts[chainId];
4222
6011
  const addresses = {
4223
6012
  setter: extendedConfig?.contracts?.setter || chainContracts.setter,
4224
6013
  getter: extendedConfig?.contracts?.getter || chainContracts.getter,
@@ -4229,16 +6018,20 @@ const createConfig = (props) => {
4229
6018
  publicClient,
4230
6019
  addresses
4231
6020
  });
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];
6021
+ const graphEndpoint = extendedConfig?.subgraph?.endpoint || (hasAPIKey ? config.paid_graph_endpoints[chainId] : config.graph_endpoints[chainId]);
6022
+ const restEndpoint = extendedConfig?.rest?.endpoint || config.rest_endpoints[chainId];
4234
6023
  const graphQLClient = new graphqlRequest.GraphQLClient(
4235
6024
  graphEndpoint,
4236
- hasAPIKey ? { headers: { Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}` } } : void 0
6025
+ hasAPIKey ? {
6026
+ headers: {
6027
+ Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}`
6028
+ }
6029
+ } : void 0
4237
6030
  );
4238
6031
  return {
4239
6032
  publicClient,
4240
6033
  walletClient,
4241
- chain: walletClient.chain,
6034
+ chain: publicClient.chain,
4242
6035
  api: {
4243
6036
  ...createQueries(graphQLClient),
4244
6037
  ...createSSVAPI(restEndpoint)
@@ -4254,31 +6047,17 @@ const createConfig = (props) => {
4254
6047
  contract
4255
6048
  };
4256
6049
  };
4257
- const deposit = async (config2, { args: { id, amount }, ...writeOptions }, options2 = {}) => {
4258
- const cluster = await config2.api.getCluster({ id });
6050
+ const deposit = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6051
+ const { cluster } = await config$1.api.getCluster({ id });
4259
6052
  if (!cluster) {
4260
6053
  throw new Error("Cluster not found");
4261
6054
  }
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({
6055
+ const snapshot = config.toSolidityCluster(cluster);
6056
+ return config$1.contract.ssv.write.deposit({
6057
+ value: amount,
4278
6058
  args: {
4279
- amount,
4280
6059
  cluster: snapshot,
4281
- clusterOwner: config2.walletClient.account.address,
6060
+ clusterOwner: cluster.owner.id,
4282
6061
  operatorIds: cluster.operatorIds.map(BigInt)
4283
6062
  },
4284
6063
  ...writeOptions
@@ -4302,58 +6081,97 @@ const exitValidators = async (config2, { args: { publicKeys, operatorIds }, ...w
4302
6081
  ...writeOptions
4303
6082
  });
4304
6083
  };
4305
- const liquidateCluster = async (config2, { args: { id }, ...writeOptions }) => {
4306
- const cluster = await config2.api.getCluster({ id });
6084
+ const liquidateCluster = async (config$1, { args: { id }, ...writeOptions }) => {
6085
+ const { cluster } = await config$1.api.getCluster({ id });
4307
6086
  if (!cluster) {
4308
6087
  throw new Error("Cluster not found");
4309
6088
  }
4310
- return config2.contract.ssv.write.liquidate({
6089
+ return config$1.contract.ssv.write.liquidate({
4311
6090
  args: {
4312
- cluster: globals.getClusterSnapshot(cluster),
4313
- clusterOwner: config2.walletClient.account.address,
6091
+ cluster: config.toSolidityCluster(cluster),
6092
+ clusterOwner: cluster.owner.id,
4314
6093
  operatorIds: cluster.operatorIds.map(BigInt)
4315
6094
  },
4316
6095
  ...writeOptions
4317
6096
  });
4318
6097
  };
4319
- const reactivateCluster = async (config2, { args: { id, amount }, ...writeOptions }) => {
4320
- const cluster = await config2.api.getCluster({ id });
6098
+ const liquidateSSV = async (config$1, { args: { id }, ...writeOptions }) => {
6099
+ const { cluster } = await config$1.api.getCluster({ id });
4321
6100
  if (!cluster) {
4322
6101
  throw new Error("Cluster not found");
4323
6102
  }
4324
- return config2.contract.ssv.write.reactivate({
6103
+ return config$1.contract.ssv.write.liquidateSSV({
4325
6104
  args: {
4326
- cluster: globals.getClusterSnapshot(cluster),
4327
- amount,
6105
+ clusterOwner: cluster.owner.id,
6106
+ operatorIds: cluster.operatorIds.map(BigInt),
6107
+ cluster: config.toSolidityCluster(cluster)
6108
+ },
6109
+ ...writeOptions
6110
+ });
6111
+ };
6112
+ const migrateClusterToETH = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6113
+ const { cluster } = await config$1.api.getCluster({ id });
6114
+ if (!cluster) {
6115
+ throw new Error("Cluster not found");
6116
+ }
6117
+ return config$1.contract.ssv.write.migrateClusterToETH({
6118
+ value: amount,
6119
+ args: {
6120
+ operatorIds: cluster.operatorIds.map(BigInt),
6121
+ cluster: config.toSolidityCluster(cluster)
6122
+ },
6123
+ ...writeOptions
6124
+ });
6125
+ };
6126
+ const reactivateCluster = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6127
+ const { cluster } = await config$1.api.getCluster({ id });
6128
+ if (!cluster) {
6129
+ throw new Error("Cluster not found");
6130
+ }
6131
+ return config$1.contract.ssv.write.reactivate({
6132
+ value: amount,
6133
+ args: {
6134
+ cluster: config.toSolidityCluster(cluster),
4328
6135
  operatorIds: cluster.operatorIds.map(BigInt)
4329
6136
  },
4330
6137
  ...writeOptions
4331
6138
  });
4332
6139
  };
4333
- const registerValidators = async (config2, { args: { keyshares, depositAmount = 0n }, ...writeOptions }) => {
6140
+ const registerValidators = async (config$1, {
6141
+ args: { keyshares, depositAmount = 0n },
6142
+ ...writeOptions
6143
+ }) => {
4334
6144
  const shares = keyshares.map((share) => {
4335
- return globals.isKeySharesItem(share) ? share.payload : share;
6145
+ return config.isKeySharesItem(share) ? share.payload : share;
4336
6146
  });
4337
6147
  const operatorIds = shares[0].operatorIds;
4338
6148
  const clusterSize = operatorIds.length;
4339
- const limit = globals.registerValidatorsByClusterSizeLimits[clusterSize];
6149
+ const limit = config.registerValidatorsByClusterSizeLimits[clusterSize];
4340
6150
  if (!limit) {
4341
6151
  throw new Error(
4342
- `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(globals.registerValidatorsByClusterSizeLimits).join(", ")}`
6152
+ `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(config.registerValidatorsByClusterSizeLimits).join(", ")}`
4343
6153
  );
4344
6154
  }
4345
6155
  if (shares.length > limit) {
4346
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6156
+ throw new Error(
6157
+ `You can't register more than ${limit} validators in a single transaction`
6158
+ );
4347
6159
  }
4348
- const clusterId = globals.createClusterId(config2.walletClient.account.address, operatorIds);
4349
- const cluster = await config2.api.getCluster({
6160
+ const ownerAddress = config$1.walletClient?.account?.address;
6161
+ if (!ownerAddress) {
6162
+ throw new Error(
6163
+ "walletClient with account is required for write operations"
6164
+ );
6165
+ }
6166
+ const clusterId = config.createClusterId(ownerAddress, operatorIds);
6167
+ const { cluster } = await config$1.api.getCluster({
4350
6168
  id: clusterId
4351
6169
  });
4352
- const snapshot = cluster ? globals.getClusterSnapshot(cluster) : globals.createEmptyCluster();
6170
+ const snapshot = cluster ? config.toSolidityCluster(cluster) : config.createEmptyCluster();
4353
6171
  if (shares.length === 1) {
4354
- return config2.contract.ssv.write.registerValidator({
6172
+ return config$1.contract.ssv.write.registerValidator({
6173
+ value: depositAmount,
4355
6174
  args: {
4356
- amount: depositAmount,
4357
6175
  cluster: snapshot,
4358
6176
  operatorIds: operatorIds.map(BigInt),
4359
6177
  publicKey: shares[0].publicKey,
@@ -4362,10 +6180,10 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4362
6180
  ...writeOptions
4363
6181
  });
4364
6182
  }
4365
- return config2.contract.ssv.write.bulkRegisterValidator({
6183
+ return config$1.contract.ssv.write.bulkRegisterValidator({
6184
+ value: depositAmount,
4366
6185
  args: {
4367
6186
  cluster: snapshot,
4368
- amount: depositAmount,
4369
6187
  operatorIds: operatorIds.map(BigInt),
4370
6188
  publicKeys: shares.map((share) => share.publicKey),
4371
6189
  sharesData: shares.map((share) => share.sharesData)
@@ -4373,38 +6191,44 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4373
6191
  ...writeOptions
4374
6192
  });
4375
6193
  };
4376
- const registerValidatorsRawData = async (config2, { args: { keyshares, depositAmount = 0n } }) => {
6194
+ const registerValidatorsRawData = async (config$1, { args: { keyshares, ownerAddress } }) => {
4377
6195
  const shares = keyshares.map((share) => {
4378
- return globals.isKeySharesItem(share) ? share.payload : share;
6196
+ return config.isKeySharesItem(share) ? share.payload : share;
4379
6197
  });
4380
6198
  const operatorIds = shares[0].operatorIds;
4381
6199
  const clusterSize = operatorIds.length;
4382
- const limit = globals.registerValidatorsByClusterSizeLimits[clusterSize];
6200
+ const limit = config.registerValidatorsByClusterSizeLimits[clusterSize];
4383
6201
  if (!limit) {
4384
6202
  throw new Error(
4385
- `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(globals.registerValidatorsByClusterSizeLimits).join(", ")}`
6203
+ `Invalid number of operators in keyshares: ${clusterSize}, should be one of: ${Object.keys(config.registerValidatorsByClusterSizeLimits).join(", ")}`
4386
6204
  );
4387
6205
  }
4388
6206
  if (shares.length > limit) {
4389
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6207
+ throw new Error(
6208
+ `You can't register more than ${limit} validators in a single transaction`
6209
+ );
6210
+ }
6211
+ const resolvedOwnerAddress = ownerAddress ?? config$1.walletClient?.account?.address;
6212
+ if (!resolvedOwnerAddress) {
6213
+ throw new Error(
6214
+ "ownerAddress is required when walletClient.account.address is not available"
6215
+ );
4390
6216
  }
4391
- const clusterId = globals.createClusterId(config2.walletClient.account.address, operatorIds);
4392
- const cluster = await config2.api.getCluster({
6217
+ const clusterId = config.createClusterId(resolvedOwnerAddress, operatorIds);
6218
+ const { cluster } = await config$1.api.getCluster({
4393
6219
  id: clusterId
4394
6220
  });
4395
- const snapshot = cluster ? globals.getClusterSnapshot(cluster) : globals.createEmptyCluster();
6221
+ const snapshot = cluster ? config.toSolidityCluster(cluster) : config.createEmptyCluster();
4396
6222
  if (shares.length === 1) {
4397
- return config2.contract.ssv.write.registerValidator.getTransactionData({
4398
- amount: depositAmount,
6223
+ return config$1.contract.ssv.write.registerValidator.getTransactionData({
4399
6224
  cluster: snapshot,
4400
6225
  operatorIds: operatorIds.map(BigInt),
4401
6226
  publicKey: shares[0].publicKey,
4402
6227
  sharesData: shares[0].sharesData
4403
6228
  });
4404
6229
  }
4405
- return config2.contract.ssv.write.bulkRegisterValidator.getTransactionData({
6230
+ return config$1.contract.ssv.write.bulkRegisterValidator.getTransactionData({
4406
6231
  cluster: snapshot,
4407
- amount: depositAmount,
4408
6232
  operatorIds: operatorIds.map(BigInt),
4409
6233
  publicKeys: shares.map((share) => share.publicKey),
4410
6234
  sharesData: shares.map((share) => share.sharesData)
@@ -4412,13 +6236,20 @@ const registerValidatorsRawData = async (config2, { args: { keyshares, depositAm
4412
6236
  };
4413
6237
  const ssvKeys$1 = new KeyShares.SSVKeys();
4414
6238
  const validateSharesPostRegistration = async (config2, args) => {
6239
+ const ownerAddress = args.ownerAddress ?? config2.walletClient?.account?.address;
6240
+ if (!ownerAddress) {
6241
+ throw new Error(
6242
+ "ownerAddress is required when walletClient.account.address is not available"
6243
+ );
6244
+ }
4415
6245
  const receipt = await config2.publicClient.waitForTransactionReceipt({
4416
6246
  hash: args.txHash
4417
6247
  });
4418
- const ownerNonce = await config2.api.getOwnerNonce({
4419
- owner: config2.walletClient.account.address,
6248
+ const ownerNonceResponse = await config2.api.getOwnerNonce({
6249
+ owner: ownerAddress,
4420
6250
  block: Number(receipt.blockNumber) - 1
4421
6251
  });
6252
+ const ownerNonce = ownerNonceResponse?.nonce;
4422
6253
  if (lodashEs.isUndefined(ownerNonce)) {
4423
6254
  throw new Error("Could not fetch owner nonce");
4424
6255
  }
@@ -4427,7 +6258,7 @@ const validateSharesPostRegistration = async (config2, args) => {
4427
6258
  address: config2.contractAddresses.setter,
4428
6259
  eventName: "ValidatorAdded",
4429
6260
  args: {
4430
- owner: config2.walletClient.account.address
6261
+ owner: ownerAddress
4431
6262
  },
4432
6263
  fromBlock: receipt.blockNumber,
4433
6264
  toBlock: receipt.blockNumber
@@ -4443,8 +6274,8 @@ const validateSharesPostRegistration = async (config2, args) => {
4443
6274
  blockNumber: Number(receipt.blockNumber),
4444
6275
  operatorsCount: e.args.operatorIds.length,
4445
6276
  isAccountExists: false,
4446
- ownerAddress: config2.walletClient.account.address,
4447
- ownerNonce: Number(ownerNonce) + index,
6277
+ ownerAddress,
6278
+ ownerNonce: ownerNonce + index,
4448
6279
  shares: e.args.shares,
4449
6280
  validatorPublicKey: e.args.publicKey
4450
6281
  })
@@ -4456,28 +6287,28 @@ const validateSharesPostRegistration = async (config2, args) => {
4456
6287
  isValid,
4457
6288
  validations,
4458
6289
  invalids,
4459
- ownerNonceAtBlock: Number(ownerNonce),
6290
+ ownerNonceAtBlock: ownerNonce,
4460
6291
  block: Number(receipt.blockNumber)
4461
6292
  };
4462
6293
  };
4463
- const removeValidators = async (config2, { args: { id, publicKeys }, ...writeOptions }) => {
4464
- const cluster = await config2.api.getCluster({ id });
6294
+ const removeValidators = async (config$1, { args: { id, publicKeys }, ...writeOptions }) => {
6295
+ const { cluster } = await config$1.api.getCluster({ id });
4465
6296
  if (!cluster) {
4466
6297
  throw new Error("Cluster not found");
4467
6298
  }
4468
6299
  if (publicKeys.length === 1) {
4469
- return config2.contract.ssv.write.removeValidator({
6300
+ return config$1.contract.ssv.write.removeValidator({
4470
6301
  args: {
4471
- cluster: globals.getClusterSnapshot(cluster),
6302
+ cluster: config.toSolidityCluster(cluster),
4472
6303
  publicKey: publicKeys[0],
4473
6304
  operatorIds: cluster.operatorIds.map(BigInt)
4474
6305
  },
4475
6306
  ...writeOptions
4476
6307
  });
4477
6308
  }
4478
- return config2.contract.ssv.write.bulkRemoveValidator({
6309
+ return config$1.contract.ssv.write.bulkRemoveValidator({
4479
6310
  args: {
4480
- cluster: globals.getClusterSnapshot(cluster),
6311
+ cluster: config.toSolidityCluster(cluster),
4481
6312
  publicKeys,
4482
6313
  operatorIds: cluster.operatorIds.map(BigInt)
4483
6314
  },
@@ -4492,15 +6323,15 @@ const setFeeRecipient = async (config2, { args: { recipient }, ...writeOptions }
4492
6323
  ...writeOptions
4493
6324
  });
4494
6325
  };
4495
- const withdraw$1 = async (config2, { args: { id, amount }, ...writeOptions }) => {
4496
- const cluster = await config2.api.getCluster({ id });
6326
+ const withdraw$1 = async (config$1, { args: { id, amount }, ...writeOptions }) => {
6327
+ const { cluster } = await config$1.api.getCluster({ id });
4497
6328
  if (!cluster) {
4498
6329
  throw new Error("Cluster not found");
4499
6330
  }
4500
- return config2.contract.ssv.write.withdraw({
6331
+ return config$1.contract.ssv.write.withdraw({
4501
6332
  args: {
4502
6333
  amount,
4503
- cluster: globals.getClusterSnapshot(cluster),
6334
+ cluster: config.toSolidityCluster(cluster),
4504
6335
  operatorIds: cluster.operatorIds.map(BigInt)
4505
6336
  },
4506
6337
  ...writeOptions
@@ -4510,17 +6341,61 @@ const createClusterManager = (config2) => ({
4510
6341
  deposit: deposit.bind(null, config2),
4511
6342
  withdraw: withdraw$1.bind(null, config2),
4512
6343
  liquidate: liquidateCluster.bind(null, config2),
6344
+ liquidateSSV: liquidateSSV.bind(null, config2),
4513
6345
  reactivate: reactivateCluster.bind(null, config2),
6346
+ migrateClusterToETH: migrateClusterToETH.bind(
6347
+ null,
6348
+ config2
6349
+ ),
4514
6350
  removeValidators: removeValidators.bind(null, config2),
4515
6351
  setFeeRecipient: setFeeRecipient.bind(null, config2),
4516
6352
  exitValidators: exitValidators.bind(null, config2),
4517
6353
  registerValidators: registerValidators.bind(null, config2),
4518
- registerValidatorsRawData: registerValidatorsRawData.bind(null, config2),
6354
+ registerValidatorsRawData: registerValidatorsRawData.bind(
6355
+ null,
6356
+ config2
6357
+ ),
4519
6358
  validateSharesPostRegistration: validateSharesPostRegistration.bind(
4520
6359
  null,
4521
6360
  config2
4522
6361
  )
4523
6362
  });
6363
+ const commitRoot = async (config2, { args: { merkleRoot, blockNum }, ...writeOptions }) => {
6364
+ return config2.contract.ssv.write.commitRoot({
6365
+ args: {
6366
+ merkleRoot,
6367
+ blockNum
6368
+ },
6369
+ ...writeOptions
6370
+ });
6371
+ };
6372
+ const updateNetworkFeeSSV = async (config2, { args: { fee }, ...writeOptions }) => {
6373
+ return config2.contract.ssv.write.updateNetworkFeeSSV({
6374
+ args: {
6375
+ fee
6376
+ },
6377
+ ...writeOptions
6378
+ });
6379
+ };
6380
+ const withdrawNetworkSSVEarnings = async (config2, { args: { amount }, ...writeOptions }) => {
6381
+ return config2.contract.ssv.write.withdrawNetworkSSVEarnings({
6382
+ args: {
6383
+ amount
6384
+ },
6385
+ ...writeOptions
6386
+ });
6387
+ };
6388
+ const createDaoManager = (config2) => ({
6389
+ commitRoot: commitRoot.bind(null, config2),
6390
+ updateNetworkFeeSSV: updateNetworkFeeSSV.bind(
6391
+ null,
6392
+ config2
6393
+ ),
6394
+ withdrawNetworkSSVEarnings: withdrawNetworkSSVEarnings.bind(
6395
+ null,
6396
+ config2
6397
+ )
6398
+ });
4524
6399
  const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions }) => {
4525
6400
  const balance = await config2.contract.ssv.read.getOperatorEarnings({
4526
6401
  id: BigInt(operatorId)
@@ -4542,17 +6417,69 @@ const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions
4542
6417
  ...writeOptions
4543
6418
  });
4544
6419
  };
4545
- const registerOperator = async (config2, { args: { isPrivate, yearlyFee, publicKey }, ...writeOptions }) => {
4546
- return config2.contract.ssv.write.registerOperator({
6420
+ const withdrawOperatorEarningsSSV = async (config2, {
6421
+ args: { operatorId, amount },
6422
+ ...writeOptions
6423
+ }) => {
6424
+ const balance = await config2.contract.ssv.read.getOperatorEarningsSSV({
6425
+ id: BigInt(operatorId)
6426
+ });
6427
+ const isWithdrawingAll = amount >= balance;
6428
+ if (isWithdrawingAll) {
6429
+ return config2.contract.ssv.write.withdrawAllOperatorEarningsSSV({
6430
+ args: {
6431
+ operatorId: BigInt(operatorId)
6432
+ },
6433
+ ...writeOptions
6434
+ });
6435
+ }
6436
+ return config2.contract.ssv.write.withdrawOperatorEarningsSSV({
6437
+ args: {
6438
+ operatorId: BigInt(operatorId),
6439
+ amount
6440
+ },
6441
+ ...writeOptions
6442
+ });
6443
+ };
6444
+ const withdrawAllOperatorEarningsSSV = async (config2, { args: { operatorId }, ...writeOptions }) => {
6445
+ return config2.contract.ssv.write.withdrawAllOperatorEarningsSSV({
6446
+ args: {
6447
+ operatorId: BigInt(operatorId)
6448
+ },
6449
+ ...writeOptions
6450
+ });
6451
+ };
6452
+ const withdrawAllVersionOperatorEarnings = async (config2, {
6453
+ args: { operatorId },
6454
+ ...writeOptions
6455
+ }) => {
6456
+ return config2.contract.ssv.write.withdrawAllVersionOperatorEarnings({
6457
+ args: {
6458
+ operatorId: BigInt(operatorId)
6459
+ },
6460
+ ...writeOptions
6461
+ });
6462
+ };
6463
+ const registerOperator = async (config$1, {
6464
+ args: { isPrivate, yearlyFee, publicKey },
6465
+ ...writeOptions
6466
+ }) => {
6467
+ return config$1.contract.ssv.write.registerOperator({
4547
6468
  args: {
4548
6469
  publicKey: viem.encodeAbiParameters(viem.parseAbiParameters("string"), [publicKey]),
4549
- fee: globals.roundOperatorFee(yearlyFee / globals.globals.BLOCKS_PER_YEAR),
6470
+ fee: config.roundOperatorFee(
6471
+ yearlyFee / config.globals.BLOCKS_PER_YEAR,
6472
+ config.globals.ETH_DEDUCTED_DIGITS
6473
+ ),
4550
6474
  setPrivate: isPrivate
4551
6475
  },
4552
6476
  ...writeOptions
4553
6477
  });
4554
6478
  };
4555
- const setOperatorWhitelists = async (config2, { args: { operatorIds, contractAddress }, ...writeOptions }) => {
6479
+ const setOperatorWhitelists = async (config2, {
6480
+ args: { operatorIds, contractAddress },
6481
+ ...writeOptions
6482
+ }) => {
4556
6483
  const isWhitelistingContract = await config2.contract.ssv.read.isWhitelistingContract({
4557
6484
  contractAddress
4558
6485
  });
@@ -4588,70 +6515,168 @@ const createOperatorManager = (config2) => ({
4588
6515
  registerOperator: registerOperator.bind(null, config2),
4589
6516
  removeOperator: config2.contract.ssv.write.removeOperator,
4590
6517
  withdraw: withdraw.bind(null, config2),
6518
+ withdrawOperatorEarningsSSV: withdrawOperatorEarningsSSV.bind(
6519
+ null,
6520
+ config2
6521
+ ),
6522
+ withdrawAllOperatorEarningsSSV: withdrawAllOperatorEarningsSSV.bind(
6523
+ null,
6524
+ config2
6525
+ ),
6526
+ withdrawAllVersionOperatorEarnings: withdrawAllVersionOperatorEarnings.bind(
6527
+ null,
6528
+ config2
6529
+ ),
4591
6530
  setOperatorWhitelists: config2.contract.ssv.write.setOperatorsWhitelists,
4592
6531
  removeOperatorWhitelists: config2.contract.ssv.write.removeOperatorsWhitelists,
4593
6532
  setOperatorsPrivate: config2.contract.ssv.write.setOperatorsPrivateUnchecked,
4594
6533
  setOperatorsPublic: config2.contract.ssv.write.setOperatorsPublicUnchecked,
4595
- setOperatorWhitelistingContract: setOperatorWhitelists.bind(null, config2),
6534
+ setOperatorWhitelistingContract: setOperatorWhitelists.bind(
6535
+ null,
6536
+ config2
6537
+ ),
4596
6538
  removeOperatorWhitelistingContract: config2.contract.ssv.write.removeOperatorsWhitelists,
4597
6539
  declareOperatorFee: config2.contract.ssv.write.declareOperatorFee,
4598
6540
  executeOperatorFee: config2.contract.ssv.write.executeOperatorFee,
4599
6541
  cancelDeclaredOperatorFee: config2.contract.ssv.write.cancelDeclaredOperatorFee,
4600
6542
  reduceOperatorFee: config2.contract.ssv.write.reduceOperatorFee
4601
6543
  });
4602
- const getClusterBalance = async (config2, { operatorIds }) => {
4603
- const query = await config2.api.getClusterBalance({
4604
- daoAddress: config2.contractAddresses.setter,
6544
+ const getClusterBalance = async (config$1, { operatorIds, ownerAddress }) => {
6545
+ const resolvedOwnerAddress = ownerAddress ?? config$1.walletClient?.account?.address;
6546
+ if (!resolvedOwnerAddress) {
6547
+ throw new Error(
6548
+ "ownerAddress is required when walletClient.account.address is not available"
6549
+ );
6550
+ }
6551
+ const query = await config$1.api.getClusterBalance({
6552
+ daoAddress: config$1.contractAddresses.setter,
4605
6553
  operatorIds: operatorIds.map(String),
4606
- clusterId: globals.createClusterId(config2.walletClient.account.address, operatorIds)
6554
+ clusterId: config.createClusterId(resolvedOwnerAddress, operatorIds)
4607
6555
  });
4608
- if (!query.cluster || !query.daovalues || !query._meta) {
6556
+ if (!query.cluster || !query.daovalues) {
4609
6557
  throw new Error("Could not fetch cluster balance");
4610
6558
  }
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;
6559
+ const isSsvCluster = query.cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6560
+ const networkFee = BigInt(
6561
+ isSsvCluster ? query.daovalues.networkFeeSSV : query.daovalues.networkFee
6562
+ );
6563
+ const networkFeeIndex = BigInt(
6564
+ isSsvCluster ? query.daovalues.networkFeeIndexSSV : query.daovalues.networkFeeIndex
6565
+ );
6566
+ const networkFeeIndexBlockNumber = BigInt(
6567
+ isSsvCluster ? query.daovalues.networkFeeIndexBlockNumberSSV : query.daovalues.networkFeeIndexBlockNumber
6568
+ );
6569
+ const minimumLiquidationCollateral = BigInt(
6570
+ isSsvCluster ? query.daovalues.minimumLiquidationCollateralSSV : query.daovalues.minimumLiquidationCollateral
6571
+ );
6572
+ const liquidationThreshold = BigInt(
6573
+ isSsvCluster ? query.daovalues.liquidationThresholdSSV : query.daovalues.liquidationThreshold
6574
+ );
6575
+ const scallingCoefficient = isSsvCluster ? config.globals.SSV_DEDUCTED_DIGITS : config.globals.ETH_DEDUCTED_DIGITS;
6576
+ const cumulativeNetworkFee = networkFeeIndex + (BigInt(query.blockNumber) - networkFeeIndexBlockNumber) * networkFee - BigInt(query.cluster.networkFeeIndex) * scallingCoefficient;
4612
6577
  const cumulativeOperatorFee = query.operators.reduce(
4613
6578
  (acc, operator) => {
4614
- return acc + BigInt(operator.feeIndex) + (BigInt(query._meta.block.number) - BigInt(operator.feeIndexBlockNumber)) * BigInt(operator.fee);
6579
+ const fee = isSsvCluster ? operator.feeSSV : operator.fee;
6580
+ const feeIndex = isSsvCluster ? operator.feeIndexSSV : operator.feeIndex;
6581
+ const feeIndexBlockNumber = isSsvCluster ? operator.feeIndexBlockNumberSSV : operator.feeIndexBlockNumber;
6582
+ return acc + BigInt(feeIndex) + (BigInt(query.blockNumber) - BigInt(feeIndexBlockNumber)) * BigInt(fee);
4615
6583
  },
4616
- -BigInt(query.cluster.index) * 10000000n
6584
+ -BigInt(query.cluster.index) * scallingCoefficient
4617
6585
  );
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;
6586
+ const operatorsFee = query.operators.reduce(
6587
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6588
+ 0n
6589
+ );
6590
+ const effectiveBalanceValidatorUnits = BigInt(query.cluster.effectiveBalance) * BigInt(config.globals.VUNITS_PRECISION) / 32n;
6591
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(config.globals.VUNITS_PRECISION);
6592
+ const calculatedClusterBalance = BigInt(query.cluster.balance) - (cumulativeNetworkFee + cumulativeOperatorFee) * validatorUnits || 1n;
6593
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6594
+ const LC = config.bigintMax(
6595
+ minimumLiquidationCollateral,
6596
+ burnRate * liquidationThreshold
6597
+ );
6598
+ const runway = calculatedClusterBalance - LC;
6599
+ const operationalRunway = runway / burnRate / config.globals.BLOCKS_PER_DAY;
4625
6600
  return {
6601
+ blockNumber: query.blockNumber,
4626
6602
  balance: calculatedClusterBalance,
4627
6603
  operationalRunway
4628
6604
  };
4629
6605
  };
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,
6606
+ const isKeySharesPayload = (value) => {
6607
+ return !!value && typeof value === "object" && "sharesData" in value && "publicKey" in value && "operatorIds" in value;
6608
+ };
6609
+ const isKeySharesPayloadList = (value) => {
6610
+ return Array.isArray(value) && value.every(isKeySharesPayload);
6611
+ };
6612
+ const buildKeysharesFromPayloads = (payloads) => {
6613
+ const shares = payloads.map((payload) => {
6614
+ const item = new KeyShares.KeySharesItem();
6615
+ item.payload.update(payload);
6616
+ return item;
6617
+ });
6618
+ config.ensureValidatorsUniqueness(shares);
6619
+ return shares;
6620
+ };
6621
+ const validateSharesPreRegistration = async (config$1, { keyshares, operatorIds, ownerAddress }) => {
6622
+ const account = ownerAddress ?? config$1.walletClient?.account?.address;
6623
+ if (!account) {
6624
+ throw new Error(
6625
+ "ownerAddress is required when walletClient.account.address is not available"
6626
+ );
6627
+ }
6628
+ const { operators } = await config$1.api.getOperators({ operatorIds });
6629
+ if (operators.length !== operatorIds.length) {
6630
+ throw new config.KeysharesValidationError(
6631
+ config.KeysharesValidationErrors.OperatorDoesNotExist
6632
+ );
6633
+ }
6634
+ const usesPayloads = isKeySharesPayloadList(keyshares);
6635
+ const shares = usesPayloads ? buildKeysharesFromPayloads(keyshares) : await validateKeysharesJSON({
6636
+ account,
4634
6637
  operators,
4635
6638
  keyshares
4636
6639
  });
6640
+ if (usesPayloads) {
6641
+ const shareOperatorIds = config.validateConsistentOperatorIds(shares);
6642
+ const sortedOperatorIds = config.sortNumbers(
6643
+ operators.map((operator) => Number(operator.id))
6644
+ );
6645
+ if (!lodashEs.isEqual(config.sortNumbers(shareOperatorIds), config.sortNumbers(sortedOperatorIds))) {
6646
+ throw new config.KeysharesValidationError(
6647
+ config.KeysharesValidationErrors.ClusterMismatch
6648
+ );
6649
+ }
6650
+ }
4637
6651
  const statuses = await Promise.all(
4638
6652
  shares.map((share) => {
4639
- return config2.api.getValidator({ id: share.data.publicKey }).then((res) => [share, Boolean(res)]).catch(() => [share, false]);
6653
+ return config$1.api.getValidator({ id: share.data.publicKey }).then(
6654
+ ({ validator }) => [share, Boolean(validator)]
6655
+ );
4640
6656
  })
4641
6657
  );
4642
6658
  if (statuses.every(([, isRegistered]) => isRegistered)) {
4643
6659
  throw new Error("All validators are already registered");
4644
6660
  }
4645
- const nonce = await config2.api.getOwnerNonce({ owner: config2.walletClient.account.address }).then((nonce2) => {
4646
- if (!nonce2) throw new Error("Failed to get owner nonce");
4647
- return Number(nonce2);
4648
- });
6661
+ const shouldValidateNonce = shares.every(
6662
+ (share) => typeof share.data.ownerNonce === "number"
6663
+ );
6664
+ const nonce = shouldValidateNonce ? await config$1.api.getOwnerNonce({ owner: account }).then(({ nonce: nonce2 }) => {
6665
+ if (typeof nonce2 !== "number") {
6666
+ throw new Error("Failed to get owner nonce");
6667
+ }
6668
+ return nonce2;
6669
+ }) : null;
4649
6670
  let i = 0;
4650
6671
  const sharesWithStatuses = statuses.reduce(
4651
6672
  (acc, [share, isRegistered]) => {
4652
6673
  if (isRegistered) {
4653
6674
  acc.registered.push(share);
4654
6675
  } else {
6676
+ if (!shouldValidateNonce) {
6677
+ acc.available.push(share);
6678
+ return acc;
6679
+ }
4655
6680
  const validNonce = nonce + i === share.data.ownerNonce;
4656
6681
  if (validNonce) i++;
4657
6682
  if (validNonce) {
@@ -4669,13 +6694,17 @@ const validateSharesPreRegistration = async (config2, { keyshares, operatorIds }
4669
6694
  `No available keyshares to register. ${sharesWithStatuses.incorrect.length} keyshares have incorrect nonce and ${sharesWithStatuses.registered.length} are already registered`
4670
6695
  );
4671
6696
  }
4672
- const limit = await config2.contract.ssv.read.getValidatorsPerOperatorLimit();
6697
+ const limit = await config$1.contract.ssv.read.getValidatorsPerOperatorLimit();
4673
6698
  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`);
6699
+ if (!await canAccountUseOperator(config$1, operator, account)) {
6700
+ throw new Error(
6701
+ `Operator ${operator.id} is private and the account is not whitelisted`
6702
+ );
4676
6703
  }
4677
6704
  if (Number(operator.validatorCount) + sharesWithStatuses.available.length > limit) {
4678
- throw new Error(`Operator ${operator.id} has reached the limit of ${limit} validators`);
6705
+ throw new Error(
6706
+ `Operator ${operator.id} has reached the limit of ${limit} validators`
6707
+ );
4679
6708
  }
4680
6709
  }
4681
6710
  return sharesWithStatuses;
@@ -4686,9 +6715,9 @@ const validateKeysharesJSON = async ({
4686
6715
  keyshares
4687
6716
  }) => {
4688
6717
  const shares = (await KeyShares.KeyShares.fromJson(keyshares)).list();
4689
- globals.ensureNoKeysharesErrors(shares);
4690
- globals.ensureValidatorsUniqueness(shares);
4691
- globals.validateConsistentOperatorPublicKeys(shares, operators);
6718
+ config.ensureNoKeysharesErrors(shares);
6719
+ config.ensureValidatorsUniqueness(shares);
6720
+ config.validateConsistentOperatorPublicKeys(shares, operators);
4692
6721
  await Promise.all(
4693
6722
  shares.map(
4694
6723
  (share) => share.validateSingleShares(share.payload.sharesData, {
@@ -4698,17 +6727,24 @@ const validateKeysharesJSON = async ({
4698
6727
  })
4699
6728
  )
4700
6729
  );
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);
6730
+ const shareOperatorIds = config.validateConsistentOperatorIds(shares);
6731
+ const operatorIds = config.sortNumbers(
6732
+ operators.map((operator) => Number(operator.id))
6733
+ );
6734
+ if (!lodashEs.isEqual(config.sortNumbers(shareOperatorIds), config.sortNumbers(operatorIds))) {
6735
+ throw new config.KeysharesValidationError(
6736
+ config.KeysharesValidationErrors.ClusterMismatch
6737
+ );
4705
6738
  }
4706
6739
  return shares;
4707
6740
  };
4708
6741
  const ssvKeys = new KeyShares.SSVKeys();
4709
6742
  const createAndEncryptShares = async (privateKey, operators) => {
4710
6743
  const threshold = await ssvKeys.createThreshold(privateKey, operators);
4711
- const encryptedShares = await ssvKeys.encryptShares(operators, threshold.shares);
6744
+ const encryptedShares = await ssvKeys.encryptShares(
6745
+ operators,
6746
+ threshold.shares
6747
+ );
4712
6748
  return {
4713
6749
  threshold,
4714
6750
  encryptedShares
@@ -4719,29 +6755,31 @@ const generateKeyShares = async (args) => {
4719
6755
  const shares = [];
4720
6756
  for (let i = 0; i < keystores.length; i++) {
4721
6757
  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],
6758
+ const extracted = await ssvKeys.extractKeys(
6759
+ keystore,
6760
+ args.keystorePassword
6761
+ );
6762
+ const operators = args.operatorKeys.map((key, index) => ({
6763
+ id: args.operatorIds[index],
4725
6764
  operatorKey: key
4726
6765
  }));
4727
6766
  const { threshold, encryptedShares } = await createAndEncryptShares(
4728
6767
  extracted.privateKey,
4729
6768
  operators
4730
6769
  );
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
- )
6770
+ const payload = await new KeyShares.KeySharesItem().buildPayload(
6771
+ {
6772
+ publicKey: threshold.publicKey,
6773
+ operators,
6774
+ encryptedShares
6775
+ },
6776
+ {
6777
+ ownerAddress: args.ownerAddress,
6778
+ ownerNonce: args.nonce + i,
6779
+ privateKey: extracted.privateKey
6780
+ }
4744
6781
  );
6782
+ shares.push(payload);
4745
6783
  }
4746
6784
  return shares;
4747
6785
  };
@@ -4752,19 +6790,200 @@ const getOperatorCapacity = async (config2, operatorId) => {
4752
6790
  }),
4753
6791
  config2.contract.ssv.read.getValidatorsPerOperatorLimit()
4754
6792
  ]);
4755
- if (!operator) return 0;
4756
- return limit - Number(operator.validatorCount);
6793
+ if (!operator?.operator) return 0;
6794
+ return limit - Number(operator.operator.validatorCount);
6795
+ };
6796
+ const isKeySharesFileShare = (share) => {
6797
+ return !!share && typeof share === "object" && "data" in share && "payload" in share;
6798
+ };
6799
+ const isPayloadOnlyShare = (share) => {
6800
+ return !!share && typeof share === "object" && "sharesData" in share && "publicKey" in share && "operatorIds" in share && !("data" in share) && !("payload" in share);
6801
+ };
6802
+ const toWebappOperatorKey = (operatorKey) => {
6803
+ if (operatorKey.startsWith("LS0tLS1CRUdJTi")) {
6804
+ return operatorKey;
6805
+ }
6806
+ return Buffer.from(operatorKey, "utf-8").toString("base64");
6807
+ };
6808
+ const buildOperatorMap = async (config2, shares, providedOperators) => {
6809
+ if (providedOperators) {
6810
+ return new Map(
6811
+ providedOperators.map((operator) => [
6812
+ operator.id,
6813
+ {
6814
+ ...operator,
6815
+ operatorKey: toWebappOperatorKey(operator.operatorKey)
6816
+ }
6817
+ ])
6818
+ );
6819
+ }
6820
+ const payloadShares = shares.filter(isPayloadOnlyShare);
6821
+ if (!payloadShares.length) {
6822
+ return /* @__PURE__ */ new Map();
6823
+ }
6824
+ const uniqueOperatorIds = [
6825
+ ...new Set(payloadShares.flatMap((share) => share.operatorIds))
6826
+ ];
6827
+ const { operators } = await config2.api.getOperators({
6828
+ operatorIds: uniqueOperatorIds.map(String)
6829
+ });
6830
+ if (operators.length !== uniqueOperatorIds.length) {
6831
+ throw new Error(
6832
+ "writeKeysharesFile could not fetch all operators required to build the webapp keyshares format."
6833
+ );
6834
+ }
6835
+ return new Map(
6836
+ operators.map((operator) => [
6837
+ Number(operator.id),
6838
+ {
6839
+ id: Number(operator.id),
6840
+ operatorKey: toWebappOperatorKey(operator.publicKey)
6841
+ }
6842
+ ])
6843
+ );
6844
+ };
6845
+ const normalizeKeySharesItem = async (share, index, args, operatorMap) => {
6846
+ if (config.isKeySharesItem(share)) {
6847
+ return JSON.parse(share.toJson());
6848
+ }
6849
+ if (isKeySharesFileShare(share)) {
6850
+ return share;
6851
+ }
6852
+ if (!isPayloadOnlyShare(share)) {
6853
+ throw new Error(
6854
+ "writeKeysharesFile received an unsupported keyshares shape."
6855
+ );
6856
+ }
6857
+ if (!args.ownerAddress || typeof args.nonce !== "number") {
6858
+ throw new Error(
6859
+ "writeKeysharesFile requires ownerAddress and nonce when shares contain payload-only keyshares."
6860
+ );
6861
+ }
6862
+ const operators = share.operatorIds.map((operatorId) => {
6863
+ const operator = operatorMap.get(operatorId);
6864
+ if (!operator) {
6865
+ throw new Error(
6866
+ `writeKeysharesFile could not resolve operator ${operatorId} for the webapp keyshares format.`
6867
+ );
6868
+ }
6869
+ return operator;
6870
+ });
6871
+ return {
6872
+ data: {
6873
+ ownerAddress: args.ownerAddress,
6874
+ ownerNonce: args.nonce + index,
6875
+ publicKey: share.publicKey,
6876
+ operators
6877
+ },
6878
+ payload: share
6879
+ };
6880
+ };
6881
+ const getParentDirectory = (filePath) => {
6882
+ const normalizedPath = filePath.replace(/\\/g, "/");
6883
+ const lastSeparatorIndex = normalizedPath.lastIndexOf("/");
6884
+ if (lastSeparatorIndex === -1) {
6885
+ return ".";
6886
+ }
6887
+ if (lastSeparatorIndex === 0) {
6888
+ return normalizedPath[0];
6889
+ }
6890
+ return normalizedPath.slice(0, lastSeparatorIndex);
6891
+ };
6892
+ const writeKeysharesFile = async (config2, args) => {
6893
+ const { path, shares } = args;
6894
+ if (!shares.length) {
6895
+ throw new Error(
6896
+ "writeKeysharesFile requires at least one keyshares item to write a file."
6897
+ );
6898
+ }
6899
+ const operatorMap = await buildOperatorMap(config2, shares, args.operators);
6900
+ const normalizedShares = await Promise.all(
6901
+ shares.map(
6902
+ (share, index) => normalizeKeySharesItem(share, index, args, operatorMap)
6903
+ )
6904
+ );
6905
+ const keySharesFile = {
6906
+ version: "v1.1.0",
6907
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6908
+ shares: normalizedShares
6909
+ };
6910
+ const { mkdir, writeFile } = await import("node:fs/promises");
6911
+ await mkdir(getParentDirectory(path), { recursive: true });
6912
+ await writeFile(path, JSON.stringify(keySharesFile, null, 2), {
6913
+ encoding: "utf-8"
6914
+ });
6915
+ };
6916
+ const computeDailyAmount = (value, days) => {
6917
+ const scale = 10 ** 6;
6918
+ const scaledDays = BigInt(days * scale);
6919
+ return value * scaledDays * BigInt(config.globals.BLOCKS_PER_DAY) / BigInt(scale);
6920
+ };
6921
+ const calcDepositFromRunway = async (config$1, { clusterId, runway }) => {
6922
+ const { cluster } = await config$1.api.getCluster({ id: clusterId });
6923
+ if (!cluster) {
6924
+ throw new Error("Cluster not found");
6925
+ }
6926
+ const { operators } = await config$1.api.getOperators({
6927
+ operatorIds: cluster.operatorIds
6928
+ });
6929
+ if (!operators) {
6930
+ throw new Error("Operators not found");
6931
+ }
6932
+ const { daovalues: daoValues } = await config$1.api.getDaoValues({
6933
+ daoAddress: config$1.contractAddresses.setter
6934
+ });
6935
+ if (!daoValues) {
6936
+ throw new Error("DAO values not found");
6937
+ }
6938
+ const isSsvCluster = cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6939
+ const operatorsFee = operators.reduce(
6940
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6941
+ 0n
6942
+ );
6943
+ const networkFee = BigInt(
6944
+ isSsvCluster ? daoValues.networkFeeSSV : daoValues.networkFee
6945
+ );
6946
+ const minimumLiquidationCollateral = BigInt(
6947
+ isSsvCluster ? daoValues.minimumLiquidationCollateralSSV : daoValues.minimumLiquidationCollateral
6948
+ );
6949
+ const liquidationThreshold = BigInt(
6950
+ isSsvCluster ? daoValues.liquidationThresholdSSV : daoValues.liquidationThreshold
6951
+ );
6952
+ const effectiveBalanceValidatorUnits = BigInt(cluster.effectiveBalance) * BigInt(config.globals.VUNITS_PRECISION) / 32n;
6953
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(config.globals.VUNITS_PRECISION) || 1n;
6954
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6955
+ const liquidationCollateral = config.bigintMax(
6956
+ minimumLiquidationCollateral,
6957
+ burnRate * liquidationThreshold
6958
+ );
6959
+ const residualBalance = computeDailyAmount(burnRate, runway);
6960
+ return residualBalance + liquidationCollateral;
4757
6961
  };
4758
6962
  const createUtils = (config2) => ({
4759
6963
  generateKeyShares,
6964
+ writeKeysharesFile: writeKeysharesFile.bind(
6965
+ null,
6966
+ config2
6967
+ ),
4760
6968
  validateKeysharesJSON,
4761
- validateSharesPreRegistration: validateSharesPreRegistration.bind(null, config2),
4762
- getOperatorCapacity: getOperatorCapacity.bind(null, config2),
4763
- getClusterBalance: getClusterBalance.bind(null, config2)
6969
+ validateSharesPreRegistration: validateSharesPreRegistration.bind(
6970
+ null,
6971
+ config2
6972
+ ),
6973
+ getOperatorCapacity: getOperatorCapacity.bind(
6974
+ null,
6975
+ config2
6976
+ ),
6977
+ getClusterBalance: getClusterBalance.bind(null, config2),
6978
+ calcDepositFromRunway: calcDepositFromRunway.bind(
6979
+ null,
6980
+ config2
6981
+ )
4764
6982
  });
4765
6983
  class SSVSDK {
4766
6984
  config;
4767
6985
  clusters;
6986
+ dao;
4768
6987
  operators;
4769
6988
  api;
4770
6989
  contract;
@@ -4772,22 +6991,38 @@ class SSVSDK {
4772
6991
  constructor(props) {
4773
6992
  this.config = isConfig(props) ? props : createConfig(props);
4774
6993
  this.clusters = createClusterManager(this.config);
6994
+ this.dao = createDaoManager(this.config);
4775
6995
  this.operators = createOperatorManager(this.config);
4776
6996
  this.api = this.config.api;
4777
6997
  this.contract = this.config.contract;
4778
6998
  this.utils = createUtils(this.config);
4779
6999
  }
7000
+ connectWallet(walletClient) {
7001
+ config.configArgsSchema.parse({
7002
+ publicClient: this.config.publicClient,
7003
+ walletClient
7004
+ });
7005
+ this.config.walletClient = walletClient;
7006
+ this.config.contract = createContractInteractions({
7007
+ walletClient,
7008
+ publicClient: this.config.publicClient,
7009
+ addresses: this.config.contractAddresses
7010
+ });
7011
+ this.contract = this.config.contract;
7012
+ this.operators = createOperatorManager(this.config);
7013
+ return this;
7014
+ }
4780
7015
  }
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;
7016
+ exports.chainIds = config.chainIds;
7017
+ exports.chains = config.chains;
7018
+ exports.contracts = config.contracts;
7019
+ exports.globals = config.globals;
7020
+ exports.graph_endpoints = config.graph_endpoints;
7021
+ exports.hoodi = config.hoodi;
7022
+ exports.networks = config.networks;
7023
+ exports.paid_graph_endpoints = config.paid_graph_endpoints;
7024
+ exports.registerValidatorsByClusterSizeLimits = config.registerValidatorsByClusterSizeLimits;
7025
+ exports.rest_endpoints = config.rest_endpoints;
4791
7026
  exports.KeyShares = KeyShares.KeyShares;
4792
7027
  exports.KeySharesItem = KeyShares.KeySharesItem;
4793
7028
  exports.OperatorPublicKeyError = KeyShares.OperatorPublicKeyError;
@@ -4798,6 +7033,7 @@ exports.SSVSDK = SSVSDK;
4798
7033
  exports.createClusterManager = createClusterManager;
4799
7034
  exports.createConfig = createConfig;
4800
7035
  exports.createContractInteractions = createContractInteractions;
7036
+ exports.createDaoManager = createDaoManager;
4801
7037
  exports.createOperatorManager = createOperatorManager;
4802
7038
  exports.createQueries = createQueries;
4803
7039
  exports.createReader = createReader;
@@ -4808,6 +7044,7 @@ exports.getCluster = getCluster;
4808
7044
  exports.getClusterBalance = getClusterBalance$1;
4809
7045
  exports.getClusterSnapshot = getClusterSnapshot;
4810
7046
  exports.getClusters = getClusters;
7047
+ exports.getDaoValues = getDaoValues;
4811
7048
  exports.getOperator = getOperator;
4812
7049
  exports.getOperators = getOperators;
4813
7050
  exports.getOwnerNonce = getOwnerNonce;