@crtxio/bproto-domain-lookup
v0.0.1
Published
@crtxio/bproto-domain-lookup is a Nuxt3 layer which provides Nuxt 3 composables to look up the domains and subdomains associated with an account.
Downloads
2
Readme
@crtxio/bproto-domain-lookup
@crtxio/bproto-domain-lookup is a Nuxt3 layer which provides Nuxt 3 composables to look up the domains and subdomains associated with an account.
Setup
Make sure to install the dependencies:
npm install --save @crtxio/bproto-domain-lookup
or
yarn add @crtxio/bproto-domain-lookup
Add the dependency to your extends
in nuxt.config
:
defineNuxtConfig({
extends: [
'@crtxio/bproto-domain-lookup'
]
})
How to use it
Components
<template>
<div @click="getDomains()" class="border rounded-md cursor-pointer w-fit p-1">
Fetch
</div>
<div class="text-xl font-bold mb-3">Press Lookup</div>
<div v-if="pressDomains">
<div v-for="domain in pressDomains.subdomains">
{{ domain.fqn }}
<div class="ml-5">
<div v-for="domain in domain.subdomains">
{{ domain.fqn }}
</div>
</div>
</div>
</div>
<div class="text-xl font-bold my-3">Chain Lookup</div>
<div v-if="chainDomains">
<div v-for="domain in chainDomains.subdomains">
{{ domain.fqn }}
<div class="ml-5">
<div v-for="domain in domain.subdomains">
{{ domain.fqn }}
</div>
</div>
</div>
</div>
</template>
<script>
import { ethers } from 'ethers';
import { Network } from 'alchemy-sdk';
import { useRuntimeConfig } from "#app";
export default {
data() {
return {
pressDomains: undefined,
chainDomains: undefined
}
},
methods: {
async getDomains() {
const config = useRuntimeConfig();
this.pressDomains = await arrangeDomains('pepe', await queryDomains(config.public.ACCOUNT));
const provider = new ethers.BrowserProvider(window.ethereum);
await provider.send("eth_requestAccounts", [])
this.chainDomains = await arrangeDomains(
'pepe',
await getLogs(
config.public.ACCOUNT,
provider,
'pepe',
16369392,
'0x9bD43DCC42Ff2187fFe2101d483A08173582b82f',
config.public.API_KEY,
Network.ETH_MAINNET
)
);
}
}
}
</script>