Cnd
Facilitates access to the [COMIT network daemon (cnd)](@link https://github.com/comit-network/comit-rs) REST API.
Hierarchy
- Cnd
Index
Constructors
Methods
- createHalightLightningBitcoinHanEthereumEther
- createHalightLightningBitcoinHerc20EthereumErc20
- createHanEthereumEtherHalightLightningBitcoin
- createHerc20EthereumErc20HalightLightningBitcoin
- executeSirenAction
- fetch
- getPeerId
- getPeerListenAddresses
- getSwaps
- postSwap
Constructors
constructor
+ new Cnd(cndUrl
: string): Cnd
Defined in src/cnd/cnd.ts:328
Parameters:
Name | Type |
---|---|
cndUrl | string |
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:
Name | Type | Description |
---|---|---|
body | HalightLightningBitcoinHanEthereumEtherRequestBody | The 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:
Name | Type | Description |
---|---|---|
body | HalightLightningBitcoinHerc20EthereumErc20RequestBody | The 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:
Name | Type | Description |
---|---|---|
body | HanEthereumEtherHalightLightningBitcoinRequestBody | The 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:
Name | Type | Description |
---|---|---|
body | Herc20EthereumErc20HalightLightningBitcoinRequestBody | The 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:
Name | Type | Description |
---|---|---|
action | Action | The action to perform. |
resolver? | FieldValueResolverFn | A 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:
Name | Type | Description |
---|---|---|
path | string | The 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:
Name | Type | Description |
---|---|---|
swap | SwapRequest | The details of the swap to initiate. |
Returns: Promise‹string›
The URL of the swap request on the cnd REST API.