-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
225 additions
and
50 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script setup lang="ts"> | ||
import Header from "@/explorer/Header.vue"; | ||
import { blockStore } from "@/state/data"; | ||
import { computed, watchEffect } from "vue"; | ||
import { useRoute } from "vue-router"; | ||
const route = useRoute(); | ||
const block_hash = computed(() => route.params.block_hash as string); | ||
watchEffect(() => { | ||
if (!blockStore.value.data[block_hash.value]) { | ||
blockStore.value.load(block_hash.value); | ||
} | ||
}); | ||
const data = computed(() => blockStore.value.data?.[block_hash.value]); | ||
</script> | ||
|
||
<template> | ||
<div class="container m-auto"> | ||
<Header></Header> | ||
<div class="px-8 py-4 bg-white rounded-xl text-gray-700"> | ||
<h2 class="mb-4">Tx 0x{{ block_hash }}</h2> | ||
<p> | ||
Parent: <RouterLink :to="{ name: 'Block', params: { block_hash: data?.parent_hash } }">{{ data?.parent_hash }}</RouterLink> | ||
</p> | ||
<p>Height: {{ data?.height }}</p> | ||
<div class="mt-4"> | ||
<pre class="bg-gray-100 p-4 rounded-xl text-xs font-mono">{{ JSON.stringify(data, null, 4) }}</pre> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<script setup lang="ts"> | ||
import Header from "@/explorer/Header.vue"; | ||
import { contractStore } from "@/state/data"; | ||
import { computed, watchEffect } from "vue"; | ||
import { useRoute } from "vue-router"; | ||
const route = useRoute(); | ||
const contract_name = computed(() => route.params.contract_name as string); | ||
watchEffect(() => { | ||
if (!contractStore.value.data[contract_name.value]) { | ||
contractStore.value.load(contract_name.value); | ||
} | ||
}); | ||
const data = computed(() => contractStore.value.data?.[contract_name.value]); | ||
</script> | ||
|
||
<template> | ||
<div class="container m-auto"> | ||
<Header></Header> | ||
<div class="px-8 py-4 bg-white rounded-xl text-gray-700"> | ||
<h2 class="mb-4">Contract {{ contract_name }}</h2> | ||
<div class="mt-4"> | ||
<pre class="bg-gray-100 p-4 rounded-xl text-xs font-mono">{{ JSON.stringify(data, null, 4) }}</pre> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script setup lang="ts"> | ||
import Header from "@/explorer/Header.vue"; | ||
import { transactionStore } from "@/state/data"; | ||
import { computed, watchEffect } from "vue"; | ||
import { useRoute } from "vue-router"; | ||
const route = useRoute(); | ||
const tx_hash = computed(() => route.params.tx_hash as string); | ||
watchEffect(() => { | ||
if (!transactionStore.value.data[tx_hash.value]) { | ||
transactionStore.value.load(tx_hash.value); | ||
} | ||
}); | ||
const data = computed(() => transactionStore.value.data?.[tx_hash.value]); | ||
</script> | ||
|
||
<template> | ||
<div class="container m-auto"> | ||
<Header></Header> | ||
<div class="px-8 py-4 bg-white rounded-xl text-gray-700"> | ||
<h2 class="mb-4">Tx 0x{{ tx_hash }}</h2> | ||
<p>Block: {{ data?.block_hash }}</p> | ||
<p>Type: {{ data?.transaction_type }}</p> | ||
<p>Status: {{ data?.transaction_status }}</p> | ||
<div class="mt-4"> | ||
<pre class="bg-gray-100 p-4 rounded-xl text-xs font-mono">{{ JSON.stringify(data, null, 4) }}</pre> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { getNetworkApiUrl } from "@/state/network"; | ||
|
||
export type ContractInfo = { | ||
contract_name: string; | ||
}; | ||
|
||
export class ContractStore { | ||
network: string; | ||
data: Record<string, ContractInfo> = {}; | ||
|
||
constructor(network: string) { | ||
this.network = network; | ||
} | ||
|
||
async loadAll() { | ||
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/contracts?no_cache=${Date.now()}`); | ||
let resp = await response.json(); | ||
for (let item of resp) { | ||
this.data[item.contract_name] = item; | ||
} | ||
} | ||
|
||
async load(contract_name: string) { | ||
if (this.data[contract_name]) { | ||
return; | ||
} | ||
const response = await fetch(`${getNetworkApiUrl(this.network)}/v1/indexer/contract/${contract_name}`); | ||
let item = await response.json(); | ||
this.data[item.contract_name] = item; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters