Class: CoinView

CoinView

new CoinView(coins)

A collections of Coins objects.

Parameters:
Name Type Description
coins Object

A hash-to-coins map.

Properties:
Name Type Description
coins Object
Source:

Methods

add(tx/coins)

Add a coin to the collection.

Parameters:
Name Type Description
tx/coins Coins | TX
Source:

addCoin(tx/coins)

Add a coin to the collection.

Parameters:
Name Type Description
tx/coins Coins | TX
Source:

fill(tx) → {Boolean}

Fill transaction(s) with coins.

Parameters:
Name Type Description
tx TX
Source:
Returns:

True if all inputs were filled.

Type
Boolean

get(hash, index) → {Coin}

Get a coin.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Coin

has(hash, index) → {Boolean}

Test whether the collection has a coin.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Boolean

remove(tx/coins)

Remove a collection from the view.

Parameters:
Name Type Description
tx/coins Coins | TX
Source:

spend(hash, index) → {Coin}

Remove a coin and return it.

Parameters:
Name Type Description
hash Hash
index Number
Source:
Returns:
Type
Coin

toArray() → {Array.<Coins>}

Convert collection to an array.

Source:
Returns:
Type
Array.<Coins>