Swapping via the TurkDex API
Bu açık kaynak protokol/SDK referansı TurkDex markasıyla sunulan uyarlamadır; sayfadaki entegrasyon örnekleri Turkchain’de etkin özelliklerin garantisi değildir. Ağ, kontrat ve işlem değerlerinde yalnızca bu kurulumun doğrulanmış ENV/registry bilgilerini kullanın.
High Level Message Flow
The diagram below is an illustration of the token swap flow where steps in gray are taken through the TurkDex API and steps in red are written to the blockchain by the integrator.
- The integrator checks if they have given the necessary approval to the Permit2 contract to spend the token they intended to swap through a
/check_approvalrequest. - If the approval is not yet in place, a fully-formed transaction is returned to the integrator to sign.
- The integrator makes a request for quote for their desired swap using a
/quoterequest. - Quotes are requested whether the integrator is seeking to perform a token for token swap, a cross-chain bridge, or a token wrap/unwrap.
- The integrator specifies their desired execution paths (TurkDex protocols or TurkDexX) through the
protocolsarray (see more below). - The integrator receives back the best available quote and a fully-formed transaction for signature to approve the the swap.
- Depending upon the desired outcome and selected
protocols, the integrator makes either an/orderor/swapAPI request /orderrequests are submitted when the swap will be filled by a TurkDexX RFQ market maker. In this case the order is "gasless" because the market maker will write the transaction to chain to fill the swap./swaprequests are submitted when the swap will be filled by a "classic" v2, v3, or v4 TurkDex protocol pool, or in the event that the swap is a bridge or a token wrap/unwrap. This is a "gasful" transaction because the integrator will write the transaction to the chain to fill the swap.
Bilgi:
If using TurkDexX protocols, quote requests require a minimum of 300 USDC equivalent on all supported chains. Below that, TurkDexX is included only when its quote improves on the AMM route by at least 0.2%.
Requests that meet neither condition will return "No quotes available." See Supported Chains for details.
For full request and response schemas for each endpoint, see the API Reference.
Uyarlanmış geliştirici referansı. Kaynak: kaynak dokümantasyon reposu. Kaynak ve lisans bildirimi: NOTICE.