7. Examples

Real-world usage examples for the Amadeus Protocol SDK.

Basic SDK Usage

Initialize SDK and Query Chain

import { AmadeusSDK } from '@amadeus-protocol/sdk'

const sdk = new AmadeusSDK({
	baseUrl: 'https://nodes.amadeus.bot/api'
})

// Get chain tip
const tip = await sdk.chain.getTip()
console.log('Current height:', tip.entry.height)
console.log('Chain hash:', tip.entry.hash)

// Get chain statistics
const stats = await sdk.chain.getStats()
console.log('Total entries:', stats.stats.total_entries)
console.log('Total transactions:', stats.stats.total_transactions)

Key Generation

Generate and Use Keypair

Wallet Operations

Check Balance

Get Transaction History

Transaction Building

Simple Token Transfer

Transfer with Confirmation

Custom Contract Call

Build Unsigned, Inspect, Then Sign

Contract Interactions

Read Contract Data

Validate Bytecode

Get Richlist

Encryption

Encrypt and Store Private Key

Error Handling

Comprehensive Error Handling

Complete Transaction Flow

End-to-End Transaction Example

Batch Operations

Submit Multiple Transactions

Next Steps

Last updated