Skip to main content

DummyProvider

@opcat-labs/scrypt-ts-opcat v1.0.4


@opcat-labs/scrypt-ts-opcat / DummyProvider

Class: DummyProvider

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:11

A DummyProvider is build for test purpose only, it always returns a dummy utxo for getUtxos request.

Implements​

Constructors​

new DummyProvider()​

new DummyProvider(network): DummyProvider

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:17

Parameters​

network​

SupportedNetwork = 'opcat-mainnet'

Returns​

DummyProvider

Methods​

addNewUTXO()​

addNewUTXO(utxo): void

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:63

Add a UTXO to the provider

Parameters​

utxo​

UTXO

Returns​

void

Implementation of​

UtxoProvider.addNewUTXO


broadcast()​

broadcast(txHex): Promise\<string>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:73

Send a raw transaction hex string.

Parameters​

txHex​

string

Returns​

Promise\<string>

A promise which resolves to the hash of the transaction that has been sent.

Implementation of​

ChainProvider.broadcast


getConfirmations()​

getConfirmations(_txId): Promise\<number>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:70

Query a transaction confirmation

Parameters​

_txId​

string

Returns​

Promise\<number>

Implementation of​

ChainProvider.getConfirmations


getFeeRate()​

getFeeRate(): Promise\<number>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:67

Query current network fee

Returns​

Promise\<number>

Implementation of​

ChainProvider.getFeeRate


getNetwork()​

getNetwork(): Promise\<SupportedNetwork>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:19

Get the current network the provider is connected to.

Returns​

Promise\<SupportedNetwork>

A promise which resolves to the current network identifier.

Implementation of​

ChainProvider.getNetwork


getRawTransaction()​

getRawTransaction(txId): Promise\<string>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:79

Get a transaction raw hex from the network.

Parameters​

txId​

string

Returns​

Promise\<string>

The query result with the transaction raw hex.

Implementation of​

ChainProvider.getRawTransaction


getUtxos()​

getUtxos(address, _options?): Promise\<UTXO[]>

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:22

Get a list of the UTXOs.

Parameters​

address​

string

The address of the returned UTXOs belongs to.

_options?​

UtxoQueryOptions

Returns​

Promise\<UTXO[]>

A promise which resolves to a list of UTXO for the query options.

Implementation of​

UtxoProvider.getUtxos


markSpent()​

markSpent(txId, vout): void

Defined in: packages/scrypt-ts-opcat/src/providers/dummyProvider.ts:56

Mark an outpoint as spent

Parameters​

txId​

string

vout​

number

Returns​

void

Implementation of​

UtxoProvider.markSpent