11<template >
22 <ModalWrapper label =" Add Tip" icon =" plus" >
33 <div >
4- <Dropdown mode = " accounts " @selected = " handleAccountSelection " />
5- <Dropdown mode = " accounts " @selected = " handleBeneficiary " />
6- <b-field label =" reason" class = " password-wrapper " >
4+ <AccountSelect label = " submit with account " v-model = " accountId " />
5+ <AccountSelect label = " beneficiary " v-model = " beneficiaryId " />
6+ <b-field label =" tip reason" >
77 <b-input v-model =" reason" > </b-input >
88 </b-field >
9-
10- <b-field label =" password 🤫 magic spell" class =" password-wrapper" >
11- <b-input v-model =" password" type =" password" password-reveal > </b-input >
12- </b-field >
9+ <PasswordInput v-model =" password" />
1310
1411 <b-button
1512 type =" is-primary"
@@ -33,51 +30,43 @@ import { KeyringPair } from '@polkadot/keyring/types';
3330import { notificationTypes , showNotification } from ' @/utils/notification' ;
3431import exec from ' @/utils/transactionExecutor' ;
3532import { urlBuilderTransaction } from ' @/utils/explorerGuide' ;
36- import C from ' @vue-polkadot/vue-api'
33+ import Connector from ' @vue-polkadot/vue-api' ;
34+ import AccountSelect from ' @/components/shared/AccountSelect.vue'
35+ import PasswordInput from ' @/components/shared/PasswordInput.vue' ;
3736
3837@Component ({
3938 components: {
4039 ModalWrapper ,
41- Dropdown ,
40+ AccountSelect ,
41+ PasswordInput
4242 },
4343})
4444export default class TipModal extends Vue {
45- private account: any = {};
45+ private accountId: string = ' ' ;
46+ private beneficiaryId: string = ' ' ;
4647 private password: string = ' ' ;
47- private beneficiary: any = {};
4848 private reason: string = ' ' ;
4949
50-
51-
52- public handleAccountSelection(account : KeyringPair ) {
53- this .account = account ;
54- }
55-
56- public handleBeneficiary(account : KeyringPair ) {
57- console .log (account .address )
58- this .beneficiary = account ;
59- }
60-
6150 public async shipIt() {
62- const { api } = C .getInstance ()
51+ const { api } = Connector .getInstance ();
6352
6453 if (! api ) {
6554 return ;
6655 }
6756
6857 try {
69- const { reason, beneficiary } = this ;
58+ const { reason, beneficiaryId, accountId, password } = this ;
7059 showNotification (' Dispatched' );
71- const tx = await exec (this . account , this .password , api .tx .treasury .reportAwesome , [reason , beneficiary . address ]);
72- // showNotification(`Second ${referendumId.toString()}`, { ... notificationTypes.success, onAction: this.onAction() } );
60+ const tx = await exec (accountId , this .password , api .tx .treasury .reportAwesome , [reason , beneficiaryId ]);
61+ showNotification (' [TIP] Success ' , notificationTypes .success );
7362 } catch (e ) {
7463 showNotification (e , notificationTypes .danger );
7564 }
7665
7766 }
7867
7968 get disabled() {
80- return ! this .account || ! this .password || ! this . beneficiary || ! this .reason
69+ return ! this .accountId || ! this .beneficiaryId || ! this .reason
8170 }
8271
8372}
0 commit comments