Merge remote-tracking branch 'upstream/master' into fix-take-offer-view

This commit is contained in:
Devin Bileck 2018-10-16 10:06:11 -07:00
commit d435afdd03
No known key found for this signature in database
GPG key ID: 38750B26EA8B8C93
15 changed files with 463 additions and 16 deletions

View file

@ -40,16 +40,39 @@ public class CryptonoteAddressValidator implements AddressValidator {
// Invalid characters
return AddressValidationResult.invalidStructure();
}
if (address.startsWith(prefix) && address.length() == 94 + prefix.length()) {
// Standard address
return AddressValidationResult.validAddress();
} else if (address.startsWith(subAddressPrefix) && address.length() == 94 + subAddressPrefix.length()) {
// Subaddress
return AddressValidationResult.validAddress();
} else {
// Integrated? Invalid? Doesn't matter
if (address.startsWith(prefix)) {
if (prefix.length() == 1 && address.length() == 94 + prefix.length()) {
// XMR-type Standard address
return AddressValidationResult.validAddress();
}
else if (prefix.length() == 2 && address.length() == 95 + prefix.length()) {
//Aeon & Blur-type addresses
return AddressValidationResult.validAddress();
}
else {
//Non-supported prefix
return AddressValidationResult.invalidStructure();
}
}
if (address.startsWith(subAddressPrefix)) {
if (subAddressPrefix.length() == 1 && address.length() == 94 + subAddressPrefix.length()) {
// XMR-type subaddress
return AddressValidationResult.validAddress();
}
else if (subAddressPrefix.length() == 2 && address.length() == 95 + subAddressPrefix.length()) {
// Aeon & Blur-type subaddress
return AddressValidationResult.validAddress();
}
else {
// Non-supported subAddress
return AddressValidationResult.invalidStructure();
}
}
}
}
else {
//Integrated? Invalid? Doesn't matter
return AddressValidationResult.invalidStructure();
}
}
}

View file

@ -0,0 +1,39 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Base58BitcoinAddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;
public class Actinium extends Coin {
public Actinium() {
super("Actinium", "ACM", new Base58BitcoinAddressValidator(new ActiniumParams()));
}
public static class ActiniumParams extends NetworkParametersAdapter {
public ActiniumParams() {
addressHeader = 53;
p2shHeader = 5;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.CryptonoteAddressValidator;
public class Blur extends Coin {
public Blur() {
super("Blur", "BLUR", new CryptonoteAddressValidator("bL", "Ry"));
}
}

View file

@ -0,0 +1,28 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.Coin;
import bisq.asset.RegexAddressValidator;
public class Dragonglass extends Coin {
public Dragonglass() {
super("Dragonglass", "DRGL", new RegexAddressValidator("^(dRGL)[1-9A-HJ-NP-Za-km-z]{94}$"));
}
}

View file

@ -0,0 +1,42 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AddressValidationResult;
import bisq.asset.AddressValidator;
import bisq.asset.Coin;
public class Zero extends Coin {
public Zero() {
super("Zero", "ZER", new ZeroAddressValidator());
}
public static class ZeroAddressValidator implements AddressValidator {
@Override
public AddressValidationResult validate(String address) {
// We only support t addresses (transparent transactions)
if (!address.startsWith("t1"))
return AddressValidationResult.invalidAddress("", "validation.altcoin.zAddressesNotSupported");
return AddressValidationResult.validAddress();
}
}
}

View file

@ -0,0 +1,27 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.tokens;
import bisq.asset.Erc20Token;
public class EtherStone extends Erc20Token {
public EtherStone() {
super("EtherStone", "ETHS");
}
}

View file

@ -3,6 +3,7 @@
# See bisq.asset.Asset and bisq.asset.AssetRegistry for further details.
# See https://bisq.network/list-asset for complete instructions.
bisq.asset.coins.Achievecoin
bisq.asset.coins.Actinium
bisq.asset.coins.Angelcoin
bisq.asset.coins.Aquachain
bisq.asset.coins.Arto
@ -19,6 +20,7 @@ bisq.asset.coins.Bitcoin$Testnet
bisq.asset.coins.Bitcore
bisq.asset.coins.BitDaric
bisq.asset.coins.BitZeny
bisq.asset.coins.Blur
bisq.asset.coins.BSQ$Mainnet
bisq.asset.coins.BSQ$Regtest
bisq.asset.coins.BSQ$Testnet
@ -47,6 +49,7 @@ bisq.asset.coins.Diamond
bisq.asset.coins.DigiMoney
bisq.asset.coins.Dinero
bisq.asset.coins.Dogecoin
bisq.asset.coins.Dragonglass
bisq.asset.coins.DRIP
bisq.asset.coins.DSTRA
bisq.asset.coins.DynamicCoin
@ -137,10 +140,12 @@ bisq.asset.coins.Yenten
bisq.asset.coins.Zcash
bisq.asset.coins.Zcoin
bisq.asset.coins.ZenCash
bisq.asset.coins.Zero
bisq.asset.coins.ZeroOneCoin
bisq.asset.tokens.BetterBetting
bisq.asset.tokens.DaiStablecoin
bisq.asset.tokens.Ellaism
bisq.asset.tokens.EtherStone
bisq.asset.tokens.Exceed
bisq.asset.tokens.GeoCoin
bisq.asset.tokens.Grans

View file

@ -0,0 +1,43 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class ActiniumTest extends AbstractAssetTest {
public ActiniumTest() {
super(new Actinium());
}
@Test
public void testValidAddresses() {
assertValidAddress("NLzB9iUGJ8GaKSn9GfVKfd55QVRdNdz9FK");
assertValidAddress("NSz7PKmo1sLQYtFuZjTQ1zZXhPQtHLScKT");
assertValidAddress("NTFtsh4Ff2ijPNsnQAUf5fKTp7DJaGxSZK");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("MgTFtsh4Ff2ijPNsnQAUf5fKTp7DJaGxSZK");
assertInvalidAddress("F9z7PKmo1sLQYtFuZjTQ1zZXhPQtHLScKT");
assertInvalidAddress("16Ftsh4Ff2ijPNsnQAUf5fKTp7DJaGxSZK");
}
}

View file

@ -0,0 +1,44 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class BlurTest extends AbstractAssetTest {
public BlurTest() {
super(new Blur());
}
@Test
public void testValidAddresses() {
assertValidAddress("bL3W1g1d12sbxQDTQ6q8bgU2bBp2rkfFFKfNvQuUQTHqgQHRaxKTHqK5Nqdm53BU3ibPnsqbdYAnnJMyqJ6FfN9m3CSZSNqDE");
assertValidAddress("bL2zBGUBDkQdyYasdoAdvQCxWLa9Mk5Q1PW8Zk7S38vx9xu7T7NMPPWNfieXqUyswo544ZSB3C1n9jLMfsUvR6p91rnrSdx9h");
assertValidAddress("Ry49oErHtqyHucxADDT2DfEJ9pRv2ciSpKV9XseCuWmx1PK1CZi4gbPKxhWBdtvLJNNc94c4yDutmZrD3WrsHPYV1nvE9X4Cc");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("");
assertInvalidAddress("bl4E2BCFY31DPLjeqF6Gu7TEUM5v2JwpmudFX64AubQtFDYEPBvgvQPzidaawDhjAmHeZSw92wEBnUfdfY5144Sad2ZCknZzC");
assertInvalidAddress("Ry49oErHtqyHucxADDT2DfEJ9pRv2ciSpKV9XseCuWmx1PK1CZi4gbPKxhWBdtvLJNNc94c4yDutmZrD3WrsHPYV1nvE9X40");
assertInvalidAddress("bLNHRh8pFh5Y14bhBVAoD4cvqHyoPsQJqB3dr49zoF6bNDFrts96tuuj#RoUKWRwpTHmYt4Kf78FES7LCXAXKXFf6bMsx1sdgz");
assertInvalidAddress("82zBGUBDkQdyYasdoAdvQCxWLa9Mk5Q1PW#8Zk7S38vx9xu7T7NMPPWNfieXqUyswo544ZSB3C1n9jLMfsUvR6p91rnrSdxwd");
}
}

View file

@ -0,0 +1,45 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class DragonglassTest extends AbstractAssetTest {
public DragonglassTest() {
super(new Dragonglass());
}
@Test
public void testValidAddresses() {
assertValidAddress("dRGLhxvCtLk1vfSD3WmFzyTN5ph2gZYvkZfxvLSrcdry95x4PPJrCKBTKDEFZYTw4bCGqoiaUWxNd8B41vqXaTY72Vi2XcvikX");
assertValidAddress("dRGLjS5v91tDd4GDZeahUj95nkXSNQs5DMY1YStLN2hSNWD67iZh7ED7oDw841Kx6oUYouZaXmBNFcqSptNZ4dL94CbZbF53jt");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("dRGLjS5v91tDd4GDZeahUj95nkXSNQs5DMY1YStLN2hSNWD67iZh7ED7oDw841Kx6oUYouZaXmBNFcqSptNZ4dL94CbZbF53j");
assertInvalidAddress("dRGLjS5v91tDd4GDZeahUj95nkXSNQs5DMY1YStLN2hSNWD67iZh7ED7oDw841Ko6oUYouZaXmBNFcqSptNZ4dL94oUCifk4048");
assertInvalidAddress("DRGLhxvCtLk1vfSD3WmFzyTN5ph2gZYvkZfxvLSrcdry95x4PPJrCKBTKDEFZYTw4bCGqoiaUWxNd8B41vqXaTY72Vi2XcvikX");
assertInvalidAddress("drglhxvCtLk1vfSD3WmFzyTN5ph2gZYvkZfxvLSrcdry95x4PPJrCKBTKDEFZYTw4bCGqoiaUWxNd8B41vqXaTY72Vi2XcvikX");
assertInvalidAddress("dRgLjS5v91tDd4GDZeahUj95nkXSNQs5DMY1YStLN2hSNWD67iZh7ED7oDw841Kx6oUYouZaXmBNFcqSptNZ4dL94CbZbF53jt");
assertInvalidAddress("dRGlhxvCtLk1vfSD3WmFzyTN5ph2gZYvkZfxvLSrcdry95x4PPJrCKBTKDEFZYTw4bCGqoiaUWxNd8B41vqXaTY72Vi2XcvikX");
}
}

View file

@ -0,0 +1,43 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.coins;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class ZeroTest extends AbstractAssetTest {
public ZeroTest() {
super(new Zero());
}
@Test
public void testValidAddresses() {
assertValidAddress("t1cZTNaKS6juH6tGEhCUZmZhtbYGeYeuTrK");
assertValidAddress("t1ZBPYJwK2UPbshwcYWRiCq7vw8VPDYumWu");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem");
assertInvalidAddress("38NwrYsD1HxQW5zfLT0QcUUXGMPvQgzTSn");
assertInvalidAddress("8tP9rh3SH6n9cSLmV22vnSNNw56LKGpLrB");
assertInvalidAddress("8Zbvjr");
}
}

View file

@ -0,0 +1,42 @@
/*
* This file is part of Bisq.
*
* Bisq is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or (at
* your option) any later version.
*
* Bisq is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
* License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/
package bisq.asset.tokens;
import bisq.asset.AbstractAssetTest;
import org.junit.Test;
public class EtherStoneTest extends AbstractAssetTest {
public EtherStoneTest () {
super(new EtherStone());
}
@Test
public void testValidAddresses() {
assertValidAddress("0x0d81d9e21bd7c5bb095535624dcb0759e64b3899");
assertValidAddress("0d81d9e21bd7c5bb095535624dcb0759e64b3899");
}
@Test
public void testInvalidAddresses() {
assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a216");
assertInvalidAddress("0x65767ec6d4d3d18a200842352485cdc37cbf3a2g");
assertInvalidAddress("65767ec6d4d3d18a200842352485cdc37cbf3a2g");
}
}

View file

@ -193,6 +193,17 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
languageComboBox = FormBuilder.<String>addLabelComboBox(root, ++gridRow, "", 15).second;
languageComboBox.setPromptText(Res.get("shared.addLanguage"));
languageComboBox.setButtonCell(new ListCell<String>() {
@Override
protected void updateItem(final String item, boolean empty) {
super.updateItem(item, empty) ;
if (empty || item == null) {
setText(Res.get("shared.addLanguage"));
} else {
setText(LanguageUtil.getDisplayName(item));
}
}
});
languageComboBox.setConverter(new StringConverter<String>() {
@Override
public String toString(String code) {
@ -204,7 +215,7 @@ public class ArbitratorSelectionView extends ActivatableViewAndModel<GridPane, A
return null;
}
});
languageComboBox.setOnAction(e -> onAddLanguage());
languageComboBox.setOnHiding(e -> onAddLanguage());
}
private void addArbitratorsGroup() {

View file

@ -488,6 +488,7 @@ public abstract class Overlay<T extends Overlay> {
event.consume();
doClose();
});
stage.sizeToScene();
stage.show();
layout();

View file

@ -365,8 +365,10 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
new Popup<>().warning(Res.get("setting.preferences.cannotRemovePrefCurrency")).show();
} else {
preferences.removeFiatCurrency(item);
if (!allFiatCurrencies.contains(item))
if (!allFiatCurrencies.contains(item)) {
allFiatCurrencies.add(item);
allFiatCurrencies.sort(TradeCurrency::compareTo);
}
}
});
setGraphic(pane);
@ -415,8 +417,10 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
new Popup<>().warning(Res.get("setting.preferences.cannotRemovePrefCurrency")).show();
} else {
preferences.removeCryptoCurrency(item);
if (!allCryptoCurrencies.contains(item))
if (!allCryptoCurrencies.contains(item)) {
allCryptoCurrencies.add(item);
allCryptoCurrencies.sort(TradeCurrency::compareTo);
}
}
});
setGraphic(pane);
@ -431,6 +435,17 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
fiatCurrenciesComboBox = FormBuilder.<FiatCurrency>addLabelComboBox(root, ++gridRow).second;
fiatCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
fiatCurrenciesComboBox.setButtonCell(new ListCell<FiatCurrency>() {
@Override
protected void updateItem(final FiatCurrency item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(Res.get("setting.preferences.addFiat"));
} else {
setText(item.getNameAndCode());
}
}
});
fiatCurrenciesComboBox.setConverter(new StringConverter<FiatCurrency>() {
@Override
public String toString(FiatCurrency tradeCurrency) {
@ -447,6 +462,17 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
cryptoCurrenciesComboBox = labelComboBoxTuple2.second;
GridPane.setColumnIndex(cryptoCurrenciesComboBox, 3);
cryptoCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addAltcoin"));
cryptoCurrenciesComboBox.setButtonCell(new ListCell<CryptoCurrency>() {
@Override
protected void updateItem(final CryptoCurrency item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setText(Res.get("setting.preferences.addAltcoin"));
} else {
setText(item.getNameAndCode());
}
}
});
cryptoCurrenciesComboBox.setConverter(new StringConverter<CryptoCurrency>() {
@Override
public String toString(CryptoCurrency tradeCurrency) {
@ -609,7 +635,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
fiatCurrenciesComboBox.setItems(allFiatCurrencies);
fiatCurrenciesListView.setItems(fiatCurrencies);
fiatCurrenciesComboBox.setOnAction(e -> {
fiatCurrenciesComboBox.setOnHiding(e -> {
FiatCurrency selectedItem = fiatCurrenciesComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
preferences.addFiatCurrency(selectedItem);
@ -624,7 +650,7 @@ public class PreferencesView extends ActivatableViewAndModel<GridPane, Preferenc
});
cryptoCurrenciesComboBox.setItems(allCryptoCurrencies);
cryptoCurrenciesListView.setItems(cryptoCurrencies);
cryptoCurrenciesComboBox.setOnAction(e -> {
cryptoCurrenciesComboBox.setOnHiding(e -> {
CryptoCurrency selectedItem = cryptoCurrenciesComboBox.getSelectionModel().getSelectedItem();
if (selectedItem != null) {
preferences.addCryptoCurrency(selectedItem);