Skip to content

Commit

Permalink
Add Jupiter provider token list (#1088)
Browse files Browse the repository at this point in the history
* Add Jupiter provider token list

* Adjust Jupiter test

* fix: token list export

* chore: update correct jupiter tokenlist

* chore: update correct jupiter tokenlist

* chore: update correct jupiter tokenlist

* chore: remove ociswap tokenlist

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
alexisshleverx and github-actions[bot] authored Nov 13, 2024
1 parent d317f5c commit a2f1571
Show file tree
Hide file tree
Showing 21 changed files with 2,663 additions and 4,072 deletions.
5 changes: 5 additions & 0 deletions .changeset/dirty-scissors-glow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@swapkit/helpers": minor
---

Adds new token provider to TokenNames type
6 changes: 6 additions & 0 deletions .changeset/nice-countries-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@swapkit/helpers": patch
"@swapkit/tokens": patch
---

Add Jupiter tokenlist
17 changes: 17 additions & 0 deletions packages/swapkit/helpers/src/helpers/__tests__/others.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,21 @@ describe("getAssetBy", () => {
});
expect(assetByChainAndContract?.toUpperCase()).toBe("XRD.XRD".toUpperCase());
});

test("find asset by chain and Solana resource", async () => {
const assetByChainAndContract = await findAssetBy({
chain: Chain.Solana,
contract: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
});
expect(assetByChainAndContract?.toUpperCase()).toBe(
"SOL.USDC-EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v".toUpperCase(),
);
});

