change grapheneapigenerator to be used with steem
This commit is contained in:
parent
9c6db3a6ea
commit
14a405f67c
4 changed files with 44 additions and 89 deletions
|
@ -1,7 +1,6 @@
|
|||
package cy.agorise.crystalwallet.apigenerator;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
@ -9,7 +8,6 @@ import java.util.Date;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import cy.agorise.crystalwallet.application.constant.BitsharesConstant;
|
||||
import cy.agorise.crystalwallet.dao.BitsharesAssetDao;
|
||||
import cy.agorise.crystalwallet.dao.CryptoCoinBalanceDao;
|
||||
import cy.agorise.crystalwallet.dao.CryptoCurrencyDao;
|
||||
|
@ -107,7 +105,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param accountId The accountId to retrieve
|
||||
* @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,
|
||||
new WitnessResponseListener() {
|
||||
@Override
|
||||
|
@ -128,7 +126,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -138,7 +136,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param address The address to retrieve
|
||||
* @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,
|
||||
new WitnessResponseListener() {
|
||||
@Override
|
||||
|
@ -168,7 +166,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
|
||||
thread.start();
|
||||
}
|
||||
|
@ -205,7 +203,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param accountName The account Name to find
|
||||
* @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,
|
||||
new WitnessResponseListener() {
|
||||
@Override
|
||||
|
@ -222,7 +220,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -232,7 +230,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param accountName The account Name to find
|
||||
* @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,
|
||||
new WitnessResponseListener() {
|
||||
@Override
|
||||
|
@ -249,7 +247,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -283,7 +281,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param assetNames The list of the names of the assets to be retrieve
|
||||
* @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,
|
||||
new WitnessResponseListener() {
|
||||
|
@ -318,7 +316,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -327,7 +325,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param assetIds The list of the ids to retrieve
|
||||
* @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<>();
|
||||
for(String assetId : assetIds){
|
||||
Asset asset = new Asset(assetId);
|
||||
|
@ -366,7 +364,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
}
|
||||
|
||||
|
@ -438,7 +436,7 @@ public abstract class GrapheneApiGenerator {
|
|||
});
|
||||
ArrayList<String> assets = new ArrayList<>();
|
||||
assets.add(tOperation.getAssetAmount().getAsset().getObjectId());
|
||||
GrapheneApiGenerator.getAssetById(assets,assetRequest);
|
||||
GrapheneApiGenerator.getAssetById(assets,CryptoNet.BITSHARES,assetRequest);
|
||||
}else{
|
||||
saveTransaction(transaction,cryptoCurrencyDao.getById(info.getCryptoCurrencyId()),accountBitsharesId,tOperation,context);
|
||||
}
|
||||
|
@ -531,7 +529,7 @@ public abstract class GrapheneApiGenerator {
|
|||
});
|
||||
ArrayList<String> assets = new ArrayList<>();
|
||||
assets.add(tOperation.getAssetAmount().getAsset().getObjectId());
|
||||
GrapheneApiGenerator.getAssetById(assets,assetRequest);
|
||||
GrapheneApiGenerator.getAssetById(assets,CryptoNet.STEEM,assetRequest);
|
||||
}else{
|
||||
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
|
||||
*/
|
||||
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);
|
||||
final CryptoCoinBalanceDao balanceDao = db.cryptoCoinBalanceDao();
|
||||
|
@ -640,7 +638,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void fail(int idPetition) {
|
||||
}
|
||||
});
|
||||
getAssetById(idAssets,getAssetRequest);
|
||||
getAssetById(idAssets,cryptoNet,getAssetRequest);
|
||||
|
||||
}else {
|
||||
|
||||
|
@ -666,7 +664,7 @@ public abstract class GrapheneApiGenerator {
|
|||
* @param blockHeader The block header to retrieve the date time
|
||||
* @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() {
|
||||
@Override
|
||||
public void onSuccess(WitnessResponse response) {
|
||||
|
@ -681,7 +679,7 @@ public abstract class GrapheneApiGenerator {
|
|||
public void onError(BaseResponse.Error error) {
|
||||
request.getListener().fail(request.getId());
|
||||
}
|
||||
}),CryptoNetManager.getURL(CryptoNet.BITSHARES));
|
||||
}),CryptoNetManager.getURL(cryptoNet));
|
||||
thread.start();
|
||||
|
||||
}
|
||||
|
@ -784,7 +782,7 @@ public abstract class GrapheneApiGenerator {
|
|||
});
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
names.add(baseAssetName);
|
||||
GrapheneApiGenerator.getAssetByName(names,getAssetRequest);
|
||||
GrapheneApiGenerator.getAssetByName(names,CryptoNet.BITSHARES,getAssetRequest);
|
||||
|
||||
}else {
|
||||
BitsharesAsset baseAsset = new BitsharesAsset(baseCurrency);
|
||||
|
|
|
@ -306,7 +306,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
|||
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);
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo);
|
||||
GrapheneApiGenerator.getAccountById((String)answer,CryptoNet.BITSHARES,getAccountInfo);
|
||||
}
|
||||
|
||||
@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){
|
||||
|
@ -449,7 +449,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
|||
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);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
ArrayList<String> assetNames = new ArrayList<>();
|
||||
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<>();
|
||||
assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId());
|
||||
GrapheneApiGenerator.getAssetById(assets,assetRequest);
|
||||
GrapheneApiGenerator.getAssetById(assets,CryptoNet.BITSHARES,assetRequest);
|
||||
|
||||
}else{
|
||||
saveTransaction(transaction,info,transfer);
|
||||
|
@ -812,7 +812,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
|
|||
transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId()));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -465,7 +465,7 @@ public class GeneralAccountManager implements CryptoAccountManager, CryptoNetInf
|
|||
CrystalDatabase db = CrystalDatabase.getAppDatabase(request.getContext());
|
||||
long index = db.bitcoinAddressDao().getLastExternalAddress(request.getAccount().getId());
|
||||
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.setStatus(NextBitcoinAccountAddressRequest.StatusCode.SUCCEEDED);
|
||||
}else {
|
||||
|
|
|
@ -223,47 +223,12 @@ 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
|
||||
public void fail(int idPetition) {
|
||||
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED);
|
||||
}
|
||||
});
|
||||
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())),getAccountNamesBP39);
|
||||
importRequest.setStatus(ImportBitsharesAccountRequest.StatusCode.BAD_SEED);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
|
||||
|
||||
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("BTS"),getAccountNamesBK);
|
||||
|
||||
|
||||
GrapheneApiGenerator.getAccountByOwnerOrActiveAddress(bk.getPublicAddress("STM"),CryptoNet.STEEM,getAccountNamesBK);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -284,21 +249,13 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
AccountProperties prop = (AccountProperties) answer;
|
||||
BrainKey bk = new BrainKey(importRequest.getMnemonic(), 0);
|
||||
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.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.SUCCEEDED);
|
||||
|
||||
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.addAccountIfValid()) {
|
||||
|
@ -309,7 +266,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
long idSeed = accountSeedDao.insertAccountSeed(seed);
|
||||
if (idSeed >= 0) {
|
||||
GrapheneAccount account = new GrapheneAccount();
|
||||
account.setCryptoNet(CryptoNet.BITSHARES);
|
||||
account.setCryptoNet(CryptoNet.STEEM);
|
||||
account.setAccountIndex(0);
|
||||
account.setSeedId(idSeed);
|
||||
account.setName(importRequest.getAccountName());
|
||||
|
@ -331,7 +288,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
importRequest.setStatus(ValidateImportBitsharesAccountRequest.StatusCode.NO_ACCOUNT_DATA);
|
||||
}
|
||||
});
|
||||
GrapheneApiGenerator.getAccountById((String)answer,getAccountInfo);
|
||||
GrapheneApiGenerator.getAccountById((String)answer,CryptoNet.STEEM,getAccountInfo);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
});
|
||||
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 feeAsset
|
||||
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){
|
||||
getAssetInfoByName(sendRequest.getAsset(), new ManagerRequest() {
|
||||
@Override
|
||||
|
@ -475,7 +432,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
ECKey privateKey = sendRequest.getSourceAccount().getActiveKey(sendRequest.getContext());
|
||||
|
||||
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() {
|
||||
@Override
|
||||
|
@ -527,7 +484,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
AccountIdOrNameListener listener = new AccountIdOrNameListener(request);
|
||||
|
||||
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);
|
||||
|
||||
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);
|
||||
ArrayList<String> assetNames = new ArrayList<>();
|
||||
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<>();
|
||||
assets.add(transfer.getOperation().getAssetAmount().getAsset().getObjectId());
|
||||
GrapheneApiGenerator.getAssetById(assets,assetRequest);
|
||||
GrapheneApiGenerator.getAssetById(assets,CryptoNet.STEEM,assetRequest);
|
||||
|
||||
}else{
|
||||
saveTransaction(transaction,info,transfer);
|
||||
|
@ -692,7 +649,7 @@ public class SteemAccountManager implements CryptoAccountManager, CryptoNetInfoR
|
|||
transaction.setInput(!transfer.getOperation().getFrom().getObjectId().equals(account.getAccountId()));
|
||||
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())));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue