Note: This package is currently in beta. Please test thoroughly in development environments before using in production.
A bridge module for WDK (Wallet Development Kit) by Tether that lets EVM wallet accounts move USD₮0 tokens across supported blockchains. This package provides a clean SDK for moving tokens between EVM-compatible chains using the LayerZero protocol and USD₮0 bridge system with support for both standard wallets and ERC-4337 smart accounts.
This module can be managed by the @tetherto/wdk package, which provides a unified interface for managing multiple WDK wallet and protocol modules across different blockchains.
This module is part of the WDK (Wallet Development Kit) project, which empowers developers to build secure, non-custodial wallets with unified blockchain access, stateless architecture, and complete user control.
For detailed documentation about the complete WDK ecosystem, visit docs.wdk.tether.io.
🌟 Features
Cross-Chain Bridge: Move USDT0 and XAUt0 tokens between supported blockchains
LayerZero Integration: Uses LayerZero protocol for secure cross-chain transfers
Multi-Chain Support: Bridge across 25+ networks including Ethereum, Arbitrum, Optimism, Polygon, Berachain, Monad, and more
Non-EVM Destinations: Bridge to Solana, TON, and TRON from any supported EVM source chain
Account Abstraction: Works with both standard EVM wallets and ERC-4337 smart accounts
Fee Management: Built-in fee calculation and bridge cost estimation
Token Support: Supports USDT0 and XAUt0 (Tether Gold) across supported networks
TypeScript Support: Full TypeScript definitions included
Memory Safety: Secure transaction handling with proper error management
Provider Flexibility: Works with JSON-RPC URLs and EIP-1193 browser providers
⬇️ Installation
To install the @tetherto/wdk-protocol-bridge-usdt0-evm package, follow these instructions:
Before calling bridge(), approve the source-chain bridge spender for the token and amount you want to bridge. When you pass oftContractAddress, use that same address as the approval spender. Some providers also require allowance before quoteBridge() because fee quoting estimates the bridge send transaction.
Option 1: Using with WDK Core (Recommended)
import WDK from '@tetherto/wdk'import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'// Create WDK instance with EVM wallet supportconst wdk = new WDK(seedPhrase) .registerWallet('ethereum', WalletManagerEvm, { provider: 'https://ethereum-rpc.publicnode.com' }) .registerWallet('arbitrum', WalletManagerEvm, { provider: 'https://arb1.arbitrum.io/rpc' }) .registerProtocol('ethereum', 'usdt0', Usdt0ProtocolEvm, { bridgeMaxFee: 100000000000000 // 0.0001 ETH in wei })// Get account with bridge protocolconst account = await wdk.getAccount('ethereum', 0)const usdt0Bridge = account.getBridgeProtocol('usdt0')const USDT_TOKEN_ADDRESS = 'USDT_TOKEN_ADDRESS'const USDT0_OFT_ADDRESS = 'OFT_CONTRACT_ADDRESS'const amount = 1000000n // 1 USDT (6 decimals)// Approve the source-chain bridge spender before bridgingawait account.approve({ token: USDT_TOKEN_ADDRESS, spender: USDT0_OFT_ADDRESS, amount})// Perform bridgeconst result = await usdt0Bridge.bridge({ targetChain: 'arbitrum', recipient: 'RECIPIENT_ADDRESS', token: USDT_TOKEN_ADDRESS, amount, oftContractAddress: USDT0_OFT_ADDRESS})
Use the source-chain OFT or bridge contract as the approval spender. Find current token and bridge contract addresses in the USDT0 deployments. For the route mapping used by this package, see src/config.js, especially oftContract, legacyMeshContract, and xautOftContract.
Option 2: Direct Usage
Creating a New Bridge Service
import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'// Use a BIP-39 seed phrase (replace with your own secure phrase)const seedPhrase = 'test only example nut use this real life secret phrase must random'// Create wallet account with provider configconst account = new WalletAccountEvm(seedPhrase, "0'/0/0", { provider: 'https://ethereum-rpc.publicnode.com'})// Create bridge service with configurationconst bridgeProtocol = new Usdt0ProtocolEvm(account, { bridgeMaxFee: 100000000000000n // Optional: Maximum bridge fee in wei})// OR for ERC-4337 smart accountsimport { WalletAccountEvmErc4337 } from '@tetherto/wdk-wallet-evm-erc-4337'// Create ERC-4337 accountconst smartAccount = new WalletAccountEvmErc4337(seedPhrase, "0'/0/0", { provider: 'https://arb1.arbitrum.io/rpc', bundlerUrl: 'YOUR_BUNDLER_URL', paymasterUrl: 'YOUR_PAYMASTER_URL'})// Create bridge service for smart accountconst smartBridgeProtocol = new Usdt0ProtocolEvm(smartAccount, { bridgeMaxFee: 100000000000000n})
Basic Cross-Chain Bridging
const USDT_TOKEN_ADDRESS = 'USDT_TOKEN_ADDRESS'const ETHEREUM_OFT_ADDRESS = 'ETHEREUM_OFT_CONTRACT_ADDRESS'const ARBITRUM_OFT_ADDRESS = 'ARBITRUM_OFT_CONTRACT_ADDRESS'// Bridge USDT from Ethereum to Arbitrumawait account.approve({ token: USDT_TOKEN_ADDRESS, spender: ETHEREUM_OFT_ADDRESS, amount: 1000000n})const result = await bridgeProtocol.bridge({ targetChain: 'arbitrum', // Where to send tokens recipient: 'RECIPIENT_ADDRESS', // Who gets the tokens on target chain token: USDT_TOKEN_ADDRESS, // USDT token address on source chain amount: 1000000n, // Amount to bridge (1 USDT with 6 decimals) oftContractAddress: ETHEREUM_OFT_ADDRESS})console.log('Bridge transaction hash:', result.hash)console.log('Total fee:', result.fee, 'wei')console.log('Bridge fee:', result.bridgeFee, 'wei')// Bridge from Arbitrum to Ethereumawait account.approve({ token: USDT_TOKEN_ADDRESS, spender: ARBITRUM_OFT_ADDRESS, amount: 5000000n})const reverseResult = await bridgeProtocol.bridge({ targetChain: 'ethereum', recipient: 'RECIPIENT_ADDRESS', token: USDT_TOKEN_ADDRESS, amount: 5000000n, // 5 USDT oftContractAddress: ARBITRUM_OFT_ADDRESS})// Bridge to Polygonawait account.approve({ token: USDT_TOKEN_ADDRESS, spender: ETHEREUM_OFT_ADDRESS, amount: 10000000n})const polygonResult = await bridgeProtocol.bridge({ targetChain: 'polygon', recipient: 'RECIPIENT_ADDRESS', token: USDT_TOKEN_ADDRESS, amount: 10000000n, // 10 USDT oftContractAddress: ETHEREUM_OFT_ADDRESS})
Getting Bridge Quotes
// Get bridge cost estimate before executingconst quote = await bridgeProtocol.quoteBridge({ targetChain: 'arbitrum', recipient: 'RECIPIENT_ADDRESS', token: 'USDT_TOKEN_ADDRESS', amount: 1000000n})console.log('Estimated gas fee:', quote.fee, 'wei')console.log('Estimated bridge fee:', quote.bridgeFee, 'wei')console.log('Total cost:', Number(quote.fee + quote.bridgeFee) / 1e18, 'ETH')// Check if bridge is cost-effectiveif (quote.fee + quote.bridgeFee > 100000000000000n) { // More than 0.0001 ETH console.log('Bridge fees too high, consider waiting for lower gas prices')} else { await account.approve({ token: 'USDT_TOKEN_ADDRESS', spender: 'OFT_CONTRACT_ADDRESS', amount: 1000000n }) // Execute the bridge const result = await bridgeProtocol.bridge({ targetChain: 'arbitrum', recipient: 'RECIPIENT_ADDRESS', token: 'USDT_TOKEN_ADDRESS', amount: 1000000n, oftContractAddress: 'OFT_CONTRACT_ADDRESS' })}
ERC-4337 Smart Account Bridging
ERC-4337 accounts bridge through the source chain's transaction value helper, which pays the LayerZero fee and charges it in the bridged token. The helper currently supports USD₮0 only: bridging XAUt0 from an ERC-4337 account throws an error (see #58).
await smartAccount.approve({ token: 'USDT_TOKEN_ADDRESS', spender: 'OFT_CONTRACT_ADDRESS', amount: 1000000n})// Bridge using ERC-4337 smart account with sponsored transactionsconst smartAccountResult = await smartBridgeProtocol.bridge({ targetChain: 'ethereum', recipient: 'RECIPIENT_ADDRESS', token: 'USDT_TOKEN_ADDRESS', amount: 1000000n, oftContractAddress: 'OFT_CONTRACT_ADDRESS'}, { paymasterToken: { address: 'USDT_TOKEN_ADDRESS' }, // Use USDT to pay gas fees bridgeMaxFee: 100000000000000n // Override max fee})console.log('Smart account bridge hash:', smartAccountResult.hash)console.log('Gas fee paid in USDT:', smartAccountResult.fee)console.log('Bridge service fee:', smartAccountResult.bridgeFee)
quoteBridge() and bridge() also return tokenFee. For ERC-4337 accounts, it is
the transaction-value helper's surcharge in the bridged source token's base units.
bridgeFee remains the underlying native fee in wei; it is not an additional
charge on top of tokenFee. The helper quotes a total source-token debit of
amount + tokenFee, before the separate wallet/network fee. Approval headroom
is not part of tokenFee. Standard EOA accounts pay no surcharge and return
tokenFee: 0n.
Both methods use the exported Usdt0BridgeResult type: bridge() returns the
full result and quoteBridge() omits only hash. Values are calculated for each
operation; a later send can have different fees from an earlier quote.
Field
Units
Treatment
fee
Wallet fee units: native wei or the configured paymaster token's base units
Separate transaction/network charge
bridgeFee
Native wei
LayerZero messaging cost; for ERC-4337 the helper recovers this through tokenFee
tokenFee
Bridged source-token base units; 0n for standard EOA accounts
Added to the bridge principal; excludes approval headroom and fee
The main class for bridging USDT0 tokens between EVM-compatible blockchains using the LayerZero protocol.
Extends BridgeProtocol from @tetherto/wdk-wallet/protocols.
Constructor
new Usdt0ProtocolEvm(account, config)
Parameters:
account (WalletAccountEvm | WalletAccountEvmErc4337 | WalletAccountReadOnlyEvm | WalletAccountReadOnlyEvmErc4337): The wallet account to use for bridge operations
config (object, optional): Configuration object
bridgeMaxFee (bigint, optional): Maximum total bridge cost in wei
Example:
const bridgeProtocol = new Usdt0ProtocolEvm(account, { bridgeMaxFee: 100000000000000n // Maximum bridge fee in wei (0.0001 ETH)})
Methods
Method
Description
Returns
bridge(options, config?)
Bridges tokens between EVM chains
Promise<Usdt0BridgeResult>
quoteBridge(options, config?)
Gets the cost of a bridge operation
Promise<Omit<Usdt0BridgeResult, 'hash'>>
getSupportedChains()
Lists the chains supported for bridging
Promise<SwidgeSupportedChain[]>
getSupportedTokens(options?)
Lists the tokens supported for bridging, optionally scoped to a chain/token
Promise<SwidgeSupportedToken[]>
bridge(options, config?)
Bridges tokens between blockchains using the USDT0 protocol.
Parameters:
options (BridgeOptions): Bridge operation options
targetChain (string): Where to send tokens (e.g. 'ethereum', 'arbitrum', 'polygon', 'solana', 'ton', 'tron', etc.)
recipient (string): Address that will get the bridged tokens (EVM hex address, Solana base58, TON, or TRON address)
token (string): Token address on source chain
amount (bigint): Amount to bridge in token base units
oftContractAddress (string, optional): Custom OFT contract address to use instead of auto-resolving from the source chain
dstEid (number, optional): Custom LayerZero destination endpoint ID to override the default for the target chain
Returns the chains supported for bridging. Discovery is derived from the bundled config, so it makes no network calls. Asynchronous to match the WDK swidge getSupportedChains() contract.
Returns:Promise<SwidgeSupportedChain[]> - One entry per supported chain, each { id, name, type, nativeToken }. The shape matches the WDK swidge getSupportedChains() contract.
Returns the tokens supported for bridging. A token (USDT0 or XAUT0) is reported on a chain when the corresponding bridge contract is configured for that chain. Discovery makes no network calls; the on-chain token address is not resolved and is therefore omitted. Asynchronous to match the WDK swidge getSupportedTokens() contract.
fromChain (string | number, optional): Scope results to a chain (key, chainId, or eid)
toChain (string | number, optional): Used when fromChain is absent
fromToken (string, optional): Scope results to a token symbol (e.g. 'USDT0')
Returns:Promise<SwidgeSupportedToken[]> - Each { token, chain, symbol, decimals, name }. The shape matches the WDK swidge getSupportedTokens() contract.
Example:
// Every supported token on every chainconst allTokens = await bridgeProtocol.getSupportedTokens()// Tokens available on a specific chainconst onArbitrum = await bridgeProtocol.getSupportedTokens({ fromChain: 'arbitrum' })// [{ token: 'USDT0', chain: 'arbitrum', symbol: 'USDT0', decimals: 6, name: 'USDT0' }, ...]
Note: Non-EVM destinations (Solana, TON, TRON) are reachable as bridge targets but are not reported by getSupportedTokens because they have no source-chain bridge contract entry in the config.
🌐 Supported Networks
This package supports bridging from EVM source chains to both EVM and non-EVM destination chains.
EVM Source/Destination Chains (USDT0):
Chain
Chain ID
EID
Ethereum
1
30101
Arbitrum
42161
30110
Berachain
80094
30362
Conflux eSpace
1030
30212
Corn
21000000
30331
Flare
14
30295
HyperEVM
999
30367
Ink
57073
30339
Mantle
5000
30181
MegaETH
4326
30398
Monad
143
30390
Morph
2818
30322
Optimism
10
30111
Plasma
9745
30383
Polygon
137
30109
Rootstock
30
30333
Sei
1329
30280
Stable
988
30396
Unichain
130
30320
XLayer
196
30274
Legacy Mesh Chains (USDT0):
Chain
EID
Ethereum
30101
Arbitrum
30110
Celo
30125
Solana
30168
TON
30343
TRON
30420
Non-EVM Destination Chains:
Solana (EID: 30168) - base58 address format
TON (EID: 30343) - TON address format
TRON (EID: 30420) - TRON address format
XAUt0 (Tether Gold) Support:
Chain
EID
Ethereum
30101
Arbitrum
30110
Avalanche
30106
Celo
30125
HyperEVM
30367
Ink
30339
Monad
30390
Plasma
30383
Polygon
30109
Stable
30396
Account Types:
Standard EVM Wallets: @tetherto/wdk-wallet-evm accounts
ERC-4337 Smart Accounts: @tetherto/wdk-wallet-evm-erc-4337 accounts with sponsored transactions
Read-Only Accounts: For querying bridge costs without transaction capabilities
Note: Token support is determined by the contracts deployed on each chain. The protocol checks for oftContract, legacyMeshContract, and xautOftContract to determine available tokens.
🔒 Security Considerations
Seed Phrase Security: Always store your seed phrase securely and never share it
Private Key Management: The package handles private keys internally with memory safety features
RPC Provider Security: Use trusted RPC endpoints and consider running your own node
Transaction Validation: Always validate bridge details before signing
Gas Price Management: Monitor gas prices and set appropriate bridgeMaxFee limits
Quote Validation: Always get quotes before executing bridges to avoid unexpected costs
Token Verification: Verify token contract addresses before bridging
Chain Verification: Ensure target chain supports the token being bridged
Recipient Validation: Double-check recipient addresses for target chains
LayerZero Security: Trust LayerZero protocol for cross-chain message delivery
Smart Contract Risk: Understand the risks of interacting with bridge smart contracts
ERC-4337 Considerations: Be aware of paymaster and bundler dependencies for smart accounts
Slippage Protection: Consider price impact for large bridge amounts
MEV Protection: Be aware of potential MEV risks on public mempools
🛠️ Development
Building
# Install dependenciesnpm install# Build TypeScript definitionsnpm run build:types# Lint codenpm run lint# Fix linting issuesnpm run lint:fix
Testing
# Run testsnpm test# Run tests with coveragenpm run test:coverage
📜 License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
🤝 Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
🆘 Support
For support, please open an issue on the GitHub repository.