Skip to content

Commit

Permalink
Feat/kado plugin (#1107)
Browse files Browse the repository at this point in the history
* wip: kado plugin

* fix: Correct function name and update parameters in offRampQuote

* fix: update the on and off ramp quote functions in the Kado plugin

The commit message is:

fix: update the on and off ramp quote functions in the Kado plugin

* fix: update Kado plugin to use new API endpoints

* feat: add KadoQuoteResponse type

* feat: Update onRampQuote and offRampQuote functions in Kado plugin

* feat: Extend KadoQuoteRequest type with additional fiat methods and currencies

* feat: add getOrderStatus with GET

* feat: adds kado quoting

* feat: adds kado tokenlist

* feat: WIP kado plugin updates

* feat: fix kado quote mapping

* feat: kado plugin

* chore: fix lint issues

* chore: remove aider files

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
towanTG and github-actions[bot] authored Dec 4, 2024
1 parent be50199 commit d88fe02
Show file tree
Hide file tree
Showing 34 changed files with 1,039 additions and 46 deletions.
12 changes: 12 additions & 0 deletions .changeset/witty-rats-arrive.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@swapkit/plugin-thorchain": minor
"@swapkit/helpers": minor
"@swapkit/tokens": minor
"@swapkit/wallet-ledger": minor
"@swapkit/plugin-radix": minor
"@swapkit/plugin-kado": minor
"@swapkit/core": minor
"@swapkit/sdk": minor
---

Adds Kado plugin
Binary file modified bun.lockb
Binary file not shown.
Empty file.
4 changes: 4 additions & 0 deletions packages/plugins/kado/build.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { buildPackage } from "../../../tools/builder";
import { dependencies } from "./package.json";

buildPackage({ dependencies });
32 changes: 32 additions & 0 deletions packages/plugins/kado/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"author": "swapkit-oss",
"dependencies": {
"@swapkit/api": "workspace:*",
"@swapkit/helpers": "workspace:*"
},
"description": "SwapKit Plugin - Kado",
"files": [
"src/",
"dist/"
],
"homepage": "https://github.com/thorswap/SwapKit",
"license": "Apache-2.0",
"main": "./dist/index.js",
"name": "@swapkit/plugin-kado",
"react-native": "./src/index.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/thorswap/SwapKit.git"
},
"scripts": {
"build": "bun run ./build.ts",
"clean": "rm -rf dist node_modules *.tsbuildinfo",
"lint": "biome check --write ./src",
"test": "echo 'bun test'",
"test:coverage": "bun test --coverage",
"type-check": "tsc --noEmit"
},
"type": "module",
"types": "./src/index.ts",
"version": "0.0.0"
}
29 changes: 29 additions & 0 deletions packages/plugins/kado/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { Chain } from "@swapkit/helpers";

export const SupportedKadoChain = {
thorchain: Chain.THORChain,
solana: Chain.Solana,
polygon: Chain.Polygon,
Optimism: Chain.Optimism,
litecoin: Chain.Litecoin,
kujira: Chain.Kujira,
ethereum: Chain.Ethereum,
"cosmos hub": Chain.Cosmos,
bitcoin: Chain.Bitcoin,
base: Chain.Base,
Avalanche: Chain.Avalanche,
Arbitrum: Chain.Arbitrum,
};

export const ChainToKadoChain = (chain: Chain) => {
const entries = Object.entries(SupportedKadoChain);
const found = entries.find(([_, value]) => value === chain);
if (!found) throw new Error(`Chain ${chain} not supported`);
return found[0];
};

export const KadoChainToChain = (kadoChain: string) => {
const found = Object.keys(SupportedKadoChain).includes(kadoChain);
if (!found) throw new Error(`KadoChain ${kadoChain} not supported`);
return SupportedKadoChain[kadoChain as keyof typeof SupportedKadoChain];
};
1 change: 1 addition & 0 deletions packages/plugins/kado/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./plugin";
Loading

0 comments on commit d88fe02

Please sign in to comment.