diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml
new file mode 100644
index 0000000..7f68460
--- /dev/null
+++ b/.idea/runConfigurations.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 5e78366..44843e8 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -13,7 +13,13 @@ android {
}
buildTypes {
release {
- minifyEnabled false
+ // Enables code shrinking, obfuscation, and optimization for only
+ // your project's release build type.
+ minifyEnabled true
+
+ // Enables resource shrinking, which is performed by the
+ // Android Gradle plugin.
+ shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index f1b4245..c576118 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -19,3 +19,8 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
+
+# To fix errors and force R8 to keep certain code, add a -keep line in the ProGuard rules file. For example:
+# -keep public class MyClass
+-dontwarn com.crux.sdk.**
+-keep class com.crux.sdk.** {*;}
\ No newline at end of file
diff --git a/app/src/main/java/com/example/liquid_test_2/MainActivity.java b/app/src/main/java/com/example/liquid_test_2/MainActivity.java
index 3c476cd..d41fd18 100644
--- a/app/src/main/java/com/example/liquid_test_2/MainActivity.java
+++ b/app/src/main/java/com/example/liquid_test_2/MainActivity.java
@@ -2,16 +2,18 @@
import android.content.Context;
import android.os.Bundle;
+import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import com.crux.sdk.CruxClient;
-import com.crux.sdk.model.CruxAddress;
-import com.crux.sdk.model.CruxClientError;
-import com.crux.sdk.model.CruxClientInitConfig;
-import com.crux.sdk.model.CruxClientResponseHandler;
-import com.crux.sdk.model.CruxIDState;
-import com.crux.sdk.model.CruxPutAddressMapSuccess;
+import com.crux.sdk.model.*;
+//import com.crux.sdk.model.CruxAddress;
+//import com.crux.sdk.model.CruxClientError;
+//import com.crux.sdk.model.CruxClientInitConfig;
+//import com.crux.sdk.model.CruxClientResponseHandler;
+//import com.crux.sdk.model.CruxIDState;
+//import com.crux.sdk.model.CruxPutAddressMapSuccess;
import java.io.IOException;
import java.util.HashMap;
@@ -38,7 +40,14 @@ public String runScript(final Context androidContextObject) throws IOException,
.setWalletClientName("cruxdev")
.setPrivateKey("cdf2d276caf0c9c34258ed6ebd0e60e0e8b3d9a7b8a9a717f2e19ed9b37f7c6f");
- final CruxClient client = new CruxClient(configBuilder, androidContextObject);
+ CruxClient client;
+ try {
+ client = new CruxClient(configBuilder, androidContextObject);
+ } catch(CruxClientError e) {
+ Toast.makeText(androidContextObject, "Client caught and reraised:" + e.errorMessage, Toast.LENGTH_LONG).show();
+ System.out.println("use debug version for development");
+ return null;
+ }
final String testAvailabilityCruxId = "yadu007";
client.isCruxIDAvailable(testAvailabilityCruxId, new CruxClientResponseHandler() {
@@ -55,7 +64,8 @@ public void onResponse(Boolean successResponse) {
@Override
public void onErrorResponse(CruxClientError failureResponse) {
- System.out.println(failureResponse);
+ System.err.println(failureResponse.errorCode);
+ System.err.println(failureResponse.errorMessage);
}
});
@@ -68,7 +78,8 @@ public void onResponse(Void successResponse) {
@Override
public void onErrorResponse(CruxClientError failureResponse) {
- System.out.println(failureResponse);
+ System.err.println(failureResponse.errorCode);
+ System.err.println(failureResponse.errorMessage);
}
});
@@ -81,7 +92,8 @@ public void onResponse(CruxIDState successResponse) {
@Override
public void onErrorResponse(CruxClientError failureResponse) {
- System.out.println(failureResponse);
+ System.err.println(failureResponse.errorCode);
+ System.err.println(failureResponse.errorMessage);
}
});
@@ -94,7 +106,8 @@ public void onResponse(HashMap successResponse) {
@Override
public void onErrorResponse(CruxClientError failureResponse) {
- System.out.println(failureResponse);
+ System.err.println(failureResponse.errorCode);
+ System.err.println(failureResponse.errorMessage);
}
});
@@ -123,7 +136,8 @@ public void onResponse(CruxPutAddressMapSuccess successResponse) {
@Override
public void onErrorResponse(CruxClientError failureResponse) {
- System.out.println(failureResponse);
+ System.err.println(failureResponse.errorCode);
+ System.err.println(failureResponse.errorMessage);
}
});
@@ -136,7 +150,7 @@ private HashMap getCurrencyMap() {
currencyMap.put("btc", new CruxAddress("1HX4KvtPdg9QUYwQE1kNqTAjmNaDG7w82V", null));
currencyMap.put("eth", new CruxAddress("0x0a2311594059b468c9897338b027c8782398b481", null));
currencyMap.put("tron", new CruxAddress("TG3iFaVvUs34SGpWq8RG9gnagDLTe1jdyz", null));
- currencyMap.put("xrp", new CruxAddress("rpfKAA2Ezqoq5wWo3XENdLYdZ8YGziz48h", "5555"));
+ currencyMap.put("xrp", new CruxAddress("rpfKAA2Ezqoq5wWo3XENdLYdZ8YGziz48h", "7777"));
return currencyMap;
}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 4fc2444..f1b2987 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -7,9 +7,11 @@
tools:context=".MainActivity">
- Liquid_Test_2
+ CRUX Android Sample
diff --git a/sdk/src/main/assets/cruxpay-0.1.10-security-fixes.js b/sdk/src/main/assets/cruxpay-0.1.10-security-fixes.js
new file mode 100644
index 0000000..7c15484
--- /dev/null
+++ b/sdk/src/main/assets/cruxpay-0.1.10-security-fixes.js
@@ -0,0 +1,113641 @@
+// modules are defined as an array
+// [ module function, map of requires ]
+//
+// map of requires is short require name -> numeric require
+//
+// anything defined in a previous bundle is accessed via the
+// orig method which is the require for previous bundles
+parcelRequire = (function (modules, cache, entry, globalName) {
+ // Save the require from previous bundle to this closure if any
+ var previousRequire = typeof parcelRequire === 'function' && parcelRequire;
+ var nodeRequire = typeof require === 'function' && require;
+
+ function newRequire(name, jumped) {
+ if (!cache[name]) {
+ if (!modules[name]) {
+ // if we cannot find the module within our internal map or
+ // cache jump to the current global require ie. the last bundle
+ // that was added to the page.
+ var currentRequire = typeof parcelRequire === 'function' && parcelRequire;
+ if (!jumped && currentRequire) {
+ return currentRequire(name, true);
+ }
+
+ // If there are other bundles on this page the require from the
+ // previous one is saved to 'previousRequire'. Repeat this as
+ // many times as there are bundles until the module is found or
+ // we exhaust the require chain.
+ if (previousRequire) {
+ return previousRequire(name, true);
+ }
+
+ // Try the node require function if it exists.
+ if (nodeRequire && typeof name === 'string') {
+ return nodeRequire(name);
+ }
+
+ var err = new Error('Cannot find module \'' + name + '\'');
+ err.code = 'MODULE_NOT_FOUND';
+ throw err;
+ }
+
+ localRequire.resolve = resolve;
+ localRequire.cache = {};
+
+ var module = cache[name] = new newRequire.Module(name);
+
+ modules[name][0].call(module.exports, localRequire, module, module.exports, this);
+ }
+
+ return cache[name].exports;
+
+ function localRequire(x){
+ return newRequire(localRequire.resolve(x));
+ }
+
+ function resolve(x){
+ return modules[name][1][x] || x;
+ }
+ }
+
+ function Module(moduleName) {
+ this.id = moduleName;
+ this.bundle = newRequire;
+ this.exports = {};
+ }
+
+ newRequire.isParcelRequire = true;
+ newRequire.Module = Module;
+ newRequire.modules = modules;
+ newRequire.cache = cache;
+ newRequire.parent = previousRequire;
+ newRequire.register = function (id, exports) {
+ modules[id] = [function (require, module) {
+ module.exports = exports;
+ }, {}];
+ };
+
+ var error;
+ for (var i = 0; i < entry.length; i++) {
+ try {
+ newRequire(entry[i]);
+ } catch (e) {
+ // Save first error but execute all entries
+ if (!error) {
+ error = e;
+ }
+ }
+ }
+
+ if (entry.length) {
+ // Expose entry point to Node, AMD or browser globals
+ // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
+ var mainExports = newRequire(entry[entry.length - 1]);
+
+ // CommonJS
+ if (typeof exports === "object" && typeof module !== "undefined") {
+ module.exports = mainExports;
+
+ // RequireJS
+ } else if (typeof define === "function" && define.amd) {
+ define(function () {
+ return mainExports;
+ });
+
+ //