@ic-reactor/react 0.0.4 → 0.0.6
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/dist/index.d.ts +0 -1
- package/dist/index.js +3 -7
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,24 +8,21 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
12
|
exports.createReActor = void 0;
|
|
16
|
-
const store_1 =
|
|
13
|
+
const store_1 = require("@ic-reactor/store");
|
|
17
14
|
const react_1 = require("react");
|
|
18
15
|
const hooks_1 = require("./hooks");
|
|
19
16
|
const defaultCreateReActorOptions = {
|
|
20
17
|
initializeOnMount: true,
|
|
21
|
-
host: process.env.NODE_ENV === "production" || process.env.DFX_NETWORK === "ic"
|
|
18
|
+
host: (process === null || process === void 0 ? void 0 : process.env.NODE_ENV) === "production" || (process === null || process === void 0 ? void 0 : process.env.DFX_NETWORK) === "ic"
|
|
22
19
|
? "https://icp-api.io"
|
|
23
20
|
: "http://localhost:4943",
|
|
24
21
|
};
|
|
25
22
|
const createReActor = (actorInitializer, options = {}) => {
|
|
26
23
|
const optionsWithDefaults = Object.assign(Object.assign({}, defaultCreateReActorOptions), options);
|
|
27
24
|
const Context = (0, react_1.createContext)(undefined);
|
|
28
|
-
const { actions, initializeActor, store } = (0, store_1.
|
|
25
|
+
const { actions, initializeActor, store } = (0, store_1.createReActorStore)((agent) => actorInitializer(agent), optionsWithDefaults);
|
|
29
26
|
if (optionsWithDefaults.initializeOnMount) {
|
|
30
27
|
try {
|
|
31
28
|
initializeActor();
|
|
@@ -99,4 +96,3 @@ const createReActor = (actorInitializer, options = {}) => {
|
|
|
99
96
|
useInitializing });
|
|
100
97
|
};
|
|
101
98
|
exports.createReActor = createReActor;
|
|
102
|
-
exports.default = exports.createReActor;
|
package/package.json
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "A React library for interacting with Dfinity actors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.esm.js",
|
|
7
6
|
"types": "dist/index.d.ts",
|
|
8
7
|
"files": [
|
|
9
8
|
"dist/*"
|
|
@@ -41,12 +40,12 @@
|
|
|
41
40
|
"@dfinity/candid": "0.20",
|
|
42
41
|
"@dfinity/identity": "^0.20",
|
|
43
42
|
"@dfinity/principal": "^0.20",
|
|
44
|
-
"@ic-reactor/store": "^0.0.
|
|
43
|
+
"@ic-reactor/store": "^0.0.4",
|
|
45
44
|
"zustand": "4.4"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
47
|
"@peculiar/webcrypto": "1.4",
|
|
49
48
|
"react": ">=16.8"
|
|
50
49
|
},
|
|
51
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "14f94fc5f6b5eaf0b8f564fa8fddee9700f3e7ed"
|
|
52
51
|
}
|