diff --git a/pages/api/proxy.ts b/pages/api/proxy.ts
index 9c9d74fa68..0756f3639c 100644
--- a/pages/api/proxy.ts
+++ b/pages/api/proxy.ts
@@ -32,8 +32,8 @@ export default handler;
export const config = {
api: {
- // disable body parser otherwise it is impossible to upload large files (over 1Mb)
- // e.g. when verifying a smart contract
- bodyParser: false,
+ bodyParser: {
+ sizeLimit: '100mb',
+ },
},
};
diff --git a/ui/address/AddressContract.tsx b/ui/address/AddressContract.tsx
index 32bd6e8baf..a2dd58db5f 100644
--- a/ui/address/AddressContract.tsx
+++ b/ui/address/AddressContract.tsx
@@ -16,7 +16,7 @@ const TAB_LIST_PROPS = {
const AddressContract = ({ tabs }: Props) => {
const fallback = React.useCallback(() => {
- const noProviderTabs = tabs.filter(({ id }) => id === 'contact_code');
+ const noProviderTabs = tabs.filter(({ id }) => id === 'contact_code' || id.startsWith('read_'));
return (
);
diff --git a/ui/address/contract/ContractRead.tsx b/ui/address/contract/ContractRead.tsx
index edbfdd899f..564b5a8e42 100644
--- a/ui/address/contract/ContractRead.tsx
+++ b/ui/address/contract/ContractRead.tsx
@@ -1,6 +1,5 @@
import { Alert, Flex } from '@chakra-ui/react';
import React from 'react';
-import { useAccount } from 'wagmi';
import type { SmartContractReadMethod, SmartContractQueryMethodRead } from 'types/api/contract';
@@ -16,6 +15,7 @@ import ContractImplementationAddress from './ContractImplementationAddress';
import ContractMethodCallable from './ContractMethodCallable';
import ContractMethodConstant from './ContractMethodConstant';
import ContractReadResult from './ContractReadResult';
+import useWatchAccount from './useWatchAccount';
interface Props {
addressHash?: string;
@@ -25,13 +25,13 @@ interface Props {
const ContractRead = ({ addressHash, isProxy, isCustomAbi }: Props) => {
const apiFetch = useApiFetch();
- const { address: userAddress } = useAccount();
+ const account = useWatchAccount();
const { data, isLoading, isError } = useApiQuery(isProxy ? 'contract_methods_read_proxy' : 'contract_methods_read', {
pathParams: { hash: addressHash },
queryParams: {
is_custom_abi: isCustomAbi ? 'true' : 'false',
- from: userAddress,
+ from: account?.address,
},
queryOptions: {
enabled: Boolean(addressHash),
@@ -50,11 +50,11 @@ const ContractRead = ({ addressHash, isProxy, isCustomAbi }: Props) => {
args,
method_id: item.method_id,
contract_type: isProxy ? 'proxy' : 'regular',
- from: userAddress,
+ from: account?.address,
},
},
});
- }, [ addressHash, apiFetch, isCustomAbi, isProxy, userAddress ]);
+ }, [ account?.address, addressHash, apiFetch, isCustomAbi, isProxy ]);
const renderItemContent = React.useCallback((item: SmartContractReadMethod, index: number, id: number) => {
if (item.error) {
@@ -94,7 +94,7 @@ const ContractRead = ({ addressHash, isProxy, isCustomAbi }: Props) => {
return (
<>
{ isCustomAbi && }
-
+ { account && }
{ isProxy && }
>
diff --git a/ui/address/contract/useWatchAccount.tsx b/ui/address/contract/useWatchAccount.tsx
new file mode 100644
index 0000000000..d4035e6ce5
--- /dev/null
+++ b/ui/address/contract/useWatchAccount.tsx
@@ -0,0 +1,24 @@
+import { watchAccount, getAccount } from '@wagmi/core';
+import React from 'react';
+
+export function getWalletAccount() {
+ try {
+ return getAccount();
+ } catch (error) {
+ return null;
+ }
+}
+
+export default function useWatchAccount() {
+ const [ account, setAccount ] = React.useState(getWalletAccount());
+
+ React.useEffect(() => {
+ if (!account) {
+ return;
+ }
+
+ return watchAccount(setAccount);
+ }, [ account ]);
+
+ return account;
+}