@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.
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/eoa/eoaHelpers.js +4 -4
- package/dist/cjs/test/eoa/eoa.spec.js +11 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/eoa/eoaHelpers.js +4 -4
- package/dist/esm/test/eoa/eoa.spec.js +11 -0
- package/package.json +1 -1
- package/src/eoa/eoaHelpers.ts +4 -5
package/dist/cjs/package.json
CHANGED
|
@@ -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
|
|
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
|
|
32
|
-
if (!
|
|
31
|
+
const receipt = yield tx.wait();
|
|
32
|
+
if (!receipt)
|
|
33
33
|
return { txHash: null };
|
|
34
|
-
return { txHash:
|
|
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
|
});
|
package/dist/esm/package.json
CHANGED
|
@@ -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
|
|
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
|
|
29
|
-
if (!
|
|
28
|
+
const receipt = yield tx.wait();
|
|
29
|
+
if (!receipt)
|
|
30
30
|
return { txHash: null };
|
|
31
|
-
return { txHash:
|
|
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
package/src/eoa/eoaHelpers.ts
CHANGED
|
@@ -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
|
|
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
|
|
40
|
-
if (!
|
|
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
|
}
|