Utilize an Opaque type to key on currencies in the Ledger #3231
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.
By utilizing an opaque type, we can eliminate the details of
stringifying the Currency objects from the ledger. This allows for some
cleaner scope of concern.
The opaque type prevents the decoding of keys, which
should not be necessary, Generating a key should be a one-way operation,
in case we ever move to generating hashes instead of just stringified
objects, or some other operation to that changes the characteristics of
keys.
Additionally, json-stable-stringify is utilized over JSON.stringify
because it produces the same string across all platforms. Some
JSON.stringify implementations differ and therefore it is potentially
unstable.
test plan: unit tests have been updated
Merge plan: this is a prereq to #3156