import { getBalance } from '@bigmi/core'
async function checkBalance(address: string) {
const balance = await getBalance(client, { address })
console.log('Balance:', balance)
}
import { getTransaction } from '@bigmi/core'
async function getTx(txId: string) {
const tx = await getTransaction(client, { txId })
console.log('Transaction:', tx)
}
import { getBlockCount } from '@bigmi/core'
async function getBlockInfo() {
const blockCount = await getBlockCount(client)
console.log('Current block:', blockCount)
}
import { sendUTXOTransaction } from '@bigmi/core'
async function sendTx(hex: string) {
try {
const txId = await sendUTXOTransaction(client, { hex })
console.log('Transaction sent:', txId)
} catch (error) {
console.error('Transaction failed:', error)
}
}
import { waitForTransaction } from '@bigmi/core'
async function waitForTx(txId: string, txHex: string) {
const tx = await waitForTransaction(client, {
txId,
txHex,
onReplaced: (response) => {
console.log('Transaction replaced:', response.reason)
},
})
console.log('Transaction confirmed:', tx)
}
import { sendUTXOTransaction, waitForTransaction } from '@bigmi/core'
async function sendAndWait(txHex: string) {
try {
const txId = await sendUTXOTransaction(client, { hex: txHex })
const tx = await waitForTransaction(client, {
txId,
txHex,
onReplaced: (response) => {
console.log('Transaction replaced:', response.reason)
},
})
console.log('Transaction confirmed:', tx)
} catch (error) {
console.error('Error:', error)
}
}
⬅️ back