dfinity / cdk-rs

Rust canister development kit for the Internet Computer.
Apache License 2.0
201 stars 90 forks source link

feat(ic-ledger-types): Add AccountIdentifier.as_bytes() #520

Closed bitdivine closed 2 months ago

bitdivine commented 2 months ago

Description

It is currently not possible to obtain an AccountIdentifier as bytes. It is only possible to obtain hex and then convert the hex back to bytes. This is resolved by adding an .as_bytes() method that returns a reference to the inner bytes.

Fixes #519

How Has This Been Tested?

A unit test is included that verifies that parsing bytes and returning them as bytes yields the original data.

Checklist: