[bisq-network/bisq] API BSQ swap simulation script and doc updates #5 (PR #5876)
Christoph Atteneder
notifications at github.com
Fri Dec 3 15:08:02 CET 2021
@ripcurlx requested changes on this pull request.
NACK
Hi @ghubstan! I walked through the documentation as an API consumer and tested following API endpoints. You find the complete walkthrough with outputs below. Great work so far! Besides the `getoffer` problem, just a couple of minor things that needs to be fixed from a consumer perspective. I'll do the code review after those parts are fixed. Thanks!
Summary
- `createoffer` (documentation is wrong) :heavy_check_mark:
- `getoffers` :white_check_mark:
- `getmyoffers` :white_check_mark:
- `getoffer` (not working for BSQ swap) :x:
- `editoffer` (error message could be improved) :heavy_check_mark:
- `canceloffer` :white_check_mark:
- `gettrade` :white_check_mark:
- `takeoffer`:white_check_mark:
I've tested as a API consumer `getoffers` and `getmyoffers` which work as expected.
When testing the example form the docs to create a BSQ offer:
```
./bisq-cli --password=xyz --port=9998 createoffer \
--swap=true \
--direction=BUY \
--amount=0.5 \
--fixed-price=0.00005
```
it fails with `Error: no currency code specified`
```
./bisq-cli --password=xyz --port=9998 createoffer \
--currency-code=BSQ \
--swap=true \
--direction=BUY \
--amount=0.5 \
--fixed-price=0.00005
```
works just fine resulting in following output:
```
Enabled Buy/Sell Price in BTC for 1 BSQ BTC(min - max) BSQ(min - max) Payment Method Creation Date (UTC) ID
PENDING Sell BSQ (Buy BTC) 0.00005000 0.50000000 10,000.00 BSQ Swap 2021-12-03T13:33:02Z 1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175
```
After a couple of seconds I tried to request the offer with:
```
./bisq-cli --password=xyz getoffer --offer-id=1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175
```
which failed with
```
Error: offer with id '1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175' not found
```
Requesting all offers with:
```
./bisq-cli --password=xyz getmyoffers --direction=BUY --currency-code=BSQ
```
did succeed.
```
Enabled Buy/Sell Price in BTC for 1 BSQ BTC(min - max) BSQ(min - max) Payment Method Creation Date (UTC) ID
YES Sell BSQ (Buy BTC) 0.00005000 0.50000000 10,000.00 BSQ Swap 2021-12-03T13:33:02Z 1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175
YES Sell BSQ (Buy BTC) 0.00004000 0.01000000 250.00 Altcoins 2021-12-03T13:25:55Z mHRQoPHK-1ece3745-d94a-45e8-bd5c-6ba81bf9363b-175
YES Sell BSQ (Buy BTC) 0.00003900 0.01200000 307.69 BSQ Swap 2021-12-03T13:26:14Z RQAVAU8-430bbe62-b286-4277-8bd4-8c1c1db15fbe-175
```
Testing editing of a BSQ offer with:
```
./bisq-cli --password=xyz editoffer --offer-id=1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175 --fixed-price=0.00004000 --enable=false
```
Fails with
```
Error: cannot edit swap bsq offers
```
Which is fine as editing of BSQ offers (Should be `BSQ` instead of `bsq` IMO) isn't necessary as you can remove and create them without paying trading or mining fees. Still I think it would be good to hint the user in the error message why and what to do instead.
So I tried to cancel and create the offer instead:
```
./bisq-cli --password=xyz canceloffer --offer-id=1376837-1edf81cf-49bb-4a88-97cd-143bcf850025-175
offer canceled and removed from offer book
./bisq-cli --password=xyz createoffer \
--currency-code=BSQ \
--swap=true \
--direction=BUY \
--amount=0.5 \
--fixed-price=0.000065
Enabled Buy/Sell Price in BTC for 1 BSQ BTC(min - max) BSQ(min - max) Payment Method Creation Date (UTC) ID
PENDING Sell BSQ (Buy BTC) 0.00006500 0.50000000 7,692.31 BSQ Swap 2021-12-03T13:49:23Z 14286-a32584e1-1591-4804-bcb5-acb342d17e6c-175
```
which worked just fine.
Now I took the offer with a non-API client. Checking the state with `getmyoffers`.
```
./bisq-cli --password=xyz getmyoffers --direction=BUY --currency-code=BSQ
Enabled Buy/Sell Price in BTC for 1 BSQ BTC(min - max) BSQ(min - max) Payment Method Creation Date (UTC) ID
YES Sell BSQ (Buy BTC) 0.00004000 0.01000000 250.00 Altcoins 2021-12-03T13:25:55Z mHRQoPHK-1ece3745-d94a-45e8-bd5c-6ba81bf9363b-175
YES Sell BSQ (Buy BTC) 0.00003900 0.01200000 307.69 BSQ Swap 2021-12-03T13:26:14Z RQAVAU8-430bbe62-b286-4277-8bd4-8c1c1db15fbe-175
```
As expected the offer is gone and can be found as an active trade:
```
./bisq-cli --password=xyz gettrade --trade-id=14286-a32584e1-1591-4804-bcb5-acb342d17e6c-175
ID My BSQ Swap Role Price in BTC for 1 BSQ Amount(BSQ) Tx Fee (BTC) Maker Fee(BSQ) Buyer Cost(BTC) Status Tx ID Confirmations
14286 BSQ seller as maker 0.00006500 7,692.31 0.00000000 0.25 0.50000000 COMPLETED 361e973033e7852e9347d5eff108da58d461a89e56015170865214f15ddcdcda 0
```
After the first block confirmation it looks like:
```
./bisq-cli --password=xyz gettrade --trade-id=14286-a32584e1-1591-4804-bcb5-acb342d17e6c-175
ID My BSQ Swap Role Price in BTC for 1 BSQ Amount(BSQ) Tx Fee (BTC) Maker Fee(BSQ) Buyer Cost(BTC) Status Tx ID Confirmations
14286 BSQ seller as maker 0.00006500 7,692.31 0.00000000 0.25 0.50000000 COMPLETED 361e973033e7852e9347d5eff108da58d461a89e56015170865214f15ddcdcda 1
```
Next I tried to take a BSQ swap offer of a non-API client.
```
./bisq-cli --password=xyz getoffers --direction=BUY --currency-code=BSQ
Buy/Sell Price in BTC for 1 BSQ BTC(min - max) BSQ(min - max) Payment Method Creation Date (UTC) ID
Sell BSQ (Buy BTC) 0.00004000 0.10000000 2,500.00 BSQ Swap 2021-11-24T09:57:35Z 87384764-a4842168-b7a7-4a95-8a0f-34982108b58d-180
Sell BSQ (Buy BTC) 0.00004000 0.00100000 25.00 Altcoins 2021-11-25T10:30:41Z tuvkkg-319f04dc-1b17-4e72-8a71-e30cb536bce9-180
./bisq-cli --password=xyz --port=9998 takeoffer --offer-id=87384764-a4842168-b7a7-4a95-8a0f-34982108b58d-180
trade 87384764-a4842168-b7a7-4a95-8a0f-34982108b58d-180 successfully taken
./bisq-cli --password=xyz gettrade --trade-id=87384764-a4842168-b7a7-4a95-8a0f-34982108b58d-180
ID My BSQ Swap Role Price in BTC for 1 BSQ Amount(BSQ) Tx Fee (BTC) Taker Fee(BSQ) Buyer Cost(BTC) Status Tx ID Confirmations
87384764 BSQ buyer as taker 0.00004000 2,500.00 0.00001320 0.30 0.10000000 COMPLETED fd4495141dfb9eb614e98ddb18081edbafafd474f31f9603d6d760ce440cc60b 0
./bisq-cli --password=xyz gettrade --trade-id=87384764-a4842168-b7a7-4a95-8a0f-34982108b58d-180
ID My BSQ Swap Role Price in BTC for 1 BSQ Amount(BSQ) Tx Fee (BTC) Taker Fee(BSQ) Buyer Cost(BTC) Status Tx ID Confirmations
87384764 BSQ buyer as taker 0.00004000 2,500.00 0.00001320 0.30 0.10000000 COMPLETED fd4495141dfb9eb614e98ddb18081edbafafd474f31f9603d6d760ce440cc60b 1
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/5876#pullrequestreview-822692137
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20211203/b65257ae/attachment-0001.htm>
More information about the bisq-github
mailing list