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:- Approve tokens
- Get a quote
- Calculate minimum output with slippage
- 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
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
- Discord — #developers channel
- Email — developers@tedprotocol.io
- GitHub — Issues and discussions