Class ClientFactory

Massa Web3 ClientFactory class allows you to easily initialize a client to connect to the massa blockchain.

Remarks

The client can be initialized using a default provider (MAINNET, TESTNET, LABNET, LOCALNET and BUILDNET) or a custom set of providers.

Constructors

Methods

  • Initializes a new client using a custom set of private and public providers.

    Parameters

    • providers: IProvider[]

      Array of providers to be used by the client.

    • chainId: bigint

      Chain id matching the network used by the provider

    • retryStrategyOn: boolean = true

      Whether to retry failed requests.

    • Optional baseAccount: IAccount

      Base account to be used by the client (optional).

    Returns Promise<Client>

    A promise that resolves to a Client object.

    Remarks

    Suitable for local node interactions.

  • Creates a default client using a default provider (MAINNET, TESTNET, LABNET, LOCALNET and BUILDNET).

    Parameters

    • provider: DefaultProviderUrls

      Default provider to be used by the client.

    • chainId: bigint

      Chain id matching the network used by the provider

    • retryStrategyOn: boolean = true

      Whether to retry failed requests.

    • Optional baseAccount: IAccount

      Base account to use with the client (optional).

    Returns Promise<Client>

    A promise that resolves to a Client object.

  • Initializes a new client using the wallet provider.

    Parameters

    • provider: IProvider

      Provider from wallet provider to be used by the client.

    • baseAccount: IAccount

      Base account from the wallet provider to be used by the client.

    • retryStrategyOn: boolean = true

      Whether to retry failed requests.

    Returns Promise<Client>

    A promise that resolves to a Client object.

    Remarks

    Suitable for local node interactions.

Generated using TypeDoc