0.3.3 ⢠Published 4 months ago
radix-web3.js v0.3.3
Radix Web3.js
A collection of JavaScript/TypeScript packages for interacting with the Radix Network.
š See docs
Getting Started
npm install radix-web3.js
Quick Example
import { createEd25519KeyPair, createRadixWeb3Client } from 'radix-web3.js'
import { sendResourceManifest } from 'radix-web3.js/manifests'
import { fromPublicKey } from 'radix-web3.js/account'
// Create a new keypair
const keyPair = createEd25519KeyPair()
// Initialize the client
const web3Client = createRadixWeb3Client({
networkId: 'Stokenet',
notaryPublicKey: keyPair.publicKey(),
notarizer: (hash) => keyPair.signToSignature(hash),
})
// Get your account address
const accountAddress = await fromPublicKey(keyPair.publicKey(), 2) // 2 = Stokenet
// Send 1 XRD to another address
const { transactionId } = await web3Client.submitTransaction(
sendResourceManifest({
resourceAddress:
'resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc',
amount: '1',
fromAddress: accountAddress,
toAddress: 'account_tdx_2_12yf3qp4feqnw...',
}),
)
// Check your balances
const { fungibleTokens } = await web3Client.getBalances(accountAddress)
console.log('Balances:', fungibleTokens)