Getting Started
Altitrace SDK for HyperEVM transaction simulation and tracing.
Installation
bun add @altitrace/sdkUsage
example.ts
import { AltitraceClient } from '@altitrace/sdk'
const client = new AltitraceClient({
baseUrl: 'https://api.altitrace.reachaltitude.xyz/v1'
})
const result = await client.simulate().call({
from: '0xA79C12BCf11133af01b6B20f16F8AafAECdEBC93',
to: '0x3aD2674e162A3bdA4be608C75d52f4B18C729193',
value: '0x40000',
}).atBlock(12026976).execute()
console.log('Gas used:', result.getTotalGasUsed())
console.log('Success:', result.isSuccess())Core Features
Simulation
Simulate transactions to predict execution results and gas usage.
const result = await client.simulateCall({
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
data: '0x095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d0000000000000000000000000000000000000000000000000000000000000064'
})Tracing
Analyze transaction execution with multiple trace types.
const trace = await client.traceCall({
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
data: '0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f06e8c'
}, {
callTracer: true,
prestateTracer: true
})Access Lists
Generate optimized access lists for EIP-2930 transactions.
const accessList = await client.generateAccessList({
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
data: '0xa9059cbb0000000000000000000000001234567890123456789012345678901234567890000000000000000000000000000000000000000000000000000000000000000a'
})
console.log('Access List:', accessList.accessList)
console.log('Gas Used:', accessList.gasUsed)Builder Pattern API
For complex simulations, use the builder pattern.
const result = await client.simulate()
.call({
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
data: '0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f06e8c'
})
.forAccount('0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c')
.withAssetChanges(true)
.atBlock('latest')
.execute()Batch Operations
Process multiple simulations efficiently.
const results = await client.simulateBatchAPI([
{
params: {
calls: [{
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
data: '0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f06e8c'
}],
blockNumber: '0x1234567'
},
options: null
},
{
params: {
calls: [{
from: '0x742d35Cc6634C0532925a3b844Bc9e7595f06e8c',
to: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
data: '0x70a08231000000000000000000000000742d35cc6634c0532925a3b844bc9e7595f06e8c'
}],
blockNumber: '0x1234567'
},
options: null
}
])