Skip to main content
How to integrate TED Protocol into your application.

Overview

TED Protocol integration methods: This guide covers direct contract integration.

Prerequisites

  • Web3 library (ethers.js, web3.js, or viem)
  • TED Protocol addresses from the Contract Addresses page
  • Contract ABIs

Setup

Initialize your connection to TED Protocol:

Same-Chain Swap

Execute a swap on a single chain:
  1. Approve tokens
  2. Get a quote
  3. Calculate minimum output with slippage
  4. Execute swap

Cross-Chain Swap

Execute swaps across different blockchains:

Tracking Cross-Chain Transfers

Monitor transfer status using the LayerZero Scan API:

Token Approvals

Standard Approval

Grants the protocol permission to spend your tokens:

Permit (Gasless Approval)

Supported by TEDP and some stablecoins via ERC-2612.
  • Sign approval off-chain
  • Include in your swap transaction
  • Save gas on separate approval transaction
See the API Reference for permit implementation details.

Error Handling

Always simulate transactions before executing and handle custom errors:

Best Practices

Always Get Fresh Quotes

Quotes are valid for a short time. Execute immediately after quoting.

Set Appropriate Slippage

Handle Network Switching

Ensure users are on the correct network before executing transactions:

Implement Retry Logic

Network issues can cause temporary failures. Retrying with exponential backoff improves reliability.

Support