MCPcopy Create free account
hub / github.com/dfinity/cancan / getCanister

Function getCanister

scripts/setup.ts:33–46  ·  view source on GitHub ↗
(canisterName: string, host = DEFAULT_HOST)

Source from the content-addressed store, hash-verified

31};
32// Exports
33const getCanister = (canisterName: string, host = DEFAULT_HOST) => {
34 const candid = eval(getCandid(canisterName));
35 const canisterId = getCanisterId(canisterName);
36 const config = { fetch, host };
37 if (credentials.name && credentials.password) {
38 // @ts-ignore
39 config.credentials = credentials;
40 }
41 const agent = new HttpAgent(config);
42 agent.addTransform(makeNonceTransform());
43 agent.addTransform(makeExpiryTransform(5 * 60 * 1000));
44
45 return makeActorFactory(candid)({ canisterId, agent });
46};
47
48// Helpers
49

Callers 1

setup.tsFile · 0.85

Calls 2

getCandidFunction · 0.85
getCanisterIdFunction · 0.70

Tested by

no test coverage detected