Repository navigation
docs(how-to-guide): a beginner page for amounts, units and addresses - #421
Open
IanoNjuguna wants to merge 2 commits into
Open
IanoNjuguna wants to merge 2 commits into
IanoNjuguna wants to merge 2 commits into
Conversation
The three representations every API expects, each with a block a reader can edit: ADA to lovelace, an asset name to its unit, and an address to its network and credential kind. The limits are on the page rather than implied: the address check reads the prefix and the header byte and does not verify the checksum, and protocol parameters are pointed at their real source instead of being hardcoded.
7 of 10 tasks
The two are neighbours and neither pointed at the other: Addresses explains why a payment and a stake credential are separate, Numbers and Identifiers shows how to read the prefix and header byte that carry them.
This branch has not been deployed
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.
Description
A new page under How To Guide → Beginner, next to "Inputs and Outputs" and "Addresses", with three runnable examples. It covers the representations every API expects and no page currently explains: an amount, a token unit, and the address prefix that names its network.
Position 3 in that folder, three
jsx liveblocks, plus the two sentences that link it to the Addresses page and back. Neither page pointed at the other before, which is a gap worth closing in the same change: the Addresses page explains why a payment and a stake credential are separate, this one shows how to read the prefix and header byte that carry them.Closes #419, which asked for both this page and the theme it depends on. Stacked on #420, which brings the theme these blocks need.
Type of Change
Testing
Checklist
What the page says
lovelacefor ADA, otherwise the 56-hex-character policy ID followed by the asset name in hex, with no separator. The block builds a unit from a policy ID and a name, validates the policy ID length, and shows that an empty name is legal.Verification
Built and served locally, then driven through CDP with real addresses rather than eyeballed:
All three blocks render and react, no reload, no horizontal overflow, and
npm run buildpasses withonBrokenLinks: throw. The two new cross-links are checked in the built output: the Addresses page links to/docs/how-to-guide/beginner/numbers-and-identifiers/and back to/docs/how-to-guide/beginner/address/.One bug found and fixed during that pass: the separator lookup was
lastIndexOf('1'), which a typo in the data part can defeat. Bech32's data alphabet has no1in it, soindexOf('1')is the correct read, and the page now uses that.Notes
systemStartandslotLengthfrom the network's genesis file, and a plausible-looking constant on a testnet page would be worse than no widget./epochs/latest/parametersand the genesis file rather than quoting numbers that governance can change.