For the complete documentation index, see llms.txt. This page is also available as Markdown.

Examples

This guide provides practical examples using the Bloxchain TypeScript SDK. Contract API is defined by the Solidity source; see generated contract API for NatSpec output.

πŸš€ Setup Examples

Basic Client Setup

import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet, goerli } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

// Public client for read operations
const publicClient = createPublicClient({
  chain: mainnet,
  transport: http('https://eth-mainnet.alchemyapi.io/v2/your-api-key')
})

// Wallet client for write operations
const account = privateKeyToAccount('0x...') // Your private key
const walletClient = createWalletClient({
  account,
  chain: mainnet,
  transport: http('https://eth-mainnet.alchemyapi.io/v2/your-api-key')
})

// Testnet setup
const testnetClient = createPublicClient({
  chain: goerli,
  transport: http('https://eth-goerli.alchemyapi.io/v2/your-api-key')
})

Contract Instance Creation

πŸ“– SecureOwnable Examples

Reading Contract State

Ownership Transfer Workflow

Administrative Updates

Getting Function Schemas

Getting Role Permissions

Utility Methods

Configuration

πŸ“‘ Event Monitoring Examples

Contracts emit ComponentEvent(bytes4 functionSelector, bytes data). Decode data based on functionSelector. See generated contract API for payload layouts.

SecureOwnable / RuntimeRBAC Events

πŸ§ͺ Complete Example: Contract Manager


Last updated

Was this helpful?