Multi chain
The Moromoro SDK supports multiple blockchain networks. This guide shows how to use the SDK across different chains.
Supported Networks
Network
Chain ID
Native Token
Example RPC
HyperEVM
-
HYPE
https://rpc.hyperliquid.xyz/evm
BSC
56
BNB
https://bsc-dataseed.binance.org
Ethereum
1
ETH
Your RPC URL
Polygon
137
MATIC
https://polygon-rpc.com
Arbitrum
42161
ETH
https://arb1.arbitrum.io/rpc
Avalanche
43114
AVAX
https://api.avax.network/ext/bc/C/rpc
Optimism
10
ETH
https://mainnet.optimism.io
HyperEVM Example
const { MoroBestRate } = require('@moromoro/moro-sdk')
const { ethers } = require('ethers')
async function swapOnHyperEVM() {
const provider = new ethers.providers.JsonRpcProvider(
'https://rpc.hyperliquid.xyz/evm'
)
const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
const moroClient = new MoroBestRate(provider, 'hyperevm')
const HYPE = '0x5555555555555555555555555555555555555555'
const USDT = '0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb'
const amountIn = ethers.utils.parseUnits('10', 18)
const gasPrice = ethers.BigNumber.from('5000000000') // 5 gwei
const quote = await moroClient.getQuote(HYPE, USDT, amountIn, gasPrice)
const minOut = ethers.BigNumber.from(quote.amountOut).mul(99).div(100)
const tx = await moroClient.swap(signer, HYPE, USDT, amountIn, minOut, quote)
await tx.wait()
console.log('✓ Swapped on HyperEVM')
}
swapOnHyperEVM()BSC Example
Polygon Example
Arbitrum Example (L2)
For L2 chains like Arbitrum and Optimism, you need to provide L2 gas price.
Optimism Example (L2)
Avalanche Example
Multi-Chain Manager
Utility class to manage swaps across multiple chains.
Getting Network Gas Prices
Network-Specific Configurations
Best Practices
1
2
3
4
See Also
Simple Swap Examples
Split Trading Examples