@@ -2764,19 +2764,25 @@ def get_wallet_balance(self, bridge_identifier: str, wallet_address: str) -> str
27642764 """
27652765 return truf_sdk .GetWalletBalance (self .client , bridge_identifier , wallet_address )
27662766
2767- def withdraw (self , bridge_identifier : str , amount : str , recipient : str ) -> str :
2767+ def withdraw (self , bridge_identifier : str , amount : str , recipient : str , wait : bool = True ) -> str :
27682768 """
27692769 Initiate a withdrawal by burning tokens on the Kwil network.
27702770
27712771 Args:
27722772 bridge_identifier: The bridge instance identifier (e.g., "hoodi_tt", "sepolia")
27732773 amount: The amount to withdraw in wei (as a string)
27742774 recipient: The EVM address to receive the funds
2775+ wait: If True, wait for the transaction to be confirmed on-chain
27752776
27762777 Returns:
27772778 str: The transaction hash of the burn operation
27782779 """
2779- return truf_sdk .Withdraw (self .client , bridge_identifier , amount , recipient )
2780+ tx_hash = truf_sdk .Withdraw (self .client , bridge_identifier , amount , recipient )
2781+
2782+ if wait :
2783+ self .wait_for_tx (tx_hash )
2784+
2785+ return tx_hash
27802786
27812787 def get_withdrawal_proof (self , bridge_identifier : str , wallet : str ) -> list [dict ]:
27822788 """
@@ -2790,6 +2796,8 @@ def get_withdrawal_proof(self, bridge_identifier: str, wallet: str) -> list[dict
27902796 list[dict]: A list of withdrawal proof objects containing signatures and merkle data
27912797 """
27922798 json_str = truf_sdk .GetWithdrawalProof (self .client , bridge_identifier , wallet )
2799+ if not json_str :
2800+ return []
27932801 return json .loads (json_str )
27942802
27952803 def get_history (self , bridge_identifier : str , wallet : str , limit : int = 20 , offset : int = 0 ) -> list [BridgeHistory ]:
@@ -2806,6 +2814,8 @@ def get_history(self, bridge_identifier: str, wallet: str, limit: int = 20, offs
28062814 list[BridgeHistory]: A list of history records (deposits and withdrawals)
28072815 """
28082816 json_str = truf_sdk .GetHistory (self .client , bridge_identifier , wallet , limit , offset )
2817+ if not json_str :
2818+ return []
28092819 return json .loads (json_str )
28102820
28112821 # ═══════════════════════════════════════════════════════════════
0 commit comments