Skip to content

Commit 36f8895

Browse files
committed
chore: apply suggestion
1 parent 7fa28e7 commit 36f8895

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

docs/api-reference.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,12 @@ print(f"Paid {paid_count} transaction fees")
908908
print(f"Received {received_count} fee distributions")
909909
```
910910

911-
### `client.get_history(bridge_identifier: str, wallet_address: str, limit: int = 20, offset: int = 0) -> List[BridgeHistory]`
911+
### `client.get_history(bridge_identifier: str, wallet: str, limit: int = 20, offset: int = 0) -> List[BridgeHistory]`
912912
Retrieves the transaction history for a wallet on a specific bridge.
913913

914914
#### Parameters
915915
- `bridge_identifier: str` - The name of the bridge instance (e.g., "hoodi_tt2")
916-
- `wallet_address: str` - The wallet address to query
916+
- `wallet: str` - The wallet address to query
917917
- `limit: int` - Max number of records to return (default: 20)
918918
- `offset: int` - Number of records to skip (default: 0)
919919

@@ -924,7 +924,7 @@ Retrieves the transaction history for a wallet on a specific bridge.
924924
```python
925925
history = client.get_history(
926926
bridge_identifier="hoodi_tt2",
927-
wallet_address="0x..."
927+
wallet="0x..."
928928
)
929929

930930
for rec in history:
@@ -1379,8 +1379,8 @@ Parses a canonical attestation payload (without signature) into structured data.
13791379
- `data_provider: str` (0x-prefixed address)
13801380
- `stream_id: str`
13811381
- `action_id: int`
1382-
- `args: List[Any]` (decoded arguments)
1383-
- `result: bytes` (ABI-encoded result)
1382+
- `arguments: List[Any]` (decoded arguments)
1383+
- `result: List[Dict[str, Any]]` (ABI-encoded result)
13841384

13851385
## Bridge Actions
13861386

examples/bridging/withdraw_and_claim.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def main():
162162

163163
except Exception as e:
164164
# Log error but continue polling
165-
# print(f"\n[!] Polling error: {e}")
165+
print(f"\n[!] Polling error: {e}")
166166
pass
167167

168168
time.sleep(30) # Poll every 30 seconds

src/trufnetwork_sdk_py/client.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)