AKKA Finance
  • 🏠Getting Started
    • 🌟Why AKKA?
    • ❓What is AKKA?
  • AKKA API
    • 👷Introduction
    • 🌐Quick start
    • ⚙️Swagger
    • 3️⃣Use API endpoints of AKKA
    • ↗️Example
  • Smart Contracts
Powered by GitBook
On this page
  • /{chain_id}/approve/spender endpoint
  • /{chain_id}/approve/transaction endpoint
  • /{chain_id}/approve/allowance endpoint
  • /{chain_id}/tokens endpoint
  • /{chain_id}/tokens/{token_address} endpoint
  • /{chain_id}/pks-quote endpoint
  • /{chain_id}/quote endpoint
  • /{chain_id}/swap endpoint
  1. AKKA API

Use API endpoints of AKKA

There are many endpoints in AKKA api that help you implement an app for swapping tokens. All of these endpoints are explained below:

/{chain_id}/approve/spender endpoint

The /{chain_id}/approve/spender needs no query params and returns the address of the AKKA smart contract in the requested chain.

Example usage:

curl router.akka.finance/v2/5000/approve/spender

/{chain_id}/approve/transaction endpoint

This endpoint takes a tokenAddress (required) and optionally, an amount (if not provided it will default to maximum amount) in query params; and responds with the data required to be signed and sent to the chain by wallet user to give AKKA smart contract the allowance to make the swap.

Example usage: curl router.akka.finanace/v2/5000/approve/transaction?tokenAddress=0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE

/{chain_id}/approve/allowance endpoint

This endpoint takes a walletAddress and a tokenAddress in query params and returns the allowance of the provided token given by the provided wallet address, to the AKKA smart contract.

Example usage: curl router.akka.finanace/v2/5000/approve/allowance?tokenAddress=0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE&walletAddress=0x684155b682239f12361B034C4eDA0DF6dD40a9F5

/{chain_id}/tokens endpoint

This endpoint returns a list of the tokens in the requested chain. Pagination in this endpoint is supported via the page and limit query params (note that page is 1-indexed, meaning that the first page is numbered as 1 rather than 0). The default value for page is 1 and the default value for limit is 1000.

Example usage: curl router.akka.finanace/v2/5000/tokens

/{chain_id}/tokens/{token_address} endpoint

This endpoint returns a single token, which is requested in the URL param.

Example usage: curl router.akka.finanace/v2/5000/tokens/0x201EBa5CC46D216Ce6DC03F6a759e8E766e956aE

/{chain_id}/pks-quote endpoint

This endpoint returns the best route for swap, in the pancake swap structure. It requires three mandatory query params:

  • src: the input token which is given by the user.

  • dst: the output token which is wanted.

  • amount: the amount of the input token, in wei.

Example usage:

curl router.akka.interface/v2/5000/pks-quote?src=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&dst=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&amount=1000000000000000000

/{chain_id}/quote endpoint

This endpoint returns the best route for swap, in the 1inch swap structure. It requires three mandatory query params, same as the previous endpoint:

  • src: the input token which is given by the user.

  • dst: the output token which is wanted.

  • amount: the amount of the input token, in wei.

Also this endpoint accepts 2 optional query params:

  • includeTokensInfo: a boolean value (true or false), when true the tokens info is included in the response.

  • includeProtocols: a boolean value (true or false), when true the protocols (routes) is included in the response.

Example usage:

curl router.akka.interface/v2/5000/quote?src=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&dst=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&amount=1000000000000000000&includeTokensInfo=true&includeProtocols=true

/{chain_id}/swap endpoint

This endpoint generates the data required to call the AKKA smart contract for swap, and requires some query params. The mandatory query params are listed below:

  • src: the input token which is given by the user.

  • dst: the output token which is wanted.

  • amount: the amount of the input token, in wei.

  • from: the address of the wallet from which src is paid.

  • slippage: the slippage tolerance, from 0 to 50 (percentage).

There are 2 optional query params as well, same as the previous endpoint:

  • includeTokensInfo: a boolean value (true or false), when true the tokens info is included in the response.

  • includeProtocols: a boolean value (true or false), when true the protocols (routes) is included in the response.

Example usage:

curl router.akka.interface/v2/5000/swap?src=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&dst=0x78c1b0C915c4FAA5FffA6CAbf0219DA63d7f4cb8&amount=1000000000000000000&from=0x684155b682239f12361B034C4eDA0DF6dD40a9F5&slippage=1&includeTokensInfo=true&includeProtocols=true

PreviousSwaggerNextExample

Last updated 1 year ago

3️⃣