@ic-reactor/core 1.0.0 → 1.0.1
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 +0 -6
- package/dist/actor/index.d.ts +2 -2
- package/dist/actor/index.js +0 -15
- package/dist/agent/index.d.ts +0 -1
- package/dist/agent/index.js +0 -4
- package/dist/index.d.ts +6 -13
- package/dist/index.js +16 -12
- package/dist/tools/candid.d.ts +1 -2
- package/dist/tools/helper.d.ts +1 -1
- package/dist/tools/index.d.ts +0 -1
- package/dist/tools/index.js +0 -1
- package/dist/types.d.ts +5 -1
- package/dist/types.js +17 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# @ic-reactor/core
|
|
2
|
-
|
|
3
1
|
The `@ic-reactor/core` package provides a streamlined way to interact with the Internet Computer (IC) by simplifying agent and actor management. It offers utilities for creating and managing IC agents, enabling seamless communication with canisters through a friendly API.
|
|
4
2
|
|
|
5
3
|
## Installation
|
|
@@ -204,7 +202,3 @@ try {
|
|
|
204
202
|
console.error(error)
|
|
205
203
|
}
|
|
206
204
|
```
|
|
207
|
-
|
|
208
|
-
## Conclusion
|
|
209
|
-
|
|
210
|
-
The `@ic-reactor/core` package offers a flexible and powerful way to interact with the Internet Computer, catering to both straightforward use cases with automatic agent management and more complex scenarios requiring manual control. By abstracting away some of the intricacies of agent and actor management, it enables developers to focus more on building their applications.
|
package/dist/actor/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { HttpAgent } from "@dfinity/agent";
|
|
2
2
|
import type { CanisterId, ActorMethodArgs, ActorMethodReturnType, ActorStore, ActorManagerOptions, FunctionName, VisitService, BaseActor, ActorMethodState } from "./types";
|
|
3
|
-
import type { AgentManager
|
|
4
|
-
|
|
3
|
+
import type { AgentManager } from "../agent";
|
|
4
|
+
import type { UpdateAgentOptions } from "../types";
|
|
5
5
|
export declare class ActorManager<A = BaseActor> {
|
|
6
6
|
private _actor;
|
|
7
7
|
private _idlFactory;
|
package/dist/actor/index.js
CHANGED
|
@@ -1,18 +1,4 @@
|
|
|
1
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
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -28,7 +14,6 @@ exports.ActorManager = void 0;
|
|
|
28
14
|
const agent_1 = require("@dfinity/agent");
|
|
29
15
|
const helper_1 = require("../tools/helper");
|
|
30
16
|
const candid_1 = require("@dfinity/candid");
|
|
31
|
-
__exportStar(require("./types"), exports);
|
|
32
17
|
class ActorManager {
|
|
33
18
|
constructor(actorConfig) {
|
|
34
19
|
this._actor = null;
|
package/dist/agent/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HttpAgent } from "@dfinity/agent";
|
|
2
2
|
import type { AgentStore, AgentManagerOptions, UpdateAgentOptions, AuthStore } from "./types";
|
|
3
|
-
export * from "./types";
|
|
4
3
|
export declare const IC_HOST_NETWORK_URI = "https://ic0.app";
|
|
5
4
|
export declare const LOCAL_HOST_NETWORK_URI = "http://127.0.0.1:4943";
|
|
6
5
|
export declare class AgentManager {
|
package/dist/agent/index.js
CHANGED
|
@@ -15,9 +15,6 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
|
-
};
|
|
21
18
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
19
|
if (mod && mod.__esModule) return mod;
|
|
23
20
|
var result = {};
|
|
@@ -49,7 +46,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
49
46
|
exports.AgentManager = exports.LOCAL_HOST_NETWORK_URI = exports.IC_HOST_NETWORK_URI = void 0;
|
|
50
47
|
const agent_1 = require("@dfinity/agent");
|
|
51
48
|
const helper_1 = require("../tools/helper");
|
|
52
|
-
__exportStar(require("./types"), exports);
|
|
53
49
|
exports.IC_HOST_NETWORK_URI = "https://ic0.app";
|
|
54
50
|
exports.LOCAL_HOST_NETWORK_URI = "http://127.0.0.1:4943";
|
|
55
51
|
class AgentManager {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
import type { ActorManagerOptions, BaseActor } from "./actor/types";
|
|
2
|
-
import type { AgentManagerOptions } from "./agent/types";
|
|
3
1
|
import { ActorManager } from "./actor";
|
|
4
2
|
import { AgentManager } from "./agent";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
export * from "./types";
|
|
8
|
-
export * from "./actor";
|
|
9
|
-
export * from "./agent";
|
|
10
|
-
export * from "./tools";
|
|
3
|
+
import { CandidAdapter } from "./tools";
|
|
4
|
+
import type { ActorManagerOptions, BaseActor, AgentManagerOptions, ActorCoreActions, CreateReActorOptions, CreateReActorStoreOptions, CandidAdapterOptions } from "./types";
|
|
11
5
|
/**
|
|
12
6
|
* Create a new actor manager with the given options.
|
|
13
7
|
* Its create a new agent manager if not provided.
|
|
14
8
|
*
|
|
15
|
-
* @category Main
|
|
16
9
|
* @includeExample ./packages/core/README.md:30-91
|
|
17
10
|
*/
|
|
18
11
|
export declare const createReActor: <A = BaseActor>({ isLocalEnv, withProcessEnv, ...options }: CreateReActorOptions) => ActorCoreActions<A>;
|
|
@@ -21,7 +14,6 @@ export declare const createReActor: <A = BaseActor>({ isLocalEnv, withProcessEnv
|
|
|
21
14
|
* Its create a new agent manager if not provided.
|
|
22
15
|
* It also creates a new actor manager with the given options.
|
|
23
16
|
*
|
|
24
|
-
* @category Main
|
|
25
17
|
* @includeExample ./packages/core/README.md:32-45
|
|
26
18
|
*/
|
|
27
19
|
export declare const createReActorStore: <A = BaseActor>(options: CreateReActorStoreOptions) => ActorManager<A>;
|
|
@@ -31,7 +23,6 @@ export declare const createReActorStore: <A = BaseActor>(options: CreateReActorS
|
|
|
31
23
|
* You can use it to subscribe to the agent changes.
|
|
32
24
|
* login and logout to the internet identity.
|
|
33
25
|
*
|
|
34
|
-
* @category Main
|
|
35
26
|
* @includeExample ./packages/core/README.md:55-86
|
|
36
27
|
*/
|
|
37
28
|
export declare const createAgentManager: (options?: AgentManagerOptions) => AgentManager;
|
|
@@ -41,7 +32,6 @@ export declare const createAgentManager: (options?: AgentManagerOptions) => Agen
|
|
|
41
32
|
* You can use it to call and visit the actor's methods.
|
|
42
33
|
* It also provides a way to interact with the actor's state.
|
|
43
34
|
*
|
|
44
|
-
* @category Main
|
|
45
35
|
* @includeExample ./packages/core/README.md:94-109
|
|
46
36
|
*/
|
|
47
37
|
export declare const createActorManager: <A = BaseActor>(options: ActorManagerOptions) => ActorManager<A>;
|
|
@@ -50,7 +40,10 @@ export declare const createActorManager: <A = BaseActor>(options: ActorManagerOp
|
|
|
50
40
|
* It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
|
|
51
41
|
* If both methods fail, it throws an error.
|
|
52
42
|
*
|
|
53
|
-
* @category Main
|
|
54
43
|
* @includeExample ./packages/core/README.md:164-205
|
|
55
44
|
*/
|
|
56
45
|
export declare const createCandidAdapter: (options: CandidAdapterOptions) => CandidAdapter;
|
|
46
|
+
export * as types from "./types";
|
|
47
|
+
export * as actor from "./actor";
|
|
48
|
+
export * as agent from "./agent";
|
|
49
|
+
export * as tools from "./tools";
|
package/dist/index.js
CHANGED
|
@@ -10,8 +10,17 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
10
10
|
if (k2 === undefined) k2 = k;
|
|
11
11
|
o[k2] = m[k];
|
|
12
12
|
}));
|
|
13
|
-
var
|
|
14
|
-
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
15
24
|
};
|
|
16
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -34,19 +43,14 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
34
43
|
return t;
|
|
35
44
|
};
|
|
36
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
-
exports.createCandidAdapter = exports.createActorManager = exports.createAgentManager = exports.createReActorStore = exports.createReActor = void 0;
|
|
46
|
+
exports.tools = exports.agent = exports.actor = exports.types = exports.createCandidAdapter = exports.createActorManager = exports.createAgentManager = exports.createReActorStore = exports.createReActor = void 0;
|
|
38
47
|
const actor_1 = require("./actor");
|
|
39
48
|
const agent_1 = require("./agent");
|
|
40
49
|
const tools_1 = require("./tools");
|
|
41
|
-
__exportStar(require("./types"), exports);
|
|
42
|
-
__exportStar(require("./actor"), exports);
|
|
43
|
-
__exportStar(require("./agent"), exports);
|
|
44
|
-
__exportStar(require("./tools"), exports);
|
|
45
50
|
/**
|
|
46
51
|
* Create a new actor manager with the given options.
|
|
47
52
|
* Its create a new agent manager if not provided.
|
|
48
53
|
*
|
|
49
|
-
* @category Main
|
|
50
54
|
* @includeExample ./packages/core/README.md:30-91
|
|
51
55
|
*/
|
|
52
56
|
const createReActor = (_a) => {
|
|
@@ -169,7 +173,6 @@ exports.createReActor = createReActor;
|
|
|
169
173
|
* Its create a new agent manager if not provided.
|
|
170
174
|
* It also creates a new actor manager with the given options.
|
|
171
175
|
*
|
|
172
|
-
* @category Main
|
|
173
176
|
* @includeExample ./packages/core/README.md:32-45
|
|
174
177
|
*/
|
|
175
178
|
const createReActorStore = (options) => {
|
|
@@ -193,7 +196,6 @@ exports.createReActorStore = createReActorStore;
|
|
|
193
196
|
* You can use it to subscribe to the agent changes.
|
|
194
197
|
* login and logout to the internet identity.
|
|
195
198
|
*
|
|
196
|
-
* @category Main
|
|
197
199
|
* @includeExample ./packages/core/README.md:55-86
|
|
198
200
|
*/
|
|
199
201
|
const createAgentManager = (options) => {
|
|
@@ -206,7 +208,6 @@ exports.createAgentManager = createAgentManager;
|
|
|
206
208
|
* You can use it to call and visit the actor's methods.
|
|
207
209
|
* It also provides a way to interact with the actor's state.
|
|
208
210
|
*
|
|
209
|
-
* @category Main
|
|
210
211
|
* @includeExample ./packages/core/README.md:94-109
|
|
211
212
|
*/
|
|
212
213
|
const createActorManager = (options) => {
|
|
@@ -218,10 +219,13 @@ exports.createActorManager = createActorManager;
|
|
|
218
219
|
* It provides methods to fetch the Candid definition either from the canister's metadata or by using a temporary hack method.
|
|
219
220
|
* If both methods fail, it throws an error.
|
|
220
221
|
*
|
|
221
|
-
* @category Main
|
|
222
222
|
* @includeExample ./packages/core/README.md:164-205
|
|
223
223
|
*/
|
|
224
224
|
const createCandidAdapter = (options) => {
|
|
225
225
|
return new tools_1.CandidAdapter(options);
|
|
226
226
|
};
|
|
227
227
|
exports.createCandidAdapter = createCandidAdapter;
|
|
228
|
+
exports.types = __importStar(require("./types"));
|
|
229
|
+
exports.actor = __importStar(require("./actor"));
|
|
230
|
+
exports.agent = __importStar(require("./agent"));
|
|
231
|
+
exports.tools = __importStar(require("./tools"));
|
package/dist/tools/candid.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { HttpAgent } from "@dfinity/agent";
|
|
2
|
-
import { CanisterId } from "../
|
|
3
|
-
import { CandidAdapterOptions, CandidDefenition } from "./types";
|
|
2
|
+
import type { CanisterId, CandidAdapterOptions, CandidDefenition } from "../types";
|
|
4
3
|
export declare const DEFAULT_LOCAL_DIDJS_ID = "bd3sg-teaaa-aaaaa-qaaba-cai";
|
|
5
4
|
export declare const DEFAULT_IC_DIDJS_ID = "a4gq6-oaaaa-aaaab-qaa4q-cai";
|
|
6
5
|
export declare class CandidAdapter {
|
package/dist/tools/helper.d.ts
CHANGED
package/dist/tools/index.d.ts
CHANGED
package/dist/tools/index.js
CHANGED
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./candid"), exports);
|
|
18
18
|
__exportStar(require("./helper"), exports);
|
|
19
|
-
__exportStar(require("./types"), exports);
|
package/dist/types.d.ts
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
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
|
|
5
|
+
import type { ActorManager } from "./actor";
|
|
6
|
+
import type { ActorManagerOptions, ActorMethodArgs, ActorMethodReturnType, ActorMethodState, BaseActor, FunctionName } from "./actor/types";
|
|
6
7
|
import type { AgentManager } from "./agent";
|
|
7
8
|
import type { AuthClientLoginOptions } from "@dfinity/auth-client";
|
|
9
|
+
export * from "./agent/types";
|
|
10
|
+
export * from "./actor/types";
|
|
11
|
+
export * from "./tools/types";
|
|
8
12
|
export type { ActorMethod, HttpAgentOptions, ActorSubclass, Principal, HttpAgent, Identity, IDL, };
|
|
9
13
|
export interface CreateReActorOptions extends CreateReActorStoreOptions {
|
|
10
14
|
}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./agent/types"), exports);
|
|
18
|
+
__exportStar(require("./actor/types"), exports);
|
|
19
|
+
__exportStar(require("./tools/types"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ic-reactor/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/b3hr4d/ic-reactor/issues"
|
|
26
26
|
},
|
|
27
|
-
"homepage": "https://github.
|
|
27
|
+
"homepage": "https://b3pay.github.io/ic-reactor/modules/core.html",
|
|
28
28
|
"peerDependencies": {
|
|
29
29
|
"@dfinity/agent": ">=1.0",
|
|
30
30
|
"@dfinity/auth-client": ">=1.0",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=10"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "54c9942a98bcad64e63c8d52788103f8b168720e"
|
|
47
47
|
}
|