A simple TypeScript library for interacting with the Radius network. Built on viem.
Check balances, send tokens, request faucet funds, deploy contracts, and interact with smart contracts.
npm install viem
# Generate a new key
node -e "import('viem/accounts').then(m => console.log(m.generatePrivateKey()))"
# Set your private key
export RADIUS_PRIVATE_KEY=0x...import { RadiusWallet } from "./src/index.js";
const wallet = RadiusWallet.fromEnv();
console.log(await wallet.getBalances());// From private key
const wallet = new RadiusWallet("0xYOUR_PRIVATE_KEY");
// Generate new wallet
const wallet = RadiusWallet.create();
console.log(wallet.address);
// From environment variable (RADIUS_PRIVATE_KEY)
const wallet = RadiusWallet.fromEnv();
// Use mainnet
const wallet = new RadiusWallet("0x...", { chain: "mainnet" });await wallet.getRusdBalance(); // Your RUSD balance
await wallet.getSbcBalance(); // Your SBC balance
await wallet.getBalances(); // Both as { address, rusd, sbc }
await wallet.getSbcBalance("0x1234..."); // Someone else's balance// Send SBC (amounts are strings, decimals handled automatically)
const hash = await wallet.sendSbc("0xRecipient", "1.5");
// Send RUSD (native token)
const hash = await wallet.sendRusd("0xRecipient", "0.001");
// Wait for confirmation
const receipt = await wallet.waitForTx(hash);
console.log(receipt.status); // "success" or "reverted"
console.log(wallet.explorerUrl(hash));const receipt = await wallet.getTxReceipt(hash);
const receipt = await wallet.waitForTx(hash); // Waits for confirmation
wallet.explorerUrl(hash); // Link to block explorerconst result = await wallet.requestFaucet(); // Requests SBC from testnet faucetrequestFaucet() is testnet-only and throws when the wallet is configured for mainnet.
import MyContract from "./artifacts/MyContract.json";
const result = await wallet.deployContract(
MyContract.abi,
MyContract.bytecode as `0x${string}`,
[constructorArg1, constructorArg2] // optional
);
console.log(result.address);
console.log(result.txHash);const count = await wallet.readContract(
"0xContractAddress",
counterAbi,
"getCount"
);const hash = await wallet.writeContract(
"0xContractAddress",
erc20Abi,
"transfer",
["0xRecipient", 1000000n]
);
const receipt = await wallet.waitForTx(hash);| Testnet | Mainnet | |
|---|---|---|
| RPC | https://rpc.testnet.radiustech.xyz |
https://rpc.radiustech.xyz |
| Chain ID | 72344 | 723487 |
| Explorer | https://testnet.radiustech.xyz |
https://network.radiustech.xyz |
Tokens:
- RUSD — Native token, 18 decimals (used for gas)
- SBC — ERC-20 stablecoin, 6 decimals, at
0x33ad9e4BD16B69B5BFdED37D8B5D9fF9aba014Fb
Things to know:
- Gas price is fixed (~1 gwei). No EIP-1559, no priority fees.
- Block numbers are timestamps in milliseconds (not sequential).
- Sub-second finality — no reorgs possible.
- Failed transactions don't charge gas.
import {
radiusTestnet, // viem Chain definition
radiusMainnet, // viem Chain definition
SBC_ADDRESS, // SBC token contract address
SBC_DECIMALS, // 6
RUSD_DECIMALS, // 18
ERC20_ABI, // Minimal ERC-20 ABI
} from "./src/index.js";See the examples/ directory:
check-balance.ts— Query balancessend-sbc.ts— Send an SBC transferrequest-faucet.ts— Get testnet tokens
Run with: npx tsx examples/check-balance.ts
This library uses a local private key for signing. For production, use a managed signing service like Privy. See the Nanda Wallet Concierge for an example.