Version: 0.14.1

Cnd

Facilitates access to the [COMIT network daemon (cnd)](@link https://github.com/comit-network/comit-rs) REST API.

Hierarchy

  • Cnd

Index

Constructors

Methods

Constructors

constructor

+ new Cnd(cndUrl: string): Cnd

Defined in src/cnd/cnd.ts:328

Parameters:

NameType
cndUrlstring

Returns: Cnd

Methods

createHalightLightningBitcoinHanEthereumEther

createHalightLightningBitcoinHanEthereumEther(body: HalightLightningBitcoinHanEthereumEtherRequestBody): Promise‹string›

Defined in src/cnd/cnd.ts:461

Post a swap request on the lightning REST API route of cnd /swaps/halight/lightning/bitcoin/han/ethereum/ether

Parameters:

NameTypeDescription
bodyHalightLightningBitcoinHanEthereumEtherRequestBodyThe body to set in the request. The design being not yet finalised it is optional and of type any

Returns: Promise‹string›

The location of the swap (href) as returned by the REST API in the location header.


createHalightLightningBitcoinHerc20EthereumErc20

createHalightLightningBitcoinHerc20EthereumErc20(body: HalightLightningBitcoinHerc20EthereumErc20RequestBody): Promise‹string›

Defined in src/cnd/cnd.ts:477

Post a swap request on the lightning REST API route of cnd /swaps/halight/lightning/bitcoin/herc20/ethereum/erc20

Parameters:

NameTypeDescription
bodyHalightLightningBitcoinHerc20EthereumErc20RequestBodyThe body to set in the request. The design being not yet finalised it is optional and of type any

Returns: Promise‹string›

The location of the swap (href) as returned by the REST API in the location header.


createHanEthereumEtherHalightLightningBitcoin

createHanEthereumEtherHalightLightningBitcoin(body: HanEthereumEtherHalightLightningBitcoinRequestBody): Promise‹string›

Defined in src/cnd/cnd.ts:429

Post a swap request on the lightning REST API route of cnd /swaps/han/ethereum/ether/halight/lightning/bitcoin

Parameters:

NameTypeDescription
bodyHanEthereumEtherHalightLightningBitcoinRequestBodyThe body to set in the request. The design being not yet finalised it is optional and of type any

Returns: Promise‹string›

The location of the swap (href) as returned by the REST API in the location header.


createHerc20EthereumErc20HalightLightningBitcoin

createHerc20EthereumErc20HalightLightningBitcoin(body: Herc20EthereumErc20HalightLightningBitcoinRequestBody): Promise‹string›

Defined in src/cnd/cnd.ts:445

Post a swap request on the lightning REST API route of cnd /swaps/herc20/ethereum/erc20/halight/lightning/bitcoin

Parameters:

NameTypeDescription
bodyHerc20EthereumErc20HalightLightningBitcoinRequestBodyThe body to set in the request. The design being not yet finalised it is optional and of type any

Returns: Promise‹string›

The location of the swap (href) as returned by the REST API in the location header.


executeSirenAction

executeSirenAction(action: Action, resolver?: FieldValueResolverFn): Promise‹AxiosResponse›

Defined in src/cnd/cnd.ts:415

Proceed with an action request on the cnd REST API.

throws A Problem from the cnd REST API, or WalletError if the blockchain wallet throws, or an Error.

Parameters:

NameTypeDescription
actionActionThe action to perform.
resolver?FieldValueResolverFnA function that returns data needed to perform the action, this data is likely to be provided by a blockchain wallet or interface (e.g. wallet address).

Returns: Promise‹AxiosResponse›


fetch

fetch<T>(path: string): AxiosPromise‹T›

Defined in src/cnd/cnd.ts:403

Fetch data from the REST API.

throws A Problem from the cnd REST API or an Error.

Type parameters:

T

Parameters:

NameTypeDescription
pathstringThe URL to GET.

Returns: AxiosPromise‹T›

The data returned by cnd.


getPeerId

getPeerId(): Promise‹string›

Defined in src/cnd/cnd.ts:346

Get the peer id of the cnd node

throws A Problem from the cnd REST API or an Error.

Returns: Promise‹string›

Promise that resolves with the peer id of the cnd node,


getPeerListenAddresses

getPeerListenAddresses(): Promise‹string[]›

Defined in src/cnd/cnd.ts:361

Get the address on which cnd is listening for peer-to-peer/COMIT messages.

throws A Problem from the cnd REST API or an Error.

Returns: Promise‹string[]›

An array of multiaddresses


getSwaps

getSwaps(): Promise‹SwapSubEntity[]›

Defined in src/cnd/cnd.ts:389

List the swaps handled by this cnd instance.

throws A Problem from the cnd REST API or an Error.

Returns: Promise‹SwapSubEntity[]›

An Array of SwapSubEntity, which contains details of the swaps.


postSwap

postSwap(swap: SwapRequest): Promise‹string›

Defined in src/cnd/cnd.ts:377

Sends a swap request to cnd.

throws A Problem from the cnd REST API or an Error.

Parameters:

NameTypeDescription
swapSwapRequestThe details of the swap to initiate.

Returns: Promise‹string›

The URL of the swap request on the cnd REST API.