Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit 89591fb

Browse files
author
Franck Royer
committed
fix: Swap is already ongoing when trying to retrieve it
Before it was `new` as it was yet to be accepted but now there is an auto-accept as part of the negotiation protocol.
1 parent 89d0d52 commit 89591fb

File tree

1 file changed

+4
-4
lines changed
  • new_project/examples/separate_apps/src

1 file changed

+4
-4
lines changed

new_project/examples/separate_apps/src/maker.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ function createOrder(): Order {
4949
console.log("[Maker] peer id:", peerId);
5050
console.log("[Maker] address hint:", addressHint);
5151

52-
const tryParams: TryParams = { maxTimeoutSecs: 100, tryIntervalSecs: 1 };
53-
5452
// start negotiation protocol handler so that a taker can take the order and receives the latest rate
5553

5654
const makerNegotiator = new MakerNegotiator(
@@ -68,7 +66,7 @@ function createOrder(): Order {
6866
ethereum: { network: "regtest" },
6967
},
7068
},
71-
tryParams
69+
{ maxTimeoutSecs: 1000, tryIntervalSecs: 0.1 }
7270
);
7371

7472
const makerHttpApi = new MakerHttpApi(makerNegotiator);
@@ -83,7 +81,7 @@ function createOrder(): Order {
8381
let swapHandle;
8482
while (!swapHandle) {
8583
await new Promise(r => setTimeout(r, 1000));
86-
swapHandle = await maker.comitClient.getNewSwaps().then(swaps => {
84+
swapHandle = await maker.comitClient.getOngoingSwaps().then(swaps => {
8785
if (swaps) {
8886
return swaps[0];
8987
} else {
@@ -104,6 +102,8 @@ function createOrder(): Order {
104102

105103
readLineSync.question("2. Continue?");
106104

105+
const tryParams: TryParams = { maxTimeoutSecs: 100, tryIntervalSecs: 1 };
106+
107107
console.log(
108108
"Bitcoin HTLC funded! TXID: ",
109109
await swapHandle.fund(tryParams)

0 commit comments

Comments
 (0)