Class: SolNetwork

moralis-monorepo / @moralisweb3/sol-utils / SolNetwork

Class: SolNetwork

@moralisweb3/sol-utils.SolNetwork

A representation of a Solana network.

Implements

  • MoralisData

Table of contents

Methods

Methods

create

Static create(network): SolNetwork

Create a new instance of SolNetwork from any valid network input.

Example

const network = SolNetwork.create("mainnet")

Throws

an error when a passed network is invalid.

Parameters

NameType
networkSolNetworkish

Returns

SolNetwork


format

format(): MoralisDataFormatted

Formats the network to a specific format.
Currently returns a string representing the network.

Example

network.format(); // "mainnet"

Returns

MoralisDataFormatted

Implementation of

MoralisData.format


equals

equals(network): boolean

Checks the equality of the current network with another Solana network.

Example

network.equals("mainnet")

Example

network.equals(SolNetwork.create("mainnet"))

Parameters

NameType
networkSolNetworkish

Returns

boolean

Implementation of

MoralisData.equals


toJSON

toJSON(): string

Example

network.toJSON(); // "mainnet"

Returns

string

a string representing the network.


toString

toString(): string

Example

network.toString(); // "mainnet"

Returns

string

a string representing the network.


Did this page help you?