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

New endoint /accounts/raw_address #154

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

New endoint /accounts/raw_address #154

wants to merge 12 commits into from

Conversation

tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented Jun 16, 2022

The most requested data by the front are balances, delegations and unbonding_delegations :

image

That represents the majority of the requests, because for each chain (for each chain bech32 address), a request is executed.

@Pitasi suggested this could be consolidated by changing the endpoints to they take a list of address instead of a single one.

Actually we can also go further by using the keplr raw address from (await keplr.getKey('comoshub')).address. From this address we can easily derive the bech32 chain addresses in the backend, and return everything within a single endpoint :

image

Note that (await keplr.getKey('comoshub')).address must be hex encoded before passing it the URL.

This should significantly reduce the number of requests, without performance issue since the new endpoint fetches the data concurrently.

Note: This PR has a lot of changes because I also refactored the related endpoints with the usecase pattern, with tons of tests.

@tbruyelle tbruyelle requested a review from a team as a code owner June 16, 2022 10:13
@tbruyelle tbruyelle requested review from akc2267, CommoDor64 and lukitsbrian and removed request for a team June 16, 2022 10:13
@github-actions github-actions bot added the patch label Jun 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant