Skip to main content

ChainGate 1.2 — Avalanche, precise fee diagnostics & smarter gas estimates

· 4 min read

This release adds full Avalanche support and tightens fee estimation across UTXO and EVM with a new missingFunds field, a gasEstimationFailed flag, and far more realistic estimates for token and NFT transfers. EVM connectors can now also send several transactions back-to-back without colliding on the nonce.

We now support Avalanche

Avalanche joins Ethereum as a fully supported network — balances, transaction history, ERC-20 / ERC-721 / ERC-1155 token holdings, NFT metadata, fee estimation, broadcasting, and fiat conversion all work out of the box:

const cg = new ChainGate()
const avax = cg.connect(cg.networks.avalanche, wallet)

const { confirmed } = await avax.addressBalance()
console.log('AVAX balance:', confirmed.base(), confirmed.symbol)
console.log('AVAX → USD:', await confirmed.toCurrency('usd'))

const tx = await avax.transfer(cg.networks.avalanche.amount('0.5'), '0xRecipient...')
tx.setFee(tx.recommendedFees().normal)
await tx.signAndBroadcast()

There's a hosted Avalanche RPC URL too — cg.rpcUrls.avalanche — ready to plug into ethers.js, viem, or cg.networks.evmRpc().


missingFunds on every fee tier

Recommended fees now include a missingFunds field that tells you exactly how much extra you need to send the transaction at that fee — in satoshis on Bitcoin / Litecoin / Dogecoin / Bitcoin Cash, in wei on every EVM chain:

const tx = await ethereum.transfer(amount, '0xRecipient...')
const fees = tx.recommendedFees()

if (!fees.normal.enoughFunds) {
console.log('Need:', fees.normal.missingFunds, 'wei more')
}

No more guessing how short you are. This is everything you need to render a precise "add X more to send" prompt in your UI instead of a generic "insufficient funds" warning.


Realistic gas estimation for token & NFT transfers

When the wallet doesn't hold enough native coin to simulate a transaction, the on-chain gas estimator typically refuses to answer — and previous versions fell back to the bare 21 000 minimum, which made enoughFunds and missingFunds look artificially close.

1.2 ships per-call-type fallbacks for the common cases — ERC-20 transfer / approve, ERC-721 / ERC-1155 safeTransferFrom, setApprovalForAll, and so on — so the numbers you see for token and NFT transfers are realistic even when the wallet is empty. When the heuristic kicks in, you'll see it explicitly:

const fees = tx.recommendedFees()

if (fees.normal.gasEstimationFailed) {
console.log('On-chain estimation failed; using heuristic')
}
console.log('Realistic missing funds:', fees.normal.missingFunds)

Works the same way on Ethereum, Avalanche, and any EVM chain reached via cg.networks.evmRpc().


Send several EVM transactions back-to-back

You can now broadcast multiple EVM transactions in quick succession without worrying about reusing the same nonce:

const eth = cg.connect(cg.networks.ethereum, wallet)

const tx1 = await eth.transfer(cg.networks.ethereum.amount('0.01'), '0xRecipientA...')
await tx1.signAndBroadcast()

// Sent right away — picks the next nonce automatically
const tx2 = await eth.transfer(cg.networks.ethereum.amount('0.02'), '0xRecipientB...')
await tx2.signAndBroadcast()

ChainGate tracks the next nonce per address and chain, so transactions still sitting in the mempool don't fight for the same slot. The same behaviour applies to every EVM chain — Ethereum, Avalanche, and any custom EVM RPC network.

If you need the value yourself, every EVM explorer now exposes getNonce(address):

const nonce = await cg.explore(cg.networks.ethereum).getNonce('0xYourAddress...')

Highlights

ChangeDescription
Avalanche full supportBalances, history, tokens, NFTs, fees, broadcast, fiat — plus cg.rpcUrls.avalanche
missingFundsExact amount short on every UTXO and EVM fee tier
gasEstimationFailedFlag on EVM fees when on-chain estimation fell back to a heuristic
Smarter gas fallbacksRealistic estimates for ERC-20 / ERC-721 / ERC-1155 sends
In-flight noncesMultiple back-to-back EVM broadcasts pick the next nonce automatically
getNonce(address)New method on EVM explorers for the next-nonce-to-use
npm install chaingate@latest

new ChainGate() also works without an API key now — handy for quick demos and scripts. See the getting started guide for the details.

Star us on GitHub and join the Discord to tell us what you're building.