Custom AccountId32 impl, remove substrate deps#1010
Conversation
| /// This has been copied from `subxt::utils::AccountId32`, with some modifications: | ||
| /// | ||
| /// - Custom [`scale_info::TypeInfo`] implementation to match original substrate type. | ||
| /// - Made `to_ss58check` public. | ||
| /// - Implemented `TryFrom<&'a [u8]>`. |
There was a problem hiding this comment.
I considered just importing subxt as a dependency and using this type directly, however the above modifications were required.
The other way was to implement a wrapper type, but I decided to copy the code across wholesale and make the modifications. This has the advantage of not pulling in the whole of subxt just for this type.
|
Clippy CI failure fixed in #1011 |
|
Thanks @ascjones , this should solve our problems. Nitpick: Maybe include a short explanation as of why we're doing this. |
SkymanOne
left a comment
There was a problem hiding this comment.
I assume the maths for account derivation is correct :)
Indeed, all copied from |
Actually there is already a test at the bottom of the file that checks those using the account keyring. |
|
|
| [dev-dependencies] | ||
| assert_matches = "1.5.0" | ||
| ink = "4.0.1" | ||
| sp-core = { version = "18.0.0", default-features = false } |
There was a problem hiding this comment.
Is default-features = false needed here?
There was a problem hiding this comment.
No, probably not.
Removes the substrate dependencies from
contract-transcode.We copy the
AccountId32type fromsubxt: https://github.com/paritytech/subxt/blob/ce0a82e3227efb0eae131f025da5f839d9623e15/subxt/src/utils/account_id.rs, with a few modifications so that it can work in place ofsp_core::crypto::AccountId32