add /assetid(to|from)hexbytes APIs#62
Conversation
Add /encodeassetid and /decodeassetid APIs
zoedberg
left a comment
There was a problem hiding this comment.
Thank you for your contribution! I've requested some changes, mainly stylistic. In addition please rebase the commits on the latest master, sign the commits with gpg, remove the merge commit and rename the last commit to add test for assetid(to|from)hexbytes APIs. Finally please remember to format and lint the code after making changes.
|
@zoedberg all fixed |
There was a problem hiding this comment.
Thank you for addressing the requested changes!
Please see 2 small suggestions, other than that LGTM.
Please also squash the commits into a single one, signed with gpg and with add /assetid(to|from)hexbytes APIs as message. If you prefer keeping the commit adding the tests separated, then call the second commit add test for assetid(to|from)hexbytes APIs. Then rebase the commit (or the 2 commits) on the latest master commit (d13a4ec).
Finally, please before requesting the next review make sure the code is still linted and formatted (using rust 1.88.0).
| #[error("Invalid asset ID: {0}")] | ||
| InvalidAssetID(String), | ||
|
|
||
| #[error("Invalid hex bytes")] |
There was a problem hiding this comment.
| #[error("Invalid hex bytes")] | |
| #[error("Invalid asset ID hex bytes")] |
| #[derive(Deserialize, Serialize)] | ||
| pub(crate) struct AssetIdToHexBytesRequest { | ||
| pub(crate) asset_id: String, | ||
| } | ||
|
|
||
| #[derive(Deserialize, Serialize)] | ||
| pub(crate) struct AssetIdToHexBytesResponse { | ||
| pub(crate) hex_bytes: String, | ||
| } | ||
|
|
||
| #[derive(Deserialize, Serialize)] | ||
| pub(crate) struct AssetIdFromHexBytesRequest { | ||
| pub(crate) hex_bytes: String, | ||
| } | ||
|
|
||
| #[derive(Deserialize, Serialize)] | ||
| pub(crate) struct AssetIdFromHexBytesResponse { | ||
| pub(crate) asset_id: String, | ||
| } | ||
|
|
There was a problem hiding this comment.
please sort these alphabetically
encode and decode assetId format between hex and string by baid64
test : encode_decode_asset_id.rs