diff --git a/src/main/java/bisq/asset/coins/Motion.java b/src/main/java/bisq/asset/coins/Motion.java new file mode 100644 index 0000000..79e5f8f --- /dev/null +++ b/src/main/java/bisq/asset/coins/Motion.java @@ -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 . + */ + +package bisq.asset.coins; + +import bisq.asset.Base58BitcoinAddressValidator; +import bisq.asset.Coin; +import bisq.asset.NetworkParametersAdapter; + +public class Motion extends Coin { + + public Motion() { + super("Motion", "XMN", new Base58BitcoinAddressValidator(new MotionParams())); + } + + + public static class MotionParams extends NetworkParametersAdapter { + + public MotionParams() { + addressHeader = 50; + p2shHeader = 18; + acceptableAddressCodes = new int[]{addressHeader, p2shHeader}; + } + } +} diff --git a/src/main/resources/META-INF/services/bisq.asset.Asset b/src/main/resources/META-INF/services/bisq.asset.Asset index 4197973..c726bdc 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -66,6 +66,7 @@ bisq.asset.coins.Mazacoin bisq.asset.coins.MFCoin bisq.asset.coins.MicroCoin bisq.asset.coins.Monero +bisq.asset.coins.Motion bisq.asset.coins.Namecoin bisq.asset.coins.NavCoin bisq.asset.coins.NEETCOIN diff --git a/src/test/java/bisq/asset/coins/MotionTest.java b/src/test/java/bisq/asset/coins/MotionTest.java new file mode 100644 index 0000000..3b55ab5 --- /dev/null +++ b/src/test/java/bisq/asset/coins/MotionTest.java @@ -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 . + */ + +package bisq.asset.coins; + +import bisq.asset.AbstractAssetTest; + +import org.junit.Test; + +public class MotionTest extends AbstractAssetTest { + + public MotionTest() { + super(new Motion()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("MUQXDHrau4NbDJ93GcTP3q2JEb9dUpUz9n"); + assertValidAddress("MCi4PALzN9U2TL7UAQXJTEorJgYYKwzv7j"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("MidkVmR8GaT3oQthbm6jVxG5R7LnLVAvKwX"); + assertInvalidAddress("MidkVmR8GaT3oQthbm6jVxG5R7LnLVAvK"); + assertInvalidAddress("MidkVmR8GaT3oQthbm6jVxG5R7LnLVAvK#"); + assertInvalidAddress("XidkVmR8GaT3oQthbm6jVxG5R7LnLVAvKwX"); + assertInvalidAddress("yidkVmR8GaT3oQthbm6jVxG5R7LnLVAvKwX"); + } +}