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'
// Create wallet account first
const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://eth.drpc.org'
})
// Create bridge protocol with configuration
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n // Optional standard-account cap in source native base units
})Account Configuration
The constructor accepts IWalletAccount or IWalletAccountReadOnly from @tetherto/wdk-wallet. Execution requires EVM transaction support and a callable sendTransaction() method; read-only accounts can quote. See account requirements for custom accounts and ERC-4337 class identity.
The bridge protocol reads the provider from the wallet account's internal configuration for blockchain access:
import { WalletAccountEvm, WalletAccountReadOnlyEvm } from '@tetherto/wdk-wallet-evm'
// Full access account
const account = new WalletAccountEvm(
seedPhrase,
"0'/0/0", // BIP-44 derivation path
{
provider: 'https://eth.drpc.org',
transferMaxFee: 100000000000000
}
)
// Read-only account
const readOnlyAccount = new WalletAccountReadOnlyEvm(
'0x...', // Ethereum address
{
provider: 'https://eth.drpc.org'
}
)
// Create bridge protocol
const bridgeProtocol = new Usdt0ProtocolEvm(account, {
bridgeMaxFee: 1000000000000000n
})Configuration Options
Bridge Max Fee
The bridgeMaxFee option rejects bridge() when the implementation's fee + bridgeFee value is equal to or greater than the cap.
Type: number | bigint (optional)
For WalletAccountEvm, both fields use the source chain's native base unit, such as wei on Ethereum and Arbitrum. Other compatible accounts retain their own quoteSendTransaction() fee denomination, while the single-transaction path still returns bridgeFee in source native base units. Confirm the units match before setting a cap.
For an ERC-4337 helper flow, bridgeFee is in bridged-token base units. The account's fee uses native base units for native gas, paymaster-token base units for token-paid gas, or zero for sponsored gas. In 1.0.0-beta.9, the protocol numerically adds these values when enforcing bridgeMaxFee. Do not treat that sum as one currency or set a cap until your payment mode uses compatible units.
Examples:
const config = {
// Standard Ethereum account: reject fee + bridgeFee at or above 0.001 ETH
bridgeMaxFee: 1000000000000000n,
}
// Usage example
try {
await account.approve({
token: '0x...', // USDt contract address
spender: '0x...', // OFT or bridge spender address
amount: 1000000n
})
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...', // Recipient address
token: '0x...', // USDt contract address
amount: 1000000n,
oftContractAddress: '0x...' // Same address used as approval spender
})
} 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. Both bridge() and quoteBridge() require it. The constructor reads account._config.provider; _config is not part of the shared account interfaces, so accepting an interface in TypeScript does not guarantee runtime compatibility.
Type: string | Eip1193Provider
Examples:
// Option 1: Using RPC URL
const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://eth.drpc.org'
})
// Option 2: Using browser provider (e.g., MetaMask)
const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: window.ethereum
})
Pass either an RPC URL string or a genuine EIP-1193 provider. An ethers JsonRpcProvider is not an EIP-1193 provider and is not accepted by this wallet release.
ERC-4337 Configuration
When using ERC-4337 accounts recognized by the bridge package's concrete class checks, you can override configuration options during bridge operations. Review the class identity requirement before combining package versions:
// Bridge with ERC-4337 account
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...', // Recipient address
token: '0x...', // USDt contract address
amount: 1000000n,
oftContractAddress: '0x...' // Optional custom OFT contract
}, {
paymasterToken: { address: '0x...' } // Paymaster token for gasless transactions
})The protocol builds the token approval and transaction-value-helper call and submits them as one UserOperation. Do not call account.approve() separately for this flow.
ERC-4337 helper bridging is configured for these source chains:
| Source chain | Chain ID |
|---|---|
| Ethereum | 1 |
| Arbitrum | 42161 |
| Plasma | 9745 |
| Polygon | 137 |
Other supported EVM source chains require a standard EVM account.
Paymaster Token
The paymasterToken option specifies which token to use for paying gas fees in ERC-4337 accounts.
Type: { address: string } (optional)
Format: Object with token contract address
Example:
const result = await bridgeProtocol.bridge({
targetChain: 'arbitrum',
recipient: '0x...', // Recipient address
token: '0x...', // USDt contract address
amount: 1000000n,
oftContractAddress: '0x...' // Optional custom OFT contract
}, {
paymasterToken: {
address: '0x...' // Paymaster token address
}
})Network Support
The bridge protocol uses EVM wallet providers as source chains and supports both EVM and non-EVM destinations. Change the provider URL in the wallet account configuration:
// Ethereum Mainnet
const ethereumAccount = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://eth.drpc.org'
})
// Arbitrum
const arbitrumAccount = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://arb1.arbitrum.io/rpc'
})
// Polygon
const polygonAccount = new WalletAccountEvm(seedPhrase, "0'/0/0", {
provider: 'https://polygon-rpc.com'
})Bridge Options
When calling the bridge method, you need to provide bridge options. The following allowance step applies to a standard EVM account:
const bridgeOptions = {
targetChain: 'arbitrum', // Destination chain name
recipient: '0x...', // Recipient address
token: '0x...', // USDt contract address
amount: 1000000n, // Amount to bridge in base units
oftContractAddress: '0x...', // Optional custom OFT contract address
dstEid: 30110 // Optional LayerZero destination endpoint ID override
}
await account.approve({
token: bridgeOptions.token,
spender: bridgeOptions.oftContractAddress,
amount: bridgeOptions.amount
})
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: number | bigint
Unit: Base units of the token (e.g., for USD₮: 1 USD₮ = 1000000n)
OFT Contract Address
The optional oftContractAddress option lets you override auto-discovery and force a specific OFT contract.
Type: string (optional)
Format: Valid EVM contract address on the source chain
Destination EID Override
The optional dstEid option lets you override the default LayerZero destination endpoint ID for the selected target chain.
Type: number (optional)
Error Handling
The bridge protocol will throw errors for invalid configurations. This example uses a standard EVM account, so it approves the bridge spender first:
try {
await account.approve({
token: '0x...', // USDt contract address
spender: '0x...', // OFT or bridge spender address
amount: 1000000n
})
const result = await bridgeProtocol.bridge({
targetChain: 'invalid-chain',
recipient: '0x...', // Recipient address
token: '0x...', // USDt contract address
amount: 1000000n,
oftContractAddress: '0x...' // Same address used as approval spender
})
} 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
WDK Bridge USD₮0 EVM Protocol API
Get started with WDK's Bridge USD₮0 EVM Protocol API
WDK Bridge USD₮0 EVM Protocol Usage
Get started with WDK's Bridge USD₮0 EVM Protocol usage