@junobuild/admin 0.0.12 → 0.0.14

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.
Files changed (46) hide show
  1. package/README.md +1 -1
  2. package/declarations/cmc/cmc.did +122 -0
  3. package/declarations/cmc/cmc.did.d.ts +48 -0
  4. package/declarations/cmc/cmc.factory.did.js +65 -0
  5. package/declarations/cmc/index.d.ts +45 -0
  6. package/declarations/cmc/index.js +32 -0
  7. package/declarations/console/console.did.d.ts +60 -0
  8. package/declarations/console/console.factory.did.js +62 -0
  9. package/declarations/console/console.factory.did.mjs +62 -0
  10. package/declarations/console/index.d.ts +45 -0
  11. package/declarations/console/index.js +32 -0
  12. package/declarations/frontend/frontend.did +188 -0
  13. package/declarations/frontend/frontend.did.d.ts +172 -0
  14. package/declarations/frontend/frontend.factory.did.js +208 -0
  15. package/declarations/frontend/index.d.ts +45 -0
  16. package/declarations/frontend/index.js +32 -0
  17. package/declarations/ic/ic.did +82 -0
  18. package/declarations/ic/ic.did.d.ts +77 -0
  19. package/declarations/ic/ic.factory.did.js +128 -0
  20. package/declarations/internet_identity/index.d.ts +45 -0
  21. package/declarations/internet_identity/index.js +32 -0
  22. package/declarations/internet_identity/internet_identity.did +330 -0
  23. package/declarations/internet_identity/internet_identity.did.d.ts +204 -0
  24. package/declarations/internet_identity/internet_identity.factory.did.js +233 -0
  25. package/declarations/ledger/index.d.ts +45 -0
  26. package/declarations/ledger/index.js +32 -0
  27. package/declarations/ledger/ledger.did +249 -0
  28. package/declarations/ledger/ledger.did.d.ts +100 -0
  29. package/declarations/ledger/ledger.factory.did.js +98 -0
  30. package/declarations/mission_control/index.d.ts +45 -0
  31. package/declarations/mission_control/index.js +32 -0
  32. package/declarations/mission_control/mission_control.did.d.ts +41 -0
  33. package/declarations/mission_control/mission_control.factory.did.js +50 -0
  34. package/declarations/satellite/index.d.ts +45 -0
  35. package/declarations/satellite/index.js +32 -0
  36. package/declarations/satellite/satellite-deprecated.did.d.ts +182 -0
  37. package/declarations/satellite/satellite-deprecated.factory.did.js +191 -0
  38. package/declarations/satellite/satellite-deprecated.factory.did.mjs +191 -0
  39. package/declarations/satellite/satellite.did.d.ts +183 -0
  40. package/declarations/satellite/satellite.factory.did.js +194 -0
  41. package/declarations/satellite/satellite.factory.did.mjs +192 -0
  42. package/dist/browser/index.js +1 -1
  43. package/dist/browser/index.js.map +2 -2
  44. package/dist/node/index.mjs +1 -1
  45. package/dist/node/index.mjs.map +2 -2
  46. package/package.json +3 -3
@@ -0,0 +1,188 @@
1
+ type BatchId = nat;
2
+ type ChunkId = nat;
3
+ type Key = text;
4
+ type Time = int;
5
+
6
+ type CreateAssetArguments = record {
7
+ key: Key;
8
+ content_type: text;
9
+ max_age: opt nat64;
10
+ headers: opt vec HeaderField;
11
+ enable_aliasing: opt bool;
12
+ allow_raw_access: opt bool;
13
+ };
14
+
15
+ // Add or change content for an asset, by content encoding
16
+ type SetAssetContentArguments = record {
17
+ key: Key;
18
+ content_encoding: text;
19
+ chunk_ids: vec ChunkId;
20
+ sha256: opt blob;
21
+ };
22
+
23
+ // Remove content for an asset, by content encoding
24
+ type UnsetAssetContentArguments = record {
25
+ key: Key;
26
+ content_encoding: text;
27
+ };
28
+
29
+ // Delete an asset
30
+ type DeleteAssetArguments = record {
31
+ key: Key;
32
+ };
33
+
34
+ // Reset everything
35
+ type ClearArguments = record {};
36
+
37
+ type BatchOperationKind = variant {
38
+ CreateAsset: CreateAssetArguments;
39
+ SetAssetContent: SetAssetContentArguments;
40
+
41
+ UnsetAssetContent: UnsetAssetContentArguments;
42
+ DeleteAsset: DeleteAssetArguments;
43
+
44
+ Clear: ClearArguments;
45
+ };
46
+
47
+ type HeaderField = record { text; text; };
48
+
49
+ type HttpRequest = record {
50
+ method: text;
51
+ url: text;
52
+ headers: vec HeaderField;
53
+ body: blob;
54
+ };
55
+
56
+ type HttpResponse = record {
57
+ status_code: nat16;
58
+ headers: vec HeaderField;
59
+ body: blob;
60
+ streaming_strategy: opt StreamingStrategy;
61
+ };
62
+
63
+ type StreamingCallbackHttpResponse = record {
64
+ body: blob;
65
+ token: opt StreamingCallbackToken;
66
+ };
67
+
68
+ type StreamingCallbackToken = record {
69
+ key: Key;
70
+ content_encoding: text;
71
+ index: nat;
72
+ sha256: opt blob;
73
+ };
74
+
75
+ type StreamingStrategy = variant {
76
+ Callback: record {
77
+ callback: func (StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query;
78
+ token: StreamingCallbackToken;
79
+ };
80
+ };
81
+
82
+ type SetAssetPropertiesArguments = record {
83
+ key: Key;
84
+ max_age: opt opt nat64;
85
+ headers: opt opt vec HeaderField;
86
+ allow_raw_access: opt opt bool;
87
+ };
88
+
89
+ type Permission = variant {
90
+ Commit;
91
+ ManagePermissions;
92
+ Prepare;
93
+ };
94
+
95
+ type GrantPermission = record {
96
+ to_principal: principal;
97
+ permission: Permission;
98
+ };
99
+ type RevokePermission = record {
100
+ of_principal: principal;
101
+ permission: Permission;
102
+ };
103
+ type ListPermitted = record { permission: Permission };
104
+
105
+ type ValidationResult = variant { Ok : text; Err : text };
106
+
107
+ service: {
108
+ get: (record {
109
+ key: Key;
110
+ accept_encodings: vec text;
111
+ }) -> (record {
112
+ content: blob; // may be the entirety of the content, or just chunk index 0
113
+ content_type: text;
114
+ content_encoding: text;
115
+ sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments
116
+ total_length: nat; // all chunks except last have size == content.size()
117
+ }) query;
118
+
119
+ // if get() returned chunks > 1, call this to retrieve them.
120
+ // chunks may or may not be split up at the same boundaries as presented to create_chunk().
121
+ get_chunk: (record {
122
+ key: Key;
123
+ content_encoding: text;
124
+ index: nat;
125
+ sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments
126
+ }) -> (record { content: blob }) query;
127
+
128
+ list : (record {}) -> (vec record {
129
+ key: Key;
130
+ content_type: text;
131
+ encodings: vec record {
132
+ content_encoding: text;
133
+ sha256: opt blob; // sha256 of entire asset encoding, calculated by dfx and passed in SetAssetContentArguments
134
+ length: nat; // Size of this encoding's blob. Calculated when uploading assets.
135
+ modified: Time;
136
+ };
137
+ }) query;
138
+
139
+ certified_tree : (record {}) -> (record {
140
+ certificate: blob;
141
+ tree: blob;
142
+ }) query;
143
+
144
+ create_batch : (record {}) -> (record { batch_id: BatchId });
145
+
146
+ create_chunk: (record { batch_id: BatchId; content: blob }) -> (record { chunk_id: ChunkId });
147
+
148
+ // Perform all operations successfully, or reject
149
+ commit_batch: (record { batch_id: BatchId; operations: vec BatchOperationKind }) -> ();
150
+
151
+ create_asset: (CreateAssetArguments) -> ();
152
+ set_asset_content: (SetAssetContentArguments) -> ();
153
+ unset_asset_content: (UnsetAssetContentArguments) -> ();
154
+
155
+ delete_asset: (DeleteAssetArguments) -> ();
156
+
157
+ clear: (ClearArguments) -> ();
158
+
159
+ // Single call to create an asset with content for a single content encoding that
160
+ // fits within the message ingress limit.
161
+ store: (record {
162
+ key: Key;
163
+ content_type: text;
164
+ content_encoding: text;
165
+ content: blob;
166
+ sha256: opt blob
167
+ }) -> ();
168
+
169
+ http_request: (request: HttpRequest) -> (HttpResponse) query;
170
+ http_request_streaming_callback: (token: StreamingCallbackToken) -> (opt StreamingCallbackHttpResponse) query;
171
+
172
+ authorize: (principal) -> ();
173
+ deauthorize: (principal) -> ();
174
+ list_authorized: () -> (vec principal) query;
175
+ grant_permission: (GrantPermission) -> ();
176
+ revoke_permission: (RevokePermission) -> ();
177
+ list_permitted: (ListPermitted) -> (vec principal) query;
178
+ take_ownership: () -> ();
179
+
180
+ get_asset_properties : (key: Key) -> (record {
181
+ max_age: opt nat64;
182
+ headers: opt vec HeaderField;
183
+ allow_raw_access: opt bool; } ) query;
184
+ set_asset_properties: (SetAssetPropertiesArguments) -> ();
185
+
186
+ validate_grant_permission: (GrantPermission) -> (ValidationResult);
187
+ validate_revoke_permission: (RevokePermission) -> (ValidationResult);
188
+ }
@@ -0,0 +1,172 @@
1
+ import type {ActorMethod} from '@dfinity/agent';
2
+ import type {Principal} from '@dfinity/principal';
3
+
4
+ export type BatchId = bigint;
5
+ export type BatchOperationKind =
6
+ | {CreateAsset: CreateAssetArguments}
7
+ | {UnsetAssetContent: UnsetAssetContentArguments}
8
+ | {DeleteAsset: DeleteAssetArguments}
9
+ | {SetAssetContent: SetAssetContentArguments}
10
+ | {Clear: ClearArguments};
11
+ export type ChunkId = bigint;
12
+ export type ClearArguments = {};
13
+ export interface CreateAssetArguments {
14
+ key: Key;
15
+ content_type: string;
16
+ headers: [] | [Array<HeaderField>];
17
+ allow_raw_access: [] | [boolean];
18
+ max_age: [] | [bigint];
19
+ enable_aliasing: [] | [boolean];
20
+ }
21
+ export interface DeleteAssetArguments {
22
+ key: Key;
23
+ }
24
+ export interface GrantPermission {
25
+ permission: Permission;
26
+ to_principal: Principal;
27
+ }
28
+ export type HeaderField = [string, string];
29
+ export interface HttpRequest {
30
+ url: string;
31
+ method: string;
32
+ body: Uint8Array | number[];
33
+ headers: Array<HeaderField>;
34
+ }
35
+ export interface HttpResponse {
36
+ body: Uint8Array | number[];
37
+ headers: Array<HeaderField>;
38
+ streaming_strategy: [] | [StreamingStrategy];
39
+ status_code: number;
40
+ }
41
+ export type Key = string;
42
+ export interface ListPermitted {
43
+ permission: Permission;
44
+ }
45
+ export type Permission = {Prepare: null} | {ManagePermissions: null} | {Commit: null};
46
+ export interface RevokePermission {
47
+ permission: Permission;
48
+ of_principal: Principal;
49
+ }
50
+ export interface SetAssetContentArguments {
51
+ key: Key;
52
+ sha256: [] | [Uint8Array | number[]];
53
+ chunk_ids: Array<ChunkId>;
54
+ content_encoding: string;
55
+ }
56
+ export interface SetAssetPropertiesArguments {
57
+ key: Key;
58
+ headers: [] | [[] | [Array<HeaderField>]];
59
+ allow_raw_access: [] | [[] | [boolean]];
60
+ max_age: [] | [[] | [bigint]];
61
+ }
62
+ export interface StreamingCallbackHttpResponse {
63
+ token: [] | [StreamingCallbackToken];
64
+ body: Uint8Array | number[];
65
+ }
66
+ export interface StreamingCallbackToken {
67
+ key: Key;
68
+ sha256: [] | [Uint8Array | number[]];
69
+ index: bigint;
70
+ content_encoding: string;
71
+ }
72
+ export type StreamingStrategy = {
73
+ Callback: {
74
+ token: StreamingCallbackToken;
75
+ callback: [Principal, string];
76
+ };
77
+ };
78
+ export type Time = bigint;
79
+ export interface UnsetAssetContentArguments {
80
+ key: Key;
81
+ content_encoding: string;
82
+ }
83
+ export type ValidationResult = {Ok: string} | {Err: string};
84
+ export interface _SERVICE {
85
+ authorize: ActorMethod<[Principal], undefined>;
86
+ certified_tree: ActorMethod<
87
+ [{}],
88
+ {certificate: Uint8Array | number[]; tree: Uint8Array | number[]}
89
+ >;
90
+ clear: ActorMethod<[ClearArguments], undefined>;
91
+ commit_batch: ActorMethod<
92
+ [{batch_id: BatchId; operations: Array<BatchOperationKind>}],
93
+ undefined
94
+ >;
95
+ create_asset: ActorMethod<[CreateAssetArguments], undefined>;
96
+ create_batch: ActorMethod<[{}], {batch_id: BatchId}>;
97
+ create_chunk: ActorMethod<
98
+ [{content: Uint8Array | number[]; batch_id: BatchId}],
99
+ {chunk_id: ChunkId}
100
+ >;
101
+ deauthorize: ActorMethod<[Principal], undefined>;
102
+ delete_asset: ActorMethod<[DeleteAssetArguments], undefined>;
103
+ get: ActorMethod<
104
+ [{key: Key; accept_encodings: Array<string>}],
105
+ {
106
+ content: Uint8Array | number[];
107
+ sha256: [] | [Uint8Array | number[]];
108
+ content_type: string;
109
+ content_encoding: string;
110
+ total_length: bigint;
111
+ }
112
+ >;
113
+ get_asset_properties: ActorMethod<
114
+ [Key],
115
+ {
116
+ headers: [] | [Array<HeaderField>];
117
+ allow_raw_access: [] | [boolean];
118
+ max_age: [] | [bigint];
119
+ }
120
+ >;
121
+ get_chunk: ActorMethod<
122
+ [
123
+ {
124
+ key: Key;
125
+ sha256: [] | [Uint8Array | number[]];
126
+ index: bigint;
127
+ content_encoding: string;
128
+ }
129
+ ],
130
+ {content: Uint8Array | number[]}
131
+ >;
132
+ grant_permission: ActorMethod<[GrantPermission], undefined>;
133
+ http_request: ActorMethod<[HttpRequest], HttpResponse>;
134
+ http_request_streaming_callback: ActorMethod<
135
+ [StreamingCallbackToken],
136
+ [] | [StreamingCallbackHttpResponse]
137
+ >;
138
+ list: ActorMethod<
139
+ [{}],
140
+ Array<{
141
+ key: Key;
142
+ encodings: Array<{
143
+ modified: Time;
144
+ sha256: [] | [Uint8Array | number[]];
145
+ length: bigint;
146
+ content_encoding: string;
147
+ }>;
148
+ content_type: string;
149
+ }>
150
+ >;
151
+ list_authorized: ActorMethod<[], Array<Principal>>;
152
+ list_permitted: ActorMethod<[ListPermitted], Array<Principal>>;
153
+ revoke_permission: ActorMethod<[RevokePermission], undefined>;
154
+ set_asset_content: ActorMethod<[SetAssetContentArguments], undefined>;
155
+ set_asset_properties: ActorMethod<[SetAssetPropertiesArguments], undefined>;
156
+ store: ActorMethod<
157
+ [
158
+ {
159
+ key: Key;
160
+ content: Uint8Array | number[];
161
+ sha256: [] | [Uint8Array | number[]];
162
+ content_type: string;
163
+ content_encoding: string;
164
+ }
165
+ ],
166
+ undefined
167
+ >;
168
+ take_ownership: ActorMethod<[], undefined>;
169
+ unset_asset_content: ActorMethod<[UnsetAssetContentArguments], undefined>;
170
+ validate_grant_permission: ActorMethod<[GrantPermission], ValidationResult>;
171
+ validate_revoke_permission: ActorMethod<[RevokePermission], ValidationResult>;
172
+ }
@@ -0,0 +1,208 @@
1
+ export const idlFactory = ({IDL}) => {
2
+ const ClearArguments = IDL.Record({});
3
+ const BatchId = IDL.Nat;
4
+ const Key = IDL.Text;
5
+ const HeaderField = IDL.Tuple(IDL.Text, IDL.Text);
6
+ const CreateAssetArguments = IDL.Record({
7
+ key: Key,
8
+ content_type: IDL.Text,
9
+ headers: IDL.Opt(IDL.Vec(HeaderField)),
10
+ allow_raw_access: IDL.Opt(IDL.Bool),
11
+ max_age: IDL.Opt(IDL.Nat64),
12
+ enable_aliasing: IDL.Opt(IDL.Bool)
13
+ });
14
+ const UnsetAssetContentArguments = IDL.Record({
15
+ key: Key,
16
+ content_encoding: IDL.Text
17
+ });
18
+ const DeleteAssetArguments = IDL.Record({key: Key});
19
+ const ChunkId = IDL.Nat;
20
+ const SetAssetContentArguments = IDL.Record({
21
+ key: Key,
22
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
23
+ chunk_ids: IDL.Vec(ChunkId),
24
+ content_encoding: IDL.Text
25
+ });
26
+ const BatchOperationKind = IDL.Variant({
27
+ CreateAsset: CreateAssetArguments,
28
+ UnsetAssetContent: UnsetAssetContentArguments,
29
+ DeleteAsset: DeleteAssetArguments,
30
+ SetAssetContent: SetAssetContentArguments,
31
+ Clear: ClearArguments
32
+ });
33
+ const Permission = IDL.Variant({
34
+ Prepare: IDL.Null,
35
+ ManagePermissions: IDL.Null,
36
+ Commit: IDL.Null
37
+ });
38
+ const GrantPermission = IDL.Record({
39
+ permission: Permission,
40
+ to_principal: IDL.Principal
41
+ });
42
+ const HttpRequest = IDL.Record({
43
+ url: IDL.Text,
44
+ method: IDL.Text,
45
+ body: IDL.Vec(IDL.Nat8),
46
+ headers: IDL.Vec(HeaderField)
47
+ });
48
+ const StreamingCallbackToken = IDL.Record({
49
+ key: Key,
50
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
51
+ index: IDL.Nat,
52
+ content_encoding: IDL.Text
53
+ });
54
+ const StreamingCallbackHttpResponse = IDL.Record({
55
+ token: IDL.Opt(StreamingCallbackToken),
56
+ body: IDL.Vec(IDL.Nat8)
57
+ });
58
+ const StreamingStrategy = IDL.Variant({
59
+ Callback: IDL.Record({
60
+ token: StreamingCallbackToken,
61
+ callback: IDL.Func(
62
+ [StreamingCallbackToken],
63
+ [IDL.Opt(StreamingCallbackHttpResponse)],
64
+ ['query']
65
+ )
66
+ })
67
+ });
68
+ const HttpResponse = IDL.Record({
69
+ body: IDL.Vec(IDL.Nat8),
70
+ headers: IDL.Vec(HeaderField),
71
+ streaming_strategy: IDL.Opt(StreamingStrategy),
72
+ status_code: IDL.Nat16
73
+ });
74
+ const Time = IDL.Int;
75
+ const ListPermitted = IDL.Record({permission: Permission});
76
+ const RevokePermission = IDL.Record({
77
+ permission: Permission,
78
+ of_principal: IDL.Principal
79
+ });
80
+ const SetAssetPropertiesArguments = IDL.Record({
81
+ key: Key,
82
+ headers: IDL.Opt(IDL.Opt(IDL.Vec(HeaderField))),
83
+ allow_raw_access: IDL.Opt(IDL.Opt(IDL.Bool)),
84
+ max_age: IDL.Opt(IDL.Opt(IDL.Nat64))
85
+ });
86
+ const ValidationResult = IDL.Variant({Ok: IDL.Text, Err: IDL.Text});
87
+ return IDL.Service({
88
+ authorize: IDL.Func([IDL.Principal], [], []),
89
+ certified_tree: IDL.Func(
90
+ [IDL.Record({})],
91
+ [
92
+ IDL.Record({
93
+ certificate: IDL.Vec(IDL.Nat8),
94
+ tree: IDL.Vec(IDL.Nat8)
95
+ })
96
+ ],
97
+ ['query']
98
+ ),
99
+ clear: IDL.Func([ClearArguments], [], []),
100
+ commit_batch: IDL.Func(
101
+ [
102
+ IDL.Record({
103
+ batch_id: BatchId,
104
+ operations: IDL.Vec(BatchOperationKind)
105
+ })
106
+ ],
107
+ [],
108
+ []
109
+ ),
110
+ create_asset: IDL.Func([CreateAssetArguments], [], []),
111
+ create_batch: IDL.Func([IDL.Record({})], [IDL.Record({batch_id: BatchId})], []),
112
+ create_chunk: IDL.Func(
113
+ [IDL.Record({content: IDL.Vec(IDL.Nat8), batch_id: BatchId})],
114
+ [IDL.Record({chunk_id: ChunkId})],
115
+ []
116
+ ),
117
+ deauthorize: IDL.Func([IDL.Principal], [], []),
118
+ delete_asset: IDL.Func([DeleteAssetArguments], [], []),
119
+ get: IDL.Func(
120
+ [IDL.Record({key: Key, accept_encodings: IDL.Vec(IDL.Text)})],
121
+ [
122
+ IDL.Record({
123
+ content: IDL.Vec(IDL.Nat8),
124
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
125
+ content_type: IDL.Text,
126
+ content_encoding: IDL.Text,
127
+ total_length: IDL.Nat
128
+ })
129
+ ],
130
+ ['query']
131
+ ),
132
+ get_asset_properties: IDL.Func(
133
+ [Key],
134
+ [
135
+ IDL.Record({
136
+ headers: IDL.Opt(IDL.Vec(HeaderField)),
137
+ allow_raw_access: IDL.Opt(IDL.Bool),
138
+ max_age: IDL.Opt(IDL.Nat64)
139
+ })
140
+ ],
141
+ ['query']
142
+ ),
143
+ get_chunk: IDL.Func(
144
+ [
145
+ IDL.Record({
146
+ key: Key,
147
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
148
+ index: IDL.Nat,
149
+ content_encoding: IDL.Text
150
+ })
151
+ ],
152
+ [IDL.Record({content: IDL.Vec(IDL.Nat8)})],
153
+ ['query']
154
+ ),
155
+ grant_permission: IDL.Func([GrantPermission], [], []),
156
+ http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
157
+ http_request_streaming_callback: IDL.Func(
158
+ [StreamingCallbackToken],
159
+ [IDL.Opt(StreamingCallbackHttpResponse)],
160
+ ['query']
161
+ ),
162
+ list: IDL.Func(
163
+ [IDL.Record({})],
164
+ [
165
+ IDL.Vec(
166
+ IDL.Record({
167
+ key: Key,
168
+ encodings: IDL.Vec(
169
+ IDL.Record({
170
+ modified: Time,
171
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
172
+ length: IDL.Nat,
173
+ content_encoding: IDL.Text
174
+ })
175
+ ),
176
+ content_type: IDL.Text
177
+ })
178
+ )
179
+ ],
180
+ ['query']
181
+ ),
182
+ list_authorized: IDL.Func([], [IDL.Vec(IDL.Principal)], ['query']),
183
+ list_permitted: IDL.Func([ListPermitted], [IDL.Vec(IDL.Principal)], ['query']),
184
+ revoke_permission: IDL.Func([RevokePermission], [], []),
185
+ set_asset_content: IDL.Func([SetAssetContentArguments], [], []),
186
+ set_asset_properties: IDL.Func([SetAssetPropertiesArguments], [], []),
187
+ store: IDL.Func(
188
+ [
189
+ IDL.Record({
190
+ key: Key,
191
+ content: IDL.Vec(IDL.Nat8),
192
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
193
+ content_type: IDL.Text,
194
+ content_encoding: IDL.Text
195
+ })
196
+ ],
197
+ [],
198
+ []
199
+ ),
200
+ take_ownership: IDL.Func([], [], []),
201
+ unset_asset_content: IDL.Func([UnsetAssetContentArguments], [], []),
202
+ validate_grant_permission: IDL.Func([GrantPermission], [ValidationResult], []),
203
+ validate_revoke_permission: IDL.Func([RevokePermission], [ValidationResult], [])
204
+ });
205
+ };
206
+ export const init = ({IDL}) => {
207
+ return [];
208
+ };
@@ -0,0 +1,45 @@
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>;
@@ -0,0 +1,32 @@
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
+ };