@airgap/icp 0.13.11-beta.1 → 0.13.11-beta.2
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/index.d.ts +1 -0
- package/index.js +18 -0
- package/index.js.map +1 -0
- package/package.json +4 -8
- package/v1/block-explorer/ICPBlockExplorer.d.ts +9 -0
- package/v1/block-explorer/ICPBlockExplorer.js +74 -0
- package/v1/block-explorer/ICPBlockExplorer.js.map +1 -0
- package/v1/index.d.ts +13 -0
- package/v1/index.js +11 -0
- package/v1/index.js.map +1 -0
- package/v1/module/ICPModule.d.ts +15 -0
- package/v1/module/ICPModule.js +107 -0
- package/v1/module/ICPModule.js.map +1 -0
- package/v1/module.d.ts +3 -0
- package/v1/module.js +24 -0
- package/v1/module.js.map +1 -0
- package/v1/protocol/ICPImplementation.d.ts +26 -0
- package/v1/protocol/ICPImplementation.js +344 -0
- package/v1/protocol/ICPImplementation.js.map +1 -0
- package/v1/protocol/ICPProtocol.d.ts +42 -0
- package/v1/protocol/ICPProtocol.js +416 -0
- package/v1/protocol/ICPProtocol.js.map +1 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.d.ts +7 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js +21 -0
- package/v1/serializer/v3/schemas/converter/transaction-converter.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.d.ts +4 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-request-icp.js.map +1 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.d.ts +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.js +3 -0
- package/v1/serializer/v3/schemas/definitions/transaction-sign-response-icp.js.map +1 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-request-icp.json +32 -0
- package/v1/serializer/v3/schemas/generated/transaction-sign-response-icp.json +19 -0
- package/v1/serializer/v3/serializer-companion.d.ts +14 -0
- package/v1/serializer/v3/serializer-companion.js +174 -0
- package/v1/serializer/v3/serializer-companion.js.map +1 -0
- package/v1/serializer/v3/validators/transaction-validator.d.ts +10 -0
- package/v1/serializer/v3/validators/transaction-validator.js +100 -0
- package/v1/serializer/v3/validators/transaction-validator.js.map +1 -0
- package/v1/serializer/v3/validators/validators.d.ts +5 -0
- package/v1/serializer/v3/validators/validators.js +106 -0
- package/v1/serializer/v3/validators/validators.js.map +1 -0
- package/v1/types/crypto.d.ts +2 -0
- package/v1/types/crypto.js +3 -0
- package/v1/types/crypto.js.map +1 -0
- package/v1/types/governance.d.ts +580 -0
- package/v1/types/governance.js +796 -0
- package/v1/types/governance.js.map +1 -0
- package/v1/types/ledger.d.ts +143 -0
- package/v1/types/ledger.js +146 -0
- package/v1/types/ledger.js.map +1 -0
- package/v1/types/management_idl.d.ts +7 -0
- package/v1/types/management_idl.js +72 -0
- package/v1/types/management_idl.js.map +1 -0
- package/v1/types/protocol.d.ts +8 -0
- package/v1/types/protocol.js +3 -0
- package/v1/types/protocol.js.map +1 -0
- package/v1/types/transaction.d.ts +11 -0
- package/v1/types/transaction.js +3 -0
- package/v1/types/transaction.js.map +1 -0
- package/v1/utils/account.d.ts +24 -0
- package/v1/utils/account.js +112 -0
- package/v1/utils/account.js.map +1 -0
- package/v1/utils/actor.d.ts +246 -0
- package/v1/utils/actor.js +458 -0
- package/v1/utils/actor.js.map +1 -0
- package/v1/utils/agent.d.ts +156 -0
- package/v1/utils/agent.js +16 -0
- package/v1/utils/agent.js.map +1 -0
- package/v1/utils/auth.d.ts +110 -0
- package/v1/utils/auth.js +261 -0
- package/v1/utils/auth.js.map +1 -0
- package/v1/utils/bls.d.ts +38 -0
- package/v1/utils/bls.js +204 -0
- package/v1/utils/bls.js.map +1 -0
- package/v1/utils/buffer.d.ts +70 -0
- package/v1/utils/buffer.js +216 -0
- package/v1/utils/buffer.js.map +1 -0
- package/v1/utils/cbor.d.ts +9 -0
- package/v1/utils/cbor.js +178 -0
- package/v1/utils/cbor.js.map +1 -0
- package/v1/utils/certificate.d.ts +74 -0
- package/v1/utils/certificate.js +396 -0
- package/v1/utils/certificate.js.map +1 -0
- package/v1/utils/convert.d.ts +8 -0
- package/v1/utils/convert.js +80 -0
- package/v1/utils/convert.js.map +1 -0
- package/v1/utils/crypto.d.ts +0 -0
- package/v1/utils/crypto.js +104 -0
- package/v1/utils/crypto.js.map +1 -0
- package/v1/utils/der.d.ts +35 -0
- package/v1/utils/der.js +176 -0
- package/v1/utils/der.js.map +1 -0
- package/v1/utils/errors.d.ts +7 -0
- package/v1/utils/errors.js +38 -0
- package/v1/utils/errors.js.map +1 -0
- package/v1/utils/hdkey.d.ts +13 -0
- package/v1/utils/hdkey.js +265 -0
- package/v1/utils/hdkey.js.map +1 -0
- package/v1/utils/http.d.ts +284 -0
- package/v1/utils/http.js +614 -0
- package/v1/utils/http.js.map +1 -0
- package/v1/utils/idl.d.ts +515 -0
- package/v1/utils/idl.js +2103 -0
- package/v1/utils/idl.js.map +1 -0
- package/v1/utils/leb128.d.ts +63 -0
- package/v1/utils/leb128.js +224 -0
- package/v1/utils/leb128.js.map +1 -0
- package/v1/utils/polling.d.ts +59 -0
- package/v1/utils/polling.js +325 -0
- package/v1/utils/polling.js.map +1 -0
- package/v1/utils/principal.d.ts +58 -0
- package/v1/utils/principal.js +543 -0
- package/v1/utils/principal.js.map +1 -0
- package/v1/utils/secp256k1.d.ts +79 -0
- package/v1/utils/secp256k1.js +278 -0
- package/v1/utils/secp256k1.js.map +1 -0
- package/v1/utils/transaction.d.ts +3 -0
- package/v1/utils/transaction.js +56 -0
- package/v1/utils/transaction.js.map +1 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { RequestId } from './auth';
|
|
2
|
+
import { CreateCertificateOptions } from './certificate';
|
|
3
|
+
import { Agent, HttpAgent, QueryResponseRejected, SubmitResponse } from './http';
|
|
4
|
+
import { Principal } from './principal';
|
|
5
|
+
import * as IDL from './idl';
|
|
6
|
+
import { PollStrategyFactory } from './polling';
|
|
7
|
+
import { AgentError } from './errors';
|
|
8
|
+
export interface GlobalInternetComputer {
|
|
9
|
+
ic: {
|
|
10
|
+
agent: Agent;
|
|
11
|
+
HttpAgent: typeof HttpAgent;
|
|
12
|
+
IDL: typeof IDL;
|
|
13
|
+
/**
|
|
14
|
+
* Simple advertisement of features in whoever is managing this `globalThis.ic`.
|
|
15
|
+
* Use Case
|
|
16
|
+
* * Scripts that know they need an ic feature can detect using this and, if not present
|
|
17
|
+
* (e.g. old bootstrap version), they can dynamically include their own and continue
|
|
18
|
+
* operating (e.g. polyfill).
|
|
19
|
+
* This is useful when adding features to bootstrap. You can still deploy your canister to
|
|
20
|
+
* an ic with old bootstrap, then just dynamically reload your own new-version bootstrap if
|
|
21
|
+
* needed.
|
|
22
|
+
*/
|
|
23
|
+
features?: {
|
|
24
|
+
/** This is falsy if authn isn't supported at all */
|
|
25
|
+
authentication?: boolean;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The Actor for the canister being used for the frontend. Normally should correspond to the
|
|
29
|
+
* canister represented by the canister id in the URL.
|
|
30
|
+
*
|
|
31
|
+
* It does not have any functions configured.
|
|
32
|
+
*
|
|
33
|
+
* If a canister ID could not be found, no actor were created and this is undefined.
|
|
34
|
+
*/
|
|
35
|
+
canister: ActorSubclass | undefined;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare function getDefaultAgent(): Agent;
|
|
39
|
+
/**
|
|
40
|
+
* This file is generated from the candid for asset management.
|
|
41
|
+
*/
|
|
42
|
+
export declare type canister_id = Principal;
|
|
43
|
+
export interface canister_settings {
|
|
44
|
+
controllers: [] | [Array<Principal>];
|
|
45
|
+
freezing_threshold: [] | [bigint];
|
|
46
|
+
memory_allocation: [] | [bigint];
|
|
47
|
+
compute_allocation: [] | [bigint];
|
|
48
|
+
}
|
|
49
|
+
export interface definite_canister_settings {
|
|
50
|
+
controllers: Array<Principal>;
|
|
51
|
+
freezing_threshold: bigint;
|
|
52
|
+
memory_allocation: bigint;
|
|
53
|
+
compute_allocation: bigint;
|
|
54
|
+
}
|
|
55
|
+
export declare type user_id = Principal;
|
|
56
|
+
export declare type wasm_module = Array<number>;
|
|
57
|
+
export default interface _SERVICE {
|
|
58
|
+
canister_status: (arg_0: {
|
|
59
|
+
canister_id: canister_id;
|
|
60
|
+
}) => Promise<{
|
|
61
|
+
status: {
|
|
62
|
+
stopped: null;
|
|
63
|
+
} | {
|
|
64
|
+
stopping: null;
|
|
65
|
+
} | {
|
|
66
|
+
running: null;
|
|
67
|
+
};
|
|
68
|
+
memory_size: bigint;
|
|
69
|
+
cycles: bigint;
|
|
70
|
+
settings: definite_canister_settings;
|
|
71
|
+
module_hash: [] | [Array<number>];
|
|
72
|
+
}>;
|
|
73
|
+
create_canister: (arg_0: {
|
|
74
|
+
settings: [] | [canister_settings];
|
|
75
|
+
}) => Promise<{
|
|
76
|
+
canister_id: canister_id;
|
|
77
|
+
}>;
|
|
78
|
+
delete_canister: (arg_0: {
|
|
79
|
+
canister_id: canister_id;
|
|
80
|
+
}) => Promise<undefined>;
|
|
81
|
+
deposit_cycles: (arg_0: {
|
|
82
|
+
canister_id: canister_id;
|
|
83
|
+
}) => Promise<undefined>;
|
|
84
|
+
install_code: (arg_0: {
|
|
85
|
+
arg: Array<number>;
|
|
86
|
+
wasm_module: wasm_module;
|
|
87
|
+
mode: {
|
|
88
|
+
reinstall: null;
|
|
89
|
+
} | {
|
|
90
|
+
upgrade: null;
|
|
91
|
+
} | {
|
|
92
|
+
install: null;
|
|
93
|
+
};
|
|
94
|
+
canister_id: canister_id;
|
|
95
|
+
}) => Promise<undefined>;
|
|
96
|
+
provisional_create_canister_with_cycles: (arg_0: {
|
|
97
|
+
settings: [] | [canister_settings];
|
|
98
|
+
amount: [] | [bigint];
|
|
99
|
+
}) => Promise<{
|
|
100
|
+
canister_id: canister_id;
|
|
101
|
+
}>;
|
|
102
|
+
provisional_top_up_canister: (arg_0: {
|
|
103
|
+
canister_id: canister_id;
|
|
104
|
+
amount: bigint;
|
|
105
|
+
}) => Promise<undefined>;
|
|
106
|
+
raw_rand: () => Promise<Array<number>>;
|
|
107
|
+
start_canister: (arg_0: {
|
|
108
|
+
canister_id: canister_id;
|
|
109
|
+
}) => Promise<undefined>;
|
|
110
|
+
stop_canister: (arg_0: {
|
|
111
|
+
canister_id: canister_id;
|
|
112
|
+
}) => Promise<undefined>;
|
|
113
|
+
uninstall_code: (arg_0: {
|
|
114
|
+
canister_id: canister_id;
|
|
115
|
+
}) => Promise<undefined>;
|
|
116
|
+
update_settings: (arg_0: {
|
|
117
|
+
canister_id: Principal;
|
|
118
|
+
settings: canister_settings;
|
|
119
|
+
}) => Promise<undefined>;
|
|
120
|
+
}
|
|
121
|
+
export declare type ManagementCanisterRecord = _SERVICE;
|
|
122
|
+
export declare function getManagementCanister(config: CallConfig): ActorSubclass<ManagementCanisterRecord>;
|
|
123
|
+
export declare class ActorCallError extends AgentError {
|
|
124
|
+
readonly canisterId: Principal;
|
|
125
|
+
readonly methodName: string;
|
|
126
|
+
readonly type: 'query' | 'update';
|
|
127
|
+
readonly props: Record<string, string>;
|
|
128
|
+
constructor(canisterId: Principal, methodName: string, type: 'query' | 'update', props: Record<string, string>);
|
|
129
|
+
}
|
|
130
|
+
export declare class QueryCallRejectedError extends ActorCallError {
|
|
131
|
+
readonly result: QueryResponseRejected;
|
|
132
|
+
constructor(canisterId: Principal, methodName: string, result: QueryResponseRejected);
|
|
133
|
+
}
|
|
134
|
+
export declare class UpdateCallRejectedError extends ActorCallError {
|
|
135
|
+
readonly requestId: RequestId;
|
|
136
|
+
readonly response: SubmitResponse['response'];
|
|
137
|
+
constructor(canisterId: Principal, methodName: string, requestId: RequestId, response: SubmitResponse['response']);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Configuration to make calls to the Replica.
|
|
141
|
+
*/
|
|
142
|
+
export interface CallConfig {
|
|
143
|
+
/**
|
|
144
|
+
* An agent to use in this call, otherwise the actor or call will try to discover the
|
|
145
|
+
* agent to use.
|
|
146
|
+
*/
|
|
147
|
+
agent?: Agent;
|
|
148
|
+
/**
|
|
149
|
+
* A polling strategy factory that dictates how much and often we should poll the
|
|
150
|
+
* read_state endpoint to get the result of an update call.
|
|
151
|
+
*/
|
|
152
|
+
pollingStrategyFactory?: PollStrategyFactory;
|
|
153
|
+
/**
|
|
154
|
+
* The canister ID of this Actor.
|
|
155
|
+
*/
|
|
156
|
+
canisterId?: string | Principal;
|
|
157
|
+
/**
|
|
158
|
+
* The effective canister ID. This should almost always be ignored.
|
|
159
|
+
*/
|
|
160
|
+
effectiveCanisterId?: Principal;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Configuration that can be passed to customize the Actor behaviour.
|
|
164
|
+
*/
|
|
165
|
+
export interface ActorConfig extends CallConfig {
|
|
166
|
+
/**
|
|
167
|
+
* The Canister ID of this Actor. This is required for an Actor.
|
|
168
|
+
*/
|
|
169
|
+
canisterId: string | Principal;
|
|
170
|
+
/**
|
|
171
|
+
* An override function for update calls' CallConfig. This will be called on every calls.
|
|
172
|
+
*/
|
|
173
|
+
callTransform?(methodName: string, args: unknown[], callConfig: CallConfig): Partial<CallConfig> | void;
|
|
174
|
+
/**
|
|
175
|
+
* An override function for query calls' CallConfig. This will be called on every query.
|
|
176
|
+
*/
|
|
177
|
+
queryTransform?(methodName: string, args: unknown[], callConfig: CallConfig): Partial<CallConfig> | void;
|
|
178
|
+
/**
|
|
179
|
+
* Polyfill for BLS Certificate verification in case wasm is not supported
|
|
180
|
+
*/
|
|
181
|
+
blsVerify?: CreateCertificateOptions['blsVerify'];
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* A subclass of an actor. Actor class itself is meant to be a based class.
|
|
185
|
+
*/
|
|
186
|
+
export declare type ActorSubclass<T = Record<string, ActorMethod>> = Actor & T;
|
|
187
|
+
/**
|
|
188
|
+
* An actor method type, defined for each methods of the actor service.
|
|
189
|
+
*/
|
|
190
|
+
export interface ActorMethod<Args extends unknown[] = unknown[], Ret extends unknown = unknown> {
|
|
191
|
+
(...args: Args): Promise<Ret>;
|
|
192
|
+
withOptions(options: CallConfig): (...args: Args) => Promise<Ret>;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* The mode used when installing a canister.
|
|
196
|
+
*/
|
|
197
|
+
export declare enum CanisterInstallMode {
|
|
198
|
+
Install = "install",
|
|
199
|
+
Reinstall = "reinstall",
|
|
200
|
+
Upgrade = "upgrade"
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Internal metadata for actors. It's an enhanced version of ActorConfig with
|
|
204
|
+
* some fields marked as required (as they are defaulted) and canisterId as
|
|
205
|
+
* a Principal type.
|
|
206
|
+
*/
|
|
207
|
+
interface ActorMetadata {
|
|
208
|
+
service: IDL.ServiceClass;
|
|
209
|
+
agent?: Agent;
|
|
210
|
+
config: ActorConfig;
|
|
211
|
+
}
|
|
212
|
+
declare const metadataSymbol: unique symbol;
|
|
213
|
+
/**
|
|
214
|
+
* An actor base class. An actor is an object containing only functions that will
|
|
215
|
+
* return a promise. These functions are derived from the IDL definition.
|
|
216
|
+
*/
|
|
217
|
+
export declare class Actor {
|
|
218
|
+
/**
|
|
219
|
+
* Get the Agent class this Actor would call, or undefined if the Actor would use
|
|
220
|
+
* the default agent (global.ic.agent).
|
|
221
|
+
* @param actor The actor to get the agent of.
|
|
222
|
+
*/
|
|
223
|
+
static agentOf(actor: Actor): Agent | undefined;
|
|
224
|
+
/**
|
|
225
|
+
* Get the interface of an actor, in the form of an instance of a Service.
|
|
226
|
+
* @param actor The actor to get the interface of.
|
|
227
|
+
*/
|
|
228
|
+
static interfaceOf(actor: Actor): IDL.ServiceClass;
|
|
229
|
+
static canisterIdOf(actor: Actor): Principal;
|
|
230
|
+
static install(fields: {
|
|
231
|
+
module: ArrayBuffer;
|
|
232
|
+
mode?: CanisterInstallMode;
|
|
233
|
+
arg?: ArrayBuffer;
|
|
234
|
+
}, config: ActorConfig): Promise<void>;
|
|
235
|
+
static createCanister(config?: CallConfig): Promise<Principal>;
|
|
236
|
+
static createAndInstallCanister(interfaceFactory: IDL.InterfaceFactory, fields: {
|
|
237
|
+
module: ArrayBuffer;
|
|
238
|
+
arg?: ArrayBuffer;
|
|
239
|
+
}, config?: CallConfig): Promise<ActorSubclass>;
|
|
240
|
+
static createActorClass(interfaceFactory: IDL.InterfaceFactory): ActorConstructor;
|
|
241
|
+
static createActor<T = Record<string, ActorMethod>>(interfaceFactory: IDL.InterfaceFactory, configuration: ActorConfig): ActorSubclass<T>;
|
|
242
|
+
private [metadataSymbol];
|
|
243
|
+
protected constructor(metadata: ActorMetadata);
|
|
244
|
+
}
|
|
245
|
+
export declare type ActorConstructor = new (config: ActorConfig) => ActorSubclass;
|
|
246
|
+
export {};
|