ComitClient

The ComitClient class is a one-stop shop interface for interacting with Swaps of Cnd.

It bundles all the necessary dependencies (BitcoinWallet, EthereumWallet, Cnd) to provide you with instances of Swaps.

Hierarchy

  • ComitClient

Index

Constructors

Methods

Constructors

constructor

+ new ComitClient(cnd: Cnd): ComitClient

Defined in comit_client.ts:15

Parameters:

NameType
cndCnd

Returns: ComitClient

Methods

getDoneSwaps

getDoneSwaps(): Promise‹Swap[]›

Defined in comit_client.ts:105

Returns: Promise‹Swap[]›


getNewSwaps

getNewSwaps(): Promise‹Swap[]›

Defined in comit_client.ts:82

Returns: Promise‹Swap[]›


getOngoingSwaps

getOngoingSwaps(): Promise‹Swap[]›

Defined in comit_client.ts:96

Returns: Promise‹Swap[]›


getPeerId

getPeerId(): Promise‹string›

Defined in comit_client.ts:119

Returns: Promise‹string›


getPeerListenAddresses

getPeerListenAddresses(): Promise‹string[]›

Defined in comit_client.ts:123

Returns: Promise‹string[]›


retrieveSwapById

retrieveSwapById(swapId: string): Promise‹Swap | undefined›

Defined in comit_client.ts:127

Parameters:

NameType
swapIdstring

Returns: Promise‹Swap | undefined›


sendSwap

sendSwap(swapRequest: SwapRequest): Promise‹Swap

Defined in comit_client.ts:47

Send a SwapRequest to Cnd to create a Swap.

Parameters:

NameTypeDescription
swapRequestSwapRequest

Returns: Promise‹Swap


withBitcoinWallet

withBitcoinWallet(bitcoinWallet: BitcoinWallet): ComitClient

Defined in comit_client.ts:26

Sets a BitcoinWallet in the ComitClient.

If you are planning to use this instance to handle swaps involving Bitcoin, you should set this.

Parameters:

NameTypeDescription
bitcoinWalletBitcoinWalletThe wallet that should be used to handle Bitcoin related actions of swaps.

Returns: ComitClient


withEthereumWallet

withEthereumWallet(ethereumWallet: EthereumWallet): ComitClient

Defined in comit_client.ts:38

Sets a EthereumWallet in the ComitClient.

If you are planning to use this instance to handle swaps involving Ethereum, you should set this.

Parameters:

NameTypeDescription
ethereumWalletEthereumWalletThe wallet that should be used to handle Ethereum related actions of swaps.

Returns: ComitClient