From 753e9d5bbde4a7e709d5d09bcb15130a4ed917a0 Mon Sep 17 00:00:00 2001 From: Memo Khoury Date: Fri, 17 Jan 2025 11:39:38 +0000 Subject: [PATCH] relay complete .. without analytics --- webapps/world-builder-dashboard/src/App.tsx | 18 +--- .../src/pages/RelayPage/RelayPage.tsx | 87 +--------------- .../src/utils/relayConfig.ts | 99 +++++++++++++++++++ 3 files changed, 107 insertions(+), 97 deletions(-) create mode 100644 webapps/world-builder-dashboard/src/utils/relayConfig.ts diff --git a/webapps/world-builder-dashboard/src/App.tsx b/webapps/world-builder-dashboard/src/App.tsx index 662f4ce6..b507dad2 100644 --- a/webapps/world-builder-dashboard/src/App.tsx +++ b/webapps/world-builder-dashboard/src/App.tsx @@ -18,12 +18,11 @@ import router from '@/router' // relay stuff import { RelayKitProvider } from '@reservoir0x/relay-kit-ui' -import { convertViemChainToRelayChain } from '@reservoir0x/relay-sdk' -import { http, createConfig, WagmiProvider } from 'wagmi' -import { mainnet, arbitrum, arbitrumSepolia, sepolia, } from 'viem/chains' +import { WagmiProvider } from 'wagmi' import { MAINNET_RELAY_API } from '@reservoir0x/relay-sdk' import { theme } from './utils/relayTheme' import '@reservoir0x/relay-kit-ui/styles.css' +import { wagmiConfig, chains } from './utils/relayConfig' dayjs.extend(utc) dayjs.extend(timezone) @@ -48,19 +47,8 @@ const queryClient = new QueryClient({ } }) -const chains = [ - convertViemChainToRelayChain(mainnet), - convertViemChainToRelayChain(arbitrum), - convertViemChainToRelayChain(arbitrumSepolia), - convertViemChainToRelayChain(sepolia) -] -const wagmiConfig = createConfig({ - chains: [mainnet], - transports: { - [mainnet.id]: http(), - } -}) + const enMessages = { en } diff --git a/webapps/world-builder-dashboard/src/pages/RelayPage/RelayPage.tsx b/webapps/world-builder-dashboard/src/pages/RelayPage/RelayPage.tsx index 808c8897..ed5f2179 100644 --- a/webapps/world-builder-dashboard/src/pages/RelayPage/RelayPage.tsx +++ b/webapps/world-builder-dashboard/src/pages/RelayPage/RelayPage.tsx @@ -15,6 +15,7 @@ import { useNotifications, usePendingTransactions } from '@/hooks/useL2ToL1Messa import { SwapWidget } from '@reservoir0x/relay-kit-ui' import { Address } from "viem" import { useNavigate } from 'react-router-dom' +import { ETH, USDC, TOKENS } from '@/utils/relayConfig' export interface SwapWidgetToken { chainId: number; @@ -29,7 +30,7 @@ export interface SwapWidgetToken { const RelayPage = () => { - const { connectedAccount } = useBlockchainContext() + const { connectedAccount, connectWallet } = useBlockchainContext() const navigate = useNavigate() const pendingTransacions = usePendingTransactions(connectedAccount) const [notificationsOffset] = useState(0) @@ -61,15 +62,11 @@ const RelayPage = () => {
{ console.log('Analytic Event', eventName, data) }} @@ -83,78 +80,4 @@ const RelayPage = () => { ) } -export default RelayPage - - -export const ETH: SwapWidgetToken = { - chainId: 1, - address: '0x0000000000000000000000000000000000000000', - decimals: 18, - name: 'ETH', - symbol: 'ETH', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const ETH_ARB: SwapWidgetToken = { - chainId: 42161, - address: '0x0000000000000000000000000000000000000000', - decimals: 18, - name: 'ETH', - symbol: 'ETH', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const USDC: SwapWidgetToken = { - chainId: 1, - address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - decimals: 6, - name: 'USDC', - symbol: 'USDC', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const USDC_ARB: SwapWidgetToken = { - chainId: 42161, - address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', - decimals: 6, - name: 'USDC', - symbol: 'USDC', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const USDC_G7: SwapWidgetToken = { - chainId: 2187, - address: '0x401eCb1D350407f13ba348573E5630B83638E30D', - decimals: 6, - name: 'USDC', - symbol: 'USDC', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -// G7 -export const G7: SwapWidgetToken = { - chainId: 1, - address: '0x12c88a3C30A7AaBC1dd7f2c08a97145F5DCcD830', - decimals: 18, - name: 'G7', - symbol: 'G7', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const G7_ARB = { - chainId: 42161, - address: '0xF18e4466F26B4cA55bbAb890b314a54976E45B17', - decimals: 18, - name: 'G7', - symbol: 'G7', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} - -export const G7_G7 = { - chainId: 2187, - address: '0x0000000000000000000000000000000000000000', - decimals: 18, - name: 'G7', - symbol: 'G7', - logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' -} +export default RelayPage \ No newline at end of file diff --git a/webapps/world-builder-dashboard/src/utils/relayConfig.ts b/webapps/world-builder-dashboard/src/utils/relayConfig.ts new file mode 100644 index 00000000..47840132 --- /dev/null +++ b/webapps/world-builder-dashboard/src/utils/relayConfig.ts @@ -0,0 +1,99 @@ + +import { SwapWidgetToken } from '@/pages/RelayPage/RelayPage' +import { convertViemChainToRelayChain } from '@reservoir0x/relay-sdk' +import { http } from 'viem' +import { mainnet, arbitrum, base, optimism, polygon, zksync, xai } from 'viem/chains' +import { createConfig } from 'wagmi' + +export const chains = [ + convertViemChainToRelayChain(mainnet), + convertViemChainToRelayChain(arbitrum), + convertViemChainToRelayChain(base), + convertViemChainToRelayChain(optimism), + convertViemChainToRelayChain(polygon), + convertViemChainToRelayChain(zksync), + convertViemChainToRelayChain(xai), +] + +export const wagmiConfig = createConfig({ + chains: [mainnet], + transports: { + [mainnet.id]: http(), + } +}) + +export const ETH: SwapWidgetToken = { + chainId: 1, + address: '0x0000000000000000000000000000000000000000', + decimals: 18, + name: 'ETH', + symbol: 'ETH', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const ETH_ARB: SwapWidgetToken = { + chainId: 42161, + address: '0x0000000000000000000000000000000000000000', + decimals: 18, + name: 'ETH', + symbol: 'ETH', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const USDC: SwapWidgetToken = { + chainId: 1, + address: '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', + decimals: 6, + name: 'USDC', + symbol: 'USDC', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const USDC_ARB: SwapWidgetToken = { + chainId: 42161, + address: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831', + decimals: 6, + name: 'USDC', + symbol: 'USDC', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const USDC_G7: SwapWidgetToken = { + chainId: 2187, + address: '0x401eCb1D350407f13ba348573E5630B83638E30D', + decimals: 6, + name: 'USDC', + symbol: 'USDC', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +// G7 +export const G7: SwapWidgetToken = { + chainId: 1, + address: '0x12c88a3C30A7AaBC1dd7f2c08a97145F5DCcD830', + decimals: 18, + name: 'G7', + symbol: 'G7', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const G7_ARB = { + chainId: 42161, + address: '0xF18e4466F26B4cA55bbAb890b314a54976E45B17', + decimals: 18, + name: 'G7', + symbol: 'G7', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + +export const G7_G7 = { + chainId: 2187, + address: '0x0000000000000000000000000000000000000000', + decimals: 18, + name: 'G7', + symbol: 'G7', + logoURI: 'https://2248955668-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhE4weeNpCJSNUXnecN1R%2Ficon%2FgJEa5WUcw0RjBfGqTNof%2Fxai%20symbol%20red%20svg.svg?alt=media&token=9131a0bf-a73d-4052-a957-fd69884aee62' +} + + +export const TOKENS = [ETH, ETH_ARB, USDC, USDC_ARB, USDC_G7, G7, G7_ARB, G7_G7] \ No newline at end of file