Encode Principal to Candid arguments

Shit, I think it may have worked out!!!

My manager access point

public shared({ caller }) func installCode(canisterId: Principal, owner: Blob, wasmModule: Blob): async() {
        await canisterUtils.installCode(canisterId, owner, wasmModule);
    };

My utils

public func installCode(canisterId: Principal, owner: Blob, wasmModule: Blob): async() {
            await ic.install_code({
                arg = owner;
                wasm_module = wasmModule;
                mode = #upgrade;
                canister_id = canisterId;
            });
        };

The js call

const arg = IDL.encode([IDL.Principal], [owner]);
await actor.installCode(bucketId, [...arg], [...new Uint8Array(buffer)]);
3 Likes