eco-stake/restake-ui

UI Network RPC Override

Opened this issue · 12 comments

For some network such as Terra and SecretNetwork the RPC's are unreliable and are often offline in the UI
perhaps we could also have a entry in src/networks.json to override the public endpoints to our own more reliable endpoints?

I really need to make networks.local.json work in the UI. That's the solution for autostaking script, but not for the UI.

You can override rpcUrl and restUrl in networks.json in your fork - that should take in place of the default cosmos.directory endpoints. It might be a bit of a hassle with merging upstream but there should be less and less updates to networks.json as cosmos.directory provides more data.

Can you let me know if that works okay and I'll close this, haven't tested in a while.

Relevant code: https://github.com/eco-stake/restake/blob/master/src/utils/Network.mjs#L22-L23

Oh I see, thank you
I will give this a try an let you know

On a separate note, if you could provide a REST API for Terra to the chain registry it would save me a few support requests 😂 😇

https://github.com/cosmos/chain-registry/blob/master/terra/chain.json#L60-L65

Ok yeah - I will add a Terra REST API to the registry within the next few days

Thanks so much! Terra doesn't get tonnes of traffic on restake so hopefully won't cause any hassle ❤️

I was wandering if it would be possible for me to implement a CORS whitelist for the Terra LCD

would whitelisting restake.app be suffcient?

also perhaps I should put it in restake network.json rather than chain registry if we go down this route?

Ok I've submitted a pull request without a CORS whitelist for now

https://github.com/cosmos/chain-registry/pull/309/files

I will have to monitor this closely though as i've watched many times public services get abused by bots on the Terra Network

You heroes. Sorry I started writing a response to your previous message and got distracted; it would be difficult to CORS restrict it but please do monitor it and let me know if it gets abused. I will add some endpoints to support soon.

I'll leave this issue open as I need to implement UI override of all the networks.json attributes, but it's lower priority if we can get Terra functioning like this. Keep me in the loop :)

Right out the gate that didn't go well; so the plan now is to replace that endpoint with this: https://github.com/terra-money/mantlemint
Which is essentially same thing but more optimised for the task and much easier to scale out.
WIll aim to get that setup hopefully early next week.

Ah no, what happened? I had a look at Mantlemint recently, looks perfect! If it just speeds up the native APIs without changing the structure then it's a game changer. Lmk how you get on, I'll run it too 🤞🏻

It should be exactly the same except for:
Following endpoints are not implemented
GET /blocks/
GET /blocks/latest
GET /txs/{hash}
GET /txs
GET /validatorset
Which still need to be routed to the terrad node instead of mantlemint

The problem is not the support of REStake but of being a general LCD available to anyone.
So we think this is a good solution to the problem.