mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-27 15:40:36 +08:00
Jump to org in resolver
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
|
||||
let error = false;
|
||||
|
||||
onMount(() => {
|
||||
onMount(async () => {
|
||||
if (query) {
|
||||
if (ethers.utils.isAddress(query)) {
|
||||
// Go to org.
|
||||
@@ -24,7 +24,14 @@
|
||||
if (label.includes(".")) {
|
||||
error = true;
|
||||
} else {
|
||||
navigate(`/registrations/${label}`, { replace: true });
|
||||
// Jump straight to org, if the ENS entry points to an org. Otherwise just go to the
|
||||
// registration.
|
||||
const address = await utils.resolveLabel(label, config);
|
||||
if (address && await utils.identifyAddress(address, config) === utils.AddressType.Org) {
|
||||
navigate(`/orgs/${address}`, { replace: true });
|
||||
} else {
|
||||
navigate(`/registrations/${label}`, { replace: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -138,3 +138,8 @@ export async function identifyAddress(address: string, config: Config): Promise<
|
||||
}
|
||||
return AddressType.EOA;
|
||||
}
|
||||
|
||||
// Resolve a label under the radicle domain.
|
||||
export async function resolveLabel(label: string, config: Config): Promise<string | null> {
|
||||
return config.provider.resolveName(`${label}.${config.registrar.domain}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user