JavaScript
1
In your project folder, create a minimal package.json
file:
{
"name": "radius-quickstart",
"version": "1.0.0",
"type": "commonjs",
"dependencies": {
"@radiustechsystems/sdk": "^1.0.0"
}
}
2
Install the Radius TypeScript SDK:
npm i @radiustechsystems/sdk
3
Create a TypeScript file called index.js
:
const {
AddressFromHex,
NewClient,
NewAccount,
withPrivateKey,
} = require('@radiustechsystems/sdk');
// Replace the following values with your own
const RADIUS_ENDPOINT = "https://rpc.testnet.radiustech.xyz/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const PRIVATE_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
async function main() {
const client = await NewClient(RADIUS_ENDPOINT);
const account = await NewAccount(withPrivateKey(PRIVATE_KEY, client));
const recipient = AddressFromHex('0x...'); // Replace with recipient address
const amount = BigInt(100);
const receipt = await account.send(client, recipient, amount);
console.log('Transaction hash:', receipt.txHash.hex());
}
main().catch(console.error);
4
Compile and run the code using the following command:
node index.js
Last updated
Was this helpful?