31Third.
  • 👋Introduction
    • About 31Third
    • Use cases
    • 0x Labs Collaboration
    • Architecture
    • Team
  • 🤝31Third API
    • Overview
    • Healthcheck
    • Assets
      • Wallet
      • Enzyme
    • Swap
      • Get started
      • price
      • quote
    • Basket Trade (m:n swap)
      • async
      • Wallet
      • Enzyme
      • SetProtocol
    • Refresh Quotes
    • RFQ
  • ⛓️Protocol
    • Overview
    • Contracts
      • BatchTrade
      • Owner Privilege
    • Prohibition
    • Audit
    • Statistics
      • Gas cost analysis
    • Fees
  • 📚Resources
    • FAQ
    • Start trading
    • Discord
    • Twitter
Powered by GitBook
On this page
  • Step 0: Get 31Third API key
  • Step 1: Get an indicative price
  • Step 2: Get quote
  • Step 3: Send transaction
  • Ethers.js example
  1. 31Third API
  2. Swap

Get started

PreviousSwapNextprice

Last updated 22 days ago

Step 0: Get 31Third API key

Request an API key via .

Step 1: Get an indicative price

Use /swap/price to fetch an indicative price.

You'll receive indicative information about:

  • buy amount

  • conversion price

  • price impact estimation.

Step 2: Get quote

Use /swap/quote to fetch a quote.

You'll receive information about:

  • buy amount

  • minimal buy amount

  • conversion price

  • guaranteed conversion price

  • price impact

  • maximal price impact

  • raw transaction

Step 3: Send transaction

The quote response contains a raw transaction.

RawTransaction {
  to: string;
  data: string;
  value: string;
  gasLimit?: string; // Not always present
  gasPrice?: string; // Not always present
}

This transaction can be broadcasted to execute the swap.

Ethers.js example

signer.sendTransaction(rawTransaction);

The raw transaction can be passed into as follows:

🤝
dev@31third.com
price
quote
ethers signer.sendTransaction