From 50f8ab9d2714ede8ad0f3ddc1bb778c9de99fcf5 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Wed, 11 May 2022 21:48:38 +0100 Subject: [PATCH] Fix handling fees on the RPC API side. --- chia/rpc/wallet_rpc_api.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/chia/rpc/wallet_rpc_api.py b/chia/rpc/wallet_rpc_api.py index 1b73cc674fa2..445f774f19d1 100644 --- a/chia/rpc/wallet_rpc_api.py +++ b/chia/rpc/wallet_rpc_api.py @@ -1334,7 +1334,8 @@ async def nft_mint_nft(self, request) -> Dict: ("h", hexstr_to_bytes(request["hash"])), ] ) - spend_bundle = await nft_wallet.generate_new_nft(metadata, puzzle_hash, request.get("fee", uint64(0))) + fee = uint64(request.get("fee", 0)) + spend_bundle = await nft_wallet.generate_new_nft(metadata, puzzle_hash, fee=fee) return {"wallet_id": wallet_id, "success": True, "spend_bundle": spend_bundle} async def nft_get_nfts(self, request) -> Dict: @@ -1358,7 +1359,8 @@ async def nft_transfer_nft(self, request): nft_wallet: NFTWallet = self.service.wallet_state_manager.wallets[wallet_id] try: nft_coin_info = nft_wallet.get_nft_coin_by_id(bytes32.from_hexstr(request["nft_coin_id"])) - spend_bundle = await nft_wallet.transfer_nft(nft_coin_info, puzzle_hash, fee=request.get("fee", uint64(0))) + fee = uint64(request.get("fee", 0)) + spend_bundle = await nft_wallet.transfer_nft(nft_coin_info, puzzle_hash, fee=fee) return {"wallet_id": wallet_id, "success": True, "spend_bundle": spend_bundle} except Exception as e: log.exception(f"Failed to transfer NFT: {e}") @@ -1371,7 +1373,8 @@ async def nft_add_uri(self, request) -> Dict: nft_wallet: NFTWallet = self.service.wallet_state_manager.wallets[wallet_id] try: nft_coin_info = nft_wallet.get_nft_coin_by_id(bytes32.from_hexstr(request["nft_coin_id"])) - spend_bundle = await nft_wallet.update_metadata(nft_coin_info, uri, request.get("fee", uint64(0))) + fee = uint64(request.get("fee", 0)) + spend_bundle = await nft_wallet.update_metadata(nft_coin_info, uri, fee=fee) return {"wallet_id": wallet_id, "success": True, "spend_bundle": spend_bundle} except Exception as e: log.exception(f"Failed to update NFT metadata: {e}")