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:
GET /api/swap/quote?amount=&fromTokenAddress=&toTokenAddress=
GET /api/swap?fromAddress=&amount=&fromTokenAddress=&toTokenAddress=
GET /api/info/tokens
GET /api/info/providers
GET /api/approve/spender
GET /api/approve/transaction?fromAddress=&tokenAddress=&amount=
GET /api/approve/allowance?fromAddress=&tokenAddress=
- Run
yarn
in the root folder - Run
yarn develop
when developing - Run
yarn test
to run tests - Run
yarn distribute
to run on production
And you should be good to go! Feel free to fork and submit pull requests
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.