@ic-reactor/core 1.0.2 → 1.0.4

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.
@@ -1,7 +1,6 @@
1
- import type { HttpAgent } from "@dfinity/agent";
2
- import type { CanisterId, ActorMethodArgs, ActorMethodReturnType, ActorStore, ActorManagerOptions, FunctionName, VisitService, BaseActor, ActorMethodState } from "./types";
1
+ import type { CanisterId, ActorMethodParameters, ActorMethodReturnType, ActorStore, ActorManagerParameters, FunctionName, VisitService, BaseActor, ActorMethodState } from "./types";
3
2
  import type { AgentManager } from "../agent";
4
- import type { UpdateAgentOptions } from "../types";
3
+ import type { UpdateAgentParameters } from "../../types";
5
4
  export declare class ActorManager<A = BaseActor> {
6
5
  private _actor;
7
6
  private _idlFactory;
@@ -10,20 +9,18 @@ export declare class ActorManager<A = BaseActor> {
10
9
  actorStore: ActorStore<A>;
11
10
  visitFunction: VisitService<A>;
12
11
  private initialState;
13
- unsubscribeActor: () => void;
14
12
  private updateState;
15
13
  updateMethodState: (method: FunctionName<A>, hash: string, newState: Partial<{
16
14
  data: ActorMethodReturnType<A[FunctionName<A>]> | undefined;
17
15
  loading: boolean;
18
16
  error: Error | undefined;
19
17
  }>) => void;
20
- constructor(actorConfig: ActorManagerOptions);
21
- initialize: (options?: UpdateAgentOptions) => Promise<void>;
18
+ constructor(actorConfig: ActorManagerParameters);
19
+ initialize: (options?: UpdateAgentParameters) => Promise<void>;
22
20
  extractService(): VisitService<A>;
23
21
  private initializeActor;
24
- callMethod: <M extends FunctionName<A>>(functionName: M, ...args: ActorMethodArgs<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
22
+ callMethod: <M extends FunctionName<A>>(functionName: M, ...args: ActorMethodParameters<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
25
23
  get agentManager(): AgentManager;
26
- getAgent: () => HttpAgent;
27
24
  getActor: () => A | null;
28
25
  getState: ActorStore<A>["getState"];
29
26
  subscribeActorState: ActorStore<A>["subscribe"];
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ActorManager = void 0;
13
13
  /* eslint-disable no-console */
14
14
  const agent_1 = require("@dfinity/agent");
15
- const helper_1 = require("../tools/helper");
15
+ const helper_1 = require("../../tools/helper");
16
16
  const candid_1 = require("@dfinity/candid");
17
17
  class ActorManager {
18
18
  constructor(actorConfig) {
@@ -29,11 +29,7 @@ class ActorManager {
29
29
  this.updateMethodState = (method, hash, newState) => {
30
30
  this.actorStore.setState((state) => {
31
31
  const methodState = state.methodState[method] || {};
32
- const currentMethodState = methodState[hash] || {
33
- loading: false,
34
- data: undefined,
35
- error: undefined,
36
- };
32
+ const currentMethodState = methodState[hash] || DEFAULT_STATE;
37
33
  const updatedMethodState = Object.assign(Object.assign({}, methodState), { [hash]: Object.assign(Object.assign({}, currentMethodState), newState) });
38
34
  return Object.assign(Object.assign({}, state), { methodState: Object.assign(Object.assign({}, state.methodState), { [method]: updatedMethodState }) });
39
35
  });
@@ -82,9 +78,6 @@ class ActorManager {
82
78
  const data = yield method(...args);
83
79
  return data;
84
80
  });
85
- this.getAgent = () => {
86
- return this._agentManager.getAgent();
87
- };
88
81
  // actor store
89
82
  this.getActor = () => {
90
83
  return this._actor;
@@ -100,11 +93,11 @@ class ActorManager {
100
93
  };
101
94
  const { agentManager, canisterId, idlFactory, withVisitor = false, withDevtools = false, initializeOnCreate = true, } = actorConfig;
102
95
  this._agentManager = agentManager;
103
- this.unsubscribeActor = this._agentManager.subscribeAgent(this.initializeActor);
96
+ this._agentManager.subscribeAgent(this.initializeActor);
104
97
  this.canisterId = canisterId;
105
98
  this._idlFactory = idlFactory;
106
99
  if (withVisitor) {
107
- this.visitFunction = this.extractService();
100
+ this.visitFunction = withVisitor ? this.extractService() : emptyVisitor;
108
101
  }
109
102
  else {
110
103
  this.visitFunction = emptyVisitor;
@@ -140,3 +133,4 @@ const emptyVisitor = new Proxy({}, {
140
133
  throw new Error(`Cannot visit function "${String(prop)}" without initializing the actor with the visitor option, please set the withVisitor option to true when creating the actor manager.`);
141
134
  },
142
135
  });
136
+ const DEFAULT_STATE = { data: undefined, error: undefined, loading: false };
@@ -1,7 +1,7 @@
1
1
  import type { IDL } from "@dfinity/candid";
2
2
  import type { StoreApi } from "zustand";
3
3
  import type { AgentManager } from "../agent";
4
- import type { ActorMethod, ActorSubclass, Principal } from "../types";
4
+ import type { ActorMethod, ActorSubclass, Principal } from "../../types";
5
5
  export interface DefaultActorType {
6
6
  [key: string]: ActorMethod;
7
7
  }
@@ -9,7 +9,7 @@ export type BaseActor<T = DefaultActorType> = ActorSubclass<T>;
9
9
  export type FunctionName<A = BaseActor> = keyof A & string;
10
10
  export type FunctionType = "query" | "update";
11
11
  export type CanisterId = string | Principal;
12
- export interface ActorManagerOptions {
12
+ export interface ActorManagerParameters {
13
13
  agentManager: AgentManager;
14
14
  idlFactory: IDL.InterfaceFactory;
15
15
  canisterId: CanisterId;
@@ -24,23 +24,23 @@ export type VisitorType<V> = V extends IDL.Visitor<infer D, infer R> ? {
24
24
  export type VisitService<A = BaseActor, M extends FunctionName<A> = FunctionName<A>> = {
25
25
  [K in M]: <V extends IDL.Visitor<unknown, unknown>>(extractorClass: V, data?: VisitorType<V>["data"]) => ReturnType<V["visitFunc"]>;
26
26
  };
27
- export type ActorMethodArgs<T> = T extends ActorMethod<infer Args, any> ? Args : never;
27
+ export type ActorMethodParameters<T> = T extends ActorMethod<infer Args, any> ? Args : never;
28
28
  export type ActorMethodReturnType<T> = T extends ActorMethod<any, infer Ret> ? Ret : never;
29
- export interface ActorMethodState<A, M extends keyof A> {
29
+ export interface ActorMethodState<A = BaseActor, M extends FunctionName<A> = FunctionName<A>> {
30
30
  [key: string]: {
31
31
  data: ActorMethodReturnType<A[M]> | undefined;
32
32
  loading: boolean;
33
33
  error: Error | undefined;
34
34
  };
35
35
  }
36
- export type ActorMethodStates<A> = {
37
- [M in keyof A]: ActorMethodState<A, M>;
36
+ export type ActorMethodStates<A = BaseActor> = {
37
+ [M in FunctionName<A>]: ActorMethodState<A, M>;
38
38
  };
39
- export type ActorState<A> = {
39
+ export type ActorState<A = BaseActor> = {
40
40
  initialized: boolean;
41
41
  initializing: boolean;
42
42
  error: Error | undefined;
43
43
  methodState: ActorMethodStates<A>;
44
44
  };
45
45
  export type ActorStore<A = BaseActor> = StoreApi<ActorState<A>>;
46
- export type CallActorMethod<A = BaseActor> = <M extends keyof A>(functionName: M, ...args: ActorMethodArgs<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
46
+ export type CallActorMethod<A = BaseActor> = <M extends FunctionName<A> = FunctionName<A>>(functionName: M, ...args: ActorMethodParameters<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
@@ -1,5 +1,5 @@
1
1
  import { HttpAgent } from "@dfinity/agent";
2
- import type { AgentStore, AgentManagerOptions, UpdateAgentOptions, AuthStore } from "./types";
2
+ import type { AgentStore, AgentManagerParameters, UpdateAgentParameters, AuthStore } from "./types";
3
3
  export declare class AgentManager {
4
4
  private _agent;
5
5
  private _subscribers;
@@ -10,12 +10,12 @@ export declare class AgentManager {
10
10
  private initialAuthState;
11
11
  private updateAgentState;
12
12
  private updateAuthState;
13
- constructor(options?: AgentManagerOptions);
13
+ constructor(options?: AgentManagerParameters);
14
14
  private initializeAgent;
15
15
  subscribeAgent: (callback: (agent: HttpAgent) => void) => () => void;
16
16
  unsubscribeAgent: (callback: (agent: HttpAgent) => void) => void;
17
17
  private notifySubscribers;
18
- updateAgent: (options?: UpdateAgentOptions) => Promise<void>;
18
+ updateAgent: (options?: UpdateAgentParameters) => Promise<void>;
19
19
  authenticate: () => Promise<import("@dfinity/agent").Identity>;
20
20
  getAgent: () => HttpAgent;
21
21
  getAgentState: AgentStore["getState"];
@@ -45,8 +45,8 @@ var __rest = (this && this.__rest) || function (s, e) {
45
45
  Object.defineProperty(exports, "__esModule", { value: true });
46
46
  exports.AgentManager = void 0;
47
47
  const agent_1 = require("@dfinity/agent");
48
- const helper_1 = require("../tools/helper");
49
- const constants_1 = require("../tools/constants");
48
+ const helper_1 = require("../../tools/helper");
49
+ const constants_1 = require("../../tools/constants");
50
50
  class AgentManager {
51
51
  constructor(options) {
52
52
  this._subscribers = [];
@@ -155,7 +155,7 @@ class AgentManager {
155
155
  const identity = this.authStore.getState().identity;
156
156
  return identity ? identity.getPrincipal() : null;
157
157
  };
158
- const _a = options || {}, { withDevtools, port = 4943, isLocalEnv, host: optionHost } = _a, agentOptions = __rest(_a, ["withDevtools", "port", "isLocalEnv", "host"]);
158
+ const _a = options || {}, { withDevtools, port = 4943, isLocalEnv, host: optionHost } = _a, agentParameters = __rest(_a, ["withDevtools", "port", "isLocalEnv", "host"]);
159
159
  const host = isLocalEnv
160
160
  ? `http://127.0.0.1:${port}`
161
161
  : optionHost
@@ -171,7 +171,7 @@ class AgentManager {
171
171
  withDevtools,
172
172
  store: "auth",
173
173
  });
174
- this._agent = new agent_1.HttpAgent(Object.assign(Object.assign({}, agentOptions), { host }));
174
+ this._agent = new agent_1.HttpAgent(Object.assign(Object.assign({}, agentParameters), { host }));
175
175
  this.isLocalEnv = this._agent.isLocal();
176
176
  this.initializeAgent();
177
177
  }
@@ -2,7 +2,7 @@ import type { HttpAgent, HttpAgentOptions, Identity } from "@dfinity/agent";
2
2
  import type { AuthClient } from "@dfinity/auth-client";
3
3
  import type { StoreApi } from "zustand";
4
4
  export { HttpAgentOptions, AuthClient, Identity };
5
- export interface AgentManagerOptions extends HttpAgentOptions {
5
+ export interface AgentManagerParameters extends HttpAgentOptions {
6
6
  port?: number;
7
7
  isLocalEnv?: boolean;
8
8
  withDevtools?: boolean;
@@ -19,7 +19,7 @@ export interface AuthState {
19
19
  authenticated: boolean;
20
20
  error: Error | undefined;
21
21
  }
22
- export interface UpdateAgentOptions extends HttpAgentOptions {
22
+ export interface UpdateAgentParameters extends HttpAgentOptions {
23
23
  agent?: HttpAgent;
24
24
  }
25
25
  export type AgentStore = StoreApi<AgentState>;
@@ -1,9 +1,9 @@
1
1
  import { HttpAgent } from "@dfinity/agent";
2
- import type { CanisterId, CandidAdapterOptions, CandidDefenition } from "../types";
2
+ import type { CanisterId, CandidAdapterParameters, CandidDefenition } from "../../types";
3
3
  export declare class CandidAdapter {
4
4
  agent: HttpAgent;
5
5
  didjsCanisterId: string;
6
- constructor({ agentManager, agent, didjsCanisterId }: CandidAdapterOptions);
6
+ constructor({ agentManager, agent, didjsCanisterId, }: CandidAdapterParameters);
7
7
  private getDefaultDidJsId;
8
8
  getCandidDefinition(canisterId: CanisterId): Promise<CandidDefenition>;
9
9
  getFromMetadata(canisterId: CanisterId): Promise<CandidDefenition | undefined>;
@@ -12,9 +12,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CandidAdapter = void 0;
13
13
  const agent_1 = require("@dfinity/agent");
14
14
  const principal_1 = require("@dfinity/principal");
15
- const constants_1 = require("../tools/constants");
15
+ const constants_1 = require("../../tools/constants");
16
16
  class CandidAdapter {
17
- constructor({ agentManager, agent, didjsCanisterId }) {
17
+ constructor({ agentManager, agent, didjsCanisterId, }) {
18
18
  if (agent) {
19
19
  this.agent = agent;
20
20
  }
@@ -1,6 +1,6 @@
1
1
  import type { AgentManager } from "../agent";
2
- import type { IDL, HttpAgent } from "../types";
3
- export interface CandidAdapterOptions {
2
+ import type { IDL, HttpAgent } from "../../types";
3
+ export interface CandidAdapterParameters {
4
4
  agentManager?: AgentManager;
5
5
  agent?: HttpAgent;
6
6
  didjsCanisterId?: string;
@@ -0,0 +1,3 @@
1
+ export * from "./actor";
2
+ export * from "./agent";
3
+ export * from "./candid";
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./actor"), exports);
18
+ __exportStar(require("./agent"), exports);
19
+ __exportStar(require("./candid"), exports);
package/dist/index.d.ts CHANGED
@@ -1,56 +1,6 @@
1
- import { ActorManager } from "./actor";
2
- import { AgentManager } from "./agent";
3
- import type { ActorManagerOptions, BaseActor, AgentManagerOptions, ReactorCore, CreateReactorOptions, CreateReactorStoreOptions, CandidAdapterOptions } from "./types";
4
- import { CandidAdapter } from "./candid";
5
- /**
6
- * The Core module is the main entry point for the library.
7
- * Create a new actor manager with the given options.
8
- * Its create a new agent manager if not provided.
9
- *
10
- * @category Main
11
- * @includeExample ./packages/core/README.md:26-80
12
- */
13
- export declare const createReactorCore: <A = BaseActor>({ isLocalEnv, withProcessEnv, ...options }: CreateReactorOptions) => ReactorCore<A>;
14
- /**
15
- * The `CandidAdapter` class is used to interact with a canister and retrieve its Candid interface definition.
16
- * It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
17
- * If both methods fail, it throws an error.
18
- *
19
- * @category Main
20
- * @includeExample ./packages/core/README.md:145-186
21
- */
22
- export declare const createCandidAdapter: (options: CandidAdapterOptions) => CandidAdapter;
23
- /**
24
- * Create a new actor manager with the given options.
25
- * Its create a new agent manager if not provided.
26
- * It also creates a new actor manager with the given options.
27
- *
28
- * @category Main
29
- * @includeExample ./packages/core/README.md:194-220
30
- */
31
- export declare const createReactorStore: <A = BaseActor>(options: CreateReactorStoreOptions) => ActorManager<A>;
32
- /**
33
- * Agent manager handles the lifecycle of the `@dfinity/agent`.
34
- * It is responsible for creating agent and managing the agent's state.
35
- * You can use it to subscribe to the agent changes.
36
- * login and logout to the internet identity.
37
- *
38
- * @category Main
39
- * @includeExample ./packages/core/README.md:226-254
40
- */
41
- export declare const createAgentManager: (options?: AgentManagerOptions) => AgentManager;
42
- /**
43
- * Actor manager handles the lifecycle of the actors.
44
- * It is responsible for creating and managing the actors.
45
- * You can use it to call and visit the actor's methods.
46
- * It also provides a way to interact with the actor's state.
47
- *
48
- * @category Main
49
- * @includeExample ./packages/core/README.md:262-277
50
- */
51
- export declare const createActorManager: <A = BaseActor>(options: ActorManagerOptions) => ActorManager<A>;
52
- export * from "./actor";
53
- export * from "./agent";
54
- export * from "./candid";
1
+ export * from "./main";
2
+ export * from "./store";
3
+ export * from "./other";
4
+ export * as classes from "./classes";
55
5
  export * as types from "./types";
56
6
  export * as tools from "./tools";
package/dist/index.js CHANGED
@@ -25,216 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  __setModuleDefault(result, mod);
26
26
  return result;
27
27
  };
28
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
- return new (P || (P = Promise))(function (resolve, reject) {
31
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
- step((generator = generator.apply(thisArg, _arguments || [])).next());
35
- });
36
- };
37
- var __rest = (this && this.__rest) || function (s, e) {
38
- var t = {};
39
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
40
- t[p] = s[p];
41
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
42
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
43
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
44
- t[p[i]] = s[p[i]];
45
- }
46
- return t;
47
- };
48
28
  Object.defineProperty(exports, "__esModule", { value: true });
49
- exports.tools = exports.types = exports.createActorManager = exports.createAgentManager = exports.createReactorStore = exports.createCandidAdapter = exports.createReactorCore = void 0;
50
- const actor_1 = require("./actor");
51
- const agent_1 = require("./agent");
52
- const constants_1 = require("./tools/constants");
53
- const tools_1 = require("./tools");
54
- const candid_1 = require("./candid");
55
- /**
56
- * The Core module is the main entry point for the library.
57
- * Create a new actor manager with the given options.
58
- * Its create a new agent manager if not provided.
59
- *
60
- * @category Main
61
- * @includeExample ./packages/core/README.md:26-80
62
- */
63
- const createReactorCore = (_a) => {
64
- var { isLocalEnv, withProcessEnv = false } = _a, options = __rest(_a, ["isLocalEnv", "withProcessEnv"]);
65
- isLocalEnv = isLocalEnv || (withProcessEnv ? (0, tools_1.isInLocalOrDevelopment)() : false);
66
- const _b = (0, exports.createReactorStore)(Object.assign({ isLocalEnv }, options)), { subscribeActorState, updateMethodState, callMethod, getState, agentManager } = _b, rest = __rest(_b, ["subscribeActorState", "updateMethodState", "callMethod", "getState", "agentManager"]);
67
- const reActorMethod = (functionName, ...args) => {
68
- const requestHash = (0, tools_1.generateRequestHash)(args);
69
- const updateState = (newState = {}) => {
70
- updateMethodState(functionName, requestHash, newState);
71
- };
72
- updateState();
73
- try {
74
- const methodState = ((key) => {
75
- const state = getState().methodState[functionName][requestHash];
76
- switch (key) {
77
- case "data":
78
- return state.data;
79
- case "loading":
80
- return state.loading;
81
- case "error":
82
- return state.error;
83
- default:
84
- return state;
85
- }
86
- });
87
- const subscribe = (callback) => {
88
- const unsubscribe = subscribeActorState((state) => {
89
- const methodState = state.methodState[functionName];
90
- const methodStateHash = methodState[requestHash];
91
- if (methodStateHash) {
92
- callback(methodStateHash);
93
- }
94
- });
95
- return unsubscribe;
96
- };
97
- const call = (replaceArgs) => __awaiter(void 0, void 0, void 0, function* () {
98
- updateState({
99
- loading: true,
100
- error: undefined,
101
- });
102
- try {
103
- const data = yield callMethod(functionName, ...(replaceArgs !== null && replaceArgs !== void 0 ? replaceArgs : args));
104
- updateState({ data, loading: false });
105
- return data;
106
- }
107
- catch (error) {
108
- updateState({
109
- error: error,
110
- loading: false,
111
- });
112
- throw error;
113
- }
114
- });
115
- return {
116
- requestHash,
117
- subscribe,
118
- getState: methodState,
119
- call,
120
- };
121
- }
122
- catch (error) {
123
- updateState({
124
- error: error,
125
- loading: false,
126
- });
127
- throw error;
128
- }
129
- };
130
- const queryCall = ({ functionName, args = [], refetchOnMount = true, refetchInterval = false, }) => {
131
- let intervalId = null;
132
- const _a = reActorMethod(functionName, ...args), { call } = _a, rest = __rest(_a, ["call"]);
133
- if (refetchInterval) {
134
- intervalId = setInterval(() => {
135
- call();
136
- }, refetchInterval);
137
- }
138
- let dataPromise = Promise.resolve();
139
- if (refetchOnMount)
140
- dataPromise = call();
141
- return Object.assign(Object.assign({}, rest), { call, dataPromise, intervalId });
142
- };
143
- const updateCall = ({ functionName, args = [] }) => {
144
- return reActorMethod(functionName, ...args);
145
- };
146
- const login = (options) => __awaiter(void 0, void 0, void 0, function* () {
147
- const authClient = agentManager.getAuthClient();
148
- if (!authClient) {
149
- yield agentManager.authenticate();
150
- }
151
- if (!authClient) {
152
- throw new Error("Auth client not initialized");
153
- }
154
- yield authClient.login(Object.assign({ identityProvider: isLocalEnv
155
- ? constants_1.IC_INTERNET_IDENTITY_PROVIDER
156
- : constants_1.LOCAL_INTERNET_IDENTITY_PROVIDER }, options));
157
- });
158
- const logout = (options) => __awaiter(void 0, void 0, void 0, function* () {
159
- const authClient = agentManager.getAuthClient();
160
- if (!authClient) {
161
- throw new Error("Auth client not initialized");
162
- }
163
- yield authClient.logout(options);
164
- yield agentManager.authenticate();
165
- });
166
- return Object.assign(Object.assign({ queryCall,
167
- updateCall,
168
- callMethod,
169
- getState,
170
- login,
171
- logout,
172
- subscribeActorState }, agentManager), rest);
173
- };
174
- exports.createReactorCore = createReactorCore;
175
- /**
176
- * The `CandidAdapter` class is used to interact with a canister and retrieve its Candid interface definition.
177
- * It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
178
- * If both methods fail, it throws an error.
179
- *
180
- * @category Main
181
- * @includeExample ./packages/core/README.md:145-186
182
- */
183
- const createCandidAdapter = (options) => {
184
- return new candid_1.CandidAdapter(options);
185
- };
186
- exports.createCandidAdapter = createCandidAdapter;
187
- /**
188
- * Create a new actor manager with the given options.
189
- * Its create a new agent manager if not provided.
190
- * It also creates a new actor manager with the given options.
191
- *
192
- * @category Main
193
- * @includeExample ./packages/core/README.md:194-220
194
- */
195
- const createReactorStore = (options) => {
196
- const { idlFactory, canisterId, withDevtools = false, initializeOnCreate = true, withVisitor = false, agentManager: maybeAgentManager } = options, agentOptions = __rest(options, ["idlFactory", "canisterId", "withDevtools", "initializeOnCreate", "withVisitor", "agentManager"]);
197
- const agentManager = maybeAgentManager ||
198
- (0, exports.createAgentManager)(Object.assign({ withDevtools }, agentOptions));
199
- const actorManager = (0, exports.createActorManager)({
200
- idlFactory,
201
- canisterId,
202
- agentManager,
203
- withVisitor,
204
- withDevtools,
205
- initializeOnCreate,
206
- });
207
- return actorManager;
208
- };
209
- exports.createReactorStore = createReactorStore;
210
- /**
211
- * Agent manager handles the lifecycle of the `@dfinity/agent`.
212
- * It is responsible for creating agent and managing the agent's state.
213
- * You can use it to subscribe to the agent changes.
214
- * login and logout to the internet identity.
215
- *
216
- * @category Main
217
- * @includeExample ./packages/core/README.md:226-254
218
- */
219
- const createAgentManager = (options) => {
220
- return new agent_1.AgentManager(options);
221
- };
222
- exports.createAgentManager = createAgentManager;
223
- /**
224
- * Actor manager handles the lifecycle of the actors.
225
- * It is responsible for creating and managing the actors.
226
- * You can use it to call and visit the actor's methods.
227
- * It also provides a way to interact with the actor's state.
228
- *
229
- * @category Main
230
- * @includeExample ./packages/core/README.md:262-277
231
- */
232
- const createActorManager = (options) => {
233
- return new actor_1.ActorManager(options);
234
- };
235
- exports.createActorManager = createActorManager;
236
- __exportStar(require("./actor"), exports);
237
- __exportStar(require("./agent"), exports);
238
- __exportStar(require("./candid"), exports);
29
+ exports.tools = exports.types = exports.classes = void 0;
30
+ __exportStar(require("./main"), exports);
31
+ __exportStar(require("./store"), exports);
32
+ __exportStar(require("./other"), exports);
33
+ exports.classes = __importStar(require("./classes"));
239
34
  exports.types = __importStar(require("./types"));
240
35
  exports.tools = __importStar(require("./tools"));
package/dist/main.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import type { BaseActor, CreateReactorCoreParameters, CreateReactorCoreReturnType } from "./types";
2
+ /**
3
+ * The Core module is the main entry point for the library.
4
+ * Create a new actor manager with the given options.
5
+ * Its create a new agent manager if not provided.
6
+ *
7
+ * @category Main
8
+ * @includeExample ./packages/core/README.md:26-80
9
+ */
10
+ export declare const createReactorCore: <A = BaseActor>(config: CreateReactorCoreParameters) => CreateReactorCoreReturnType<A>;
package/dist/main.js ADDED
@@ -0,0 +1,144 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __rest = (this && this.__rest) || function (s, e) {
12
+ var t = {};
13
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
14
+ t[p] = s[p];
15
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
16
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
17
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
18
+ t[p[i]] = s[p[i]];
19
+ }
20
+ return t;
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.createReactorCore = void 0;
24
+ const constants_1 = require("./tools/constants");
25
+ const tools_1 = require("./tools");
26
+ const store_1 = require("./store");
27
+ /**
28
+ * The Core module is the main entry point for the library.
29
+ * Create a new actor manager with the given options.
30
+ * Its create a new agent manager if not provided.
31
+ *
32
+ * @category Main
33
+ * @includeExample ./packages/core/README.md:26-80
34
+ */
35
+ const createReactorCore = (config) => {
36
+ const _a = (0, store_1.createReactorStore)(config), { subscribeActorState, updateMethodState, callMethod, getState, agentManager } = _a, rest = __rest(_a, ["subscribeActorState", "updateMethodState", "callMethod", "getState", "agentManager"]);
37
+ const actorMethod = (functionName, ...args) => {
38
+ const requestHash = (0, tools_1.generateRequestHash)(args);
39
+ const updateState = (newState = {}) => {
40
+ updateMethodState(functionName, requestHash, newState);
41
+ };
42
+ updateState();
43
+ try {
44
+ const methodState = ((key) => {
45
+ const state = getState().methodState[functionName][requestHash];
46
+ switch (key) {
47
+ case "data":
48
+ return state.data;
49
+ case "loading":
50
+ return state.loading;
51
+ case "error":
52
+ return state.error;
53
+ default:
54
+ return state;
55
+ }
56
+ });
57
+ const subscribe = (callback) => {
58
+ const unsubscribe = subscribeActorState((state) => {
59
+ const methodState = state.methodState[functionName];
60
+ const methodStateHash = methodState[requestHash];
61
+ if (methodStateHash) {
62
+ callback(methodStateHash);
63
+ }
64
+ });
65
+ return unsubscribe;
66
+ };
67
+ const call = (replaceArgs) => __awaiter(void 0, void 0, void 0, function* () {
68
+ updateState({
69
+ loading: true,
70
+ error: undefined,
71
+ });
72
+ try {
73
+ const data = yield callMethod(functionName, ...(replaceArgs !== null && replaceArgs !== void 0 ? replaceArgs : args));
74
+ updateState({ data, loading: false });
75
+ return data;
76
+ }
77
+ catch (error) {
78
+ updateState({
79
+ error: error,
80
+ loading: false,
81
+ });
82
+ throw error;
83
+ }
84
+ });
85
+ return {
86
+ requestHash,
87
+ subscribe,
88
+ getState: methodState,
89
+ call,
90
+ };
91
+ }
92
+ catch (error) {
93
+ updateState({
94
+ error: error,
95
+ loading: false,
96
+ });
97
+ throw error;
98
+ }
99
+ };
100
+ const queryCall = ({ functionName, args = [], refetchOnMount = true, refetchInterval = false, }) => {
101
+ let intervalId = null;
102
+ const _a = actorMethod(functionName, ...args), { call } = _a, rest = __rest(_a, ["call"]);
103
+ if (refetchInterval) {
104
+ intervalId = setInterval(() => {
105
+ call();
106
+ }, refetchInterval);
107
+ }
108
+ let dataPromise = Promise.resolve();
109
+ if (refetchOnMount)
110
+ dataPromise = call();
111
+ return Object.assign(Object.assign({}, rest), { call, dataPromise, intervalId });
112
+ };
113
+ const updateCall = ({ functionName, args = [] }) => {
114
+ return actorMethod(functionName, ...args);
115
+ };
116
+ const login = (options) => __awaiter(void 0, void 0, void 0, function* () {
117
+ const authClient = agentManager.getAuthClient();
118
+ if (!authClient) {
119
+ yield agentManager.authenticate();
120
+ }
121
+ if (!authClient) {
122
+ throw new Error("Auth client not initialized");
123
+ }
124
+ yield authClient.login(Object.assign({ identityProvider: agentManager.isLocalEnv
125
+ ? constants_1.IC_INTERNET_IDENTITY_PROVIDER
126
+ : constants_1.LOCAL_INTERNET_IDENTITY_PROVIDER }, options));
127
+ });
128
+ const logout = (options) => __awaiter(void 0, void 0, void 0, function* () {
129
+ const authClient = agentManager.getAuthClient();
130
+ if (!authClient) {
131
+ throw new Error("Auth client not initialized");
132
+ }
133
+ yield authClient.logout(options);
134
+ yield agentManager.authenticate();
135
+ });
136
+ return Object.assign(Object.assign({ queryCall,
137
+ updateCall,
138
+ callMethod,
139
+ getState,
140
+ login,
141
+ logout,
142
+ subscribeActorState }, agentManager), rest);
143
+ };
144
+ exports.createReactorCore = createReactorCore;
@@ -0,0 +1,33 @@
1
+ import { ActorManager } from "./classes/actor";
2
+ import { AgentManager } from "./classes/agent";
3
+ import { CandidAdapter } from "./classes/candid";
4
+ import { CandidAdapterParameters, ActorManagerParameters, AgentManagerParameters, BaseActor } from "./types";
5
+ /**
6
+ * The `CandidAdapter` class is used to interact with a canister and retrieve its Candid interface definition.
7
+ * It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
8
+ * If both methods fail, it throws an error.
9
+ *
10
+ * @category Main
11
+ * @includeExample ./packages/core/README.md:145-186
12
+ */
13
+ export declare const createCandidAdapter: (config: CandidAdapterParameters) => CandidAdapter;
14
+ /**
15
+ * Agent manager handles the lifecycle of the `@dfinity/agent`.
16
+ * It is responsible for creating agent and managing the agent's state.
17
+ * You can use it to subscribe to the agent changes.
18
+ * login and logout to the internet identity.
19
+ *
20
+ * @category Main
21
+ * @includeExample ./packages/core/README.md:226-254
22
+ */
23
+ export declare const createAgentManager: (config?: AgentManagerParameters) => AgentManager;
24
+ /**
25
+ * Actor manager handles the lifecycle of the actors.
26
+ * It is responsible for creating and managing the actors.
27
+ * You can use it to call and visit the actor's methods.
28
+ * It also provides a way to interact with the actor's state.
29
+ *
30
+ * @category Main
31
+ * @includeExample ./packages/core/README.md:262-277
32
+ */
33
+ export declare const createActorManager: <A = BaseActor>(config: ActorManagerParameters) => ActorManager<A>;
package/dist/other.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createActorManager = exports.createAgentManager = exports.createCandidAdapter = void 0;
4
+ const actor_1 = require("./classes/actor");
5
+ const agent_1 = require("./classes/agent");
6
+ const candid_1 = require("./classes/candid");
7
+ /**
8
+ * The `CandidAdapter` class is used to interact with a canister and retrieve its Candid interface definition.
9
+ * It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
10
+ * If both methods fail, it throws an error.
11
+ *
12
+ * @category Main
13
+ * @includeExample ./packages/core/README.md:145-186
14
+ */
15
+ const createCandidAdapter = (config) => {
16
+ return new candid_1.CandidAdapter(config);
17
+ };
18
+ exports.createCandidAdapter = createCandidAdapter;
19
+ /**
20
+ * Agent manager handles the lifecycle of the `@dfinity/agent`.
21
+ * It is responsible for creating agent and managing the agent's state.
22
+ * You can use it to subscribe to the agent changes.
23
+ * login and logout to the internet identity.
24
+ *
25
+ * @category Main
26
+ * @includeExample ./packages/core/README.md:226-254
27
+ */
28
+ const createAgentManager = (config) => {
29
+ return new agent_1.AgentManager(config);
30
+ };
31
+ exports.createAgentManager = createAgentManager;
32
+ /**
33
+ * Actor manager handles the lifecycle of the actors.
34
+ * It is responsible for creating and managing the actors.
35
+ * You can use it to call and visit the actor's methods.
36
+ * It also provides a way to interact with the actor's state.
37
+ *
38
+ * @category Main
39
+ * @includeExample ./packages/core/README.md:262-277
40
+ */
41
+ const createActorManager = (config) => {
42
+ return new actor_1.ActorManager(config);
43
+ };
44
+ exports.createActorManager = createActorManager;
@@ -0,0 +1,11 @@
1
+ import { ActorManager } from "./classes/actor";
2
+ import type { BaseActor, CreateReactorStoreParameters } from "./types";
3
+ /**
4
+ * Create a new actor manager with the given options.
5
+ * Its create a new agent manager if not provided.
6
+ * It also creates a new actor manager with the given options.
7
+ *
8
+ * @category Main
9
+ * @includeExample ./packages/core/README.md:194-220
10
+ */
11
+ export declare const createReactorStore: <A = BaseActor>(config: CreateReactorStoreParameters) => ActorManager<A>;
package/dist/store.js ADDED
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.createReactorStore = void 0;
15
+ const other_1 = require("./other");
16
+ const tools_1 = require("./tools");
17
+ /**
18
+ * Create a new actor manager with the given options.
19
+ * Its create a new agent manager if not provided.
20
+ * It also creates a new actor manager with the given options.
21
+ *
22
+ * @category Main
23
+ * @includeExample ./packages/core/README.md:194-220
24
+ */
25
+ const createReactorStore = (config) => {
26
+ const isLocalEnv = config.withProcessEnv
27
+ ? (0, tools_1.isInLocalOrDevelopment)()
28
+ : undefined;
29
+ const { idlFactory, canisterId, withDevtools = false, initializeOnCreate = true, withVisitor = false, agentManager: maybeAgentManager } = config, agentParameters = __rest(config, ["idlFactory", "canisterId", "withDevtools", "initializeOnCreate", "withVisitor", "agentManager"]);
30
+ const agentManager = maybeAgentManager ||
31
+ (0, other_1.createAgentManager)(Object.assign({ withDevtools,
32
+ isLocalEnv }, agentParameters));
33
+ const actorManager = (0, other_1.createActorManager)({
34
+ idlFactory,
35
+ canisterId,
36
+ agentManager,
37
+ withVisitor,
38
+ withDevtools,
39
+ initializeOnCreate,
40
+ });
41
+ return actorManager;
42
+ };
43
+ exports.createReactorStore = createReactorStore;
@@ -1,9 +1,9 @@
1
- import { BaseActor } from "../types";
2
- interface StoreOptions {
1
+ import type { BaseActor } from "../types";
2
+ interface StoreParameters {
3
3
  withDevtools?: boolean;
4
4
  store: string;
5
5
  }
6
- export declare function createStoreWithOptionalDevtools<T>(initialState: T, options: StoreOptions): Omit<import("zustand/vanilla").StoreApi<T>, "setState"> & {
6
+ export declare function createStoreWithOptionalDevtools<T>(initialState: T, config: StoreParameters): Omit<import("zustand/vanilla").StoreApi<T>, "setState"> & {
7
7
  setState<A extends string | {
8
8
  type: string;
9
9
  }>(partial: T | Partial<T> | ((state: T) => T | Partial<T>), replace?: boolean | undefined, action?: A | undefined): void;
@@ -5,11 +5,11 @@ const agent_1 = require("@dfinity/agent");
5
5
  const candid_1 = require("@dfinity/candid");
6
6
  const middleware_1 = require("zustand/middleware");
7
7
  const vanilla_1 = require("zustand/vanilla");
8
- function createStoreWithOptionalDevtools(initialState, options) {
9
- if (options.withDevtools) {
8
+ function createStoreWithOptionalDevtools(initialState, config) {
9
+ if (config.withDevtools) {
10
10
  return (0, vanilla_1.createStore)((0, middleware_1.devtools)(() => initialState, {
11
11
  name: "Reactor",
12
- store: options.store,
12
+ store: config.store,
13
13
  }));
14
14
  }
15
15
  else {
package/dist/types.d.ts CHANGED
@@ -2,17 +2,16 @@
2
2
  import type { ActorMethod, ActorSubclass, HttpAgentOptions, HttpAgent, Identity } from "@dfinity/agent";
3
3
  import type { Principal } from "@dfinity/principal";
4
4
  import type { IDL } from "@dfinity/candid";
5
- import type { ActorManager } from "./actor";
6
- import type { ActorManagerOptions, ActorMethodArgs, ActorMethodReturnType, ActorMethodState, BaseActor, FunctionName } from "./actor/types";
7
- import type { AgentManager } from "./agent";
5
+ import type { ActorManagerParameters, ActorMethodParameters, ActorMethodReturnType, ActorMethodState, BaseActor, FunctionName } from "./classes/actor/types";
6
+ import type { ActorManager } from "./classes/actor";
7
+ import type { AgentManager } from "./classes/agent";
8
8
  import type { AuthClientLoginOptions } from "@dfinity/auth-client";
9
- export * from "./agent/types";
10
- export * from "./actor/types";
11
- export * from "./candid/types";
12
- export type { ActorMethod, HttpAgentOptions, ActorSubclass, Principal, HttpAgent, Identity, IDL, };
13
- export interface CreateReactorOptions extends CreateReactorStoreOptions {
14
- }
15
- export interface CreateReactorStoreOptions extends HttpAgentOptions, Omit<ActorManagerOptions, "agentManager"> {
9
+ export * from "./classes/agent/types";
10
+ export * from "./classes/actor/types";
11
+ export * from "./classes/candid/types";
12
+ export type { ActorManager, AgentManager };
13
+ export type { ActorMethod, AuthClientLoginOptions, HttpAgentOptions, ActorSubclass, Principal, HttpAgent, Identity, IDL, };
14
+ export interface CreateReactorStoreParameters extends HttpAgentOptions, Omit<ActorManagerParameters, "agentManager"> {
16
15
  agentManager?: AgentManager;
17
16
  withProcessEnv?: boolean;
18
17
  isLocalEnv?: boolean;
@@ -25,8 +24,8 @@ export type ActorGetStateFunction<A, M extends FunctionName<A>> = {
25
24
  (): ActorMethodState<A, M>[string];
26
25
  };
27
26
  export type ActorSubscribeFunction<A, M extends FunctionName<A>> = (callback: (state: ActorMethodState<A, M>[string]) => void) => () => void;
28
- export type ActorCallFunction<A, M extends FunctionName<A>> = (replaceArgs?: ActorMethodArgs<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
29
- export type ActorQueryReturn<A, M extends FunctionName<A>> = {
27
+ export type ActorCallFunction<A, M extends FunctionName<A>> = (replaceArgs?: ActorMethodParameters<A[M]>) => Promise<ActorMethodReturnType<A[M]>>;
28
+ export type ActorQueryReturnType<A, M extends FunctionName<A>> = {
30
29
  intervalId: NodeJS.Timeout | null;
31
30
  requestHash: string;
32
31
  getState: ActorGetStateFunction<A, M>;
@@ -34,28 +33,31 @@ export type ActorQueryReturn<A, M extends FunctionName<A>> = {
34
33
  call: ActorCallFunction<A, M>;
35
34
  dataPromise: Promise<ActorMethodReturnType<A[M]>>;
36
35
  };
37
- export type ActorUpdateReturn<A, M extends FunctionName<A>> = {
36
+ export type ActorUpdateReturnType<A, M extends FunctionName<A>> = {
38
37
  requestHash: string;
39
38
  getState: ActorGetStateFunction<A, M>;
40
39
  subscribe: ActorSubscribeFunction<A, M>;
41
40
  call: ActorCallFunction<A, M>;
42
41
  };
43
- export type ActorQueryArgs<A, M extends FunctionName<A>> = {
42
+ export type ActorQueryParameters<A, M extends FunctionName<A>> = {
44
43
  functionName: M;
45
- args?: ActorMethodArgs<A[M]>;
44
+ args?: ActorMethodParameters<A[M]>;
46
45
  refetchOnMount?: boolean;
47
46
  refetchInterval?: number | false;
48
47
  };
49
- export type ActorUpdateArgs<A, M extends FunctionName<A>> = {
48
+ export type ActorUpdateParameters<A, M extends FunctionName<A>> = {
50
49
  functionName: M;
51
- args?: ActorMethodArgs<A[M]>;
50
+ args?: ActorMethodParameters<A[M]>;
52
51
  };
53
- export type ActorMethodCall<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(functionName: M, ...args: ActorMethodArgs<A[M]>) => ActorUpdateReturn<A, M>;
54
- export type ActorQuery<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(options: ActorQueryArgs<A, M>) => ActorQueryReturn<A, M>;
55
- export type ActorUpdate<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(options: ActorUpdateArgs<A, M>) => ActorUpdateReturn<A, M>;
56
- export interface ReactorCore<A = BaseActor> extends AgentManager, Omit<ActorManager<A>, "updateMethodState"> {
57
- login: (options?: AuthClientLoginOptions) => Promise<void>;
58
- logout: (options?: {
52
+ export type ActorMethodCall<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(functionName: M, ...args: ActorMethodParameters<A[M]>) => ActorUpdateReturnType<A, M>;
53
+ export type ActorQuery<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(config: ActorQueryParameters<A, M>) => ActorQueryReturnType<A, M>;
54
+ export type ActorUpdate<A = Record<string, ActorMethod>> = <M extends FunctionName<A>>(config: ActorUpdateParameters<A, M>) => ActorUpdateReturnType<A, M>;
55
+ export interface CreateReactorCoreParameters extends CreateReactorStoreParameters {
56
+ withProcessEnv?: boolean;
57
+ }
58
+ export interface CreateReactorCoreReturnType<A = BaseActor> extends AgentManager, Omit<ActorManager<A>, "updateMethodState"> {
59
+ login: (config?: AuthClientLoginOptions) => Promise<void>;
60
+ logout: (config?: {
59
61
  returnTo?: string;
60
62
  }) => Promise<void>;
61
63
  queryCall: ActorQuery<A>;
package/dist/types.js CHANGED
@@ -14,6 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./agent/types"), exports);
18
- __exportStar(require("./actor/types"), exports);
19
- __exportStar(require("./candid/types"), exports);
17
+ __exportStar(require("./classes/agent/types"), exports);
18
+ __exportStar(require("./classes/actor/types"), exports);
19
+ __exportStar(require("./classes/candid/types"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "A library for intracting with the Internet Computer canisters",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -43,5 +43,5 @@
43
43
  "engines": {
44
44
  "node": ">=10"
45
45
  },
46
- "gitHead": "4d19bef671056c8046ec64037f51d85380ff5bae"
46
+ "gitHead": "6b8947ab2611bf7af4f0fadaa33a1fa231cfc26b"
47
47
  }
File without changes
File without changes
File without changes