From 33ffe138b9df571e027a40b4078daf5fb60b3ffe Mon Sep 17 00:00:00 2001 From: Cong Zhang Date: Tue, 27 Aug 2024 13:28:36 +0800 Subject: [PATCH] add babylon unbonding&withdraw interface --- MPCClient.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/MPCClient.php b/MPCClient.php index cfefef0..3ac2d4f 100644 --- a/MPCClient.php +++ b/MPCClient.php @@ -865,6 +865,37 @@ function babylonDropStaking(string $requestId, string $relatedRequestId, string return $this->request("POST", "/v1/custody/mpc/babylon/drop_staking/", $params); } + function babylonUnbonding(string $requestId, string $stakingRequestId) + { + $params = [ + "request_id" => $requestId, + "staking_request_id" => $stakingRequestId, + ]; + + return $this->request("POST", "/v1/custody/mpc/babylon/unbonding/", params); + } + + + function babylonWithdraw(string $requestId, string $feeRate, BigInteger $maxFeeAmount=null, string $unbondingRequestId=null, string $stakingRequestId=null) + { + $params = [ + "request_id" => $requestId, + "fee_rate" => $feeRate, + ]; + + if ($maxFeeAmount) { + $params = array_merge($params, ["max_fee_amount" => $maxFeeAmount]); + } + if ($unbondingRequestId) { + $params = array_merge($params, ["unbonding_request_id" => $unbondingRequestId]); + } + if ($stakingRequestId) { + $params = array_merge($params, ["staking_request_id" => $stakingRequestId]); + } + return $this->request("POST", "/v1/custody/mpc/babylon/withdraw/", params); + } + + function babylonBroadcastStakingTransaction(string $requestId) { $params = [