Reconfigure /staking/ADDRESS to accept stash and give controller, rewardDestination#94
Merged
Reconfigure /staking/ADDRESS to accept stash and give controller, rewardDestination#94
/staking/ADDRESS to accept stash and give controller, rewardDestination#94Conversation
* Unwrap if isSome or return if isNone * Remove unnecesary import * Delete debugger
…sidecar into zeke-staking-take-stash
danforbes
reviewed
Jun 16, 2020
save progress Add errors and setup statusCode handling in `get` Switch errors to throw change routes to `accounts/:address/staking/:number` Remove toJSON on stakingLedge; Add backslash to front of path
63b45cc to
0c86bb2
Compare
danforbes
reviewed
Jun 17, 2020
danforbes
reviewed
Jun 17, 2020
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
danforbes
approved these changes
Jun 17, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
payout/:addressand move that info to '/staking' in order to create a single endpoint for an accounts staking info.getEndpoint change from
staking/:address/:numbertoaccounts/:address/staking/:numberdiscussiontl;dr - we should think about changing the path to
accounts/:address/staking/:numberbecause it more accurately models our resource taxonomy.As we approach V1 and dialing in the api, the importance of communicating meaning through our endpoint increases and thus it behooves us to carefully consider how they model resources.
After offline discussion with @danforbes, consensus has begun to coalesce around modeling the resource
accounts, representing the (collection of)AccountIds of the chain. Underaccountswe would then have single resource, anaccount, identified by itsAccountId, (commonly referred to in sidecar and its reference material as ADDRESS oraddress).Following this we can identify the following resources and relationships to an
account:balancebelongs to anaccount; anaccounthas onebalance.staking{information}belongs to anaccount; anaccounthas onestaking{information}.vesting{information}belongs to anaccount; anaccounthas onevesting{information}.Using this model we can then define paths that semantically correspond:
accounts/:address/balanceaccounts/:address/stakingaccounts/:address/vestingIf critical consensus can be reached on the aforementioned paths, it still leaves the question of where an optional
number(block hash or height) parameter would semantically fit with our model. Some say REST principles lean towards using a query param becausenumberis not necessarily a resource ID, but instead a search term. However, to another subset of people, simply puttingnumberat the end of the path still communicates model while staying terse. These two options fornumberwould look like:accounts/:address/staking?number=2643accounts/:address/staking/:numberTo move the discussion forward, I have gone ahead and changed the staking paths to
accounts/:address/staking/andaccounts/:address/staking/:numberWhat about the other two routes?
In order to keep the diff for this PR minimal I decided to only change this route for now. However, if this change is implemented the other routes should be changed prior to the v1 release.
Follow up PRs: