From 0694ad3edaf0820710b27c41e97f0f936aeebdc3 Mon Sep 17 00:00:00 2001 From: shrpne Date: Tue, 17 Mar 2020 21:30:55 +0300 Subject: [PATCH 1/8] update FieldCoin to support amount, copywrite, cleanup SendForm --- components/CoinBuyForm.vue | 10 +- components/CoinCreateForm.vue | 8 +- components/CoinSellAllForm.vue | 10 +- components/CoinSellForm.vue | 6 +- components/CoinSendForm.vue | 107 +++++++++++------- components/MultisigCreateForm.vue | 4 +- components/ValidatorDeclareCandidacyForm.vue | 4 +- components/ValidatorDelegateForm.vue | 4 +- components/ValidatorEditCandidateForm.vue | 4 +- components/ValidatorSetCandidateOnOffForm.vue | 4 +- components/ValidatorUnbondForm.vue | 19 ++-- .../{FieldCoinList.vue => FieldCoin.vue} | 17 ++- jest.config.js | 3 + lang/ru.js | 2 +- layouts/default.vue | 12 +- 15 files changed, 126 insertions(+), 88 deletions(-) rename components/common/{FieldCoinList.vue => FieldCoin.vue} (82%) diff --git a/components/CoinBuyForm.vue b/components/CoinBuyForm.vue index e34d5d17..bf399486 100644 --- a/components/CoinBuyForm.vue +++ b/components/CoinBuyForm.vue @@ -15,7 +15,7 @@ import {getErrorText} from "~/assets/server-error"; import {getExplorerTxUrl, pretty, prettyExact} from "~/assets/utils"; import FieldQr from '~/components/common/FieldQr'; - import FieldCoinList from '~/components/common/FieldCoinList'; + import FieldCoin from '~/components/common/FieldCoin'; import InputUppercase from '~/components/common/InputUppercase'; import InputMaskedAmount from '~/components/common/InputMaskedAmount'; import InputMaskedInteger from '~/components/common/InputMaskedInteger'; @@ -29,7 +29,7 @@ components: { QrcodeVue, FieldQr, - FieldCoinList, + FieldCoin, InputUppercase, InputMaskedAmount, InputMaskedInteger, @@ -275,7 +275,7 @@
- {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/CoinCreateForm.vue b/components/CoinCreateForm.vue index 682f81c5..14520cf1 100644 --- a/components/CoinCreateForm.vue +++ b/components/CoinCreateForm.vue @@ -455,7 +455,7 @@ {{ $td(`Min value is ${$options.MIN_MAX_SUPPLY}`, 'form.coiner-create-max-supply-error-min', {value: $options.MIN_MAX_SUPPLY}) }} {{ $td(`Max value is ${$options.MAX_MAX_SUPPLY}`, 'form.coiner-create-max-supply-error-max', {value: $options.MAX_MAX_SUPPLY}) }} -
{{ $td('Coin purchase will not be possible if the limit is exceeded', 'form.coiner-create-max-supply-help') }}
+
{{ $td('Coin purchase will not be possible if the limit is exceeded. (By default: 10^15)', 'form.coiner-create-max-supply-help') }}
- {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
@@ -681,7 +681,7 @@
-

{{ $td('Warning!', 'form.coiner-create-confirm-warning') }}

+ {{ $td('Warning!', 'form.coiner-create-confirm-warning') }}

Coin liquidation is not allowed.
One can't sell coin if it reserve goes lower than 10 000 {{ $store.getters.COIN_NAME }}.

diff --git a/components/CoinSellAllForm.vue b/components/CoinSellAllForm.vue index 6d8f78bb..19144d42 100644 --- a/components/CoinSellAllForm.vue +++ b/components/CoinSellAllForm.vue @@ -13,7 +13,7 @@ import {getErrorText} from "~/assets/server-error"; import {getExplorerTxUrl, pretty, prettyExact} from "~/assets/utils"; import FieldQr from '~/components/common/FieldQr'; - import FieldCoinList from '~/components/common/FieldCoinList'; + import FieldCoin from '~/components/common/FieldCoin'; import InputUppercase from '~/components/common/InputUppercase'; import InputMaskedInteger from '~/components/common/InputMaskedInteger'; import ButtonCopyIcon from '~/components/common/ButtonCopyIcon'; @@ -24,7 +24,7 @@ components: { QrcodeVue, FieldQr, - FieldCoinList, + FieldCoin, InputUppercase, InputMaskedInteger, ButtonCopyIcon, @@ -247,7 +247,7 @@ {{ $td('Max 10 letters', 'form.coin-error-max') }}
- {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/CoinSellForm.vue b/components/CoinSellForm.vue index 37886286..51aa4993 100644 --- a/components/CoinSellForm.vue +++ b/components/CoinSellForm.vue @@ -16,7 +16,7 @@ import {getErrorText} from "~/assets/server-error"; import {getExplorerTxUrl, pretty, prettyExact} from "~/assets/utils"; import FieldQr from '~/components/common/FieldQr'; - import FieldCoinList from '~/components/common/FieldCoinList'; + import FieldCoin from '~/components/common/FieldCoin'; import FieldUseMax from '~/components/common/FieldUseMax'; import InputUppercase from '~/components/common/InputUppercase'; import InputMaskedInteger from '~/components/common/InputMaskedInteger'; @@ -369,8 +369,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/CoinSendForm.vue b/components/CoinSendForm.vue index 0741abb7..c2d11f16 100644 --- a/components/CoinSendForm.vue +++ b/components/CoinSendForm.vue @@ -8,7 +8,7 @@ import minLength from 'vuelidate/lib/validators/minLength'; import maxLength from 'vuelidate/lib/validators/maxLength'; import autosize from 'v-autosize'; - import SendTxParams from "minter-js-sdk/src/tx-params/send"; + import SendTxData from "minter-js-sdk/src/tx-data/send"; import {TX_TYPE} from 'minterjs-tx/src/tx-types'; import {isValidAddress} from "minterjs-util/src/prefix"; import prepareSignedTx, {prepareTx, makeSignature} from 'minter-js-sdk/src/tx'; @@ -61,15 +61,15 @@ address: '', amount: '', coinSymbol: coinList && coinList.length ? coinList[0].coin : '', - feeCoinSymbol: '', - message: '', + gasCoin: '', + payload: '', signatureList: null, multisigAddress: '', gasPrice: '', }, formAdvanced: { - feeCoinSymbol: '', - message: '', + gasCoin: '', + payload: '', }, isModeAdvanced: false, /** @type FeeData */ @@ -98,11 +98,11 @@ minLength: minLength(3), maxLength: maxLength(10), }, - feeCoinSymbol: { + gasCoin: { minLength: minLength(3), maxLength: maxLength(10), }, - message: { + payload: { maxLength: maxLength(1024), }, multisigAddress: { @@ -158,9 +158,9 @@ feeBusParams() { return { txType: TX_TYPE.SEND, - txFeeOptions: {payload: this.form.message}, + txFeeOptions: {payload: this.form.payload}, selectedCoinSymbol: this.form.coinSymbol, - selectedFeeCoinSymbol: this.form.feeCoinSymbol, + selectedFeeCoinSymbol: this.form.gasCoin, baseCoinAmount: this.$store.getters.baseCoin && this.$store.getters.baseCoin.amount, isOffline: this.$store.getters.isOfflineMode, }; @@ -214,12 +214,18 @@ this.serverError = ''; this.serverSuccess = ''; - this.signedTx = prepareSignedTx(new SendTxParams({ + this.signedTx = prepareSignedTx({ chainId: this.$store.getters.CHAIN_ID, ...this.form, - feeCoinSymbol: this.fee.coinSymbol, + data: new SendTxData({ + to: this.form.address, + coin: this.form.coinSymbol, + value: this.form.amount, + }), + type: TX_TYPE.SEND, + gasCoin: this.fee.coinSymbol, gasPrice: this.form.gasPrice || undefined, - }), {privateKey: this.$store.getters.privateKey}).serialize().toString('hex'); + }, {privateKey: this.$store.getters.privateKey}).serialize().toString('hex'); this.clearForm(); }, postTx() { @@ -232,12 +238,17 @@ if (!this.form.multisigAddress) { this.$store.dispatch('FETCH_ADDRESS_ENCRYPTED') .then(() => { - postTx(new SendTxParams({ - privateKey: this.$store.getters.privateKey, + postTx({ ...this.form, - feeCoinSymbol: this.fee.coinSymbol, + data: new SendTxData({ + to: this.form.address, + coin: this.form.coinSymbol, + value: this.form.amount, + }), + type: TX_TYPE.SEND, + gasCoin: this.fee.coinSymbol, gasPrice: this.form.gasPrice || undefined, - })).then((txHash) => { + }, {privateKey: this.$store.getters.privateKey}).then((txHash) => { this.isFormSending = false; this.serverSuccess = txHash; this.clearForm(); @@ -252,16 +263,22 @@ this.serverError = getErrorText(error); }); } else { - postTx(new SendTxParams({ + postTx({ ...this.form, + data: new SendTxData({ + to: this.form.address, + coin: this.form.coinSymbol, + value: this.form.amount, + }), + type: TX_TYPE.SEND, signatureType: 2, signatureData: { multisig: this.form.multisigAddress, signatures: this.form.signatureList, }, - feeCoinSymbol: this.fee.coinSymbol, + gasCoin: this.fee.coinSymbol, gasPrice: this.form.gasPrice || undefined, - }), {address: this.form.multisigAddress}).then((txHash) => { + }, {address: this.form.multisigAddress}).then((txHash) => { this.isFormSending = false; this.serverSuccess = txHash; this.clearForm(); @@ -286,13 +303,19 @@ this.isSigning = true; this.signature = null; - let txParams = new SendTxParams({ + let txParams = { chainId: this.$store.getters.CHAIN_ID, ...this.form, + data: new SendTxData({ + to: this.form.address, + coin: this.form.coinSymbol, + value: this.form.amount, + }), + type: TX_TYPE.SEND, signatureType: 2, - feeCoinSymbol: this.fee.coinSymbol, + gasCoin: this.fee.coinSymbol, gasPrice: this.form.gasPrice || undefined, - }); + }; Promise.all([ ensureNonce(txParams, {address: this.form.multisigAddress}), @@ -314,28 +337,28 @@ switchToAdvanced() { this.isModeAdvanced = true; // restore advanced data - this.form.feeCoinSymbol = this.formAdvanced.feeCoinSymbol; - this.form.message = this.formAdvanced.message; + this.form.gasCoin = this.formAdvanced.gasCoin; + this.form.payload = this.formAdvanced.payload; }, switchToSimple() { this.isModeAdvanced = false; // save advanced data - this.formAdvanced.feeCoinSymbol = this.form.feeCoinSymbol; - this.formAdvanced.message = this.form.message; + this.formAdvanced.gasCoin = this.form.gasCoin; + this.formAdvanced.payload = this.form.payload; // clear advanced form - this.form.feeCoinSymbol = ''; - this.form.message = ''; + this.form.gasCoin = ''; + this.form.payload = ''; }, clearForm() { this.form.address = ''; this.form.amount = ''; this.form.coinSymbol = this.balance && this.balance.length ? this.balance[0].coin : ''; - this.form.feeCoinSymbol = ''; - this.form.message = ''; + this.form.gasCoin = ''; + this.form.payload = ''; this.form.multisigAddress = ''; this.form.signatureList = null; - this.formAdvanced.feeCoinSymbol = ''; - this.formAdvanced.message = ''; + this.formAdvanced.gasCoin = ''; + this.formAdvanced.payload = ''; if (this.form.nonce && this.$store.getters.isOfflineMode) { this.form.nonce += 1; } else { @@ -407,9 +430,9 @@ {{ $td('Enter amount', 'form.amount-error-required') }}
-
-
diff --git a/components/MultisigCreateForm.vue b/components/MultisigCreateForm.vue index ec6d5feb..6a0cd978 100644 --- a/components/MultisigCreateForm.vue +++ b/components/MultisigCreateForm.vue @@ -393,8 +393,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/ValidatorDeclareCandidacyForm.vue b/components/ValidatorDeclareCandidacyForm.vue index 084a28bd..fdc508fe 100644 --- a/components/ValidatorDeclareCandidacyForm.vue +++ b/components/ValidatorDeclareCandidacyForm.vue @@ -393,8 +393,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/ValidatorDelegateForm.vue b/components/ValidatorDelegateForm.vue index d8e83cd1..ff47aad4 100644 --- a/components/ValidatorDelegateForm.vue +++ b/components/ValidatorDelegateForm.vue @@ -352,8 +352,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/ValidatorEditCandidateForm.vue b/components/ValidatorEditCandidateForm.vue index 7836261c..ecc2764f 100644 --- a/components/ValidatorEditCandidateForm.vue +++ b/components/ValidatorEditCandidateForm.vue @@ -310,8 +310,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/ValidatorSetCandidateOnOffForm.vue b/components/ValidatorSetCandidateOnOffForm.vue index 612cd971..ebb5e7b4 100644 --- a/components/ValidatorSetCandidateOnOffForm.vue +++ b/components/ValidatorSetCandidateOnOffForm.vue @@ -278,8 +278,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/ValidatorUnbondForm.vue b/components/ValidatorUnbondForm.vue index 9c98968a..e65070ed 100644 --- a/components/ValidatorUnbondForm.vue +++ b/components/ValidatorUnbondForm.vue @@ -20,7 +20,7 @@ import {getExplorerTxUrl, pretty, prettyExact} from "~/assets/utils"; import FieldDomain from '~/components/common/FieldDomain'; import FieldQr from '~/components/common/FieldQr'; - import FieldCoinList from '~/components/common/FieldCoinList'; + import FieldCoin from '~/components/common/FieldCoin'; import FieldUseMax from '~/components/common/FieldUseMax'; import InputUppercase from '~/components/common/InputUppercase'; import InputMaskedInteger from '~/components/common/InputMaskedInteger'; @@ -35,7 +35,7 @@ QrcodeVue, FieldDomain, FieldQr, - FieldCoinList, + FieldCoin, FieldUseMax, InputUppercase, InputMaskedInteger, @@ -196,9 +196,6 @@ return []; } }, - stakeCoinList() { - return this.stakeList.map((item) => item.coin); - }, }, watch: { feeBusParams: { @@ -210,8 +207,8 @@ deep: true, }, 'form.publicKey': function(newVal) { - if (this.stakeCoinList.length === 1) { - this.form.coinSymbol = this.stakeCoinList[0]; + if (this.stakeList.length === 1) { + this.form.coinSymbol = this.stakeList[0].coin; } }, }, @@ -351,11 +348,11 @@ />
- {{ $td('Enter coin', 'form.coin-error-required') }} {{ $td('Min 3 letters', 'form.coin-error-min') }} @@ -404,8 +401,8 @@ > {{ $td('Message', 'form.message') }} - {{ $td('Max 1024 symbols', 'form.message-error-max') }} -
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 symbols.', 'form.message-help') }}
+ {{ $td('Max 1024 bytes', 'form.message-error-max') }} +
{{ $td('Any additional information about the transaction. Please note it will be stored on the blockchain and visible to anyone. May include up to 1024 bytes.', 'form.message-help') }}
diff --git a/components/common/FieldCoinList.vue b/components/common/FieldCoin.vue similarity index 82% rename from components/common/FieldCoinList.vue rename to components/common/FieldCoin.vue index 3513d650..b2f32e3e 100644 --- a/components/common/FieldCoinList.vue +++ b/components/common/FieldCoin.vue @@ -1,6 +1,7 @@ + + From 874c54ad7b319f276743cdd95c9c38faa4c8c246 Mon Sep 17 00:00:00 2001 From: shrpne Date: Sat, 21 Mar 2020 02:24:26 +0300 Subject: [PATCH 4/8] refactor to use common TxForm --- .eslintrc.js | 1 + assets/less/include/layout.less | 1 + assets/less/include/modal.less | 2 +- components/CheckRedeemForm.vue | 160 +---- components/CoinBuyForm.vue | 441 +++--------- components/CoinCreateForm.vue | 628 +++++------------- components/CoinSellAllForm.vue | 361 +++------- components/CoinSellForm.vue | 455 +++---------- components/CoinSendForm.vue | 579 ++-------------- components/MultisigCreateForm.vue | 369 +++------- components/ValidatorDeclareCandidacyForm.vue | 352 ++-------- components/ValidatorDelegateForm.vue | 403 ++--------- components/ValidatorEditCandidateForm.vue | 334 ++-------- components/ValidatorSetCandidateOnOffForm.vue | 322 ++------- components/ValidatorUnbondForm.vue | 377 ++--------- components/common/FieldDomain.vue | 2 +- components/common/FieldUseMax.vue | 40 +- components/{ => common}/TxForm.vue | 344 +++++----- lang/ru.js | 3 +- pages/checks/index.vue | 13 +- pages/delegation/index.vue | 26 +- pages/masternode/index.vue | 51 +- pages/multisignature/index.vue | 9 +- 23 files changed, 1048 insertions(+), 4225 deletions(-) rename components/{ => common}/TxForm.vue (66%) diff --git a/.eslintrc.js b/.eslintrc.js index dc4862ba..aaa6e9f2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -54,6 +54,7 @@ module.exports = { 'vue/singleline-html-element-content-newline': 0, 'vue/v-bind-style': 0, 'vue/v-on-style': 0, + 'vue/no-unused-vars': 0, // allow `$value` 'vue/prop-name-casing': 0, diff --git a/assets/less/include/layout.less b/assets/less/include/layout.less index 6c598bc8..a29dc602 100644 --- a/assets/less/include/layout.less +++ b/assets/less/include/layout.less @@ -73,6 +73,7 @@ @media (min-width: @breakpoint-large-up) { .u-cell--large--1-2 {width: 50%;} .u-cell--large--1-3 { width: 33.3333%;} + .u-cell--large--1-4 {width: 25%;} } @media (min-width: @breakpoint-xlarge-up) { .u-cell--xlarge--1-4 { width: 25%;} diff --git a/assets/less/include/modal.less b/assets/less/include/modal.less index e53fb93b..c65166ff 100644 --- a/assets/less/include/modal.less +++ b/assets/less/include/modal.less @@ -20,7 +20,7 @@ &::before {transform: rotate(45deg);} &::after {transform: rotate(-45deg);} } -.modal__container {max-width: 450px; margin: auto; text-align: center; padding-bottom: @modal-padding-vertical;} +.modal__container {max-width: 450px; width: 100%; margin: auto; text-align: center; padding-bottom: @modal-padding-vertical;} .modal__title {margin-bottom: 10px;} .modal__text {max-width: 480px; margin: 0 auto 20px; &:last-child {margin-bottom: 0;}} diff --git a/components/CheckRedeemForm.vue b/components/CheckRedeemForm.vue index 3eb5ef45..6fd1a797 100644 --- a/components/CheckRedeemForm.vue +++ b/components/CheckRedeemForm.vue @@ -1,44 +1,28 @@ diff --git a/components/CoinBuyForm.vue b/components/CoinBuyForm.vue index 5572af8d..c8f54852 100644 --- a/components/CoinBuyForm.vue +++ b/components/CoinBuyForm.vue @@ -1,73 +1,36 @@ - -
- - -
-
- -
{{ serverError }}
-
-
- {{ $td('Tx sent:', 'form.tx-sent') }} {{ serverSuccess }} -
+ -
-
-
{{ $td('Signed tx:', 'form.generate-result-tx') }}
-
- - {{ signedTx }} - - -
-
-
- -
- - + - -
-
-

- - {{ $td('Convert Coins', 'convert.convert-title') }} -

+ + diff --git a/components/CoinCreateForm.vue b/components/CoinCreateForm.vue index be406fc6..7509bc7e 100644 --- a/components/CoinCreateForm.vue +++ b/components/CoinCreateForm.vue @@ -1,6 +1,4 @@ diff --git a/components/CoinSellAllForm.vue b/components/CoinSellAllForm.vue index 2f0ea869..defabacf 100644 --- a/components/CoinSellAllForm.vue +++ b/components/CoinSellAllForm.vue @@ -1,63 +1,37 @@ diff --git a/components/CoinSellForm.vue b/components/CoinSellForm.vue index d445c12c..1a9ff803 100644 --- a/components/CoinSellForm.vue +++ b/components/CoinSellForm.vue @@ -1,74 +1,38 @@ diff --git a/components/MultisigCreateForm.vue b/components/MultisigCreateForm.vue index 11515c6d..025e0bb3 100644 --- a/components/MultisigCreateForm.vue +++ b/components/MultisigCreateForm.vue @@ -1,6 +1,5 @@ -
-
-
{{ $td('Signed tx:', 'form.generate-result-tx') }}
-
- - {{ signedTx }} - - -
-
-
- -
+ + + + + + diff --git a/components/ValidatorDeclareCandidacyForm.vue b/components/ValidatorDeclareCandidacyForm.vue index 9d1fd034..ce4e8411 100644 --- a/components/ValidatorDeclareCandidacyForm.vue +++ b/components/ValidatorDeclareCandidacyForm.vue @@ -1,79 +1,41 @@ diff --git a/components/ValidatorDelegateForm.vue b/components/ValidatorDelegateForm.vue index cf2fc120..b980d9ce 100644 --- a/components/ValidatorDelegateForm.vue +++ b/components/ValidatorDelegateForm.vue @@ -1,84 +1,42 @@ diff --git a/components/ValidatorEditCandidateForm.vue b/components/ValidatorEditCandidateForm.vue index fd33f038..97683787 100644 --- a/components/ValidatorEditCandidateForm.vue +++ b/components/ValidatorEditCandidateForm.vue @@ -1,70 +1,29 @@ diff --git a/components/ValidatorSetCandidateOnOffForm.vue b/components/ValidatorSetCandidateOnOffForm.vue index 7a6b26a4..33e69766 100644 --- a/components/ValidatorSetCandidateOnOffForm.vue +++ b/components/ValidatorSetCandidateOnOffForm.vue @@ -1,45 +1,18 @@ diff --git a/components/ValidatorUnbondForm.vue b/components/ValidatorUnbondForm.vue index c8fb0e90..9a31586c 100644 --- a/components/ValidatorUnbondForm.vue +++ b/components/ValidatorUnbondForm.vue @@ -1,81 +1,43 @@ diff --git a/components/common/FieldDomain.vue b/components/common/FieldDomain.vue index 2d913632..13cc4703 100644 --- a/components/common/FieldDomain.vue +++ b/components/common/FieldDomain.vue @@ -141,7 +141,7 @@ @input="handleInput" :$value="$value" :label="label" - :suggestionList="suggestionDisabled ? false : (suggestionList || validatorList)" + :suggestionList="suggestionDisabled ? [] : (suggestionList || validatorList)" :suggestionMinInputLength="suggestionMinInputLength" :suggestionContent="$options.suggestionValidatorContent" :suggestionFilter="$options.suggestionValidatorFilter" diff --git a/components/common/FieldUseMax.vue b/components/common/FieldUseMax.vue index 6bd6810e..96dd9371 100644 --- a/components/common/FieldUseMax.vue +++ b/components/common/FieldUseMax.vue @@ -28,6 +28,18 @@ type: [String, Number], default: undefined, }, + addressBalance: { + type: Array, + default: () => [], + }, + selectedCoinSymbol: { + type: String, + default: '', + }, + fee: { + type: [Object, null], + default: null, + }, }, data() { return { @@ -35,8 +47,28 @@ }; }, computed: { + maxValueComputed() { + if (typeof this.maxValue !== 'undefined') { + return this.maxValue; + } + + const selectedCoin = this.addressBalance.find((coin) => { + return coin.coin === this.selectedCoinSymbol; + }); + // coin not selected + if (!selectedCoin) { + return undefined; + } + // fee not in selected coins + if (selectedCoin.coin !== this.fee?.coinSymbol) { + return selectedCoin.amount; + } + // fee in selected coin, subtract fee + const amount = new Big(selectedCoin.amount).minus(this.fee?.value).toFixed(); + return amount > 0 ? amount : '0'; + }, isMaxValueDefined() { - return typeof this.maxValue !== 'undefined'; + return typeof this.maxValueComputed !== 'undefined'; }, }, watch: { @@ -49,11 +81,11 @@ this.isUseMax = false; return; } - if (new Big(newVal).toFixed() !== new Big(this.maxValue).toFixed()) { + if (new Big(newVal).toFixed() !== new Big(this.maxValueComputed).toFixed()) { this.isUseMax = false; } }, - maxValue(newVal) { + maxValueComputed(newVal) { if (this.isMaxValueDefined && this.isUseMax) { this.useMax(); } @@ -65,7 +97,7 @@ return false; } this.isUseMax = true; - this.$emit('input', this.maxValue); + this.$emit('input', this.maxValueComputed); this.$value.$touch(); }, }, diff --git a/components/TxForm.vue b/components/common/TxForm.vue similarity index 66% rename from components/TxForm.vue rename to components/common/TxForm.vue index bf5760a9..bd38744e 100644 --- a/components/TxForm.vue +++ b/components/common/TxForm.vue @@ -1,30 +1,26 @@ diff --git a/components/CoinSellForm.vue b/components/CoinSellForm.vue index 1a9ff803..0e224e9a 100644 --- a/components/CoinSellForm.vue +++ b/components/CoinSellForm.vue @@ -160,15 +160,25 @@
- -
- {{ $td('* The result amount depends on the current rate at the time of the exchange and may differ from the above.', 'form.convert-confirm-note') }} -
+ +
diff --git a/components/ConnectionNotice.vue b/components/ConnectionNotice.vue index 4a626b9d..6cdc5e72 100644 --- a/components/ConnectionNotice.vue +++ b/components/ConnectionNotice.vue @@ -1,5 +1,5 @@