decane-sdk
Official Python SDK for Decane — institutional liquidity rail for crypto settlement.
Renamed from granthe. The old package was
grantheon PyPI. The API and webhook formats are unchanged, and the server still sendsGranthe-Signature(andX-Granthe-Signature) for older integrations. ReadDecane-Signaturefirst and fall back toGranthe-Signatureif you handle both.
Install
pip install decane-sdk
Quick Start
from decane import Decane
decane = Decane(api_key="gr_...", webhook_secret="gr_whsec_...")
# Create a payment invoice
invoice = decane.invoices.create(
amount=100.00,
crypto_currency="USDT",
network="tron",
description="Premium Plan",
customer_email="buyer@example.com",
idempotency_key="order-1042", # optional, safe to retry
)
print(f"Pay to: {invoice.wallet_address}")
print(f"Status: {invoice.status}")
# Request a payout
payout = decane.payouts.create(
amount=50.00,
currency="USDT",
network="tron",
recipient_address="TXyz...recipientAddress",
idempotency_key="payout-1042", # optional, safe to retry
)
print(f"Payout ID: {payout.id}")
Async Support
from decane import AsyncFlow
async with AsyncFlow(api_key="gr_...") as flow:
invoice = await decane.invoices.create(
amount=100, crypto_currency="USDT", network="ethereum",
)
Resources
Invoices
# Create
invoice = decane.invoices.create(amount=100, crypto_currency="USDT", network="tron")
# Get by ID
invoice = decane.invoices.get("inv_abc123")
# List with filters
result = decane.invoices.list(status="paid", page=1, limit=20)
for inv in result.items:
print(inv.id, inv.amount, inv.status)
# Cancel
decane.invoices.cancel("inv_abc123")
Payouts
# Single payout
payout = decane.payouts.create(
amount=50, currency="USDT", network="tron",
recipient_address="TXyz...addr",
)
# Batch payout
payouts = decane.payouts.create_batch([
{"amount": 50, "currency": "USDT", "network": "tron", "recipient_address": "TXyz..."},
{"amount": 25, "currency": "USDT", "network": "tron", "recipient_address": "TAbc..."},
])
# Check status
payout = decane.payouts.get("pout_abc123")
Wallets
# Generate a new deposit wallet
wallet = decane.wallets.generate(network="ethereum", currency="USDT")
print(wallet.address)
# List wallets
result = decane.wallets.list(network="tron")
# Check balance
wallet = decane.wallets.balance("wal_abc123")
Swaps
# Get a quote
quote = flow.swaps.quote("BTC", "USDT", amount=0.01)
print(f"Rate: {quote.rate}, You get: {quote.to_amount} USDT")
# Execute swap
swap = flow.swaps.create("BTC", "USDT", amount=0.01)
Webhooks
from decane import Decane, InvalidSignatureError
decane = Decane(api_key="gr_...", webhook_secret="gr_whsec_...")
# In your webhook handler. Use the raw body, not re-serialized JSON.
def handle_webhook(request):
payload = request.body
header = request.headers.get("Decane-Signature") or request.headers["Granthe-Signature"] # t=<unix>,v1=<hex>
try:
event = decane.webhooks.construct_event(payload, header, tolerance=300)
except InvalidSignatureError:
return {"error": "Invalid signature"}, 400
# X-Decane-Delivery is the same on every retry, so use it to drop duplicates.
if event.type == "invoice.completed":
invoice_id = event.data["id"]
print(f"Invoice {invoice_id} completed!")
return {"status": "ok"}
decane.webhooks.verify_signature(payload, header) returns a bool if you want to parse the body yourself. The old webhooks.verify(payload, signature) for X-Decane-Signature (or X-Granthe-Signature) still works but is deprecated, because it has no timestamp check.
Error Handling
from decane import Decane, DecaneError, AuthenticationError, RateLimitError
decane = Decane(api_key="gr_...")
try:
invoice = decane.invoices.create(amount=100, crypto_currency="USDT", network="tron")
except AuthenticationError:
print("Bad API key")
except RateLimitError as e:
print(f"Rate limited, retry after {e.retry_after}s")
except DecaneError as e:
print(f"Error: {e.message} (code={e.code}, status={e.status})")
Configuration
decane = Decane(
api_key="gr_...",
webhook_secret="gr_whsec_...", # For webhook verification
base_url="https://api.decane.io/api/v1", # Default
timeout=30.0, # Request timeout in seconds
)
Supported Networks
Bitcoin, Ethereum, Tron, BNB Chain, Solana, Ripple, Polygon, Avalanche, Dogecoin, Litecoin, TON, and more.
License
MIT
Metadata
Release files for decane-sdk 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| decane_sdk-0.8.0.tar.gz | 14.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| decane_sdk-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.3 kB
Release files / decane_sdk-0.8.0.tar.gz
| Download URL | decane_sdk-0.8.0.tar.gz |
|---|---|
| Size | 14.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6bab7f89bc837b90cbf20418fea5d616b160587ac0b4cb1360a38d654746d30f
|
|
BLAKE2b-256 checksum How to use checksums |
9a9c11c00ba8373e5b2e254d46cb2554abea5993476807b9c2157e4857f3eb8e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / decane_sdk-0.8.0-py3-none-any.whl
| Download URL | decane_sdk-0.8.0-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4060a85eeeb8ec5f30846cddafc06a6e3bcda6f58c8af00bcf7b9beb634efb7b
|
|
BLAKE2b-256 checksum How to use checksums |
28677e0024c01f860e409d0f33602842bf39b7a08c4282d0c59a6138a822c88d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for decane-sdk 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.