I need to know the Principal of my canister from a function within it. In a local replica, if it makes a difference (I assume it should work the same locally and in mainnet?).
I’m defining it as
actor class SomeName(_network : Types.Network) = this {
then inside a function within it:
public shared (message) func create_user() : async User {
I’m calling Principal.fromActor(this);
but I get an anonymous principal I guess:
1. Principal
1. _arr: Uint8Array(10) [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, buffer: ArrayBuffer(10), byteLength: 10, byteOffset: 0, length: 10, Symbol(Symbol.toStringTag): 'Uint8Array']
2. _isPrincipal: true
How do I make it return the host canister’s Principal?
Why am I getting [0, 0, 0, 0, 0, 0, 0, 1, 1, 1] as principal?