Merge branch 'master' of https://github.com/Agorise/crystal-wallet-android
This commit is contained in:
commit
41b054c9bf
7 changed files with 98 additions and 18 deletions
|
@ -1,7 +1,9 @@
|
|||
package cy.agorise.crystalwallet.dao;
|
||||
|
||||
import android.arch.persistence.db.SupportSQLiteDatabase;
|
||||
import android.arch.persistence.room.*;
|
||||
import android.arch.persistence.room.Database;
|
||||
import android.arch.persistence.room.Room;
|
||||
import android.arch.persistence.room.RoomDatabase;
|
||||
import android.arch.persistence.room.migration.Migration;
|
||||
import android.content.Context;
|
||||
|
||||
|
@ -10,6 +12,7 @@ import cy.agorise.crystalwallet.models.CryptoCoinTransaction;
|
|||
import cy.agorise.crystalwallet.models.CryptoNetAccount;
|
||||
|
||||
/**
|
||||
* Manage the Database
|
||||
* Created by Henry Varona on 4/9/2017.
|
||||
*/
|
||||
|
||||
|
|
|
@ -7,23 +7,22 @@ import java.io.Serializable;
|
|||
*/
|
||||
|
||||
public enum CryptoCoin implements Serializable {
|
||||
BITCOIN(CryptoNet.BITCOIN,"BTC",8,6),
|
||||
BITCOIN_TEST(CryptoNet.BITCOIN_TEST,"BTC",8,6),
|
||||
LITECOIN(CryptoNet.LITECOIN,"LTC",8,6),
|
||||
DASH(CryptoNet.DASH,"DASH",8,6),
|
||||
DOGECOIN(CryptoNet.DOGECOIN,"DOGE",8,6),
|
||||
BITSHARES(CryptoNet.BITSHARES,"BTS",8,6);
|
||||
BITCOIN(CryptoNet.BITCOIN,"BTC",8),
|
||||
BITCOIN_TEST(CryptoNet.BITCOIN_TEST,"BTC",8),
|
||||
LITECOIN(CryptoNet.LITECOIN,"LTC",8),
|
||||
DASH(CryptoNet.DASH,"DASH",8),
|
||||
DOGECOIN(CryptoNet.DOGECOIN,"DOGE",8),
|
||||
BITSHARES(CryptoNet.BITSHARES,"BTS",8);
|
||||
|
||||
protected CryptoNet cryptoNet;
|
||||
protected String label;
|
||||
protected int precision;
|
||||
protected int confirmationsNeeded;
|
||||
|
||||
CryptoCoin(CryptoNet cryptoNet, String label, int precision, int confirmationsNeeded){
|
||||
CryptoCoin(CryptoNet cryptoNet, String label, int precision){
|
||||
this.cryptoNet = cryptoNet;
|
||||
this.label = label;
|
||||
this.precision = precision;
|
||||
this.confirmationsNeeded = confirmationsNeeded;
|
||||
|
||||
}
|
||||
|
||||
public CryptoNet getCryptoNet(){
|
||||
|
@ -35,7 +34,5 @@ public enum CryptoCoin implements Serializable {
|
|||
public int getPrecision(){
|
||||
return this.precision;
|
||||
}
|
||||
public int getConfirmationsNeeded(){
|
||||
return this.confirmationsNeeded;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,19 +3,30 @@ package cy.agorise.crystalwallet.enums;
|
|||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* CryptoNet Enumeration, a Crypto Net is define as the net where a CryptoCoin works, iniside the
|
||||
* CrypotNet is where the transaction and balance works, using the CryptoCoin Assets
|
||||
*
|
||||
* Created by Henry Varona on 12/9/2017.
|
||||
*/
|
||||
|
||||
public enum CryptoNet implements Serializable {
|
||||
BITCOIN("BITCOIN"), BITCOIN_TEST("BITCOIN(TEST)"), LITECOIN("LITECOIN"), DASH("DASH"), DOGECOIN("DOGECOIN"), BITSHARES("BITSHARES");
|
||||
BITCOIN("BITCOIN",6), BITCOIN_TEST("BITCOIN(TEST)",6), LITECOIN("LITECOIN",6), DASH("DASH",6), DOGECOIN("DOGECOIN",6), BITSHARES("BITSHARES",1), STEEM("STEEN",1);
|
||||
|
||||
protected String label;
|
||||
|
||||
CryptoNet(String label){
|
||||
protected int confirmationsNeeded;
|
||||
|
||||
|
||||
CryptoNet(String label,int confirmationsNeeded){
|
||||
this.label = label;
|
||||
this.confirmationsNeeded = confirmationsNeeded;
|
||||
}
|
||||
|
||||
public String getLabel(){
|
||||
return this.label;
|
||||
}
|
||||
|
||||
public int getConfirmationsNeeded(){
|
||||
return this.confirmationsNeeded;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,34 @@
|
|||
package cy.agorise.crystalwallet.models;
|
||||
|
||||
import android.arch.persistence.room.*;
|
||||
|
||||
import android.arch.persistence.room.ColumnInfo;
|
||||
import android.arch.persistence.room.Entity;
|
||||
import android.arch.persistence.room.PrimaryKey;
|
||||
|
||||
/**
|
||||
* Represents a type of crypto seed for HD wallets
|
||||
*
|
||||
* Created by Henry Varona on 6/9/2017.
|
||||
*/
|
||||
@Entity(tableName = "account_seed")
|
||||
public class AccountSeed {
|
||||
|
||||
/**
|
||||
* The id on the database
|
||||
*/
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int mId;
|
||||
|
||||
/**
|
||||
* The name or tag of this seed
|
||||
*/
|
||||
@ColumnInfo(name = "name")
|
||||
private String mName;
|
||||
|
||||
/**
|
||||
* The bytes of the master seed
|
||||
*/
|
||||
@ColumnInfo(name = "master_seed")
|
||||
private String mMasterSeed;
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package cy.agorise.crystalwallet.models;
|
||||
|
||||
/**
|
||||
* Represents each asset in transaction and balances
|
||||
*
|
||||
* Created by henry Henry Varona on 11/9/2017.
|
||||
*/
|
||||
|
||||
public class CryptoAsset {
|
||||
}
|
|
@ -9,26 +9,52 @@ import java.util.Date;
|
|||
import cy.agorise.crystalwallet.enums.CryptoCoin;
|
||||
|
||||
/**
|
||||
* Represents a generic CryptoNet Transaction
|
||||
*
|
||||
* Created by Henry Varona on 11/9/2017.
|
||||
*/
|
||||
@Entity(tableName="crypto_coin_transaction")
|
||||
public class CryptoCoinTransaction {
|
||||
|
||||
/**
|
||||
* The account associated with this transaction
|
||||
*/
|
||||
protected CryptoNetAccount account;
|
||||
|
||||
/**
|
||||
* The id on the database
|
||||
*/
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name="id")
|
||||
protected int id;
|
||||
/**
|
||||
* The full date of this transaction
|
||||
*/
|
||||
@ColumnInfo(name="date")
|
||||
protected Date date;
|
||||
/**
|
||||
* If this transaction is input of the account associated with it
|
||||
*/
|
||||
@ColumnInfo(name="is_input")
|
||||
protected boolean isInput;
|
||||
/**
|
||||
* The id of the account assoiciated, this is used for the foreign key definition
|
||||
*/
|
||||
@ColumnInfo(name="account_id")
|
||||
protected int accountId;
|
||||
/**
|
||||
* The amount of asset is moved in this transaction
|
||||
*/
|
||||
@ColumnInfo(name="amount")
|
||||
protected int amount;
|
||||
/**
|
||||
* The crypto Coin associated with this transaction
|
||||
*/
|
||||
@ColumnInfo(name="crypto_coin")
|
||||
protected CryptoCoin coin;
|
||||
/**
|
||||
* If this transaction is confirmed
|
||||
*/
|
||||
@ColumnInfo(name="is_confirmed")
|
||||
protected boolean isConfirmed;
|
||||
|
||||
|
|
|
@ -1,8 +1,15 @@
|
|||
package cy.agorise.crystalwallet.models;
|
||||
|
||||
import android.arch.persistence.room.*;
|
||||
|
||||
import android.arch.persistence.room.ColumnInfo;
|
||||
import android.arch.persistence.room.Entity;
|
||||
import android.arch.persistence.room.ForeignKey;
|
||||
import android.arch.persistence.room.Index;
|
||||
import android.arch.persistence.room.PrimaryKey;
|
||||
|
||||
/**
|
||||
* Represents a geneeric CryptoNet Account
|
||||
*
|
||||
* Created by Henry Varona on 6/9/2017.
|
||||
*/
|
||||
|
||||
|
@ -13,16 +20,28 @@ import android.arch.persistence.room.*;
|
|||
childColumns = "seed_id"))
|
||||
public class CryptoNetAccount {
|
||||
|
||||
/**
|
||||
* The id on the database
|
||||
*/
|
||||
@PrimaryKey(autoGenerate = true)
|
||||
@ColumnInfo(name = "id")
|
||||
private int mId;
|
||||
|
||||
/**
|
||||
* The id of the seed used by this account
|
||||
*/
|
||||
@ColumnInfo(name = "seed_id")
|
||||
private int mSeedId;
|
||||
|
||||
/**
|
||||
* The account number on the bip44 or slip44
|
||||
*/
|
||||
@ColumnInfo(name = "account_number")
|
||||
private int mAccountNumber;
|
||||
|
||||
/**
|
||||
* The account index
|
||||
*/
|
||||
@ColumnInfo(name = "account_index")
|
||||
private int mAccountIndex;
|
||||
|
||||
|
|
Loading…
Reference in a new issue