Dfx call serialize principal

How do you provide a Principal to dfx for a call?

e.g.

dfx canister call rrkah-fqaaa-aaaaa-aaaaq-cai knownBucket '("qaa6y-5yaaa-aaaaa-aaafa-cai")'

for given Motoko function:

public shared func knownBucket(bucketId: Principal) : async (Bool) {

ends in a serialization error:

Error: Failed to create argument blob.
Caused by: Failed to create argument blob.
Invalid data: Unable to serialize Candid values: type mismatch: “qaa6y-5yaaa-aaaaa-aaafa-cai” cannot be of type principal

Absolutely makes sense and of course, I will modify my function to use a text argument but, curious to know if possible.

It looks like this (Source, see “Textual syntax”):

dfx canister call rrkah-fqaaa-aaaaa-aaaaq-cai knownBucket '(principal "qaa6y-5yaaa-aaaaa-aaafa-cai")'
1 Like

Thanks @Severin - awesome :call_me_hand: