Class: Network

protocol.Network(options)

Network Represents a network.

Constructor

new Network(options)

Create a network.

Parameters:
Name Type Description
options Object
Source:

Members

(static) primary :Network

Default network.

Type:
  • Network
Source:

(static) type :String

Default network type.

Type:
  • String
Source:

Methods

(private, static) by(value, compare, networknullable, name) → {Network}

Get a network by an associated comparator.

Parameters:
Name Type Attributes Description
value Object
compare function
network NetworkType | Network <nullable>
name String
Source:
Returns:
Type
Network

(static) create(options) → {Network}

Create a network. Get existing network if possible.

Parameters:
Name Type Description
options NetworkType | Object
Source:
Returns:
Type
Network

(static) ensure(type) → {Network}

Get a network with a string or a Network object.

Parameters:
Name Type Description
type NetworkType | Network

Network type.

Source:
Returns:
Type
Network

(static) fromAddress(hrp, networkopt, nullable) → {Network}

Get a network by its bech32 address prefix.

Parameters:
Name Type Attributes Description
hrp String
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromMagic(value, networkopt, nullable) → {Network}

Get a network by its magic number.

Parameters:
Name Type Attributes Description
value Number
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromPrivate(prefix, networkopt, nullable) → {Network}

Get a network by its xprivkey prefix.

Parameters:
Name Type Attributes Description
prefix Number
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromPrivate58(prefix, networkopt, nullable) → {Network}

Get a network by its xprivkey base58 prefix.

Parameters:
Name Type Attributes Description
prefix String
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromPublic(prefix, networkopt, nullable) → {Network}

Get a network by its xpubkey prefix.

Parameters:
Name Type Attributes Description
prefix Number
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromPublic58(prefix, networkopt, nullable) → {Network}

Get a network by its xpubkey base58 prefix.

Parameters:
Name Type Attributes Description
prefix String
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) fromWIF(prefix, networkopt, nullable) → {Network}

Get a network by its WIF prefix.

Parameters:
Name Type Attributes Description
prefix Number
network Network | NetworkType <optional>
<nullable>
Source:
Returns:
Type
Network

(static) get(type) → {Network}

Get a network with a string or a Network object.

Parameters:
Name Type Description
type NetworkType | Network

Network type.

Source:
Returns:
Type
Network

(static) isNetwork(obj) → {Boolean}

Test an object to see if it is a Network.

Parameters:
Name Type Description
obj Object
Source:
Returns:
Type
Boolean

(static) set(type) → {Network}

Set the default network. This network will be used if nothing is passed as the network option for certain objects.

Parameters:
Name Type Description
type NetworkType

Network type.

Source:
Returns:
Type
Network

byBit(bit) → {Object}

Get a deployment by bit index.

Parameters:
Name Type Description
bit Number
Source:
Returns:
Type
Object

init()

Get a deployment by bit index.

Source:

inspect() → {String}

Inspect the network.

Source:
Returns:
Type
String

ms() → {Number}

Get network adjusted time in milliseconds.

Source:
Returns:
Type
Number

now() → {Number}

Get network adjusted time.

Source:
Returns:
Type
Number

toString() → {String}

Convert the network to a string.

Source:
Returns:
Type
String