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

Adjust API 'editoffer' to PR 5651 (include extraData field when editing offer) #5666

Merged
merged 65 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
81da6fb
Refactor EditOfferDataModel for new editoffer api method
ghubstan Jun 12, 2021
d9dd718
Fix comment
ghubstan Jun 12, 2021
1daf471
Add OfferInfo field isActivated, rpc EditOffer to proto
ghubstan Jun 13, 2021
2b8b53b
Add server/core editOffer, adjust getMyOffer(s) impls
ghubstan Jun 13, 2021
9231e48
Refactor GrpcClient: request builders moved bisq.cli.request pkg
ghubstan Jun 13, 2021
d2939cc
Add new EditOfferOptionParser and test
ghubstan Jun 13, 2021
2344285
Add editoffer method help
ghubstan Jun 13, 2021
be249c5
Add editoffer to CLI
ghubstan Jun 13, 2021
929b28c
Add editoffer api tests & minor apitest refactoring
ghubstan Jun 13, 2021
571568a
Remove chase quickpay acct test
ghubstan Jun 13, 2021
9a5e2d0
Remove unused import
ghubstan Jun 13, 2021
05f3985
Fix problems found in codacy check
ghubstan Jun 13, 2021
54efad0
Fix codacy issue
ghubstan Jun 13, 2021
21ac46a
Fix log arg spec bug
ghubstan Jun 13, 2021
32688a7
Add bool isMyOffer to OfferInfo proto
ghubstan Jun 15, 2021
738d2f7
Fix editoffer validation bugs, tidy up CoreOffersService
ghubstan Jun 15, 2021
e2a205a
Show enable/trigger-price cols for 'getmyoffer'
ghubstan Jun 15, 2021
4da64b9
Improve 'editoffer' opt parsing, fix test pkg name
ghubstan Jun 15, 2021
063b52e
Add editoffer test case, suppress annoying warnings
ghubstan Jun 15, 2021
e5b5a06
Remove unused field
ghubstan Jun 15, 2021
bc1576e
Throw exception is edit altcoin offer is attempted
ghubstan Jun 15, 2021
a3ea4ec
Avoid duplicate test run
ghubstan Jun 15, 2021
3d38a85
Make codacy just a bit happier
ghubstan Jun 15, 2021
1a56a51
Force codacy check after codacy config change
ghubstan Jun 17, 2021
0e9c665
Include isMyOffer flag in API's trade/offer proto wrappers
ghubstan Jun 18, 2021
a603044
Pass isMyOffer flag to trade/offer proto wrappers from core services
ghubstan Jun 18, 2021
e32e0d1
Add altcoin (bsq) offer editing validation check
ghubstan Jun 18, 2021
b74f084
Optionally show ENABLED column in CLI's getoffer(bsq) output
ghubstan Jun 18, 2021
7880a84
Add BSQ offer editing tests to EditOfferTest
ghubstan Jun 18, 2021
ab2edac
Merge branch 'master' into 02-refactor-for-api-editoffer-method
ghubstan Jun 19, 2021
0a3e011
Merge branch '02-refactor-for-api-editoffer-method' into 03-api-edito…
ghubstan Jun 19, 2021
8115866
Merge branch '03-api-editoffer-method' into 04-edit-bsq-offer
ghubstan Jun 19, 2021
acbf1e4
Force rebuild after github action ECONNRESET
ghubstan Jun 19, 2021
9703b87
Document api 'editoffer' usage
ghubstan Jun 19, 2021
05f4f4d
Fix header
ghubstan Jun 19, 2021
06efcdf
Delete tmp main() method
ghubstan Jul 11, 2021
eb62f93
Rename and move private function
ghubstan Jul 12, 2021
1992bcb
Do not duplicate Price.parse on CLI side for only one use case
ghubstan Jul 12, 2021
622f7e9
Remove old TODO because relevant refactoring was approved
ghubstan Jul 12, 2021
a4278a4
Fix typo 'enabled' -> 'enable'
ghubstan Jul 13, 2021
649c98a
Always use Locale.US in CLI DecimalFormats
ghubstan Jul 15, 2021
b8379e2
Merge branch 'master' into 05-update-api-beta-test-guide
ghubstan Jul 30, 2021
b4ee6db
Do not start test harness deamons in dbg mode by default
ghubstan Jul 30, 2021
95bbb41
Add missing trigger-price param
ghubstan Jul 30, 2021
add6536
Fix peer add(offer) & remove(offer) event order problem
ghubstan Jul 30, 2021
094bc52
Revert "Fix peer add(offer) & remove(offer) event order problem"
ghubstan Aug 2, 2021
3693728
Merge branch 'master' into 05-update-api-beta-test-guide
ghubstan Aug 4, 2021
6e2400f
Ensure UI OfferBook items are correctly added and removed
ghubstan Aug 7, 2021
d3508d2
Revert logback debug config changes
ghubstan Aug 7, 2021
1a7ad0b
Merge branch 'master' into 06-safe-offerbook-add-remove-events
ghubstan Aug 7, 2021
713867b
Remove comment (question answered)
ghubstan Aug 11, 2021
6a4aced
Handle API's edit+disable offer use case in UI.
ghubstan Aug 13, 2021
71a61c6
Display Enabled=PENDING in CLI 'createoffer' output
ghubstan Aug 14, 2021
1c096d0
Merge branch 'master' into 08-handle-extradata-in-editoffer
ghubstan Aug 16, 2021
d709338
Refactor 2 predicates as single predicate
ghubstan Aug 16, 2021
59c0313
Fix long method name
ghubstan Aug 16, 2021
524a586
Merge branch '06-safe-offerbook-add-remove-events' into 07-show-new-o…
ghubstan Aug 16, 2021
859a5ab
Merge branch '07-show-new-offer-with-pending-status' into 08-handle-e…
ghubstan Aug 16, 2021
fb4e00f
Fix OfferBookService bug causing extra check in OfferBook.onRemoved
ghubstan Aug 18, 2021
fdc78b2
Remove unused methods
ghubstan Aug 18, 2021
b93f6ea
Remove sequence-number checks from OfferBook
ghubstan Aug 20, 2021
59192e9
Do not filter on paylaod hash when deleting duplicate list items
ghubstan Aug 22, 2021
4889da6
Remove redundant list.size check
ghubstan Aug 25, 2021
98a5b17
Add missing detail to comment
ghubstan Aug 25, 2021
84036bd
Add TODOs (delete debug statement)
ghubstan Aug 25, 2021
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
4 changes: 2 additions & 2 deletions apitest/docs/api-beta-test-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,14 +432,14 @@ To disable an offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
--enabled=false
--enable=false
```

To enable an offer:
```
./bisq-cli --password=xyz --port=9998 editoffer \
--offer-id=83e8b2e2-51b6-4f39-a748-3ebd29c22aea \
--enabled=true
--enable=true
```

#### Change Offer Pricing Model
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public abstract class AbstractOfferTest extends MethodTest {
@BeforeAll
public static void setUp() {
startSupportingApps(true,
true,
false,
bitcoind,
seednode,
arbdaemon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static protobuf.OfferPayload.Direction.BUY;
import static protobuf.OfferPayload.Direction.SELL;

Expand Down Expand Up @@ -70,6 +71,9 @@ public void testCreateBuy1BTCFor20KBSQOffer() {
alicesBsqAcct.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("Sell BSQ (Buy BTC) OFFER:\n{}", formatOfferTable(singletonList(newOffer), BSQ));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -86,6 +90,8 @@ public void testCreateBuy1BTCFor20KBSQOffer() {
genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand All @@ -112,6 +118,9 @@ public void testCreateSell1BTCFor20KBSQOffer() {
alicesBsqAcct.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("SELL 20K BSQ OFFER:\n{}", formatOfferTable(singletonList(newOffer), BSQ));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), newOffer.getDirection());
Expand All @@ -128,6 +137,8 @@ public void testCreateSell1BTCFor20KBSQOffer() {
genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(SELL.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand All @@ -154,6 +165,9 @@ public void testCreateBuyBTCWith1To2KBSQOffer() {
alicesBsqAcct.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("BUY 1-2K BSQ OFFER:\n{}", formatOfferTable(singletonList(newOffer), BSQ));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -170,6 +184,8 @@ public void testCreateBuyBTCWith1To2KBSQOffer() {
genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand All @@ -196,6 +212,9 @@ public void testCreateSellBTCFor5To10KBSQOffer() {
alicesBsqAcct.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("SELL 5-10K BSQ OFFER:\n{}", formatOfferTable(singletonList(newOffer), BSQ));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), newOffer.getDirection());
Expand All @@ -212,6 +231,8 @@ public void testCreateSellBTCFor5To10KBSQOffer() {
genBtcBlockAndWaitForOfferPreparation();

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(SELL.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static protobuf.OfferPayload.Direction.BUY;
import static protobuf.OfferPayload.Direction.SELL;

Expand All @@ -58,6 +59,9 @@ public void testCreateAUDBTCBuyOfferUsingFixedPrice16000() {
audAccount.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("OFFER #1:\n{}", formatOfferTable(singletonList(newOffer), "AUD"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -72,6 +76,8 @@ public void testCreateAUDBTCBuyOfferUsingFixedPrice16000() {
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand All @@ -98,6 +104,9 @@ public void testCreateUSDBTCBuyOfferUsingFixedPrice100001234() {
usdAccount.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("OFFER #2:\n{}", formatOfferTable(singletonList(newOffer), "USD"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -112,6 +121,8 @@ public void testCreateUSDBTCBuyOfferUsingFixedPrice100001234() {
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand All @@ -138,6 +149,9 @@ public void testCreateEURBTCSellOfferUsingFixedPrice95001234() {
eurAccount.getId(),
MAKER_FEE_CURRENCY_CODE);
log.info("OFFER #3:\n{}", formatOfferTable(singletonList(newOffer), "EUR"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), newOffer.getDirection());
Expand All @@ -152,6 +166,8 @@ public void testCreateEURBTCSellOfferUsingFixedPrice95001234() {
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(SELL.name(), newOffer.getDirection());
assertFalse(newOffer.getUseMarketBasedPrice());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import static java.math.RoundingMode.HALF_UP;
import static java.util.Collections.singletonList;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static protobuf.OfferPayload.Direction.BUY;
Expand Down Expand Up @@ -81,6 +82,9 @@ public void testCreateUSDBTCBuyOffer5PctPriceMargin() {
MAKER_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
log.info("OFFER #1:\n{}", formatOfferTable(singletonList(newOffer), "usd"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -94,6 +98,8 @@ public void testCreateUSDBTCBuyOffer5PctPriceMargin() {
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertTrue(newOffer.getUseMarketBasedPrice());
Expand Down Expand Up @@ -123,6 +129,9 @@ public void testCreateNZDBTCBuyOfferMinus2PctPriceMargin() {
MAKER_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
log.info("OFFER #2:\n{}", formatOfferTable(singletonList(newOffer), "nzd"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(BUY.name(), newOffer.getDirection());
Expand All @@ -136,6 +145,8 @@ public void testCreateNZDBTCBuyOfferMinus2PctPriceMargin() {
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(BUY.name(), newOffer.getDirection());
assertTrue(newOffer.getUseMarketBasedPrice());
Expand Down Expand Up @@ -165,6 +176,9 @@ public void testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin() {
MAKER_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
log.info("OFFER #3:\n{}", formatOfferTable(singletonList(newOffer), "gbp"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), newOffer.getDirection());
Expand All @@ -178,6 +192,8 @@ public void testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin() {
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(SELL.name(), newOffer.getDirection());
assertTrue(newOffer.getUseMarketBasedPrice());
Expand Down Expand Up @@ -207,6 +223,9 @@ public void testCreateBRLBTCSellOffer6Point55PctPriceMargin() {
MAKER_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
log.info("OFFER #4:\n{}", formatOfferTable(singletonList(newOffer), "brl"));
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

String newOfferId = newOffer.getId();
assertNotEquals("", newOfferId);
assertEquals(SELL.name(), newOffer.getDirection());
Expand All @@ -220,6 +239,8 @@ public void testCreateBRLBTCSellOffer6Point55PctPriceMargin() {
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());

newOffer = aliceClient.getMyOffer(newOfferId);
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(newOfferId, newOffer.getId());
assertEquals(SELL.name(), newOffer.getDirection());
assertTrue(newOffer.getUseMarketBasedPrice());
Expand Down Expand Up @@ -252,9 +273,14 @@ public void testCreateUSDBTCBuyOfferWithTriggerPrice() {
usdAccount.getId(),
MAKER_FEE_CURRENCY_CODE,
triggerPriceAsLong);
assertTrue(newOffer.getIsMyOffer());
assertTrue(newOffer.getIsMyPendingOffer());

genBtcBlocksThenWait(1, 4000); // give time to add to offer book
newOffer = aliceClient.getMyOffer(newOffer.getId());
log.info("OFFER #5:\n{}", formatOfferTable(singletonList(newOffer), "usd"));
assertTrue(newOffer.getIsMyOffer());
assertFalse(newOffer.getIsMyPendingOffer());
assertEquals(triggerPriceAsLong, newOffer.getTriggerPrice());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void testTakeAlicesBuyOffer(final TestInfo testInfo) {
0.00,
getDefaultBuyerSecurityDepositAsPercent(),
alicesPaymentAccount.getId(),
TRADE_FEE_CURRENCY_CODE);
TRADE_FEE_CURRENCY_CODE,
NO_TRIGGER_PRICE);
var offerId = alicesOffer.getId();
assertFalse(alicesOffer.getIsCurrencyForMakerFeeBtc());

Expand Down
2 changes: 1 addition & 1 deletion cli/src/main/java/bisq/cli/CliMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ public static void run(String[] args) {
}
var tradeId = opts.getTradeId();
var address = opts.getAddress();
// Multi-word memos must be double quoted.
// Multi-word memos must be double-quoted.
var memo = opts.getMemo();
client.withdrawFunds(tradeId, address, memo);
out.printf("trade %s funds sent to btc address %s%n", tradeId, address);
Expand Down
13 changes: 8 additions & 5 deletions cli/src/main/java/bisq/cli/CurrencyFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.common.annotations.VisibleForTesting;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;

import java.math.BigDecimal;
Expand All @@ -35,19 +36,22 @@
@VisibleForTesting
public class CurrencyFormat {

// Use the US locale for all DecimalFormat objects.
private static final DecimalFormatSymbols DECIMAL_FORMAT_SYMBOLS = DecimalFormatSymbols.getInstance(Locale.US);

// Formats numbers in US locale, human friendly style.
private static final NumberFormat FRIENDLY_NUMBER_FORMAT = NumberFormat.getInstance(Locale.US);

// Formats numbers for internal use, i.e., grpc request parameters.
private static final DecimalFormat INTERNAL_FIAT_DECIMAL_FORMAT = new DecimalFormat("##############0.0000");

static final BigDecimal SATOSHI_DIVISOR = new BigDecimal(100_000_000);
static final DecimalFormat BTC_FORMAT = new DecimalFormat("###,##0.00000000");
static final DecimalFormat BTC_TX_FEE_FORMAT = new DecimalFormat("###,###,##0");
static final DecimalFormat BTC_FORMAT = new DecimalFormat("###,##0.00000000", DECIMAL_FORMAT_SYMBOLS);
static final DecimalFormat BTC_TX_FEE_FORMAT = new DecimalFormat("###,###,##0", DECIMAL_FORMAT_SYMBOLS);

static final BigDecimal BSQ_SATOSHI_DIVISOR = new BigDecimal(100);
static final DecimalFormat BSQ_FORMAT = new DecimalFormat("###,###,###,##0.00");
static final DecimalFormat SEND_BSQ_FORMAT = new DecimalFormat("###########0.00");
static final DecimalFormat BSQ_FORMAT = new DecimalFormat("###,###,###,##0.00", DECIMAL_FORMAT_SYMBOLS);
static final DecimalFormat SEND_BSQ_FORMAT = new DecimalFormat("###########0.00", DECIMAL_FORMAT_SYMBOLS);

static final BigDecimal SECURITY_DEPOSIT_MULTIPLICAND = new BigDecimal("0.01");

Expand All @@ -62,7 +66,6 @@ public static String formatBsq(long sats) {
}

public static String formatBsqAmount(long bsqSats) {
// BSQ sats = trade.getOffer().getVolume()
FRIENDLY_NUMBER_FORMAT.setMinimumFractionDigits(2);
FRIENDLY_NUMBER_FORMAT.setMaximumFractionDigits(2);
FRIENDLY_NUMBER_FORMAT.setRoundingMode(HALF_UP);
Expand Down
12 changes: 10 additions & 2 deletions cli/src/main/java/bisq/cli/TableFormat.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private static String formattedFiatOfferTable(List<OfferInfo> offers,
return headerLine
+ offers.stream()
.map(o -> format(colDataFormat,
o.getIsActivated() ? "YES" : "NO",
formatEnabled(o),
o.getDirection(),
formatPrice(o.getPrice()),
formatAmountRange(o.getMinAmount(), o.getAmount()),
Expand Down Expand Up @@ -300,7 +300,7 @@ private static String formatCryptoCurrencyOfferTable(List<OfferInfo> offers,
return headerLine
+ offers.stream()
.map(o -> format(colDataFormat,
o.getIsActivated() ? "YES" : "NO",
formatEnabled(o),
directionFormat.apply(o),
formatCryptoCurrencyPrice(o.getPrice()),
formatAmountRange(o.getMinAmount(), o.getAmount()),
Expand All @@ -324,6 +324,14 @@ private static String formatCryptoCurrencyOfferTable(List<OfferInfo> offers,
}
}


private static String formatEnabled(OfferInfo offerInfo) {
if (offerInfo.getIsMyOffer() && offerInfo.getIsMyPendingOffer())
return "PENDING";
else
return offerInfo.getIsActivated() ? "YES" : "NO";
}

private static int getLongestPaymentMethodColWidth(List<OfferInfo> offers) {
return getLongestColumnSize(
COL_HEADER_PAYMENT_METHOD.length(),
Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/bisq/core/api/CoreOffersService.java
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,8 @@ private OfferPayload getMergedOfferPayload(OpenOffer openOffer,
offer.getOfferPayload().getCountryCode(),
offer.getOfferPayload().getAcceptedCountryCodes(),
offer.getOfferPayload().getBankId(),
offer.getOfferPayload().getAcceptedBankIds());
offer.getOfferPayload().getAcceptedBankIds(),
offer.getOfferPayload().getExtraDataMap());
log.info("Merging OfferPayload with {}", mutableOfferPayloadFields);
return offerUtil.getMergedOfferPayload(openOffer, mutableOfferPayloadFields);
}
Expand Down
Loading