diff --git a/wrappers/fedimint-py/AsyncFedimintClient.py b/wrappers/fedimint-py/AsyncFedimintClient.py index 2a6883d..db2e415 100644 --- a/wrappers/fedimint-py/AsyncFedimintClient.py +++ b/wrappers/fedimint-py/AsyncFedimintClient.py @@ -6,7 +6,6 @@ import atexit from models.common import ( - DiscoverVersionRequest, DiscoverVersionResponse, InfoResponse, ListOperationsRequest, @@ -29,7 +28,6 @@ from models.onchain import ( OnchainAwaitDepositRequest, OnchainAwaitDepositResponse, - OnchainDepositAddressRequest, OnchainDepositAddressResponse, OnchainWithdrawRequest, OnchainWithdrawResponse, @@ -185,9 +183,12 @@ async def config(self): # async def backup(self, request: BackupRequest, federationId: str = None): # return await self._post_with_id("/admin/backup", request, federationId) - async def discover_version(self, threshold: int) -> DiscoverVersionResponse: - request: DiscoverVersionRequest = {"threshold": threshold} - return await self._post("/admin/discover-version", request) + async def discover_version( + self, federation_id: str = None + ) -> DiscoverVersionResponse: + return await self._post_with_federation_id( + "/admin/discover-version", {}, federation_id + ) async def federation_ids(self): return await self._get("/admin/federation-ids") @@ -378,10 +379,9 @@ class Onchain: def __init__(self, client): self.client = client - async def create_deposit_address(self, timeout: int, federation_id: str = None): - request: OnchainDepositAddressRequest = {"timeout": timeout} + async def create_deposit_address(self, federation_id: str = None): return await self.client._post_with_federation_id( - "/onchain/deposit-address", request, federation_id + "/onchain/deposit-address", {}, federation_id ) async def await_deposit( diff --git a/wrappers/fedimint-py/FedimintClient.py b/wrappers/fedimint-py/FedimintClient.py index 9c0c520..ddaa5e7 100644 --- a/wrappers/fedimint-py/FedimintClient.py +++ b/wrappers/fedimint-py/FedimintClient.py @@ -4,7 +4,6 @@ import requests from models.common import ( - DiscoverVersionRequest, DiscoverVersionResponse, InfoResponse, ListOperationsRequest, @@ -26,7 +25,6 @@ from models.onchain import ( OnchainAwaitDepositRequest, OnchainAwaitDepositResponse, - OnchainDepositAddressRequest, OnchainWithdrawRequest, OnchainWithdrawResponse, ) @@ -157,9 +155,8 @@ def info(self) -> InfoResponse: def config(self): return self._get("/admin/config") - def discover_version(self, threshold: int) -> DiscoverVersionResponse: - request: DiscoverVersionRequest = {"threshold": threshold} - return self._post("/admin/discover-version", request) + def discover_version(self, federation_id: str = None) -> DiscoverVersionResponse: + return self._post_with_federation_id("/admin/discover-version", {}) def federation_ids(self): return self._get("/admin/federation-ids") @@ -343,10 +340,9 @@ class Onchain: def __init__(self, client): self.client = client - def create_deposit_address(self, timeout: int, federation_id: str = None): - request: OnchainDepositAddressRequest = {"timeout": timeout} + def create_deposit_address(self, federation_id: str = None): return self.client._post_with_federation_id( - "/onchain/deposit-address", request, federation_id + "/onchain/deposit-address", {}, federation_id ) def await_deposit( diff --git a/wrappers/fedimint-py/models/mint.py b/wrappers/fedimint-py/models/mint.py index 674dc76..e698bd5 100644 --- a/wrappers/fedimint-py/models/mint.py +++ b/wrappers/fedimint-py/models/mint.py @@ -17,7 +17,7 @@ class NotesJson(BaseModel): class MintDecodeNotesResponse(BaseModel): - notesJson: NotesJson + notes: NotesJson class MintEncodeNotesRequest(BaseModel): @@ -25,7 +25,7 @@ class MintEncodeNotesRequest(BaseModel): class MintEncodeNotesResponse(BaseModel): - notes: str + notesJson: str class MintReissueRequest(BaseModel): diff --git a/wrappers/fedimint-py/models/onchain.py b/wrappers/fedimint-py/models/onchain.py index 53d1482..e239eb5 100644 --- a/wrappers/fedimint-py/models/onchain.py +++ b/wrappers/fedimint-py/models/onchain.py @@ -2,13 +2,10 @@ from pydantic import BaseModel -class OnchainDepositAddressRequest(BaseModel): - timeout: int - - class OnchainDepositAddressResponse(BaseModel): operation_id: str address: str + tweak_idx: int class OnchainAwaitDepositRequest(BaseModel): diff --git a/wrappers/fedimint-py/test.py b/wrappers/fedimint-py/test.py index bc29fdf..9d75e54 100644 --- a/wrappers/fedimint-py/test.py +++ b/wrappers/fedimint-py/test.py @@ -45,7 +45,7 @@ def main(): log_input_and_output({}, data) log_method("/v2/admin/discover-version") - data = fedimint_client.discover_version(1) + data = fedimint_client.discover_version() log_input_and_output({}, data) log_method("/v2/admin/federation-ids") @@ -120,8 +120,8 @@ def main(): log_input_and_output({"notes": mint_data["notes"]}, data) log_method("/v2/mint/encode-notes") - data = fedimint_client.mint.encode_notes(data["notesJson"]) - log_input_and_output({"notesJson": data}, data) + encoded_data = fedimint_client.mint.encode_notes(data["notesJson"]) + log_input_and_output({"notesJson": data}, encoded_data) log_method("/v2/mint/validate") data = fedimint_client.mint.validate(mint_data["notes"]) @@ -145,8 +145,8 @@ def main(): # ONCHAIN METHODS log_method("/v2/onchain/deposit-address") - data = fedimint_client.onchain.create_deposit_address(1000) - log_input_and_output({"timeout": 1000}, data) + data = fedimint_client.onchain.create_deposit_address() + log_input_and_output({}, data) log_method("/v2/onchain/withdraw") withdraw_data = fedimint_client.onchain.withdraw(data["address"], 1000) log_input_and_output({"address": data["address"], "amountSat": 1000}, withdraw_data) diff --git a/wrappers/fedimint-py/test_async.py b/wrappers/fedimint-py/test_async.py index 75e5f1f..3ea6d3d 100644 --- a/wrappers/fedimint-py/test_async.py +++ b/wrappers/fedimint-py/test_async.py @@ -47,9 +47,7 @@ async def main(): # log_input_and_output({}, data) # `/v2/admin/discover-version` log_method("/v2/admin/discover-version") - data = await fedimint_client.discover_version( - 1 - ) # Assuming threshold is required, adjust as needed + data = await fedimint_client.discover_version() log_input_and_output({}, data) # `/v2/admin/federation-ids` log_method("/v2/admin/federation-ids") @@ -130,8 +128,8 @@ async def main(): log_input_and_output({"notes": mint_data["notes"]}, data) # `/v2/mint/encode-notes` log_method("/v2/mint/encode-notes") - data = await fedimint_client.mint.encode_notes(data["notesJson"]) - log_input_and_output({"notesJson": data}, data) + encoded_data = await fedimint_client.mint.encode_notes(data["notesJson"]) + log_input_and_output({"notesJson": data}, encoded_data) # `/v2/mint/validate` log_method("/v2/mint/validate") data = await fedimint_client.mint.validate(mint_data["notes"]) @@ -157,9 +155,8 @@ async def main(): # ONCHAIN METHODS # `/v2/onchain/deposit-address` log_method("/v2/onchain/deposit-address") - data = await fedimint_client.onchain.create_deposit_address(1000) - print("data: ", data) - log_input_and_output({"timeout": 1000}, data) + data = await fedimint_client.onchain.create_deposit_address() + log_input_and_output({}, data) # `/v2/onchain/withdraw` log_method("/v2/onchain/withdraw") withdraw_data = await fedimint_client.onchain.withdraw(data["address"], 1000)