@junobuild/admin 0.0.2 → 0.0.4
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/cjs/index.cjs.js +13 -13
- package/dist/cjs/index.cjs.js.map +4 -4
- package/dist/declarations/cmc/cmc.did +122 -0
- package/dist/declarations/cmc/cmc.did.d.ts +48 -0
- package/dist/declarations/cmc/cmc.factory.did.js +65 -0
- package/dist/declarations/cmc/index.d.ts +45 -0
- package/dist/declarations/cmc/index.js +32 -0
- package/dist/declarations/console/console.did.d.ts +47 -0
- package/dist/declarations/console/console.factory.did.js +49 -0
- package/dist/declarations/console/console.factory.did.mjs +49 -0
- package/dist/declarations/console/index.d.ts +45 -0
- package/dist/declarations/console/index.js +32 -0
- package/dist/declarations/frontend/frontend.did +147 -0
- package/dist/declarations/frontend/frontend.did.d.ts +128 -0
- package/dist/declarations/frontend/frontend.factory.did.js +165 -0
- package/dist/declarations/frontend/index.d.ts +45 -0
- package/dist/declarations/frontend/index.js +32 -0
- package/dist/declarations/ic/ic.did +82 -0
- package/dist/declarations/ic/ic.did.d.ts +77 -0
- package/dist/declarations/ic/ic.factory.did.js +128 -0
- package/dist/declarations/internet_identity/index.d.ts +45 -0
- package/dist/declarations/internet_identity/index.js +32 -0
- package/dist/declarations/internet_identity/internet_identity.did +271 -0
- package/dist/declarations/internet_identity/internet_identity.did.d.ts +161 -0
- package/dist/declarations/internet_identity/internet_identity.factory.did.js +187 -0
- package/dist/declarations/ledger/index.d.ts +45 -0
- package/dist/declarations/ledger/index.js +32 -0
- package/dist/declarations/ledger/ledger.did +249 -0
- package/dist/declarations/ledger/ledger.did.d.ts +100 -0
- package/dist/declarations/ledger/ledger.factory.did.js +98 -0
- package/dist/declarations/mission_control/index.d.ts +45 -0
- package/dist/declarations/mission_control/index.js +32 -0
- package/dist/declarations/mission_control/mission_control.did.d.ts +24 -0
- package/dist/declarations/mission_control/mission_control.factory.did.js +28 -0
- package/dist/declarations/satellite/index.d.ts +45 -0
- package/dist/declarations/satellite/index.js +32 -0
- package/dist/declarations/satellite/satellite.did.d.ts +166 -0
- package/dist/declarations/satellite/satellite.factory.did.js +164 -0
- package/dist/declarations/satellite/satellite.factory.did.mjs +164 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +4 -4
- package/dist/types/api/actor.api.d.ts +4 -4
- package/dist/types/api/satellite.api.d.ts +1 -1
- package/dist/types/services/satellite.services.d.ts +1 -1
- package/dist/types/types/config.types.d.ts +5 -1
- package/dist/types/types/ic.types.d.ts +1 -1
- package/package.json +9 -3
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
max_age: [] | [bigint];
|
|
18
|
+
}
|
|
19
|
+
export interface DeleteAssetArguments {
|
|
20
|
+
key: Key;
|
|
21
|
+
}
|
|
22
|
+
export type HeaderField = [string, string];
|
|
23
|
+
export interface HttpRequest {
|
|
24
|
+
url: string;
|
|
25
|
+
method: string;
|
|
26
|
+
body: Uint8Array;
|
|
27
|
+
headers: Array<HeaderField>;
|
|
28
|
+
}
|
|
29
|
+
export interface HttpResponse {
|
|
30
|
+
body: Uint8Array;
|
|
31
|
+
headers: Array<HeaderField>;
|
|
32
|
+
streaming_strategy: [] | [StreamingStrategy];
|
|
33
|
+
status_code: number;
|
|
34
|
+
}
|
|
35
|
+
export type Key = string;
|
|
36
|
+
export interface SetAssetContentArguments {
|
|
37
|
+
key: Key;
|
|
38
|
+
sha256: [] | [Uint8Array];
|
|
39
|
+
chunk_ids: Array<ChunkId>;
|
|
40
|
+
content_encoding: string;
|
|
41
|
+
}
|
|
42
|
+
export interface StreamingCallbackHttpResponse {
|
|
43
|
+
token: [] | [StreamingCallbackToken];
|
|
44
|
+
body: Uint8Array;
|
|
45
|
+
}
|
|
46
|
+
export interface StreamingCallbackToken {
|
|
47
|
+
key: Key;
|
|
48
|
+
sha256: [] | [Uint8Array];
|
|
49
|
+
index: bigint;
|
|
50
|
+
content_encoding: string;
|
|
51
|
+
}
|
|
52
|
+
export type StreamingStrategy = {
|
|
53
|
+
Callback: {
|
|
54
|
+
token: StreamingCallbackToken;
|
|
55
|
+
callback: [Principal, string];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export type Time = bigint;
|
|
59
|
+
export interface UnsetAssetContentArguments {
|
|
60
|
+
key: Key;
|
|
61
|
+
content_encoding: string;
|
|
62
|
+
}
|
|
63
|
+
export interface _SERVICE {
|
|
64
|
+
authorize: ActorMethod<[Principal], undefined>;
|
|
65
|
+
certified_tree: ActorMethod<[{}], {certificate: Uint8Array; tree: Uint8Array}>;
|
|
66
|
+
clear: ActorMethod<[ClearArguments], undefined>;
|
|
67
|
+
commit_batch: ActorMethod<
|
|
68
|
+
[{batch_id: BatchId; operations: Array<BatchOperationKind>}],
|
|
69
|
+
undefined
|
|
70
|
+
>;
|
|
71
|
+
create_asset: ActorMethod<[CreateAssetArguments], undefined>;
|
|
72
|
+
create_batch: ActorMethod<[{}], {batch_id: BatchId}>;
|
|
73
|
+
create_chunk: ActorMethod<[{content: Uint8Array; batch_id: BatchId}], {chunk_id: ChunkId}>;
|
|
74
|
+
delete_asset: ActorMethod<[DeleteAssetArguments], undefined>;
|
|
75
|
+
get: ActorMethod<
|
|
76
|
+
[{key: Key; accept_encodings: Array<string>}],
|
|
77
|
+
{
|
|
78
|
+
content: Uint8Array;
|
|
79
|
+
sha256: [] | [Uint8Array];
|
|
80
|
+
content_type: string;
|
|
81
|
+
content_encoding: string;
|
|
82
|
+
total_length: bigint;
|
|
83
|
+
}
|
|
84
|
+
>;
|
|
85
|
+
get_chunk: ActorMethod<
|
|
86
|
+
[
|
|
87
|
+
{
|
|
88
|
+
key: Key;
|
|
89
|
+
sha256: [] | [Uint8Array];
|
|
90
|
+
index: bigint;
|
|
91
|
+
content_encoding: string;
|
|
92
|
+
}
|
|
93
|
+
],
|
|
94
|
+
{content: Uint8Array}
|
|
95
|
+
>;
|
|
96
|
+
http_request: ActorMethod<[HttpRequest], HttpResponse>;
|
|
97
|
+
http_request_streaming_callback: ActorMethod<
|
|
98
|
+
[StreamingCallbackToken],
|
|
99
|
+
[] | [StreamingCallbackHttpResponse]
|
|
100
|
+
>;
|
|
101
|
+
list: ActorMethod<
|
|
102
|
+
[{}],
|
|
103
|
+
Array<{
|
|
104
|
+
key: Key;
|
|
105
|
+
encodings: Array<{
|
|
106
|
+
modified: Time;
|
|
107
|
+
sha256: [] | [Uint8Array];
|
|
108
|
+
length: bigint;
|
|
109
|
+
content_encoding: string;
|
|
110
|
+
}>;
|
|
111
|
+
content_type: string;
|
|
112
|
+
}>
|
|
113
|
+
>;
|
|
114
|
+
set_asset_content: ActorMethod<[SetAssetContentArguments], undefined>;
|
|
115
|
+
store: ActorMethod<
|
|
116
|
+
[
|
|
117
|
+
{
|
|
118
|
+
key: Key;
|
|
119
|
+
content: Uint8Array;
|
|
120
|
+
sha256: [] | [Uint8Array];
|
|
121
|
+
content_type: string;
|
|
122
|
+
content_encoding: string;
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
undefined
|
|
126
|
+
>;
|
|
127
|
+
unset_asset_content: ActorMethod<[UnsetAssetContentArguments], undefined>;
|
|
128
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
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
|
+
max_age: IDL.Opt(IDL.Nat64)
|
|
11
|
+
});
|
|
12
|
+
const UnsetAssetContentArguments = IDL.Record({
|
|
13
|
+
key: Key,
|
|
14
|
+
content_encoding: IDL.Text
|
|
15
|
+
});
|
|
16
|
+
const DeleteAssetArguments = IDL.Record({key: Key});
|
|
17
|
+
const ChunkId = IDL.Nat;
|
|
18
|
+
const SetAssetContentArguments = IDL.Record({
|
|
19
|
+
key: Key,
|
|
20
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
21
|
+
chunk_ids: IDL.Vec(ChunkId),
|
|
22
|
+
content_encoding: IDL.Text
|
|
23
|
+
});
|
|
24
|
+
const BatchOperationKind = IDL.Variant({
|
|
25
|
+
CreateAsset: CreateAssetArguments,
|
|
26
|
+
UnsetAssetContent: UnsetAssetContentArguments,
|
|
27
|
+
DeleteAsset: DeleteAssetArguments,
|
|
28
|
+
SetAssetContent: SetAssetContentArguments,
|
|
29
|
+
Clear: ClearArguments
|
|
30
|
+
});
|
|
31
|
+
const HttpRequest = IDL.Record({
|
|
32
|
+
url: IDL.Text,
|
|
33
|
+
method: IDL.Text,
|
|
34
|
+
body: IDL.Vec(IDL.Nat8),
|
|
35
|
+
headers: IDL.Vec(HeaderField)
|
|
36
|
+
});
|
|
37
|
+
const StreamingCallbackToken = IDL.Record({
|
|
38
|
+
key: Key,
|
|
39
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
40
|
+
index: IDL.Nat,
|
|
41
|
+
content_encoding: IDL.Text
|
|
42
|
+
});
|
|
43
|
+
const StreamingCallbackHttpResponse = IDL.Record({
|
|
44
|
+
token: IDL.Opt(StreamingCallbackToken),
|
|
45
|
+
body: IDL.Vec(IDL.Nat8)
|
|
46
|
+
});
|
|
47
|
+
const StreamingStrategy = IDL.Variant({
|
|
48
|
+
Callback: IDL.Record({
|
|
49
|
+
token: StreamingCallbackToken,
|
|
50
|
+
callback: IDL.Func(
|
|
51
|
+
[StreamingCallbackToken],
|
|
52
|
+
[IDL.Opt(StreamingCallbackHttpResponse)],
|
|
53
|
+
['query']
|
|
54
|
+
)
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
const HttpResponse = IDL.Record({
|
|
58
|
+
body: IDL.Vec(IDL.Nat8),
|
|
59
|
+
headers: IDL.Vec(HeaderField),
|
|
60
|
+
streaming_strategy: IDL.Opt(StreamingStrategy),
|
|
61
|
+
status_code: IDL.Nat16
|
|
62
|
+
});
|
|
63
|
+
const Time = IDL.Int;
|
|
64
|
+
return IDL.Service({
|
|
65
|
+
authorize: IDL.Func([IDL.Principal], [], []),
|
|
66
|
+
certified_tree: IDL.Func(
|
|
67
|
+
[IDL.Record({})],
|
|
68
|
+
[
|
|
69
|
+
IDL.Record({
|
|
70
|
+
certificate: IDL.Vec(IDL.Nat8),
|
|
71
|
+
tree: IDL.Vec(IDL.Nat8)
|
|
72
|
+
})
|
|
73
|
+
],
|
|
74
|
+
['query']
|
|
75
|
+
),
|
|
76
|
+
clear: IDL.Func([ClearArguments], [], []),
|
|
77
|
+
commit_batch: IDL.Func(
|
|
78
|
+
[
|
|
79
|
+
IDL.Record({
|
|
80
|
+
batch_id: BatchId,
|
|
81
|
+
operations: IDL.Vec(BatchOperationKind)
|
|
82
|
+
})
|
|
83
|
+
],
|
|
84
|
+
[],
|
|
85
|
+
[]
|
|
86
|
+
),
|
|
87
|
+
create_asset: IDL.Func([CreateAssetArguments], [], []),
|
|
88
|
+
create_batch: IDL.Func([IDL.Record({})], [IDL.Record({batch_id: BatchId})], []),
|
|
89
|
+
create_chunk: IDL.Func(
|
|
90
|
+
[IDL.Record({content: IDL.Vec(IDL.Nat8), batch_id: BatchId})],
|
|
91
|
+
[IDL.Record({chunk_id: ChunkId})],
|
|
92
|
+
[]
|
|
93
|
+
),
|
|
94
|
+
delete_asset: IDL.Func([DeleteAssetArguments], [], []),
|
|
95
|
+
get: IDL.Func(
|
|
96
|
+
[IDL.Record({key: Key, accept_encodings: IDL.Vec(IDL.Text)})],
|
|
97
|
+
[
|
|
98
|
+
IDL.Record({
|
|
99
|
+
content: IDL.Vec(IDL.Nat8),
|
|
100
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
101
|
+
content_type: IDL.Text,
|
|
102
|
+
content_encoding: IDL.Text,
|
|
103
|
+
total_length: IDL.Nat
|
|
104
|
+
})
|
|
105
|
+
],
|
|
106
|
+
['query']
|
|
107
|
+
),
|
|
108
|
+
get_chunk: IDL.Func(
|
|
109
|
+
[
|
|
110
|
+
IDL.Record({
|
|
111
|
+
key: Key,
|
|
112
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
113
|
+
index: IDL.Nat,
|
|
114
|
+
content_encoding: IDL.Text
|
|
115
|
+
})
|
|
116
|
+
],
|
|
117
|
+
[IDL.Record({content: IDL.Vec(IDL.Nat8)})],
|
|
118
|
+
['query']
|
|
119
|
+
),
|
|
120
|
+
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
121
|
+
http_request_streaming_callback: IDL.Func(
|
|
122
|
+
[StreamingCallbackToken],
|
|
123
|
+
[IDL.Opt(StreamingCallbackHttpResponse)],
|
|
124
|
+
['query']
|
|
125
|
+
),
|
|
126
|
+
list: IDL.Func(
|
|
127
|
+
[IDL.Record({})],
|
|
128
|
+
[
|
|
129
|
+
IDL.Vec(
|
|
130
|
+
IDL.Record({
|
|
131
|
+
key: Key,
|
|
132
|
+
encodings: IDL.Vec(
|
|
133
|
+
IDL.Record({
|
|
134
|
+
modified: Time,
|
|
135
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
136
|
+
length: IDL.Nat,
|
|
137
|
+
content_encoding: IDL.Text
|
|
138
|
+
})
|
|
139
|
+
),
|
|
140
|
+
content_type: IDL.Text
|
|
141
|
+
})
|
|
142
|
+
)
|
|
143
|
+
],
|
|
144
|
+
['query']
|
|
145
|
+
),
|
|
146
|
+
set_asset_content: IDL.Func([SetAssetContentArguments], [], []),
|
|
147
|
+
store: IDL.Func(
|
|
148
|
+
[
|
|
149
|
+
IDL.Record({
|
|
150
|
+
key: Key,
|
|
151
|
+
content: IDL.Vec(IDL.Nat8),
|
|
152
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
153
|
+
content_type: IDL.Text,
|
|
154
|
+
content_encoding: IDL.Text
|
|
155
|
+
})
|
|
156
|
+
],
|
|
157
|
+
[],
|
|
158
|
+
[]
|
|
159
|
+
),
|
|
160
|
+
unset_asset_content: IDL.Func([UnsetAssetContentArguments], [], [])
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
export const init = ({IDL}) => {
|
|
164
|
+
return [];
|
|
165
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
type canister_id = principal;
|
|
2
|
+
type user_id = principal;
|
|
3
|
+
type wasm_module = blob;
|
|
4
|
+
|
|
5
|
+
type canister_settings = record {
|
|
6
|
+
controllers : opt vec principal;
|
|
7
|
+
compute_allocation : opt nat;
|
|
8
|
+
memory_allocation : opt nat;
|
|
9
|
+
freezing_threshold : opt nat;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type definite_canister_settings = record {
|
|
13
|
+
controllers : vec principal;
|
|
14
|
+
compute_allocation : nat;
|
|
15
|
+
memory_allocation : nat;
|
|
16
|
+
freezing_threshold : nat;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type http_header = record { name: text; value: text };
|
|
20
|
+
|
|
21
|
+
type http_response = record {
|
|
22
|
+
status: nat;
|
|
23
|
+
headers: vec http_header;
|
|
24
|
+
body: blob;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type http_request_error = variant {
|
|
28
|
+
no_consensus;
|
|
29
|
+
timeout;
|
|
30
|
+
bad_tls;
|
|
31
|
+
invalid_url;
|
|
32
|
+
transform_error;
|
|
33
|
+
dns_error;
|
|
34
|
+
unreachable;
|
|
35
|
+
conn_timeout;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
service ic : {
|
|
39
|
+
create_canister : (record {
|
|
40
|
+
settings : opt canister_settings
|
|
41
|
+
}) -> (record {canister_id : canister_id});
|
|
42
|
+
update_settings : (record {
|
|
43
|
+
canister_id : principal;
|
|
44
|
+
settings : canister_settings
|
|
45
|
+
}) -> ();
|
|
46
|
+
install_code : (record {
|
|
47
|
+
mode : variant {install; reinstall; upgrade};
|
|
48
|
+
canister_id : canister_id;
|
|
49
|
+
wasm_module : wasm_module;
|
|
50
|
+
arg : blob;
|
|
51
|
+
}) -> ();
|
|
52
|
+
uninstall_code : (record {canister_id : canister_id}) -> ();
|
|
53
|
+
start_canister : (record {canister_id : canister_id}) -> ();
|
|
54
|
+
stop_canister : (record {canister_id : canister_id}) -> ();
|
|
55
|
+
canister_status : (record {canister_id : canister_id}) -> (record {
|
|
56
|
+
status : variant { running; stopping; stopped };
|
|
57
|
+
settings: definite_canister_settings;
|
|
58
|
+
module_hash: opt blob;
|
|
59
|
+
memory_size: nat;
|
|
60
|
+
cycles: nat;
|
|
61
|
+
});
|
|
62
|
+
delete_canister : (record {canister_id : canister_id}) -> ();
|
|
63
|
+
deposit_cycles : (record {canister_id : canister_id}) -> ();
|
|
64
|
+
raw_rand : () -> (blob);
|
|
65
|
+
http_request : (record {
|
|
66
|
+
url : text;
|
|
67
|
+
method : variant { get };
|
|
68
|
+
headers: vec http_header;
|
|
69
|
+
body : opt blob;
|
|
70
|
+
transform : opt variant {
|
|
71
|
+
function: func (http_response) -> (http_response) query
|
|
72
|
+
};
|
|
73
|
+
}) -> (variant { Ok : http_response; Err: opt http_request_error });
|
|
74
|
+
|
|
75
|
+
// provisional interfaces for the pre-ledger world
|
|
76
|
+
provisional_create_canister_with_cycles : (record {
|
|
77
|
+
amount: opt nat;
|
|
78
|
+
settings : opt canister_settings
|
|
79
|
+
}) -> (record {canister_id : canister_id});
|
|
80
|
+
provisional_top_up_canister :
|
|
81
|
+
(record { canister_id: canister_id; amount: nat }) -> ();
|
|
82
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import type {Principal} from '@dfinity/principal';
|
|
2
|
+
export type canister_id = Principal;
|
|
3
|
+
export interface canister_settings {
|
|
4
|
+
freezing_threshold: [] | [bigint];
|
|
5
|
+
controllers: [] | [Array<Principal>];
|
|
6
|
+
memory_allocation: [] | [bigint];
|
|
7
|
+
compute_allocation: [] | [bigint];
|
|
8
|
+
}
|
|
9
|
+
export interface definite_canister_settings {
|
|
10
|
+
freezing_threshold: bigint;
|
|
11
|
+
controllers: Array<Principal>;
|
|
12
|
+
memory_allocation: bigint;
|
|
13
|
+
compute_allocation: bigint;
|
|
14
|
+
}
|
|
15
|
+
export interface http_header {
|
|
16
|
+
value: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
19
|
+
export type http_request_error =
|
|
20
|
+
| {dns_error: null}
|
|
21
|
+
| {no_consensus: null}
|
|
22
|
+
| {transform_error: null}
|
|
23
|
+
| {unreachable: null}
|
|
24
|
+
| {bad_tls: null}
|
|
25
|
+
| {conn_timeout: null}
|
|
26
|
+
| {invalid_url: null}
|
|
27
|
+
| {timeout: null};
|
|
28
|
+
export interface http_response {
|
|
29
|
+
status: bigint;
|
|
30
|
+
body: Array<number>;
|
|
31
|
+
headers: Array<http_header>;
|
|
32
|
+
}
|
|
33
|
+
export type user_id = Principal;
|
|
34
|
+
export type wasm_module = Array<number>;
|
|
35
|
+
export interface _SERVICE {
|
|
36
|
+
canister_status: (arg_0: {canister_id: canister_id}) => Promise<{
|
|
37
|
+
status: {stopped: null} | {stopping: null} | {running: null};
|
|
38
|
+
memory_size: bigint;
|
|
39
|
+
cycles: bigint;
|
|
40
|
+
settings: definite_canister_settings;
|
|
41
|
+
module_hash: [] | [Array<number>];
|
|
42
|
+
}>;
|
|
43
|
+
create_canister: (arg_0: {
|
|
44
|
+
settings: [] | [canister_settings];
|
|
45
|
+
}) => Promise<{canister_id: canister_id}>;
|
|
46
|
+
delete_canister: (arg_0: {canister_id: canister_id}) => Promise<undefined>;
|
|
47
|
+
deposit_cycles: (arg_0: {canister_id: canister_id}) => Promise<undefined>;
|
|
48
|
+
http_request: (arg_0: {
|
|
49
|
+
url: string;
|
|
50
|
+
method: {get: null};
|
|
51
|
+
body: [] | [Array<number>];
|
|
52
|
+
transform: [] | [{function: [Principal, string]}];
|
|
53
|
+
headers: Array<http_header>;
|
|
54
|
+
}) => Promise<{Ok: http_response} | {Err: [] | [http_request_error]}>;
|
|
55
|
+
install_code: (arg_0: {
|
|
56
|
+
arg: Array<number>;
|
|
57
|
+
wasm_module: wasm_module;
|
|
58
|
+
mode: {reinstall: null} | {upgrade: null} | {install: null};
|
|
59
|
+
canister_id: canister_id;
|
|
60
|
+
}) => Promise<undefined>;
|
|
61
|
+
provisional_create_canister_with_cycles: (arg_0: {
|
|
62
|
+
settings: [] | [canister_settings];
|
|
63
|
+
amount: [] | [bigint];
|
|
64
|
+
}) => Promise<{canister_id: canister_id}>;
|
|
65
|
+
provisional_top_up_canister: (arg_0: {
|
|
66
|
+
canister_id: canister_id;
|
|
67
|
+
amount: bigint;
|
|
68
|
+
}) => Promise<undefined>;
|
|
69
|
+
raw_rand: () => Promise<Array<number>>;
|
|
70
|
+
start_canister: (arg_0: {canister_id: canister_id}) => Promise<undefined>;
|
|
71
|
+
stop_canister: (arg_0: {canister_id: canister_id}) => Promise<undefined>;
|
|
72
|
+
uninstall_code: (arg_0: {canister_id: canister_id}) => Promise<undefined>;
|
|
73
|
+
update_settings: (arg_0: {
|
|
74
|
+
canister_id: Principal;
|
|
75
|
+
settings: canister_settings;
|
|
76
|
+
}) => Promise<undefined>;
|
|
77
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export const idlFactory = ({IDL}) => {
|
|
2
|
+
const canister_id = IDL.Principal;
|
|
3
|
+
const definite_canister_settings = IDL.Record({
|
|
4
|
+
freezing_threshold: IDL.Nat,
|
|
5
|
+
controllers: IDL.Vec(IDL.Principal),
|
|
6
|
+
memory_allocation: IDL.Nat,
|
|
7
|
+
compute_allocation: IDL.Nat
|
|
8
|
+
});
|
|
9
|
+
const canister_settings = IDL.Record({
|
|
10
|
+
freezing_threshold: IDL.Opt(IDL.Nat),
|
|
11
|
+
controllers: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
12
|
+
memory_allocation: IDL.Opt(IDL.Nat),
|
|
13
|
+
compute_allocation: IDL.Opt(IDL.Nat)
|
|
14
|
+
});
|
|
15
|
+
const http_header = IDL.Record({value: IDL.Text, name: IDL.Text});
|
|
16
|
+
const http_response = IDL.Record({
|
|
17
|
+
status: IDL.Nat,
|
|
18
|
+
body: IDL.Vec(IDL.Nat8),
|
|
19
|
+
headers: IDL.Vec(http_header)
|
|
20
|
+
});
|
|
21
|
+
const http_request_error = IDL.Variant({
|
|
22
|
+
dns_error: IDL.Null,
|
|
23
|
+
no_consensus: IDL.Null,
|
|
24
|
+
transform_error: IDL.Null,
|
|
25
|
+
unreachable: IDL.Null,
|
|
26
|
+
bad_tls: IDL.Null,
|
|
27
|
+
conn_timeout: IDL.Null,
|
|
28
|
+
invalid_url: IDL.Null,
|
|
29
|
+
timeout: IDL.Null
|
|
30
|
+
});
|
|
31
|
+
const wasm_module = IDL.Vec(IDL.Nat8);
|
|
32
|
+
return IDL.Service({
|
|
33
|
+
canister_status: IDL.Func(
|
|
34
|
+
[IDL.Record({canister_id: canister_id})],
|
|
35
|
+
[
|
|
36
|
+
IDL.Record({
|
|
37
|
+
status: IDL.Variant({
|
|
38
|
+
stopped: IDL.Null,
|
|
39
|
+
stopping: IDL.Null,
|
|
40
|
+
running: IDL.Null
|
|
41
|
+
}),
|
|
42
|
+
memory_size: IDL.Nat,
|
|
43
|
+
cycles: IDL.Nat,
|
|
44
|
+
settings: definite_canister_settings,
|
|
45
|
+
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
|
|
46
|
+
})
|
|
47
|
+
],
|
|
48
|
+
[]
|
|
49
|
+
),
|
|
50
|
+
create_canister: IDL.Func(
|
|
51
|
+
[IDL.Record({settings: IDL.Opt(canister_settings)})],
|
|
52
|
+
[IDL.Record({canister_id: canister_id})],
|
|
53
|
+
[]
|
|
54
|
+
),
|
|
55
|
+
delete_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
|
|
56
|
+
deposit_cycles: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
|
|
57
|
+
http_request: IDL.Func(
|
|
58
|
+
[
|
|
59
|
+
IDL.Record({
|
|
60
|
+
url: IDL.Text,
|
|
61
|
+
method: IDL.Variant({get: IDL.Null}),
|
|
62
|
+
body: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
63
|
+
transform: IDL.Opt(
|
|
64
|
+
IDL.Variant({
|
|
65
|
+
function: IDL.Func([http_response], [http_response], ['query'])
|
|
66
|
+
})
|
|
67
|
+
),
|
|
68
|
+
headers: IDL.Vec(http_header)
|
|
69
|
+
})
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
IDL.Variant({
|
|
73
|
+
Ok: http_response,
|
|
74
|
+
Err: IDL.Opt(http_request_error)
|
|
75
|
+
})
|
|
76
|
+
],
|
|
77
|
+
[]
|
|
78
|
+
),
|
|
79
|
+
install_code: IDL.Func(
|
|
80
|
+
[
|
|
81
|
+
IDL.Record({
|
|
82
|
+
arg: IDL.Vec(IDL.Nat8),
|
|
83
|
+
wasm_module: wasm_module,
|
|
84
|
+
mode: IDL.Variant({
|
|
85
|
+
reinstall: IDL.Null,
|
|
86
|
+
upgrade: IDL.Null,
|
|
87
|
+
install: IDL.Null
|
|
88
|
+
}),
|
|
89
|
+
canister_id: canister_id
|
|
90
|
+
})
|
|
91
|
+
],
|
|
92
|
+
[],
|
|
93
|
+
[]
|
|
94
|
+
),
|
|
95
|
+
provisional_create_canister_with_cycles: IDL.Func(
|
|
96
|
+
[
|
|
97
|
+
IDL.Record({
|
|
98
|
+
settings: IDL.Opt(canister_settings),
|
|
99
|
+
amount: IDL.Opt(IDL.Nat)
|
|
100
|
+
})
|
|
101
|
+
],
|
|
102
|
+
[IDL.Record({canister_id: canister_id})],
|
|
103
|
+
[]
|
|
104
|
+
),
|
|
105
|
+
provisional_top_up_canister: IDL.Func(
|
|
106
|
+
[IDL.Record({canister_id: canister_id, amount: IDL.Nat})],
|
|
107
|
+
[],
|
|
108
|
+
[]
|
|
109
|
+
),
|
|
110
|
+
raw_rand: IDL.Func([], [IDL.Vec(IDL.Nat8)], []),
|
|
111
|
+
start_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
|
|
112
|
+
stop_canister: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
|
|
113
|
+
uninstall_code: IDL.Func([IDL.Record({canister_id: canister_id})], [], []),
|
|
114
|
+
update_settings: IDL.Func(
|
|
115
|
+
[
|
|
116
|
+
IDL.Record({
|
|
117
|
+
canister_id: IDL.Principal,
|
|
118
|
+
settings: canister_settings
|
|
119
|
+
})
|
|
120
|
+
],
|
|
121
|
+
[],
|
|
122
|
+
[]
|
|
123
|
+
)
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
export const init = ({IDL}) => {
|
|
127
|
+
return [];
|
|
128
|
+
};
|
|
@@ -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 './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>;
|