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

Commit 979a6ef

Browse files
authored
Merge pull request #205 from blockchain/development
Development
2 parents 27bf847 + da1e385 commit 979a6ef

File tree

144 files changed

+5332
-11355
lines changed

Some content is hidden

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

144 files changed

+5332
-11355
lines changed

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: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
import info.blockchain.wallet.api.Environment;
44
import info.blockchain.wallet.api.PersistentUrls;
5+
import info.blockchain.wallet.shapeshift.ShapeShiftUrls;
56

6-
import org.bitcoinj.params.AbstractBitcoinNetParams;
7-
import org.bitcoinj.params.MainNetParams;
7+
import org.bitcoinj.core.NetworkParameters;
8+
import org.bitcoinj.params.BitcoinCashMainNetParams;
9+
import org.bitcoinj.params.BitcoinMainNetParams;
810
import org.junit.After;
911
import org.junit.Before;
1012
import org.junit.BeforeClass;
@@ -16,7 +18,6 @@
1618
import io.reactivex.internal.schedulers.TrampolineScheduler;
1719
import io.reactivex.plugins.RxJavaPlugins;
1820
import okhttp3.OkHttpClient;
19-
import okhttp3.logging.HttpLoggingInterceptor;
2021
import retrofit2.Retrofit;
2122
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
2223
import retrofit2.converter.jackson.JacksonConverterFactory;
@@ -39,19 +40,29 @@ public Retrofit getRetrofitExplorerInstance() {
3940
return getRetrofit(PersistentUrls.EXPLORER_URL, getOkHttpClient());
4041
}
4142

43+
@Override
44+
public Retrofit getRetrofitShapeShiftInstance() {
45+
return getRetrofit(ShapeShiftUrls.SHAPESHIFT_URL, getOkHttpClient());
46+
}
47+
4248
@Override
4349
public Environment getEnvironment() {
4450
return Environment.PRODUCTION;
4551
}
4652

4753
@Override
48-
public AbstractBitcoinNetParams getNetworkParameters() {
49-
return MainNetParams.get();
54+
public NetworkParameters getBitcoinParams() {
55+
return BitcoinMainNetParams.get();
56+
}
57+
58+
@Override
59+
public NetworkParameters getBitcoinCashParams() {
60+
return BitcoinCashMainNetParams.get();
5061
}
5162

5263
@Override
5364
public String getApiCode() {
54-
return null;
65+
return "Android-Integration-test";
5566
}
5667

5768
@Override
@@ -95,13 +106,13 @@ public void tearDownRxCalls() {
95106
RxJavaPlugins.reset();
96107
}
97108

98-
private static OkHttpClient getOkHttpClient() {
109+
public static OkHttpClient getOkHttpClient() {
99110
return new OkHttpClient.Builder()
100111
.addInterceptor(new ApiInterceptor())//Extensive logging
101112
.build();
102113
}
103114

104-
private static Retrofit getRetrofit(String url, OkHttpClient client) {
115+
public static Retrofit getRetrofit(String url, OkHttpClient client) {
105116
return new Retrofit.Builder()
106117
.baseUrl(url)
107118
.client(client)

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,12 @@
22

33
import info.blockchain.wallet.BaseIntegTest;
44
import info.blockchain.wallet.api.data.FeeList;
5-
import info.blockchain.wallet.api.data.Merchant;
65
import info.blockchain.wallet.api.data.Status;
76

8-
import org.json.JSONObject;
97
import org.junit.Test;
108
import org.spongycastle.util.encoders.Hex;
119

1210
import java.security.SecureRandom;
13-
import java.util.List;
1411

1512
import io.reactivex.observers.TestObserver;
1613
import okhttp3.ResponseBody;
@@ -30,16 +27,6 @@ public class WalletApiIntegTest extends BaseIntegTest {
3027
private String sharedKey = "b4ff6bf5-17a9-4905-b54b-a526816aa100";
3128
private WalletApi walletApi = new WalletApi();
3229

33-
@Test
34-
public void getDynamicFee() throws Exception {
35-
final TestObserver<FeeList> testObserver = walletApi.getDynamicFee().test();
36-
37-
testObserver.assertComplete();
38-
testObserver.assertNoErrors();
39-
assertNotNull(testObserver.values().get(0));
40-
assertNotNull(testObserver.values().get(0).toJson());
41-
}
42-
4330
@Test
4431
public void getRandomBytesCall() throws Exception {
4532
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)