From d4f680e60a55bc862019ce5bbba8d52da4d37e3f Mon Sep 17 00:00:00 2001 From: Cong Zhang Date: Mon, 4 Dec 2023 14:27:45 +0800 Subject: [PATCH] add get_max_send_amount --- MPCClient.php | 15 +++++++++++++++ MPCClientTest.php | 9 +++++++++ 2 files changed, 24 insertions(+) diff --git a/MPCClient.php b/MPCClient.php index 0d909df..3dca510 100644 --- a/MPCClient.php +++ b/MPCClient.php @@ -680,4 +680,19 @@ function retryDoubleCheck(string $requestId) return $this->request("POST", "/v1/custody/mpc/retry_double_check/", $params); } + + function getMaxSendAmount(string $coin, string $fee_rate, string $to_address, string $from_address = null) + { + $params = [ + "coin" => $coin, + "fee_rate" => $fee_rate, + "to_address" => $to_address + ]; + + if ($from_address) { + $params = array_merge($params, ["from_address" => $from_address]); + } + + return $this->request("GET", "/v1/custody/mpc/get_max_send_amount/", $params); + } } \ No newline at end of file diff --git a/MPCClientTest.php b/MPCClientTest.php index 8ced06d..d4b5da9 100644 --- a/MPCClientTest.php +++ b/MPCClientTest.php @@ -175,4 +175,13 @@ public function testListTssNode() $this->assertTrue($res->success); } + + public function testGetMaxSendAmount() + { + $coin = "GETH"; + $to_address = "0xEEACb7a5e53600c144C0b9839A834bb4b39E540c"; + $res = $this->mpcClient->getMaxSendAmount($coin, "0", $to_address); + + $this->assertTrue($res->success); + } } \ No newline at end of file