This repository serves as a guide for developers looking to conduct swaps via the KyberSwap Aggregator APIs in a typescript environment. For simplicity, the examples are implemented purely in Node.js so that users can focus on the backend logic required to achieve swaps at superior rates.
For more performant route querying and, please refer to the [V1] implementation:
- Query Swap Route (
getSwapRouteV1()) - Encode Preferred Swap Route (
postSwapRouteV1()) - Executre Swap Transaction On-Chain (
V1Swap())
To aid with readability, each operation has its own .ts file which has been categorized under the /src/operations/ folder. Users can run specific operations by commenting or uncommenting the relevant function in index.ts.
To run the examples:
- Clone this repository
- Install dependencies:
npm install - Set up the ethers.js signer under
/src/libs/signer.ts. - Run dev environment:
npm run start
Full API specifications, dev guide, and related sequence diagrams are available on our Docs:
Note that the code samples in this repository are not production-ready and are meant as references to get you started on integrating KyberSwap Aggregator functionality into your dApp.