@obolnetwork/obol-sdk 1.0.16 → 1.0.17

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 (48) hide show
  1. package/README.md +6 -3
  2. package/dist/cjs/package.json +11 -6
  3. package/dist/cjs/src/ajv.js +27 -0
  4. package/dist/cjs/src/constants.js +8 -4
  5. package/dist/cjs/src/index.js +10 -9
  6. package/dist/cjs/src/schema.js +8 -0
  7. package/dist/cjs/src/utils.js +3 -3
  8. package/dist/cjs/src/verification/common.js +19 -7
  9. package/dist/cjs/src/verification/termsAndConditions.js +1 -1
  10. package/dist/cjs/src/verification/v1.6.0.js +1 -1
  11. package/dist/cjs/src/verification/v1.7.0.js +3 -3
  12. package/dist/cjs/src/verification/v1.8.0.js +3 -3
  13. package/dist/cjs/test/fixtures.js +27 -33
  14. package/dist/cjs/test/methods.test.js +54 -27
  15. package/dist/esm/package.json +11 -6
  16. package/dist/esm/src/ajv.js +27 -0
  17. package/dist/esm/src/base.js +1 -1
  18. package/dist/esm/src/constants.js +7 -3
  19. package/dist/esm/src/index.js +11 -10
  20. package/dist/esm/src/schema.js +8 -0
  21. package/dist/esm/src/utils.js +3 -3
  22. package/dist/esm/src/verification/common.js +27 -15
  23. package/dist/esm/src/verification/sszTypes.js +1 -1
  24. package/dist/esm/src/verification/termsAndConditions.js +1 -1
  25. package/dist/esm/src/verification/v1.6.0.js +5 -5
  26. package/dist/esm/src/verification/v1.7.0.js +8 -8
  27. package/dist/esm/src/verification/v1.8.0.js +8 -8
  28. package/dist/esm/test/fixtures.js +27 -33
  29. package/dist/esm/test/methods.test.js +55 -28
  30. package/dist/types/src/constants.d.ts +3 -1
  31. package/dist/types/src/schema.d.ts +8 -0
  32. package/dist/types/src/types.d.ts +18 -18
  33. package/package.json +12 -7
  34. package/src/ajv.ts +38 -7
  35. package/src/base.ts +22 -18
  36. package/src/constants.ts +42 -36
  37. package/src/errors.ts +4 -4
  38. package/src/index.ts +85 -75
  39. package/src/schema.ts +10 -2
  40. package/src/services.ts +6 -6
  41. package/src/types.ts +65 -65
  42. package/src/utils.ts +17 -17
  43. package/src/verification/common.ts +374 -333
  44. package/src/verification/sszTypes.ts +60 -51
  45. package/src/verification/termsAndConditions.ts +16 -14
  46. package/src/verification/v1.6.0.ts +214 -184
  47. package/src/verification/v1.7.0.ts +268 -233
  48. package/src/verification/v1.8.0.ts +266 -225
package/src/base.ts CHANGED
@@ -1,31 +1,35 @@
1
1
  // src/resources/base.ts
2
- import { DEFAULT_BASE_URL, DEFAULT_CHAIN_ID, SDK_VERSION } from './constants.js'
3
- import { FORK_MAPPING } from './types.js'
2
+ import {
3
+ DEFAULT_BASE_URL,
4
+ DEFAULT_CHAIN_ID,
5
+ SDK_VERSION,
6
+ } from './constants.js';
7
+ import { FORK_MAPPING } from './types.js';
4
8
 
5
9
  interface Config {
6
- baseUrl?: string
7
- chainId?: FORK_MAPPING
10
+ baseUrl?: string;
11
+ chainId?: FORK_MAPPING;
8
12
  }
9
13
 
