@obolnetwork/obol-sdk 2.10.0 → 2.10.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -22,16 +22,16 @@ function submitEOAWithdrawalRequest({ pubkey, allocation, withdrawalAddress, wit
22
22
  throw new Error('No allocation provided');
23
23
  const amountInGwei = BigInt(Math.floor(Number(allocation) * constants_1.ETHER_TO_GWEI));
24
24
  const data = `0x${pubkey.slice(2)}${amountInGwei.toString(16).padStart(16, '0')}`;
25
- const { hash } = yield signer.sendTransaction({
25
+ const tx = yield signer.sendTransaction({
26
26
  to: withdrawalContractAddress,
27
27
  chainId,
28
28
  value: BigInt(requiredFee),
29
29
  data: data,
30
30
  });
31
- const txResult = yield provider.getTransactionReceipt(hash);
32
- if (!txResult)
31
+ const receipt = yield tx.wait();
32
+ if (!receipt)
33
33
  return { txHash: null };
34
- return { txHash: txResult === null || txResult === void 0 ? void 0 : txResult.hash };
34
+ return { txHash: receipt.hash };
35
35
  });
36
36
  }
37
37
  exports.submitEOAWithdrawalRequest = submitEOAWithdrawalRequest;
@@ -83,5 +83,16 @@ describe('EOA', () => {
83
83
  };
84
84
  yield expect(eoaUnsupportedChain.requestWithdrawal(mockPayload)).rejects.toThrow('EOA withdrawal contract is not configured for chain 999');
85
85
  }));
86
+ it('should return null txHash when transaction receipt is null', () => __awaiter(void 0, void 0, void 0, function* () {
87
+ const mockPayload = {
88
+ pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
89
+ allocation: 32,
90
+ requiredFee: '1',
91
+ };
92
+ const mockResult = { txHash: null };
93
+ eoaHelpers_1.submitEOAWithdrawalRequest.mockResolvedValue(mockResult);
94
+ const result = yield eoa.requestWithdrawal(mockPayload);
95
+ expect(result).toEqual(mockResult);
96
+ }));
86
97
  });
87
98
  });
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -19,15 +19,15 @@ export function submitEOAWithdrawalRequest({ pubkey, allocation, withdrawalAddre
19
19
  throw new Error('No allocation provided');
20
20
  const amountInGwei = BigInt(Math.floor(Number(allocation) * ETHER_TO_GWEI));
21
21
  const data = `0x${pubkey.slice(2)}${amountInGwei.toString(16).padStart(16, '0')}`;
22
- const { hash } = yield signer.sendTransaction({
22
+ const tx = yield signer.sendTransaction({
23
23
  to: withdrawalContractAddress,
24
24
  chainId,
25
25
  value: BigInt(requiredFee),
26
26
  data: data,
27
27
  });
28
- const txResult = yield provider.getTransactionReceipt(hash);
29
- if (!txResult)
28
+ const receipt = yield tx.wait();
29
+ if (!receipt)
30
30
  return { txHash: null };
31
- return { txHash: txResult === null || txResult === void 0 ? void 0 : txResult.hash };
31
+ return { txHash: receipt.hash };
32
32
  });
33
33
  }
@@ -81,5 +81,16 @@ describe('EOA', () => {
81
81
  };
82
82
  yield expect(eoaUnsupportedChain.requestWithdrawal(mockPayload)).rejects.toThrow('EOA withdrawal contract is not configured for chain 999');
83
83
  }));
84
+ it('should return null txHash when transaction receipt is null', () => __awaiter(void 0, void 0, void 0, function* () {
85
+ const mockPayload = {
86
+ pubkey: '0x123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456',
87
+ allocation: 32,
88
+ requiredFee: '1',
89
+ };
90
+ const mockResult = { txHash: null };
91
+ submitEOAWithdrawalRequest.mockResolvedValue(mockResult);
92
+ const result = yield eoa.requestWithdrawal(mockPayload);
93
+ expect(result).toEqual(mockResult);
94
+ }));
84
95
  });
85
96
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@obolnetwork/obol-sdk",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "description": "A package for creating Distributed Validators using the Obol API.",
5
5
  "bugs": {
6
6
  "url": "https://github.com/obolnetwork/obol-sdk/issues"
@@ -29,15 +29,14 @@ export async function submitEOAWithdrawalRequest({
29
29
  const amountInGwei = BigInt(Math.floor(Number(allocation) * ETHER_TO_GWEI));
30
30
  const data = `0x${pubkey.slice(2)}${amountInGwei.toString(16).padStart(16, '0')}`;
31
31
 
32
- const { hash } = await signer.sendTransaction({
32
+ const tx = await signer.sendTransaction({
33
33
  to: withdrawalContractAddress,
34
34
  chainId,
35
35
  value: BigInt(requiredFee),
36
36
  data: data as `0x${string}`,
37
37
  });
38
38
 
39
- const txResult = await provider.getTransactionReceipt(hash);
40
- if (!txResult) return { txHash: null };
41
-
42
- return { txHash: txResult?.hash };
39
+ const receipt = await tx.wait();
40
+ if (!receipt) return { txHash: null };
41
+ return { txHash: receipt.hash };
43
42
  }