Files

59 lines
1.4 KiB
Markdown
Raw Permalink Normal View History

2026-01-01 08:04:06 -08:00
# @dbis-thirdweb/bridge
Bridge routes and execution for Chain 138.
## Usage
### Get Supported Routes
```typescript
import { getSupportedRoutes, isRouteSupported } from '@dbis-thirdweb/bridge';
const routes = getSupportedRoutes();
const isSupported = isRouteSupported(1, 138); // Ethereum to Chain 138
```
### Generate Bridge Quote
```typescript
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
```typescript
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