Skip to content

Commit

Permalink
Merge pull request #10 from sudokey/master
Browse files Browse the repository at this point in the history
Added title hint for executor
  • Loading branch information
Rexagon committed Sep 6, 2023
2 parents 8223b98 + a4013d6 commit 3d8a5d2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 11 deletions.
46 changes: 36 additions & 10 deletions src/components/ExecutorAbiForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ref, shallowRef, watch } from 'vue';
import * as core from '@core';
import { rewriteAbiUrl } from '../common';
import { convertAddress, rewriteAbiUrl } from '../common';
enum LoadAbiType {
FROM_FILE,
Expand All @@ -15,6 +15,7 @@ const DEFAULT_ABI_NAME = 'abi1';
const getAllAbis = () => Object.keys(localStorage);
const props = defineProps<{
address?: string;
codeHash?: string;
}>();
Expand All @@ -36,9 +37,9 @@ const abiSelectorVisible = ref(false);
const inProgress = ref(false);
watch(
() => props.codeHash,
(codeHash, _, onCleanup) => {
if (codeHash == null) {
() => [props.codeHash, props.address],
([codeHash, address], _, onCleanup) => {
if (address == null || codeHash == null) {
return;
}
Expand All @@ -51,16 +52,41 @@ watch(
controller.abort();
});
fetch(`https://verify.everscan.io/abi/code_hash/${codeHash}`, {
fetch(`https://verify.everscan.io/info/code_hash/${codeHash}`, {
method: 'GET',
signal: controller.signal
})
.then(res => res.text())
.then(abi => {
if (!localState.codeHashChanged) {
everscanAbi.value = abi != 'null' ? abi : undefined;
.then(res => res.json())
.then(data => {
if (localState.codeHashChanged) {
return
}
});
if (data && data.abi) {
everscanAbi.value = JSON.stringify(data.abi);
}
if (data && data.contract_name) {
const shortName = data.contract_name.split('/').pop().replace('.tsol', '');
if (shortName) {
document.title = `${shortName} ${convertAddress(address)} | Everscale tools`;
}
}
})
.catch(console.error);
},
{
immediate: true
}
);
watch(
() => [selectedAbi.value, props.address],
([abiName, address]) => {
if (abiName && address) {
document.title = `${abiName} ${convertAddress(address)} | Everscale tools`;
}
},
{
immediate: true
Expand Down
6 changes: 5 additions & 1 deletion src/components/ExecutorWorkspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,11 @@ onBeforeUnmount(() => {
/>
</div>
<div class="column is-8">
<ExecutorAbiForm :code-hash="codeHash" @change="abi = $event" />
<ExecutorAbiForm
:address="address"
:code-hash="codeHash"
@change="abi = $event"
/>

<div v-if="abi != null && address != null" class="block">
<div class="box field has-addons function-search pb-3">
Expand Down

0 comments on commit 3d8a5d2

Please sign in to comment.