@obolnetwork/obol-sdk 2.11.7 → 2.11.9
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/browser/src/index.js +26 -43
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +26 -43
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/esm/src/index.js +26 -43
- package/dist/esm/src/index.js.map +1 -1
- package/dist/types/src/splits/splitHelpers.d.ts +2 -3
- package/dist/types/src/splits/splits.d.ts +7 -3
- package/package.json +1 -1
package/dist/esm/src/index.js
CHANGED
|
@@ -89,7 +89,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
89
89
|
// package.json
|
|
90
90
|
var package_default = {
|
|
91
91
|
name: "@obolnetwork/obol-sdk",
|
|
92
|
-
version: "2.11.
|
|
92
|
+
version: "2.11.9",
|
|
93
93
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
94
94
|
bugs: {
|
|
95
95
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -629,7 +629,7 @@ var isContractAvailable = (contractAddress, provider, bytecode) => __async(null,
|
|
|
629
629
|
if (bytecode) {
|
|
630
630
|
return !!code2 && code2 === bytecode;
|
|
631
631
|
}
|
|
632
|
-
return !!code2 && code2 !== "0x" && code2 !== "0x0";
|
|
632
|
+
return !!code2 && code2 !== "0x" && code2 !== "0x0" && !code2.startsWith("0xef0100");
|
|
633
633
|
});
|
|
634
634
|
var getProvider = (chainId, rpcUrl) => {
|
|
635
635
|
const resolvedRpcUrl = rpcUrl != null ? rpcUrl : PROVIDER_MAP[chainId];
|
|
@@ -11685,7 +11685,9 @@ var validateEOASignature = ({
|
|
|
11685
11685
|
try {
|
|
11686
11686
|
const sig = ethers2.Signature.from(token);
|
|
11687
11687
|
const digest2 = TypedDataUtils.eip712Hash(data, SignTypedDataVersion.V4);
|
|
11688
|
-
|
|
11688
|
+
const recovered = ethers2.getAddress(ethers2.recoverAddress(digest2, sig));
|
|
11689
|
+
const normalizedAddress = ethers2.getAddress(address);
|
|
11690
|
+
return recovered === normalizedAddress;
|
|
11689
11691
|
} catch (err) {
|
|
11690
11692
|
console.error(`validate EOA Signature error: ${err}`);
|
|
11691
11693
|
throw err;
|
|
@@ -15566,43 +15568,23 @@ var requestWithdrawalFromOVM = (_0) => __async(null, [_0], function* ({
|
|
|
15566
15568
|
throw new Error(`Failed to request withdrawal from OVM: ${errorMessage}`);
|
|
15567
15569
|
}
|
|
15568
15570
|
});
|
|
15569
|
-
var
|
|
15571
|
+
var depositOVM = (_0) => __async(null, [_0], function* ({
|
|
15570
15572
|
ovmAddress,
|
|
15571
15573
|
deposits,
|
|
15572
|
-
signer
|
|
15573
|
-
chainId
|
|
15574
|
+
signer
|
|
15574
15575
|
}) {
|
|
15575
15576
|
try {
|
|
15576
15577
|
const ovmContract = new Contract(ovmAddress, OVMContract.abi, signer);
|
|
15577
|
-
const chainConfig = getChainConfig(chainId);
|
|
15578
|
-
const multicall3Address = chainConfig.MULTICALL3_CONTRACT.address;
|
|
15579
|
-
const multiCall3ContractInstance = new Contract(
|
|
15580
|
-
multicall3Address,
|
|
15581
|
-
MultiCall3Contract.abi,
|
|
15582
|
-
signer
|
|
15583
|
-
);
|
|
15584
|
-
const BATCH_SIZE = 500;
|
|
15585
15578
|
const txHashes = [];
|
|
15586
|
-
for (
|
|
15587
|
-
const
|
|
15588
|
-
|
|
15589
|
-
|
|
15590
|
-
|
|
15591
|
-
|
|
15592
|
-
|
|
15593
|
-
deposit.
|
|
15594
|
-
|
|
15595
|
-
deposit.deposit_data_root
|
|
15596
|
-
]),
|
|
15597
|
-
value: BigInt(deposit.amount)
|
|
15598
|
-
}));
|
|
15599
|
-
const totalBatchValue = callsWithValue.reduce(
|
|
15600
|
-
(sum, c) => sum + c.value,
|
|
15601
|
-
BigInt(0)
|
|
15602
|
-
);
|
|
15603
|
-
const tx = yield multiCall3ContractInstance.aggregate3Value(
|
|
15604
|
-
callsWithValue,
|
|
15605
|
-
{ value: totalBatchValue }
|
|
15579
|
+
for (const deposit of deposits) {
|
|
15580
|
+
const tx = yield ovmContract.deposit(
|
|
15581
|
+
deposit.pubkey,
|
|
15582
|
+
deposit.withdrawal_credentials,
|
|
15583
|
+
deposit.signature,
|
|
15584
|
+
deposit.deposit_data_root,
|
|
15585
|
+
{
|
|
15586
|
+
value: BigInt(deposit.amount)
|
|
15587
|
+
}
|
|
15606
15588
|
);
|
|
15607
15589
|
const receipt = yield tx.wait();
|
|
15608
15590
|
if (receipt == null ? void 0 : receipt.hash) {
|
|
@@ -15612,9 +15594,7 @@ var depositWithMulticall3 = (_0) => __async(null, [_0], function* ({
|
|
|
15612
15594
|
return { txHashes };
|
|
15613
15595
|
} catch (error) {
|
|
15614
15596
|
const errorMessage = error instanceof Error ? error.message : "Deposit failed";
|
|
15615
|
-
throw new Error(
|
|
15616
|
-
`Failed to deposit to OVM with multicall3: ${errorMessage}`
|
|
15617
|
-
);
|
|
15597
|
+
throw new Error(`Failed to deposit to OVM: ${errorMessage}`);
|
|
15618
15598
|
}
|
|
15619
15599
|
});
|
|
15620
15600
|
|
|
@@ -16434,6 +16414,8 @@ var ObolSplits = class {
|
|
|
16434
16414
|
* **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
|
|
16435
16415
|
* and not pushed to version control.
|
|
16436
16416
|
*
|
|
16417
|
+
* **📌 Note:** The Obol Validator Manager (OVM) feature is only enabled on Hoodi on launchpad.
|
|
16418
|
+
*
|
|
16437
16419
|
* @param {OVMRewardsSplitPayload} payload - Data needed to deploy OVM and SplitV2
|
|
16438
16420
|
* @returns {Promise<ClusterValidator>} OVM address as withdrawal address and splitter as fee recipient
|
|
16439
16421
|
* @throws Will throw an error if the splitter configuration is not supported or deployment fails
|
|
@@ -16570,6 +16552,8 @@ var ObolSplits = class {
|
|
|
16570
16552
|
* **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
|
|
16571
16553
|
* and not pushed to version control.
|
|
16572
16554
|
*
|
|
16555
|
+
* **📌 Note:** The Obol Validator Manager (OVM) feature is only enabled on Hoodi on launchpad.
|
|
16556
|
+
*
|
|
16573
16557
|
* @param {OVMTotalSplitPayload} payload - Data needed to deploy OVM and SplitV2
|
|
16574
16558
|
* @returns {Promise<ClusterValidator>} OVM address as withdrawal address and splitter as fee recipient
|
|
16575
16559
|
* @throws Will throw an error if the splitter configuration is not supported or deployment fails
|
|
@@ -16760,9 +16744,9 @@ var ObolSplits = class {
|
|
|
16760
16744
|
});
|
|
16761
16745
|
}
|
|
16762
16746
|
/**
|
|
16763
|
-
* Deposits to OVM contract
|
|
16747
|
+
* Deposits to OVM contract by sending individual transactions for each deposit.
|
|
16764
16748
|
*
|
|
16765
|
-
* This method allows depositing to an OVM contract
|
|
16749
|
+
* This method allows depositing to an OVM contract. Each deposit is sent as a separate transaction
|
|
16766
16750
|
* Each deposit includes validator public key, withdrawal credentials, signature, deposit data root, and amount.
|
|
16767
16751
|
*
|
|
16768
16752
|
* @remarks
|
|
@@ -16770,7 +16754,7 @@ var ObolSplits = class {
|
|
|
16770
16754
|
* and not pushed to version control.
|
|
16771
16755
|
*
|
|
16772
16756
|
* @param {OVMDepositPayload} payload - Data needed to deposit to OVM
|
|
16773
|
-
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for
|
|
16757
|
+
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes, one for each deposit
|
|
16774
16758
|
* @throws Will throw an error if the signer is not provided, OVM address is invalid, or the deposit fails
|
|
16775
16759
|
*
|
|
16776
16760
|
* An example of how to use deposit:
|
|
@@ -16797,11 +16781,10 @@ var ObolSplits = class {
|
|
|
16797
16781
|
payload,
|
|
16798
16782
|
ovmDepositPayloadSchema
|
|
16799
16783
|
);
|
|
16800
|
-
return yield
|
|
16784
|
+
return yield depositOVM({
|
|
16801
16785
|
ovmAddress: validatedPayload.ovmAddress,
|
|
16802
16786
|
deposits: validatedPayload.deposits,
|
|
16803
|
-
signer: this.signer
|
|
16804
|
-
chainId: this.chainId
|
|
16787
|
+
signer: this.signer
|
|
16805
16788
|
});
|
|
16806
16789
|
});
|
|
16807
16790
|
}
|