1.4 KiB
1.4 KiB
@dbis-thirdweb/bridge
Bridge routes and execution for Chain 138.
Usage
Get Supported Routes
import { getSupportedRoutes, isRouteSupported } from '@dbis-thirdweb/bridge';
const routes = getSupportedRoutes();
const isSupported = isRouteSupported(1, 138); // Ethereum to Chain 138
Generate Bridge Quote
import { generateBridgeQuote, getAllBridgeableTokens } from '@dbis-thirdweb/bridge';
import { ethers } from 'ethers';
const tokens = getAllBridgeableTokens();
const nativeToken = tokens.find(t => t.isNative);
const quote = await generateBridgeQuote({
fromChainId: 1,
toChainId: 138,
token: nativeToken!,
amount: ethers.utils.parseEther('0.1'),
slippageBps: 50, // 0.5%
});
Execute Bridge
import { executeBridge, getBridgeStatus } from '@dbis-thirdweb/bridge';
const status = await executeBridge(quote, signer, provider);
// Poll for status
const finalStatus = await getBridgeStatus(status.sourceTxHash, provider);
Features
- Canonical chain mapping for Chain 138
- Supported routes configuration
- Token lists (native, wrapped, stablecoins)
- Quote generation with slippage protection
- Bridge execution helpers
- Status tracking and finality checks
Notes
- This implementation uses simplified bridge logic
- In production, integrate with thirdweb Bridge SDK or bridge provider APIs
- Token addresses need to be configured for Chain 138's actual deployed tokens