Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Network

This provides a TypeScript (or JavaScript) interface for loading blockchain network information into a running Db.

See the Network abstraction section of this documentation's index page for an overview of the purpose this abstraction serves, or see the Network.includeBlocks() method documentation for a bit more detail.

Index

Constructor

Abstraction

Other

Internal processor

Constructor

InitializeOptions

InitializeOptions: { network: Omit<Input<"networks">, "networkId" | "historicBlock">; settings?: IncludeSettings } & { db: Db; provider: Provider } | ReturnType<ReturnType<typeof forDb>["forProvider"]>

Options for constructing a Network abstraction, required by initialize().

These options must include either:

In addition, these options must contain network with name information, as per the Network input specification.

Optionally this may include settings to specify IncludeSettings.

initialize

  • Construct a Network abstraction for given InitializeOptions.

    Example:

    import type { Provider } from "web3/providers";
    import { db, Network } from "@truffle/db";
    
    declare const provider: Provider; // obtain this somehow
    
    const db = connect({
      // ...
    });
    
    const network = await Network.initialize({
      db,
      provider,
      network: {
        name: "mainnet"
      }
    });
    

    Parameters

    Returns Promise<Network>

Other

IncludeSettings

IncludeSettings: { disableIndex?: boolean; skipKnownLatest?: boolean }

As described in the documentation for Network.includeBlocks(), these settings may help mitigate unforeseen problems with large data sets.

Type declaration

  • Optional disableIndex?: boolean

    Force the underlying persistence adapter to disable use of certain database indexes. This option exists for purposes of testing fallback behavior for persistence query generation failure. You probably don't need to use this, but it may help diagnose problems when using the SQLite adapter if you see errors about excessive SQL query parameters.

    default

    false

  • Optional skipKnownLatest?: boolean

    Skip final query at end of this operation that determines canonical known latest after the operation completes.

    If set to true, this operation will update Network.knownLatest using only information already present in the abstraction instance as well as information passed as input.

    default

    false

Generated using TypeDoc