oxen-electron-gui-wallet/src/components/service_node/service_node_staking.vue

508 lines
14 KiB
Vue
Raw Normal View History

<template>
2020-03-03 04:16:23 +01:00
<div class="service-node-staking">
<div class="q-px-md q-pt-md">
2021-01-06 06:26:42 +01:00
<p class="tab-desc">
2020-09-08 04:17:55 +02:00
{{ $t("strings.serviceNodeContributionDescription") }}
<span
style="cursor: pointer; text-decoration: underline;"
2021-01-06 06:26:42 +01:00
@click="oxenWebsite"
2020-09-08 04:17:55 +02:00
>Loki {{ $t("strings.website") }}.</span
>
2020-09-07 07:47:57 +02:00
</p>
2021-01-06 06:26:42 +01:00
<OxenField
:label="$t('fieldLabels.serviceNodeKey')"
:error="$v.service_node.key.$error"
>
2020-03-03 04:16:23 +01:00
<q-input
v-model.trim="service_node.key"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.hexCharacters', { count: 64 })"
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
borderless
dense
2020-03-03 04:16:23 +01:00
@blur="$v.service_node.key.$touch"
/>
2021-01-06 06:26:42 +01:00
</OxenField>
<OxenField
:label="$t('fieldLabels.amount')"
class="q-mt-md"
:error="$v.service_node.amount.$error"
>
2020-03-03 04:16:23 +01:00
<q-input
v-model.trim="service_node.amount"
:dark="theme == 'dark'"
type="number"
min="0"
:max="unlocked_balance / 1e9"
placeholder="0"
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
borderless
dense
2020-03-03 04:16:23 +01:00
@blur="$v.service_node.amount.$touch"
/>
<q-btn
2021-01-06 06:26:42 +01:00
color="primary"
2020-03-03 04:16:23 +01:00
:text-color="theme == 'dark' ? 'white' : 'dark'"
:label="$t('buttons.min')"
:disable="!areButtonsEnabled()"
@click="service_node.amount = minStake(service_node.key)"
/>
<q-btn
2021-01-06 06:26:42 +01:00
color="primary"
:text-color="theme == 'dark' ? 'white' : 'dark'"
:label="$t('buttons.max')"
:disable="!areButtonsEnabled()"
@click="service_node.amount = maxStake(service_node.key)"
/>
2021-01-06 06:26:42 +01:00
</OxenField>
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
<div class="submit-button">
<q-btn
:disable="!is_able_to_send"
color="primary"
:label="$t('buttons.stake')"
@click="stake()"
/>
2020-03-03 04:16:23 +01:00
<q-btn
:disable="!is_able_to_send"
2021-01-06 06:26:42 +01:00
color="accent"
2020-03-03 04:16:23 +01:00
:label="$t('buttons.sweepAll')"
@click="sweepAllWarning()"
/>
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
</div>
</div>
<ServiceNodeContribute
:awaiting-service-nodes="awaiting_service_nodes"
class="contribute"
@contribute="fillStakingFields"
/>
<ConfirmTransactionDialog
:show="confirmSweepAll"
:amount="confirmFields.totalAmount"
:is-blink="confirmFields.isBlink"
:send-to="confirmFields.destination"
:fee="confirmFields.totalFees"
:on-confirm-transaction="onConfirmTransaction"
:on-cancel-transaction="onCancelTransaction"
/>
<q-inner-loading
:showing="stake_status.sending || sweep_all_status.sending"
>
<q-spinner color="primary" size="30" />
</q-inner-loading>
2020-03-03 04:16:23 +01:00
</div>
</template>
<script>
const objectAssignDeep = require("object-assign-deep");
2020-03-03 04:16:23 +01:00
import { mapState } from "vuex";
import { required, decimal } from "vuelidate/lib/validators";
import { service_node_key, greater_than_zero } from "src/validators/common";
2021-01-06 06:26:42 +01:00
import OxenField from "components/oxen_field";
2020-03-03 04:16:23 +01:00
import WalletPassword from "src/mixins/wallet_password";
import ConfirmDialogMixin from "src/mixins/confirm_dialog_mixin";
2020-09-07 05:43:36 +02:00
import ServiceNodeContribute from "./service_node_contribute";
import ServiceNodeMixin from "src/mixins/service_node_mixin";
import ConfirmTransactionDialog from "components/confirm_tx_dialog";
const DO_NOTHING = 10;
export default {
2020-03-03 04:16:23 +01:00
name: "ServiceNodeStaking",
components: {
2021-01-06 06:26:42 +01:00
OxenField,
ServiceNodeContribute,
ConfirmTransactionDialog
2020-03-03 04:16:23 +01:00
},
mixins: [WalletPassword, ConfirmDialogMixin, ServiceNodeMixin],
2020-03-03 04:16:23 +01:00
data() {
return {
service_node: {
key: "",
amount: 0,
// the min and max are for that particular SN,
// start at min/max for the wallet
minStakeAmount: 0,
maxStakeAmount: this.unlocked_balance / 1e9
},
confirmFields: {
isBlink: false,
totalAmount: -1,
destination: "",
totalFees: 0
2020-03-03 04:16:23 +01:00
}
};
},
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
unlocked_balance: state => state.gateway.wallet.info.unlocked_balance,
info: state => state.gateway.wallet.info,
stake_status: state => state.gateway.service_node_status.stake,
sweep_all_status: state => state.gateway.sweep_all_status,
2020-03-03 04:16:23 +01:00
award_address: state => state.gateway.wallet.info.address,
confirmSweepAll: state => state.gateway.sweep_all_status.code === 1,
2020-03-03 04:16:23 +01:00
is_ready() {
return this.$store.getters["gateway/isReady"];
},
is_able_to_send() {
return this.$store.getters["gateway/isAbleToSend"];
},
2020-03-03 04:16:23 +01:00
address_placeholder(state) {
const wallet = state.gateway.wallet.info;
const prefix = (wallet && wallet.address && wallet.address[0]) || "L";
return `${prefix}..`;
},
awaiting_service_nodes(state) {
const nodes = state.gateway.daemon.service_nodes.nodes;
// a reserved node is one on which someone is a "contributor" of amount = 0
const getOurContribution = node =>
node.contributors.find(
c => c.address === this.our_address && c.amount > 0
);
const isAwaitingContribution = node =>
!node.active && !node.funded && node.requested_unlock_height === 0;
const isAwaitingContributionNonReserved = node =>
isAwaitingContribution(node) && !getOurContribution(node);
const isAwaitingContributionReserved = node =>
isAwaitingContribution(node) && getOurContribution(node);
// we want the reserved nodes sorted by fee at the top
const awaitingContributionNodesReserved = nodes
.filter(isAwaitingContributionReserved)
.map(n => {
return {
...n,
awaitingContribution: true
};
});
const awaitingContributionNodesNonReserved = nodes
.filter(isAwaitingContributionNonReserved)
.map(n => {
return {
...n,
awaitingContribution: true
};
});
const compareFee = (n1, n2) =>
this.getFeeDecimal(n1) > this.getFeeDecimal(n2) ? 1 : -1;
awaitingContributionNodesReserved.sort(compareFee);
awaitingContributionNodesNonReserved.sort(compareFee);
const nodesForContribution = [
...awaitingContributionNodesReserved,
...awaitingContributionNodesNonReserved
];
return nodesForContribution;
2020-03-03 04:16:23 +01:00
}
}),
validations: {
service_node: {
key: { required, service_node_key },
amount: {
required,
decimal,
greater_than_zero
}
}
},
watch: {
stake_status: {
handler(val, old) {
if (val.code == old.code) return;
const { code, message } = val;
switch (code) {
2020-03-03 04:16:23 +01:00
case 0:
this.$q.notify({
type: "positive",
timeout: 1000,
message
2020-03-03 04:16:23 +01:00
});
this.$v.$reset();
this.service_node = {
key: "",
amount: 0
};
break;
case -1:
this.$q.notify({
type: "negative",
timeout: 3000,
message
2020-03-03 04:16:23 +01:00
});
break;
}
2020-03-03 04:16:23 +01:00
},
deep: true
},
sweep_all_status: {
handler(val, old) {
if (val.code == old.code) return;
const { code, message } = val;
switch (code) {
// the "nothing", so we can update state without doing anything
// in particular
case DO_NOTHING:
break;
case 1:
this.buildDialogFieldsSweepAll(val);
break;
case 0:
this.$q.notify({
type: "positive",
timeout: 1000,
message
});
this.$v.$reset();
this.newTx = {
amount: 0,
address: "",
// blink
priority: 5,
address_book: {
save: false,
name: "",
description: ""
},
note: ""
};
break;
case -1:
this.$q.notify({
type: "negative",
timeout: 3000,
message
});
break;
}
},
deep: true
2020-03-03 04:16:23 +01:00
}
},
methods: {
2021-01-06 06:26:42 +01:00
oxenWebsite() {
const url = "https://loki.network/service-nodes/";
2020-09-07 08:55:08 +02:00
this.$gateway.send("core", "open_url", {
url
});
},
2020-09-07 07:47:57 +02:00
fillStakingFields(key, minContribution) {
2020-09-07 05:43:36 +02:00
this.service_node.key = key;
2020-09-07 07:47:57 +02:00
this.service_node.amount = minContribution;
2020-09-07 05:43:36 +02:00
},
minStake() {
const node = this.getNodeWithPubKey();
return this.getMinContribution(node);
},
maxStake() {
const node = this.getNodeWithPubKey();
2021-01-06 06:26:42 +01:00
return this.openForContriubtionOxen(node);
},
getFeeDecimal(node) {
const operatorPortion = node.portions_for_operator;
return (operatorPortion / 18446744073709551612) * 100;
},
getNodeWithPubKey() {
const key = this.service_node.key;
const nodeOfKey = this.awaiting_service_nodes.find(
n => n.service_node_pubkey === key
);
if (!nodeOfKey) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.invalidServiceNodeKey")
});
return;
} else {
return nodeOfKey;
}
},
onConfirmTransaction() {
// put the loading spinner up
this.$store.commit("gateway/set_sweep_all_status", {
code: DO_NOTHING,
message: "Getting sweep all tx information",
sending: true
});
const isBlink = this.confirmFields.isBlink;
const relayTxData = {
isBlink,
isSweepAll: true
};
// Commit the transaction
this.$gateway.send("wallet", "relay_tx", relayTxData);
},
onCancelTransaction() {
this.$store.commit("gateway/set_sweep_all_status", {
code: DO_NOTHING,
message: "Cancel the transaction from confirm dialog",
sending: false
});
},
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
sweepAllWarning() {
2020-03-03 04:16:23 +01:00
this.$q
.dialog({
title: this.$t("dialog.sweepAllWarning.title"),
message: this.$t("dialog.sweepAllWarning.message"),
ok: {
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
label: this.$t("dialog.sweepAllWarning.ok"),
color: "primary"
2020-03-03 04:16:23 +01:00
},
cancel: {
flat: true,
label: this.$t("dialog.buttons.cancel"),
2021-01-06 06:26:42 +01:00
color: "negative"
}
2020-03-03 04:16:23 +01:00
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onOk(() => {
2020-09-07 08:26:23 +02:00
this.sweepAll();
2020-03-03 04:16:23 +01:00
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onDismiss(() => {})
.onCancel(() => {});
},
buildDialogFieldsSweepAll(txData) {
this.confirmFields = this.buildDialogFields(txData);
},
areButtonsEnabled() {
// if we can find the service node key in the list of service nodes
const key = this.service_node.key;
return !!this.awaiting_service_nodes.find(
n => n.service_node_pubkey === key
);
},
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
async sweepAll() {
2020-03-03 04:16:23 +01:00
const { unlocked_balance } = this.info;
2020-03-03 04:16:23 +01:00
const tx = {
amount: unlocked_balance / 1e9,
address: this.award_address,
priority: 0
};
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
let passwordDialog = await this.showPasswordConfirmation({
2020-03-03 04:16:23 +01:00
title: this.$t("dialog.sweepAll.title"),
noPasswordMessage: this.$t("dialog.sweepAll.message"),
ok: {
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
label: this.$t("dialog.sweepAll.ok"),
2021-01-06 06:26:42 +01:00
color: "#12C7BA"
}
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
});
passwordDialog
.onOk(password => {
password = password || "";
this.$store.commit("gateway/set_sweep_all_status", {
code: DO_NOTHING,
2020-03-03 04:16:23 +01:00
message: "Sweeping all",
sending: true
});
const newTx = objectAssignDeep.noMutate(tx, {
password,
isSweepAll: true
});
this.$gateway.send("wallet", "transfer", newTx);
2020-03-03 04:16:23 +01:00
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onDismiss(() => {})
.onCancel(() => {});
2020-03-03 04:16:23 +01:00
},
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
async stake() {
2020-03-03 04:16:23 +01:00
this.$v.service_node.$touch();
2020-03-03 04:16:23 +01:00
if (this.$v.service_node.key.$error) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.invalidServiceNodeKey")
});
return;
}
2020-03-03 04:16:23 +01:00
if (this.service_node.amount < 0) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.negativeAmount")
});
return;
} else if (this.service_node.amount == 0) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.zeroAmount")
});
return;
} else if (this.service_node.amount > this.unlocked_balance / 1e9) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.notEnoughBalance")
});
return;
} else if (this.$v.service_node.amount.$error) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.invalidAmount")
});
return;
}
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
let passwordDialog = await this.showPasswordConfirmation({
2020-03-03 04:16:23 +01:00
title: this.$t("dialog.stake.title"),
noPasswordMessage: this.$t("dialog.stake.message"),
ok: {
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
label: this.$t("dialog.stake.ok"),
color: "primary"
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
},
dark: this.theme == "dark",
color: this.theme == "dark" ? "white" : "dark"
});
passwordDialog
.onOk(password => {
password = password || "";
2020-03-03 04:16:23 +01:00
this.$store.commit("gateway/set_snode_status", {
stake: {
code: 1,
message: "Staking...",
sending: true
}
});
const service_node = objectAssignDeep.noMutate(this.service_node, {
password,
destination: this.award_address
});
this.$gateway.send("wallet", "stake", service_node);
})
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.onDismiss(() => {})
.onCancel(() => {});
}
2020-03-03 04:16:23 +01:00
}
};
</script>
<style lang="scss">
.service-node-staking {
UI upgrade (#155) * followed upgrade instructions on quasar site * followed upgrade instructions on quasar site * debug messages now show * Fix template error mode undefined * building and working, UI broken, need to move to new quasar components * move collapsible to expansion-item * moving over components to quasar v1+ * items to labels * items and item side to quasar v1 * fix label typo * item main to item label * q-section to q-item-section * popover to menu * modals to v1 quasar * Remove debug lines, use new dialog methods * move static folder up a dir and rename to public. Change paths accordingly * Exit modal fixed with v1 quasar * UI fixes for v1 quasar * remove link styles * some field updates * Fix more fields and modals for v1 * more fields updated * more fields changed over * wallet settings modals * Fix password confirm dialog issue w/ refactor * begin generalising a copy component * Receive item looking better * Index view vixed for v1 quasar * fix export/import keys modal * tx styles and some others * bunch of small style changes * Fix date display on restore page * completed upgrade to v1 quasar (I think) * lns list fixed, stake buttons fixed * fix favourite checkbox with v1 quasar * Address book fixes * Fix the context menus * clean up * remove mixin from copyicon * Fix webpack * fix QR code view on address detail page * Fix welcome stepper and default to blink * Fix some style issues * radio buttons w/ white circles * clean up * sn style fixes, and other fixes * style fixes and unlock bug fixed * fix daemon typo * Fix some style things * fix button colour Co-authored-by: Kyle Zsembery <zsembery.kyle@gmail.com>
2020-08-31 07:26:06 +02:00
.submit-button {
2020-03-03 04:16:23 +01:00
.q-btn:not(:first-child) {
margin-left: 8px;
}
2020-03-03 04:16:23 +01:00
}
}
2020-09-08 02:50:11 +02:00
.contribute {
2020-09-07 09:48:19 +02:00
margin-top: 16px;
padding-left: 8px;
}
2020-09-07 05:43:36 +02:00
.service-node-stake-tab {
2020-09-07 09:48:19 +02:00
margin-top: 4px;
2020-09-07 05:43:36 +02:00
user-select: none;
.header {
font-weight: 450;
}
.q-item-sublabel,
.q-list-header {
font-size: 14px;
}
}
</style>