1
0
Fork 0
forked from lthn/blockchain

Mixins change (#182)

* changed mixins

* disable mixin if is_auditable true

* added mixin constant

* fix mixin bug
This commit is contained in:
arthurest 2020-06-18 19:51:49 +04:00 committed by GitHub
parent 7be50f9325
commit a67633e3ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 194 additions and 148 deletions

1
.gitignore vendored
View file

@ -5,3 +5,4 @@
._.DS_Store
Thumbs.db
._*
.idea

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5800,8 +5800,8 @@ __webpack_require__.r(__webpack_exports__);
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! C:\Users\Admin\Desktop\zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! C:\Users\Admin\Desktop\zano\src\gui\qt-daemon\html_source\node_modules\@angular-devkit\build-angular\src\angular-cli-files\models\jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
__webpack_require__(/*! /var/www/zano-project/zano/src/gui/qt-daemon/html_source/src/polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! /var/www/zano-project/zano/src/gui/qt-daemon/html_source/node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js */"./node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/jit-polyfills.js");
/***/ })

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -93461,17 +93461,6 @@ function Buffer (arg, encodingOrOffset, length) {
return from(arg, encodingOrOffset, length)
}
// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
if (typeof Symbol !== 'undefined' && Symbol.species != null &&
Buffer[Symbol.species] === Buffer) {
Object.defineProperty(Buffer, Symbol.species, {
value: null,
configurable: true,
enumerable: false,
writable: false
})
}
Buffer.poolSize = 8192 // not used by this implementation
function from (value, encodingOrOffset, length) {
@ -97893,7 +97882,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Base", function() { return Base; });
var defaultDocumentEvents = [
var DEFAULT_DOCUMENT_EVENTS = [
'click',
'mousemove',
'mouseenter',
@ -97903,7 +97892,6 @@ var defaultDocumentEvents = [
];
var Base = /** @class */ (function () {
function Base() {
this.timer = 0;
this.interactions = [];
}
/**
@ -97923,7 +97911,7 @@ var Base = /** @class */ (function () {
};
Base.prototype.start = function () {
if (this.interactions.length === 0) {
throw Error('There is no interaction to watch!');
throw new Error('There is no interaction to watch!');
}
this.addListeners();
this.setInterval();
@ -97939,7 +97927,7 @@ var Base = /** @class */ (function () {
var interaction = _a[_i];
for (var _b = 0, _c = interaction.events; _b < _c.length; _b++) {
var event_1 = _c[_b];
interaction.target.addEventListener(event_1, this.listenerAction);
interaction.target.addEventListener(event_1, this.onInteraction);
}
}
};
@ -97948,19 +97936,13 @@ var Base = /** @class */ (function () {
var interaction = _a[_i];
for (var _b = 0, _c = interaction.events; _b < _c.length; _b++) {
var event_2 = _c[_b];
interaction.target.removeEventListener(event_2, this.listenerAction);
interaction.target.removeEventListener(event_2, this.onInteraction);
}
}
};
Base.prototype.clearInterval = function () {
clearInterval(this.intervalId);
};
Base.prototype.setInterval = function () {
this.intervalId = setInterval(this.tick, this.factor);
};
Base.prototype.pushDefaultInteraction = function () {
Base.prototype.pushDefaultInteractions = function () {
this.interactions.push({
events: defaultDocumentEvents,
events: DEFAULT_DOCUMENT_EVENTS,
target: document,
});
};
@ -97968,10 +97950,16 @@ var Base = /** @class */ (function () {
this.interactions = this.interactions
.concat(interactions);
};
Base.prototype.clearInterval = function () {
clearInterval(this.activeIntervalId);
};
Base.prototype.setInterval = function () {
this.activeIntervalId = setInterval(this.onInterval, this.timeout * this.factor);
};
return Base;
}());
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/base.js.map
//# sourceMappingURL=/Users/haurhan/ts/idlejs/src/base.js.map
/***/ }),
@ -98002,15 +97990,14 @@ var Idle = /** @class */ (function (_super) {
function Idle() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.repetitive = false;
_this.listenerAction = function () {
_this.timer = 0;
_this.onInteraction = function () {
_this.clearInterval();
_this.setInterval();
};
_this.tick = function () {
_this.timer += 1;
if (_this.timer === _this.timeout || (_this.repetitive && _this.timer % _this.timeout === 0)) {
_this.callback();
_this.onInterval = function () {
_this.callback();
if (!_this.repetitive) {
_this.clearInterval();
}
};
return _this;
@ -98026,11 +98013,11 @@ var Idle = /** @class */ (function (_super) {
* Adds default interactions to decide if user is not interacting with page.
*/
Idle.prototype.whenNotInteractive = function () {
this.pushDefaultInteraction();
this.pushDefaultInteractions();
return this;
};
/**
* Repeat calling idle action for each timeout frame.
* Repeat calling the callback for each timeout frame.
*
* - Does NOT repeat by default
*/
@ -98041,16 +98028,16 @@ var Idle = /** @class */ (function (_super) {
};
/**
* Restart away timer
* incase of custom situations other than events on `EventTarget`
* Can be used incase of something different than events on `EventTarget`s
*/
Idle.prototype.restart = function () {
this.listenerAction();
this.onInteraction();
return this;
};
return Idle;
}(_base__WEBPACK_IMPORTED_MODULE_0__["Base"]));
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/idle.js.map
//# sourceMappingURL=/Users/haurhan/ts/idlejs/src/idle.js.map
/***/ }),
@ -98071,7 +98058,7 @@ __webpack_require__.r(__webpack_exports__);
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/index.js.map
//# sourceMappingURL=/Users/haurhan/ts/idlejs/src/index.js.map
/***/ }),
@ -98102,22 +98089,18 @@ var NotIdle = /** @class */ (function (_super) {
function NotIdle() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.immediate = false;
_this.listenerAction = function () {
_this.wasInteractiveLastPeriod = true;
};
_this.tick = function () {
_this.timer += 1;
if (_this.immediate && _this.wasInteractiveLastPeriod) {
_this.interactedWithin = false;
_this.onInteraction = function () {
if (!_this.interactedWithin && _this.immediate) {
_this.callback();
_this.wasInteractiveLastPeriod = false;
}
if (_this.timer === _this.timeout) {
_this.timer = 0;
if (!_this.immediate && _this.wasInteractiveLastPeriod) {
_this.callback();
_this.wasInteractiveLastPeriod = false;
}
_this.interactedWithin = true;
};
_this.onInterval = function () {
if (_this.interactedWithin && !_this.immediate) {
_this.callback();
}
_this.interactedWithin = false;
};
return _this;
}
@ -98132,7 +98115,7 @@ var NotIdle = /** @class */ (function (_super) {
* Adds default interactions to decide if user is not interacting with page.
*/
NotIdle.prototype.whenInteractive = function () {
this.pushDefaultInteraction();
this.pushDefaultInteractions();
return this;
};
/**
@ -98149,7 +98132,7 @@ var NotIdle = /** @class */ (function (_super) {
return NotIdle;
}(_base__WEBPACK_IMPORTED_MODULE_0__["Base"]));
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/not-idle.js.map
//# sourceMappingURL=/Users/haurhan/ts/idlejs/src/not-idle.js.map
/***/ }),
@ -119024,7 +119007,7 @@ __webpack_require__.r(__webpack_exports__);
/*!*****************************************!*\
!*** ./node_modules/tslib/tslib.es6.js ***!
\*****************************************/
/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@ -119037,6 +119020,7 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__createBinding", function() { return __createBinding; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
@ -119052,18 +119036,18 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldGet", function() { return __classPrivateFieldGet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__classPrivateFieldSet", function() { return __classPrivateFieldSet; });
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Copyright (c) Microsoft Corporation.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
@ -119156,8 +119140,13 @@ function __generator(thisArg, body) {
}
}
function __createBinding(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}
function __exportStar(m, exports) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) exports[p] = m[p];
}
function __values(o) {

File diff suppressed because one or more lines are too long

View file

@ -17,7 +17,7 @@
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"outputPath": "../html",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",

View file

@ -56,6 +56,7 @@ export class VariablesService {
public wallets: Array<Wallet> = [];
public currentWallet: Wallet;
public walletIsAuditable: any = [];
public selectWallet: number;
public aliases: any = [];
public aliasesChecked: any = {};

View file

@ -0,0 +1 @@
export const MIXIN: number = 10;

View file

@ -55,6 +55,12 @@ export class OpenWalletModalComponent implements OnInit {
return;
}
this.backend.openWallet(this.wallet.path, this.wallet.pass, this.variablesService.count, false, (open_status, open_data, open_error) => {
if (open_data.wi.is_auditable) {
let address = open_data['wi'].address;
if (this.variablesService.walletIsAuditable.indexOf(address) === -1) {
this.variablesService.walletIsAuditable.push(address);
}
}
if (open_error && open_error === 'FILE_NOT_FOUND') {
let error_translate = this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND1');
error_translate += ':<br>' + this.wallet.path;

View file

@ -62,6 +62,12 @@ export class OpenWalletComponent implements OnInit, OnDestroy {
openWallet() {
if (this.openForm.valid && this.openForm.get('name').value.length <= this.variablesService.maxWalletNameLength) {
this.backend.openWallet(this.filePath, this.openForm.get('password').value, this.variablesService.count, false, (open_status, open_data, open_error) => {
if (open_data.wi.is_auditable) {
let address = open_data['wi'].address;
if (this.variablesService.walletIsAuditable.indexOf(address) === -1) {
this.variablesService.walletIsAuditable.push(address);
}
}
if (open_error && open_error === 'FILE_NOT_FOUND') {
let error_translate = this.translate.instant('OPEN_WALLET.FILE_NOT_FOUND1');
error_translate += ':<br>' + this.filePath;

View file

@ -5,6 +5,7 @@ import {BackendService} from '../_helpers/services/backend.service';
import {VariablesService} from '../_helpers/services/variables.service';
import {ModalService} from '../_helpers/services/modal.service';
import {BigNumber} from 'bignumber.js';
import {MIXIN} from '../_shared/constants'
@Component({
selector: 'app-send',
@ -16,6 +17,7 @@ export class SendComponent implements OnInit, OnDestroy {
isOpen = false;
localAliases = [];
isModalDialogVisible = false;
mixin: number;
currentWalletId = null;
parentRouting;
@ -75,7 +77,7 @@ export class SendComponent implements OnInit, OnDestroy {
return null;
}]),
comment: new FormControl(''),
mixin: new FormControl(0, Validators.required),
mixin: new FormControl(MIXIN, Validators.required),
fee: new FormControl(this.variablesService.default_fee, [Validators.required, (g: FormControl) => {
if ((new BigNumber(g.value)).isLessThan(this.variablesService.default_fee)) {
return {'less_min': true};
@ -116,11 +118,16 @@ export class SendComponent implements OnInit, OnDestroy {
ngOnInit() {
this.parentRouting = this.route.parent.params.subscribe(params => {
this.currentWalletId = params['id'];
this.mixin = this.variablesService.currentWallet.send_data['mixin'] || MIXIN;
if (this.variablesService.walletIsAuditable.indexOf(this.variablesService.currentWallet.address) !== -1) {
this.mixin = 0;
this.sendForm.controls['mixin'].disable();
}
this.sendForm.reset({
address: this.variablesService.currentWallet.send_data['address'],
amount: this.variablesService.currentWallet.send_data['amount'],
comment: this.variablesService.currentWallet.send_data['comment'],
mixin: this.variablesService.currentWallet.send_data['mixin'] || 0,
mixin: this.mixin,
fee: this.variablesService.currentWallet.send_data['fee'] || this.variablesService.default_fee,
hide: this.variablesService.currentWallet.send_data['hide'] || false
});
@ -159,7 +166,7 @@ export class SendComponent implements OnInit, OnDestroy {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
this.sendForm.reset({address: null, amount: null, comment: null, mixin: this.mixin, fee: this.variablesService.default_fee, hide: false});
}
});
}
@ -184,7 +191,7 @@ export class SendComponent implements OnInit, OnDestroy {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
this.variablesService.currentWallet.send_data = {address: null, amount: null, comment: null, mixin: null, fee: null, hide: null};
this.sendForm.reset({address: null, amount: null, comment: null, mixin: 0, fee: this.variablesService.default_fee, hide: false});
this.sendForm.reset({address: null, amount: null, comment: null, mixin: this.mixin, fee: this.variablesService.default_fee, hide: false});
}
});
}