@dfinity/pic 0.12.0-b0

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 (63) hide show
  1. package/README.md +73 -0
  2. package/dist/error.d.ts +21 -0
  3. package/dist/error.js +55 -0
  4. package/dist/error.js.map +1 -0
  5. package/dist/http2-client.d.ts +27 -0
  6. package/dist/http2-client.js +137 -0
  7. package/dist/http2-client.js.map +1 -0
  8. package/dist/identity.d.ts +74 -0
  9. package/dist/identity.js +94 -0
  10. package/dist/identity.js.map +1 -0
  11. package/dist/index.d.ts +7 -0
  12. package/dist/index.js +24 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/management-canister.d.ts +45 -0
  15. package/dist/management-canister.js +71 -0
  16. package/dist/management-canister.js.map +1 -0
  17. package/dist/pocket-ic-actor.d.ts +85 -0
  18. package/dist/pocket-ic-actor.js +58 -0
  19. package/dist/pocket-ic-actor.js.map +1 -0
  20. package/dist/pocket-ic-client-types.d.ts +372 -0
  21. package/dist/pocket-ic-client-types.js +395 -0
  22. package/dist/pocket-ic-client-types.js.map +1 -0
  23. package/dist/pocket-ic-client.d.ts +31 -0
  24. package/dist/pocket-ic-client.js +152 -0
  25. package/dist/pocket-ic-client.js.map +1 -0
  26. package/dist/pocket-ic-deferred-actor.d.ts +67 -0
  27. package/dist/pocket-ic-deferred-actor.js +44 -0
  28. package/dist/pocket-ic-deferred-actor.js.map +1 -0
  29. package/dist/pocket-ic-server-types.d.ts +13 -0
  30. package/dist/pocket-ic-server-types.js +3 -0
  31. package/dist/pocket-ic-server-types.js.map +1 -0
  32. package/dist/pocket-ic-server.d.ts +53 -0
  33. package/dist/pocket-ic-server.js +126 -0
  34. package/dist/pocket-ic-server.js.map +1 -0
  35. package/dist/pocket-ic-types.d.ts +679 -0
  36. package/dist/pocket-ic-types.js +72 -0
  37. package/dist/pocket-ic-types.js.map +1 -0
  38. package/dist/pocket-ic.d.ts +972 -0
  39. package/dist/pocket-ic.js +1248 -0
  40. package/dist/pocket-ic.js.map +1 -0
  41. package/dist/util/candid.d.ts +3 -0
  42. package/dist/util/candid.js +21 -0
  43. package/dist/util/candid.js.map +1 -0
  44. package/dist/util/encoding.d.ts +6 -0
  45. package/dist/util/encoding.js +24 -0
  46. package/dist/util/encoding.js.map +1 -0
  47. package/dist/util/fs.d.ts +4 -0
  48. package/dist/util/fs.js +28 -0
  49. package/dist/util/fs.js.map +1 -0
  50. package/dist/util/index.d.ts +6 -0
  51. package/dist/util/index.js +23 -0
  52. package/dist/util/index.js.map +1 -0
  53. package/dist/util/is-nil.d.ts +2 -0
  54. package/dist/util/is-nil.js +11 -0
  55. package/dist/util/is-nil.js.map +1 -0
  56. package/dist/util/os.d.ts +4 -0
  57. package/dist/util/os.js +19 -0
  58. package/dist/util/os.js.map +1 -0
  59. package/dist/util/poll.d.ts +5 -0
  60. package/dist/util/poll.js +23 -0
  61. package/dist/util/poll.js.map +1 -0
  62. package/package.json +40 -0
  63. package/postinstall.mjs +25 -0
package/README.md ADDED
@@ -0,0 +1,73 @@
1
+ # Pic JS
2
+
3
+ Pic JS is a library for interacting with a local instance of `pocket-ic` from TypeScript.
4
+
5
+ The `pocket-ic` is a canister testing platform for the [Internet Computer](https://internetcomputer.org/). It is a standalone executable that can be used to test canisters locally, without the need to deploy them to a full replica.
6
+
7
+ Other languages available include [Python](https://github.com/dfinity/pocketic-py/) and [Rust](https://github.com/dfinity/ic/tree/master/packages/pocket-ic).
8
+
9
+ ## Installation
10
+
11
+ ```shell
12
+ npm i -D @dfinity/pic
13
+ ```
14
+
15
+ Install peer dependencies if they are not already installed:
16
+
17
+ ```shell
18
+ npm i -D @dfinity/{agent,candid,identity,principal}
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ The easiest way to use PocketIC is to use `setupCanister` convenience method:
24
+
25
+ ```ts
26
+ import { PocketIc } from '@dfinity/pic';
27
+ import { _SERVICE, idlFactory } from '../declarations';
28
+
29
+ const wasmPath = resolve('..', '..', 'canister.wasm');
30
+
31
+ const pic = await PocketIc.create();
32
+ const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);
33
+ const { actor } = fixture;
34
+
35
+ // perform tests...
36
+
37
+ await pic.tearDown();
38
+ ```
39
+
40
+ If more control is needed, then the `createCanister`, `installCode` and `createActor` methods can be used directly:
41
+
42
+ ```ts
43
+ import { PocketIc } from '@dfinity/pic';
44
+ import { _SERVICE, idlFactory } from '../declarations';
45
+
46
+ const wasmPath = resolve('..', '..', 'canister.wasm');
47
+
48
+ const pic = await PocketIc.create();
49
+
50
+ const canisterId = await pic.createCanister();
51
+ await pic.installCode(canisterId, wasmPath);
52
+ const actor = pic.createActor<_SERVICE>(idlFactory, canisterId);
53
+
54
+ // perform tests...
55
+
56
+ await pic.tearDown();
57
+ ```
58
+
59
+ ## Documentation
60
+
61
+ More detailed documentation is available over at [dfinity.github.io/pic-js](https://dfinity.github.io/pic-js/).
62
+
63
+ ## Examples
64
+
65
+ All examples are written in [TypeScript](https://www.typescriptlang.org/) with [Jest](https://jestjs.io/) as the test runner,
66
+ but `@dfinity/pic` can be used with JavaScript and any other testing runner, such as [NodeJS](https://nodejs.org/dist/latest-v20.x/docs/api/test.html), [bun](https://bun.sh/docs/cli/test) or [Mocha](https://mochajs.org/).
67
+
68
+ - The [Counter](https://github.com/dfinity/pic-js/tree/main/examples/counter/README.md) example demonstrates how to work with a simple canister as well as init arguments, canister upgrades and WASM reinstallation.
69
+ - The [Clock](https://github.com/dfinity/pic-js/tree/main/examples/clock/README.md) example demonstrates how to work with the replica's system time, canister timers as well as checking for canister existence and cycle management.
70
+ - The [Todo](https://github.com/dfinity/pic-js/tree/main/examples/todo/README.md) example demonstrates how to work with more complex canisters, identities, canister upgrades, and stable memory management.
71
+ - The [Multicanister](https://github.com/dfinity/pic-js/tree/main/examples/multicanister/README.md) example demonstrates how to work with multiple canisters and multiple subnets.
72
+ - The [NNS Proxy](https://github.com/dfinity/pic-js/tree/main/examples/nns_proxy/README.md) example demonstrates how to work with an NNS state directory.
73
+ - [Google Search](https://github.com/dfinity/pic-js/tree/main/examples/google_search/README.md) example demonstrates how to mock HTTPS Outcalls.
@@ -0,0 +1,21 @@
1
+ export declare class BinStartError extends Error {
2
+ constructor(cause: Error);
3
+ }
4
+ export declare class BinStartMacOSArmError extends Error {
5
+ constructor(cause: Error);
6
+ }
7
+ export declare class BinNotFoundError extends Error {
8
+ constructor(picBinPath: string);
9
+ }
10
+ export declare class BinTimeoutError extends Error {
11
+ constructor();
12
+ }
13
+ export declare class ServerRequestTimeoutError extends Error {
14
+ constructor();
15
+ }
16
+ export declare class InstanceDeletedError extends Error {
17
+ constructor();
18
+ }
19
+ export declare class TopologyValidationError extends Error {
20
+ constructor();
21
+ }
package/dist/error.js ADDED
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TopologyValidationError = exports.InstanceDeletedError = exports.ServerRequestTimeoutError = exports.BinTimeoutError = exports.BinNotFoundError = exports.BinStartMacOSArmError = exports.BinStartError = void 0;
4
+ class BinStartError extends Error {
5
+ constructor(cause) {
6
+ super(`There was an error starting the PocketIC Binary.
7
+
8
+ Original error: ${cause.name} ${cause.message}.
9
+ ${cause.stack}`, { cause });
10
+ }
11
+ }
12
+ exports.BinStartError = BinStartError;
13
+ class BinStartMacOSArmError extends Error {
14
+ constructor(cause) {
15
+ super(`There was an error starting the PocketIC Binary.
16
+
17
+ It seems you are running on an Apple Silicon Mac. The PocketIC binary can not run with the ARM architecture on Apple Silicon Macs.
18
+ Please install and enable Rosetta if it is not enabled and try again.
19
+
20
+ Original error: ${cause.name} ${cause.message}.
21
+ ${cause.stack}`, { cause });
22
+ }
23
+ }
24
+ exports.BinStartMacOSArmError = BinStartMacOSArmError;
25
+ class BinNotFoundError extends Error {
26
+ constructor(picBinPath) {
27
+ super(`Could not find the PocketIC binary. The PocketIC binary could not be found at ${picBinPath}. Please try installing @dfinity/pic again.`);
28
+ }
29
+ }
30
+ exports.BinNotFoundError = BinNotFoundError;
31
+ class BinTimeoutError extends Error {
32
+ constructor() {
33
+ super('The PocketIC binary took too long to start. Please try again.');
34
+ }
35
+ }
36
+ exports.BinTimeoutError = BinTimeoutError;
37
+ class ServerRequestTimeoutError extends Error {
38
+ constructor() {
39
+ super('A request to the PocketIC server timed out.');
40
+ }
41
+ }
42
+ exports.ServerRequestTimeoutError = ServerRequestTimeoutError;
43
+ class InstanceDeletedError extends Error {
44
+ constructor() {
45
+ super('This PocketIC instance has been torn down. Please create a new instance before interacting further with PocketIC.');
46
+ }
47
+ }
48
+ exports.InstanceDeletedError = InstanceDeletedError;
49
+ class TopologyValidationError extends Error {
50
+ constructor() {
51
+ super('The provided subnet configuration is invalid. At least one subnet must be configured and the number of both application and system subnets must be at least 0 (non-negative).');
52
+ }
53
+ }
54
+ exports.TopologyValidationError = TopologyValidationError;
55
+ //# sourceMappingURL=error.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACtC,YAAY,KAAY;QACtB,KAAK,CACH;;kBAEY,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO;EAC3C,KAAK,CAAC,KAAK,EAAE,EACT,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;CACF;AAVD,sCAUC;AAED,MAAa,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,KAAY;QACtB,KAAK,CACH;;;;;kBAKY,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO;EAC3C,KAAK,CAAC,KAAK,EAAE,EACT,EAAE,KAAK,EAAE,CACV,CAAC;IACJ,CAAC;CACF;AAbD,sDAaC;AAED,MAAa,gBAAiB,SAAQ,KAAK;IACzC,YAAY,UAAkB;QAC5B,KAAK,CACH,iFAAiF,UAAU,6CAA6C,CACzI,CAAC;IACJ,CAAC;CACF;AAND,4CAMC;AAED,MAAa,eAAgB,SAAQ,KAAK;IACxC;QACE,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACzE,CAAC;CACF;AAJD,0CAIC;AAED,MAAa,yBAA0B,SAAQ,KAAK;IAClD;QACE,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACvD,CAAC;CACF;AAJD,8DAIC;AAED,MAAa,oBAAqB,SAAQ,KAAK;IAC7C;QACE,KAAK,CACH,mHAAmH,CACpH,CAAC;IACJ,CAAC;CACF;AAND,oDAMC;AAED,MAAa,uBAAwB,SAAQ,KAAK;IAChD;QACE,KAAK,CACH,+KAA+K,CAChL,CAAC;IACJ,CAAC;CACF;AAND,0DAMC"}
@@ -0,0 +1,27 @@
1
+ export interface RequestOptions {
2
+ method: Method;
3
+ path: string;
4
+ headers?: RequestHeaders;
5
+ body?: Uint8Array;
6
+ }
7
+ export type RequestHeaders = RequestInit['headers'];
8
+ export interface JsonGetRequest {
9
+ path: string;
10
+ headers?: RequestHeaders;
11
+ }
12
+ export interface JsonPostRequest<B> {
13
+ path: string;
14
+ headers?: RequestHeaders;
15
+ body?: B;
16
+ }
17
+ export type ResponseHeaders = ResponseInit['headers'];
18
+ export type Method = 'GET' | 'POST' | 'PUT' | 'DELETE';
19
+ export declare const JSON_HEADER: RequestHeaders;
20
+ export declare class Http2Client {
21
+ private readonly baseUrl;
22
+ private readonly processingTimeoutMs;
23
+ constructor(baseUrl: string, processingTimeoutMs: number);
24
+ request(init: RequestOptions): Promise<Response>;
25
+ jsonGet<R extends {}>(init: JsonGetRequest): Promise<R>;
26
+ jsonPost<B, R extends {}>(init: JsonPostRequest<B>): Promise<R>;
27
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Http2Client = exports.JSON_HEADER = void 0;
4
+ const error_1 = require("./error");
5
+ const util_1 = require("./util");
6
+ exports.JSON_HEADER = {
7
+ 'Content-Type': 'application/json',
8
+ };
9
+ class Http2Client {
10
+ baseUrl;
11
+ processingTimeoutMs;
12
+ constructor(baseUrl, processingTimeoutMs) {
13
+ this.baseUrl = baseUrl;
14
+ this.processingTimeoutMs = processingTimeoutMs;
15
+ }
16
+ request(init) {
17
+ const timeoutAbortController = new AbortController();
18
+ const requestAbortController = new AbortController();
19
+ const cancelAfterTimeout = async () => {
20
+ return await new Promise((_, reject) => {
21
+ const timeoutId = setTimeout(() => {
22
+ requestAbortController.abort();
23
+ reject(new error_1.ServerRequestTimeoutError());
24
+ }, this.processingTimeoutMs);
25
+ timeoutAbortController.signal.addEventListener('abort', () => {
26
+ clearTimeout(timeoutId);
27
+ reject(new error_1.ServerRequestTimeoutError());
28
+ });
29
+ });
30
+ };
31
+ const makeRequest = async () => {
32
+ const url = `${this.baseUrl}${init.path}`;
33
+ const res = await fetch(url, {
34
+ method: init.method,
35
+ headers: init.headers,
36
+ body: init.body,
37
+ signal: requestAbortController.signal,
38
+ });
39
+ timeoutAbortController.abort();
40
+ return res;
41
+ };
42
+ return Promise.race([makeRequest(), cancelAfterTimeout()]);
43
+ }
44
+ async jsonGet(init) {
45
+ // poll the request until it is successful or times out
46
+ return await (0, util_1.poll)(async () => {
47
+ const res = await this.request({
48
+ method: 'GET',
49
+ path: init.path,
50
+ headers: { ...init.headers, ...exports.JSON_HEADER },
51
+ });
52
+ const resBody = (await res.json());
53
+ if (!resBody) {
54
+ return resBody;
55
+ }
56
+ // server encountered an error, throw and try again
57
+ if ('message' in resBody) {
58
+ console.error('PocketIC server encountered an error', resBody.message);
59
+ throw new Error(resBody.message);
60
+ }
61
+ // the server has started processing or is busy
62
+ if ('state_label' in resBody) {
63
+ // the server is too busy to process the request, throw and try again
64
+ if (res.status === 409) {
65
+ throw new Error('Server busy');
66
+ }
67
+ // the server has started processing the request
68
+ // this shouldn't happen for GET requests, throw and try again
69
+ if (res.status === 202) {
70
+ throw new Error('Server started processing');
71
+ }
72
+ // something weird happened, throw and try again
73
+ throw new Error('Unknown state');
74
+ }
75
+ // the request was successful, exit the loop
76
+ return resBody;
77
+ }, { intervalMs: POLLING_INTERVAL_MS, timeoutMs: this.processingTimeoutMs });
78
+ }
79
+ async jsonPost(init) {
80
+ const reqBody = init.body
81
+ ? new TextEncoder().encode(JSON.stringify(init.body))
82
+ : undefined;
83
+ // poll the request until it is successful or times out
84
+ return await (0, util_1.poll)(async () => {
85
+ const res = await this.request({
86
+ method: 'POST',
87
+ path: init.path,
88
+ headers: { ...init.headers, ...exports.JSON_HEADER },
89
+ body: reqBody,
90
+ });
91
+ const resBody = (await res.json());
92
+ if ((0, util_1.isNil)(resBody)) {
93
+ return resBody;
94
+ }
95
+ // server encountered an error, throw and try again
96
+ if ('message' in resBody) {
97
+ console.error('PocketIC server encountered an error', resBody.message);
98
+ throw new Error(resBody.message);
99
+ }
100
+ // the server has started processing or is busy
101
+ if ('state_label' in resBody) {
102
+ // the server is too busy to process the request, throw and try again
103
+ if (res.status === 409) {
104
+ throw new Error('Server busy');
105
+ }
106
+ // the server has started processing the request, poll until it is done
107
+ if (res.status === 202) {
108
+ return await (0, util_1.poll)(async () => {
109
+ const stateRes = await this.request({
110
+ method: 'GET',
111
+ path: `/read_graph/${resBody.state_label}/${resBody.op_id}`,
112
+ });
113
+ const stateBody = (await stateRes.json());
114
+ // the server encountered an error, throw and try again
115
+ if ((0, util_1.isNil)(stateBody) ||
116
+ 'message' in stateBody ||
117
+ 'state_label' in stateBody) {
118
+ throw new Error('Polling has not succeeded yet');
119
+ }
120
+ // the request was successful, exit the loop
121
+ return stateBody;
122
+ }, {
123
+ intervalMs: POLLING_INTERVAL_MS,
124
+ timeoutMs: this.processingTimeoutMs,
125
+ });
126
+ }
127
+ // something weird happened, throw and try again
128
+ throw new Error('Unknown state');
129
+ }
130
+ // the request was successful, exit the loop
131
+ return resBody;
132
+ }, { intervalMs: POLLING_INTERVAL_MS, timeoutMs: this.processingTimeoutMs });
133
+ }
134
+ }
135
+ exports.Http2Client = Http2Client;
136
+ const POLLING_INTERVAL_MS = 10;
137
+ //# sourceMappingURL=http2-client.js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.
4
+ * The seed phrase can be any arbitrary string.
5
+ *
6
+ * The Identity is generated deterministically from the seed phrase,
7
+ * so subsequent calls to this function with the same seed phrase will
8
+ * produce the same Identity.
9
+ *
10
+ * This is useful for tests where a persistent Identity is necessary
11
+ * but it's easier to store the seed phrase than the Identity itself.
12
+ *
13
+ * @category API
14
+ * @param seedPhrase The seed phrase to create the identity from. Can be any arbitrary string.
15
+ * @returns An identity created from the seed phrase.
16
+ *
17
+ * @see [Identity](https://agent-js.icp.xyz/agent/interfaces/Identity.html)
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * import { PocketIc, PocketIcServer, createIdentity } from '@dfinity/pic';
22
+ * import { AnonymousIdentity } from '@dfinity/agent';
23
+ * import { _SERVICE, idlFactory } from '../declarations';
24
+ *
25
+ * const wasmPath = resolve('..', '..', 'canister.wasm');
26
+ *
27
+ * const picServer = await PocketIcServer.create();
28
+ * const pic = await PocketIc.create(picServer.getUrl());
29
+ * const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);
30
+ * const { actor } = fixture;
31
+ *
32
+ * const bob = createIdentity('SuperSecretSeedPhraseForBob');
33
+ * actor.setIdentity(bob);
34
+ *
35
+ * await pic.tearDown();
36
+ * await picServer.stop();
37
+ * ```
38
+ */
39
+ export declare function createIdentity(seedPhrase: string): Identity;
40
+ /**
41
+ * Create an Identity from a randomly generated bip39 seed phrase.
42
+ * Subsequent calls to this function will produce different Identities
43
+ * with an extremely low probability of collision.
44
+ *
45
+ * This is useful for tests where it is important to avoid conflicts arising
46
+ * from multiple identities accessing the same canister and maintaining
47
+ * the necessary seed phrases would become cumbersome.
48
+ *
49
+ * @category API
50
+ * @returns An identity created from a random seed phrase.
51
+ *
52
+ * @see [Identity](https://agent-js.icp.xyz/agent/interfaces/Identity.html)
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * import { PocketIc, PocketIcServer, generateRandomIdentity } from '@dfinity/pic';
57
+ * import { AnonymousIdentity } from '@dfinity/agent';
58
+ * import { _SERVICE, idlFactory } from '../declarations';
59
+ *
60
+ * const wasmPath = resolve('..', '..', 'canister.wasm');
61
+ *
62
+ * const picServer = await PocketIcServer.create();
63
+ * const pic = await PocketIc.create(picServer.getUrl());
64
+ * const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);
65
+ * const { actor } = fixture;
66
+ *
67
+ * const bob = generateRandomIdentity();
68
+ * actor.setIdentity(bob);
69
+ *
70
+ * await pic.tearDown();
71
+ * await picServer.stop();
72
+ * ```
73
+ */
74
+ export declare function generateRandomIdentity(): Identity;
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createIdentity = createIdentity;
4
+ exports.generateRandomIdentity = generateRandomIdentity;
5
+ const node_crypto_1 = require("node:crypto");
6
+ const bip39_1 = require("bip39");
7
+ const identity_1 = require("@dfinity/identity");
8
+ /**
9
+ * Create an Identity from a seed phrase.
10
+ * The seed phrase can be any arbitrary string.
11
+ *
12
+ * The Identity is generated deterministically from the seed phrase,
13
+ * so subsequent calls to this function with the same seed phrase will
14
+ * produce the same Identity.
15
+ *
16
+ * This is useful for tests where a persistent Identity is necessary
17
+ * but it's easier to store the seed phrase than the Identity itself.
18
+ *
19
+ * @category API
20
+ * @param seedPhrase The seed phrase to create the identity from. Can be any arbitrary string.
21
+ * @returns An identity created from the seed phrase.
22
+ *
23
+ * @see [Identity](https://agent-js.icp.xyz/agent/interfaces/Identity.html)
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { PocketIc, PocketIcServer, createIdentity } from '@dfinity/pic';
28
+ * import { AnonymousIdentity } from '@dfinity/agent';
29
+ * import { _SERVICE, idlFactory } from '../declarations';
30
+ *
31
+ * const wasmPath = resolve('..', '..', 'canister.wasm');
32
+ *
33
+ * const picServer = await PocketIcServer.create();
34
+ * const pic = await PocketIc.create(picServer.getUrl());
35
+ * const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);
36
+ * const { actor } = fixture;
37
+ *
38
+ * const bob = createIdentity('SuperSecretSeedPhraseForBob');
39
+ * actor.setIdentity(bob);
40
+ *
41
+ * await pic.tearDown();
42
+ * await picServer.stop();
43
+ * ```
44
+ */
45
+ function createIdentity(seedPhrase) {
46
+ const hash = (0, node_crypto_1.createHash)('sha256');
47
+ hash.update(seedPhrase);
48
+ const digest = hash.digest('hex').slice(0, 32);
49
+ const encodedDigest = new TextEncoder().encode(digest);
50
+ return identity_1.Ed25519KeyIdentity.generate(encodedDigest);
51
+ }
52
+ function generateMnemonic() {
53
+ const entropy = (0, node_crypto_1.randomBytes)(16);
54
+ return (0, bip39_1.entropyToMnemonic)(entropy);
55
+ }
56
+ /**
57
+ * Create an Identity from a randomly generated bip39 seed phrase.
58
+ * Subsequent calls to this function will produce different Identities
59
+ * with an extremely low probability of collision.
60
+ *
61
+ * This is useful for tests where it is important to avoid conflicts arising
62
+ * from multiple identities accessing the same canister and maintaining
63
+ * the necessary seed phrases would become cumbersome.
64
+ *
65
+ * @category API
66
+ * @returns An identity created from a random seed phrase.
67
+ *
68
+ * @see [Identity](https://agent-js.icp.xyz/agent/interfaces/Identity.html)
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * import { PocketIc, PocketIcServer, generateRandomIdentity } from '@dfinity/pic';
73
+ * import { AnonymousIdentity } from '@dfinity/agent';
74
+ * import { _SERVICE, idlFactory } from '../declarations';
75
+ *
76
+ * const wasmPath = resolve('..', '..', 'canister.wasm');
77
+ *
78
+ * const picServer = await PocketIcServer.create();
79
+ * const pic = await PocketIc.create(picServer.getUrl());
80
+ * const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);
81
+ * const { actor } = fixture;
82
+ *
83
+ * const bob = generateRandomIdentity();
84
+ * actor.setIdentity(bob);
85
+ *
86
+ * await pic.tearDown();
87
+ * await picServer.stop();
88
+ * ```
89
+ */
90
+ function generateRandomIdentity() {
91
+ const mnemonic = generateMnemonic();
92
+ return createIdentity(mnemonic);
93
+ }
94
+ //# sourceMappingURL=identity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identity.js","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":";;AA0CA,wCAOC;AA0CD,wDAIC;AA/FD,6CAAsD;AACtD,iCAA0C;AAE1C,gDAAuD;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,cAAc,CAAC,UAAkB;IAC/C,MAAM,IAAI,GAAG,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAC/C,MAAM,aAAa,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEvD,OAAO,6BAAkB,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,gBAAgB;IACvB,MAAM,OAAO,GAAG,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC;IAEhC,OAAO,IAAA,yBAAiB,EAAC,OAAO,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,SAAgB,sBAAsB;IACpC,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IAEpC,OAAO,cAAc,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './identity';
2
+ export * from './pocket-ic-actor';
3
+ export * from './pocket-ic-deferred-actor';
4
+ export * from './pocket-ic-server-types';
5
+ export * from './pocket-ic-server';
6
+ export * from './pocket-ic-types';
7
+ export * from './pocket-ic';
package/dist/index.js ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./identity"), exports);
18
+ __exportStar(require("./pocket-ic-actor"), exports);
19
+ __exportStar(require("./pocket-ic-deferred-actor"), exports);
20
+ __exportStar(require("./pocket-ic-server-types"), exports);
21
+ __exportStar(require("./pocket-ic-server"), exports);
22
+ __exportStar(require("./pocket-ic-types"), exports);
23
+ __exportStar(require("./pocket-ic"), exports);
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA2B;AAC3B,oDAAkC;AAClC,6DAA2C;AAC3C,2DAAyC;AACzC,qDAAmC;AACnC,oDAAkC;AAClC,8CAA4B"}
@@ -0,0 +1,45 @@
1
+ import { IDL } from '@dfinity/candid';
2
+ import { Principal } from '@dfinity/principal';
3
+ export declare const MANAGEMENT_CANISTER_ID: Principal;
4
+ export interface CanisterSettings {
5
+ controllers: [] | [Principal[]];
6
+ compute_allocation: [] | [bigint];
7
+ memory_allocation: [] | [bigint];
8
+ freezing_threshold: [] | [bigint];
9
+ reserved_cycles_limit: [] | [bigint];
10
+ }
11
+ export declare const CanisterSettings: IDL.RecordClass;
12
+ export interface CreateCanisterRequest {
13
+ settings: [] | [CanisterSettings];
14
+ amount: [] | [bigint];
15
+ specified_id: [] | [Principal];
16
+ }
17
+ export declare function encodeCreateCanisterRequest(arg: CreateCanisterRequest): Uint8Array;
18
+ export interface CreateCanisterResponse {
19
+ canister_id: Principal;
20
+ }
21
+ export declare function decodeCreateCanisterResponse(arg: Uint8Array): CreateCanisterResponse;
22
+ export interface StartCanisterRequest {
23
+ canister_id: Principal;
24
+ }
25
+ export declare function encodeStartCanisterRequest(arg: StartCanisterRequest): Uint8Array;
26
+ export interface StopCanisterRequest {
27
+ canister_id: Principal;
28
+ }
29
+ export declare function encodeStopCanisterRequest(arg: StopCanisterRequest): Uint8Array;
30
+ export interface InstallCodeRequest {
31
+ arg: Uint8Array;
32
+ wasm_module: Uint8Array;
33
+ mode: {
34
+ reinstall?: null;
35
+ upgrade?: null;
36
+ install?: null;
37
+ };
38
+ canister_id: Principal;
39
+ }
40
+ export declare function encodeInstallCodeRequest(arg: InstallCodeRequest): Uint8Array;
41
+ export interface UpdateCanisterSettingsRequest {
42
+ canister_id: Principal;
43
+ settings: CanisterSettings;
44
+ }
45
+ export declare function encodeUpdateCanisterSettingsRequest(arg: UpdateCanisterSettingsRequest): Uint8Array;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CanisterSettings = exports.MANAGEMENT_CANISTER_ID = void 0;
4
+ exports.encodeCreateCanisterRequest = encodeCreateCanisterRequest;
5
+ exports.decodeCreateCanisterResponse = decodeCreateCanisterResponse;
6
+ exports.encodeStartCanisterRequest = encodeStartCanisterRequest;
7
+ exports.encodeStopCanisterRequest = encodeStopCanisterRequest;
8
+ exports.encodeInstallCodeRequest = encodeInstallCodeRequest;
9
+ exports.encodeUpdateCanisterSettingsRequest = encodeUpdateCanisterSettingsRequest;
10
+ const candid_1 = require("@dfinity/candid");
11
+ const principal_1 = require("@dfinity/principal");
12
+ const util_1 = require("./util");
13
+ exports.MANAGEMENT_CANISTER_ID = principal_1.Principal.fromText('aaaaa-aa');
14
+ exports.CanisterSettings = candid_1.IDL.Record({
15
+ controllers: candid_1.IDL.Opt(candid_1.IDL.Vec(candid_1.IDL.Principal)),
16
+ compute_allocation: candid_1.IDL.Opt(candid_1.IDL.Nat),
17
+ memory_allocation: candid_1.IDL.Opt(candid_1.IDL.Nat),
18
+ freezing_threshold: candid_1.IDL.Opt(candid_1.IDL.Nat),
19
+ reserved_cycles_limit: candid_1.IDL.Opt(candid_1.IDL.Nat),
20
+ });
21
+ const CreateCanisterRequest = candid_1.IDL.Record({
22
+ settings: candid_1.IDL.Opt(exports.CanisterSettings),
23
+ amount: candid_1.IDL.Opt(candid_1.IDL.Nat),
24
+ specified_id: candid_1.IDL.Opt(candid_1.IDL.Principal),
25
+ });
26
+ function encodeCreateCanisterRequest(arg) {
27
+ return new Uint8Array(candid_1.IDL.encode([CreateCanisterRequest], [arg]));
28
+ }
29
+ const CreateCanisterResponse = candid_1.IDL.Record({
30
+ canister_id: candid_1.IDL.Principal,
31
+ });
32
+ function decodeCreateCanisterResponse(arg) {
33
+ const payload = (0, util_1.decodeCandid)([CreateCanisterResponse], arg);
34
+ if ((0, util_1.isNil)(payload)) {
35
+ throw new Error('Failed to decode CreateCanisterResponse');
36
+ }
37
+ return payload;
38
+ }
39
+ const StartCanisterRequest = candid_1.IDL.Record({
40
+ canister_id: candid_1.IDL.Principal,
41
+ });
42
+ function encodeStartCanisterRequest(arg) {
43
+ return new Uint8Array(candid_1.IDL.encode([StartCanisterRequest], [arg]));
44
+ }
45
+ const StopCanisterRequest = candid_1.IDL.Record({
46
+ canister_id: candid_1.IDL.Principal,
47
+ });
48
+ function encodeStopCanisterRequest(arg) {
49
+ return new Uint8Array(candid_1.IDL.encode([StopCanisterRequest], [arg]));
50
+ }
51
+ const InstallCodeRequest = candid_1.IDL.Record({
52
+ arg: candid_1.IDL.Vec(candid_1.IDL.Nat8),
53
+ wasm_module: candid_1.IDL.Vec(candid_1.IDL.Nat8),
54
+ mode: candid_1.IDL.Variant({
55
+ reinstall: candid_1.IDL.Null,
56
+ upgrade: candid_1.IDL.Null,
57
+ install: candid_1.IDL.Null,
58
+ }),
59
+ canister_id: candid_1.IDL.Principal,
60
+ });
61
+ function encodeInstallCodeRequest(arg) {
62
+ return new Uint8Array(candid_1.IDL.encode([InstallCodeRequest], [arg]));
63
+ }
64
+ const UpdateCanisterSettingsRequest = candid_1.IDL.Record({
65
+ canister_id: candid_1.IDL.Principal,
66
+ settings: exports.CanisterSettings,
67
+ });
68
+ function encodeUpdateCanisterSettingsRequest(arg) {
69
+ return new Uint8Array(candid_1.IDL.encode([UpdateCanisterSettingsRequest], [arg]));
70
+ }
71
+ //# sourceMappingURL=management-canister.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"management-canister.js","sourceRoot":"","sources":["../src/management-canister.ts"],"names":[],"mappings":";;;AAkCA,kEAIC;AAUD,oEAaC;AAUD,gEAIC;AAUD,8DAIC;AAoBD,4DAEC;AAYD,kFAIC;AA/HD,4CAAsC;AACtC,kDAA+C;AAC/C,iCAA6C;AAEhC,QAAA,sBAAsB,GAAG,qBAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;AAUxD,QAAA,gBAAgB,GAAG,YAAG,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,SAAS,CAAC,CAAC;IAC5C,kBAAkB,EAAE,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,GAAG,CAAC;IACpC,iBAAiB,EAAE,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,GAAG,CAAC;IACnC,kBAAkB,EAAE,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,GAAG,CAAC;IACpC,qBAAqB,EAAE,YAAG,CAAC,GAAG,CAAC,YAAG,CAAC,GAAG,CAAC;CACxC,CAAC,CAAC;AAQH,MAAM,qBAAqB,GAAG,YAAG,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,YAAG,CAAC,GAAG,CAAC,wBAAgB,CAAC;IACnC,MA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