diff --git a/src/main/java/bisq/asset/coins/BitcoinInstant.java b/src/main/java/bisq/asset/coins/BitcoinInstant.java new file mode 100644 index 0000000..93b927b --- /dev/null +++ b/src/main/java/bisq/asset/coins/BitcoinInstant.java @@ -0,0 +1,38 @@ +/* + * 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 BitcoinInstant extends Coin { + + public BitcoinInstant() { + super("Bitcoin Instant", "BTI", new Base58BitcoinAddressValidator(new BitcoinInstantParams())); + } + + public static class BitcoinInstantParams extends NetworkParametersAdapter { + + public BitcoinInstantParams() { + addressHeader = 0x66; + p2shHeader = 0x05; + 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 445a4f4..07cb801 100644 --- a/src/main/resources/META-INF/services/bisq.asset.Asset +++ b/src/main/resources/META-INF/services/bisq.asset.Asset @@ -10,6 +10,7 @@ bisq.asset.coins.BitcoinCash bisq.asset.coins.BitcoinClashic bisq.asset.coins.BitcoinCore bisq.asset.coins.BitcoinGold +bisq.asset.coins.BitcoinInstant bisq.asset.coins.Bitcoin$Mainnet bisq.asset.coins.Bitcoin$Regtest bisq.asset.coins.Bitcoin$Testnet diff --git a/src/test/java/bisq/asset/coins/BitcoinInstantTest.java b/src/test/java/bisq/asset/coins/BitcoinInstantTest.java new file mode 100644 index 0000000..6bd5303 --- /dev/null +++ b/src/test/java/bisq/asset/coins/BitcoinInstantTest.java @@ -0,0 +1,48 @@ +/* + * 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 BitcoinInstantTest extends AbstractAssetTest { + + public BitcoinInstantTest() { + super(new BitcoinInstant()); + } + + @Test + public void testValidAddresses() { + assertValidAddress("iG4DCE2RKHH47FcguJsfKXKuF4sdQ519Tt"); + assertValidAddress("i83W3SJH4KVfb94kprXRVXaoLYajFsNeGx"); + assertValidAddress("iDpT25zn3um3kpQCE3ZuMK6gmHviixgFvQ"); + assertValidAddress("iNdhv889Gqp67qdgsTc8K9zBfmqXvGLrtc"); + } + + @Test + public void testInvalidAddresses() { + assertInvalidAddress("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJXX"); + assertInvalidAddress("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJ"); + assertInvalidAddress("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJ#"); + assertInvalidAddress("12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX"); + assertInvalidAddress("iG4DCE2RKHH47FcguJsfKXKuF4sdQ519Ttt"); + assertInvalidAddress("iG4DCE2RKHH47FcguJsfKXKuF4sdQ519T"); + assertInvalidAddress("iG4DCE2RKHH47FcguJsfKXKuF4sdQ519T#"); + } +}