ic-mops 2.2.1 → 2.3.0

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 (146) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/RELEASE.md +9 -1
  3. package/bundle/cli.tgz +0 -0
  4. package/cli.ts +25 -2
  5. package/commands/build.ts +2 -10
  6. package/commands/check-stable.ts +177 -0
  7. package/commands/check.ts +53 -6
  8. package/dist/cli.js +22 -2
  9. package/dist/commands/build.js +2 -5
  10. package/dist/commands/check-stable.d.ts +14 -0
  11. package/dist/commands/check-stable.js +95 -0
  12. package/dist/commands/check.js +41 -6
  13. package/dist/helpers/resolve-canisters.d.ts +7 -0
  14. package/dist/helpers/resolve-canisters.js +31 -0
  15. package/dist/package.json +2 -2
  16. package/dist/tests/check-fix.test.js +17 -0
  17. package/dist/tests/check-stable.test.d.ts +1 -0
  18. package/dist/tests/check-stable.test.js +51 -0
  19. package/dist/tests/check.test.js +54 -1
  20. package/dist/tests/moc-args.test.js +3 -3
  21. package/dist/types.d.ts +5 -1
  22. package/dist/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
  23. package/dist/wasm/pkg/web/wasm_bg.wasm +0 -0
  24. package/helpers/resolve-canisters.ts +52 -0
  25. package/package.json +2 -2
  26. package/tests/README.md +16 -0
  27. package/tests/__snapshots__/check-fix.test.ts.snap +16 -10
  28. package/tests/__snapshots__/check-stable.test.ts.snap +29 -0
  29. package/tests/__snapshots__/check.test.ts.snap +26 -16
  30. package/tests/build/no-dfx/mops.toml +3 -0
  31. package/tests/build/no-dfx/src/Main.mo +1 -1
  32. package/tests/check/canisters/Ok.mo +5 -0
  33. package/tests/check/canisters/mops.toml +8 -0
  34. package/tests/check/canisters-error/Error.mo +7 -0
  35. package/tests/check/canisters-error/mops.toml +8 -0
  36. package/tests/check/canisters-moc-args/Warning.mo +5 -0
  37. package/tests/check/canisters-moc-args/mops.toml +8 -0
  38. package/tests/check/deployed-compatible/main.mo +4 -0
  39. package/tests/check/deployed-compatible/mops.toml +11 -0
  40. package/tests/check/deployed-compatible/old.mo +3 -0
  41. package/tests/check/deployed-compile-error/Error.mo +7 -0
  42. package/tests/check/deployed-compile-error/mops.toml +11 -0
  43. package/tests/check/deployed-compile-error/old.mo +3 -0
  44. package/tests/check/deployed-missing-error/Ok.mo +5 -0
  45. package/tests/check/deployed-missing-error/mops.toml +11 -0
  46. package/tests/check/deployed-missing-skip/Ok.mo +5 -0
  47. package/tests/check/deployed-missing-skip/mops.toml +12 -0
  48. package/tests/check/error/Error.mo +1 -1
  49. package/tests/check/error/mops.toml +5 -2
  50. package/tests/check/fix/M0223.mo +1 -1
  51. package/tests/check/fix/M0236.mo +1 -1
  52. package/tests/check/fix/M0237.mo +1 -1
  53. package/tests/check/fix/Ok.mo +1 -1
  54. package/tests/check/fix/fix-with-error.mo +9 -0
  55. package/tests/check/fix/fix-with-warning.mo +8 -0
  56. package/tests/check/fix/mops.toml +3 -0
  57. package/tests/check/fix/transitive-main.mo +1 -1
  58. package/tests/check/moc-args/Warning.mo +1 -1
  59. package/tests/check/moc-args/mops.toml +4 -1
  60. package/tests/check/success/Ok.mo +1 -1
  61. package/tests/check/success/Warning.mo +1 -1
  62. package/tests/check/success/mops.toml +5 -2
  63. package/tests/check-fix.test.ts +25 -0
  64. package/tests/check-stable/compatible/mops.toml +8 -0
  65. package/tests/check-stable/compatible/new.mo +4 -0
  66. package/tests/check-stable/compatible/old.mo +3 -0
  67. package/tests/check-stable/incompatible/mops.toml +8 -0
  68. package/tests/check-stable/incompatible/new.mo +3 -0
  69. package/tests/check-stable/incompatible/old.mo +4 -0
  70. package/tests/check-stable/subdirectory/.old/src/main.mo +3 -0
  71. package/tests/check-stable/subdirectory/mops.toml +8 -0
  72. package/tests/check-stable/subdirectory/src/main.mo +4 -0
  73. package/tests/check-stable.test.ts +56 -0
  74. package/tests/check.test.ts +63 -1
  75. package/tests/moc-args.test.ts +3 -3
  76. package/types.ts +5 -1
  77. package/wasm/Cargo.lock +101 -54
  78. package/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
  79. package/wasm/pkg/web/wasm_bg.wasm +0 -0
  80. package/.DS_Store +0 -0
  81. package/bundle/bench/bench-canister.mo +0 -130
  82. package/bundle/bench/user-bench.mo +0 -10
  83. package/bundle/bin/moc-wrapper.sh +0 -40
  84. package/bundle/bin/mops.js +0 -3
  85. package/bundle/cli.js +0 -1569
  86. package/bundle/declarations/bench/bench.did +0 -30
  87. package/bundle/declarations/bench/bench.did.d.ts +0 -33
  88. package/bundle/declarations/bench/bench.did.js +0 -30
  89. package/bundle/declarations/bench/index.d.ts +0 -50
  90. package/bundle/declarations/bench/index.js +0 -40
  91. package/bundle/declarations/main/index.d.ts +0 -50
  92. package/bundle/declarations/main/index.js +0 -40
  93. package/bundle/declarations/main/main.did +0 -428
  94. package/bundle/declarations/main/main.did.d.ts +0 -348
  95. package/bundle/declarations/main/main.did.js +0 -406
  96. package/bundle/declarations/storage/index.d.ts +0 -50
  97. package/bundle/declarations/storage/index.js +0 -30
  98. package/bundle/declarations/storage/storage.did +0 -46
  99. package/bundle/declarations/storage/storage.did.d.ts +0 -40
  100. package/bundle/declarations/storage/storage.did.js +0 -38
  101. package/bundle/default-stylesheet.css +0 -415
  102. package/bundle/package.json +0 -36
  103. package/bundle/templates/README.md +0 -13
  104. package/bundle/templates/licenses/Apache-2.0 +0 -202
  105. package/bundle/templates/licenses/Apache-2.0-NOTICE +0 -13
  106. package/bundle/templates/licenses/MIT +0 -21
  107. package/bundle/templates/mops-publish.yml +0 -17
  108. package/bundle/templates/mops-test.yml +0 -24
  109. package/bundle/templates/src/lib.mo +0 -15
  110. package/bundle/templates/test/lib.test.mo +0 -4
  111. package/bundle/wasm_bg.wasm +0 -0
  112. package/bundle/xhr-sync-worker.js +0 -51
  113. package/dist/wasm/pkg/bundler/package.json +0 -20
  114. package/dist/wasm/pkg/bundler/wasm.d.ts +0 -3
  115. package/dist/wasm/pkg/bundler/wasm.js +0 -5
  116. package/dist/wasm/pkg/bundler/wasm_bg.js +0 -93
  117. package/dist/wasm/pkg/bundler/wasm_bg.wasm +0 -0
  118. package/dist/wasm/pkg/bundler/wasm_bg.wasm.d.ts +0 -8
  119. package/tests/build/success/.dfx/local/canister_ids.json +0 -17
  120. package/tests/build/success/.dfx/local/canisters/bar/bar.did +0 -3
  121. package/tests/build/success/.dfx/local/canisters/bar/bar.most +0 -4
  122. package/tests/build/success/.dfx/local/canisters/bar/bar.wasm +0 -0
  123. package/tests/build/success/.dfx/local/canisters/bar/constructor.did +0 -3
  124. package/tests/build/success/.dfx/local/canisters/bar/index.js +0 -42
  125. package/tests/build/success/.dfx/local/canisters/bar/init_args.txt +0 -1
  126. package/tests/build/success/.dfx/local/canisters/bar/service.did +0 -3
  127. package/tests/build/success/.dfx/local/canisters/bar/service.did.d.ts +0 -7
  128. package/tests/build/success/.dfx/local/canisters/bar/service.did.js +0 -4
  129. package/tests/build/success/.dfx/local/canisters/foo/constructor.did +0 -3
  130. package/tests/build/success/.dfx/local/canisters/foo/foo.did +0 -3
  131. package/tests/build/success/.dfx/local/canisters/foo/foo.most +0 -4
  132. package/tests/build/success/.dfx/local/canisters/foo/foo.wasm +0 -0
  133. package/tests/build/success/.dfx/local/canisters/foo/index.js +0 -42
  134. package/tests/build/success/.dfx/local/canisters/foo/init_args.txt +0 -1
  135. package/tests/build/success/.dfx/local/canisters/foo/service.did +0 -3
  136. package/tests/build/success/.dfx/local/canisters/foo/service.did.d.ts +0 -7
  137. package/tests/build/success/.dfx/local/canisters/foo/service.did.js +0 -4
  138. package/tests/build/success/.dfx/local/lsp/ucwa4-rx777-77774-qaada-cai.did +0 -3
  139. package/tests/build/success/.dfx/local/lsp/ulvla-h7777-77774-qaacq-cai.did +0 -3
  140. package/tests/build/success/.dfx/local/network-id +0 -4
  141. package/wasm/pkg/bundler/package.json +0 -20
  142. package/wasm/pkg/bundler/wasm.d.ts +0 -3
  143. package/wasm/pkg/bundler/wasm.js +0 -5
  144. package/wasm/pkg/bundler/wasm_bg.js +0 -93
  145. package/wasm/pkg/bundler/wasm_bg.wasm +0 -0
  146. package/wasm/pkg/bundler/wasm_bg.wasm.d.ts +0 -8
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) <year> <copyright-owner>
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,17 +0,0 @@
1
- name: publish on mops
2
-
3
- on:
4
- release:
5
- types: [released]
6
-
7
- jobs:
8
- publish:
9
- runs-on: ubuntu-latest
10
-
11
- steps:
12
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
13
- - uses: dfinity/setup-mops@v1
14
- with:
15
- # Make sure you set the MOPS_IDENTITY_PEM secret in your repository settings https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository
16
- identity-pem: ${{ secrets.MOPS_IDENTITY_PEM }}
17
- - run: mops publish
@@ -1,24 +0,0 @@
1
- name: mops test
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- - master
8
- pull_request:
9
-
10
- jobs:
11
- test:
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16
- - uses: dfinity/setup-mops@v1
17
- with:
18
- mops-version: 1
19
-
20
- - name: install mops packages
21
- run: mops install
22
-
23
- - name: run tests
24
- run: mops test
@@ -1,15 +0,0 @@
1
- module {
2
- // This comment will not be included in the documentation
3
- // Use triple slash for documentation
4
-
5
- /// Add two natural numbers
6
- ///
7
- /// Example:
8
- /// ```motoko
9
- /// assert add(1, 2) == 3;
10
- /// assert add(7, 3) == 10;
11
- /// ```
12
- public func add(x : Nat, y : Nat) : Nat {
13
- return x + y;
14
- };
15
- };
@@ -1,4 +0,0 @@
1
- import { add } "../src";
2
-
3
- assert add(1, 2) == 3;
4
- assert add(3, 22) == 25;
Binary file
@@ -1,51 +0,0 @@
1
- "use strict";
2
- // Persistent worker thread for handling synchronous XHR requests.
3
- //
4
- // This worker runs in a separate thread and performs async HTTP requests on behalf of the main
5
- // thread, which blocks on Atomics.wait() until we signal completion. A single JSDOM instance is
6
- // created at startup and reused across requests to avoid the ~400ms initialization cost each time.
7
- //
8
- // The signaling protocol (shared with sendSyncWorkerRequest in XMLHttpRequest-impl.js):
9
- // 1. Main thread sends us a SharedArrayBuffer, a MessagePort, and the serialized request config.
10
- // 2. We perform the XHR asynchronously.
11
- // 3. When done, we post the serialized response to the MessagePort, then signal the main thread
12
- // by writing 1 to the SharedArrayBuffer with Atomics.store() and waking it with Atomics.notify().
13
-
14
- const { parentPort } = require("node:worker_threads");
15
- const { JSDOM } = require("../../../..");
16
- const idlUtils = require("../../../generated/idl/utils");
17
-
18
- const dom = new JSDOM();
19
- const IDLE_TIMEOUT_MS = 5000;
20
-
21
- let idleTimer = setTimeout(() => process.exit(0), IDLE_TIMEOUT_MS);
22
- idleTimer.unref();
23
-
24
- parentPort.on("message", ({ sharedBuffer, responsePort, config }) => {
25
- clearTimeout(idleTimer);
26
-
27
- const int32 = new Int32Array(sharedBuffer);
28
-
29
- const xhr = new dom.window.XMLHttpRequest();
30
- const xhrImpl = idlUtils.implForWrapper(xhr);
31
- xhrImpl._adoptSerializedRequest(config);
32
-
33
- function done() {
34
- const response = xhrImpl._serializeResponse();
35
- const transfer = response.responseBytes ? [response.responseBytes.buffer] : [];
36
- responsePort.postMessage(response, transfer);
37
- Atomics.store(int32, 0, 1);
38
- Atomics.notify(int32, 0);
39
-
40
- idleTimer = setTimeout(() => process.exit(0), IDLE_TIMEOUT_MS);
41
- idleTimer.unref();
42
- }
43
-
44
- try {
45
- xhr.addEventListener("loadend", done, false);
46
- xhr.send(xhrImpl._body);
47
- } catch (error) {
48
- xhrImpl._error = error;
49
- done();
50
- }
51
- });
@@ -1,20 +0,0 @@
1
- {
2
- "name": "wasm",
3
- "type": "module",
4
- "collaborators": [
5
- "Ryan Vandersmith <ryan.vandersmith@dfinity.org>"
6
- ],
7
- "version": "0.1.0",
8
- "files": [
9
- "wasm_bg.wasm",
10
- "wasm.js",
11
- "wasm_bg.js",
12
- "wasm.d.ts"
13
- ],
14
- "main": "wasm.js",
15
- "types": "wasm.d.ts",
16
- "sideEffects": [
17
- "./wasm.js",
18
- "./snippets/*"
19
- ]
20
- }
@@ -1,3 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export function is_candid_compatible(new_interface: string, original_interface: string): boolean;
@@ -1,5 +0,0 @@
1
- import * as wasm from "./wasm_bg.wasm";
2
- export * from "./wasm_bg.js";
3
- import { __wbg_set_wasm } from "./wasm_bg.js";
4
- __wbg_set_wasm(wasm);
5
- wasm.__wbindgen_start();
@@ -1,93 +0,0 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
-
7
- let WASM_VECTOR_LEN = 0;
8
-
9
- let cachedUint8ArrayMemory0 = null;
10
-
11
- function getUint8ArrayMemory0() {
12
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8ArrayMemory0;
16
- }
17
-
18
- const cachedTextEncoder = new TextEncoder();
19
-
20
- if (!('encodeInto' in cachedTextEncoder)) {
21
- cachedTextEncoder.encodeInto = function (arg, view) {
22
- const buf = cachedTextEncoder.encode(arg);
23
- view.set(buf);
24
- return {
25
- read: arg.length,
26
- written: buf.length
27
- };
28
- }
29
- }
30
-
31
- function passStringToWasm0(arg, malloc, realloc) {
32
-
33
- if (realloc === undefined) {
34
- const buf = cachedTextEncoder.encode(arg);
35
- const ptr = malloc(buf.length, 1) >>> 0;
36
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
37
- WASM_VECTOR_LEN = buf.length;
38
- return ptr;
39
- }
40
-
41
- let len = arg.length;
42
- let ptr = malloc(len, 1) >>> 0;
43
-
44
- const mem = getUint8ArrayMemory0();
45
-
46
- let offset = 0;
47
-
48
- for (; offset < len; offset++) {
49
- const code = arg.charCodeAt(offset);
50
- if (code > 0x7F) break;
51
- mem[ptr + offset] = code;
52
- }
53
-
54
- if (offset !== len) {
55
- if (offset !== 0) {
56
- arg = arg.slice(offset);
57
- }
58
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
59
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
60
- const ret = cachedTextEncoder.encodeInto(arg, view);
61
-
62
- offset += ret.written;
63
- ptr = realloc(ptr, len, offset, 1) >>> 0;
64
- }
65
-
66
- WASM_VECTOR_LEN = offset;
67
- return ptr;
68
- }
69
- /**
70
- * @param {string} new_interface
71
- * @param {string} original_interface
72
- * @returns {boolean}
73
- */
74
- export function is_candid_compatible(new_interface, original_interface) {
75
- const ptr0 = passStringToWasm0(new_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
- const len0 = WASM_VECTOR_LEN;
77
- const ptr1 = passStringToWasm0(original_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
- const len1 = WASM_VECTOR_LEN;
79
- const ret = wasm.is_candid_compatible(ptr0, len0, ptr1, len1);
80
- return ret !== 0;
81
- }
82
-
83
- export function __wbindgen_init_externref_table() {
84
- const table = wasm.__wbindgen_externrefs;
85
- const offset = table.grow(4);
86
- table.set(0, undefined);
87
- table.set(offset + 0, undefined);
88
- table.set(offset + 1, null);
89
- table.set(offset + 2, true);
90
- table.set(offset + 3, false);
91
- ;
92
- };
93
-
Binary file
@@ -1,8 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const is_candid_compatible: (a: number, b: number, c: number, d: number) => number;
5
- export const __wbindgen_externrefs: WebAssembly.Table;
6
- export const __wbindgen_malloc: (a: number, b: number) => number;
7
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
- export const __wbindgen_start: () => void;
@@ -1,17 +0,0 @@
1
- {
2
- "__Candid_UI": {
3
- "local": "ufxgi-4p777-77774-qaadq-cai"
4
- },
5
- "a": {
6
- "local": "uzt4z-lp777-77774-qaabq-cai"
7
- },
8
- "b": {
9
- "local": "umunu-kh777-77774-qaaca-cai"
10
- },
11
- "bar": {
12
- "local": "ulvla-h7777-77774-qaacq-cai"
13
- },
14
- "foo": {
15
- "local": "ucwa4-rx777-77774-qaada-cai"
16
- }
17
- }
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,4 +0,0 @@
1
- // Version: 1.0.0
2
- actor {
3
-
4
- };
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,42 +0,0 @@
1
- import { Actor, HttpAgent } from "@dfinity/agent";
2
-
3
- // Imports and re-exports candid interface
4
- import { idlFactory } from './bar.did.js';
5
- export { idlFactory } from './bar.did.js';
6
- // CANISTER_ID is replaced by webpack based on node environment
7
- export const canisterId = process.env.CANISTER_ID_BAR;
8
-
9
- /**
10
- * @deprecated since dfx 0.11.1
11
- * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface.
12
- * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
13
- * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
14
- * @return {import("@dfinity/agent").ActorSubclass<import("./bar.did.js")._SERVICE>}
15
- */
16
- export const createActor = (canisterId, options = {}) => {
17
- console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings.
18
-
19
- See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`);
20
- const agent = options.agent || new HttpAgent({ ...options.agentOptions });
21
-
22
- // Fetch root key for certificate validation during development
23
- if (process.env.DFX_NETWORK !== "ic") {
24
- agent.fetchRootKey().catch(err => {
25
- console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
26
- console.error(err);
27
- });
28
- }
29
-
30
- // Creates an actor with using the candid interface and the HttpAgent
31
- return Actor.createActor(idlFactory, {
32
- agent,
33
- canisterId,
34
- ...(options ? options.actorOptions : {}),
35
- });
36
- };
37
-
38
- /**
39
- * A ready-to-use agent for the bar canister
40
- * @type {import("@dfinity/agent").ActorSubclass<import("./bar.did.js")._SERVICE>}
41
- */
42
- export const bar = createActor(canisterId);
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,7 +0,0 @@
1
- import type { Principal } from '@dfinity/principal';
2
- import type { ActorMethod } from '@dfinity/agent';
3
- import type { IDL } from '@dfinity/candid';
4
-
5
- export interface _SERVICE { 'call' : ActorMethod<[], string> }
6
- export declare const idlFactory: IDL.InterfaceFactory;
7
- export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -1,4 +0,0 @@
1
- export const idlFactory = ({ IDL }) => {
2
- return IDL.Service({ 'call' : IDL.Func([], [IDL.Text], []) });
3
- };
4
- export const init = ({ IDL }) => { return []; };
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,4 +0,0 @@
1
- // Version: 1.0.0
2
- actor {
3
-
4
- };
@@ -1,42 +0,0 @@
1
- import { Actor, HttpAgent } from "@dfinity/agent";
2
-
3
- // Imports and re-exports candid interface
4
- import { idlFactory } from './foo.did.js';
5
- export { idlFactory } from './foo.did.js';
6
- // CANISTER_ID is replaced by webpack based on node environment
7
- export const canisterId = process.env.CANISTER_ID_FOO;
8
-
9
- /**
10
- * @deprecated since dfx 0.11.1
11
- * Do not import from `.dfx`, instead switch to using `dfx generate` to generate your JS interface.
12
- * @param {string | import("@dfinity/principal").Principal} canisterId Canister ID of Agent
13
- * @param {{agentOptions?: import("@dfinity/agent").HttpAgentOptions; actorOptions?: import("@dfinity/agent").ActorConfig} | { agent?: import("@dfinity/agent").Agent; actorOptions?: import("@dfinity/agent").ActorConfig }} [options]
14
- * @return {import("@dfinity/agent").ActorSubclass<import("./foo.did.js")._SERVICE>}
15
- */
16
- export const createActor = (canisterId, options = {}) => {
17
- console.warn(`Deprecation warning: you are currently importing code from .dfx. Going forward, refactor to use the dfx generate command for JavaScript bindings.
18
-
19
- See https://internetcomputer.org/docs/current/developer-docs/updates/release-notes/ for migration instructions`);
20
- const agent = options.agent || new HttpAgent({ ...options.agentOptions });
21
-
22
- // Fetch root key for certificate validation during development
23
- if (process.env.DFX_NETWORK !== "ic") {
24
- agent.fetchRootKey().catch(err => {
25
- console.warn("Unable to fetch root key. Check to ensure that your local replica is running");
26
- console.error(err);
27
- });
28
- }
29
-
30
- // Creates an actor with using the candid interface and the HttpAgent
31
- return Actor.createActor(idlFactory, {
32
- agent,
33
- canisterId,
34
- ...(options ? options.actorOptions : {}),
35
- });
36
- };
37
-
38
- /**
39
- * A ready-to-use agent for the foo canister
40
- * @type {import("@dfinity/agent").ActorSubclass<import("./foo.did.js")._SERVICE>}
41
- */
42
- export const foo = createActor(canisterId);
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,7 +0,0 @@
1
- import type { Principal } from '@dfinity/principal';
2
- import type { ActorMethod } from '@dfinity/agent';
3
- import type { IDL } from '@dfinity/candid';
4
-
5
- export interface _SERVICE { 'call' : ActorMethod<[], string> }
6
- export declare const idlFactory: IDL.InterfaceFactory;
7
- export declare const init: (args: { IDL: typeof IDL }) => IDL.Type[];
@@ -1,4 +0,0 @@
1
- export const idlFactory = ({ IDL }) => {
2
- return IDL.Service({ 'call' : IDL.Func([], [IDL.Text], []) });
3
- };
4
- export const init = ({ IDL }) => { return []; };
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,3 +0,0 @@
1
- service : {
2
- call: () -> (text);
3
- }
@@ -1,4 +0,0 @@
1
- {
2
- "created": "2025-09-11 02:20:43.69975 +00:00:00",
3
- "settings_digest": "685af83dea9d217efa2077ec50e8b0ed561d1c292a5454dacdc43d3b5e45306f"
4
- }
@@ -1,20 +0,0 @@
1
- {
2
- "name": "wasm",
3
- "type": "module",
4
- "collaborators": [
5
- "Ryan Vandersmith <ryan.vandersmith@dfinity.org>"
6
- ],
7
- "version": "0.1.0",
8
- "files": [
9
- "wasm_bg.wasm",
10
- "wasm.js",
11
- "wasm_bg.js",
12
- "wasm.d.ts"
13
- ],
14
- "main": "wasm.js",
15
- "types": "wasm.d.ts",
16
- "sideEffects": [
17
- "./wasm.js",
18
- "./snippets/*"
19
- ]
20
- }
@@ -1,3 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export function is_candid_compatible(new_interface: string, original_interface: string): boolean;
@@ -1,5 +0,0 @@
1
- import * as wasm from "./wasm_bg.wasm";
2
- export * from "./wasm_bg.js";
3
- import { __wbg_set_wasm } from "./wasm_bg.js";
4
- __wbg_set_wasm(wasm);
5
- wasm.__wbindgen_start();
@@ -1,93 +0,0 @@
1
- let wasm;
2
- export function __wbg_set_wasm(val) {
3
- wasm = val;
4
- }
5
-
6
-
7
- let WASM_VECTOR_LEN = 0;
8
-
9
- let cachedUint8ArrayMemory0 = null;
10
-
11
- function getUint8ArrayMemory0() {
12
- if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
13
- cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
14
- }
15
- return cachedUint8ArrayMemory0;
16
- }
17
-
18
- const cachedTextEncoder = new TextEncoder();
19
-
20
- if (!('encodeInto' in cachedTextEncoder)) {
21
- cachedTextEncoder.encodeInto = function (arg, view) {
22
- const buf = cachedTextEncoder.encode(arg);
23
- view.set(buf);
24
- return {
25
- read: arg.length,
26
- written: buf.length
27
- };
28
- }
29
- }
30
-
31
- function passStringToWasm0(arg, malloc, realloc) {
32
-
33
- if (realloc === undefined) {
34
- const buf = cachedTextEncoder.encode(arg);
35
- const ptr = malloc(buf.length, 1) >>> 0;
36
- getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
37
- WASM_VECTOR_LEN = buf.length;
38
- return ptr;
39
- }
40
-
41
- let len = arg.length;
42
- let ptr = malloc(len, 1) >>> 0;
43
-
44
- const mem = getUint8ArrayMemory0();
45
-
46
- let offset = 0;
47
-
48
- for (; offset < len; offset++) {
49
- const code = arg.charCodeAt(offset);
50
- if (code > 0x7F) break;
51
- mem[ptr + offset] = code;
52
- }
53
-
54
- if (offset !== len) {
55
- if (offset !== 0) {
56
- arg = arg.slice(offset);
57
- }
58
- ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
59
- const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
60
- const ret = cachedTextEncoder.encodeInto(arg, view);
61
-
62
- offset += ret.written;
63
- ptr = realloc(ptr, len, offset, 1) >>> 0;
64
- }
65
-
66
- WASM_VECTOR_LEN = offset;
67
- return ptr;
68
- }
69
- /**
70
- * @param {string} new_interface
71
- * @param {string} original_interface
72
- * @returns {boolean}
73
- */
74
- export function is_candid_compatible(new_interface, original_interface) {
75
- const ptr0 = passStringToWasm0(new_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
76
- const len0 = WASM_VECTOR_LEN;
77
- const ptr1 = passStringToWasm0(original_interface, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
78
- const len1 = WASM_VECTOR_LEN;
79
- const ret = wasm.is_candid_compatible(ptr0, len0, ptr1, len1);
80
- return ret !== 0;
81
- }
82
-
83
- export function __wbindgen_init_externref_table() {
84
- const table = wasm.__wbindgen_externrefs;
85
- const offset = table.grow(4);
86
- table.set(0, undefined);
87
- table.set(offset + 0, undefined);
88
- table.set(offset + 1, null);
89
- table.set(offset + 2, true);
90
- table.set(offset + 3, false);
91
- ;
92
- };
93
-
Binary file
@@ -1,8 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- export const memory: WebAssembly.Memory;
4
- export const is_candid_compatible: (a: number, b: number, c: number, d: number) => number;
5
- export const __wbindgen_externrefs: WebAssembly.Table;
6
- export const __wbindgen_malloc: (a: number, b: number) => number;
7
- export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
8
- export const __wbindgen_start: () => void;