@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.
Files changed (144) hide show
  1. package/README.md +33 -0
  2. package/dist/browser/src/index.js +18280 -0
  3. package/dist/browser/src/index.js.map +1 -0
  4. package/dist/cjs/src/index.js +17470 -382
  5. package/dist/cjs/src/index.js.map +1 -0
  6. package/dist/esm/src/index.js +17437 -361
  7. package/dist/esm/src/index.js.map +1 -0
  8. package/dist/types/src/constants.d.ts +1 -2
  9. package/dist/types/src/eoa/eoaHelpers.d.ts +1 -1
  10. package/dist/types/src/exits/verificationHelpers.d.ts +0 -2
  11. package/dist/types/src/incentives/incentiveHelpers.d.ts +1 -1
  12. package/dist/types/src/splits/splitHelpers.d.ts +3 -3
  13. package/dist/types/src/utils.d.ts +2 -2
  14. package/dist/types/src/verification/common.d.ts +0 -2
  15. package/dist/types/src/verification/signature-validator.d.ts +4 -4
  16. package/dist/types/src/verification/v1.10.0.d.ts +1 -1
  17. package/dist/types/src/verification/v1.6.0.d.ts +1 -1
  18. package/dist/types/src/verification/v1.7.0.d.ts +1 -1
  19. package/dist/types/src/verification/v1.8.0.d.ts +1 -1
  20. package/dist/types/test/client/methods.spec.d.ts +17 -0
  21. package/dist/types/tsconfig.types.tsbuildinfo +1 -0
  22. package/dist/types/tsup.config.d.ts +2 -0
  23. package/package.json +96 -58
  24. package/dist/cjs/package.json +0 -139
  25. package/dist/cjs/src/abi/BatchDeposit.js +0 -120
  26. package/dist/cjs/src/abi/MerkleDistributorWithDeadline.js +0 -73
  27. package/dist/cjs/src/abi/Multicall3.js +0 -253
  28. package/dist/cjs/src/abi/OVM.js +0 -627
  29. package/dist/cjs/src/abi/OWR.js +0 -304
  30. package/dist/cjs/src/abi/SplitMain.js +0 -929
  31. package/dist/cjs/src/abi/splitV2FactoryAbi.js +0 -420
  32. package/dist/cjs/src/ajv.js +0 -136
  33. package/dist/cjs/src/base.js +0 -42
  34. package/dist/cjs/src/bytecodes.js +0 -19
  35. package/dist/cjs/src/constants.js +0 -272
  36. package/dist/cjs/src/eoa/eoa.js +0 -132
  37. package/dist/cjs/src/eoa/eoaHelpers.js +0 -82
  38. package/dist/cjs/src/errors.js +0 -11
  39. package/dist/cjs/src/exits/ethUtils.js +0 -57
  40. package/dist/cjs/src/exits/exit.js +0 -502
  41. package/dist/cjs/src/exits/verificationHelpers.js +0 -86
  42. package/dist/cjs/src/incentives/incentiveHelpers.js +0 -39
  43. package/dist/cjs/src/incentives/incentives.js +0 -119
  44. package/dist/cjs/src/schema.js +0 -352
  45. package/dist/cjs/src/services.js +0 -33
  46. package/dist/cjs/src/splits/splitHelpers.js +0 -571
  47. package/dist/cjs/src/splits/splits.js +0 -366
  48. package/dist/cjs/src/types.js +0 -29
  49. package/dist/cjs/src/utils.js +0 -77
  50. package/dist/cjs/src/verification/common.js +0 -355
  51. package/dist/cjs/src/verification/signature-validator.js +0 -73
  52. package/dist/cjs/src/verification/sszTypes.js +0 -69
  53. package/dist/cjs/src/verification/termsAndConditions.js +0 -40
  54. package/dist/cjs/src/verification/v1.10.0.js +0 -146
  55. package/dist/cjs/src/verification/v1.6.0.js +0 -149
  56. package/dist/cjs/src/verification/v1.7.0.js +0 -173
  57. package/dist/cjs/src/verification/v1.8.0.js +0 -196
  58. package/dist/cjs/test/client/ajv.spec.js +0 -320
  59. package/dist/cjs/test/client/methods.spec.js +0 -418
  60. package/dist/cjs/test/eoa/eoa.spec.js +0 -176
  61. package/dist/cjs/test/exit/ethUtils.spec.js +0 -83
  62. package/dist/cjs/test/exit/exit.spec.js +0 -399
  63. package/dist/cjs/test/exit/verificationHelpers.spec.js +0 -68
  64. package/dist/cjs/test/fixtures.js +0 -896
  65. package/dist/cjs/test/incentives/incentives.spec.js +0 -202
  66. package/dist/cjs/test/splits/splits.spec.js +0 -402
  67. package/dist/esm/package.json +0 -139
  68. package/dist/esm/src/abi/BatchDeposit.js +0 -117
  69. package/dist/esm/src/abi/MerkleDistributorWithDeadline.js +0 -70
  70. package/dist/esm/src/abi/Multicall3.js +0 -250
  71. package/dist/esm/src/abi/OVM.js +0 -624
  72. package/dist/esm/src/abi/OWR.js +0 -301
  73. package/dist/esm/src/abi/SplitMain.js +0 -926
  74. package/dist/esm/src/abi/splitV2FactoryAbi.js +0 -417
  75. package/dist/esm/src/ajv.js +0 -129
  76. package/dist/esm/src/base.js +0 -38
  77. package/dist/esm/src/bytecodes.js +0 -16
  78. package/dist/esm/src/constants.js +0 -238
  79. package/dist/esm/src/eoa/eoa.js +0 -128
  80. package/dist/esm/src/eoa/eoaHelpers.js +0 -77
  81. package/dist/esm/src/errors.js +0 -7
  82. package/dist/esm/src/exits/ethUtils.js +0 -52
  83. package/dist/esm/src/exits/exit.js +0 -475
  84. package/dist/esm/src/exits/verificationHelpers.js +0 -81
  85. package/dist/esm/src/incentives/incentiveHelpers.js +0 -34
  86. package/dist/esm/src/incentives/incentives.js +0 -115
  87. package/dist/esm/src/schema.js +0 -349
  88. package/dist/esm/src/services.js +0 -29
  89. package/dist/esm/src/splits/splitHelpers.js +0 -554
  90. package/dist/esm/src/splits/splits.js +0 -362
  91. package/dist/esm/src/types.js +0 -26
  92. package/dist/esm/src/utils.js +0 -68
  93. package/dist/esm/src/verification/common.js +0 -319
  94. package/dist/esm/src/verification/signature-validator.js +0 -64
  95. package/dist/esm/src/verification/sszTypes.js +0 -64
  96. package/dist/esm/src/verification/termsAndConditions.js +0 -33
  97. package/dist/esm/src/verification/v1.10.0.js +0 -140
  98. package/dist/esm/src/verification/v1.6.0.js +0 -142
  99. package/dist/esm/src/verification/v1.7.0.js +0 -166
  100. package/dist/esm/src/verification/v1.8.0.js +0 -189
  101. package/dist/esm/test/client/ajv.spec.js +0 -318
  102. package/dist/esm/test/client/methods.spec.js +0 -393
  103. package/dist/esm/test/eoa/eoa.spec.js +0 -174
  104. package/dist/esm/test/exit/ethUtils.spec.js +0 -81
  105. package/dist/esm/test/exit/exit.spec.js +0 -374
  106. package/dist/esm/test/exit/verificationHelpers.spec.js +0 -66
  107. package/dist/esm/test/fixtures.js +0 -893
  108. package/dist/esm/test/incentives/incentives.spec.js +0 -177
  109. package/dist/esm/test/splits/splits.spec.js +0 -400
  110. package/dist/types/src/verification/termsAndConditions.d.ts +0 -1
  111. package/src/abi/BatchDeposit.ts +0 -117
  112. package/src/abi/MerkleDistributorWithDeadline.ts +0 -70
  113. package/src/abi/Multicall3.ts +0 -250
  114. package/src/abi/OVM.ts +0 -624
  115. package/src/abi/OWR.ts +0 -302
  116. package/src/abi/SplitMain.ts +0 -927
  117. package/src/abi/splitV2FactoryAbi.ts +0 -417
  118. package/src/ajv.ts +0 -191
  119. package/src/base.ts +0 -54
  120. package/src/bytecodes.ts +0 -32
  121. package/src/constants.ts +0 -309
  122. package/src/eoa/eoa.ts +0 -153
  123. package/src/eoa/eoaHelpers.ts +0 -112
  124. package/src/errors.ts +0 -8
  125. package/src/exits/ethUtils.ts +0 -49
  126. package/src/exits/exit.ts +0 -661
  127. package/src/exits/verificationHelpers.ts +0 -110
  128. package/src/incentives/incentiveHelpers.ts +0 -55
  129. package/src/incentives/incentives.ts +0 -153
  130. package/src/index.ts +0 -614
  131. package/src/schema.ts +0 -376
  132. package/src/services.ts +0 -24
  133. package/src/splits/splitHelpers.ts +0 -1032
  134. package/src/splits/splits.ts +0 -504
  135. package/src/types.ts +0 -687
  136. package/src/utils.ts +0 -88
  137. package/src/verification/common.ts +0 -532
  138. package/src/verification/signature-validator.ts +0 -103
  139. package/src/verification/sszTypes.ts +0 -88
  140. package/src/verification/termsAndConditions.ts +0 -32
  141. package/src/verification/v1.10.0.ts +0 -245
  142. package/src/verification/v1.6.0.ts +0 -256
  143. package/src/verification/v1.7.0.ts +0 -309
  144. package/src/verification/v1.8.0.ts +0 -340
