Class: SolAddress
moralis-monorepo / @moralisweb3/common-sol-utils / SolAddress
Class: SolAddress
@moralisweb3/common-sol-utils.SolAddress
A representation of an address on the Solana network.
Use this class any time you work with an address.
Implements
MoralisData
Table of contents
Methods
Properties
Constructors
Methods
create
▸ Static
create(address
): SolAddress
Create a new instance of SolAddress from any valid address input.
Example
const address = SolAddress.create("9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM")
Throws
an error when a passed address is invalid.
Parameters
Name | Type |
---|---|
address | SolAddressish |
Returns
equals
▸ equals(address
): boolean
Checks the equality of the current address with another Solana address.
Example
address.equals("9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM")
Example
address.equals(SolAddress.create("9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"))
Parameters
Name | Type |
---|---|
address | SolAddressish |
Returns
boolean
Implementation of
MoralisData.equals
format
▸ format(): MoralisDataFormatted
Formats the address to a specific format. Currently returns a string representing the address.
Example
address.format(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
Returns
MoralisDataFormatted
Implementation of
MoralisData.format
toJSON
▸ toJSON(): string
Example
address.toJSON(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
Returns
string
a string representing the address.
toString
▸ toString(): string
Example
address.toString(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM"
Returns
string
a string representing the address.
Properties
address
• Readonly
address: string
Constructors
constructor
• new SolAddress(address
)
Parameters
Name | Type |
---|---|
address | string |