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

feat: upgrade api layer #1910

Merged
merged 1 commit into from
Dec 2, 2024
Merged

feat: upgrade api layer #1910

merged 1 commit into from
Dec 2, 2024

Conversation

He1DAr
Copy link
Collaborator

@He1DAr He1DAr commented Nov 15, 2024

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

@stacks/blockchain-api-client no longer exports API call wrappers, we need to upgrade to latest stacks API JS client replace all API calls across Explorer.
https://github.com/hirosystems/stacks-blockchain-api/blob/HEAD/client/MIGRATION.md

Issue ticket number and link

closes #1896

Checklist:

  • I have performed a self-review of my code.
  • I have tested the change on desktop and mobile.
  • I have added thorough tests where applicable.
  • I've added analytics and error logging where applicable.

Screenshots (if appropriate):

N/A

Copy link

vercel bot commented Nov 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
explorer-storybook ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 3:20pm
hiro-explorer ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 27, 2024 3:20pm

@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 25e066e to 7be35ba Compare November 15, 2024 14:48
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 7be35ba to 6025c52 Compare November 18, 2024 14:24
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 6025c52 to 8d9e372 Compare November 18, 2024 14:30
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 8d9e372 to 8f5a43f Compare November 18, 2024 14:45
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 8f5a43f to 9d76acd Compare November 18, 2024 14:59
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 9d76acd to d307216 Compare November 18, 2024 16:13
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from d307216 to 7ae81b7 Compare November 18, 2024 16:23
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 7ae81b7 to 7e16fa5 Compare November 18, 2024 19:04
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 0a8446c to c2659ae Compare November 26, 2024 17:15
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from c2659ae to 6323121 Compare November 26, 2024 17:29
@He1DAr He1DAr force-pushed the feat/upgrade-api-layer branch from 6323121 to 1e9d13b Compare November 26, 2024 19:19
apiUrl: Endpoint,
apiParams?: ApiParams<Endpoint>
): Promise<OperationResponse[Endpoint]> {
const { error, data } = await apiClient.GET(apiUrl, apiParams as any);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function acts as a wrapper around the API client, it enforce type safety for the endpoint, parameters, and response, as well as providing centralized error handling. I had to use any when passing apiParams because the types provided by client library are not fully generic and rely on rigid definitions that cannot be dynamically inferred. Open to suggestions here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this works. We'll do with the missing types for now, unless it hinders us in some signifcant way. Would be interesting to see if we could have done this with middleware, but I think that is a separate investigation. Thanks for making these changes!

@He1DAr He1DAr requested a review from BLuEScioN November 26, 2024 19:37
Copy link
Collaborator

@BLuEScioN BLuEScioN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small thing about removing useBlockByHeight hook or w/e it was. Other than that LGTM

@blockstack-devops
Copy link

🎉 This PR is included in version 1.231.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Upgrade @stacks/blockchain-api-client
3 participants