Mach 2
  • Getting Started
    • What is Mach?
    • Mach 2
      • Optimistic Settlement
      • Intents
      • Order Matching
      • Stables & RWAs
    • Trade Lifecycle
  • Navigation
    • Users
      • FAQ
    • Market Makers
  • Protocol
    • Overview
      • Cross-Chain Swap
      • Challenge Process
    • CCTP
    • LayerZero
    • API
      • Integration
    • Staging
    • Deployed Contracts
    • Supported Assets
    • Security
  • Whitepaper
  • Audits
  • Github
Powered by GitBook
On this page
  • Endpoints for Trial and Usage
  • Where Can I Trial the Endpoints?
  • Endpoints Used by the Front-End
  1. Protocol

API

PreviousLayerZeroNextIntegration

Last updated 12 months ago

Endpoints for Trial and Usage

Where Can I Trial the Endpoints?

You can trial the endpoints at the following link:

Endpoints Used by the Front-End

The front-end interacts with several key endpoints to ensure smooth operation and user experience. Here’s how these endpoints are utilized:

On Load: Reading Available Chains and Assets

  • Endpoint: get_config

  • Description: On load, the front-end reads the available chains and assets from the configuration to present the user with the latest options.

Estimating Gas Costs

  • Endpoint: estimate_gas

  • Description: When a user specifies the send token and buy token, the front-end estimates the gas cost for the transaction.

Placing a Trade

  • Endpoint: PlaceTrade

  • Description: When a user places a trade using MetaMask, the front-end retrieves the price and fee from the following endpoints:

    • get_price: Retrieves the current price for the trade.

    • get_fee: Retrieves the applicable fee for the trade.

Order Clearing and Backend Fix

  • Endpoint: make_order

  • Description: Immediately after the order has cleared on the source chain, this endpoint is called to have the backend finalize and fix the order.

Displaying Order History

  • Endpoint: get_orders

  • Description: After the trade is complete, the front-end uses this endpoint to display the user's order history.

API Documentation and Testing