From 8a7e6aadab22cfb9aee22dec545401a4579160af Mon Sep 17 00:00:00 2001 From: Artem Date: Tue, 17 Nov 2020 22:06:57 +0300 Subject: [PATCH] Feature: domains --- src/api/bcd.js | 32 +++++ src/components/SearchBox.vue | 14 +++ src/router/index.js | 7 ++ src/views/contract/SideBar.vue | 22 +++- src/views/extended_search/ResultItem.vue | 10 ++ src/views/stats/DomainsTab.vue | 153 +++++++++++++++++++++++ src/views/stats/Stats.vue | 3 + 7 files changed, 240 insertions(+), 1 deletion(-) create mode 100644 src/views/stats/DomainsTab.vue diff --git a/src/api/bcd.js b/src/api/bcd.js index 57a320e3..d98c8cf6 100644 --- a/src/api/bcd.js +++ b/src/api/bcd.js @@ -759,6 +759,38 @@ export class BetterCallApi { }) } + listDomains(network, offset = 0, size = 10) { + let params = {} + if (size > 0) { + params['size'] = size + } + if (offset > 0) { + params['offset'] = offset + } + return getCancellable(this.api, `/domains/${network}`, { + params: params + }) + .then((res) => { + if (res.status != 200) { + throw new RequestFailedError(res); + } + return res.data + }) + } + + resolveDomain(network, address) { + return getCancellable(this.api, `/domains/${network}/resolve?address=${address}`, {}) + .then((res) => { + if (res.status == 204) { + return {} + } + if (res.status != 200) { + throw new RequestFailedError(res); + } + return res.data + }) + } + getTokenVolumeSeries(network, period, contract, addresses, token_id) { let params = []; params.push(`contract=${contract}`) diff --git a/src/components/SearchBox.vue b/src/components/SearchBox.vue index 0f8d72e7..f1932131 100644 --- a/src/components/SearchBox.vue +++ b/src/components/SearchBox.vue @@ -34,6 +34,7 @@ >mdi-circle-multiple-outline mdi-history + mdi-web @@ -73,6 +74,9 @@ {{ item.body.symbol }} + @@ -238,6 +242,16 @@ export default { this.model = null; }); this.$router.push({ path: `/${network}/${value}/tokens` }); + } else if ( + [this.model.type, this.model.body.recent_type].includes( + "tezos_domain" + ) && + checkAddress(value) + ) { + this.$nextTick(() => { + this.model = null; + }); + this.$router.push({ path: `/${network}/${value}` }); } else if (this.model.type == "recent") { this.$router.push({ name: "search", query: { text: value } }); } diff --git a/src/router/index.js b/src/router/index.js index 09c6549a..d212df3f 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -10,6 +10,7 @@ import ExtendedSearch from '@/views/extended_search/ExtendedSearch.vue' import Stats from '@/views/stats/Stats.vue' import NetworkTab from '@/views/stats/NetworkTab.vue' import TokensTab from '@/views/stats/TokensTab.vue' +import DomainsTab from '@/views/stats/DomainsTab.vue' import Diff from '@/views/diff/Diff.vue' @@ -129,6 +130,12 @@ const router = new Router({ name: 'stats_fa20', component: TokensTab, props: true + }, + { + path: 'domains', + name: 'domains', + component: DomainsTab, + props: true } ] }, diff --git a/src/views/contract/SideBar.vue b/src/views/contract/SideBar.vue index c6f8333d..daf26385 100644 --- a/src/views/contract/SideBar.vue +++ b/src/views/contract/SideBar.vue @@ -173,6 +173,16 @@ + + + Domain + + {{ domain }} + + + { + if (!res && res.name && res.name !== "") return; + this.domain = res.name; + }); + }, }, watch: { address: "requestSameSimilar", diff --git a/src/views/extended_search/ResultItem.vue b/src/views/extended_search/ResultItem.vue index 157fb00a..13c14237 100644 --- a/src/views/extended_search/ResultItem.vue +++ b/src/views/extended_search/ResultItem.vue @@ -56,6 +56,13 @@ + @@ -93,6 +100,9 @@ metadata + + domain + diff --git a/src/views/stats/DomainsTab.vue b/src/views/stats/DomainsTab.vue new file mode 100644 index 00000000..69eb585c --- /dev/null +++ b/src/views/stats/DomainsTab.vue @@ -0,0 +1,153 @@ + + + \ No newline at end of file diff --git a/src/views/stats/Stats.vue b/src/views/stats/Stats.vue index 22dbac13..1ccf8152 100644 --- a/src/views/stats/Stats.vue +++ b/src/views/stats/Stats.vue @@ -16,6 +16,9 @@ mdi-align-vertical-bottom General + + mdi-web Domains + mdi-bank-outline FA1.2