From b7fa052f0939133534e19af9f7a613487e44bcd3 Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Tue, 30 Jun 2020 02:38:54 +0100 Subject: [PATCH 1/6] fix: stuck loading screen on fresh wallet (#2289) --- src/renderer/store/modules/peer/index.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/renderer/store/modules/peer/index.js b/src/renderer/store/modules/peer/index.js index d39a75f451..c9ef1c2cd2 100644 --- a/src/renderer/store/modules/peer/index.js +++ b/src/renderer/store/modules/peer/index.js @@ -351,7 +351,12 @@ export default { let peers = [] try { - peers = await discoverPeers(await dispatch('getPeerDiscovery', network)) + const peerDiscovery = await dispatch('getPeerDiscovery', network) + if (!peerDiscovery) { + throw new Error('could not initiate peer discovery') + } + + peers = await discoverPeers(peerDiscovery) } catch (error) { if (!network) { network = rootGetters['session/network'] @@ -362,7 +367,7 @@ export default { 'ark.devnet': 'devnet' } - if (networkLookup[network.id]) { + if (network && networkLookup[network.id]) { console.log('Could not refresh peer list. Using fallback seeds: ', error) let peerDiscoveryFailed = true From 0033d553377d5da76049481e20deae1509128d2a Mon Sep 17 00:00:00 2001 From: Breno Polanski Date: Wed, 1 Jul 2020 12:59:34 -0300 Subject: [PATCH 2/6] fix: ark uri scheme (#2314) --- .../TransactionForm/TransactionFormTransfer.vue | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue b/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue index 256172c450..d827813ecc 100644 --- a/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue +++ b/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue @@ -560,8 +560,8 @@ export default { } try { - if (this.schema.address && this.schema.amount) { - if (WalletService.validateAddress(this.schema.address, this.session_network.version)) { + if (WalletService.validateAddress(this.schema.address, this.session_network.version)) { + if (this.schema.address && this.schema.amount) { this.$v.form.recipients.$model = [] this.$v.form.recipients.$model.push({ address: this.schema.address, @@ -569,13 +569,15 @@ export default { sendAll: false }) } else { - throw new Error(this.$t('VALIDATION.RECIPIENT_DIFFERENT_NETWORK', [ - this.wallet_truncate(this.schema.address) - ])) + this.$set(this, 'recipientId', this.schema.address || '') } - } - this.$set(this.form, 'vendorField', this.schema.vendorField || '') + this.$set(this.form, 'vendorField', this.schema.vendorField || '') + } else { + throw new Error(this.$t('VALIDATION.RECIPIENT_DIFFERENT_NETWORK', [ + this.wallet_truncate(this.schema.address) + ])) + } } catch (error) { this.$error(`${this.$t('TRANSACTION.ERROR.LOAD_FROM_URI')}: ${error.message}`) } From 39bc17dba429ea41e7ae5c031adfa0f5ab3b4fcc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2020 10:48:07 +0300 Subject: [PATCH 3/6] chore(deps-dev): bump electron from 8.0.1 to 8.2.4 (#2389) Bumps [electron](https://github.com/electron/electron) from 8.0.1 to 8.2.4. - [Release notes](https://github.com/electron/electron/releases) - [Changelog](https://github.com/electron/electron/blob/master/docs/breaking-changes.md) - [Commits](https://github.com/electron/electron/compare/v8.0.1...v8.2.4) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 31 ++++++++----------------------- 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 1d19fdda89..66a87a9a7d 100644 --- a/package.json +++ b/package.json @@ -145,7 +145,7 @@ "css-loader": "^3.1.0", "del": "^5.0.0", "devtron": "^1.4.0", - "electron": "^8.0.0", + "electron": "^8.2.4", "electron-builder": "22.6.0", "electron-debug": "^3.0.1", "electron-devtools-installer": "^3.0.0", diff --git a/yarn.lock b/yarn.lock index 583c98bb27..70a17847fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1462,10 +1462,10 @@ dependencies: "@types/node" "*" -"@types/node@*": - version "12.7.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.11.tgz#be879b52031cfb5d295b047f5462d8ef1a716446" - integrity sha512-Otxmr2rrZLKRYIybtdG/sgeO+tHY20GxeDjcGmUnmmlCWyEnv2a2x1ZXBo3BTec4OiTXMQCiazB8NMBf0iRlFw== +"@types/node@*", "@types/node@^12.0.12", "@types/node@^12.6.1", "@types/node@^12.7.2": + version "12.12.29" + resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.29.tgz#46275f028b4e463b9ac5fefc1d08bc66cc193f25" + integrity sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ== "@types/node@10.12.18": version "10.12.18" @@ -1482,21 +1482,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.17.tgz#7a183163a9e6ff720d86502db23ba4aade5999b8" integrity sha512-gpNnRnZP3VWzzj5k3qrpRC6Rk3H/uclhAVo1aIvwzK5p5cOrs9yEyQ8H/HBsBY0u5rrWxXEiVPQ0dEB6pkjE8Q== -"@types/node@^12.0.12": - version "12.12.28" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.28.tgz#3a2b5f8d21f96ace690a8832ae9779114612575f" - integrity sha512-g73GJYJDXgf0jqg+P9S8h2acWbDXNkoCX8DLtJVu7Fkn788pzQ/oJsrdJz/2JejRf/SjfZaAhsw+3nd1D5EWGg== - -"@types/node@^12.6.1": - version "12.12.29" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.29.tgz#46275f028b4e463b9ac5fefc1d08bc66cc193f25" - integrity sha512-yo8Qz0ygADGFptISDj3pOC9wXfln/5pQaN/ysDIzOaAWXt73cNHmtEC8zSO2Y+kse/txmwIAJzkYZ5fooaS5DQ== - -"@types/node@^12.7.2": - version "12.7.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.7.2.tgz#c4e63af5e8823ce9cc3f0b34f7b998c2171f0c44" - integrity sha512-dyYO+f6ihZEtNPDcWNR1fkoTDf3zAK3lAABDze3mz6POyIercH0lEUawUFXlG8xaQZmm1yEBON/4TsYv/laDYg== - "@types/parse-json@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@types/parse-json/-/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0" @@ -5090,10 +5075,10 @@ electron-window-state@^5.0.3: jsonfile "^4.0.0" mkdirp "^0.5.1" -electron@^8.0.0: - version "8.0.1" - resolved "https://registry.yarnpkg.com/electron/-/electron-8.0.1.tgz#7f5070a1625f423cddcece25a1eb9e6d2f1339fb" - integrity sha512-kLZAQkbrAFNjQVpcHJUnjRYQNafuuWKnsdxzag5do1ewMqN0J4Pi/hPE27+5/1YAFMcbvCrPqhWIpcMsi8mKXQ== +electron@^8.2.4: + version "8.2.4" + resolved "https://registry.yarnpkg.com/electron/-/electron-8.2.4.tgz#c4e51ca8e84b5a5beaaabdae1024bd52ba487ba4" + integrity sha512-Lle0InIgSAHZxD5KDY0wZ1A2Zlc6GHwMhAxoHMzn05mndyP1YBkCYHc0TDDofzUTrsLFofduPjlknO5Oj9fTPA== dependencies: "@electron/get" "^1.0.1" "@types/node" "^12.0.12" From 3787acd529abe3d87cf4b7a664ff60998286cc5b Mon Sep 17 00:00:00 2001 From: Alex Barnsley <8069294+alexbarnsley@users.noreply.github.com> Date: Wed, 8 Jul 2020 12:10:18 +0100 Subject: [PATCH 4/6] refactor: transfer multipayment ux (#2392) --- .../TransactionFormTransfer.spec.js | 60 ++++-- src/renderer/components/Input/InputFee.vue | 27 ++- .../Input/InputToggle/InputToggleChoice.vue | 2 +- .../TransactionFormTransfer.vue | 194 +++++++++++------- src/renderer/i18n/locales/en-US.js | 4 +- src/renderer/styles/_theme.css | 14 +- tailwind.js | 6 + 7 files changed, 216 insertions(+), 91 deletions(-) diff --git a/__tests__/unit/components/Transaction/TransactionForm/TransactionFormTransfer.spec.js b/__tests__/unit/components/Transaction/TransactionForm/TransactionFormTransfer.spec.js index f411efe54b..1114a4b806 100644 --- a/__tests__/unit/components/Transaction/TransactionForm/TransactionFormTransfer.spec.js +++ b/__tests__/unit/components/Transaction/TransactionForm/TransactionFormTransfer.spec.js @@ -184,7 +184,12 @@ describe('TransactionFormTransfer', () => { expect(wrapper.contains('.TransactionFormTransfer__amount')).toBe(true) }) - it('should have add button', () => { + it('should have add button on multiple tab', async () => { + expect(wrapper.contains('.TransactionFormTransfer__add')).toBe(false) + + wrapper.vm.onSendTypeChange('Multiple') + await wrapper.vm.$nextTick() + expect(wrapper.contains('.TransactionFormTransfer__add')).toBe(true) }) @@ -233,7 +238,20 @@ describe('TransactionFormTransfer', () => { }) describe('next button', () => { - it('should be enabled if recipients form is valid', async () => { + it('should be enabled for single if recipients form is valid', async () => { + wrapper.vm.$v.recipientId.$model = 'address-1' + wrapper.vm.$v.amount.$model = 10 + wrapper.vm.$v.form.fee.$model = 0.1 + wrapper.vm.$v.form.vendorField.$model = 'vendorfield test' + wrapper.vm.$v.form.passphrase.$model = 'passphrase' + + await wrapper.vm.$nextTick() + + expect(wrapper.find('.TransactionFormTransfer__next').attributes('disabled')).toBeFalsy() + }) + + it('should be enabled for multiple if recipients form is valid', async () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-2', amount: 10 @@ -284,6 +302,7 @@ describe('TransactionFormTransfer', () => { }) it('should return true if it is multipayment transaction', () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-2', amount: 10 @@ -394,7 +413,11 @@ describe('TransactionFormTransfer', () => { expect(wrapper.vm.maximumAvailableAmount).toEqual((new BigNumber(1000)).minus(0.1)) }) - it('should return value including all recipients', async () => { + it('should return value including all recipients for multiple', async () => { + wrapper.vm.onSendTypeChange('Multiple') + + await wrapper.vm.$nextTick() + wrapper.vm.$v.form.fee.$model = 0.1 wrapper.vm.$v.recipientId.$model = Identities.Address.fromPassphrase('test') wrapper.vm.$v.amount.$model = 10 @@ -812,7 +835,7 @@ describe('TransactionFormTransfer', () => { describe('methods', () => { describe('getTransactionData', () => { - it('should return correct data with passphrase for normal transaction', () => { + it('should return correct data with passphrase for normal transaction', async () => { wrapper.vm.$v.form.fee.$model = 0.1 wrapper.vm.$v.form.vendorField.$model = 'vendorfield test' wrapper.vm.$v.form.passphrase.$model = 'passphrase' @@ -820,14 +843,18 @@ describe('TransactionFormTransfer', () => { address: 'address-2', amount: (1 * 1e8).toString() }] - wrapper.vm.$v.recipientId.$model = wrapper.vm.$v.form.recipients.$model[0].address - wrapper.vm.$v.amount.$model = wrapper.vm.$v.form.recipients.$model[0].amount + wrapper.vm.$v.recipientId.$model = 'address-1' + wrapper.vm.$v.amount.$model = 50 + // wrapper.vm.$v.recipientId.$model = wrapper.vm.$v.form.recipients.$model[0].address + // wrapper.vm.$v.amount.$model = wrapper.vm.$v.form.recipients.$model[0].amount + + await wrapper.vm.$nextTick() expect(wrapper.vm.getTransactionData()).toEqual({ address: 'address-1', passphrase: 'passphrase', - recipientId: 'address-2', - amount: (1 * 1e8).toString(), + recipientId: 'address-1', + amount: new BigNumber(50 * 1e8), fee: new BigNumber(0.1 * 1e8), vendorField: 'vendorfield test', wif: undefined, @@ -838,6 +865,7 @@ describe('TransactionFormTransfer', () => { }) it('should return correct data with passphrase for multipayment transaction', () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.fee.$model = 0.1 wrapper.vm.$v.form.vendorField.$model = 'vendorfield test' wrapper.vm.$v.form.passphrase.$model = 'passphrase' @@ -874,6 +902,7 @@ describe('TransactionFormTransfer', () => { secondPublicKey: Identities.PublicKey.fromPassphrase('second passphrase') }) + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.fee.$model = 0.1 wrapper.vm.$v.form.vendorField.$model = 'vendorfield test' wrapper.vm.$v.form.passphrase.$model = 'passphrase' @@ -920,6 +949,7 @@ describe('TransactionFormTransfer', () => { }) it('should build multipayment transaction', async () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-2', amount: 10 @@ -952,6 +982,7 @@ describe('TransactionFormTransfer', () => { }) it('should build multipayment transaction with default arguments', async () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-2', amount: 10 @@ -994,8 +1025,8 @@ describe('TransactionFormTransfer', () => { wrapper.vm.populateSchema() - expect(wrapper.vm.form.recipients[0].address).toBe('address-5') - expect(wrapper.vm.form.recipients[0].amount).toEqual(new BigNumber(100 * 1e8)) + expect(wrapper.vm.recipientId).toBe('address-5') + expect(wrapper.vm.amount).toEqual(100) expect(wrapper.vm.form.vendorField).toBe('test vendorfield') }) @@ -1129,6 +1160,7 @@ describe('TransactionFormTransfer', () => { }) it('should generate error for multipayment transaction', () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-2', amount: 10 @@ -1395,9 +1427,9 @@ describe('TransactionFormTransfer', () => { it('should submit form data', async () => { const spy = jest.spyOn(wrapper.vm, 'onSubmit').mockImplementation() - wrapper.vm.nextStep() + await wrapper.vm.nextStep() - expect(spy).toHaveBeenCalledTimes(0) + expect(spy).toHaveBeenCalledTimes(1) }) }) @@ -1606,9 +1638,13 @@ describe('TransactionFormTransfer', () => { }) it('should be above minimum if set', () => { + wrapper.vm.onSendTypeChange('Multiple') wrapper.vm.$v.form.recipients.$model = [{ address: 'address-1', amount: 10 + }, { + address: 'address-1', + amount: 10 }] expect(wrapper.vm.$v.form.recipients.aboveMinimum).toBe(true) diff --git a/src/renderer/components/Input/InputFee.vue b/src/renderer/components/Input/InputFee.vue index 10d22e7763..41a82b43fd 100644 --- a/src/renderer/components/Input/InputFee.vue +++ b/src/renderer/components/Input/InputFee.vue @@ -58,7 +58,7 @@

{{ $t(`INPUT_FEE.UNIQUE`, { fee: parseFloat(fee) }) }} @@ -121,6 +121,12 @@ export default { type: Object, required: false, default: null + }, + + hideStaticFeeNotice: { + type: Boolean, + required: false, + default: false } }, @@ -260,15 +266,17 @@ export default { } }, + watch: { + transactionType () { + this.triggerTypeUpdate() + } + }, + created () { // Fees should be synchronized only when this component is active this.$synchronizer.appendFocus('fees') - if (this.lastFee && this.session_profile.defaultChosenFee === 'LAST') { - this.onChoice(this.session_profile.defaultChosenFee) - } else { - this.emitFee(this.feeChoices.AVERAGE) - } + this.triggerTypeUpdate() }, beforeDestroy () { @@ -276,6 +284,13 @@ export default { }, methods: { + triggerTypeUpdate () { + if (this.lastFee && this.session_profile.defaultChosenFee === 'LAST') { + this.onChoice(this.session_profile.defaultChosenFee) + } else { + this.emitFee(this.feeChoices.AVERAGE) + } + }, focusInput () { this.$refs.input.focus() }, diff --git a/src/renderer/components/Input/InputToggle/InputToggleChoice.vue b/src/renderer/components/Input/InputToggle/InputToggleChoice.vue index abac5c46e7..f19b0b0e57 100644 --- a/src/renderer/components/Input/InputToggle/InputToggleChoice.vue +++ b/src/renderer/components/Input/InputToggle/InputToggleChoice.vue @@ -5,7 +5,7 @@ 'rounded-l': isFirst, 'rounded-r': isLast, 'InputToggleChoice--selected bg-blue text-white font-semibold shadow-lg': isSelected, - 'bg-theme-input-toggle-choice text-theme-input-toggle-choice-text': !isSelected + 'bg-theme-input-toggle-choice text-theme-input-toggle-choice-text hover:bg-theme-input-toggle-choice-hover': !isSelected }" type="button" @click="emitSelect(choice)" diff --git a/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue b/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue index d827813ecc..5c6d75efab 100644 --- a/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue +++ b/src/renderer/components/Transaction/TransactionForm/TransactionFormTransfer.vue @@ -3,6 +3,28 @@ class="TransactionFormTransfer flex flex-col" @submit.prevent > +
+
+ Select a Single or Multiple Recipient Transaction +
+ +
+ + +
+ ? +
+
+
+ - - -
- + +
+ + + +
+ - -