1
0
Fork 0
forked from lthn/blockchain
This commit is contained in:
wildkif 2019-01-22 14:24:34 +02:00
parent 1b6ba99605
commit 5ccdc59c48
11 changed files with 87 additions and 89 deletions

View file

@ -62,8 +62,8 @@
"PASS": "Wallet password",
"BUTTON": "Open wallet",
"WITH_ADDRESS_ALREADY_OPEN": "A wallet with this address is already open",
"SAFE_FILE_NOT_FOUND1": "Wallet file not found",
"SAFE_FILE_NOT_FOUND2": "<br/><br/> It might have been renamed or moved. <br/> To open it, use the \"Open wallet\" button."
"FILE_NOT_FOUND1": "Wallet file not found",
"FILE_NOT_FOUND2": "<br/><br/> It might have been renamed or moved. <br/> To open it, use the \"Open wallet\" button."
},
"RESTORE_WALLET": {
"LABEL_NAME": "Wallet name",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -120,15 +120,15 @@ export class Wallet {
}
prepareContractsAfterOpen(items: any[], exp_med_ts, height_app, viewedContracts, notViewedContracts): void {
const safe = this;
const wallet = this;
for (let i = 0; i < items.length; i++) {
const contract = items[i];
let contractTransactionExist = false;
if (safe && safe.history) {
contractTransactionExist = safe.history.some(elem => elem.contract && elem.contract.length && elem.contract[0].contract_id === contract.contract_id);
if (wallet && wallet.history) {
contractTransactionExist = wallet.history.some(elem => elem.contract && elem.contract.length && elem.contract[0].contract_id === contract.contract_id);
}
if (!contractTransactionExist && safe && safe.excluded_history) {
contractTransactionExist = safe.excluded_history.some(elem => elem.contract && elem.contract.length && elem.contract[0].contract_id === contract.contract_id);
if (!contractTransactionExist && wallet && wallet.excluded_history) {
contractTransactionExist = wallet.excluded_history.some(elem => elem.contract && elem.contract.length && elem.contract[0].contract_id === contract.contract_id);
}
if (!contractTransactionExist) {
@ -196,7 +196,7 @@ export class Wallet {
contract['private_detailes'].a_pledge = contract['private_detailes'].a_pledge.plus(contract['private_detailes'].to_pay);
safe.contracts.push(contract);
wallet.contracts.push(contract);
}
this.recountNewContracts();
}

View file

@ -342,7 +342,7 @@ export class BackendService {
this.runCommand('close_wallet', {wallet_id: wallet_id}, callback);
}
getSmartSafeInfo(wallet_id, callback) {
getSmartWalletInfo(wallet_id, callback) {
this.runCommand('get_smart_safe_info', {wallet_id: +wallet_id}, callback);
}

View file

@ -89,7 +89,7 @@ export class AppComponent implements OnInit, OnDestroy {
wallet.loaded = true;
}
if (wallet_state === 3) { // error
// safe.error = true;
// wallet.error = true;
}
wallet.balance = data.balance;
wallet.unlocked_balance = data.unlocked_balance;
@ -156,27 +156,27 @@ export class AppComponent implements OnInit, OnDestroy {
const wallet_id = data.wallet_id;
const tr_info = data.ti;
const safe = this.variablesService.getWallet(wallet_id);
const wallet = this.variablesService.getWallet(wallet_id);
if (safe) {
if (wallet) {
this.ngZone.run(() => {
if (!safe.loaded) {
safe.balance = data.balance;
safe.unlocked_balance = data.unlocked_balance;
if (!wallet.loaded) {
wallet.balance = data.balance;
wallet.unlocked_balance = data.unlocked_balance;
} else {
safe.balance = data.balance;
safe.unlocked_balance = data.unlocked_balance;
wallet.balance = data.balance;
wallet.unlocked_balance = data.unlocked_balance;
}
if (tr_info.tx_type === 6) {
this.variablesService.setRefreshStacking(wallet_id);
}
let tr_exists = safe.excluded_history.some(elem => elem.tx_hash === tr_info.tx_hash);
tr_exists = (!tr_exists) ? safe.history.some(elem => elem.tx_hash === tr_info.tx_hash) : tr_exists;
let tr_exists = wallet.excluded_history.some(elem => elem.tx_hash === tr_info.tx_hash);
tr_exists = (!tr_exists) ? wallet.history.some(elem => elem.tx_hash === tr_info.tx_hash) : tr_exists;
safe.prepareHistory([tr_info]);
wallet.prepareHistory([tr_info]);
if (tr_info.hasOwnProperty('contract')) {
const exp_med_ts = this.variablesService.exp_med_ts;
@ -185,12 +185,12 @@ export class AppComponent implements OnInit, OnDestroy {
const contract = tr_info.contract[0];
if (tr_exists) {
for (let i = 0; i < safe.contracts.length; i++) {
if (safe.contracts[i].contract_id === contract.contract_id && safe.contracts[i].is_a === contract.is_a) {
safe.contracts[i].cancel_expiration_time = contract.cancel_expiration_time;
safe.contracts[i].expiration_time = contract.expiration_time;
safe.contracts[i].height = contract.height;
safe.contracts[i].timestamp = contract.timestamp;
for (let i = 0; i < wallet.contracts.length; i++) {
if (wallet.contracts[i].contract_id === contract.contract_id && wallet.contracts[i].is_a === contract.is_a) {
wallet.contracts[i].cancel_expiration_time = contract.cancel_expiration_time;
wallet.contracts[i].expiration_time = contract.expiration_time;
wallet.contracts[i].height = contract.height;
wallet.contracts[i].timestamp = contract.timestamp;
break;
}
}
@ -259,11 +259,11 @@ export class AppComponent implements OnInit, OnDestroy {
contract['private_detailes'].a_pledge = contract['private_detailes'].a_pledge.plus(contract['private_detailes'].to_pay);
let findContract = false;
for (let i = 0; i < safe.contracts.length; i++) {
if (safe.contracts[i].contract_id === contract.contract_id && safe.contracts[i].is_a === contract.is_a) {
for (let i = 0; i < wallet.contracts.length; i++) {
if (wallet.contracts[i].contract_id === contract.contract_id && wallet.contracts[i].is_a === contract.is_a) {
for (const prop in contract) {
if (contract.hasOwnProperty(prop)) {
safe.contracts[i][prop] = contract[prop];
wallet.contracts[i][prop] = contract[prop];
}
}
findContract = true;
@ -271,9 +271,9 @@ export class AppComponent implements OnInit, OnDestroy {
}
}
if (findContract === false) {
safe.contracts.push(contract);
wallet.contracts.push(contract);
}
safe.recountNewContracts();
wallet.recountNewContracts();
}
});
@ -291,8 +291,8 @@ export class AppComponent implements OnInit, OnDestroy {
//
// var wallet_id = data.wallet_id;
// var tr_info = data.ti;
// var safe = $rootScope.getSafeById(wallet_id);
// if (safe) {
// var wallet = $rootScope.getWalletById(wallet_id);
// if (wallet) {
// if ( tr_info.hasOwnProperty("contract") ){
// for (var i = 0; i < $rootScope.contracts.length; i++) {
// if ($rootScope.contracts[i].contract_id === tr_info.contract[0].contract_id && $rootScope.contracts[i].is_a === tr_info.contract[0].is_a) {
@ -305,9 +305,9 @@ export class AppComponent implements OnInit, OnDestroy {
// }
// }
// }
// angular.forEach(safe.history, function (tr_item, key) {
// angular.forEach(wallet.history, function (tr_item, key) {
// if (tr_item.tx_hash === tr_info.tx_hash) {
// safe.history.splice(key, 1);
// wallet.history.splice(key, 1);
// }
// });
//
@ -315,7 +315,7 @@ export class AppComponent implements OnInit, OnDestroy {
// switch (tr_info.tx_type) {
// case 0:
// error_tr = $filter('translate')('ERROR_GUI_TX_TYPE_NORMAL') + '<br>' +
// tr_info.tx_hash + '<br>' + safe.name + '<br>' + safe.address + '<br>' +
// tr_info.tx_hash + '<br>' + wallet.name + '<br>' + wallet.address + '<br>' +
// $filter('translate')('ERROR_GUI_TX_TYPE_NORMAL_TO') + ' ' + $rootScope.moneyParse(tr_info.amount) + ' ' +
// $filter('translate')('ERROR_GUI_TX_TYPE_NORMAL_END');
// informer.error(error_tr);
@ -331,13 +331,13 @@ export class AppComponent implements OnInit, OnDestroy {
// break;
// case 4:
// error_tr = $filter('translate')('ERROR_GUI_TX_TYPE_NEW_ALIAS') + '<br>' +
// tr_info.tx_hash + '<br>' + safe.name + '<br>' + safe.address + '<br>' +
// tr_info.tx_hash + '<br>' + wallet.name + '<br>' + wallet.address + '<br>' +
// $filter('translate')('ERROR_GUI_TX_TYPE_NEW_ALIAS_END');
// informer.error(error_tr);
// break;
// case 5:
// error_tr = $filter('translate')('ERROR_GUI_TX_TYPE_UPDATE_ALIAS') + '<br>' +
// tr_info.tx_hash + '<br>' + safe.name + '<br>' + safe.address + '<br>' +
// tr_info.tx_hash + '<br>' + wallet.name + '<br>' + wallet.address + '<br>' +
// $filter('translate')('ERROR_GUI_TX_TYPE_NEW_ALIAS_END');
// informer.error(error_tr);
// break;

View file

@ -62,10 +62,9 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
if (this.openForm.valid) {
this.backend.openWallet(this.filePath, this.openForm.get('password').value, false, (open_status, open_data, open_error) => {
if (open_error && open_error === 'FILE_NOT_FOUND') {
let error_translate = this.translate.instant('OPEN_WALLET.SAFE_FILE_NOT_FOUND1');
// error_translate += ':<br>' + $scope.safe.path;
let error_translate = this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND1');
error_translate += ':<br>' + this.filePath;
error_translate += this.translate.instant('OPEN_WALLET.SAFE_FILE_NOT_FOUND2');
error_translate += this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND2');
this.modalService.prepareModal('error', error_translate);
} else {
if (open_status || open_error === 'FILE_RESTORED') {

View file

@ -109,7 +109,7 @@
<div class="purchase-states" *ngIf="!newPurchase">
<ng-container *ngIf="currentContract.state == 1 && !currentContract.is_a && currentContract.private_detailes.b_pledge.plus(('0.01' | moneyToInt)).plus(('0.01' | moneyToInt)).isGreaterThan(variablesService.currentWallet.unlocked_balance)">
<span>{{ 'There are insufficient funds in the safe. Add funds to the safe to continue' | translate }}</span>
<span>{{ 'There are insufficient funds in the wallet. Add funds to the wallet to continue' | translate }}</span>
</ng-container>
<ng-container *ngIf="currentContract.is_a">

View file

@ -26,7 +26,7 @@ export class SeedPhraseComponent implements OnInit, OnDestroy {
this.queryRouting = this.route.queryParams.subscribe(params => {
if (params.wallet_id) {
this.wallet_id = params.wallet_id;
this.backend.getSmartSafeInfo(params.wallet_id, (status, data) => {
this.backend.getSmartWalletInfo(params.wallet_id, (status, data) => {
if (data.hasOwnProperty('restore_key')) {
this.ngZone.run(() => {
this.seedPhrase = data['restore_key'].trim();

View file

@ -39,7 +39,7 @@ export class WalletDetailsComponent implements OnInit, OnDestroy {
this.showSeed = false;
this.detailsForm.get('name').setValue(this.variablesService.currentWallet.name);
this.detailsForm.get('path').setValue(this.variablesService.currentWallet.path);
this.backend.getSmartSafeInfo(this.variablesService.currentWallet.wallet_id, (status, data) => {
this.backend.getSmartWalletInfo(this.variablesService.currentWallet.wallet_id, (status, data) => {
if (data.hasOwnProperty('restore_key')) {
this.ngZone.run(() => {
this.seedPhrase = data['restore_key'].trim();

View file

@ -62,8 +62,8 @@
"PASS": "Wallet password",
"BUTTON": "Open wallet",
"WITH_ADDRESS_ALREADY_OPEN": "A wallet with this address is already open",
"SAFE_FILE_NOT_FOUND1": "Wallet file not found",
"SAFE_FILE_NOT_FOUND2": "<br/><br/> It might have been renamed or moved. <br/> To open it, use the \"Open wallet\" button."
"FILE_NOT_FOUND1": "Wallet file not found",
"FILE_NOT_FOUND2": "<br/><br/> It might have been renamed or moved. <br/> To open it, use the \"Open wallet\" button."
},
"RESTORE_WALLET": {
"LABEL_NAME": "Wallet name",