change grapheneapigenerator to be used with steem

This commit is contained in:
hvarona 2018-11-11 23:06:09 -04:00
parent 9c6db3a6ea
commit 14a405f67c
4 changed files with 44 additions and 89 deletions

View file

@ -1,7 +1,6 @@
package cy.agorise.crystalwallet.apigenerator; package cy.agorise.crystalwallet.apigenerator;
import android.content.Context; import android.content.Context;
import android.util.Log;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
@ -9,7 +8,6 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import cy.agorise.crystalwallet.application.constant.BitsharesConstant;
import cy.agorise.crystalwallet.dao.BitsharesAssetDao; import cy.agorise.crystalwallet.dao.BitsharesAssetDao;
import cy.agorise.crystalwallet.dao.CryptoCoinBalanceDao; import cy.agorise.crystalwallet.dao.CryptoCoinBalanceDao;
import cy.agorise.crystalwallet.dao.CryptoCurrencyDao; import cy.agorise.crystalwallet.dao.CryptoCurrencyDao;
@ -107,7 +105,7 @@ public abstract class GrapheneApiGenerator {
* @param accountId The accountId to retrieve * @param accountId The accountId to retrieve
* @param request The Api request object, to answer this petition * @param request The Api request object, to answer this petition
*/ */
public static void getAccountById(String accountId, final ApiRequest request){ public static void getAccountById(String accountId, CryptoNet cryptoNet, final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new GetAccounts(accountId, WebSocketThread thread = new WebSocketThread(new GetAccounts(accountId,
new WitnessResponseListener() { new WitnessResponseListener() {
@Override @Override
@ -128,7 +126,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -138,7 +136,7 @@ public abstract class GrapheneApiGenerator {
* @param address The address to retrieve * @param address The address to retrieve
* @param request The Api request object, to answer this petition * @param request The Api request object, to answer this petition
*/ */
public static void getAccountByOwnerOrActiveAddress(Address address, final ApiRequest request){ public static void getAccountByOwnerOrActiveAddress(Address address, CryptoNet cryptoNet, final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new GetKeyReferences(address, true, WebSocketThread thread = new WebSocketThread(new GetKeyReferences(address, true,
new WitnessResponseListener() { new WitnessResponseListener() {
@Override @Override
@ -168,7 +166,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -205,7 +203,7 @@ public abstract class GrapheneApiGenerator {
* @param accountName The account Name to find * @param accountName The account Name to find
* @param request The Api request object, to answer this petition * @param request The Api request object, to answer this petition
*/ */
public static void getAccountByName(String accountName, final ApiRequest request){ public static void getAccountByName(String accountName, CryptoNet cryptoNet,final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new GetAccountByName(accountName, WebSocketThread thread = new WebSocketThread(new GetAccountByName(accountName,
new WitnessResponseListener() { new WitnessResponseListener() {
@Override @Override
@ -222,7 +220,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -232,7 +230,7 @@ public abstract class GrapheneApiGenerator {
* @param accountName The account Name to find * @param accountName The account Name to find
* @param request The Api request object, to answer this petition * @param request The Api request object, to answer this petition
*/ */
public static void getAccountIdByName(String accountName, final ApiRequest request){ public static void getAccountIdByName(String accountName, CryptoNet cryptoNet, final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new GetAccountByName(accountName, WebSocketThread thread = new WebSocketThread(new GetAccountByName(accountName,
new WitnessResponseListener() { new WitnessResponseListener() {
@Override @Override
@ -249,7 +247,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -283,7 +281,7 @@ public abstract class GrapheneApiGenerator {
* @param assetNames The list of the names of the assets to be retrieve * @param assetNames The list of the names of the assets to be retrieve
* @param request the api request object, to answer this petition * @param request the api request object, to answer this petition
*/ */
public static void getAssetByName(ArrayList<String> assetNames, final ApiRequest request){ public static void getAssetByName(ArrayList<String> assetNames, CryptoNet cryptoNet,final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new LookupAssetSymbols(assetNames,true, WebSocketThread thread = new WebSocketThread(new LookupAssetSymbols(assetNames,true,
new WitnessResponseListener() { new WitnessResponseListener() {
@ -318,7 +316,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -327,7 +325,7 @@ public abstract class GrapheneApiGenerator {
* @param assetIds The list of the ids to retrieve * @param assetIds The list of the ids to retrieve
* @param request the api request object, to answer this petition * @param request the api request object, to answer this petition
*/ */
public static void getAssetById(ArrayList<String> assetIds, final ApiRequest request){ public static void getAssetById(ArrayList<String> assetIds, CryptoNet cryptoNet, final ApiRequest request){
ArrayList<Asset> assets = new ArrayList<>(); ArrayList<Asset> assets = new ArrayList<>();
for(String assetId : assetIds){ for(String assetId : assetIds){
Asset asset = new Asset(assetId); Asset asset = new Asset(assetId);
@ -366,7 +364,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -438,7 +436,7 @@ public abstract class GrapheneApiGenerator {
}); });
ArrayList<String> assets = new ArrayList<>(); ArrayList<String> assets = new ArrayList<>();
assets.add(tOperation.getAssetAmount().getAsset().getObjectId()); assets.add(tOperation.getAssetAmount().getAsset().getObjectId());
GrapheneApiGenerator.getAssetById(assets,assetRequest); GrapheneApiGenerator.getAssetById(assets,CryptoNet.BITSHARES,assetRequest);
}else{ }else{
saveTransaction(transaction,cryptoCurrencyDao.getById(info.getCryptoCurrencyId()),accountBitsharesId,tOperation,context); saveTransaction(transaction,cryptoCurrencyDao.getById(info.getCryptoCurrencyId()),accountBitsharesId,tOperation,context);
} }
@ -531,7 +529,7 @@ public abstract class GrapheneApiGenerator {
}); });
ArrayList<String> assets = new ArrayList<>(); ArrayList<String> assets = new ArrayList<>();
assets.add(tOperation.getAssetAmount().getAsset().getObjectId()); assets.add(tOperation.getAssetAmount().getAsset().getObjectId());
GrapheneApiGenerator.getAssetById(assets,assetRequest); GrapheneApiGenerator.getAssetById(assets,CryptoNet.STEEM,assetRequest);
}else{ }else{
saveTransaction(transaction,cryptoCurrencyDao.getById(info.getCryptoCurrencyId()),accountSteemId,tOperation,context); saveTransaction(transaction,cryptoCurrencyDao.getById(info.getCryptoCurrencyId()),accountSteemId,tOperation,context);
} }
@ -594,7 +592,7 @@ public abstract class GrapheneApiGenerator {
* @param context The android context of this application * @param context The android context of this application
*/ */
public static void getAccountBalance(final long accountId, final String accountGrapheneId, public static void getAccountBalance(final long accountId, final String accountGrapheneId,
CryptoNet cryptoNet, final Context context){ final CryptoNet cryptoNet, final Context context){
CrystalDatabase db = CrystalDatabase.getAppDatabase(context); CrystalDatabase db = CrystalDatabase.getAppDatabase(context);
final CryptoCoinBalanceDao balanceDao = db.cryptoCoinBalanceDao(); final CryptoCoinBalanceDao balanceDao = db.cryptoCoinBalanceDao();
@ -640,7 +638,7 @@ public abstract class GrapheneApiGenerator {
public void fail(int idPetition) { public void fail(int idPetition) {
} }
}); });
getAssetById(idAssets,getAssetRequest); getAssetById(idAssets,cryptoNet,getAssetRequest);
}else { }else {
@ -666,7 +664,7 @@ public abstract class GrapheneApiGenerator {
* @param blockHeader The block header to retrieve the date time * @param blockHeader The block header to retrieve the date time
* @param request the api request object, to answer this petition * @param request the api request object, to answer this petition
*/ */
public static void getBlockHeaderTime(long blockHeader, final ApiRequest request){ public static void getBlockHeaderTime(long blockHeader, CryptoNet cryptoNet,final ApiRequest request){
WebSocketThread thread = new WebSocketThread(new GetBlockHeader(blockHeader, new WitnessResponseListener() { WebSocketThread thread = new WebSocketThread(new GetBlockHeader(blockHeader, new WitnessResponseListener() {
@Override @Override
public void onSuccess(WitnessResponse response) { public void onSuccess(WitnessResponse response) {
@ -681,7 +679,7 @@ public abstract class GrapheneApiGenerator {
public void onError(BaseResponse.Error error) { public void onError(BaseResponse.Error error) {
request.getListener().fail(request.getId()); request.getListener().fail(request.getId());
} }
}),CryptoNetManager.getURL(CryptoNet.BITSHARES)); }),CryptoNetManager.getURL(cryptoNet));
thread.start(); thread.start();
} }
@ -784,7 +782,7 @@ public abstract class GrapheneApiGenerator {
}); });
ArrayList<String> names = new ArrayList<>(); ArrayList<String> names = new ArrayList<>();
names.add(baseAssetName); names.add(baseAssetName);
GrapheneApiGenerator.getAssetByName(names,getAssetRequest); GrapheneApiGenerator.getAssetByName(names,CryptoNet.BITSHARES,getAssetRequest);
}else { }else {
BitsharesAsset baseAsset = new BitsharesAsset(baseCurrency); BitsharesAsset baseAsset = new BitsharesAsset(baseCurrency);

View file

@ -306,7 +306,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED); importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED);
} }
}); });
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39); GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),CryptoNet.BITSHARES,getAccountNamesBP39);
} }
}); });
@ -314,7 +314,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0); BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK); GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),CryptoNet.BITSHARES,getAccountNamesBK);
} }
@ -384,7 +384,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.NO_ACCOUNT_DATA); importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.NO_ACCOUNT_DATA);
} }
}); });
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo); GrapheneApiGenerator.getAccountById((String)answer,CryptoNet.BITSHARES,getAccountInfo);
} }
@Override @Override
@ -394,7 +394,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
} }
}); });
GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),checkAccountName); GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),CryptoNet.BITSHARES,checkAccountName);
} }
private void validateCreateAccount(final ValidateCreateBitsharesAccountRequest createRequest){ private void validateCreateAccount(final ValidateCreateBitsharesAccountRequest createRequest){
@ -449,7 +449,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
validateRequest.setAccountExists(false); validateRequest.setAccountExists(false);
} }
}); });
GrapheneApiGenerator.getAccountIdByName(validateRequest.getAccountName(),checkAccountName); GrapheneApiGenerator.getAccountIdByName(validateRequest.getAccountName(),CryptoNet.BITSHARES,checkAccountName);
} }
/** /**
@ -647,7 +647,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
AccountIdOrNameListener listener = new AccountIdOrNameListener(request); AccountIdOrNameListener listener = new AccountIdOrNameListener(request);
ApiRequest accountRequest = new ApiRequest(0, listener); ApiRequest accountRequest = new ApiRequest(0, listener);
GrapheneApiGenerator.getAccountById(grapheneId,accountRequest); GrapheneApiGenerator.getAccountById(grapheneId,CryptoNet.BITSHARES,accountRequest);
} }
/** /**
@ -659,7 +659,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
AccountIdOrNameListener listener = new AccountIdOrNameListener(request); AccountIdOrNameListener listener = new AccountIdOrNameListener(request);
ApiRequest accountRequest = new ApiRequest(0, listener); ApiRequest accountRequest = new ApiRequest(0, listener);
GrapheneApiGenerator.getAccountByName(grapheneName,accountRequest); GrapheneApiGenerator.getAccountByName(grapheneName,CryptoNet.BITSHARES,accountRequest);
} }
@ -670,7 +670,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
ApiRequest assetRequest = new ApiRequest(0, nameListener); ApiRequest assetRequest = new ApiRequest(0, nameListener);
ArrayList<String> assetNames = new ArrayList<>(); ArrayList<String> assetNames = new ArrayList<>();
assetNames.add(assetName); assetNames.add(assetName);
GrapheneApiGenerator.getAssetByName(assetNames, assetRequest); GrapheneApiGenerator.getAssetByName(assetNames, CryptoNet.BITSHARES,assetRequest);
} }
@ -783,7 +783,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
}); });
ArrayList<String> assets = new ArrayList<>(); ArrayList<String> assets = new ArrayList<>();
assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId()); assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId());
GrapheneApiGenerator.getAssetById(assets,assetRequest); GrapheneApiGenerator.getAssetById(assets,CryptoNet.BITSHARES,assetRequest);
}else{ }else{
saveTransaction(transaction,info,transfer); saveTransaction(transaction,info,transfer);
@ -812,7 +812,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId())); transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId()));
transaction.setTo(transfer.getOperation().getTo().getObjectId()); transaction.setTo(transfer.getOperation().getTo().getObjectId());
GrapheneApiGenerator.getBlockHeaderTime(transfer.getBlockNum(), new ApiRequest(0, new GetTransactionDate(transaction, db.transactionDao()))); GrapheneApiGenerator.getBlockHeaderTime(transfer.getBlockNum(),CryptoNet.BITSHARES, new ApiRequest(0, new GetTransactionDate(transaction, db.transactionDao())));
} }
} }

View file

@ -465,7 +465,7 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf
CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext()); CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext());
long index = db.bitcoinAddressDao().getLastExternalAddress(request.getAccount().getId()); long index = db.bitcoinAddressDao().getLastExternalAddress(request.getAccount().getId());
BitcoinAddress address = db.bitcoinAddressDao().getExternalByIndex(index); BitcoinAddress address = db.bitcoinAddressDao().getExternalByIndex(index);
if(db.bitcoinTransactionDao().getGtxIOByAddress(address.getAddress()).size()<=0){ if(address != null && db.bitcoinTransactionDao().getGtxIOByAddress(address.getAddress()).size()<=0){
request.setAddress(address.getAddress()); request.setAddress(address.getAddress());
request.setStatus(NextBitcoinAccountAddressRequest.StatusCode.SUCCEEDED); request.setStatus(NextBitcoinAccountAddressRequest.StatusCode.SUCCEEDED);
}else { }else {

View file

@ -221,49 +221,14 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
} }
} }
@Override
public void fail(int idPetition) {
BIP39 bip39 = new BIP39(-1, importRequest.getMnemonic());
ApiRequest getAccountNamesBP39 = new ApiRequest(0, new ApiRequestListener() {
@Override
public void success(Object answer, int idPetition) {
if(answer != null && importRequest.getStatus().equals(ImportBitsharesAccountRequest.StatusCode.NOT_STARTED)) {
UserAccount userAccount = (UserAccount) answer;
importRequest.setSeedType(SeedType.BIP39);
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
AccountSeed seed = new AccountSeed();
seed.setName(userAccount.getName());
seed.setType(importRequest.getSeedType());
seed.setMasterSeed(importRequest.getMnemonic());
long idSeed = accountSeedDao.insertAccountSeed(seed);
if (idSeed >= 0) {
GrapheneAccount account = new GrapheneAccount();
account.setCryptoNet(CryptoNet.STEEM);
account.setAccountIndex(0);
account.setSeedId(idSeed);
account.setAccountId(userAccount.getObjectId());
importAccountFromSeed(account, importRequest.getContext());
}
}
}
@Override @Override
public void fail(int idPetition) { public void fail(int idPetition) {
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED); importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED);
} }
}); });
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39);
}
});
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0); BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("STM"),CryptoNet.STEEM,getAccountNamesBK);
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK);
} }
/** /**
@ -284,21 +249,13 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
AccountProperties prop = (AccountProperties) answer; AccountProperties prop = (AccountProperties) answer;
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0); BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
for(PublicKey activeKey : prop.owner.getKeyAuthList()){ for(PublicKey activeKey : prop.owner.getKeyAuthList()){
if((new Address(activeKey.getKey(),"BTS")).toString().equals(bk.getPublicAddress("BTS").toString())){ if((new Address(activeKey.getKey(),"STM")).toString().equals(bk.getPublicAddress("STM").toString())){
importRequest.setSeedType(SeedType.BRAINKEY); importRequest.setSeedType(SeedType.BRAINKEY);
importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED); importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
break; break;
} }
} }
BIP39 bip39 = new BIP39(-1, importRequest.getMnemonic());
for(PublicKey activeKey : prop.active.getKeyAuthList()){
if((new Address(activeKey.getKey(),"BTS")).toString().equals(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())).toString())){
importRequest.setSeedType(SeedType.BIP39);
importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
break;
}
}
if ((importRequest.getStatus() == ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)){ if ((importRequest.getStatus() == ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED)){
if (importRequest.addAccountIfValid()) { if (importRequest.addAccountIfValid()) {
@ -309,7 +266,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
long idSeed = accountSeedDao.insertAccountSeed(seed); long idSeed = accountSeedDao.insertAccountSeed(seed);
if (idSeed >= 0) { if (idSeed >= 0) {
GrapheneAccount account = new GrapheneAccount(); GrapheneAccount account = new GrapheneAccount();
account.setCryptoNet(CryptoNet.BITSHARES); account.setCryptoNet(CryptoNet.STEEM);
account.setAccountIndex(0); account.setAccountIndex(0);
account.setSeedId(idSeed); account.setSeedId(idSeed);
account.setName(importRequest.getAccountName()); account.setName(importRequest.getAccountName());
@ -331,7 +288,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.NO_ACCOUNT_DATA); importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.NO_ACCOUNT_DATA);
} }
}); });
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo); GrapheneApiGenerator.getAccountById((String)answer,CryptoNet.STEEM,getAccountInfo);
} }
@Override @Override
@ -341,7 +298,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
} }
}); });
GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),checkAccountName); GrapheneApiGenerator.getAccountIdByName(importRequest.getAccountName(),CryptoNet.STEEM,checkAccountName);
} }
/** /**
@ -366,7 +323,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
validateRequest.setAccountExists(false); validateRequest.setAccountExists(false);
} }
}); });
GrapheneApiGenerator.getAccountIdByName(validateRequest.getAccountName(),checkAccountName); GrapheneApiGenerator.getAccountIdByName(validateRequest.getAccountName(),CryptoNet.STEEM,checkAccountName);
} }
/** /**
@ -376,7 +333,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
//TODO check internet, server connection //TODO check internet, server connection
//TODO feeAsset //TODO feeAsset
CrystalDatabase db = CrystalDatabase.getAppDatabase(sendRequest.getContext()); CrystalDatabase db = CrystalDatabase.getAppDatabase(sendRequest.getContext());
CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(sendRequest.getAsset(), CryptoNet.BITSHARES.name()); CryptoCurrency currency = db.cryptoCurrencyDao().getByNameAndCryptoNet(sendRequest.getAsset(), CryptoNet.STEEM.name());
if (currency == null){ if (currency == null){
getAssetInfoByName(sendRequest.getAsset(), new ManagerRequest() { getAssetInfoByName(sendRequest.getAsset(), new ManagerRequest() {
@Override @Override
@ -475,7 +432,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
ECKey privateKey = sendRequest.getSourceAccount().getActiveKey(sendRequest.getContext()); ECKey privateKey = sendRequest.getSourceAccount().getActiveKey(sendRequest.getContext());
Transaction transaction = new Transaction(privateKey, null, operationList); Transaction transaction = new Transaction(privateKey, null, operationList);
transaction.setChainId(CryptoNetManager.getChaindId(CryptoNet.BITSHARES)); transaction.setChainId(CryptoNetManager.getChaindId(CryptoNet.STEEM));
ApiRequest transactionRequest = new ApiRequest(0, new ApiRequestListener() { ApiRequest transactionRequest = new ApiRequest(0, new ApiRequestListener() {
@Override @Override
@ -527,7 +484,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
AccountIdOrNameListener listener = new AccountIdOrNameListener(request); AccountIdOrNameListener listener = new AccountIdOrNameListener(request);
ApiRequest accountRequest = new ApiRequest(0, listener); ApiRequest accountRequest = new ApiRequest(0, listener);
GrapheneApiGenerator.getAccountById(grapheneId,accountRequest); GrapheneApiGenerator.getAccountById(grapheneId,CryptoNet.STEEM,accountRequest);
} }
/** /**
@ -539,7 +496,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
AccountIdOrNameListener listener = new AccountIdOrNameListener(request); AccountIdOrNameListener listener = new AccountIdOrNameListener(request);
ApiRequest accountRequest = new ApiRequest(0, listener); ApiRequest accountRequest = new ApiRequest(0, listener);
GrapheneApiGenerator.getAccountByName(grapheneName,accountRequest); GrapheneApiGenerator.getAccountByName(grapheneName,CryptoNet.STEEM,accountRequest);
} }
@ -550,7 +507,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
ApiRequest assetRequest = new ApiRequest(0, nameListener); ApiRequest assetRequest = new ApiRequest(0, nameListener);
ArrayList<String> assetNames = new ArrayList<>(); ArrayList<String> assetNames = new ArrayList<>();
assetNames.add(assetName); assetNames.add(assetName);
GrapheneApiGenerator.getAssetByName(assetNames, assetRequest); GrapheneApiGenerator.getAssetByName(assetNames, CryptoNet.STEEM, assetRequest);
} }
@ -663,7 +620,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
}); });
ArrayList<String> assets = new ArrayList<>(); ArrayList<String> assets = new ArrayList<>();
assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId()); assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId());
GrapheneApiGenerator.getAssetById(assets,assetRequest); GrapheneApiGenerator.getAssetById(assets,CryptoNet.STEEM,assetRequest);
}else{ }else{
saveTransaction(transaction,info,transfer); saveTransaction(transaction,info,transfer);
@ -692,7 +649,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId())); transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId()));
transaction.setTo(transfer.getOperation().getTo().getObjectId()); transaction.setTo(transfer.getOperation().getTo().getObjectId());
GrapheneApiGenerator.getBlockHeaderTime(transfer.getBlockNum(), new ApiRequest(0, new GetTransactionDate(transaction, db.transactionDao()))); GrapheneApiGenerator.getBlockHeaderTime(transfer.getBlockNum(), CryptoNet.STEEM,new ApiRequest(0, new GetTransactionDate(transaction, db.transactionDao())));
} }
} }