Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete API support for BSQ/BTC trade pair #5412

Merged
merged 5 commits into from
Apr 20, 2021

Conversation

ghubstan
Copy link
Member

  • Finished API server's verify bsq payment impl.

  • Added verifybsqsenttoaddress method to CLI.

  • Added verifybsqsenttoaddress-help.txt to server.

  • Fixed client getoffers, getmyoffers to work with BSQ offers.

  • Configure call rate meter for CreateCryptoCurrencyPaymentAccount.

  • Added CreateBSQOffersTest, TakeBuyBSQOfferTest, TakeSellBSQOfferTest.
    The first tests bsq offer creation, the second & third test bsq trade protocol, and includes bsq payment verification checks.

  • Made test dispute agent registration a test harness opt.
    It was a test case opt, now it happens by default.

  • Moved some global test constants into ApiTestConfig.
    Adjusted affected test cases.

The implemenation is already present in CoreWalletsService
- Finished API server's verify bsq payment impl.
- Added verifybsqsenttoaddress method to CLI.
- Added verifybsqsenttoaddress-help.txt to server.
- Fixed client getoffers, getmyoffers to work with BSQ offers.
- Added CreateBSQOffersTest, TakeBuyBSQOfferTest, TakeSellBSQOfferTest.
  The first tests bsq offer creation, the second & third test bsq trade
  protocol, and includes bsq payment verification checks.

- Made test dispute agent registration a test harness opt.
  It was a test case option, now it happens by default.

- Moved some global test constants into ApiTestConfig.
  Adjusted affected test cases.
@ghubstan ghubstan changed the title Complete API support to BSQ/BTC trade pair Complete API support for BSQ/BTC trade pair Apr 15, 2021
@ghubstan
Copy link
Member Author

Here is an example BSQ trade using the CLI.

Alice getunusedbsqaddress

./bisq-cli --password=xyz --port=9998 getunusedbsqaddress
Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne

Alice createcryptopaymentacct

./bisq-cli --password=xyz --port=9998 createcryptopaymentacct --account-name="Alice Instant BSQ Account" --currency-code=bsq --address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne --trade-instant=true
payment account saved
Name                       Currency  Payment Method        ID                                                    
Alice Instant BSQ Account  BSQ       BLOCK_CHAINS_INSTANT  aa384589-d309-4aa4-9f14-7a5722227612

Bob getunusedbsqaddress

./bisq-cli --password=xyz --port=9999 getunusedbsqaddress
BmzMJH8W4u6tvxzGDNLFdfsQsdSdnB4ERU5

Bob createcryptopaymentacct

./bisq-cli --password=xyz --port=9999 createcryptopaymentacct --account-name="Bob Instant BSQ Account" --currency-code=bsq --address=BmzMJH8W4u6tvxzGDNLFdfsQsdSdnB4ERU5 --trade-instant=true
payment account saved
Name                     Currency  Payment Method        ID                                                    
Bob Instant BSQ Account  BSQ       BLOCK_CHAINS_INSTANT  61297448-b49f-41c0-a0aa-c256148cb86b

Alice createoffer to Sell BSQ

./bisq-cli --password=xyz --port=9998 createoffer --direction=sell --currency-code=bsq \
	--amount=0.1 \
	--fixed-price=0.00005 \
	--security-deposit=25.0 \
	--fee-currency=btc \
	--payment-account=aa384589-d309-4aa4-9f14-7a5722227612
Buy/Sell            Price in BTC for 1 BSQ  BTC(min - max)   BSQ(min - max)  Payment Method    Creation Date (UTC)   ID
Buy BSQ (Sell BTC)              0.00005000      0.10000000         2,000.00  Altcoins Instant  2021-04-15T16:58:54Z  qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162

Alice getmyoffer

./bisq-cli --password=xyz --port=9998 getmyoffer --offer-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
Buy/Sell            Price in BTC for 1 BSQ  BTC(min - max)   BSQ(min - max)  Payment Method    Creation Date (UTC)   ID
Buy BSQ (Sell BTC)              0.00005000      0.10000000         2,000.00  Altcoins Instant  2021-04-15T16:58:54Z  qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162

Bob getoffers

./bisq-cli --password=xyz --port=9999 getoffers --direction=sell --currency-code=bsq
Buy/Sell            Price in BTC for 1 BSQ  BTC(min - max)   BSQ(min - max)  Payment Method    Creation Date (UTC)   ID
Buy BSQ (Sell BTC)              0.00005000      0.10000000         2,000.00  Altcoins Instant  2021-04-15T16:58:54Z  qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162

