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, network, name) → {Network}

Get a network by an associated comparator.

Parameters:
Name Type Description
value Object
compare function
network Network | null
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, networknullable) → {Network}

Get a network by its bech32 address prefix.

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

(static) fromMagic(value, networknullable) → {Network}

Get a network by its magic number.

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

(static) fromPrivate(value, networknullable) → {Network}

Get a network by its xprivkey prefix.

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

(static) fromPrivate58(prefix, networknullable) → {Network}

Get a network by its xprivkey base58 prefix.

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

(static) fromPublic(value, networknullable) → {Network}

Get a network by its xpubkey prefix.

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

(static) fromPublic58(prefix, networknullable) → {Network}

Get a network by its xpubkey base58 prefix.

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

(static) fromWIF(value, networknullable) → {Network}

Get a network by its WIF prefix.

Parameters:
Name Type Attributes Description
value Number
network Network <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(bit) → {Object}

Get a deployment by bit index.

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

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