test("find asset by Solana identifier", async () => {
const assetByChainAndContract = await findAssetBy({
identifier: "SOL.SOL",
});
expect(assetByChainAndContract?.toUpperCase()).toBe("SOL.SOL".toUpperCase());
});
});
2 changes: 1 addition & 1 deletion packages/swapkit/helpers/src/helpers/asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export const filterAssets = (

export async function findAssetBy(
params:
| { chain: EVMChain | Chain.Radix; contract: string }
| { chain: EVMChain | Chain.Radix | Chain.Solana; contract: string }
| { identifier: `${Chain}.${string}` },
) {
const tokenPackages = await import("@swapkit/tokens");
Expand Down
6 changes: 5 additions & 1 deletion packages/swapkit/helpers/src/types/quotes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,15 @@ export enum WarningCodeEnum {
}

export enum ProviderName {
CAVIAR_V1 = "CAVIAR_V1",
CAMELOT_V3 = "CAMELOT_V3",
CHAINFLIP = "CHAINFLIP",
JUPITER = "JUPITER",
MAYACHAIN = "MAYACHAIN",
MAYACHAIN_STREAMING = "MAYACHAIN_STREAMING",
OCISWAP_V1 = "OCISWAP_V1",
ONEINCH = "ONEINCH",
OPENOCEAN_V2 = "OPENOCEAN_V2",
PANCAKESWAP = "PANCAKESWAP",
PANGOLIN_V1 = "PANGOLIN_V1",
SUSHISWAP_V2 = "SUSHISWAP_V2",
Expand All @@ -130,7 +135,6 @@ export enum ProviderName {
TRADERJOE_V2 = "TRADERJOE_V2",
UNISWAP_V2 = "UNISWAP_V2",
UNISWAP_V3 = "UNISWAP_V3",
CAVIAR_V1 = "CAVIAR_V1",
}

export enum FeeTypeEnum {
Expand Down
14 changes: 8 additions & 6 deletions packages/swapkit/helpers/src/types/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type {
CaviarV1List,
ChainflipList,
JupiterList,
MayaList,
// OciswapV1List,
OneInchList,
OpenOceanV2List,
PancakeswapList,
PangolinList,
SushiswapList,
Expand All @@ -14,19 +18,17 @@ import type {
export type TokenTax = { buy: number; sell: number };

export type TokenNames =
| (typeof CaviarV1List)["tokens"][number]["identifier"]
| (typeof ChainflipList)["tokens"][number]["identifier"]
| (typeof JupiterList)["tokens"][number]["identifier"]
| (typeof MayaList)["tokens"][number]["identifier"]
// | (typeof OciswapV1List)["tokens"][number]["identifier"]
| (typeof OneInchList)["tokens"][number]["identifier"]
| (typeof OpenOceanV2List)["tokens"][number]["identifier"]
| (typeof PancakeswapList)["tokens"][number]["identifier"]
| (typeof PangolinList)["tokens"][number]["identifier"]
| (typeof SushiswapList)["tokens"][number]["identifier"]
| (typeof ThorchainList)["tokens"][number]["identifier"]
| (typeof TraderjoeV2List)["tokens"][number]["identifier"]
| (typeof UniswapV2List)["tokens"][number]["identifier"]
| (typeof UniswapV3List)["tokens"][number]["identifier"];
// | (typeof CoinGeckoList)["tokens"][number]["identifier"]
// | (typeof PancakeswapETHList)["tokens"][number]["identifier"]
// | (typeof StargateARBList)["tokens"][number]["identifier"]
// | (typeof TraderjoeList)["tokens"][number]["identifier"]
// | (typeof WoofiList)["tokens"][number]["identifier"]
// | (typeof UniswapList)["tokens"][number]["identifier"];
8 changes: 5 additions & 3 deletions packages/swapkit/tokens/fetchTokenLists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ function parseIdentifier(identifier: string) {

const providers = (await SwapKitApi.getTokenListProvidersV2(true)).filter(
(provider) =>
![ProviderName.THORCHAIN_STREAMING, ProviderName.MAYACHAIN_STREAMING].includes(
provider.provider,
),
![
ProviderName.THORCHAIN_STREAMING,
ProviderName.MAYACHAIN_STREAMING,
ProviderName.OCISWAP_V1,
].includes(provider.provider),
);

console.info(providers);
Expand Down
2 changes: 1 addition & 1 deletion packages/swapkit/tokens/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export { list as CaviarV1List } from "./tokenLists/caviar_v1";
export { list as ChainflipList } from "./tokenLists/chainflip";
export { list as JupiterList } from "./tokenLists/jupiter";
export { list as MayaList } from "./tokenLists/mayachain";
export { list as OciswapV1List } from "./tokenLists/ociswap_v1";
// export { list as OciswapV1List } from "./tokenLists/ociswap_v1";
export { list as OneInchList } from "./tokenLists/oneinch";
export { list as OpenOceanV2List } from "./tokenLists/openocean_v2";
export { list as PancakeswapList } from "./tokenLists/pancakeswap";
Expand Down
34 changes: 32 additions & 2 deletions packages/swapkit/tokens/src/tokenLists/caviar_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ export const list = {
provider: "CAVIAR_V1",
chainId: "radix-mainnet",
name: "CAVIAR_V1",
timestamp: "2024-11-07T05:01:31.015Z",
timestamp: "2024-11-13T04:31:31.830Z",
version: {
major: 1,
minor: 0,
patch: 0,
},
keywords: [],
count: 128,
count: 131,
tokens: [
{
address: "resource_rdx1t4hw37aufauds7h7cwq24h25rxtzwe5gl7pz9qvrls2m3a7dmhh0v5",
Expand Down Expand Up @@ -391,6 +391,16 @@ export const list = {
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.floop-resource_rdx1tkhseye4w0hmf2af5enwurkxu4x29zk73yckyzhndv8xdk8tp2tn8q.png",
ticker: "floop",
},
{
address: "resource_rdx1t5l954908vmg465pkj7j37z0fn4j33cdjt2g6czavjde406y4uxdy9",
chain: "XRD",
chainId: "radix-mainnet",
decimals: 18,
identifier: "XRD.FOMO-resource_rdx1t5l954908vmg465pkj7j37z0fn4j33cdjt2g6czavjde406y4uxdy9",
logoURI:
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.fomo-resource_rdx1t5l954908vmg465pkj7j37z0fn4j33cdjt2g6czavjde406y4uxdy9.png",
ticker: "FOMO",
},
{
address: "resource_rdx1t4km4k306ul40s3zr8zwwrm25xfmx7w8ytjvdwqh0u3kkch0eph9rn",
chain: "XRD",
Expand Down Expand Up @@ -1021,6 +1031,16 @@ export const list = {
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.slg-resource_rdx1t4mtpqwly2p8pes0camm8zsalknyaag2qee9ks34y990zrcjqnmpal.png",
ticker: "SLG",
},
{
address: "resource_rdx1tka3kqqkjxcpddvcx0u300qt66z3tlzv7swqx9rklp60m5yqry6yzk",
chain: "XRD",
chainId: "radix-mainnet",
decimals: 18,
identifier: "XRD.SRG-resource_rdx1tka3kqqkjxcpddvcx0u300qt66z3tlzv7swqx9rklp60m5yqry6yzk",
logoURI:
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.srg-resource_rdx1tka3kqqkjxcpddvcx0u300qt66z3tlzv7swqx9rklp60m5yqry6yzk.png",
ticker: "SRG",
},
{
address: "resource_rdx1tk33qqrfz2m0p4t8mkpw9ahr3w3qngpwfrnhh7vq2kuqpdv90lkmcs",
chain: "XRD",
Expand Down Expand Up @@ -1280,6 +1300,16 @@ export const list = {
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.xwbtc-resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75.png",
ticker: "xwBTC",
},
{
address: "resource_rdx1t4lkvwqd7wxqcatatelre2svxy04fn6980ydzld0faqamv8nrxhzm5",
chain: "XRD",
chainId: "radix-mainnet",
decimals: 18,
identifier: "XRD.YOMM-resource_rdx1t4lkvwqd7wxqcatatelre2svxy04fn6980ydzld0faqamv8nrxhzm5",
logoURI:
"https://storage.googleapis.com/token-list-swapkit-dev/images/xrd.yomm-resource_rdx1t4lkvwqd7wxqcatatelre2svxy04fn6980ydzld0faqamv8nrxhzm5.png",
ticker: "YOMM",
},
{
address: "resource_rdx1t4tzgxlmq93c2te5ackj6v6qy8f23k6tt5rf7g3e3q49c2jmnn8tn2",
chain: "XRD",
Expand Down
2 changes: 1 addition & 1 deletion packages/swapkit/tokens/src/tokenLists/chainflip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const list = {
provider: "CHAINFLIP",
name: "CHAINFLIP",
timestamp: "2024-11-07T05:00:44.052Z",
timestamp: "2024-11-13T04:30:38.712Z",
version: {
major: 1,
minor: 0,
Expand Down
Loading

0 comments on commit a2f1571

Please sign in to comment.