⚠️ NOTEThe AppchainBridge component is alpha release software and is provided AS-IS. Use at your own risk.
Usage
Create a custom chain for your appchain using Viem’s defineChain, then add it to your Wagmi configuration.Appchain
object. You can also render an icon in the UI using the icon
prop.
AppchainBridge
component with the chain
and appchain
props.
Custom Bridgeable Tokens
By default, only native ETH is bridgeable. Add custom tokens using thebridgeableTokens
prop:
⚠️ What is remoteToken?The
remoteToken
field represents the token address on the appchain you’re bridging to.ERC-20 tokens on the appchain must comply to the IOptimismMintableERC20
interface to be bridgeable.Follow the Optimism documentation to retrieve the remoteToken
address for your ERC-20 token.customBridgeableTokens
into the AppchainBridge
component with the bridgeableTokens
prop.
Custom Gas Tokens
For chains using custom gas tokens, setisCustomGasToken: true
:
Custom Price Fetching
OverridehandleFetchPrice
to fetch prices for custom tokens. Called whenever the user changes the input amount:
Components
AppchainBridge
- Complete bridge interface for deposits and withdrawalsAppchainBridgeProvider
- Headless provider for bridge contextAppchainBridgeInput
- Amount input componentAppchainBridgeNetwork
- Network selection and displayAppchainBridgeTransactionButton
- Transaction trigger buttonAppchainBridgeWithdraw
- Withdrawal interfaceAppchainNetworkToggleButton
- Network toggle buttonAppchainBridgeSuccess
- Success state displayAppchainBridgeResumeTransaction
- Resume interrupted transactions