docs: updated docs

This commit is contained in:
Richard Moore 2022-12-10 01:31:18 -05:00
parent 0fa48e2722
commit 722fdd9a3c
5 changed files with 39 additions and 4 deletions

@ -1,3 +1,3 @@
_section: Getting Started @<getting-started> @priority<100> _section: Getting Started @<getting-started> @priority<100>
The v6 getting started is ocming soon... The v6 getting started is coming soon...

@ -1,4 +1,18 @@
_section: Documentation _section: Documentation (BETA) @<about-home>
**NOTE:** This documentation is for the **beta branch** (i.e. ``v6-beta-exports``), which
is still undergoing minor changes.
To try it out:
_code:
/home/ricmoo> npm install ethers@beta-eports
_null:
Please [report any v6 issues](link-issue) and I will get to them right away.
If you are looking v5 docs, please see the [v5 documentation here](link-v5).
_subsection: What is Ethers? _subsection: What is Ethers?

@ -1,5 +1,7 @@
link-mail [link-mail](mailto:me@ricmoo.com) link-mail [link-mail](mailto:me@ricmoo.com)
link-issue [Open GitHub Issue](https://github.com/ethers-io/ethers.js/issues/new/choose)
link-v5 [V5 Documentation](https://docs.ethers.io/v5/)
# Projects # Projects
link-alchemy [Alchemy](https://alchemy.com/?a=ethers) link-alchemy [Alchemy](https://alchemy.com/?a=ethers)

@ -1,4 +1,8 @@
/**
* Explain all the nitty-gritty about the **FallbackProvider**.
*
* @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider]
*/
import { import {
getBigInt, getNumber, assert, assertArgument getBigInt, getNumber, assert, assertArgument
} from "../utils/index.js"; } from "../utils/index.js";
@ -36,6 +40,9 @@ function stringify(value: any): string {
}); });
} }
/**
* A configuration entry for how to use a [[Provider]].
*/
export interface FallbackProviderConfig { export interface FallbackProviderConfig {
// The provider // The provider
@ -56,6 +63,9 @@ const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 };
// We track a bunch of extra stuff that might help debug problems or // We track a bunch of extra stuff that might help debug problems or
// optimize infrastructure later on. // optimize infrastructure later on.
/**
* The statistics and state maintained for a [[Provider]].
*/
export interface FallbackProviderState extends Required<FallbackProviderConfig> { export interface FallbackProviderState extends Required<FallbackProviderConfig> {
// The most recent blockNumber this provider has reported (-2 if none) // The most recent blockNumber this provider has reported (-2 if none)
@ -112,6 +122,9 @@ async function waitForSync(config: Config, blockNumber: number): Promise<void> {
} }
} }
/**
* Additional options to configure a [[FallbackProvider]].
*/
export type FallbackProviderOptions = { export type FallbackProviderOptions = {
// How many providers must agree on a value before reporting // How many providers must agree on a value before reporting
// back the response // back the response
@ -293,6 +306,10 @@ function getFuzzyMode(quorum: number, results: Array<TallyResult>): undefined |
return bestResult; return bestResult;
} }
/**
* A Fallback Provider.
*
*/
export class FallbackProvider extends AbstractProvider { export class FallbackProvider extends AbstractProvider {
readonly quorum: number; readonly quorum: number;

@ -7,7 +7,9 @@ import { getBytes } from "./data.js";
import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; import type { FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js";
/**
* @_ignore:
*/
export async function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise<GetUrlResponse> { export async function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise<GetUrlResponse> {
const protocol = req.url.split(":")[0].toLowerCase(); const protocol = req.url.split(":")[0].toLowerCase();