@@ -766,6 +766,32 @@ export class WalletAddress extends Address {
766766 ) ;
767767 }
768768
769+ /**
770+ * Creates a staking operation to consolidate.
771+ *
772+ * @param options - Additional options for the consolidation operation.
773+ *
774+ * @param timeoutSeconds - The amount to wait for the transaction to complete when broadcasted.
775+ * @param intervalSeconds - The amount to check each time for a successful broadcast.
776+ *
777+ * @returns The staking operation after it's completed successfully.
778+ */
779+ public async createValidatorConsolidation (
780+ options : { [ key : string ] : string } = { } ,
781+ timeoutSeconds = 600 ,
782+ intervalSeconds = 0.2 ,
783+ ) : Promise < StakingOperation > {
784+ return this . createStakingOperation (
785+ 0 ,
786+ "eth" ,
787+ "consolidate" ,
788+ StakeOptionsMode . NATIVE ,
789+ options ,
790+ timeoutSeconds ,
791+ intervalSeconds ,
792+ ) ;
793+ }
794+
769795 /**
770796 * Creates a Payload Signature.
771797 *
@@ -1011,13 +1037,6 @@ export class WalletAddress extends Address {
10111037 timeoutSeconds : number ,
10121038 intervalSeconds : number ,
10131039 ) : Promise < StakingOperation > {
1014- // If performing a native ETH unstake, the amount is not required.
1015- if ( ! IsDedicatedEthUnstakeV2Operation ( assetId , action , mode , options ) ) {
1016- if ( new Decimal ( amount . toString ( ) ) . lessThanOrEqualTo ( 0 ) ) {
1017- throw new Error ( "Amount required greater than zero." ) ;
1018- }
1019- }
1020-
10211040 let stakingOperation = await this . createStakingOperationRequest (
10221041 amount ,
10231042 assetId ,
@@ -1080,10 +1099,7 @@ export class WalletAddress extends Address {
10801099
10811100 options . mode = mode ? mode : StakeOptionsMode . DEFAULT ;
10821101
1083- // If performing a native ETH unstake, the amount is not required.
1084- if ( ! IsDedicatedEthUnstakeV2Operation ( assetId , action , mode , options ) ) {
1085- options . amount = asset . toAtomicAmount ( new Decimal ( amount . toString ( ) ) ) . toString ( ) ;
1086- }
1102+ options . amount = asset . toAtomicAmount ( new Decimal ( amount . toString ( ) ) ) . toString ( ) ;
10871103
10881104 const stakingOperationRequest = {
10891105 network_id : this . getNetworkId ( ) ,
0 commit comments