Skip to content

Commit 896d4bf

Browse files
committed
add message key which support Flare Networks airdrop
1 parent 8fe309e commit 896d4bf

File tree

7 files changed

+64
-3
lines changed

7 files changed

+64
-3
lines changed

js/controller/security.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ myApp.controller("SecurityCtrl", ['$scope', '$rootScope', 'AuthenticationFactory
2424
XrpApi.checkSettings().then(data => {
2525
console.log(data);
2626
$scope.domain = data.domain;
27+
$scope.messagekey = data.messageKey;
2728
$scope.disallowxrp = !!data.disallowIncomingXRP;
2829
$scope.requiretag = !!data.requireDestinationTag;
2930
$scope.defaultrippling = !!data.defaultRipple;
@@ -78,6 +79,27 @@ myApp.controller("SecurityCtrl", ['$scope', '$rootScope', 'AuthenticationFactory
7879
});
7980
};
8081

82+
$scope.messagekey = '';
83+
$scope.messagekey_working = false;
84+
$scope.messagekey_done = false;
85+
$scope.setMessagekey = function() {
86+
$scope.error = '';
87+
$scope.messagekey_done = false;
88+
$scope.messagekey_working = true;
89+
if ($scope.isEthAddress) {
90+
$scope.messagekey = '02' + '0'.repeat(24) + $scope.messagekey.slice(2).toUpperCase();
91+
}
92+
XrpApi.changeSettings({'messageKey': $scope.messagekey}).then(result => {
93+
$scope.messagekey_working = false;
94+
$scope.messagekey_done = true;
95+
$rootScope.$apply();
96+
}).catch(err => {
97+
$scope.messagekey_working = false;
98+
console.error(err);
99+
$scope.error = err.message;
100+
$rootScope.$apply();
101+
});
102+
};
81103

82104
$scope.delete_warning = true;
83105
$scope.toggleWarning = function() {
@@ -100,5 +122,4 @@ myApp.controller("SecurityCtrl", ['$scope', '$rootScope', 'AuthenticationFactory
100122
});
101123
};
102124

103-
104125
} ]);

js/lang/translate_cn.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ var translate_cn = {
237237
public_net : '公共网络',
238238
test_net : '测试网络',
239239
other_net : '自定义',
240-
'Ripple Public Network' : '公共网络',
240+
'Ripple Public Network' : '瑞波公网',
241241
'Ripple Test Network' : '测试网络',
242242
'User defined' : '自定义',
243243
public_url : '瑞波公网节点',
@@ -265,6 +265,7 @@ var translate_cn = {
265265
requiretag : '对方转账时提示,支付需要提供标签号。',
266266
setrippling : '允许资产置换(Rippling)。此为危险操作,不要打开,除非你是发行方。',
267267
flags_done : '设置成功',
268+
messagekey_desc : '用于向该帐户发送加密消息的公钥。',
268269
manage_data : '数据',
269270
back : '返回',
270271

js/lang/translate_en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ var translate_en = {
265265
requiretag : 'Requires incoming payments to specify a destination tag.',
266266
setrippling : 'Enable rippling on this account’s trust lines by default. Do NOT enable it unless you are a issuer.',
267267
flags_done : 'Settings updated',
268+
messagekey_desc : 'Public key for sending encrypted messages to this account. ',
268269
manage_data : 'Manage Data',
269270
back : 'Back',
270271

js/lang/translate_jp.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ var translate_jp = {
266266
setrippling : '資産のスワップ(Rippling)を許可します。危険な操作です。発行者以外の場合にはつけないでください。',
267267
flags_done : '設定成功',
268268
manage_data : 'データ',
269+
messagekey_desc : 'このアカウントに暗号化されたメッセージを送信するための公開鍵。',
269270
back : '戻る',
270271

271272
AccountDelete : 'アカウントを削除する',

js/ripple/api.factory.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ myApp.factory('XrpApi', ['$rootScope', 'AuthenticationFactory', 'ServerManager',
271271
}
272272
resolve(result);
273273
} catch (err) {
274-
console.info('changeSettings', err);
274+
console.info('changeSettings', err.data || err);
275275
reject(err);
276276
}
277277
});
@@ -404,12 +404,14 @@ myApp.factory('XrpApi', ['$rootScope', 'AuthenticationFactory', 'ServerManager',
404404
order.quantity.counterparty = options.base_issuer;
405405
} else {
406406
order.quantity.currency = 'XRP';
407+
order.quantity.value = round(order.quantity.value, 6).toString();
407408
}
408409
if (options.counter_issuer) {
409410
order.totalPrice.currency = options.counter;
410411
order.totalPrice.counterparty = options.counter_issuer;
411412
} else {
412413
order.totalPrice.currency = 'XRP';
414+
order.totalPrice.value = round(order.totalPrice.value, 6).toString();
413415
}
414416
order.memos = [{data: _client, type: 'client', format: 'text'}];
415417
return new Promise(async (resolve, reject) => {

pages/convert.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ <h2 class="result-success" translate="cleared">Transaction cleared!</h2>
103103
<div class="service_alert">
104104
<div>{{send_error}}</div>
105105
</div>
106+
<hr>
107+
<div class="actionLink"><a href="" ng-click="init()" translate="back_convert">Do another conversion</a></div>
106108
</div>
107109
</div>
108110

pages/security.html

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<a href="javascript:" ng-class="{active: mode=='security'}" ng-click="mode='security'">{{'security' | translate}}</a>
66
<a href="javascript:" ng-class="{active: mode=='domain'}" ng-click="mode='domain'">{{'home_domain' | translate}}</a>
77
<a href="javascript:" ng-class="{active: mode=='payment'}" ng-click="mode='payment'">{{'payment_flag' | translate}}</a>
8+
<a href="javascript:" ng-class="{active: mode=='messagekey'}" ng-click="mode='messagekey'">Message Key</a>
89
<a href="javascript:" ng-class="{active: mode=='delete'}" ng-click="mode='delete'">{{'AccountDelete' | translate}}</a>
910
</div>
1011
</div>
@@ -114,6 +115,38 @@
114115
</div>
115116
</div>
116117

118+
<div class="col-sm-9" ng-show="mode=='messagekey'">
119+
<label translate="important">Important:</label>
120+
<p class="hint" translate="messagekey_desc">Public key for sending encrypted messages to this account. </p>
121+
<div class="row" style="margin-bottom: 20px;">
122+
<div class="col-xs-12 col-md-10">
123+
<label>Message Key</label>
124+
<input class="form-control" type="text" ng-model="messagekey" />
125+
</div>
126+
</div>
127+
<div class="row" style="margin-bottom: 20px;">
128+
<div class="col-xs-2 col-md-2">
129+
<label class="switch marginleft">
130+
<input type="checkbox" ng-model="isEthAddress" ng-disabled="messagekey_working">
131+
<span class="slider round"></span>
132+
</label>
133+
</div>
134+
<div class="col-xs-8 col-md-8">
135+
<label>Ethereum address</label>
136+
<p>Append 02 + 24 zeros to the uppercased character set to produce.</p>
137+
</div>
138+
</div>
139+
<div class="s-alert s-alert--success row__message" ng-show="messagekey_done" translate="flags_done">
140+
Settings updated.
141+
</div>
142+
<div class="row" style="margin-bottom: 20px;">
143+
<div class="col-xs-12 col-sm-5">
144+
<a class="btn btn-info btn-block btn-big" href="javascript:" ng-disabled="messagekey_working"
145+
ng-click="setMessagekey()" translate="save">Save</a>
146+
</div>
147+
</div>
148+
</div>
149+
117150
<div class="col-sm-9" ng-show="mode=='delete'">
118151
<label translate="important">Important:</label>
119152
<p class="hint" translate="merge_desc" translate-values="currentNetwork.coin">Danger operation! It transfers the native balance (the amount of XRP an account holds) to another account and removes the source account from the ledger.</p>

0 commit comments

Comments
 (0)