@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
|
@@ -92,7 +92,7 @@ import { v4 as uuidv4 } from "uuid";
|
|
|
92
92
|
// package.json
|
|
93
93
|
var package_default = {
|
|
94
94
|
name: "@obolnetwork/obol-sdk",
|
|
95
|
-
version: "2.11.
|
|
95
|
+
version: "2.11.8",
|
|
96
96
|
description: "A package for creating Distributed Validators using the Obol API.",
|
|
97
97
|
bugs: {
|
|
98
98
|
url: "https://github.com/obolnetwork/obol-sdk/issues"
|
|
@@ -16377,43 +16377,23 @@ var requestWithdrawalFromOVM = (_0) => __async(null, [_0], function* ({
|
|
|
16377
16377
|
throw new Error(`Failed to request withdrawal from OVM: ${errorMessage}`);
|
|
16378
16378
|
}
|
|
16379
16379
|
});
|
|
16380
|
-
var
|
|
16380
|
+
var depositOVM = (_0) => __async(null, [_0], function* ({
|
|
16381
16381
|
ovmAddress,
|
|
16382
16382
|
deposits,
|
|
16383
|
-
signer
|
|
16384
|
-
chainId
|
|
16383
|
+
signer
|
|
16385
16384
|
}) {
|
|
16386
16385
|
try {
|
|
16387
16386
|
const ovmContract = new Contract(ovmAddress, OVMContract.abi, signer);
|
|
16388
|
-
const chainConfig = getChainConfig(chainId);
|
|
16389
|
-
const multicall3Address = chainConfig.MULTICALL3_CONTRACT.address;
|
|
16390
|
-
const multiCall3ContractInstance = new Contract(
|
|
16391
|
-
multicall3Address,
|
|
16392
|
-
MultiCall3Contract.abi,
|
|
16393
|
-
signer
|
|
16394
|
-
);
|
|
16395
|
-
const BATCH_SIZE = 500;
|
|
16396
16387
|
const txHashes = [];
|
|
16397
|
-
for (
|
|
16398
|
-
const
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
deposit.
|
|
16405
|
-
|
|
16406
|
-
deposit.deposit_data_root
|
|
16407
|
-
]),
|
|
16408
|
-
value: BigInt(deposit.amount)
|
|
16409
|
-
}));
|
|
16410
|
-
const totalBatchValue = callsWithValue.reduce(
|
|
16411
|
-
(sum, c) => sum + c.value,
|
|
16412
|
-
BigInt(0)
|
|
16413
|
-
);
|
|
16414
|
-
const tx = yield multiCall3ContractInstance.aggregate3Value(
|
|
16415
|
-
callsWithValue,
|
|
16416
|
-
{ value: totalBatchValue }
|
|
16388
|
+
for (const deposit of deposits) {
|
|
16389
|
+
const tx = yield ovmContract.deposit(
|
|
16390
|
+
deposit.pubkey,
|
|
16391
|
+
deposit.withdrawal_credentials,
|
|
16392
|
+
deposit.signature,
|
|
16393
|
+
deposit.deposit_data_root,
|
|
16394
|
+
{
|
|
16395
|
+
value: BigInt(deposit.amount)
|
|
16396
|
+
}
|
|
16417
16397
|
);
|
|
16418
16398
|
const receipt = yield tx.wait();
|
|
16419
16399
|
if (receipt == null ? void 0 : receipt.hash) {
|
|
@@ -16423,9 +16403,7 @@ var depositWithMulticall3 = (_0) => __async(null, [_0], function* ({
|
|
|
16423
16403
|
return { txHashes };
|
|
16424
16404
|
} catch (error) {
|
|
16425
16405
|
const errorMessage = error instanceof Error ? error.message : "Deposit failed";
|
|
16426
|
-
throw new Error(
|
|
16427
|
-
`Failed to deposit to OVM with multicall3: ${errorMessage}`
|
|
16428
|
-
);
|
|
16406
|
+
throw new Error(`Failed to deposit to OVM: ${errorMessage}`);
|
|
16429
16407
|
}
|
|
16430
16408
|
});
|
|
16431
16409
|
|
|
@@ -17571,9 +17549,9 @@ var ObolSplits = class {
|
|
|
17571
17549
|
});
|
|
17572
17550
|
}
|
|
17573
17551
|
/**
|
|
17574
|
-
* Deposits to OVM contract
|
|
17552
|
+
* Deposits to OVM contract by sending individual transactions for each deposit.
|
|
17575
17553
|
*
|
|
17576
|
-
* This method allows depositing to an OVM contract
|
|
17554
|
+
* This method allows depositing to an OVM contract. Each deposit is sent as a separate transaction
|
|
17577
17555
|
* Each deposit includes validator public key, withdrawal credentials, signature, deposit data root, and amount.
|
|
17578
17556
|
*
|
|
17579
17557
|
* @remarks
|
|
@@ -17581,7 +17559,7 @@ var ObolSplits = class {
|
|
|
17581
17559
|
* and not pushed to version control.
|
|
17582
17560
|
*
|
|
17583
17561
|
* @param {OVMDepositPayload} payload - Data needed to deposit to OVM
|
|
17584
|
-
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes for
|
|
17562
|
+
* @returns {Promise<{txHashes: string[]}>} Array of transaction hashes, one for each deposit
|
|
17585
17563
|
* @throws Will throw an error if the signer is not provided, OVM address is invalid, or the deposit fails
|
|
17586
17564
|
*
|
|
17587
17565
|
* An example of how to use deposit:
|
|
@@ -17608,11 +17586,10 @@ var ObolSplits = class {
|
|
|
17608
17586
|
payload,
|
|
17609
17587
|
ovmDepositPayloadSchema
|
|
17610
17588
|
);
|
|
17611
|
-
return yield
|
|
17589
|
+
return yield depositOVM({
|
|
17612
17590
|
ovmAddress: validatedPayload.ovmAddress,
|
|
17613
17591
|
deposits: validatedPayload.deposits,
|
|
17614
|
-
signer: this.signer
|
|
17615
|
-
chainId: this.chainId
|
|
17592
|
+
signer: this.signer
|
|
17616
17593
|
});
|
|
17617
17594
|
});
|
|
17618
17595
|
}
|