BitcoinAPI

swapchain documentationBitcoinAPI

This interface defines the data required for the HTLC creation on the bitcoin blockchain. You are welcome to implement this yourself and pass it to the HTLC class.

The return objects are explicitly stated here as these are the only values we require. Anything else returned from your api of choice can be ignored.

interface BitcoinAPI

Hierarchy

  • BitcoinAPI

Implemented by

Index

Properties

Properties

getBlockHeight

getBlockHeight: function

Defined in pkg/types/bitcoinApi.ts:67

Return the blockheight of a transaction.

param ID of any bitcoin transaction.

returns Blockheight or undefined if block is not mined/broadcasted yet.

Type declaration:

▸ (transactionID: string): Promise‹number | undefined›

Parameters:

NameType
transactionIDstring

getFeeEstimates

getFeeEstimates: function

Defined in pkg/types/bitcoinApi.ts:75

Get fee estimates

returns Array with fee estimates for high, mid and low priority in satoshis/vbyte. If fee estimates are too close, it returns only one or two values.

memberof BlockStream

Type declaration:

▸ (): Promise‹number[]›


getLastBlock

getLastBlock: function

Defined in pkg/types/bitcoinApi.ts:22

Return height and timestamp of the last block. Used for timelock calculations.

Type declaration:

▸ (): Promise‹object›


getOutput

getOutput: function

Defined in pkg/types/bitcoinApi.ts:59

Return the vout and value of the transaction.

param ID of any bitcoin transaction.

param The address to look for.

returns vout and value

Type declaration:

▸ (transactionID: string, address: string): Promise‹object›

Parameters:

NameType
transactionIDstring
addressstring

getPreimageFromLastTransaction

getPreimageFromLastTransaction: function

Defined in pkg/types/bitcoinApi.ts:43

Returns the preimage of the last incoming transaction.

param Any bitcoin address.

returns Returns the preimage of the last incoming transaction.

Type declaration:

▸ (address: string): Promise‹string›

Parameters:

NameType
addressstring

getTimestampAtHeight

getTimestampAtHeight: function

Defined in pkg/types/bitcoinApi.ts:28

Return the timestamp of a block defined by its height. Used for timelock calculations

Type declaration:

▸ (n: number): Promise‹number›

Parameters:

NameType
nnumber

getValueFromLastTransaction

getValueFromLastTransaction: function

Defined in pkg/types/bitcoinApi.ts:50

Returns the outgoing transaction of an address.

param Any bitcoin address.

returns Amount of the transaction and its ID.

Type declaration:

▸ (address: string): Promise‹object›

Parameters:

NameType
addressstring

pushTX

pushTX: function

Defined in pkg/types/bitcoinApi.ts:35

Pushes a transaction hex to the blockchain. Returns the transactionID on success. Throws on failure

Type declaration:

▸ (transactionHex: string): Promise‹string›

Parameters:

NameType
transactionHexstring