Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update JSDOC type to support plug agent #1827

Merged
merged 8 commits into from
Oct 10, 2022
Merged
6 changes: 3 additions & 3 deletions src/dfx/assets/language_bindings/canister.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ export { idlFactory } from './{canister_name}.did.js';
export const canisterId = process.env.{canister_name_uppercase}_CANISTER_ID;

/**
*
*
* @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
* @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig}} [options]
* @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
* @return {import("@dfinity/agent").ActorSubclass<import("./{canister_name}.did.js")._SERVICE>}
*/
export const createActor = (canisterId, options) => {
const agent = new HttpAgent({ ...options?.agentOptions });
const agent = options.agent || new HttpAgent({ ...options?.agentOptions });

// Fetch root key for certificate validation during development
if(process.env.NODE_ENV !== "production") {
Expand Down