Skip to content
Merged
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 .env
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,5 @@ VITE_FEATURE_APP_RATING=true
VITE_SWAPS_SERVER_URL=https://shapeshiftswap-service-production.up.railway.app
VITE_USER_SERVER_URL=https://shapeshiftuser-service-production.up.railway.app
VITE_NOTIFICATIONS_SERVER_URL=https://shapeshiftnotifications-service-production.up.railway.app

VITE_FEATURE_TRON=false
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ VITE_BASE_NODE_URL=https://dev-api.base.shapeshift.com/api/v1/jsonrpc
VITE_THORCHAIN_NODE_URL=https://dev-api.thorchain.shapeshift.com/lcd
VITE_MAYACHAIN_NODE_URL=https://dev-api.mayachain.shapeshift.com/lcd
VITE_SOLANA_NODE_URL=https://dev-api.solana.shapeshift.com/api/v1/jsonrpc
VITE_TRON_NODE_URL=https://api.trongrid.io

# midgard
VITE_THORCHAIN_MIDGARD_URL=https://dev-api.thorchain.shapeshift.com/midgard/v2
Expand All @@ -84,3 +85,4 @@ VITE_FEATURE_NOTIFICATIONS_WEBSERVICES=true
# VITE_NOTIFICATIONS_SERVER_URL=/notifications-api

VITE_FEATURE_WC_DIRECT_CONNECTION=true
VITE_FEATURE_TRON=true
10 changes: 10 additions & 0 deletions headers/csps/chains/tron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { loadEnv } from 'vite'

import type { Csp } from '../../types'

const mode = process.env.MODE ?? process.env.NODE_ENV ?? 'development'
const env = loadEnv(mode, process.cwd(), '')

