Skip to content

Commit 473c4e9

Browse files
committed
add swell support
1 parent 6fb6e54 commit 473c4e9

File tree

8 files changed

+189
-4
lines changed

8 files changed

+189
-4
lines changed

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,10 @@
7171
"typescript": "^5.7.2",
7272
"vite-tsconfig-paths": "^5.1.3",
7373
"vitest": "^2.1.6"
74+
},
75+
"pnpm": {
76+
"patchedDependencies": {
77+
78+
}
7479
}
7580
}

patches/@[email protected]

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
diff --git a/dist/services/quotes/quote-service.js b/dist/services/quotes/quote-service.js
2+
index 87b99845acffff1c3c103de1d41b250debe1b840..4439c828dcbd28ea1e202bee0b2f144bf0c4105c 100644
3+
--- a/dist/services/quotes/quote-service.js
4+
+++ b/dist/services/quotes/quote-service.js
5+
@@ -131,16 +131,17 @@ class QuoteService {
6+
return result;
7+
}
8+
async listResponseToQuoteResponse({ request, response: responsePromise, promises, }) {
9+
- const [response, tokens, prices, gasCalculator] = await Promise.all([
10+
+ let [response, tokens, prices, gasCalculator] = await Promise.all([
11+
responsePromise,
12+
promises.tokens,
13+
promises.prices,
14+
promises.gasCalculator,
15+
]);
16+
- if (!tokens)
17+
+ if (!tokens && request.chainId !== 1923)
18+
throw new Error(`Failed to fetch the quote's tokens`);
19+
- if (!gasCalculator)
20+
+ if (!gasCalculator && request.chainId !== 1923)
21+
throw new Error(`Failed to fetch gas data`);
22+
+ if (request.chainId === 1923) tokens = {}
23+
const sellToken = { ...tokens[request.sellToken], price: prices?.[request.sellToken]?.price };
24+
const buyToken = { ...tokens[request.buyToken], price: prices?.[request.buyToken]?.price };
25+
let gas;
26+
diff --git a/dist/shared/defi-llama.js b/dist/shared/defi-llama.js
27+
index 2b237c74bdb3d8185ea1b2a221955244f2ccf9ea..6472633c4606d35e7dd5ffb6cf0222e0c89d0ebc 100644
28+
--- a/dist/shared/defi-llama.js
29+
+++ b/dist/shared/defi-llama.js
30+
@@ -37,6 +37,7 @@ const CHAIN_ID_TO_KEY = {
31+
[_chains_1.Chains.SCROLL.chainId]: 'scroll',
32+
[_chains_1.Chains.MANTLE.chainId]: 'mantle',
33+
[_chains_1.Chains.METIS_ANDROMEDA.chainId]: 'metis',
34+
+ [1923]: 'swell',
35+
};
36+
const KEY_TO_CHAIN_ID = Object.fromEntries(Object.entries(CHAIN_ID_TO_KEY).map(([chainId, key]) => [key, parseInt(chainId)]));
37+
class DefiLlamaClient {

pnpm-lock.yaml

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/utils/contractBook.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const contractBook: any = {
77
[chains.mainnet.id]: "0x2Bba09866b6F1025258542478C39720A09B728bF",
88
[chains.base.id]: "0x0D3d0F97eD816Ca3350D627AD8e57B6AD41774df",
99
[chains.polygon.id]: "0x3e43F3CE1C364722df6470381Fa1F15ffbFB37E3",
10+
[1923]: "0x05Eb1A647265D974a1B0A57206048312604Ac6C3",
1011
},
1112
},
1213
swapVerifier: {
@@ -15,6 +16,7 @@ const contractBook: any = {
1516
[chains.mainnet.id]: "0xae26485ACDDeFd486Fe9ad7C2b34169d360737c7",
1617
[chains.base.id]: "0x30660764A7a05B84608812C8AFC0Cb4845439EEe",
1718
[chains.polygon.id]: "0x50C5ca05E916459F32c517932f1b4D78fb11018F",
19+
[1923]: "0x392C1570b3Bf29B113944b759cAa9a9282DA12Fe",
1820
},
1921
},
2022
}

src/common/utils/tokenList.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Address } from "viem"
22
import tokenList1 from "../../tokenLists/tokenList_1"
3+
import tokenList1923 from "../../tokenLists/tokenList_1923"
34
import tokenList8453 from "../../tokenLists/tokenList_8543"
45

56
export type TokenListItem = {
@@ -19,6 +20,7 @@ export type TokenListItem = {
1920
const cache: Record<number, TokenListItem[]> = {
2021
1: tokenList1 as TokenListItem[],
2122
8453: tokenList8453 as TokenListItem[],
23+
1923: tokenList1923 as TokenListItem[],
2224
}
2325

2426
export default function getTokenList(chainId: number): TokenListItem[] {

src/swapService/strategies/balmySDK/neptuneQuoteSource.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,9 @@ export class CustomNeptuneQuoteSource
107107
(await response.text()) || `Failed with status ${response.status}`,
108108
)
109109
}
110+
110111
const {
111-
amountOut,
112+
quote: { amountOut },
112113
tx: { router, data },
113114
} = await response.json()
114115
return { amountOut, data, to: router }

src/swapService/strategies/strategyBalmySDK.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ export class StrategyBalmySDK {
134134
async supports(swapParams: SwapParams) {
135135
return (
136136
!isExactInRepay(swapParams) &&
137-
this.sdk.quoteService.supportedChains().includes(swapParams.chainId)
137+
(this.sdk.quoteService.supportedChains().includes(swapParams.chainId) ||
138+
swapParams.chainId === 1923) // TODO fix!
138139
)
139140
}
140141

src/tokenLists/tokenList_1923.js

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
export default [
2+
{
3+
addressInfo: "0x4200000000000000000000000000000000000006",
4+
chainId: 1923,
5+
name: "Wrapped Ether",
6+
symbol: "WETH",
7+
decimals: 18,
8+
logoURI:
9+
"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",
10+
meta: {},
11+
},
12+
{
13+
addressInfo: "0x7c98E0779EB5924b3ba8cE3B17648539ed5b0Ecc",
14+
chainId: 1923,
15+
name: "Wrapped liquid staked Ether 2.0",
16+
symbol: "wstETH",
17+
decimals: 18,
18+
logoURI: "/tokens/1923/wsteth.png",
19+
meta: {},
20+
},
21+
{
22+
addressInfo: "0xA6cB988942610f6731e664379D15fFcfBf282b44",
23+
chainId: 1923,
24+
name: "Wrapped eETH",
25+
symbol: "weETH",
26+
decimals: 18,
27+
logoURI:
28+
"https://coin-images.coingecko.com/coins/images/33033/large/weETH.png?1701438396",
29+
meta: {},
30+
},
31+
{
32+
addressInfo: "0x2416092f143378750bb29b79eD961ab195CcEea5",
33+
chainId: 1923,
34+
name: "Renzo Restaked ETH",
35+
symbol: "ezETH",
36+
decimals: 18,
37+
logoURI:
38+
"https://assets.coingecko.com/coins/images/34753/standard/Ezeth_logo_circle.png?1713496404",
39+
meta: {},
40+
},
41+
{
42+
addressInfo: "0xc3eACf0612346366Db554C991D7858716db09f58",
43+
chainId: 1923,
44+
name: "KelpDao Restaked ETH",
45+
symbol: "rsETH",
46+
decimals: 18,
47+
logoURI:
48+
"https://coin-images.coingecko.com/coins/images/33800/large/Icon___Dark.png?1702991855",
49+
meta: {},
50+
},
51+
{
52+
addressInfo: "0x09341022ea237a4DB1644DE7CCf8FA0e489D85B7",
53+
chainId: 1923,
54+
name: "swETH",
55+
symbol: "swETH",
56+
decimals: 18,
57+
logoURI:
58+
"https://assets.coingecko.com/coins/images/30326/standard/_lB7zEtS_400x400.jpg?1696529227",
59+
meta: {},
60+
},
61+
{
62+
addressInfo: "0x18d33689AE5d02649a859A1CF16c9f0563975258",
63+
chainId: 1923,
64+
name: "rswETH",
65+
symbol: "rswETH",
66+
decimals: 18,
67+
logoURI:
68+
"https://coin-images.coingecko.com/coins/images/34489/large/rswETH_Icon.png?1706865484",
69+
meta: {},
70+
},
71+
{
72+
addressInfo: "0x9cb41CD74D01ae4b4f640EC40f7A60cA1bCF83E7",
73+
chainId: 1923,
74+
name: "Renzo Restaked LST",
75+
symbol: "pzETH",
76+
decimals: 18,
77+
logoURI:
78+
"https://coin-images.coingecko.com/coins/images/39124/large/200x200.png?1720629607",
79+
meta: {},
80+
},
81+
{
82+
addressInfo: "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
83+
chainId: 1923,
84+
name: "USDe",
85+
symbol: "USDe",
86+
decimals: 18,
87+
logoURI:
88+
"https://assets.coingecko.com/coins/images/33613/standard/usde.png?1733810059",
89+
meta: {},
90+
},
91+
{
92+
addressInfo: "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2",
93+
chainId: 1923,
94+
name: "Staked USDe",
95+
symbol: "sUSDe",
96+
decimals: 18,
97+
logoURI:
98+
"https://assets.coingecko.com/coins/images/33669/large/sUSDe-Symbol-Color.png?1716307680",
99+
meta: {},
100+
},
101+
{
102+
addressInfo: "0x1cf7b5f266A0F39d6f9408B90340E3E71dF8BF7B",
103+
chainId: 1923,
104+
name: "swBTC",
105+
symbol: "swBTC",
106+
decimals: 8,
107+
logoURI:
108+
"https://assets.coingecko.com/coins/images/39682/standard/swBTC200x200.png?1723652322",
109+
meta: {},
110+
},
111+
{
112+
addressInfo: "0x58538e6A46E07434d7E7375Bc268D3cb839C0133",
113+
chainId: 1923,
114+
name: "ENA",
115+
symbol: "ENA",
116+
decimals: 18,
117+
logoURI:
118+
"https://assets.coingecko.com/coins/images/36530/standard/ethena.png?1711701436",
119+
meta: {},
120+
},
121+
{
122+
addressInfo: "0x2826D136F5630adA89C1678b64A61620Aab77Aea",
123+
chainId: 1923,
124+
name: "Swell Governance Token",
125+
symbol: "SWELL",
126+
decimals: 18,
127+
logoURI:
128+
"https://assets.coingecko.com/coins/images/28777/standard/swell1.png?1727899715",
129+
meta: {},
130+
},
131+
]

0 commit comments

Comments
 (0)