Simple Bridge
This example demonstrates how to execute a basic bridge transaction, moving USDC from Arbitrum to Hyperliquid’s HyperEVM chain.Overview
The simplest bridge flow involves three steps:- Initialize the Mina SDK
- Get a quote for the bridge
- Execute the bridge with a wallet signer
Prerequisites
Before starting, ensure you have:- Installed the Mina SDK and viem
- A wallet with USDC on Arbitrum
- Basic understanding of TypeScript/JavaScript async patterns
Complete Example
Step-by-Step Breakdown
1
Initialize the SDK
Create a new Mina instance with your integrator name. The
autoDeposit option controls whether bridged funds are automatically deposited to your Hyperliquid L1 trading account.2
Set up the wallet signer
The SDK requires a signer that implements
sendTransaction, getAddress, and getChainId. This example uses viem, but any compatible wallet library works.3
Get a bridge quote
Request a quote specifying the source chain, destination chain, tokens, and amount. The quote includes estimated output, fees, and execution time.
4
Execute the bridge
Execute the quote with the signer. Use callbacks to track progress in real-time.
5
Handle the result
Check the execution result and handle success or failure appropriately.
Status Callbacks
Theexecute method accepts two callback functions for monitoring progress:
onStepChange
Called when individual steps (approval, swap, bridge, deposit) change status.onStatusChange
Called when the overall transaction status changes.Common Token Addresses
Always verify token addresses before executing transactions. The SDK’s
getTokens() method returns verified token addresses for each chain.Next Steps
Token Selection
Build a UI for selecting chains and tokens
Quote Display
Display detailed quote information
Error Handling
Handle errors gracefully
Full Integration
Complete bridge widget example
