Class: AptosNetwork
moralis-monorepo / @moralisweb3/common-aptos-utils / AptosNetwork
Class: AptosNetwork
@moralisweb3/common-aptos-utils.AptosNetwork
A representation of a Aptos network.
Implements
MoralisData
Table of contents
Accessors
Methods
Properties
Accessors
DEVNET
• Static get DEVNET(): AptosNetwork
Returns DEVNET network
Example
AptosNetwork.MAINNET
Returns
MAINNET
• Static get MAINNET(): AptosNetwork
Returns MAINNET network
Example
AptosNetwork.MAINNET
Returns
TESTNET
• Static get TESTNET(): AptosNetwork
Returns TESTNET network
Example
AptosNetwork.MAINNET
Returns
Methods
create
▸ Static create(network): AptosNetwork
Create a new instance of AptosNetwork from any valid network input.
Example
const network = AptosNetwork.create("mainnet")
Throws
an error when a passed network is invalid.
Parameters
| Name | Type |
|---|---|
network | AptosNetworkInput |
Returns
equals
▸ equals(network): boolean
Checks the equality of the current network with another Aptos network.
Example
network.equals("mainnet")
Example
network.equals(AptosNetwork.create("mainnet"))
Parameters
| Name | Type |
|---|---|
network | AptosNetworkInput |
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" | "testnet" | "devnet"