-
Notifications
You must be signed in to change notification settings - Fork 2
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
Open Question: How to Generalize #53
Comments
Love this idea and think worker kv's would be perfect for this! Separating the data layer would give birth to a lot more tools and use cases if cc data felt quicker to retrieve and more accessible. |
Apart of what DataGovs and the Govs API is doing is building this data layer for City of Miami is this. The layer would tie to multiple sources like CC that support city infrastructure. |
@diopitis thanks for the support, I also wonder if there's an overlap between this idea and clarigen, since the contract ABIs are exposed there's technically a way to generate the code needed. Turning this into a 1-click package sounds like a great wishlist grant actually. The powerful part of it is how others can then integrate with your app using the same data, whether that be another user interface, a dashboard, a reporting service, a companion service, custom scripts, etc. Plus, with a generated openapi spec the docs setup is basically pointing a script at the openapi file. Can be hosted through workers with a little HTML and route magic but KV works for static sites too. The API only covers read-only functions though. Another missing piece would be a library for public functions that someone could install, and making that into a maintained NPM package for the project would also elevate DX. Imagine this: you want to integrate a project and you can
@will-at-stacks flagging you in case this sounds interesting ^ |
@HiGregory The idea presented here is more of an abstract design philosophy on how to create a Stacks app where you provide a simple API that exposes contract values to allow for easier integrations, in a consistent and possibly generative matter, without the need for external dependencies like That said, I'm definitely interested in learning more about how we can integrate - I left comments in #48 on how we can get to next steps! |
This may not be something specifically in scope for the CityCoins API, but thinking about the amount of routing we do to satisfy all the contract paths and parameters, there is a common pattern that could be generalized.
The original thought behind the CityCoins API was to make an endpoint for every contract function, and I still think specific APIs that follow this pattern could be very useful to both user interfaces and external integrations.
However, this may be useful for other projects that want to the use an API structure like this one, and I felt like the idea was worth documenting as "something to think about" when the V2 upgrades come downstream.
What if there were a simple route that accepted the following path and query parameters?
https://api.citycoins.co/query/deployer/contract_name/function_name?param1=value1¶m2=value2
Which breaks down as:
https://api.citycoins.co/query/
deployer
- deployer address of contractcontract_name
- contract namefunction_name
- function name in contractparam1
- function parameters, if anyparam2
- function parameters, if anyAn example using
is-block-winner
:https://api.citycoins.co/v2/SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27/miamicoin-core-v1/?blockheight=25000&address=SP466FNC0P7JWTNM2R9T199QRZN1MYEDTAR0KP27
This would essentially be a "query builder" in which you could put any contract, function, and related parameters then receive a result.
Pros:
Cons:
Curious what others think!
Spit-balling a few more reasons I think this could be useful:
The text was updated successfully, but these errors were encountered: