Skip to content

Commit b93b0d2

Browse files
committed
Merge remote-tracking branch 'origin/rebirth' into client-370-fix-leasing-overflow
2 parents 070f91b + 4a58925 commit b93b0d2

24 files changed

Lines changed: 208 additions & 145 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/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@
358358
{
359359
id: 'dex',
360360
data: {
361+
url:'/dex?assetId1&assetId2',
362+
reloadOnSearch: false,
361363
views: [{ name: 'mainContent' }]
362364
}
363365
},

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/less/app.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ a {
3636
cursor: pointer;
3737
}
3838

39+
/* Mac button text centering fix */
40+
w-button > button {
41+
w-i18n,
42+
div.full-width,
43+
div.full-width * {
44+
width: 100%;
45+
display: block;
46+
}
47+
}
48+
3949
md-input-container {
4050
transform: translate3d(0, 0, 0);
4151
}

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/app/services/waves/matcher/Matcher.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
}
6464

6565
/**
66+
* TODO Paulo add id for order for optimize draw trade history
6667
* @param keyPair
6768
* @returns {Promise<any>}
6869
* @private
@@ -191,8 +192,9 @@
191192
'PartiallyFilled': 'matcher.orders.statuses.filled'
192193
};
193194
const state = i18n.translate(STATUS_MAP[order.status], 'app', { percent });
195+
const isActive = ['Accepted', 'PartiallyFilled'].indexOf(order.status) !== -1;
194196

195-
return { ...order, price, amount, filled, pair, percent, state };
197+
return { ...order, isActive, price, amount, filled, pair, percent, state };
196198
});
197199
}
198200

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: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,47 +71,36 @@
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;
8681
});
8782

88-
/**
89-
* @type {Poll}
90-
*/
91-
const balancesPoll = createPoll(this, this._getBalances, this._setBalances, 1000);
92-
9383
this.receive(dexDataService.chooseOrderBook, ({ type, price, amount }) => {
9484
this.amount = new BigNumber(amount);
9585
this.price = new BigNumber(price);
9686
this.expand(type);
9787
$scope.$apply();
9888
});
9989

100-
this.observe(['_amountAssetId', '_priceAssetId'], () => {
101-
102-
if (!this._priceAssetId || !this._amountAssetId) {
103-
return null;
104-
}
90+
this.syncSettings({
91+
_assetIdPair: 'dex.assetIdPair'
92+
});
10593

94+
this.observe('_assetIdPair', () => {
10695
this.amount = null;
10796
this.price = null;
10897
balancesPoll.restart();
10998
});
11099

111-
this.syncSettings({
112-
_amountAssetId: 'dex.amountAssetId',
113-
_priceAssetId: 'dex.priceAssetId'
114-
});
100+
/**
101+
* @type {Poll}
102+
*/
103+
const balancesPoll = createPoll(this, this._getBalances, this._setBalances, 1000);
115104

116105
this.observe(['amount', 'price', 'step', 'type'], this._currentTotal);
117106

@@ -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,

0 commit comments

Comments
 (0)