@obolnetwork/obol-sdk 2.11.7 → 2.11.8
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 +18 -41
- package/dist/browser/src/index.js.map +1 -1
- package/dist/cjs/src/index.js +18 -41
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/esm/src/index.js +18 -41
- 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 +3 -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.8",
|
|
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"
|
|
@@ -15566,43 +15566,23 @@ var requestWithdrawalFromOVM = (_0) => __async(null, [_0], function* ({
|
|
|
15566
15566
|
throw new Error(`Failed to request withdrawal from OVM: ${errorMessage}`);
|
|
15567
15567
|
}
|
|
15568
15568
|
});
|
|
15569
|
-
var
|
|
15569
|
+
var depositOVM = (_0) => __async(null, [_0], function* ({
|
|
15570
15570
|
ovmAddress,
|
|
15571
15571
|
deposits,
|
|
15572
|
-
signer
|
|
15573
|
-
chainId
|
|
15572
|
+
signer
|
|
15574
15573
|
}) {
|
|
15575
15574
|
try {
|
|
15576
15575
|
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
15576
|
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 }
|
|
15577
|
+
for (const deposit of deposits) {
|
|
15578
|
+
const tx = yield ovmContract.deposit(
|
|
15579
|
+
deposit.pubkey,
|
|
15580
|
+
deposit.withdrawal_credentials,
|
|
15581
|
+
deposit.signature,
|
|
15582
|
+
deposit.deposit_data_root,
|
|
15583
|
+
{
|
|
15584
|
+
value: BigInt(deposit.amount)
|
|
15585
|
+
}
|
|
15606
15586
|
);
|
|
15607
15587
|
const receipt = yield tx.wait();
|
|
15608
15588
|
if (receipt == null ? void 0 : receipt.hash) {
|
|
@@ -15612,9 +15592,7 @@ var depositWithMulticall3 = (_0) => __async(null, [_0], function* ({
|
|
|
15612
15592
|
return { txHashes };
|
|
15613
15593
|
} catch (error) {
|
|
15614
15594
|
const errorMessage = error instanceof Error ? error.message : "Deposit failed";
|
|
15615
|
-
throw new Error(
|
|
15616
|
-
`Failed to deposit to OVM with multicall3: ${errorMessage}`
|
|
15617
|
-
);
|
|
15595
|
+
throw new Error(`Failed to deposit to OVM: ${errorMessage}`);
|
|
15618
15596
|
}
|
|
15619
15597
|
});
|
|
15620
15598
|
|
|
@@ -16760,9 +16738,9 @@ var ObolSplits = class {
|
|
|
16760
16738
|
});
|
|
16761
16739
|
}
|
|
16762
16740
|
/**
|
|
16763
|
-
* Deposits to OVM contract
|
|
16741
|
+
* Deposits to OVM contract by sending individual transactions for each deposit.
|
|
16764
16742
|
*
|
|
16765
|
-
* This method allows depositing to an OVM contract
|
|
16743
|
+
* This method allows depositing to an OVM contract. Each deposit is sent as a separate transaction
|
|
16766
16744
|
* Each deposit includes validator public key, withdrawal credentials, signature, deposit data root, and amount.
|
|
16767
16745
|
*
|
|
16768
16746
|
* @remarks
|
|
@@ -16770,7 +16748,7 @@ var ObolSplits = class {
|
|
|
16770
16748
|
* and not pushed to version control.
|
|
16771
16749
|
*
|
|
16772
16750
|
* @param {OVMDepositPayload} payload - Data needed to deposit to OVM
|
|
16773
|
-
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for
|
|
16751
|
+
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes, one for each deposit
|
|
16774
16752
|
* @throws Will throw an error if the signer is not provided, OVM address is invalid, or the deposit fails
|
|
16775
16753
|
*
|
|
16776
16754
|
* An example of how to use deposit:
|
|
@@ -16797,11 +16775,10 @@ var ObolSplits = class {
|
|
|
16797
16775
|
payload,
|
|
16798
16776
|
ovmDepositPayloadSchema
|
|
16799
16777
|
);
|
|
16800
|
-
return yield
|
|
16778
|
+
return yield depositOVM({
|
|
16801
16779
|
ovmAddress: validatedPayload.ovmAddress,
|
|
16802
16780
|
deposits: validatedPayload.deposits,
|
|
16803
|
-
signer: this.signer
|
|
16804
|
-
chainId: this.chainId
|
|
16781
|
+
signer: this.signer
|
|
16805
16782
|
});
|
|
16806
16783
|
});
|
|
16807
16784
|
}
|