Skip to content

Commit 05b84eb

Browse files
committed
Upgrade to Swapkit v3
1 parent fecc092 commit 05b84eb

File tree

6 files changed

+283
-177
lines changed

6 files changed

+283
-177
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- changed: (SwapKit) Upgrade to v3 API
6+
57
## 2.40.4 (2026-01-15)
68

79
- fixed: Fix Rango EVM approval address

scripts/mappings/swapkitMappings.ts

Lines changed: 27 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,38 @@ export const swapkit = new Map<string, EdgeCurrencyPluginId | null>()
44
// Display Name: ARB
55
swapkit.set('ARB', 'arbitrum')
66

7-
// Display Name: AVAX
8-
swapkit.set('AVAX', null)
7+
// Display Name: AVAX - THORCHAIN supported
8+
swapkit.set('AVAX', 'avalanche')
99

10-
// Display Name: BASE
11-
swapkit.set('BASE', null)
10+
// Display Name: BASE - THORCHAIN supported
11+
swapkit.set('BASE', 'base')
1212

13-
// Display Name: BCH
14-
swapkit.set('BCH', null)
13+
// Display Name: BCH - THORCHAIN supported
14+
swapkit.set('BCH', 'bitcoincash')
1515

1616
// Display Name: BERA
1717
swapkit.set('BERA', null)
1818

19-
// Display Name: BSC
20-
swapkit.set('BSC', null)
19+
// Display Name: BSC - THORCHAIN supported
20+
swapkit.set('BSC', 'binancesmartchain')
2121

22-
// Display Name: BTC
23-
swapkit.set('BTC', null)
22+
// Display Name: BTC - THORCHAIN & MAYACHAIN supported
23+
swapkit.set('BTC', 'bitcoin')
2424

25-
// Display Name: DASH
25+
// Display Name: DASH - MAYACHAIN supported
2626
swapkit.set('DASH', 'dash')
2727

28-
// Display Name: DOGE
29-
swapkit.set('DOGE', null)
28+
// Display Name: DOGE - THORCHAIN supported
29+
swapkit.set('DOGE', 'dogecoin')
3030

3131
// Display Name: DOT
3232
swapkit.set('DOT', 'polkadot')
3333

34-
// Display Name: ETH
35-
swapkit.set('ETH', null)
34+
// Display Name: ETH - THORCHAIN & MAYACHAIN supported
35+
swapkit.set('ETH', 'ethereum')
3636

37-
// Display Name: GAIA
37+
// Display Name: GAIA - THORCHAIN supported (Cosmos Hub)
38+
// Disabled: swapkit plugin only supports EVM and UTXO chain types
3839
swapkit.set('GAIA', null)
3940

4041
// Display Name: GNO
@@ -43,8 +44,8 @@ swapkit.set('GNO', null)
4344
// Display Name: KUJI
4445
swapkit.set('KUJI', null)
4546

46-
// Display Name: LTC
47-
swapkit.set('LTC', null)
47+
// Display Name: LTC - THORCHAIN supported
48+
swapkit.set('LTC', 'litecoin')
4849

4950
// Display Name: MAYA
5051
swapkit.set('MAYA', null)
@@ -67,17 +68,21 @@ swapkit.set('SOL', 'solana')
6768
// Display Name: SUI
6869
swapkit.set('SUI', 'sui')
6970

70-
// Display Name: THOR
71+
// Display Name: THOR - THORCHAIN native
72+
// Disabled: swapkit plugin only supports EVM and UTXO chain types
7173
swapkit.set('THOR', null)
7274

73-
// Display Name: TRON
75+
// Display Name: TRON - THORCHAIN supported
76+
// Disabled: swapkit plugin only supports EVM and UTXO chain types
7477
swapkit.set('TRON', null)
7578

7679
// Display Name: XRD
7780
swapkit.set('XRD', null)
7881

79-
// Display Name: XRP
82+
// Display Name: XRP - THORCHAIN supported
83+
// Disabled: swapkit plugin only supports EVM and UTXO chain types
8084
swapkit.set('XRP', null)
8185

