priority selection added

pull/24/head
moneroexamples 7 years ago
parent 4dac1ae418
commit 3819bbb52c

@ -1,6 +1,6 @@
var config = {
apiUrl: "http://127.0.0.1:1984/",
testnet: false,
testnet: true,
coinUnitPlaces: 12,
txMinConfirms: 10, // corresponds to CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE in Monero
txCoinbaseMinConfirms: 60, // corresponds to CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW in Monero

@ -39,8 +39,23 @@ thinwalletCtrls.controller('SendCoinsCtrl', function($scope, $http, $q, AccountS
$scope.success_page = false;
$scope.sent_tx = {};
// few multiplayers based on uint64_t wallet2::get_fee_multiplier
var fee_multiplayers = [1, 4, 20, 166];
var default_priority = 2;
$scope.priority = default_priority;
$scope.openaliasDialog = undefined;
function isInt(value) {
return !isNaN(value) &&
parseInt(Number(value)) == value &&
!isNaN(parseInt(value, 10));
}
function confirmOpenAliasAddress(domain, address, name, description, dnssec_used) {
var deferred = $q.defer();
@ -70,12 +85,15 @@ thinwalletCtrls.controller('SendCoinsCtrl', function($scope, $http, $q, AccountS
$scope.transferConfirmDialog = undefined;
function confirmTransfer(address, amount, tx_hash, fee, tx_prv_key, payment_id, mixin) {
function confirmTransfer(address, amount, tx_hash, fee, tx_prv_key, payment_id, mixin, priority) {
var deferred = $q.defer();
if ($scope.transferConfirmDialog !== undefined) {
deferred.reject("transferConfirmDialog is already being shown!");
return;
}
var priority_names = ["Low", "Medium", "High", "Paranoid"];
$scope.transferConfirmDialog = {
address: address,
fee: fee,
@ -84,6 +102,7 @@ thinwalletCtrls.controller('SendCoinsCtrl', function($scope, $http, $q, AccountS
tx_prv_key: tx_prv_key,
payment_id: payment_id,
mixin: mixin,
priority: priority_names[priority - 1],
confirm: function() {
$scope.transferConfirmDialog = undefined;
deferred.resolve();
@ -229,11 +248,21 @@ thinwalletCtrls.controller('SendCoinsCtrl', function($scope, $http, $q, AccountS
var feePerKB = new JSBigInt(config.feePerKB);
var priority = $scope.priority || 2;
// few multiplayers based on uint64_t wallet2::get_fee_multiplier
var fee_multiplayers = [1, 4, 20, 166];
if (!isInt(priority))
{
$scope.submitting = false;
$scope.error = "Priority is not an integer number";
return;
}
var priority = 2;
if (!(priority >= 1 && priority <= 4))
{
$scope.submitting = false;
$scope.error = "Priority is not between 1 and 4";
return;
}
var fee_multiplayer = fee_multiplayers[priority - 1]; // default is 4
@ -386,7 +415,8 @@ thinwalletCtrls.controller('SendCoinsCtrl', function($scope, $http, $q, AccountS
confirmTransfer(realDsts[0].address, realDsts[0].amount,
tx_hash, neededFee, tx_prvkey, payment_id, mixin).then(function() {
tx_hash, neededFee, tx_prvkey, payment_id,
mixin, priority).then(function() {
//alert('Confirmed ');

@ -21,6 +21,10 @@
<label class="field-label review">Mixin</label>
<div class="review-text">{{transferConfirmDialog.mixin}}</div>
</div>
<div class="w-col w-col-4 responsive-column">
<label class="field-label review">Priority</label>
<div class="review-text">{{transferConfirmDialog.priority}}</div>
</div>
</div>
<label class="field-label review" for="Mnemonic-2">Payment ID</label>
<div class="move-text-div">

@ -68,6 +68,14 @@
<option value="10">High (mix with 10 others)</option>
<option value="20">Paranoid (mix with 20 others)</option>
</select>
<label class="send-label" for="field4">Priority Level (adjusts miner fee)</label>
<select class="w-select" id="field4" name="Select-a-number" data-name="Select a number"
required="required" ng-model="priority">
<option value="1">Low (the cheapest, but might not confirm quickly)</option>
<option value="2">Medium (default, usually enough for all transactions)</option>
<option value="3">High (if you are in hurry and if there is some backlog of txs)</option>
<option value="4">Paranoid (absolute priority, but the most expensive obviously)</option>
</select>
<input class="w-button send-btn" id="form-submit" type="submit" value="Send Payment"
data-wait="Please wait..." ng-disabled="submitting">
</form>

Loading…
Cancel
Save