@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.mjs CHANGED
@@ -1,382 +1,155 @@
1
- import require$$0 from "fs";
2
- import require$$1 from "path";
3
- import require$$2 from "os";
4
- import crypto$1 from "crypto";
5
- import { E as decodeOperatorPublicKey, s as stringifyBigints, F as tryCatch, G as configArgsSchema, H as contracts, I as paid_graph_endpoints, J as graph_endpoints, L as rest_endpoints, j as getClusterSnapshot$1, m as isKeySharesItem, M as registerValidatorsByClusterSizeLimits, g as createClusterId, k as createEmptyCluster, r as roundOperatorFee, N as globals, b as bigintMax, t as ensureNoKeysharesErrors, p as ensureValidatorsUniqueness, q as validateConsistentOperatorPublicKeys, v as validateConsistentOperatorIds, C as sortNumbers, o as KeysharesValidationError, K as KeysharesValidationErrors } from "./globals-CDOcDUnk.mjs";
6
- import { Q, P, O, R } from "./globals-CDOcDUnk.mjs";
1
+ import { n as decodeOperatorPublicKey, C as stringifyBigints, E as tryCatch, k as configArgsSchema, H as contracts, I as paid_graph_endpoints, J as graph_endpoints, L as rest_endpoints, D as toSolidityCluster, w as isKeySharesItem, M as registerValidatorsByClusterSizeLimits, l as createClusterId, m as createEmptyCluster, A as roundOperatorFee, N as globals, g as bigintMax, o as ensureNoKeysharesErrors, p as ensureValidatorsUniqueness, G as validateConsistentOperatorPublicKeys, F as validateConsistentOperatorIds, B as sortNumbers, K as KeysharesValidationError, a as KeysharesValidationErrors } from "./config-BdEJjnYA.mjs";
2
+ import { O, P, Q, R } from "./config-BdEJjnYA.mjs";
7
3
  import { isUndefined, isEqual } from "lodash-es";
8
- import { decodeEventLog, encodeFunctionData, encodeAbiParameters, parseAbiParameters, isAddressEqual, zeroAddress } from "viem";
4
+ import { isAddressEqual, decodeEventLog, encodeFunctionData, encodeAbiParameters, parseAbiParameters, zeroAddress } from "viem";
9
5
  import { GraphQLClient } from "graphql-request";
10
- import { S as SSVKeys, a as KeyShares, K as KeySharesItem } from "./KeyShares-ClzHwMUy.mjs";
11
- import { O as O2, c, b } from "./KeyShares-ClzHwMUy.mjs";
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
- }
6
+ import { S as SSVKeys, K as KeyShares, a as KeySharesItem } from "./KeyShares-Dlp4Pa3b.mjs";
7
+ import { O as O2, b, c } from "./KeyShares-Dlp4Pa3b.mjs";
8
+ var ClusterFeeAssetTypes = /* @__PURE__ */ ((ClusterFeeAssetTypes2) => {
9
+ ClusterFeeAssetTypes2["ETH"] = "ETH";
10
+ ClusterFeeAssetTypes2["SSV"] = "SSV";
11
+ return ClusterFeeAssetTypes2;
12
+ })(ClusterFeeAssetTypes || {});
13
+ const GetClusterSnapshotDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterSnapshot" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
14
+ const GetClusterDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetCluster" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
15
+ const GetClustersDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusters" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
16
+ const GetOwnerNonceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOwnerNonce" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
17
+ const GetOwnerNonceByBlockDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOwnerNonceByBlock" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "block" } }, "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Int" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "account" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "owner" } } }, { "kind": "Argument", "name": { "kind": "Name", "value": "block" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "number" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "block" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "nonce" } }] } }] } }] };
18
+ const GetOperatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOperator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] } }] };
19
+ const GetOperatorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetOperators" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] } }] };
20
+ const GetValidatorsDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetValidators" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "ids" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "Bytes" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
21
+ const GetValidatorDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetValidator" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "id" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
22
+ const GetClusterBalanceDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetClusterBalance" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }, { "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } }, "type": { "kind": "NonNullType", "type": { "kind": "ListType", "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "String" } } } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_meta" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "block" }, "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "number" } }] } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "daovalues" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "networkFee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndexBlockNumberSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThreshold" } }, { "kind": "Field", "name": { "kind": "Name", "value": "liquidationThresholdSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateral" } }, { "kind": "Field", "name": { "kind": "Name", "value": "minimumLiquidationCollateralSSV" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "operators" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "where" }, "value": { "kind": "ObjectValue", "fields": [{ "kind": "ObjectField", "name": { "kind": "Name", "value": "id_in" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "operatorIds" } } }] } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "fee" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumber" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexSSV" } }, { "kind": "Field", "name": { "kind": "Name", "value": "feeIndexBlockNumberSSV" } }] } }, { "kind": "Field", "name": { "kind": "Name", "value": "cluster" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "id" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "clusterId" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "feeAsset" } }, { "kind": "Field", "name": { "kind": "Name", "value": "validatorCount" } }, { "kind": "Field", "name": { "kind": "Name", "value": "networkFeeIndex" } }, { "kind": "Field", "name": { "kind": "Name", "value": "index" } }, { "kind": "Field", "name": { "kind": "Name", "value": "balance" } }, { "kind": "Field", "name": { "kind": "Name", "value": "effectiveBalance" } }] } }] } }] };
23
+ const GetDaoValuesDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "query", "name": { "kind": "Name", "value": "GetDaoValues" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "daoAddress" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "ID" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "_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" } }] } }] } }] };
24
+ const requireSafeNumber = (rawValue, fieldName) => {
25
+ if (rawValue === null || typeof rawValue === "undefined") {
26
+ throw new Error(`Could not resolve ${fieldName}`);
257
27
  }
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;
28
+ const value = BigInt(rawValue);
29
+ if (value > BigInt(Number.MAX_SAFE_INTEGER)) {
30
+ throw new Error(`${fieldName} exceeds MAX_SAFE_INTEGER`);
266
31
  }
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
- }
32
+ return Number(value);
33
+ };
34
+ const getSnapshotBlockNumber = (response) => {
35
+ if (response._meta?.block.number === null || typeof response._meta?.block.number === "undefined") {
36
+ throw new Error(
37
+ "Subgraph endpoint must support _meta.block.number for snapshot-aware SDK reads."
38
+ );
282
39
  }
283
- }
284
- const DotenvModule = {
285
- configDotenv,
286
- _configVault,
287
- _parseVault,
288
- config,
289
- decrypt,
290
- parse,
291
- populate
40
+ return requireSafeNumber(response._meta.block.number, "snapshot block number");
292
41
  };
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";
42
+ const mapOperator = (operator) => ({
43
+ ...operator,
44
+ publicKey: decodeOperatorPublicKey(operator.publicKey),
45
+ whitelisted: operator.whitelisted.map((v) => v.id)
46
+ });
47
+ const withSnapshotBlock = (response, payload) => ({
48
+ blockNumber: getSnapshotBlockNumber(response),
49
+ ...payload
50
+ });
51
+ const getOwnerNonce = async (client, args) => {
52
+ if (typeof args.block === "number") {
53
+ const response2 = await client.request(
54
+ GetOwnerNonceByBlockDocument,
55
+ args
56
+ );
57
+ return {
58
+ blockNumber: requireSafeNumber(args.block, "snapshot block number"),
59
+ nonce: requireSafeNumber(response2.account?.nonce ?? "0", "owner nonce")
60
+ };
333
61
  }
334
- return options2;
62
+ const response = await client.request(
63
+ GetOwnerNonceDocument,
64
+ args
65
+ );
66
+ return withSnapshotBlock(response, {
67
+ nonce: requireSafeNumber(response.account?.nonce ?? "0", "owner nonce")
68
+ });
335
69
  };
