BitsharesHTLC

swapchain documentationBitsharesHTLC

Handler to create HTLCs on the bitshares blockchain using a specified node.

Hierarchy

  • BitsharesHTLC

Index

Constructors

Properties

Methods

Constructors

constructor

+ new BitsharesHTLC(node: string, senderID: string, receiverID: string): BitsharesHTLC

Defined in pkg/bitshares/htlc/btsHTLC.ts:56

Creates an instance of BitsharesHTLC.

memberof BitsharesHTLC

Parameters:

NameTypeDescription
nodestringThe Bitshares node you want to connect to.
senderIDstringThe account that is creating the transaction.
receiverIDstringThe receiving account.

Returns: BitsharesHTLC

Properties

Private node

node: string

Defined in pkg/bitshares/htlc/btsHTLC.ts:54


Private receiverID

receiverID: string

Defined in pkg/bitshares/htlc/btsHTLC.ts:56


Private senderID

senderID: string

Defined in pkg/bitshares/htlc/btsHTLC.ts:55

Methods

Private create

create(config: HTLCConfig): Promise‹boolean›

Defined in pkg/bitshares/htlc/btsHTLC.ts:79

Create and send the actual HTLC.

memberof BitsharesHTLC

Parameters:

NameTypeDescription
configHTLCConfigConfiguration object for the HTLC.

Returns: Promise‹boolean›

Success status. Can be used for user feedback.


Private redeem

redeem(amount: number, privateKey: string, secret: Secret): Promise‹boolean›

Defined in pkg/bitshares/htlc/btsHTLC.ts:117

Redeem the actual HTLC.

Never call this function directly but use redeem() instead. That's because the websocket must be open before redeeming an HTLC.

memberof BitsharesHTLC

Parameters:

NameTypeDescription
amountnumberThe amount of assets of the HTLC.
privateKeystringPrivate key of the redeemer in WIF format.
secretSecretA secret object with the correct preimage.

Returns: Promise‹boolean›

Success status. Can be used for user feedback.