@ssv-labs/ssv-sdk 0.1.3 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.html +4 -7
  2. package/README.md +37 -26
  3. package/dist/{KeyShares-B_4l2THg.js → KeyShares-Bk9uzOlK.js} +194 -51
  4. package/dist/{KeyShares-ClzHwMUy.mjs → KeyShares-Dlp4Pa3b.mjs} +198 -55
  5. package/dist/abi/mainnet/v4/getter.d.ts +699 -74
  6. package/dist/abi/mainnet/v4/setter.d.ts +939 -59
  7. package/dist/api/subgraph/index.d.ts +36 -1
  8. package/dist/config/create.d.ts +2 -2
  9. package/dist/config/globals.d.ts +3 -0
  10. package/dist/{globals-CDOcDUnk.mjs → config-BdEJjnYA.mjs} +107 -79
  11. package/dist/{globals-DsaKgq3v.js → config-ClGS9Tic.js} +73 -45
  12. package/dist/contract-interactions/create.d.ts +1 -1
  13. package/dist/contract-interactions/types.d.ts +9 -3
  14. package/dist/graphql/graphql.d.ts +4663 -922
  15. package/dist/keys.js +1 -1
  16. package/dist/keys.mjs +5 -5
  17. package/dist/libs/api/index.d.ts +2 -0
  18. package/dist/libs/cluster/index.d.ts +3 -1
  19. package/dist/libs/cluster/methods/deposit.d.ts +150 -4
  20. package/dist/libs/cluster/methods/exit-validators.d.ts +149 -0
  21. package/dist/libs/cluster/methods/index.d.ts +3 -1
  22. package/dist/libs/cluster/methods/liquidate-cluster.d.ts +149 -0
  23. package/dist/libs/cluster/methods/liquidate-ssv.d.ts +430 -0
  24. package/dist/libs/cluster/methods/migrate-cluster-to-eth.d.ts +431 -0
  25. package/dist/libs/cluster/methods/reactivate-cluster.d.ts +149 -0
  26. package/dist/libs/cluster/methods/register-validators.d.ts +2222 -309
  27. package/dist/libs/cluster/methods/remove-validators.d.ts +149 -0
  28. package/dist/libs/cluster/methods/set-fee-recipient.d.ts +149 -0
  29. package/dist/libs/cluster/methods/withdraw.d.ts +149 -0
  30. package/dist/libs/dao/index.d.ts +8 -0
  31. package/dist/libs/dao/methods/commit-root.d.ts +432 -0
  32. package/dist/libs/dao/methods/index.d.ts +3 -0
  33. package/dist/libs/dao/methods/update-network-fee-ssv.d.ts +430 -0
  34. package/dist/libs/dao/methods/withdraw-network-ssv-earnings.d.ts +430 -0
  35. package/dist/libs/operator/index.d.ts +1525 -32
  36. package/dist/libs/operator/methods.d.ts +1731 -2
  37. package/dist/libs/ssv-keys/Encryption/__test__/RsaKeys.d.ts +1 -1
  38. package/dist/libs/ssv-keys/KeyShares/KeySharesItem.d.ts +1 -1
  39. package/dist/libs/ssv-keys/SSVKeys.d.ts +1 -1
  40. package/dist/libs/ssv-keys/exceptions/index.d.ts +1 -1
  41. package/dist/libs/ssv-keys/index.d.ts +1 -1
  42. package/dist/libs/ssv-keys/interfaces/index.d.ts +2 -2
  43. package/dist/libs/utils/index.d.ts +6 -4
  44. package/dist/libs/utils/methods/calc-deposit-from-runway.d.ts +11 -0
  45. package/dist/libs/utils/methods/get-cluster-balance.d.ts +3 -1
  46. package/dist/libs/utils/methods/keyshares.d.ts +4 -2
  47. package/dist/libs/utils/methods/keystores.d.ts +4 -4
  48. package/dist/main.d.ts +1 -0
  49. package/dist/main.js +2714 -729
  50. package/dist/main.mjs +2746 -761
  51. package/dist/sdk.d.ts +8 -4
  52. package/dist/types/contract-interactions.d.ts +11 -0
  53. package/dist/types/methods.d.ts +4 -3
  54. package/dist/utils/cluster.d.ts +3 -3
  55. package/dist/utils/funding.d.ts +29 -0
  56. package/dist/utils/zod/config.d.ts +1 -1
  57. package/dist/utils.js +38 -38
  58. package/dist/utils.mjs +34 -34
  59. package/package.json +18 -6
