Skip to content

Commit 4a58925

Browse files
authored
Merge pull request #417 from wavesplatform/client-357-release-beta-8
Client 357 release beta 8
2 parents 401ddcc + 6b75ac5 commit 4a58925

15 files changed

Lines changed: 137 additions & 139 deletions

File tree

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "waves-client",
3-
"version": "1.0.0-beta.7",
3+
"version": "1.0.0-beta.8",
44
"description": "The official client application for the Waves platform",
55
"private": true,
66
"repository": {

src/modules/app/initialize/AppConfig.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
const abstract = item.get('abstract');
9797
const url = AppConfig.getUrlFromState(item);
9898
const redirectTo = item.get('redirectTo');
99+
const reloadOnSearch = item.get('reloadOnSearch');
99100

100101
const views = item.get('views').reduce((views, viewData) => {
101102
const controller = (abstract || viewData.noController) ? undefined :
@@ -112,7 +113,8 @@
112113
abstract,
113114
url,
114115
redirectTo,
115-
views
116+
views,
117+
reloadOnSearch
116118
});
117119
});
118120
}

src/modules/app/services/DefaultSettings.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,10 @@
6262
},
6363
dex: {
6464
chartCropRate: 1.5,
65-
amountAssetId: WavesApp.defaultAssets.WAVES,
66-
priceAssetId: WavesApp.defaultAssets.BTC,
65+
assetIdPair: {
66+
amount: WavesApp.defaultAssets.WAVES,
67+
price: WavesApp.defaultAssets.BTC
68+
},
6769
watchlist: {
6870
activeWatchListId: 'top',
6971
top: {

src/modules/dex/controllers/DexCtrl.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
constructor() {
1414
super();
1515

16-
this._amountAssetId = null;
17-
this._priceAssetId = null;
1816
this._leftHidden = false;
1917
this._rightHidden = false;
2018

2119
this.syncSettings({
22-
_amountAssetId: 'dex.amountAssetId',
23-
_priceAssetId: 'dex.priceAssetId',
2420
_leftHidden: 'dex.layout.leftColumnState',
2521
_rightHidden: 'dex.layout.rightColumnState',
2622
collapseMyOrders: 'dex.layout.myOrders.collapsed',

src/modules/dex/directives/createOrder/CreateOrder.js

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,10 @@
7171
*/
7272
this.totalPrice = null;
7373
/**
74-
* @type {string}
75-
* @private
76-
*/
77-
this._priceAssetId = null;
78-
/**
79-
* @type {string}
74+
* @type {{amount: string, price: string}}
8075
* @private
8176
*/
82-
this._amountAssetId = null;
77+
this._assetIdPair = null;
8378

8479
Waves.Money.fromTokens('0.003', WavesApp.defaultAssets.WAVES).then((money) => {
8580
this.fee = money;
@@ -93,16 +88,10 @@
9388
});
9489

9590
this.syncSettings({
96-
_amountAssetId: 'dex.amountAssetId',
97-
_priceAssetId: 'dex.priceAssetId'
91+
_assetIdPair: 'dex.assetIdPair'
9892
});
9993

100-
this.observe(['_amountAssetId', '_priceAssetId'], () => {
101-
102-
if (!this._priceAssetId || !this._amountAssetId) {
103-
return null;
104-
}
105-
94+
this.observe('_assetIdPair', () => {
10695
this.amount = null;
10796
this.price = null;
10897
balancesPoll.restart();
@@ -174,7 +163,7 @@
174163
createOrder(form) {
175164
user.getSeed()
176165
.then((seed) => {
177-
return Waves.AssetPair.get(this._amountAssetId, this._priceAssetId).then((pair) => {
166+
return Waves.AssetPair.get(this._assetIdPair.amount, this._assetIdPair.price).then((pair) => {
178167
return Promise.all([
179168
Waves.Money.fromTokens(this.amount.toFixed(), this.amountBalance.asset.id),
180169
Waves.OrderPrice.fromTokens(this.price.toFixed(), pair)
@@ -212,7 +201,7 @@
212201
}
213202

214203
_getBalances() {
215-
return Waves.AssetPair.get(this._amountAssetId, this._priceAssetId).then((pair) => {
204+
return Waves.AssetPair.get(this._assetIdPair.amount, this._assetIdPair.price).then((pair) => {
216205
return utils.whenAll([
217206
waves.node.assets.balance(pair.amountAsset.id),
218207
waves.node.assets.balance(pair.priceAsset.id)
@@ -223,9 +212,11 @@
223212
});
224213
}
225214

226-
_setBalances({ amountBalance, priceBalance }) {
227-
this.amountBalance = amountBalance;
228-
this.priceBalance = priceBalance;
215+
_setBalances(data) {
216+
if (data) {
217+
this.amountBalance = data.amountBalance;
218+
this.priceBalance = data.priceBalance;
219+
}
229220
}
230221

231222
/**
@@ -253,7 +244,7 @@
253244
* @private
254245
*/
255246
_getData() {
256-
return waves.matcher.getOrderBook(this._amountAssetId, this._priceAssetId)
247+
return waves.matcher.getOrderBook(this._assetIdPair.amount, this._assetIdPair.price)
257248
.then(({ bids, asks, spread }) => {
258249
const [lastAsk] = asks;
259250
const [firstBid] = bids;

src/modules/dex/directives/dexCandleChart/DexCandleChart.js

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,32 @@
2727
this.notLoaded = false;
2828

2929
/**
30-
* @type {string}
30+
* @type {{price: string, amount: string}}
3131
* @private
3232
*/
33-
this._amountAssetId = null;
34-
/**
35-
* @type {string}
36-
* @private
37-
*/
38-
this._priceAssetId = null;
33+
this._assetIdPair = null;
3934

40-
this.observe(['_amountAssetId', '_priceAssetId'], () => {
41-
if (this.notLoaded || !this._amountAssetId || !this._priceAssetId) {
42-
return null;
43-
}
35+
this.observe('_assetIdPair', () => {
4436

4537
if (this.chartReady) {
4638
this.chart.symbolInterval(({ interval }) => {
47-
this.chart.setSymbol(`${this._amountAssetId}/${this._priceAssetId}`, interval);
39+
this.chart.setSymbol(`${this._assetIdPair.amount}/${this._assetIdPair.price}`, interval);
4840
});
4941
} else {
5042
// TODO : wait until it's ready and switch to the active pair
5143
}
5244
});
5345

5446
this.syncSettings({
55-
_amountAssetId: 'dex.amountAssetId',
56-
_priceAssetId: 'dex.priceAssetId'
47+
_assetIdPair: 'dex.assetIdPair'
5748
});
5849
}
5950

6051
$postLink() {
6152
controller.load().then(() => {
6253
this.chart = new TradingView.widget({
6354
// debug: true,
64-
symbol: `${this._amountAssetId}/${this._priceAssetId}`,
55+
symbol: `${this._assetIdPair.amount}/${this._assetIdPair.price}`,
6556
interval: WavesApp.dex.defaultResolution,
6657
container_id: this.elementId,
6758
datafeed: candlesService,

src/modules/dex/directives/dexMyOrders/DexMyOrders.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,17 @@
1818
super();
1919

2020
/**
21-
* @type {string}
21+
* @type {{amount: string, price: string}}
2222
* @private
2323
*/
24-
this._amountAssetId = null;
25-
/**
26-
* @type {string}
27-
* @private
28-
*/
29-
this._priceAssetId = null;
24+
this._assetIdPair = null;
3025

3126
this.syncSettings({
32-
_amountAssetId: 'dex.amountAssetId',
33-
_priceAssetId: 'dex.priceAssetId'
27+
_assetIdPair: 'dex.assetIdPair'
3428
});
3529

3630
const poll = createPoll(this, this._getOrders, 'orders', 5000);
37-
this.observe(['_amountAssetId', '_priceAssetId'], () => poll.restart());
31+
this.observe('_assetIdPair', () => poll.restart());
3832
}
3933

4034
dropOrder(order) {
@@ -67,6 +61,7 @@
6761
.then((orders) => {
6862
const active = [];
6963
const others = [];
64+
7065
orders.forEach((order) => {
7166
switch (order.status) {
7267
case 'Accepted':

0 commit comments

Comments
 (0)