@junobuild/admin 0.0.20 → 0.0.22
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/declarations/cmc/index.js +6 -1
- package/declarations/console/console.did.d.ts +5 -4
- package/declarations/console/console.factory.did.js +3 -2
- package/declarations/console/console.factory.did.mjs +3 -2
- package/declarations/console/index.js +6 -1
- package/declarations/ic/ic.did +131 -18
- package/declarations/ic/ic.did.d.ts +184 -53
- package/declarations/ic/ic.factory.did.js +167 -24
- package/declarations/mission_control/index.js +7 -1
- package/declarations/mission_control/mission_control.did.d.ts +1 -0
- package/declarations/mission_control/mission_control.factory.did.js +5 -0
- package/declarations/observatory/index.js +7 -1
- package/declarations/satellite/index.js +6 -1
- package/declarations/satellite/satellite.did.d.ts +1 -0
- package/declarations/satellite/satellite.factory.did.js +1 -0
- package/declarations/satellite/satellite.factory.did.mjs +1 -0
- package/dist/browser/index.js +12 -30
- package/dist/browser/index.js.map +4 -4
- package/dist/declarations/cmc/index.js +6 -1
- package/dist/declarations/console/console.did.d.ts +5 -4
- package/dist/declarations/console/console.factory.did.js +3 -2
- package/dist/declarations/console/console.factory.did.mjs +3 -2
- package/dist/declarations/console/index.js +6 -1
- package/dist/declarations/ic/ic.did +131 -18
- package/dist/declarations/ic/ic.did.d.ts +184 -53
- package/dist/declarations/ic/ic.factory.did.js +167 -24
- package/dist/declarations/mission_control/index.js +7 -1
- package/dist/declarations/mission_control/mission_control.did.d.ts +1 -0
- package/dist/declarations/mission_control/mission_control.factory.did.js +5 -0
- package/dist/declarations/observatory/index.js +7 -1
- package/dist/declarations/satellite/index.js +6 -1
- package/dist/declarations/satellite/satellite.did.d.ts +1 -0
- package/dist/declarations/satellite/satellite.factory.did.js +1 -0
- package/dist/declarations/satellite/satellite.factory.did.mjs +1 -0
- package/dist/node/index.mjs +7 -63
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/ic.api.d.ts +1 -1
- package/dist/types/constants/config.constants.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/services/mission-control.services.d.ts +1 -1
- package/dist/types/services/releases.services.d.ts +6 -0
- package/dist/types/services/satellite.services.d.ts +2 -2
- package/dist/types/types/config.types.d.ts +9 -3
- package/dist/types/types/ic.types.d.ts +2 -1
- package/dist/types/types/releases.types.d.ts +12 -0
- package/package.json +8 -6
- package/declarations/frontend/frontend.did +0 -188
- package/declarations/frontend/frontend.did.d.ts +0 -172
- package/declarations/frontend/frontend.factory.did.js +0 -210
- package/declarations/frontend/index.d.ts +0 -45
- package/declarations/frontend/index.js +0 -32
- package/declarations/internet_identity/index.d.ts +0 -45
- package/declarations/internet_identity/index.js +0 -32
- package/declarations/internet_identity/internet_identity.did +0 -378
- package/declarations/internet_identity/internet_identity.did.d.ts +0 -231
- package/declarations/internet_identity/internet_identity.factory.did.js +0 -277
- package/declarations/ledger/index.d.ts +0 -45
- package/declarations/ledger/index.js +0 -32
- package/declarations/ledger/ledger.did +0 -266
- package/declarations/ledger/ledger.did.d.ts +0 -117
- package/declarations/ledger/ledger.factory.did.js +0 -115
- package/dist/browser/canisterStatus-MAYNIE3Q.js +0 -2
- package/dist/browser/canisterStatus-MAYNIE3Q.js.map +0 -7
- package/dist/browser/chunk-ZTILA2YH.js +0 -35
- package/dist/browser/chunk-ZTILA2YH.js.map +0 -7
- package/dist/declarations/frontend/frontend.did +0 -188
- package/dist/declarations/frontend/frontend.did.d.ts +0 -172
- package/dist/declarations/frontend/frontend.factory.did.js +0 -210
- package/dist/declarations/frontend/index.d.ts +0 -45
- package/dist/declarations/frontend/index.js +0 -32
- package/dist/declarations/internet_identity/index.d.ts +0 -45
- package/dist/declarations/internet_identity/index.js +0 -32
- package/dist/declarations/internet_identity/internet_identity.did +0 -378
- package/dist/declarations/internet_identity/internet_identity.did.d.ts +0 -231
- package/dist/declarations/internet_identity/internet_identity.factory.did.js +0 -277
- package/dist/declarations/ledger/index.d.ts +0 -45
- package/dist/declarations/ledger/index.js +0 -32
- package/dist/declarations/ledger/ledger.did +0 -266
- package/dist/declarations/ledger/ledger.did.d.ts +0 -117
- package/dist/declarations/ledger/ledger.factory.did.js +0 -115
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
export const idlFactory = ({IDL}) => {
|
|
3
|
-
const ClearArguments = IDL.Record({});
|
|
4
|
-
const BatchId = IDL.Nat;
|
|
5
|
-
const Key = IDL.Text;
|
|
6
|
-
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
|
|
7
|
-
const CreateAssetArguments = IDL.Record({
|
|
8
|
-
key: Key,
|
|
9
|
-
content_type: IDL.Text,
|
|
10
|
-
headers: IDL.Opt(IDL.Vec(HeaderField)),
|
|
11
|
-
allow_raw_access: IDL.Opt(IDL.Bool),
|
|
12
|
-
max_age: IDL.Opt(IDL.Nat64),
|
|
13
|
-
enable_aliasing: IDL.Opt(IDL.Bool)
|
|
14
|
-
});
|
|
15
|
-
const UnsetAssetContentArguments = IDL.Record({
|
|
16
|
-
key: Key,
|
|
17
|
-
content_encoding: IDL.Text
|
|
18
|
-
});
|
|
19
|
-
const DeleteAssetArguments = IDL.Record({key: Key});
|
|
20
|
-
const ChunkId = IDL.Nat;
|
|
21
|
-
const SetAssetContentArguments = IDL.Record({
|
|
22
|
-
key: Key,
|
|
23
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
24
|
-
chunk_ids: IDL.Vec(ChunkId),
|
|
25
|
-
content_encoding: IDL.Text
|
|
26
|
-
});
|
|
27
|
-
const BatchOperationKind = IDL.Variant({
|
|
28
|
-
CreateAsset: CreateAssetArguments,
|
|
29
|
-
UnsetAssetContent: UnsetAssetContentArguments,
|
|
30
|
-
DeleteAsset: DeleteAssetArguments,
|
|
31
|
-
SetAssetContent: SetAssetContentArguments,
|
|
32
|
-
Clear: ClearArguments
|
|
33
|
-
});
|
|
34
|
-
const Permission = IDL.Variant({
|
|
35
|
-
Prepare: IDL.Null,
|
|
36
|
-
ManagePermissions: IDL.Null,
|
|
37
|
-
Commit: IDL.Null
|
|
38
|
-
});
|
|
39
|
-
const GrantPermission = IDL.Record({
|
|
40
|
-
permission: Permission,
|
|
41
|
-
to_principal: IDL.Principal
|
|
42
|
-
});
|
|
43
|
-
const HttpRequest = IDL.Record({
|
|
44
|
-
url: IDL.Text,
|
|
45
|
-
method: IDL.Text,
|
|
46
|
-
body: IDL.Vec(IDL.Nat8),
|
|
47
|
-
headers: IDL.Vec(HeaderField)
|
|
48
|
-
});
|
|
49
|
-
const StreamingCallbackToken = IDL.Record({
|
|
50
|
-
key: Key,
|
|
51
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
52
|
-
index: IDL.Nat,
|
|
53
|
-
content_encoding: IDL.Text
|
|
54
|
-
});
|
|
55
|
-
const StreamingCallbackHttpResponse = IDL.Record({
|
|
56
|
-
token: IDL.Opt(StreamingCallbackToken),
|
|
57
|
-
body: IDL.Vec(IDL.Nat8)
|
|
58
|
-
});
|
|
59
|
-
const StreamingStrategy = IDL.Variant({
|
|
60
|
-
Callback: IDL.Record({
|
|
61
|
-
token: StreamingCallbackToken,
|
|
62
|
-
callback: IDL.Func(
|
|
63
|
-
[StreamingCallbackToken],
|
|
64
|
-
[IDL.Opt(StreamingCallbackHttpResponse)],
|
|
65
|
-
['query']
|
|
66
|
-
)
|
|
67
|
-
})
|
|
68
|
-
});
|
|
69
|
-
const HttpResponse = IDL.Record({
|
|
70
|
-
body: IDL.Vec(IDL.Nat8),
|
|
71
|
-
headers: IDL.Vec(HeaderField),
|
|
72
|
-
streaming_strategy: IDL.Opt(StreamingStrategy),
|
|
73
|
-
status_code: IDL.Nat16
|
|
74
|
-
});
|
|
75
|
-
const Time = IDL.Int;
|
|
76
|
-
const ListPermitted = IDL.Record({permission: Permission});
|
|
77
|
-
const RevokePermission = IDL.Record({
|
|
78
|
-
permission: Permission,
|
|
79
|
-
of_principal: IDL.Principal
|
|
80
|
-
});
|
|
81
|
-
const SetAssetPropertiesArguments = IDL.Record({
|
|
82
|
-
key: Key,
|
|
83
|
-
headers: IDL.Opt(IDL.Opt(IDL.Vec(HeaderField))),
|
|
84
|
-
allow_raw_access: IDL.Opt(IDL.Opt(IDL.Bool)),
|
|
85
|
-
max_age: IDL.Opt(IDL.Opt(IDL.Nat64))
|
|
86
|
-
});
|
|
87
|
-
const ValidationResult = IDL.Variant({Ok: IDL.Text, Err: IDL.Text});
|
|
88
|
-
return IDL.Service({
|
|
89
|
-
authorize: IDL.Func([IDL.Principal], [], []),
|
|
90
|
-
certified_tree: IDL.Func(
|
|
91
|
-
[IDL.Record({})],
|
|
92
|
-
[
|
|
93
|
-
IDL.Record({
|
|
94
|
-
certificate: IDL.Vec(IDL.Nat8),
|
|
95
|
-
tree: IDL.Vec(IDL.Nat8)
|
|
96
|
-
})
|
|
97
|
-
],
|
|
98
|
-
['query']
|
|
99
|
-
),
|
|
100
|
-
clear: IDL.Func([ClearArguments], [], []),
|
|
101
|
-
commit_batch: IDL.Func(
|
|
102
|
-
[
|
|
103
|
-
IDL.Record({
|
|
104
|
-
batch_id: BatchId,
|
|
105
|
-
operations: IDL.Vec(BatchOperationKind)
|
|
106
|
-
})
|
|
107
|
-
],
|
|
108
|
-
[],
|
|
109
|
-
[]
|
|
110
|
-
),
|
|
111
|
-
create_asset: IDL.Func([CreateAssetArguments], [], []),
|
|
112
|
-
create_batch: IDL.Func([IDL.Record({})], [IDL.Record({batch_id: BatchId})], []),
|
|
113
|
-
create_chunk: IDL.Func(
|
|
114
|
-
[IDL.Record({content: IDL.Vec(IDL.Nat8), batch_id: BatchId})],
|
|
115
|
-
[IDL.Record({chunk_id: ChunkId})],
|
|
116
|
-
[]
|
|
117
|
-
),
|
|
118
|
-
deauthorize: IDL.Func([IDL.Principal], [], []),
|
|
119
|
-
delete_asset: IDL.Func([DeleteAssetArguments], [], []),
|
|
120
|
-
get: IDL.Func(
|
|
121
|
-
[IDL.Record({key: Key, accept_encodings: IDL.Vec(IDL.Text)})],
|
|
122
|
-
[
|
|
123
|
-
IDL.Record({
|
|
124
|
-
content: IDL.Vec(IDL.Nat8),
|
|
125
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
126
|
-
content_type: IDL.Text,
|
|
127
|
-
content_encoding: IDL.Text,
|
|
128
|
-
total_length: IDL.Nat
|
|
129
|
-
})
|
|
130
|
-
],
|
|
131
|
-
['query']
|
|
132
|
-
),
|
|
133
|
-
get_asset_properties: IDL.Func(
|
|
134
|
-
[Key],
|
|
135
|
-
[
|
|
136
|
-
IDL.Record({
|
|
137
|
-
headers: IDL.Opt(IDL.Vec(HeaderField)),
|
|
138
|
-
allow_raw_access: IDL.Opt(IDL.Bool),
|
|
139
|
-
max_age: IDL.Opt(IDL.Nat64)
|
|
140
|
-
})
|
|
141
|
-
],
|
|
142
|
-
['query']
|
|
143
|
-
),
|
|
144
|
-
get_chunk: IDL.Func(
|
|
145
|
-
[
|
|
146
|
-
IDL.Record({
|
|
147
|
-
key: Key,
|
|
148
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
149
|
-
index: IDL.Nat,
|
|
150
|
-
content_encoding: IDL.Text
|
|
151
|
-
})
|
|
152
|
-
],
|
|
153
|
-
[IDL.Record({content: IDL.Vec(IDL.Nat8)})],
|
|
154
|
-
['query']
|
|
155
|
-
),
|
|
156
|
-
grant_permission: IDL.Func([GrantPermission], [], []),
|
|
157
|
-
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
158
|
-
http_request_streaming_callback: IDL.Func(
|
|
159
|
-
[StreamingCallbackToken],
|
|
160
|
-
[IDL.Opt(StreamingCallbackHttpResponse)],
|
|
161
|
-
['query']
|
|
162
|
-
),
|
|
163
|
-
list: IDL.Func(
|
|
164
|
-
[IDL.Record({})],
|
|
165
|
-
[
|
|
166
|
-
IDL.Vec(
|
|
167
|
-
IDL.Record({
|
|
168
|
-
key: Key,
|
|
169
|
-
encodings: IDL.Vec(
|
|
170
|
-
IDL.Record({
|
|
171
|
-
modified: Time,
|
|
172
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
173
|
-
length: IDL.Nat,
|
|
174
|
-
content_encoding: IDL.Text
|
|
175
|
-
})
|
|
176
|
-
),
|
|
177
|
-
content_type: IDL.Text
|
|
178
|
-
})
|
|
179
|
-
)
|
|
180
|
-
],
|
|
181
|
-
['query']
|
|
182
|
-
),
|
|
183
|
-
list_authorized: IDL.Func([], [IDL.Vec(IDL.Principal)], ['query']),
|
|
184
|
-
list_permitted: IDL.Func([ListPermitted], [IDL.Vec(IDL.Principal)], ['query']),
|
|
185
|
-
revoke_permission: IDL.Func([RevokePermission], [], []),
|
|
186
|
-
set_asset_content: IDL.Func([SetAssetContentArguments], [], []),
|
|
187
|
-
set_asset_properties: IDL.Func([SetAssetPropertiesArguments], [], []),
|
|
188
|
-
store: IDL.Func(
|
|
189
|
-
[
|
|
190
|
-
IDL.Record({
|
|
191
|
-
key: Key,
|
|
192
|
-
content: IDL.Vec(IDL.Nat8),
|
|
193
|
-
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
194
|
-
content_type: IDL.Text,
|
|
195
|
-
content_encoding: IDL.Text
|
|
196
|
-
})
|
|
197
|
-
],
|
|
198
|
-
[],
|
|
199
|
-
[]
|
|
200
|
-
),
|
|
201
|
-
take_ownership: IDL.Func([], [], []),
|
|
202
|
-
unset_asset_content: IDL.Func([UnsetAssetContentArguments], [], []),
|
|
203
|
-
validate_grant_permission: IDL.Func([GrantPermission], [ValidationResult], []),
|
|
204
|
-
validate_revoke_permission: IDL.Func([RevokePermission], [ValidationResult], [])
|
|
205
|
-
});
|
|
206
|
-
};
|
|
207
|
-
// @ts-ignore
|
|
208
|
-
export const init = ({IDL}) => {
|
|
209
|
-
return [];
|
|
210
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type {ActorConfig, ActorSubclass, Agent, HttpAgentOptions} from '@dfinity/agent';
|
|
2
|
-
import type {IDL} from '@dfinity/candid';
|
|
3
|
-
import type {Principal} from '@dfinity/principal';
|
|
4
|
-
|
|
5
|
-
import {_SERVICE} from './frontend.did';
|
|
6
|
-
|
|
7
|
-
export declare const idlFactory: IDL.InterfaceFactory;
|
|
8
|
-
export declare const canisterId: string;
|
|
9
|
-
|
|
10
|
-
export declare interface CreateActorOptions {
|
|
11
|
-
/**
|
|
12
|
-
* @see {@link Agent}
|
|
13
|
-
*/
|
|
14
|
-
agent?: Agent;
|
|
15
|
-
/**
|
|
16
|
-
* @see {@link HttpAgentOptions}
|
|
17
|
-
*/
|
|
18
|
-
agentOptions?: HttpAgentOptions;
|
|
19
|
-
/**
|
|
20
|
-
* @see {@link ActorConfig}
|
|
21
|
-
*/
|
|
22
|
-
actorOptions?: ActorConfig;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
|
|
27
|
-
* @constructs {@link ActorSubClass}
|
|
28
|
-
* @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
|
|
29
|
-
* @param {CreateActorOptions} options - see {@link CreateActorOptions}
|
|
30
|
-
* @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
|
|
31
|
-
* @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
|
|
32
|
-
* @see {@link HttpAgentOptions}
|
|
33
|
-
* @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
|
|
34
|
-
* @see {@link ActorConfig}
|
|
35
|
-
*/
|
|
36
|
-
export declare const createActor: (
|
|
37
|
-
canisterId: string | Principal,
|
|
38
|
-
options?: CreateActorOptions
|
|
39
|
-
) => ActorSubclass<_SERVICE>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Intialized Actor using default settings, ready to talk to a canister using its candid interface
|
|
43
|
-
* @constructs {@link ActorSubClass}
|
|
44
|
-
*/
|
|
45
|
-
export declare const frontend: ActorSubclass<_SERVICE>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
|
-
|
|
3
|
-
// Imports and re-exports candid interface
|
|
4
|
-
import {idlFactory} from './frontend.did.js';
|
|
5
|
-
export {idlFactory} from './frontend.did.js';
|
|
6
|
-
|
|
7
|
-
// CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
-
|
|
9
|
-
export const createActor = (canisterId, options = {}) => {
|
|
10
|
-
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
11
|
-
|
|
12
|
-
if (options.agent && options.agentOptions) {
|
|
13
|
-
console.warn(
|
|
14
|
-
'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Fetch root key for certificate validation during development
|
|
19
|
-
if (process.env.DFX_NETWORK !== 'ic') {
|
|
20
|
-
agent.fetchRootKey().catch((err) => {
|
|
21
|
-
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
|
|
22
|
-
console.error(err);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Creates an actor with using the candid interface and the HttpAgent
|
|
27
|
-
return Actor.createActor(idlFactory, {
|
|
28
|
-
agent,
|
|
29
|
-
canisterId,
|
|
30
|
-
...options.actorOptions
|
|
31
|
-
});
|
|
32
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type {ActorConfig, ActorSubclass, Agent, HttpAgentOptions} from '@dfinity/agent';
|
|
2
|
-
import type {IDL} from '@dfinity/candid';
|
|
3
|
-
import type {Principal} from '@dfinity/principal';
|
|
4
|
-
|
|
5
|
-
import {_SERVICE} from './internet_identity.did';
|
|
6
|
-
|
|
7
|
-
export declare const idlFactory: IDL.InterfaceFactory;
|
|
8
|
-
export declare const canisterId: string;
|
|
9
|
-
|
|
10
|
-
export declare interface CreateActorOptions {
|
|
11
|
-
/**
|
|
12
|
-
* @see {@link Agent}
|
|
13
|
-
*/
|
|
14
|
-
agent?: Agent;
|
|
15
|
-
/**
|
|
16
|
-
* @see {@link HttpAgentOptions}
|
|
17
|
-
*/
|
|
18
|
-
agentOptions?: HttpAgentOptions;
|
|
19
|
-
/**
|
|
20
|
-
* @see {@link ActorConfig}
|
|
21
|
-
*/
|
|
22
|
-
actorOptions?: ActorConfig;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
|
|
27
|
-
* @constructs {@link ActorSubClass}
|
|
28
|
-
* @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
|
|
29
|
-
* @param {CreateActorOptions} options - see {@link CreateActorOptions}
|
|
30
|
-
* @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
|
|
31
|
-
* @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
|
|
32
|
-
* @see {@link HttpAgentOptions}
|
|
33
|
-
* @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
|
|
34
|
-
* @see {@link ActorConfig}
|
|
35
|
-
*/
|
|
36
|
-
export declare const createActor: (
|
|
37
|
-
canisterId: string | Principal,
|
|
38
|
-
options?: CreateActorOptions
|
|
39
|
-
) => ActorSubclass<_SERVICE>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Intialized Actor using default settings, ready to talk to a canister using its candid interface
|
|
43
|
-
* @constructs {@link ActorSubClass}
|
|
44
|
-
*/
|
|
45
|
-
export declare const internet_identity: ActorSubclass<_SERVICE>;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
|
-
|
|
3
|
-
// Imports and re-exports candid interface
|
|
4
|
-
import {idlFactory} from './internet_identity.did.js';
|
|
5
|
-
export {idlFactory} from './internet_identity.did.js';
|
|
6
|
-
|
|
7
|
-
// CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
-
|
|
9
|
-
export const createActor = (canisterId, options = {}) => {
|
|
10
|
-
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
11
|
-
|
|
12
|
-
if (options.agent && options.agentOptions) {
|
|
13
|
-
console.warn(
|
|
14
|
-
'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Fetch root key for certificate validation during development
|
|
19
|
-
if (process.env.DFX_NETWORK !== 'ic') {
|
|
20
|
-
agent.fetchRootKey().catch((err) => {
|
|
21
|
-
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
|
|
22
|
-
console.error(err);
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Creates an actor with using the candid interface and the HttpAgent
|
|
27
|
-
return Actor.createActor(idlFactory, {
|
|
28
|
-
agent,
|
|
29
|
-
canisterId,
|
|
30
|
-
...options.actorOptions
|
|
31
|
-
});
|
|
32
|
-
};
|