-
Notifications
You must be signed in to change notification settings - Fork 121
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is default-features = false
needed here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, probably not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tacked it on to #1026
Removes the substrate dependencies from
contract-transcode
.We copy the
AccountId32
type 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