Class: SolNetwork
moralis-monorepo / @moralisweb3/common-sol-utils / SolNetwork
Class: SolNetwork
@moralisweb3/common-sol-utils.SolNetwork
A representation of a Solana network.
Implements
MoralisData
Table of contents
Accessors
Methods
Properties
Accessors
DEVNET
• Static get DEVNET(): SolNetwork
Returns DEVNET network
Example
SolNetwork.MAINNET
Returns
MAINNET
• Static get MAINNET(): SolNetwork
Returns MAINNET network
Example
SolNetwork.MAINNET
Returns
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
| Name | Type |
|---|---|
network | SolNetworkInput |
Returns
fromJSON
▸ Static fromJSON(network): SolNetwork
Parameters
| Name | Type |
|---|---|
network | string |
Returns
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
| Name | Type |
|---|---|
network | SolNetworkInput |
Returns
boolean
Implementation of
MoralisData.equals
format
▸ format(): MoralisDataFormatted
Deprecated
This method will be removed soon. To format the value, use one of the properties.
Returns
MoralisDataFormatted
Implementation of
MoralisData.format
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.
Properties
network
• Readonly network: "mainnet" | "devnet"