-
Notifications
You must be signed in to change notification settings - Fork 51
feat(explorer): add address existence check in getResultsForAddress for names #8597
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
apps/explorer/src/hooks/useSearch.ts
Outdated
]; | ||
}; | ||
|
||
async function addressExists(client: IotaClient, address: string): Promise<boolean> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async function addressExists(client: IotaClient, address: string): Promise<boolean> { | |
async function isAddress(client: IotaClient, address: string): Promise<boolean> { |
apps/explorer/src/hooks/useSearch.ts
Outdated
|
||
if (!nameRecord || !nameRecord.targetAddress) return null; | ||
|
||
const exists = await addressExists(client, nameRecord.targetAddress); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const exists = await addressExists(client, nameRecord.targetAddress); | |
const _isAddress = await isAddress(client, nameRecord.targetAddress); |
apps/explorer/src/hooks/useSearch.ts
Outdated
const fromTransactions = await client.queryTransactionBlocks({ | ||
filter: { FromAddress: normalized }, | ||
limit: 1, | ||
}); | ||
if (fromTransactions.data.length > 0) return true; | ||
|
||
const toTransactions = await client.queryTransactionBlocks({ | ||
filter: { ToAddress: normalized }, | ||
limit: 1, | ||
}); | ||
if (toTransactions.data.length > 0) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this also work by doing:
const fromTransactions = await client.queryTransactionBlocks({ | |
filter: { FromAddress: normalized }, | |
limit: 1, | |
}); | |
if (fromTransactions.data.length > 0) return true; | |
const toTransactions = await client.queryTransactionBlocks({ | |
filter: { ToAddress: normalized }, | |
limit: 1, | |
}); | |
if (toTransactions.data.length > 0) return true; | |
const transactions = await client.queryTransactionBlocks({ | |
filter: { FromOrToAddress: { addr: normalized } }, | |
limit: 1, | |
}); | |
if (toTransactions.data.length > 0) return true; |
?
…ame-connected-to-object
No description provided.