From aa3036163c09b6500c9c1ba37bc2420961f621ef Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Sat, 30 Sep 2017 14:37:36 -0500 Subject: [PATCH 1/3] Enabling multidex in order to prevent compilation problem --- app/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/app/build.gradle b/app/build.gradle index 34c1bfc..403a2dc 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,6 +16,7 @@ android { arguments = ["room.schemaLocation": "$projectDir/schemas".toString()] } } + multiDexEnabled true } buildTypes { release { From 23cac8c927dd09cc4388ad1171c543fa76cb7989 Mon Sep 17 00:00:00 2001 From: "Nelson R. Perez" Date: Sat, 30 Sep 2017 14:38:04 -0500 Subject: [PATCH 2/3] Fixed typo --- .../2.json | 247 ++++++++++++++++++ .../apigenerator/GrapheneApiGenerator.java | 10 +- 2 files changed, 252 insertions(+), 5 deletions(-) create mode 100644 app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/2.json diff --git a/app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/2.json b/app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/2.json new file mode 100644 index 0000000..2145cfe --- /dev/null +++ b/app/schemas/cy.agorise.crystalwallet.dao.CrystalDatabase/2.json @@ -0,0 +1,247 @@ +{ + "formatVersion": 1, + "database": { + "version": 2, + "identityHash": "e8e3aa452878e49fb9c7cfa99f356e4e", + "entities": [ + { + "tableName": "account_seed", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `master_seed` TEXT)", + "fields": [ + { + "fieldPath": "mId", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "mName", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "mMasterSeed", + "columnName": "master_seed", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "crypto_net_account", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `seed_id` INTEGER NOT NULL, `account_number` INTEGER NOT NULL, `account_index` INTEGER NOT NULL, FOREIGN KEY(`seed_id`) REFERENCES `account_seed`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )", + "fields": [ + { + "fieldPath": "mId", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "mSeedId", + "columnName": "seed_id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "mAccountNumber", + "columnName": "account_number", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "mAccountIndex", + "columnName": "account_index", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [ + { + "name": "index_crypto_net_account_id", + "unique": false, + "columnNames": [ + "id" + ], + "createSql": "CREATE INDEX `index_crypto_net_account_id` ON `${TABLE_NAME}` (`id`)" + }, + { + "name": "index_crypto_net_account_seed_id", + "unique": false, + "columnNames": [ + "seed_id" + ], + "createSql": "CREATE INDEX `index_crypto_net_account_seed_id` ON `${TABLE_NAME}` (`seed_id`)" + } + ], + "foreignKeys": [ + { + "table": "account_seed", + "onDelete": "NO ACTION", + "onUpdate": "NO ACTION", + "columns": [ + "seed_id" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "crypto_coin_transaction", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`account` INTEGER, `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `date` INTEGER, `is_input` INTEGER NOT NULL, `account_id` INTEGER NOT NULL, `amount` INTEGER NOT NULL, `id_currency` INTEGER NOT NULL, `is_confirmed` INTEGER NOT NULL, `from` TEXT, `to` TEXT, FOREIGN KEY(`account_id`) REFERENCES `crypto_net_account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`id_currency`) REFERENCES `crypto_currency`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "account", + "columnName": "account", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "id", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "date", + "columnName": "date", + "affinity": "INTEGER", + "notNull": false + }, + { + "fieldPath": "isInput", + "columnName": "is_input", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "accountId", + "columnName": "account_id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "amount", + "columnName": "amount", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "idCurrency", + "columnName": "id_currency", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isConfirmed", + "columnName": "is_confirmed", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "from", + "columnName": "from", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "to", + "columnName": "to", + "affinity": "TEXT", + "notNull": false + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [ + { + "table": "crypto_net_account", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "account_id" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "crypto_currency", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "id_currency" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "crypto_currency", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `name` TEXT, `crypto_net` TEXT, `precision` INTEGER NOT NULL)", + "fields": [ + { + "fieldPath": "mId", + "columnName": "id", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "mName", + "columnName": "name", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "mCryptoNet", + "columnName": "crypto_net", + "affinity": "TEXT", + "notNull": false + }, + { + "fieldPath": "mPrecision", + "columnName": "precision", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "columnNames": [ + "id" + ], + "autoGenerate": true + }, + "indices": [], + "foreignKeys": [] + } + ], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"e8e3aa452878e49fb9c7cfa99f356e4e\")" + ] + } +} \ No newline at end of file diff --git a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java index 8c5499a..b5a2362 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java +++ b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java @@ -4,6 +4,10 @@ import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFactory; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + import cy.agorise.graphenej.Address; import cy.agorise.graphenej.UserAccount; import cy.agorise.graphenej.api.GetAccounts; @@ -15,10 +19,6 @@ import cy.agorise.graphenej.models.BaseResponse; import cy.agorise.graphenej.models.HistoricalTransfer; import cy.agorise.graphenej.models.WitnessResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - /** * Created by henry on 26/9/2017. @@ -28,7 +28,7 @@ public class GrapheneApiGenerator { //TODO network connections private static int connectionTimeout = 5000; - private static String url = "http://128.0.69.157:8090" + private static String url = "http://128.0.69.157:8090"; /** * Retrieves the data of an account searching by it's id From eb3beb6e9a53893a1ec4f601a8ba050dabb43eec Mon Sep 17 00:00:00 2001 From: henry Date: Sun, 1 Oct 2017 22:18:56 -0400 Subject: [PATCH 3/3] Graphene api import acount --- .../cryptonetinforequests/CryptoNetInfoRequest.java | 2 +- .../CryptoNetInfoRequestsListener.java | 2 +- .../ValidateImportBitsharesAccountRequest.java | 2 +- .../manager/BitsharesAccountManager.java | 11 ++++++++++- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java index 3fb44ba..24c11e9 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequest.java @@ -6,7 +6,7 @@ import cy.agorise.crystalwallet.enums.CryptoCoin; * Created by Henry Varona on 1/10/2017. */ -abstract class CryptoNetInfoRequest { +public abstract class CryptoNetInfoRequest { protected CryptoCoin coin; protected CryptoNetInfoRequestListener listener; diff --git a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequestsListener.java b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequestsListener.java index 1c16bf3..05efb5f 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequestsListener.java +++ b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/CryptoNetInfoRequestsListener.java @@ -4,6 +4,6 @@ package cy.agorise.crystalwallet.cryptonetinforequests; * Created by Henry Varona on 1/10/2017. */ -interface CryptoNetInfoRequestsListener { +public interface CryptoNetInfoRequestsListener { public void onNewRequest(CryptoNetInfoRequest request); } diff --git a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateImportBitsharesAccountRequest.java b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateImportBitsharesAccountRequest.java index bdae7cf..b6cde09 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateImportBitsharesAccountRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/cryptonetinforequests/ValidateImportBitsharesAccountRequest.java @@ -6,7 +6,7 @@ import cy.agorise.crystalwallet.enums.CryptoCoin; * Created by Henry Varona on 1/10/2017. */ -class ValidateImportBitsharesAccountRequest extends CryptoNetInfoRequest { +public class ValidateImportBitsharesAccountRequest extends CryptoNetInfoRequest { private String accountName; private String mnemonic; diff --git a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java index 9d75dcc..7d66cce 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java +++ b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java @@ -1,12 +1,15 @@ package cy.agorise.crystalwallet.manager; +import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequest; +import cy.agorise.crystalwallet.cryptonetinforequests.CryptoNetInfoRequestsListener; +import cy.agorise.crystalwallet.cryptonetinforequests.ValidateImportBitsharesAccountRequest; import cy.agorise.crystalwallet.models.CryptoNetAccount; /** * Created by henry on 26/9/2017. */ -public class BitsharesAccountManager implements CryptoAccountManager { +public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetInfoRequestsListener { @Override public CryptoNetAccount createAccountFromSeed(CryptoNetAccount account) { return null; @@ -21,4 +24,10 @@ public class BitsharesAccountManager implements CryptoAccountManager { public void loadAccountFromDB(CryptoNetAccount account) { } + + @Override + public void onNewRequest(CryptoNetInfoRequest request) { + if (request instanceof ValidateImportBitsharesAccountRequest){ + } + } }