diff --git a/assets/src/main/java/bisq/asset/coins/Adeptio.java b/assets/src/main/java/bisq/asset/coins/Adeptio.java new file mode 100644 index 00000000000..ecfd4b34113 --- /dev/null +++ b/assets/src/main/java/bisq/asset/coins/Adeptio.java @@ -0,0 +1,56 @@ +/* + * 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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AddressValidationResult; +import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Adeptio extends Coin { + + public Adeptio() { + super("Adeptio", "ADE", new AdeptioAddressValidator()); + } + + + public static class AdeptioAddressValidator extends Base58BitcoinAddressValidator { + + public AdeptioAddressValidator() { + super(new AdeptioParams()); + } + + @Override + public AddressValidationResult validate(String address) { + if (!address.matches("^[A][a-km-zA-HJ-NP-Z1-9]{24,33}$")) + return AddressValidationResult.invalidStructure(); + + return super.validate(address); + } + } + + + public static class AdeptioParams extends NetworkParametersAdapter { + + public AdeptioParams() { + addressHeader = 23; + p2shHeader = 16; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/assets/src/main/resources/META-INF/services/bisq.asset.Asset b/assets/src/main/resources/META-INF/services/bisq.asset.Asset index 4f855ac7dde..ed35cb82ebf 100644 --- a/assets/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/assets/src/main/resources/META-INF/services/bisq.asset.Asset @@ -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.Actinium +bisq.asset.coins.Adeptio bisq.asset.coins.Aeon bisq.asset.coins.Australiacash bisq.asset.coins.Beam diff --git a/assets/src/test/java/bisq/asset/coins/AdeptioTest.java b/assets/src/test/java/bisq/asset/coins/AdeptioTest.java new file mode 100644 index 00000000000..4efa16b6ee3 --- /dev/null +++ b/assets/src/test/java/bisq/asset/coins/AdeptioTest.java @@ -0,0 +1,47 @@ +/* + * 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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class AdeptioTest extends AbstractAssetTest { + + public AdeptioTest() { + super(new Adeptio()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("AP7rSyQMZRek9HGy9QB1bpung69xViesN7"); + assertValidAddress("AWVXtnMo4pS2vBSNrBPLVvMgYvJGD6gSXk"); + assertValidAddress("AHq8sM8DEeFoZXeDkaimfCLtnMuuSWXFE7"); + assertValidAddress("ANG52tPNJuVknLQiLUdzVFoZ3vyo8UzkDL"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("aP7rSyQMZRek9HGy9QB1bpung69xViesN7"); + assertInvalidAddress("DAeiBSH4nudXgoxS4kY6uhTPobc7AlrWDA"); + assertInvalidAddress("BGhVYBXk511m8TPvQA6YokzxdpdhRE3sG6"); + assertInvalidAddress("AZt2Kuy9cWFbTc888HNphppkuCTNyqu5PY"); + assertInvalidAddress("AbosH98t3TRKzyNb8pPQV9boupVcBAX6of"); + assertInvalidAddress("DTPAqTryNRCE2FgsxzohTtJXfCBIDnG6Rc"); + } +}