Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions data-service/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ export function get<K extends keyof IConfigParams>(key: K): IConfigParams[K] {
export function set<K extends keyof IConfigParams>(key: K, value: IConfigParams[K]): void {
config[key] = value;
if (key === 'node') {
time().then(serverTime => {
const now = Date.now();
const dif = now - serverTime.getTime();
time()
.then(serverTime => {
const now = Date.now();
const dif = now - serverTime.getTime();

if (Math.abs(dif) > 1000 * 30) {
timeDiff = dif;
} else {
timeDiff = 0;
}
});
if (Math.abs(dif) > 1000 * 30) {
timeDiff = dif;
} else {
timeDiff = 0;
}
})
.catch(() => null);
}
if (key === 'matcher') {
matcherSettingsPromise = request<any>({
Expand Down
3 changes: 2 additions & 1 deletion src/modules/dex/directives/createOrder/CreateOrder.js
Original file line number Diff line number Diff line change
Expand Up @@ -983,7 +983,8 @@
waves.matcher.getCreateOrderSettings(pair, matcherPublicKey)
.then(data => {
this.matcherSettings = data;
});
})
.catch(() => null);
});
}

Expand Down
12 changes: 3 additions & 9 deletions src/modules/ui/directives/avatar/Avatar.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(function () {
'use strict';

const ds = require('data-service');

/**
* @param {typeof Base} Base
* @param $q
Expand Down Expand Up @@ -48,16 +46,12 @@
this.size = 67;
}
if (this.address) {
ds.fetch(`${ds.config.get('node')}/addresses/scriptInfo/${this.address}`)
waves.node.scriptInfo(this.address)
.then(data => {
this.hasScript = !!data.script;
$scope.$apply();
});

waves.node.scriptInfo(this.address).then(data => {
this.hasScript = !!data.script;
$scope.$apply();
});
})
.catch(() => null);

$q((resolve) => {
resolve(identityImg.create(this.address, { size: this.size * 3 }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@
const baseAssetBalance = balance.available.getTokens().mul(rate).toFormat(2);
this.node.querySelector(`.${SELECTORS.EXCHANGE_RATE}`).innerHTML = rate.toFixed(2);
this.node.querySelector(`.${SELECTORS.BASE_ASSET_BALANCE}`).innerHTML = baseAssetBalance;
});
})
.catch(() => null);

const startDate = this.utils.moment().add().day(-7);
this.waves.utils.getRateHistory(balance.asset.id, baseAssetId, startDate).then(values => {
Expand Down