Skip to content
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

Add addressFormat support on various search by account #1065

Closed
marc-aurele-besner opened this issue Jan 17, 2025 · 4 comments · Fixed by #1107
Closed

Add addressFormat support on various search by account #1065

marc-aurele-besner opened this issue Jan 17, 2025 · 4 comments · Fixed by #1107
Assignees
Labels
enhancement New feature or request ui/ux UI/UX

Comments

@marc-aurele-besner
Copy link
Member

Add addressFormat support on various search by account

@varunguleriaCodes
Copy link
Contributor

Hi @marc-aurele-besner I will like to work on this can you provide some more details regarding this, thanks

@marc-aurele-besner
Copy link
Member Author

Hi @marc-aurele-besner I will like to work on this can you provide some more details regarding this, thanks

Hi @varunguleriaCodes

This was an improvement that was suggested/reported in the general-chat of our Discord. To give more context, on previous testnet version, we used addresses starting with "st" and some farmer may have keep their farmer pointing to st addresses. This is not an issue since st address resolve to a su addresses and if searching for a st address in the home search bar or directly in the account's url pathname. It will resolve to the right su address details page.

The only place where I see this conversion is not supported, is in the advance table search and filtering options.

Image
the logic for the search is handle here

// Add search conditions
availableColumns
.filter((column) => column.searchable)
.forEach((column) => {
const searchKey = `search-${column.name}` as keyof AccountsFilters
const searchValue = filters[searchKey]
if (searchValue) {
conditions[column.name] = { _ilike: `%${searchValue}%` }
}
})

The function that convert an address to the su format is in utils/formatAddress

The main issue I see, however, is that currently the search logic also handle partial address because of the ilike, if we move format the address before doing the search, it will result in error on partial address...

(To be honest when I first created this issue, it was just for tracking purposes, I had not investigated it, I thought the issue was on the search bar on the home screen, but I now see that the home screen search bar does handle st address)

Here is a st address that can be used for testing st9cFR8qXpGacLS6Xx2QJzdxy4oY7EnXpn98UkQLRs4ZxQWNA

@varunguleriaCodes
Copy link
Contributor

Hi @marc-aurele-besner I think of implementing something like this:

  1. If address is partial we skip the conversion and search for what data we have

  2. If address is complete we convert it through formatAddress and search for it

What do you think about this?

@marc-aurele-besner
Copy link
Member Author

Hi @marc-aurele-besner I think of implementing something like this:

  1. If address is partial we skip the conversion and search for what data we have
  2. If address is complete we convert it through formatAddress and search for it

What do you think about this?

That make sense 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ui/ux UI/UX
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants