Skip to content

Commit

Permalink
Merge pull request bisq-network#3 from ManfredKarrer/mk-http-api
Browse files Browse the repository at this point in the history
Sync with master
  • Loading branch information
mrosseel authored Oct 23, 2018
2 parents 3b13412 + 4043d82 commit fe13f79
Show file tree
Hide file tree
Showing 238 changed files with 5,287 additions and 2,963 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: java
jdk: oraclejdk10
jdk: openjdk10
before_install:
grep -v '^#' src/main/resources/META-INF/services/bisq.asset.Asset | sort --check --dictionary-order --ignore-case
notifications:
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ For more information, see https://bisq.network/intro and for step-by-step gettin

## Building Bisq

You will need [JDK 10](https://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html) installed to complete the following instructions.
You will need OpenJDK [JDK 10](https://jdk.java.net/10/) installed to complete the following instructions.

1. Clone the Bisq source code and cd into `bisq`

Expand Down Expand Up @@ -42,11 +42,11 @@ _The following instructions have been tested on IDEA 2018.2_
1. Go to `Preferences->Plugins`. Search for and install the _Lombok_ plugin. When prompted, do not restart IDEA.
1. Go to `Preferences->Build, Execution, Deployment->Compiler->Annotation Processors` and check the `Enable annotation processing` option (to enable processing of Lombok annotations)
1. Restart IDEA
1. Go to `Import Project`, select `settings.gradle` and click `Open`
1. Go to `Import Project`, select the `settings.gradle` file and click `Open`
1. In the `Import Project from Gradle` screen, check the `Use auto-import` option and click `OK`
1. When prompted whether to overwrite the existing `.idea` directory, click `Yes`
1. In the `Project` tool window, right click on the root-level `.idea` folder, select `Git->Revert...` and click OK in the dialog that appears (to restore source-controlled `.idea` configuration files that get overwritten during project import)
1. Go to `Build->Build project`. Everything should build cleanly. You should be able to run tests, run `main` methods in any component, etc.
1. Go to `Build->Build Project`. Everything should build cleanly. You should be able to run tests, run `main` methods in any component, etc.

> TIP: If you encounter compilation errors related to the `io.bisq.generated.protobuffer.PB` class, it is probably because you didn't run the full Gradle build above. You need to run the `generateProto` task in the `common` project. You can do this via the Gradle tool window in IDEA, or you can do it the command line with `cd common; ./gradlew generateProto`. Once you've done that, run `Build->Build project` again and you should have no errors.
> TIP: If you encounter compilation errors related to the `io.bisq.generated.protobuffer.PB` class, it is probably because you didn't run the full Gradle build above. You need to run the `generateProto` task in the `common` project. You can do this via the Gradle tool window in IDEA, or you can do it the command line with `cd common; ./gradlew generateProto`. Once you've done that, run `Build->Build Project` again and you should have no errors.
45 changes: 34 additions & 11 deletions assets/src/main/java/bisq/asset/CryptonoteAddressValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,39 @@ public AddressValidationResult validate(String address) {
// 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();
}
}
}


Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,25 @@
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
*/

package bisq.core.dao.governance.voteresult;
package bisq.asset.coins;

import bisq.core.dao.governance.ballot.Ballot;
import bisq.asset.Base58BitcoinAddressValidator;
import bisq.asset.Coin;
import bisq.asset.NetworkParametersAdapter;

import java.util.List;
public class Actinium extends Coin {

public Actinium() {
super("Actinium", "ACM", new Base58BitcoinAddressValidator(new ActiniumParams()));
}

import lombok.EqualsAndHashCode;
import lombok.Value;

@EqualsAndHashCode(callSuper = true)
@Value
public class MissingBallotException extends Exception {
private List<Ballot> existingBallots;
private List<String> proposalTxIdsOfMissingBallots;
public static class ActiniumParams extends NetworkParametersAdapter {

public MissingBallotException(List<Ballot> existingBallots, List<String> proposalTxIdsOfMissingBallots) {
this.existingBallots = existingBallots;
this.proposalTxIdsOfMissingBallots = proposalTxIdsOfMissingBallots;
public ActiniumParams() {
addressHeader = 53;
p2shHeader = 5;
acceptableAddressCodes = new int[]{addressHeader, p2shHeader};
}
}
}
28 changes: 28 additions & 0 deletions assets/src/main/java/bisq/asset/coins/Blur.java
Original file line number Diff line number Diff line change
@@ -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"));
}
}
28 changes: 28 additions & 0 deletions assets/src/main/java/bisq/asset/coins/Dragonglass.java
Original file line number Diff line number Diff line change
@@ -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}$"));
}
}
42 changes: 42 additions & 0 deletions assets/src/main/java/bisq/asset/coins/Zero.java
Original file line number Diff line number Diff line change
@@ -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();
}
}
}
27 changes: 27 additions & 0 deletions assets/src/main/java/bisq/asset/tokens/EtherStone.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
5 changes: 5 additions & 0 deletions assets/src/main/resources/META-INF/services/bisq.asset.Asset
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions assets/src/test/java/bisq/asset/coins/ActiniumTest.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
44 changes: 44 additions & 0 deletions assets/src/test/java/bisq/asset/coins/BlurTest.java
Original file line number Diff line number Diff line change
@@ -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");
}
}
Loading

0 comments on commit fe13f79

Please sign in to comment.