How does msg.caller convert to ICP address?

Principal.toText is split with ‘-’.

How to convert to an ICP address like: 9185cae14fbe484e138534a4c6b9df2fb304fc5d13a2ec7b51e5643b6524c9bc?

1 Like

An account address is an encoding of (<user principal>, <subaccount>). If you know the subaccont (most often none) you can derive the address. You can e.g. use ic-ledger-types for it

Is there a motoko example

You can copy this file into your project

It seems that there is no function here that can convert to this text format.

It seems that there is no function here that can convert to this text format.

4 Likes

Thank you so much!
Thank you so much!