blockchain-api
Version:
API utilities for interacting with the Exatechl2 blockchain
29 lines (23 loc) • 884 B
text/typescript
import { search, setExplorerApiUrl } from '../src';
// Anda bisa mengkonfigurasi URL API jika berbeda dari default
// setExplorerApiUrl('http://localhost:3001/api');
async function main() {
try {
// Contoh 1: Pencarian blok
console.log('Mencari blok nomor 100:');
const blockResult = await search('100');
console.log(blockResult);
// Contoh 2: Pencarian transaksi
console.log('\nMencari transaksi:');
const txResult = await search('0x3401bb89ec6425b40e8eab44a0ef7dea98ee1785abea0a1a6dfaa3b37832035a');
console.log(txResult);
// Contoh 3: Pencarian alamat
console.log('\nMencari alamat:');
const address = '0x6E42037c19884Ec54Ee5C290fa2987FdeE03073C';
const addressResult = await search(address);
console.log(addressResult);
} catch (error) {
console.error('Error in search example:', error);
}
}
main();