10
14
  export abstract class Base {
11
- baseUrl: string
12
- chainId: number
13
- fork_version: string
15
+ baseUrl: string;
16
+ chainId: number;
17
+ fork_version: string;
14
18
 
15
- constructor ({
19
+ constructor({
16
20
  baseUrl = DEFAULT_BASE_URL,
17
21
  chainId = DEFAULT_CHAIN_ID,
18
22
  }: Config) {
19
- this.baseUrl = baseUrl
20
- this.chainId = chainId
21
- this.fork_version = FORK_MAPPING[this.chainId]
23
+ this.baseUrl = baseUrl;
24
+ this.chainId = chainId;
25
+ this.fork_version = FORK_MAPPING[this.chainId];
22
26
  }
23
27
 
24
28
  protected async request<T>(
25
29
  endpoint: string,
26
30
  options?: RequestInit,
27
31
  ): Promise<T> {
28
- const url = `${this.baseUrl}${endpoint}`
32
+ const url = `${this.baseUrl}${endpoint}`;
29
33
  const config = {
30
34
  ...options,
31
35
  headers: {
@@ -33,18 +37,18 @@ export abstract class Base {
33
37
  'User-Agent': `Obol-SDK/${SDK_VERSION}`,
34
38
  ...options?.headers,
35
39
  },
36
- }
40
+ };
37
41
 
38
42
  try {
39
- const response = await fetch(url, config)
43
+ const response = await fetch(url, config);
40
44
  if (response.ok) {
41
- return await response.json()
45
+ return await response.json();
42
46
  } else {
43
- const errorResponse = await response.json()
44
- throw errorResponse
47
+ const errorResponse = await response.json();
48
+ throw errorResponse;
45
49
  }
46
50
  } catch (e: any) {
47
- throw e
51
+ throw e;
48
52
  }
49
53
  }
50
54
  }
package/src/constants.ts CHANGED
@@ -1,61 +1,61 @@
1
- import { type TypedMessage } from '@metamask/eth-sig-util'
2
- import { type TypedDataDomain } from 'ethers'
3
- import * as pjson from '../package.json'
1
+ import { type TypedMessage } from '@metamask/eth-sig-util';
2
+ import { type TypedDataDomain } from 'ethers';
3
+ import * as pjson from '../package.json';
4
4
 
5
- export const CONFLICT_ERROR_MSG = 'Conflict'
5
+ export const CONFLICT_ERROR_MSG = 'Conflict';
6
6
 
7
- export const EIP712_DOMAIN_NAME = 'Obol'
8
- export const EIP712_DOMAIN_VERSION = '1'
7
+ export const EIP712_DOMAIN_NAME = 'Obol';
8
+ export const EIP712_DOMAIN_VERSION = '1';
9
9
  export const CreatorConfigHashSigningTypes = {
10
10
  CreatorConfigHash: [{ name: 'creator_config_hash', type: 'string' }],
11
- }
11
+ };
12
12
  export const TermsAndConditionsSigningTypes = {
13
13
  TermsAndConditions: [
14
14
  { name: 'terms_and_conditions_hash', type: 'string' },
15
15
  { name: 'version', type: 'uint256' },
16
- ]
17
- }
16
+ ],
17
+ };
18
18
 
19
19
  const EIP712Domain = [
20
20
  { name: 'name', type: 'string' },
21
21
  { name: 'version', type: 'string' },
22
22
  { name: 'chainId', type: 'uint256' },
23
- ]
23
+ ];
24
24
 
25
25
  export const Domain = (chainId?: number): TypedDataDomain => {
26
26
  const typeDataDomain: any = {
27
27
  name: EIP712_DOMAIN_NAME,
28
28
  version: EIP712_DOMAIN_VERSION,
29
- }
29
+ };
30
30
  if (chainId) {
31
- typeDataDomain.chainId = chainId
31
+ typeDataDomain.chainId = chainId;
32
32
  }
33
- return typeDataDomain
34
- }
33
+ return typeDataDomain;
34
+ };
35
35
 
36
36
  export const CreatorTypedMessage = {
37
37
  EIP712Domain,
38
38
  ...CreatorConfigHashSigningTypes,
39
- }
39
+ };
40
40
 
41
41
  // A conflict once updateDefinition is merged
42
42
  export const EnrSigningTypes = {
43
43
  ENR: [{ name: 'enr', type: 'string' }],
44
- }
44
+ };
45
45
 
46
46
  export const OperatorConfigHashSigningTypes = {
47
47
  OperatorConfigHash: [{ name: 'operator_config_hash', type: 'string' }],
48
- }
48
+ };
49
49
 
50
50
  export const OperatorTypedMessage = {
51
51
  EIP712Domain,
52
52
  ...OperatorConfigHashSigningTypes,
53
- }
53
+ };
54
54
 
55
55
  export const ENRTypedMessage = {
56
56
  EIP712Domain,
57
57
  ...EnrSigningTypes,
58
- }
58
+ };
59
59
 
60
60
  export const signCreatorConfigHashPayload = (
61
61
  payload: { creator_config_hash: string },
@@ -70,8 +70,8 @@ export const signCreatorConfigHashPayload = (
70
70
  chainId,
71
71
  },
72
72
  message: payload,
73
- }
74
- }
73
+ };
74
+ };
75
75
 
