@obolnetwork/obol-sdk 2.10.0 → 2.10.2
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 +1 -1
- package/dist/cjs/package.json +1 -1
- package/dist/cjs/src/constants.js +1 -0
- 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/constants.js +1 -0
- 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/constants.ts +1 -0
- package/src/eoa/eoaHelpers.ts +4 -5
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@ If you're integrating this SDK with a **backend** (e.g., in Node.js), and you st
|
|
|
19
19
|
|
|
20
20
|
## ⚡️ Integration with Safe Wallet
|
|
21
21
|
|
|
22
|
-
When integrating the Obol SDK with a **Safe Wallet**, you can either pass an RPC URL OR provide the `RPC_MAINNET` or `RPC_HOLESKY` or `RPC_GNOSIS` or `RPC_SEPOLIA` environment variable, pointing to the correct network's RPC URL. This is required to interact with Safe kit.
|
|
22
|
+
When integrating the Obol SDK with a **Safe Wallet**, you can either pass an RPC URL OR provide the `RPC_MAINNET` or `RPC_HOLESKY` or `RPC_GNOSIS` or `RPC_SEPOLIA` or `RPC_HOODI` environment variable, pointing to the correct network's RPC URL. This is required to interact with Safe kit.
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
## Contributing
|
package/dist/cjs/package.json
CHANGED
|
@@ -242,6 +242,7 @@ exports.PROVIDER_MAP = {
|
|
|
242
242
|
17000: `${process.env.RPC_HOLESKY}`, // Holesky
|
|
243
243
|
11155111: `${process.env.RPC_SEPOLIA}`, // Sepolia
|
|
244
244
|
100: `${process.env.RPC_GNOSIS}`, // Gnosis
|
|
245
|
+
560048: `${process.env.RPC_HOODI}`, // Hoodi
|
|
245
246
|
};
|
|
246
247
|
/**
|
|
247
248
|
* Maps base fork versions to their corresponding Capella fork versions.
|
|
@@ -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
|
@@ -208,6 +208,7 @@ export const PROVIDER_MAP = {
|
|
|
208
208
|
17000: `${process.env.RPC_HOLESKY}`, // Holesky
|
|
209
209
|
11155111: `${process.env.RPC_SEPOLIA}`, // Sepolia
|
|
210
210
|
100: `${process.env.RPC_GNOSIS}`, // Gnosis
|
|
211
|
+
560048: `${process.env.RPC_HOODI}`, // Hoodi
|
|
211
212
|
};
|
|
212
213
|
/**
|
|
213
214
|
* Maps base fork versions to their corresponding Capella fork versions.
|
|
@@ -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/constants.ts
CHANGED
|
@@ -276,6 +276,7 @@ export const PROVIDER_MAP: Record<number, string> = {
|
|
|
276
276
|
17000: `${process.env.RPC_HOLESKY}`, // Holesky
|
|
277
277
|
11155111: `${process.env.RPC_SEPOLIA}`, // Sepolia
|
|
278
278
|
100: `${process.env.RPC_GNOSIS}`, // Gnosis
|
|
279
|
+
560048: `${process.env.RPC_HOODI}`, // Hoodi
|
|
279
280
|
};
|
|
280
281
|
|
|
281
282
|
/**
|
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
|
}
|