githubEdit

codeAPI Reference

Complete API documentation for @tetherto/wdk-protocol-bridge-usdt0-evm

Table of Contents

Class
Description
Methods

Main class for bridging USD₮0 tokens across blockchains. Extends BridgeProtocol from @tetherto/wdk-wallet/protocols.

Usdt0ProtocolEvm

The main class for bridging USD₮0 tokens across different 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 (BridgeProtocolConfig, optional): Configuration object

    • bridgeMaxFee (number | bigint, optional): Maximum total bridge cost in wei

Example:

import Usdt0ProtocolEvm from '@tetherto/wdk-protocol-bridge-usdt0-evm'
import { WalletAccountEvm } from '@tetherto/wdk-wallet-evm'

const account = new WalletAccountEvm(seedPhrase, "0'/0/0", {
  provider: 'https://eth.drpc.org'
})

const bridgeProtocol = new Usdt0ProtocolEvm(account, {
  bridgeMaxFee: 1000000000000000n // Maximum bridge fee in wei
})

Methods

Method
Description
Returns
Throws

bridge(options, config?)

Bridges tokens to another blockchain

Promise<BridgeResult>

If no provider or fee exceeds max

quoteBridge(options, config?)

Estimates the cost of a bridge operation

Promise<Omit<BridgeResult, 'hash'>>

If no provider

bridge(options, config?)

Bridges tokens to a different blockchain using the USD₮0 protocol.

Parameters:

  • options (BridgeOptions): Bridge operation options

    • targetChain (string): Destination chain name

    • recipient (string): Address that will receive the bridged tokens (EVM hex address, Solana base58 address, TON address, or TRON address)

    • token (string): Token contract address on source chain

    • amount (number | 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 override

  • config (Pick<EvmErc4337WalletConfig, 'paymasterToken'> & Pick<BridgeProtocolConfig, 'bridgeMaxFee'>, optional): Override configuration for ERC-4337 accounts

    • paymasterToken ({ address: string }, optional): Paymaster token configuration for gas fees

    • bridgeMaxFee (number | bigint, optional): Override maximum bridge fee

Returns: Promise<BridgeResult> - Bridge operation result

Throws:

  • Error if account is read-only

  • Error if no provider is configured

  • Error if bridge fee exceeds maximum allowed

Example:

quoteBridge(options, config?)

Estimates the cost of a bridge operation without executing it.

Parameters:

  • options (BridgeOptions): Bridge operation options (same as bridge method)

  • config (Pick<EvmErc4337WalletConfig, 'paymasterToken'>, optional): Override configuration for ERC-4337 accounts

    • paymasterToken ({ address: string }, optional): Paymaster token configuration for gas fees

Returns: Promise<Omit<BridgeResult, 'hash'>> - Bridge cost estimate

Throws: Error if no provider is configured

Example:

Types

BridgeOptions

BridgeResult

BridgeProtocolConfig

EvmErc4337WalletConfig

Supported Chains

The bridge protocol supports the following chains:

Source Chains (EVM):

  • 'ethereum' (Chain ID: 1)

  • 'arbitrum' (Chain ID: 42161) - ERC-4337 support

  • 'optimism' (Chain ID: 10)

  • 'polygon' (Chain ID: 137)

  • 'berachain' (Chain ID: 80094)

  • 'ink' (Chain ID: 57073)

  • 'plasma' (Chain ID: 9745)

  • 'conflux' (Chain ID: 1030)

  • 'corn' (Chain ID: 21000000)

  • 'avalanche' (Chain ID: 43114)

  • 'celo' (Chain ID: 42220)

  • 'flare' (Chain ID: 14)

  • 'hyperevm' (Chain ID: 999)

  • 'mantle' (Chain ID: 5000)

  • 'megaeth' (Chain ID: 4326)

  • 'monad' (Chain ID: 143)

  • 'morph' (Chain ID: 2818)

  • 'rootstock' (Chain ID: 30)

  • 'sei' (Chain ID: 1329)

  • 'stable' (Chain ID: 988)

  • 'unichain' (Chain ID: 130)

  • 'xlayer' (Chain ID: 196)

Destination Chains:

  • EVM destinations: same as source-chain set above

  • 'solana' (EID: 30168)

  • 'ton' (EID: 30343)

  • 'tron' (EID: 30420)

Error Handling

The bridge protocol throws specific errors for different failure cases:

Usage Examples

Basic Bridge Operation

Multi-Chain Bridge

ERC-4337 Gasless Bridge


Need Help?