@moralisweb3/sol-utils
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -31,3 +31,3 @@ import { MoralisData, MoralisDataFormatted } from '@moralisweb3/core'; | ||
* Currently returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.format(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -43,3 +43,3 @@ format(): MoralisDataFormatted; | ||
* @returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.toString(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -49,3 +49,3 @@ toString(): string; | ||
* @returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.toJSON(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -52,0 +52,0 @@ toJSON(): string; |
@@ -38,3 +38,3 @@ "use strict"; | ||
* Currently returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.format(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -55,3 +55,3 @@ SolAddress.prototype.format = function () { | ||
* @returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.toString(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -63,3 +63,3 @@ SolAddress.prototype.toString = function () { | ||
* @returns a string representing the address. | ||
* @example "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
* @example address.toJSON(); // "9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM" | ||
*/ | ||
@@ -66,0 +66,0 @@ SolAddress.prototype.toJSON = function () { |
import { MoralisData, MoralisDataFormatted } from '@moralisweb3/core'; | ||
declare const solNetworkNames: readonly ["mainnet", "devnet"]; | ||
/** | ||
* A name of Solana network. | ||
* | ||
* @example "mainnet" | ||
* @example "devnet" | ||
*/ | ||
export declare type SolNetworkName = typeof solNetworkNames[number]; | ||
/** | ||
* A name of Solana network. | ||
* | ||
* @example "mainnet" | ||
* @example "devnet" | ||
*/ | ||
export declare type SolNetworkNameish = SolNetworkName | string; | ||
/** | ||
* Valid input for a new SolNetwork instance. | ||
* This can be an existing SolNetwork or a valid network name. | ||
* | ||
* @example "mainnet" | ||
* @example "devnet" | ||
* @example SolNetwork.create("mainnet") | ||
*/ | ||
export declare type SolNetworkish = SolNetwork | SolNetworkNameish; | ||
/** | ||
* A representation of a Solana network. | ||
* | ||
* @category DataType | ||
*/ | ||
export declare class SolNetwork implements MoralisData { | ||
readonly network: SolNetworkName; | ||
/** | ||
* 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. | ||
*/ | ||
static create(network: SolNetworkish): SolNetwork; | ||
private static parse; | ||
private constructor(); | ||
/** | ||
* Formats the network to a specific format. | ||
* Currently returns a string representing the network. | ||
* @example network.format(); // "mainnet" | ||
*/ | ||
format(): MoralisDataFormatted; | ||
equals(network: SolNetwork): boolean; | ||
/** | ||
* Checks the equality of the current network with another Solana network. | ||
* @example `network.equals("mainnet")` | ||
* @example `network.equals(SolNetwork.create("mainnet"))` | ||
*/ | ||
equals(network: SolNetworkish): boolean; | ||
/** | ||
* @returns a string representing the network. | ||
* @example network.toJSON(); // "mainnet" | ||
*/ | ||
toJSON(): string; | ||
/** | ||
* @returns a string representing the network. | ||
* @example network.toString(); // "mainnet" | ||
*/ | ||
toString(): string; | ||
@@ -15,0 +64,0 @@ } |
@@ -6,2 +6,7 @@ "use strict"; | ||
var solNetworkNames = ['mainnet', 'devnet']; | ||
/** | ||
* A representation of a Solana network. | ||
* | ||
* @category DataType | ||
*/ | ||
var SolNetwork = /** @class */ (function () { | ||
@@ -11,2 +16,8 @@ function SolNetwork(network) { | ||
} | ||
/** | ||
* 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. | ||
*/ | ||
SolNetwork.create = function (network) { | ||
@@ -26,2 +37,7 @@ return network instanceof SolNetwork ? network : new SolNetwork(SolNetwork.parse(network)); | ||
}; | ||
/** | ||
* Formats the network to a specific format. | ||
* Currently returns a string representing the network. | ||
* @example network.format(); // "mainnet" | ||
*/ | ||
SolNetwork.prototype.format = function () { | ||
@@ -31,8 +47,21 @@ // TODO: add `format` argument | ||
}; | ||
/** | ||
* Checks the equality of the current network with another Solana network. | ||
* @example `network.equals("mainnet")` | ||
* @example `network.equals(SolNetwork.create("mainnet"))` | ||
*/ | ||
SolNetwork.prototype.equals = function (network) { | ||
return this.network === network.network; | ||
return this.network === SolNetwork.create(network).network; | ||
}; | ||
/** | ||
* @returns a string representing the network. | ||
* @example network.toJSON(); // "mainnet" | ||
*/ | ||
SolNetwork.prototype.toJSON = function () { | ||
return this.network; | ||
}; | ||
/** | ||
* @returns a string representing the network. | ||
* @example network.toString(); // "mainnet" | ||
*/ | ||
SolNetwork.prototype.toString = function () { | ||
@@ -39,0 +68,0 @@ return this.network; |
{ | ||
"name": "@moralisweb3/sol-utils", | ||
"author": "Moralis", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"license": "MIT", | ||
@@ -28,5 +28,5 @@ "private": false, | ||
"dependencies": { | ||
"@moralisweb3/core": "^2.1.0", | ||
"@moralisweb3/core": "^2.1.1", | ||
"@solana/web3.js": "^1.53.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27222
480
Updated@moralisweb3/core@^2.1.1