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

View File

@ -41,7 +41,7 @@
"md-editor-v3": "^2.8.1", "md-editor-v3": "^2.8.1",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"osmojs": "^14.0.0-rc.0", "osmojs": "^14.0.0-rc.0",
"ping-widget": "^0.0.19", "ping-widget": "^0.0.20",
"pinia": "^2.0.28", "pinia": "^2.0.28",
"postcss": "^8.4.23", "postcss": "^8.4.23",
"prismjs": "^1.29.0", "prismjs": "^1.29.0",

View File

@ -37,21 +37,29 @@ const tipMsg = computed(() => {
<template> <template>
<div <div
v-show="walletStore.currentAddress"
class="dropdown dropdown-hover dropdown-end" class="dropdown dropdown-hover dropdown-end"
> >
<label tabindex="0" class="btn btn-sm m-1 lowercase">{{ <label tabindex="0" class="btn btn-sm m-1 lowercase">
walletStore.shortAddress <Icon icon="mdi:wallet"/>
}}</label> <span class="ml-1 hidden md:block">
{{ walletStore.shortAddress || "Wallet" }}</span>
</label>
<div <div
tabindex="0" tabindex="0"
class="dropdown-content menu shadow p-2 bg-base-100 rounded w-64 overflow-auto" 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"> <div class="px-2 mb-1 text-gray-500 dark:text-gray-400 font-semibold">
{{ walletStore.connectedWallet?.wallet }} {{ walletStore.connectedWallet?.wallet }}
</div> </div>
<div class=""> <div class="">
<a <a
v-if="walletStore.currentAddress"
class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer" class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer"
style="overflow-wrap: anywhere" style="overflow-wrap: anywhere"
@click="copyAdress(walletStore.currentAddress)" @click="copyAdress(walletStore.currentAddress)"
@ -69,8 +77,9 @@ const tipMsg = computed(() => {
to="/wallet/portfolio" to="/wallet/portfolio"
>Portfolio</RouterLink >Portfolio</RouterLink
> >
<div class="divider mt-1 mb-1"></div> <div v-if="walletStore.currentAddress" class="divider mt-1 mb-1"></div>
<a <a
v-if="walletStore.currentAddress"
class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer" class="block py-2 px-2 hover:bg-gray-100 dark:hover:bg-[#353f5a] rounded cursor-pointer"
@click="walletStore.disconnect()" @click="walletStore.disconnect()"
>Disconnected</a >Disconnected</a
@ -93,12 +102,6 @@ const tipMsg = computed(() => {
</div> </div>
</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"> <div class="footer-modal">
<Teleport to="body"> <Teleport to="body">
<ping-connect-wallet <ping-connect-wallet

View File

@ -8,7 +8,7 @@ import type {
} from '../types'; } from '../types';
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue'; import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
import type { CustomInputContent } from '@/plugins/vuetify/@core/types'; import type { CustomInputContent } from '@/plugins/vuetify/@core/types';
import { useFormatter } from '@/stores'; import { useFormatter, useTxDialog } from '@/stores';
import PaginationBar from '@/components/PaginationBar.vue'; import PaginationBar from '@/components/PaginationBar.vue';
import { PageRequest } from '@/types'; import { PageRequest } from '@/types';
@ -27,6 +27,7 @@ function loadContract(pageNum: number) {
} }
loadContract(1) loadContract(1)
const dialog = useTxDialog()
const format = useFormatter(); const format = useFormatter();
const infoDialog = ref(false); const infoDialog = ref(false);
const stateDialog = ref(false); const stateDialog = ref(false);
@ -136,16 +137,22 @@ const result = ref('');
</label> </label>
<label <label
for="modal-contract-query" 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)" @click="showQuery(v)"
> >
Query Query
</label> </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> </td>
</tr> </tr>
</tbody> </tbody>
</table> </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>
</div> </div>
@ -192,7 +199,7 @@ const result = ref('');
{{ format.base64ToString(v.value) }} {{ format.base64ToString(v.value) }}
</td> </td>
</tr> </tr>
</table> </table>
<PaginationBar :limit="pageRequest.limit" :total="state.pagination?.total" :callback="pageload"/> <PaginationBar :limit="pageRequest.limit" :total="state.pagination?.total" :callback="pageload"/>
</div> </div>
</div> </div>

View File

@ -1,5 +1,5 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useBlockchain, useFormatter } from '@/stores'; import { useBlockchain, useFormatter, useTxDialog } from '@/stores';
import { useWasmStore } from './WasmStore'; import { useWasmStore } from './WasmStore';
import { ref } from 'vue'; import { ref } from 'vue';
import type { PaginabledCodeInfos } from './types'; import type { PaginabledCodeInfos } from './types';
@ -12,6 +12,7 @@ const codes = ref({} as PaginabledCodeInfos);
const pageRequest = ref(new PageRequest()) const pageRequest = ref(new PageRequest())
const wasmStore = useWasmStore(); const wasmStore = useWasmStore();
const dialog = useTxDialog()
function pageload(pageNum: number) { function pageload(pageNum: number) {
pageRequest.value.setPage(pageNum) pageRequest.value.setPage(pageNum)
@ -57,7 +58,15 @@ pageload(1)
</tr> </tr>
</tbody> </tbody>
</table> </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>
</div> </div>
</template> </template>

View File

@ -224,9 +224,7 @@ async function addAddress(acc: AccountEntry) {
</tbody> </tbody>
<tfoot> <tfoot>
<th colspan="10"> <th colspan="10">
<div v-if="editable"> <RouterLink to="/wallet/keplr"> Add chain to Keplr </RouterLink>
</div>
</th> </th>
</tfoot> </tfoot>
</table> </table>

View File

@ -97,7 +97,7 @@ function suggest() {
<textarea v-model="conf" class="textarea textarea-bordered w-full" rows="15"></textarea> <textarea v-model="conf" class="textarea textarea-bordered w-full" rows="15"></textarea>
</div> </div>
<div class="mt-4 mb-4"> <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>
</div> </div>
</template> </template>

View File

@ -3076,7 +3076,7 @@
"@vue/compiler-dom" "3.2.47" "@vue/compiler-dom" "3.2.47"
"@vue/shared" "3.2.47" "@vue/shared" "3.2.47"
"@vue/devtools-api@^6.2.1", "@vue/devtools-api@^6.4.5", "@vue/devtools-api@^6.5.0": "@vue/devtools-api@^6.2.1", "@vue/devtools-api@^6.4.5":
version "6.5.0" version "6.5.0"
resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz" resolved "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz"
integrity sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q== integrity sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==
@ -4846,6 +4846,11 @@ fb-watchman@^2.0.0:
dependencies: dependencies:
bser "2.1.1" bser "2.1.1"
fflate@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.0.tgz#f93ad1dcbe695a25ae378cf2386624969a7cda32"
integrity sha512-FAdS4qMuFjsJj6XHbBaZeXOgaypXp8iw/Tpyuq/w3XA41jjLHT8NPA+n7czH/DDhdncq0nAyDZmPeWXh2qmdIg==
figures@^2.0.0: figures@^2.0.0:
version "2.0.0" version "2.0.0"
resolved "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz" resolved "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz"
@ -6950,10 +6955,10 @@ pify@^3.0.0:
resolved "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz" resolved "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz"
integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg== integrity sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==
ping-widget@^0.0.19: ping-widget@^0.0.20:
version "0.0.19" version "0.0.20"
resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.19.tgz#61ac216963a4b6bed3a525890ccd35fa64644c0e" resolved "https://registry.yarnpkg.com/ping-widget/-/ping-widget-0.0.20.tgz#768979566462284ca69bf78901c25f4adbc8613b"
integrity sha512-Yl1P8+cgiXCLsFHJJpP/Cy8eL+5j4xtWGSF1sAwJKj2UfVCJHGqFO2ih+caEx5I6wYQYwZTzqDYUjco5SADNaA== integrity sha512-bndLcLs5YDEHXXXglODwO1oLr5PANPOfVojPyLaUq41z2eBmFJ4hum+yqKLvsWLSaNnEJSv/gleeA1gutj4ogw==
dependencies: dependencies:
"@cosmjs/amino" "^0.30.1" "@cosmjs/amino" "^0.30.1"
"@cosmjs/cosmwasm-stargate" "^0.30.1" "@cosmjs/cosmwasm-stargate" "^0.30.1"
@ -6972,8 +6977,8 @@ ping-widget@^0.0.19:
cross-fetch "^3.1.5" cross-fetch "^3.1.5"
daisyui "^2.51.6" daisyui "^2.51.6"
dayjs "^1.11.7" dayjs "^1.11.7"
fflate "^0.8.0"
osmojs "^15.2.1" osmojs "^15.2.1"
pinia "^2.0.36"
vue "^3.2.47" vue "^3.2.47"
vue3-webcomponent-wrapper "^0.2.0" vue3-webcomponent-wrapper "^0.2.0"
@ -6985,14 +6990,6 @@ pinia@^2.0.28:
"@vue/devtools-api" "^6.4.5" "@vue/devtools-api" "^6.4.5"
vue-demi "*" vue-demi "*"
pinia@^2.0.36:
version "2.1.1"
resolved "https://registry.yarnpkg.com/pinia/-/pinia-2.1.1.tgz#542c6bb8a7c27b342082f431bccd6124b63c5b55"
integrity sha512-Y2CgpcUtD8Ogdvo5LW5g20ykSZgnVDMgTSZFr40EvO6HB8axQk+0lHa1UrRah9wworFaxjovwRlY/wRICWj/KQ==
dependencies:
"@vue/devtools-api" "^6.5.0"
vue-demi ">=0.14.2"
pirates@^4.0.1, pirates@^4.0.4: pirates@^4.0.1, pirates@^4.0.4:
version "4.0.5" version "4.0.5"
resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz" resolved "https://registry.npmjs.org/pirates/-/pirates-4.0.5.tgz"
@ -8627,11 +8624,6 @@ vue-demi@>=0.14.0:
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.1.tgz#1ed9af03a27642762bfed83d8750805302d0398d" resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.1.tgz#1ed9af03a27642762bfed83d8750805302d0398d"
integrity sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ== integrity sha512-rt+yuCtXvscYot9SQQj3WKZJVSriPNqVkpVBNEHPzSgBv7QIYzsS410VqVgvx8f9AAPgjg+XPKvmV3vOqqkJQQ==
vue-demi@>=0.14.2:
version "0.14.3"
resolved "https://registry.yarnpkg.com/vue-demi/-/vue-demi-0.14.3.tgz#5c7375527ad32580a7d8d28ee322bc059dbc1b99"
integrity sha512-aknytzARm7U20nMhvOdfa5IRiS+oyATtd55s3fICsT7wEtN/qoOiOINsNsNJjeZCOsPNOGS4p1yDOwH9cTxgjg==
vue-eslint-parser@^9.0.0, vue-eslint-parser@^9.0.1: vue-eslint-parser@^9.0.0, vue-eslint-parser@^9.0.1:
version "9.1.0" version "9.1.0"
resolved "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz" resolved "https://registry.npmjs.org/vue-eslint-parser/-/vue-eslint-parser-9.1.0.tgz"