API 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 (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, {
  provider: 'https://eth-mainnet.g.alchemy.com/v2/your-api-key'
})

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' | 'approveHash'>>

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

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

    • amount (bigint): Amount to bridge in token base units

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

    • paymasterToken (string, optional): Token to use for paying gas fees

    • bridgeMaxFee (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 (string, optional): Token to use for paying gas fees

Returns: Promise<Omit<BridgeResult, 'hash' | 'approveHash'>> - 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

  • 'polygon' (Chain ID: 137)

  • 'berachain' (Chain ID: 80094)

  • 'ink' (Chain ID: 57073)

Destination Chains:

  • 'ethereum' (Chain ID: 1)

  • 'arbitrum' (Chain ID: 42161)

  • 'polygon' (Chain ID: 137)

  • 'berachain' (Chain ID: 80094)

  • 'ink' (Chain ID: 57073)

  • 'ton' (Chain ID: 30343)

  • 'tron' (Chain ID: 728126428)

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?