motoko-base icon indicating copy to clipboard operation
motoko-base copied to clipboard

Principal - new functions | toSubaccount | toICRC1Text

Open infu opened this issue 2 years ago • 0 comments

Since there is now Principal.toLedgerAccount the other most common functions are toSubaccount https://github.com/infu/minimal_swap/blob/215217d41d91635a4e4562887ffa37a1e12c339a/swap.mo#L44 https://github.com/dfinity/ic-js/tree/main/packages/ledger-icp#gear-fromprincipal Used by almost every tokenized canister

toICRC1Text https://github.com/NatLabs/icrc1/blob/0800c7ac03026a4c5a72eeb357cbbd0aca2f0fb4/src/ICRC1/Account.mo#L83 Will be useful for converting Account to Text Account when validating SNS generic functions and rendering their output. Useful for the new Identity WG ICRC standards as well (And possibly hardware wallets). https://github.com/dfinity/wg-identity-authentication/blob/main/topics/icrc_21_consent_msg.md

Considering their significance for security, it is essential that they are included in the Motoko Base library.

infu avatar Jan 28 '24 17:01 infu