76
76
  export const signOperatorConfigHashPayload = (
77
77
  payload: { operator_config_hash: string },
@@ -86,8 +86,8 @@ export const signOperatorConfigHashPayload = (
86
86
  chainId,
87
87
  },
88
88
  message: payload,
89
- }
90
- }
89
+ };
90
+ };
91
91
 
92
92
  export const signEnrPayload = (
93
93
  payload: { enr: string },
@@ -102,19 +102,19 @@ export const signEnrPayload = (
102
102
  chainId,
103
103
  },
104
104
  message: payload,
105
- }
106
- }
105
+ };
106
+ };
107
107
 
108
- export const DKG_ALGORITHM = 'default'
108
+ export const DKG_ALGORITHM = 'default';
109
109
 
110
- export const CONFIG_VERSION = 'v1.7.0'
110
+ export const CONFIG_VERSION = 'v1.8.0';
111
111
 
112
- export const SDK_VERSION = pjson.version
112
+ export const SDK_VERSION = pjson.version;
113
113
 
114
- export const DOMAIN_APPLICATION_BUILDER = '00000001'
115
- export const DOMAIN_DEPOSIT = '03000000'
114
+ export const DOMAIN_APPLICATION_BUILDER = '00000001';
115
+ export const DOMAIN_DEPOSIT = '03000000';
116
116
  export const GENESIS_VALIDATOR_ROOT =
117
- '0000000000000000000000000000000000000000000000000000000000000000'
117
+ '0000000000000000000000000000000000000000000000000000000000000000';
118
118
 
119
119
  // Flow used to create definition