Bob takeoffer

./bisq-cli --password=xyz --port=9999 takeoffer --offer-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 --payment-account=61297448-b49f-41c0-a0aa-c256148cb86b
trade qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 successfully taken

Bob gettrade

./bisq-cli --password=xyz --port=9999 gettrade --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
ID        My Role              Price in BTC for 1 BSQ  Amount(BSQ)  Tx Fee(BTC)   Taker Fee(BTC)  Deposit Published  Deposit Confirmed  Buyer Cost(BTC)  BSQ Sent  BSQ Received  Payout Published  Withdrawn  BSQ Buyer Address
qkqUrpHp  BSQ seller as taker              0.00005000     2,000.00   0.00019928       0.00030000  YES                YES                     0.10000000  NO        NO            NO                NO         Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne

Alice gettrade

./bisq-cli --password=xyz --port=9998 gettrade --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
ID        My Role             Price in BTC for 1 BSQ  Amount(BSQ)  Tx Fee(BTC)   Maker Fee(BTC)  Deposit Published  Deposit Confirmed  Buyer Cost(BTC)  BSQ Sent  BSQ Received  Payout Published  Withdrawn  
qkqUrpHp  BSQ buyer as maker              0.00005000     2,000.00   0.00024347       0.00010000  YES                YES                     0.10000000  NO        NO            NO                NO

Bob sendbsq (payment)

./bisq-cli --password=xyz --port=9999 sendbsq --amount=2000.00  --address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne
2000.00 bsq sent to Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne in tx 9caf88399cb2182dd3b5dc0614e8f2eaf8695ebf8f02298ad41b0fb3c64e460e

Bob confirmpaymentstarted

./bisq-cli --password=xyz --port=9999 confirmpaymentstarted --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
trade qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 payment started message sent

Alice check trade 'BSQ Sent' status

./bisq-cli --password=xyz --port=9998 gettrade --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
ID        My Role             Price in BTC for 1 BSQ  Amount(BSQ)  Tx Fee(BTC)   Maker Fee(BTC)  Deposit Published  Deposit Confirmed  Buyer Cost(BTC)  BSQ Sent  BSQ Received  Payout Published  Withdrawn  
qkqUrpHp  BSQ buyer as maker              0.00005000     2,000.00   0.00024347       0.00010000  YES                YES                     0.10000000  YES       NO            NO                NO

Alice verify 2K BSQ sent to payment acct receiving address Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne

./bisq-cli --password=xyz --port=9998 verifybsqsenttoaddress --address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne --amount=2000.00
2000.00 bsq has been sent to address Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne

Alice sends confirmpaymentreceived message

./bisq-cli --password=xyz --port=9998 confirmpaymentreceived --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
trade qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 payment received message sent

Bob closes trade with keepfunds (sets trade state to CLOSED)

./bisq-cli --password=xyz --port=9999 keepfunds --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
funds from trade qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 saved in bisq wallet

Alice closes trade with keepfunds (sets trade state to CLOSED)

./bisq-cli --password=xyz --port=9998 keepfunds --trade-id=qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162
funds from trade qkqUrpHp-56daa446-99bb-4ad4-ba18-e4fe2aa775f6-162 saved in bisq wallet

Alice getbalance

./bisq-cli --password=xyz --port=9998 getbalance
BTC
Available Balance  Reserved Balance  Total Available Balance  Locked Balance  
       9.89965653        0.00000000               9.89965653      0.00000000
BSQ
Available Confirmed Balance  Unverified Balance  Unconfirmed Change Balance  Locked For Voting Balance  Lockup Bonds Balance  Unlocking Bonds Balance  
               1,002,000.00                0.00                        0.00                       0.00                  0.00                     0.00

Bob getbalance

./bisq-cli --password=xyz --port=9999 getbalance
BTC
Available Balance  Reserved Balance  Total Available Balance  Locked Balance  
      10.09879854        0.00000000              10.09879854      0.00000000
BSQ
Available Confirmed Balance  Unverified Balance  Unconfirmed Change Balance  Locked For Voting Balance  Lockup Bonds Balance  Unlocking Bonds Balance  
               1,498,000.00                0.00                        0.00                       0.00                  0.00                     0.00

Copy link
Member

@sqrrm sqrrm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@sqrrm sqrrm merged commit de8213a into bisq-network:master Apr 20, 2021
@ripcurlx ripcurlx added this to the v1.6.3 milestone Apr 20, 2021
@ghubstan ghubstan deleted the complete-api-bsqbtc-trade-support branch April 21, 2021 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants