diff --git a/src/config/endpoints.js b/src/config/endpoints.js index 0a49f45..d6beff1 100644 --- a/src/config/endpoints.js +++ b/src/config/endpoints.js @@ -7,6 +7,10 @@ const ENDPOINTS = { ETHEREUM: { MAIN: 'mainnet', TEST: 'goerli', + }, + ECLIPSE: { + DEV: 'testnet.dev2', + TEST: 'testnet.dev2', } }; diff --git a/src/config/explorers.js b/src/config/explorers.js index 01f8baa..da0e0e7 100644 --- a/src/config/explorers.js +++ b/src/config/explorers.js @@ -17,6 +17,8 @@ const SOLANA_EXPLORERS = { }, }; + + const EXPLORERS = { SOLANA: { mainnet: SOLANA_EXPLORERS, @@ -24,6 +26,22 @@ const EXPLORERS = { testnet: SOLANA_EXPLORERS, devnet: SOLANA_EXPLORERS, }, + ECLIPSE: { + testnet: { + EXPLORER: { + name: 'Eclipse Explorer', + url: 'https://explorer.dev.eclipsenetwork.xyz/address/9RPEj9p4Xnd9eqEs6gJcWkU6FqbuRWPxqXmRvpasRein?cluster=testnet' + } + }, + devnet: { + EXPLORER: { + name: 'Eclipse Explorer', + url: 'https://explorer.dev.eclipsenetwork.xyz/address/9RPEj9p4Xnd9eqEs6gJcWkU6FqbuRWPxqXmRvpasRein?cluster=testnet' + } + } + + }, + ETHEREUM: { mainnet: { ETHERSCAN: { @@ -38,12 +56,13 @@ const EXPLORERS = { }, }, }, - + }; const DEFAULT_EXPLORERS = { SOLANA: 'SOLSCAN', ETHEREUM: 'ETHERSCAN', + ECLIPSE: 'EXPLORER', }; export { EXPLORERS, DEFAULT_EXPLORERS }; diff --git a/src/eclipse-wallet-adapter/constants/blockchains.js b/src/eclipse-wallet-adapter/constants/blockchains.js index bac7eb2..7b7f333 100644 --- a/src/eclipse-wallet-adapter/constants/blockchains.js +++ b/src/eclipse-wallet-adapter/constants/blockchains.js @@ -1,4 +1,5 @@ const SOLANA = 'solana'; +const ECLIPSE = 'eclipse'; const ETHEREUM = 'ethereum'; -module.exports = { SOLANA, ETHEREUM }; +module.exports = { SOLANA, ETHEREUM, ECLIPSE }; diff --git a/src/eclipse-wallet-adapter/constants/environment.js b/src/eclipse-wallet-adapter/constants/environment.js index daabc12..6ed56b8 100644 --- a/src/eclipse-wallet-adapter/constants/environment.js +++ b/src/eclipse-wallet-adapter/constants/environment.js @@ -11,7 +11,7 @@ switch (salmonEnv) { break; case 'test': case 'local': - apiUrl = 'http://localhost:3000/local'; + apiUrl = 'http://localhost:8083'; break; case 'main': apiUrl = 'https://bo0q5g7ie1.execute-api.us-east-1.amazonaws.com/main'; diff --git a/src/eclipse-wallet-adapter/constants/token-constants.js b/src/eclipse-wallet-adapter/constants/token-constants.js index ebe9760..542d3a1 100644 --- a/src/eclipse-wallet-adapter/constants/token-constants.js +++ b/src/eclipse-wallet-adapter/constants/token-constants.js @@ -4,6 +4,7 @@ const SOL_DECIMALS = 6; const SOL_SYMBOL = 'ETH'; const SOL_NAME = 'Eclipse'; const SOL_LOGO = 'https://i.imgur.com/y0JEPfQ.png'; +const ETH_LOGO = 'https://assets-cdn.trustwallet.com/blockchains/ethereum/info/logo.png' const SOL_ADDRESS = 'So11111111111111111111111111111111111111112'; const USDC_ADDRESS = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'; @@ -27,5 +28,6 @@ module.exports = { USDC_ADDRESS, BTC_LOGO, ETH_ADDRESS, + ETH_LOGO, ME_PROGRAM_ID }; diff --git a/src/eclipse-wallet-adapter/factories/network-account-factory.js b/src/eclipse-wallet-adapter/factories/network-account-factory.js index 7d5bd97..755312c 100644 --- a/src/eclipse-wallet-adapter/factories/network-account-factory.js +++ b/src/eclipse-wallet-adapter/factories/network-account-factory.js @@ -2,13 +2,13 @@ const { create: createEthereum } = require('./ethereum-account-factory'); const { create: createSolana } = require('./solana-account-factory'); -const { ETHEREUM, SOLANA } = require('../constants/blockchains'); +const { ETHEREUM, SOLANA, ECLIPSE } = require('../constants/blockchains'); const create = async ({ network, mnemonic, index = 0 }) => { switch (network.blockchain) { case ETHEREUM: return createEthereum({ network, mnemonic, index }); - case SOLANA: + case SOLANA, ECLIPSE: return createSolana({ network, mnemonic, index }); default: return null; diff --git a/src/eclipse-wallet-adapter/services/network-service.js b/src/eclipse-wallet-adapter/services/network-service.js index 4eb0dde..7c36714 100644 --- a/src/eclipse-wallet-adapter/services/network-service.js +++ b/src/eclipse-wallet-adapter/services/network-service.js @@ -2,8 +2,8 @@ let promise; const networkData = [ { - id: 'solana-devnet', - blockchain: 'solana', + id: 'eclipse-devnet', + blockchain: 'eclipse', environment: 'devnet', name: 'Eclipse Devnet', icon: 'https://assets-cdn.trustwallet.com/blockchains/solana/info/logo.png', @@ -16,8 +16,8 @@ const networkData = [ }, }, { - id: 'solana-testnet', - blockchain: 'solana', + id: 'eclipse-testnet', + blockchain: 'eclipse', environment: 'devnet', name: 'Eclipse Testnet', icon: 'https://assets-cdn.trustwallet.com/blockchains/solana/info/logo.png', diff --git a/src/eclipse-wallet-adapter/services/solana/solana-balance-service.js b/src/eclipse-wallet-adapter/services/solana/solana-balance-service.js index 9f7becd..a16c334 100644 --- a/src/eclipse-wallet-adapter/services/solana/solana-balance-service.js +++ b/src/eclipse-wallet-adapter/services/solana/solana-balance-service.js @@ -5,7 +5,7 @@ const { SOL_DECIMALS, SOL_SYMBOL, SOL_NAME, - SOL_LOGO, + ETH_LOGO, SOL_ADDRESS, } = require('../../constants/token-constants'); const { getLast24HoursChange } = require('../common-balance-service'); @@ -23,7 +23,7 @@ const getSolanaBalance = async (connection, publicKey) => { uiAmount: uiAmount, symbol: SOL_SYMBOL, name: SOL_NAME, - logo: SOL_LOGO, + logo: ETH_LOGO, address: SOL_ADDRESS, }; }; diff --git a/src/eclipse-wallet-adapter/services/switch-service.js b/src/eclipse-wallet-adapter/services/switch-service.js index 83bd78e..7ae78ed 100644 --- a/src/eclipse-wallet-adapter/services/switch-service.js +++ b/src/eclipse-wallet-adapter/services/switch-service.js @@ -129,7 +129,7 @@ const jsonData = { } } }, - "solana-testnet": { + "eclipse-testnet": { "enable": true, "sections": { "overview": { @@ -171,7 +171,7 @@ const jsonData = { } } }, - "solana-devnet": { + "eclipse-devnet": { "enable": true, "sections": { "overview": { diff --git a/src/eclipse-wallet-adapter/services/token-decorator.js b/src/eclipse-wallet-adapter/services/token-decorator.js index ab396ee..0c54f60 100644 --- a/src/eclipse-wallet-adapter/services/token-decorator.js +++ b/src/eclipse-wallet-adapter/services/token-decorator.js @@ -8,16 +8,19 @@ const decorateBalanceList = async (items, tokens) => { }; const decorateBalancePrices = async (items, prices) => { + const prices_a = [prices].flat(); const result = items.map((item) => { const price = item.symbol - ? prices?.find((t) => t.id == item.coingeckoId) || - prices?.find((t) => t.symbol.toUpperCase() == item.symbol.toUpperCase()) + ? prices_a?.find((t) => t.id == item.coingeckoId) || + prices_a?.find((t) => t.symbol.toUpperCase() == item.symbol.toUpperCase()) : null; - const usdBalance = price?.usdPrice ? item.uiAmount * price.usdPrice : null; + + const usd_price = price?.market_data?.current_price?.usd + const usdBalance = usd_price ? item.uiAmount * usd_price : null; const last24HoursChange = getLast24HoursChange(price, usdBalance); return { ...item, - usdPrice: price ? price.usdPrice : null, + usdPrice: price ? usd_price : null, usdBalance, last24HoursChange, }; @@ -26,11 +29,11 @@ const decorateBalancePrices = async (items, prices) => { }; const getLast24HoursChange = (price, usdBalance) => { - if (price?.perc24HoursChange === undefined || price?.perc24HoursChange === null) { + if (price?.price_change_24h === undefined || price?.price_change_24h === null) { return null; } - const perc = price.perc24HoursChange; + const perc = price.price_change_24h; const prevBalance = (1 - perc / 100) * usdBalance; const usd = usdBalance - prevBalance; return { diff --git a/src/pages/Adapter/AdapterPage.js b/src/pages/Adapter/AdapterPage.js index e2b39c8..6490e47 100644 --- a/src/pages/Adapter/AdapterPage.js +++ b/src/pages/Adapter/AdapterPage.js @@ -19,7 +19,7 @@ const AdapterPage = () => { if (loading) { const switches = await getSwitches(); const isEnabled = ({ id }) => switches[id]?.enable; - const isSolana = ({ blockchain }) => blockchain === BLOCKCHAINS.SOLANA; + const isSolana = ({ blockchain }) => [BLOCKCHAINS.SOLANA, BLOCKCHAINS.ECLIPSE].includes(blockchain); const solanaNetworks = (await getNetworks()) .filter(isSolana) .filter(isEnabled); diff --git a/src/pages/Nfts/NftsDetailPage.js b/src/pages/Nfts/NftsDetailPage.js index b3f3807..1d142f7 100644 --- a/src/pages/Nfts/NftsDetailPage.js +++ b/src/pages/Nfts/NftsDetailPage.js @@ -81,7 +81,7 @@ const NftsDetailPage = ({ params, t }) => { if (nft) { setNftDetail(nft); } - if (activeBlockchainAccount.network.blockchain === BLOCKCHAINS.SOLANA) { + if ([BLOCKCHAINS.SOLANA, BLOCKCHAINS.ECLIPSE].includes(activeBlockchainAccount.network.blockchain)) { const listed = await activeBlockchainAccount.getListedNfts(); setListedInfo(listed.find(l => l.token_address === params.id)); setListedLoaded(true); diff --git a/src/pages/Wallet/components/NetworkSelector.js b/src/pages/Wallet/components/NetworkSelector.js index 2ddd6ce..3671b5b 100644 --- a/src/pages/Wallet/components/NetworkSelector.js +++ b/src/pages/Wallet/components/NetworkSelector.js @@ -40,6 +40,7 @@ const getNetworkIcon = ({ blockchain }) => { case BLOCKCHAINS.ETHEREUM: return IconEthereumVector; case BLOCKCHAINS.SOLANA: + case BLOCKCHAINS.ECLIPSE: return IconSolanaVector; default: return IconSalmon; diff --git a/src/translations/en/translation.json b/src/translations/en/translation.json index 811a77c..165917a 100644 --- a/src/translations/en/translation.json +++ b/src/translations/en/translation.json @@ -6,7 +6,7 @@ "address": "Address", "to": "To", "name_or_address": "Name or \"{{token}}\" Address", - "recipient_s_address": "RecipientĀ“s \"{{token}}\" Address", + "recipient_s_address": "Recipient's \"{{token}}\" Address", "seed_phrase": "Seed Phrase", "private_key": "Private Key", "balance": "Balance",