RadixTransactionBuilder
TheRadixTransactionBuilder class provides low-level transaction construction capabilities for the Radix network. It creates transaction manifests and handles transaction compilation using the Radix Engine Toolkit.
Constructor
RadixTransactionBuilderConfig
Core Transaction Building
buildCustomManifestTransaction(manifest: string, signerPrivateKey: PrivateKey, currentEpoch: number, message?: string): Promise<TransactionResult>
Build a transaction from a custom manifest string.buildTransferTransaction(options: TransferOptions, fromAccountPrivateKey: PrivateKey, currentEpoch: number): Promise<Uint8Array>
Build a simple transfer transaction.buildFaucetTransaction(toAccount: string, currentEpoch: number): Promise<Uint8Array>
Build a faucet transaction for testnet funding.Manifest Creation
createTransferManifest(fromAccount: string, toAccount: string, resourceAddress: string, amount: string | number): string
Create a transfer manifest string.createTokenManifest(ownerAccount: string, tokenName: string, tokenSymbol: string, initialSupply: string | number, divisibility?: number): string
Create a fungible token creation manifest.ownerAccount- Account that will own the tokentokenName- Display name for the tokentokenSymbol- Token symbol (e.g., “GAME”)initialSupply- Initial token supplydivisibility- Number of decimal places (default: 18)
createStakeManifest(accountAddress: string, validatorAddress: string, amount: string | number): string
Create a staking manifest.Utility Methods
getCompiledTransactionHex(transaction: Uint8Array): string
Convert compiled transaction to hex string for Gateway submission.prevalidate(transaction: Uint8Array): Promise<boolean>
Basic validation of transaction bytes.deriveAccountAddress(publicKey: PublicKey): Promise<string>
Derive account address from public key.isValidAddress(address: string): boolean
Validate address format for current network.Network Information
getXRDResourceAddress(): string
Get XRD resource address for current network.getNetworkId(): number
Get numeric network ID.getRadixNetwork(): RadixNetwork
Get RadixNetwork enum value.Static Utilities
createPrivateKeyFromHex(hexString: string, keyType?: ‘Ed25519’ | ‘Secp256k1’): PrivateKey
Create PrivateKey instance from hex string.Type Definitions
SignableTransactionIntent
SignedTransaction
TransferOptions
Usage Examples
Basic Transfer Transaction
Token Creation
Staking Transaction
Address Validation
Custom Manifest
Error Handling
Integration with Other Components
With RadixAgent
With Wallet
Best Practices
- Validate Inputs: Always validate addresses and amounts before building transactions
- Current Epoch: Use fresh epoch data for transaction validity
- Fee Management: Include appropriate fees in manifests (typically 10 XRD)
- Error Handling: Implement comprehensive error handling for transaction building
- Testing: Test manifests on Stokenet before mainnet deployment
- Security: Never expose private keys in logs or error messages
Manifest Syntax
Transaction manifests use a specific syntax:CALL_METHOD- Call a method on a component/accountTAKE_ALL_FROM_WORKTOP- Take resources from worktopCALL_FUNCTION- Call a blueprint functionCREATE_FUNGIBLE_RESOURCE- Create new fungible tokenAddress("...")- Reference an addressDecimal("...")- Specify decimal amountsBucket("name")- Reference a bucket