Skip to content
This repository was archived by the owner on Apr 20, 2022. It is now read-only.

Commit da1e385

Browse files
authored
Merge pull request #204 from blockchain/feature/bitcoinCash
Feature/bitcoin cash
2 parents 1d35867 + 874de86 commit da1e385

124 files changed

Lines changed: 3586 additions & 11332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ gradle clean build
2727

2828
Security issues can be reported to us in the following venues:
2929
* Email: security@blockchain.info
30-
* Bug Bounty: https://www.crowdcurity.com/blockchain-info
30+
* Bug Bounty: https://hackerone.com/blockchain
3131

build.gradle

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
buildscript {
2+
ext.kotlin_version = '1.2.21'
3+
repositories {
4+
mavenCentral()
5+
}
6+
dependencies {
7+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
8+
}
9+
}
10+
111
plugins {
212
id 'java'
313
id 'maven'
@@ -10,6 +20,7 @@ group = 'info.blockchain'
1020
version = PROJECT_VERSION
1121

1222
apply from: "integTest.gradle"
23+
apply plugin: 'kotlin'
1324

1425
sourceCompatibility = 1.7
1526
targetCompatibility = 1.7
@@ -67,17 +78,18 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
6778
}
6879

6980
dependencies {
70-
compile files('libs/api-client-0.1.15-SNAPSHOT.jar')
81+
compile files('libs/bitcoinj-core-0.15-SNAPSHOT.jar')
82+
compile files('libs/api-client-0.1.16-SNAPSHOT.jar')
7183
// TODO: Switch this back once the client is published
7284
// compile group: 'info.blockchain', name: 'api-client', version: '0.1.15-SNAPSHOT'
73-
compile group: 'org.bitcoinj', name: 'bitcoinj-core', version: '0.14.4'
85+
// compile group: 'org.bitcoinj', name: 'bitcoinj-core', version: '0.14.4'
7486
compile 'com.madgag.spongycastle:prov:1.53.0.0'
7587
compile ('org.web3j:core-android:2.2.1')
7688
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
7789
compile group: 'org.slf4j', name: 'slf4j-jdk14', version: '1.7.5'
7890
compile group: 'commons-io', name: 'commons-io', version: '2.4'
7991
compile group: 'commons-cli', name: 'commons-cli', version: '1.3'
80-
compile group: 'commons-codec', name: 'commons-codec', version: '1.4'
92+
compile group: 'commons-codec', name: 'commons-codec', version: '1.3'
8193
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.5'
8294
compile group: 'io.mikael', name: 'urlbuilder', version: '2.0.8'
8395
compile group: 'org.json', name: 'json', version: '20160810'
@@ -89,12 +101,29 @@ dependencies {
89101
compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.7.0'
90102
compile group: 'com.squareup.okio', name: 'okio', version: '1.11.0'
91103
compile group: 'org.mockito', name: 'mockito-all', version: '1.9.5'
104+
105+
//bitcoinj dependencies
106+
compile group: 'com.google.protobuf', name: 'protobuf-java', version:'2.6.1'
107+
compile group: 'com.google.code.findbugs', name: 'jsr305', version:'2.0.1'
108+
compile group: 'com.google.guava', name: 'guava', version: '23.5-android'
109+
92110
testCompile group: 'junit', name: 'junit', version: '4.12'
111+
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
93112
}
94113

95114
jacocoTestReport {
96115
reports {
97116
xml.enabled = true // coveralls plugin depends on xml format report
98117
html.enabled = true
99118
}
119+
}
120+
compileKotlin {
121+
kotlinOptions {
122+
jvmTarget = "1.6"
123+
}
124+
}
125+
compileTestKotlin {
126+
kotlinOptions {
127+
jvmTarget = "1.6"
128+
}
100129
}
40.3 KB
Binary file not shown.
751 KB
Binary file not shown.

src/integTest/java/info/blockchain/wallet/BaseIntegTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
import info.blockchain.wallet.api.PersistentUrls;
55
import info.blockchain.wallet.shapeshift.ShapeShiftUrls;
66

7-
import org.bitcoinj.params.AbstractBitcoinNetParams;
8-
import org.bitcoinj.params.MainNetParams;
7+
import org.bitcoinj.core.NetworkParameters;
8+
import org.bitcoinj.params.BitcoinCashMainNetParams;
9+
import org.bitcoinj.params.BitcoinMainNetParams;
910
import org.junit.After;
1011
import org.junit.Before;
1112
import org.junit.BeforeClass;
@@ -50,8 +51,13 @@ public Environment getEnvironment() {
5051
}
5152

5253
@Override
53-
public AbstractBitcoinNetParams getNetworkParameters() {
54-
return MainNetParams.get();
54+
public NetworkParameters getBitcoinParams() {
55+
return BitcoinMainNetParams.get();
56+
}
57+
58+
@Override
59+
public NetworkParameters getBitcoinCashParams() {
60+
return BitcoinCashMainNetParams.get();
5561
}
5662

5763
@Override

src/integTest/java/info/blockchain/wallet/api/WalletApiIntegTest.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@ public class WalletApiIntegTest extends BaseIntegTest {
2727
private String sharedKey = "b4ff6bf5-17a9-4905-b54b-a526816aa100";
2828
private WalletApi walletApi = new WalletApi();
2929

30-
@Test
31-
public void getDynamicFee() throws Exception {
32-
final TestObserver<FeeList> testObserver = walletApi.getDynamicFee().test();
33-
34-
testObserver.assertComplete();
35-
testObserver.assertNoErrors();
36-
assertNotNull(testObserver.values().get(0));
37-
assertNotNull(testObserver.values().get(0).toJson());
38-
}
39-
4030
@Test
4131
public void getRandomBytesCall() throws Exception {
4232
Response<ResponseBody> call = walletApi.getRandomBytesCall().execute();

src/integTest/java/info/blockchain/wallet/contacts/ContactsIntegTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public class ContactsIntegTest extends BaseIntegTest{
3636
private HDWallet getWallet() throws Exception {
3737

3838
return HDWalletFactory
39-
.restoreWallet(PersistentUrls.getInstance().getCurrentNetworkParams(), Language.US,
39+
.restoreWallet(PersistentUrls.getInstance().getBitcoinParams(), Language.US,
4040
"15e23aa73d25994f1921a1256f93f72c", "", 1);
4141
}
4242

@@ -96,15 +96,15 @@ public void testSharedMetadataIntegration() throws Exception {
9696
/*
9797
Create wallets
9898
*/
99-
HDWallet a_wallet = HDWalletFactory.createWallet(PersistentUrls.getInstance().getCurrentNetworkParams(), Language.US, 12, "", 1);
99+
HDWallet a_wallet = HDWalletFactory.createWallet(PersistentUrls.getInstance().getBitcoinParams(), Language.US, 12, "", 1);
100100
DeterministicKey sharedMetaDataHDNode = MetadataUtil
101101
.deriveSharedMetadataNode(a_wallet.getMasterKey());
102102
DeterministicKey metaDataHDNode = MetadataUtil.deriveMetadataNode(a_wallet.getMasterKey());
103103
Contacts a_contacts = new Contacts(metaDataHDNode, sharedMetaDataHDNode);
104104
a_contacts.publishXpub();
105105
a_contacts.fetch();
106106

107-
HDWallet b_wallet = HDWalletFactory.createWallet(PersistentUrls.getInstance().getCurrentNetworkParams(), Language.US,12, "", 1);
107+
HDWallet b_wallet = HDWalletFactory.createWallet(PersistentUrls.getInstance().getBitcoinParams(), Language.US,12, "", 1);
108108
sharedMetaDataHDNode = MetadataUtil.deriveSharedMetadataNode(b_wallet.getMasterKey());
109109
metaDataHDNode = MetadataUtil.deriveMetadataNode(b_wallet.getMasterKey());
110110
Contacts b_contacts = new Contacts(metaDataHDNode, sharedMetaDataHDNode);

src/integTest/java/info/blockchain/wallet/metadata/MetadataIntegTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class MetadataIntegTest extends BaseIntegTest {
1515
private HDWallet getWallet() throws Exception {
1616

1717
return HDWalletFactory
18-
.restoreWallet(PersistentUrls.getInstance().getCurrentNetworkParams(), Language.US,
18+
.restoreWallet(PersistentUrls.getInstance().getBitcoinParams(), Language.US,
1919
"15e23aa73d25994f1921a1256f93f72c",
2020
"",
2121
1);

src/integTest/java/info/blockchain/wallet/metadata/MetadataNodeFactoryIntegTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@
55
import info.blockchain.wallet.bip44.HDWallet;
66
import info.blockchain.wallet.bip44.HDWalletFactory;
77
import info.blockchain.wallet.bip44.HDWalletFactory.Language;
8-
import info.blockchain.wallet.contacts.data.PublicContactDetails;
9-
import info.blockchain.wallet.util.MetadataUtil;
10-
import org.bitcoinj.crypto.DeterministicKey;
118
import org.junit.Assert;
12-
import org.junit.Before;
139
import org.junit.Test;
1410

1511
public class MetadataNodeFactoryIntegTest extends BaseIntegTest {
@@ -18,7 +14,7 @@ public class MetadataNodeFactoryIntegTest extends BaseIntegTest {
1814

1915
private HDWallet getWallet() throws Exception {
2016
return HDWalletFactory
21-
.restoreWallet(PersistentUrls.getInstance().getCurrentNetworkParams(), Language.US,
17+
.restoreWallet(PersistentUrls.getInstance().getBitcoinParams(), Language.US,
2218
"15e23aa73d25994f1921a1256f93f72c",
2319
"",
2420
1);

0 commit comments

Comments
 (0)