package/dist/keys.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const KeyShares = require("./KeyShares-B_4l2THg.js");
3
+ const KeyShares = require("./KeyShares-Bk9uzOlK.js");
4
4
  exports.KeyShares = KeyShares.KeyShares;
5
5
  exports.KeySharesItem = KeyShares.KeySharesItem;
6
6
  exports.OperatorPublicKeyError = KeyShares.OperatorPublicKeyError;
package/dist/keys.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { a, K, O, c, S, b } from "./KeyShares-ClzHwMUy.mjs";
1
+ import { K, a, O, b, S, c } from "./KeyShares-Dlp4Pa3b.mjs";
2
2
  export {
3
- a as KeyShares,
4
- K as KeySharesItem,
3
+ K as KeyShares,
4
+ a as KeySharesItem,
5
5
  O as OperatorPublicKeyError,
6
- c as OperatorsCountsMismatchError,
6
+ b as OperatorsCountsMismatchError,
7
7
  S as SSVKeys,
8
- b as SSVKeysException
8
+ c as SSVKeysException
9
9
  };
@@ -1,6 +1,7 @@
1
1
  import { GraphQLClient } from 'graphql-request';
2
2
  export declare const createQueries: (graphqlClient: GraphQLClient) => {
3
3
  getOwnerNonce: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getOwnerNonce>;
4
+ toSolidityCluster: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').toSolidityCluster>;
4
5
  getClusterSnapshot: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusterSnapshot>;
5
6
  getCluster: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getCluster>;
6
7
  getClusters: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusters>;
@@ -9,6 +10,7 @@ export declare const createQueries: (graphqlClient: GraphQLClient) => {
9
10
  getValidators: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getValidators>;
10
11
  getValidator: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getValidator>;
11
12
  getClusterBalance: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getClusterBalance>;
13
+ getDaoValues: import('../../types/methods').RemoveConfigArg<typeof import('../../api/subgraph').getDaoValues>;
12
14
  };
13
15
  export declare const createSSVAPI: (endpoint: string) => {
14
16
  checkOperatorDKGEnabled: (dkgAddresses: {
@@ -1,11 +1,13 @@
1
1
  import { ConfigReturnType } from '../../config/create';
2
- import { deposit, exitValidators, liquidateCluster, reactivateCluster, registerValidators, registerValidatorsRawData, removeValidators, setFeeRecipient, validateSharesPostRegistration, withdraw } from './methods';
2
+ import { deposit, exitValidators, liquidateCluster, liquidateSSV, migrateClusterToETH, reactivateCluster, registerValidators, registerValidatorsRawData, removeValidators, setFeeRecipient, validateSharesPostRegistration, withdraw } from './methods';
3
3
  import { RemoveConfigArg } from '../../types/methods';
4
4
  export declare const createClusterManager: (config: ConfigReturnType) => {
5
5
  deposit: RemoveConfigArg<typeof deposit>;
6
6
  withdraw: RemoveConfigArg<typeof withdraw>;
7
7
  liquidate: RemoveConfigArg<typeof liquidateCluster>;
8
+ liquidateSSV: RemoveConfigArg<typeof liquidateSSV>;
8
9
  reactivate: RemoveConfigArg<typeof reactivateCluster>;
10
+ migrateClusterToETH: RemoveConfigArg<typeof migrateClusterToETH>;
9
11
  removeValidators: RemoveConfigArg<typeof removeValidators>;
10
12
  setFeeRecipient: RemoveConfigArg<typeof setFeeRecipient>;
11
13
  exitValidators: RemoveConfigArg<typeof exitValidators>;
@@ -4,10 +4,7 @@ type DepositProps = SmartFnWriteOptions<{
4
4
  id: string;
5
5
  amount: bigint;
6
6
  }>;
7
- type DepositOptions = {
8
- approve?: boolean;
9
- };
10
- export declare const deposit: (config: ConfigReturnType, { args: { id, amount }, ...writeOptions }: DepositProps, options?: DepositOptions) => Promise<{
7
+ export declare const deposit: (config: ConfigReturnType, { args: { id, amount }, ...writeOptions }: DepositProps) => Promise<{
11
8
  hash: import('viem').Hash;
12
9
  wait: () => Promise<import('viem').TransactionReceipt & {
13
10
  events: ({
@@ -43,6 +40,21 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
43
40
  args: {
44
41
  implementation: `0x${string}`;
45
42
  };
43
+ } | {
44
+ eventName: "ClusterBalanceUpdated";
45
+ args: {
46
+ owner: `0x${string}`;
47
+ operatorIds: readonly bigint[];
48
+ blockNum: bigint;
49
+ effectiveBalance: number;
50
+ cluster: {
51
+ validatorCount: number;
52
+ networkFeeIndex: bigint;
53
+ index: bigint;
54
+ active: boolean;
55
+ balance: bigint;
56
+ };
57
+ };
46
58
  } | {
47
59
  eventName: "ClusterDeposited";
48
60
  args: {
@@ -70,6 +82,22 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
70
82
  balance: bigint;
71
83
  };
72
84
  };
85
+ } | {
86
+ eventName: "ClusterMigratedToETH";
87
+ args: {
88
+ owner: `0x${string}`;
89
+ operatorIds: readonly bigint[];
90
+ ethDeposited: bigint;
91
+ ssvRefunded: bigint;
92
+ effectiveBalance: number;
93
+ cluster: {
94
+ validatorCount: number;
95
+ networkFeeIndex: bigint;
96
+ index: bigint;
97
+ active: boolean;
98
+ balance: bigint;
99
+ };
100
+ };
73
101
  } | {
74
102
  eventName: "ClusterReactivated";
75
103
  args: {
@@ -97,11 +125,23 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
97
125
  balance: bigint;
98
126
  };
99
127
  };
128
+ } | {
129
+ eventName: "CooldownDurationUpdated";
130
+ args: {
131
+ newCooldownDuration: bigint;
132
+ };
100
133
  } | {
101
134
  eventName: "DeclareOperatorFeePeriodUpdated";
102
135
  args: {
103
136
  value: bigint;
104
137
  };
138
+ } | {
139
+ eventName: "ERC20Rescued";
140
+ args: {
141
+ token: `0x${string}`;
142
+ to: `0x${string}`;
143
+ amount: bigint;
144
+ };
105
145
  } | {
106
146
  eventName: "ExecuteOperatorFeePeriodUpdated";
107
147
  args: {
@@ -113,16 +153,42 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
113
153
  owner: `0x${string}`;
114
154
  recipientAddress: `0x${string}`;
115
155
  };
156
+ } | {
157
+ eventName: "FeesSynced";
158
+ args: {
159
+ newFeesWei: bigint;
160
+ accEthPerShare: bigint;
161
+ };
162
+ } | {
163
+ eventName: "LiquidationThresholdPeriodSSVUpdated";
164
+ args: {
165
+ value: bigint;
166
+ };
116
167
  } | {
117
168
  eventName: "LiquidationThresholdPeriodUpdated";
118
169
  args: {
119
170
  value: bigint;
120
171
  };
172
+ } | {
173
+ eventName: "MinBlocksBetweenUpdatesUpdated";
174
+ args: {
175
+ newMinBlocksBetweenUpdates: number;
176
+ };
177
+ } | {
178
+ eventName: "MinimumLiquidationCollateralSSVUpdated";
179
+ args: {
180
+ value: bigint;
181
+ };
121
182
  } | {
122
183
  eventName: "MinimumLiquidationCollateralUpdated";
123
184
  args: {
124
185
  value: bigint;
125
186
  };
187
+ } | {
188
+ eventName: "MinimumOperatorEthFeeUpdated";
189
+ args: {
190
+ minFee: bigint;
191
+ };
126
192
  } | {
127
193
  eventName: "ModuleUpgraded";
128
194
  args: {
@@ -141,6 +207,12 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
141
207
  oldFee: bigint;
142
208
  newFee: bigint;
143
209
  };
210
+ } | {
211
+ eventName: "NetworkFeeUpdatedSSV";
212
+ args: {
213
+ oldFee: bigint;
214
+ newFee: bigint;
215
+ };
144
216
  } | {
145
217
  eventName: "OperatorAdded";
146
218
  args: {
@@ -223,6 +295,70 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
223
295
  operatorId: bigint;
224
296
  value: bigint;
225
297
  };
298
+ } | {
299
+ eventName: "OperatorWithdrawnSSV";
300
+ args: {
301
+ owner: `0x${string}`;
302
+ operatorId: bigint;
303
+ value: bigint;
304
+ };
305
+ } | {
306
+ eventName: "OracleReplaced";
307
+ args: {
308
+ oracleId: number;
309
+ oldOracle: `0x${string}`;
310
+ newOracle: `0x${string}`;
311
+ };
312
+ } | {
313
+ eventName: "QuorumUpdated";
314
+ args: {
315
+ newQuorum: number;
316
+ };
317
+ } | {
318
+ eventName: "RewardsClaimed";
319
+ args: {
320
+ user: `0x${string}`;
321
+ amount: bigint;
322
+ };
323
+ } | {
324
+ eventName: "RewardsSettled";
325
+ args: {
326
+ user: `0x${string}`;
327
+ pending: bigint;
328
+ accrued: bigint;
329
+ userIndex: bigint;
330
+ };
331
+ } | {
332
+ eventName: "RootCommitted";
333
+ args: {
334
+ merkleRoot: `0x${string}`;
335
+ blockNum: bigint;
336
+ };
337
+ } | {
338
+ eventName: "SSVNetworkUpgradeBlock";
339
+ args: {
340
+ version: string;
341
+ blockNumber: bigint;
342
+ };
343
+ } | {
344
+ eventName: "Staked";
345
+ args: {
346
+ user: `0x${string}`;
347
+ amount: bigint;
348
+ };
349
+ } | {
350
+ eventName: "UnstakeRequested";
351
+ args: {
352
+ user: `0x${string}`;
353
+ amount: bigint;
354
+ unlockTime: bigint;
355
+ };
356
+ } | {
357
+ eventName: "UnstakedWithdrawn";
358
+ args: {
359
+ user: `0x${string}`;
360
+ amount: bigint;
361
+ };
226
362
  } | {
227
363
  eventName: "ValidatorAdded";
228
364
  args: {
@@ -259,6 +395,16 @@ export declare const deposit: (config: ConfigReturnType, { args: { id, amount },
259
395
  balance: bigint;
260
396
  };
261
397
  };
398
+ } | {
399
+ eventName: "WeightedRootProposed";
400
+ args: {
401
+ merkleRoot: `0x${string}`;
402
+ blockNum: bigint;
403
+ accumulatedWeight: bigint;
404
+ quorum: bigint;
405
+ oracleId: number;
406
+ oracle: `0x${string}`;
407
+ };
262
408
  } | {
263
409
  eventName: "OwnershipTransferred";
264
410
  args: {
@@ -41,6 +41,21 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
41
41
  args: {
42
42
  implementation: `0x${string}`;
43
43
  };
44
+ } | {
45
+ eventName: "ClusterBalanceUpdated";
46
+ args: {
47
+ owner: `0x${string}`;
48
+ operatorIds: readonly bigint[];
49
+ blockNum: bigint;
50
+ effectiveBalance: number;
51
+ cluster: {
52
+ validatorCount: number;
53
+ networkFeeIndex: bigint;
54
+ index: bigint;
55
+ active: boolean;
56
+ balance: bigint;
57
+ };
58
+ };
44
59
  } | {
45
60
  eventName: "ClusterDeposited";
46
61
  args: {
@@ -68,6 +83,22 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
68
83
  balance: bigint;
69
84
  };
70
85
  };
86
+ } | {
87
+ eventName: "ClusterMigratedToETH";
88
+ args: {
89
+ owner: `0x${string}`;
90
+ operatorIds: readonly bigint[];
91
+ ethDeposited: bigint;
92
+ ssvRefunded: bigint;
93
+ effectiveBalance: number;
94
+ cluster: {
95
+ validatorCount: number;
96
+ networkFeeIndex: bigint;
97
+ index: bigint;
98
+ active: boolean;
99
+ balance: bigint;
100
+ };
101
+ };
71
102
  } | {
72
103
  eventName: "ClusterReactivated";
73
104
  args: {
@@ -95,11 +126,23 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
95
126
  balance: bigint;
96
127
  };
97
128
  };
129
+ } | {
130
+ eventName: "CooldownDurationUpdated";
131
+ args: {
132
+ newCooldownDuration: bigint;
133
+ };
98
134
  } | {
99
135
  eventName: "DeclareOperatorFeePeriodUpdated";
100
136
  args: {
101
137
  value: bigint;
102
138
  };
139
+ } | {
140
+ eventName: "ERC20Rescued";
141
+ args: {
142
+ token: `0x${string}`;
143
+ to: `0x${string}`;
144
+ amount: bigint;
145
+ };
103
146
  } | {
104
147
  eventName: "ExecuteOperatorFeePeriodUpdated";
105
148
  args: {
@@ -111,16 +154,42 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
111
154
  owner: `0x${string}`;
112
155
  recipientAddress: `0x${string}`;
113
156
  };
157
+ } | {
158
+ eventName: "FeesSynced";
159
+ args: {
160
+ newFeesWei: bigint;
161
+ accEthPerShare: bigint;
162
+ };
163
+ } | {
164
+ eventName: "LiquidationThresholdPeriodSSVUpdated";
165
+ args: {
166
+ value: bigint;
167
+ };
114
168
  } | {
115
169
  eventName: "LiquidationThresholdPeriodUpdated";
116
170
  args: {
117
171
  value: bigint;
118
172
  };
173
+ } | {
174
+ eventName: "MinBlocksBetweenUpdatesUpdated";
175
+ args: {
176
+ newMinBlocksBetweenUpdates: number;
177
+ };
178
+ } | {
179
+ eventName: "MinimumLiquidationCollateralSSVUpdated";
180
+ args: {
181
+ value: bigint;
182
+ };
119
183
  } | {
120
184
  eventName: "MinimumLiquidationCollateralUpdated";
121
185
  args: {
122
186
  value: bigint;
123
187
  };
188
+ } | {
189
+ eventName: "MinimumOperatorEthFeeUpdated";
190
+ args: {
191
+ minFee: bigint;
192
+ };
124
193
  } | {
125
194
  eventName: "ModuleUpgraded";
126
195
  args: {
@@ -139,6 +208,12 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
139
208
  oldFee: bigint;
140
209
  newFee: bigint;
141
210
  };
211
+ } | {
212
+ eventName: "NetworkFeeUpdatedSSV";
213
+ args: {
214
+ oldFee: bigint;
215
+ newFee: bigint;
216
+ };
142
217
  } | {
143
218
  eventName: "OperatorAdded";
144
219
  args: {
@@ -221,6 +296,70 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
221
296
  operatorId: bigint;
222
297
  value: bigint;
223
298
  };
299
+ } | {
300
+ eventName: "OperatorWithdrawnSSV";
301
+ args: {
302
+ owner: `0x${string}`;
303
+ operatorId: bigint;
304
+ value: bigint;
305
+ };
306
+ } | {
307
+ eventName: "OracleReplaced";
308
+ args: {
309
+ oracleId: number;
310
+ oldOracle: `0x${string}`;
311
+ newOracle: `0x${string}`;
312
+ };
313
+ } | {
314
+ eventName: "QuorumUpdated";
315
+ args: {
316
+ newQuorum: number;
317
+ };
318
+ } | {
319
+ eventName: "RewardsClaimed";
320
+ args: {
321
+ user: `0x${string}`;
322
+ amount: bigint;
323
+ };
324
+ } | {
325
+ eventName: "RewardsSettled";
326
+ args: {
327
+ user: `0x${string}`;
328
+ pending: bigint;
329
+ accrued: bigint;
330
+ userIndex: bigint;
331
+ };
332
+ } | {
333
+ eventName: "RootCommitted";
334
+ args: {
335
+ merkleRoot: `0x${string}`;
336
+ blockNum: bigint;
337
+ };
338
+ } | {
339
+ eventName: "SSVNetworkUpgradeBlock";
340
+ args: {
341
+ version: string;
342
+ blockNumber: bigint;
343
+ };
344
+ } | {
345
+ eventName: "Staked";
346
+ args: {
347
+ user: `0x${string}`;
348
+ amount: bigint;
349
+ };
350
+ } | {
351
+ eventName: "UnstakeRequested";
352
+ args: {
353
+ user: `0x${string}`;
354
+ amount: bigint;
355
+ unlockTime: bigint;
356
+ };
357
+ } | {
358
+ eventName: "UnstakedWithdrawn";
359
+ args: {
360
+ user: `0x${string}`;
361
+ amount: bigint;
362
+ };
224
363
  } | {
225
364
  eventName: "ValidatorAdded";
226
365
  args: {
@@ -257,6 +396,16 @@ export declare const exitValidators: (config: ConfigReturnType, { args: { public
257
396
  balance: bigint;
258
397
  };
259
398
  };
399
+ } | {
400
+ eventName: "WeightedRootProposed";
401
+ args: {
402
+ merkleRoot: `0x${string}`;
403
+ blockNum: bigint;
404
+ accumulatedWeight: bigint;
405
+ quorum: bigint;
406
+ oracleId: number;
407
+ oracle: `0x${string}`;
408
+ };
260
409
  } | {
261
410
  eventName: "OwnershipTransferred";
262
411
  args: {
@@ -1,8 +1,10 @@
1
1
  export { deposit } from './deposit';
2
2
  export { exitValidators } from './exit-validators';
3
3
  export { liquidateCluster } from './liquidate-cluster';
4
+ export { liquidateSSV } from './liquidate-ssv';
5
+ export { migrateClusterToETH } from './migrate-cluster-to-eth';
4
6
  export { reactivateCluster } from './reactivate-cluster';
5
- export { registerValidators, registerValidatorsRawData, validateSharesPostRegistration } from './register-validators';
7
+ export { registerValidators, registerValidatorsRawData, validateSharesPostRegistration, } from './register-validators';
6
8
  export { removeValidators } from './remove-validators';
7
9
  export { setFeeRecipient } from './set-fee-recipient';
8
10
  export { withdraw } from './withdraw';