Bridge USD₮0 EVM Configuration
Configuration options and settings for @tetherto/wdk-protocol-bridge-usdt0-evm
Bridge Protocol Configuration
The Usdt0ProtocolEvm accepts a configuration object that defines how the bridge protocol works:
import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'
const account = new WalletAccountEvm(seedPhrase, {
provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'
})
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n
})Account Configuration
The bridge protocol uses the wallet account's configuration for blockchain access:
import { WalletAccountEvm, WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'
// Full access account
const account = new WalletAccountEvm(
seedPhrase,
"0'/0/0",
{
provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key',
transferMaxFee: 100000000000000
}
)
// Read-only account
const readOnlyAccount = new WalletAccountReadOnlyEvm(
'0x...',
{
provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'
}
)
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n
})Configuration Options
Bridge Max Fee
The bridgeMaxFee option sets a maximum limit for total bridge costs to prevent unexpectedly high fees.
Type: bigint (optional)
Unit: Wei (1 ETH = 1000000000000000000 Wei)
Examples:
const config = {
bridgeMaxFee: 1000000000000000n,
}
try {
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n
})
} catch (error) {
if (error.message.includes('Exceeded maximum fee')) {
console.error('Bridge cancelled: Fee too high')
}
}Provider
The provider option comes from the wallet account configuration and specifies how to connect to the blockchain.
Type: string | Eip1193Provider
Examples:
// Option 1: Using RPC URL
const account = new WalletAccountEvm(seedPhrase, {
provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'
})
// Option 2: Using browser provider (e.g., MetaMask)
const account = new WalletAccountEvm(seedPhrase, {
provider: window.ethereum
})
// Option 3: Using custom JsonRpcProvider
import { JsonRpcProvider } from 'ethers'
const account = new WalletAccountEvm(seedPhrase, {
provider: new JsonRpcProvider('https://eth-mainnet.g.alchemy.com/v2/your-api-key')
})ERC-4337 Configuration
When using ERC-4337 accounts, you can override configuration options during bridge operations:
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n
}, {
paymasterToken: '0x...',
bridgeMaxFee: 1000000000000000n
})Paymaster Token
The paymasterToken option specifies which token to use for paying gas fees in ERC-4337 accounts.
Type: string (optional)
Format: Token contract address
Example:
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n
}, {
paymasterToken: '0x...'
})Network Support
The bridge protocol works with EVM-compatible networks. Change the provider URL in the wallet account configuration:
// Ethereum Mainnet
const ethereumAccount = new WalletAccountEvm(seedPhrase, {
provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'
})
// Arbitrum
const arbitrumAccount = new WalletAccountEvm(seedPhrase, {
provider: 'https://arb1.arbitrum.io/rpc'
})
// Polygon
const polygonAccount = new WalletAccountEvm(seedPhrase, {
provider: 'https://polygon-rpc.com'
})Bridge Options
When calling the bridge method, you need to provide bridge options:
const bridgeOptions = {
targetChain: 'arbitrum',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n,
oftContractAddress: '0x...', // Optional: custom OFT contract
dstEid: 30110 // Optional: custom destination endpoint ID
}
const result = await bridgeProtocol.bridge(bridgeOptions)Target Chain
The targetChain option specifies which blockchain to bridge tokens to.
Type: string
Supported values: 'ethereum', 'arbitrum', 'optimism', 'polygon', 'berachain', 'ink', 'plasma', 'conflux', 'corn', 'avalanche', 'celo', 'flare', 'hyperevm', 'mantle', 'megaeth', 'monad', 'morph', 'rootstock', 'sei', 'stable', 'unichain', 'xlayer', 'solana', 'ton', 'tron'
Recipient
The recipient option specifies the address that will receive the bridged tokens.
Type: string
Format: Valid address for the target chain
Token
The token option specifies which token contract to bridge.
Type: string
Format: Token contract address on the source chain
Amount
The amount option specifies how many tokens to bridge.
Type: bigint
Unit: Base units of the token (e.g., for USD₮: 1 USD₮ = 1000000n)
OFT Contract Address
The oftContractAddress option overrides the default OFT (Omnichain Fungible Token) contract address used for the bridge operation.
Type: string (optional)
Format: Contract address on the source chain
Example:
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n,
oftContractAddress: '0x1234...' // Custom OFT contract
})Destination Endpoint ID
The dstEid option overrides the default LayerZero destination endpoint ID for the target chain.
Type: number (optional)
Example:
const result = await bridgeProtocol.bridge({
targetChain: 'solana',
recipient: 'SolanaRecipientAddress...',
token: '0x...',
amount: 1000000000000000000n,
dstEid: 30168 // Solana endpoint ID
})Error Handling
The bridge protocol will throw errors for invalid configurations:
try {
const result = await bridgeProtocol.bridge({
targetChain: 'invalid-chain',
recipient: '0x...',
token: '0x...',
amount: 1000000000000000000n
})
} catch (error) {
if (error.message.includes('not supported')) {
console.error('Chain or token not supported')
}
if (error.message.includes('Exceeded maximum fee')) {
console.error('Bridge fee too high')
}
if (error.message.includes('must be connected to a provider')) {
console.error('Wallet not connected to blockchain')
}
}Node.js Quickstart
Get started with WDK in a Node.js environment
API Reference
Complete API documentation for the bridge protocol
Usage
Installation, quick start, and usage examples