type JsonRpcApiProviderOptions: {
  "batchMaxCount": number;
  "batchMaxSize": number;
  "batchStallTime": number;
  "cacheTimeout": number;
  "staticNetwork": null | Network | boolean;
  "usePathing": boolean;
};

Options for configuring a JsonRpcApiProvider. Much of this is targeted towards sub-classes, which often will not expose any of these options to their consumers.

polling - use the polling strategy is used immediately for events; otherwise, attempt to use filters and fall back onto polling (default: false)

staticNetwork - do not request chain ID on requests to validate the underlying chain has not changed (default: null)

This should ONLY be used if it is certain that the network cannot change, such as when using INFURA (since the URL dictates the network). If the network is assumed static and it does change, this can have tragic consequences. For example, this CANNOT be used with MetaMask, since the used can select a new network from the drop-down at any time.

batchStallTime - how long (ms) to aggregate requests into a single batch. 0 indicates batching will only encompass the current event loop. If batchMaxCount = 1, this is ignored. (default: 10)

batchMaxSize - target maximum size (bytes) to allow per batch request (default: 1Mb)

batchMaxCount - maximum number of requests to allow in a batch. If batchMaxCount = 1, then batching is disabled. (default: 100)

cacheTimeout - passed as AbstractProviderOptions | AbstractProviderOptions.

Type declaration

batchMaxCount?

optional batchMaxCount: number;

batchMaxSize?

optional batchMaxSize: number;

batchStallTime?

optional batchStallTime: number;

cacheTimeout?

optional cacheTimeout: number;

staticNetwork?

optional staticNetwork: null | Network | boolean;

usePathing?

optional usePathing: boolean;

Source

providers/provider-jsonrpc.ts:210