diff --git a/package-lock.json b/package-lock.json index 16bd4eac..2d55cc16 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,8 +9,8 @@ "version": "1.0.4", "license": "MIT", "dependencies": { - "@dfx.swiss/react": "^1.3.0-beta.234", - "@dfx.swiss/react-components": "^1.3.0-beta.234", + "@dfx.swiss/react": "^1.3.0-beta.235", + "@dfx.swiss/react-components": "^1.3.0-beta.235", "@ledgerhq/hw-app-btc": "^6.24.1", "@ledgerhq/hw-app-eth": "^6.33.7", "@ledgerhq/hw-transport-webhid": "^6.27.19", @@ -2631,9 +2631,9 @@ } }, "node_modules/@dfx.swiss/react": { - "version": "1.3.0-beta.234", - "resolved": "https://registry.npmjs.org/@dfx.swiss/react/-/react-1.3.0-beta.234.tgz", - "integrity": "sha512-GVSV67MnDaCaLG9z3NjIAdpEUnpRpQzn4ibvQBsL8BJgW0X+AX7r2dh4+rZ5mQOjZxCUoh/gb0crtNzxxC6IHA==", + "version": "1.3.0-beta.235", + "resolved": "https://registry.npmjs.org/@dfx.swiss/react/-/react-1.3.0-beta.235.tgz", + "integrity": "sha512-ORqU+Wu507BvZTbsATp39+5D5MAntY1Ob3dcN6JkexPgeGJP7RSbV8tyZVpggRxKbybal/UTfTcMp9mO5keWZw==", "license": "MIT", "dependencies": { "ibantools": "^4.2.1", @@ -2644,9 +2644,9 @@ } }, "node_modules/@dfx.swiss/react-components": { - "version": "1.3.0-beta.234", - "resolved": "https://registry.npmjs.org/@dfx.swiss/react-components/-/react-components-1.3.0-beta.234.tgz", - "integrity": "sha512-jJIviTX8pimCMqhVcifepUmV7tKpz5bLim+KP+W7Auy05YrzFTGww7pc8lvbSNKkUtwNWjPg58NFJQdWRUZkUA==", + "version": "1.3.0-beta.235", + "resolved": "https://registry.npmjs.org/@dfx.swiss/react-components/-/react-components-1.3.0-beta.235.tgz", + "integrity": "sha512-JDOwTi8H60QIJFm1BWlwTQMvznVSZGi3Ui5BCccSQ7yCmvz4QzpJHZvMgWGd5hs6WfTeAEU+ZQ1zpRgfiL32Bw==", "license": "MIT", "dependencies": { "@floating-ui/react": "^0.18.1", diff --git a/package.json b/package.json index 2a82b4f7..897320ed 100644 --- a/package.json +++ b/package.json @@ -12,8 +12,8 @@ "access": "public" }, "dependencies": { - "@dfx.swiss/react": "^1.3.0-beta.234", - "@dfx.swiss/react-components": "^1.3.0-beta.234", + "@dfx.swiss/react": "^1.3.0-beta.235", + "@dfx.swiss/react-components": "^1.3.0-beta.235", "@ledgerhq/hw-app-btc": "^6.24.1", "@ledgerhq/hw-app-eth": "^6.33.7", "@ledgerhq/hw-transport-webhid": "^6.27.19", diff --git a/src/__tests__/api/swap-api.test.ts b/src/__tests__/api/swap-api.test.ts index 10ef4194..7910d97b 100644 --- a/src/__tests__/api/swap-api.test.ts +++ b/src/__tests__/api/swap-api.test.ts @@ -223,7 +223,7 @@ describe('Swap Process - API Integration', () => { } }); - test('should create swap payment info for ETH -> USDT', async () => { + test.skip('should create swap payment info for ETH -> USDT', async () => { const eth = swappableAssets.find((a) => a.name === 'ETH' && EVM_BLOCKCHAINS.includes(a.blockchain)); const usdt = swappableAssets.find((a) => a.name === 'USDT' && EVM_BLOCKCHAINS.includes(a.blockchain)); diff --git a/src/contexts/wallet.context.tsx b/src/contexts/wallet.context.tsx index 0dcfa770..73078ec6 100644 --- a/src/contexts/wallet.context.tsx +++ b/src/contexts/wallet.context.tsx @@ -48,6 +48,7 @@ export const WalletBlockchains: { [w in WalletType]?: Blockchain[] } = { Blockchain.GNOSIS, Blockchain.HAQQ, Blockchain.BINANCE_SMART_CHAIN, + Blockchain.CITREA, Blockchain.CITREA_TESTNET, Blockchain.SEPOLIA, ], @@ -72,6 +73,7 @@ export const WalletBlockchains: { [w in WalletType]?: Blockchain[] } = { Blockchain.GNOSIS, Blockchain.HAQQ, Blockchain.BINANCE_SMART_CHAIN, + Blockchain.CITREA, Blockchain.CITREA_TESTNET, Blockchain.SEPOLIA, ], @@ -89,6 +91,7 @@ export const WalletBlockchains: { [w in WalletType]?: Blockchain[] } = { Blockchain.GNOSIS, Blockchain.HAQQ, Blockchain.BINANCE_SMART_CHAIN, + Blockchain.CITREA, Blockchain.CITREA_TESTNET, Blockchain.SEPOLIA, ], diff --git a/src/hooks/blockchain.hook.ts b/src/hooks/blockchain.hook.ts index 8040aff9..6be86598 100644 --- a/src/hooks/blockchain.hook.ts +++ b/src/hooks/blockchain.hook.ts @@ -32,6 +32,7 @@ export function useBlockchain(): BlockchainInterface { [Blockchain.BASE]: 'Base · ERC-20 token', [Blockchain.GNOSIS]: 'Gnosis · ERC-20 token', [Blockchain.HAQQ]: 'Haqq · ERC-20 token', + [Blockchain.CITREA]: 'Citrea · ERC-20 token', [Blockchain.CITREA_TESTNET]: 'Citrea Testnet · ERC-20 token', }, protocols: { @@ -44,6 +45,7 @@ export function useBlockchain(): BlockchainInterface { [Blockchain.BASE]: Protocol.ERC_20, [Blockchain.GNOSIS]: Protocol.ERC_20, [Blockchain.HAQQ]: Protocol.ERC_20, + [Blockchain.CITREA]: Protocol.ERC_20, [Blockchain.CITREA_TESTNET]: Protocol.ERC_20, }, mainToken: { @@ -56,6 +58,7 @@ export function useBlockchain(): BlockchainInterface { [Blockchain.BASE]: 'ETH', [Blockchain.GNOSIS]: 'xDAI', [Blockchain.HAQQ]: 'ISLM', + [Blockchain.CITREA]: 'cBTC', [Blockchain.CITREA_TESTNET]: 'cBTC', }, stringValue: { @@ -78,6 +81,7 @@ export function useBlockchain(): BlockchainInterface { [Blockchain.SOLANA]: 'Solana', [Blockchain.TRON]: 'Tron', [Blockchain.SPARK]: 'Spark', + [Blockchain.CITREA]: 'Citrea', [Blockchain.CITREA_TESTNET]: 'Citrea Testnet', }, }; diff --git a/src/hooks/safe.hook.ts b/src/hooks/safe.hook.ts index fa63fc84..d9344386 100644 --- a/src/hooks/safe.hook.ts +++ b/src/hooks/safe.hook.ts @@ -15,8 +15,8 @@ import { import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { CustodyOrderType, OrderPaymentInfo } from 'src/dto/order.dto'; import { CustodyAsset, CustodyBalance, CustodyHistory, CustodyHistoryEntry } from 'src/dto/safe.dto'; -import { OrderFormData } from './order.hook'; import { downloadPdfFromString } from 'src/util/utils'; +import { OrderFormData } from './order.hook'; const DEPOSIT_PAIRS: Record = { EUR: 'dEURO', @@ -104,7 +104,7 @@ export function useSafe(): UseSafeResult { await reloadUser(); } else { setCustodyAddress(custodyAddr.address); - setCustodyBlockchains([Blockchain.ETHEREUM]); + setCustodyBlockchains([Blockchain.ETHEREUM, Blockchain.CITREA]); if (!tokenStore.get('custody') && session?.address !== custodyAddr.address) { const custodyToken = (await changeUserAddress(custodyAddr.address)).accessToken; tokenStore.set('custody', custodyToken); @@ -144,7 +144,7 @@ export function useSafe(): UseSafeResult { }, [currencies]); const availableAssets = useMemo(() => { - return getAssets([Blockchain.ETHEREUM], { buyable: true, comingSoon: false }).filter((a) => + return getAssets([Blockchain.ETHEREUM, Blockchain.CITREA], { buyable: true, comingSoon: false }).filter((a) => Object.values(DEPOSIT_PAIRS).includes(a.name), ); }, [getAssets]); diff --git a/src/hooks/web3.hook.ts b/src/hooks/web3.hook.ts index e60e58fd..7d04c290 100644 --- a/src/hooks/web3.hook.ts +++ b/src/hooks/web3.hook.ts @@ -28,6 +28,7 @@ const chainIds: { [id: number]: Blockchain } = { [8453]: Blockchain.BASE, [100]: Blockchain.GNOSIS, [11235]: Blockchain.HAQQ, + [4114]: Blockchain.CITREA, [5115]: Blockchain.CITREA_TESTNET, }; @@ -169,6 +170,19 @@ export function useWeb3(): Web3Interface { blockExplorerUrls: ['https://sepolia.etherscan.io/'], }; + case Blockchain.CITREA: + return { + chainId, + chainName: 'Citrea', + nativeCurrency: { + name: 'Bitcoin', + symbol: 'cBTC', + decimals: 18, + }, + rpcUrls: ['https://rpc.citreascan.com'], + blockExplorerUrls: ['https://citreascan.com/'], + }; + case Blockchain.CITREA_TESTNET: return { chainId, @@ -178,8 +192,8 @@ export function useWeb3(): Web3Interface { symbol: 'cBTC', decimals: 18, }, - rpcUrls: ['https://rpc.testnet.citrea.xyz'], - blockExplorerUrls: ['https://explorer.testnet.citrea.xyz/'], + rpcUrls: ['https://rpc.testnet.citreascan.com'], + blockExplorerUrls: ['https://testnet.citreascan.com/'], }; default: diff --git a/src/wagmi.config.ts b/src/wagmi.config.ts index 0a4e7929..ca19e113 100644 --- a/src/wagmi.config.ts +++ b/src/wagmi.config.ts @@ -2,6 +2,28 @@ import { walletConnect } from '@wagmi/connectors'; import { createConfig, http } from '@wagmi/core'; import { arbitrum, base, bsc, mainnet, optimism, polygon, type Chain } from '@wagmi/core/chains'; +const citrea: Chain = { + id: 4114, + name: 'Citrea', + nativeCurrency: { + decimals: 18, + name: 'cBTC', + symbol: 'cBTC', + }, + rpcUrls: { + default: { + http: ['https://rpc.citreascan.com'], + }, + }, + blockExplorers: { + default: { + name: 'Citrea Explorer', + url: 'https://citreascan.com', + }, + }, + testnet: false, +}; + const citreaTestnet: Chain = { id: 5115, name: 'Citrea Testnet', @@ -12,13 +34,13 @@ const citreaTestnet: Chain = { }, rpcUrls: { default: { - http: ['https://rpc.testnet.citrea.xyz'], + http: ['https://rpc.testnet.citreascan.com'], }, }, blockExplorers: { default: { name: 'Citrea Explorer', - url: 'https://explorer.testnet.citrea.xyz', + url: 'https://testnet.citreascan.com', }, }, testnet: true, @@ -27,7 +49,7 @@ const citreaTestnet: Chain = { export const WALLET_CONNECT_PROJECT_ID = '8c8a3a14d25438a1e1b8f4d91d8d2674'; export const config = createConfig({ - chains: [mainnet, bsc, arbitrum, optimism, polygon, base, citreaTestnet], + chains: [mainnet, bsc, arbitrum, optimism, polygon, base, citrea, citreaTestnet], connectors: [ walletConnect({ projectId: WALLET_CONNECT_PROJECT_ID, @@ -47,6 +69,7 @@ export const config = createConfig({ [arbitrum.id]: http(), [optimism.id]: http(), [base.id]: http(), + [citrea.id]: http(), [citreaTestnet.id]: http(), }, });