export const csp: Csp = {
'connect-src': [env.VITE_TRON_NODE_URL],
}
2 changes: 2 additions & 0 deletions headers/csps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { csp as optimism } from './chains/optimism'
import { csp as polygon } from './chains/polygon'
import { csp as solana } from './chains/solana'
import { csp as thorchain } from './chains/thorchain'
import { csp as tron } from './chains/tron'
import { csp as chatwoot } from './chatwoot'
import { csp as customTokenImport } from './customTokenImport'
import { csp as foxy } from './defi/foxy'
Expand Down Expand Up @@ -99,6 +100,7 @@ export const csps = [
polygon,
solana,
thorchain,
tron,
mayachain,
trustwallet,
coincap,
Expand Down
37 changes: 19 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,24 @@
"@shapeshiftoss/chain-adapters": "workspace:^",
"@shapeshiftoss/contracts": "workspace:^",
"@shapeshiftoss/errors": "workspace:^",
"@shapeshiftoss/hdwallet-coinbase": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-core": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-gridplus": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-keepkey": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-keplr": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-ledger": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-native": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-native-vault": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-phantom": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-trezor": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-vultisig": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.15-alpha.0",
"@shapeshiftoss/hdwallet-coinbase": "1.62.15",
"@shapeshiftoss/hdwallet-core": "1.62.15",
"@shapeshiftoss/hdwallet-gridplus": "1.62.15",
"@shapeshiftoss/hdwallet-keepkey": "1.62.15",
"@shapeshiftoss/hdwallet-keepkey-webusb": "1.62.15",
"@shapeshiftoss/hdwallet-keplr": "1.62.15",
"@shapeshiftoss/hdwallet-ledger": "1.62.15",
"@shapeshiftoss/hdwallet-ledger-webhid": "1.62.15",
"@shapeshiftoss/hdwallet-ledger-webusb": "1.62.15",
"@shapeshiftoss/hdwallet-metamask-multichain": "1.62.15",
"@shapeshiftoss/hdwallet-native": "1.62.15",
"@shapeshiftoss/hdwallet-native-vault": "1.62.15",
"@shapeshiftoss/hdwallet-phantom": "1.62.15",
"@shapeshiftoss/hdwallet-trezor": "1.62.15",
"@shapeshiftoss/hdwallet-trezor-connect": "1.62.15",
"@shapeshiftoss/hdwallet-vultisig": "1.62.15",
"@shapeshiftoss/hdwallet-walletconnect": "1.62.15",
"@shapeshiftoss/hdwallet-walletconnectv2": "1.62.15",
"@shapeshiftoss/swapper": "workspace:^",
"@shapeshiftoss/types": "workspace:^",
"@shapeshiftoss/unchained-client": "workspace:^",
Expand Down Expand Up @@ -213,6 +213,7 @@
"scroll-into-view-if-needed": "^3.0.10",
"semver": "^7.7.2",
"styled-components": "^6.0.7",
"tronweb": "6.1.0",
"use-long-press": "^3.3.0",
"uuid": "^9.0.0",
"vaul": "^1.1.2",
Expand Down
4 changes: 3 additions & 1 deletion packages/caip/src/adapters/coingecko/generated/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import cosmos from './cosmos_cosmoshub-4/adapter.json'
import thorchain from './cosmos_thorchain-1/adapter.json'
import mayachain from './cosmos_mayachain-mainnet-v1/adapter.json'
import solana from './solana_5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/adapter.json'
import tron from './tron_0x2b6653dc/adapter.json'

export {
bitcoin,
Expand All @@ -33,5 +34,6 @@ export {
cosmos,
thorchain,
mayachain,
solana
solana,
tron
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"tron:0x2b6653dc/slip44:195":"tron","tron:0x2b6653dc/trc20:TQgcDvhr6c1EUDnFxiAmuYpBewT3uJSnHF":"4tb-coin","tron:0x2b6653dc/trc20:TLeVfrdym8RoJreJ23dAGyfJDygRtiWKBZ":"a7a5","tron:0x2b6653dc/trc20:TFczxzPhnThNSqr5by8tvxsdCFRRz6cPNq":"apenft","tron:0x2b6653dc/trc20:TD74cpU4JfMKhuWVs6uKYXKUy8nvC6EQ95":"astrazion","tron:0x2b6653dc/trc20:TF7ixydn7nfCgj9wQj3fRdKRAvsZ8egHcx":"b1coin","tron:0x2b6653dc/trc20:TAoA331n3iKDkR62kAZ4H2n3vNL7y3d8x9":"bemchain","tron:0x2b6653dc/trc20:TR95WcjR78Y4puyv8BkbFuxaf4WcvmmPpd":"biaoqing-tron","tron:0x2b6653dc/trc20:TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9":"bitcoin-trc20","tron:0x2b6653dc/trc20:TAFjULxiVgT4qWk6UZwjqwZXTSaGaqnVp4":"bittorrent","tron:0x2b6653dc/trc20:1002000":"bittorrent-old","tron:0x2b6653dc/trc20:TXBcx59eDVndV5upFQnTR2xdvqFd5reXET":"black-phoenix","tron:0x2b6653dc/trc20:TXtu3Ke9mJQtPtAQxmoTbzu3N4Qx4XP9Y2":"blake","tron:0x2b6653dc/trc20:THkzgVF6wE9wUacsetbokJUophZtaLHRLJ":"brihlo","tron:0x2b6653dc/trc20:TKmrM2UUNcTsC5UjiujDHwzRAmzzTJDcYd":"caprisun","tron:0x2b6653dc/trc20:TL7RJPC7zqpj9B2F4RRc4mk4YpzuVrd4Ar":"cashbackpro","tron:0x2b6653dc/trc20:TCfCGjekyqmdYt1yxfUM5v5SDtaY6tuWik":"cnh-tether","tron:0x2b6653dc/trc20:TRv9ipj4kKAZqQggQ7ceJpe5ERD1ZShpgs":"coconut-chicken","tron:0x2b6653dc/trc20:TKg1nGjtWYDcf1HNTSNQtwGwNAuTxd1X2A":"core","tron:0x2b6653dc/trc20:TL5BvThAMg9QBCvbgXu7HwHh8HqGdAq4DD":"cornatto","tron:0x2b6653dc/trc20:TVzP8uYrFeynuZXhsHjgCxBd8CxPeP511e":"croin","tron:0x2b6653dc/trc20:TY2Ge1YYphoAatwaBxa1zYfJVa8CqNyL6B":"crosswallet","tron:0x2b6653dc/trc20:TWP6GgtstiuYbpygSFcZLzJQrj9eDVQcq2":"crypto-whale","tron:0x2b6653dc/trc20:TVXmroHbJsJ6rVm3wGn2G9723yz3Kbqp9x":"cyber-dog","tron:0x2b6653dc/trc20:TNzctnHygQxx2shHScTJKQBU9U4gVWctfk":"dct","tron:0x2b6653dc/trc20:TRwptGFfX3fuffAMbWDDLJZAZFmP6bGfqL":"degree-crypto-token","tron:0x2b6653dc/trc20:TV5yB8f4AdoAfVVUdkytyZnX5e7SeGAZr2":"dragon-sun","tron:0x2b6653dc/trc20:TUFonyWZ4Tza5MzgDj6g2u5rfdGoRVYG7g":"fofar-2","tron:0x2b6653dc/trc20:TQWQTZ7LzyttfnHQyfLUkKUs8eZZepgXiQ":"ftx-users-debt","tron:0x2b6653dc/trc20:TPN3AXU6GH9abi7xKchewq4jTuSFLGjq5i":"global-commercial-business","tron:0x2b6653dc/trc20:TQX4NJaSspcjXWUDHMgjcejRZ7k1VojNLz":"guarantee","tron:0x2b6653dc/trc20:TEBdrpWiPVSU3cmR96wCVYgsxb9fwwJSZi":"hammy","tron:0x2b6653dc/trc20:TUPM7K8REVzD2UdV4R5fe5M8XbnR2DdoJ6":"htx-dao","tron:0x2b6653dc/trc20:TSig7sWzEL2K83mkJMQtbyPpiVSbR6pZnb":"invest-zone","tron:0x2b6653dc/trc20:TCFLL5dx5ZJdKnWuesXxi1VPwjLVmWZZy9":"just","tron:0x2b6653dc/trc20:TVHH59uHVpHzLDMFFpUgCx2dNAQqCzPhcR":"justmoney-2","tron:0x2b6653dc/trc20:TMwFHYXLJaRUPeW6421aqXL4ZEzPRFGkGT":"just-stablecoin","tron:0x2b6653dc/trc20:THvqUNvSRvV1DRJ9wuugBVKeq3rFxpxJej":"knight","tron:0x2b6653dc/trc20:THS2ZuQowumzFPD1z3wchB1PijWMggUgmA":"kyrrex","tron:0x2b6653dc/trc20:TC8QDMS2nLdWMT7iJwvtG5YH6XiGEJT6om":"liberland-lld","tron:0x2b6653dc/trc20:TW8617uDAUBe3mGeGZo5mkaV8RhN6YfozN":"liora","tron:0x2b6653dc/trc20:TDBNKiYQ8yfJtT5MDP3byu7f1npJuG2DBN":"lumi-credits","tron:0x2b6653dc/trc20:TBoupmmqSwULKpa3jQJZuWNPDpbzfT2Grh":"madhouse","tron:0x2b6653dc/trc20:TR1iXU8Sp7oUYHXWiddsBervJzSbdibMFZ":"meow-2","tron:0x2b6653dc/trc20:TEfg1LnM3yApCjAgax35wDg6SRpmZFuQS3":"mew-woof-dao","tron:0x2b6653dc/trc20:TE2T2vLnEQT1XW647EAQAHWqd6NZL1hweR":"muncat","tron:0x2b6653dc/trc20:TNzfB1nvRPusCn5UhQLxUbZaX7DFuWkxR4":"mynth","tron:0x2b6653dc/trc20:TCGPc27oyS2x7S5pex7ssyZxZ2edPWonk2":"neiro-on-tron","tron:0x2b6653dc/trc20:TBBThLgHtUhGuT9DJ1rrzXDQ6j2XSP2Dq5":"nforbanana","tron:0x2b6653dc/trc20:TDk91SWz2GvwfZwMTGX21d4ngUUH8YZZAv":"osk","tron:0x2b6653dc/trc20:TMacq4TDUw5q8NFBwmbY4RLXvzvG5JTkvi":"pepeontron","tron:0x2b6653dc/trc20:TXdN5fvFjCdqjWJRvWmBzSRLBN7JLYmmrs":"pht-stablecoin","tron:0x2b6653dc/trc20:TAbkLGngV1k8bNb5hnqW7oX46FG4Dbs5e2":"pino-trx","tron:0x2b6653dc/trc20:TYV5eu6UgSPtxVLkPD9YfxmUEcXhum35yS":"prcy-coin","tron:0x2b6653dc/trc20:TWcDDx1Q6QEoBrJi9qehtZnD4vcXXuVLer":"proof-of-liquidity","tron:0x2b6653dc/trc20:TFf1aBoNFqxN32V2NQdvNrXVyYCy9qY8p1":"prospective","tron:0x2b6653dc/trc20:TX5eXdf8458bZ77fk8xdvUgiQmC3L93iv7":"puss","tron:0x2b6653dc/trc20:TGBfBt6Y2Dm3RHdNpZAdqywBsvfdysf834":"reallink","tron:0x2b6653dc/trc20:TD4bVgcwj3FRbmAo283HxNvqZvY7T3uD8k":"revain","tron:0x2b6653dc/trc20:TJvwMR3RjHc8jA9QwwjWGANrR3Y4scLSZm":"rock-4","tron:0x2b6653dc/trc20:TZ3c6bmoqVeq9YEEBMSNrBLq2rHJ1vR8Nc":"rock-dao","tron:0x2b6653dc/trc20:TQRkaeX4AkdWZBQLivcnwFwjZd7dKehUBH":"rubx","tron:0x2b6653dc/trc20:TYq22mVD6aQdvzYhNxVYtjmRBCQmmcp2EK":"satozhi","tron:0x2b6653dc/trc20:TFzDQj414wFKhnc2k7DsbrP1g4gSNpJTTN":"seagle","tron:0x2b6653dc/trc20:TBLQs7LqUYAgzYirNtaiX3ixnCKnhrVVCe":"socialswap-token","tron:0x2b6653dc/trc20:TU3kjFuhtEo42tsCBtfYUAZxoqQ4yuSLQ5":"staked-trx","tron:0x2b6653dc/trc20:TThzxNRLrW2Brp9DcTQU8i4Wd9udCWEdZ3":"staked-usdt","tron:0x2b6653dc/trc20:TVnuZu3GF8CLKn4D6nMWNwkHhnUwzAqn8W":"striker","tron:0x2b6653dc/trc20:TV5MV8wjCY8xbJ6NfQSArP7xZRHHTw48No":"stronghands-finance","tron:0x2b6653dc/trc20:TQKQRxEDH2vhtxGB4obGeHwu7AqGDryU3C":"sugar-boy","tron:0x2b6653dc/trc20:TAwAg9wtQzTMFsijnSFotJrpxhMm3AqW1d":"suncat","tron:0x2b6653dc/trc20:TXL6rJbvmjD46zeN1JssfgxvSo99qC8MRT":"sundog","tron:0x2b6653dc/trc20:TBk4dXtfo6j3rxPc1VJDhA7BsVi2XHK1bi":"sunlion","tron:0x2b6653dc/trc20:THMpAfhJwJic2V9SbReQhwXLPuRGSLsj5q":"sunned","tron:0x2b6653dc/trc20:TAzpJHxxgJd8f5AKjzndEndH3S9pzNUM5W":"sunpepe","tron:0x2b6653dc/trc20:TX4xgxs6ctAz8RFbpk4rPzBrULWHE7Siiq":"sunpig","tron:0x2b6653dc/trc20:TSSMHYeV2uE9qYH95DqyoCuNCzEL1NvU3S":"sun-token","tron:0x2b6653dc/trc20:TP3prcvQknVthrVnn281cKST56eWiLgJJM":"sunwukong","tron:0x2b6653dc/trc20:TKdpGm5wKPLz3stemW8gkGvAdhztJcDjcW":"swapz-app","tron:0x2b6653dc/trc20:TDxL4V5LE6TYSFXSCWJkkSsCYbgmrDnTer":"szn","tron:0x2b6653dc/trc20:TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t":"tether","tron:0x2b6653dc/trc20:TD6xZDStjpd5FjgpNGihSYnm46nQUA6Dsj":"topcat-2","tron:0x2b6653dc/trc20:TMwk13CthNktLiNpo8WDRuUMpyrzZTVZYH":"to-the-sun","tron:0x2b6653dc/trc20:TQH4JFjzGnWswNeaCxFJi3pSqmsvTXULY8":"tourism-industry-metavers","tron:0x2b6653dc/trc20:THVR1Biz4ZYYxewha6Wmi47HeB5opj1dv2":"trepe","tron:0x2b6653dc/trc20:TAt4ufXFaHZAEV44ev7onThjTnF61SEaEM":"tron-bull","tron:0x2b6653dc/trc20:TPeoxx1VhUMnAUyjwWfximDYFDQaxNQQ45":"tron-bull-coin","tron:0x2b6653dc/trc20:TVgHqeP41s3qMDH3oKBsScEUzvyXw6bKAm":"tron-cat","tron:0x2b6653dc/trc20:TVwzGbGPoQWXcN9CQ1q2REiMcMtV78MKPg":"tronches","tron:0x2b6653dc/trc20:TPP9Pq2LQwtrwfyUDLSyFsKJwJjFouf45B":"tron-mascot","tron:0x2b6653dc/trc20:THiSwGN4S9MFodhUMaqTjhnhc95rLdEKFi":"tronstrategy","tron:0x2b6653dc/trc20:TUpMhErZL2fhh4sVNULAbNKLokS4GjC1F4":"true-usd","tron:0x2b6653dc/trc20:TCMwzYUUCxLkTNpXjkYSBgXgqXwt7KJ82y":"ttcoin","tron:0x2b6653dc/trc20:TTFreuJ4pYDaCeEMEtiR1GQDwPPrS4jKFk":"twiskers","tron:0x2b6653dc/trc20:TGo8MJaSxvVVicZ1ixC7n3ibJMt9NJvxuU":"uplift","tron:0x2b6653dc/trc20:TYX2iy3i3793YgKU5vqKxDnLpiBMSa5EdV":"upstabletoken","tron:0x2b6653dc/trc20:TPFqcBAaaUMCSVRCqPaQ9QnzKhmuoLR6Rc":"usd1-wlfi","tron:0x2b6653dc/trc20:TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8":"usd-coin","tron:0x2b6653dc/trc20:TXDk8mbtRbXeYuMNS83CfKPaYYT8XWv9Hz":"usdd","tron:0x2b6653dc/trc20:TE9f8MGouEdh2jPqDaUgUVaJYLKkV6vhv6":"ushark","tron:0x2b6653dc/trc20:TP7r1pDoS1snMjEJE1kE17GRt3Df4mYuZz":"vikita","tron:0x2b6653dc/trc20:THb4CqiFdwNHsWsQCs4JhzwjMWys4aqCbF":"weth","tron:0x2b6653dc/trc20:TQb8rm1BDjArsBh78yw8enstQ3E85XFc9u":"wfdp","tron:0x2b6653dc/trc20:TFptbWaARrWTX5Yvy3gNG5Lm8BmhPx82Bt":"whitebit","tron:0x2b6653dc/trc20:TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7":"wink","tron:0x2b6653dc/trc20:TKaPzvnXD9Tb2E5XHb54vwDCyHz2LbKAnc":"won-chang","tron:0x2b6653dc/trc20:TYhWwKpw43ENFWBTGpzLHn3882f2au7SMi":"wrapped-bitcoin","tron:0x2b6653dc/trc20:TKfjV9RNKJJCqPvBtK8L7Knykh7DNWvnYt":"wrapped-btt-tron","tron:0x2b6653dc/trc20:TGkxzkDKyMeq2T7edKnyjZoFypyzjkkssq":"wrapped-staked-usdt","tron:0x2b6653dc/trc20:TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR":"wrapped-tron","tron:0x2b6653dc/trc20:TXb7CvPFwxW6vShGWtXTVZU353Efig4H6o":"wrapped-xoc","tron:0x2b6653dc/trc20:TQzUXP5eXHwrRMou9KYQQq7wEmu8KQF7mX":"xiao-lang-gou","tron:0x2b6653dc/trc20:TBAbgFHHpuLERRcUFvjnojtBjkBr39NFB7":"yalla-sun","tron:0x2b6653dc/trc20:TAP7qf8Ao26ZAKYS5E6SGozUNoSLvBHsGa":"yfx","tron:0x2b6653dc/trc20:TPUZseUsV89tM157aLfkuKYEaRKzBirmRb":"zapo","tron:0x2b6653dc/trc20:TUP3g7kbaESRFRhULeA19USSrcVBEpWLVY":"zedxion"}
7 changes: 7 additions & 0 deletions packages/caip/src/adapters/coingecko/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ describe('adapters:coingecko', () => {
assetNamespace: 'token',
assetReference: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
})
const usdcOnTron = toAssetId({
chainNamespace: CHAIN_NAMESPACE.Tron,
chainReference: CHAIN_REFERENCE.TronMainnet,
assetNamespace: 'trc20',
assetReference: 'TEkxiTehnzSmSe2XqrBj4w32RUN966rdz8',
})
expect(coingeckoToAssetIds('usd-coin')).toEqual([
usdcOnEthereum,
usdcOnAvalanche,
Expand All @@ -177,6 +183,7 @@ describe('adapters:coingecko', () => {
usdcOnArbitrum,
usdcOnBase,
usdcOnSolana,
usdcOnTron,
])
})
it('can get AssetIds for bridged USD Coin on EVM Chains', () => {
Expand Down
13 changes: 13 additions & 0 deletions packages/caip/src/adapters/coingecko/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
polygonChainId,
solanaChainId,
thorchainChainId,
tronChainId,
} from '../../constants'
import * as adapters from './generated'

Expand All @@ -40,6 +41,7 @@ export enum CoingeckoAssetPlatform {
ArbitrumNova = 'arbitrum-nova',
Base = 'base',
Solana = 'solana',
Tron = 'tron',
}

type CoinGeckoId = string
Expand Down Expand Up @@ -115,6 +117,15 @@ export const chainIdToCoingeckoAssetPlatform = (chainId: ChainId): string => {
`chainNamespace ${chainNamespace}, chainReference ${chainReference} not supported.`,
)
}
case CHAIN_NAMESPACE.Tron:
switch (chainReference) {
case CHAIN_REFERENCE.TronMainnet:
return CoingeckoAssetPlatform.Tron
default:
throw new Error(
`chainNamespace ${chainNamespace}, chainReference ${chainReference} not supported.`,
)
}
// No valid asset platform: https://api.coingecko.com/api/v3/asset_platforms
case CHAIN_NAMESPACE.Utxo:
default:
Expand Down Expand Up @@ -152,6 +163,8 @@ export const coingeckoAssetPlatformToChainId = (
return mayachainChainId
case CoingeckoAssetPlatform.Solana:
return solanaChainId
case CoingeckoAssetPlatform.Tron:
return tronChainId
default:
return undefined
}
Expand Down
3 changes: 3 additions & 0 deletions packages/caip/src/adapters/coingecko/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ describe('adapters:coingecko:utils', () => {
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp': {
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501': 'solana',
},
'tron:0x2b6653dc': {
'tron:0x2b6653dc/slip44:195': 'tron',
},
}
expect(result).toEqual(expected)
})
Expand Down
17 changes: 17 additions & 0 deletions packages/caip/src/adapters/coingecko/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import {
solanaChainId,
solAssetId,
thorchainChainId,
tronAssetId,
tronChainId,
} from '../../constants'
import {
bitcoinAssetMap,
Expand Down Expand Up @@ -198,6 +200,20 @@ export const parseData = (coins: CoingeckoCoin[]): AssetMap => {
}
}

