@obolnetwork/obol-sdk 2.9.0 → 2.10.0
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/cjs/package.json +1 -1
- package/dist/cjs/src/ajv.js +0 -1
- package/dist/cjs/src/constants.js +9 -0
- package/dist/cjs/src/eoa/eoa.js +83 -0
- package/dist/cjs/src/eoa/eoaHelpers.js +37 -0
- package/dist/cjs/src/index.js +5 -1
- package/dist/cjs/src/schema.js +24 -2
- package/dist/cjs/src/splits/splitHelpers.js +6 -4
- package/dist/cjs/src/splits/splits.js +1 -0
- package/dist/cjs/test/client/ajv.spec.js +20 -1
- package/dist/cjs/test/eoa/eoa.spec.js +87 -0
- package/dist/cjs/test/splits/splits.spec.js +5 -0
- package/dist/esm/package.json +1 -1
- package/dist/esm/src/ajv.js +0 -1
- package/dist/esm/src/constants.js +9 -0
- package/dist/esm/src/eoa/eoa.js +79 -0
- package/dist/esm/src/eoa/eoaHelpers.js +33 -0
- package/dist/esm/src/index.js +3 -0
- package/dist/esm/src/schema.js +23 -1
- package/dist/esm/src/splits/splitHelpers.js +7 -5
- package/dist/esm/src/splits/splits.js +1 -0
- package/dist/esm/test/client/ajv.spec.js +20 -1
- package/dist/esm/test/eoa/eoa.spec.js +85 -0
- package/dist/esm/test/splits/splits.spec.js +5 -0
- package/dist/types/src/eoa/eoa.d.ts +42 -0
- package/dist/types/src/eoa/eoaHelpers.d.ts +16 -0
- package/dist/types/src/index.d.ts +7 -0
- package/dist/types/src/schema.d.ts +22 -0
- package/dist/types/src/splits/splitHelpers.d.ts +2 -1
- package/dist/types/src/types.d.ts +18 -2
- package/dist/types/test/eoa/eoa.spec.d.ts +1 -0
- package/package.json +1 -1
- package/src/ajv.ts +0 -1
- package/src/constants.ts +9 -0
- package/src/eoa/eoa.ts +94 -0
- package/src/eoa/eoaHelpers.ts +43 -0
- package/src/index.ts +9 -0
- package/src/schema.ts +24 -1
- package/src/splits/splitHelpers.ts +8 -4
- package/src/splits/splits.ts +1 -0
- package/src/types.ts +22 -2
package/src/schema.ts
CHANGED
|
@@ -233,6 +233,10 @@ export const ovmTotalSplitPayloadSchema = {
|
|
|
233
233
|
export const ovmRequestWithdrawalPayloadSchema = {
|
|
234
234
|
type: 'object',
|
|
235
235
|
properties: {
|
|
236
|
+
withdrawalFees: {
|
|
237
|
+
type: 'string',
|
|
238
|
+
pattern: '^[0-9]+$',
|
|
239
|
+
},
|
|
236
240
|
ovmAddress: {
|
|
237
241
|
type: 'string',
|
|
238
242
|
pattern: '^0x[a-fA-F0-9]{40}$',
|
|
@@ -255,5 +259,24 @@ export const ovmRequestWithdrawalPayloadSchema = {
|
|
|
255
259
|
},
|
|
256
260
|
},
|
|
257
261
|
validateOVMRequestWithdrawalPayload: true,
|
|
258
|
-
required: ['ovmAddress', 'pubKeys', 'amounts'],
|
|
262
|
+
required: ['ovmAddress', 'pubKeys', 'amounts', 'withdrawalFees'],
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
export const eoaWithdrawalPayloadSchema = {
|
|
266
|
+
type: 'object',
|
|
267
|
+
properties: {
|
|
268
|
+
pubkey: {
|
|
269
|
+
type: 'string',
|
|
270
|
+
pattern: '^0x[a-fA-F0-9]{96}$', // 48 bytes = 96 hex chars + 0x prefix
|
|
271
|
+
},
|
|
272
|
+
allocation: {
|
|
273
|
+
type: 'number',
|
|
274
|
+
minimum: 0,
|
|
275
|
+
},
|
|
276
|
+
requiredFee: {
|
|
277
|
+
type: 'string',
|
|
278
|
+
pattern: '^[0-9]+$',
|
|
279
|
+
},
|
|
280
|
+
},
|
|
281
|
+
required: ['pubkey', 'allocation', 'requiredFee'],
|
|
259
282
|
};
|
|
@@ -13,7 +13,7 @@ import { OWRContract, OWRFactoryContract } from '../abi/OWR';
|
|
|
13
13
|
import { OVMFactoryContract, OVMContract } from '../abi/OVMFactory';
|
|
14
14
|
import { splitMainEthereumAbi } from '../abi/SplitMain';
|
|
15
15
|
import { MultiCallContract } from '../abi/Multicall';
|
|
16
|
-
import { CHAIN_CONFIGURATION } from '../constants';
|
|
16
|
+
import { CHAIN_CONFIGURATION, ETHER_TO_GWEI } from '../constants';
|
|
17
17
|
import { splitV2FactoryAbi } from '../abi/splitV2FactoryAbi';
|
|
18
18
|
|
|
19
19
|
const splitMainContractInterface = new Interface(splitMainEthereumAbi);
|
|
@@ -742,7 +742,7 @@ export const deployOVMContract = async ({
|
|
|
742
742
|
OVMOwnerAddress,
|
|
743
743
|
principalRecipient,
|
|
744
744
|
rewardRecipient,
|
|
745
|
-
principalThreshold,
|
|
745
|
+
principalThreshold * ETHER_TO_GWEI,
|
|
746
746
|
);
|
|
747
747
|
|
|
748
748
|
const receipt = await tx.wait();
|
|
@@ -837,7 +837,7 @@ export const deployOVMAndSplitV2 = async ({
|
|
|
837
837
|
ovmArgs.OVMOwnerAddress,
|
|
838
838
|
ovmArgs.principalRecipient,
|
|
839
839
|
ovmArgs.rewardRecipient,
|
|
840
|
-
ovmArgs.principalThreshold,
|
|
840
|
+
ovmArgs.principalThreshold * ETHER_TO_GWEI,
|
|
841
841
|
);
|
|
842
842
|
|
|
843
843
|
executeCalls.push({
|
|
@@ -923,11 +923,13 @@ export const requestWithdrawalFromOVM = async ({
|
|
|
923
923
|
ovmAddress,
|
|
924
924
|
pubKeys,
|
|
925
925
|
amounts,
|
|
926
|
+
withdrawalFees,
|
|
926
927
|
signer,
|
|
927
928
|
}: {
|
|
928
929
|
ovmAddress: string;
|
|
929
930
|
pubKeys: string[];
|
|
930
931
|
amounts: string[];
|
|
932
|
+
withdrawalFees: string;
|
|
931
933
|
signer: SignerType;
|
|
932
934
|
}): Promise<{ txHash: string }> => {
|
|
933
935
|
try {
|
|
@@ -936,7 +938,9 @@ export const requestWithdrawalFromOVM = async ({
|
|
|
936
938
|
|
|
937
939
|
const ovmContract = new Contract(ovmAddress, OVMContract.abi, signer);
|
|
938
940
|
|
|
939
|
-
const tx = await ovmContract.requestWithdrawal(pubKeys, bigintAmounts
|
|
941
|
+
const tx = await ovmContract.requestWithdrawal(pubKeys, bigintAmounts, {
|
|
942
|
+
value: BigInt(withdrawalFees),
|
|
943
|
+
});
|
|
940
944
|
const receipt = await tx.wait();
|
|
941
945
|
|
|
942
946
|
return { txHash: receipt.hash };
|
package/src/splits/splits.ts
CHANGED
package/src/types.ts
CHANGED
|
@@ -214,7 +214,7 @@ export type OVMBaseSplitPayload = {
|
|
|
214
214
|
/** Owner address for the splitter contracts. */
|
|
215
215
|
splitOwnerAddress?: string;
|
|
216
216
|
|
|
217
|
-
/** Principal threshold for OVM contract. */
|
|
217
|
+
/** Principal threshold in ETH for OVM contract. */
|
|
218
218
|
principalThreshold?: number;
|
|
219
219
|
|
|
220
220
|
/** Distributor fee percentage (0-10). */
|
|
@@ -573,7 +573,7 @@ export type OVMArgs = {
|
|
|
573
573
|
/** Rewards recipient of the cluster. */
|
|
574
574
|
rewardRecipient: string;
|
|
575
575
|
|
|
576
|
-
/** Principal threshold for OVM contract. */
|
|
576
|
+
/** Principal threshold in ETH for OVM contract. */
|
|
577
577
|
principalThreshold: number;
|
|
578
578
|
};
|
|
579
579
|
|
|
@@ -606,12 +606,18 @@ export type ChainConfig = {
|
|
|
606
606
|
address: string;
|
|
607
607
|
bytecode: string;
|
|
608
608
|
};
|
|
609
|
+
EOA_WITHDRAWAL_CONTRACT?: {
|
|
610
|
+
address: string;
|
|
611
|
+
};
|
|
609
612
|
};
|
|
610
613
|
|
|
611
614
|
/**
|
|
612
615
|
* Payload for requesting withdrawal from OVM contract
|
|
613
616
|
*/
|
|
614
617
|
export type OVMRequestWithdrawalPayload = {
|
|
618
|
+
/** request withdrawal fees in wei */
|
|
619
|
+
withdrawalFees: string;
|
|
620
|
+
|
|
615
621
|
/** OVM contract address */
|
|
616
622
|
ovmAddress: string;
|
|
617
623
|
|
|
@@ -621,3 +627,17 @@ export type OVMRequestWithdrawalPayload = {
|
|
|
621
627
|
/** Array of withdrawal amounts in gwei (uint64) as strings */
|
|
622
628
|
amounts: string[];
|
|
623
629
|
};
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Payload for requesting withdrawal from EOA contract
|
|
633
|
+
*/
|
|
634
|
+
export type EOAWithdrawalPayload = {
|
|
635
|
+
/** Validator public key in hex format */
|
|
636
|
+
pubkey: string;
|
|
637
|
+
|
|
638
|
+
/** Withdrawal amount in ETH */
|
|
639
|
+
allocation: number;
|
|
640
|
+
|
|
641
|
+
/** Required fee in wei */
|
|
642
|
+
requiredFee: string;
|
|
643
|
+
};
|