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: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pipeline {
agent any
agent { label 'build' }
tools { nodejs '22' }
options {
buildDiscarder logRotator(daysToKeepStr: '30', numToKeepStr: '5')
Expand Down
4 changes: 3 additions & 1 deletion scripts/allSynchronizers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { makeSideShiftSynchronizer } from './synchronizers/sideshift/sideshiftSy
import { makeSwapKitSynchronizer } from './synchronizers/swapkit/swapkitSynchronizer'
import { makeSwapuzSynchronizer } from './synchronizers/swapuz/swapuzSynchronizer'
import { makeThorchainSynchronizer } from './synchronizers/thorchain/thorchainSynchronizer'
import { makeXgramSynchronizer } from './synchronizers/xgram/xgramSynchronizer'
import { SwapSynchronizer } from './types'

export const synchronizers: SwapSynchronizer[] = [
Expand All @@ -33,5 +34,6 @@ export const synchronizers: SwapSynchronizer[] = [
makeSideShiftSynchronizer(config),
makeSwapKitSynchronizer(config),
makeSwapuzSynchronizer(config),
makeThorchainSynchronizer(config)
makeThorchainSynchronizer(config),
makeXgramSynchronizer(config)
]
92 changes: 92 additions & 0 deletions scripts/mappings/xgramMappings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { EdgeCurrencyPluginId } from '../../src/util/edgeCurrencyPluginIds'

export const xgram = new Map<string, EdgeCurrencyPluginId | null>()
// WARNING: Not included by the synchronizer synchronization
xgram.set('ada', 'cardano')
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cardano network identifier uses inconsistent lowercase casing

Medium Severity

The Cardano network identifier is 'ada' (lowercase) while every other identifier in the mapping uses uppercase ('BTC', 'ETH', 'BSC', 'ALGO', etc.). If the Xgram API is case-sensitive, Cardano swaps will fail because the API receives 'ada' instead of 'ADA'. The reverse mapping in src/mappings/xgram.ts propagates the same inconsistency.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cardano network code uses inconsistent lowercase casing

Medium Severity

The Cardano network code 'ada' is lowercase, while every other network code in the mapping is uppercase ('ALGO', 'ARBITRUM', 'BTC', 'ETH', etc.). This inconsistency is carried through to the auto-generated reverse mapping ('cardano''ada'). If the Xgram API expects uppercase network identifiers — consistent with the convention used for all other 27 chains — Cardano swaps would fail silently at the API level.

Additional Locations (1)

Fix in Cursor Fix in Web

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cardano network code uses inconsistent lowercase 'ada'

Medium Severity

The Cardano mapping uses lowercase 'ada' while every other network code in the file is uppercase ('ALGO', 'BTC', 'ETH', etc.). This inconsistency propagates to the reverse mapping in src/mappings/xgram.ts where 'cardano' maps to 'ada'. When the plugin sends fromNetwork or toNetwork to the Xgram API, Cardano will use 'ada' instead of the presumably expected 'ADA', likely causing Cardano swaps to fail.

Additional Locations (1)

Fix in Cursor Fix in Web


// WARNING: Not included by the synchronizer synchronization
xgram.set('ALGO', 'algorand')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ARBITRUM', 'arbitrum')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ATOM', 'cosmoshub')

// WARNING: Not included by the synchronizer synchronization
xgram.set('AVAXC', 'avalanche')

// WARNING: Not included by the synchronizer synchronization
xgram.set('BITCOINCASH', 'bitcoincash')

// WARNING: Not included by the synchronizer synchronization
xgram.set('BSC', 'binancesmartchain')

// WARNING: Not included by the synchronizer synchronization
xgram.set('BSV', 'bitcoinsv')

// WARNING: Not included by the synchronizer synchronization
xgram.set('BTC', 'bitcoin')

// WARNING: Not included by the synchronizer synchronization
xgram.set('CELO', 'celo')

// WARNING: Not included by the synchronizer synchronization
xgram.set('DGB', 'digibyte')

// WARNING: Not included by the synchronizer synchronization
xgram.set('DOGECOIN', 'dogecoin')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ETH', 'ethereum')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ETHEREUM CLASSIC', 'ethereumclassic')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ETHEREUMPOW', 'ethereumpow')

// WARNING: Not included by the synchronizer synchronization
xgram.set('FIL', 'filecoin')

// WARNING: Not included by the synchronizer synchronization
xgram.set('FIO', 'fio')

// WARNING: Not included by the synchronizer synchronization
xgram.set('HBAR', 'hedera')

// WARNING: Not included by the synchronizer synchronization
xgram.set('OPTIMISM', 'optimism')

// WARNING: Not included by the synchronizer synchronization
xgram.set('OSMO', 'osmosis')

// WARNING: Not included by the synchronizer synchronization
xgram.set('POL', 'polygon')

// WARNING: Not included by the synchronizer synchronization
xgram.set('QTUM', 'qtum')

// WARNING: Not included by the synchronizer synchronization
xgram.set('RVN', 'ravencoin')

// WARNING: Not included by the synchronizer synchronization
xgram.set('SOL', 'solana')

// WARNING: Not included by the synchronizer synchronization
xgram.set('SUI', 'sui')

// WARNING: Not included by the synchronizer synchronization
xgram.set('TRX', 'tron')

// WARNING: Not included by the synchronizer synchronization
xgram.set('WAX', 'wax')

// WARNING: Not included by the synchronizer synchronization
xgram.set('XMR', 'monero')

// WARNING: Not included by the synchronizer synchronization
xgram.set('XRP', 'ripple')

// WARNING: Not included by the synchronizer synchronization
xgram.set('ZEC', 'zcash')
17 changes: 17 additions & 0 deletions scripts/synchronizers/xgram/xgramSynchronizer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MapctlConfig } from '../../mapctlConfig'
import { FetchChainCodeResult, SwapSynchronizer } from '../../types'
import { getMappingFilePath, loadMappingFile } from '../../util/loadMappingFile'

