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
Create API address derivation path type. #2174
Comments
I wonder if first three paths, ie., are not superfluous 1852H/1815H/0H. the first two for sure if we are dealing with ada. Last one depicting account maybe also... On the other hand, it is only presentation layer so maybe the full information does not hurt. Another thing : we want to use relative indexes (counting from 0) also for hardened index? |
Was there anything wrong with just using a string to represent derivation path? |
Hi @rvl. We could indeed have used a string, and you're right, it would not be very hard to parse. The use of a JSON list was requested here: https://input-output-rnd.slack.com/archives/GBT05825V/p1600859749018000?thread_ts=1600843830.004300&cid=GBT05825V |
Good point! I've updated the task description to specify that we will use relative indices, ranging from |
2177: Create API address derivation path type. r=jonathanknowles a=jonathanknowles # Issue Number #2174 # Overview This PR adds a new type `ApiAddressDerivationPath`. A value of this type serializes to a JSON **list**. For example, the path `1852H/1815H/0H/0/0` has the following JSON representation: ```json [ { "derivation_index": 1852, "derivation_type": "hardened" }, { "derivation_index": 1815, "derivation_type": "hardened" }, { "derivation_index": 0, "derivation_type": "hardened" }, { "derivation_index": 0, "derivation_type": "soft" }, { "derivation_index": 0, "derivation_type": "soft" } ] ``` Each entry in the list has the following pair of fields: | Field name | Type | Domain | | -- | -- | -- | | `derivation_index` | natural number | `[ 0 .. 2^31 − 1 ]` | | `derivation_type` | enumeration | `[ hardened \| soft ]` | # Details This PR also: - Adds JSON roundtrip tests for `ApiAddressDerivationPath`. - Adds a missing JSON roundtrip test for the `ApiAddress` type. - Fixes the upper bound of `addressIndex` to be `2^32 - 1` rather than `2^32`. - Adds a matching swagger definition for `ApiAddressDerivationPath`. Co-authored-by: Jonathan Knowles <jonathan.knowles@iohk.io>
In that slack thread, a JSON list of strings was requested, not a list of objects. I fail to see how a list of objects like this will help the user. |
lgtm |
Context
We need to be able to represent address derivation paths in the API.
Decision
Create type
ApiAddressDerivationPath
that can encode an address derivation path.A derivation path should be serialized to JSON as a list.
For example, the path
1852H/1815H/0H/0/0
should have the following JSON representation:Each entry in the list should have the following pair of fields:
derivation_index
[ 0 .. 2^31 − 1 ]
derivation_type
[ hardened | soft ]
Acceptance Criteria
ApiAddressDerivation
type.ApiAddressDerivation
type must be serializable to JSON and deserializable from JSON.ApiAddressDerivation
value should be a list.Development
QA
See #2177, which includes:
ApiRelativeAddressIndex
type.The text was updated successfully, but these errors were encountered: