Skip to content

Commit

Permalink
Merge pull request #349 from EdgeApp/matthew/rename-thorchainda
Browse files Browse the repository at this point in the history
Rename Thorchain DEX Aggregator to SwapKit
  • Loading branch information
peachbits authored Nov 11, 2024
2 parents 71a3ccd + d6f8c2a commit 6a88495
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- changed: Rename Thorchain DEX Aggregator to SwapKit

## 2.13.0 (2024-10-31)

- added: Add TON unique IDs to swap partners
Expand Down
4 changes: 2 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import { makeCosmosIbcPlugin } from './swap/defi/cosmosIbc'
import { makeLifiPlugin } from './swap/defi/lifi'
import { makeRangoPlugin } from './swap/defi/rango'
import { makeMayaProtocolPlugin } from './swap/defi/thorchain/mayaprotocol'
import { makeSwapKitPlugin } from './swap/defi/thorchain/swapkit'
import { makeThorchainPlugin } from './swap/defi/thorchain/thorchain'
import { makeThorchainDaPlugin } from './swap/defi/thorchain/thorchainDa'
import { makeSpookySwapPlugin } from './swap/defi/uni-v2-based/plugins/spookySwap'
import { makeTombSwapPlugin } from './swap/defi/uni-v2-based/plugins/tombSwap'
import { makeVelodromePlugin } from './swap/defi/uni-v2-based/plugins/velodrome'
Expand All @@ -37,7 +37,7 @@ const plugins = {
swapuz: makeSwapuzPlugin,
mayaprotocol: makeMayaProtocolPlugin,
thorchain: makeThorchainPlugin,
thorchainda: makeThorchainDaPlugin,
swapkit: makeSwapKitPlugin,
tombSwap: makeTombSwapPlugin,
transfer: makeTransferPlugin,
velodrome: makeVelodromePlugin,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ import {
THORNODE_SERVERS_DEFAULT
} from './thorchain'

const pluginId = 'thorchainda'
const pluginId = 'swapkit'
const swapInfo: EdgeSwapInfo = {
pluginId,
isDex: true,
displayName: 'Thorchain DEX Aggregator',
displayName: 'SwapKit',
supportEmail: '[email protected]'
}

Expand Down Expand Up @@ -102,7 +102,7 @@ const asThorSwapQuoteResponse = asObject({
const asExchangeInfo = asObject({
swap: asObject({
plugins: asObject({
thorchainda: asObject({
swapkit: asObject({
daVolatilitySpread: asOptional(asNumber),
affiliateFeeBasis: asOptional(asString),
thornodeServersWithPath: asOptional(asArray(asString)),
Expand Down Expand Up @@ -135,9 +135,7 @@ const tokenProxyMap: { [currencyPluginId: string]: string } = {
avalanche: '0x69ba883af416ff5501d54d5e27a1f497fbd97156'
}

export function makeThorchainDaPlugin(
opts: EdgeCorePluginOptions
): EdgeSwapPlugin {
export function makeSwapKitPlugin(opts: EdgeCorePluginOptions): EdgeSwapPlugin {
const { io, log } = opts
const { fetchCors = io.fetch } = io
const {
Expand Down Expand Up @@ -228,12 +226,12 @@ export function makeThorchainDaPlugin(
}

if (exchangeInfo != null) {
const { thorchainda } = exchangeInfo.swap.plugins
const { swapkit } = exchangeInfo.swap.plugins
daVolatilitySpread =
thorchainda.daVolatilitySpread ?? DA_VOLATILITY_SPREAD_DEFAULT
thorswapServers = thorchainda.thorSwapServers ?? THORSWAP_DEFAULT_SERVERS
swapkit.daVolatilitySpread ?? DA_VOLATILITY_SPREAD_DEFAULT
thorswapServers = swapkit.thorSwapServers ?? THORSWAP_DEFAULT_SERVERS
thornodeServersWithPath =
thorchainda.thornodeServersWithPath ?? thornodeServersWithPath
swapkit.thornodeServersWithPath ?? thornodeServersWithPath
}

const volatilitySpreadFinal = daVolatilitySpread // Might add a likeKind spread later
Expand Down Expand Up @@ -283,7 +281,7 @@ export function makeThorchainDaPlugin(
if (!iaResponse.ok) {
const responseText = await iaResponse.text()
throw new Error(
`Thorchain could not fetch inbound_addresses: ${JSON.stringify(
`SwapKit could not fetch inbound_addresses: ${JSON.stringify(
responseText,
null,
2
Expand All @@ -293,7 +291,7 @@ export function makeThorchainDaPlugin(
if (!thorSwapResponse.ok) {
const responseText = await thorSwapResponse.text()
throw new Error(
`Thorchain could not get thorswap quote: ${JSON.stringify(
`SwapKit could not get thorswap quote: ${JSON.stringify(
responseText,
null,
2
Expand Down
2 changes: 1 addition & 1 deletion test/createUserDump.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function main(): Promise<void> {
avalanche: true,
piratechain: true,
polygon: true,
thorchainda: true
swapkit: true
}
})
const account = await context.createAccount({
Expand Down
9 changes: 9 additions & 0 deletions test/testconfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ export const asTestConfig = asObject({
thorname: asOptional(asString, 'ej')
}).withRest
),
SWAPKIT_INIT: asCorePluginInit(
asObject({
affiliateFeeBasis: asOptional(asString, '50'),
appId: asOptional(asString, 'edge'),
ninerealmsClientId: asOptional(asString, ''),
thorname: asOptional(asString, 'ej'),
thorswapApiKey: asOptional(asString)
}).withRest
),
TOMB_SWAP_INIT: asCorePluginInit(
asObject({
quiknodeApiKey: asOptional(asString, '')
Expand Down
2 changes: 1 addition & 1 deletion test/testpartner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ async function main(): Promise<void> {
piratechain: true,
rango: config.RANGO_INIT,
thorchain: config.THORCHAIN_INIT,
thorchainda: config.THORCHAIN_INIT
swapkit: config.SWAPKIT_INIT
}
}

Expand Down

0 comments on commit 6a88495

Please sign in to comment.