if (Object.keys(platforms).includes(CoingeckoAssetPlatform.Tron)) {
try {
const assetId = toAssetId({
chainNamespace: CHAIN_NAMESPACE.Tron,
chainReference: CHAIN_REFERENCE.TronMainnet,
assetNamespace: 'trc20',
assetReference: platforms[CoingeckoAssetPlatform.Tron],
})
prev[tronChainId][assetId] = id
} catch {
// unable to create assetId, skip token
}
}

return prev
},
{
Expand All @@ -211,6 +227,7 @@ export const parseData = (coins: CoingeckoCoin[]): AssetMap => {
[arbitrumNovaChainId]: { [arbitrumNovaAssetId]: 'ethereum' },
[baseChainId]: { [baseAssetId]: 'ethereum' },
[solanaChainId]: { [solAssetId]: 'solana' },
[tronChainId]: { [tronAssetId]: 'tron' },
},
)

Expand Down
9 changes: 9 additions & 0 deletions packages/caip/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const baseAssetId: AssetId = 'eip155:8453/slip44:60'
export const solAssetId: AssetId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/slip44:501'
export const wrappedSolAssetId: AssetId =
'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/token:So11111111111111111111111111111111111111112'
export const tronAssetId: AssetId = 'tron:0x2b6653dc/slip44:195'
export const uniV2EthFoxArbitrumAssetId: AssetId =
'eip155:42161/erc20:0x5f6ce0ca13b87bd738519545d3e018e70e339c24'

