add wasm inter operation

This commit is contained in:
liangping
2023-05-26 08:05:29 +08:00
parent 48d81f16c7
commit 8b514d85c6
7 changed files with 50 additions and 41 deletions
+14 -11
View File
@@ -37,21 +37,29 @@ const tipMsg = computed(() => {
<template>
<div
v-show="walletStore.currentAddress"
class="dropdown dropdown-hover dropdown-end"
>
<label tabindex="0" class="btn btn-sm m-1 lowercase">{{
walletStore.shortAddress
}}</label>
<label tabindex="0" class="btn btn-sm m-1 lowercase">
<Icon icon="mdi:wallet"/>
<span class="ml-1 hidden md:block">
{{ walletStore.shortAddress || "Wallet" }}</span>
</label>
<div
tabindex="0"
class="dropdown-content menu shadow p-2 bg-base-100 rounded w-64 overflow-auto"
>
<label
v-if="!walletStore?.currentAddress"
for="PingConnectWallet"
class="btn btn-sm"
><Icon icon="mdi:wallet"/><span class="ml-1 hidden md:block">Connect Wallet</span></label
>
<div class="px-2 mb-1 text-gray-500 dark:text-gray-400 font-semibold">
{{ walletStore.connectedWallet?.wallet }}
</div>
<div class="">
<a
v-if="walletStore.currentAddress"
class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer"
style="overflow-wrap: anywhere"
@click="copyAdress(walletStore.currentAddress)"
@@ -69,8 +77,9 @@ const tipMsg = computed(() => {
to="/wallet/portfolio"
>Portfolio</RouterLink
>
<div class="divider mt-1 mb-1"></div>
<div v-if="walletStore.currentAddress" class="divider mt-1 mb-1"></div>
<a
v-if="walletStore.currentAddress"
class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer"
@click="walletStore.disconnect()"
>Disconnected</a
@@ -93,12 +102,6 @@ const tipMsg = computed(() => {
</div>
</div>
<label
v-if="!walletStore?.currentAddress"
for="PingConnectWallet"
class="btn btn-sm ml-4"
><Icon icon="mdi:wallet"/><span class="ml-1 hidden md:block">Connect Wallet</span></label
>
<div class="footer-modal">
<Teleport to="body">
<ping-connect-wallet
@@ -8,7 +8,7 @@ import type {
} from '../types';
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
import type { CustomInputContent } from '@/plugins/vuetify/@core/types';
import { useFormatter } from '@/stores';
import { useFormatter, useTxDialog } from '@/stores';
import PaginationBar from '@/components/PaginationBar.vue';
import { PageRequest } from '@/types';
@@ -27,6 +27,7 @@ function loadContract(pageNum: number) {
}
loadContract(1)
const dialog = useTxDialog()
const format = useFormatter();
const infoDialog = ref(false);
const stateDialog = ref(false);
@@ -136,16 +137,22 @@ const result = ref('');
</label>
<label
for="modal-contract-query"
class="btn btn-primary btn-sm text-xs"
class="btn btn-primary btn-sm text-xs mr-2"
@click="showQuery(v)"
>
Query
</label>
<label for="wasm_execute_contract" class="btn btn-primary btn-sm text-xs" @click="dialog.open('wasm_execute_contract', {contract: v})">
Execute
</label>
</td>
</tr>
</tbody>
</table>
<PaginationBar :limit="50" :total="response.pagination?.total" :callback="loadContract"/>
<div class="flex justify-between">
<PaginationBar :limit="50" :total="response.pagination?.total" :callback="loadContract"/>
<label for="wasm_instantiate_contract" class="btn btn-primary my-5" @click="dialog.open('wasm_instantiate_contract', {codeId: props.code_id})">Instantiate Contract</label>
</div>
</div>
</div>
@@ -192,7 +199,7 @@ const result = ref('');
{{ format.base64ToString(v.value) }}
</td>
</tr>
</table>
</table>
<PaginationBar :limit="pageRequest.limit" :total="state.pagination?.total" :callback="pageload"/>
</div>
</div>
+11 -2
View File
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useBlockchain, useFormatter } from '@/stores';
import { useBlockchain, useFormatter, useTxDialog } from '@/stores';
import { useWasmStore } from './WasmStore';
import { ref } from 'vue';
import type { PaginabledCodeInfos } from './types';
@@ -12,6 +12,7 @@ const codes = ref({} as PaginabledCodeInfos);
const pageRequest = ref(new PageRequest())
const wasmStore = useWasmStore();
const dialog = useTxDialog()
function pageload(pageNum: number) {
pageRequest.value.setPage(pageNum)
@@ -57,7 +58,15 @@ pageload(1)
</tr>
</tbody>
</table>
<PaginationBar :limit="pageRequest.limit" :total="codes.pagination?.total" :callback="pageload"/>
<div class="flex justify-between">
<PaginationBar :limit="pageRequest.limit" :total="codes.pagination?.total" :callback="pageload"/>
<label
for="wasm_store_code"
class="btn btn-primary my-5"
@click="dialog.open('wasm_store_code', {})"
>Upload Smart Contract</label
>
</div>
</div>
</div>
</template>
+1 -3
View File
@@ -224,9 +224,7 @@ async function addAddress(acc: AccountEntry) {
</tbody>
<tfoot>
<th colspan="10">
<div v-if="editable">
</div>
<RouterLink to="/wallet/keplr"> Add chain to Keplr </RouterLink>
</th>
</tfoot>
</table>
+1 -1
View File
@@ -97,7 +97,7 @@ function suggest() {
<textarea v-model="conf" class="textarea textarea-bordered w-full" rows="15"></textarea>
</div>
<div class="mt-4 mb-4">
You can edit above params if you want.
If the chain is not offically support on Keplr, you can submit these parameters to enable Keplr.
</div>
</div>
</template>