120
120
  export enum DefinitionFlow {
@@ -123,10 +123,16 @@ export enum DefinitionFlow {
123
123
  Charon = 'Charon-Command',
124
124
  }
125
125
 
126
- export const DEFAULT_BASE_URL = 'https://api.obol.tech'
127
- export const DEFAULT_CHAIN_ID = 17000
126
+ export const DEFAULT_BASE_URL = 'https://api.obol.tech';
127
+ export const DEFAULT_BASE_VERSION = 'v1';
128
+ export const DEFAULT_CHAIN_ID = 17000;
128
129
 
129
- export const ETHER_TO_GWEI = 10 ** 9
130
+ export const ETHER_TO_GWEI = 10 ** 9;
130
131
 
131
- export const TERMS_AND_CONDITIONS_VERSION = 1
132
- export const TERMS_AND_CONDITIONS_URL = (TERMS_AND_CONDITIONS_VERSION === 1) ? 'https://obol.tech/terms.pdf' : `https://obol.tech/${TERMS_AND_CONDITIONS_VERSION as number}/terms.pdf`
132
+ export const TERMS_AND_CONDITIONS_VERSION = 1;
133
+ export const TERMS_AND_CONDITIONS_URL =
134
+ TERMS_AND_CONDITIONS_VERSION === 1
135
+ ? 'https://obol.org/terms.pdf'
136
+ : `https://obol.org/${TERMS_AND_CONDITIONS_VERSION as number}/terms.pdf`;
137
+ export const TERMS_AND_CONDITIONS_HASH =
138
+ '0xd33721644e8f3afab1495a74abe3523cec12d48b8da6cb760972492ca3f1a273';
package/src/errors.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export class ConflictError extends Error {
2
- name = 'ConflictError'
2
+ name = 'ConflictError';
3
3
 
4
- constructor () {
5
- super('This Cluster has been already posted.')
6
- Object.setPrototypeOf(this, ConflictError.prototype)
4
+ constructor() {
5
+ super('This Cluster has been already posted.');
6
+ Object.setPrototypeOf(this, ConflictError.prototype);
7
7
  }
8
8
  }
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { type Signer } from 'ethers'
2
- import { v4 as uuidv4 } from 'uuid'
3
- import { Base } from './base.js'
1
+ import { type Signer } from 'ethers';
2
+ import { v4 as uuidv4 } from 'uuid';
3
+ import { Base } from './base.js';
4
4
  import {
5
5
  CONFLICT_ERROR_MSG,
6
6
  CreatorConfigHashSigningTypes,
@@ -11,26 +11,27 @@ import {
11
11
  EnrSigningTypes,
12
12
  TERMS_AND_CONDITIONS_VERSION,
13
13
  TermsAndConditionsSigningTypes,
14
- } from './constants.js'
15
- import { ConflictError } from './errors.js'
14
+ DEFAULT_BASE_VERSION,
15
+ TERMS_AND_CONDITIONS_HASH,
16
+ } from './constants.js';
17
+ import { ConflictError } from './errors.js';
16
18
  import {
17
19
  type ClusterDefinition,
18
20
  type ClusterLock,
19
21
  type ClusterPayload,
20
22
  type OperatorPayload,
21
- } from './types.js'
22
- import { clusterConfigOrDefinitionHash } from './verification/common.js'
23
- import { validatePayload } from './ajv.js'
24
- import { definitionSchema, operatorPayloadSchema } from './schema.js'
25
- import { hashTermsAndConditions } from './verification/termsAndConditions.js'
26
- export * from './types.js'
27
- export * from './services.js'
23
+ } from './types.js';
24
+ import { clusterConfigOrDefinitionHash } from './verification/common.js';
25
+ import { validatePayload } from './ajv.js';
26
+ import { definitionSchema, operatorPayloadSchema } from './schema.js';
27
+ export * from './types.js';
28
+ export * from './services.js';
28
29
 
29
30
  /**
30
31
  * Obol sdk Client can be used for creating, managing and activating distributed validators.
31
32
  */
32
33
  export class Client extends Base {
33
- private readonly signer: Signer | undefined
34
+ private readonly signer: Signer | undefined;
34
35
 
35
36
  /**
36
37
  * @param config - Client configurations
@@ -42,12 +43,9 @@ export class Client extends Base {
42
43
  * An example of how to instantiate obol-sdk Client:
43
44
  * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L29)
44
45
  */
45
- constructor (
46
- config: { baseUrl?: string, chainId?: number },
47
- signer?: Signer,
48
- ) {
49
- super(config)
50
- this.signer = signer
46
+ constructor(config: { baseUrl?: string; chainId?: number }, signer?: Signer) {
47
+ super(config);
48
+ this.signer = signer;
51
49
  }
52
50
 
53
51
  /**
@@ -58,17 +56,19 @@ export class Client extends Base {
58
56
  * An example of how to use acceptObolLatestTermsAndConditions:
59
57
  * [acceptObolLatestTermsAndConditions](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L44)
60
58
  */
61
- async acceptObolLatestTermsAndConditions (): Promise<string> {
62
- if (!this.signer) { throw new Error('Signer is required in acceptObolTermsAndConditions') }
59
+ async acceptObolLatestTermsAndConditions(): Promise<string> {
60
+ if (!this.signer) {
61
+ throw new Error('Signer is required in acceptObolTermsAndConditions');
62
+ }
63
63
 
64
64
  try {
65
- const termsAndConditionsHash = await hashTermsAndConditions()
66
- const address = await this.signer.getAddress()
65
+ const termsAndConditionsHash = TERMS_AND_CONDITIONS_HASH;
66
+ const address = await this.signer.getAddress();
67
67
  const termsAndConditionsPayload = {
68
68
  address,
69
69
  version: TERMS_AND_CONDITIONS_VERSION,
70
- terms_and_conditions_hash: termsAndConditionsHash
71
- }
70
+ terms_and_conditions_hash: termsAndConditionsHash,
71
+ };
72
72
 
73
73
  const termsAndConditionsSignature = await this.signer.signTypedData(
74
74
  Domain(),
@@ -77,21 +77,22 @@ export class Client extends Base {
77
77
  terms_and_conditions_hash: termsAndConditionsHash,
78
78
  version: TERMS_AND_CONDITIONS_VERSION,
79
79
  },
80
- )
80
+ );
81
81
 
82
- const termsAndConditionsResponse: { message: string, success: boolean } = await this.request('/termsAndConditions', {
83
- method: 'POST',
84
- body: JSON.stringify(termsAndConditionsPayload),
85
- headers: {
86
- Authorization: `Bearer ${termsAndConditionsSignature}`,
87
- },
88
- })
89
- return termsAndConditionsResponse?.message
82
+ const termsAndConditionsResponse: { message: string; success: boolean } =
83
+ await this.request(`/${DEFAULT_BASE_VERSION}/termsAndConditions`, {
84
+ method: 'POST',
85
+ body: JSON.stringify(termsAndConditionsPayload),
86
+ headers: {
87
+ Authorization: `Bearer ${termsAndConditionsSignature}`,
88
+ },
89
+ });
90
+ return termsAndConditionsResponse?.message;
90
91
  } catch (err: any) {
91
92
  if (err?.message === CONFLICT_ERROR_MSG) {
92
- throw new ConflictError()
93
+ throw new ConflictError();
93
94
  }
94
- throw err
95
+ throw err;
95
96
  }
96
97
  }
97
98
 
@@ -104,10 +105,12 @@ export class Client extends Base {
104
105
  * An example of how to use createClusterDefinition:
105
106
  * [createObolCluster](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L59)
106
107
  */
107
- async createClusterDefinition (newCluster: ClusterPayload): Promise<string> {
108
- if (!this.signer) { throw new Error('Signer is required in createClusterDefinition') }
108
+ async createClusterDefinition(newCluster: ClusterPayload): Promise<string> {
109
+ if (!this.signer) {
110
+ throw new Error('Signer is required in createClusterDefinition');
111
+ }
109
112
 
110
- validatePayload(newCluster, definitionSchema)
113
+ validatePayload(newCluster, definitionSchema);
111
114
 
112
115
  const clusterConfig: Partial<ClusterDefinition> = {
113
116
  ...newCluster,
@@ -118,37 +121,42 @@ export class Client extends Base {
118
121
  timestamp: new Date().toISOString(),
119
122
  threshold: Math.ceil((2 * newCluster.operators.length) / 3),
120
123
  num_validators: newCluster.validators.length,
121
- }
122
-
124
+ deposit_amounts: newCluster.deposit_amounts
125
+ ? newCluster.deposit_amounts
126
+ : ['32000000000'],
127
+ };
123
128
  try {
124
- const address = await this.signer.getAddress()
129
+ const address = await this.signer.getAddress();
125
130
 
126
- clusterConfig.creator = { address }
131
+ clusterConfig.creator = { address };
127
132
  clusterConfig.config_hash = clusterConfigOrDefinitionHash(
128
133
  clusterConfig as ClusterDefinition,
129
134
  true,
130
- )
135
+ );
131
136
 
132
137
  const creatorConfigSignature = await this.signer.signTypedData(
133
138
  Domain(this.chainId),
134
139
  CreatorConfigHashSigningTypes,
135
140
  { creator_config_hash: clusterConfig.config_hash },
136
- )
137
-
138
- const clusterDefinition: ClusterDefinition = await this.request('/v1/definition', {
139
- method: 'POST',
140
- body: JSON.stringify(clusterConfig),
141
- headers: {
142
- Authorization: `Bearer ${creatorConfigSignature}`,
143
- 'fork-version': this.fork_version,
141
+ );
142
+
143
+ const clusterDefinition: ClusterDefinition = await this.request(
144
+ `/${DEFAULT_BASE_VERSION}/definition`,
145
+ {
146
+ method: 'POST',
147
+ body: JSON.stringify(clusterConfig),
148
+ headers: {
149
+ Authorization: `Bearer ${creatorConfigSignature}`,
150
+ 'fork-version': this.fork_version,
151
+ },
144
152
  },
145
- })
146
- return clusterDefinition?.config_hash
153
+ );
154
+ return clusterDefinition?.config_hash;
147
155
  } catch (err: any) {
148
156
  if (err?.message === CONFLICT_ERROR_MSG) {
149
- throw new ConflictError()
157
+ throw new ConflictError();
150
158
  }
151
- throw err
159
+ throw err;
152
160
  }
153
161
  }
154
162
 
@@ -162,36 +170,38 @@ export class Client extends Base {
162
170
  * An example of how to use acceptClusterDefinition:
163
171
  * [acceptClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L106)
164
172
  */
165
- async acceptClusterDefinition (
173
+ async acceptClusterDefinition(
166
174
  operatorPayload: OperatorPayload,
167
175
  configHash: string,
168
176
  ): Promise<ClusterDefinition> {
169
- if (!this.signer) { throw new Error('Signer is required in acceptClusterDefinition') }
177
+ if (!this.signer) {
178
+ throw new Error('Signer is required in acceptClusterDefinition');
179
+ }
170
180
 
171
- validatePayload(operatorPayload, operatorPayloadSchema)
181
+ validatePayload(operatorPayload, operatorPayloadSchema);
172
182
 
173
183
  try {
174
- const address = await this.signer.getAddress()
184
+ const address = await this.signer.getAddress();
175
185
 
176
186
  const operatorConfigSignature = await this.signer.signTypedData(
177
187
  Domain(this.chainId),
178
188
  OperatorConfigHashSigningTypes,
179
189
  { operator_config_hash: configHash },
180
- )
190
+ );
181
191
  const operatorENRSignature = await this.signer.signTypedData(
182
192
  Domain(this.chainId),
183
193
  EnrSigningTypes,
184
194
  { enr: operatorPayload.enr },
185
- )
195
+ );
186
196
 
187
197
  const operatorData: OperatorPayload = {
188
198
  ...operatorPayload,
189
199
  address,
190
200
  enr_signature: operatorENRSignature,
191
201
  fork_version: this.fork_version,
192
- }
202
+ };
193
203
  const clusterDefinition: ClusterDefinition = await this.request(
194
- `/v1/definition/${configHash}`,
204
+ `/${DEFAULT_BASE_VERSION}/definition/${configHash}`,
195
205
  {
196
206
  method: 'PUT',
197
207
  body: JSON.stringify(operatorData),
@@ -199,10 +209,10 @@ export class Client extends Base {
199
209
  Authorization: `Bearer ${operatorConfigSignature}`,
200
210
  },
201
211
  },
202
- )
203
- return clusterDefinition
212
+ );
213
+ return clusterDefinition;
204
214
  } catch (err: any) {
205
- throw err
215
+ throw err;
206
216
  }
207
217
  }
208
218
 
@@ -214,15 +224,15 @@ export class Client extends Base {
214
224
  * An example of how to use getClusterDefinition:
215
225
  * [getObolClusterDefinition](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L74)
216
226
  */
217
- async getClusterDefinition (configHash: string): Promise<ClusterDefinition> {
227
+ async getClusterDefinition(configHash: string): Promise<ClusterDefinition> {
218
228
  const clusterDefinition: ClusterDefinition = await this.request(
219
- `/dv/${configHash}`,
229
+ `/${DEFAULT_BASE_VERSION}/definition/${configHash}`,
220
230
  {
221
231
  method: 'GET',
222
232
  },
223
- )
233
+ );
224
234
 
225
- return clusterDefinition
235
+ return clusterDefinition;
226
236
  }
227
237
 
228
238
  /**
@@ -233,13 +243,13 @@ export class Client extends Base {
233
243
  * An example of how to use getClusterLock:
234
244
  * [getObolClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L89)
235
245
  */
236
- async getClusterLock (configHash: string): Promise<ClusterLock> {
246
+ async getClusterLock(configHash: string): Promise<ClusterLock> {
237
247
  const lock: ClusterLock = await this.request(
238
- `/lock/configHash/${configHash}`,
248
+ `/${DEFAULT_BASE_VERSION}/lock/configHash/${configHash}`,
239
249
  {
240
250
  method: 'GET',
241
251
  },
242
- )
243
- return lock
252
+ );
253
+ return lock;
244
254
  }
245
255
  }
package/src/schema.ts CHANGED
@@ -9,7 +9,7 @@ export const operatorPayloadSchema = {
9
9
  },
10
10
  },
