dragoonzx / yak-spirit-api

Yield Yak Swap (DEX aggregator for Avalanche) API

Home Page:https://yakspirit.com/api/swagger

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🐃 Yield Yak Aggregator API

License: MIT Yak Spirit

Usage

Check swagger for endpoints, parameters and more info

In order to execute swap transaction you need to check if user allowed to spend input tokens amount. If not, use approve endpoint and send approve tx

Example of getting best path from token to token (amount translates into base units under the hood, so in example below we want to quote for 10 AVAX):

GET https://yakspirit.com/api/swap/quote?amount=10&fromTokenAddress=0x0000000000000000000000000000000000000000&toTokenAddress=0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7

Response:

{
  "amounts": [
    { "type": "BigNumber", "hex": "0x8ac7230489e80000" },
    { "type": "BigNumber", "hex": "0x8ac7230489e80000" }
  ],
  "adapters": [ "0x5C4d23fd18Fc4128f77426F42237acFcE618D0b1" ],
  "path": [ "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7", "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" ],
  "gasEstimate": { "type": "BigNumber", "hex": "0x02bf20" }
}

Quick overview:

Swap

Get best path from token to token

GET /api/swap/quote?amount=&fromTokenAddress=&toTokenAddress=

Get swap transaction for best path

GET /api/swap?fromAddress=&amount=&fromTokenAddress=&toTokenAddress=

Info

Get tokens list

GET /api/info/tokens

Get providers list

GET /api/info/providers

Approve

Get Yak Router address

GET /api/approve/spender

Get transaction for ERC20 token spend approve

GET /api/approve/transaction?fromAddress=&tokenAddress=&amount=

Get allowed amount to spend

GET /api/approve/allowance?fromAddress=&tokenAddress=

Development

  1. Run yarn in the root folder
  2. Run yarn develop when developing
  3. Run yarn test to run tests
  4. Run yarn distribute to run on production

And you should be good to go! Feel free to fork and submit pull requests

Contributing

Interested in contributing to the Yak Spirit or Yield Yak Aggregator API? Thanks so much for your interest! We are always looking for improvements to the project and contributions from open-source developers are greatly appreciated.

If you have a contribution in mind, please open issue or PR with your ideas.

About

Yield Yak Swap (DEX aggregator for Avalanche) API

https://yakspirit.com/api/swagger

License:MIT License


Languages

Language:TypeScript 99.0%Language:JavaScript 1.0%