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

Support multiple domain types #271

Open
mcintyre94 opened this issue Jul 13, 2023 · 1 comment
Open

Support multiple domain types #271

mcintyre94 opened this issue Jul 13, 2023 · 1 comment
Assignees

Comments

@mcintyre94
Copy link
Collaborator

Currently we only support Bonfida .sol domains, using the Bonfida SDK directly

I suggest that we use the solana-wallet-names SDK from Portal Payments instead, which supports multiple domain types

This will give us support for many domain providers at once

As this SDK includes ANS addresses, this will also handle #205 (without favouring any provider) and supersede #236 with less code to maintain in Explorer.

@mcintyre94 mcintyre94 self-assigned this Jul 13, 2023
mcintyre94 added a commit that referenced this issue Jul 18, 2023
This PR refactors the search bar to remove the client-side legacy web3js
dependency. This means that the core app layout, shared by every page,
no longer pulls in legacy web3js

- The client-side call to `getDomainInfo` is replaced with a GET request
to a new API `/api/domain-info/[domain]`
- This API just calls `getDomainInfo` and returns the response as JSON.
This function and everything else in `utils/name-service` that can be
run on the server are extracted to a new `utils/domain-info`. This is
necessary because `utils/domain-info` has `use client` (needed for its
client-side hooks)
- The API has a 24h cache-response header. I haven't done any manual
client-side caching, Next's fetch de-dupe should be sufficient.
- For now I haven't changed how we get the domain info. Longer term I'd
like to support multiple domains:
#271
- I've extracted everything used by the search bar from `utils/tx` to a
new `utils/programs`. I've removed the legacy web3js dependency, which
was just used to pull in program public keys

The result of this is that some pages load ~100kb less JS. I'm not
exactly sure how some of these numbers work though, eg the homepage is
already not including web3js despite including the search bar.

<img width="1366" alt="Screenshot 2023-07-18 at 15 23 19"
src="https://github.com/solana-labs/explorer/assets/1711350/a1cc43d8-1f76-44ca-a558-1f9f8a8d2f3d">

We can also inspect the bundle before and after this change, this is the
app/layout endpoint. On master we have the legacy web3js
<img width="2387" alt="Screenshot 2023-07-18 at 15 01 10"
src="https://github.com/solana-labs/explorer/assets/1711350/fd0d4a6e-4e47-400a-b45f-fed2719415ef">

After we've stripped many of these dependencies out:
<img width="2388" alt="Screenshot 2023-07-18 at 15 02 33"
src="https://github.com/solana-labs/explorer/assets/1711350/04294a1c-03d7-4b67-8fcd-549cbc5a6215">

Mostly it shows that we should stop including that token list though...
#201
@mikemaccana
Copy link

mikemaccana commented Jan 19, 2024

Author of solana-wallet-names here (I now work at Foundation). Definitely agree that supporting all name services rather than favoring Bonfida is good.

  • It would be reasonable to add a layer of caching, maybe 1 hour, so we don't bother upstream wallet name services.
  • If we decide to support multiple name services, we should let the various wallet services know we are intend on supporting their name services on the next wallet call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants