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

Fix API CLI's '--payment-account-id' opt name, document 'createcryptopaymentacct' (#8) #5939

Merged
merged 5 commits into from
Jan 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 45 additions & 8 deletions apitest/docs/api-beta-test-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ To remove a custom withdrawal transaction fee rate preference, and revert to the
$ ./bisq-cli --password=xyz unsettxfeerate
```

### Creating Test Payment Accounts
### Creating Test Fiat Payment Accounts

Creating a payment account using the Api involves three steps:
Creating a fiat payment account using the Api involves three steps:

1. Find the payment-method-id for the payment account type you wish to create. For example, if you want to
create a face-to-face type payment account, find the face-to-face payment-method-id (`F2F`):
Expand Down Expand Up @@ -329,6 +329,43 @@ Creating a payment account using the Api involves three steps:
$ ./bisq-cli --password=xyz --port=9998 getpaymentaccts
```

### Creating Test Altcoin Payment Accounts

Unlike more complex fiat payment account setups, the `createcryptopaymentacct` command does not require a json form.

#### BSQ Altcoin Payment Accounts

A default BSQ Swap Altcoin payment account was created for you when the BSQ Swap protocol was introduced, and you do
not need to create BSQ Altcoin payment accounts to execute BSQ Swaps. But if you do want to trade BSQ using the
version 1 trade protocol, you will need to create a BSQ Altcoin payment accounts as show below.
```
$ ./bisq-cli --password=xyz --port=9998 createcryptopaymentacct --account-name="My BSQ Account" \
--currency-code=BSQ \
--address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne \
--trade-instant=false
```
To create a BSQ Altcoin _Instant_ payment account, use the `--trade-instant=true` parameter:
```
$ ./bisq-cli --password=xyz --port=9998 createcryptopaymentacct --account-name="My Instant BSQ Account" \
--currency-code=BSQ \
--address=Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne \
--trade-instant=true
```

_Note: Use your own BSQ recipient address, not the `Bn3PCQgRwhkrGnaMp1RYwt9tFwL51YELqne` address used in the
example above._

#### XMR Altcoin Payment Accounts

To create an XMR Altcoin payment account associated with example XMR address
`44G4jWmSvTEfifSUZzTDnJVLPvYATmq9XhhtDqUof1BGCLceG82EQsVYG9Q9GN4bJcjbAJEc1JD1m5G7iK4UPZqACubV4Mq`:
```
$ ./bisq-cli --password=xyz --port=9999 createcryptopaymentacct --account-name=XMR-Account \
--currency-code=XMR
--address=44G4jWmSvTEfifSUZzTDnJVLPvYATmq9XhhtDqUof1BGCLceG82EQsVYG9Q9GN4bJcjbAJEc1JD1m5G7iK4UPZqACubV4Mq
```


### Creating Offers

The createoffer command is the Api's most complex command (so far), but CLI posix-style options are self-explanatory,
Expand All @@ -345,7 +382,7 @@ and pay the Bisq maker fee in BSQ. Alice had already created an EUR face-to-fac
`f3c1ec8b-9761-458d-b13d-9039c6892413`, and used this `createoffer` command:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--direction=BUY \
--currency-code=EUR \
--amount=0.125 \
Expand All @@ -358,7 +395,7 @@ If Alice was in Japan, and wanted to create an offer to sell 0.125 BTC at 0.5% a
putting up a 15% security deposit, the `createoffer` command to do that would be:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--direction=SELL \
--currency-code=JPY \
--amount=0.125 \
Expand Down Expand Up @@ -399,7 +436,7 @@ $ ./bisq-cli --password=xyz --port=9998 getmyoffers --direction=<BUY|SELL> --cur

To look at a specific offer you created:
```
$ ./bisq-cli --password=xyz --port=9998 getmyoffer --offer-id=<offer-id>
$ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id=<offer-id>
```

