@obolnetwork/obol-sdk 2.11.4 → 2.11.5-rc.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.
- package/README.md +33 -0
- package/dist/browser/src/index.js +18280 -0
- package/dist/browser/src/index.js.map +1 -0
- package/dist/cjs/src/index.js +17470 -382
- package/dist/cjs/src/index.js.map +1 -0
- package/dist/esm/src/index.js +17437 -361
- package/dist/esm/src/index.js.map +1 -0
- package/dist/types/src/constants.d.ts +1 -2
- package/dist/types/src/eoa/eoaHelpers.d.ts +1 -1
- package/dist/types/src/exits/verificationHelpers.d.ts +0 -2
- package/dist/types/src/incentives/incentiveHelpers.d.ts +1 -1
- package/dist/types/src/splits/splitHelpers.d.ts +3 -3
- package/dist/types/src/utils.d.ts +2 -2
- package/dist/types/src/verification/common.d.ts +0 -2
- package/dist/types/src/verification/signature-validator.d.ts +4 -4
- package/dist/types/src/verification/v1.10.0.d.ts +1 -1
- package/dist/types/src/verification/v1.6.0.d.ts +1 -1
- package/dist/types/src/verification/v1.7.0.d.ts +1 -1
- package/dist/types/src/verification/v1.8.0.d.ts +1 -1
- package/dist/types/test/client/methods.spec.d.ts +17 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/tsup.config.d.ts +2 -0
- package/package.json +96 -58
- package/dist/cjs/package.json +0 -139
- package/dist/cjs/src/abi/BatchDeposit.js +0 -120
- package/dist/cjs/src/abi/MerkleDistributorWithDeadline.js +0 -73
- package/dist/cjs/src/abi/Multicall3.js +0 -253
- package/dist/cjs/src/abi/OVM.js +0 -627
- package/dist/cjs/src/abi/OWR.js +0 -304
- package/dist/cjs/src/abi/SplitMain.js +0 -929
- package/dist/cjs/src/abi/splitV2FactoryAbi.js +0 -420
- package/dist/cjs/src/ajv.js +0 -136
- package/dist/cjs/src/base.js +0 -42
- package/dist/cjs/src/bytecodes.js +0 -19
- package/dist/cjs/src/constants.js +0 -272
- package/dist/cjs/src/eoa/eoa.js +0 -132
- package/dist/cjs/src/eoa/eoaHelpers.js +0 -82
- package/dist/cjs/src/errors.js +0 -11
- package/dist/cjs/src/exits/ethUtils.js +0 -57
- package/dist/cjs/src/exits/exit.js +0 -502
- package/dist/cjs/src/exits/verificationHelpers.js +0 -86
- package/dist/cjs/src/incentives/incentiveHelpers.js +0 -39
- package/dist/cjs/src/incentives/incentives.js +0 -119
- package/dist/cjs/src/schema.js +0 -352
- package/dist/cjs/src/services.js +0 -33
- package/dist/cjs/src/splits/splitHelpers.js +0 -571
- package/dist/cjs/src/splits/splits.js +0 -366
- package/dist/cjs/src/types.js +0 -29
- package/dist/cjs/src/utils.js +0 -77
- package/dist/cjs/src/verification/common.js +0 -355
- package/dist/cjs/src/verification/signature-validator.js +0 -73
- package/dist/cjs/src/verification/sszTypes.js +0 -69
- package/dist/cjs/src/verification/termsAndConditions.js +0 -40
- package/dist/cjs/src/verification/v1.10.0.js +0 -146
- package/dist/cjs/src/verification/v1.6.0.js +0 -149
- package/dist/cjs/src/verification/v1.7.0.js +0 -173
- package/dist/cjs/src/verification/v1.8.0.js +0 -196
- package/dist/cjs/test/client/ajv.spec.js +0 -320
- package/dist/cjs/test/client/methods.spec.js +0 -418
- package/dist/cjs/test/eoa/eoa.spec.js +0 -176
- package/dist/cjs/test/exit/ethUtils.spec.js +0 -83
- package/dist/cjs/test/exit/exit.spec.js +0 -399
- package/dist/cjs/test/exit/verificationHelpers.spec.js +0 -68
- package/dist/cjs/test/fixtures.js +0 -896
- package/dist/cjs/test/incentives/incentives.spec.js +0 -202
- package/dist/cjs/test/splits/splits.spec.js +0 -402
- package/dist/esm/package.json +0 -139
- package/dist/esm/src/abi/BatchDeposit.js +0 -117
- package/dist/esm/src/abi/MerkleDistributorWithDeadline.js +0 -70
- package/dist/esm/src/abi/Multicall3.js +0 -250
- package/dist/esm/src/abi/OVM.js +0 -624
- package/dist/esm/src/abi/OWR.js +0 -301
- package/dist/esm/src/abi/SplitMain.js +0 -926
- package/dist/esm/src/abi/splitV2FactoryAbi.js +0 -417
- package/dist/esm/src/ajv.js +0 -129
- package/dist/esm/src/base.js +0 -38
- package/dist/esm/src/bytecodes.js +0 -16
- package/dist/esm/src/constants.js +0 -238
- package/dist/esm/src/eoa/eoa.js +0 -128
- package/dist/esm/src/eoa/eoaHelpers.js +0 -77
- package/dist/esm/src/errors.js +0 -7
- package/dist/esm/src/exits/ethUtils.js +0 -52
- package/dist/esm/src/exits/exit.js +0 -475
- package/dist/esm/src/exits/verificationHelpers.js +0 -81
- package/dist/esm/src/incentives/incentiveHelpers.js +0 -34
- package/dist/esm/src/incentives/incentives.js +0 -115
- package/dist/esm/src/schema.js +0 -349
- package/dist/esm/src/services.js +0 -29
- package/dist/esm/src/splits/splitHelpers.js +0 -554
- package/dist/esm/src/splits/splits.js +0 -362
- package/dist/esm/src/types.js +0 -26
- package/dist/esm/src/utils.js +0 -68
- package/dist/esm/src/verification/common.js +0 -319
- package/dist/esm/src/verification/signature-validator.js +0 -64
- package/dist/esm/src/verification/sszTypes.js +0 -64
- package/dist/esm/src/verification/termsAndConditions.js +0 -33
- package/dist/esm/src/verification/v1.10.0.js +0 -140
- package/dist/esm/src/verification/v1.6.0.js +0 -142
- package/dist/esm/src/verification/v1.7.0.js +0 -166
- package/dist/esm/src/verification/v1.8.0.js +0 -189
- package/dist/esm/test/client/ajv.spec.js +0 -318
- package/dist/esm/test/client/methods.spec.js +0 -393
- package/dist/esm/test/eoa/eoa.spec.js +0 -174
- package/dist/esm/test/exit/ethUtils.spec.js +0 -81
- package/dist/esm/test/exit/exit.spec.js +0 -374
- package/dist/esm/test/exit/verificationHelpers.spec.js +0 -66
- package/dist/esm/test/fixtures.js +0 -893
- package/dist/esm/test/incentives/incentives.spec.js +0 -177
- package/dist/esm/test/splits/splits.spec.js +0 -400
- package/dist/types/src/verification/termsAndConditions.d.ts +0 -1
- package/src/abi/BatchDeposit.ts +0 -117
- package/src/abi/MerkleDistributorWithDeadline.ts +0 -70
- package/src/abi/Multicall3.ts +0 -250
- package/src/abi/OVM.ts +0 -624
- package/src/abi/OWR.ts +0 -302
- package/src/abi/SplitMain.ts +0 -927
- package/src/abi/splitV2FactoryAbi.ts +0 -417
- package/src/ajv.ts +0 -191
- package/src/base.ts +0 -54
- package/src/bytecodes.ts +0 -32
- package/src/constants.ts +0 -309
- package/src/eoa/eoa.ts +0 -153
- package/src/eoa/eoaHelpers.ts +0 -112
- package/src/errors.ts +0 -8
- package/src/exits/ethUtils.ts +0 -49
- package/src/exits/exit.ts +0 -661
- package/src/exits/verificationHelpers.ts +0 -110
- package/src/incentives/incentiveHelpers.ts +0 -55
- package/src/incentives/incentives.ts +0 -153
- package/src/index.ts +0 -614
- package/src/schema.ts +0 -376
- package/src/services.ts +0 -24
- package/src/splits/splitHelpers.ts +0 -1032
- package/src/splits/splits.ts +0 -504
- package/src/types.ts +0 -687
- package/src/utils.ts +0 -88
- package/src/verification/common.ts +0 -532
- package/src/verification/signature-validator.ts +0 -103
- package/src/verification/sszTypes.ts +0 -88
- package/src/verification/termsAndConditions.ts +0 -32
- package/src/verification/v1.10.0.ts +0 -245
- package/src/verification/v1.6.0.ts +0 -256
- package/src/verification/v1.7.0.ts +0 -309
- package/src/verification/v1.8.0.ts +0 -340
package/src/schema.ts
DELETED
|
@@ -1,376 +0,0 @@
|
|
|
1
|
-
import { ZeroAddress } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
|
|
4
|
-
DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
|
|
5
|
-
PRINCIPAL_THRESHOLD,
|
|
6
|
-
} from './constants';
|
|
7
|
-
import { VALID_DEPOSIT_AMOUNTS, VALID_NON_COMPOUNDING_AMOUNTS } from './ajv';
|
|
8
|
-
|
|
9
|
-
export const operatorPayloadSchema = {
|
|
10
|
-
type: 'object',
|
|
11
|
-
properties: {
|
|
12
|
-
version: { type: 'string' },
|
|
13
|
-
enr: { type: 'string' },
|
|
14
|
-
},
|
|
15
|
-
required: ['version', 'enr'],
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const definitionSchema = {
|
|
19
|
-
type: 'object',
|
|
20
|
-
properties: {
|
|
21
|
-
name: { type: 'string' },
|
|
22
|
-
operators: {
|
|
23
|
-
type: 'array',
|
|
24
|
-
minItems: 4,
|
|
25
|
-
items: {
|
|
26
|
-
type: 'object',
|
|
27
|
-
properties: {
|
|
28
|
-
address: {
|
|
29
|
-
type: 'string',
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
required: ['address'],
|
|
33
|
-
},
|
|
34
|
-
validateUniqueAddresses: true,
|
|
35
|
-
},
|
|
36
|
-
validators: {
|
|
37
|
-
type: 'array',
|
|
38
|
-
minItems: 1,
|
|
39
|
-
items: {
|
|
40
|
-
type: 'object',
|
|
41
|
-
properties: {
|
|
42
|
-
fee_recipient_address: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
45
|
-
},
|
|
46
|
-
withdrawal_address: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
required: ['fee_recipient_address', 'withdrawal_address'],
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
deposit_amounts: {
|
|
55
|
-
type: ['array', 'null'],
|
|
56
|
-
items: {
|
|
57
|
-
type: 'string',
|
|
58
|
-
pattern: '^[0-9]+$',
|
|
59
|
-
},
|
|
60
|
-
if: {
|
|
61
|
-
$data: '1/compounding',
|
|
62
|
-
},
|
|
63
|
-
then: {
|
|
64
|
-
items: {
|
|
65
|
-
enum: VALID_DEPOSIT_AMOUNTS,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
else: {
|
|
69
|
-
items: {
|
|
70
|
-
enum: VALID_NON_COMPOUNDING_AMOUNTS,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
default: null,
|
|
74
|
-
},
|
|
75
|
-
compounding: {
|
|
76
|
-
type: 'boolean',
|
|
77
|
-
default: false,
|
|
78
|
-
},
|
|
79
|
-
target_gas_limit: {
|
|
80
|
-
type: 'number',
|
|
81
|
-
minimum: 1,
|
|
82
|
-
default: 36000000,
|
|
83
|
-
},
|
|
84
|
-
consensus_protocol: {
|
|
85
|
-
type: 'string',
|
|
86
|
-
enum: ['qbft', ''],
|
|
87
|
-
default: '',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
required: ['name', 'operators', 'validators'],
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export const totalSplitterPayloadSchema = {
|
|
94
|
-
type: 'object',
|
|
95
|
-
properties: {
|
|
96
|
-
splitRecipients: {
|
|
97
|
-
type: 'array',
|
|
98
|
-
items: {
|
|
99
|
-
type: 'object',
|
|
100
|
-
properties: {
|
|
101
|
-
account: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
104
|
-
},
|
|
105
|
-
percentAllocation: { type: 'number' },
|
|
106
|
-
},
|
|
107
|
-
required: ['account', 'percentAllocation'],
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
ObolRAFSplit: {
|
|
111
|
-
type: 'number',
|
|
112
|
-
minimum: DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
|
|
113
|
-
default: DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
|
|
114
|
-
},
|
|
115
|
-
distributorFee: {
|
|
116
|
-
type: 'number',
|
|
117
|
-
maximum: 10,
|
|
118
|
-
multipleOf: 0.01,
|
|
119
|
-
default: 0,
|
|
120
|
-
},
|
|
121
|
-
controllerAddress: {
|
|
122
|
-
type: 'string',
|
|
123
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
124
|
-
default: ZeroAddress,
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
validateTotalSplitRecipients: true,
|
|
128
|
-
required: ['splitRecipients'],
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const rewardsSplitterPayloadSchema = {
|
|
132
|
-
type: 'object',
|
|
133
|
-
properties: {
|
|
134
|
-
...totalSplitterPayloadSchema.properties,
|
|
135
|
-
ObolRAFSplit: {
|
|
136
|
-
type: 'number',
|
|
137
|
-
minimum: DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
|
|
138
|
-
default: DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
|
|
139
|
-
},
|
|
140
|
-
recoveryAddress: {
|
|
141
|
-
type: 'string',
|
|
142
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
143
|
-
default: ZeroAddress,
|
|
144
|
-
},
|
|
145
|
-
etherAmount: { type: 'number' },
|
|
146
|
-
principalRecipient: {
|
|
147
|
-
type: 'string',
|
|
148
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
149
|
-
},
|
|
150
|
-
},
|
|
151
|
-
validateRewardsSplitRecipients: true,
|
|
152
|
-
required: ['splitRecipients', 'principalRecipient', 'etherAmount'],
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
export const ovmBaseSplitPayload = {
|
|
156
|
-
rewardSplitRecipients: {
|
|
157
|
-
type: 'array',
|
|
158
|
-
items: {
|
|
159
|
-
type: 'object',
|
|
160
|
-
properties: {
|
|
161
|
-
address: {
|
|
162
|
-
type: 'string',
|
|
163
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
164
|
-
},
|
|
165
|
-
percentAllocation: { type: 'number' },
|
|
166
|
-
},
|
|
167
|
-
required: ['address', 'percentAllocation'],
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
OVMOwnerAddress: {
|
|
171
|
-
type: 'string',
|
|
172
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
173
|
-
},
|
|
174
|
-
splitOwnerAddress: {
|
|
175
|
-
type: 'string',
|
|
176
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
177
|
-
default: ZeroAddress,
|
|
178
|
-
},
|
|
179
|
-
principalThreshold: {
|
|
180
|
-
type: 'number',
|
|
181
|
-
minimum: 16,
|
|
182
|
-
default: PRINCIPAL_THRESHOLD,
|
|
183
|
-
},
|
|
184
|
-
distributorFeePercent: {
|
|
185
|
-
type: 'number',
|
|
186
|
-
minimum: 0,
|
|
187
|
-
maximum: 10,
|
|
188
|
-
default: 0,
|
|
189
|
-
},
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
export const ovmRewardsSplitPayloadSchema = {
|
|
193
|
-
type: 'object',
|
|
194
|
-
properties: {
|
|
195
|
-
...ovmBaseSplitPayload,
|
|
196
|
-
principalRecipient: {
|
|
197
|
-
type: 'string',
|
|
198
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
validateOVMRewardsSplitRecipients: true,
|
|
202
|
-
required: ['rewardSplitRecipients', 'OVMOwnerAddress', 'principalRecipient'],
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export const ovmTotalSplitPayloadSchema = {
|
|
206
|
-
type: 'object',
|
|
207
|
-
properties: {
|
|
208
|
-
...ovmBaseSplitPayload,
|
|
209
|
-
principalSplitRecipients: {
|
|
210
|
-
type: 'array',
|
|
211
|
-
items: {
|
|
212
|
-
type: 'object',
|
|
213
|
-
properties: {
|
|
214
|
-
address: {
|
|
215
|
-
type: 'string',
|
|
216
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
217
|
-
},
|
|
218
|
-
percentAllocation: { type: 'number' },
|
|
219
|
-
},
|
|
220
|
-
required: ['address', 'percentAllocation'],
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
},
|
|
224
|
-
validateOVMRewardsSplitRecipients: true,
|
|
225
|
-
validateOVMTotalSplitRecipients: true,
|
|
226
|
-
required: [
|
|
227
|
-
'rewardSplitRecipients',
|
|
228
|
-
'principalSplitRecipients',
|
|
229
|
-
'OVMOwnerAddress',
|
|
230
|
-
],
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
export const ovmRequestWithdrawalPayloadSchema = {
|
|
234
|
-
type: 'object',
|
|
235
|
-
properties: {
|
|
236
|
-
withdrawalFees: {
|
|
237
|
-
type: 'string',
|
|
238
|
-
pattern: '^[0-9]+$',
|
|
239
|
-
},
|
|
240
|
-
ovmAddress: {
|
|
241
|
-
type: 'string',
|
|
242
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
243
|
-
},
|
|
244
|
-
pubKeys: {
|
|
245
|
-
type: 'array',
|
|
246
|
-
minItems: 1,
|
|
247
|
-
items: {
|
|
248
|
-
type: 'string',
|
|
249
|
-
pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
amounts: {
|
|
253
|
-
type: 'array',
|
|
254
|
-
minItems: 1,
|
|
255
|
-
items: {
|
|
256
|
-
type: 'string',
|
|
257
|
-
pattern: '^[0-9]+$',
|
|
258
|
-
},
|
|
259
|
-
},
|
|
260
|
-
},
|
|
261
|
-
validateOVMRequestWithdrawalPayload: true,
|
|
262
|
-
required: ['ovmAddress', 'pubKeys', 'amounts', 'withdrawalFees'],
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
export const eoaWithdrawalPayloadSchema = {
|
|
266
|
-
type: 'object',
|
|
267
|
-
properties: {
|
|
268
|
-
pubkey: {
|
|
269
|
-
type: 'string',
|
|
270
|
-
pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
|
|
271
|
-
},
|
|
272
|
-
allocation: {
|
|
273
|
-
type: 'number',
|
|
274
|
-
minimum: 0,
|
|
275
|
-
},
|
|
276
|
-
requiredFee: {
|
|
277
|
-
type: 'string',
|
|
278
|
-
pattern: '^[0-9]+$',
|
|
279
|
-
},
|
|
280
|
-
},
|
|
281
|
-
required: ['pubkey', 'allocation', 'requiredFee'],
|
|
282
|
-
};
|
|
283
|
-
|
|
284
|
-
export const ovmDepositPayloadSchema = {
|
|
285
|
-
type: 'object',
|
|
286
|
-
properties: {
|
|
287
|
-
ovmAddress: {
|
|
288
|
-
type: 'string',
|
|
289
|
-
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
290
|
-
},
|
|
291
|
-
deposits: {
|
|
292
|
-
type: 'array',
|
|
293
|
-
minItems: 1,
|
|
294
|
-
items: {
|
|
295
|
-
type: 'object',
|
|
296
|
-
properties: {
|
|
297
|
-
pubkey: {
|
|
298
|
-
type: 'string',
|
|
299
|
-
pattern: '^0x[a-fA-F0-9]{96}$',
|
|
300
|
-
},
|
|
301
|
-
withdrawal_credentials: {
|
|
302
|
-
type: 'string',
|
|
303
|
-
pattern: '^0x[a-fA-F0-9]{64}$',
|
|
304
|
-
description: '32 bytes withdrawal credentials',
|
|
305
|
-
},
|
|
306
|
-
signature: {
|
|
307
|
-
type: 'string',
|
|
308
|
-
pattern: '^0x[a-fA-F0-9]{192}$',
|
|
309
|
-
description: '96 bytes signature (190 hex chars + 0x prefix)',
|
|
310
|
-
},
|
|
311
|
-
deposit_data_root: {
|
|
312
|
-
type: 'string',
|
|
313
|
-
pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
|
|
314
|
-
},
|
|
315
|
-
amount: {
|
|
316
|
-
type: 'string',
|
|
317
|
-
pattern: '^[0-9]+$',
|
|
318
|
-
},
|
|
319
|
-
},
|
|
320
|
-
required: [
|
|
321
|
-
'pubkey',
|
|
322
|
-
'withdrawal_credentials',
|
|
323
|
-
'signature',
|
|
324
|
-
'deposit_data_root',
|
|
325
|
-
'amount',
|
|
326
|
-
],
|
|
327
|
-
},
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
required: ['ovmAddress', 'deposits'],
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
export const eoaDepositPayloadSchema = {
|
|
334
|
-
type: 'object',
|
|
335
|
-
properties: {
|
|
336
|
-
deposits: {
|
|
337
|
-
type: 'array',
|
|
338
|
-
minItems: 1,
|
|
339
|
-
items: {
|
|
340
|
-
type: 'object',
|
|
341
|
-
properties: {
|
|
342
|
-
pubkey: {
|
|
343
|
-
type: 'string',
|
|
344
|
-
pattern: '^0x[a-fA-F0-9]{96}$',
|
|
345
|
-
},
|
|
346
|
-
withdrawal_credentials: {
|
|
347
|
-
type: 'string',
|
|
348
|
-
pattern: '^0x[a-fA-F0-9]{64}$',
|
|
349
|
-
description: '32 bytes withdrawal credentials',
|
|
350
|
-
},
|
|
351
|
-
signature: {
|
|
352
|
-
type: 'string',
|
|
353
|
-
pattern: '^0x[a-fA-F0-9]{192}$',
|
|
354
|
-
description: '96 bytes signature (190 hex chars + 0x prefix)',
|
|
355
|
-
},
|
|
356
|
-
deposit_data_root: {
|
|
357
|
-
type: 'string',
|
|
358
|
-
pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
|
|
359
|
-
},
|
|
360
|
-
amount: {
|
|
361
|
-
type: 'string',
|
|
362
|
-
pattern: '^[0-9]+$',
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
required: [
|
|
366
|
-
'pubkey',
|
|
367
|
-
'withdrawal_credentials',
|
|
368
|
-
'signature',
|
|
369
|
-
'deposit_data_root',
|
|
370
|
-
'amount',
|
|
371
|
-
],
|
|
372
|
-
},
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
required: ['deposits'],
|
|
376
|
-
};
|
package/src/services.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { type SafeRpcUrl, type ClusterLock } from './types.js';
|
|
2
|
-
import { isValidClusterLock } from './verification/common.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Verifies Cluster Lock's validity.
|
|
6
|
-
* @param lock - cluster lock
|
|
7
|
-
* @param safeRpcUrl - optional safeRpcUrl for safe wallet verification
|
|
8
|
-
* @returns {Promise<{ result: boolean }> } boolean result to indicate if lock is valid
|
|
9
|
-
* @throws on missing keys or values.
|
|
10
|
-
*
|
|
11
|
-
* An example of how to use validateClusterLock:
|
|
12
|
-
* [validateClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L127)
|
|
13
|
-
*/
|
|
14
|
-
export const validateClusterLock = async (
|
|
15
|
-
lock: ClusterLock,
|
|
16
|
-
safeRpcUrl?: SafeRpcUrl,
|
|
17
|
-
): Promise<boolean> => {
|
|
18
|
-
try {
|
|
19
|
-
const isLockValid = await isValidClusterLock(lock, safeRpcUrl);
|
|
20
|
-
return isLockValid;
|
|
21
|
-
} catch (err: any) {
|
|
22
|
-
throw err;
|
|
23
|
-
}
|
|
24
|
-
};
|