Encode Principal to Candid arguments

I am writing a script in JavaScript (sorry should have had mentioned that earlier) and the backend is in Motoko.

Found something in the playground and candid, so trying the following:

import { IDL } from "@dfinity/candid";

const arg = IDL.encode([IDL.Principal], owner);

but I get an error

Cannot mix BigInt and other types, use explicit conversions

owner is a principal


// {"_arr":{"0":154,"1":1 .... "28":2},"_isPrincipal":true}
1 Like