1
0
Fork 0
forked from lthn/blockchain

Merge branch 'master' into final

This commit is contained in:
crypro.zoidberg 2019-05-07 22:02:09 +02:00
commit 4b51ff846d
38 changed files with 813 additions and 330 deletions

View file

@ -304,7 +304,7 @@ bool blockchain_storage::init(const std::string& config_folder, const boost::pro
<< "last block: " << m_db_blocks.size() - 1 << ", " << misc_utils::get_time_interval_string(timestamp_diff) << " time ago" << ENDL
<< "current pos difficulty: " << get_next_diff_conditional(true) << ENDL
<< "current pow difficulty: " << get_next_diff_conditional(false) << ENDL
<< "total tansactions: " << m_db_transactions.size(),
<< "total transactions: " << m_db_transactions.size(),
LOG_LEVEL_0);

View file

@ -146,7 +146,8 @@
"PASS_NOT_MATCH": "Old password not match.",
"CONFIRM_NOT_MATCH": "Confirm password not match."
},
"LAST_BUILD": "Current build: {{value}}"
"LAST_BUILD": "Current build: {{value}}",
"APP_LOG_TITLE": "Log level:"
},
"WALLET": {
"REGISTER_ALIAS": "Register an alias",
@ -249,6 +250,7 @@
"DETAILS": "Additional details",
"MIXIN": "Mixin",
"FEE": "Fee",
"HIDE": "Hide your wallet address from receiver",
"BUTTON": "Send",
"SUCCESS_SENT": "Transaction sent",
"FORM_ERRORS": {
@ -511,7 +513,7 @@
"MINED": "Mined",
"LOCKED": "Blocked",
"IS_MINIMIZE": "Zano application is minimized to the system tray",
"RESTORE": "You can recover it by double-clicking or using the context menu",
"RESTORE": "You can recover it by clicking or using the context menu",
"TRAY_MENU_SHOW": "Resize",
"TRAY_MENU_MINIMIZE": "Minimize"
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -649,7 +649,7 @@ module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
/*! no static exports found */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.6.1' };
var core = module.exports = { version: '2.6.2' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
@ -1807,7 +1807,7 @@ var store = global[SHARED] || (global[SHARED] = {});
})('versions', []).push({
version: core.version,
mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global',
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
});
@ -2364,7 +2364,6 @@ $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) {
* found in the LICENSE file at https://angular.io/license
*/
var Zone$1 = (function (global) {
var FUNCTION = 'function';
var performance = global['performance'];
function mark(name) {
performance && performance['mark'] && performance['mark'](name);
@ -2373,12 +2372,26 @@ var Zone$1 = (function (global) {
performance && performance['measure'] && performance['measure'](name, label);
}
mark('Zone');
var checkDuplicate = global[('__zone_symbol__forceDuplicateZoneCheck')] === true;
if (global['Zone']) {
throw new Error('Zone already loaded.');
// if global['Zone'] already exists (maybe zone.js was already loaded or
// some other lib also registered a global object named Zone), we may need
// to throw an error, but sometimes user may not want this error.
// For example,
// we have two web pages, page1 includes zone.js, page2 doesn't.
// and the 1st time user load page1 and page2, everything work fine,
// but when user load page2 again, error occurs because global['Zone'] already exists.
// so we add a flag to let user choose whether to throw this error or not.
// By default, if existing Zone is from zone.js, we will not throw the error.
if (checkDuplicate || typeof global['Zone'].__symbol__ !== 'function') {
throw new Error('Zone already loaded.');
}
else {
return global['Zone'];
}
}
var Zone = /** @class */ (function () {
function Zone(parent, zoneSpec) {
this._properties = null;
this._parent = parent;
this._name = zoneSpec ? zoneSpec.name || 'unnamed' : '<root>';
this._properties = zoneSpec && zoneSpec.properties || {};
@ -2421,7 +2434,9 @@ var Zone$1 = (function (global) {
});
Zone.__load_patch = function (name, fn) {
if (patches.hasOwnProperty(name)) {
throw Error('Already loaded patch: ' + name);
if (checkDuplicate) {
throw Error('Already loaded patch: ' + name);
}
}
else if (!global['__Zone_disable_' + name]) {
var perfName = 'Zone:' + name;
@ -2465,7 +2480,7 @@ var Zone$1 = (function (global) {
return this._zoneDelegate.fork(this, zoneSpec);
};
Zone.prototype.wrap = function (callback, source) {
if (typeof callback !== FUNCTION) {
if (typeof callback !== 'function') {
throw new Error('Expecting function got: ' + callback);
}
var _callback = this._zoneDelegate.intercept(this, callback, source);
@ -2475,9 +2490,6 @@ var Zone$1 = (function (global) {
};
};
Zone.prototype.run = function (callback, applyThis, applyArgs, source) {
if (applyThis === void 0) { applyThis = undefined; }
if (applyArgs === void 0) { applyArgs = null; }
if (source === void 0) { source = null; }
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
try {
return this._zoneDelegate.invoke(this, callback, applyThis, applyArgs, source);
@ -2488,8 +2500,6 @@ var Zone$1 = (function (global) {
};
Zone.prototype.runGuarded = function (callback, applyThis, applyArgs, source) {
if (applyThis === void 0) { applyThis = null; }
if (applyArgs === void 0) { applyArgs = null; }
if (source === void 0) { source = null; }
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
try {
try {
@ -2513,10 +2523,7 @@ var Zone$1 = (function (global) {
// https://github.com/angular/zone.js/issues/778, sometimes eventTask
// will run in notScheduled(canceled) state, we should not try to
// run such kind of task but just return
// we have to define an variable here, if not
// typescript compiler will complain below
var isNotScheduled = task.state === notScheduled;
if (isNotScheduled && task.type === eventTask) {
if (task.state === notScheduled && (task.type === eventTask || task.type === macroTask)) {
return;
}
var reEntryGuard = task.state != running;
@ -2527,7 +2534,7 @@ var Zone$1 = (function (global) {
_currentZoneFrame = { parent: _currentZoneFrame, zone: this };
try {
if (task.type == macroTask && task.data && !task.data.isPeriodic) {
task.cancelFn = null;
task.cancelFn = undefined;
}
try {
return this._zoneDelegate.invokeTask(this, task, applyThis, applyArgs);
@ -2563,8 +2570,7 @@ var Zone$1 = (function (global) {
var newZone = this;
while (newZone) {
if (newZone === task.zone) {
throw Error("can not reschedule task to " + this
.name + " which is descendants of the original zone " + task.zone.name);
throw Error("can not reschedule task to " + this.name + " which is descendants of the original zone " + task.zone.name);
}
newZone = newZone.parent;
}
@ -2594,7 +2600,7 @@ var Zone$1 = (function (global) {
return task;
};
Zone.prototype.scheduleMicroTask = function (source, callback, data, customSchedule) {
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, null));
return this.scheduleTask(new ZoneTask(microTask, source, callback, data, customSchedule, undefined));
};
Zone.prototype.scheduleMacroTask = function (source, callback, data, customSchedule, customCancel) {
return this.scheduleTask(new ZoneTask(macroTask, source, callback, data, customSchedule, customCancel));
@ -2635,16 +2641,14 @@ var Zone$1 = (function (global) {
}());
var DELEGATE_ZS = {
name: '',
onHasTask: function (delegate, _, target, hasTaskState) {
return delegate.hasTask(target, hasTaskState);
},
onHasTask: function (delegate, _, target, hasTaskState) { return delegate.hasTask(target, hasTaskState); },
onScheduleTask: function (delegate, _, target, task) {
return delegate.scheduleTask(target, task);
},
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) { return delegate.invokeTask(target, task, applyThis, applyArgs); },
onCancelTask: function (delegate, _, target, task) {
return delegate.cancelTask(target, task);
}
onInvokeTask: function (delegate, _, target, task, applyThis, applyArgs) {
return delegate.invokeTask(target, task, applyThis, applyArgs);
},
onCancelTask: function (delegate, _, target, task) { return delegate.cancelTask(target, task); }
};
var ZoneDelegate = /** @class */ (function () {
function ZoneDelegate(zone, parentDelegate, zoneSpec) {
@ -2672,8 +2676,8 @@ var Zone$1 = (function (global) {
zoneSpec && (zoneSpec.onHandleError ? this.zone : parentDelegate.zone);
this._scheduleTaskZS =
zoneSpec && (zoneSpec.onScheduleTask ? zoneSpec : parentDelegate._scheduleTaskZS);
this._scheduleTaskDlgt =
zoneSpec && (zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
this._scheduleTaskDlgt = zoneSpec &&
(zoneSpec.onScheduleTask ? parentDelegate : parentDelegate._scheduleTaskDlgt);
this._scheduleTaskCurrZone =
zoneSpec && (zoneSpec.onScheduleTask ? this.zone : parentDelegate.zone);
this._invokeTaskZS =
@ -2728,8 +2732,7 @@ var Zone$1 = (function (global) {
callback;
};
ZoneDelegate.prototype.invoke = function (targetZone, callback, applyThis, applyArgs, source) {
return this._invokeZS ?
this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
return this._invokeZS ? this._invokeZS.onInvoke(this._invokeDlgt, this._invokeCurrZone, targetZone, callback, applyThis, applyArgs, source) :
callback.apply(applyThis, applyArgs);
};
ZoneDelegate.prototype.handleError = function (targetZone, error) {
@ -2761,8 +2764,7 @@ var Zone$1 = (function (global) {
return returnTask;
};
ZoneDelegate.prototype.invokeTask = function (targetZone, task, applyThis, applyArgs) {
return this._invokeTaskZS ?
this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
return this._invokeTaskZS ? this._invokeTaskZS.onInvokeTask(this._invokeTaskDlgt, this._invokeTaskCurrZone, targetZone, task, applyThis, applyArgs) :
task.callback.apply(applyThis, applyArgs);
};
ZoneDelegate.prototype.cancelTask = function (targetZone, task) {
@ -2782,7 +2784,7 @@ var Zone$1 = (function (global) {
// hasTask should not throw error so other ZoneDelegate
// can still trigger hasTask callback
try {
return this._hasTaskZS &&
this._hasTaskZS &&
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
}
catch (err) {
@ -2872,14 +2874,12 @@ var Zone$1 = (function (global) {
}
}
else {
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ?
' or \'' + fromState2 + '\'' :
'') + ", was '" + this._state + "'.");
throw new Error(this.type + " '" + this.source + "': can not transition to '" + toState + "', expecting state '" + fromState1 + "'" + (fromState2 ? ' or \'' + fromState2 + '\'' : '') + ", was '" + this._state + "'.");
}
};
ZoneTask.prototype.toString = function () {
if (this.data && typeof this.data.handleId !== 'undefined') {
return this.data.handleId;
return this.data.handleId.toString();
}
else {
return Object.prototype.toString.call(this);
@ -2920,7 +2920,13 @@ var Zone$1 = (function (global) {
}
}
if (nativeMicroTaskQueuePromise) {
nativeMicroTaskQueuePromise[symbolThen](drainMicroTaskQueue);
var nativeThen = nativeMicroTaskQueuePromise[symbolThen];
if (!nativeThen) {
// native Promise is not patchable, we need to use `then` directly
// issue 1078
nativeThen = nativeMicroTaskQueuePromise['then'];
}
nativeThen.call(nativeMicroTaskQueuePromise, drainMicroTaskQueue);
}
else {
global[symbolSetTimeout](drainMicroTaskQueue, 0);
@ -2967,12 +2973,13 @@ var Zone$1 = (function (global) {
patchEventTarget: function () { return []; },
patchOnProperties: noop,
patchMethod: function () { return noop; },
bindArguments: function () { return null; },
bindArguments: function () { return []; },
patchThen: function () { return noop; },
setNativePromise: function (NativePromise) {
// sometimes NativePromise.resolve static function
// is not ready yet, (such as core-js/es6.promise)
// so we need to check here.
if (NativePromise && typeof NativePromise.resolve === FUNCTION) {
if (NativePromise && typeof NativePromise.resolve === 'function') {
nativeMicroTaskQueuePromise = NativePromise.resolve(0);
}
},
@ -2988,6 +2995,16 @@ var Zone$1 = (function (global) {
return global['Zone'] = Zone;
})(typeof window !== 'undefined' && window || typeof self !== 'undefined' && self || global);
var __values = (undefined && undefined.__values) || function (o) {
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
if (m) return m.call(o);
return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
};
Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
var ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var ObjectDefineProperty = Object.defineProperty;
@ -3130,7 +3147,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
var queue = promise[symbolValue];
promise[symbolValue] = value;
if (promise[symbolFinally] === symbolFinally) {
// the promise is generated by Promise.prototype.finally
// the promise is generated by Promise.prototype.finally
if (state === RESOLVED) {
// the state is resolved, should ignore the value
// and use parent promise value
@ -3214,7 +3231,9 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
chainPromise[symbolParentPromiseState] = promiseState;
}
// should not pass value to finally callback
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ? [] : [parentPromiseValue]);
var value = zone.run(delegate, undefined, isFinallyPromise && delegate !== forwardRejection && delegate !== forwardResolution ?
[] :
[parentPromiseValue]);
resolvePromise(chainPromise, true, value);
}
catch (error) {
@ -3249,6 +3268,7 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
return resolvePromise(new this(null), REJECTED, error);
};
ZoneAwarePromise.race = function (values) {
var e_1, _a;
var resolve;
var reject;
var promise = new this(function (res, rej) {
@ -3261,40 +3281,70 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
function onReject(error) {
promise && (promise = false || reject(error));
}
for (var _i = 0, values_1 = values; _i < values_1.length; _i++) {
var value = values_1[_i];
if (!isThenable(value)) {
value = this.resolve(value);
try {
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
var value = values_1_1.value;
if (!isThenable(value)) {
value = this.resolve(value);
}
value.then(onResolve, onReject);
}
value.then(onResolve, onReject);
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
}
finally { if (e_1) throw e_1.error; }
}
return promise;
};
ZoneAwarePromise.all = function (values) {
var e_2, _a;
var resolve;
var reject;
var promise = new this(function (res, rej) {
resolve = res;
reject = rej;
});
var count = 0;
// Start at 2 to prevent prematurely resolving if .then is called immediately.
var unresolvedCount = 2;
var valueIndex = 0;
var resolvedValues = [];
for (var _i = 0, values_2 = values; _i < values_2.length; _i++) {
var value = values_2[_i];
var _loop_2 = function (value) {
if (!isThenable(value)) {
value = this.resolve(value);
value = this_1.resolve(value);
}
value.then((function (index) { return function (value) {
resolvedValues[index] = value;
count--;
if (!count) {
var curValueIndex = valueIndex;
value.then(function (value) {
resolvedValues[curValueIndex] = value;
unresolvedCount--;
if (unresolvedCount === 0) {
resolve(resolvedValues);
}
}; })(count), reject);
count++;
}, reject);
unresolvedCount++;
valueIndex++;
};
var this_1 = this;
try {
for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
var value = values_2_1.value;
_loop_2(value);
}
}
if (!count)
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
}
finally { if (e_2) throw e_2.error; }
}
// Make the unresolvedCount zero-based again.
unresolvedCount -= 2;
if (unresolvedCount === 0) {
resolve(resolvedValues);
}
return promise;
};
ZoneAwarePromise.prototype.then = function (onFulfilled, onRejected) {
@ -3390,31 +3440,112 @@ Zone.__load_patch('ZoneAwarePromise', function (global, Zone, api) {
};
Ctor[symbolThenPatched] = true;
}
function zoneify(fn) {
return function () {
var resultPromise = fn.apply(this, arguments);
if (resultPromise instanceof ZoneAwarePromise) {
return resultPromise;
}
var ctor = resultPromise.constructor;
if (!ctor[symbolThenPatched]) {
patchThen(ctor);
}
return resultPromise;
};
}
api.patchThen = patchThen;
if (NativePromise) {
patchThen(NativePromise);
var fetch_1 = global['fetch'];
if (typeof fetch_1 == 'function') {
global['fetch'] = zoneify(fetch_1);
}
}
// This is not part of public API, but it is useful for tests, so we expose it.
Promise[Zone.__symbol__('uncaughtPromiseErrors')] = _uncaughtPromiseErrors;
return ZoneAwarePromise;
});
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
Zone.__load_patch('fetch', function (global, Zone, api) {
var fetch = global['fetch'];
var ZoneAwarePromise = global.Promise;
var symbolThenPatched = api.symbol('thenPatched');
var fetchTaskScheduling = api.symbol('fetchTaskScheduling');
var fetchTaskAborting = api.symbol('fetchTaskAborting');
if (typeof fetch !== 'function') {
return;
}
var OriginalAbortController = global['AbortController'];
var supportAbort = typeof OriginalAbortController === 'function';
var abortNative = null;
if (supportAbort) {
global['AbortController'] = function () {
var abortController = new OriginalAbortController();
var signal = abortController.signal;
signal.abortController = abortController;
return abortController;
};
abortNative = api.patchMethod(OriginalAbortController.prototype, 'abort', function (delegate) { return function (self, args) {
if (self.task) {
return self.task.zone.cancelTask(self.task);
}
return delegate.apply(self, args);
}; });
}
var placeholder = function () { };
global['fetch'] = function () {
var _this = this;
var args = Array.prototype.slice.call(arguments);
var options = args.length > 1 ? args[1] : null;
var signal = options && options.signal;
return new Promise(function (res, rej) {
var task = Zone.current.scheduleMacroTask('fetch', placeholder, args, function () {
var fetchPromise;
var zone = Zone.current;
try {
zone[fetchTaskScheduling] = true;
fetchPromise = fetch.apply(_this, args);
}
catch (error) {
rej(error);
return;
}
finally {
zone[fetchTaskScheduling] = false;
}
if (!(fetchPromise instanceof ZoneAwarePromise)) {
var ctor = fetchPromise.constructor;
if (!ctor[symbolThenPatched]) {
api.patchThen(ctor);
}
}
fetchPromise.then(function (resource) {
if (task.state !== 'notScheduled') {
task.invoke();
}
res(resource);
}, function (error) {
if (task.state !== 'notScheduled') {
task.invoke();
}
rej(error);
});
}, function () {
if (!supportAbort) {
rej('No AbortController supported, can not cancel fetch');
return;
}
if (signal && signal.abortController && !signal.aborted &&
typeof signal.abortController.abort === 'function' && abortNative) {
try {
Zone.current[fetchTaskAborting] = true;
abortNative.call(signal.abortController);
}
finally {
Zone.current[fetchTaskAborting] = false;
}
}
else {
rej('cancel fetch need a AbortController.signal');
}
});
if (signal && signal.abortController) {
signal.abortController.task = task;
}
});
};
});
/**
* @license
* Copyright Google Inc. All Rights Reserved.
@ -3530,9 +3661,23 @@ var wrapFn = function (event) {
}
var target = this || event.target || _global;
var listener = target[eventNameSymbol];
var result = listener && listener.apply(this, arguments);
if (result != undefined && !result) {
event.preventDefault();
var result;
if (isBrowser && target === internalWindow && event.type === 'error') {
// window.onerror have different signiture
// https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror
// and onerror callback will prevent default when callback return true
var errorEvent = event;
result = listener &&
listener.call(this, errorEvent.message, errorEvent.filename, errorEvent.lineno, errorEvent.colno, errorEvent.error);
if (result === true) {
event.preventDefault();
}
}
else {
result = listener && listener.apply(this, arguments);
if (result != undefined && !result) {
event.preventDefault();
}
}
return result;
};
@ -3550,6 +3695,10 @@ function patchProperty(obj, prop, prototype) {
if (!desc || !desc.configurable) {
return;
}
var onPropPatchedSymbol = zoneSymbol('on' + prop + 'patched');
if (obj.hasOwnProperty(onPropPatchedSymbol) && obj[onPropPatchedSymbol]) {
return;
}
// A property descriptor cannot have getter/setter and be writable
// deleting the writable and value properties avoids this error:
//
@ -3627,6 +3776,7 @@ function patchProperty(obj, prop, prototype) {
return null;
};
ObjectDefineProperty(obj, prop, desc);
obj[onPropPatchedSymbol] = true;
}
function patchOnProperties(obj, properties, prototype) {
if (properties) {
@ -3717,6 +3867,31 @@ function patchClass(className) {
}
}
}
function copySymbolProperties(src, dest) {
if (typeof Object.getOwnPropertySymbols !== 'function') {
return;
}
var symbols = Object.getOwnPropertySymbols(src);
symbols.forEach(function (symbol) {
var desc = Object.getOwnPropertyDescriptor(src, symbol);
Object.defineProperty(dest, symbol, {
get: function () {
return src[symbol];
},
set: function (value) {
if (desc && (!desc.writable || typeof desc.set !== 'function')) {
// if src[symbol] is not writable or not have a setter, just return
return;
}
src[symbol] = value;
},
enumerable: desc ? desc.enumerable : true,
configurable: desc ? desc.configurable : true
});
});
}
var shouldCopySymbolProperties = false;
function patchMethod(target, name, patchFn) {
var proto = target;
while (proto && !proto.hasOwnProperty(name)) {
@ -3727,7 +3902,7 @@ function patchMethod(target, name, patchFn) {
proto = target;
}
var delegateName = zoneSymbol(name);
var delegate;
var delegate = null;
if (proto && !(delegate = proto[delegateName])) {
delegate = proto[delegateName] = proto[name];
// check whether proto[name] is writable
@ -3739,6 +3914,9 @@ function patchMethod(target, name, patchFn) {
return patchDelegate_1(this, arguments);
};
attachOriginToPatched(proto[name], delegate);
if (shouldCopySymbolProperties) {
copySymbolProperties(delegate, proto[name]);
}
}
}
return delegate;
@ -3757,7 +3935,7 @@ function patchMacroTask(obj, funcName, metaCreator) {
setNative = patchMethod(obj, funcName, function (delegate) { return function (self, args) {
var meta = metaCreator(self, args);
if (meta.cbIdx >= 0 && typeof args[meta.cbIdx] === 'function') {
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask, null);
return scheduleMacroTaskWithCurrentZone(meta.name, args[meta.cbIdx], meta, scheduleTask);
}
else {
// cause an error by calling it directly.
@ -3771,6 +3949,17 @@ function attachOriginToPatched(patched, original) {
}
var isDetectedIEOrEdge = false;
var ieOrEdge = false;
function isIE() {
try {
var ua = internalWindow.navigator.userAgent;
if (ua.indexOf('MSIE ') !== -1 || ua.indexOf('Trident/') !== -1) {
return true;
}
}
catch (error) {
}
return false;
}
function isIEOrEdge() {
if (isDetectedIEOrEdge) {
return ieOrEdge;
@ -3852,6 +4041,21 @@ Zone.__load_patch('toString', function (global) {
* @fileoverview
* @suppress {missingRequire}
*/
var passiveSupported = false;
if (typeof window !== 'undefined') {
try {
var options = Object.defineProperty({}, 'passive', {
get: function () {
passiveSupported = true;
}
});
window.addEventListener('test', options, options);
window.removeEventListener('test', options, options);
}
catch (err) {
passiveSupported = false;
}
}
// an identifier to tell ZoneTask do not create a new invoke closure
var OPTIMIZED_ZONE_EVENT_TASK_DATA = {
useG: true
@ -3987,6 +4191,7 @@ function patchEventTarget(_global, apis, patchOptions) {
if (proto[zoneSymbolAddEventListener]) {
return false;
}
var eventNameToString = patchOptions && patchOptions.eventNameToString;
// a shared global taskData to pass data for scheduleEventTask
// so we do not need to create a new object just for pass some data
var taskData = {};
@ -4002,12 +4207,24 @@ function patchEventTarget(_global, apis, patchOptions) {
nativePrependEventListener = proto[zoneSymbol(patchOptions.prepend)] =
proto[patchOptions.prepend];
}
var customScheduleGlobal = function () {
function checkIsPassive(task) {
if (!passiveSupported && typeof taskData.options !== 'boolean' &&
typeof taskData.options !== 'undefined' && taskData.options !== null) {
// options is a non-null non-undefined object
// passive is not supported
// don't pass options as object
// just pass capture as a boolean
task.options = !!taskData.options.capture;
taskData.options = task.options;
}
}
var customScheduleGlobal = function (task) {
// if there is already a task for the eventName + capture,
// just return, because we use the shared globalZoneAwareCallback here.
if (taskData.isExisting) {
return;
}
checkIsPassive(task);
return nativeAddEventListener.call(taskData.target, taskData.eventName, taskData.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, taskData.options);
};
var customCancelGlobal = function (task) {
@ -4048,6 +4265,7 @@ function patchEventTarget(_global, apis, patchOptions) {
return nativeRemoveEventListener.call(task.target, task.eventName, task.capture ? globalZoneAwareCaptureCallback : globalZoneAwareCallback, task.options);
};
var customScheduleNonGlobal = function (task) {
checkIsPassive(task);
return nativeAddEventListener.call(taskData.target, taskData.eventName, task.invoke, taskData.options);
};
var customSchedulePrepend = function (task) {
@ -4070,10 +4288,15 @@ function patchEventTarget(_global, apis, patchOptions) {
if (prepend === void 0) { prepend = false; }
return function () {
var target = this || _global;
var eventName = arguments[0];
var delegate = arguments[1];
if (!delegate) {
return nativeListener.apply(this, arguments);
}
if (isNode && eventName === 'uncaughtException') {
// don't patch uncaughtException of nodejs to prevent endless loop
return nativeListener.apply(this, arguments);
}
// don't create the bind delegate function for handleEvent
// case here to improve addEventListener performance
// we will create the bind delegate when invoke
@ -4087,7 +4310,6 @@ function patchEventTarget(_global, apis, patchOptions) {
if (validateHandler && !validateHandler(nativeListener, delegate, target, arguments)) {
return;
}
var eventName = arguments[0];
var options = arguments[2];
if (blackListedEvents) {
// check black list
@ -4117,8 +4339,8 @@ function patchEventTarget(_global, apis, patchOptions) {
var symbolEventName;
if (!symbolEventNames) {
// the code is duplicate, but I just want to get some better performance
var falseEventName = eventName + FALSE_STR;
var trueEventName = eventName + TRUE_STR;
var falseEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + FALSE_STR;
var trueEventName = (eventNameToString ? eventNameToString(eventName) : eventName) + TRUE_STR;
var symbol = ZONE_SYMBOL_PREFIX + falseEventName;
var symbolCapture = ZONE_SYMBOL_PREFIX + trueEventName;
zoneSymbolEventNames$1[eventName] = {};
@ -4153,7 +4375,8 @@ function patchEventTarget(_global, apis, patchOptions) {
source = targetSource[eventName];
}
if (!source) {
source = constructorName + addSource + eventName;
source = constructorName + addSource +
(eventNameToString ? eventNameToString(eventName) : eventName);
}
// do not create a new object as task.data to pass those things
// just use the global shared one
@ -4168,7 +4391,7 @@ function patchEventTarget(_global, apis, patchOptions) {
taskData.capture = capture;
taskData.eventName = eventName;
taskData.isExisting = isExisting;
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : null;
var data = useGlobalCallback ? OPTIMIZED_ZONE_EVENT_TASK_DATA : undefined;
// keep taskData into data to allow onScheduleEventTask to access the task information
if (data) {
data.taskData = taskData;
@ -4186,7 +4409,11 @@ function patchEventTarget(_global, apis, patchOptions) {
if (once) {
options.once = true;
}
task.options = options;
if (!(!passiveSupported && typeof task.options === 'boolean')) {
// if not support passive, and we pass an option object
// to addEventListener, we should save the options to task
task.options = options;
}
task.target = target;
task.capture = capture;
task.eventName = eventName;
@ -4271,7 +4498,7 @@ function patchEventTarget(_global, apis, patchOptions) {
var target = this || _global;
var eventName = arguments[0];
var listeners = [];
var tasks = findEventTasks(target, eventName);
var tasks = findEventTasks(target, eventNameToString ? eventNameToString(eventName) : eventName);
for (var i = 0; i < tasks.length; i++) {
var task = tasks[i];
var delegate = task.originalDelegate ? task.originalDelegate : task.callback;
@ -4427,9 +4654,9 @@ function patchTimer(window, setName, cancelName, nameSuffix) {
patchMethod(window, setName, function (delegate) { return function (self, args) {
if (typeof args[0] === 'function') {
var options = {
handleId: null,
isPeriodic: nameSuffix === 'Interval',
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 : null,
delay: (nameSuffix === 'Timeout' || nameSuffix === 'Interval') ? args[1] || 0 :
undefined,
args: args
};
var task = scheduleMacroTaskWithCurrentZone(setName, args[0], options, scheduleTask, clearTask);
@ -4544,7 +4771,7 @@ function propertyPatch() {
};
Object.getOwnPropertyDescriptor = function (obj, prop) {
var desc = _getOwnPropertyDescriptor(obj, prop);
if (isUnconfigurable(obj, prop)) {
if (desc && isUnconfigurable(obj, prop)) {
desc.configurable = false;
}
return desc;
@ -4772,10 +4999,10 @@ var globalEventHandlersEventNames = [
'wheel'
];
var documentEventNames = [
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'fullscreenchange',
'afterscriptexecute', 'beforescriptexecute', 'DOMContentLoaded', 'freeze', 'fullscreenchange',
'mozfullscreenchange', 'webkitfullscreenchange', 'msfullscreenchange', 'fullscreenerror',
'mozfullscreenerror', 'webkitfullscreenerror', 'msfullscreenerror', 'readystatechange',
'visibilitychange'
'visibilitychange', 'resume'
];
var windowEventNames = [
'absolutedeviceorientation',
@ -4887,7 +5114,7 @@ var websocketEventNames = ['close', 'error', 'open', 'message'];
var workerEventNames = ['error', 'message'];
var eventNames = globalEventHandlersEventNames.concat(webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames, htmlElementEventNames, ieElementEventNames);
function filterProperties(target, onProperties, ignoreProperties) {
if (!ignoreProperties) {
if (!ignoreProperties || ignoreProperties.length === 0) {
return onProperties;
}
var tip = ignoreProperties.filter(function (ip) { return ip.target === target; });
@ -4912,13 +5139,14 @@ function propertyDescriptorPatch(api, _global) {
}
var supportsWebSocket = typeof WebSocket !== 'undefined';
if (canPatchViaPropertyDescriptor()) {
var ignoreProperties = _global.__Zone_ignore_on_properties;
var ignoreProperties = _global['__Zone_ignore_on_properties'];
// for browsers that we can patch the descriptor: Chrome & Firefox
if (isBrowser) {
var internalWindow = window;
var ignoreErrorProperties = isIE ? [{ target: internalWindow, ignoreProperties: ['error'] }] : [];
// in IE/Edge, onProp not exist in window object, but in WindowPrototype
// so we need to pass WindowPrototype to check onProp exist or not
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties, ObjectGetPrototypeOf(internalWindow));
patchFilteredProperties(internalWindow, eventNames.concat(['messageerror']), ignoreProperties ? ignoreProperties.concat(ignoreErrorProperties) : ignoreProperties, ObjectGetPrototypeOf(internalWindow));
patchFilteredProperties(Document.prototype, eventNames, ignoreProperties);
if (typeof internalWindow['SVGElement'] !== 'undefined') {
patchFilteredProperties(internalWindow['SVGElement'].prototype, eventNames, ignoreProperties);
@ -4940,9 +5168,9 @@ function propertyDescriptorPatch(api, _global) {
}
}
patchFilteredProperties(XMLHttpRequest.prototype, XMLHttpRequestEventNames, ignoreProperties);
var XMLHttpRequestEventTarget = _global['XMLHttpRequestEventTarget'];
if (XMLHttpRequestEventTarget) {
patchFilteredProperties(XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype, XMLHttpRequestEventNames, ignoreProperties);
var XMLHttpRequestEventTarget_1 = _global['XMLHttpRequestEventTarget'];
if (XMLHttpRequestEventTarget_1) {
patchFilteredProperties(XMLHttpRequestEventTarget_1 && XMLHttpRequestEventTarget_1.prototype, XMLHttpRequestEventNames, ignoreProperties);
}
if (typeof IDBIndex !== 'undefined') {
patchFilteredProperties(IDBIndex.prototype, IDBIndexEventNames, ignoreProperties);
@ -5157,16 +5385,16 @@ function patchEvent(global, api) {
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
function registerElementPatch(_global) {
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
function patchCallbacks(target, targetName, method, callbacks) {
var symbol = Zone.__symbol__(method);
if (target[symbol]) {
return;
}
var _registerElement = document.registerElement;
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
document.registerElement = function (name, opts) {
var nativeDelegate = target[symbol] = target[method];
target[method] = function (name, opts, options) {
if (opts && opts.prototype) {
callbacks.forEach(function (callback) {
var source = 'Document.registerElement::' + callback;
var source = targetName + "." + method + "::" + callback;
var prototype = opts.prototype;
if (prototype.hasOwnProperty(callback)) {
var descriptor = ObjectGetOwnPropertyDescriptor(prototype, callback);
@ -5183,9 +5411,23 @@ function registerElementPatch(_global) {
}
});
}
return _registerElement.call(document, name, opts);
return nativeDelegate.call(target, name, opts, options);
};
attachOriginToPatched(document.registerElement, _registerElement);
attachOriginToPatched(target[method], nativeDelegate);
}
function registerElementPatch(_global) {
if ((!isBrowser && !isMix) || !('registerElement' in _global.document)) {
return;
}
var callbacks = ['createdCallback', 'attachedCallback', 'detachedCallback', 'attributeChangedCallback'];
patchCallbacks(document, 'Document', 'registerElement', callbacks);
}
function patchCustomElements(_global) {
if ((!isBrowser && !isMix) || !('customElements' in _global)) {
return;
}
var callbacks = ['connectedCallback', 'disconnectedCallback', 'adoptedCallback', 'attributeChangedCallback'];
patchCallbacks(_global.customElements, 'customElements', 'define', callbacks);
}
/**
@ -5248,7 +5490,10 @@ Zone.__load_patch('EventTarget', function (global, Zone, api) {
Zone.__load_patch('on_property', function (global, Zone, api) {
propertyDescriptorPatch(api, global);
propertyPatch();
});
Zone.__load_patch('customElements', function (global, Zone, api) {
registerElementPatch(global);
patchCustomElements(global);
});
Zone.__load_patch('canvas', function (global) {
var HTMLCanvasElement = global['HTMLCanvasElement'];
@ -5267,6 +5512,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
var XHR_LISTENER = zoneSymbol('xhrListener');
var XHR_SCHEDULED = zoneSymbol('xhrScheduled');
var XHR_URL = zoneSymbol('xhrURL');
var XHR_ERROR_BEFORE_SCHEDULED = zoneSymbol('xhrErrorBeforeScheduled');
function patchXHR(window) {
var XMLHttpRequestPrototype = XMLHttpRequest.prototype;
function findPendingTask(target) {
@ -5275,9 +5521,9 @@ Zone.__load_patch('XHR', function (global, Zone) {
var oriAddListener = XMLHttpRequestPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
var oriRemoveListener = XMLHttpRequestPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
if (!oriAddListener) {
var XMLHttpRequestEventTarget = window['XMLHttpRequestEventTarget'];
if (XMLHttpRequestEventTarget) {
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget.prototype;
var XMLHttpRequestEventTarget_1 = window['XMLHttpRequestEventTarget'];
if (XMLHttpRequestEventTarget_1) {
var XMLHttpRequestEventTargetPrototype = XMLHttpRequestEventTarget_1.prototype;
oriAddListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_ADD_EVENT_LISTENER];
oriRemoveListener = XMLHttpRequestEventTargetPrototype[ZONE_SYMBOL_REMOVE_EVENT_LISTENER];
}
@ -5285,9 +5531,10 @@ Zone.__load_patch('XHR', function (global, Zone) {
var READY_STATE_CHANGE = 'readystatechange';
var SCHEDULED = 'scheduled';
function scheduleTask(task) {
XMLHttpRequest[XHR_SCHEDULED] = false;
var data = task.data;
var target = data.target;
target[XHR_SCHEDULED] = false;
target[XHR_ERROR_BEFORE_SCHEDULED] = false;
// remove existing event listener
var listener = target[XHR_LISTENER];
if (!oriAddListener) {
@ -5301,8 +5548,35 @@ Zone.__load_patch('XHR', function (global, Zone) {
if (target.readyState === target.DONE) {
// sometimes on some browsers XMLHttpRequest will fire onreadystatechange with
// readyState=4 multiple times, so we need to check task state here
if (!data.aborted && XMLHttpRequest[XHR_SCHEDULED] && task.state === SCHEDULED) {
task.invoke();
if (!data.aborted && target[XHR_SCHEDULED] && task.state === SCHEDULED) {
// check whether the xhr has registered onload listener
// if that is the case, the task should invoke after all
// onload listeners finish.
var loadTasks = target['__zone_symbol__loadfalse'];
if (loadTasks && loadTasks.length > 0) {
var oriInvoke_1 = task.invoke;
task.invoke = function () {
// need to load the tasks again, because in other
// load listener, they may remove themselves
var loadTasks = target['__zone_symbol__loadfalse'];
for (var i = 0; i < loadTasks.length; i++) {
if (loadTasks[i] === task) {
loadTasks.splice(i, 1);
}
}
if (!data.aborted && task.state === SCHEDULED) {
oriInvoke_1.call(task);
}
};
loadTasks.push(task);
}
else {
task.invoke();
}
}
else if (!data.aborted && target[XHR_SCHEDULED] === false) {
// error occurs when xhr.send()
target[XHR_ERROR_BEFORE_SCHEDULED] = true;
}
}
};
@ -5312,7 +5586,7 @@ Zone.__load_patch('XHR', function (global, Zone) {
target[XHR_TASK] = task;
}
sendNative.apply(target, data.args);
XMLHttpRequest[XHR_SCHEDULED] = true;
target[XHR_SCHEDULED] = true;
return task;
}
function placeholderCallback() { }
@ -5329,24 +5603,32 @@ Zone.__load_patch('XHR', function (global, Zone) {
return openNative.apply(self, args);
}; });
var XMLHTTPREQUEST_SOURCE = 'XMLHttpRequest.send';
var fetchTaskAborting = zoneSymbol('fetchTaskAborting');
var fetchTaskScheduling = zoneSymbol('fetchTaskScheduling');
var sendNative = patchMethod(XMLHttpRequestPrototype, 'send', function () { return function (self, args) {
if (Zone.current[fetchTaskScheduling] === true) {
// a fetch is scheduling, so we are using xhr to polyfill fetch
// and because we already schedule macroTask for fetch, we should
// not schedule a macroTask for xhr again
return sendNative.apply(self, args);
}
if (self[XHR_SYNC]) {
// if the XHR is sync there is no task to schedule, just execute the code.
return sendNative.apply(self, args);
}
else {
var options = {
target: self,
url: self[XHR_URL],
isPeriodic: false,
delay: null,
args: args,
aborted: false
};
return scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
var options = { target: self, url: self[XHR_URL], isPeriodic: false, args: args, aborted: false };
var task = scheduleMacroTaskWithCurrentZone(XMLHTTPREQUEST_SOURCE, placeholderCallback, options, scheduleTask, clearTask);
if (self && self[XHR_ERROR_BEFORE_SCHEDULED] === true && !options.aborted &&
task.state === SCHEDULED) {
// xhr request throw error when send
// we should invoke task instead of leaving a scheduled
// pending macroTask
task.invoke();
}
}
}; });
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self) {
var abortNative = patchMethod(XMLHttpRequestPrototype, 'abort', function () { return function (self, args) {
var task = findPendingTask(self);
if (task && typeof task.type == 'string') {
// If the XHR has already completed, do nothing.
@ -5358,6 +5640,10 @@ Zone.__load_patch('XHR', function (global, Zone) {
}
task.zone.cancelTask(task);
}
else if (Zone.current[fetchTaskAborting] === true) {
// the abort is called from fetch polyfill, we need to call native abort of XHR.
return abortNative.apply(self, args);
}
// Otherwise, we are trying to abort an XHR which has not yet been sent, so there is no
// task
// to cancel. Do nothing.
@ -5497,8 +5783,8 @@ __webpack_require__.r(__webpack_exports__);
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! D:\Projects\Zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! D:\Projects\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__(/*! D:\zano_zano\src\gui\qt-daemon\html_source\src\polyfills.ts */"./src/polyfills.ts");
module.exports = __webpack_require__(/*! D:\zano_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

@ -93682,6 +93682,22 @@ var NotIdle = /** @class */ (function (_super) {
//# sourceMappingURL=/home/travis/build/harunurhan/idlejs/src/not-idle.js.map
/***/ }),
/***/ "./node_modules/isarray/index.js":
/*!***************************************!*\
!*** ./node_modules/isarray/index.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
/***/ }),
/***/ "./node_modules/json-bignumber/node_modules/bignumber.js/bignumber.js":
@ -98854,9 +98870,13 @@ exports.getEncodedBits = function getEncodedBits (errorCorrectionLevel, mask) {
var Buffer = __webpack_require__(/*! ../utils/buffer */ "./node_modules/qrcode/lib/utils/typedarray-buffer.js")
var EXP_TABLE = new Buffer(512)
var LOG_TABLE = new Buffer(256)
if(Buffer.alloc) {
var EXP_TABLE = Buffer.alloc(512)
var LOG_TABLE = Buffer.alloc(256)
} else {
var EXP_TABLE = new Buffer(512)
var LOG_TABLE = new Buffer(256)
}
/**
* Precompute the log and anti-log tables for faster computation later
*
@ -99566,7 +99586,7 @@ var Version = __webpack_require__(/*! ./version */ "./node_modules/qrcode/lib/co
var FormatInfo = __webpack_require__(/*! ./format-info */ "./node_modules/qrcode/lib/core/format-info.js")
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
var Segments = __webpack_require__(/*! ./segments */ "./node_modules/qrcode/lib/core/segments.js")
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
/**
* QRCode for JavaScript
@ -100614,7 +100634,7 @@ var ECCode = __webpack_require__(/*! ./error-correction-code */ "./node_modules/
var ECLevel = __webpack_require__(/*! ./error-correction-level */ "./node_modules/qrcode/lib/core/error-correction-level.js")
var Mode = __webpack_require__(/*! ./mode */ "./node_modules/qrcode/lib/core/mode.js")
var VersionCheck = __webpack_require__(/*! ./version-check */ "./node_modules/qrcode/lib/core/version-check.js")
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
// Generator polynomial used to encode version information
var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0)
@ -101064,7 +101084,7 @@ exports.qrToImageData = function qrToImageData (imgData, qr, opts) {
var isArray = __webpack_require__(/*! isarray */ "./node_modules/qrcode/node_modules/isarray/index.js")
var isArray = __webpack_require__(/*! isarray */ "./node_modules/isarray/index.js")
function typedArraySupport () {
// Can typed array instances be augmented?
@ -101569,22 +101589,6 @@ Buffer.isBuffer = function isBuffer (b) {
module.exports = Buffer
/***/ }),
/***/ "./node_modules/qrcode/node_modules/isarray/index.js":
/*!***********************************************************!*\
!*** ./node_modules/qrcode/node_modules/isarray/index.js ***!
\***********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = Array.isArray || function (arr) {
return toString.call(arr) == '[object Array]';
};
/***/ }),
/***/ "./node_modules/rxjs/_esm5/index.js":

File diff suppressed because one or more lines are too long

View file

@ -387,7 +387,7 @@ export class BackendService {
this.runCommand('restore_wallet', params, callback);
}
sendMoney(from_wallet_id, to_address, amount, fee, mixin, comment, callback) {
sendMoney(from_wallet_id, to_address, amount, fee, mixin, comment, hide, callback) {
const params = {
wallet_id: parseInt(from_wallet_id, 10),
destinations: [
@ -400,7 +400,7 @@ export class BackendService {
lock_time: 0,
fee: this.moneyToIntPipe.transform(fee),
comment: comment,
push_payer: true
push_payer: !hide
};
this.runCommand('transfer', params, callback);
}
@ -604,6 +604,10 @@ export class BackendService {
});
}
setLogLevel(level) {
return this.runCommand('set_log_level', {v: level});
}
}
@ -629,10 +633,6 @@ export class BackendService {
});
},
setLogLevel: function (level) {
return this.runCommand('set_log_level', asVal(level))
},
resetWalletPass: function (wallet_id, pass, callback) {
this.runCommand('reset_wallet_password', {wallet_id: wallet_id, pass: pass}, callback);
},

View file

@ -16,12 +16,12 @@ export class VariablesService {
public appLogin = false;
public moneyEquivalent = 0;
public defaultTheme = 'dark';
public defaultCurrency = 'ZAN';
public defaultCurrency = 'ZANO';
public opening_wallet: Wallet;
public exp_med_ts = 0;
public height_app = 0;
public last_build_available = '';
public daemon_state = 0;
public daemon_state = 3;
public sync = {
progress_value: 0,
progress_value_text: '0'
@ -31,6 +31,7 @@ export class VariablesService {
public settings = {
appLockTime: 15,
appLog: 0,
theme: '',
scale: 10,
language: 'en',

View file

@ -20,6 +20,7 @@ export class AppComponent implements OnInit, OnDestroy {
expMedTsEvent;
onQuitRequest = false;
firstOnlineState = false;
translateUsed = false;
needOpenWallets = [];
@ -32,7 +33,7 @@ export class AppComponent implements OnInit, OnDestroy {
public translate: TranslateService,
private backend: BackendService,
private router: Router,
private variablesService: VariablesService,
public variablesService: VariablesService,
private ngZone: NgZone,
private intToMoneyPipe: IntToMoneyPipe,
private modalService: ModalService
@ -41,23 +42,33 @@ export class AppComponent implements OnInit, OnDestroy {
translate.setDefaultLang('en');
// const browserLang = translate.getBrowserLang();
// translate.use(browserLang.match(/en|fr/) ? browserLang : 'en');
translate.use('en').subscribe(() => {
this.translateUsed = true;
});
}
setBackendLocalization() {
const stringsArray = [
this.translate.instant('BACKEND_LOCALIZATION.QUIT'),
this.translate.instant('BACKEND_LOCALIZATION.IS_RECEIVED'),
this.translate.instant('BACKEND_LOCALIZATION.IS_CONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.INCOME_TRANSFER_UNCONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.INCOME_TRANSFER_CONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.MINED'),
this.translate.instant('BACKEND_LOCALIZATION.LOCKED'),
this.translate.instant('BACKEND_LOCALIZATION.IS_MINIMIZE'),
this.translate.instant('BACKEND_LOCALIZATION.RESTORE'),
this.translate.instant('BACKEND_LOCALIZATION.TRAY_MENU_SHOW'),
this.translate.instant('BACKEND_LOCALIZATION.TRAY_MENU_MINIMIZE')
];
this.backend.setBackendLocalization(stringsArray, 'en');
if (this.translateUsed) {
const stringsArray = [
this.translate.instant('BACKEND_LOCALIZATION.QUIT'),
this.translate.instant('BACKEND_LOCALIZATION.IS_RECEIVED'),
this.translate.instant('BACKEND_LOCALIZATION.IS_CONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.INCOME_TRANSFER_UNCONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.INCOME_TRANSFER_CONFIRMED'),
this.translate.instant('BACKEND_LOCALIZATION.MINED'),
this.translate.instant('BACKEND_LOCALIZATION.LOCKED'),
this.translate.instant('BACKEND_LOCALIZATION.IS_MINIMIZE'),
this.translate.instant('BACKEND_LOCALIZATION.RESTORE'),
this.translate.instant('BACKEND_LOCALIZATION.TRAY_MENU_SHOW'),
this.translate.instant('BACKEND_LOCALIZATION.TRAY_MENU_MINIMIZE')
];
this.backend.setBackendLocalization(stringsArray, 'en');
} else {
console.warn('wait translate use');
setTimeout(() => {
this.setBackendLocalization();
}, 10000);
}
}
ngOnInit() {
@ -141,7 +152,7 @@ export class AppComponent implements OnInit, OnDestroy {
const wallet = this.variablesService.getWallet(data.wallet_id);
if (wallet) {
this.ngZone.run(() => {
wallet.progress = data.progress;
wallet.progress = (data.progress < 0) ? 0 : ((data.progress > 100) ? 100 : data.progress);
if (wallet.progress === 0) {
wallet.loaded = false;
} else if (wallet.progress === 100) {
@ -506,6 +517,8 @@ export class AppComponent implements OnInit, OnDestroy {
this.setBackendLocalization();
this.backend.setLogLevel(this.variablesService.settings.appLog);
if (this.router.url !== '/login') {
this.backend.haveSecureAppData((statusPass) => {
if (statusPass) {

View file

@ -14,7 +14,7 @@
<form class="form-assign" [formGroup]="assignForm">
<div class="input-block alias-name">
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
<label for="alias-name" tooltip="{{ 'ASSIGN_ALIAS.NAME.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="50">
{{ 'ASSIGN_ALIAS.NAME.LABEL' | translate }}
</label>
<input type="text" id="alias-name" formControlName="name" placeholder="{{ 'ASSIGN_ALIAS.NAME.PLACEHOLDER' | translate }}" (contextmenu)="variablesService.onContextMenu($event)">
@ -42,7 +42,7 @@
</div>
<div class="input-block textarea">
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="500">
<label for="alias-comment" tooltip="{{ 'ASSIGN_ALIAS.COMMENT.TOOLTIP' | translate }}" placement="bottom-left" tooltipClass="table-tooltip assign-alias-tooltip" [delay]="50">
{{ 'ASSIGN_ALIAS.COMMENT.LABEL' | translate }}
</label>
<textarea id="alias-comment"

View file

@ -32,6 +32,12 @@ export class ContractsComponent implements OnInit, OnDestroy {
if (a.timestamp > b.timestamp) {
return -1;
}
if (a.contract_id < b.contract_id) {
return 1;
}
if (a.contract_id > b.contract_id) {
return -1;
}
return 0;
});
}

View file

@ -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';

View file

@ -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) => {
@ -37,11 +39,11 @@ export class MainComponent implements OnInit {
}
openInBrowser() {
this.backend.openUrlInBrowser('docs.zano.org/v1.0/docs/how-to-create-wallet');
this.backend.openUrlInBrowser('docs.zano.org/docs/getting-started-1#section-create-new-wallet');
}
back() {
this.location.back()
this.location.back();
}
}

View file

@ -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(['/']);
});

View file

@ -247,9 +247,8 @@
</div>
<div class="time-cancel-block-row" *ngIf="showTimeSelect && !newPurchase && currentContract.is_a && (currentContract.state == 201 || currentContract.state == 2 || currentContract.state == 120 || currentContract.state == 130)">
<div>{{ 'PURCHASE.WAITING_TIME_QUESTION' | translate }}</div>
<div class="time-cancel-block-question">{{ 'PURCHASE.WAITING_TIME_QUESTION' | translate }}</div>
<div class="input-block">
<label for="purchase-timeCancel">{{ 'PURCHASE.WAITING_TIME' | translate }}</label>
<ng-select id="purchase-timeCancel" class="lock-selection-select"
[clearable]="false"
[searchable]="false"
@ -260,6 +259,7 @@
</ng-option>
</ng-select>
</div>
<label for="purchase-timeCancel">{{ 'PURCHASE.WAITING_TIME' | translate }}</label>
<div class="time-cancel-block-buttons">
<button type="button" class="blue-button" (click)="showTimeSelect = false;">{{ 'PURCHASE.CANCEL' | translate }}</button>
<button type="button" class="blue-button" (click)="dealsDetailsCancel();">{{ 'PURCHASE.BUTTON_CANCEL_BUYER' | translate }}</button>

View file

@ -136,10 +136,18 @@
align-items: center;
justify-content: center;
.time-cancel-block-question {
margin-bottom: 1rem;
}
.input-block {
width: 25%;
}
label {
margin-bottom: 1rem;
}
.time-cancel-block-buttons {
display: flex;
align-items: center;

View file

@ -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();

View file

@ -76,6 +76,11 @@
</div>
</div>
<div class="checkbox-block">
<input type="checkbox" id="send-hide" class="style-checkbox" formControlName="hide">
<label for="send-hide">{{ 'SEND.HIDE' | translate }}</label>
</div>
</div>
<button type="submit" class="blue-button" [disabled]="!sendForm.valid || !variablesService.currentWallet.loaded">{{ 'SEND.BUTTON' | translate }}</button>

View file

@ -66,6 +66,14 @@
padding-right: 1.5rem;
}
}
.checkbox-block {
flex-basis: 50%;
> label {
top: 3.5rem;
}
}
}
button {

View file

@ -86,7 +86,8 @@ export class SendComponent implements OnInit, OnDestroy {
return {'less_min': true};
}
return null;
}])
}]),
hide: new FormControl(false)
});
additionalOptions = false;
@ -146,6 +147,7 @@ export class SendComponent implements OnInit, OnDestroy {
this.sendForm.get('fee').value,
this.sendForm.get('mixin').value,
this.sendForm.get('comment').value,
this.sendForm.get('hide').value,
(send_status) => {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');
@ -170,6 +172,7 @@ export class SendComponent implements OnInit, OnDestroy {
this.sendForm.get('fee').value,
this.sendForm.get('mixin').value,
this.sendForm.get('comment').value,
this.sendForm.get('hide').value,
(send_status) => {
if (send_status) {
this.modalService.prepareModal('success', 'SEND.SUCCESS_SENT');

View file

@ -50,6 +50,19 @@
</ng-select>
</div>
<div class="lock-selection">
<label class="lock-selection-title">{{ 'SETTINGS.APP_LOG_TITLE' | translate }}</label>
<ng-select class="lock-selection-select"
[items]="appLogOptions"
bindValue="id"
bindLabel="id"
[(ngModel)]="variablesService.settings.appLog"
[clearable]="false"
[searchable]="false"
(change)="onLogChange()">
</ng-select>
</div>
<form class="master-password" [formGroup]="changeForm" (ngSubmit)="onSubmitChangePass()">
<span class="master-password-title">{{ 'SETTINGS.MASTER_PASSWORD.TITLE' | translate }}</span>

View file

@ -50,6 +50,26 @@ export class SettingsComponent implements OnInit {
name: '150% scale'
}
];
appLogOptions = [
{
id: -1
},
{
id: 0
},
{
id: 1
},
{
id: 2
},
{
id: 3
},
{
id: 4
}
];
currentBuild = '';
@ -118,6 +138,11 @@ export class SettingsComponent implements OnInit {
this.backend.storeAppData();
}
onLogChange() {
this.backend.setLogLevel(this.variablesService.settings.appLog);
this.backend.storeAppData();
}
back() {
this.location.back();
}

View file

@ -45,12 +45,14 @@
}
.chart {
position: relative;
display: flex;
align-items: center;
flex: 1 1 auto;
min-height: 40rem;
> div {
position: absolute;
width: 100%;
height: 100%;
}

View file

@ -31,7 +31,7 @@
<div class="tabs">
<div class="tabs-header">
<ng-container *ngFor="let tab of tabs; let index = index">
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && variablesService.daemon_state !== 2" (click)="changeTab(index)">
<div class="tab" [class.active]="tab.active" [class.disabled]="(tab.link === '/send' || tab.link === '/contracts' || tab.link === '/staking') && (variablesService.daemon_state !== 2 || !variablesService.currentWallet.loaded)" (click)="changeTab(index)">
<i class="icon" [ngClass]="tab.icon"></i>
<span>{{ tab.title | translate }}</span>
<span class="indicator" *ngIf="tab.indicator">{{variablesService.currentWallet.new_contracts}}</span>

View file

@ -104,7 +104,7 @@ export class WalletComponent implements OnInit, OnDestroy {
}
changeTab(index) {
if ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && this.variablesService.daemon_state !== 2) {
if ((this.tabs[index].link === '/send' || this.tabs[index].link === '/contracts' || this.tabs[index].link === '/staking') && (this.variablesService.daemon_state !== 2 || !this.variablesService.currentWallet.loaded)) {
return;
}
this.tabs.forEach((tab) => {

View file

@ -146,7 +146,8 @@
"PASS_NOT_MATCH": "Old password not match.",
"CONFIRM_NOT_MATCH": "Confirm password not match."
},
"LAST_BUILD": "Current build: {{value}}"
"LAST_BUILD": "Current build: {{value}}",
"APP_LOG_TITLE": "Log level:"
},
"WALLET": {
"REGISTER_ALIAS": "Register an alias",
@ -249,6 +250,7 @@
"DETAILS": "Additional details",
"MIXIN": "Mixin",
"FEE": "Fee",
"HIDE": "Hide your wallet address from receiver",
"BUTTON": "Send",
"SUCCESS_SENT": "Transaction sent",
"FORM_ERRORS": {
@ -511,7 +513,7 @@
"MINED": "Mined",
"LOCKED": "Blocked",
"IS_MINIMIZE": "Zano application is minimized to the system tray",
"RESTORE": "You can recover it by double-clicking or using the context menu",
"RESTORE": "You can recover it by clicking or using the context menu",
"TRAY_MENU_SHOW": "Resize",
"TRAY_MENU_MINIMIZE": "Minimize"
}

View file

@ -821,7 +821,7 @@ namespace
}
m_json_helper.feed(str, data_size);
LP_CC_WORKER(m_context, "DATA received <<<<<<<<<<<<< " << data_size << " bytes:" << ENDL << std::string(str, data_size), LOG_LEVEL_0);
LP_CC_WORKER(m_context, "DATA received <<<<<<<<<<<<< " << data_size << " bytes:" << ENDL << std::string(str, data_size), LOG_LEVEL_4);
if (m_json_helper.has_objects())
{
@ -975,7 +975,7 @@ namespace
void send(const std::string& data)
{
static_cast<epee::net_utils::i_service_endpoint*>(m_p_connection)->do_send(data.c_str(), data.size());
LOG_PRINT_CC(m_context, "DATA sent >>>>>>>>>>>>> " << ENDL << data, LOG_LEVEL_0);
LOG_PRINT_CC(m_context, "DATA sent >>>>>>>>>>>>> " << ENDL << data, LOG_LEVEL_4);
}
void send_notification(const std::string& json)

View file

@ -2,6 +2,6 @@
#define BUILD_COMMIT_ID "@VERSION@"
#define PROJECT_VERSION "1.0"
#define PROJECT_VERSION_BUILD_NO 18
#define PROJECT_VERSION_BUILD_NO 21
#define PROJECT_VERSION_BUILD_NO_STR STRINGIFY_EXPAND(PROJECT_VERSION_BUILD_NO)
#define PROJECT_VERSION_LONG PROJECT_VERSION "." PROJECT_VERSION_BUILD_NO_STR "[" BUILD_COMMIT_ID "]"

View file

@ -2102,9 +2102,9 @@ uint64_t wallet2::balance(uint64_t& unloked) const
return balance(unloked, fake, fake, fake);
}
//----------------------------------------------------------------------------------------------------
uint64_t wallet2::balance(uint64_t& unloked, uint64_t& awaiting_in, uint64_t& awaiting_out, uint64_t& mined) const
uint64_t wallet2::balance(uint64_t& unlocked, uint64_t& awaiting_in, uint64_t& awaiting_out, uint64_t& mined) const
{
unloked = 0;
unlocked = 0;
uint64_t balance_total = 0;
awaiting_in = 0;
awaiting_out = 0;
@ -2124,7 +2124,7 @@ uint64_t wallet2::balance(uint64_t& unloked, uint64_t& awaiting_in, uint64_t& aw
{
balance_total += td.amount();
if (is_transfer_unlocked(td))
unloked += td.amount();
unlocked += td.amount();
if (td.m_flags & WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER)
mined += td.amount();
// bool pos_coinbase = false;
@ -4082,16 +4082,24 @@ void wallet2::transfer(const std::vector<currency::tx_destination_entry>& dsts,
return;
}
TIME_MEASURE_START(finalize_transaction_time);
crypto::secret_key sk = AUTO_VAL_INIT(sk);
finalize_transaction(ftp, tx, sk, send_to_network);
TIME_MEASURE_FINISH(finalize_transaction_time);
// unlock transfers at the very end
TIME_MEASURE_START(mark_transfers_as_spent_time);
mark_transfers_as_spent(ftp.selected_transfers, std::string("money transfer, tx: ") + epee::string_tools::pod_to_hex(get_transaction_hash(tx)));
TIME_MEASURE_FINISH(mark_transfers_as_spent_time);
TIME_MEASURE_START(finalize_transaction_time);
try
{
crypto::secret_key sk = AUTO_VAL_INIT(sk);
finalize_transaction(ftp, tx, sk, send_to_network);
}
catch (...)
{
clear_transfers_from_flag(ftp.selected_transfers, WALLET_TRANSFER_DETAIL_FLAG_SPENT, std::string("exception on money transfer, tx: ") + epee::string_tools::pod_to_hex(get_transaction_hash(tx)));
throw;
}
TIME_MEASURE_FINISH(finalize_transaction_time);
WLT_LOG_GREEN("[wallet::transfer]"
<< " precalculation_time: " << print_fixed_decimal_point(precalculation_time, 3)
<< ", prepare_transaction_time: " << print_fixed_decimal_point(prepare_transaction_time, 3)

View file

@ -368,7 +368,7 @@ namespace tools
uint64_t amount() const { return m_ptx_wallet_info->m_tx.vout[m_internal_output_index].amount; }
bool is_spent() const { return m_flags & WALLET_TRANSFER_DETAIL_FLAG_SPENT; }
bool is_spendable() const { return (m_flags & (~WALLET_TRANSFER_DETAIL_FLAG_MINED_TRANSFER)) == 0; } // spenable = has no flags or mined flag only
bool is_spendable() const { return (m_flags & (WALLET_TRANSFER_DETAIL_FLAG_SPENT | WALLET_TRANSFER_DETAIL_FLAG_BLOCKED | WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION | WALLET_TRANSFER_DETAIL_FLAG_COLD_SIG_RESERVATION)) == 0; }
bool is_reserved_for_escrow() const { return ( (m_flags & WALLET_TRANSFER_DETAIL_FLAG_ESCROW_PROPOSAL_RESERVATION) != 0 ); }
BEGIN_KV_SERIALIZE_MAP()

View file

@ -809,6 +809,7 @@ int main(int argc, char* argv[])
GENERATE_AND_PLAY(mined_balance_wallet_test);
GENERATE_AND_PLAY(wallet_outputs_with_same_key_image);
GENERATE_AND_PLAY(wallet_unconfirmed_tx_expiration);
GENERATE_AND_PLAY(wallet_unconfimed_tx_balance);
GENERATE_AND_PLAY(wallet_rpc_integrated_address);
GENERATE_AND_PLAY(wallet_rpc_integrated_address_transfer);

View file

@ -24,11 +24,11 @@ const currency::account_base null_account = AUTO_VAL_INIT(null_account);
struct wlt_lambda_on_transfer2_wrapper : public tools::i_wallet2_callback
{
typedef std::function<bool(const tools::wallet_rpc::wallet_transfer_info&)> Func;
typedef std::function<bool(const tools::wallet_rpc::wallet_transfer_info&, uint64_t, uint64_t, uint64_t)> Func;
wlt_lambda_on_transfer2_wrapper(Func callback) : m_result(false), m_callback(callback) {}
virtual void on_transfer2(const tools::wallet_rpc::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) override
{
m_result = m_callback(wti);
m_result = m_callback(wti, balance, unlocked_balance, total_mined);
}
bool m_result;
Func m_callback;
@ -1777,7 +1777,7 @@ bool gen_wallet_alias_via_special_wallet_funcs::c1(currency::core& c, size_t ev_
uint64_t biggest_alias_reward = get_alias_coast_from_fee("a", TESTS_DEFAULT_FEE);
std::shared_ptr<wlt_lambda_on_transfer2_wrapper> l(new wlt_lambda_on_transfer2_wrapper(
[biggest_alias_reward](const tools::wallet_rpc::wallet_transfer_info& wti) -> bool {
[biggest_alias_reward](const tools::wallet_rpc::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) -> bool {
return std::count(wti.recipients_aliases.begin(), wti.recipients_aliases.end(), "minerminer") == 1 &&
wti.amount == biggest_alias_reward;
}
@ -3214,3 +3214,86 @@ bool wallet_chain_switch_with_spending_the_same_ki::c1(currency::core& c, size_t
return true;
}
//------------------------------------------------------------------------------
wallet_unconfimed_tx_balance::wallet_unconfimed_tx_balance()
{
REGISTER_CALLBACK_METHOD(wallet_unconfimed_tx_balance, c1);
}
bool wallet_unconfimed_tx_balance::generate(std::vector<test_event_entry>& events) const
{
// Test outline:
// 1. Miner sends 100 coins to Alice (50 + 50)
// 2. Alice sends 30 back to Miner (tx is unconfirmed)
// 3. Make sure Alice's wallet has correct balance, when it is checked from wallet's callback
// 4. Few blocks are mined so the tx is get confirmed
// 5. Make sure Alice's balance has changed correctly
m_accounts.resize(TOTAL_ACCS_COUNT);
account_base& miner_acc = m_accounts[MINER_ACC_IDX]; miner_acc.generate();
account_base& alice_acc = m_accounts[ALICE_ACC_IDX]; alice_acc.generate();
MAKE_GENESIS_BLOCK(events, blk_0, miner_acc, test_core_time::get_time());
REWIND_BLOCKS_N(events, blk_0r, blk_0, miner_acc, CURRENCY_MINED_MONEY_UNLOCK_WINDOW);
MAKE_TX(events, tx_0, miner_acc, alice_acc, MK_TEST_COINS(50), blk_0r);
MAKE_TX(events, tx_1, miner_acc, alice_acc, MK_TEST_COINS(50), blk_0r);
MAKE_NEXT_BLOCK_TX_LIST(events, blk_1, blk_0r, miner_acc, std::list<transaction>({ tx_0, tx_1 }));
REWIND_BLOCKS_N(events, blk_1r, blk_1, miner_acc, WALLET_DEFAULT_TX_SPENDABLE_AGE);
DO_CALLBACK(events, "c1");
return true;
}
bool wallet_unconfimed_tx_balance::c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events)
{
bool r = false;
std::shared_ptr<tools::wallet2> alice_wlt = init_playtime_test_wallet(events, c, ALICE_ACC_IDX);
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, MK_TEST_COINS(100), false, UINT64_MAX, MK_TEST_COINS(100)), false, "");
bool callback_is_ok = false;
// this callback will ba called from within wallet2::transfer() below
std::shared_ptr<wlt_lambda_on_transfer2_wrapper> l(new wlt_lambda_on_transfer2_wrapper(
[&callback_is_ok](const tools::wallet_rpc::wallet_transfer_info& wti, uint64_t balance, uint64_t unlocked_balance, uint64_t total_mined) -> bool
{
CHECK_AND_ASSERT_MES(balance == MK_TEST_COINS(70), false, "invalid balance: " << print_money_brief(balance));
CHECK_AND_ASSERT_MES(unlocked_balance == MK_TEST_COINS(50), false, "invalid unlocked_balance: " << print_money_brief(unlocked_balance));
CHECK_AND_ASSERT_MES(total_mined == 0, false, "invalid total_mined: " << print_money_brief(total_mined));
callback_is_ok = true;
return true;
}
));
alice_wlt->callback(l);
uint64_t fee = TESTS_DEFAULT_FEE * 3;
std::vector<tx_destination_entry> destinations{ tx_destination_entry(MK_TEST_COINS(30) - fee, m_accounts[MINER_ACC_IDX].get_public_address()) };
try
{
alice_wlt->transfer(destinations, 0, 0, fee, empty_extra, empty_attachment);
}
catch (std::exception &e)
{
CHECK_AND_ASSERT_MES(false, false, "alice_wlt->transfer() caused an exception: " << e.what());
}
CHECK_AND_NO_ASSERT_MES(callback_is_ok, false, "callback failed");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 1, false, "Tx pool has incorrect number of txs: " << c.get_pool_transactions_count());
// 50 coins should be locked and 50 - unlocked
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, MK_TEST_COINS(70), false, UINT64_MAX, MK_TEST_COINS(50), 0, 0, MK_TEST_COINS(30) - fee), false, "");
// mine WALLET_DEFAULT_TX_SPENDABLE_AGE blocks so the tx get confirmed and coins get unlocked
CHECK_AND_ASSERT_MES(mine_next_pow_blocks_in_playtime(m_accounts[MINER_ACC_IDX].get_public_address(), c, WALLET_DEFAULT_TX_SPENDABLE_AGE), false, "");
CHECK_AND_ASSERT_MES(c.get_pool_transactions_count() == 0, false, "Tx pool has incorrect number of txs: " << c.get_pool_transactions_count());
CHECK_AND_ASSERT_MES(refresh_wallet_and_check_balance("", "Alice", alice_wlt, MK_TEST_COINS(70), false, UINT64_MAX, MK_TEST_COINS(70), 0, 0, 0), false, "");
return true;
}

View file

@ -244,3 +244,10 @@ struct wallet_chain_switch_with_spending_the_same_ki : public wallet_test
bool generate(std::vector<test_event_entry>& events) const;
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
};
struct wallet_unconfimed_tx_balance : public wallet_test
{
wallet_unconfimed_tx_balance();
bool generate(std::vector<test_event_entry>& events) const;
bool c1(currency::core& c, size_t ev_index, const std::vector<test_event_entry>& events);
};

View file

@ -599,50 +599,6 @@ bool transactions_flow_test(
w1.store();
LOG_PRINT_GREEN("Wallet stored OK", LOG_LEVEL_0);
//
//
// LOG_PRINT_L0( "waiting some new blocks...");
// misc_utils::sleep_no_w(DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN*20*1000);//wait two blocks before sync on another wallet on another daemon
// LOG_PRINT_L0( "Refreshing...");
// bool recvd_money = false;
// while(w2.refresh(blocks_fetched, recvd_money, ok, stop) && ( (blocks_fetched && recvd_money) || !blocks_fetched ) )
// {
// misc_utils::sleep_no_w(DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN*1000);//wait two blocks before sync on another wallet on another daemon
// }
//
// uint64_t money_2 = w2.balance();
// if(money_2 == transfered_money)
// {
// LOG_PRINT_GREEN("-----------------------FINISHING TRANSACTIONS FLOW TEST OK-----------------------", LOG_LEVEL_0);
// LOG_PRINT_GREEN("transferred " << print_money(transfered_money) << " via " << i << " transactions" , LOG_LEVEL_0);
// return true;
// }else
// {
// tools::wallet2::transfer_container tc;
// w2.get_transfers(tc);
// BOOST_FOREACH(tools::wallet2::transfer_details& td, tc)
// {
// auto it = txs.find(get_transaction_hash(td.m_ptx_wallet_info->m_tx));
// CHECK_AND_ASSERT_MES(it != txs.end(), false, "transaction not found in local cache");
// it->second.m_received_count += 1;
// }
//
// BOOST_FOREACH(auto& tx_pair, txs)
// {
// if(tx_pair.second.m_received_count != 1)
// {
// LOG_PRINT_RED_L0("Transaction lost: " << get_transaction_hash(tx_pair.second.tx));
// }
//
// }
//
// LOG_PRINT_RED_L0("-----------------------FINISHING TRANSACTIONS FLOW TEST FAILED-----------------------" );
// LOG_PRINT_RED_L0("income " << print_money(money_2) << " via " << i << " transactions, expected money = " << print_money(transfered_money) );
// LOCAL_ASSERT(false);
// return false;
// }
return true;
}