const NAME = 'xgram'
export const makeXgramSynchronizer = (
_config: MapctlConfig
): SwapSynchronizer => {
return {
name: NAME,
get map() {
return loadMappingFile(NAME)
},
mappingFilePath: getMappingFilePath(NAME),
fetchChainCodes: async (): Promise<FetchChainCodeResult[]> => []
}
}
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { makeGodexPlugin } from './swap/central/godex'
import { makeLetsExchangePlugin } from './swap/central/letsexchange'
import { makeSideshiftPlugin } from './swap/central/sideshift'
import { makeSwapuzPlugin } from './swap/central/swapuz'
import { makeXgramPlugin } from './swap/central/xgram'
import { make0xGaslessPlugin } from './swap/defi/0x/0xGasless'
import { makeBridgelessPlugin } from './swap/defi/bridgeless'
import { makeCosmosIbcPlugin } from './swap/defi/cosmosIbc'
Expand Down Expand Up @@ -48,6 +49,7 @@ const plugins = {
transfer: makeTransferPlugin,
unizen: makeUnizenPlugin,
velodrome: makeVelodromePlugin,
xgram: makeXgramPlugin,
xrpdex,
fantomsonicupgrade: makeFantomSonicUpgradePlugin,
'0xgasless': make0xGaslessPlugin
Expand Down
102 changes: 102 additions & 0 deletions src/mappings/xgram.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
/**
* ⚠️ AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY ⚠️
*
* This file is automatically generated from scripts/mappings/xgramMappings.ts
* To regenerate this file, run: yarn mapctl update-mappings
*
* To edit mappings:
* 1. Edit scripts/mappings/xgramMappings.ts
* 2. Run: yarn mapctl update-mappings
*
* This file maps EdgeCurrencyPluginId -> synchronizer network identifier (or null)
*/

import { EdgeCurrencyPluginId } from '../util/edgeCurrencyPluginIds'

export const xgram = new Map<EdgeCurrencyPluginId, string | null>()
xgram.set('abstract', null)
xgram.set('algorand', 'ALGO')
xgram.set('amoy', null)
xgram.set('arbitrum', 'ARBITRUM')
xgram.set('avalanche', 'AVAXC')
xgram.set('axelar', null)
xgram.set('badcoin', null)
xgram.set('base', null)
xgram.set('binance', null)
xgram.set('binancesmartchain', 'BSC')
xgram.set('bitcoin', 'BTC')
xgram.set('bitcoincash', 'BITCOINCASH')
xgram.set('bitcoincashtestnet', null)
xgram.set('bitcoingold', null)
xgram.set('bitcoingoldtestnet', null)
xgram.set('bitcoinsv', 'BSV')
xgram.set('bitcointestnet', null)
xgram.set('bitcointestnet4', null)
xgram.set('bobevm', null)
xgram.set('botanix', null)
xgram.set('cacao', null)
xgram.set('calibration', null)
xgram.set('cardano', 'ada')
xgram.set('cardanotestnet', null)
xgram.set('celo', 'CELO')
xgram.set('coreum', null)
xgram.set('cosmoshub', 'ATOM')
xgram.set('dash', null)
xgram.set('digibyte', 'DGB')
xgram.set('dogecoin', 'DOGECOIN')
xgram.set('eboost', null)
xgram.set('ecash', null)
xgram.set('eos', null)
xgram.set('ethDev', null)
xgram.set('ethereum', 'ETH')
xgram.set('ethereumclassic', 'ETHEREUM CLASSIC')
xgram.set('ethereumpow', 'ETHEREUMPOW')
xgram.set('fantom', null)
xgram.set('feathercoin', null)
xgram.set('filecoin', 'FIL')
xgram.set('filecoinfevm', null)
xgram.set('filecoinfevmcalibration', null)
xgram.set('fio', 'FIO')
xgram.set('groestlcoin', null)
xgram.set('hedera', 'HBAR')
xgram.set('holesky', null)
xgram.set('hyperevm', null)
xgram.set('liberland', null)
xgram.set('liberlandtestnet', null)
xgram.set('litecoin', null)
xgram.set('mayachain', null)
xgram.set('monad', null)
xgram.set('monero', 'XMR')
xgram.set('nym', null)
xgram.set('opbnb', null)
xgram.set('optimism', 'OPTIMISM')
xgram.set('osmosis', 'OSMO')
xgram.set('piratechain', null)
xgram.set('pivx', null)
xgram.set('polkadot', null)
xgram.set('polygon', 'POL')
xgram.set('pulsechain', null)
xgram.set('qtum', 'QTUM')
xgram.set('ravencoin', 'RVN')
xgram.set('ripple', 'XRP')
xgram.set('rsk', null)
xgram.set('sepolia', null)
xgram.set('smartcash', null)
xgram.set('solana', 'SOL')
xgram.set('sonic', null)
xgram.set('stellar', null)
xgram.set('sui', 'SUI')
xgram.set('suitestnet', null)
xgram.set('telos', null)
xgram.set('tezos', null)
xgram.set('thorchainrune', null)
xgram.set('thorchainrunestagenet', null)
xgram.set('ton', null)
xgram.set('tron', 'TRX')
xgram.set('ufo', null)
xgram.set('vertcoin', null)
xgram.set('wax', 'WAX')
xgram.set('zano', null)
xgram.set('zcash', 'ZEC')
xgram.set('zcoin', null)
xgram.set('zksync', null)
Loading