Arken
  • Introducing Arken Finance
  • Table of Contents
  • Roadmap
  • Using Arken Finance
    • For Individual Traders
      • Discovering Tokens
      • Monitoring Tokens
      • Best-Rate Engine 3.0
      • Stop-Limit for AMM & Limit Orders
      • Gas Optimization Mode
      • Cross-Chain Swap
    • For Private Funds & Institutions
      • Usage Overview & USP
  • Token and Community
    • ARKEN Supply Distribution
  • For Developers
    • Arken API
      • Arken Price API
      • Arken Swap Engine API
      • Arken Insider API
    • Arken Widgets
    • Arken Bridge v1
    • Integration Proposals
  • Security
    • Audit
    • Smart Contract
      • Changelog
  • Resources
    • Contact & Social Link
    • FAQ
    • Token Listing Criteria
    • Risks
    • Common Error Messages
    • Material
Powered by GitBook
On this page

Was this helpful?

  1. For Developers
  2. Arken API

Arken Swap Engine API

PreviousArken Price APINextArken Insider API

Last updated 2 years ago

Was this helpful?

API Endpoint: https://public-api.arken.finance

Please refer to for getting API tokens

Using Arken Finance Swap Engine API, you can find the best route to exchange assets and make the swap. Here are the step-by-step instructions on how to use Arken Swap Engine API:

  1. Find the addresses of the tokens you want to swap. For example, swapping WETH -> USDT

    1. WETH: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2

    2. USDT: 0xdac17f958d2ee523a2206206994597c13d831ec7

  2. Check for allowance of Arken Approve contract to spend source asset using /approve/allowance

  3. If necessary, give approval for Arken Approve contract to spend the source token using /approve/transaction

  4. Monitor the best exchange route using /swap/quote

  5. When you are ready to swap, use /swap/swap to generate the call data to perform the swap

Chains

Health Check

Approve

Info

Swap

Arken API

Return supported chains list

get
Responses
200Success
application/json
get
GET /swap-engine/v1/chains HTTP/1.1
Host: public-api.arken.finance
Accept: */*
200Success
{
  "chains": [
    [
      {
        "chainType": "ethereum",
        "chainID": 1
      },
      {
        "chainType": "arbitrum",
        "chainID": 42161
      },
      {
        "chainType": "bsc",
        "chainID": 56
      },
      {
        "chainType": "polygon",
        "chainID": 137
      },
      {
        "chainType": "avalanche",
        "chainID": 43114
      },
      {
        "chainType": "rei",
        "chainID": 55555
      }
    ]
  ]
}

API health check

get
Authorizations
Responses
200
Always returns code 200 if API is stable
get
GET /swap-engine/v1/{chainID}/healthcheck HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
200

Always returns code 200 if API is stable

No content

Address of the Arken Approve that must be trusted to spend funds for the exchange

get
Authorizations
Responses
200
Address of the Arken Approve that must be trusted to spend funds for the exchange
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/approve/spender HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "address": "text"
}

Generate data for calling the contract in order to allow the Arken Approve to spend funds

get
Authorizations
Query parameters
tokenAddressstringRequired

Token address you want to exchange

amountstringOptional

The number of tokens that the Arken Approve is allowed to spend.If not specified, it will be allowed to spend an infinite amount of tokens.

Example: 100000000000
Responses
200
Transaction body to allow the exchange with the Arken Approve
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/approve/transaction HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "data": "text",
  "gasPrice": "text",
  "to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "value": "text"
}

Get the number of tokens that the Arken Approve is allowed to spend

get
Authorizations
Query parameters
tokenAddressstringRequired

Token address you want to exchange

walletAddressstringRequired

Wallet address for which you want to check

Responses
200Success
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/approve/allowance HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "amount": "text"
}

List of liquidity sources that are available for routing in the Arken Finance

get
Authorizations
Responses
200
All supported protocols public
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/liquidity-sources HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "protocols": [
    {
      "id": "text",
      "title": "text",
      "imageURL": "text"
    }
  ]
}

Find the best quote to exchange via Arken Finance

get
Authorizations
Query parameters
fromTokenAddressstringRequiredExample: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
toTokenAddressstringRequiredExample: 0xdac17f958d2ee523a2206206994597c13d831ec7
amountstringRequiredExample: 10000000000000000
gasPriceanyOptional

default: fast from network

Responses
200
Quote
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/swap/quote HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "fromToken": {
    "symbol": "text",
    "name": "text",
    "address": "text",
    "decimals": 1,
    "logoURI": "text"
  },
  "toToken": {
    "symbol": "text",
    "name": "text",
    "address": "text",
    "decimals": 1,
    "logoURI": "text"
  },
  "toTokenAmount": "text",
  "fromTokenAmount": "text",
  "protocols": [
    {
      "id": "text",
      "title": "text",
      "part": 1,
      "fromTokenAddress": "text",
      "toTokenAddress": "text"
    }
  ],
  "estimatedGas": "text"
}

Generate data for calling the Arken Dex for exchange

get
Authorizations
Query parameters
fromTokenAddressstringRequiredExample: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
toTokenAddressstringRequiredExample: 0xdac17f958d2ee523a2206206994597c13d831ec7
amountstringRequiredExample: 10000000000000000
fromAddressstringRequired

The address that calls the Arken Dex contract

slippagenumberRequired

min: 0; max: 50;

Example: 1
destReceiverstringOptional

Receiver of destination currency. default: fromAddress

gasPricestringOptional

default: fast from network

Responses
200
Swap
application/json
400
bad request, invalid request parameters
application/json
500
internal server error
application/json
get
GET /swap-engine/v1/{chainID}/swap/swap HTTP/1.1
Host: public-api.arken.finance
X-API-Username: YOUR_API_KEY
Accept: */*
{
  "fromToken": {
    "symbol": "text",
    "name": "text",
    "address": "text",
    "decimals": 1,
    "logoURI": "text"
  },
  "toToken": {
    "symbol": "text",
    "name": "text",
    "address": "text",
    "decimals": 1,
    "logoURI": "text"
  },
  "toTokenAmount": "text",
  "fromTokenAmount": "text",
  "protocols": [
    "text"
  ],
  "tx": {
    "from": "text",
    "to": "text",
    "data": "text",
    "value": "text",
    "gasPrice": "text",
    "gas": "text"
  }
}
  • Chains
  • GETReturn supported chains list
  • Health Check
  • GETAPI health check
  • Approve
  • GETAddress of the Arken Approve that must be trusted to spend funds for the exchange
  • GETGenerate data for calling the contract in order to allow the Arken Approve to spend funds
  • GETGet the number of tokens that the Arken Approve is allowed to spend
  • Info
  • GETList of liquidity sources that are available for routing in the Arken Finance
  • Swap
  • GETFind the best quote to exchange via Arken Finance
  • GETGenerate data for calling the Arken Dex for exchange