-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
Add v0 REST APIs for circulating and total supply #10102
Conversation
0ffd43b
to
4c141c9
Compare
@@ -239,6 +253,26 @@ impl RequestMiddleware for RpcRequestMiddleware { | |||
} | |||
} | |||
|
|||
fn process_rest(bank_forks: &Arc<RwLock<BankForks>>, path: &str) -> Option<String> { | |||
match path { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I initially plumbed this to JsonRpcRequestProcessor::get_supply()
to avoid the duplication, but that caused a circular reference. The duplication is pretty minimal and simple so not too worried.
(adding blocked flag because although I'd like to get this PR ready to go, I'm waiting for final confirmation that it'll solve the problem of those who are unable to HTTP POST) |
Codecov Report
@@ Coverage Diff @@
## master #10102 +/- ##
=======================================
Coverage 81.5% 81.6%
=======================================
Files 280 280
Lines 65705 65757 +52
=======================================
+ Hits 53607 53666 +59
+ Misses 12098 12091 -7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm, although if we add much more to RequestMiddleware, we might want to reorganize to make the various functionalities more clear.
Pull request has been modified.
💯. I'm hoping this won't set a precedent, but if so then yeah rpc totally needs a larger refactor |
I just received confirmation that this solution works, |
(cherry picked from commit 324cfd4) # Conflicts: # core/src/non_circulating_supply.rs # core/src/rpc.rs # core/src/rpc_service.rs
(cherry picked from commit 324cfd4) # Conflicts: # core/src/non_circulating_supply.rs # core/src/rpc_service.rs
(cherry picked from commit 324cfd4)
(cherry picked from commit 324cfd4)
Some users would like a simple HTTP GET method to fetch the circulating and total supply, and sending an HTTP POST is apparently too much.
The RestApi translation feature of the jsonrpc_http_server looks tempting but is insufficient as it also only responds to HTTP POST requests.
In lieu of stepping into the longer term API rework (cc: ##7866), I went for creating one-off REST APIs at:
These APIs are:
/v0/...