@junobuild/admin 0.0.8 → 0.0.10
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/browser/index.js +8 -8
- package/dist/browser/index.js.map +4 -4
- package/dist/declarations/cmc/cmc.did.d.ts +30 -30
- package/dist/declarations/cmc/cmc.factory.did.js +63 -63
- package/dist/declarations/cmc/index.d.ts +18 -18
- package/dist/declarations/cmc/index.js +22 -22
- package/dist/declarations/console/console.did.d.ts +37 -37
- package/dist/declarations/console/console.factory.did.js +60 -60
- package/dist/declarations/console/console.factory.did.mjs +60 -60
- package/dist/declarations/console/index.d.ts +18 -18
- package/dist/declarations/console/index.js +22 -22
- package/dist/declarations/frontend/frontend.did.d.ts +136 -136
- package/dist/declarations/frontend/frontend.factory.did.js +206 -206
- package/dist/declarations/frontend/index.d.ts +18 -18
- package/dist/declarations/frontend/index.js +22 -22
- package/dist/declarations/ic/ic.did.d.ts +63 -63
- package/dist/declarations/ic/ic.factory.did.js +126 -126
- package/dist/declarations/internet_identity/index.d.ts +18 -18
- package/dist/declarations/internet_identity/index.js +22 -22
- package/dist/declarations/internet_identity/internet_identity.did.d.ts +136 -136
- package/dist/declarations/internet_identity/internet_identity.factory.did.js +231 -231
- package/dist/declarations/ledger/index.d.ts +18 -18
- package/dist/declarations/ledger/index.js +22 -22
- package/dist/declarations/ledger/ledger.did.d.ts +64 -64
- package/dist/declarations/ledger/ledger.factory.did.js +96 -96
- package/dist/declarations/mission_control/index.d.ts +18 -18
- package/dist/declarations/mission_control/index.js +22 -22
- package/dist/declarations/mission_control/mission_control.did.d.ts +30 -30
- package/dist/declarations/mission_control/mission_control.factory.did.js +48 -48
- package/dist/declarations/satellite/index.d.ts +18 -18
- package/dist/declarations/satellite/index.js +22 -22
- package/dist/declarations/satellite/satellite-deprecated.did.d.ts +120 -124
- package/dist/declarations/satellite/satellite-deprecated.factory.did.js +189 -189
- package/dist/declarations/satellite/satellite-deprecated.factory.did.mjs +189 -189
- package/dist/declarations/satellite/satellite.did.d.ts +121 -124
- package/dist/declarations/satellite/satellite.factory.did.js +192 -189
- package/dist/declarations/satellite/satellite.factory.did.mjs +190 -189
- package/dist/node/index.mjs +22 -22
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/satellite.api.d.ts +11 -1
- package/dist/types/constants/rules.constants.d.ts +7 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/services/satellite.services.d.ts +10 -0
- package/dist/types/types/rules.types.d.ts +10 -0
- package/dist/types/utils/did.utils.d.ts +4 -0
- package/dist/types/utils/rule.utils.d.ts +6 -0
- package/dist/types/utils/utils.d.ts +7 -0
- package/package.json +1 -1
|
@@ -1,233 +1,233 @@
|
|
|
1
|
-
export const idlFactory = ({
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
1
|
+
export const idlFactory = ({IDL}) => {
|
|
2
|
+
const ArchiveConfig = IDL.Record({
|
|
3
|
+
polling_interval_ns: IDL.Nat64,
|
|
4
|
+
entries_buffer_limit: IDL.Nat64,
|
|
5
|
+
module_hash: IDL.Vec(IDL.Nat8),
|
|
6
|
+
entries_fetch_limit: IDL.Nat16
|
|
7
|
+
});
|
|
8
|
+
const RateLimitConfig = IDL.Record({
|
|
9
|
+
max_tokens: IDL.Nat64,
|
|
10
|
+
time_per_token_ns: IDL.Nat64
|
|
11
|
+
});
|
|
12
|
+
const InternetIdentityInit = IDL.Record({
|
|
13
|
+
assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
|
|
14
|
+
archive_config: IDL.Opt(ArchiveConfig),
|
|
15
|
+
canister_creation_cycles_cost: IDL.Opt(IDL.Nat64),
|
|
16
|
+
register_rate_limit: IDL.Opt(RateLimitConfig)
|
|
17
|
+
});
|
|
18
|
+
const UserNumber = IDL.Nat64;
|
|
19
|
+
const DeviceProtection = IDL.Variant({
|
|
20
|
+
unprotected: IDL.Null,
|
|
21
|
+
protected: IDL.Null
|
|
22
|
+
});
|
|
23
|
+
const PublicKey = IDL.Vec(IDL.Nat8);
|
|
24
|
+
const DeviceKey = PublicKey;
|
|
25
|
+
const KeyType = IDL.Variant({
|
|
26
|
+
platform: IDL.Null,
|
|
27
|
+
seed_phrase: IDL.Null,
|
|
28
|
+
cross_platform: IDL.Null,
|
|
29
|
+
unknown: IDL.Null
|
|
30
|
+
});
|
|
31
|
+
const Purpose = IDL.Variant({
|
|
32
|
+
authentication: IDL.Null,
|
|
33
|
+
recovery: IDL.Null
|
|
34
|
+
});
|
|
35
|
+
const CredentialId = IDL.Vec(IDL.Nat8);
|
|
36
|
+
const DeviceData = IDL.Record({
|
|
37
|
+
alias: IDL.Text,
|
|
38
|
+
origin: IDL.Opt(IDL.Text),
|
|
39
|
+
protection: DeviceProtection,
|
|
40
|
+
pubkey: DeviceKey,
|
|
41
|
+
key_type: KeyType,
|
|
42
|
+
purpose: Purpose,
|
|
43
|
+
credential_id: IDL.Opt(CredentialId)
|
|
44
|
+
});
|
|
45
|
+
const Timestamp = IDL.Nat64;
|
|
46
|
+
const AddTentativeDeviceResponse = IDL.Variant({
|
|
47
|
+
device_registration_mode_off: IDL.Null,
|
|
48
|
+
another_device_tentatively_added: IDL.Null,
|
|
49
|
+
added_tentatively: IDL.Record({
|
|
50
|
+
verification_code: IDL.Text,
|
|
51
|
+
device_registration_timeout: Timestamp
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
const ChallengeKey = IDL.Text;
|
|
55
|
+
const Challenge = IDL.Record({
|
|
56
|
+
png_base64: IDL.Text,
|
|
57
|
+
challenge_key: ChallengeKey
|
|
58
|
+
});
|
|
59
|
+
const DeployArchiveResult = IDL.Variant({
|
|
60
|
+
creation_in_progress: IDL.Null,
|
|
61
|
+
success: IDL.Principal,
|
|
62
|
+
failed: IDL.Text
|
|
63
|
+
});
|
|
64
|
+
const BufferedArchiveEntry = IDL.Record({
|
|
65
|
+
sequence_number: IDL.Nat64,
|
|
66
|
+
entry: IDL.Vec(IDL.Nat8),
|
|
67
|
+
anchor_number: UserNumber,
|
|
68
|
+
timestamp: Timestamp
|
|
69
|
+
});
|
|
70
|
+
const WebAuthnCredential = IDL.Record({
|
|
71
|
+
pubkey: PublicKey,
|
|
72
|
+
credential_id: CredentialId
|
|
73
|
+
});
|
|
74
|
+
const AnchorCredentials = IDL.Record({
|
|
75
|
+
recovery_phrases: IDL.Vec(PublicKey),
|
|
76
|
+
credentials: IDL.Vec(WebAuthnCredential),
|
|
77
|
+
recovery_credentials: IDL.Vec(WebAuthnCredential)
|
|
78
|
+
});
|
|
79
|
+
const DeviceWithUsage = IDL.Record({
|
|
80
|
+
alias: IDL.Text,
|
|
81
|
+
last_usage: IDL.Opt(Timestamp),
|
|
82
|
+
origin: IDL.Opt(IDL.Text),
|
|
83
|
+
protection: DeviceProtection,
|
|
84
|
+
pubkey: DeviceKey,
|
|
85
|
+
key_type: KeyType,
|
|
86
|
+
purpose: Purpose,
|
|
87
|
+
credential_id: IDL.Opt(CredentialId)
|
|
88
|
+
});
|
|
89
|
+
const DeviceRegistrationInfo = IDL.Record({
|
|
90
|
+
tentative_device: IDL.Opt(DeviceData),
|
|
91
|
+
expiration: Timestamp
|
|
92
|
+
});
|
|
93
|
+
const IdentityAnchorInfo = IDL.Record({
|
|
94
|
+
devices: IDL.Vec(DeviceWithUsage),
|
|
95
|
+
device_registration: IDL.Opt(DeviceRegistrationInfo)
|
|
96
|
+
});
|
|
97
|
+
const FrontendHostname = IDL.Text;
|
|
98
|
+
const SessionKey = PublicKey;
|
|
99
|
+
const Delegation = IDL.Record({
|
|
100
|
+
pubkey: PublicKey,
|
|
101
|
+
targets: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
102
|
+
expiration: Timestamp
|
|
103
|
+
});
|
|
104
|
+
const SignedDelegation = IDL.Record({
|
|
105
|
+
signature: IDL.Vec(IDL.Nat8),
|
|
106
|
+
delegation: Delegation
|
|
107
|
+
});
|
|
108
|
+
const GetDelegationResponse = IDL.Variant({
|
|
109
|
+
no_such_delegation: IDL.Null,
|
|
110
|
+
signed_delegation: SignedDelegation
|
|
111
|
+
});
|
|
112
|
+
const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
|
|
113
|
+
const HttpRequest = IDL.Record({
|
|
114
|
+
url: IDL.Text,
|
|
115
|
+
method: IDL.Text,
|
|
116
|
+
body: IDL.Vec(IDL.Nat8),
|
|
117
|
+
headers: IDL.Vec(HeaderField)
|
|
118
|
+
});
|
|
119
|
+
const Token = IDL.Record({});
|
|
120
|
+
const StreamingCallbackHttpResponse = IDL.Record({
|
|
121
|
+
token: IDL.Opt(Token),
|
|
122
|
+
body: IDL.Vec(IDL.Nat8)
|
|
123
|
+
});
|
|
124
|
+
const StreamingStrategy = IDL.Variant({
|
|
125
|
+
Callback: IDL.Record({
|
|
126
|
+
token: Token,
|
|
127
|
+
callback: IDL.Func([Token], [StreamingCallbackHttpResponse], ['query'])
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
const HttpResponse = IDL.Record({
|
|
131
|
+
body: IDL.Vec(IDL.Nat8),
|
|
132
|
+
headers: IDL.Vec(HeaderField),
|
|
133
|
+
upgrade: IDL.Opt(IDL.Bool),
|
|
134
|
+
streaming_strategy: IDL.Opt(StreamingStrategy),
|
|
135
|
+
status_code: IDL.Nat16
|
|
136
|
+
});
|
|
137
|
+
const UserKey = PublicKey;
|
|
138
|
+
const ChallengeResult = IDL.Record({
|
|
139
|
+
key: ChallengeKey,
|
|
140
|
+
chars: IDL.Text
|
|
141
|
+
});
|
|
142
|
+
const RegisterResponse = IDL.Variant({
|
|
143
|
+
bad_challenge: IDL.Null,
|
|
144
|
+
canister_full: IDL.Null,
|
|
145
|
+
registered: IDL.Record({user_number: UserNumber})
|
|
146
|
+
});
|
|
147
|
+
const ArchiveInfo = IDL.Record({
|
|
148
|
+
archive_config: IDL.Opt(ArchiveConfig),
|
|
149
|
+
archive_canister: IDL.Opt(IDL.Principal)
|
|
150
|
+
});
|
|
151
|
+
const ActiveAnchorCounter = IDL.Record({
|
|
152
|
+
counter: IDL.Nat64,
|
|
153
|
+
start_timestamp: Timestamp
|
|
154
|
+
});
|
|
155
|
+
const CompletedActiveAnchorStats = IDL.Record({
|
|
156
|
+
monthly_active_anchors: IDL.Opt(ActiveAnchorCounter),
|
|
157
|
+
daily_active_anchors: IDL.Opt(ActiveAnchorCounter)
|
|
158
|
+
});
|
|
159
|
+
const OngoingActiveAnchorStats = IDL.Record({
|
|
160
|
+
monthly_active_anchors: IDL.Vec(ActiveAnchorCounter),
|
|
161
|
+
daily_active_anchors: ActiveAnchorCounter
|
|
162
|
+
});
|
|
163
|
+
const ActiveAnchorStatistics = IDL.Record({
|
|
164
|
+
completed: CompletedActiveAnchorStats,
|
|
165
|
+
ongoing: OngoingActiveAnchorStats
|
|
166
|
+
});
|
|
167
|
+
const InternetIdentityStats = IDL.Record({
|
|
168
|
+
storage_layout_version: IDL.Nat8,
|
|
169
|
+
users_registered: IDL.Nat64,
|
|
170
|
+
assigned_user_number_range: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
|
171
|
+
archive_info: ArchiveInfo,
|
|
172
|
+
canister_creation_cycles_cost: IDL.Nat64,
|
|
173
|
+
active_anchor_stats: IDL.Opt(ActiveAnchorStatistics)
|
|
174
|
+
});
|
|
175
|
+
const VerifyTentativeDeviceResponse = IDL.Variant({
|
|
176
|
+
device_registration_mode_off: IDL.Null,
|
|
177
|
+
verified: IDL.Null,
|
|
178
|
+
wrong_code: IDL.Record({retries_left: IDL.Nat8}),
|
|
179
|
+
no_device_to_verify: IDL.Null
|
|
180
|
+
});
|
|
181
|
+
return IDL.Service({
|
|
182
|
+
acknowledge_entries: IDL.Func([IDL.Nat64], [], []),
|
|
183
|
+
add: IDL.Func([UserNumber, DeviceData], [], []),
|
|
184
|
+
add_tentative_device: IDL.Func([UserNumber, DeviceData], [AddTentativeDeviceResponse], []),
|
|
185
|
+
create_challenge: IDL.Func([], [Challenge], []),
|
|
186
|
+
deploy_archive: IDL.Func([IDL.Vec(IDL.Nat8)], [DeployArchiveResult], []),
|
|
187
|
+
enter_device_registration_mode: IDL.Func([UserNumber], [Timestamp], []),
|
|
188
|
+
exit_device_registration_mode: IDL.Func([UserNumber], [], []),
|
|
189
|
+
fetch_entries: IDL.Func([], [IDL.Vec(BufferedArchiveEntry)], []),
|
|
190
|
+
get_anchor_credentials: IDL.Func([UserNumber], [AnchorCredentials], ['query']),
|
|
191
|
+
get_anchor_info: IDL.Func([UserNumber], [IdentityAnchorInfo], []),
|
|
192
|
+
get_delegation: IDL.Func(
|
|
193
|
+
[UserNumber, FrontendHostname, SessionKey, Timestamp],
|
|
194
|
+
[GetDelegationResponse],
|
|
195
|
+
['query']
|
|
196
|
+
),
|
|
197
|
+
get_principal: IDL.Func([UserNumber, FrontendHostname], [IDL.Principal], ['query']),
|
|
198
|
+
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
199
|
+
http_request_update: IDL.Func([HttpRequest], [HttpResponse], []),
|
|
200
|
+
init_salt: IDL.Func([], [], []),
|
|
201
|
+
lookup: IDL.Func([UserNumber], [IDL.Vec(DeviceData)], ['query']),
|
|
202
|
+
prepare_delegation: IDL.Func(
|
|
203
|
+
[UserNumber, FrontendHostname, SessionKey, IDL.Opt(IDL.Nat64)],
|
|
204
|
+
[UserKey, Timestamp],
|
|
205
|
+
[]
|
|
206
|
+
),
|
|
207
|
+
register: IDL.Func([DeviceData, ChallengeResult], [RegisterResponse], []),
|
|
208
|
+
remove: IDL.Func([UserNumber, DeviceKey], [], []),
|
|
209
|
+
replace: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []),
|
|
210
|
+
stats: IDL.Func([], [InternetIdentityStats], ['query']),
|
|
211
|
+
update: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []),
|
|
212
|
+
verify_tentative_device: IDL.Func([UserNumber, IDL.Text], [VerifyTentativeDeviceResponse], [])
|
|
213
|
+
});
|
|
214
214
|
};
|
|
215
|
-
export const init = ({
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
215
|
+
export const init = ({IDL}) => {
|
|
216
|
+
const ArchiveConfig = IDL.Record({
|
|
217
|
+
polling_interval_ns: IDL.Nat64,
|
|
218
|
+
entries_buffer_limit: IDL.Nat64,
|
|
219
|
+
module_hash: IDL.Vec(IDL.Nat8),
|
|
220
|
+
entries_fetch_limit: IDL.Nat16
|
|
221
|
+
});
|
|
222
|
+
const RateLimitConfig = IDL.Record({
|
|
223
|
+
max_tokens: IDL.Nat64,
|
|
224
|
+
time_per_token_ns: IDL.Nat64
|
|
225
|
+
});
|
|
226
|
+
const InternetIdentityInit = IDL.Record({
|
|
227
|
+
assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)),
|
|
228
|
+
archive_config: IDL.Opt(ArchiveConfig),
|
|
229
|
+
canister_creation_cycles_cost: IDL.Opt(IDL.Nat64),
|
|
230
|
+
register_rate_limit: IDL.Opt(RateLimitConfig)
|
|
231
|
+
});
|
|
232
|
+
return [IDL.Opt(InternetIdentityInit)];
|
|
233
233
|
};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
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
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {_SERVICE} from './ledger.did';
|
|
6
6
|
|
|
7
7
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
8
8
|
export declare const canisterId: string;
|
|
9
9
|
|
|
10
10
|
export declare interface CreateActorOptions {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
23
|
}
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -34,8 +34,8 @@ export declare interface CreateActorOptions {
|
|
|
34
34
|
* @see {@link ActorConfig}
|
|
35
35
|
*/
|
|
36
36
|
export declare const createActor: (
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
canisterId: string | Principal,
|
|
38
|
+
options?: CreateActorOptions
|
|
39
39
|
) => ActorSubclass<_SERVICE>;
|
|
40
40
|
|
|
41
41
|
/**
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
2
|
|
|
3
3
|
// Imports and re-exports candid interface
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import {idlFactory} from './ledger.did.js';
|
|
5
|
+
export {idlFactory} from './ledger.did.js';
|
|
6
6
|
|
|
7
7
|
// CANISTER_ID is replaced by webpack based on node environment
|
|
8
8
|
|
|
9
9
|
export const createActor = (canisterId, options = {}) => {
|
|
10
|
-
|
|
10
|
+
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
32
|
};
|