Skip to content
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

Convert near_sdk::PublicKey to workspaces::types::PublicKey #262

Closed
mooori opened this issue Jan 17, 2023 · 0 comments · Fixed by #267
Closed

Convert near_sdk::PublicKey to workspaces::types::PublicKey #262

mooori opened this issue Jan 17, 2023 · 0 comments · Fixed by #267

Comments

@mooori
Copy link

mooori commented Jan 17, 2023

Some tests need to compare PublicKeys from the two crates mentioned above (example).

It seems like there’s no straightforward way for the conversion since the only way to generate a workspaces::types::PublicKey from data is Deserialize. Which leads to this inefficient and awkward conversion.

Maybe there’s a more efficient and elegant conversion which I’ve been missing? If not, it would be great if such a conversion could be supported.

workspaces::types::PublicKey is just a wrapper around near-crypto::PublicKey. So for workspaces it might be possible to support the conversion via:

  • Get the bytes of a near_sdk::PublicKey (as_bytes()).
  • Convert the bytes to near_crypto::PublicKey (e.g. via this function) and then wrap it in workspaces::types::PublicKey.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant