@ic-reactor/core 1.10.1 → 1.10.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.
package/README.md CHANGED
@@ -19,7 +19,7 @@ yarn add @ic-reactor/core
19
19
  or you can use the UMD version:
20
20
 
21
21
  ```html
22
- <script src="https://github.com/B3Pay/ic-reactor/releases/download/v1.9.0/ic-reactor-core.min.js"></script>
22
+ <script src="https://github.com/B3Pay/ic-reactor/releases/download/v1.10.1/ic-reactor-core.min.js"></script>
23
23
  ```
24
24
 
25
25
  ### Using `createReactorCore`
@@ -70,7 +70,8 @@ class ActorManager {
70
70
  }, {});
71
71
  };
72
72
  this.initializeActor = (agent) => {
73
- console.info(`Initializing actor ${this.canisterId} on ${this._agentManager.getNetwork()} network`);
73
+ const network = this._agentManager.getNetwork();
74
+ console.info(`Initializing actor ${this.canisterId} on ${network} network`);
74
75
  const { _idlFactory, canisterId } = this;
75
76
  this.updateState({
76
77
  initializing: true,
@@ -24,7 +24,8 @@ export declare class AgentManager {
24
24
  returnTo?: string;
25
25
  }) => Promise<void>;
26
26
  getAgent: () => HttpAgent;
27
- getAgentHost: () => URL;
27
+ getAgentHost: () => URL | undefined;
28
+ getAgentHostName: () => string;
28
29
  getIsLocal: () => boolean;
29
30
  getNetwork: () => "local" | "remote" | "ic";
30
31
  getAgentState: AgentStore["getState"];
@@ -141,11 +141,15 @@ class AgentManager {
141
141
  this.getAgentHost = () => {
142
142
  return this._agent.host;
143
143
  };
144
+ this.getAgentHostName = () => {
145
+ var _a;
146
+ return ((_a = this.getAgentHost()) === null || _a === void 0 ? void 0 : _a.hostname) || "";
147
+ };
144
148
  this.getIsLocal = () => {
145
149
  return this.getNetwork() !== "ic";
146
150
  };
147
151
  this.getNetwork = () => {
148
- const hostname = this.getAgentHost().hostname;
152
+ const hostname = this.getAgentHostName();
149
153
  if (constants_1.LOCAL_HOSTS.some((host) => hostname.endsWith(host))) {
150
154
  return "local";
151
155
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ic-reactor/core",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
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",
@@ -56,5 +56,5 @@
56
56
  "engines": {
57
57
  "node": ">=10"
58
58
  },
59
- "gitHead": "06725ac246ae54fadf18ae6f02cbf1536a35c2f6"
59
+ "gitHead": "1603c5f57869353d4a3d1c18d08f303b0d03fe6d"
60
60
  }