82-
// Display Name: ZEC
86+
// Display Name: ZEC - MAYACHAIN supported
87+
// Disabled: requires ZIP-321 handling not implemented in swapkit plugin
8388
swapkit.set('ZEC', null)

scripts/synchronizers/swapkit/swapkitSynchronizer.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { asJSON } from 'cleaners'
12
import fetch from 'node-fetch'
23

34
import { MapctlConfig } from '../../mapctlConfig'
@@ -40,8 +41,8 @@ export const makeSwapKitSynchronizer = (
4041
)
4142
}
4243

43-
const providersJson = await providersResponse.json()
44-
const providers = asSwapKitResponse(providersJson)
44+
const providersText = await providersResponse.text()
45+
const providers = asJSON(asSwapKitResponse)(providersText)
4546

4647
// Extract provider names from the providers response
4748
const providerNames = new Set<string>()
@@ -78,8 +79,8 @@ export const makeSwapKitSynchronizer = (
7879
continue
7980
}
8081

81-
const tokensJson = await tokensResponse.json()
82-
const tokensData = asSwapKitTokensResponse(tokensJson)
82+
const tokensText = await tokensResponse.text()
83+
const tokensData = asJSON(asSwapKitTokensResponse)(tokensText)
8384

8485
// Extract unique chain ticker codes from tokens
8586
// The `chain` field contains the ticker code (e.g., "BTC", "ETH", "SOL")
@@ -88,10 +89,11 @@ export const makeSwapKitSynchronizer = (
8889
chainTickers.add(token.chain)
8990
}
9091
})
91-
} catch (error: any) {
92+
} catch (error: unknown) {
93+
const message = error instanceof Error ? error.message : String(error)
9294
console.warn(
9395
`Error fetching tokens for provider ${providerName}:`,
94-
error.message
96+
message
9597
)
9698
// Continue with other providers
9799
}

src/mappings/swapkit.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ swapkit.set('abstract', null)
1818
swapkit.set('algorand', null)
1919
swapkit.set('amoy', null)
2020
swapkit.set('arbitrum', 'ARB')
21-
swapkit.set('avalanche', null)
21+
swapkit.set('avalanche', 'AVAX')
2222
swapkit.set('axelar', null)
2323
swapkit.set('badcoin', null)
24-
swapkit.set('base', null)
24+
swapkit.set('base', 'BASE')
2525
swapkit.set('binance', null)
26-
swapkit.set('binancesmartchain', null)
27-
swapkit.set('bitcoin', null)
28-
swapkit.set('bitcoincash', null)
26+
swapkit.set('binancesmartchain', 'BSC')
27+
swapkit.set('bitcoin', 'BTC')
28+
swapkit.set('bitcoincash', 'BCH')
2929
swapkit.set('bitcoincashtestnet', null)
3030
swapkit.set('bitcoingold', null)
3131
swapkit.set('bitcoingoldtestnet', null)
@@ -42,12 +42,12 @@ swapkit.set('coreum', null)
4242
swapkit.set('cosmoshub', null)
4343
swapkit.set('dash', 'DASH')
4444
swapkit.set('digibyte', null)
45-
swapkit.set('dogecoin', null)
45+
swapkit.set('dogecoin', 'DOGE')
4646
swapkit.set('eboost', null)
4747
swapkit.set('ecash', null)
4848
swapkit.set('eos', null)
4949
swapkit.set('ethDev', null)
50-
swapkit.set('ethereum', null)
50+
swapkit.set('ethereum', 'ETH')
5151
swapkit.set('ethereumclassic', null)
5252
swapkit.set('ethereumpow', null)
5353
swapkit.set('fantom', null)
@@ -62,7 +62,7 @@ swapkit.set('holesky', null)
6262
swapkit.set('hyperevm', null)
6363
swapkit.set('liberland', null)
6464
swapkit.set('liberlandtestnet', null)
65-
swapkit.set('litecoin', null)
65+
swapkit.set('litecoin', 'LTC')
6666
swapkit.set('monero', null)
6767
swapkit.set('optimism', 'OP')
6868
swapkit.set('osmosis', null)

0 commit comments

Comments
 (0)