2121 label =" Contract Name"
2222 hint =" For easier reference"
2323 v-model =" contractName"
24- :rules =" [val => !!val || 'Name is required']"
24+ :rules =" [( val) => !!val || 'Name is required']"
2525 />
2626 </div >
2727 </div >
6666 </q-card-section >
6767 <q-separator />
6868 <q-card-actions class =" bg-grey-2" >
69- <q-btn no-caps flat icon =" upload" color =" primary" :loading =" loading" @click =" deploy" :disable =" deployBtnIsDisabled"
69+ <q-btn
70+ no-caps
71+ flat
72+ icon =" upload"
73+ color =" primary"
74+ :loading =" loading"
75+ @click =" deploy"
76+ :disable =" deployBtnIsDisabled"
7077 >Deploy</q-btn
7178 >
7279 <q-space />
7380 <q-btn no-caps flat icon =" delete_forever" color =" red" >Reset</q-btn >
74- <q-btn no-caps flat icon =" close" color =" warning" v-close-popup >Cancel</q-btn >
81+ <q-btn no-caps flat icon =" close" color =" warning" v-close-popup
82+ >Cancel</q-btn
83+ >
7584 </q-card-actions >
7685 </q-card >
7786 </q-dialog >
@@ -84,7 +93,7 @@ import { ref } from 'vue';
8493import ContractInput from ' ./ContractInput.vue' ;
8594import { useQuasar } from ' quasar' ;
8695import { useContractsStore } from ' src/stores/contracts' ;
87- import { BN , Long } from ' @zilliqa-js/util' ;
96+ import { BN , Long } from ' @zilliqa-js/util' ;
8897import GasPriceInput from ' src/components/GasPriceInput.vue' ;
8998
9099const q = useQuasar ();
@@ -94,28 +103,30 @@ const show = ref(true);
94103const amount = ref (0 );
95104const gasPrice = ref (0 );
96105const gasLimit = ref (30000 );
97- const contractName = ref (' ' )
106+ const contractName = ref (' ' );
98107
99108const abi = ref ();
100109let abiParams = [];
101- const initializationParameters = ref ({})
110+ const initializationParameters = ref ({});
102111const contractsStore = useContractsStore ();
103112
104113const deployBtnIsDisabled = computed (() => {
105114 return contractName .value === ' ' ;
106- })
115+ });
107116
108117onMounted (async () => {
109118 try {
110119 const contractAbi = await getContractAbi (props .code );
111120 abi .value = contractAbi;
112121 abiParams = contractAbi .params ;
113- abiParams .forEach (item => initializationParameters .value [item .vname ] = ' ' )
122+ abiParams .forEach (
123+ (item ) => (initializationParameters .value [item .vname ] = ' ' )
124+ );
114125 } catch (error) {
115126 q .notify ({
116127 type: ' warning' ,
117- message: ` Failed to get the contract ABI. ${ error} `
118- })
128+ message: ` Failed to get the contract ABI. ${ error} ` ,
129+ });
119130 }
120131});
121132
@@ -124,21 +135,25 @@ const props = defineProps(['file', 'code']);
124135const deploy = async () => {
125136 loading .value = true ;
126137 try {
127- const id = await contractsStore .deploy (contractName .value , props .code , {
128- gasPrice: new BN (gasPrice .value ),
129- gasLimit: Long .fromNumber (gasLimit .value ),
130- amount: new BN (amount .value ),
131- }, abiParams .map (param => ({
132- ... param,
133- value: initializationParameters .value [param .vname ]
134- })))
138+ const id = await contractsStore .deploy (
139+ contractName .value ,
140+ props .code ,
141+ {
142+ gasPrice: new BN (gasPrice .value ),
143+ gasLimit: Long .fromNumber (gasLimit .value ),
144+ amount: new BN (amount .value ),
145+ },
146+ abiParams .map ((param ) => ({
147+ ... param,
148+ value: initializationParameters .value [param .vname ],
149+ }))
150+ );
135151 q .notify ({
136152 type: ' info' ,
137153 message: ` Contract deployment started. ${ id} ` ,
138154 });
139155 show .value = false ;
140156 } catch (error) {
141- console .log (error)
142157 q .notify ({
143158 type: ' negative' ,
144159 message: ` Failed to deploy. ${ error} ` ,
0 commit comments