@junobuild/admin 0.0.32 → 0.0.34
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 +1 -1
- package/declarations/satellite/satellite.did.d.ts +6 -0
- package/declarations/satellite/satellite.factory.did.js +6 -0
- package/declarations/satellite/satellite.factory.did.mjs +6 -0
- package/dist/browser/index.js +7 -7
- package/dist/browser/index.js.map +3 -3
- package/dist/declarations/satellite/satellite.did.d.ts +6 -0
- package/dist/declarations/satellite/satellite.factory.did.js +6 -0
- package/dist/declarations/satellite/satellite.factory.did.mjs +6 -0
- package/dist/node/index.mjs +7 -7
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/api/actor.api.d.ts +1 -3
- package/dist/types/constants/rules.constants.d.ts +3 -1
- package/dist/types/types/rules.types.d.ts +3 -0
- package/dist/types/utils/rule.utils.d.ts +5 -3
- package/package.json +3 -3
- package/declarations/cmc/cmc.did +0 -122
- package/declarations/cmc/cmc.did.d.ts +0 -48
- package/declarations/cmc/cmc.factory.did.js +0 -67
- package/declarations/cmc/index.d.ts +0 -45
- package/declarations/cmc/index.js +0 -37
- package/declarations/console/console.did.d.ts +0 -71
- package/declarations/console/console.factory.did.js +0 -79
- package/declarations/console/console.factory.did.mjs +0 -79
- package/declarations/console/index.d.ts +0 -45
- package/declarations/console/index.js +0 -37
- package/declarations/observatory/index.d.ts +0 -45
- package/declarations/observatory/index.js +0 -38
- package/declarations/observatory/observatory.did.d.ts +0 -86
- package/declarations/observatory/observatory.factory.did.js +0 -95
- package/declarations/observatory/observatory.factory.did.mjs +0 -95
- package/dist/declarations/cmc/cmc.did +0 -122
- package/dist/declarations/cmc/cmc.did.d.ts +0 -48
- package/dist/declarations/cmc/cmc.factory.did.js +0 -67
- package/dist/declarations/cmc/index.d.ts +0 -45
- package/dist/declarations/cmc/index.js +0 -37
- package/dist/declarations/console/console.did.d.ts +0 -71
- package/dist/declarations/console/console.factory.did.js +0 -79
- package/dist/declarations/console/console.factory.did.mjs +0 -79
- package/dist/declarations/console/index.d.ts +0 -45
- package/dist/declarations/console/index.js +0 -37
- package/dist/declarations/observatory/index.d.ts +0 -45
- package/dist/declarations/observatory/index.js +0 -38
- package/dist/declarations/observatory/observatory.did.d.ts +0 -86
- package/dist/declarations/observatory/observatory.factory.did.js +0 -95
- package/dist/declarations/observatory/observatory.factory.did.mjs +0 -95
|
@@ -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 './cmc.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 cmc: ActorSubclass<_SERVICE>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
|
-
|
|
3
|
-
// Imports and re-exports candid interface
|
|
4
|
-
import {idlFactory} from './cmc.did.js';
|
|
5
|
-
export {idlFactory} from './cmc.did.js';
|
|
6
|
-
|
|
7
|
-
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
-
* Note: canister environment variable will be standardized as
|
|
9
|
-
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
-
* beginning in dfx 0.15.0
|
|
11
|
-
*/
|
|
12
|
-
export const canisterId = process.env.CANISTER_ID_CMC || process.env.CMC_CANISTER_ID;
|
|
13
|
-
|
|
14
|
-
export const createActor = (canisterId, options = {}) => {
|
|
15
|
-
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
16
|
-
|
|
17
|
-
if (options.agent && options.agentOptions) {
|
|
18
|
-
console.warn(
|
|
19
|
-
'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Fetch root key for certificate validation during development
|
|
24
|
-
if (process.env.DFX_NETWORK !== 'ic') {
|
|
25
|
-
agent.fetchRootKey().catch((err) => {
|
|
26
|
-
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
|
|
27
|
-
console.error(err);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Creates an actor with using the candid interface and the HttpAgent
|
|
32
|
-
return Actor.createActor(idlFactory, {
|
|
33
|
-
agent,
|
|
34
|
-
canisterId,
|
|
35
|
-
...options.actorOptions
|
|
36
|
-
});
|
|
37
|
-
};
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import type {ActorMethod} from '@dfinity/agent';
|
|
2
|
-
import type {Principal} from '@dfinity/principal';
|
|
3
|
-
|
|
4
|
-
export interface AddCreditsArgs {
|
|
5
|
-
user: Principal;
|
|
6
|
-
}
|
|
7
|
-
export interface AssertMissionControlCenterArgs {
|
|
8
|
-
mission_control_id: Principal;
|
|
9
|
-
user: Principal;
|
|
10
|
-
}
|
|
11
|
-
export type ControllerScope = {Write: null} | {Admin: null};
|
|
12
|
-
export interface CreateCanisterArgs {
|
|
13
|
-
block_index: [] | [bigint];
|
|
14
|
-
user: Principal;
|
|
15
|
-
}
|
|
16
|
-
export interface DeleteControllersArgs {
|
|
17
|
-
controllers: Array<Principal>;
|
|
18
|
-
}
|
|
19
|
-
export interface LoadRelease {
|
|
20
|
-
total: bigint;
|
|
21
|
-
chunks: bigint;
|
|
22
|
-
}
|
|
23
|
-
export interface MissionControl {
|
|
24
|
-
updated_at: bigint;
|
|
25
|
-
credits: Tokens;
|
|
26
|
-
mission_control_id: [] | [Principal];
|
|
27
|
-
owner: Principal;
|
|
28
|
-
created_at: bigint;
|
|
29
|
-
}
|
|
30
|
-
export interface RateConfig {
|
|
31
|
-
max_tokens: bigint;
|
|
32
|
-
time_per_token_ns: bigint;
|
|
33
|
-
}
|
|
34
|
-
export interface ReleasesVersion {
|
|
35
|
-
satellite: [] | [string];
|
|
36
|
-
orbiter: [] | [string];
|
|
37
|
-
mission_control: [] | [string];
|
|
38
|
-
}
|
|
39
|
-
export type Segment = {Orbiter: null} | {MissionControl: null} | {Satellite: null};
|
|
40
|
-
export interface SetController {
|
|
41
|
-
metadata: Array<[string, string]>;
|
|
42
|
-
scope: ControllerScope;
|
|
43
|
-
expires_at: [] | [bigint];
|
|
44
|
-
}
|
|
45
|
-
export interface SetControllersArgs {
|
|
46
|
-
controller: SetController;
|
|
47
|
-
controllers: Array<Principal>;
|
|
48
|
-
}
|
|
49
|
-
export interface Tokens {
|
|
50
|
-
e8s: bigint;
|
|
51
|
-
}
|
|
52
|
-
export interface _SERVICE {
|
|
53
|
-
add_credits: ActorMethod<[AddCreditsArgs], undefined>;
|
|
54
|
-
add_invitation_code: ActorMethod<[string], undefined>;
|
|
55
|
-
assert_mission_control_center: ActorMethod<[AssertMissionControlCenterArgs], undefined>;
|
|
56
|
-
create_orbiter: ActorMethod<[CreateCanisterArgs], Principal>;
|
|
57
|
-
create_satellite: ActorMethod<[CreateCanisterArgs], Principal>;
|
|
58
|
-
del_controllers: ActorMethod<[DeleteControllersArgs], undefined>;
|
|
59
|
-
get_create_orbiter_fee: ActorMethod<[AddCreditsArgs], [] | [Tokens]>;
|
|
60
|
-
get_create_satellite_fee: ActorMethod<[AddCreditsArgs], [] | [Tokens]>;
|
|
61
|
-
get_credits: ActorMethod<[], Tokens>;
|
|
62
|
-
get_releases_version: ActorMethod<[], ReleasesVersion>;
|
|
63
|
-
get_user_mission_control_center: ActorMethod<[], [] | [MissionControl]>;
|
|
64
|
-
init_user_mission_control_center: ActorMethod<[], MissionControl>;
|
|
65
|
-
list_user_mission_control_centers: ActorMethod<[], Array<[Principal, MissionControl]>>;
|
|
66
|
-
load_release: ActorMethod<[Segment, Uint8Array | number[], string], LoadRelease>;
|
|
67
|
-
reset_release: ActorMethod<[Segment], undefined>;
|
|
68
|
-
set_controllers: ActorMethod<[SetControllersArgs], undefined>;
|
|
69
|
-
update_rate_config: ActorMethod<[Segment, RateConfig], undefined>;
|
|
70
|
-
version: ActorMethod<[], string>;
|
|
71
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
export const idlFactory = ({IDL}) => {
|
|
3
|
-
const AddCreditsArgs = IDL.Record({user: IDL.Principal});
|
|
4
|
-
const AssertMissionControlCenterArgs = IDL.Record({
|
|
5
|
-
mission_control_id: IDL.Principal,
|
|
6
|
-
user: IDL.Principal
|
|
7
|
-
});
|
|
8
|
-
const CreateCanisterArgs = IDL.Record({
|
|
9
|
-
block_index: IDL.Opt(IDL.Nat64),
|
|
10
|
-
user: IDL.Principal
|
|
11
|
-
});
|
|
12
|
-
const DeleteControllersArgs = IDL.Record({
|
|
13
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
14
|
-
});
|
|
15
|
-
const Tokens = IDL.Record({e8s: IDL.Nat64});
|
|
16
|
-
const ReleasesVersion = IDL.Record({
|
|
17
|
-
satellite: IDL.Opt(IDL.Text),
|
|
18
|
-
orbiter: IDL.Opt(IDL.Text),
|
|
19
|
-
mission_control: IDL.Opt(IDL.Text)
|
|
20
|
-
});
|
|
21
|
-
const MissionControl = IDL.Record({
|
|
22
|
-
updated_at: IDL.Nat64,
|
|
23
|
-
credits: Tokens,
|
|
24
|
-
mission_control_id: IDL.Opt(IDL.Principal),
|
|
25
|
-
owner: IDL.Principal,
|
|
26
|
-
created_at: IDL.Nat64
|
|
27
|
-
});
|
|
28
|
-
const Segment = IDL.Variant({
|
|
29
|
-
Orbiter: IDL.Null,
|
|
30
|
-
MissionControl: IDL.Null,
|
|
31
|
-
Satellite: IDL.Null
|
|
32
|
-
});
|
|
33
|
-
const LoadRelease = IDL.Record({total: IDL.Nat64, chunks: IDL.Nat64});
|
|
34
|
-
const ControllerScope = IDL.Variant({
|
|
35
|
-
Write: IDL.Null,
|
|
36
|
-
Admin: IDL.Null
|
|
37
|
-
});
|
|
38
|
-
const SetController = IDL.Record({
|
|
39
|
-
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
40
|
-
scope: ControllerScope,
|
|
41
|
-
expires_at: IDL.Opt(IDL.Nat64)
|
|
42
|
-
});
|
|
43
|
-
const SetControllersArgs = IDL.Record({
|
|
44
|
-
controller: SetController,
|
|
45
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
46
|
-
});
|
|
47
|
-
const RateConfig = IDL.Record({
|
|
48
|
-
max_tokens: IDL.Nat64,
|
|
49
|
-
time_per_token_ns: IDL.Nat64
|
|
50
|
-
});
|
|
51
|
-
return IDL.Service({
|
|
52
|
-
add_credits: IDL.Func([AddCreditsArgs], [], []),
|
|
53
|
-
add_invitation_code: IDL.Func([IDL.Text], [], []),
|
|
54
|
-
assert_mission_control_center: IDL.Func([AssertMissionControlCenterArgs], [], ['query']),
|
|
55
|
-
create_orbiter: IDL.Func([CreateCanisterArgs], [IDL.Principal], []),
|
|
56
|
-
create_satellite: IDL.Func([CreateCanisterArgs], [IDL.Principal], []),
|
|
57
|
-
del_controllers: IDL.Func([DeleteControllersArgs], [], []),
|
|
58
|
-
get_create_orbiter_fee: IDL.Func([AddCreditsArgs], [IDL.Opt(Tokens)], ['query']),
|
|
59
|
-
get_create_satellite_fee: IDL.Func([AddCreditsArgs], [IDL.Opt(Tokens)], ['query']),
|
|
60
|
-
get_credits: IDL.Func([], [Tokens], ['query']),
|
|
61
|
-
get_releases_version: IDL.Func([], [ReleasesVersion], ['query']),
|
|
62
|
-
get_user_mission_control_center: IDL.Func([], [IDL.Opt(MissionControl)], ['query']),
|
|
63
|
-
init_user_mission_control_center: IDL.Func([], [MissionControl], []),
|
|
64
|
-
list_user_mission_control_centers: IDL.Func(
|
|
65
|
-
[],
|
|
66
|
-
[IDL.Vec(IDL.Tuple(IDL.Principal, MissionControl))],
|
|
67
|
-
['query']
|
|
68
|
-
),
|
|
69
|
-
load_release: IDL.Func([Segment, IDL.Vec(IDL.Nat8), IDL.Text], [LoadRelease], []),
|
|
70
|
-
reset_release: IDL.Func([Segment], [], []),
|
|
71
|
-
set_controllers: IDL.Func([SetControllersArgs], [], []),
|
|
72
|
-
update_rate_config: IDL.Func([Segment, RateConfig], [], []),
|
|
73
|
-
version: IDL.Func([], [IDL.Text], ['query'])
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
export const init = ({IDL}) => {
|
|
78
|
-
return [];
|
|
79
|
-
};
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
export const idlFactory = ({IDL}) => {
|
|
3
|
-
const AddCreditsArgs = IDL.Record({user: IDL.Principal});
|
|
4
|
-
const AssertMissionControlCenterArgs = IDL.Record({
|
|
5
|
-
mission_control_id: IDL.Principal,
|
|
6
|
-
user: IDL.Principal
|
|
7
|
-
});
|
|
8
|
-
const CreateCanisterArgs = IDL.Record({
|
|
9
|
-
block_index: IDL.Opt(IDL.Nat64),
|
|
10
|
-
user: IDL.Principal
|
|
11
|
-
});
|
|
12
|
-
const DeleteControllersArgs = IDL.Record({
|
|
13
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
14
|
-
});
|
|
15
|
-
const Tokens = IDL.Record({e8s: IDL.Nat64});
|
|
16
|
-
const ReleasesVersion = IDL.Record({
|
|
17
|
-
satellite: IDL.Opt(IDL.Text),
|
|
18
|
-
orbiter: IDL.Opt(IDL.Text),
|
|
19
|
-
mission_control: IDL.Opt(IDL.Text)
|
|
20
|
-
});
|
|
21
|
-
const MissionControl = IDL.Record({
|
|
22
|
-
updated_at: IDL.Nat64,
|
|
23
|
-
credits: Tokens,
|
|
24
|
-
mission_control_id: IDL.Opt(IDL.Principal),
|
|
25
|
-
owner: IDL.Principal,
|
|
26
|
-
created_at: IDL.Nat64
|
|
27
|
-
});
|
|
28
|
-
const Segment = IDL.Variant({
|
|
29
|
-
Orbiter: IDL.Null,
|
|
30
|
-
MissionControl: IDL.Null,
|
|
31
|
-
Satellite: IDL.Null
|
|
32
|
-
});
|
|
33
|
-
const LoadRelease = IDL.Record({total: IDL.Nat64, chunks: IDL.Nat64});
|
|
34
|
-
const ControllerScope = IDL.Variant({
|
|
35
|
-
Write: IDL.Null,
|
|
36
|
-
Admin: IDL.Null
|
|
37
|
-
});
|
|
38
|
-
const SetController = IDL.Record({
|
|
39
|
-
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
40
|
-
scope: ControllerScope,
|
|
41
|
-
expires_at: IDL.Opt(IDL.Nat64)
|
|
42
|
-
});
|
|
43
|
-
const SetControllersArgs = IDL.Record({
|
|
44
|
-
controller: SetController,
|
|
45
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
46
|
-
});
|
|
47
|
-
const RateConfig = IDL.Record({
|
|
48
|
-
max_tokens: IDL.Nat64,
|
|
49
|
-
time_per_token_ns: IDL.Nat64
|
|
50
|
-
});
|
|
51
|
-
return IDL.Service({
|
|
52
|
-
add_credits: IDL.Func([AddCreditsArgs], [], []),
|
|
53
|
-
add_invitation_code: IDL.Func([IDL.Text], [], []),
|
|
54
|
-
assert_mission_control_center: IDL.Func([AssertMissionControlCenterArgs], [], ['query']),
|
|
55
|
-
create_orbiter: IDL.Func([CreateCanisterArgs], [IDL.Principal], []),
|
|
56
|
-
create_satellite: IDL.Func([CreateCanisterArgs], [IDL.Principal], []),
|
|
57
|
-
del_controllers: IDL.Func([DeleteControllersArgs], [], []),
|
|
58
|
-
get_create_orbiter_fee: IDL.Func([AddCreditsArgs], [IDL.Opt(Tokens)], ['query']),
|
|
59
|
-
get_create_satellite_fee: IDL.Func([AddCreditsArgs], [IDL.Opt(Tokens)], ['query']),
|
|
60
|
-
get_credits: IDL.Func([], [Tokens], ['query']),
|
|
61
|
-
get_releases_version: IDL.Func([], [ReleasesVersion], ['query']),
|
|
62
|
-
get_user_mission_control_center: IDL.Func([], [IDL.Opt(MissionControl)], ['query']),
|
|
63
|
-
init_user_mission_control_center: IDL.Func([], [MissionControl], []),
|
|
64
|
-
list_user_mission_control_centers: IDL.Func(
|
|
65
|
-
[],
|
|
66
|
-
[IDL.Vec(IDL.Tuple(IDL.Principal, MissionControl))],
|
|
67
|
-
['query']
|
|
68
|
-
),
|
|
69
|
-
load_release: IDL.Func([Segment, IDL.Vec(IDL.Nat8), IDL.Text], [LoadRelease], []),
|
|
70
|
-
reset_release: IDL.Func([Segment], [], []),
|
|
71
|
-
set_controllers: IDL.Func([SetControllersArgs], [], []),
|
|
72
|
-
update_rate_config: IDL.Func([Segment, RateConfig], [], []),
|
|
73
|
-
version: IDL.Func([], [IDL.Text], ['query'])
|
|
74
|
-
});
|
|
75
|
-
};
|
|
76
|
-
// @ts-ignore
|
|
77
|
-
export const init = ({IDL}) => {
|
|
78
|
-
return [];
|
|
79
|
-
};
|
|
@@ -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 './console.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 console: ActorSubclass<_SERVICE>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
|
-
|
|
3
|
-
// Imports and re-exports candid interface
|
|
4
|
-
import {idlFactory} from './console.did.js';
|
|
5
|
-
export {idlFactory} from './console.did.js';
|
|
6
|
-
|
|
7
|
-
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
-
* Note: canister environment variable will be standardized as
|
|
9
|
-
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
-
* beginning in dfx 0.15.0
|
|
11
|
-
*/
|
|
12
|
-
export const canisterId = process.env.CANISTER_ID_CONSOLE || process.env.CONSOLE_CANISTER_ID;
|
|
13
|
-
|
|
14
|
-
export const createActor = (canisterId, options = {}) => {
|
|
15
|
-
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
16
|
-
|
|
17
|
-
if (options.agent && options.agentOptions) {
|
|
18
|
-
console.warn(
|
|
19
|
-
'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Fetch root key for certificate validation during development
|
|
24
|
-
if (process.env.DFX_NETWORK !== 'ic') {
|
|
25
|
-
agent.fetchRootKey().catch((err) => {
|
|
26
|
-
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
|
|
27
|
-
console.error(err);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Creates an actor with using the candid interface and the HttpAgent
|
|
32
|
-
return Actor.createActor(idlFactory, {
|
|
33
|
-
agent,
|
|
34
|
-
canisterId,
|
|
35
|
-
...options.actorOptions
|
|
36
|
-
});
|
|
37
|
-
};
|
|
@@ -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 './observatory.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 observatory: ActorSubclass<_SERVICE>;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {Actor, HttpAgent} from '@dfinity/agent';
|
|
2
|
-
|
|
3
|
-
// Imports and re-exports candid interface
|
|
4
|
-
import {idlFactory} from './observatory.did.js';
|
|
5
|
-
export {idlFactory} from './observatory.did.js';
|
|
6
|
-
|
|
7
|
-
/* CANISTER_ID is replaced by webpack based on node environment
|
|
8
|
-
* Note: canister environment variable will be standardized as
|
|
9
|
-
* process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
|
|
10
|
-
* beginning in dfx 0.15.0
|
|
11
|
-
*/
|
|
12
|
-
export const canisterId =
|
|
13
|
-
process.env.CANISTER_ID_OBSERVATORY || process.env.OBSERVATORY_CANISTER_ID;
|
|
14
|
-
|
|
15
|
-
export const createActor = (canisterId, options = {}) => {
|
|
16
|
-
const agent = options.agent || new HttpAgent({...options.agentOptions});
|
|
17
|
-
|
|
18
|
-
if (options.agent && options.agentOptions) {
|
|
19
|
-
console.warn(
|
|
20
|
-
'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Fetch root key for certificate validation during development
|
|
25
|
-
if (process.env.DFX_NETWORK !== 'ic') {
|
|
26
|
-
agent.fetchRootKey().catch((err) => {
|
|
27
|
-
console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
|
|
28
|
-
console.error(err);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Creates an actor with using the candid interface and the HttpAgent
|
|
33
|
-
return Actor.createActor(idlFactory, {
|
|
34
|
-
agent,
|
|
35
|
-
canisterId,
|
|
36
|
-
...options.actorOptions
|
|
37
|
-
});
|
|
38
|
-
};
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type {ActorMethod} from '@dfinity/agent';
|
|
2
|
-
import type {Principal} from '@dfinity/principal';
|
|
3
|
-
|
|
4
|
-
export interface CanisterStatusResponse {
|
|
5
|
-
status: CanisterStatusType;
|
|
6
|
-
memory_size: bigint;
|
|
7
|
-
cycles: bigint;
|
|
8
|
-
settings: DefiniteCanisterSettings;
|
|
9
|
-
idle_cycles_burned_per_day: bigint;
|
|
10
|
-
module_hash: [] | [Uint8Array | number[]];
|
|
11
|
-
}
|
|
12
|
-
export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null};
|
|
13
|
-
export type ControllerScope = {Write: null} | {Admin: null};
|
|
14
|
-
export interface CronJobStatuses {
|
|
15
|
-
mission_control_cycles_threshold: [] | [bigint];
|
|
16
|
-
orbiters: Array<[Principal, CronJobStatusesConfig]>;
|
|
17
|
-
satellites: Array<[Principal, CronJobStatusesConfig]>;
|
|
18
|
-
enabled: boolean;
|
|
19
|
-
cycles_threshold: [] | [bigint];
|
|
20
|
-
}
|
|
21
|
-
export interface CronJobStatusesConfig {
|
|
22
|
-
enabled: boolean;
|
|
23
|
-
cycles_threshold: [] | [bigint];
|
|
24
|
-
}
|
|
25
|
-
export interface CronJobs {
|
|
26
|
-
metadata: Array<[string, string]>;
|
|
27
|
-
statuses: CronJobStatuses;
|
|
28
|
-
}
|
|
29
|
-
export interface CronTab {
|
|
30
|
-
cron_jobs: CronJobs;
|
|
31
|
-
updated_at: bigint;
|
|
32
|
-
mission_control_id: Principal;
|
|
33
|
-
created_at: bigint;
|
|
34
|
-
}
|
|
35
|
-
export interface DefiniteCanisterSettings {
|
|
36
|
-
freezing_threshold: bigint;
|
|
37
|
-
controllers: Array<Principal>;
|
|
38
|
-
memory_allocation: bigint;
|
|
39
|
-
compute_allocation: bigint;
|
|
40
|
-
}
|
|
41
|
-
export interface DeleteControllersArgs {
|
|
42
|
-
controllers: Array<Principal>;
|
|
43
|
-
}
|
|
44
|
-
export interface ListStatuses {
|
|
45
|
-
cron_jobs: CronJobs;
|
|
46
|
-
statuses: Result_1;
|
|
47
|
-
timestamp: bigint;
|
|
48
|
-
}
|
|
49
|
-
export interface ListStatusesArgs {
|
|
50
|
-
time_delta: [] | [bigint];
|
|
51
|
-
}
|
|
52
|
-
export type Result = {Ok: SegmentStatus} | {Err: string};
|
|
53
|
-
export type Result_1 = {Ok: SegmentsStatuses} | {Err: string};
|
|
54
|
-
export interface SegmentStatus {
|
|
55
|
-
id: Principal;
|
|
56
|
-
status: CanisterStatusResponse;
|
|
57
|
-
metadata: [] | [Array<[string, string]>];
|
|
58
|
-
status_at: bigint;
|
|
59
|
-
}
|
|
60
|
-
export interface SegmentsStatuses {
|
|
61
|
-
orbiters: [] | [Array<Result>];
|
|
62
|
-
satellites: [] | [Array<Result>];
|
|
63
|
-
mission_control: Result;
|
|
64
|
-
}
|
|
65
|
-
export interface SetController {
|
|
66
|
-
metadata: Array<[string, string]>;
|
|
67
|
-
scope: ControllerScope;
|
|
68
|
-
expires_at: [] | [bigint];
|
|
69
|
-
}
|
|
70
|
-
export interface SetControllersArgs {
|
|
71
|
-
controller: SetController;
|
|
72
|
-
controllers: Array<Principal>;
|
|
73
|
-
}
|
|
74
|
-
export interface SetCronTab {
|
|
75
|
-
cron_jobs: CronJobs;
|
|
76
|
-
updated_at: [] | [bigint];
|
|
77
|
-
mission_control_id: Principal;
|
|
78
|
-
}
|
|
79
|
-
export interface _SERVICE {
|
|
80
|
-
del_controllers: ActorMethod<[DeleteControllersArgs], undefined>;
|
|
81
|
-
get_cron_tab: ActorMethod<[], [] | [CronTab]>;
|
|
82
|
-
list_statuses: ActorMethod<[ListStatusesArgs], Array<ListStatuses>>;
|
|
83
|
-
set_controllers: ActorMethod<[SetControllersArgs], undefined>;
|
|
84
|
-
set_cron_tab: ActorMethod<[SetCronTab], CronTab>;
|
|
85
|
-
version: ActorMethod<[], string>;
|
|
86
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
|
-
export const idlFactory = ({IDL}) => {
|
|
3
|
-
const DeleteControllersArgs = IDL.Record({
|
|
4
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
5
|
-
});
|
|
6
|
-
const CronJobStatusesConfig = IDL.Record({
|
|
7
|
-
enabled: IDL.Bool,
|
|
8
|
-
cycles_threshold: IDL.Opt(IDL.Nat64)
|
|
9
|
-
});
|
|
10
|
-
const CronJobStatuses = IDL.Record({
|
|
11
|
-
mission_control_cycles_threshold: IDL.Opt(IDL.Nat64),
|
|
12
|
-
orbiters: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)),
|
|
13
|
-
satellites: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)),
|
|
14
|
-
enabled: IDL.Bool,
|
|
15
|
-
cycles_threshold: IDL.Opt(IDL.Nat64)
|
|
16
|
-
});
|
|
17
|
-
const CronJobs = IDL.Record({
|
|
18
|
-
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
19
|
-
statuses: CronJobStatuses
|
|
20
|
-
});
|
|
21
|
-
const CronTab = IDL.Record({
|
|
22
|
-
cron_jobs: CronJobs,
|
|
23
|
-
updated_at: IDL.Nat64,
|
|
24
|
-
mission_control_id: IDL.Principal,
|
|
25
|
-
created_at: IDL.Nat64
|
|
26
|
-
});
|
|
27
|
-
const ListStatusesArgs = IDL.Record({time_delta: IDL.Opt(IDL.Nat64)});
|
|
28
|
-
const CanisterStatusType = IDL.Variant({
|
|
29
|
-
stopped: IDL.Null,
|
|
30
|
-
stopping: IDL.Null,
|
|
31
|
-
running: IDL.Null
|
|
32
|
-
});
|
|
33
|
-
const DefiniteCanisterSettings = IDL.Record({
|
|
34
|
-
freezing_threshold: IDL.Nat,
|
|
35
|
-
controllers: IDL.Vec(IDL.Principal),
|
|
36
|
-
memory_allocation: IDL.Nat,
|
|
37
|
-
compute_allocation: IDL.Nat
|
|
38
|
-
});
|
|
39
|
-
const CanisterStatusResponse = IDL.Record({
|
|
40
|
-
status: CanisterStatusType,
|
|
41
|
-
memory_size: IDL.Nat,
|
|
42
|
-
cycles: IDL.Nat,
|
|
43
|
-
settings: DefiniteCanisterSettings,
|
|
44
|
-
idle_cycles_burned_per_day: IDL.Nat,
|
|
45
|
-
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
|
|
46
|
-
});
|
|
47
|
-
const SegmentStatus = IDL.Record({
|
|
48
|
-
id: IDL.Principal,
|
|
49
|
-
status: CanisterStatusResponse,
|
|
50
|
-
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
|
|
51
|
-
status_at: IDL.Nat64
|
|
52
|
-
});
|
|
53
|
-
const Result = IDL.Variant({Ok: SegmentStatus, Err: IDL.Text});
|
|
54
|
-
const SegmentsStatuses = IDL.Record({
|
|
55
|
-
orbiters: IDL.Opt(IDL.Vec(Result)),
|
|
56
|
-
satellites: IDL.Opt(IDL.Vec(Result)),
|
|
57
|
-
mission_control: Result
|
|
58
|
-
});
|
|
59
|
-
const Result_1 = IDL.Variant({Ok: SegmentsStatuses, Err: IDL.Text});
|
|
60
|
-
const ListStatuses = IDL.Record({
|
|
61
|
-
cron_jobs: CronJobs,
|
|
62
|
-
statuses: Result_1,
|
|
63
|
-
timestamp: IDL.Nat64
|
|
64
|
-
});
|
|
65
|
-
const ControllerScope = IDL.Variant({
|
|
66
|
-
Write: IDL.Null,
|
|
67
|
-
Admin: IDL.Null
|
|
68
|
-
});
|
|
69
|
-
const SetController = IDL.Record({
|
|
70
|
-
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
71
|
-
scope: ControllerScope,
|
|
72
|
-
expires_at: IDL.Opt(IDL.Nat64)
|
|
73
|
-
});
|
|
74
|
-
const SetControllersArgs = IDL.Record({
|
|
75
|
-
controller: SetController,
|
|
76
|
-
controllers: IDL.Vec(IDL.Principal)
|
|
77
|
-
});
|
|
78
|
-
const SetCronTab = IDL.Record({
|
|
79
|
-
cron_jobs: CronJobs,
|
|
80
|
-
updated_at: IDL.Opt(IDL.Nat64),
|
|
81
|
-
mission_control_id: IDL.Principal
|
|
82
|
-
});
|
|
83
|
-
return IDL.Service({
|
|
84
|
-
del_controllers: IDL.Func([DeleteControllersArgs], [], []),
|
|
85
|
-
get_cron_tab: IDL.Func([], [IDL.Opt(CronTab)], ['query']),
|
|
86
|
-
list_statuses: IDL.Func([ListStatusesArgs], [IDL.Vec(ListStatuses)], ['query']),
|
|
87
|
-
set_controllers: IDL.Func([SetControllersArgs], [], []),
|
|
88
|
-
set_cron_tab: IDL.Func([SetCronTab], [CronTab], []),
|
|
89
|
-
version: IDL.Func([], [IDL.Text], ['query'])
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
// @ts-ignore
|
|
93
|
-
export const init = ({IDL}) => {
|
|
94
|
-
return [];
|
|
95
|
-
};
|