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: create @stacks/rpc-client package #1737

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

zone117x
Copy link
Member

@zone117x zone117x commented Aug 15, 2024

The RPC schema is being removed from the stacks-blockchain-api codebase. This means the @stacks/blockchain-api-client library will no longer include auto-generated code for those endpoints. See more details over at that repo: PR, client migration notes.

This PR creates a new library @stacks/rpc-client which generates a client library using the canonical RPC schema at
https://github.com/stacks-network/stacks-core/blob/master/docs/rpc/openapi.yaml

The library http request types are generated using openapi-typescript, and depends on openapi-fetch.

Some glue code is included to easily use the existing StacksNetwork objects and middleware, and also to export some common types.

@zone117x zone117x requested a review from janniks August 15, 2024 12:40
Copy link

vercel bot commented Aug 15, 2024

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

Name Status Preview Comments Updated (UTC)
stacksjs-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2024 0:40am

Comment on lines -111 to -113
const headers = new Headers(context.init.headers);
const headers =
context.init.headers instanceof Headers
? context.init.headers
: (context.init.headers = new Headers(context.init.headers));
headers.set(httpHeader, apiKey);
context.init.headers = headers;
Copy link
Member Author

Choose a reason for hiding this comment

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

This fixes a bug where in some instances the headers property is a read-only getter and cannot be re-assigned.

@smcclellan
Copy link
Contributor

This is going into its own repo and will be closed when that's ready. /cc @janniks

@smcclellan smcclellan marked this pull request as draft October 16, 2024 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In Review
Development

Successfully merging this pull request may close these issues.

2 participants