Start using JsonRpcBatchProvider from ethers instead of the regular one to optimize for big txs

This commit is contained in:
Willian Mitsuda 2021-11-01 16:17:48 -03:00
parent 74a9b05c04
commit 2dd4850eb0
1 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,9 @@
import { useEffect, useState } from "react";
import { JsonRpcProvider, WebSocketProvider } from "@ethersproject/providers";
import {
JsonRpcProvider,
JsonRpcBatchProvider,
WebSocketProvider,
} from "@ethersproject/providers";
import { ConnectionStatus } from "./types";
import { MIN_API_LEVEL } from "./params";
@ -35,7 +39,7 @@ export const useProvider = (
if (erigonURL?.startsWith("ws://") || erigonURL?.startsWith("wss://")) {
provider = new WebSocketProvider(erigonURL);
} else {
provider = new JsonRpcProvider(erigonURL);
provider = new JsonRpcBatchProvider(erigonURL);
}
// Check if it is at least a regular ETH node