11
11
  required: ['version', 'enr'],
12
- }
12
+ };
13
13
 
14
14
  export const definitionSchema = {
15
15
  type: 'object',
@@ -53,6 +53,14 @@ export const definitionSchema = {
53
53
  required: ['fee_recipient_address', 'withdrawal_address'],
54
54
  },
55
55
  },
56
+ deposit_amounts: {
57
+ type: 'array',
58
+ items: {
59
+ type: 'string',
60
+ pattern: '^[0-9]+$',
61
+ },
62
+ validDepositAmounts: true,
63
+ },
56
64
  },
57
65
  required: ['name', 'operators', 'validators'],
58
- }
66
+ };
package/src/services.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { type ClusterLock } from './types.js'
2
- import { isValidClusterLock } from './verification/common.js'
1
+ import { type ClusterLock } from './types.js';
2
+ import { isValidClusterLock } from './verification/common.js';
3
3
 
4
4
  /**
5
5
  * Verifies Cluster Lock's validity.
@@ -14,9 +14,9 @@ export const validateClusterLock = async (
14
14
  lock: ClusterLock,
15
15
  ): Promise<boolean> => {
16
16
  try {
17
- const isLockValid = await isValidClusterLock(lock)
18
- return isLockValid
17
+ const isLockValid = await isValidClusterLock(lock);
18
+ return isLockValid;
19
19
  } catch (err: any) {
20
- throw err
20
+ throw err;
21
21
  }
22
- }
22
+ };