Bridge USD₮0 EVM Guides
Installation, quick start, and usage examples for @tetherto/wdk-protocol-bridge-usdt0-evm
Installation
To install the @tetherto/wdk-protocol-bridge-usdt0-evm package, follow these instructions:
npm install @tetherto/wdk-protocol-bridge-usdt0-evmQuick Start
Setting Up a Bridge Protocol
import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
const account = new WalletAccountEvm(seedPhrase, {
provider: 'https://rpc.mevblocker.io/fast'
})
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n
})Basic Bridge Operation
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n
})
console.log('Bridge transaction hash:', result.hash)
console.log('Total fee:', result.fee, 'wei')
console.log('Bridge fee:', result.bridgeFee, 'wei')Getting Bridge Quotes
const quote = await bridgeProtocol.quoteBridge({
targetChain: 'polygon',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n
})
console.log('Estimated fee:', quote.fee, 'wei')
console.log('Bridge fee:', quote.bridgeFee, 'wei')Supported Chains
Source Chains (EVM)
| Chain | Chain ID |
|---|---|
| Ethereum | 1 |
| Arbitrum | 42161 |
| Optimism | 10 |
| Polygon | 137 |
| Berachain | 80094 |
| Ink | 57073 |
| Plasma | 9745 |
| Conflux eSpace | 1030 |
| Corn | 21000000 |
| Avalanche | 43114 |
| Celo | 42220 |
| Flare | 14 |
| HyperEVM | 999 |
| Mantle | 5000 |
| MegaETH | 4326 |
| Monad | 143 |
| Morph | 2818 |
| Rootstock | 30 |
| Sei | 1329 |
| Stable | 988 |
| Unichain | 130 |
| XLayer | 196 |
Destination Chains
All source chains above, plus:
| Chain | Endpoint ID (EID) |
|---|---|
| Solana | 30168 |
| TON | 30343 |
| TRON | 30420 |
Bridge Operations
Standard EVM Account
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n
})
console.log('Bridge hash:', result.hash)
console.log('Approve hash:', result.approveHash)
console.log('Reset allowance hash:', result.resetAllowanceHash)
console.log('Total fee:', result.fee)
console.log('Bridge fee:', result.bridgeFee)ERC-4337 Account
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n
}, {
paymasterToken: '0x...',
bridgeMaxFee: 1000000000000000n
})
console.log('Bridge hash:', result.hash)
console.log('Total fee:', result.fee)
console.log('Bridge fee:', result.bridgeFee)Non-EVM Destinations
Bridge to Solana
const result = await bridgeProtocol.bridge({
targetChain: 'solana',
recipient: 'SolanaRecipientAddress...',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n,
dstEid: 30168
})
console.log('Bridge to Solana hash:', result.hash)Bridge to TON
const result = await bridgeProtocol.bridge({
targetChain: 'ton',
recipient: 'TONRecipientAddress...',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n,
dstEid: 30343
})
console.log('Bridge to TON hash:', result.hash)Bridge to TRON
const result = await bridgeProtocol.bridge({
targetChain: 'tron',
recipient: 'TRONRecipientAddress...',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n,
dstEid: 30420
})
console.log('Bridge to TRON hash:', result.hash)BridgeOptions Overrides
You can override the OFT contract address and destination endpoint ID for custom routing:
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n,
oftContractAddress: '0x...', // Custom OFT contract address
dstEid: 30110 // Custom destination endpoint ID
})Error Handling
try {
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
token: '0xdac17f958d2ee523a2206206994597c13d831ec7',
amount: 1000000000000000000n
})
console.log('Bridge successful:', result.hash)
} catch (error) {
console.error('Bridge failed:', error.message)
if (error.message.includes('not supported')) {
console.log('Chain or token not supported')
}
if (error.message.includes('Exceeded maximum fee')) {
console.log('Bridge fee too high')
}
if (error.message.includes('insufficient funds')) {
console.log('Not enough tokens or gas')
}
}Complete Examples
Complete Bridge Setup
import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
async function setupBridge() {
const account = new WalletAccountEvm(seedPhrase, {
provider: 'https://rpc.mevblocker.io/fast'
})
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n
})
const address = await account.getAddress()
const balance = await account.getBalance()
console.log('Account:', address)
console.log('Balance:', balance, 'wei')
return { account, bridgeProtocol }
}Multi-Chain Bridge Example
async function bridgeToMultipleChains(bridgeProtocol) {
const chains = ['arbitrum', 'polygon', 'berachain']
const token = '0xdac17f958d2ee523a2206206994597c13d831ec7'
const amount = 1000000000000000000n
const recipient = '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6'
for (const chain of chains) {
try {
const quote = await bridgeProtocol.quoteBridge({
targetChain: chain,
recipient,
token,
amount
})
console.log(`Bridge to ${chain}:`)
console.log(' Fee:', quote.fee, 'wei')
console.log(' Bridge fee:', quote.bridgeFee, 'wei')
const result = await bridgeProtocol.bridge({
targetChain: chain,
recipient,
token,
amount
})
console.log(` Transaction hash: ${result.hash}`)
} catch (error) {
console.error(`Bridge to ${chain} failed:`, error.message)
}
}
}Bridge with Validation
async function bridgeWithValidation(bridgeProtocol, targetChain, recipient, token, amount) {
try {
const supportedChains = [
'ethereum', 'arbitrum', 'optimism', 'polygon', 'berachain', 'ink',
'solana', 'ton', 'tron'
]
if (!supportedChains.includes(targetChain)) {
throw new Error('Chain not supported')
}
if (!recipient.startsWith('0x') || recipient.length !== 42) {
throw new Error('Invalid recipient address')
}
if (!token.startsWith('0x') || token.length !== 42) {
throw new Error('Invalid token address')
}
const quote = await bridgeProtocol.quoteBridge({
targetChain,
recipient,
token,
amount
})
console.log('Bridge quote:')
console.log(' Fee:', quote.fee, 'wei')
console.log(' Bridge fee:', quote.bridgeFee, 'wei')
if (quote.fee + quote.bridgeFee > 1000000000000000n) {
throw new Error('Fees too high')
}
const result = await bridgeProtocol.bridge({
targetChain,
recipient,
token,
amount
})
console.log('Bridge successful:', result.hash)
return result
} catch (error) {
console.error('Bridge validation failed:', error.message)
throw error
}
}Node.js Quickstart
Get started with WDK in a Node.js environment
Configuration
Configure the Bridge USD₮0 EVM Protocol
API Reference
Complete API documentation for the bridge protocol