@ic-reactor/react 1.3.2 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,3 +4,4 @@ export * from "./useAgentManager";
4
4
  export * from "./useAuth";
5
5
  export * from "./useAuthState";
6
6
  export * from "./useUserPrincipal";
7
+ export * from "./useCandidAdapter";
@@ -20,3 +20,4 @@ __exportStar(require("./useAgentManager"), exports);
20
20
  __exportStar(require("./useAuth"), exports);
21
21
  __exportStar(require("./useAuthState"), exports);
22
22
  __exportStar(require("./useUserPrincipal"), exports);
23
+ __exportStar(require("./useCandidAdapter"), exports);
@@ -6,16 +6,25 @@ export interface UseCandidAdapterParams {
6
6
  didjsCanisterId?: string;
7
7
  }
8
8
  /**
9
- * Accesses the `AgentManager` instance for managing agent configurations and state.
9
+ * Accesses the `CandidAdapter` to download the actor's Candid interface.
10
+ *
11
+ * @param config - `UseCandidAdapterParams` The configuration object.
12
+ * @returns The `CandidAdapter` instance.
10
13
  *
11
14
  * @example
12
- *```jsx
13
- * function AgentManagerComponent() {
14
- * const agentManager = useAgentManager();
15
+ * ```jsx
16
+ * function CandidAdapterComponent() {
17
+ * const candidAdapter = useCandidAdapter();
18
+ *
19
+ * const getActor = async () => {
20
+ * const { idlFactory } = await candidAdapter.getCandidDefinition(canisterId)
21
+ * console.log(idlFactory)
22
+ * }
15
23
  *
16
- * // Use agentManager for managing agent configurations, etc.
17
- * return <div>Agent Manager ready.</div>;
18
- * }
24
+ * return (
25
+ * <button onClick={getActor}>Get Actor</button>
26
+ * );
27
+ * }
19
28
  *```
20
29
  */
21
30
  export declare const useCandidAdapter: (config: UseCandidAdapterParams) => CandidAdapter | undefined;
@@ -5,16 +5,25 @@ const useAgentManager_1 = require("./useAgentManager");
5
5
  const react_1 = require("react");
6
6
  const core_1 = require("@ic-reactor/core");
7
7
  /**
8
- * Accesses the `AgentManager` instance for managing agent configurations and state.
8
+ * Accesses the `CandidAdapter` to download the actor's Candid interface.
9
+ *
10
+ * @param config - `UseCandidAdapterParams` The configuration object.
11
+ * @returns The `CandidAdapter` instance.
9
12
  *
10
13
  * @example
11
- *```jsx
12
- * function AgentManagerComponent() {
13
- * const agentManager = useAgentManager();
14
+ * ```jsx
15
+ * function CandidAdapterComponent() {
16
+ * const candidAdapter = useCandidAdapter();
17
+ *
18
+ * const getActor = async () => {
19
+ * const { idlFactory } = await candidAdapter.getCandidDefinition(canisterId)
20
+ * console.log(idlFactory)
21
+ * }
14
22
  *
15
- * // Use agentManager for managing agent configurations, etc.
16
- * return <div>Agent Manager ready.</div>;
17
- * }
23
+ * return (
24
+ * <button onClick={getActor}>Get Actor</button>
25
+ * );
26
+ * }
18
27
  *```
19
28
  */
20
29
  const useCandidAdapter = (config) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/react",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "A React library for interacting with Internet Computer canisters",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -47,5 +47,5 @@
47
47
  "react": ">=16.8",
48
48
  "zustand": "4.5"
49
49
  },
50
- "gitHead": "02ebf0dfbd01792ded00b91a69b4196aab018285"
50
+ "gitHead": "a471daafc519bd06902e773058748241c1f0331b"
51
51
  }