Skip to content

Commit

Permalink
update explorer transports/poll interval
Browse files Browse the repository at this point in the history
  • Loading branch information
holic committed Nov 11, 2024
1 parent 88b9daf commit ee97ca2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";

import { WagmiProvider, createConfig, http } from "wagmi";
import { WagmiProvider, createConfig, fallback, http, webSocket } from "wagmi";
import { injected, metaMask, safe } from "wagmi/connectors";
import { ReactNode, useMemo } from "react";
import { RainbowKitProvider, darkTheme } from "@rainbow-me/rainbowkit";
Expand All @@ -27,9 +27,14 @@ export function Providers({ children }: { children: ReactNode }) {
...getDefaultAnvilConnectors(chain.id),
],
transports: {
[chain.id]: http(),
[chain.id]: chain.rpcUrls.default.webSocket
? fallback([webSocket(chain.rpcUrls.default.webSocket[0]), http(chain.rpcUrls.default.http[0])])
: http(chain.rpcUrls.default.http[0]),
},
ssr: true,
pollingInterval: {
[chain.id]: chain.id === 31337 ? 100 : 500,
},
});
}, [chain]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ export function EditableTableCell({ name, table, keyTuple, value: defaultValue }
chainId,
});

const receipt = await waitForTransactionReceipt(wagmiConfig, {
hash: txHash,
pollingInterval: 100,
});
const receipt = await waitForTransactionReceipt(wagmiConfig, { hash: txHash });

return { txHash, receipt };
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ export function useContractMutation({ worldAbi, functionAbi, operationType }: Us
chainId,
});

const receipt = await waitForTransactionReceipt(wagmiConfig, {
hash: txHash,
pollingInterval: 100,
});
const receipt = await waitForTransactionReceipt(wagmiConfig, { hash: txHash });

return { txHash, receipt };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
parseEventLogs,
} from "viem";
import { UserOperation, entryPoint07Abi, entryPoint07Address } from "viem/account-abstraction";
import { anvil } from "viem/chains";
import { useConfig, useWatchBlocks } from "wagmi";
import { getTransaction, simulateContract, waitForTransactionReceipt } from "wagmi/actions";
import { useStore } from "zustand";
Expand Down Expand Up @@ -226,7 +225,6 @@ export function TransactionsWatcher() {
}
},
chainId,
pollingInterval: chainId === anvil.id ? 10 : 500,
});

return null;
Expand Down

0 comments on commit ee97ca2

Please sign in to comment.