Python SDK for TBUSD gasless transfers
Project description
TBUSD Python SDK
Gasless TBUSD transfers on Base L2. No ETH required.
Installation
pip install tbusd
Quick Start
from tbusd import Client
# Initialize with your API key and wallet
client = Client(
api_key="tbusd_your_api_key", # Get one at https://tbusd.io/developers
private_key="0x..." # Your wallet's private key
)
# Send TBUSD - no gas needed!
tx = client.transfer(to="0xRecipient...", amount=10.0)
print(f"Sent! TX: {tx['txHash']}")
# Check balance
balance = client.balance()
print(f"Balance: {balance} TBUSD")
# Check API usage
usage = client.usage()
print(f"Today: {usage['today']['used']}/{usage['today']['limit']} transactions")
Features
- Gasless transfers - We pay the gas, you just need TBUSD
- Simple API - No Web3 complexity, just
transfer(to, amount) - EIP-712 signing - Secure, standard meta-transactions
- Rate limited - 20 transactions/day per API key
API Reference
Client(api_key, private_key, rpc_url=None)
Create a new TBUSD client.
| Parameter | Type | Description |
|---|---|---|
api_key |
str | Your TBUSD API key |
private_key |
str | Your wallet's private key (0x...) |
rpc_url |
str | Optional custom RPC URL (defaults to Base public RPC) |
client.transfer(to, amount) -> dict
Send TBUSD to an address.
| Parameter | Type | Description |
|---|---|---|
to |
str | Recipient address (0x...) |
amount |
float | Amount of TBUSD to send |
Returns: {"success": True, "txHash": "0x...", "gasUsed": "85000"}
client.balance(address=None) -> float
Get TBUSD balance. Defaults to your wallet if no address provided.
client.usage() -> dict
Check your API usage and remaining daily limit.
Returns:
{
"email": "you@example.com",
"total_transactions": 142,
"today": {
"used": 5,
"remaining": 15,
"limit": 20
}
}
client.health() -> bool
Check if the relayer service is operational.
Exceptions
from tbusd import TBUSDError, RateLimitError, InsufficientBalanceError
try:
tx = client.transfer(to="0x...", amount=100)
except RateLimitError:
print("Daily limit reached, try again tomorrow")
except InsufficientBalanceError:
print("Not enough TBUSD in wallet")
except TBUSDError as e:
print(f"Error: {e}")
Example: AI Agent Wallet
import os
from tbusd import Client
# Agent's petty cash wallet
agent = Client(
api_key=os.environ["TBUSD_API_KEY"],
private_key=os.environ["AGENT_PRIVATE_KEY"]
)
def pay_for_service(service_address: str, amount: float) -> str:
"""Pay for an API call or service"""
tx = agent.transfer(to=service_address, amount=amount)
return tx["txHash"]
# Pay 5 cents for a search query
tx_hash = pay_for_service("0xSearchProvider...", 0.05)
Rate Limits
| Limit | Value |
|---|---|
| Transactions per day | 20 |
| Minimum transfer | $1 TBUSD |
| Reset time | Midnight UTC |
Links
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tbusd-0.1.0.tar.gz.
File metadata
- Download URL: tbusd-0.1.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b763e999c8a76a95c830b919c311de3fbaee730035c7ff53291fa5d279f89f6
|
|
| MD5 |
88b8d26e6bb71f8ad83d37e3af0ebaf2
|
|
| BLAKE2b-256 |
ab7f7457e90979336db889e8bb6e96f2d7e7ad5e3b7aa6e387887682bb48c6e3
|
File details
Details for the file tbusd-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tbusd-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b474023edb90b7c84ef68eeb8cb021a081185cd790187dab53fc3bf8201dc2ae
|
|
| MD5 |
b8f5a7c4a9c03e4fa766f13cd636114a
|
|
| BLAKE2b-256 |
5adbab5bee3aa2757380ac5d5e2b12d508e7fbf3d46c185b6e73f3b6d5c03279
|