oxen-electron-gui-wallet/src/components/advanced/prove_transaction.vue

207 lines
4.9 KiB
Vue
Raw Normal View History

2019-06-13 01:20:26 +02:00
<template>
2020-03-03 04:16:23 +01:00
<div class="prove-transaction">
2019-06-13 01:20:26 +02:00
<div class="q-pa-md">
2021-01-06 06:26:42 +01:00
<div class="q-mb-lg tab-desc">
2020-03-03 04:16:23 +01:00
{{ $t("strings.proveTransactionDescription") }}
</div>
<div>
2021-01-06 06:26:42 +01:00
<OxenField
2020-11-23 05:27:34 +01:00
:label="$t('fieldLabels.transactionId')"
:error="$v.txid.$error"
>
2020-03-03 04:16:23 +01:00
<q-input
v-model.trim="txid"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.pasteTransactionId')"
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.txid.$touch"
/>
2021-01-06 06:26:42 +01:00
</OxenField>
<OxenField
2020-11-23 05:27:34 +01:00
class="q-mt-md"
:label="$t('fieldLabels.address')"
:error="$v.address.$error"
optional
>
2020-03-03 04:16:23 +01:00
<q-input
v-model.trim="address"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.recipientWalletAddress')"
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.address.$touch"
/>
2021-01-06 06:26:42 +01:00
</OxenField>
<OxenField class="q-mt-md" :label="$t('fieldLabels.message')" optional>
2020-03-03 04:16:23 +01:00
<q-input
v-model.trim="message"
:dark="theme == 'dark'"
:placeholder="$t('placeholders.proveOptionalMessage')"
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
/>
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="buttons submit-button">
2020-11-23 05:27:34 +01:00
<q-btn
color="primary"
:label="$t('buttons.generate')"
@click="generate"
/>
<q-btn
v-if="canClear"
2021-01-06 06:26:42 +01:00
color="accent"
2020-11-23 05:27:34 +01:00
:label="$t('buttons.clear')"
@click="clear"
/>
<q-btn
v-if="status.state.signature"
color="secondary"
:label="$t('buttons.copySignature')"
@click="copy"
/>
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>
2020-03-03 04:16:23 +01:00
</div>
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 v-if="status.state.signature" class="signature-wrapper">
2020-03-03 04:16:23 +01:00
<div class="txid q-mb-sm">
<div class="title">{{ $t("strings.transactionID") }}</div>
<div>{{ status.state.txid }}</div>
2019-06-13 03:52:38 +02:00
</div>
2020-03-03 04:16:23 +01:00
<p class="signature">
{{ status.state.signature }}
</p>
</div>
2019-06-13 01:20:26 +02:00
</div>
2020-03-03 04:16:23 +01:00
</div>
2019-06-13 01:20:26 +02:00
</template>
<script>
2020-03-03 04:16:23 +01:00
import { mapState } from "vuex";
import { required } from "vuelidate/lib/validators";
import { address } 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 { clipboard } from "electron";
2019-06-13 01:20:26 +02:00
export default {
2020-03-03 04:16:23 +01:00
name: "ProveTransaction",
components: {
2021-01-06 06:26:42 +01:00
OxenField
2020-03-03 04:16:23 +01:00
},
data() {
return {
txid: "",
address: "",
message: ""
};
},
computed: mapState({
theme: state => state.gateway.app.config.appearance.theme,
status: state => state.gateway.prove_transaction_status,
canClear() {
return this.txid !== "" || this.address !== "" || this.message !== "";
}
}),
validations: {
txid: { required },
address: {
isAddress(value) {
if (value === "") return true;
2020-03-03 04:16:23 +01:00
return new Promise(resolve => {
address(value, this.$gateway)
.then(() => resolve(true))
.catch(() => resolve(false));
});
}
}
},
watch: {
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 -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
}
},
methods: {
generate() {
this.$v.txid.$touch();
this.$v.address.$touch();
2020-03-03 04:16:23 +01:00
if (this.$v.txid.$error) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.enterTransactionId")
});
return;
}
2020-03-03 04:16:23 +01:00
if (this.$v.address.$error) {
this.$q.notify({
type: "negative",
timeout: 1000,
message: this.$t("notification.errors.invalidAddress")
});
return;
}
2020-03-03 04:16:23 +01:00
this.$gateway.send("wallet", "prove_transaction", {
txid: this.txid.trim(),
address: this.address.trim(),
message: this.message.trim()
});
},
2020-03-03 04:16:23 +01:00
clear() {
this.txid = "";
this.address = "";
this.message = "";
this.$v.$reset();
},
copy() {
clipboard.writeText(this.status.state.signature);
this.$q.notify({
type: "positive",
timeout: 1000,
message: this.$t("notification.positive.signatureCopied")
});
}
2020-03-03 04:16:23 +01:00
}
};
2019-06-13 01:20:26 +02:00
</script>
<style lang="scss">
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
.signature-wrapper {
margin-top: 12px;
}
.prove-transaction {
2020-03-03 04:16:23 +01:00
.description {
white-space: pre-line;
}
.buttons {
.q-btn:not(:first-child) {
margin-left: 8px;
2019-06-13 03:52:38 +02:00
}
2020-03-03 04:16:23 +01:00
}
.signature {
flex: 1;
word-break: break-all;
word-wrap: break-word;
-webkit-user-select: all;
user-select: all;
padding: 8px;
}
}
</style>