Skip to content

Commit

Permalink
Fix handling fees on the RPC API side.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmineKhaldi committed May 11, 2022
1 parent 102280e commit 50f8ab9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions chia/rpc/wallet_rpc_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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}")
Expand All @@ -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}")
Expand Down

0 comments on commit 50f8ab9

Please sign in to comment.