diff --git a/.gitignore b/.gitignore index 7983193..a68a778 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,5 @@ package-lock.json dist/* addrbook.json build.zip +.idea +.vercel diff --git a/package.json b/package.json index e6311a7..e854ecc 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,8 @@ "@primer/octicons": "^17.1.0", "axios": "^0.24.0", "axios-retry": "^3.2.5", + "bn.js": "^5.2.1", + "buffer": "^6.0.3", "chart.js": "^4.0.1", "chartjs-adapter-date-fns": "^2.0.1", "chartjs-plugin-gradient": "^0.5.1", @@ -28,13 +30,15 @@ "highlightjs-func": "^0.3.1", "qrcode.vue": "^1.7.0", "timeago.js": "^4.0.2", + "tonweb": "^0.0.62", "vue": "^2.6.14", "vue-clipboard2": "^0.3.3", "vue-i18n": "^8.26.8", "vue-meta": "^2.4.0", "vue-mugen-scroll": "^0.2.6", "vue-router": "^3.5.3", - "vuex": "^3.6.2" + "vuex": "^3.6.2", + "web-tree-sitter": "^0.20.7" }, "devDependencies": { "@babel/plugin-transform-runtime": "^7.16.10", diff --git a/src/js/api/toncenter.js b/src/js/api/toncenter.js index d101b84..8e05940 100644 --- a/src/js/api/toncenter.js +++ b/src/js/api/toncenter.js @@ -1,8 +1,9 @@ import { TONCENTER_API_ENDPOINT, TONCENTER_API_KEY } from '~/config.js'; -import { canonizeAddress } from '~/tonweb.js'; -import { dechex, hexToBase64 } from '~/utils.js'; +import {canonizeAddress, parseStack} from '~/tonweb.js'; +import {base64ToBytes, dechex, hexToBase64} from '~/utils.js'; import axiosRetry from 'axios-retry'; import axios from 'axios'; +import TonWeb from "tonweb"; // Disable headers if api key is not set. Otherwise // axios will make a pre-flight request: @@ -263,4 +264,19 @@ export const getLastBlock = async function () { result.last.shard = dechex(result.last.shard); return Object.freeze(result.last); -}; \ No newline at end of file +}; + +export const executeGetMethod = async function({ address, method, stack = [] }) { + const { data } = await http.post('runGetMethod', { + address, + method, + stack + }); + + if (! data.ok) { + throw data.error; + } + + + return data.result.stack; +}; diff --git a/src/js/app.js b/src/js/app.js index 62448a8..954daed 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -2,7 +2,7 @@ import Vue from 'vue'; import axios from 'axios'; import VueClipboard from 'vue-clipboard2'; import VueMeta from 'vue-meta'; -import store from './store.js'; +import store from './store'; import router from './router.js'; import App from '~/components/App.vue'; import UiCopyButton from '~/components/UiCopyButton.vue'; diff --git a/src/js/components/UiInput.vue b/src/js/components/UiInput.vue new file mode 100644 index 0000000..5114192 --- /dev/null +++ b/src/js/components/UiInput.vue @@ -0,0 +1,38 @@ + + + \ No newline at end of file diff --git a/src/js/components/UiSelect.vue b/src/js/components/UiSelect.vue new file mode 100644 index 0000000..bf8ca78 --- /dev/null +++ b/src/js/components/UiSelect.vue @@ -0,0 +1,285 @@ + + + \ No newline at end of file diff --git a/src/js/components/address/AddressTabs.vue b/src/js/components/address/AddressTabs.vue index 2e951e4..e46a57f 100644 --- a/src/js/components/address/AddressTabs.vue +++ b/src/js/components/address/AddressTabs.vue @@ -5,10 +5,9 @@ import IconNft from '@img/icons/material-duotone/view-in-ar.svg?inline'; import IconToken from '@img/icons/material-duotone/toll.svg?inline'; import TabUserNfts from './TabUserNfts.vue'; import TabUserTokens from './TabUserTokens.vue'; -import TabContractSources from './Verifier/Verifier.vue'; -import ContractInfo from './ContractInfo.vue'; import TxHistory from './TxHistory.vue'; import UiTabs from '~/components/UiTabs.vue'; +import TabContract from "~/components/address/Contract/TabContract.vue"; export default { props: { @@ -32,7 +31,7 @@ export default { computed: { tabs() { - const props = { address: this.address }; + const props = { address: this.address, isActive: this.isActive }; const key = this.address; // keepalive key return [{ @@ -60,11 +59,8 @@ export default { icon: IconContract, content: { key, - component: TabContractSources, - props: { - address: this.address, - isActive: this.isActive, - }, + component: TabContract, + props }, }]; }, diff --git a/src/js/components/address/Contract/AddressFormats.vue b/src/js/components/address/Contract/AddressFormats.vue new file mode 100644 index 0000000..5915ced --- /dev/null +++ b/src/js/components/address/Contract/AddressFormats.vue @@ -0,0 +1,51 @@ + + + \ No newline at end of file diff --git a/src/js/components/address/Contract/ArgumentInput.vue b/src/js/components/address/Contract/ArgumentInput.vue new file mode 100644 index 0000000..dcddd05 --- /dev/null +++ b/src/js/components/address/Contract/ArgumentInput.vue @@ -0,0 +1,61 @@ + + + \ No newline at end of file diff --git a/src/js/components/address/Contract/ContractTabs.vue b/src/js/components/address/Contract/ContractTabs.vue new file mode 100644 index 0000000..62ef361 --- /dev/null +++ b/src/js/components/address/Contract/ContractTabs.vue @@ -0,0 +1,65 @@ + + + + \ No newline at end of file diff --git a/src/js/components/address/Contract/GetMethods.vue b/src/js/components/address/Contract/GetMethods.vue new file mode 100644 index 0000000..78472e6 --- /dev/null +++ b/src/js/components/address/Contract/GetMethods.vue @@ -0,0 +1,73 @@ + + + \ No newline at end of file diff --git a/src/js/components/address/Contract/Method.vue b/src/js/components/address/Contract/Method.vue new file mode 100644 index 0000000..f32632f --- /dev/null +++ b/src/js/components/address/Contract/Method.vue @@ -0,0 +1,90 @@ + + + \ No newline at end of file diff --git a/src/js/components/address/Contract/TabContract.vue b/src/js/components/address/Contract/TabContract.vue new file mode 100644 index 0000000..34dc3b8 --- /dev/null +++ b/src/js/components/address/Contract/TabContract.vue @@ -0,0 +1,82 @@ + + \ No newline at end of file diff --git a/src/js/components/address/Verifier/Verifier.vue b/src/js/components/address/Contract/Verifier.vue similarity index 100% rename from src/js/components/address/Verifier/Verifier.vue rename to src/js/components/address/Contract/Verifier.vue diff --git a/src/js/components/address/Verifier/VerifierAdmonition.vue b/src/js/components/address/Contract/VerifierAdmonition.vue similarity index 100% rename from src/js/components/address/Verifier/VerifierAdmonition.vue rename to src/js/components/address/Contract/VerifierAdmonition.vue diff --git a/src/js/components/address/Verifier/VerifierBytecodeViewer.vue b/src/js/components/address/Contract/VerifierBytecodeViewer.vue similarity index 99% rename from src/js/components/address/Verifier/VerifierBytecodeViewer.vue rename to src/js/components/address/Contract/VerifierBytecodeViewer.vue index 930915a..6a1ba13 100644 --- a/src/js/components/address/Verifier/VerifierBytecodeViewer.vue +++ b/src/js/components/address/Contract/VerifierBytecodeViewer.vue @@ -23,7 +23,7 @@
         
     
diff --git a/src/js/components/address/Verifier/VerifierFileList.vue b/src/js/components/address/Contract/VerifierFileList.vue
similarity index 99%
rename from src/js/components/address/Verifier/VerifierFileList.vue
rename to src/js/components/address/Contract/VerifierFileList.vue
index 34bba83..b311501 100644
--- a/src/js/components/address/Verifier/VerifierFileList.vue
+++ b/src/js/components/address/Contract/VerifierFileList.vue
@@ -72,7 +72,7 @@ export default {