add verificaion

This commit is contained in:
liangping 2023-12-14 08:39:46 +08:00
parent 489971021e
commit 2f8321dba8
2 changed files with 55 additions and 5 deletions

View File

@ -0,0 +1,52 @@
<script setup lang="ts">
import { get, post } from "@/libs/http"
import { useBaseStore } from "@/stores";
import { computed, onMounted, ref } from "vue";
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
const props = defineProps({
contract: { type: String },
});
const baseurl = "https://prod.compiler.welldonestudio.io"
const verification = ref({});
const chainId = computed(() => {
const base = useBaseStore()
return base.latest?.block?.header?.chain_id || "unknown"
})
console.log("contract:", props.contract)
onMounted(() => {
console.log("mounted", `${baseurl}/deploy-histories/neutron-1?contract=${props.contract}`, chainId.value)
get(`${baseurl}/deploy-histories/${chainId.value}?contract=${props.contract}`).then((x) => {
console.log("x:", x)
verification.value = x
}).catch(e => {
console.error(e)
})
})
function verify() {
const base = useBaseStore()
const id = base.latest?.block?.header?.chain_id || "unknown"
const data = {"contractAddress": props.contract, "chainId": "neutron"}
console.log(data)
post(`${baseurl}/verification/neutron`, data).then((x)=> {
console.log("x", x)
})
}
</script>
<template>
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
<h2 class="card-title truncate w-full mt-4">Verification {{ chainId }}</h2>
<div><DynamicComponent :value="verification"/></div>
<button class="btn btn-primary" @click="verify">verify</button>
</div>
</template>

View File

@ -13,6 +13,7 @@ import { post } from '@/libs';
import { JsonViewer } from "vue3-json-viewer"
// if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css"
import "vue3-json-viewer/dist/index.css";
import WasmVerification from '@/components/WasmVerification.vue';
const chainStore = useBlockchain();
const baseStore = useBaseStore();
@ -201,10 +202,7 @@ const result = ref({});
<PaginationBar :limit="page.limit" :total="txs.pagination?.total" :callback="pageload" />
</div>
<div class="bg-base-100 px-4 pt-3 pb-4 rounded mb-4 shadow">
<h2 class="card-title truncate w-full mt-4">Verification</h2>
</div>
<WasmVerification v-if="contractAddress=='1'" :contract="contractAddress" class="hide"/>
<div>
<input type="checkbox" id="modal-contract-funds" class="modal-toggle" />
@ -235,7 +233,7 @@ const result = ref({});
<label for="modal-contract-states" class="btn btn-sm btn-circle"></label>
</div>
<div class="overflow-auto">
<JsonViewer :value="state.models?.map(v => ({key: format.hexToString(v.key), value: JSON.parse(format.base64ToString(v.value))}))" :theme="baseStore.theme" style="background: transparent;" copyable boxed sort :expand-depth="5"/>
<JsonViewer :value="state.models?.map(v => ({key: format.hexToString(v.key), value: JSON.parse(format.base64ToString(v.value))}))||''" :theme="baseStore.theme||'dark'" style="background: transparent;" copyable boxed sort :expand-depth="5"/>
<PaginationBar :limit="pageRequest.limit" :total="state.pagination?.total"
:callback="pageloadState" />
</div>