@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/cjs/src/index.js
CHANGED
|
@@ -171,7 +171,7 @@ var import_uuid = require("uuid");
|
|
|
171
171
|
// package.json
|
|
172
172
|
var package_default = {
|
|
173
173
|
name: "@obolnetwork/obol-sdk",
|
|
174
|
-
version: "2.11.
|
|
174
|
+
version: "2.11.9",
|
|
175
175
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
176
176
|
bugs: {
|
|
177
177
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -709,7 +709,7 @@ var isContractAvailable = (contractAddress, provider, bytecode) => __async(null,
|
|
|
709
709
|
if (bytecode) {
|
|
710
710
|
return !!code2 && code2 === bytecode;
|
|
711
711
|
}
|
|
712
|
-
return !!code2 && code2 !== "0x" && code2 !== "0x0";
|
|
712
|
+
return !!code2 && code2 !== "0x" && code2 !== "0x0" && !code2.startsWith("0xef0100");
|
|
713
713
|
});
|
|
714
714
|
var getProvider = (chainId, rpcUrl) => {
|
|
715
715
|
const resolvedRpcUrl = rpcUrl != null ? rpcUrl : PROVIDER_MAP[chainId];
|
|
@@ -11734,7 +11734,9 @@ var validateEOASignature = ({
|
|
|
11734
11734
|
try {
|
|
11735
11735
|
const sig = import_ethers2.ethers.Signature.from(token);
|
|
11736
11736
|
const digest2 = import_eth_sig_util.TypedDataUtils.eip712Hash(data, import_eth_sig_util.SignTypedDataVersion.V4);
|
|
11737
|
-
|
|
11737
|
+
const recovered = import_ethers2.ethers.getAddress(import_ethers2.ethers.recoverAddress(digest2, sig));
|
|
11738
|
+
const normalizedAddress = import_ethers2.ethers.getAddress(address);
|
|
11739
|
+
return recovered === normalizedAddress;
|
|
11738
11740
|
} catch (err) {
|
|
11739
11741
|
console.error(`validate EOA Signature error: ${err}`);
|
|
11740
11742
|
throw err;
|
|
@@ -15599,43 +15601,23 @@ var requestWithdrawalFromOVM = (_0) => __async(null, [_0], function* ({
|
|
|
15599
15601
|
throw new Error(`Failed to request withdrawal from OVM: ${errorMessage}`);
|
|
15600
15602
|
}
|
|
15601
15603
|
});
|
|
15602
|
-
var
|
|
15604
|
+
var depositOVM = (_0) => __async(null, [_0], function* ({
|
|
15603
15605
|
ovmAddress,
|
|
15604
15606
|
deposits,
|
|
15605
|
-
signer
|
|
15606
|
-
chainId
|
|
15607
|
+
signer
|
|
15607
15608
|
}) {
|
|
15608
15609
|
try {
|
|
15609
15610
|
const ovmContract = new import_ethers5.Contract(ovmAddress, OVMContract.abi, signer);
|
|
15610
|
-
const chainConfig = getChainConfig(chainId);
|
|
15611
|
-
const multicall3Address = chainConfig.MULTICALL3_CONTRACT.address;
|
|
15612
|
-
const multiCall3ContractInstance = new import_ethers5.Contract(
|
|
15613
|
-
multicall3Address,
|
|
15614
|
-
MultiCall3Contract.abi,
|
|
15615
|
-
signer
|
|
15616
|
-
);
|
|
15617
|
-
const BATCH_SIZE = 500;
|
|
15618
15611
|
const txHashes = [];
|
|
15619
|
-
for (
|
|
15620
|
-
const
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
deposit.
|
|
15627
|
-
|
|
15628
|
-
deposit.deposit_data_root
|
|
15629
|
-
]),
|
|
15630
|
-
value: BigInt(deposit.amount)
|
|
15631
|
-
}));
|
|
15632
|
-
const totalBatchValue = callsWithValue.reduce(
|
|
15633
|
-
(sum, c) => sum + c.value,
|
|
15634
|
-
BigInt(0)
|
|
15635
|
-
);
|
|
15636
|
-
const tx = yield multiCall3ContractInstance.aggregate3Value(
|
|
15637
|
-
callsWithValue,
|
|
15638
|
-
{ value: totalBatchValue }
|
|
15612
|
+
for (const deposit of deposits) {
|
|
15613
|
+
const tx = yield ovmContract.deposit(
|
|
15614
|
+
deposit.pubkey,
|
|
15615
|
+
deposit.withdrawal_credentials,
|
|
15616
|
+
deposit.signature,
|
|
15617
|
+
deposit.deposit_data_root,
|
|
15618
|
+
{
|
|
15619
|
+
value: BigInt(deposit.amount)
|
|
15620
|
+
}
|
|
15639
15621
|
);
|
|
15640
15622
|
const receipt = yield tx.wait();
|
|
15641
15623
|
if (receipt == null ? void 0 : receipt.hash) {
|
|
@@ -15645,9 +15627,7 @@ var depositWithMulticall3 = (_0) => __async(null, [_0], function* ({
|
|
|
15645
15627
|
return { txHashes };
|
|
15646
15628
|
} catch (error) {
|
|
15647
15629
|
const errorMessage = error instanceof Error ? error.message : "Deposit failed";
|
|
15648
|
-
throw new Error(
|
|
15649
|
-
`Failed to deposit to OVM with multicall3: ${errorMessage}`
|
|
15650
|
-
);
|
|
15630
|
+
throw new Error(`Failed to deposit to OVM: ${errorMessage}`);
|
|
15651
15631
|
}
|
|
15652
15632
|
});
|
|
15653
15633
|
|
|
@@ -16461,6 +16441,8 @@ var ObolSplits = class {
|
|
|
16461
16441
|
* **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
|
|
16462
16442
|
* and not pushed to version control.
|
|
16463
16443
|
*
|
|
16444
|
+
* **📌 Note:** The Obol Validator Manager (OVM) feature is only enabled on Hoodi on launchpad.
|
|
16445
|
+
*
|
|
16464
16446
|
* @param {OVMRewardsSplitPayload} payload - Data needed to deploy OVM and SplitV2
|
|
16465
16447
|
* @returns {Promise<ClusterValidator>} OVM address as withdrawal address and splitter as fee recipient
|
|
16466
16448
|
* @throws Will throw an error if the splitter configuration is not supported or deployment fails
|
|
@@ -16597,6 +16579,8 @@ var ObolSplits = class {
|
|
|
16597
16579
|
* **⚠️ Important:** If you're storing the private key in an `.env` file, ensure it is securely managed
|
|
16598
16580
|
* and not pushed to version control.
|
|
16599
16581
|
*
|
|
16582
|
+
* **📌 Note:** The Obol Validator Manager (OVM) feature is only enabled on Hoodi on launchpad.
|
|
16583
|
+
*
|
|
16600
16584
|
* @param {OVMTotalSplitPayload} payload - Data needed to deploy OVM and SplitV2
|
|
16601
16585
|
* @returns {Promise<ClusterValidator>} OVM address as withdrawal address and splitter as fee recipient
|
|
16602
16586
|
* @throws Will throw an error if the splitter configuration is not supported or deployment fails
|
|
@@ -16787,9 +16771,9 @@ var ObolSplits = class {
|
|
|
16787
16771
|
});
|
|
16788
16772
|
}
|
|
16789
16773
|
/**
|
|
16790
|
-
* Deposits to OVM contract
|
|
16774
|
+
* Deposits to OVM contract by sending individual transactions for each deposit.
|
|
16791
16775
|
*
|
|
16792
|
-
* This method allows depositing to an OVM contract
|
|
16776
|
+
* This method allows depositing to an OVM contract. Each deposit is sent as a separate transaction
|
|
16793
16777
|
* Each deposit includes validator public key, withdrawal credentials, signature, deposit data root, and amount.
|
|
16794
16778
|
*
|
|
16795
16779
|
* @remarks
|
|
@@ -16797,7 +16781,7 @@ var ObolSplits = class {
|
|
|
16797
16781
|
* and not pushed to version control.
|
|
16798
16782
|
*
|
|
16799
16783
|
* @param {OVMDepositPayload} payload - Data needed to deposit to OVM
|
|
16800
|
-
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for
|
|
16784
|
+
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes, one for each deposit
|
|
16801
16785
|
* @throws Will throw an error if the signer is not provided, OVM address is invalid, or the deposit fails
|
|
16802
16786
|
*
|
|
16803
16787
|
* An example of how to use deposit:
|
|
@@ -16824,11 +16808,10 @@ var ObolSplits = class {
|
|
|
16824
16808
|
payload,
|
|
16825
16809
|
ovmDepositPayloadSchema
|
|
16826
16810
|
);
|
|
16827
|
-
return yield
|
|
16811
|
+
return yield depositOVM({
|
|
16828
16812
|
ovmAddress: validatedPayload.ovmAddress,
|
|
16829
16813
|
deposits: validatedPayload.deposits,
|
|
16830
|
-
signer: this.signer
|
|
16831
|
-
chainId: this.chainId
|
|
16814
|
+
signer: this.signer
|
|
16832
16815
|
});
|
|
16833
16816
|
});
|
|
16834
16817
|
}
|