diff --git a/extension/src/browser/Drawer/index.tsx b/extension/src/browser/Drawer/index.tsx index 64f245ac..f8f1b330 100644 --- a/extension/src/browser/Drawer/index.tsx +++ b/extension/src/browser/Drawer/index.tsx @@ -13,6 +13,7 @@ import { useAllTransactions, useDispatch, useNewTransactions } from '../state' import Submit from './Submit' import { Transaction, TransactionBadge } from './Transaction' import classes from './style.module.css' +import { ChainId, MULTI_SEND_ADDRESS } from '../../networks' const TransactionsDrawer: React.FC = () => { const [expanded, setExpanded] = useState(true) @@ -20,7 +21,7 @@ const TransactionsDrawer: React.FC = () => { const newTransactions = useNewTransactions() const dispatch = useDispatch() const provider = useProvider() - const { connection } = useConnection() + const { connection, chainId } = useConnection() const scrollContainerRef = useRef(null) @@ -58,14 +59,12 @@ const TransactionsDrawer: React.FC = () => { } const copyTransactionData = () => { + if (!chainId) throw new Error('chainId is undefined') const metaTransactions = newTransactions.map((tx) => encodeSingle(tx.input)) const batchTransaction = metaTransactions.length === 1 ? metaTransactions[0] - : encodeMulti( - metaTransactions, - '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761' - ) + : encodeMulti(metaTransactions, MULTI_SEND_ADDRESS[chainId as ChainId]) const finalRequest = connection.moduleAddress ? wrapRequest(batchTransaction, connection) : batchTransaction diff --git a/extension/src/browser/ProvideProvider.tsx b/extension/src/browser/ProvideProvider.tsx index 58c4b72b..e1a3e8d3 100644 --- a/extension/src/browser/ProvideProvider.tsx +++ b/extension/src/browser/ProvideProvider.tsx @@ -8,7 +8,7 @@ import React, { } from 'react' import { decodeSingle, encodeMulti, encodeSingle } from 'react-multisend' -import { ChainId, EXPLORER_API_KEY } from '../networks' +import { ChainId, EXPLORER_API_KEY, MULTI_SEND_ADDRESS } from '../networks' import { ForkProvider, useTenderlyProvider, @@ -116,6 +116,10 @@ const ProvideProvider: React.FC = ({ simulate, children }) => { encodeSingle(txState.input) ) + if (!chainId) { + throw new Error('chainId is undefined') + } + const batchTransactionHash = await wrappingProvider.request({ method: 'eth_sendTransaction', params: [ @@ -123,7 +127,7 @@ const ProvideProvider: React.FC = ({ simulate, children }) => { ? metaTransactions[0] : encodeMulti( metaTransactions, - '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761' + MULTI_SEND_ADDRESS[chainId as ChainId] ), ], }) @@ -135,7 +139,7 @@ const ProvideProvider: React.FC = ({ simulate, children }) => { `multi-send batch has been submitted with transaction hash ${batchTransactionHash}` ) return batchTransactionHash - }, [transactions, wrappingProvider, dispatch]) + }, [transactions, wrappingProvider, dispatch, chainId]) return ( = { 73799: 'Volta Testnet', 80001: 'Polygon Testnet', } + +export const MULTI_SEND_ADDRESS: Record = { + 1: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 3: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 4: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 10: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 11: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 12: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 25: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 28: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 40: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 41: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 42: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 5: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 56: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 61: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 63: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 69: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 82: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 83: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 97: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 100: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 106: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 111: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 122: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 123: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 137: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 246: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 250: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 288: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 300: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 321: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 322: '0x6367360366E4c898488091ac315834B779d8f561', + // 336: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 338: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 420: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 588: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 592: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 595: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 686: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 787: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1001: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1008: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1088: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1284: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1285: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1287: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1294: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1807: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1984: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2001: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2002: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2008: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2019: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2020: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2221: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 2222: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 4002: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 4918: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 4919: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 7341: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 7700: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 8217: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 9000: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 9001: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 10000: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 10001: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 11437: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 12357: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 42161: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 42170: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 42220: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 43113: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 43114: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 47805: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 71401: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + 73799: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + 80001: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 200101: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 200202: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 333999: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 421611: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 421613: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 11155111: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1313161554: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1313161555: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 1666600000: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 1666700000: '0x998739BFdAAdde7C933B942a68053933098f9EDa', + // 11297108099: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', + // 11297108109: '0xA238CBeb142c10Ef7Ad8442C6D1f9E89e07e7761', +} diff --git a/extension/src/settings/Connection/useZodiacModules.ts b/extension/src/settings/Connection/useZodiacModules.ts index e348234a..227de3a0 100644 --- a/extension/src/settings/Connection/useZodiacModules.ts +++ b/extension/src/settings/Connection/useZodiacModules.ts @@ -1,4 +1,4 @@ -import { JsonRpcBatchProvider, Web3Provider } from '@ethersproject/providers' +import { JsonRpcBatchProvider } from '@ethersproject/providers' import { ContractAbis, ContractAddresses,