Expand Down Expand Up @@ -73,12 +74,14 @@ export const mayachainChainId: ChainId = 'cosmos:mayachain-mainnet-v1'
export const binanceChainId: ChainId = 'cosmos:binance-chain-tigris'

export const solanaChainId: ChainId = 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp'
export const tronChainId: ChainId = 'tron:0x2b6653dc'

export const CHAIN_NAMESPACE = {
Evm: 'eip155',
Utxo: 'bip122',
CosmosSdk: 'cosmos',
Solana: 'solana',
Tron: 'tron',
} as const

type ValidChainMap = {
Expand All @@ -104,6 +107,7 @@ export const CHAIN_REFERENCE = {
ArbitrumNovaMainnet: '42170', // https://chainlist.org/chain/42170
BaseMainnet: '8453', // https://chainlist.org/chain/8453
SolanaMainnet: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp', // https://namespaces.chainagnostic.org/solana/caip2
TronMainnet: '0x2b6653dc', // https://developers.tron.network/docs/networks
} as const

export const ASSET_NAMESPACE = {
Expand All @@ -112,6 +116,7 @@ export const ASSET_NAMESPACE = {
erc1155: 'erc1155',
slip44: 'slip44',
splToken: 'token',
trc20: 'trc20',
} as const

export const ASSET_REFERENCE = {
Expand All @@ -133,6 +138,7 @@ export const ASSET_REFERENCE = {
ArbitrumNova: '60', // evm chain which uses ethereum derivation path as common practice
Base: '60', // evm chain which uses ethereum derivation path as common practice
Solana: '501',
Tron: '195',
} as const

export const VALID_CHAIN_IDS: ValidChainMap = Object.freeze({
Expand Down Expand Up @@ -160,6 +166,7 @@ export const VALID_CHAIN_IDS: ValidChainMap = Object.freeze({
CHAIN_REFERENCE.BinanceMainnet,
],
[CHAIN_NAMESPACE.Solana]: [CHAIN_REFERENCE.SolanaMainnet],
[CHAIN_NAMESPACE.Tron]: [CHAIN_REFERENCE.TronMainnet],
})

type ValidAssetNamespace = {
Expand All @@ -176,6 +183,7 @@ export const VALID_ASSET_NAMESPACE: ValidAssetNamespace = Object.freeze({
],
[CHAIN_NAMESPACE.CosmosSdk]: [ASSET_NAMESPACE.slip44],
[CHAIN_NAMESPACE.Solana]: [ASSET_NAMESPACE.splToken, ASSET_NAMESPACE.slip44],
[CHAIN_NAMESPACE.Tron]: [ASSET_NAMESPACE.slip44, ASSET_NAMESPACE.trc20],
})

// We should prob change this once we add more chains
Expand All @@ -197,4 +205,5 @@ export const FEE_ASSET_IDS = [
arbitrumNovaAssetId,
baseAssetId,
solAssetId,
tronAssetId,
]
1 change: 1 addition & 0 deletions packages/chain-adapters/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from './evm'
export * from './utxo'
export * from './cosmossdk'
export * as solana from './solana'
export * as tron from './tron'
Loading