diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fdbe7c..25d6b99 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.46] (2025-03-06) +[0.46]: https://github.com/CoboGlobal/cobo-python-api/compare/0.45...0.46 +### Added +- Add babylon claim rewards interface. https://github.com/CoboGlobal/cobo-python-api/pull/106 +- Add babylon register staking interface. https://github.com/CoboGlobal/cobo-python-api/pull/105 + +## [0.45] (2025-02-21) +[0.45]: https://github.com/CoboGlobal/cobo-python-api/compare/0.44...0.45 +### Added +- Add babylon airdrop interface. https://github.com/CoboGlobal/cobo-python-api/pull/101 + +## [0.44] (2024-09-02) +[0.44]: https://github.com/CoboGlobal/cobo-python-api/compare/0.43...0.44 +### Added +- Add New API `babylon_unbonding` and `babylon_withdraw` for MPC Wallet. https://github.com/CoboGlobal/cobo-python-api/pull/96 +- The method of the `estimate_fee` API for the MPC wallet has been changed from GET to POST. https://github.com/CoboGlobal/cobo-python-api/pull/97 + +## [0.43] (2024-08-14) +[0.43]: https://github.com/CoboGlobal/cobo-python-api/compare/0.42...0.43 +### Added +- Add New API `babylon_drop_staking` for MPC Wallet. https://github.com/CoboGlobal/cobo-python-api/pull/94 + ## [0.42] (2024-07-15) [0.42]: https://github.com/CoboGlobal/cobo-python-api/compare/0.41...0.42 ### Added diff --git a/cobo_custody/client/mpc_client.py b/cobo_custody/client/mpc_client.py index 4eb61e5..3c042e7 100644 --- a/cobo_custody/client/mpc_client.py +++ b/cobo_custody/client/mpc_client.py @@ -278,7 +278,7 @@ def estimate_fee(self, coin: str, amount: int = None, address: str = None, repla params = {"coin": coin, "amount": amount, "address": address, "replace_cobo_id": replace_cobo_id, "from_address": from_address, "to_address_details": to_address_details, "fee": fee, "gas_price": gas_price, "gas_limit": gas_limit, "extra_parameters": extra_parameters} - return self.request("GET", "/v1/custody/mpc/estimate_fee/", params) + return self.request("POST", "/v1/custody/mpc/estimate_fee/", params) def list_tss_node_requests(self, request_type: int = None, status: int = None) -> ApiResponse: params = {"request_type": request_type, "status": status} @@ -333,6 +333,10 @@ def babylon_replace_staking_fee(self, request_id: str, related_request_id: str, params = {"request_id": request_id, "related_request_id": related_request_id, "fee_rate": fee_rate, "max_staking_fee": max_staking_fee} return self.request("POST", "/v1/custody/mpc/babylon/replace_staking_fee/", params) + def babylon_drop_staking(self, request_id: str, related_request_id: str, fee_rate: float, max_staking_fee: int = None): + params = {"request_id": request_id, "related_request_id": related_request_id, "fee_rate": fee_rate, "max_staking_fee": max_staking_fee} + return self.request("POST", "/v1/custody/mpc/babylon/drop_staking/", params) + def babylon_broadcast_staking_transaction(self, request_id: str): params = {"request_id": request_id} return self.request("POST", "/v1/custody/mpc/babylon/broadcast_staking_transaction/", params) @@ -353,7 +357,80 @@ def babylon_list_transactions_by_status(self, status: int, address: str = None, params = {"status": status, "address": address, "min_cobo_id": min_cobo_id, "limit": limit} return self.request("GET", "/v1/custody/mpc/babylon/list_transactions_by_status/", params) + def babylon_unbonding(self, request_id: str, staking_request_id: str): + params = {"request_id": request_id, "staking_request_id": staking_request_id} + return self.request("POST", "/v1/custody/mpc/babylon/unbonding/", params) + + def babylon_withdraw(self, request_id: str, fee_rate: float, max_fee_amount: int = None, unbonding_request_id: str = None, staking_request_id: str = None): + params = {"request_id": request_id, "fee_rate": fee_rate, "max_fee_amount": max_fee_amount, "unbonding_request_id": unbonding_request_id, "staking_request_id": staking_request_id} + return self.request("POST", "/v1/custody/mpc/babylon/withdraw/", params) + def get_approval_details(self, request_id: str): params = {"request_id": request_id} return self.request("GET", "/v1/custody/mpc/get_approval_details/", params) + def list_eligibles(self, status: str = None, min_id: str = None, limit: int = None) -> ApiResponse: + params = { + "status": status, + "min_id": min_id, + "limit": limit + } + return self.request("GET", "/v1/custody/mpc/babylon/airdrops/list_eligibles/", params) + + def submit_registration(self, btc_address: str, babylon_address: str) -> ApiResponse: + params = { + "btc_address": btc_address, + "babylon_address": babylon_address + } + return self.request("POST", "/v1/custody/mpc/babylon/airdrops/submit_registration/", params) + + def list_registrations(self, status: str = None, btc_address: str = None, min_id: str = None, limit: int = None) -> ApiResponse: + params = { + "status": status, + "btc_address": btc_address, + "min_id": min_id, + "limit": limit + } + return self.request("GET", "/v1/custody/mpc/babylon/airdrops/list_registrations/", params) + + def get_registration(self, registration_id: str) -> ApiResponse: + params = { + "registration_id": registration_id + } + return self.request("GET", "/v1/custody/mpc/babylon/airdrops/get_registration/", params) + + def list_eligible_stakings(self, status: str = None, min_id: str = None, limit: int = None) -> ApiResponse: + params = { + "status": status, + "min_id": min_id, + "limit": limit + } + return self.request("GET", "/v1/custody/mpc/babylon/stakings/list_eligibles/", params) + + def submit_staking_registration(self, staking_id: str, babylon_address: str) -> ApiResponse: + params = { + "staking_id": staking_id, + "babylon_address": babylon_address + } + return self.request("POST", "/v1/custody/mpc/babylon/stakings/submit_registration/", params) + + def list_staking_registrations(self, staking_id: str, status: str = None, min_id: str = None, limit: int = None) -> ApiResponse: + params = { + "staking_id": staking_id, + "status": status, + "min_id": min_id, + "limit": limit + } + return self.request("GET", "/v1/custody/mpc/babylon/stakings/list_registrations/", params) + + def get_staking_registration(self, registration_id: str) -> ApiResponse: + params = { + "registration_id": registration_id + } + return self.request("GET", "/v1/custody/mpc/babylon/stakings/get_registration/", params) + + def claim_babylon_rewards(self, babylon_address: str): + params = { + "babylon_address": babylon_address + } + return self.request("POST", "/v1/custody/mpc/babylon/claim_rewards/", params) diff --git a/setup.py b/setup.py index 5af323b..24cc4e2 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import setup setup( name="cobo_custody", - version="0.42", + version="0.46", author="Cobo", author_email="support@cobo.com", description="Cobo Custody restful api", diff --git a/tests/testcase/test_mpc_client.py b/tests/testcase/test_mpc_client.py index 5ef6cbf..7653c1f 100644 --- a/tests/testcase/test_mpc_client.py +++ b/tests/testcase/test_mpc_client.py @@ -1,5 +1,6 @@ import unittest import time + from cobo_custody.signer.local_signer import LocalSigner from cobo_custody.client.mpc_client import MPCClient