ic-mops 2.2.1 → 2.3.1
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/CHANGELOG.md +13 -0
- package/RELEASE.md +9 -1
- package/cli.ts +25 -2
- package/commands/build.ts +2 -10
- package/commands/check-stable.ts +177 -0
- package/commands/check.ts +53 -6
- package/dist/bin/mops.js +1 -1
- package/dist/cli.js +22 -2
- package/dist/commands/build.js +2 -5
- package/dist/commands/check-stable.d.ts +14 -0
- package/dist/commands/check-stable.js +95 -0
- package/dist/commands/check.js +41 -6
- package/dist/fix-dist.js +5 -0
- package/dist/helpers/resolve-canisters.d.ts +7 -0
- package/dist/helpers/resolve-canisters.js +31 -0
- package/dist/package.json +2 -2
- package/dist/tests/build.test.js +18 -0
- package/dist/tests/check-fix.test.js +17 -0
- package/dist/tests/check-stable.test.d.ts +1 -0
- package/dist/tests/check-stable.test.js +51 -0
- package/dist/tests/check.test.js +54 -1
- package/dist/tests/moc-args.test.js +3 -3
- package/dist/types.d.ts +5 -1
- package/dist/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/web/wasm_bg.wasm +0 -0
- package/fix-dist.ts +9 -0
- package/helpers/resolve-canisters.ts +52 -0
- package/package.json +2 -2
- package/tests/README.md +16 -0
- package/tests/__snapshots__/check-fix.test.ts.snap +16 -10
- package/tests/__snapshots__/check-stable.test.ts.snap +29 -0
- package/tests/__snapshots__/check.test.ts.snap +26 -16
- package/tests/build/no-dfx/mops.toml +3 -0
- package/tests/build/no-dfx/src/Main.mo +1 -1
- package/tests/build.test.ts +24 -0
- package/tests/check/canisters/Ok.mo +5 -0
- package/tests/check/canisters/mops.toml +8 -0
- package/tests/check/canisters-error/Error.mo +7 -0
- package/tests/check/canisters-error/mops.toml +8 -0
- package/tests/check/canisters-moc-args/Warning.mo +5 -0
- package/tests/check/canisters-moc-args/mops.toml +8 -0
- package/tests/check/deployed-compatible/main.mo +4 -0
- package/tests/check/deployed-compatible/mops.toml +11 -0
- package/tests/check/deployed-compatible/old.mo +3 -0
- package/tests/check/deployed-compile-error/Error.mo +7 -0
- package/tests/check/deployed-compile-error/mops.toml +11 -0
- package/tests/check/deployed-compile-error/old.mo +3 -0
- package/tests/check/deployed-missing-error/Ok.mo +5 -0
- package/tests/check/deployed-missing-error/mops.toml +11 -0
- package/tests/check/deployed-missing-skip/Ok.mo +5 -0
- package/tests/check/deployed-missing-skip/mops.toml +12 -0
- package/tests/check/error/Error.mo +1 -1
- package/tests/check/error/mops.toml +5 -2
- package/tests/check/fix/M0223.mo +1 -1
- package/tests/check/fix/M0236.mo +1 -1
- package/tests/check/fix/M0237.mo +1 -1
- package/tests/check/fix/Ok.mo +1 -1
- package/tests/check/fix/fix-with-error.mo +9 -0
- package/tests/check/fix/fix-with-warning.mo +8 -0
- package/tests/check/fix/mops.toml +3 -0
- package/tests/check/fix/transitive-main.mo +1 -1
- package/tests/check/moc-args/Warning.mo +1 -1
- package/tests/check/moc-args/mops.toml +4 -1
- package/tests/check/success/Ok.mo +1 -1
- package/tests/check/success/Warning.mo +1 -1
- package/tests/check/success/mops.toml +5 -2
- package/tests/check-fix.test.ts +25 -0
- package/tests/check-stable/compatible/mops.toml +8 -0
- package/tests/check-stable/compatible/new.mo +4 -0
- package/tests/check-stable/compatible/old.mo +3 -0
- package/tests/check-stable/incompatible/mops.toml +8 -0
- package/tests/check-stable/incompatible/new.mo +3 -0
- package/tests/check-stable/incompatible/old.mo +4 -0
- package/tests/check-stable/subdirectory/.old/src/main.mo +3 -0
- package/tests/check-stable/subdirectory/mops.toml +8 -0
- package/tests/check-stable/subdirectory/src/main.mo +4 -0
- package/tests/check-stable.test.ts +56 -0
- package/tests/check.test.ts +63 -1
- package/tests/moc-args.test.ts +3 -3
- package/types.ts +5 -1
- package/wasm/pkg/nodejs/wasm_bg.wasm +0 -0
- package/wasm/pkg/web/wasm_bg.wasm +0 -0
- package/.DS_Store +0 -0
- package/bundle/bench/bench-canister.mo +0 -130
- package/bundle/bench/user-bench.mo +0 -10
- package/bundle/bin/moc-wrapper.sh +0 -40
- package/bundle/bin/mops.js +0 -3
- package/bundle/cli.js +0 -1569
- package/bundle/cli.tgz +0 -0
- package/bundle/declarations/bench/bench.did +0 -30
- package/bundle/declarations/bench/bench.did.d.ts +0 -33
- package/bundle/declarations/bench/bench.did.js +0 -30
- package/bundle/declarations/bench/index.d.ts +0 -50
- package/bundle/declarations/bench/index.js +0 -40
- package/bundle/declarations/main/index.d.ts +0 -50
- package/bundle/declarations/main/index.js +0 -40
- package/bundle/declarations/main/main.did +0 -428
- package/bundle/declarations/main/main.did.d.ts +0 -348
- package/bundle/declarations/main/main.did.js +0 -406
- package/bundle/declarations/storage/index.d.ts +0 -50
- package/bundle/declarations/storage/index.js +0 -30
- package/bundle/declarations/storage/storage.did +0 -46
- package/bundle/declarations/storage/storage.did.d.ts +0 -40
- package/bundle/declarations/storage/storage.did.js +0 -38
- package/bundle/default-stylesheet.css +0 -415
- package/bundle/package.json +0 -36
- package/bundle/templates/README.md +0 -13
- package/bundle/templates/licenses/Apache-2.0 +0 -202
- package/bundle/templates/licenses/Apache-2.0-NOTICE +0 -13
- package/bundle/templates/licenses/MIT +0 -21
- package/bundle/templates/mops-publish.yml +0 -17
- package/bundle/templates/mops-test.yml +0 -24
- package/bundle/templates/src/lib.mo +0 -15
- package/bundle/templates/test/lib.test.mo +0 -4
- package/bundle/wasm_bg.wasm +0 -0
- package/bundle/xhr-sync-worker.js +0 -51
- package/dist/wasm/pkg/bundler/package.json +0 -20
- package/dist/wasm/pkg/bundler/wasm.d.ts +0 -3
- package/dist/wasm/pkg/bundler/wasm.js +0 -5
- package/dist/wasm/pkg/bundler/wasm_bg.js +0 -93
- package/dist/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- package/dist/wasm/pkg/bundler/wasm_bg.wasm.d.ts +0 -8
- package/tests/build/success/.dfx/local/canister_ids.json +0 -17
- package/tests/build/success/.dfx/local/canisters/bar/bar.did +0 -3
- package/tests/build/success/.dfx/local/canisters/bar/bar.most +0 -4
- package/tests/build/success/.dfx/local/canisters/bar/bar.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/bar/constructor.did +0 -3
- package/tests/build/success/.dfx/local/canisters/bar/index.js +0 -42
- package/tests/build/success/.dfx/local/canisters/bar/init_args.txt +0 -1
- package/tests/build/success/.dfx/local/canisters/bar/service.did +0 -3
- package/tests/build/success/.dfx/local/canisters/bar/service.did.d.ts +0 -7
- package/tests/build/success/.dfx/local/canisters/bar/service.did.js +0 -4
- package/tests/build/success/.dfx/local/canisters/foo/constructor.did +0 -3
- package/tests/build/success/.dfx/local/canisters/foo/foo.did +0 -3
- package/tests/build/success/.dfx/local/canisters/foo/foo.most +0 -4
- package/tests/build/success/.dfx/local/canisters/foo/foo.wasm +0 -0
- package/tests/build/success/.dfx/local/canisters/foo/index.js +0 -42
- package/tests/build/success/.dfx/local/canisters/foo/init_args.txt +0 -1
- package/tests/build/success/.dfx/local/canisters/foo/service.did +0 -3
- package/tests/build/success/.dfx/local/canisters/foo/service.did.d.ts +0 -7
- package/tests/build/success/.dfx/local/canisters/foo/service.did.js +0 -4
- package/tests/build/success/.dfx/local/lsp/ucwa4-rx777-77774-qaada-cai.did +0 -3
- package/tests/build/success/.dfx/local/lsp/ulvla-h7777-77774-qaacq-cai.did +0 -3
- package/tests/build/success/.dfx/local/network-id +0 -4
- package/wasm/Cargo.lock +0 -1475
- package/wasm/pkg/bundler/package.json +0 -20
- package/wasm/pkg/bundler/wasm.d.ts +0 -3
- package/wasm/pkg/bundler/wasm.js +0 -5
- package/wasm/pkg/bundler/wasm_bg.js +0 -93
- package/wasm/pkg/bundler/wasm_bg.wasm +0 -0
- 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
|
-
};
|
package/bundle/wasm_bg.wasm
DELETED
|
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,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
|
-
}
|
|
Binary file
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
()
|
|
@@ -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[];
|
|
Binary file
|
|
@@ -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 +0,0 @@
|
|
|
1
|
-
()
|
|
@@ -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[];
|