@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/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.8",
|
|
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"
|
|
@@ -15599,43 +15599,23 @@ var requestWithdrawalFromOVM = (_0) => __async(null, [_0], function* ({
|
|
|
15599
15599
|
throw new Error(`Failed to request withdrawal from OVM: ${errorMessage}`);
|
|
15600
15600
|
}
|
|
15601
15601
|
});
|
|
15602
|
-
var
|
|
15602
|
+
var depositOVM = (_0) => __async(null, [_0], function* ({
|
|
15603
15603
|
ovmAddress,
|
|
15604
15604
|
deposits,
|
|
15605
|
-
signer
|
|
15606
|
-
chainId
|
|
15605
|
+
signer
|
|
15607
15606
|
}) {
|
|
15608
15607
|
try {
|
|
15609
15608
|
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
15609
|
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 }
|
|
15610
|
+
for (const deposit of deposits) {
|
|
15611
|
+
const tx = yield ovmContract.deposit(
|
|
15612
|
+
deposit.pubkey,
|
|
15613
|
+
deposit.withdrawal_credentials,
|
|
15614
|
+
deposit.signature,
|
|
15615
|
+
deposit.deposit_data_root,
|
|
15616
|
+
{
|
|
15617
|
+
value: BigInt(deposit.amount)
|
|
15618
|
+
}
|
|
15639
15619
|
);
|
|
15640
15620
|
const receipt = yield tx.wait();
|
|
15641
15621
|
if (receipt == null ? void 0 : receipt.hash) {
|
|
@@ -15645,9 +15625,7 @@ var depositWithMulticall3 = (_0) => __async(null, [_0], function* ({
|
|
|
15645
15625
|
return { txHashes };
|
|
15646
15626
|
} catch (error) {
|
|
15647
15627
|
const errorMessage = error instanceof Error ? error.message : "Deposit failed";
|
|
15648
|
-
throw new Error(
|
|
15649
|
-
`Failed to deposit to OVM with multicall3: ${errorMessage}`
|
|
15650
|
-
);
|
|
15628
|
+
throw new Error(`Failed to deposit to OVM: ${errorMessage}`);
|
|
15651
15629
|
}
|
|
15652
15630
|
});
|
|
15653
15631
|
|
|
@@ -16787,9 +16765,9 @@ var ObolSplits = class {
|
|
|
16787
16765
|
});
|
|
16788
16766
|
}
|
|
16789
16767
|
/**
|
|
16790
|
-
* Deposits to OVM contract
|
|
16768
|
+
* Deposits to OVM contract by sending individual transactions for each deposit.
|
|
16791
16769
|
*
|
|
16792
|
-
* This method allows depositing to an OVM contract
|
|
16770
|
+
* This method allows depositing to an OVM contract. Each deposit is sent as a separate transaction
|
|
16793
16771
|
* Each deposit includes validator public key, withdrawal credentials, signature, deposit data root, and amount.
|
|
16794
16772
|
*
|
|
16795
16773
|
* @remarks
|
|
@@ -16797,7 +16775,7 @@ var ObolSplits = class {
|
|
|
16797
16775
|
* and not pushed to version control.
|
|
16798
16776
|
*
|
|
16799
16777
|
* @param {OVMDepositPayload} payload - Data needed to deposit to OVM
|
|
16800
|
-
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for
|
|
16778
|
+
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes, one for each deposit
|
|
16801
16779
|
* @throws Will throw an error if the signer is not provided, OVM address is invalid, or the deposit fails
|
|
16802
16780
|
*
|
|
16803
16781
|
* An example of how to use deposit:
|
|
@@ -16824,11 +16802,10 @@ var ObolSplits = class {
|
|
|
16824
16802
|
payload,
|
|
16825
16803
|
ovmDepositPayloadSchema
|
|
16826
16804
|
);
|
|
16827
|
-
return yield
|
|
16805
|
+
return yield depositOVM({
|
|
16828
16806
|
ovmAddress: validatedPayload.ovmAddress,
|
|
16829
16807
|
deposits: validatedPayload.deposits,
|
|
16830
|
-
signer: this.signer
|
|
16831
|
-
chainId: this.chainId
|
|
16808
|
+
signer: this.signer
|
|
16832
16809
|
});
|
|
16833
16810
|
});
|
|
16834
16811
|
}
|