Skip to content

Commit

Permalink
fix: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicov-iov committed May 29, 2024
1 parent 00dd035 commit a38d144
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/components/ContractInteraction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export default {
message: {
content: null,
style: 'message-info'
}
},
requested: false
})
this.contractAbi[category].push(value)
Expand Down Expand Up @@ -267,6 +268,7 @@ export default {
async contractCall (methodName, inputs) {
const methodIndex = this.contractAbi[this.CATEGORIES.READ_METHODS].findIndex(m => m.name === methodName)
const method = this.contractAbi[this.CATEGORIES.READ_METHODS][methodIndex]
this.$set(method.interactionData, 'requested', true)
this.$set(method.interactionData, 'message', { content: 'calling contract...', style: 'message-info' })
try {
Expand Down Expand Up @@ -308,6 +310,8 @@ export default {
this.$set(method.interactionData, 'outputs', [])
this.$set(method.interactionData, 'message', { content: error.message, style: 'message-error' })
}
this.$set(method.interactionData, 'requested', false)
},
validateString (value) {
if (typeof value !== 'string') throw new Error('Invalid string')
Expand Down
6 changes: 3 additions & 3 deletions src/components/ContractMethods.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
<input class="method-input-field" type="text" v-model="method.interactionData.inputs[i]" :placeholder="input.name || i">
</div>
</div>
<button :class="['button', disableCalls ? 'disabled' : 'enabled']" @click="contractCall(method.name, method.interactionData.inputs)" :disabled="disableCalls">{{ method.name }}</button>
<button :class="['button', disableCalls || method.interactionData.requested ? 'disabled' : 'enabled']" @click="contractCall(method.name, method.interactionData.inputs)" :disabled="disableCalls">{{ method.name }}</button>
<!-- Result -->
<div v-if="showOutputs && method.outputs && method.interactionData.outputs[0]" class="result">
<div v-if="showOutputs && method.outputs && method.interactionData.outputs.length" class="result">
<label class="label">
<p>result</p>
<span v-if="method.outputs.length" class="type">({{ method.outputs.map(output => output.type).join(', ') }})</span>
</label>
<div v-for="(output, i) in method.outputs" :key="i">
<div class="method-output" v-if="method.interactionData.outputs[i]">
<div class="method-output" v-if="method.outputs[i]">
<p class="method-output-value">{{ method.interactionData.outputs[i] ?? 'result' }}</p>
</div>
</div>
Expand Down

0 comments on commit a38d144

Please sign in to comment.