Docs menu

SDKs

Two SDKs sign every request the way the API verifies it and verify webhook signatures. Both are published as a beta, 0.1.0-beta.0: the API they call is stable, the package interface may still change before 1.0. Other languages: generate a client from openapi.yaml.

TypeScriptPython
Package@tenergy/sdk (npm, beta)tenergy (PyPI, beta)
Installnpm install @tenergy/sdkpip install tenergy; async: pip install "tenergy[async]"
Dependenciesnone (WebCrypto: Node 22+, Bun, Deno, Workers, browsers)none; the async client adds httpx
Styleasync/awaitClient (blocking) or AsyncClient (await, asyncio)
Webhook checkverifyWebhookSignature(secret, timestamp, rawBody, signature)verify_signature(secret, headers, body, tolerance_seconds=300)
Example projecttenergy-examples-tstenergy-examples-py
Full referenceTypeScript SDKthis page

TypeScript

import { TenergyClient } from "@tenergy/sdk";
const client = new TenergyClient({ baseUrl: "https://api-nile.tenergy.me/v1", apiKey: process.env.TENERGY_KEY!, apiSecret: process.env.TENERGY_SECRET! });
const quote = await client.createQuote({ resource: "energy", amount: 65_000, tier: "1h", receiver });
const order = await client.createOrder({ quote_id: quote.id, client_order_id: `qs-${crypto.randomUUID()}` });
const settled = await client.waitForOrder(order.id, { timeoutMs: 120_000 });

Python

import os, uuid
from tenergy import Client
client = Client(api_key=os.environ["TENERGY_KEY"], api_secret=os.environ["TENERGY_SECRET"], base_url="https://api-nile.tenergy.me/v1")
quote = client.create_quote({"resource": "energy", "amount": 65000, "tier": "1h", "receiver": receiver})
order = client.create_order({"quote_id": quote["id"], "client_order_id": f"qs-{uuid.uuid4()}"})

client.wait_for_order(order["id"]) returns once the status is active; or wait for the order.confirmed webhook.

Runnable quickstarts

Both quickstarts walk test wallets → sign-up → deposit → transfer estimate → rented energy → a real token transfer that burns no TRX, and print each step; any API error prints its slug and request id.

ProjectRunNeeds
tenergy-examples-tsnpm install && npm run quickstartNode.js 22.9+; nothing else — it creates test wallets and signs up on Nile
tenergy-examples-pypip install -e . && python quickstart.pyPython 3.9+; nothing else — it creates test wallets and signs up on Nile

Keys are available right after signup; only the order needs a balance. Create the key before the deposit: the signup token lives 15 minutes, and a TRX top-up is credited after 1-3 confirmations up to 5,000 TRX (about 6-12 s from sending), 19 above (about a minute). The five-step Nile run is in Environments.

    ↑ ↓ to move · Enter to open · Esc to close