Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
"ethers": "^5.7.0",
"hashjs": "^1.2.0",
"iso4217": "^0.2.0",
"jsrsasign": "^10.8.6",
"utf8": "^3.0.0"
},
"devDependencies": {
Expand All @@ -61,6 +62,7 @@
"@types/chai": "^4.2.9",
"@types/chai-as-promised": "^7.1.3",
"@types/jsonfile": "^6.0.1",
"@types/jsrsasign": "^10.5.8",
"@types/mocha": "^7.0.1",
"@types/node": "^16.11.18",
"@types/node-fetch": "2.x",
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { makeNomicsPlugin } from './rate/nomics'
import { makeWazirxPlugin } from './rate/wazirx'
import { makeChangeHeroPlugin } from './swap/changehero'
import { makeChangeNowPlugin } from './swap/changenow'
import { makeCriptointercambioPlugin } from './swap/criptointercambio';
import { makeLifiPlugin } from './swap/defi/lifi'
import { makeThorchainPlugin } from './swap/defi/thorchain'
import { makeThorchainDaPlugin } from './swap/defi/thorchainDa'
Expand Down Expand Up @@ -41,6 +42,7 @@ const edgeCorePlugins = {
// Swap plugins:
changehero: makeChangeHeroPlugin,
changenow: makeChangeNowPlugin,
criptointercambio: makeCriptointercambioPlugin,
exolix: makeExolixPlugin,
godex: makeGodexPlugin,
lifi: makeLifiPlugin,
Expand Down
28 changes: 28 additions & 0 deletions src/swap-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,3 +386,31 @@ export const getTokenId = (

export const consify = (val: any): void =>
console.log(JSON.stringify(val, null, 2))

export const checkEthTokensOnly = (
swapInfo: EdgeSwapInfo,
request: EdgeSwapRequest
): void => {
const currencyFromWallet = request.fromWallet.currencyInfo.currencyCode
const currencyToWallet = request.toWallet.currencyInfo.currencyCode

if (
currencyFromWallet !== request.fromCurrencyCode &&
currencyFromWallet !== 'ETH'
) {
throw new SwapCurrencyError(
swapInfo,
request.fromCurrencyCode as string,
request.toCurrencyCode
)
} else if (
currencyToWallet !== request.toCurrencyCode &&
currencyToWallet !== 'ETH'
) {
throw new SwapCurrencyError(
swapInfo,
request.fromCurrencyCode as string,
request.toCurrencyCode
)
}
}
Loading