SDKs

Official client libraries for JavaScript and Python. Both SDKs provide typed methods for every API endpoint, automatic retries, and error handling.

JavaScript / TypeScript

Works in Node.js 18+ and modern browsers. Ships with full TypeScript type definitions.

Installbash
npm install @merx/sdk
Quickstartjavascript
import { MerxClient } from '@merx/sdk'

const merx = new MerxClient({ apiKey: 'sk_live_your_key_here' })

const prices = await merx.getPrices()
console.log(prices)

const order = await merx.createOrder({
  resourceType: 'ENERGY',
  amount: 65000,
  durationSec: 86400,
  targetAddress: 'TYourTargetAddressHere',
})
console.log(order.id, order.status)

Available methods

MethodDescription
getPrices()Get all provider prices
getBalance()Get TRX and USDT balance
createOrder(params)Create energy or bandwidth order
getOrder(id)Get order details with fills
listOrders(filters?)List orders with optional filters
getHistory(params?)Transaction history
withdraw(params)Initiate TRX withdrawal
getDeposit()Get deposit address

Python

Requires Python 3.9+. Async support via an optional async client.

Installbash
pip install merx-sdk
Quickstartpython
from merx_sdk import MerxClient

merx = MerxClient(api_key="sk_live_your_key_here")

prices = merx.get_prices()
print(prices)

order = merx.create_order(
    resource_type="ENERGY",
    amount=65000,
    duration_sec=86400,
    target_address="TYourTargetAddressHere",
)
print(order.id, order.status)

Available methods

MethodDescription
get_prices()Get all provider prices
get_balance()Get TRX and USDT balance
create_order(**params)Create energy or bandwidth order
get_order(id)Get order details with fills
list_orders(**filters)List orders with optional filters
get_history(**params)Transaction history
withdraw(**params)Initiate TRX withdrawal
get_deposit()Get deposit address