From 364c624bbadf4ea8032a3c432198379aa2b80de8 Mon Sep 17 00:00:00 2001 From: kamalbuilds Date: Sun, 11 Aug 2024 21:05:55 +0530 Subject: [PATCH] update readme with latest details --- README.md | 2 + frontend/app/page.tsx | 8 +- frontend/app/preference/page.tsx | 12 +- frontend/config/site.ts | 10 +- frontend/misc.ts | 223 +------------------------------ frontend/utils/config.ts | 4 +- 6 files changed, 20 insertions(+), 239 deletions(-) diff --git a/README.md b/README.md index 1a13c4e..cd2f3f9 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Mode Testnet - https://sepolia.explorer.mode.network/address/0xc8E2B6AC668AC47ff OP Sepolia Testnet - https://optimism-sepolia.blockscout.com/address/0x2AAC535db31DB35D13AECe36Ea7954A2089D55bE +Fraxtal Testnet - https://holesky.fraxscan.com/address/0x301Ab38c7f652FA23C7Ba1fa182E36665Dac0fC2 + ## Features ### Simplified Cross-Chain Payments diff --git a/frontend/app/page.tsx b/frontend/app/page.tsx index 05148e7..b94f062 100644 --- a/frontend/app/page.tsx +++ b/frontend/app/page.tsx @@ -10,7 +10,6 @@ import { ERC20_ABI, SPOKEPOOL_ABI, TOKEN_ADDRESS_BY_SYMBOL, - ZKBOB_DIRECT_DEPOSIT_ABI, } from "misc" import { createPublicClient, createWalletClient, custom, http } from "viem" import * as chains from "viem/chains" @@ -78,10 +77,7 @@ export default function Home() { const chainId = await walletClient.getChainId() - const chain = CHAINS[chainId] - - // const publicClient = () => - // configureChains([chain], [alchemyProvider({ apiKey: 'wFen0yW-EwjPyr49Cyg2x2nNARSt7Os0' })]).publicClient({ chainId: chainId }) + const chain = CHAINS[chainId]; const publicClient = createPublicClient({ chain, @@ -247,7 +243,7 @@ export default function Home() { TOKEN_ADDRESS_BY_SYMBOL[paymentAsset][ (await getChainDetails()).chain.name.toLowerCase() ], - "0x1111111254eeb25477b68fb85ed929f73a960582" + "0x1111111254eeb25477b68fb85ed929f73a960582" // 1inch router ) const caller = (await getChainDetails()).address const swapFromTokenAddress = diff --git a/frontend/app/preference/page.tsx b/frontend/app/preference/page.tsx index de3f85e..b17c4a7 100644 --- a/frontend/app/preference/page.tsx +++ b/frontend/app/preference/page.tsx @@ -68,12 +68,12 @@ const Merchantpreference: React.FC = () => { ), }) - const contractAddress = ( - siteConfig.crosspayaddress as Record - )[chainId] - if (!contractAddress) { - toast.error("Contract not deployed on this network") - } + const contractAddress = ( + siteConfig.crosspayaddress as Record + )[chainId] + if (!contractAddress) { + toast.error("Contract not deployed on this network") + } const [address] = await walletClient.getAddresses() diff --git a/frontend/config/site.ts b/frontend/config/site.ts index c54f7e5..b140c81 100644 --- a/frontend/config/site.ts +++ b/frontend/config/site.ts @@ -2,8 +2,7 @@ export type SiteConfig = typeof siteConfig export const siteConfig = { name: "Cross-Chain MerchantsPay", - description: - "Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.", + description: "Connecting merchants with customers , a payment infrastructure designed to make it easy for merchants to accept payments in any token on multiple chains", mainNav: [ ], @@ -11,5 +10,10 @@ export const siteConfig = { twitter: "https://twitter.com/0xkamal7", docs: "https://ui.shadcn.com", }, - crosspayaddress: "0x6328a8e5529dd322A5583b5EEFfc48a2dc2c3A0f" + crosspayaddress: { + 84532: "0xC0204113CcC43D83De06191C082ea696C65466f9", // Base Sepolia + 56: "0xc8E2B6AC668AC47ffE8814E86aDCb966C6AA3d5b", // Mode Sepolia + 11155420: "0x2AAC535db31DB35D13AECe36Ea7954A2089D55bE", // OP Sepolia + 2522: "0x301Ab38c7f652FA23C7Ba1fa182E36665Dac0fC2" // fRAXTAL Holesky + } } diff --git a/frontend/misc.ts b/frontend/misc.ts index 9a42f0c..0f6a8ea 100644 --- a/frontend/misc.ts +++ b/frontend/misc.ts @@ -1,225 +1,4 @@ -export const ZKBOB_DIRECT_DEPOSIT_ABI = [ - { - inputs: [ - { internalType: 'address', name: '_pool', type: 'address' }, - { internalType: 'address', name: '_token', type: 'address' }, - { internalType: 'uint256', name: '_denominator', type: 'uint256' }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - anonymous: false, - inputs: [{ indexed: false, internalType: 'uint256[]', name: 'indices', type: 'uint256[]' }], - name: 'CompleteDirectDepositBatch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: 'address', name: 'previousOwner', type: 'address' }, - { indexed: true, internalType: 'address', name: 'newOwner', type: 'address' }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: 'uint256', name: 'nonce', type: 'uint256' }, - { indexed: false, internalType: 'address', name: 'receiver', type: 'address' }, - { indexed: false, internalType: 'uint256', name: 'amount', type: 'uint256' }, - ], - name: 'RefundDirectDeposit', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { indexed: true, internalType: 'address', name: 'sender', type: 'address' }, - { indexed: true, internalType: 'uint256', name: 'nonce', type: 'uint256' }, - { indexed: false, internalType: 'address', name: 'fallbackUser', type: 'address' }, - { - components: [ - { internalType: 'bytes10', name: 'diversifier', type: 'bytes10' }, - { internalType: 'bytes32', name: 'pk', type: 'bytes32' }, - ], - indexed: false, - internalType: 'struct ZkAddress.ZkAddress', - name: 'zkAddress', - type: 'tuple', - }, - { indexed: false, internalType: 'uint64', name: 'deposit', type: 'uint64' }, - ], - name: 'SubmitDirectDeposit', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, internalType: 'uint64', name: 'fee', type: 'uint64' }], - name: 'UpdateDirectDepositFee', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, internalType: 'uint40', name: 'timeout', type: 'uint40' }], - name: 'UpdateDirectDepositTimeout', - type: 'event', - }, - { - anonymous: false, - inputs: [{ indexed: false, internalType: 'address', name: 'manager', type: 'address' }], - name: 'UpdateOperatorManager', - type: 'event', - }, - { - inputs: [ - { internalType: 'uint256[]', name: '_indices', type: 'uint256[]' }, - { internalType: 'uint256', name: '_out_commit', type: 'uint256' }, - ], - name: 'collect', - outputs: [ - { internalType: 'uint256', name: 'total', type: 'uint256' }, - { internalType: 'uint256', name: 'totalFee', type: 'uint256' }, - { internalType: 'uint256', name: 'hashsum', type: 'uint256' }, - { internalType: 'bytes', name: 'message', type: 'bytes' }, - ], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'address', name: '_fallbackUser', type: 'address' }, - { internalType: 'uint256', name: '_amount', type: 'uint256' }, - { internalType: 'bytes', name: '_rawZkAddress', type: 'bytes' }, - ], - name: 'directDeposit', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'address', name: '_fallbackUser', type: 'address' }, - { internalType: 'uint256', name: '_amount', type: 'uint256' }, - { internalType: 'string', name: '_zkAddress', type: 'string' }, - ], - name: 'directDeposit', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'directDepositFee', - outputs: [{ internalType: 'uint64', name: '', type: 'uint64' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'directDepositNonce', - outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'directDepositTimeout', - outputs: [{ internalType: 'uint40', name: '', type: 'uint40' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'uint256', name: '_index', type: 'uint256' }], - name: 'getDirectDeposit', - outputs: [ - { - components: [ - { internalType: 'address', name: 'fallbackReceiver', type: 'address' }, - { internalType: 'uint96', name: 'sent', type: 'uint96' }, - { internalType: 'uint64', name: 'deposit', type: 'uint64' }, - { internalType: 'uint64', name: 'fee', type: 'uint64' }, - { internalType: 'uint40', name: 'timestamp', type: 'uint40' }, - { internalType: 'enum IZkBobDirectDeposits.DirectDepositStatus', name: 'status', type: 'uint8' }, - { internalType: 'bytes10', name: 'diversifier', type: 'bytes10' }, - { internalType: 'bytes32', name: 'pk', type: 'bytes32' }, - ], - internalType: 'struct IZkBobDirectDeposits.DirectDeposit', - name: '', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'address', name: '_from', type: 'address' }, - { internalType: 'uint256', name: '_value', type: 'uint256' }, - { internalType: 'bytes', name: '_data', type: 'bytes' }, - ], - name: 'onTokenTransfer', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [], - name: 'operatorManager', - outputs: [{ internalType: 'contract IOperatorManager', name: '', type: 'address' }], - stateMutability: 'view', - type: 'function', - }, - { inputs: [], name: 'owner', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' }, - { inputs: [], name: 'pool', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' }, - { inputs: [], name: 'pool_id', outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], stateMutability: 'view', type: 'function' }, - { - inputs: [{ internalType: 'uint256[]', name: '_indices', type: 'uint256[]' }], - name: 'refundDirectDeposit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'uint256', name: '_index', type: 'uint256' }], - name: 'refundDirectDeposit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { inputs: [], name: 'renounceOwnership', outputs: [], stateMutability: 'nonpayable', type: 'function' }, - { - inputs: [{ internalType: 'uint64', name: '_fee', type: 'uint64' }], - name: 'setDirectDepositFee', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'uint40', name: '_timeout', type: 'uint40' }], - name: 'setDirectDepositTimeout', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'contract IOperatorManager', name: '_operatorManager', type: 'address' }], - name: 'setOperatorManager', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { inputs: [], name: 'token', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' }, - { - inputs: [{ internalType: 'address', name: 'newOwner', type: 'address' }], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - ] - + export const SPOKEPOOL_ABI = [ { anonymous: false, diff --git a/frontend/utils/config.ts b/frontend/utils/config.ts index e4b5743..b708ddb 100644 --- a/frontend/utils/config.ts +++ b/frontend/utils/config.ts @@ -1,5 +1,5 @@ import { http } from 'wagmi' -import { baseSepolia, mainnet, modeTestnet, sepolia } from 'wagmi/chains' +import { baseSepolia, mainnet, modeTestnet, optimismSepolia, sepolia } from 'wagmi/chains' import { defaultWagmiConfig } from '@web3modal/wagmi/react/config' const chains = [mainnet, sepolia , modeTestnet , baseSepolia] as const @@ -16,7 +16,7 @@ export const config = defaultWagmiConfig({ projectId: 'ebc8b79c899ea9b36db43c39aea67728', metadata, transports: { - [mainnet.id]: http(), + [optimismSepolia.id]: http(), [sepolia.id]: http(), [modeTestnet.id]: http(), [baseSepolia.id]: http(),