336
- (function() {
337
- mainExports.config(
338
- Object.assign(
339
- {},
340
- envOptions,
341
- cliOptions(process.argv)
342
- )
70
+ const getClusterSnapshot = async (client, args) => {
71
+ const response = await client.request(
72
+ GetClusterSnapshotDocument,
73
+ args
343
74
  );
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");
75
+ return withSnapshotBlock(response, {
76
+ cluster: response.cluster
77
+ });
78
+ };
79
+ const getCluster = async (client, args) => {
80
+ const response = await client.request(
81
+ GetClusterDocument,
82
+ args
83
+ );
84
+ return withSnapshotBlock(response, {
85
+ cluster: response.cluster
86
+ });
87
+ };
88
+ const getClusters = async (client, args) => {
89
+ const response = await client.request(
90
+ GetClustersDocument,
91
+ args
92
+ );
93
+ return withSnapshotBlock(response, {
94
+ clusters: response.clusters
95
+ });
96
+ };
97
+ const getOperator = async (client, args) => {
98
+ const response = await client.request(
99
+ GetOperatorDocument,
100
+ args
101
+ );
102
+ return withSnapshotBlock(response, {
103
+ operator: response.operator ? mapOperator(response.operator) : null
104
+ });
105
+ };
106
+ const getOperators = async (client, args) => {
107
+ const response = await client.request(
108
+ GetOperatorsDocument,
109
+ args
110
+ );
111
+ return withSnapshotBlock(response, {
112
+ operators: response.operators.map(mapOperator)
113
+ });
114
+ };
115
+ const getValidators = async (client, args) => {
116
+ const response = await client.request(
117
+ GetValidatorsDocument,
118
+ args
119
+ );
120
+ return withSnapshotBlock(response, {
121
+ validators: response.validators
122
+ });
123
+ };
124
+ const getValidator = async (client, args) => {
125
+ const response = await client.request(
126
+ GetValidatorDocument,
127
+ args
128
+ );
129
+ return withSnapshotBlock(response, {
130
+ validator: response.validator
131
+ });
132
+ };
133
+ const getClusterBalance$1 = async (client, args) => {
134
+ const response = await client.request(
135
+ GetClusterBalanceDocument,
136
+ args
137
+ );
138
+ return withSnapshotBlock(response, {
139
+ cluster: response.cluster,
140
+ daovalues: response.daovalues,
141
+ operators: response.operators
142
+ });
143
+ };
144
+ const getDaoValues = async (client, args) => {
145
+ const response = await client.request(
146
+ GetDaoValuesDocument,
147
+ args
148
+ );
149
+ return withSnapshotBlock(response, {
150
+ daovalues: response.daovalues
151
+ });
358
152
  };
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: 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: 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
153
  const getQueries = (client) => ({
381
154
  getOwnerNonce: getOwnerNonce.bind(null, client),
382
155
  getClusterSnapshot: getClusterSnapshot.bind(null, client),
@@ -386,7 +159,8 @@ const getQueries = (client) => ({
386
159
  getOperators: getOperators.bind(null, client),
387
160
  getValidators: getValidators.bind(null, client),
388
161
  getValidator: getValidator.bind(null, client),
389
- getClusterBalance: getClusterBalance$1.bind(null, client)
162
+ getClusterBalance: getClusterBalance$1.bind(null, client),
163
+ getDaoValues: getDaoValues.bind(null, client)
390
164
  });
391
165
  const MainnetV4GetterABI = [
392
166
  {
@@ -405,6 +179,11 @@ const MainnetV4GetterABI = [
405
179
  name: "AddressIsWhitelistingContract",
406
180
  type: "error"
407
181
  },
182
+ {
183
+ inputs: [],
184
+ name: "AlreadyVoted",
185
+ type: "error"
186
+ },
408
187
  {
409
188
  inputs: [],
410
189
  name: "ApprovalNotWithinTimeframe",
@@ -454,7 +233,7 @@ const MainnetV4GetterABI = [
454
233
  },
455
234
  {
456
235
  inputs: [],
457
- name: "ClusterDoesNotExists",
236
+ name: "ClusterDoesNotExist",
458
237
  type: "error"
459
238
  },
460
239
  {
@@ -467,6 +246,21 @@ const MainnetV4GetterABI = [
467
246
  name: "ClusterNotLiquidatable",
468
247
  type: "error"
469
248
  },
249
+ {
250
+ inputs: [],
251
+ name: "EBBelowMinimum",
252
+ type: "error"
253
+ },
254
+ {
255
+ inputs: [],
256
+ name: "EBExceedsMaximum",
257
+ type: "error"
258
+ },
259
+ {
260
+ inputs: [],
261
+ name: "ETHTransferFailed",
262
+ type: "error"
263
+ },
470
264
  {
471
265
  inputs: [],
472
266
  name: "EmptyPublicKeysList",
@@ -514,11 +308,32 @@ const MainnetV4GetterABI = [
514
308
  name: "FeeTooLow",
515
309
  type: "error"
516
310
  },
311
+ {
312
+ inputs: [],
313
+ name: "FutureBlockNumber",
314
+ type: "error"
315
+ },
517
316
  {
518
317
  inputs: [],
519
318
  name: "IncorrectClusterState",
520
319
  type: "error"
521
320
  },
321
+ {
322
+ inputs: [],
323
+ name: "IncorrectClusterVersion",
324
+ type: "error"
325
+ },
326
+ {
327
+ inputs: [
328
+ {
329
+ internalType: "uint8",
330
+ name: "operatorVersion",
331
+ type: "uint8"
332
+ }
333
+ ],
334
+ name: "IncorrectOperatorVersion",
335
+ type: "error"
336
+ },
522
337
  {
523
338
  inputs: [],
524
339
  name: "IncorrectValidatorState",
@@ -542,7 +357,17 @@ const MainnetV4GetterABI = [
542
357
  },
543
358
  {
544
359
  inputs: [],
545
- name: "InvalidContractAddress",
360
+ name: "InsufficientCSSVSupply",
361
+ type: "error"
362
+ },
363
+ {
364
+ inputs: [],
365
+ name: "InvalidOperatorFeeIncreaseLimit",
366
+ type: "error"
367
+ },
368
+ {
369
+ inputs: [],
370
+ name: "InvalidOperatorFeeRange",
546
371
  type: "error"
547
372
  },
548
373
  {
@@ -550,11 +375,31 @@ const MainnetV4GetterABI = [
550
375
  name: "InvalidOperatorIdsLength",
551
376
  type: "error"
552
377
  },
378
+ {
379
+ inputs: [],
380
+ name: "InvalidOracleId",
381
+ type: "error"
382
+ },
383
+ {
384
+ inputs: [],
385
+ name: "InvalidProof",
386
+ type: "error"
387
+ },
553
388
  {
554
389
  inputs: [],
555
390
  name: "InvalidPublicKeyLength",
556
391
  type: "error"
557
392
  },
393
+ {
394
+ inputs: [],
395
+ name: "InvalidQuorum",
396
+ type: "error"
397
+ },
398
+ {
399
+ inputs: [],
400
+ name: "InvalidToken",
401
+ type: "error"
402
+ },
558
403
  {
559
404
  inputs: [],
560
405
  name: "InvalidWhitelistAddressesLength",
@@ -571,11 +416,31 @@ const MainnetV4GetterABI = [
571
416
  name: "InvalidWhitelistingContract",
572
417
  type: "error"
573
418
  },
419
+ {
420
+ inputs: [],
421
+ name: "LegacyOperatorFeeDeclarationInvalid",
422
+ type: "error"
423
+ },
424
+ {
425
+ inputs: [],
426
+ name: "MaxPrecisionExceeded",
427
+ type: "error"
428
+ },
429
+ {
430
+ inputs: [],
431
+ name: "MaxRequestsAmountReached",
432
+ type: "error"
433
+ },
574
434
  {
575
435
  inputs: [],
576
436
  name: "MaxValueExceeded",
577
437
  type: "error"
578
438
  },
439
+ {
440
+ inputs: [],
441
+ name: "MustUseLatestRoot",
442
+ type: "error"
443
+ },
579
444
  {
580
445
  inputs: [],
581
446
  name: "NewBlockPeriodIsBelowMinimum",
@@ -588,7 +453,22 @@ const MainnetV4GetterABI = [
588
453
  },
589
454
  {
590
455
  inputs: [],
591
- name: "NotAuthorized",
456
+ name: "NotCSSV",
457
+ type: "error"
458
+ },
459
+ {
460
+ inputs: [],
461
+ name: "NotOracle",
462
+ type: "error"
463
+ },
464
+ {
465
+ inputs: [],
466
+ name: "NothingToClaim",
467
+ type: "error"
468
+ },
469
+ {
470
+ inputs: [],
471
+ name: "NothingToWithdraw",
592
472
  type: "error"
593
473
  },
594
474
  {
@@ -606,16 +486,46 @@ const MainnetV4GetterABI = [
606
486
  name: "OperatorsListNotUnique",
607
487
  type: "error"
608
488
  },
489
+ {
490
+ inputs: [],
491
+ name: "OracleAlreadyAssigned",
492
+ type: "error"
493
+ },
609
494
  {
610
495
  inputs: [],
611
496
  name: "PublicKeysSharesLengthMismatch",
612
497
  type: "error"
613
498
  },
499
+ {
500
+ inputs: [],
501
+ name: "RootNotFound",
502
+ type: "error"
503
+ },
614
504
  {
615
505
  inputs: [],
616
506
  name: "SameFeeChangeNotAllowed",
617
507
  type: "error"
618
508
  },
509
+ {
510
+ inputs: [],
511
+ name: "SameOracleAddressNotAllowed",
512
+ type: "error"
513
+ },
514
+ {
515
+ inputs: [],
516
+ name: "StakeTooLow",
517
+ type: "error"
518
+ },
519
+ {
520
+ inputs: [],
521
+ name: "StaleBlockNumber",
522
+ type: "error"
523
+ },
524
+ {
525
+ inputs: [],
526
+ name: "StaleUpdate",
527
+ type: "error"
528
+ },
619
529
  {
620
530
  inputs: [],
621
531
  name: "TargetModuleDoesNotExist",
@@ -642,6 +552,16 @@ const MainnetV4GetterABI = [
642
552
  name: "UnsortedOperatorsList",
643
553
  type: "error"
644
554
  },
555
+ {
556
+ inputs: [],
557
+ name: "UnstakeAmountExceedsBalance",
558
+ type: "error"
559
+ },
560
+ {
561
+ inputs: [],
562
+ name: "UpdateTooFrequent",
563
+ type: "error"
564
+ },
645
565
  {
646
566
  inputs: [],
647
567
  name: "ValidatorAlreadyExists",
@@ -658,16 +578,47 @@ const MainnetV4GetterABI = [
658
578
  name: "ValidatorAlreadyExistsWithData",
659
579
  type: "error"
660
580
  },
581
+ {
582
+ inputs: [
583
+ {
584
+ internalType: "bytes",
585
+ name: "publicKey",
586
+ type: "bytes"
587
+ },
588
+ {
589
+ internalType: "address",
590
+ name: "owner",
591
+ type: "address"
592
+ }
593
+ ],
594
+ name: "ValidatorAlreadyRegistered",
595
+ type: "error"
596
+ },
661
597
  {
662
598
  inputs: [],
663
599
  name: "ValidatorDoesNotExist",
664
600
  type: "error"
665
601
  },
602
+ {
603
+ inputs: [],
604
+ name: "ZeroAddress",
605
+ type: "error"
606
+ },
666
607
  {
667
608
  inputs: [],
668
609
  name: "ZeroAddressNotAllowed",
669
610
  type: "error"
670
611
  },
612
+ {
613
+ inputs: [],
614
+ name: "ZeroAmount",
615
+ type: "error"
616
+ },
617
+ {
618
+ inputs: [],
619
+ name: "ZeroCSSVSupply",
620
+ type: "error"
621
+ },
671
622
  {
672
623
  anonymous: false,
673
624
  inputs: [
@@ -766,13 +717,52 @@ const MainnetV4GetterABI = [
766
717
  },
767
718
  {
768
719
  inputs: [],
769
- name: "acceptOwnership",
770
- outputs: [],
771
- stateMutability: "nonpayable",
772
- type: "function"
773
- },
774
- {
775
- inputs: [
720
+ name: "accEthPerShare",
721
+ outputs: [
722
+ {
723
+ internalType: "uint256",
724
+ name: "",
725
+ type: "uint256"
726
+ }
727
+ ],
728
+ stateMutability: "view",
729
+ type: "function"
730
+ },
731
+ {
732
+ inputs: [],
733
+ name: "acceptOwnership",
734
+ outputs: [],
735
+ stateMutability: "nonpayable",
736
+ type: "function"
737
+ },
738
+ {
739
+ inputs: [],
740
+ name: "cooldownDuration",
741
+ outputs: [
742
+ {
743
+ internalType: "uint256",
744
+ name: "",
745
+ type: "uint256"
746
+ }
747
+ ],
748
+ stateMutability: "view",
749
+ type: "function"
750
+ },
751
+ {
752
+ inputs: [],
753
+ name: "getActiveOracleIds",
754
+ outputs: [
755
+ {
756
+ internalType: "uint32[4]",
757
+ name: "",
758
+ type: "uint32[4]"
759
+ }
760
+ ],
761
+ stateMutability: "view",
762
+ type: "function"
763
+ },
764
+ {
765
+ inputs: [
776
766
  {
777
767
  internalType: "address",
778
768
  name: "clusterOwner",
@@ -817,6 +807,118 @@ const MainnetV4GetterABI = [
817
807
  }
818
808
  ],
819
809
  name: "getBalance",
810
+ outputs: [
811
+ {
812
+ internalType: "uint256",
813
+ name: "balance",
814
+ type: "uint256"
815
+ }
816
+ ],
817
+ stateMutability: "view",
818
+ type: "function"
819
+ },
820
+ {
821
+ inputs: [
822
+ {
823
+ internalType: "address",
824
+ name: "clusterOwner",
825
+ type: "address"
826
+ },
827
+ {
828
+ internalType: "uint64[]",
829
+ name: "operatorIds",
830
+ type: "uint64[]"
831
+ },
832
+ {
833
+ components: [
834
+ {
835
+ internalType: "uint32",
836
+ name: "validatorCount",
837
+ type: "uint32"
838
+ },
839
+ {
840
+ internalType: "uint64",
841
+ name: "networkFeeIndex",
842
+ type: "uint64"
843
+ },
844
+ {
845
+ internalType: "uint64",
846
+ name: "index",
847
+ type: "uint64"
848
+ },
849
+ {
850
+ internalType: "bool",
851
+ name: "active",
852
+ type: "bool"
853
+ },
854
+ {
855
+ internalType: "uint256",
856
+ name: "balance",
857
+ type: "uint256"
858
+ }
859
+ ],
860
+ internalType: "struct ISSVNetworkCore.Cluster",
861
+ name: "cluster",
862
+ type: "tuple"
863
+ }
864
+ ],
865
+ name: "getBalanceSSV",
866
+ outputs: [
867
+ {
868
+ internalType: "uint256",
869
+ name: "balance",
870
+ type: "uint256"
871
+ }
872
+ ],
873
+ stateMutability: "view",
874
+ type: "function"
875
+ },
876
+ {
877
+ inputs: [
878
+ {
879
+ internalType: "address",
880
+ name: "clusterOwner",
881
+ type: "address"
882
+ },
883
+ {
884
+ internalType: "uint64[]",
885
+ name: "operatorIds",
886
+ type: "uint64[]"
887
+ },
888
+ {
889
+ components: [
890
+ {
891
+ internalType: "uint32",
892
+ name: "validatorCount",
893
+ type: "uint32"
894
+ },
895
+ {
896
+ internalType: "uint64",
897
+ name: "networkFeeIndex",
898
+ type: "uint64"
899
+ },
900
+ {
901
+ internalType: "uint64",
902
+ name: "index",
903
+ type: "uint64"
904
+ },
905
+ {
906
+ internalType: "bool",
907
+ name: "active",
908
+ type: "bool"
909
+ },
910
+ {
911
+ internalType: "uint256",
912
+ name: "balance",
913
+ type: "uint256"
914
+ }
915
+ ],
916
+ internalType: "struct ISSVNetworkCore.Cluster",
917
+ name: "cluster",
918
+ type: "tuple"
919
+ }
920
+ ],
921
+ name: "getBurnRate",
820
922
  outputs: [
821
923
  {
822
924
  internalType: "uint256",
@@ -872,7 +974,158 @@ const MainnetV4GetterABI = [
872
974
  type: "tuple"
873
975
  }
874
976
  ],
875
- name: "getBurnRate",
977
+ name: "getBurnRateSSV",
978
+ outputs: [
979
+ {
980
+ internalType: "uint256",
981
+ name: "",
982
+ type: "uint256"
983
+ }
984
+ ],
985
+ stateMutability: "view",
986
+ type: "function"
987
+ },
988
+ {
989
+ inputs: [
990
+ {
991
+ internalType: "address",
992
+ name: "owner",
993
+ type: "address"
994
+ },
995
+ {
996
+ internalType: "uint64[]",
997
+ name: "operatorIds",
998
+ type: "uint64[]"
999
+ }
1000
+ ],
1001
+ name: "getClusterAssetType",
1002
+ outputs: [
1003
+ {
1004
+ internalType: "uint8",
1005
+ name: "",
1006
+ type: "uint8"
1007
+ }
1008
+ ],
1009
+ stateMutability: "view",
1010
+ type: "function"
1011
+ },
1012
+ {
1013
+ inputs: [
1014
+ {
1015
+ internalType: "uint64",
1016
+ name: "blockNum",
1017
+ type: "uint64"
1018
+ }
1019
+ ],
1020
+ name: "getCommittedRoot",
1021
+ outputs: [
1022
+ {
1023
+ internalType: "bytes32",
1024
+ name: "",
1025
+ type: "bytes32"
1026
+ }
1027
+ ],
1028
+ stateMutability: "view",
1029
+ type: "function"
1030
+ },
1031
+ {
1032
+ inputs: [
1033
+ {
1034
+ internalType: "address",
1035
+ name: "clusterOwner",
1036
+ type: "address"
1037
+ },
1038
+ {
1039
+ internalType: "uint64[]",
1040
+ name: "operatorIds",
1041
+ type: "uint64[]"
1042
+ },
1043
+ {
1044
+ components: [
1045
+ {
1046
+ internalType: "uint32",
1047
+ name: "validatorCount",
1048
+ type: "uint32"
1049
+ },
1050
+ {
1051
+ internalType: "uint64",
1052
+ name: "networkFeeIndex",
1053
+ type: "uint64"
1054
+ },
1055
+ {
1056
+ internalType: "uint64",
1057
+ name: "index",
1058
+ type: "uint64"
1059
+ },
1060
+ {
1061
+ internalType: "bool",
1062
+ name: "active",
1063
+ type: "bool"
1064
+ },
1065
+ {
1066
+ internalType: "uint256",
1067
+ name: "balance",
1068
+ type: "uint256"
1069
+ }
1070
+ ],
1071
+ internalType: "struct ISSVNetworkCore.Cluster",
1072
+ name: "cluster",
1073
+ type: "tuple"
1074
+ }
1075
+ ],
1076
+ name: "getEffectiveBalance",
1077
+ outputs: [
1078
+ {
1079
+ internalType: "uint32",
1080
+ name: "effectiveBalance",
1081
+ type: "uint32"
1082
+ }
1083
+ ],
1084
+ stateMutability: "view",
1085
+ type: "function"
1086
+ },
1087
+ {
1088
+ inputs: [],
1089
+ name: "getLiquidationThresholdPeriod",
1090
+ outputs: [
1091
+ {
1092
+ internalType: "uint64",
1093
+ name: "",
1094
+ type: "uint64"
1095
+ }
1096
+ ],
1097
+ stateMutability: "view",
1098
+ type: "function"
1099
+ },
1100
+ {
1101
+ inputs: [],
1102
+ name: "getLiquidationThresholdPeriodSSV",
1103
+ outputs: [
1104
+ {
1105
+ internalType: "uint64",
1106
+ name: "",
1107
+ type: "uint64"
1108
+ }
1109
+ ],
1110
+ stateMutability: "view",
1111
+ type: "function"
1112
+ },
1113
+ {
1114
+ inputs: [],
1115
+ name: "getMaximumOperatorFee",
1116
+ outputs: [
1117
+ {
1118
+ internalType: "uint256",
1119
+ name: "",
1120
+ type: "uint256"
1121
+ }
1122
+ ],
1123
+ stateMutability: "view",
1124
+ type: "function"
1125
+ },
1126
+ {
1127
+ inputs: [],
1128
+ name: "getMaximumOperatorFeeSSV",
876
1129
  outputs: [
877
1130
  {
878
1131
  internalType: "uint256",
@@ -885,12 +1138,12 @@ const MainnetV4GetterABI = [
885
1138
  },
886
1139
  {
887
1140
  inputs: [],
888
- name: "getLiquidationThresholdPeriod",
1141
+ name: "getMinimumLiquidationCollateral",
889
1142
  outputs: [
890
1143
  {
891
- internalType: "uint64",
1144
+ internalType: "uint256",
892
1145
  name: "",
893
- type: "uint64"
1146
+ type: "uint256"
894
1147
  }
895
1148
  ],
896
1149
  stateMutability: "view",
@@ -898,12 +1151,12 @@ const MainnetV4GetterABI = [
898
1151
  },
899
1152
  {
900
1153
  inputs: [],
901
- name: "getMaximumOperatorFee",
1154
+ name: "getMinimumLiquidationCollateralSSV",
902
1155
  outputs: [
903
1156
  {
904
- internalType: "uint64",
1157
+ internalType: "uint256",
905
1158
  name: "",
906
- type: "uint64"
1159
+ type: "uint256"
907
1160
  }
908
1161
  ],
909
1162
  stateMutability: "view",
@@ -911,7 +1164,7 @@ const MainnetV4GetterABI = [
911
1164
  },
912
1165
  {
913
1166
  inputs: [],
914
- name: "getMinimumLiquidationCollateral",
1167
+ name: "getMinimumOperatorEthFee",
915
1168
  outputs: [
916
1169
  {
917
1170
  internalType: "uint256",
@@ -935,6 +1188,19 @@ const MainnetV4GetterABI = [
935
1188
  stateMutability: "view",
936
1189
  type: "function"
937
1190
  },
1191
+ {
1192
+ inputs: [],
1193
+ name: "getNetworkEarningsSSV",
1194
+ outputs: [
1195
+ {
1196
+ internalType: "uint256",
1197
+ name: "",
1198
+ type: "uint256"
1199
+ }
1200
+ ],
1201
+ stateMutability: "view",
1202
+ type: "function"
1203
+ },
938
1204
  {
939
1205
  inputs: [],
940
1206
  name: "getNetworkFee",
@@ -948,6 +1214,19 @@ const MainnetV4GetterABI = [
948
1214
  stateMutability: "view",
949
1215
  type: "function"
950
1216
  },
1217
+ {
1218
+ inputs: [],
1219
+ name: "getNetworkFeeSSV",
1220
+ outputs: [
1221
+ {
1222
+ internalType: "uint256",
1223
+ name: "",
1224
+ type: "uint256"
1225
+ }
1226
+ ],
1227
+ stateMutability: "view",
1228
+ type: "function"
1229
+ },
951
1230
  {
952
1231
  inputs: [],
953
1232
  name: "getNetworkValidatorsCount",
@@ -972,34 +1251,92 @@ const MainnetV4GetterABI = [
972
1251
  name: "getOperatorById",
973
1252
  outputs: [
974
1253
  {
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",
1254
+ components: [
1255
+ {
1256
+ internalType: "address",
1257
+ name: "owner",
1258
+ type: "address"
1259
+ },
1260
+ {
1261
+ internalType: "uint256",
1262
+ name: "fee",
1263
+ type: "uint256"
1264
+ },
1265
+ {
1266
+ internalType: "uint32",
1267
+ name: "validatorCount",
1268
+ type: "uint32"
1269
+ },
1270
+ {
1271
+ internalType: "address",
1272
+ name: "whitelistedAddress",
1273
+ type: "address"
1274
+ },
1275
+ {
1276
+ internalType: "bool",
1277
+ name: "isPrivate",
1278
+ type: "bool"
1279
+ },
1280
+ {
1281
+ internalType: "bool",
1282
+ name: "isActive",
1283
+ type: "bool"
1284
+ }
1285
+ ],
1286
+ internalType: "struct ISSVViewsTypes.OperatorData",
991
1287
  name: "",
992
- type: "address"
993
- },
1288
+ type: "tuple"
1289
+ }
1290
+ ],
1291
+ stateMutability: "view",
1292
+ type: "function"
1293
+ },
1294
+ {
1295
+ inputs: [
994
1296
  {
995
- internalType: "bool",
996
- name: "",
997
- type: "bool"
998
- },
1297
+ internalType: "uint64",
1298
+ name: "operatorId",
1299
+ type: "uint64"
1300
+ }
1301
+ ],
1302
+ name: "getOperatorByIdSSV",
1303
+ outputs: [
999
1304
  {
1000
- internalType: "bool",
1305
+ components: [
1306
+ {
1307
+ internalType: "address",
1308
+ name: "owner",
1309
+ type: "address"
1310
+ },
1311
+ {
1312
+ internalType: "uint256",
1313
+ name: "fee",
1314
+ type: "uint256"
1315
+ },
1316
+ {
1317
+ internalType: "uint32",
1318
+ name: "validatorCount",
1319
+ type: "uint32"
1320
+ },
1321
+ {
1322
+ internalType: "address",
1323
+ name: "whitelistedAddress",
1324
+ type: "address"
1325
+ },
1326
+ {
1327
+ internalType: "bool",
1328
+ name: "isPrivate",
1329
+ type: "bool"
1330
+ },
1331
+ {
1332
+ internalType: "bool",
1333
+ name: "isActive",
1334
+ type: "bool"
1335
+ }
1336
+ ],
1337
+ internalType: "struct ISSVViewsTypes.OperatorData",
1001
1338
  name: "",
1002
- type: "bool"
1339
+ type: "tuple"
1003
1340
  }
1004
1341
  ],
1005
1342
  stateMutability: "view",
@@ -1016,24 +1353,50 @@ const MainnetV4GetterABI = [
1016
1353
  name: "getOperatorDeclaredFee",
1017
1354
  outputs: [
1018
1355
  {
1019
- internalType: "bool",
1020
- name: "",
1021
- type: "bool"
1022
- },
1023
- {
1024
- internalType: "uint256",
1356
+ components: [
1357
+ {
1358
+ internalType: "bool",
1359
+ name: "isFeeDeclared",
1360
+ type: "bool"
1361
+ },
1362
+ {
1363
+ internalType: "uint256",
1364
+ name: "fee",
1365
+ type: "uint256"
1366
+ },
1367
+ {
1368
+ internalType: "uint64",
1369
+ name: "approvalBeginTime",
1370
+ type: "uint64"
1371
+ },
1372
+ {
1373
+ internalType: "uint64",
1374
+ name: "approvalEndTime",
1375
+ type: "uint64"
1376
+ }
1377
+ ],
1378
+ internalType: "struct ISSVViewsTypes.OperatorDeclaredFeeData",
1025
1379
  name: "",
1026
- type: "uint256"
1027
- },
1380
+ type: "tuple"
1381
+ }
1382
+ ],
1383
+ stateMutability: "view",
1384
+ type: "function"
1385
+ },
1386
+ {
1387
+ inputs: [
1028
1388
  {
1029
1389
  internalType: "uint64",
1030
- name: "",
1390
+ name: "id",
1031
1391
  type: "uint64"
1032
- },
1392
+ }
1393
+ ],
1394
+ name: "getOperatorEarnings",
1395
+ outputs: [
1033
1396
  {
1034
- internalType: "uint64",
1397
+ internalType: "uint256",
1035
1398
  name: "",
1036
- type: "uint64"
1399
+ type: "uint256"
1037
1400
  }
1038
1401
  ],
1039
1402
  stateMutability: "view",
@@ -1047,7 +1410,7 @@ const MainnetV4GetterABI = [
1047
1410
  type: "uint64"
1048
1411
  }
1049
1412
  ],
1050
- name: "getOperatorEarnings",
1413
+ name: "getOperatorEarningsSSV",
1051
1414
  outputs: [
1052
1415
  {
1053
1416
  internalType: "uint256",
@@ -1095,14 +1458,91 @@ const MainnetV4GetterABI = [
1095
1458
  name: "getOperatorFeePeriods",
1096
1459
  outputs: [
1097
1460
  {
1098
- internalType: "uint64",
1461
+ components: [
1462
+ {
1463
+ internalType: "uint64",
1464
+ name: "declarePeriod",
1465
+ type: "uint64"
1466
+ },
1467
+ {
1468
+ internalType: "uint64",
1469
+ name: "executePeriod",
1470
+ type: "uint64"
1471
+ }
1472
+ ],
1473
+ internalType: "struct ISSVViewsTypes.OperatorFeePeriodsData",
1099
1474
  name: "",
1100
- type: "uint64"
1101
- },
1475
+ type: "tuple"
1476
+ }
1477
+ ],
1478
+ stateMutability: "view",
1479
+ type: "function"
1480
+ },
1481
+ {
1482
+ inputs: [
1102
1483
  {
1103
1484
  internalType: "uint64",
1485
+ name: "operatorId",
1486
+ type: "uint64"
1487
+ }
1488
+ ],
1489
+ name: "getOperatorFeeSSV",
1490
+ outputs: [
1491
+ {
1492
+ internalType: "uint256",
1493
+ name: "",
1494
+ type: "uint256"
1495
+ }
1496
+ ],
1497
+ stateMutability: "view",
1498
+ type: "function"
1499
+ },
1500
+ {
1501
+ inputs: [
1502
+ {
1503
+ internalType: "uint32",
1504
+ name: "oracleId",
1505
+ type: "uint32"
1506
+ }
1507
+ ],
1508
+ name: "getOracle",
1509
+ outputs: [
1510
+ {
1511
+ internalType: "address",
1512
+ name: "",
1513
+ type: "address"
1514
+ }
1515
+ ],
1516
+ stateMutability: "view",
1517
+ type: "function"
1518
+ },
1519
+ {
1520
+ inputs: [
1521
+ {
1522
+ internalType: "uint32",
1523
+ name: "oracleId",
1524
+ type: "uint32"
1525
+ }
1526
+ ],
1527
+ name: "getOracleWeight",
1528
+ outputs: [
1529
+ {
1530
+ internalType: "uint256",
1531
+ name: "",
1532
+ type: "uint256"
1533
+ }
1534
+ ],
1535
+ stateMutability: "view",
1536
+ type: "function"
1537
+ },
1538
+ {
1539
+ inputs: [],
1540
+ name: "getQuorumBps",
1541
+ outputs: [
1542
+ {
1543
+ internalType: "uint16",
1104
1544
  name: "",
1105
- type: "uint64"
1545
+ type: "uint16"
1106
1546
  }
1107
1547
  ],
1108
1548
  stateMutability: "view",
@@ -1280,6 +1720,62 @@ const MainnetV4GetterABI = [
1280
1720
  stateMutability: "view",
1281
1721
  type: "function"
1282
1722
  },
1723
+ {
1724
+ inputs: [
1725
+ {
1726
+ internalType: "address",
1727
+ name: "clusterOwner",
1728
+ type: "address"
1729
+ },
1730
+ {
1731
+ internalType: "uint64[]",
1732
+ name: "operatorIds",
1733
+ type: "uint64[]"
1734
+ },
1735
+ {
1736
+ components: [
1737
+ {
1738
+ internalType: "uint32",
1739
+ name: "validatorCount",
1740
+ type: "uint32"
1741
+ },
1742
+ {
1743
+ internalType: "uint64",
1744
+ name: "networkFeeIndex",
1745
+ type: "uint64"
1746
+ },
1747
+ {
1748
+ internalType: "uint64",
1749
+ name: "index",
1750
+ type: "uint64"
1751
+ },
1752
+ {
1753
+ internalType: "bool",
1754
+ name: "active",
1755
+ type: "bool"
1756
+ },
1757
+ {
1758
+ internalType: "uint256",
1759
+ name: "balance",
1760
+ type: "uint256"
1761
+ }
1762
+ ],
1763
+ internalType: "struct ISSVNetworkCore.Cluster",
1764
+ name: "cluster",
1765
+ type: "tuple"
1766
+ }
1767
+ ],
1768
+ name: "isLiquidatableSSV",
1769
+ outputs: [
1770
+ {
1771
+ internalType: "bool",
1772
+ name: "",
1773
+ type: "bool"
1774
+ }
1775
+ ],
1776
+ stateMutability: "view",
1777
+ type: "function"
1778
+ },
1283
1779
  {
1284
1780
  inputs: [
1285
1781
  {
@@ -1381,6 +1877,56 @@ const MainnetV4GetterABI = [
1381
1877
  stateMutability: "view",
1382
1878
  type: "function"
1383
1879
  },
1880
+ {
1881
+ inputs: [
1882
+ {
1883
+ internalType: "address",
1884
+ name: "user",
1885
+ type: "address"
1886
+ }
1887
+ ],
1888
+ name: "pendingUnstake",
1889
+ outputs: [
1890
+ {
1891
+ components: [
1892
+ {
1893
+ internalType: "uint256",
1894
+ name: "amount",
1895
+ type: "uint256"
1896
+ },
1897
+ {
1898
+ internalType: "uint256",
1899
+ name: "unlockTime",
1900
+ type: "uint256"
1901
+ }
1902
+ ],
1903
+ internalType: "struct ISSVViewsTypes.UnstakeRequestsData[]",
1904
+ name: "",
1905
+ type: "tuple[]"
1906
+ }
1907
+ ],
1908
+ stateMutability: "view",
1909
+ type: "function"
1910
+ },
1911
+ {
1912
+ inputs: [
1913
+ {
1914
+ internalType: "address",
1915
+ name: "user",
1916
+ type: "address"
1917
+ }
1918
+ ],
1919
+ name: "previewClaimableEth",
1920
+ outputs: [
1921
+ {
1922
+ internalType: "uint256",
1923
+ name: "",
1924
+ type: "uint256"
1925
+ }
1926
+ ],
1927
+ stateMutability: "view",
1928
+ type: "function"
1929
+ },
1384
1930
  {
1385
1931
  inputs: [],
1386
1932
  name: "proxiableUUID",
@@ -1414,6 +1960,51 @@ const MainnetV4GetterABI = [
1414
1960
  stateMutability: "view",
1415
1961
  type: "function"
1416
1962
  },
1963
+ {
1964
+ inputs: [
1965
+ {
1966
+ internalType: "address",
1967
+ name: "user",
1968
+ type: "address"
1969
+ }
1970
+ ],
1971
+ name: "stakedBalanceOf",
1972
+ outputs: [
1973
+ {
1974
+ internalType: "uint256",
1975
+ name: "",
1976
+ type: "uint256"
1977
+ }
1978
+ ],
1979
+ stateMutability: "view",
1980
+ type: "function"
1981
+ },
1982
+ {
1983
+ inputs: [],
1984
+ name: "stakingEthPoolBalance",
1985
+ outputs: [
1986
+ {
1987
+ internalType: "uint256",
1988
+ name: "",
1989
+ type: "uint256"
1990
+ }
1991
+ ],
1992
+ stateMutability: "view",
1993
+ type: "function"
1994
+ },
1995
+ {
1996
+ inputs: [],
1997
+ name: "totalStaked",
1998
+ outputs: [
1999
+ {
2000
+ internalType: "uint256",
2001
+ name: "",
2002
+ type: "uint256"
2003
+ }
2004
+ ],
2005
+ stateMutability: "view",
2006
+ type: "function"
2007
+ },
1417
2008
  {
1418
2009
  inputs: [
1419
2010
  {
@@ -1476,6 +2067,11 @@ const MainnetV4SetterABI = [
1476
2067
  name: "AddressIsWhitelistingContract",
1477
2068
  type: "error"
1478
2069
  },
2070
+ {
2071
+ inputs: [],
2072
+ name: "AlreadyVoted",
2073
+ type: "error"
2074
+ },
1479
2075
  {
1480
2076
  inputs: [],
1481
2077
  name: "ApprovalNotWithinTimeframe",
@@ -1525,7 +2121,7 @@ const MainnetV4SetterABI = [
1525
2121
  },
1526
2122
  {
1527
2123
  inputs: [],
1528
- name: "ClusterDoesNotExists",
2124
+ name: "ClusterDoesNotExist",
1529
2125
  type: "error"
1530
2126
  },
1531
2127
  {
@@ -1538,6 +2134,21 @@ const MainnetV4SetterABI = [
1538
2134
  name: "ClusterNotLiquidatable",
1539
2135
  type: "error"
1540
2136
  },
2137
+ {
2138
+ inputs: [],
2139
+ name: "EBBelowMinimum",
2140
+ type: "error"
2141
+ },
2142
+ {
2143
+ inputs: [],
2144
+ name: "EBExceedsMaximum",
2145
+ type: "error"
2146
+ },
2147
+ {
2148
+ inputs: [],
2149
+ name: "ETHTransferFailed",
2150
+ type: "error"
2151
+ },
1541
2152
  {
1542
2153
  inputs: [],
1543
2154
  name: "EmptyPublicKeysList",
@@ -1585,11 +2196,32 @@ const MainnetV4SetterABI = [
1585
2196
  name: "FeeTooLow",
1586
2197
  type: "error"
1587
2198
  },
2199
+ {
2200
+ inputs: [],
2201
+ name: "FutureBlockNumber",
2202
+ type: "error"
2203
+ },
1588
2204
  {
1589
2205
  inputs: [],
1590
2206
  name: "IncorrectClusterState",
1591
2207
  type: "error"
1592
2208
  },
2209
+ {
2210
+ inputs: [],
2211
+ name: "IncorrectClusterVersion",
2212
+ type: "error"
2213
+ },
2214
+ {
2215
+ inputs: [
2216
+ {
2217
+ internalType: "uint8",
2218
+ name: "operatorVersion",
2219
+ type: "uint8"
2220
+ }
2221
+ ],
2222
+ name: "IncorrectOperatorVersion",
2223
+ type: "error"
2224
+ },
1593
2225
  {
1594
2226
  inputs: [],
1595
2227
  name: "IncorrectValidatorState",
@@ -1613,7 +2245,17 @@ const MainnetV4SetterABI = [
1613
2245
  },
1614
2246
  {
1615
2247
  inputs: [],
1616
- name: "InvalidContractAddress",
2248
+ name: "InsufficientCSSVSupply",
2249
+ type: "error"
2250
+ },
2251
+ {
2252
+ inputs: [],
2253
+ name: "InvalidOperatorFeeIncreaseLimit",
2254
+ type: "error"
2255
+ },
2256
+ {
2257
+ inputs: [],
2258
+ name: "InvalidOperatorFeeRange",
1617
2259
  type: "error"
1618
2260
  },
1619
2261
  {
@@ -1621,11 +2263,31 @@ const MainnetV4SetterABI = [
1621
2263
  name: "InvalidOperatorIdsLength",
1622
2264
  type: "error"
1623
2265
  },
2266
+ {
2267
+ inputs: [],
2268
+ name: "InvalidOracleId",
2269
+ type: "error"
2270
+ },
2271
+ {
2272
+ inputs: [],
2273
+ name: "InvalidProof",
2274
+ type: "error"
2275
+ },
1624
2276
  {
1625
2277
  inputs: [],
1626
2278
  name: "InvalidPublicKeyLength",
1627
2279
  type: "error"
1628
2280
  },
2281
+ {
2282
+ inputs: [],
2283
+ name: "InvalidQuorum",
2284
+ type: "error"
2285
+ },
2286
+ {
2287
+ inputs: [],
2288
+ name: "InvalidToken",
2289
+ type: "error"
2290
+ },
1629
2291
  {
1630
2292
  inputs: [],
1631
2293
  name: "InvalidWhitelistAddressesLength",
@@ -1642,11 +2304,31 @@ const MainnetV4SetterABI = [
1642
2304
  name: "InvalidWhitelistingContract",
1643
2305
  type: "error"
1644
2306
  },
2307
+ {
2308
+ inputs: [],
2309
+ name: "LegacyOperatorFeeDeclarationInvalid",
2310
+ type: "error"
2311
+ },
2312
+ {
2313
+ inputs: [],
2314
+ name: "MaxPrecisionExceeded",
2315
+ type: "error"
2316
+ },
2317
+ {
2318
+ inputs: [],
2319
+ name: "MaxRequestsAmountReached",
2320
+ type: "error"
2321
+ },
1645
2322
  {
1646
2323
  inputs: [],
1647
2324
  name: "MaxValueExceeded",
1648
2325
  type: "error"
1649
2326
  },
2327
+ {
2328
+ inputs: [],
2329
+ name: "MustUseLatestRoot",
2330
+ type: "error"
2331
+ },
1650
2332
  {
1651
2333
  inputs: [],
1652
2334
  name: "NewBlockPeriodIsBelowMinimum",
@@ -1659,7 +2341,22 @@ const MainnetV4SetterABI = [
1659
2341
  },
1660
2342
  {
1661
2343
  inputs: [],
1662
- name: "NotAuthorized",
2344
+ name: "NotCSSV",
2345
+ type: "error"
2346
+ },
2347
+ {
2348
+ inputs: [],
2349
+ name: "NotOracle",
2350
+ type: "error"
2351
+ },
2352
+ {
2353
+ inputs: [],
2354
+ name: "NothingToClaim",
2355
+ type: "error"
2356
+ },
2357
+ {
2358
+ inputs: [],
2359
+ name: "NothingToWithdraw",
1663
2360
  type: "error"
1664
2361
  },
1665
2362
  {
@@ -1677,16 +2374,46 @@ const MainnetV4SetterABI = [
1677
2374
  name: "OperatorsListNotUnique",
1678
2375
  type: "error"
1679
2376
  },
2377
+ {
2378
+ inputs: [],
2379
+ name: "OracleAlreadyAssigned",
2380
+ type: "error"
2381
+ },
1680
2382
  {
1681
2383
  inputs: [],
1682
2384
  name: "PublicKeysSharesLengthMismatch",
1683
2385
  type: "error"
1684
2386
  },
2387
+ {
2388
+ inputs: [],
2389
+ name: "RootNotFound",
2390
+ type: "error"
2391
+ },
1685
2392
  {
1686
2393
  inputs: [],
1687
2394
  name: "SameFeeChangeNotAllowed",
1688
2395
  type: "error"
1689
2396
  },
2397
+ {
2398
+ inputs: [],
2399
+ name: "SameOracleAddressNotAllowed",
2400
+ type: "error"
2401
+ },
2402
+ {
2403
+ inputs: [],
2404
+ name: "StakeTooLow",
2405
+ type: "error"
2406
+ },
2407
+ {
2408
+ inputs: [],
2409
+ name: "StaleBlockNumber",
2410
+ type: "error"
2411
+ },
2412
+ {
2413
+ inputs: [],
2414
+ name: "StaleUpdate",
2415
+ type: "error"
2416
+ },
1690
2417
  {
1691
2418
  inputs: [],
1692
2419
  name: "TargetModuleDoesNotExist",
@@ -1705,12 +2432,22 @@ const MainnetV4SetterABI = [
1705
2432
  },
1706
2433
  {
1707
2434
  inputs: [],
1708
- name: "TokenTransferFailed",
2435
+ name: "TokenTransferFailed",
2436
+ type: "error"
2437
+ },
2438
+ {
2439
+ inputs: [],
2440
+ name: "UnsortedOperatorsList",
2441
+ type: "error"
2442
+ },
2443
+ {
2444
+ inputs: [],
2445
+ name: "UnstakeAmountExceedsBalance",
1709
2446
  type: "error"
1710
2447
  },
1711
2448
  {
1712
2449
  inputs: [],
1713
- name: "UnsortedOperatorsList",
2450
+ name: "UpdateTooFrequent",
1714
2451
  type: "error"
1715
2452
  },
1716
2453
  {
@@ -1729,16 +2466,47 @@ const MainnetV4SetterABI = [
1729
2466
  name: "ValidatorAlreadyExistsWithData",
1730
2467
  type: "error"
1731
2468
  },
2469
+ {
2470
+ inputs: [
2471
+ {
2472
+ internalType: "bytes",
2473
+ name: "publicKey",
2474
+ type: "bytes"
2475
+ },
2476
+ {
2477
+ internalType: "address",
2478
+ name: "owner",
2479
+ type: "address"
2480
+ }
2481
+ ],
2482
+ name: "ValidatorAlreadyRegistered",
2483
+ type: "error"
2484
+ },
1732
2485
  {
1733
2486
  inputs: [],
1734
2487
  name: "ValidatorDoesNotExist",
1735
2488
  type: "error"
1736
2489
  },
2490
+ {
2491
+ inputs: [],
2492
+ name: "ZeroAddress",
2493
+ type: "error"
2494
+ },
1737
2495
  {
1738
2496
  inputs: [],
1739
2497
  name: "ZeroAddressNotAllowed",
1740
2498
  type: "error"
1741
2499
  },
2500
+ {
2501
+ inputs: [],
2502
+ name: "ZeroAmount",
2503
+ type: "error"
2504
+ },
2505
+ {
2506
+ inputs: [],
2507
+ name: "ZeroCSSVSupply",
2508
+ type: "error"
2509
+ },
1742
2510
  {
1743
2511
  anonymous: false,
1744
2512
  inputs: [
@@ -1771,6 +2539,70 @@ const MainnetV4SetterABI = [
1771
2539
  name: "BeaconUpgraded",
1772
2540
  type: "event"
1773
2541
  },
2542
+ {
2543
+ anonymous: false,
2544
+ inputs: [
2545
+ {
2546
+ indexed: true,
2547
+ internalType: "address",
2548
+ name: "owner",
2549
+ type: "address"
2550
+ },
2551
+ {
2552
+ indexed: false,
2553
+ internalType: "uint64[]",
2554
+ name: "operatorIds",
2555
+ type: "uint64[]"
2556
+ },
2557
+ {
2558
+ indexed: true,
2559
+ internalType: "uint64",
2560
+ name: "blockNum",
2561
+ type: "uint64"
2562
+ },
2563
+ {
2564
+ indexed: false,
2565
+ internalType: "uint32",
2566
+ name: "effectiveBalance",
2567
+ type: "uint32"
2568
+ },
2569
+ {
2570
+ components: [
2571
+ {
2572
+ internalType: "uint32",
2573
+ name: "validatorCount",
2574
+ type: "uint32"
2575
+ },
2576
+ {
2577
+ internalType: "uint64",
2578
+ name: "networkFeeIndex",
2579
+ type: "uint64"
2580
+ },
2581
+ {
2582
+ internalType: "uint64",
2583
+ name: "index",
2584
+ type: "uint64"
2585
+ },
2586
+ {
2587
+ internalType: "bool",
2588
+ name: "active",
2589
+ type: "bool"
2590
+ },
2591
+ {
2592
+ internalType: "uint256",
2593
+ name: "balance",
2594
+ type: "uint256"
2595
+ }
2596
+ ],
2597
+ indexed: false,
2598
+ internalType: "struct ISSVNetworkCore.Cluster",
2599
+ name: "cluster",
2600
+ type: "tuple"
2601
+ }
2602
+ ],
2603
+ name: "ClusterBalanceUpdated",
2604
+ type: "event"
2605
+ },
1774
2606
  {
1775
2607
  anonymous: false,
1776
2608
  inputs: [
@@ -1881,6 +2713,76 @@ const MainnetV4SetterABI = [
1881
2713
  name: "ClusterLiquidated",
1882
2714
  type: "event"
1883
2715
  },
2716
+ {
2717
+ anonymous: false,
2718
+ inputs: [
2719
+ {
2720
+ indexed: true,
2721
+ internalType: "address",
2722
+ name: "owner",
2723
+ type: "address"
2724
+ },
2725
+ {
2726
+ indexed: false,
2727
+ internalType: "uint64[]",
2728
+ name: "operatorIds",
2729
+ type: "uint64[]"
2730
+ },
2731
+ {
2732
+ indexed: false,
2733
+ internalType: "uint256",
2734
+ name: "ethDeposited",
2735
+ type: "uint256"
2736
+ },
2737
+ {
2738
+ indexed: false,
2739
+ internalType: "uint256",
2740
+ name: "ssvRefunded",
2741
+ type: "uint256"
2742
+ },
2743
+ {
2744
+ indexed: false,
2745
+ internalType: "uint32",
2746
+ name: "effectiveBalance",
2747
+ type: "uint32"
2748
+ },
2749
+ {
2750
+ components: [
2751
+ {
2752
+ internalType: "uint32",
2753
+ name: "validatorCount",
2754
+ type: "uint32"
2755
+ },
2756
+ {
2757
+ internalType: "uint64",
2758
+ name: "networkFeeIndex",
2759
+ type: "uint64"
2760
+ },
2761
+ {
2762
+ internalType: "uint64",
2763
+ name: "index",
2764
+ type: "uint64"
2765
+ },
2766
+ {
2767
+ internalType: "bool",
2768
+ name: "active",
2769
+ type: "bool"
2770
+ },
2771
+ {
2772
+ internalType: "uint256",
2773
+ name: "balance",
2774
+ type: "uint256"
2775
+ }
2776
+ ],
2777
+ indexed: false,
2778
+ internalType: "struct ISSVNetworkCore.Cluster",
2779
+ name: "cluster",
2780
+ type: "tuple"
2781
+ }
2782
+ ],
2783
+ name: "ClusterMigratedToETH",
2784
+ type: "event"
2785
+ },
1884
2786
  {
1885
2787
  anonymous: false,
1886
2788
  inputs: [
@@ -1983,12 +2885,127 @@ const MainnetV4SetterABI = [
1983
2885
  }
1984
2886
  ],
1985
2887
  indexed: false,
1986
- internalType: "struct ISSVNetworkCore.Cluster",
1987
- name: "cluster",
1988
- type: "tuple"
2888
+ internalType: "struct ISSVNetworkCore.Cluster",
2889
+ name: "cluster",
2890
+ type: "tuple"
2891
+ }
2892
+ ],
2893
+ name: "ClusterWithdrawn",
2894
+ type: "event"
2895
+ },
2896
+ {
2897
+ anonymous: false,
2898
+ inputs: [
2899
+ {
2900
+ indexed: false,
2901
+ internalType: "uint64",
2902
+ name: "newCooldownDuration",
2903
+ type: "uint64"
2904
+ }
2905
+ ],
2906
+ name: "CooldownDurationUpdated",
2907
+ type: "event"
2908
+ },
2909
+ {
2910
+ anonymous: false,
2911
+ inputs: [
2912
+ {
2913
+ indexed: false,
2914
+ internalType: "uint64",
2915
+ name: "value",
2916
+ type: "uint64"
2917
+ }
2918
+ ],
2919
+ name: "DeclareOperatorFeePeriodUpdated",
2920
+ type: "event"
2921
+ },
2922
+ {
2923
+ anonymous: false,
2924
+ inputs: [
2925
+ {
2926
+ indexed: true,
2927
+ internalType: "address",
2928
+ name: "token",
2929
+ type: "address"
2930
+ },
2931
+ {
2932
+ indexed: true,
2933
+ internalType: "address",
2934
+ name: "to",
2935
+ type: "address"
2936
+ },
2937
+ {
2938
+ indexed: false,
2939
+ internalType: "uint256",
2940
+ name: "amount",
2941
+ type: "uint256"
2942
+ }
2943
+ ],
2944
+ name: "ERC20Rescued",
2945
+ type: "event"
2946
+ },
2947
+ {
2948
+ anonymous: false,
2949
+ inputs: [
2950
+ {
2951
+ indexed: false,
2952
+ internalType: "uint64",
2953
+ name: "value",
2954
+ type: "uint64"
2955
+ }
2956
+ ],
2957
+ name: "ExecuteOperatorFeePeriodUpdated",
2958
+ type: "event"
2959
+ },
2960
+ {
2961
+ anonymous: false,
2962
+ inputs: [
2963
+ {
2964
+ indexed: true,
2965
+ internalType: "address",
2966
+ name: "owner",
2967
+ type: "address"
2968
+ },
2969
+ {
2970
+ indexed: false,
2971
+ internalType: "address",
2972
+ name: "recipientAddress",
2973
+ type: "address"
2974
+ }
2975
+ ],
2976
+ name: "FeeRecipientAddressUpdated",
2977
+ type: "event"
2978
+ },
2979
+ {
2980
+ anonymous: false,
2981
+ inputs: [
2982
+ {
2983
+ indexed: false,
2984
+ internalType: "uint256",
2985
+ name: "newFeesWei",
2986
+ type: "uint256"
2987
+ },
2988
+ {
2989
+ indexed: false,
2990
+ internalType: "uint256",
2991
+ name: "accEthPerShare",
2992
+ type: "uint256"
2993
+ }
2994
+ ],
2995
+ name: "FeesSynced",
2996
+ type: "event"
2997
+ },
2998
+ {
2999
+ anonymous: false,
3000
+ inputs: [
3001
+ {
3002
+ indexed: false,
3003
+ internalType: "uint8",
3004
+ name: "version",
3005
+ type: "uint8"
1989
3006
  }
1990
3007
  ],
1991
- name: "ClusterWithdrawn",
3008
+ name: "Initialized",
1992
3009
  type: "event"
1993
3010
  },
1994
3011
  {
@@ -2001,7 +3018,7 @@ const MainnetV4SetterABI = [
2001
3018
  type: "uint64"
2002
3019
  }
2003
3020
  ],
2004
- name: "DeclareOperatorFeePeriodUpdated",
3021
+ name: "LiquidationThresholdPeriodSSVUpdated",
2005
3022
  type: "event"
2006
3023
  },
2007
3024
  {
@@ -2014,26 +3031,20 @@ const MainnetV4SetterABI = [
2014
3031
  type: "uint64"
2015
3032
  }
2016
3033
  ],
2017
- name: "ExecuteOperatorFeePeriodUpdated",
3034
+ name: "LiquidationThresholdPeriodUpdated",
2018
3035
  type: "event"
2019
3036
  },
2020
3037
  {
2021
3038
  anonymous: false,
2022
3039
  inputs: [
2023
- {
2024
- indexed: true,
2025
- internalType: "address",
2026
- name: "owner",
2027
- type: "address"
2028
- },
2029
3040
  {
2030
3041
  indexed: false,
2031
- internalType: "address",
2032
- name: "recipientAddress",
2033
- type: "address"
3042
+ internalType: "uint32",
3043
+ name: "newMinBlocksBetweenUpdates",
3044
+ type: "uint32"
2034
3045
  }
2035
3046
  ],
2036
- name: "FeeRecipientAddressUpdated",
3047
+ name: "MinBlocksBetweenUpdatesUpdated",
2037
3048
  type: "event"
2038
3049
  },
2039
3050
  {
@@ -2041,12 +3052,12 @@ const MainnetV4SetterABI = [
2041
3052
  inputs: [
2042
3053
  {
2043
3054
  indexed: false,
2044
- internalType: "uint8",
2045
- name: "version",
2046
- type: "uint8"
3055
+ internalType: "uint256",
3056
+ name: "value",
3057
+ type: "uint256"
2047
3058
  }
2048
3059
  ],
2049
- name: "Initialized",
3060
+ name: "MinimumLiquidationCollateralSSVUpdated",
2050
3061
  type: "event"
2051
3062
  },
2052
3063
  {
@@ -2054,12 +3065,12 @@ const MainnetV4SetterABI = [
2054
3065
  inputs: [
2055
3066
  {
2056
3067
  indexed: false,
2057
- internalType: "uint64",
3068
+ internalType: "uint256",
2058
3069
  name: "value",
2059
- type: "uint64"
3070
+ type: "uint256"
2060
3071
  }
2061
3072
  ],
2062
- name: "LiquidationThresholdPeriodUpdated",
3073
+ name: "MinimumLiquidationCollateralUpdated",
2063
3074
  type: "event"
2064
3075
  },
2065
3076
  {
@@ -2068,11 +3079,11 @@ const MainnetV4SetterABI = [
2068
3079
  {
2069
3080
  indexed: false,
2070
3081
  internalType: "uint256",
2071
- name: "value",
3082
+ name: "minFee",
2072
3083
  type: "uint256"
2073
3084
  }
2074
3085
  ],
2075
- name: "MinimumLiquidationCollateralUpdated",
3086
+ name: "MinimumOperatorEthFeeUpdated",
2076
3087
  type: "event"
2077
3088
  },
2078
3089
  {
@@ -2132,6 +3143,25 @@ const MainnetV4SetterABI = [
2132
3143
  name: "NetworkFeeUpdated",
2133
3144
  type: "event"
2134
3145
  },
3146
+ {
3147
+ anonymous: false,
3148
+ inputs: [
3149
+ {
3150
+ indexed: false,
3151
+ internalType: "uint256",
3152
+ name: "oldFee",
3153
+ type: "uint256"
3154
+ },
3155
+ {
3156
+ indexed: false,
3157
+ internalType: "uint256",
3158
+ name: "newFee",
3159
+ type: "uint256"
3160
+ }
3161
+ ],
3162
+ name: "NetworkFeeUpdatedSSV",
3163
+ type: "event"
3164
+ },
2135
3165
  {
2136
3166
  anonymous: false,
2137
3167
  inputs: [
@@ -2262,9 +3292,9 @@ const MainnetV4SetterABI = [
2262
3292
  inputs: [
2263
3293
  {
2264
3294
  indexed: false,
2265
- internalType: "uint64",
3295
+ internalType: "uint256",
2266
3296
  name: "maxFee",
2267
- type: "uint64"
3297
+ type: "uint256"
2268
3298
  }
2269
3299
  ],
2270
3300
  name: "OperatorMaximumFeeUpdated",
@@ -2409,17 +3439,231 @@ const MainnetV4SetterABI = [
2409
3439
  {
2410
3440
  indexed: true,
2411
3441
  internalType: "address",
2412
- name: "previousOwner",
3442
+ name: "owner",
3443
+ type: "address"
3444
+ },
3445
+ {
3446
+ indexed: true,
3447
+ internalType: "uint64",
3448
+ name: "operatorId",
3449
+ type: "uint64"
3450
+ },
3451
+ {
3452
+ indexed: false,
3453
+ internalType: "uint256",
3454
+ name: "value",
3455
+ type: "uint256"
3456
+ }
3457
+ ],
3458
+ name: "OperatorWithdrawnSSV",
3459
+ type: "event"
3460
+ },
3461
+ {
3462
+ anonymous: false,
3463
+ inputs: [
3464
+ {
3465
+ indexed: true,
3466
+ internalType: "uint32",
3467
+ name: "oracleId",
3468
+ type: "uint32"
3469
+ },
3470
+ {
3471
+ indexed: true,
3472
+ internalType: "address",
3473
+ name: "oldOracle",
3474
+ type: "address"
3475
+ },
3476
+ {
3477
+ indexed: true,
3478
+ internalType: "address",
3479
+ name: "newOracle",
3480
+ type: "address"
3481
+ }
3482
+ ],
3483
+ name: "OracleReplaced",
3484
+ type: "event"
3485
+ },
3486
+ {
3487
+ anonymous: false,
3488
+ inputs: [
3489
+ {
3490
+ indexed: true,
3491
+ internalType: "address",
3492
+ name: "previousOwner",
3493
+ type: "address"
3494
+ },
3495
+ {
3496
+ indexed: true,
3497
+ internalType: "address",
3498
+ name: "newOwner",
3499
+ type: "address"
3500
+ }
3501
+ ],
3502
+ name: "OwnershipTransferStarted",
3503
+ type: "event"
3504
+ },
3505
+ {
3506
+ anonymous: false,
3507
+ inputs: [
3508
+ {
3509
+ indexed: true,
3510
+ internalType: "address",
3511
+ name: "previousOwner",
3512
+ type: "address"
3513
+ },
3514
+ {
3515
+ indexed: true,
3516
+ internalType: "address",
3517
+ name: "newOwner",
3518
+ type: "address"
3519
+ }
3520
+ ],
3521
+ name: "OwnershipTransferred",
3522
+ type: "event"
3523
+ },
3524
+ {
3525
+ anonymous: false,
3526
+ inputs: [
3527
+ {
3528
+ indexed: false,
3529
+ internalType: "uint16",
3530
+ name: "newQuorum",
3531
+ type: "uint16"
3532
+ }
3533
+ ],
3534
+ name: "QuorumUpdated",
3535
+ type: "event"
3536
+ },
3537
+ {
3538
+ anonymous: false,
3539
+ inputs: [
3540
+ {
3541
+ indexed: true,
3542
+ internalType: "address",
3543
+ name: "user",
3544
+ type: "address"
3545
+ },
3546
+ {
3547
+ indexed: false,
3548
+ internalType: "uint256",
3549
+ name: "amount",
3550
+ type: "uint256"
3551
+ }
3552
+ ],
3553
+ name: "RewardsClaimed",
3554
+ type: "event"
3555
+ },
3556
+ {
3557
+ anonymous: false,
3558
+ inputs: [
3559
+ {
3560
+ indexed: true,
3561
+ internalType: "address",
3562
+ name: "user",
3563
+ type: "address"
3564
+ },
3565
+ {
3566
+ indexed: false,
3567
+ internalType: "uint256",
3568
+ name: "pending",
3569
+ type: "uint256"
3570
+ },
3571
+ {
3572
+ indexed: false,
3573
+ internalType: "uint256",
3574
+ name: "accrued",
3575
+ type: "uint256"
3576
+ },
3577
+ {
3578
+ indexed: false,
3579
+ internalType: "uint256",
3580
+ name: "userIndex",
3581
+ type: "uint256"
3582
+ }
3583
+ ],
3584
+ name: "RewardsSettled",
3585
+ type: "event"
3586
+ },
3587
+ {
3588
+ anonymous: false,
3589
+ inputs: [
3590
+ {
3591
+ indexed: true,
3592
+ internalType: "bytes32",
3593
+ name: "merkleRoot",
3594
+ type: "bytes32"
3595
+ },
3596
+ {
3597
+ indexed: true,
3598
+ internalType: "uint64",
3599
+ name: "blockNum",
3600
+ type: "uint64"
3601
+ }
3602
+ ],
3603
+ name: "RootCommitted",
3604
+ type: "event"
3605
+ },
3606
+ {
3607
+ anonymous: false,
3608
+ inputs: [
3609
+ {
3610
+ indexed: false,
3611
+ internalType: "string",
3612
+ name: "version",
3613
+ type: "string"
3614
+ },
3615
+ {
3616
+ indexed: false,
3617
+ internalType: "uint256",
3618
+ name: "blockNumber",
3619
+ type: "uint256"
3620
+ }
3621
+ ],
3622
+ name: "SSVNetworkUpgradeBlock",
3623
+ type: "event"
3624
+ },
3625
+ {
3626
+ anonymous: false,
3627
+ inputs: [
3628
+ {
3629
+ indexed: true,
3630
+ internalType: "address",
3631
+ name: "user",
3632
+ type: "address"
3633
+ },
3634
+ {
3635
+ indexed: false,
3636
+ internalType: "uint256",
3637
+ name: "amount",
3638
+ type: "uint256"
3639
+ }
3640
+ ],
3641
+ name: "Staked",
3642
+ type: "event"
3643
+ },
3644
+ {
3645
+ anonymous: false,
3646
+ inputs: [
3647
+ {
3648
+ indexed: true,
3649
+ internalType: "address",
3650
+ name: "user",
2413
3651
  type: "address"
2414
3652
  },
2415
3653
  {
2416
- indexed: true,
2417
- internalType: "address",
2418
- name: "newOwner",
2419
- type: "address"
3654
+ indexed: false,
3655
+ internalType: "uint256",
3656
+ name: "amount",
3657
+ type: "uint256"
3658
+ },
3659
+ {
3660
+ indexed: false,
3661
+ internalType: "uint256",
3662
+ name: "unlockTime",
3663
+ type: "uint256"
2420
3664
  }
2421
3665
  ],
2422
- name: "OwnershipTransferStarted",
3666
+ name: "UnstakeRequested",
2423
3667
  type: "event"
2424
3668
  },
2425
3669
  {
@@ -2428,17 +3672,17 @@ const MainnetV4SetterABI = [
2428
3672
  {
2429
3673
  indexed: true,
2430
3674
  internalType: "address",
2431
- name: "previousOwner",
3675
+ name: "user",
2432
3676
  type: "address"
2433
3677
  },
2434
3678
  {
2435
- indexed: true,
2436
- internalType: "address",
2437
- name: "newOwner",
2438
- type: "address"
3679
+ indexed: false,
3680
+ internalType: "uint256",
3681
+ name: "amount",
3682
+ type: "uint256"
2439
3683
  }
2440
3684
  ],
2441
- name: "OwnershipTransferred",
3685
+ name: "UnstakedWithdrawn",
2442
3686
  type: "event"
2443
3687
  },
2444
3688
  {
@@ -2601,6 +3845,49 @@ const MainnetV4SetterABI = [
2601
3845
  name: "ValidatorRemoved",
2602
3846
  type: "event"
2603
3847
  },
3848
+ {
3849
+ anonymous: false,
3850
+ inputs: [
3851
+ {
3852
+ indexed: true,
3853
+ internalType: "bytes32",
3854
+ name: "merkleRoot",
3855
+ type: "bytes32"
3856
+ },
3857
+ {
3858
+ indexed: true,
3859
+ internalType: "uint64",
3860
+ name: "blockNum",
3861
+ type: "uint64"
3862
+ },
3863
+ {
3864
+ indexed: false,
3865
+ internalType: "uint256",
3866
+ name: "accumulatedWeight",
3867
+ type: "uint256"
3868
+ },
3869
+ {
3870
+ indexed: false,
3871
+ internalType: "uint256",
3872
+ name: "quorum",
3873
+ type: "uint256"
3874
+ },
3875
+ {
3876
+ indexed: false,
3877
+ internalType: "uint32",
3878
+ name: "oracleId",
3879
+ type: "uint32"
3880
+ },
3881
+ {
3882
+ indexed: false,
3883
+ internalType: "address",
3884
+ name: "oracle",
3885
+ type: "address"
3886
+ }
3887
+ ],
3888
+ name: "WeightedRootProposed",
3889
+ type: "event"
3890
+ },
2604
3891
  {
2605
3892
  stateMutability: "nonpayable",
2606
3893
  type: "fallback"
@@ -2647,11 +3934,6 @@ const MainnetV4SetterABI = [
2647
3934
  name: "sharesData",
2648
3935
  type: "bytes[]"
2649
3936
  },
2650
- {
2651
- internalType: "uint256",
2652
- name: "amount",
2653
- type: "uint256"
2654
- },
2655
3937
  {
2656
3938
  components: [
2657
3939
  {
@@ -2687,7 +3969,7 @@ const MainnetV4SetterABI = [
2687
3969
  ],
2688
3970
  name: "bulkRegisterValidator",
2689
3971
  outputs: [],
2690
- stateMutability: "nonpayable",
3972
+ stateMutability: "payable",
2691
3973
  type: "function"
2692
3974
  },
2693
3975
  {
@@ -2753,6 +4035,31 @@ const MainnetV4SetterABI = [
2753
4035
  stateMutability: "nonpayable",
2754
4036
  type: "function"
2755
4037
  },
4038
+ {
4039
+ inputs: [],
4040
+ name: "claimEthRewards",
4041
+ outputs: [],
4042
+ stateMutability: "nonpayable",
4043
+ type: "function"
4044
+ },
4045
+ {
4046
+ inputs: [
4047
+ {
4048
+ internalType: "bytes32",
4049
+ name: "merkleRoot",
4050
+ type: "bytes32"
4051
+ },
4052
+ {
4053
+ internalType: "uint64",
4054
+ name: "blockNum",
4055
+ type: "uint64"
4056
+ }
4057
+ ],
4058
+ name: "commitRoot",
4059
+ outputs: [],
4060
+ stateMutability: "nonpayable",
4061
+ type: "function"
4062
+ },
2756
4063
  {
2757
4064
  inputs: [
2758
4065
  {
@@ -2783,11 +4090,6 @@ const MainnetV4SetterABI = [
2783
4090
  name: "operatorIds",
2784
4091
  type: "uint64[]"
2785
4092
  },
2786
- {
2787
- internalType: "uint256",
2788
- name: "amount",
2789
- type: "uint256"
2790
- },
2791
4093
  {
2792
4094
  components: [
2793
4095
  {
@@ -2823,7 +4125,7 @@ const MainnetV4SetterABI = [
2823
4125
  ],
2824
4126
  name: "deposit",
2825
4127
  outputs: [],
2826
- stateMutability: "nonpayable",
4128
+ stateMutability: "payable",
2827
4129
  type: "function"
2828
4130
  },
2829
4131
  {
@@ -2898,37 +4200,104 @@ const MainnetV4SetterABI = [
2898
4200
  type: "address"
2899
4201
  },
2900
4202
  {
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
- },
4203
+ components: [
4204
+ {
4205
+ internalType: "uint64",
4206
+ name: "minimumBlocksBeforeLiquidation",
4207
+ type: "uint64"
4208
+ },
4209
+ {
4210
+ internalType: "uint256",
4211
+ name: "minimumLiquidationCollateral",
4212
+ type: "uint256"
4213
+ },
4214
+ {
4215
+ internalType: "uint32",
4216
+ name: "validatorsPerOperatorLimit",
4217
+ type: "uint32"
4218
+ },
4219
+ {
4220
+ internalType: "uint64",
4221
+ name: "declareOperatorFeePeriod",
4222
+ type: "uint64"
4223
+ },
4224
+ {
4225
+ internalType: "uint64",
4226
+ name: "executeOperatorFeePeriod",
4227
+ type: "uint64"
4228
+ },
4229
+ {
4230
+ internalType: "uint64",
4231
+ name: "operatorMaxFeeIncrease",
4232
+ type: "uint64"
4233
+ },
4234
+ {
4235
+ internalType: "uint32[4]",
4236
+ name: "defaultOracleIds",
4237
+ type: "uint32[4]"
4238
+ },
4239
+ {
4240
+ internalType: "uint16",
4241
+ name: "quorumBps",
4242
+ type: "uint16"
4243
+ }
4244
+ ],
4245
+ internalType: "struct ISSVNetwork.NetworkInitParams",
4246
+ name: "params",
4247
+ type: "tuple"
4248
+ }
4249
+ ],
4250
+ name: "initialize",
4251
+ outputs: [],
4252
+ stateMutability: "nonpayable",
4253
+ type: "function"
4254
+ },
4255
+ {
4256
+ inputs: [
2915
4257
  {
2916
- internalType: "uint64",
2917
- name: "declareOperatorFeePeriod_",
2918
- type: "uint64"
4258
+ internalType: "address",
4259
+ name: "clusterOwner",
4260
+ type: "address"
2919
4261
  },
2920
4262
  {
2921
- internalType: "uint64",
2922
- name: "executeOperatorFeePeriod_",
2923
- type: "uint64"
4263
+ internalType: "uint64[]",
4264
+ name: "operatorIds",
4265
+ type: "uint64[]"
2924
4266
  },
2925
4267
  {
2926
- internalType: "uint64",
2927
- name: "operatorMaxFeeIncrease_",
2928
- type: "uint64"
4268
+ components: [
4269
+ {
4270
+ internalType: "uint32",
4271
+ name: "validatorCount",
4272
+ type: "uint32"
4273
+ },
4274
+ {
4275
+ internalType: "uint64",
4276
+ name: "networkFeeIndex",
4277
+ type: "uint64"
4278
+ },
4279
+ {
4280
+ internalType: "uint64",
4281
+ name: "index",
4282
+ type: "uint64"
4283
+ },
4284
+ {
4285
+ internalType: "bool",
4286
+ name: "active",
4287
+ type: "bool"
4288
+ },
4289
+ {
4290
+ internalType: "uint256",
4291
+ name: "balance",
4292
+ type: "uint256"
4293
+ }
4294
+ ],
4295
+ internalType: "struct ISSVNetworkCore.Cluster",
4296
+ name: "cluster",
4297
+ type: "tuple"
2929
4298
  }
2930
4299
  ],
2931
- name: "initialize",
4300
+ name: "liquidate",
2932
4301
  outputs: [],
2933
4302
  stateMutability: "nonpayable",
2934
4303
  type: "function"
@@ -2978,7 +4347,75 @@ const MainnetV4SetterABI = [
2978
4347
  type: "tuple"
2979
4348
  }
2980
4349
  ],
2981
- name: "liquidate",
4350
+ name: "liquidateSSV",
4351
+ outputs: [],
4352
+ stateMutability: "nonpayable",
4353
+ type: "function"
4354
+ },
4355
+ {
4356
+ inputs: [
4357
+ {
4358
+ internalType: "uint64[]",
4359
+ name: "operatorIds",
4360
+ type: "uint64[]"
4361
+ },
4362
+ {
4363
+ components: [
4364
+ {
4365
+ internalType: "uint32",
4366
+ name: "validatorCount",
4367
+ type: "uint32"
4368
+ },
4369
+ {
4370
+ internalType: "uint64",
4371
+ name: "networkFeeIndex",
4372
+ type: "uint64"
4373
+ },
4374
+ {
4375
+ internalType: "uint64",
4376
+ name: "index",
4377
+ type: "uint64"
4378
+ },
4379
+ {
4380
+ internalType: "bool",
4381
+ name: "active",
4382
+ type: "bool"
4383
+ },
4384
+ {
4385
+ internalType: "uint256",
4386
+ name: "balance",
4387
+ type: "uint256"
4388
+ }
4389
+ ],
4390
+ internalType: "struct ISSVNetworkCore.Cluster",
4391
+ name: "cluster",
4392
+ type: "tuple"
4393
+ }
4394
+ ],
4395
+ name: "migrateClusterToETH",
4396
+ outputs: [],
4397
+ stateMutability: "payable",
4398
+ type: "function"
4399
+ },
4400
+ {
4401
+ inputs: [
4402
+ {
4403
+ internalType: "address",
4404
+ name: "from",
4405
+ type: "address"
4406
+ },
4407
+ {
4408
+ internalType: "address",
4409
+ name: "to",
4410
+ type: "address"
4411
+ },
4412
+ {
4413
+ internalType: "uint256",
4414
+ name: "amount",
4415
+ type: "uint256"
4416
+ }
4417
+ ],
4418
+ name: "onCSSVTransfer",
2982
4419
  outputs: [],
2983
4420
  stateMutability: "nonpayable",
2984
4421
  type: "function"
@@ -3029,11 +4466,6 @@ const MainnetV4SetterABI = [
3029
4466
  name: "operatorIds",
3030
4467
  type: "uint64[]"
3031
4468
  },
3032
- {
3033
- internalType: "uint256",
3034
- name: "amount",
3035
- type: "uint256"
3036
- },
3037
4469
  {
3038
4470
  components: [
3039
4471
  {
@@ -3069,7 +4501,7 @@ const MainnetV4SetterABI = [
3069
4501
  ],
3070
4502
  name: "reactivate",
3071
4503
  outputs: [],
3072
- stateMutability: "nonpayable",
4504
+ stateMutability: "payable",
3073
4505
  type: "function"
3074
4506
  },
3075
4507
  {
@@ -3136,11 +4568,6 @@ const MainnetV4SetterABI = [
3136
4568
  name: "sharesData",
3137
4569
  type: "bytes"
3138
4570
  },
3139
- {
3140
- internalType: "uint256",
3141
- name: "amount",
3142
- type: "uint256"
3143
- },
3144
4571
  {
3145
4572
  components: [
3146
4573
  {
@@ -3176,7 +4603,7 @@ const MainnetV4SetterABI = [
3176
4603
  ],
3177
4604
  name: "registerValidator",
3178
4605
  outputs: [],
3179
- stateMutability: "nonpayable",
4606
+ stateMutability: "payable",
3180
4607
  type: "function"
3181
4608
  },
3182
4609
  {
@@ -3280,6 +4707,60 @@ const MainnetV4SetterABI = [
3280
4707
  stateMutability: "nonpayable",
3281
4708
  type: "function"
3282
4709
  },
4710
+ {
4711
+ inputs: [
4712
+ {
4713
+ internalType: "uint32",
4714
+ name: "oracleId",
4715
+ type: "uint32"
4716
+ },
4717
+ {
4718
+ internalType: "address",
4719
+ name: "newOracle",
4720
+ type: "address"
4721
+ }
4722
+ ],
4723
+ name: "replaceOracle",
4724
+ outputs: [],
4725
+ stateMutability: "nonpayable",
4726
+ type: "function"
4727
+ },
4728
+ {
4729
+ inputs: [
4730
+ {
4731
+ internalType: "uint256",
4732
+ name: "amount",
4733
+ type: "uint256"
4734
+ }
4735
+ ],
4736
+ name: "requestUnstake",
4737
+ outputs: [],
4738
+ stateMutability: "nonpayable",
4739
+ type: "function"
4740
+ },
4741
+ {
4742
+ inputs: [
4743
+ {
4744
+ internalType: "address",
4745
+ name: "token",
4746
+ type: "address"
4747
+ },
4748
+ {
4749
+ internalType: "address",
4750
+ name: "to",
4751
+ type: "address"
4752
+ },
4753
+ {
4754
+ internalType: "uint256",
4755
+ name: "amount",
4756
+ type: "uint256"
4757
+ }
4758
+ ],
4759
+ name: "rescueERC20",
4760
+ outputs: [],
4761
+ stateMutability: "nonpayable",
4762
+ type: "function"
4763
+ },
3283
4764
  {
3284
4765
  inputs: [
3285
4766
  {
@@ -3355,6 +4836,26 @@ const MainnetV4SetterABI = [
3355
4836
  stateMutability: "nonpayable",
3356
4837
  type: "function"
3357
4838
  },
4839
+ {
4840
+ inputs: [
4841
+ {
4842
+ internalType: "uint256",
4843
+ name: "amount",
4844
+ type: "uint256"
4845
+ }
4846
+ ],
4847
+ name: "stake",
4848
+ outputs: [],
4849
+ stateMutability: "nonpayable",
4850
+ type: "function"
4851
+ },
4852
+ {
4853
+ inputs: [],
4854
+ name: "syncFees",
4855
+ outputs: [],
4856
+ stateMutability: "nonpayable",
4857
+ type: "function"
4858
+ },
3358
4859
  {
3359
4860
  inputs: [
3360
4861
  {
@@ -3368,6 +4869,71 @@ const MainnetV4SetterABI = [
3368
4869
  stateMutability: "nonpayable",
3369
4870
  type: "function"
3370
4871
  },
4872
+ {
4873
+ inputs: [
4874
+ {
4875
+ internalType: "uint64",
4876
+ name: "blockNum",
4877
+ type: "uint64"
4878
+ },
4879
+ {
4880
+ internalType: "address",
4881
+ name: "clusterOwner",
4882
+ type: "address"
4883
+ },
4884
+ {
4885
+ internalType: "uint64[]",
4886
+ name: "operatorIds",
4887
+ type: "uint64[]"
4888
+ },
4889
+ {
4890
+ components: [
4891
+ {
4892
+ internalType: "uint32",
4893
+ name: "validatorCount",
4894
+ type: "uint32"
4895
+ },
4896
+ {
4897
+ internalType: "uint64",
4898
+ name: "networkFeeIndex",
4899
+ type: "uint64"
4900
+ },
4901
+ {
4902
+ internalType: "uint64",
4903
+ name: "index",
4904
+ type: "uint64"
4905
+ },
4906
+ {
4907
+ internalType: "bool",
4908
+ name: "active",
4909
+ type: "bool"
4910
+ },
4911
+ {
4912
+ internalType: "uint256",
4913
+ name: "balance",
4914
+ type: "uint256"
4915
+ }
4916
+ ],
4917
+ internalType: "struct ISSVNetworkCore.Cluster",
4918
+ name: "cluster",
4919
+ type: "tuple"
4920
+ },
4921
+ {
4922
+ internalType: "uint32",
4923
+ name: "effectiveBalance",
4924
+ type: "uint32"
4925
+ },
4926
+ {
4927
+ internalType: "bytes32[]",
4928
+ name: "merkleProof",
4929
+ type: "bytes32[]"
4930
+ }
4931
+ ],
4932
+ name: "updateClusterBalance",
4933
+ outputs: [],
4934
+ stateMutability: "nonpayable",
4935
+ type: "function"
4936
+ },
3371
4937
  {
3372
4938
  inputs: [
3373
4939
  {
@@ -3411,15 +4977,41 @@ const MainnetV4SetterABI = [
3411
4977
  inputs: [
3412
4978
  {
3413
4979
  internalType: "uint64",
3414
- name: "maxFee",
4980
+ name: "blocks",
3415
4981
  type: "uint64"
3416
4982
  }
3417
4983
  ],
4984
+ name: "updateLiquidationThresholdPeriodSSV",
4985
+ outputs: [],
4986
+ stateMutability: "nonpayable",
4987
+ type: "function"
4988
+ },
4989
+ {
4990
+ inputs: [
4991
+ {
4992
+ internalType: "uint256",
4993
+ name: "maxFee",
4994
+ type: "uint256"
4995
+ }
4996
+ ],
3418
4997
  name: "updateMaximumOperatorFee",
3419
4998
  outputs: [],
3420
4999
  stateMutability: "nonpayable",
3421
5000
  type: "function"
3422
5001
  },
5002
+ {
5003
+ inputs: [
5004
+ {
5005
+ internalType: "uint32",
5006
+ name: "blocks",
5007
+ type: "uint32"
5008
+ }
5009
+ ],
5010
+ name: "updateMinBlocksBetweenUpdates",
5011
+ outputs: [],
5012
+ stateMutability: "nonpayable",
5013
+ type: "function"
5014
+ },
3423
5015
  {
3424
5016
  inputs: [
3425
5017
  {
@@ -3433,6 +5025,32 @@ const MainnetV4SetterABI = [
3433
5025
  stateMutability: "nonpayable",
3434
5026
  type: "function"
3435
5027
  },
5028
+ {
5029
+ inputs: [
5030
+ {
5031
+ internalType: "uint256",
5032
+ name: "amount",
5033
+ type: "uint256"
5034
+ }
5035
+ ],
5036
+ name: "updateMinimumLiquidationCollateralSSV",
5037
+ outputs: [],
5038
+ stateMutability: "nonpayable",
5039
+ type: "function"
5040
+ },
5041
+ {
5042
+ inputs: [
5043
+ {
5044
+ internalType: "uint256",
5045
+ name: "minFee",
5046
+ type: "uint256"
5047
+ }
5048
+ ],
5049
+ name: "updateMinimumOperatorEthFee",
5050
+ outputs: [],
5051
+ stateMutability: "nonpayable",
5052
+ type: "function"
5053
+ },
3436
5054
  {
3437
5055
  inputs: [
3438
5056
  {
@@ -3464,6 +5082,19 @@ const MainnetV4SetterABI = [
3464
5082
  stateMutability: "nonpayable",
3465
5083
  type: "function"
3466
5084
  },
5085
+ {
5086
+ inputs: [
5087
+ {
5088
+ internalType: "uint256",
5089
+ name: "fee",
5090
+ type: "uint256"
5091
+ }
5092
+ ],
5093
+ name: "updateNetworkFeeSSV",
5094
+ outputs: [],
5095
+ stateMutability: "nonpayable",
5096
+ type: "function"
5097
+ },
3467
5098
  {
3468
5099
  inputs: [
3469
5100
  {
@@ -3477,6 +5108,32 @@ const MainnetV4SetterABI = [
3477
5108
  stateMutability: "nonpayable",
3478
5109
  type: "function"
3479
5110
  },
5111
+ {
5112
+ inputs: [
5113
+ {
5114
+ internalType: "uint16",
5115
+ name: "quorum",
5116
+ type: "uint16"
5117
+ }
5118
+ ],
5119
+ name: "updateQuorumBps",
5120
+ outputs: [],
5121
+ stateMutability: "nonpayable",
5122
+ type: "function"
5123
+ },
5124
+ {
5125
+ inputs: [
5126
+ {
5127
+ internalType: "uint64",
5128
+ name: "duration",
5129
+ type: "uint64"
5130
+ }
5131
+ ],
5132
+ name: "updateUnstakeCooldownDuration",
5133
+ outputs: [],
5134
+ stateMutability: "nonpayable",
5135
+ type: "function"
5136
+ },
3480
5137
  {
3481
5138
  inputs: [
3482
5139
  {
@@ -3566,20 +5223,64 @@ const MainnetV4SetterABI = [
3566
5223
  type: "uint64"
3567
5224
  }
3568
5225
  ],
3569
- name: "withdrawAllOperatorEarnings",
5226
+ name: "withdrawAllOperatorEarnings",
5227
+ outputs: [],
5228
+ stateMutability: "nonpayable",
5229
+ type: "function"
5230
+ },
5231
+ {
5232
+ inputs: [
5233
+ {
5234
+ internalType: "uint64",
5235
+ name: "operatorId",
5236
+ type: "uint64"
5237
+ }
5238
+ ],
5239
+ name: "withdrawAllOperatorEarningsSSV",
5240
+ outputs: [],
5241
+ stateMutability: "nonpayable",
5242
+ type: "function"
5243
+ },
5244
+ {
5245
+ inputs: [
5246
+ {
5247
+ internalType: "uint64",
5248
+ name: "operatorId",
5249
+ type: "uint64"
5250
+ }
5251
+ ],
5252
+ name: "withdrawAllVersionOperatorEarnings",
5253
+ outputs: [],
5254
+ stateMutability: "nonpayable",
5255
+ type: "function"
5256
+ },
5257
+ {
5258
+ inputs: [
5259
+ {
5260
+ internalType: "uint256",
5261
+ name: "amount",
5262
+ type: "uint256"
5263
+ }
5264
+ ],
5265
+ name: "withdrawNetworkSSVEarnings",
3570
5266
  outputs: [],
3571
5267
  stateMutability: "nonpayable",
3572
5268
  type: "function"
3573
5269
  },
3574
5270
  {
3575
5271
  inputs: [
5272
+ {
5273
+ internalType: "uint64",
5274
+ name: "operatorId",
5275
+ type: "uint64"
5276
+ },
3576
5277
  {
3577
5278
  internalType: "uint256",
3578
5279
  name: "amount",
3579
5280
  type: "uint256"
3580
5281
  }
3581
5282
  ],
3582
- name: "withdrawNetworkEarnings",
5283
+ name: "withdrawOperatorEarnings",
3583
5284
  outputs: [],
3584
5285
  stateMutability: "nonpayable",
3585
5286
  type: "function"
@@ -3597,7 +5298,14 @@ const MainnetV4SetterABI = [
3597
5298
  type: "uint256"
3598
5299
  }
3599
5300
  ],
3600
- name: "withdrawOperatorEarnings",
5301
+ name: "withdrawOperatorEarningsSSV",
5302
+ outputs: [],
5303
+ stateMutability: "nonpayable",
5304
+ type: "function"
5305
+ },
5306
+ {
5307
+ inputs: [],
5308
+ name: "withdrawUnlocked",
3601
5309
  outputs: [],
3602
5310
  stateMutability: "nonpayable",
3603
5311
  type: "function"
@@ -3983,23 +5691,41 @@ const TokenABI = [
3983
5691
  type: "function"
3984
5692
  }
3985
5693
  ];
5694
+ class MissingAbiParameterError extends Error {
5695
+ code = "MISSING_ABI_PARAMETER";
5696
+ functionName;
5697
+ parameterName;
5698
+ parameterIndex;
5699
+ constructor({
5700
+ functionName,
5701
+ parameterName,
5702
+ parameterIndex
5703
+ }) {
5704
+ super(
5705
+ `Missing required ABI parameter "${parameterName}" for function "${functionName}" at index ${parameterIndex}.`
5706
+ );
5707
+ this.name = "MissingAbiParameterError";
5708
+ this.functionName = functionName;
5709
+ this.parameterName = parameterName;
5710
+ this.parameterIndex = parameterIndex;
5711
+ }
5712
+ }
3986
5713
  const paramsToArray = ({
3987
5714
  params,
3988
5715
  abiFunction
3989
5716
  }) => {
3990
- return stringifyBigints(
3991
- abiFunction.inputs.reduce(
3992
- (acc, param) => {
3993
- if (param.name && !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
- );
5717
+ const args = abiFunction.inputs.map((param, parameterIndex) => {
5718
+ const parameterName = param.name;
5719
+ if (!parameterName || isUndefined(params[parameterName])) {
5720
+ throw new MissingAbiParameterError({
5721
+ functionName: abiFunction.name,
5722
+ parameterName: parameterName || `<unnamed_${parameterIndex}>`,
5723
+ parameterIndex
5724
+ });
5725
+ }
5726
+ return params[parameterName];
5727
+ });
5728
+ return stringifyBigints(args);
4003
5729
  };
4004
5730
  function normalize(strArray) {
4005
5731
  const resultArray = [];
@@ -4063,59 +5789,84 @@ function urlJoin(...args) {
4063
5789
  const parts = Array.from(Array.isArray(args[0]) ? args[0] : args);
4064
5790
  return normalize(parts);
4065
5791
  }
4066
- const ABIS = [TokenABI, MainnetV4SetterABI];
5792
+ const ensureWritableWallet = (walletClient, functionName) => {
5793
+ if (!walletClient) {
5794
+ throw new Error(
5795
+ `Wallet client is required for write method "${functionName}". Provide walletClient in SDK config.`
5796
+ );
5797
+ }
5798
+ if (!walletClient.account) {
5799
+ throw new Error(
5800
+ `Wallet client account is required for write method "${functionName}".`
5801
+ );
5802
+ }
5803
+ return walletClient;
5804
+ };
4067
5805
  const createWriter = ({
4068
5806
  abi,
4069
5807
  publicClient,
4070
5808
  walletClient,
4071
- contractAddress
5809
+ contractAddress,
5810
+ eventSources = [{ abi, address: contractAddress }]
4072
5811
  }) => {
4073
5812
  const writeFnsMainnet = abi.filter(
4074
5813
  (item) => item.type === "function" && (item.stateMutability === "nonpayable" || item.stateMutability === "payable")
4075
5814
  );
4076
5815
  return Object.fromEntries(
4077
5816
  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
- });
5817
+ const getWriteArgs = (params) => {
5818
+ if (fn.inputs.length === 0) {
5819
+ return void 0;
5820
+ }
5821
+ return paramsToArray({
5822
+ params: params ?? {},
5823
+ abiFunction: fn
5824
+ });
5825
+ };
5826
+ const simulate = async (options = {}) => {
5827
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5828
+ return publicClient.simulateContract({
5829
+ ...options,
5830
+ address: contractAddress,
5831
+ abi,
5832
+ functionName: fn.name,
5833
+ args: getWriteArgs(options.args),
5834
+ account: writableWallet.account
5835
+ });
5836
+ };
4086
5837
  const getTransactionData = (params) => {
4087
5838
  return encodeFunctionData({
4088
5839
  abi,
4089
5840
  functionName: fn.name,
4090
- args: paramsToArray({ params, abiFunction: fn })
5841
+ args: getWriteArgs(params)
4091
5842
  });
4092
5843
  };
4093
- const func = async (options2) => {
4094
- const { request } = await simulate(options2);
4095
- const hash = await walletClient.writeContract(request);
5844
+ const func = async (options = {}) => {
5845
+ const writableWallet = ensureWritableWallet(walletClient, fn.name);
5846
+ const { request } = await simulate(options);
5847
+ const hash = await writableWallet.writeContract(
5848
+ request
5849
+ );
4096
5850
  return {
4097
5851
  hash,
4098
5852
  wait: () => publicClient.waitForTransactionReceipt({ hash }).then((receipt) => ({
4099
5853
  ...receipt,
4100
5854
  events: receipt.logs.reduce(
4101
5855
  (acc, log) => {
4102
- try {
4103
- const event = 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
- tryCatch(() => {
4112
- const event = decodeEventLog({
4113
- abi: eventAbi,
4114
- data: log.data,
4115
- topics: log.topics
4116
- });
4117
- acc.push(event);
4118
- });
5856
+ for (const eventSource of eventSources) {
5857
+ if (!isAddressEqual(log.address, eventSource.address)) {
5858
+ continue;
5859
+ }
5860
+ const [event] = tryCatch(
5861
+ () => decodeEventLog({
5862
+ abi: eventSource.abi,
5863
+ data: log.data,
5864
+ topics: log.topics
5865
+ })
5866
+ );
5867
+ if (event) {
5868
+ acc.push(event);
5869
+ break;
4119
5870
  }
4120
5871
  }
4121
5872
  return acc;
@@ -4178,7 +5929,7 @@ const createSSVAPI = (endpoint) => {
4178
5929
  return getSSVAPI(endpoint);
4179
5930
  };
4180
5931
  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;
5932
+ 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
5933
  };
4183
5934
  const createContractInteractions = ({
4184
5935
  walletClient,
@@ -4191,7 +5942,17 @@ const createContractInteractions = ({
4191
5942
  abi: MainnetV4SetterABI,
4192
5943
  walletClient,
4193
5944
  publicClient,
4194
- contractAddress: addresses.setter
5945
+ contractAddress: addresses.setter,
5946
+ eventSources: [
5947
+ {
5948
+ abi: MainnetV4SetterABI,
5949
+ address: addresses.setter
5950
+ },
5951
+ {
5952
+ abi: TokenABI,
5953
+ address: addresses.token
5954
+ }
5955
+ ]
4195
5956
  }),
4196
5957
  read: createReader({
4197
5958
  abi: MainnetV4GetterABI,
@@ -4209,7 +5970,13 @@ const createContractInteractions = ({
4209
5970
  abi: TokenABI,
4210
5971
  walletClient,
4211
5972
  publicClient,
4212
- contractAddress: addresses.token
5973
+ contractAddress: addresses.token,
5974
+ eventSources: [
5975
+ {
5976
+ abi: TokenABI,
5977
+ address: addresses.token
5978
+ }
5979
+ ]
4213
5980
  })
4214
5981
  }
4215
5982
  };
@@ -4217,7 +5984,7 @@ const createContractInteractions = ({
4217
5984
  const createConfig = (props) => {
4218
5985
  const { walletClient, publicClient, extendedConfig } = configArgsSchema.parse(props);
4219
5986
  const hasAPIKey = Boolean(extendedConfig?.subgraph?.apiKey);
4220
- const chainId = walletClient.chain.id;
5987
+ const chainId = publicClient.chain.id;
4221
5988
  const chainContracts = contracts[chainId];
4222
5989
  const addresses = {
4223
5990
  setter: extendedConfig?.contracts?.setter || chainContracts.setter,
@@ -4233,12 +6000,16 @@ const createConfig = (props) => {
4233
6000
  const restEndpoint = extendedConfig?.rest?.endpoint || rest_endpoints[chainId];
4234
6001
  const graphQLClient = new GraphQLClient(
4235
6002
  graphEndpoint,
4236
- hasAPIKey ? { headers: { Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}` } } : void 0
6003
+ hasAPIKey ? {
6004
+ headers: {
6005
+ Authorization: `Bearer ${extendedConfig?.subgraph?.apiKey}`
6006
+ }
6007
+ } : void 0
4237
6008
  );
4238
6009
  return {
4239
6010
  publicClient,
4240
6011
  walletClient,
4241
- chain: walletClient.chain,
6012
+ chain: publicClient.chain,
4242
6013
  api: {
4243
6014
  ...createQueries(graphQLClient),
4244
6015
  ...createSSVAPI(restEndpoint)
@@ -4254,39 +6025,25 @@ const createConfig = (props) => {
4254
6025
  contract
4255
6026
  };
4256
6027
  };
4257
- const deposit = async (config2, { args: { id, amount }, ...writeOptions }, options2 = {}) => {
4258
- const cluster = await config2.api.getCluster({ id });
6028
+ const deposit = async (config, { args: { id, amount }, ...writeOptions }) => {
6029
+ const { cluster } = await config.api.getCluster({ id });
4259
6030
  if (!cluster) {
4260
6031
  throw new Error("Cluster not found");
4261
6032
  }
4262
- const snapshot = getClusterSnapshot$1(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({
6033
+ const snapshot = toSolidityCluster(cluster);
6034
+ return config.contract.ssv.write.deposit({
6035
+ value: amount,
4278
6036
  args: {
4279
- amount,
4280
6037
  cluster: snapshot,
4281
- clusterOwner: config2.walletClient.account.address,
6038
+ clusterOwner: cluster.owner.id,
4282
6039
  operatorIds: cluster.operatorIds.map(BigInt)
4283
6040
  },
4284
6041
  ...writeOptions
4285
6042
  });
4286
6043
  };
4287
- const exitValidators = async (config2, { args: { publicKeys, operatorIds }, ...writeOptions }) => {
6044
+ const exitValidators = async (config, { args: { publicKeys, operatorIds }, ...writeOptions }) => {
4288
6045
  if (publicKeys.length === 1) {
4289
- return config2.contract.ssv.write.exitValidator({
6046
+ return config.contract.ssv.write.exitValidator({
4290
6047
  args: {
4291
6048
  publicKey: publicKeys[0],
4292
6049
  operatorIds: [operatorIds[0]]
@@ -4294,7 +6051,7 @@ const exitValidators = async (config2, { args: { publicKeys, operatorIds }, ...w
4294
6051
  ...writeOptions
4295
6052
  });
4296
6053
  }
4297
- return config2.contract.ssv.write.bulkExitValidator({
6054
+ return config.contract.ssv.write.bulkExitValidator({
4298
6055
  args: {
4299
6056
  publicKeys,
4300
6057
  operatorIds
@@ -4302,35 +6059,66 @@ const exitValidators = async (config2, { args: { publicKeys, operatorIds }, ...w
4302
6059
  ...writeOptions
4303
6060
  });
4304
6061
  };
4305
- const liquidateCluster = async (config2, { args: { id }, ...writeOptions }) => {
4306
- const cluster = await config2.api.getCluster({ id });
6062
+ const liquidateCluster = async (config, { args: { id }, ...writeOptions }) => {
6063
+ const { cluster } = await config.api.getCluster({ id });
4307
6064
  if (!cluster) {
4308
6065
  throw new Error("Cluster not found");
4309
6066
  }
4310
- return config2.contract.ssv.write.liquidate({
6067
+ return config.contract.ssv.write.liquidate({
4311
6068
  args: {
4312
- cluster: getClusterSnapshot$1(cluster),
4313
- clusterOwner: config2.walletClient.account.address,
6069
+ cluster: toSolidityCluster(cluster),
6070
+ clusterOwner: cluster.owner.id,
4314
6071
  operatorIds: cluster.operatorIds.map(BigInt)
4315
6072
  },
4316
6073
  ...writeOptions
4317
6074
  });
4318
6075
  };
4319
- const reactivateCluster = async (config2, { args: { id, amount }, ...writeOptions }) => {
4320
- const cluster = await config2.api.getCluster({ id });
6076
+ const liquidateSSV = async (config, { args: { id }, ...writeOptions }) => {
6077
+ const { cluster } = await config.api.getCluster({ id });
4321
6078
  if (!cluster) {
4322
6079
  throw new Error("Cluster not found");
4323
6080
  }
4324
- return config2.contract.ssv.write.reactivate({
6081
+ return config.contract.ssv.write.liquidateSSV({
4325
6082
  args: {
4326
- cluster: getClusterSnapshot$1(cluster),
4327
- amount,
6083
+ clusterOwner: cluster.owner.id,
6084
+ operatorIds: cluster.operatorIds.map(BigInt),
6085
+ cluster: toSolidityCluster(cluster)
6086
+ },
6087
+ ...writeOptions
6088
+ });
6089
+ };
6090
+ const migrateClusterToETH = async (config, { args: { id, amount }, ...writeOptions }) => {
6091
+ const { cluster } = await config.api.getCluster({ id });
6092
+ if (!cluster) {
6093
+ throw new Error("Cluster not found");
6094
+ }
6095
+ return config.contract.ssv.write.migrateClusterToETH({
6096
+ value: amount,
6097
+ args: {
6098
+ operatorIds: cluster.operatorIds.map(BigInt),
6099
+ cluster: toSolidityCluster(cluster)
6100
+ },
6101
+ ...writeOptions
6102
+ });
6103
+ };
6104
+ const reactivateCluster = async (config, { args: { id, amount }, ...writeOptions }) => {
6105
+ const { cluster } = await config.api.getCluster({ id });
6106
+ if (!cluster) {
6107
+ throw new Error("Cluster not found");
6108
+ }
6109
+ return config.contract.ssv.write.reactivate({
6110
+ value: amount,
6111
+ args: {
6112
+ cluster: toSolidityCluster(cluster),
4328
6113
  operatorIds: cluster.operatorIds.map(BigInt)
4329
6114
  },
4330
6115
  ...writeOptions
4331
6116
  });
4332
6117
  };
4333
- const registerValidators = async (config2, { args: { keyshares, depositAmount = 0n }, ...writeOptions }) => {
6118
+ const registerValidators = async (config, {
6119
+ args: { keyshares, depositAmount = 0n },
6120
+ ...writeOptions
6121
+ }) => {
4334
6122
  const shares = keyshares.map((share) => {
4335
6123
  return isKeySharesItem(share) ? share.payload : share;
4336
6124
  });
@@ -4343,17 +6131,25 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4343
6131
  );
4344
6132
  }
4345
6133
  if (shares.length > limit) {
4346
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6134
+ throw new Error(
6135
+ `You can't register more than ${limit} validators in a single transaction`
6136
+ );
6137
+ }
6138
+ const ownerAddress = config.walletClient?.account?.address;
6139
+ if (!ownerAddress) {
6140
+ throw new Error(
6141
+ "walletClient with account is required for write operations"
6142
+ );
4347
6143
  }
4348
- const clusterId = createClusterId(config2.walletClient.account.address, operatorIds);
4349
- const cluster = await config2.api.getCluster({
6144
+ const clusterId = createClusterId(ownerAddress, operatorIds);
6145
+ const { cluster } = await config.api.getCluster({
4350
6146
  id: clusterId
4351
6147
  });
4352
- const snapshot = cluster ? getClusterSnapshot$1(cluster) : createEmptyCluster();
6148
+ const snapshot = cluster ? toSolidityCluster(cluster) : createEmptyCluster();
4353
6149
  if (shares.length === 1) {
4354
- return config2.contract.ssv.write.registerValidator({
6150
+ return config.contract.ssv.write.registerValidator({
6151
+ value: depositAmount,
4355
6152
  args: {
4356
- amount: depositAmount,
4357
6153
  cluster: snapshot,
4358
6154
  operatorIds: operatorIds.map(BigInt),
4359
6155
  publicKey: shares[0].publicKey,
@@ -4362,10 +6158,10 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4362
6158
  ...writeOptions
4363
6159
  });
4364
6160
  }
4365
- return config2.contract.ssv.write.bulkRegisterValidator({
6161
+ return config.contract.ssv.write.bulkRegisterValidator({
6162
+ value: depositAmount,
4366
6163
  args: {
4367
6164
  cluster: snapshot,
4368
- amount: depositAmount,
4369
6165
  operatorIds: operatorIds.map(BigInt),
4370
6166
  publicKeys: shares.map((share) => share.publicKey),
4371
6167
  sharesData: shares.map((share) => share.sharesData)
@@ -4373,7 +6169,7 @@ const registerValidators = async (config2, { args: { keyshares, depositAmount =
4373
6169
  ...writeOptions
4374
6170
  });
4375
6171
  };
4376
- const registerValidatorsRawData = async (config2, { args: { keyshares, depositAmount = 0n } }) => {
6172
+ const registerValidatorsRawData = async (config, { args: { keyshares, ownerAddress } }) => {
4377
6173
  const shares = keyshares.map((share) => {
4378
6174
  return isKeySharesItem(share) ? share.payload : share;
4379
6175
  });
@@ -4386,48 +6182,61 @@ const registerValidatorsRawData = async (config2, { args: { keyshares, depositAm
4386
6182
  );
4387
6183
  }
4388
6184
  if (shares.length > limit) {
4389
- throw new Error(`You can't register more than ${limit} validators in a single transaction`);
6185
+ throw new Error(
6186
+ `You can't register more than ${limit} validators in a single transaction`
6187
+ );
4390
6188
  }
4391
- const clusterId = createClusterId(config2.walletClient.account.address, operatorIds);
4392
- const cluster = await config2.api.getCluster({
6189
+ const resolvedOwnerAddress = ownerAddress ?? config.walletClient?.account?.address;
6190
+ if (!resolvedOwnerAddress) {
6191
+ throw new Error(
6192
+ "ownerAddress is required when walletClient.account.address is not available"
6193
+ );
6194
+ }
6195
+ const clusterId = createClusterId(resolvedOwnerAddress, operatorIds);
6196
+ const { cluster } = await config.api.getCluster({
4393
6197
  id: clusterId
4394
6198
  });
4395
- const snapshot = cluster ? getClusterSnapshot$1(cluster) : createEmptyCluster();
6199
+ const snapshot = cluster ? toSolidityCluster(cluster) : createEmptyCluster();
4396
6200
  if (shares.length === 1) {
4397
- return config2.contract.ssv.write.registerValidator.getTransactionData({
4398
- amount: depositAmount,
6201
+ return config.contract.ssv.write.registerValidator.getTransactionData({
4399
6202
  cluster: snapshot,
4400
6203
  operatorIds: operatorIds.map(BigInt),
4401
6204
  publicKey: shares[0].publicKey,
4402
6205
  sharesData: shares[0].sharesData
4403
6206
  });
4404
6207
  }
4405
- return config2.contract.ssv.write.bulkRegisterValidator.getTransactionData({
6208
+ return config.contract.ssv.write.bulkRegisterValidator.getTransactionData({
4406
6209
  cluster: snapshot,
4407
- amount: depositAmount,
4408
6210
  operatorIds: operatorIds.map(BigInt),
4409
6211
  publicKeys: shares.map((share) => share.publicKey),
4410
6212
  sharesData: shares.map((share) => share.sharesData)
4411
6213
  });
4412
6214
  };
4413
6215
  const ssvKeys$1 = new SSVKeys();
4414
- const validateSharesPostRegistration = async (config2, args) => {
4415
- const receipt = await config2.publicClient.waitForTransactionReceipt({
6216
+ const validateSharesPostRegistration = async (config, args) => {
6217
+ const ownerAddress = args.ownerAddress ?? config.walletClient?.account?.address;
6218
+ if (!ownerAddress) {
6219
+ throw new Error(
6220
+ "ownerAddress is required when walletClient.account.address is not available"
6221
+ );
6222
+ }
6223
+ const receipt = await config.publicClient.waitForTransactionReceipt({
4416
6224
  hash: args.txHash
4417
6225
  });
4418
- const ownerNonce = await config2.api.getOwnerNonce({
4419
- owner: config2.walletClient.account.address,
6226
+ const ownerNonceResponse = await config.api.getOwnerNonce({
6227
+ owner: ownerAddress,
4420
6228
  block: Number(receipt.blockNumber) - 1
4421
6229
  });
6230
+ const ownerNonce = ownerNonceResponse?.nonce;
4422
6231
  if (isUndefined(ownerNonce)) {
4423
6232
  throw new Error("Could not fetch owner nonce");
4424
6233
  }
4425
- const validatorAddedEvents = await config2.publicClient.getContractEvents({
6234
+ const validatorAddedEvents = await config.publicClient.getContractEvents({
4426
6235
  abi: MainnetV4SetterABI,
4427
- address: config2.contractAddresses.setter,
6236
+ address: config.contractAddresses.setter,
4428
6237
  eventName: "ValidatorAdded",
4429
6238
  args: {
4430
- owner: config2.walletClient.account.address
6239
+ owner: ownerAddress
4431
6240
  },
4432
6241
  fromBlock: receipt.blockNumber,
4433
6242
  toBlock: receipt.blockNumber
@@ -4443,8 +6252,8 @@ const validateSharesPostRegistration = async (config2, args) => {
4443
6252
  blockNumber: Number(receipt.blockNumber),
4444
6253
  operatorsCount: e.args.operatorIds.length,
4445
6254
  isAccountExists: false,
4446
- ownerAddress: config2.walletClient.account.address,
4447
- ownerNonce: Number(ownerNonce) + index,
6255
+ ownerAddress,
6256
+ ownerNonce: ownerNonce + index,
4448
6257
  shares: e.args.shares,
4449
6258
  validatorPublicKey: e.args.publicKey
4450
6259
  })
@@ -4456,85 +6265,153 @@ const validateSharesPostRegistration = async (config2, args) => {
4456
6265
  isValid,
4457
6266
  validations,
4458
6267
  invalids,
4459
- ownerNonceAtBlock: Number(ownerNonce),
6268
+ ownerNonceAtBlock: ownerNonce,
4460
6269
  block: Number(receipt.blockNumber)
4461
6270
  };
4462
6271
  };
4463
- const removeValidators = async (config2, { args: { id, publicKeys }, ...writeOptions }) => {
4464
- const cluster = await config2.api.getCluster({ id });
6272
+ const removeValidators = async (config, { args: { id, publicKeys }, ...writeOptions }) => {
6273
+ const { cluster } = await config.api.getCluster({ id });
4465
6274
  if (!cluster) {
4466
6275
  throw new Error("Cluster not found");
4467
6276
  }
4468
6277
  if (publicKeys.length === 1) {
4469
- return config2.contract.ssv.write.removeValidator({
6278
+ return config.contract.ssv.write.removeValidator({
4470
6279
  args: {
4471
- cluster: getClusterSnapshot$1(cluster),
6280
+ cluster: toSolidityCluster(cluster),
4472
6281
  publicKey: publicKeys[0],
4473
6282
  operatorIds: cluster.operatorIds.map(BigInt)
4474
6283
  },
4475
6284
  ...writeOptions
4476
6285
  });
4477
6286
  }
4478
- return config2.contract.ssv.write.bulkRemoveValidator({
6287
+ return config.contract.ssv.write.bulkRemoveValidator({
4479
6288
  args: {
4480
- cluster: getClusterSnapshot$1(cluster),
6289
+ cluster: toSolidityCluster(cluster),
4481
6290
  publicKeys,
4482
6291
  operatorIds: cluster.operatorIds.map(BigInt)
4483
6292
  },
4484
6293
  ...writeOptions
4485
6294
  });
4486
6295
  };
4487
- const setFeeRecipient = async (config2, { args: { recipient }, ...writeOptions }) => {
4488
- return config2.contract.ssv.write.setFeeRecipientAddress({
6296
+ const setFeeRecipient = async (config, { args: { recipient }, ...writeOptions }) => {
6297
+ return config.contract.ssv.write.setFeeRecipientAddress({
4489
6298
  args: {
4490
6299
  recipientAddress: recipient
4491
6300
  },
4492
6301
  ...writeOptions
4493
6302
  });
4494
6303
  };
4495
- const withdraw$1 = async (config2, { args: { id, amount }, ...writeOptions }) => {
4496
- const cluster = await config2.api.getCluster({ id });
6304
+ const withdraw$1 = async (config, { args: { id, amount }, ...writeOptions }) => {
6305
+ const { cluster } = await config.api.getCluster({ id });
4497
6306
  if (!cluster) {
4498
6307
  throw new Error("Cluster not found");
4499
6308
  }
4500
- return config2.contract.ssv.write.withdraw({
6309
+ return config.contract.ssv.write.withdraw({
4501
6310
  args: {
4502
6311
  amount,
4503
- cluster: getClusterSnapshot$1(cluster),
6312
+ cluster: toSolidityCluster(cluster),
4504
6313
  operatorIds: cluster.operatorIds.map(BigInt)
4505
6314
  },
4506
6315
  ...writeOptions
4507
6316
  });
4508
6317
  };
4509
- const createClusterManager = (config2) => ({
4510
- deposit: deposit.bind(null, config2),
4511
- withdraw: withdraw$1.bind(null, config2),
4512
- liquidate: liquidateCluster.bind(null, config2),
4513
- reactivate: reactivateCluster.bind(null, config2),
4514
- removeValidators: removeValidators.bind(null, config2),
4515
- setFeeRecipient: setFeeRecipient.bind(null, config2),
4516
- exitValidators: exitValidators.bind(null, config2),
4517
- registerValidators: registerValidators.bind(null, config2),
4518
- registerValidatorsRawData: registerValidatorsRawData.bind(null, config2),
6318
+ const createClusterManager = (config) => ({
6319
+ deposit: deposit.bind(null, config),
6320
+ withdraw: withdraw$1.bind(null, config),
6321
+ liquidate: liquidateCluster.bind(null, config),
6322
+ liquidateSSV: liquidateSSV.bind(null, config),
6323
+ reactivate: reactivateCluster.bind(null, config),
6324
+ migrateClusterToETH: migrateClusterToETH.bind(
6325
+ null,
6326
+ config
6327
+ ),
6328
+ removeValidators: removeValidators.bind(null, config),
6329
+ setFeeRecipient: setFeeRecipient.bind(null, config),
6330
+ exitValidators: exitValidators.bind(null, config),
6331
+ registerValidators: registerValidators.bind(null, config),
6332
+ registerValidatorsRawData: registerValidatorsRawData.bind(
6333
+ null,
6334
+ config
6335
+ ),
4519
6336
  validateSharesPostRegistration: validateSharesPostRegistration.bind(
4520
6337
  null,
4521
- config2
6338
+ config
6339
+ )
6340
+ });
6341
+ const commitRoot = async (config, { args: { merkleRoot, blockNum }, ...writeOptions }) => {
6342
+ return config.contract.ssv.write.commitRoot({
6343
+ args: {
6344
+ merkleRoot,
6345
+ blockNum
6346
+ },
6347
+ ...writeOptions
6348
+ });
6349
+ };
6350
+ const updateNetworkFeeSSV = async (config, { args: { fee }, ...writeOptions }) => {
6351
+ return config.contract.ssv.write.updateNetworkFeeSSV({
6352
+ args: {
6353
+ fee
6354
+ },
6355
+ ...writeOptions
6356
+ });
6357
+ };
6358
+ const withdrawNetworkSSVEarnings = async (config, { args: { amount }, ...writeOptions }) => {
6359
+ return config.contract.ssv.write.withdrawNetworkSSVEarnings({
6360
+ args: {
6361
+ amount
6362
+ },
6363
+ ...writeOptions
6364
+ });
6365
+ };
6366
+ const createDaoManager = (config) => ({
6367
+ commitRoot: commitRoot.bind(null, config),
6368
+ updateNetworkFeeSSV: updateNetworkFeeSSV.bind(
6369
+ null,
6370
+ config
6371
+ ),
6372
+ withdrawNetworkSSVEarnings: withdrawNetworkSSVEarnings.bind(
6373
+ null,
6374
+ config
4522
6375
  )
4523
6376
  });
4524
- const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions }) => {
4525
- const balance = await config2.contract.ssv.read.getOperatorEarnings({
6377
+ const withdraw = async (config, { args: { operatorId, amount }, ...writeOptions }) => {
6378
+ const balance = await config.contract.ssv.read.getOperatorEarnings({
6379
+ id: BigInt(operatorId)
6380
+ });
6381
+ const isWithdrawingAll = amount >= balance;
6382
+ if (isWithdrawingAll) {
6383
+ return config.contract.ssv.write.withdrawAllOperatorEarnings({
6384
+ args: {
6385
+ operatorId: BigInt(operatorId)
6386
+ },
6387
+ ...writeOptions
6388
+ });
6389
+ }
6390
+ return config.contract.ssv.write.withdrawOperatorEarnings({
6391
+ args: {
6392
+ operatorId: BigInt(operatorId),
6393
+ amount
6394
+ },
6395
+ ...writeOptions
6396
+ });
6397
+ };
6398
+ const withdrawOperatorEarningsSSV = async (config, {
6399
+ args: { operatorId, amount },
6400
+ ...writeOptions
6401
+ }) => {
6402
+ const balance = await config.contract.ssv.read.getOperatorEarningsSSV({
4526
6403
  id: BigInt(operatorId)
4527
6404
  });
4528
6405
  const isWithdrawingAll = amount >= balance;
4529
6406
  if (isWithdrawingAll) {
4530
- return config2.contract.ssv.write.withdrawAllOperatorEarnings({
6407
+ return config.contract.ssv.write.withdrawAllOperatorEarningsSSV({
4531
6408
  args: {
4532
6409
  operatorId: BigInt(operatorId)
4533
6410
  },
4534
6411
  ...writeOptions
4535
6412
  });
4536
6413
  }
4537
- return config2.contract.ssv.write.withdrawOperatorEarnings({
6414
+ return config.contract.ssv.write.withdrawOperatorEarningsSSV({
4538
6415
  args: {
4539
6416
  operatorId: BigInt(operatorId),
4540
6417
  amount
@@ -4542,24 +6419,52 @@ const withdraw = async (config2, { args: { operatorId, amount }, ...writeOptions
4542
6419
  ...writeOptions
4543
6420
  });
4544
6421
  };
4545
- const registerOperator = async (config2, { args: { isPrivate, yearlyFee, publicKey }, ...writeOptions }) => {
4546
- return config2.contract.ssv.write.registerOperator({
6422
+ const withdrawAllOperatorEarningsSSV = async (config, { args: { operatorId }, ...writeOptions }) => {
6423
+ return config.contract.ssv.write.withdrawAllOperatorEarningsSSV({
6424
+ args: {
6425
+ operatorId: BigInt(operatorId)
6426
+ },
6427
+ ...writeOptions
6428
+ });
6429
+ };
6430
+ const withdrawAllVersionOperatorEarnings = async (config, {
6431
+ args: { operatorId },
6432
+ ...writeOptions
6433
+ }) => {
6434
+ return config.contract.ssv.write.withdrawAllVersionOperatorEarnings({
6435
+ args: {
6436
+ operatorId: BigInt(operatorId)
6437
+ },
6438
+ ...writeOptions
6439
+ });
6440
+ };
6441
+ const registerOperator = async (config, {
6442
+ args: { isPrivate, yearlyFee, publicKey },
6443
+ ...writeOptions
6444
+ }) => {
6445
+ return config.contract.ssv.write.registerOperator({
4547
6446
  args: {
4548
6447
  publicKey: encodeAbiParameters(parseAbiParameters("string"), [publicKey]),
4549
- fee: roundOperatorFee(yearlyFee / globals.BLOCKS_PER_YEAR),
6448
+ fee: roundOperatorFee(
6449
+ yearlyFee / globals.BLOCKS_PER_YEAR,
6450
+ globals.ETH_DEDUCTED_DIGITS
6451
+ ),
4550
6452
  setPrivate: isPrivate
4551
6453
  },
4552
6454
  ...writeOptions
4553
6455
  });
4554
6456
  };
4555
- const setOperatorWhitelists = async (config2, { args: { operatorIds, contractAddress }, ...writeOptions }) => {
4556
- const isWhitelistingContract = await config2.contract.ssv.read.isWhitelistingContract({
6457
+ const setOperatorWhitelists = async (config, {
6458
+ args: { operatorIds, contractAddress },
6459
+ ...writeOptions
6460
+ }) => {
6461
+ const isWhitelistingContract = await config.contract.ssv.read.isWhitelistingContract({
4557
6462
  contractAddress
4558
6463
  });
4559
6464
  if (!isWhitelistingContract) {
4560
6465
  throw new Error("The provided contract is not whitelisting contract");
4561
6466
  }
4562
- return config2.contract.ssv.write.setOperatorsWhitelists({
6467
+ return config.contract.ssv.write.setOperatorsWhitelists({
4563
6468
  args: {
4564
6469
  operatorIds: operatorIds.map(BigInt),
4565
6470
  whitelistAddresses: [contractAddress]
@@ -4567,7 +6472,7 @@ const setOperatorWhitelists = async (config2, { args: { operatorIds, contractAdd
4567
6472
  ...writeOptions
4568
6473
  });
4569
6474
  };
4570
- const canAccountUseOperator = async (config2, operator, account) => {
6475
+ const canAccountUseOperator = async (config, operator, account) => {
4571
6476
  if (!operator) return false;
4572
6477
  if (!operator.isPrivate) return true;
4573
6478
  const isWhitelisted = operator.whitelisted.some(
@@ -4578,80 +6483,178 @@ const canAccountUseOperator = async (config2, operator, account) => {
4578
6483
  operator.whitelistedContract && operator.whitelistedContract !== zeroAddress
4579
6484
  );
4580
6485
  if (!hasExternalContract) return false;
4581
- return config2.contract.ssv.read.isAddressWhitelistedInWhitelistingContract({
6486
+ return config.contract.ssv.read.isAddressWhitelistedInWhitelistingContract({
4582
6487
  addressToCheck: account,
4583
6488
  operatorId: BigInt(operator.id),
4584
6489
  whitelistingContract: operator.whitelistedContract
4585
6490
  });
4586
6491
  };
4587
- const createOperatorManager = (config2) => ({
4588
- registerOperator: registerOperator.bind(null, config2),
4589
- removeOperator: config2.contract.ssv.write.removeOperator,
4590
- withdraw: withdraw.bind(null, config2),
4591
- setOperatorWhitelists: config2.contract.ssv.write.setOperatorsWhitelists,
4592
- removeOperatorWhitelists: config2.contract.ssv.write.removeOperatorsWhitelists,
4593
- setOperatorsPrivate: config2.contract.ssv.write.setOperatorsPrivateUnchecked,
4594
- setOperatorsPublic: config2.contract.ssv.write.setOperatorsPublicUnchecked,
4595
- setOperatorWhitelistingContract: setOperatorWhitelists.bind(null, config2),
4596
- removeOperatorWhitelistingContract: config2.contract.ssv.write.removeOperatorsWhitelists,
4597
- declareOperatorFee: config2.contract.ssv.write.declareOperatorFee,
4598
- executeOperatorFee: config2.contract.ssv.write.executeOperatorFee,
4599
- cancelDeclaredOperatorFee: config2.contract.ssv.write.cancelDeclaredOperatorFee,
4600
- reduceOperatorFee: config2.contract.ssv.write.reduceOperatorFee
6492
+ const createOperatorManager = (config) => ({
6493
+ registerOperator: registerOperator.bind(null, config),
6494
+ removeOperator: config.contract.ssv.write.removeOperator,
6495
+ withdraw: withdraw.bind(null, config),
6496
+ withdrawOperatorEarningsSSV: withdrawOperatorEarningsSSV.bind(
6497
+ null,
6498
+ config
6499
+ ),
6500
+ withdrawAllOperatorEarningsSSV: withdrawAllOperatorEarningsSSV.bind(
6501
+ null,
6502
+ config
6503
+ ),
6504
+ withdrawAllVersionOperatorEarnings: withdrawAllVersionOperatorEarnings.bind(
6505
+ null,
6506
+ config
6507
+ ),
6508
+ setOperatorWhitelists: config.contract.ssv.write.setOperatorsWhitelists,
6509
+ removeOperatorWhitelists: config.contract.ssv.write.removeOperatorsWhitelists,
6510
+ setOperatorsPrivate: config.contract.ssv.write.setOperatorsPrivateUnchecked,
6511
+ setOperatorsPublic: config.contract.ssv.write.setOperatorsPublicUnchecked,
6512
+ setOperatorWhitelistingContract: setOperatorWhitelists.bind(
6513
+ null,
6514
+ config
6515
+ ),
6516
+ removeOperatorWhitelistingContract: config.contract.ssv.write.removeOperatorsWhitelists,
6517
+ declareOperatorFee: config.contract.ssv.write.declareOperatorFee,
6518
+ executeOperatorFee: config.contract.ssv.write.executeOperatorFee,
6519
+ cancelDeclaredOperatorFee: config.contract.ssv.write.cancelDeclaredOperatorFee,
6520
+ reduceOperatorFee: config.contract.ssv.write.reduceOperatorFee
4601
6521
  });
4602
- const getClusterBalance = async (config2, { operatorIds }) => {
4603
- const query = await config2.api.getClusterBalance({
4604
- daoAddress: config2.contractAddresses.setter,
6522
+ const getClusterBalance = async (config, { operatorIds, ownerAddress }) => {
6523
+ const resolvedOwnerAddress = ownerAddress ?? config.walletClient?.account?.address;
6524
+ if (!resolvedOwnerAddress) {
6525
+ throw new Error(
6526
+ "ownerAddress is required when walletClient.account.address is not available"
6527
+ );
6528
+ }
6529
+ const query = await config.api.getClusterBalance({
6530
+ daoAddress: config.contractAddresses.setter,
4605
6531
  operatorIds: operatorIds.map(String),
4606
- clusterId: createClusterId(config2.walletClient.account.address, operatorIds)
6532
+ clusterId: createClusterId(resolvedOwnerAddress, operatorIds)
4607
6533
  });
4608
- if (!query.cluster || !query.daovalues || !query._meta) {
6534
+ if (!query.cluster || !query.daovalues) {
4609
6535
  throw new Error("Could not fetch cluster balance");
4610
6536
  }
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;
6537
+ const isSsvCluster = query.cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6538
+ const networkFee = BigInt(
6539
+ isSsvCluster ? query.daovalues.networkFeeSSV : query.daovalues.networkFee
6540
+ );
6541
+ const networkFeeIndex = BigInt(
6542
+ isSsvCluster ? query.daovalues.networkFeeIndexSSV : query.daovalues.networkFeeIndex
6543
+ );
6544
+ const networkFeeIndexBlockNumber = BigInt(
6545
+ isSsvCluster ? query.daovalues.networkFeeIndexBlockNumberSSV : query.daovalues.networkFeeIndexBlockNumber
6546
+ );
6547
+ const minimumLiquidationCollateral = BigInt(
6548
+ isSsvCluster ? query.daovalues.minimumLiquidationCollateralSSV : query.daovalues.minimumLiquidationCollateral
6549
+ );
6550
+ const liquidationThreshold = BigInt(
6551
+ isSsvCluster ? query.daovalues.liquidationThresholdSSV : query.daovalues.liquidationThreshold
6552
+ );
6553
+ const scallingCoefficient = isSsvCluster ? globals.SSV_DEDUCTED_DIGITS : globals.ETH_DEDUCTED_DIGITS;
6554
+ const cumulativeNetworkFee = networkFeeIndex + (BigInt(query.blockNumber) - networkFeeIndexBlockNumber) * networkFee - BigInt(query.cluster.networkFeeIndex) * scallingCoefficient;
4612
6555
  const cumulativeOperatorFee = query.operators.reduce(
4613
6556
  (acc, operator) => {
4614
- return acc + BigInt(operator.feeIndex) + (BigInt(query._meta.block.number) - BigInt(operator.feeIndexBlockNumber)) * BigInt(operator.fee);
6557
+ const fee = isSsvCluster ? operator.feeSSV : operator.fee;
6558
+ const feeIndex = isSsvCluster ? operator.feeIndexSSV : operator.feeIndex;
6559
+ const feeIndexBlockNumber = isSsvCluster ? operator.feeIndexBlockNumberSSV : operator.feeIndexBlockNumber;
6560
+ return acc + BigInt(feeIndex) + (BigInt(query.blockNumber) - BigInt(feeIndexBlockNumber)) * BigInt(fee);
4615
6561
  },
4616
- -BigInt(query.cluster.index) * 10000000n
6562
+ -BigInt(query.cluster.index) * scallingCoefficient
6563
+ );
6564
+ const operatorsFee = query.operators.reduce(
6565
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6566
+ 0n
4617
6567
  );
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 = bigintMax(mLc, burnRate * BigInt(query.daovalues.liquidationThreshold));
4623
- const runwaySSV = calculatedClusterBalance - LC;
4624
- const operationalRunway = runwaySSV / burnRate / globals.BLOCKS_PER_DAY;
6568
+ const effectiveBalanceValidatorUnits = BigInt(query.cluster.effectiveBalance) * BigInt(globals.VUNITS_PRECISION) / 32n;
6569
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(globals.VUNITS_PRECISION);
6570
+ const calculatedClusterBalance = BigInt(query.cluster.balance) - (cumulativeNetworkFee + cumulativeOperatorFee) * validatorUnits || 1n;
6571
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6572
+ const LC = bigintMax(
6573
+ minimumLiquidationCollateral,
6574
+ burnRate * liquidationThreshold
6575
+ );
6576
+ const runway = calculatedClusterBalance - LC;
6577
+ const operationalRunway = runway / burnRate / globals.BLOCKS_PER_DAY;
4625
6578
  return {
6579
+ blockNumber: query.blockNumber,
4626
6580
  balance: calculatedClusterBalance,
4627
6581
  operationalRunway
4628
6582
  };
4629
6583
  };
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,
6584
+ const isKeySharesPayload = (value) => {
6585
+ return !!value && typeof value === "object" && "sharesData" in value && "publicKey" in value && "operatorIds" in value;
6586
+ };
6587
+ const isKeySharesPayloadList = (value) => {
6588
+ return Array.isArray(value) && value.every(isKeySharesPayload);
6589
+ };
6590
+ const buildKeysharesFromPayloads = (payloads) => {
6591
+ const shares = payloads.map((payload) => {
6592
+ const item = new KeySharesItem();
6593
+ item.payload.update(payload);
6594
+ return item;
6595
+ });
6596
+ ensureValidatorsUniqueness(shares);
6597
+ return shares;
6598
+ };
6599
+ const validateSharesPreRegistration = async (config, { keyshares, operatorIds, ownerAddress }) => {
6600
+ const account = ownerAddress ?? config.walletClient?.account?.address;
6601
+ if (!account) {
6602
+ throw new Error(
6603
+ "ownerAddress is required when walletClient.account.address is not available"
6604
+ );
6605
+ }
6606
+ const { operators } = await config.api.getOperators({ operatorIds });
6607
+ if (operators.length !== operatorIds.length) {
6608
+ throw new KeysharesValidationError(
6609
+ KeysharesValidationErrors.OperatorDoesNotExist
6610
+ );
6611
+ }
6612
+ const usesPayloads = isKeySharesPayloadList(keyshares);
6613
+ const shares = usesPayloads ? buildKeysharesFromPayloads(keyshares) : await validateKeysharesJSON({
6614
+ account,
4634
6615
  operators,
4635
6616
  keyshares
4636
6617
  });
6618
+ if (usesPayloads) {
6619
+ const shareOperatorIds = validateConsistentOperatorIds(shares);
6620
+ const sortedOperatorIds = sortNumbers(
6621
+ operators.map((operator) => Number(operator.id))
6622
+ );
6623
+ if (!isEqual(sortNumbers(shareOperatorIds), sortNumbers(sortedOperatorIds))) {
6624
+ throw new KeysharesValidationError(
6625
+ KeysharesValidationErrors.ClusterMismatch
6626
+ );
6627
+ }
6628
+ }
4637
6629
  const statuses = await Promise.all(
4638
6630
  shares.map((share) => {
4639
- return config2.api.getValidator({ id: share.data.publicKey }).then((res) => [share, Boolean(res)]).catch(() => [share, false]);
6631
+ return config.api.getValidator({ id: share.data.publicKey }).then(
6632
+ ({ validator }) => [share, Boolean(validator)]
6633
+ );
4640
6634
  })
4641
6635
  );
4642
6636
  if (statuses.every(([, isRegistered]) => isRegistered)) {
4643
6637
  throw new Error("All validators are already registered");
4644
6638
  }
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
- });
6639
+ const shouldValidateNonce = shares.every(
6640
+ (share) => typeof share.data.ownerNonce === "number"
6641
+ );
6642
+ const nonce = shouldValidateNonce ? await config.api.getOwnerNonce({ owner: account }).then(({ nonce: nonce2 }) => {
6643
+ if (typeof nonce2 !== "number") {
6644
+ throw new Error("Failed to get owner nonce");
6645
+ }
6646
+ return nonce2;
6647
+ }) : null;
4649
6648
  let i = 0;
4650
6649
  const sharesWithStatuses = statuses.reduce(
4651
6650
  (acc, [share, isRegistered]) => {
4652
6651
  if (isRegistered) {
4653
6652
  acc.registered.push(share);
4654
6653
  } else {
6654
+ if (!shouldValidateNonce) {
6655
+ acc.available.push(share);
6656
+ return acc;
6657
+ }
4655
6658
  const validNonce = nonce + i === share.data.ownerNonce;
4656
6659
  if (validNonce) i++;
4657
6660
  if (validNonce) {
@@ -4669,13 +6672,17 @@ const validateSharesPreRegistration = async (config2, { keyshares, operatorIds }
4669
6672
  `No available keyshares to register. ${sharesWithStatuses.incorrect.length} keyshares have incorrect nonce and ${sharesWithStatuses.registered.length} are already registered`
4670
6673
  );
4671
6674
  }
4672
- const limit = await config2.contract.ssv.read.getValidatorsPerOperatorLimit();
6675
+ const limit = await config.contract.ssv.read.getValidatorsPerOperatorLimit();
4673
6676
  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`);
6677
+ if (!await canAccountUseOperator(config, operator, account)) {
6678
+ throw new Error(
6679
+ `Operator ${operator.id} is private and the account is not whitelisted`
6680
+ );
4676
6681
  }
4677
6682
  if (Number(operator.validatorCount) + sharesWithStatuses.available.length > limit) {
4678
- throw new Error(`Operator ${operator.id} has reached the limit of ${limit} validators`);
6683
+ throw new Error(
6684
+ `Operator ${operator.id} has reached the limit of ${limit} validators`
6685
+ );
4679
6686
  }
4680
6687
  }
4681
6688
  return sharesWithStatuses;
@@ -4699,16 +6706,23 @@ const validateKeysharesJSON = async ({
4699
6706
  )
4700
6707
  );
4701
6708
  const shareOperatorIds = validateConsistentOperatorIds(shares);
4702
- const operatorIds = sortNumbers(operators.map((operator) => Number(operator.id)));
6709
+ const operatorIds = sortNumbers(
6710
+ operators.map((operator) => Number(operator.id))
6711
+ );
4703
6712
  if (!isEqual(sortNumbers(shareOperatorIds), sortNumbers(operatorIds))) {
4704
- throw new KeysharesValidationError(KeysharesValidationErrors.ClusterMismatch);
6713
+ throw new KeysharesValidationError(
6714
+ KeysharesValidationErrors.ClusterMismatch
6715
+ );
4705
6716
  }
4706
6717
  return shares;
4707
6718
  };
4708
6719
  const ssvKeys = new SSVKeys();
4709
6720
  const createAndEncryptShares = async (privateKey, operators) => {
4710
6721
  const threshold = await ssvKeys.createThreshold(privateKey, operators);
4711
- const encryptedShares = await ssvKeys.encryptShares(operators, threshold.shares);
6722
+ const encryptedShares = await ssvKeys.encryptShares(
6723
+ operators,
6724
+ threshold.shares
6725
+ );
4712
6726
  return {
4713
6727
  threshold,
4714
6728
  encryptedShares
@@ -4719,52 +6733,235 @@ const generateKeyShares = async (args) => {
4719
6733
  const shares = [];
4720
6734
  for (let i = 0; i < keystores.length; i++) {
4721
6735
  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],
6736
+ const extracted = await ssvKeys.extractKeys(
6737
+ keystore,
6738
+ args.keystorePassword
6739
+ );
6740
+ const operators = args.operatorKeys.map((key, index) => ({
6741
+ id: args.operatorIds[index],
4725
6742
  operatorKey: key
4726
6743
  }));
4727
6744
  const { threshold, encryptedShares } = await createAndEncryptShares(
4728
6745
  extracted.privateKey,
4729
6746
  operators
4730
6747
  );
4731
- shares.push(
4732
- await new 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
- )
6748
+ const payload = await new KeySharesItem().buildPayload(
6749
+ {
6750
+ publicKey: threshold.publicKey,
6751
+ operators,
6752
+ encryptedShares
6753
+ },
6754
+ {
6755
+ ownerAddress: args.ownerAddress,
6756
+ ownerNonce: args.nonce + i,
6757
+ privateKey: extracted.privateKey
6758
+ }
4744
6759
  );
6760
+ shares.push(payload);
4745
6761
  }
4746
6762
  return shares;
4747
6763
  };
4748
- const getOperatorCapacity = async (config2, operatorId) => {
6764
+ const getOperatorCapacity = async (config, operatorId) => {
4749
6765
  const [operator, limit] = await Promise.all([
4750
- config2.api.getOperator({
6766
+ config.api.getOperator({
4751
6767
  id: operatorId
4752
6768
  }),
4753
- config2.contract.ssv.read.getValidatorsPerOperatorLimit()
6769
+ config.contract.ssv.read.getValidatorsPerOperatorLimit()
4754
6770
  ]);
4755
- if (!operator) return 0;
4756
- return limit - Number(operator.validatorCount);
6771
+ if (!operator?.operator) return 0;
6772
+ return limit - Number(operator.operator.validatorCount);
6773
+ };
6774
+ const isKeySharesFileShare = (share) => {
6775
+ return !!share && typeof share === "object" && "data" in share && "payload" in share;
6776
+ };
6777
+ const isPayloadOnlyShare = (share) => {
6778
+ return !!share && typeof share === "object" && "sharesData" in share && "publicKey" in share && "operatorIds" in share && !("data" in share) && !("payload" in share);
6779
+ };
6780
+ const toWebappOperatorKey = (operatorKey) => {
6781
+ if (operatorKey.startsWith("LS0tLS1CRUdJTi")) {
6782
+ return operatorKey;
6783
+ }
6784
+ return Buffer.from(operatorKey, "utf-8").toString("base64");
4757
6785
  };
4758
- const createUtils = (config2) => ({
6786
+ const buildOperatorMap = async (config, shares, providedOperators) => {
6787
+ if (providedOperators) {
6788
+ return new Map(
6789
+ providedOperators.map((operator) => [
6790
+ operator.id,
6791
+ {
6792
+ ...operator,
6793
+ operatorKey: toWebappOperatorKey(operator.operatorKey)
6794
+ }
6795
+ ])
6796
+ );
6797
+ }
6798
+ const payloadShares = shares.filter(isPayloadOnlyShare);
6799
+ if (!payloadShares.length) {
6800
+ return /* @__PURE__ */ new Map();
6801
+ }
6802
+ const uniqueOperatorIds = [
6803
+ ...new Set(payloadShares.flatMap((share) => share.operatorIds))
6804
+ ];
6805
+ const { operators } = await config.api.getOperators({
6806
+ operatorIds: uniqueOperatorIds.map(String)
6807
+ });
6808
+ if (operators.length !== uniqueOperatorIds.length) {
6809
+ throw new Error(
6810
+ "writeKeysharesFile could not fetch all operators required to build the webapp keyshares format."
6811
+ );
6812
+ }
6813
+ return new Map(
6814
+ operators.map((operator) => [
6815
+ Number(operator.id),
6816
+ {
6817
+ id: Number(operator.id),
6818
+ operatorKey: toWebappOperatorKey(operator.publicKey)
6819
+ }
6820
+ ])
6821
+ );
6822
+ };
6823
+ const normalizeKeySharesItem = async (share, index, args, operatorMap) => {
6824
+ if (isKeySharesItem(share)) {
6825
+ return JSON.parse(share.toJson());
6826
+ }
6827
+ if (isKeySharesFileShare(share)) {
6828
+ return share;
6829
+ }
6830
+ if (!isPayloadOnlyShare(share)) {
6831
+ throw new Error(
6832
+ "writeKeysharesFile received an unsupported keyshares shape."
6833
+ );
6834
+ }
6835
+ if (!args.ownerAddress || typeof args.nonce !== "number") {
6836
+ throw new Error(
6837
+ "writeKeysharesFile requires ownerAddress and nonce when shares contain payload-only keyshares."
6838
+ );
6839
+ }
6840
+ const operators = share.operatorIds.map((operatorId) => {
6841
+ const operator = operatorMap.get(operatorId);
6842
+ if (!operator) {
6843
+ throw new Error(
6844
+ `writeKeysharesFile could not resolve operator ${operatorId} for the webapp keyshares format.`
6845
+ );
6846
+ }
6847
+ return operator;
6848
+ });
6849
+ return {
6850
+ data: {
6851
+ ownerAddress: args.ownerAddress,
6852
+ ownerNonce: args.nonce + index,
6853
+ publicKey: share.publicKey,
6854
+ operators
6855
+ },
6856
+ payload: share
6857
+ };
6858
+ };
6859
+ const getParentDirectory = (filePath) => {
6860
+ const normalizedPath = filePath.replace(/\\/g, "/");
6861
+ const lastSeparatorIndex = normalizedPath.lastIndexOf("/");
6862
+ if (lastSeparatorIndex === -1) {
6863
+ return ".";
6864
+ }
6865
+ if (lastSeparatorIndex === 0) {
6866
+ return normalizedPath[0];
6867
+ }
6868
+ return normalizedPath.slice(0, lastSeparatorIndex);
6869
+ };
6870
+ const writeKeysharesFile = async (config, args) => {
6871
+ const { path, shares } = args;
6872
+ if (!shares.length) {
6873
+ throw new Error(
6874
+ "writeKeysharesFile requires at least one keyshares item to write a file."
6875
+ );
6876
+ }
6877
+ const operatorMap = await buildOperatorMap(config, shares, args.operators);
6878
+ const normalizedShares = await Promise.all(
6879
+ shares.map(
6880
+ (share, index) => normalizeKeySharesItem(share, index, args, operatorMap)
6881
+ )
6882
+ );
6883
+ const keySharesFile = {
6884
+ version: "v1.1.0",
6885
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
6886
+ shares: normalizedShares
6887
+ };
6888
+ const { mkdir, writeFile } = await import("node:fs/promises");
6889
+ await mkdir(getParentDirectory(path), { recursive: true });
6890
+ await writeFile(path, JSON.stringify(keySharesFile, null, 2), {
6891
+ encoding: "utf-8"
6892
+ });
6893
+ };
6894
+ const computeDailyAmount = (value, days) => {
6895
+ const scale = 10 ** 6;
6896
+ const scaledDays = BigInt(days * scale);
6897
+ return value * scaledDays * BigInt(globals.BLOCKS_PER_DAY) / BigInt(scale);
6898
+ };
6899
+ const calcDepositFromRunway = async (config, { clusterId, runway }) => {
6900
+ const { cluster } = await config.api.getCluster({ id: clusterId });
6901
+ if (!cluster) {
6902
+ throw new Error("Cluster not found");
6903
+ }
6904
+ const { operators } = await config.api.getOperators({
6905
+ operatorIds: cluster.operatorIds
6906
+ });
6907
+ if (!operators) {
6908
+ throw new Error("Operators not found");
6909
+ }
6910
+ const { daovalues: daoValues } = await config.api.getDaoValues({
6911
+ daoAddress: config.contractAddresses.setter
6912
+ });
6913
+ if (!daoValues) {
6914
+ throw new Error("DAO values not found");
6915
+ }
6916
+ const isSsvCluster = cluster.feeAsset === ClusterFeeAssetTypes.SSV;
6917
+ const operatorsFee = operators.reduce(
6918
+ (acc, operator) => acc + BigInt(isSsvCluster ? operator.feeSSV : operator.fee),
6919
+ 0n
6920
+ );
6921
+ const networkFee = BigInt(
6922
+ isSsvCluster ? daoValues.networkFeeSSV : daoValues.networkFee
6923
+ );
6924
+ const minimumLiquidationCollateral = BigInt(
6925
+ isSsvCluster ? daoValues.minimumLiquidationCollateralSSV : daoValues.minimumLiquidationCollateral
6926
+ );
6927
+ const liquidationThreshold = BigInt(
6928
+ isSsvCluster ? daoValues.liquidationThresholdSSV : daoValues.liquidationThreshold
6929
+ );
6930
+ const effectiveBalanceValidatorUnits = BigInt(cluster.effectiveBalance) * BigInt(globals.VUNITS_PRECISION) / 32n;
6931
+ const validatorUnits = effectiveBalanceValidatorUnits / BigInt(globals.VUNITS_PRECISION) || 1n;
6932
+ const burnRate = (operatorsFee + networkFee) * validatorUnits || 1n;
6933
+ const liquidationCollateral = bigintMax(
6934
+ minimumLiquidationCollateral,
6935
+ burnRate * liquidationThreshold
6936
+ );
6937
+ const residualBalance = computeDailyAmount(burnRate, runway);
6938
+ return residualBalance + liquidationCollateral;
6939
+ };
6940
+ const createUtils = (config) => ({
4759
6941
  generateKeyShares,
6942
+ writeKeysharesFile: writeKeysharesFile.bind(
6943
+ null,
6944
+ config
6945
+ ),
4760
6946
  validateKeysharesJSON,
4761
- validateSharesPreRegistration: validateSharesPreRegistration.bind(null, config2),
4762
- getOperatorCapacity: getOperatorCapacity.bind(null, config2),
4763
- getClusterBalance: getClusterBalance.bind(null, config2)
6947
+ validateSharesPreRegistration: validateSharesPreRegistration.bind(
6948
+ null,
6949
+ config
6950
+ ),
6951
+ getOperatorCapacity: getOperatorCapacity.bind(
6952
+ null,
6953
+ config
6954
+ ),
6955
+ getClusterBalance: getClusterBalance.bind(null, config),
6956
+ calcDepositFromRunway: calcDepositFromRunway.bind(
6957
+ null,
6958
+ config
6959
+ )
4764
6960
  });
4765
6961
  class SSVSDK {
4766
6962
  config;
4767
6963
  clusters;
6964
+ dao;
4768
6965
  operators;
4769
6966
  api;
4770
6967
  contract;
@@ -4772,26 +6969,43 @@ class SSVSDK {
4772
6969
  constructor(props) {
4773
6970
  this.config = isConfig(props) ? props : createConfig(props);
4774
6971
  this.clusters = createClusterManager(this.config);
6972
+ this.dao = createDaoManager(this.config);
4775
6973
  this.operators = createOperatorManager(this.config);
4776
6974
  this.api = this.config.api;
4777
6975
  this.contract = this.config.contract;
4778
6976
  this.utils = createUtils(this.config);
4779
6977
  }
6978
+ connectWallet(walletClient) {
6979
+ configArgsSchema.parse({
6980
+ publicClient: this.config.publicClient,
6981
+ walletClient
6982
+ });
6983
+ this.config.walletClient = walletClient;
6984
+ this.config.contract = createContractInteractions({
6985
+ walletClient,
6986
+ publicClient: this.config.publicClient,
6987
+ addresses: this.config.contractAddresses
6988
+ });
6989
+ this.contract = this.config.contract;
6990
+ this.operators = createOperatorManager(this.config);
6991
+ return this;
6992
+ }
4780
6993
  }
4781
6994
  export {
4782
6995
  KeyShares,
4783
6996
  KeySharesItem,
4784
6997
  O2 as OperatorPublicKeyError,
4785
- c as OperatorsCountsMismatchError,
6998
+ b as OperatorsCountsMismatchError,
4786
6999
  SSVKeys,
4787
- b as SSVKeysException,
7000
+ c as SSVKeysException,
4788
7001
  SSVSDK,
4789
- Q as chainIds,
7002
+ O as chainIds,
4790
7003
  P as chains,
4791
7004
  contracts,
4792
7005
  createClusterManager,
4793
7006
  createConfig,
4794
7007
  createContractInteractions,
7008
+ createDaoManager,
4795
7009
  createOperatorManager,
4796
7010
  createQueries,
4797
7011
  createReader,
@@ -4802,6 +7016,7 @@ export {
4802
7016
  getClusterBalance$1 as getClusterBalance,
4803
7017
  getClusterSnapshot,
4804
7018
  getClusters,
7019
+ getDaoValues,
4805
7020
  getOperator,
4806
7021
  getOperators,
4807
7022
  getOwnerNonce,
@@ -4810,7 +7025,7 @@ export {
4810
7025
  getValidators,
4811
7026
  globals,
4812
7027
  graph_endpoints,
4813
- O as hoodi,
7028
+ Q as hoodi,
4814
7029
  isConfig,
4815
7030
  R as networks,
4816
7031
  paid_graph_endpoints,