@@ -1,119 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Incentives = void 0;
13
- const utils_1 = require("../utils");
14
- const types_1 = require("../types");
15
- const incentiveHelpers_1 = require("./incentiveHelpers");
16
- const constants_1 = require("../constants");
17
- /**
18
- * Incentives can be used for fetching and claiming Obol incentives.
19
- * @class
20
- * @internal Access it through Client.incentives.
21
- * @example
22
- * const obolClient = new Client(config);
23
- * await obolClient.incentives.claimIncentives(address);
24
- */
25
- class Incentives {
26
- constructor(signer, chainId, request, provider) {
27
- this.signer = signer;
28
- this.chainId = chainId;
29
- this.request = request;
30
- this.provider = provider;
31
- }
32
- /**
33
- * Claims Obol incentives from a Merkle Distributor contract using an address.
34
- *
35
- * This method automatically fetches incentive data and verifies whether the incentives have already been claimed.
36
- * If `txHash` is `null`, it indicates that the incentives were already claimed.
37
- *
38
- * Note: This method is not yet enabled and will throw an error if called.
39
- *
40
- * @remarks
41
- * **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
42
- * and not pushed to version control.
43
- *
44
- * @param {string} address - The address to claim incentives for
45
- * @returns {Promise<ClaimIncentivesResponse>} The transaction hash or already claimed status
46
- * @throws Will throw an error if the incentives data is not found or the claim fails
47
- *
48
- * An example of how to use claimIncentives:
49
- * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L281)
50
- */
51
- claimIncentives(address) {
52
- return __awaiter(this, void 0, void 0, function* () {
53
- if (!this.signer) {
54
- throw new Error('Signer is required in claimIncentives');
55
- }
56
- try {
57
- const incentivesData = yield this.getIncentivesByAddress(address);
58
- if (!(incentivesData === null || incentivesData === void 0 ? void 0 : incentivesData.contract_address)) {
59
- throw new Error(`No incentives found for address ${address}`);
60
- }
61
- const isContractDeployed = yield (0, utils_1.isContractAvailable)(incentivesData.contract_address, this.provider);
62
- if (!isContractDeployed) {
63
- throw new Error(`Merkle Distributor contract is not available at address ${incentivesData.contract_address}`);
64
- }
65
- const claimed = yield this.isClaimed(incentivesData.contract_address, incentivesData.index);
66
- if (claimed) {
67
- return { txHash: null };
68
- }
69
- const { txHash } = yield (0, incentiveHelpers_1.claimIncentivesFromMerkleDistributor)({
70
- signer: this.signer,
71
- contractAddress: incentivesData.contract_address,
72
- index: incentivesData.index,
73
- operatorAddress: incentivesData.operator_address,
74
- amount: incentivesData.amount,
75
- merkleProof: incentivesData.merkle_proof,
76
- });
77
- return { txHash };
78
- }
79
- catch (error) {
80
- console.log('Error claiming incentives:', error);
81
- throw new Error(`Failed to claim incentives: ${error.message}`);
82
- }
83
- });
84
- }
85
- /**
86
- * Read isClaimed.
87
- *
88
- * @param {ETH_ADDRESS} contractAddress - Address of the Merkle Distributor Contract
89
- * @param {ETH_ADDRESS} index - operator index in merkle tree
90
- * @returns {Promise<boolean>} true if incentives are already claime
91
- *
92
- *
93
- * An example of how to use isClaimed:
94
- * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L266)
95
- */
96
- isClaimed(contractAddress, index) {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- return yield (0, incentiveHelpers_1.isClaimedFromMerkleDistributor)(contractAddress, index, this.provider);
99
- });
100
- }
101
- /**
102
- * @param address - Operator address
103
- * @returns {Promise<IncentivesType>} The matched incentives from DB
104
- * @throws On not found if address not found.
105
- *
106
- * An example of how to use getIncentivesByAddress:
107
- * [obolClient](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L250)
108
- */
109
- getIncentivesByAddress(address) {
110
- return __awaiter(this, void 0, void 0, function* () {
111
- const network = types_1.FORK_NAMES[this.chainId];
112
- const incentives = yield this.request(`/${constants_1.DEFAULT_BASE_VERSION}/address/incentives/${network}/${address}`, {
113
- method: 'GET',
114
- });
115
- return incentives;
116
- });
117
- }
118
- }
119
- exports.Incentives = Incentives;
@@ -1,352 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eoaDepositPayloadSchema = exports.ovmDepositPayloadSchema = exports.eoaWithdrawalPayloadSchema = exports.ovmRequestWithdrawalPayloadSchema = exports.ovmTotalSplitPayloadSchema = exports.ovmRewardsSplitPayloadSchema = exports.ovmBaseSplitPayload = exports.rewardsSplitterPayloadSchema = exports.totalSplitterPayloadSchema = exports.definitionSchema = exports.operatorPayloadSchema = void 0;
4
- const ethers_1 = require("ethers");
5
- const constants_1 = require("./constants");
6
- const ajv_1 = require("./ajv");
7
- exports.operatorPayloadSchema = {
8
- type: 'object',
9
- properties: {
10
- version: { type: 'string' },
11
- enr: { type: 'string' },
12
- },
13
- required: ['version', 'enr'],
14
- };
15
- exports.definitionSchema = {
16
- type: 'object',
17
- properties: {
18
- name: { type: 'string' },
19
- operators: {
20
- type: 'array',
21
- minItems: 4,
22
- items: {
23
- type: 'object',
24
- properties: {
25
- address: {
26
- type: 'string',
27
- },
28
- },
29
- required: ['address'],
30
- },
31
- validateUniqueAddresses: true,
32
- },
33
- validators: {
34
- type: 'array',
35
- minItems: 1,
36
- items: {
37
- type: 'object',
38
- properties: {
39
- fee_recipient_address: {
40
- type: 'string',
41
- pattern: '^0x[a-fA-F0-9]{40}$',
42
- },
43
- withdrawal_address: {
44
- type: 'string',
45
- pattern: '^0x[a-fA-F0-9]{40}$',
46
- },
47
- },
48
- required: ['fee_recipient_address', 'withdrawal_address'],
49
- },
50
- },
51
- deposit_amounts: {
52
- type: ['array', 'null'],
53
- items: {
54
- type: 'string',
55
- pattern: '^[0-9]+$',
56
- },
57
- if: {
58
- $data: '1/compounding',
59
- },
60
- then: {
61
- items: {
62
- enum: ajv_1.VALID_DEPOSIT_AMOUNTS,
63
- },
64
- },
65
- else: {
66
- items: {
67
- enum: ajv_1.VALID_NON_COMPOUNDING_AMOUNTS,
68
- },
69
- },
70
- default: null,
71
- },
72
- compounding: {
73
- type: 'boolean',
74
- default: false,
75
- },
76
- target_gas_limit: {
77
- type: 'number',
78
- minimum: 1,
79
- default: 36000000,
80
- },
81
- consensus_protocol: {
82
- type: 'string',
83
- enum: ['qbft', ''],
84
- default: '',
85
- },
86
- },
87
- required: ['name', 'operators', 'validators'],
88
- };
89
- exports.totalSplitterPayloadSchema = {
90
- type: 'object',
91
- properties: {
92
- splitRecipients: {
93
- type: 'array',
94
- items: {
95
- type: 'object',
96
- properties: {
97
- account: {
98
- type: 'string',
99
- pattern: '^0x[a-fA-F0-9]{40}$',
100
- },
101
- percentAllocation: { type: 'number' },
102
- },
103
- required: ['account', 'percentAllocation'],
104
- },
105
- },
106
- ObolRAFSplit: {
107
- type: 'number',
108
- minimum: constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
109
- default: constants_1.DEFAULT_RETROACTIVE_FUNDING_TOTAL_SPLIT,
110
- },
111
- distributorFee: {
112
- type: 'number',
113
- maximum: 10,
114
- multipleOf: 0.01,
115
- default: 0,
116
- },
117
- controllerAddress: {
118
- type: 'string',
119
- pattern: '^0x[a-fA-F0-9]{40}$',
120
- default: ethers_1.ZeroAddress,
121
- },
122
- },
123
- validateTotalSplitRecipients: true,
124
- required: ['splitRecipients'],
125
- };
126
- exports.rewardsSplitterPayloadSchema = {
127
- type: 'object',
128
- properties: Object.assign(Object.assign({}, exports.totalSplitterPayloadSchema.properties), { ObolRAFSplit: {
129
- type: 'number',
130
- minimum: constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
131
- default: constants_1.DEFAULT_RETROACTIVE_FUNDING_REWARDS_ONLY_SPLIT,
132
- }, recoveryAddress: {
133
- type: 'string',
134
- pattern: '^0x[a-fA-F0-9]{40}$',
135
- default: ethers_1.ZeroAddress,
136
- }, etherAmount: { type: 'number' }, principalRecipient: {
137
- type: 'string',
138
- pattern: '^0x[a-fA-F0-9]{40}$',
139
- } }),
140
- validateRewardsSplitRecipients: true,
141
- required: ['splitRecipients', 'principalRecipient', 'etherAmount'],
142
- };
143
- exports.ovmBaseSplitPayload = {
144
- rewardSplitRecipients: {
145
- type: 'array',
146
- items: {
147
- type: 'object',
148
- properties: {
149
- address: {
150
- type: 'string',
151
- pattern: '^0x[a-fA-F0-9]{40}$',
152
- },
153
- percentAllocation: { type: 'number' },
154
- },
155
- required: ['address', 'percentAllocation'],
156
- },
157
- },
158
- OVMOwnerAddress: {
159
- type: 'string',
160
- pattern: '^0x[a-fA-F0-9]{40}$',
161
- },
162
- splitOwnerAddress: {
163
- type: 'string',
164
- pattern: '^0x[a-fA-F0-9]{40}$',
165
- default: ethers_1.ZeroAddress,
166
- },
167
- principalThreshold: {
168
- type: 'number',
169
- minimum: 16,
170
- default: constants_1.PRINCIPAL_THRESHOLD,
171
- },
172
- distributorFeePercent: {
173
- type: 'number',
174
- minimum: 0,
175
- maximum: 10,
176
- default: 0,
177
- },
178
- };
179
- exports.ovmRewardsSplitPayloadSchema = {
180
- type: 'object',
181
- properties: Object.assign(Object.assign({}, exports.ovmBaseSplitPayload), { principalRecipient: {
182
- type: 'string',
183
- pattern: '^0x[a-fA-F0-9]{40}$',
184
- } }),
185
- validateOVMRewardsSplitRecipients: true,
186
- required: ['rewardSplitRecipients', 'OVMOwnerAddress', 'principalRecipient'],
187
- };
188
- exports.ovmTotalSplitPayloadSchema = {
189
- type: 'object',
190
- properties: Object.assign(Object.assign({}, exports.ovmBaseSplitPayload), { principalSplitRecipients: {
191
- type: 'array',
192
- items: {
193
- type: 'object',
194
- properties: {
195
- address: {
196
- type: 'string',
197
- pattern: '^0x[a-fA-F0-9]{40}$',
198
- },
199
- percentAllocation: { type: 'number' },
200
- },
201
- required: ['address', 'percentAllocation'],
202
- },
203
- } }),
204
- validateOVMRewardsSplitRecipients: true,
205
- validateOVMTotalSplitRecipients: true,
206
- required: [
207
- 'rewardSplitRecipients',
208
- 'principalSplitRecipients',
209
- 'OVMOwnerAddress',
210
- ],
211
- };
212
- exports.ovmRequestWithdrawalPayloadSchema = {
213
- type: 'object',
214
- properties: {
215
- withdrawalFees: {
216
- type: 'string',
217
- pattern: '^[0-9]+$',
218
- },
219
- ovmAddress: {
220
- type: 'string',
221
- pattern: '^0x[a-fA-F0-9]{40}$',
222
- },
223
- pubKeys: {
224
- type: 'array',
225
- minItems: 1,
226
- items: {
227
- type: 'string',
228
- pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
229
- },
230
- },
231
- amounts: {
232
- type: 'array',
233
- minItems: 1,
234
- items: {
235
- type: 'string',
236
- pattern: '^[0-9]+$',
237
- },
238
- },
239
- },
240
- validateOVMRequestWithdrawalPayload: true,
241
- required: ['ovmAddress', 'pubKeys', 'amounts', 'withdrawalFees'],
242
- };
243
- exports.eoaWithdrawalPayloadSchema = {
244
- type: 'object',
245
- properties: {
246
- pubkey: {
247
- type: 'string',
248
- pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
249
- },
250
- allocation: {
251
- type: 'number',
252
- minimum: 0,
253
- },
254
- requiredFee: {
255
- type: 'string',
256
- pattern: '^[0-9]+$',
257
- },
258
- },
259
- required: ['pubkey', 'allocation', 'requiredFee'],
260
- };
261
- exports.ovmDepositPayloadSchema = {
262
- type: 'object',
263
- properties: {
264
- ovmAddress: {
265
- type: 'string',
266
- pattern: '^0x[a-fA-F0-9]{40}$',
267
- },
268
- deposits: {
269
- type: 'array',
270
- minItems: 1,
271
- items: {
272
- type: 'object',
273
- properties: {
274
- pubkey: {
275
- type: 'string',
276
- pattern: '^0x[a-fA-F0-9]{96}$',
277
- },
278
- withdrawal_credentials: {
279
- type: 'string',
280
- pattern: '^0x[a-fA-F0-9]{64}$',
281
- description: '32 bytes withdrawal credentials',
282
- },
283
- signature: {
284
- type: 'string',
285
- pattern: '^0x[a-fA-F0-9]{192}$',
286
- description: '96 bytes signature (190 hex chars + 0x prefix)',
287
- },
288
- deposit_data_root: {
289
- type: 'string',
290
- pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
291
- },
292
- amount: {
293
- type: 'string',
294
- pattern: '^[0-9]+$',
295
- },
296
- },
297
- required: [
298
- 'pubkey',
299
- 'withdrawal_credentials',
300
- 'signature',
301
- 'deposit_data_root',
302
- 'amount',
303
- ],
304
- },
305
- },
306
- },
307
- required: ['ovmAddress', 'deposits'],
308
- };
309
- exports.eoaDepositPayloadSchema = {
310
- type: 'object',
311
- properties: {
312
- deposits: {
313
- type: 'array',
314
- minItems: 1,
315
- items: {
316
- type: 'object',
317
- properties: {
318
- pubkey: {
319
- type: 'string',
320
- pattern: '^0x[a-fA-F0-9]{96}$',
321
- },
322
- withdrawal_credentials: {
323
- type: 'string',
324
- pattern: '^0x[a-fA-F0-9]{64}$',
325
- description: '32 bytes withdrawal credentials',
326
- },
327
- signature: {
328
- type: 'string',
329
- pattern: '^0x[a-fA-F0-9]{192}$',
330
- description: '96 bytes signature (190 hex chars + 0x prefix)',
331
- },
332
- deposit_data_root: {
333
- type: 'string',
334
- pattern: '^0x[a-fA-F0-9]{64}$', // 32 bytes = 64 hex chars + 0x prefix
335
- },
336
- amount: {
337
- type: 'string',
338
- pattern: '^[0-9]+$',
339
- },
340
- },
341
- required: [
342
- 'pubkey',
343
- 'withdrawal_credentials',
344
- 'signature',
345
- 'deposit_data_root',
346
- 'amount',
347
- ],
348
- },
349
- },
350
- },
351
- required: ['deposits'],
352
- };
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.validateClusterLock = void 0;
13
- const common_js_1 = require("./verification/common.js");
14
- /**
15
- * Verifies Cluster Lock's validity.
16
- * @param lock - cluster lock
17
- * @param safeRpcUrl - optional safeRpcUrl for safe wallet verification
18
- * @returns {Promise<{ result: boolean }> } boolean result to indicate if lock is valid
19
- * @throws on missing keys or values.
20
- *
21
- * An example of how to use validateClusterLock:
22
- * [validateClusterLock](https://github.com/ObolNetwork/obol-sdk-examples/blob/main/TS-Example/index.ts#L127)
23
- */
24
- const validateClusterLock = (lock, safeRpcUrl) => __awaiter(void 0, void 0, void 0, function* () {
25
- try {
26
- const isLockValid = yield (0, common_js_1.isValidClusterLock)(lock, safeRpcUrl);
27
- return isLockValid;
28
- }
29
- catch (err) {
30
- throw err;
31
- }
32
- });
33
- exports.validateClusterLock = validateClusterLock;