diff --git a/src/components/AccountLink.vue b/src/components/AccountLink.vue
index 89f731d..3a28b9c 100644
--- a/src/components/AccountLink.vue
+++ b/src/components/AccountLink.vue
@@ -15,14 +15,15 @@
>
{{ address | abbr }}
{{ address | checksum }}
+ ({{ vetName }})
- {{ address | abbr }}
- {{ address | checksum }}
+ {{ (vetName || address) | abbr }}
+ {{ (vetName || address | checksum) }}
import Vue from "vue"
import { address } from "thor-devkit"
+import { genesisIdToNetwork } from '../utils'
export default Vue.extend({
props: {
@@ -41,10 +43,49 @@ export default Vue.extend({
icon: Boolean,
noLink: Boolean
},
+ asyncComputed: {
+ async vetName(): Promise {
+ if (genesisIdToNetwork(this.$connex.thor.genesis.id) !== 'main') {
+ return null
+ }
+ try {
+ const { decoded: { names } } = await this.$connex.thor
+ .account(vetResolverUtilsAddress)
+ .method(getNamesJsonAbi)
+ .call([this.address])
+
+ return names[0] || null
+ } catch {
+ return null
+ }
+ }
+ },
computed: {
isValid(): boolean {
return address.test(this.address);
}
}
})
-
+
+const vetResolverUtilsAddress = '0xA11413086e163e41901bb81fdc5617c975Fa5a1A'
+const getNamesJsonAbi = {
+ "inputs": [
+ {
+ "internalType": "address[]",
+ "name": "addresses",
+ "type": "address[]"
+ }
+ ],
+ "name": "getNames",
+ "outputs": [
+ {
+ "internalType": "string[]",
+ "name": "names",
+ "type": "string[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+}
+
+
\ No newline at end of file
diff --git a/src/views/Search.vue b/src/views/Search.vue
index 5406652..f6f35db 100644
--- a/src/views/Search.vue
+++ b/src/views/Search.vue
@@ -16,6 +16,7 @@
+const vetResolverUtilsAddress = '0xA11413086e163e41901bb81fdc5617c975Fa5a1A'
+const getAddressesJsonAbi = {
+ "inputs": [
+ {
+ "internalType": "string[]",
+ "name": "names",
+ "type": "string[]"
+ }
+ ],
+ "name": "getAddresses",
+ "outputs": [
+ {
+ "internalType": "address[]",
+ "name": "addresses",
+ "type": "address[]"
+ }
+ ],
+ "stateMutability": "view",
+ "type": "function"
+}
+
+
\ No newline at end of file