### Browsing Available Offers
Expand Down Expand Up @@ -466,7 +503,7 @@ and vice-versa.
Suppose you used `createoffer` to create a market price margin based offer as follows:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--direction=SELL \
--currency-code=JPY \
--amount=0.125 \
Expand All @@ -485,7 +522,7 @@ To change the market price margin based offer to a fixed price offer:
Suppose you used `createoffer` to create a fixed price offer as follows:
```
$ ./bisq-cli --password=xyz --port=9998 createoffer \
--payment-account=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--payment-account-id=f3c1ec8b-9761-458d-b13d-9039c6892413 \
--direction=SELL \
--currency-code=JPY \
--amount=0.125 \
Expand Down Expand Up @@ -551,7 +588,7 @@ with the `takeoffer` command:
```
$ ./bisq-cli --password=xyz --port=9998 takeoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
--payment-account=fe20cdbd-22be-4b8a-a4b6-d2608ff09d6e \
--payment-account-id=fe20cdbd-22be-4b8a-a4b6-d2608ff09d6e \
--fee-currency=btc
```
Depending on the offer type, the taken offer will be used to (1) create a trade contract, or (2) execute a BSQ swap.
Expand Down
2 changes: 1 addition & 1 deletion apitest/scripts/bsqswap-simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ sleeptraced 2

# Show Alice's new bsq swap offer.
printdate "Alice looking at her new $DIRECTION $CURRENCY_CODE offer."
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
printdate "ALICE CLI: $CMD"
OFFER=$($CMD)
exitoncommandalert $?
Expand Down
2 changes: 1 addition & 1 deletion apitest/scripts/limit-order-simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ sleeptraced 3

# Show Alice's new offer.
printdate "ALICE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
printdate "ALICE CLI: $CMD"
OFFER=$($CMD)
exitoncommandalert $?
Expand Down
2 changes: 1 addition & 1 deletion apitest/scripts/rolling-offer-simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ while : ; do

# Show Alice's new offer.
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
printdate "ALICE CLI: $CMD"
OFFER=$($CMD)
exitoncommandalert $?
Expand Down
2 changes: 1 addition & 1 deletion apitest/scripts/trade-simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ sleeptraced 3

# Show Alice's new offer.
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
printdate "ALICE CLI: $CMD"
OFFER=$($CMD)
exitoncommandalert $?
Expand Down
2 changes: 1 addition & 1 deletion apitest/scripts/trade-xmr-simulation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ sleeptraced 3

# Show Alice's new offer.
printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer."
CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID"
CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID"
printdate "ALICE CLI: $CMD"
OFFER=$($CMD)
exitoncommandalert $?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void testGetMyBsqSwapOffer(OfferInfo bsqSwapOffer) {
while (true) {
try {
numFetchAttempts++;
var fetchedBsqSwapOffer = aliceClient.getMyOffer(bsqSwapOffer.getId());
var fetchedBsqSwapOffer = aliceClient.getOffer(bsqSwapOffer.getId());
assertEquals(bsqSwapOffer.getId(), fetchedBsqSwapOffer.getId());
log.debug("Alice found her (my) new bsq swap offer on attempt # {}.", numFetchAttempts);
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void testCreateBuy1BTCFor20KBSQOffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -132,7 +132,7 @@ public void testCreateSell1BTCFor20KBSQOffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testCreateBuyBTCWith1To2KBSQOffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -226,7 +226,7 @@ public void testCreateSellBTCFor5To10KBSQOffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void testCreateAUDBTCBuyOfferUsingFixedPrice16000() {
assertEquals("AUD", newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -120,7 +120,7 @@ public void testCreateUSDBTCBuyOfferUsingFixedPrice100001234() {
assertEquals(USD, newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -165,7 +165,7 @@ public void testCreateEURBTCSellOfferUsingFixedPrice95001234() {
assertEquals(EUR, newOffer.getCounterCurrencyCode());
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void testCreateUSDBTCBuyOffer5PctPriceMargin() {
assertEquals(USD, newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -143,7 +143,7 @@ public void testCreateNZDBTCBuyOfferMinus2PctPriceMargin() {
assertEquals("NZD", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -190,7 +190,7 @@ public void testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin() {
assertEquals("GBP", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -237,7 +237,7 @@ public void testCreateBRLBTCSellOffer6Point55PctPriceMargin() {
assertEquals("BRL", newOffer.getCounterCurrencyCode());
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -276,7 +276,7 @@ public void testCreateUSDBTCBuyOfferWithTriggerPrice() {
assertTrue(newOffer.getIsMyPendingOffer());

genBtcBlocksThenWait(1, 4000); // give time to add to offer book
newOffer = aliceClient.getMyOffer(newOffer.getId());
newOffer = aliceClient.getOffer(newOffer.getId());
log.debug("OFFER #5:\n{}", toOfferTable.apply(newOffer));
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void testCreateFixedPriceBuy1BTCFor200KXMROffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -135,7 +135,7 @@ public void testCreateFixedPriceSell1BTCFor200KXMROffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down Expand Up @@ -188,7 +188,7 @@ public void testCreatePriceMarginBasedBuy1BTCOfferWithTriggerPrice() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
log.debug("Available Sell XMR (Buy BTC) offer:\n{}", toOfferTable.apply(newOffer));
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
Expand Down Expand Up @@ -240,7 +240,7 @@ public void testCreatePriceMarginBasedSell1BTCOffer() {

genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
newOffer = aliceClient.getOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
Expand Down
Loading