forked from lthn/blockchain
contract check same wallet address
This commit is contained in:
parent
702e157c38
commit
cc0881909c
6 changed files with 22 additions and 18 deletions
|
|
@ -4507,7 +4507,8 @@ var MainComponent = /** @class */ (function () {
|
|||
this.ngZone = ngZone;
|
||||
this.translate = translate;
|
||||
}
|
||||
MainComponent.prototype.ngOnInit = function () { };
|
||||
MainComponent.prototype.ngOnInit = function () {
|
||||
};
|
||||
MainComponent.prototype.openWallet = function () {
|
||||
var _this = this;
|
||||
this.backend.openFileDialog(this.translate.instant('MAIN.CHOOSE_PATH'), '*', this.variablesService.settings.default_path, function (file_status, file_data) {
|
||||
|
|
@ -4906,7 +4907,7 @@ var OpenWalletComponent = /** @class */ (function () {
|
|||
});
|
||||
if (exists_1) {
|
||||
_this.modalService.prepareModal('error', 'OPEN_WALLET.WITH_ADDRESS_ALREADY_OPEN');
|
||||
_this.backend.closeWallet(open_data.wallet_id, function (close_status, close_data) {
|
||||
_this.backend.closeWallet(open_data.wallet_id, function () {
|
||||
_this.ngZone.run(function () {
|
||||
_this.router.navigate(['/']);
|
||||
});
|
||||
|
|
@ -5080,9 +5081,12 @@ var PurchaseComponent = /** @class */ (function () {
|
|||
g.setErrors(Object.assign({ 'alias_not_valid': true }, g.errors));
|
||||
}
|
||||
else {
|
||||
_this.backend.getAliasByName(g.value.replace('@', ''), function (alias_status) {
|
||||
_this.backend.getAliasByName(g.value.replace('@', ''), function (alias_status, alias_data) {
|
||||
_this.ngZone.run(function () {
|
||||
if (alias_status) {
|
||||
if (alias_data.address === _this.variablesService.currentWallet.address) {
|
||||
g.setErrors(Object.assign({ 'address_same': true }, g.errors));
|
||||
}
|
||||
if (g.hasError('alias_not_valid')) {
|
||||
delete g.errors['alias_not_valid'];
|
||||
if (Object.keys(g.errors).length === 0) {
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, NgZone, OnInit, OnDestroy} from '@angular/core';
|
||||
import {FormGroup, FormControl, Validators} from '@angular/forms';
|
||||
import {FormGroup, FormControl} from '@angular/forms';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import {Component, NgZone, OnInit} from '@angular/core';
|
||||
import {Location} from "@angular/common";
|
||||
import {Location} from '@angular/common';
|
||||
import {BackendService} from '../_helpers/services/backend.service';
|
||||
import {VariablesService} from '../_helpers/services/variables.service';
|
||||
import {Router} from '@angular/router';
|
||||
|
|
@ -19,9 +19,11 @@ export class MainComponent implements OnInit {
|
|||
private variablesService: VariablesService,
|
||||
private ngZone: NgZone,
|
||||
private translate: TranslateService
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit() {}
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
openWallet() {
|
||||
this.backend.openFileDialog(this.translate.instant('MAIN.CHOOSE_PATH'), '*', this.variablesService.settings.default_path, (file_status, file_data) => {
|
||||
|
|
@ -41,7 +43,7 @@ export class MainComponent implements OnInit {
|
|||
}
|
||||
|
||||
back() {
|
||||
this.location.back()
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
|
|||
|
||||
if (exists) {
|
||||
this.modalService.prepareModal('error', 'OPEN_WALLET.WITH_ADDRESS_ALREADY_OPEN');
|
||||
this.backend.closeWallet(open_data.wallet_id, (close_status, close_data) => {
|
||||
this.backend.closeWallet(open_data.wallet_id, () => {
|
||||
this.ngZone.run(() => {
|
||||
this.router.navigate(['/']);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import {VariablesService} from '../_helpers/services/variables.service';
|
|||
import {ModalService} from '../_helpers/services/modal.service';
|
||||
import {Location} from '@angular/common';
|
||||
import {IntToMoneyPipe} from '../_helpers/pipes/int-to-money.pipe';
|
||||
import {TranslateService} from '@ngx-translate/core';
|
||||
import {BigNumber} from 'bignumber.js';
|
||||
|
||||
@Component({
|
||||
|
|
@ -60,9 +59,12 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
if (!(/^@?[a-z0-9\.\-]{6,25}$/.test(g.value))) {
|
||||
g.setErrors(Object.assign({'alias_not_valid': true}, g.errors));
|
||||
} else {
|
||||
this.backend.getAliasByName(g.value.replace('@', ''), (alias_status) => {
|
||||
this.backend.getAliasByName(g.value.replace('@', ''), (alias_status, alias_data) => {
|
||||
this.ngZone.run(() => {
|
||||
if (alias_status) {
|
||||
if (alias_data.address === this.variablesService.currentWallet.address) {
|
||||
g.setErrors(Object.assign({'address_same': true}, g.errors));
|
||||
}
|
||||
if (g.hasError('alias_not_valid')) {
|
||||
delete g.errors['alias_not_valid'];
|
||||
if (Object.keys(g.errors).length === 0) {
|
||||
|
|
@ -107,7 +109,8 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
private ngZone: NgZone,
|
||||
private location: Location,
|
||||
private intToMoneyPipe: IntToMoneyPipe
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
checkAndChangeHistory() {
|
||||
if (this.currentContract.state === 201) {
|
||||
|
|
@ -166,7 +169,6 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
if (this.currentContract.state === 130 && this.currentContract.cancel_expiration_time !== 0 && this.currentContract.cancel_expiration_time < this.variablesService.exp_med_ts) {
|
||||
this.currentContract.state = 2;
|
||||
}
|
||||
|
||||
this.variablesService.settings.viewedContracts = (this.variablesService.settings.viewedContracts) ? this.variablesService.settings.viewedContracts : [];
|
||||
let findViewedCont = false;
|
||||
for (let j = 0; j < this.variablesService.settings.viewedContracts.length; j++) {
|
||||
|
|
@ -184,13 +186,11 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
});
|
||||
}
|
||||
this.currentContract.is_new = false;
|
||||
|
||||
setTimeout(() => {
|
||||
this.variablesService.currentWallet.recountNewContracts();
|
||||
}, 0);
|
||||
}
|
||||
this.checkAndChangeHistory();
|
||||
|
||||
} else {
|
||||
this.newPurchase = true;
|
||||
}
|
||||
|
|
@ -205,7 +205,6 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
this.currentContract.is_new = true;
|
||||
this.variablesService.currentWallet.recountNewContracts();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -381,7 +380,6 @@ export class PurchaseComponent implements OnInit, OnDestroy {
|
|||
this.currentContract.is_new = true;
|
||||
this.currentContract.state = 130;
|
||||
this.currentContract.time = this.currentContract.cancel_expiration_time;
|
||||
|
||||
this.variablesService.currentWallet.recountNewContracts();
|
||||
this.modalService.prepareModal('info', 'PURCHASE.IGNORED_CANCEL');
|
||||
this.back();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue