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

Explorer: Update Instructions for Connecting SuiExplorer to localnet #1357

Closed
apburnie opened this issue Apr 13, 2022 · 11 comments · Fixed by #1771
Closed

Explorer: Update Instructions for Connecting SuiExplorer to localnet #1357

apburnie opened this issue Apr 13, 2022 · 11 comments · Fixed by #1771
Assignees
Labels
devx dogfooding sui-explorer Type: Documentation Improvements or additions to documentation
Milestone

Comments

@apburnie
Copy link
Contributor

This follows up on an issue raised by @kyleqian regarding the instructions here: https://github.com/MystenLabs/sui/tree/main/explorer#data-source--rpc-url

@apburnie
Copy link
Contributor Author

@kyleqian provided the following error message:

image

@kyleqian --> To fix this issue, we will need details on how to replicate the above error message. We will then be able to trial several approaches to find a solution. In particular, we will need details on:

  • What is the SuiExplorer URL that raises the described error?
  • Which API are you trying to connect to?
  • What JSON data does the API deliver when given a correct query?

The error data.objects.map is not a function suggests there is something unexpected regarding the structure of the JSON data being returned by the API.

@apburnie apburnie assigned kyleqian and unassigned kyleqian Apr 13, 2022
@kyleqian
Copy link
Contributor

kyleqian commented Apr 13, 2022

Repro:

  1. Start local Sui via sui genesis and sui start
  2. Start local rest server via ACCESS_CONTROL_ALLOW_ORIGIN=* rest_server
  3. Start local explorer
  4. Visit http://localhost:3000/?rpc=http%3A%2F%2F127.0.0.1%3A5001%2Fapi
  5. Search any object id (I used one of my address's gas objects), using both /api/object_info and /api/objects according to network activity
  6. I believe for that specific error, I was expecting an empty array, because it lists owned objects of that object, which were were none.

Deviation from instructions:

  1. Appended api to the end of the RPC address
  2. Used port 5001 instead of 5000
  3. The site didn't seem to "remember" my RPC setting between refreshes, so I had to make sure the the RPC address in the url params was there every time I searched

@apburnie
Copy link
Contributor Author

@kyleqian --> The problem is that there is a mismatch between the deployed endpoints for the https://demo-rpc.sui.io API and the local endpoints when rest_server is run. The SuiExplorer Website was created based on the API endpoints for https://demo-rpc.sui.io/.

Take for example how the objects on an address are found.

For demo-rpc.sui.io, the following endpoint works: https://demo-rpc.sui.io/objects?address=09818aac3edf9cf9b006b70c36e7241768b26386.

For rest_server, the successful endpoint is instead http://127.0.0.1:5001/api/objects?address=8EB212D032C99CDCA910E42E63985A7257C45828.

The solution is to restore consistency between what is delivered locally by ./sui/src/rest_server.rs, deployed across the Internet by https://demo-rpc.sui.io and expected by SuiExplorer at explorer/client/src/utils/api/SuiRpcClient.ts.

@stella3d --> We will require one of the Backend API Engineers to take a look at this. It looks like one possible solution could be to remove the added api strings from file ./sui/src/rest_server.rs. For example switching "/api/objects" for "/objects" in line 174 and "/api/object_info" for "/object_info" in line 258. This would avoid the need for downtime for the deployed website.

@apburnie
Copy link
Contributor Author

@kyleqian --> Once the 3 files are again consistent, the README can then be updated to reflect any changes.

@todd-mystenlabs todd-mystenlabs added this to the DevNet milestone Apr 18, 2022
@todd-mystenlabs
Copy link
Contributor

This feels like a DevNet fix.

@todd-mystenlabs
Copy link
Contributor

@stella3d / @Andrew47 - do we have a GitHub issue filed for the backend side of this?

@todd-mystenlabs todd-mystenlabs changed the title [explorer] Update Instructions for Connecting SuiExplorer to localnet Explorer: Update Instructions for Connecting SuiExplorer to localnet Apr 19, 2022
@666lcz 666lcz assigned stella3d and unassigned apburnie and Clay-Mysten Apr 20, 2022
@666lcz
Copy link
Contributor

666lcz commented Apr 20, 2022

@stella3d assigning this to you per Andrew's comment above. Let me know if you are not the right owner

@Clay-Mysten
Copy link
Contributor

I'm just noting Chris has excellent progress in:
http://go/cli-devnet

See related work in:
#1651

@Clay-Mysten
Copy link
Contributor

Hi team,

I'm working on:
https://github.com/MystenLabs/Prose/issues/23

And noting the call to link to Explorer URLs and docs. For reference, from:
https://docs.sui.io/explore#sui-explorer

We link to:
https://github.com/MystenLabs/sui/tree/explorer-rest/explorer
https://github.com/MystenLabs/sui/tree/explorer-rest/explorer/client

It looks like we should instead link into:
https://github.com/MystenLabs/sui/tree/main/explorer
https://github.com/MystenLabs/sui/tree/main/explorer/client

If so, I can take care of that. Please confirm. Yet I can see many references still to REST in the first README. Will those change? We are replacing them everywhere else, as in:
#1672

Further, Sam is linking to these URLs from a forthcoming announcement:
http://gateway.devnet.sui.io/
http://explorer.devnet.sui.io/

And I want to make sure they will be live as I will also link to them from the page coming in:
#1723

Please advise. Thanks!

@Clay-Mysten
Copy link
Contributor

Adding Bauer since she offered to help generate content and can perhaps guide the work needed here.

@Clay-Mysten Clay-Mysten added the Type: Documentation Improvements or additions to documentation label May 3, 2022
@666lcz
Copy link
Contributor

666lcz commented May 4, 2022

#1771 closes this issue.

It looks like we should instead link into:
https://github.com/MystenLabs/sui/tree/main/explorer
https://github.com/MystenLabs/sui/tree/main/explorer/client

@Clay-Mysten , I removed the client doc and you can change the following paragraph in https://docs.sui.io/explore#sui-explorer

Navigate the Sui Explorer and Sui Explorer Client to see the latest blocks, transactions, and cluster statistics.

to

Navigate the Sui Explorer to see the latest transactions and objects.

where it now points to https://github.com/MystenLabs/sui/tree/main/explorer/client#readme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devx dogfooding sui-explorer Type: Documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants