From a46bc4de713bde7359da1a9509b572f3be1730b4 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 14:01:39 -0500 Subject: [PATCH 01/14] implement the azle dfx extension and update all example projects --- .github/workflows/test.yml | 4 +- dfx_extension/extension.json | 36 ++++++ dfx_extension/install.sh | 4 + examples/apollo_server/dfx.json | 19 +-- examples/apollo_server/src/index.did | 4 - examples/async_await/dfx.json | 20 +-- examples/async_await/src/async_await.did | 6 - examples/audio_and_video/dfx.json | 20 +-- .../audio_and_video/src/backend/server.did | 4 - examples/audio_recorder/dfx.json | 17 +-- examples/autoreload/dfx.json | 19 +-- examples/autoreload/src/server.did | 4 - examples/bitcoin/dfx.json | 21 +--- examples/bitcoin/src/index.did | 6 - examples/bitcoinjs-lib/dfx.json | 8 +- examples/bitcoinjs-lib/src/index.did | 4 - examples/bitcore-lib/dfx.json | 8 +- examples/bitcore-lib/src/index.did | 4 - examples/blob_array/dfx.json | 19 +-- examples/blob_array/src/index.did | 4 - examples/bytes/dfx.json | 19 +-- examples/bytes/src/index.did | 3 - examples/call_raw/dfx.json | 19 +-- examples/call_raw/src/index.did | 4 - examples/candid_encoding/dfx.json | 19 +-- examples/candid_encoding/src/index.did | 4 - examples/candid_keywords/dfx.json | 19 +-- examples/candid_keywords/src/index.did | 6 - examples/canister/dfx.json | 42 ++----- examples/canister/src/index.did | 7 -- examples/canister/src/some_canister.did | 4 - examples/ckbtc/dfx.json | 23 +--- examples/ckbtc/wallet/backend/index.did | 6 - examples/complex_init/dfx.json | 38 +----- .../complex_init/src/complex_init/index.did | 3 - examples/complex_init/src/rec_init/index.did | 4 - examples/complex_types/dfx.json | 17 +-- examples/complex_types/src/index.did | 46 ------- examples/composite_queries/dfx.json | 67 +++------- .../composite_queries/src/canister1/index.did | 12 -- .../composite_queries/src/canister2/index.did | 7 -- .../composite_queries/src/canister3/index.did | 3 - examples/counter/dfx.json | 17 +-- examples/counter/src/index.did | 4 - examples/cross_canister_calls/dfx.json | 42 ++----- .../src/canister1/index.did | 8 -- .../src/canister2/index.did | 9 -- examples/cycles/dfx.json | 42 ++----- examples/cycles/src/cycles/index.did | 6 - examples/cycles/src/intermediary/index.did | 8 -- examples/date/dfx.json | 19 +-- examples/date/src/index.did | 44 ------- examples/ethereum_json_rpc/dfx.json | 21 +--- examples/ethereum_json_rpc/src/index.did | 5 - examples/ethers/dfx.json | 19 +-- examples/ethers/src/index.did | 4 - examples/ethers_base/dfx.json | 19 +-- examples/ethers_base/src/server.did | 4 - examples/express/dfx.json | 19 +-- examples/express/src/backend/index.did | 4 - examples/fetch_ic/dfx.json | 19 +-- examples/fetch_ic/src/backend/server.did | 4 - examples/file_protocol/dfx.json | 19 +-- examples/file_protocol/src/backend.did | 4 - examples/fs/dfx.json | 19 +-- .../func_types/canisters/func_types/index.did | 14 --- .../func_types/canisters/notifiers/index.did | 3 - examples/func_types/dfx.json | 44 ++----- examples/generics/dfx.json | 18 +-- examples/generics/src/index.did | 97 --------------- examples/guard_functions/dfx.json | 19 +-- examples/guard_functions/src/index.did | 14 --- examples/heartbeat/dfx.json | 40 ++---- .../heartbeat/src/heartbeat_async/index.did | 3 - .../heartbeat/src/heartbeat_sync/index.did | 3 - examples/hello_world/dfx.json | 19 +-- examples/hello_world/src/backend/index.did | 4 - examples/http_outcall_fetch/dfx.json | 17 +-- examples/hybrid_canister/dfx.json | 68 ++--------- examples/hybrid_canister/src/canister.did | 6 - .../src/canister_init_and_post_upgrade.did | 6 - examples/hybrid_canister/src/server.did | 6 - .../src/server_init_and_post_upgrade.did | 6 - examples/ic_api/dfx.json | 19 +-- examples/ic_api/src/index.did | 19 --- examples/ic_evm_rpc/dfx.json | 19 +-- examples/ic_evm_rpc/src/candid/server.did | 4 - examples/icrc/canisters/proxy/index.did | 15 --- examples/icrc/dfx.json | 21 +--- examples/imports/dfx.json | 19 +-- examples/imports/src/index.did | 7 -- examples/init/dfx.json | 19 +-- examples/init/src/index.did | 5 - examples/inspect_message/dfx.json | 19 +-- examples/inspect_message/src/index.did | 5 - examples/internet_identity/dfx.json | 19 +-- .../internet_identity/src/backend/server.did | 4 - examples/key_value_store/dfx.json | 19 +-- examples/key_value_store/src/index.did | 4 - examples/large_files/dfx.json | 18 +-- examples/large_files/src/backend/index.did | 4 - examples/ledger_canister/dfx.json | 23 +--- .../src/ledger_canister/index.did | 11 -- examples/list_of_lists/dfx.json | 19 +-- examples/list_of_lists/src/index.did | 30 ----- examples/management_canister/dfx.json | 21 +--- examples/management_canister/src/index.did | 16 --- examples/manual_reply/dfx.json | 19 +-- examples/manual_reply/src/index.did | 25 ---- examples/motoko_examples/calc/dfx.json | 19 +-- examples/motoko_examples/calc/src/index.did | 7 -- examples/motoko_examples/counter/dfx.json | 19 +-- .../motoko_examples/counter/src/index.did | 5 - examples/motoko_examples/echo/dfx.json | 19 +-- examples/motoko_examples/echo/src/index.did | 3 - examples/motoko_examples/factorial/dfx.json | 19 +-- .../motoko_examples/factorial/src/index.did | 3 - examples/motoko_examples/hello-world/dfx.json | 19 +-- .../motoko_examples/hello-world/src/index.did | 3 - examples/motoko_examples/hello/dfx.json | 19 +-- .../motoko_examples/hello/src/hello/index.did | 3 - .../motoko_examples/http_counter/dfx.json | 18 +-- .../minimal-counter-dapp/dfx.json | 19 +-- .../src/minimal_dapp/index.did | 5 - .../persistent-storage/dfx.json | 19 +-- .../persistent-storage/src/index.did | 6 - examples/motoko_examples/phone-book/dfx.json | 19 +-- .../phone-book/src/phone_book/index.did | 4 - examples/motoko_examples/quicksort/dfx.json | 19 +-- .../motoko_examples/quicksort/src/index.did | 3 - .../motoko_examples/simple-to-do/dfx.json | 19 +-- .../simple-to-do/src/index.did | 7 -- examples/motoko_examples/superheroes/dfx.json | 19 +-- .../superheroes/src/superheroes/index.did | 9 -- .../motoko_examples/threshold_ecdsa/dfx.json | 21 +--- .../threshold_ecdsa/src/index.did | 4 - examples/motoko_examples/whoami/dfx.json | 23 +--- examples/motoko_examples/whoami/src/index.did | 7 -- examples/notify_raw/dfx.json | 40 ++---- examples/notify_raw/src/canister1/index.did | 3 - examples/notify_raw/src/canister2/index.did | 4 - examples/null_example/dfx.json | 17 +-- examples/null_example/src/index.did | 10 -- examples/optional_types/dfx.json | 19 +-- examples/optional_types/src/index.did | 9 -- examples/outgoing_http_requests/dfx.json | 21 +--- examples/outgoing_http_requests/src/index.did | 5 - examples/pre_and_post_upgrade/dfx.json | 19 +-- examples/pre_and_post_upgrade/src/index.did | 4 - examples/primitive_types/dfx.json | 17 +-- examples/primitive_types/src/index.did | 42 ------- examples/principal/dfx.json | 19 +-- examples/principal/src/index.did | 13 -- examples/query/dfx.json | 19 +-- examples/query/src/index.did | 3 - examples/randomness/dfx.json | 19 +-- examples/randomness/src/index.did | 4 - examples/recursion/dfx.json | 44 ++----- examples/recursion/src/recursion/index.did | 77 ------------ .../src/recursive_canister/index.did | 6 - examples/rejections/dfx.json | 44 ++----- examples/rejections/src/rejections/index.did | 7 -- .../rejections/src/some_canister/index.did | 5 - examples/robust_imports/dfx.json | 19 +-- examples/robust_imports/src/index.did | 47 -------- examples/run_time_errors/dfx.json | 18 +-- examples/run_time_errors/src/index.did | 114 ------------------ examples/simple_erc20/dfx.json | 19 +-- examples/simple_erc20/src/index.did | 8 -- examples/simple_user_accounts/dfx.json | 18 +-- examples/sqlite/dfx.json | 19 +-- examples/sqlite/src/index.did | 4 - .../dfx.json | 19 +-- .../src/index.did | 14 --- examples/stable_memory/dfx.json | 19 +-- examples/stable_memory/src/index.did | 11 -- examples/stable_structures/dfx.json | 57 ++------- .../stable_structures/src/canister1/index.did | 48 -------- .../stable_structures/src/canister2/index.did | 48 -------- .../stable_structures/src/canister3/index.did | 75 ------------ examples/tfjs/dfx.json | 19 +-- examples/tfjs/src/api.did | 4 - examples/timers/dfx.json | 21 +--- examples/timers/src/timers.did | 5 - examples/tuple_types/dfx.json | 19 +-- examples/tuple_types/src/index.did | 36 ------ examples/update/dfx.json | 19 +-- examples/update/src/index.did | 4 - examples/vanilla_js/dfx.json | 19 +-- examples/vanilla_js/src/index.did | 5 - examples/web_assembly/dfx.json | 19 +-- examples/web_assembly/src/index.did | 4 - src/compiler/file_uploader/index.ts | 4 + .../get_candid_and_canister_methods.ts | 2 +- src/compiler/get_names.ts | 3 +- src/compiler/index.ts | 18 ++- src/compiler/utils/get_canister_config.ts | 32 ++--- src/compiler/utils/types.ts | 8 +- 198 files changed, 406 insertions(+), 2973 deletions(-) create mode 100644 dfx_extension/extension.json create mode 100755 dfx_extension/install.sh delete mode 100644 examples/apollo_server/src/index.did delete mode 100644 examples/async_await/src/async_await.did delete mode 100644 examples/audio_and_video/src/backend/server.did delete mode 100644 examples/autoreload/src/server.did delete mode 100644 examples/bitcoin/src/index.did delete mode 100644 examples/bitcoinjs-lib/src/index.did delete mode 100644 examples/bitcore-lib/src/index.did delete mode 100644 examples/blob_array/src/index.did delete mode 100644 examples/bytes/src/index.did delete mode 100644 examples/call_raw/src/index.did delete mode 100644 examples/candid_encoding/src/index.did delete mode 100644 examples/candid_keywords/src/index.did delete mode 100644 examples/canister/src/index.did delete mode 100644 examples/canister/src/some_canister.did delete mode 100644 examples/ckbtc/wallet/backend/index.did delete mode 100644 examples/complex_init/src/complex_init/index.did delete mode 100644 examples/complex_init/src/rec_init/index.did delete mode 100644 examples/complex_types/src/index.did delete mode 100644 examples/composite_queries/src/canister1/index.did delete mode 100644 examples/composite_queries/src/canister2/index.did delete mode 100644 examples/composite_queries/src/canister3/index.did delete mode 100644 examples/counter/src/index.did delete mode 100644 examples/cross_canister_calls/src/canister1/index.did delete mode 100644 examples/cross_canister_calls/src/canister2/index.did delete mode 100644 examples/cycles/src/cycles/index.did delete mode 100644 examples/cycles/src/intermediary/index.did delete mode 100644 examples/date/src/index.did delete mode 100644 examples/ethereum_json_rpc/src/index.did delete mode 100644 examples/ethers/src/index.did delete mode 100644 examples/ethers_base/src/server.did delete mode 100644 examples/express/src/backend/index.did delete mode 100644 examples/fetch_ic/src/backend/server.did delete mode 100644 examples/file_protocol/src/backend.did delete mode 100644 examples/func_types/canisters/func_types/index.did delete mode 100644 examples/func_types/canisters/notifiers/index.did delete mode 100644 examples/generics/src/index.did delete mode 100644 examples/guard_functions/src/index.did delete mode 100644 examples/heartbeat/src/heartbeat_async/index.did delete mode 100644 examples/heartbeat/src/heartbeat_sync/index.did delete mode 100644 examples/hello_world/src/backend/index.did delete mode 100644 examples/hybrid_canister/src/canister.did delete mode 100644 examples/hybrid_canister/src/canister_init_and_post_upgrade.did delete mode 100644 examples/hybrid_canister/src/server.did delete mode 100644 examples/hybrid_canister/src/server_init_and_post_upgrade.did delete mode 100644 examples/ic_api/src/index.did delete mode 100644 examples/ic_evm_rpc/src/candid/server.did delete mode 100644 examples/icrc/canisters/proxy/index.did delete mode 100644 examples/imports/src/index.did delete mode 100644 examples/init/src/index.did delete mode 100644 examples/inspect_message/src/index.did delete mode 100644 examples/internet_identity/src/backend/server.did delete mode 100644 examples/key_value_store/src/index.did delete mode 100644 examples/large_files/src/backend/index.did delete mode 100644 examples/ledger_canister/src/ledger_canister/index.did delete mode 100644 examples/list_of_lists/src/index.did delete mode 100644 examples/management_canister/src/index.did delete mode 100644 examples/manual_reply/src/index.did delete mode 100644 examples/motoko_examples/calc/src/index.did delete mode 100644 examples/motoko_examples/counter/src/index.did delete mode 100644 examples/motoko_examples/echo/src/index.did delete mode 100644 examples/motoko_examples/factorial/src/index.did delete mode 100644 examples/motoko_examples/hello-world/src/index.did delete mode 100644 examples/motoko_examples/hello/src/hello/index.did delete mode 100644 examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.did delete mode 100644 examples/motoko_examples/persistent-storage/src/index.did delete mode 100644 examples/motoko_examples/phone-book/src/phone_book/index.did delete mode 100644 examples/motoko_examples/quicksort/src/index.did delete mode 100644 examples/motoko_examples/simple-to-do/src/index.did delete mode 100644 examples/motoko_examples/superheroes/src/superheroes/index.did delete mode 100644 examples/motoko_examples/threshold_ecdsa/src/index.did delete mode 100644 examples/motoko_examples/whoami/src/index.did delete mode 100644 examples/notify_raw/src/canister1/index.did delete mode 100644 examples/notify_raw/src/canister2/index.did delete mode 100644 examples/null_example/src/index.did delete mode 100644 examples/optional_types/src/index.did delete mode 100644 examples/outgoing_http_requests/src/index.did delete mode 100644 examples/pre_and_post_upgrade/src/index.did delete mode 100644 examples/primitive_types/src/index.did delete mode 100644 examples/principal/src/index.did delete mode 100644 examples/query/src/index.did delete mode 100644 examples/randomness/src/index.did delete mode 100644 examples/recursion/src/recursion/index.did delete mode 100644 examples/recursion/src/recursive_canister/index.did delete mode 100644 examples/rejections/src/rejections/index.did delete mode 100644 examples/rejections/src/some_canister/index.did delete mode 100644 examples/robust_imports/src/index.did delete mode 100644 examples/run_time_errors/src/index.did delete mode 100644 examples/simple_erc20/src/index.did delete mode 100644 examples/sqlite/src/index.did delete mode 100644 examples/stable_b_tree_map_instruction_threshold/src/index.did delete mode 100644 examples/stable_memory/src/index.did delete mode 100644 examples/stable_structures/src/canister1/index.did delete mode 100644 examples/stable_structures/src/canister2/index.did delete mode 100644 examples/stable_structures/src/canister3/index.did delete mode 100644 examples/tfjs/src/api.did delete mode 100644 examples/timers/src/timers.did delete mode 100644 examples/tuple_types/src/index.did delete mode 100644 examples/update/src/index.did delete mode 100644 examples/vanilla_js/src/index.did delete mode 100644 examples/web_assembly/src/index.did diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c01775adda..a3c35e7e13 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -50,7 +50,7 @@ jobs: - if: contains(github.head_ref, 'release--') name: Install dfx run: | - DFXVM_INIT_YES=true DFX_VERSION=0.19.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" + DFXVM_INIT_YES=true DFX_VERSION=0.20.0-extensioncanistertype.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH # TODO we should use some Action-specific bot account - if: contains(github.head_ref, 'release--') @@ -244,7 +244,7 @@ jobs: - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} name: Install dfx run: | - DFXVM_INIT_YES=true DFX_VERSION=0.19.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" + DFXVM_INIT_YES=true DFX_VERSION=0.20.0-extensioncanistertype.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)" echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} uses: actions/cache@v3 diff --git a/dfx_extension/extension.json b/dfx_extension/extension.json new file mode 100644 index 0000000000..b1e433059b --- /dev/null +++ b/dfx_extension/extension.json @@ -0,0 +1,36 @@ +{ + "name": "azle", + "version": "0.21.1", + "homepage": "https://github.com/dfinity/dfx-extensions", + "authors": "", + "summary": "", + "categories": [], + "keywords": [], + "canister_type": { + "defaults": { + "candid": ".azle/{{canister_name}}/{{canister_name}}.did", + "build": "npx azle {{canister_name}}", + "post_install": "npx azle upload-assets {{canister_name}}", + "wasm": ".azle/{{canister_name}}/{{canister_name}}.wasm", + "gzip": true, + "metadata": [ + { + "name": "candid:service" + }, + { + "name": "cdk:name", + "content": "azle" + } + ], + "tech_stack": { + "cdk": { + "azle": {} + }, + "language": { + "typescript": {}, + "javascript": {} + } + } + } + } +} diff --git a/dfx_extension/install.sh b/dfx_extension/install.sh new file mode 100755 index 0000000000..2987455008 --- /dev/null +++ b/dfx_extension/install.sh @@ -0,0 +1,4 @@ +DFX_CACHE_DIR="$(dfx cache show)" +dfx cache install +mkdir -p "$DFX_CACHE_DIR/extensions/azle" +cp extension.json "$DFX_CACHE_DIR/extensions/azle/extension.json" diff --git a/examples/apollo_server/dfx.json b/examples/apollo_server/dfx.json index 44ae8d3f23..7d87156cf2 100644 --- a/examples/apollo_server/dfx.json +++ b/examples/apollo_server/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "apollo_server": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "candid_gen": "http", - "build": "npx azle apollo_server", - "wasm": ".azle/apollo_server/apollo_server.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/apollo_server/src/index.did b/examples/apollo_server/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/apollo_server/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/async_await/dfx.json b/examples/async_await/dfx.json index fde5007fb1..cd85e73384 100644 --- a/examples/async_await/dfx.json +++ b/examples/async_await/dfx.json @@ -1,27 +1,13 @@ { "canisters": { "async_await": { - "type": "custom", + "type": "azle", "main": "src/async_await.ts", - "candid": "src/async_await.did", - "build": "npx azle async_await", - "wasm": ".azle/async_await/async_await.wasm", - "gzip": true, + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/async_await", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/async_await.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/async_await/src/async_await.did b/examples/async_await/src/async_await.did deleted file mode 100644 index 806bd53f24..0000000000 --- a/examples/async_await/src/async_await.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - getRandomnessDirectly: () -> (vec nat8); - getRandomnessIndirectly: () -> (vec nat8); - getRandomnessSuperIndirectly: () -> (vec nat8); - returnPromiseVoid: () -> (); -} diff --git a/examples/audio_and_video/dfx.json b/examples/audio_and_video/dfx.json index 9bd69ad062..70b490f1d1 100644 --- a/examples/audio_and_video/dfx.json +++ b/examples/audio_and_video/dfx.json @@ -1,13 +1,8 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend/server.ts", - "candid": "src/backend/server.did", - "candid_gen": "http", - "build": "npx azle backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, "assets": [ ["src/frontend/dist", "dist"], ["src/backend/media/audio.ogg", "media/audio.ogg"], @@ -23,18 +18,7 @@ "media/popeye_the_sailor_meets_sindbad_the_sailor.mp4" ] ], - "post_install": "npx azle upload-assets backend", - "build_assets": "npm run build", - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "build_assets": "npm run build" } } } diff --git a/examples/audio_and_video/src/backend/server.did b/examples/audio_and_video/src/backend/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/audio_and_video/src/backend/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/audio_recorder/dfx.json b/examples/audio_recorder/dfx.json index f786ee477b..6559a9571e 100644 --- a/examples/audio_recorder/dfx.json +++ b/examples/audio_recorder/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "audio_recorder": { - "type": "custom", + "type": "azle", "main": "src/index.ts", "candid": "src/index.did", "candid_gen": "custom", - "build": "npx azle audio_recorder", - "wasm": ".azle/audio_recorder/audio_recorder.wasm", - "gzip": true, "declarations": { "output": "test/dfx_generated/audio_recorder", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/autoreload/dfx.json b/examples/autoreload/dfx.json index 55bfeb1de1..b177ecade8 100644 --- a/examples/autoreload/dfx.json +++ b/examples/autoreload/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "autoreload": { - "type": "custom", - "main": "src/server.ts", - "candid": "src/server.did", - "candid_gen": "http", - "build": "npx azle autoreload", - "wasm": ".azle/autoreload/autoreload.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/server.ts" } } } diff --git a/examples/autoreload/src/server.did b/examples/autoreload/src/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/autoreload/src/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/bitcoin/dfx.json b/examples/bitcoin/dfx.json index 1acb6620e2..43612b24e4 100644 --- a/examples/bitcoin/dfx.json +++ b/examples/bitcoin/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "bitcoin": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle bitcoin", - "wasm": ".azle/bitcoin/bitcoin.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/bitcoin", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } }, "networks": { diff --git a/examples/bitcoin/src/index.did b/examples/bitcoin/src/index.did deleted file mode 100644 index 043bb7c09d..0000000000 --- a/examples/bitcoin/src/index.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - getBalance: (text) -> (nat64); - getCurrentFeePercentiles: () -> (vec nat64); - getUtxos: (text) -> (record {next_page:opt vec nat8; tip_height:nat32; tip_block_hash:vec nat8; utxos:vec record {height:nat32; value:nat64; outpoint:record {txid:vec nat8; vout:nat32}}}); - sendTransaction: (vec nat8) -> (bool); -} diff --git a/examples/bitcoinjs-lib/dfx.json b/examples/bitcoinjs-lib/dfx.json index bdf640e1c2..53716bf8e0 100644 --- a/examples/bitcoinjs-lib/dfx.json +++ b/examples/bitcoinjs-lib/dfx.json @@ -1,12 +1,8 @@ { "canisters": { "bitcoinjs": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle bitcoinjs", - "wasm": ".azle/bitcoinjs/bitcoinjs.wasm", - "gzip": true + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/bitcoinjs-lib/src/index.did b/examples/bitcoinjs-lib/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/bitcoinjs-lib/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/bitcore-lib/dfx.json b/examples/bitcore-lib/dfx.json index 26dac539be..52025ed8e1 100644 --- a/examples/bitcore-lib/dfx.json +++ b/examples/bitcore-lib/dfx.json @@ -1,12 +1,8 @@ { "canisters": { "bitcore": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle bitcore", - "wasm": ".azle/bitcore/bitcore.wasm", - "gzip": true + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/bitcore-lib/src/index.did b/examples/bitcore-lib/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/bitcore-lib/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/blob_array/dfx.json b/examples/blob_array/dfx.json index 8d08569784..0f3068dc1b 100644 --- a/examples/blob_array/dfx.json +++ b/examples/blob_array/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "blob_array": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle blob_array", - "wasm": ".azle/blob_array/blob_array.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/blob_array", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/blob_array/src/index.did b/examples/blob_array/src/index.did deleted file mode 100644 index 15efbbbbb9..0000000000 --- a/examples/blob_array/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - getBlob: () -> (vec nat8) query; - getBlobs: () -> (vec vec nat8) query; -} diff --git a/examples/bytes/dfx.json b/examples/bytes/dfx.json index 0e6d495df9..84ab1c4356 100644 --- a/examples/bytes/dfx.json +++ b/examples/bytes/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "bytes_canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle bytes_canister", - "wasm": ".azle/bytes_canister/bytes_canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/bytes_canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/bytes/src/index.did b/examples/bytes/src/index.did deleted file mode 100644 index 4e2b06275c..0000000000 --- a/examples/bytes/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - getBytes: (vec nat8) -> (vec nat8); -} diff --git a/examples/call_raw/dfx.json b/examples/call_raw/dfx.json index e6d4074c65..2d10f22926 100644 --- a/examples/call_raw/dfx.json +++ b/examples/call_raw/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "call_raw": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "build": "npx azle call_raw", - "candid": "src/index.did", - "wasm": ".azle/call_raw/call_raw.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/call_raw", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/call_raw/src/index.did b/examples/call_raw/src/index.did deleted file mode 100644 index 546696e637..0000000000 --- a/examples/call_raw/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - executeCallRaw: (principal, text, text, nat64) -> (variant {Ok:text; Err:text}); - executeCallRaw128: (principal, text, text, nat) -> (variant {Ok:text; Err:text}); -} diff --git a/examples/candid_encoding/dfx.json b/examples/candid_encoding/dfx.json index 04c8e3e2ab..842565d703 100644 --- a/examples/candid_encoding/dfx.json +++ b/examples/candid_encoding/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "candid_encoding": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle candid_encoding", - "wasm": ".azle/candid_encoding/candid_encoding.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/candid_encoding", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/candid_encoding/src/index.did b/examples/candid_encoding/src/index.did deleted file mode 100644 index 0421848c2d..0000000000 --- a/examples/candid_encoding/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - candidDecode: (vec nat8) -> (text) query; - candidEncode: (text) -> (vec nat8) query; -} diff --git a/examples/candid_keywords/dfx.json b/examples/candid_keywords/dfx.json index 006a78687a..5a47ed1559 100644 --- a/examples/candid_keywords/dfx.json +++ b/examples/candid_keywords/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "candid_keywords": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle candid_keywords", - "wasm": ".azle/candid_keywords/candid_keywords.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/candid_keywords", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/candid_keywords/src/index.did b/examples/candid_keywords/src/index.did deleted file mode 100644 index 39f359b7c3..0000000000 --- a/examples/candid_keywords/src/index.did +++ /dev/null @@ -1,6 +0,0 @@ -type rec_0 = func () -> (record {"int":int; "nat":nat; "opt":opt nat; "vec":vec text; "service":service {query1: () -> (bool) query; update1: () -> (text);}; "principal":principal; "blob":vec nat8; "bool":bool; "func":rec_0; "int8":int8; "nat8":nat8; "null":null; "text":text; "query":text; "nat16":nat16; "nat32":nat32; "nat64":nat64; "int16":int16; "int32":int32; "int64":int64; "variant":variant {Tag1; Tag2; Tag3:int}; "float32":float32; "float64":float64; "record":record {age:nat8; lastName:text; firstName:text}}) query; -service: () -> { - candidTypes: () -> (record {"int":int; "nat":nat; "opt":opt nat; "vec":vec text; "service":service {query1: () -> (bool) query; update1: () -> (text);}; "principal":principal; "blob":vec nat8; "bool":bool; "func":rec_0; "int8":int8; "nat8":nat8; "null":null; "text":text; "query":text; "nat16":nat16; "nat32":nat32; "nat64":nat64; "int16":int16; "int32":int32; "int64":int64; "variant":variant {Tag1; Tag2; Tag3:int}; "float32":float32; "float64":float64; "record":record {age:nat8; lastName:text; firstName:text}}) query; - "opt": () -> () query; - "variant": () -> (variant {"service":text; "query":text; "nat32":text}) query; -} diff --git a/examples/canister/dfx.json b/examples/canister/dfx.json index 105b42fcb3..00e2c11a2b 100644 --- a/examples/canister/dfx.json +++ b/examples/canister/dfx.json @@ -1,50 +1,24 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["src/some_canister.did", "src/some_canister.did"]], "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/some_canister.did", "src/some_canister.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "some_canister": { - "type": "custom", + "type": "azle", "main": "src/some_canister.ts", - "candid": "src/some_canister.did", - "build": "npx azle some_canister", - "wasm": ".azle/some_canister/some_canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/some_canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/some_canister.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/canister/src/index.did b/examples/canister/src/index.did deleted file mode 100644 index 2a6e359468..0000000000 --- a/examples/canister/src/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - canisterCrossCanisterCall: (service {query1: () -> (bool) query; update1: () -> (text);}) -> (text); - canisterList: (vec service {query1: () -> (bool) query; update1: () -> (text);}) -> (vec service {query1: () -> (bool) query; update1: () -> (text);}); - canisterNestedReturnType: () -> (record {someCanister:service {query1: () -> (bool) query; update1: () -> (text);}}); - canisterParam: (service {query1: () -> (bool) query; update1: () -> (text);}) -> (service {query1: () -> (bool) query; update1: () -> (text);}) query; - canisterReturnType: () -> (service {query1: () -> (bool) query; update1: () -> (text);}) query; -} diff --git a/examples/canister/src/some_canister.did b/examples/canister/src/some_canister.did deleted file mode 100644 index f61de65f9f..0000000000 --- a/examples/canister/src/some_canister.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - query1: () -> (bool) query; - update1: () -> (text); -} diff --git a/examples/ckbtc/dfx.json b/examples/ckbtc/dfx.json index 0fcec297c4..aeb2f46d84 100644 --- a/examples/ckbtc/dfx.json +++ b/examples/ckbtc/dfx.json @@ -21,28 +21,15 @@ "wasm": "minter/minter.wasm.gz" }, "wallet_backend": { - "type": "custom", + "type": "azle", "main": "wallet/backend/index.ts", - "candid": "wallet/backend/index.did", - "build": "npx azle wallet_backend", - "wasm": ".azle/wallet_backend/wallet_backend.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["CK_BTC_PRINCIPAL", "MINTER_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["minter/minter.did", "minter/minter.did"]], "declarations": { "node_compatibility": true, "output": "wallet/frontend/dfx_generated/wallet_backend" - }, - "env": ["CK_BTC_PRINCIPAL", "MINTER_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["minter/minter.did", "minter/minter.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "wallet/backend/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "wallet_frontend": { "type": "assets", diff --git a/examples/ckbtc/wallet/backend/index.did b/examples/ckbtc/wallet/backend/index.did deleted file mode 100644 index 9714deada8..0000000000 --- a/examples/ckbtc/wallet/backend/index.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - getBalance: () -> (nat64); - getDepositAddress: () -> (text); - transfer: (text, nat) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; BadBurn:record {min_burn_amount:nat}; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; InsufficientFunds:record {balance:nat}}}); - updateBalance: () -> (variant {Ok:vec variant {ValueTooSmall:record {height:nat32; value:nat64; outpoint:record {txid:vec nat8; vout:nat32}}; Tainted:record {height:nat32; value:nat64; outpoint:record {txid:vec nat8; vout:nat32}}; Minted:record {minted_amount:nat64; block_index:nat64; utxo:record {height:nat32; value:nat64; outpoint:record {txid:vec nat8; vout:nat32}}}; Checked:record {height:nat32; value:nat64; outpoint:record {txid:vec nat8; vout:nat32}}}; Err:variant {GenericError:record {error_message:text; error_code:nat64}; TemporarilyUnavailable:text; AlreadyProcessing; NoNewUtxos:record {required_confirmations:nat32; current_confirmations:opt nat32}}}); -} diff --git a/examples/complex_init/dfx.json b/examples/complex_init/dfx.json index 7cacb9d3be..0d2d8b49b0 100644 --- a/examples/complex_init/dfx.json +++ b/examples/complex_init/dfx.json @@ -1,48 +1,22 @@ { "canisters": { "complex_init": { - "type": "custom", + "type": "azle", "main": "src/complex_init/index.ts", - "candid": "src/complex_init/index.did", - "build": "npx azle complex_init", - "wasm": ".azle/complex_init/complex_init.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/complex_init", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/complex_init/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "rec_init": { - "type": "custom", + "type": "azle", "main": "src/rec_init/index.ts", - "candid": "src/rec_init/index.did", - "build": "npx azle rec_init", - "wasm": ".azle/rec_init/rec_init.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/rec_init", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/rec_init/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/complex_init/src/complex_init/index.did b/examples/complex_init/src/complex_init/index.did deleted file mode 100644 index fe1b700ef7..0000000000 --- a/examples/complex_init/src/complex_init/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: (record {text; record {id:text}}) -> { - greetUser: () -> (text) query; -} diff --git a/examples/complex_init/src/rec_init/index.did b/examples/complex_init/src/rec_init/index.did deleted file mode 100644 index 33672a74d9..0000000000 --- a/examples/complex_init/src/rec_init/index.did +++ /dev/null @@ -1,4 +0,0 @@ -type rec_0 = variant {Leaf; Branch:rec_0}; -service: (rec_0) -> { - countBranches: () -> (nat) query; -} diff --git a/examples/complex_types/dfx.json b/examples/complex_types/dfx.json index 1c9cf8bec7..7d4436bedb 100644 --- a/examples/complex_types/dfx.json +++ b/examples/complex_types/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "complex_types": { - "type": "custom", + "type": "azle", "main": "src/index.ts", "candid": "src/index.did", "candid_gen": "custom", - "build": "npx azle complex_types", - "wasm": ".azle/complex_types/complex_types.wasm", - "gzip": true, "declarations": { "output": "test/dfx_generated/complex_types", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/complex_types/src/index.did b/examples/complex_types/src/index.did deleted file mode 100644 index 367c03853c..0000000000 --- a/examples/complex_types/src/index.did +++ /dev/null @@ -1,46 +0,0 @@ -type Post = record { - id: text; - author: User; - reactions: vec Reaction; - text: text; - thread: Thread; -}; - -type Reaction = record { - id: text; - author: User; - post: Post; - reactionType: ReactionType; -}; - -type ReactionType = variant { - Fire; - ThumbsUp; - ThumbsDown; -}; - -type Thread = record { - id: text; - author: User; - posts: vec Post; - title: text; -}; - -type User = record { - id: text; - posts: vec Post; - reactions: vec Reaction; - threads: vec Thread; - username: text; -}; - -service: () -> { - createPost: (text, text, text, nat32) -> (Post); - getAllPosts: (nat32) -> (vec Post) query; - createReaction: (text, text, ReactionType, nat32) -> (Reaction); - getAllReactions: (nat32) -> (vec Reaction) query; - createThread: (text, text, nat32) -> (Thread); - getAllThreads: (nat32) -> (vec Thread) query; - createUser: (text, nat32) -> (User); - getAllUsers: (nat32) -> (vec User) query; -} diff --git a/examples/composite_queries/dfx.json b/examples/composite_queries/dfx.json index 420b69ff86..9c19b8a429 100644 --- a/examples/composite_queries/dfx.json +++ b/examples/composite_queries/dfx.json @@ -1,16 +1,9 @@ { "canisters": { "canister1": { - "type": "custom", + "type": "azle", "main": "src/canister1/index.ts", - "candid": "src/canister1/index.did", - "build": "npx azle canister1", - "wasm": ".azle/canister1/canister1.wasm", - "gzip": true, - "declarations": { - "output": "test/dfx_generated/canister1", - "node_compatibility": true - }, + "candid_gen": "automatic", "env": [ "CANISTER1_PRINCIPAL", "CANISTER2_PRINCIPAL", @@ -22,62 +15,30 @@ ["src/canister2/index.did", "src/canister2.did"], ["src/canister3/index.did", "src/canister3.did"] ], - "metadata": [ - { - "name": "candid:service", - "path": "src/canister1/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "declarations": { + "output": "test/dfx_generated/canister1", + "node_compatibility": true + } }, "canister2": { - "type": "custom", + "type": "azle", "main": "src/canister2/index.ts", - "candid": "src/canister2/index.did", - "build": "npx azle canister2", - "wasm": ".azle/canister2/canister2.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["CANISTER3_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["src/canister3/index.did", "src/canister3.did"]], "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true - }, - "env": ["CANISTER3_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/canister3/index.did", "src/canister3.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/canister2/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "canister3": { - "type": "custom", + "type": "azle", "main": "src/canister3/index.ts", - "candid": "src/canister3/index.did", - "build": "npx azle canister3", - "wasm": ".azle/canister3/canister3.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister3", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister3/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/composite_queries/src/canister1/index.did b/examples/composite_queries/src/canister1/index.did deleted file mode 100644 index c06801e6f2..0000000000 --- a/examples/composite_queries/src/canister1/index.did +++ /dev/null @@ -1,12 +0,0 @@ -service: () -> { - deepQuery: () -> (text) query; - incCanister1: () -> (nat) query; - incCanister2: () -> (nat) query; - incCounter: () -> (nat) query; - manualQuery: () -> (text) query; - simpleCompositeQuery: () -> (text) query; - simpleQuery: () -> (text) query; - simpleUpdate: () -> (text); - totallyManualQuery: () -> (text) query; - updateQuery: () -> (text) query; -} diff --git a/examples/composite_queries/src/canister2/index.did b/examples/composite_queries/src/canister2/index.did deleted file mode 100644 index 01f39353d7..0000000000 --- a/examples/composite_queries/src/canister2/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - deepQuery: () -> (text) query; - incCounter: () -> (nat) query; - manualQuery: () -> (text) query; - simpleQuery: () -> (text) query; - updateQuery: () -> (text); -} diff --git a/examples/composite_queries/src/canister3/index.did b/examples/composite_queries/src/canister3/index.did deleted file mode 100644 index 78eacc0a1e..0000000000 --- a/examples/composite_queries/src/canister3/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - deepQuery: () -> (text) query; -} diff --git a/examples/counter/dfx.json b/examples/counter/dfx.json index 22ef02aecc..21ed14de1f 100644 --- a/examples/counter/dfx.json +++ b/examples/counter/dfx.json @@ -3,24 +3,11 @@ "counter": { "type": "custom", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle counter", - "wasm": ".azle/counter/counter.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/counter", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/counter/src/index.did b/examples/counter/src/index.did deleted file mode 100644 index 3c92dce14e..0000000000 --- a/examples/counter/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - incrementCount: () -> (nat64); - readCount: () -> (nat64) query; -} diff --git a/examples/cross_canister_calls/dfx.json b/examples/cross_canister_calls/dfx.json index aa0390ba32..c9224a7b4c 100644 --- a/examples/cross_canister_calls/dfx.json +++ b/examples/cross_canister_calls/dfx.json @@ -1,50 +1,24 @@ { "canisters": { "canister1": { - "type": "custom", + "type": "azle", "main": "src/canister1/index.ts", - "candid": "src/canister1/index.did", - "build": "npx azle canister1", - "wasm": ".azle/canister1/canister1.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["CANISTER2_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["src/canister2/index.did", "src/canister2/index.did"]], "declarations": { "output": "test/dfx_generated/canister1", "node_compatibility": true - }, - "env": ["CANISTER2_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/canister2/index.did", "src/canister2/index.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/canister1/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "canister2": { - "type": "custom", + "type": "azle", "main": "src/canister2/index.ts", - "candid": "src/canister2/index.did", - "build": "npx azle canister2", - "wasm": ".azle/canister2/canister2.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister2/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/cross_canister_calls/src/canister1/index.did b/examples/cross_canister_calls/src/canister1/index.did deleted file mode 100644 index 6b20dd1de2..0000000000 --- a/examples/cross_canister_calls/src/canister1/index.did +++ /dev/null @@ -1,8 +0,0 @@ -service: () -> { - account: (record {id:text}) -> (opt record {id:text; balance:nat64}); - accounts: () -> (vec record {id:text; balance:nat64}); - balance: (text) -> (nat64); - sendNotification: () -> (); - transfer: (text, text, nat64) -> (nat64); - trap: () -> (text); -} diff --git a/examples/cross_canister_calls/src/canister2/index.did b/examples/cross_canister_calls/src/canister2/index.did deleted file mode 100644 index 25c20581d3..0000000000 --- a/examples/cross_canister_calls/src/canister2/index.did +++ /dev/null @@ -1,9 +0,0 @@ -service: () -> { - account: (record {id:text}) -> (opt record {id:text; balance:nat64}) query; - accounts: () -> (vec record {id:text; balance:nat64}) query; - balance: (text) -> (nat64) query; - getNotification: () -> (text) query; - receiveNotification: (text) -> (); - transfer: (text, text, nat64) -> (nat64); - trap: () -> (text) query; -} diff --git a/examples/cycles/dfx.json b/examples/cycles/dfx.json index c34dc3922f..72df547f05 100644 --- a/examples/cycles/dfx.json +++ b/examples/cycles/dfx.json @@ -1,50 +1,24 @@ { "canisters": { "cycles": { - "type": "custom", + "type": "azle", "main": "src/cycles/index.ts", - "candid": "src/cycles/index.did", - "build": "npx azle cycles", - "wasm": ".azle/cycles/cycles.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/cycles", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/cycles/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "intermediary": { - "type": "custom", + "type": "azle", "main": "src/intermediary/index.ts", - "candid": "src/intermediary/index.did", - "build": "npx azle intermediary", - "wasm": ".azle/intermediary/intermediary.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["CYCLES_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["src/cycles/index.did", "src/cycles/index.did"]], "declarations": { "output": "test/dfx_generated/intermediary", "node_compatibility": true - }, - "env": ["CYCLES_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/cycles/index.did", "src/cycles/index.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/intermediary/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/cycles/src/cycles/index.did b/examples/cycles/src/cycles/index.did deleted file mode 100644 index 0d3dfd51c0..0000000000 --- a/examples/cycles/src/cycles/index.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - getCanisterBalance: () -> (nat64) query; - getCanisterBalance128: () -> (nat) query; - receiveCycles: () -> (nat64); - receiveCycles128: () -> (nat); -} diff --git a/examples/cycles/src/intermediary/index.did b/examples/cycles/src/intermediary/index.did deleted file mode 100644 index 74274cb464..0000000000 --- a/examples/cycles/src/intermediary/index.did +++ /dev/null @@ -1,8 +0,0 @@ -service: () -> { - getCanisterBalance: () -> (nat64) query; - getCanisterBalance128: () -> (nat) query; - sendCycles: () -> (nat64); - sendCycles128: () -> (nat); - sendCycles128Notify: () -> (); - sendCyclesNotify: () -> (); -} diff --git a/examples/date/dfx.json b/examples/date/dfx.json index ffd080ae0d..2d71168e7e 100644 --- a/examples/date/dfx.json +++ b/examples/date/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "date": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle date", - "wasm": ".azle/date/date.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/date", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/date/src/index.did b/examples/date/src/index.did deleted file mode 100644 index 8ce2fb67c3..0000000000 --- a/examples/date/src/index.did +++ /dev/null @@ -1,44 +0,0 @@ -service: () -> { - getDate: (text) -> (nat32) query; - getDay: (text) -> (nat32) query; - getFullYear: (text) -> (nat32) query; - getHours: (text) -> (nat32) query; - getMilliseconds: (text) -> (nat32) query; - getMinutes: (text) -> (nat32) query; - getMonth: (text) -> (nat32) query; - getSeconds: (text) -> (nat32) query; - getTime: (text) -> (nat64) query; - getTimezoneOffset: (text) -> (nat32) query; - getUtcDate: (text) -> (nat32) query; - getUtcDay: (text) -> (nat32) query; - getUtcFullYear: (text) -> (nat32) query; - getUtcHours: (text) -> (nat32) query; - getUtcMilliseconds: (text) -> (nat32) query; - getUtcMinutes: (text) -> (nat32) query; - getUtcMonth: (text) -> (nat32) query; - getUtcSeconds: (text) -> (nat32) query; - now: () -> (nat64) query; - parse: (text) -> (nat64) query; - setDate: (text, nat32) -> (nat32) query; - setFullYear: (text, nat32) -> (nat32) query; - setHours: (text, nat32) -> (nat32) query; - setMilliseconds: (text, nat32) -> (nat32) query; - setMinutes: (text, nat32) -> (nat32) query; - setMonth: (text, nat32) -> (nat32) query; - setSeconds: (text, nat32) -> (nat32) query; - setTime: (text, nat64) -> (nat64) query; - setUtcDate: (text, nat32) -> (nat32) query; - setUtcFullYear: (text, nat32) -> (nat32) query; - setUtcHours: (text, nat32) -> (nat32) query; - setUtcMilliseconds: (text, nat32) -> (nat32) query; - setUtcMinutes: (text, nat32) -> (nat32) query; - setUtcMonth: (text, nat32) -> (nat32) query; - setUtcSeconds: (text, nat32) -> (nat32) query; - toDateString: (text) -> (text) query; - toISOString: (text) -> (text) query; - toJSONString: (text) -> (text) query; - toString: (text) -> (text) query; - toTimeString: (text) -> (text) query; - toUtcString: (text) -> (text) query; - utc: (nat32, nat32) -> (nat64) query; -} diff --git a/examples/ethereum_json_rpc/dfx.json b/examples/ethereum_json_rpc/dfx.json index ced5536cad..c10f17fdf8 100644 --- a/examples/ethereum_json_rpc/dfx.json +++ b/examples/ethereum_json_rpc/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "ethereum_json_rpc": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle ethereum_json_rpc", - "wasm": ".azle/ethereum_json_rpc/ethereum_json_rpc.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/ethereum_json_rpc", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/ethereum_json_rpc/src/index.did b/examples/ethereum_json_rpc/src/index.did deleted file mode 100644 index fbffd45803..0000000000 --- a/examples/ethereum_json_rpc/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: (text) -> { - ethGetBalance: (text) -> (text); - ethGetBlockByNumber: (nat32) -> (text); - ethTransform: (record {context:vec nat8; response:record {status:nat; body:vec nat8; headers:vec record {value:text; name:text}}}) -> (record {status:nat; body:vec nat8; headers:vec record {value:text; name:text}}) query; -} diff --git a/examples/ethers/dfx.json b/examples/ethers/dfx.json index 4cd08e1c03..a308dbab56 100644 --- a/examples/ethers/dfx.json +++ b/examples/ethers/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "ethers": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "candid_gen": "http", - "build": "npx azle ethers", - "wasm": ".azle/ethers/ethers.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/ethers/src/index.did b/examples/ethers/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/ethers/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/ethers_base/dfx.json b/examples/ethers_base/dfx.json index a6c340b133..014e47dc11 100644 --- a/examples/ethers_base/dfx.json +++ b/examples/ethers_base/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "server": { - "type": "custom", - "main": "src/server.ts", - "candid": "src/server.did", - "candid_gen": "http", - "build": "npx azle server", - "wasm": ".azle/server/server.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/server.ts" } } } diff --git a/examples/ethers_base/src/server.did b/examples/ethers_base/src/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/ethers_base/src/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/express/dfx.json b/examples/express/dfx.json index 4a94554213..4b7ed89ca5 100644 --- a/examples/express/dfx.json +++ b/examples/express/dfx.json @@ -1,25 +1,10 @@ { "canisters": { "express": { - "type": "custom", + "type": "azle", "main": "src/backend/index.ts", - "candid": "src/backend/index.did", - "candid_gen": "http", - "build": "npx azle express", - "wasm": ".azle/express/express.wasm", - "gzip": true, "assets": [["src/frontend/dist", "dist"]], - "build_assets": "npm run build", - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "build_assets": "npm run build" } } } diff --git a/examples/express/src/backend/index.did b/examples/express/src/backend/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/express/src/backend/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/fetch_ic/dfx.json b/examples/fetch_ic/dfx.json index b5dbd20bfe..999990d9cb 100644 --- a/examples/fetch_ic/dfx.json +++ b/examples/fetch_ic/dfx.json @@ -1,25 +1,10 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend/server.ts", - "candid": "src/backend/server.did", - "candid_gen": "http", - "build": "npx azle backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, "assets": [["src/frontend/dist", "dist"]], - "build_assets": "npm run build", - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "build_assets": "npm run build" }, "internet_identity": { "type": "custom", diff --git a/examples/fetch_ic/src/backend/server.did b/examples/fetch_ic/src/backend/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/fetch_ic/src/backend/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/file_protocol/dfx.json b/examples/file_protocol/dfx.json index 9a125099ac..7a8cf401fe 100644 --- a/examples/file_protocol/dfx.json +++ b/examples/file_protocol/dfx.json @@ -1,24 +1,9 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend.ts", - "candid": "src/backend.did", - "candid_gen": "http", - "build": "npx azle backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, - "assets": [["src/assets", "assets"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/backend.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "assets": [["src/assets", "assets"]] } } } diff --git a/examples/file_protocol/src/backend.did b/examples/file_protocol/src/backend.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/file_protocol/src/backend.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/fs/dfx.json b/examples/fs/dfx.json index 8d6bab7968..0de6718a97 100644 --- a/examples/fs/dfx.json +++ b/examples/fs/dfx.json @@ -1,24 +1,9 @@ { "canisters": { "fs": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "candid_gen": "http", - "build": "npx azle fs", - "wasm": ".azle/fs/fs.wasm", - "gzip": true, - "assets": [["src/image.jpg", "image.jpg"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "assets": [["src/image.jpg", "image.jpg"]] } } } diff --git a/examples/func_types/canisters/func_types/index.did b/examples/func_types/canisters/func_types/index.did deleted file mode 100644 index 236c78c089..0000000000 --- a/examples/func_types/canisters/func_types/index.did +++ /dev/null @@ -1,14 +0,0 @@ -type rec_0 = func (record {id:text; complexFunc:rec_0; basicFunc:func (text) -> (text) query}, variant {Bad; ComplexFunc:rec_0; Good; BasicFunc:func (text) -> (text) query}) -> (nat64); -type rec_1 = func (record {id:text; complexFunc:rec_1; basicFunc:func (text) -> (text) query}, variant {Bad; ComplexFunc:rec_1; Good; BasicFunc:func (text) -> (text) query}) -> (nat64); -type rec_2 = func (record {id:text; complexFunc:rec_2; basicFunc:func (text) -> (text) query}, variant {Bad; ComplexFunc:rec_2; Good; BasicFunc:func (text) -> (text) query}) -> (nat64); -service: () -> { - basicFuncParam: (func (text) -> (text) query) -> (func (text) -> (text) query) query; - basicFuncParamArray: (vec func (text) -> (text) query) -> (vec func (text) -> (text) query) query; - basicFuncReturnType: () -> (func (text) -> (text) query) query; - basicFuncReturnTypeArray: () -> (vec func (text) -> (text) query) query; - complexFuncParam: (rec_0) -> (rec_1) query; - complexFuncReturnType: () -> (rec_2) query; - getNotifierFromNotifiersCanister: () -> (func (vec nat8) -> () oneway); - getStableFunc: () -> (func (nat64, text) -> () query) query; - nullFuncParam: (func (opt null, vec null, null, vec vec null, vec opt null) -> (null) query) -> (func (opt null, vec null, null, vec vec null, vec opt null) -> (null) query) query; -} diff --git a/examples/func_types/canisters/notifiers/index.did b/examples/func_types/canisters/notifiers/index.did deleted file mode 100644 index 9ea58c8334..0000000000 --- a/examples/func_types/canisters/notifiers/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - getNotifier: () -> (func (vec nat8) -> () oneway) query; -} diff --git a/examples/func_types/dfx.json b/examples/func_types/dfx.json index dd1cd04dbf..fca9909932 100644 --- a/examples/func_types/dfx.json +++ b/examples/func_types/dfx.json @@ -1,51 +1,25 @@ { "canisters": { "func_types": { - "type": "custom", + "type": "azle", "main": "canisters/func_types/index.ts", - "candid": "canisters/func_types/index.did", - "build": "npx azle func_types", - "wasm": ".azle/func_types/func_types.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["NOTIFIERS_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["canisters/notifiers/index.did", "src/notifiers.did"]], "declarations": { "output": "test/dfx_generated/func_types", "node_compatibility": true - }, - "env": ["NOTIFIERS_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["canisters/notifiers/index.did", "src/notifiers.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "canisters/func_types/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "notifiers": { - "type": "custom", + "type": "azle", "main": "canisters/notifiers/index.ts", - "candid": "canisters/notifiers/index.did", - "build": "npx azle notifiers", - "wasm": ".azle/notifiers/notifiers.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["NOTIFIERS_PRINCIPAL"], "declarations": { "output": "test/dfx_generated/notifiers", "node_compatibility": true - }, - "env": ["NOTIFIERS_PRINCIPAL"], - "metadata": [ - { - "name": "candid:service", - "path": "canisters/notifiers/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/generics/dfx.json b/examples/generics/dfx.json index e424fede2e..ae94dc73fb 100644 --- a/examples/generics/dfx.json +++ b/examples/generics/dfx.json @@ -1,25 +1,13 @@ { "canisters": { "generics": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle generics", - "wasm": ".azle/generics/generics.wasm.gz", + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/generics", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/generics/src/index.did b/examples/generics/src/index.did deleted file mode 100644 index 46f6b327a9..0000000000 --- a/examples/generics/src/index.did +++ /dev/null @@ -1,97 +0,0 @@ -type GenericAliasRecord = record { arm1 : text; arm2 : KeyValuePairRecord }; -type GenericAliasVariant = variant { Arm1 : text; Arm2 : KeyValuePair }; -type GenericRecord = record { - arm1 : _InlineInlineTypesGenericRecordReturnTypeTypeArg0; - arm2 : vec bool; - arm3 : record { float64; text }; -}; -type GenericVariant = variant { - Arm1 : _InlineInlineTypesGenericTupleReturnTypeTypeArg0; - Arm2 : vec bool; - Arm3 : record { float64; text }; -}; -type KeyValuePair = variant { Key : text; Value : nat64 }; -type KeyValuePairRecord = record { key : text; value : nat64 }; -type MyRecord = record { prop1 : text; prop2 : nat64 }; -type MyVariant = variant { Arm1 : text; Arm2 : nat64 }; -type OneGenericTypeParamRecord = record { a : text; b : float64 }; -type OneGenericTypeParamVariant = variant { A : text; B : float64 }; -type ThreeGenericTypeParamsRecord = record { a : text; b : float64; c : bool }; -type ThreeGenericTypeParamsVariant = variant { - A : text; - B : float64; - C : bool; -}; -type ThreeInlinesGenericVariant = variant { - Arm1 : _InlineThreeInlinesGenericVariantReturnTypeTypeArg0; - Arm2 : _InlineThreeInlinesGenericVariantReturnTypeTypeArg1; - Arm3 : record { text }; -}; -type _AzleResult = variant { Ok : float64; Err : text }; -type _AzleResult_1 = variant { Ok : text; Err : bool }; -type _AzleResult_2 = variant { - Ok : bool; - Err : _InlineResultInlineTypeArgumentsReturnTypeTypeArg1; -}; -type _AzleResult_3 = variant { Ok : text; Err : float64 }; -type _InlineInlineTypesGenericRecordReturnTypeTypeArg0 = record { - id : float64; - name : text; -}; -type _InlineInlineTypesGenericTupleReturnTypeTypeArg0 = record { - id : float64; - name : text; -}; -type _InlineInlineTypesGenericVecReturnTypeTypeArg0 = record { - id : float64; - name : text; -}; -type _InlineResultInlineTypeArgumentsReturnTypeTypeArg1 = record { - error : text; -}; -type _InlineThreeInlinesGenericVariantReturnTypeTypeArg0 = record { - prop1 : text; - prop2 : float64; - prop3 : bool; -}; -type _InlineThreeInlinesGenericVariantReturnTypeTypeArg1 = variant { - Arm1 : text; -}; -service : () -> { - genericAliasRecordAlias : () -> (GenericAliasRecord) query; - genericAliasTupleAlias : () -> ( - record { text; record { text; nat64 } }, - ) query; - genericAliasVariantAlias : () -> (GenericAliasVariant) query; - genericResultAlias : () -> (_AzleResult) query; - inlineTypesGenericRecord : () -> (GenericRecord) query; - inlineTypesGenericTuple : () -> ( - record { - _InlineInlineTypesGenericTupleReturnTypeTypeArg0; - vec bool; - record { float64; text }; - }, - ) query; - inlineTypesGenericVariant : () -> (GenericVariant) query; - inlineTypesGenericVec : () -> ( - vec _InlineInlineTypesGenericVecReturnTypeTypeArg0, - ) query; - myRecordAlias : () -> (MyRecord) query; - myTupleAlias : () -> (record { text; nat64 }) query; - myVariantAlias : () -> (MyVariant) query; - myVecAlias : () -> (vec text) query; - nonGenericResultAlias : () -> (_AzleResult_1) query; - oneGenericTypeParamRecord : () -> (OneGenericTypeParamRecord) query; - oneGenericTypeParamTuple : () -> (record { text; float64 }) query; - oneGenericTypeParamVariant : () -> (OneGenericTypeParamVariant) query; - oneGenericTypeParamVec : () -> (vec text) query; - resultInlineTypeArguments : () -> (_AzleResult_2) query; - simpleResult : () -> (_AzleResult_3) query; - threeGenericTypeParamsRecord : () -> (ThreeGenericTypeParamsRecord) query; - threeGenericTypeParamsTuple : () -> (record { text; float64; bool }) query; - threeGenericTypeParamsVariant : () -> (ThreeGenericTypeParamsVariant) query; - threeInlinesGenericVariant : () -> (ThreeInlinesGenericVariant) query; - twoGenericTypeParamsRecord : () -> (OneGenericTypeParamRecord) query; - twoGenericTypeParamsTuple : () -> (record { text; float64 }) query; - twoGenericTypeParamsVariant : () -> (OneGenericTypeParamVariant) query; -} \ No newline at end of file diff --git a/examples/guard_functions/dfx.json b/examples/guard_functions/dfx.json index c50ed06f14..8059250df0 100644 --- a/examples/guard_functions/dfx.json +++ b/examples/guard_functions/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "guard_functions": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle guard_functions", - "wasm": ".azle/guard_functions/guard_functions.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/guard_functions", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/guard_functions/src/index.did b/examples/guard_functions/src/index.did deleted file mode 100644 index 00693bd418..0000000000 --- a/examples/guard_functions/src/index.did +++ /dev/null @@ -1,14 +0,0 @@ -service: () -> { - callExpressionWithEmptyOptionsObject: () -> (bool) query; - callExpressionWithoutOptionsObject: () -> (bool) query; - customErrorGuarded: () -> (bool) query; - errorStringGuarded: () -> (bool) query; - getCounter: () -> (nat32) query; - identifierAnnotation: () -> (bool) query; - looselyGuarded: () -> (bool) query; - looselyGuardedManual: () -> (bool) query; - looselyGuardedWithGuardOptionKeyAsString: () -> (bool) query; - modifyStateGuarded: () -> (bool); - nonStringErrValueGuarded: () -> (bool) query; - tightlyGuarded: () -> (bool) query; -} diff --git a/examples/heartbeat/dfx.json b/examples/heartbeat/dfx.json index b4753d568f..72d6af226e 100644 --- a/examples/heartbeat/dfx.json +++ b/examples/heartbeat/dfx.json @@ -1,49 +1,23 @@ { "canisters": { "heartbeat_async": { - "type": "custom", + "type": "azle", "main": "src/heartbeat_async/index.ts", - "candid": "src/heartbeat_async/index.did", - "build": "npx azle heartbeat_async", - "wasm": ".azle/heartbeat_async/heartbeat_async.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/heartbeat_async", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/heartbeat_async/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "heartbeat_sync": { - "type": "custom", + "type": "azle", "main": "src/heartbeat_sync/index.ts", - "candid": "src/heartbeat_sync/index.did", - "build": "npx azle heartbeat_sync", - "wasm": ".azle/heartbeat_sync/heartbeat_sync.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/heartbeat_sync", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/heartbeat_sync/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/heartbeat/src/heartbeat_async/index.did b/examples/heartbeat/src/heartbeat_async/index.did deleted file mode 100644 index dd004659b2..0000000000 --- a/examples/heartbeat/src/heartbeat_async/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - getInitialized: () -> (vec nat8) query; -} diff --git a/examples/heartbeat/src/heartbeat_sync/index.did b/examples/heartbeat/src/heartbeat_sync/index.did deleted file mode 100644 index dfc7e585bb..0000000000 --- a/examples/heartbeat/src/heartbeat_sync/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - getInitialized: () -> (bool) query; -} diff --git a/examples/hello_world/dfx.json b/examples/hello_world/dfx.json index 3f394bb562..9d36edc5f9 100644 --- a/examples/hello_world/dfx.json +++ b/examples/hello_world/dfx.json @@ -1,25 +1,10 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend/index.ts", - "candid": "src/backend/index.did", - "candid_gen": "http", - "build": "npx azle backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, "assets": [["src/frontend/dist", "dist"]], - "build_assets": "npm run build", - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "build_assets": "npm run build" } } } diff --git a/examples/hello_world/src/backend/index.did b/examples/hello_world/src/backend/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/hello_world/src/backend/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/http_outcall_fetch/dfx.json b/examples/http_outcall_fetch/dfx.json index d3d493e38b..3144d115c2 100644 --- a/examples/http_outcall_fetch/dfx.json +++ b/examples/http_outcall_fetch/dfx.json @@ -1,22 +1,9 @@ { "canisters": { "server": { - "type": "custom", + "type": "azle", "main": "src/server.ts", - "candid": "src/server.did", - "build": "npx azle server", - "wasm": ".azle/server/server.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "candid_gen": "automatic" } } } diff --git a/examples/hybrid_canister/dfx.json b/examples/hybrid_canister/dfx.json index 83eaf50fe2..c4a9aeca8f 100644 --- a/examples/hybrid_canister/dfx.json +++ b/examples/hybrid_canister/dfx.json @@ -1,90 +1,38 @@ { "canisters": { "server": { - "type": "custom", + "type": "azle", "main": "src/server.ts", - "candid": "src/server.did", - "build": "npx azle server", - "wasm": ".azle/server/server.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ], + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/server", "node_compatibility": true } }, "server_init_and_post_upgrade": { - "type": "custom", + "type": "azle", "init_arg": "(\"http-query-server-init-and-post-upgrade\", \"http-update-server-init-and-post-upgrade\", \"candidQueryServerInitAndPostUpgrade\", \"candidUpdateServerInitAndPostUpgrade\")", "main": "src/server_init_and_post_upgrade.ts", - "candid": "src/server_init_and_post_upgrade.did", - "build": "npx azle server_init_and_post_upgrade", - "wasm": ".azle/server_init_and_post_upgrade/server_init_and_post_upgrade.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/server_init_and_post_upgrade.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ], + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/server_init_and_post_upgrade", "node_compatibility": true } }, "canister": { - "type": "custom", + "type": "azle", "main": "src/canister.ts", - "candid": "src/canister.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ], + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true } }, "canister_init_and_post_upgrade": { - "type": "custom", + "type": "azle", "init_arg": "(\"http-query-canister-init-and-post-upgrade\", \"http-update-canister-init-and-post-upgrade\", \"candidQueryCanisterInitAndPostUpgrade\", \"candidUpdateCanisterInitAndPostUpgrade\")", "main": "src/canister_init_and_post_upgrade.ts", - "candid": "src/canister_init_and_post_upgrade.did", - "build": "npx azle canister_init_and_post_upgrade", - "wasm": ".azle/canister_init_and_post_upgrade/canister_init_and_post_upgrade.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister_init_and_post_upgrade.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ], + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister_init_and_post_upgrade", "node_compatibility": true diff --git a/examples/hybrid_canister/src/canister.did b/examples/hybrid_canister/src/canister.did deleted file mode 100644 index 969fe87fe9..0000000000 --- a/examples/hybrid_canister/src/canister.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - candidQuery: () -> (text) query; - candidUpdate: () -> (text); - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/hybrid_canister/src/canister_init_and_post_upgrade.did b/examples/hybrid_canister/src/canister_init_and_post_upgrade.did deleted file mode 100644 index 6293f81261..0000000000 --- a/examples/hybrid_canister/src/canister_init_and_post_upgrade.did +++ /dev/null @@ -1,6 +0,0 @@ -service: (text, text, text, text) -> { - candidQuery: () -> (text) query; - candidUpdate: () -> (text); - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/hybrid_canister/src/server.did b/examples/hybrid_canister/src/server.did deleted file mode 100644 index 969fe87fe9..0000000000 --- a/examples/hybrid_canister/src/server.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - candidQuery: () -> (text) query; - candidUpdate: () -> (text); - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/hybrid_canister/src/server_init_and_post_upgrade.did b/examples/hybrid_canister/src/server_init_and_post_upgrade.did deleted file mode 100644 index 6293f81261..0000000000 --- a/examples/hybrid_canister/src/server_init_and_post_upgrade.did +++ /dev/null @@ -1,6 +0,0 @@ -service: (text, text, text, text) -> { - candidQuery: () -> (text) query; - candidUpdate: () -> (text); - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/ic_api/dfx.json b/examples/ic_api/dfx.json index d196a8c1df..8c7d97528c 100644 --- a/examples/ic_api/dfx.json +++ b/examples/ic_api/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "ic_api": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle ic_api", - "wasm": ".azle/ic_api/ic_api.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/ic_api", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/ic_api/src/index.did b/examples/ic_api/src/index.did deleted file mode 100644 index 083bbc4846..0000000000 --- a/examples/ic_api/src/index.did +++ /dev/null @@ -1,19 +0,0 @@ -service: () -> { - argDataRaw: (vec nat8, int8, bool, text) -> (vec nat8) query; - argDataRawSize: (vec nat8, int8, bool, text) -> (nat32) query; - caller: () -> (principal) query; - canisterBalance: () -> (nat64) query; - canisterBalance128: () -> (nat) query; - canisterVersion: () -> (nat64) query; - dataCertificate: () -> (opt vec nat8) query; - dataCertificateNull: () -> (opt vec nat8); - id: () -> (principal) query; - instructionCounter: () -> (nat64) query; - isController: (principal) -> (bool) query; - performanceCounter: () -> (nat64) query; - print: (text) -> (bool) query; - reject: (text) -> (empty) query; - setCertifiedData: (vec nat8) -> (); - time: () -> (nat64) query; - trap: (text) -> (bool) query; -} diff --git a/examples/ic_evm_rpc/dfx.json b/examples/ic_evm_rpc/dfx.json index 5abe952b45..795645c7c4 100644 --- a/examples/ic_evm_rpc/dfx.json +++ b/examples/ic_evm_rpc/dfx.json @@ -1,25 +1,10 @@ { "canisters": { "server": { - "specified_id": "bd3sg-teaaa-aaaaa-qaaba-cai", - "type": "custom", + "type": "azle", "main": "src/server.ts", - "candid": "src/candid/server.did", - "candid_gen": "http", - "build": "npx azle server", - "wasm": ".azle/server/server.wasm", - "gzip": true, "assets": [["src/candid/evm_rpc.did", "src/candid/evm_rpc.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/candid/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "specified_id": "bd3sg-teaaa-aaaaa-qaaba-cai" }, "evm_rpc": { "specified_id": "be2us-64aaa-aaaaa-qaabq-cai", diff --git a/examples/ic_evm_rpc/src/candid/server.did b/examples/ic_evm_rpc/src/candid/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/ic_evm_rpc/src/candid/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/icrc/canisters/proxy/index.did b/examples/icrc/canisters/proxy/index.did deleted file mode 100644 index 681270de93..0000000000 --- a/examples/icrc/canisters/proxy/index.did +++ /dev/null @@ -1,15 +0,0 @@ -service: () -> { - icrc1_balance_of: (record {owner:principal; subaccount:opt vec nat8}) -> (nat) query; - icrc1_decimals: () -> (nat8) query; - icrc1_fee: () -> (nat) query; - icrc1_metadata: () -> (vec record {text; variant {Int:int; Nat:nat; Blob:vec nat8; Text:text}}) query; - icrc1_minting_account: () -> (opt record {owner:principal; subaccount:opt vec nat8}) query; - icrc1_name: () -> (text) query; - icrc1_supported_standards: () -> (vec record {url:text; name:text}) query; - icrc1_symbol: () -> (text) query; - icrc1_total_supply: () -> (nat) query; - icrc1_transfer: (record {to:record {owner:principal; subaccount:opt vec nat8}; fee:opt nat; memo:opt vec nat8; from_subaccount:opt vec nat8; created_at_time:opt nat64; amount:nat}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; BadBurn:record {min_burn_amount:nat}; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; InsufficientFunds:record {balance:nat}}}); - icrc2_allowance: (record {account:record {owner:principal; subaccount:opt vec nat8}; spender:record {owner:principal; subaccount:opt vec nat8}}) -> (record {allowance:nat; expires_at:opt nat64}); - icrc2_approve: (record {fee:opt nat; memo:opt vec nat8; from_subaccount:opt vec nat8; created_at_time:opt nat64; amount:nat; expected_allowance:opt nat; expires_at:opt nat64; spender:record {owner:principal; subaccount:opt vec nat8}}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; AllowanceChanged:record {current_allowance:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; Expired:record {ledger_time:nat64}; InsufficientFunds:record {balance:nat}}}); - icrc2_transfer_from: (record {to:record {owner:principal; subaccount:opt vec nat8}; fee:opt nat; spender_subaccount:opt vec nat8; from:record {owner:principal; subaccount:opt vec nat8}; memo:opt vec nat8; created_at_time:opt nat64; amount:nat}) -> (variant {Ok:nat; Err:variant {GenericError:record {message:text; error_code:nat}; TemporarilyUnavailable; InsufficientAllowance:record {allowance:nat}; BadBurn:record {min_burn_amount:nat}; Duplicate:record {duplicate_of:nat}; BadFee:record {expected_fee:nat}; CreatedInFuture:record {ledger_time:nat64}; TooOld; InsufficientFunds:record {balance:nat}}}); -} diff --git a/examples/icrc/dfx.json b/examples/icrc/dfx.json index b29ff4a9ba..48928dc599 100644 --- a/examples/icrc/dfx.json +++ b/examples/icrc/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "proxy": { - "type": "custom", + "type": "azle", "main": "canisters/proxy/index.ts", - "candid": "canisters/proxy/index.did", - "build": "npx azle proxy", - "wasm": ".azle/proxy/proxy.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["ICRC_PRINCIPAL", "AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/proxy", "node_compatibility": true - }, - "env": ["ICRC_PRINCIPAL", "AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "canisters/proxy/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "icrc": { "type": "motoko", diff --git a/examples/imports/dfx.json b/examples/imports/dfx.json index b5645aedf9..aa93dc0fa2 100644 --- a/examples/imports/dfx.json +++ b/examples/imports/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "imports": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle imports", - "wasm": ".azle/imports/imports.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/imports", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/imports/src/index.did b/examples/imports/src/index.did deleted file mode 100644 index 2c9c4bd552..0000000000 --- a/examples/imports/src/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - getMathMessage: () -> (int) query; - getOne: () -> (text) query; - getThree: () -> (text) query; - getTwo: () -> (text) query; - sha224Hash: (text) -> (text) query; -} diff --git a/examples/init/dfx.json b/examples/init/dfx.json index d6c678292e..df0d63ba37 100644 --- a/examples/init/dfx.json +++ b/examples/init/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "init": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle init", - "wasm": ".azle/init/init.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/init", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/init/src/index.did b/examples/init/src/index.did deleted file mode 100644 index 4f448d1dba..0000000000 --- a/examples/init/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: (record {id:text}, variant {Fire; Wave}, principal) -> { - getOwner: () -> (opt principal) query; - getReaction: () -> (opt variant {Fire; Wave}) query; - getUser: () -> (opt record {id:text}) query; -} diff --git a/examples/inspect_message/dfx.json b/examples/inspect_message/dfx.json index 2ca06be47d..6656fa4084 100644 --- a/examples/inspect_message/dfx.json +++ b/examples/inspect_message/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "inspect_message": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle inspect_message", - "wasm": ".azle/inspect_message/inspect_message.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/inspect_message", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/inspect_message/src/index.did b/examples/inspect_message/src/index.did deleted file mode 100644 index e2ac47359e..0000000000 --- a/examples/inspect_message/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - accessible: () -> (bool); - alsoInaccessible: () -> (bool); - inaccessible: () -> (bool); -} diff --git a/examples/internet_identity/dfx.json b/examples/internet_identity/dfx.json index b5dbd20bfe..999990d9cb 100644 --- a/examples/internet_identity/dfx.json +++ b/examples/internet_identity/dfx.json @@ -1,25 +1,10 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend/server.ts", - "candid": "src/backend/server.did", - "candid_gen": "http", - "build": "npx azle backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, "assets": [["src/frontend/dist", "dist"]], - "build_assets": "npm run build", - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/server.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "build_assets": "npm run build" }, "internet_identity": { "type": "custom", diff --git a/examples/internet_identity/src/backend/server.did b/examples/internet_identity/src/backend/server.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/internet_identity/src/backend/server.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/key_value_store/dfx.json b/examples/key_value_store/dfx.json index b279f8127d..e4fe31690c 100644 --- a/examples/key_value_store/dfx.json +++ b/examples/key_value_store/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "key_value_store": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle key_value_store --native-compilation", - "wasm": ".azle/key_value_store/key_value_store.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/key_value_store", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/key_value_store/src/index.did b/examples/key_value_store/src/index.did deleted file mode 100644 index 1fbf4a6fd0..0000000000 --- a/examples/key_value_store/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - get: (text) -> (opt text) query; - set: (text, text) -> (); -} diff --git a/examples/large_files/dfx.json b/examples/large_files/dfx.json index 7410dd439d..caf37fbc6d 100644 --- a/examples/large_files/dfx.json +++ b/examples/large_files/dfx.json @@ -1,28 +1,12 @@ { "canisters": { "backend": { - "type": "custom", + "type": "azle", "main": "src/backend/index.ts", - "candid": "src/backend/index.did", - "candid_gen": "http", - "build": "npx azle backend", - "post_install": "npx azle upload-assets backend", - "wasm": ".azle/backend/backend.wasm", - "gzip": true, "assets_large": [ ["assets/auto", "assets"], ["assets/permanent", "assets"], ["assets/single_asset.txt", "assets/text/single.txt"] - ], - "metadata": [ - { - "name": "candid:service", - "path": "src/backend/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } ] } } diff --git a/examples/large_files/src/backend/index.did b/examples/large_files/src/backend/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/large_files/src/backend/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/ledger_canister/dfx.json b/examples/ledger_canister/dfx.json index b3563b831c..3c8a2dddf1 100644 --- a/examples/ledger_canister/dfx.json +++ b/examples/ledger_canister/dfx.json @@ -1,28 +1,15 @@ { "canisters": { "ledger_canister": { - "type": "custom", + "type": "azle", "main": "src/ledger_canister/index.ts", - "candid": "src/ledger_canister/index.did", - "build": "npx azle ledger_canister", - "wasm": ".azle/ledger_canister/ledger_canister.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["ICP_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], + "assets": [["src/icp_ledger/ledger.public.did", "src/ledger.did"]], "declarations": { "output": "test/dfx_generated/ledger_canister", "node_compatibility": true - }, - "env": ["ICP_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/icp_ledger/ledger.public.did", "src/ledger.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/ledger_canister/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "icp_ledger": { "type": "custom", diff --git a/examples/ledger_canister/src/ledger_canister/index.did b/examples/ledger_canister/src/ledger_canister/index.did deleted file mode 100644 index 0e3624ae50..0000000000 --- a/examples/ledger_canister/src/ledger_canister/index.did +++ /dev/null @@ -1,11 +0,0 @@ -service: () -> { - executeTransfer: (text, nat64, nat64, opt nat64) -> (variant {Ok:nat64; Err:variant {TxTooOld:record {allowed_window_nanos:nat64}; BadFee:record {expected_fee:record {e8s:nat64}}; TxDuplicate:record {duplicate_of:nat64}; TxCreatedInFuture; InsufficientFunds:record {balance:record {e8s:nat64}}}}); - getAccountBalance: (text) -> (record {e8s:nat64}); - getAddressFromPrincipal: (principal) -> (text) query; - getArchives: () -> (record {archives:vec record {canister_id:principal}}); - getBlocks: (record {start:nat64; length:nat64}) -> (record {certificate:opt vec nat8; blocks:vec record {transaction:record {memo:nat64; operation:opt variant {Burn:record {from:vec nat8; amount:record {e8s:nat64}}; Mint:record {to:vec nat8; amount:record {e8s:nat64}}; Transfer:record {to:vec nat8; fee:record {e8s:nat64}; from:vec nat8; amount:record {e8s:nat64}}}; created_at_time:record {timestamp_nanos:nat64}}; timestamp:record {timestamp_nanos:nat64}; parent_hash:opt vec nat8}; chain_length:nat64; first_block_index:nat64; archived_blocks:vec record {callback:func (record {start:nat64; length:nat64}) -> (variant {Ok:record {blocks:vec record {transaction:record {memo:nat64; operation:opt variant {Burn:record {from:vec nat8; amount:record {e8s:nat64}}; Mint:record {to:vec nat8; amount:record {e8s:nat64}}; Transfer:record {to:vec nat8; fee:record {e8s:nat64}; from:vec nat8; amount:record {e8s:nat64}}}; created_at_time:record {timestamp_nanos:nat64}}; timestamp:record {timestamp_nanos:nat64}; parent_hash:opt vec nat8}}; Err:variant {BadFirstBlockIndex:record {requested_index:nat64; first_valid_index:nat64}; Other:record {error_message:text; error_code:nat64}}}) query; start:nat64; length:nat64}}); - getDecimals: () -> (nat32); - getName: () -> (text); - getSymbol: () -> (text); - getTransferFee: () -> (record {transfer_fee:record {e8s:nat64}}); -} diff --git a/examples/list_of_lists/dfx.json b/examples/list_of_lists/dfx.json index 118b298c16..1924f3b808 100644 --- a/examples/list_of_lists/dfx.json +++ b/examples/list_of_lists/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "list_of_lists": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle list_of_lists", - "wasm": ".azle/list_of_lists/list_of_lists.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "dfx_generated/list_of_lists", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/list_of_lists/src/index.did b/examples/list_of_lists/src/index.did deleted file mode 100644 index 03bf3ef376..0000000000 --- a/examples/list_of_lists/src/index.did +++ /dev/null @@ -1,30 +0,0 @@ -service: () -> { - listOfBlob: (vec vec nat8) -> (vec vec nat8) query; - listOfBool: (vec vec vec bool) -> (vec vec vec bool) query; - listOfEmpty: () -> (vec vec vec empty) query; - listOfF32: (vec vec vec float32) -> (vec vec vec float32) query; - listOfF64: (vec vec vec float64) -> (vec vec vec float64) query; - listOfFunc: (vec vec vec func (text) -> (text) query) -> (vec vec vec func (text) -> (text) query) query; - listOfInt: (vec vec vec int) -> (vec vec vec int) query; - listOfInt16: (vec vec vec int16) -> (vec vec vec int16) query; - listOfInt32: (vec vec vec int32) -> (vec vec vec int32) query; - listOfInt64: (vec vec vec int64) -> (vec vec vec int64) query; - listOfInt8: (vec vec vec int8) -> (vec vec vec int8) query; - listOfListOfBlob: (vec vec vec nat8) -> (vec vec vec nat8) query; - listOfListOfInt8: () -> (vec vec vec vec vec vec vec int8) query; - listOfNat: (vec vec vec nat) -> (vec vec vec nat) query; - listOfNat16: (vec vec vec nat16) -> (vec vec vec nat16) query; - listOfNat32: (vec vec vec nat32) -> (vec vec vec nat32) query; - listOfNat64: (vec vec vec nat64) -> (vec vec vec nat64) query; - listOfNat8: (vec vec vec nat8) -> (vec vec vec nat8) query; - listOfNull: (vec vec vec null) -> (vec vec vec null) query; - listOfOptionString: (vec vec vec opt text) -> (vec vec vec opt text) query; - listOfPrincipal: (vec vec vec principal) -> (vec vec vec principal) query; - listOfRecord: (vec vec vec record {age:nat8; name:text}) -> (vec vec vec record {age:nat8; name:text}) query; - listOfReserved: () -> (vec vec vec reserved) query; - listOfString: (vec vec vec text) -> (vec vec vec text) query; - listOfStringFour: (vec vec vec vec text) -> (vec vec vec vec text) query; - listOfStringOne: (vec text) -> (vec text) query; - listOfStringTwo: (vec vec text) -> (vec vec text) query; - listOfVariant: (vec vec vec variant {gas; solid; liquid}) -> (vec vec vec variant {gas; solid; liquid}) query; -} diff --git a/examples/management_canister/dfx.json b/examples/management_canister/dfx.json index 2626abbfd6..0b08550635 100644 --- a/examples/management_canister/dfx.json +++ b/examples/management_canister/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "management_canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle management_canister", - "wasm": ".azle/management_canister/management_canister.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/management_canister", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/management_canister/src/index.did b/examples/management_canister/src/index.did deleted file mode 100644 index 9ebdc39052..0000000000 --- a/examples/management_canister/src/index.did +++ /dev/null @@ -1,16 +0,0 @@ -service: () -> { - executeCreateCanister: () -> (record {canister_id:principal}); - executeDeleteCanister: (principal) -> (bool); - executeDepositCycles: (principal) -> (bool); - executeInstallCode: (principal, vec nat8) -> (bool); - executeStartCanister: (principal) -> (bool); - executeStopCanister: (principal) -> (bool); - executeUninstallCode: (principal) -> (bool); - executeUpdateSettings: (principal) -> (bool); - getCanisterInfo: (record {canister_id:principal; num_requested_changes:opt nat64}) -> (record {controllers:vec principal; module_hash:opt vec nat8; recent_changes:vec record {timestamp_nanos:nat64; canister_version:nat64; origin:variant {from_user:record {user_id:principal}; from_canister:record {canister_version:opt nat64; canister_id:principal}}; details:variant {creation:record {controllers:vec principal}; code_deployment:record {mode:variant {reinstall; upgrade; install}; module_hash:vec nat8}; controllers_change:record {controllers:vec principal}; code_uninstall}}; total_num_changes:nat64}); - getCanisterStatus: (record {canister_id:principal}) -> (record {status:variant {stopped; stopping; running}; memory_size:nat; cycles:nat; settings:record {freezing_threshold:nat; controllers:vec principal; reserved_cycles_limit:nat; memory_allocation:nat; compute_allocation:nat}; idle_cycles_burned_per_day:nat; module_hash:opt vec nat8; reserved_cycles:nat}); - getCreatedCanisterId: () -> (principal) query; - getRawRand: () -> (vec nat8); - provisionalCreateCanisterWithCycles: () -> (record {canister_id:principal}); - provisionalTopUpCanister: (principal, nat) -> (bool); -} diff --git a/examples/manual_reply/dfx.json b/examples/manual_reply/dfx.json index 664d91e191..2e1068040b 100644 --- a/examples/manual_reply/dfx.json +++ b/examples/manual_reply/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "manual_reply": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle manual_reply", - "wasm": ".azle/manual_reply/manual_reply.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/manual_reply", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/manual_reply/src/index.did b/examples/manual_reply/src/index.did deleted file mode 100644 index 18aebc0cb0..0000000000 --- a/examples/manual_reply/src/index.did +++ /dev/null @@ -1,25 +0,0 @@ -service: () -> { - manualQuery: (text) -> (text) query; - manualUpdate: (text) -> (text); - queryBlob: () -> (vec nat8) query; - queryFloat32: () -> (float32) query; - queryInt8: () -> (int8) query; - queryNat: () -> (nat) query; - queryNull: () -> (null) query; - queryRecord: () -> (record {id:text; orbitals:vec record {electrons:nat8; layer:nat8}; state:variant {Gas:variant {Elemental; Mixed; Toxic}; Solid:record {element:text}; Liquid}}) query; - queryReserved: () -> (reserved) query; - queryString: () -> (text) query; - queryVariant: () -> (variant {Elemental; Mixed; Toxic}) query; - queryVoid: () -> () query; - replyRaw: () -> (record {"int":int; "bool":bool; "text":text; myBlob:vec nat8; myVariant:variant {Large; Small; Medium}}); - updateBlob: () -> (vec nat8); - updateFloat32: () -> (float32); - updateInt8: () -> (int8); - updateNat: () -> (nat); - updateNull: () -> (null); - updateRecord: () -> (record {id:text; orbitals:vec record {electrons:nat8; layer:nat8}; state:variant {Gas:variant {Elemental; Mixed; Toxic}; Solid:record {element:text}; Liquid}}); - updateReserved: () -> (reserved); - updateString: () -> (text); - updateVariant: () -> (variant {Elemental; Mixed; Toxic}); - updateVoid: () -> (); -} diff --git a/examples/motoko_examples/calc/dfx.json b/examples/motoko_examples/calc/dfx.json index 1c2210a8ec..ff866b88f0 100644 --- a/examples/motoko_examples/calc/dfx.json +++ b/examples/motoko_examples/calc/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "calc": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle calc", - "wasm": ".azle/calc/calc.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/calc", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/calc/src/index.did b/examples/motoko_examples/calc/src/index.did deleted file mode 100644 index 497f4321ba..0000000000 --- a/examples/motoko_examples/calc/src/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - add: (int) -> (int); - clearall: () -> (); - div: (int) -> (opt int); - mul: (int) -> (int); - sub: (int) -> (int); -} diff --git a/examples/motoko_examples/counter/dfx.json b/examples/motoko_examples/counter/dfx.json index 22ef02aecc..4374e8ecf6 100644 --- a/examples/motoko_examples/counter/dfx.json +++ b/examples/motoko_examples/counter/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "counter": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle counter", - "wasm": ".azle/counter/counter.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/counter", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/counter/src/index.did b/examples/motoko_examples/counter/src/index.did deleted file mode 100644 index a0b3a1ed59..0000000000 --- a/examples/motoko_examples/counter/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - get: () -> (nat) query; - inc: () -> (); - set: (nat) -> (); -} diff --git a/examples/motoko_examples/echo/dfx.json b/examples/motoko_examples/echo/dfx.json index 2cc3915669..8afce46092 100644 --- a/examples/motoko_examples/echo/dfx.json +++ b/examples/motoko_examples/echo/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "echo": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle echo", - "wasm": ".azle/echo/echo.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/echo", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/echo/src/index.did b/examples/motoko_examples/echo/src/index.did deleted file mode 100644 index 99f2ac5fdc..0000000000 --- a/examples/motoko_examples/echo/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - say: (text) -> (text) query; -} diff --git a/examples/motoko_examples/factorial/dfx.json b/examples/motoko_examples/factorial/dfx.json index 07595b0098..2651611c1d 100644 --- a/examples/motoko_examples/factorial/dfx.json +++ b/examples/motoko_examples/factorial/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "factorial": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle factorial", - "wasm": ".azle/factorial/factorial.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/factorial", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/factorial/src/index.did b/examples/motoko_examples/factorial/src/index.did deleted file mode 100644 index 64dfc3d216..0000000000 --- a/examples/motoko_examples/factorial/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - fac: (nat) -> (nat); -} diff --git a/examples/motoko_examples/hello-world/dfx.json b/examples/motoko_examples/hello-world/dfx.json index dfe8b6cab7..065b304858 100644 --- a/examples/motoko_examples/hello-world/dfx.json +++ b/examples/motoko_examples/hello-world/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "hello_world": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle hello_world", - "wasm": ".azle/hello_world/hello_world.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/hello_world", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/hello-world/src/index.did b/examples/motoko_examples/hello-world/src/index.did deleted file mode 100644 index 458334c84e..0000000000 --- a/examples/motoko_examples/hello-world/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - main: () -> () query; -} diff --git a/examples/motoko_examples/hello/dfx.json b/examples/motoko_examples/hello/dfx.json index 92822afe87..72a35fa07b 100644 --- a/examples/motoko_examples/hello/dfx.json +++ b/examples/motoko_examples/hello/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "hello": { - "type": "custom", + "type": "azle", "main": "src/hello/index.ts", - "candid": "src/hello/index.did", - "build": "npx azle hello", - "wasm": ".azle/hello/hello.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "dfx_generated/hello", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/hello/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "hello_assets": { "type": "assets", diff --git a/examples/motoko_examples/hello/src/hello/index.did b/examples/motoko_examples/hello/src/hello/index.did deleted file mode 100644 index b0909eff8d..0000000000 --- a/examples/motoko_examples/hello/src/hello/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - greet: (text) -> (text) query; -} diff --git a/examples/motoko_examples/http_counter/dfx.json b/examples/motoko_examples/http_counter/dfx.json index d6ae71e51d..db57989ba8 100644 --- a/examples/motoko_examples/http_counter/dfx.json +++ b/examples/motoko_examples/http_counter/dfx.json @@ -1,22 +1,10 @@ { "canisters": { "http_counter": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle http_counter", - "wasm": ".azle/http_counter/http_counter.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "candid_gen": "automatic", + "gzip": true } } } diff --git a/examples/motoko_examples/minimal-counter-dapp/dfx.json b/examples/motoko_examples/minimal-counter-dapp/dfx.json index add9a707a8..8df388e823 100644 --- a/examples/motoko_examples/minimal-counter-dapp/dfx.json +++ b/examples/motoko_examples/minimal-counter-dapp/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "minimal_dapp": { - "type": "custom", + "type": "azle", "main": "src/minimal_dapp/index.ts", - "candid": "src/minimal_dapp/index.did", - "build": "npx azle minimal_dapp", - "wasm": ".azle/minimal_dapp/minimal_dapp.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "src/declarations/minimal_dapp", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/minimal_dapp/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "minimal_dapp_assets": { "type": "assets", diff --git a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.did b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.did deleted file mode 100644 index 96bd0bbf84..0000000000 --- a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - count: () -> (nat); - getCount: () -> (nat) query; - reset: () -> (nat); -} diff --git a/examples/motoko_examples/persistent-storage/dfx.json b/examples/motoko_examples/persistent-storage/dfx.json index 2148bf7a8d..84eb5ea4a4 100644 --- a/examples/motoko_examples/persistent-storage/dfx.json +++ b/examples/motoko_examples/persistent-storage/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "persistent_storage": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle persistent_storage", - "wasm": ".azle/persistent_storage/persistent_storage.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/persistent_storage", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/persistent-storage/src/index.did b/examples/motoko_examples/persistent-storage/src/index.did deleted file mode 100644 index e63226e8ed..0000000000 --- a/examples/motoko_examples/persistent-storage/src/index.did +++ /dev/null @@ -1,6 +0,0 @@ -service: () -> { - get: () -> (nat) query; - getRedeployed: () -> (bool) query; - increment: () -> (nat); - reset: () -> (nat); -} diff --git a/examples/motoko_examples/phone-book/dfx.json b/examples/motoko_examples/phone-book/dfx.json index 721bf6fc8c..466acb44cc 100644 --- a/examples/motoko_examples/phone-book/dfx.json +++ b/examples/motoko_examples/phone-book/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "phone_book": { - "type": "custom", + "type": "azle", "main": "src/phone_book/index.ts", - "candid": "src/phone_book/index.did", - "build": "npx azle phone_book", - "wasm": ".azle/phone_book/phone_book.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "src/declarations/phone_book", "node_compatibility": false - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/phone_book/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "www": { "type": "assets", diff --git a/examples/motoko_examples/phone-book/src/phone_book/index.did b/examples/motoko_examples/phone-book/src/phone_book/index.did deleted file mode 100644 index 2cf23ca350..0000000000 --- a/examples/motoko_examples/phone-book/src/phone_book/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - insert: (text, record {desc:text; phone:text}) -> (); - lookup: (text) -> (opt record {desc:text; phone:text}) query; -} diff --git a/examples/motoko_examples/quicksort/dfx.json b/examples/motoko_examples/quicksort/dfx.json index 18672c6e57..5575753824 100644 --- a/examples/motoko_examples/quicksort/dfx.json +++ b/examples/motoko_examples/quicksort/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "quicksort": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle quicksort", - "wasm": ".azle/quicksort/quicksort.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/quicksort", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/quicksort/src/index.did b/examples/motoko_examples/quicksort/src/index.did deleted file mode 100644 index 0bf0d725ac..0000000000 --- a/examples/motoko_examples/quicksort/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - sort: (vec int) -> (vec int) query; -} diff --git a/examples/motoko_examples/simple-to-do/dfx.json b/examples/motoko_examples/simple-to-do/dfx.json index e3f2c6b8aa..95914c1281 100644 --- a/examples/motoko_examples/simple-to-do/dfx.json +++ b/examples/motoko_examples/simple-to-do/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "simple_to_do": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle simple_to_do", - "wasm": ".azle/simple_to_do/simple_to_do.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/simple_to_do", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/simple-to-do/src/index.did b/examples/motoko_examples/simple-to-do/src/index.did deleted file mode 100644 index a6c08c685d..0000000000 --- a/examples/motoko_examples/simple-to-do/src/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - addTodo: (text) -> (nat); - clearCompleted: () -> (); - completeTodo: (nat) -> (); - getTodos: () -> (vec record {completed:bool; description:text}) query; - showTodos: () -> (text) query; -} diff --git a/examples/motoko_examples/superheroes/dfx.json b/examples/motoko_examples/superheroes/dfx.json index b566665a0c..15243d8669 100644 --- a/examples/motoko_examples/superheroes/dfx.json +++ b/examples/motoko_examples/superheroes/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "superheroes": { - "type": "custom", + "type": "azle", "main": "src/superheroes/index.ts", - "candid": "src/superheroes/index.did", - "build": "npx azle superheroes", - "wasm": ".azle/superheroes/superheroes.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "src/declarations", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/superheroes/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "www": { "type": "assets", diff --git a/examples/motoko_examples/superheroes/src/superheroes/index.did b/examples/motoko_examples/superheroes/src/superheroes/index.did deleted file mode 100644 index b0ff080de3..0000000000 --- a/examples/motoko_examples/superheroes/src/superheroes/index.did +++ /dev/null @@ -1,9 +0,0 @@ -type rec_0 = record {text; opt rec_0}; -type rec_1 = record {text; opt rec_1}; -type rec_2 = record {text; opt rec_2}; -service: () -> { - create: (record {superpowers:opt rec_0; name:text}) -> (nat32); - deleteHero: (nat32) -> (bool); - read: (nat32) -> (opt record {superpowers:opt rec_1; name:text}) query; - update: (nat32, record {superpowers:opt rec_2; name:text}) -> (bool); -} diff --git a/examples/motoko_examples/threshold_ecdsa/dfx.json b/examples/motoko_examples/threshold_ecdsa/dfx.json index 77e932251b..3ea1ddd26d 100644 --- a/examples/motoko_examples/threshold_ecdsa/dfx.json +++ b/examples/motoko_examples/threshold_ecdsa/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "threshold_ecdsa": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle threshold_ecdsa", - "wasm": ".azle/threshold_ecdsa/threshold_ecdsa.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/threshold_ecdsa", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/threshold_ecdsa/src/index.did b/examples/motoko_examples/threshold_ecdsa/src/index.did deleted file mode 100644 index 74f57782b3..0000000000 --- a/examples/motoko_examples/threshold_ecdsa/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - publicKey: () -> (record {publicKey:vec nat8}); - sign: (vec nat8) -> (record {signature:vec nat8}); -} diff --git a/examples/motoko_examples/whoami/dfx.json b/examples/motoko_examples/whoami/dfx.json index a59d91e5f0..a2ef795562 100644 --- a/examples/motoko_examples/whoami/dfx.json +++ b/examples/motoko_examples/whoami/dfx.json @@ -1,28 +1,15 @@ { "canisters": { "whoami": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle whoami", - "wasm": ".azle/whoami/whoami.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], + "assets": [["src/index.did", "src/whoami.did"]], "declarations": { "output": "test/dfx_generated/whoami", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "assets": [["src/index.did", "src/whoami.did"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/motoko_examples/whoami/src/index.did b/examples/motoko_examples/whoami/src/index.did deleted file mode 100644 index 29556c8d4c..0000000000 --- a/examples/motoko_examples/whoami/src/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: (principal) -> { - argument: () -> (principal) query; - id: () -> (principal); - idQuick: () -> (principal) query; - installer: () -> (principal) query; - whoami: () -> (principal); -} diff --git a/examples/notify_raw/dfx.json b/examples/notify_raw/dfx.json index 57835877ec..c82ccc605e 100644 --- a/examples/notify_raw/dfx.json +++ b/examples/notify_raw/dfx.json @@ -1,49 +1,23 @@ { "canisters": { "canister1": { - "type": "custom", + "type": "azle", "main": "src/canister1/index.ts", - "candid": "src/canister1/index.did", - "build": "npx azle canister1", - "wasm": ".azle/canister1/canister1.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["CANISTER2_PRINCIPAL"], "declarations": { "output": "test/dfx_generated/canister1", "node_compatibility": true - }, - "env": ["CANISTER2_PRINCIPAL"], - "metadata": [ - { - "name": "candid:service", - "path": "src/canister1/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "canister2": { - "type": "custom", + "type": "azle", "main": "src/canister2/index.ts", - "candid": "src/canister2/index.did", - "build": "npx azle canister2", - "wasm": ".azle/canister2/canister2.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister2/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/notify_raw/src/canister1/index.did b/examples/notify_raw/src/canister1/index.did deleted file mode 100644 index 3413cdec4f..0000000000 --- a/examples/notify_raw/src/canister1/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - sendNotification: () -> (); -} diff --git a/examples/notify_raw/src/canister2/index.did b/examples/notify_raw/src/canister2/index.did deleted file mode 100644 index 7529697cb3..0000000000 --- a/examples/notify_raw/src/canister2/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - getNotified: () -> (bool) query; - receiveNotification: () -> (); -} diff --git a/examples/null_example/dfx.json b/examples/null_example/dfx.json index 1c125a37ad..6c7a8def51 100644 --- a/examples/null_example/dfx.json +++ b/examples/null_example/dfx.json @@ -3,24 +3,11 @@ "null_example": { "type": "custom", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle null_example", - "wasm": ".azle/null_example/null_example.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/null_example", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/null_example/src/index.did b/examples/null_example/src/index.did deleted file mode 100644 index 9f8d2f2ade..0000000000 --- a/examples/null_example/src/index.did +++ /dev/null @@ -1,10 +0,0 @@ -service: () -> { - getLargeNullRecord: () -> (record {thirdItem:null; secondItem:null; firstItem:null}) query; - getPartiallyNullRecord: () -> (record {thirdItem:int; secondItem:null; firstItem:int}) query; - getSmallNullRecord: () -> (record {secondItem:null; firstItem:null}) query; - nullFunction: (null) -> (null) query; - setLargeNullRecord: (record {thirdItem:null; secondItem:null; firstItem:null}) -> (record {thirdItem:null; secondItem:null; firstItem:null}); - setPartiallyNullRecord: (record {thirdItem:int; secondItem:null; firstItem:int}) -> (record {thirdItem:int; secondItem:null; firstItem:int}); - setSmallNullRecord: (record {secondItem:null; firstItem:null}) -> (record {secondItem:null; firstItem:null}); - voidIsNotNull: () -> () query; -} diff --git a/examples/optional_types/dfx.json b/examples/optional_types/dfx.json index f055eb457a..2708ea54da 100644 --- a/examples/optional_types/dfx.json +++ b/examples/optional_types/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "optional_types": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle optional_types", - "wasm": ".azle/optional_types/optional_types.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/optional_types", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/optional_types/src/index.did b/examples/optional_types/src/index.did deleted file mode 100644 index 985ba24827..0000000000 --- a/examples/optional_types/src/index.did +++ /dev/null @@ -1,9 +0,0 @@ -service: () -> { - getElement: (opt opt record {id:text}) -> (opt opt record {id:text}) query; - getHead: () -> (opt record {elements:vec record {id:text}}) query; - getHeadWithElements: () -> (opt record {elements:vec record {id:text}}) query; - getHtml: () -> (record {head:opt record {elements:vec record {id:text}}}) query; - getNull: () -> (null) query; - getOptNull: () -> (opt text) query; - stringToBoolean: (opt text) -> (bool) query; -} diff --git a/examples/outgoing_http_requests/dfx.json b/examples/outgoing_http_requests/dfx.json index 98cd0ac2cd..0b8776dd0b 100644 --- a/examples/outgoing_http_requests/dfx.json +++ b/examples/outgoing_http_requests/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "outgoing_http_requests": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle outgoing_http_requests", - "wasm": ".azle/outgoing_http_requests/outgoing_http_requests.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/outgoing_http_requests", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/outgoing_http_requests/src/index.did b/examples/outgoing_http_requests/src/index.did deleted file mode 100644 index 1a14f55853..0000000000 --- a/examples/outgoing_http_requests/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - xkcd: () -> (text); - xkcdRaw: () -> (record {status:nat; body:vec nat8; headers:vec record {value:text; name:text}}); - xkcdTransform: (record {context:vec nat8; response:record {status:nat; body:vec nat8; headers:vec record {value:text; name:text}}}) -> (record {status:nat; body:vec nat8; headers:vec record {value:text; name:text}}) query; -} diff --git a/examples/pre_and_post_upgrade/dfx.json b/examples/pre_and_post_upgrade/dfx.json index 07107f634e..d5395178cd 100644 --- a/examples/pre_and_post_upgrade/dfx.json +++ b/examples/pre_and_post_upgrade/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "pre_and_post_upgrade": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle pre_and_post_upgrade", - "wasm": ".azle/pre_and_post_upgrade/pre_and_post_upgrade.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/pre_and_post_upgrade", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/pre_and_post_upgrade/src/index.did b/examples/pre_and_post_upgrade/src/index.did deleted file mode 100644 index ad46fc2bfc..0000000000 --- a/examples/pre_and_post_upgrade/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - getEntries: () -> (vec record {key:text; value:nat64}) query; - setEntry: (record {key:text; value:nat64}) -> (); -} diff --git a/examples/primitive_types/dfx.json b/examples/primitive_types/dfx.json index e0a9b220f7..452d4bf0d7 100644 --- a/examples/primitive_types/dfx.json +++ b/examples/primitive_types/dfx.json @@ -3,24 +3,11 @@ "primitive_types": { "type": "custom", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle primitive_types --native-compilation", - "wasm": ".azle/primitive_types/primitive_types.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/primitive_types", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/primitive_types/src/index.did b/examples/primitive_types/src/index.did deleted file mode 100644 index a08b2ea1ef..0000000000 --- a/examples/primitive_types/src/index.did +++ /dev/null @@ -1,42 +0,0 @@ -service: () -> { - getBool: () -> (bool) query; - getEmpty: () -> (empty) query; - getFloat32: () -> (float32) query; - getFloat64: () -> (float64) query; - getInt: () -> (int) query; - getInt16: () -> (int16) query; - getInt32: () -> (int32) query; - getInt64: () -> (int64) query; - getInt8: () -> (int8) query; - getNat: () -> (nat) query; - getNat16: () -> (nat16) query; - getNat32: () -> (nat32) query; - getNat64: () -> (nat64) query; - getNat8: () -> (nat8) query; - getNull: () -> (null) query; - getNumber: () -> (float64) query; - getPrincipal: () -> (principal) query; - getReserved: () -> (reserved) query; - getString: () -> (text) query; - getText: () -> (text) query; - printBool: (bool) -> (bool) query; - printEmpty: (empty) -> (empty) query; - printFloat32: (float32) -> (float32) query; - printFloat64: (float64) -> (float64) query; - printInt: (int) -> (int) query; - printInt16: (int16) -> (int16) query; - printInt32: (int32) -> (int32) query; - printInt64: (int64) -> (int64) query; - printInt8: (int8) -> (int8) query; - printNat: (nat) -> (nat) query; - printNat16: (nat16) -> (nat16) query; - printNat32: (nat32) -> (nat32) query; - printNat64: (nat64) -> (nat64) query; - printNat8: (nat8) -> (nat8) query; - printNull: (null) -> (null) query; - printNumber: (float64) -> (float64) query; - printPrincipal: (principal) -> (principal) query; - printReserved: (reserved) -> (reserved) query; - printString: (text) -> (text) query; - printText: (text) -> (text) query; -} diff --git a/examples/principal/dfx.json b/examples/principal/dfx.json index 61f15a49f4..3385a1becd 100644 --- a/examples/principal/dfx.json +++ b/examples/principal/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "principal": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle principal", - "wasm": ".azle/principal/principal.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/principal", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/principal/src/index.did b/examples/principal/src/index.did deleted file mode 100644 index f1e8e62ae9..0000000000 --- a/examples/principal/src/index.did +++ /dev/null @@ -1,13 +0,0 @@ -service: () -> { - principalFromBlob: (vec nat8) -> (principal) query; - principalFromHex: (text) -> (principal) query; - principalFromText: (text) -> (principal) query; - principalInRecord: () -> (record {id:principal; username:text}) query; - principalInVariant: () -> (variant {Online; WaitingOn:principal; Offline}) query; - principalParam: (principal) -> (principal) query; - principalReturnType: () -> (principal) query; - principalSelfAuthenticating: (vec nat8) -> (principal) query; - principalToBlob: (principal) -> (vec nat8) query; - principalToHex: (principal) -> (text) query; - principalToText: (principal) -> (text) query; -} diff --git a/examples/query/dfx.json b/examples/query/dfx.json index 5b3ede95e4..89885f9cb1 100644 --- a/examples/query/dfx.json +++ b/examples/query/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "query": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle query", - "wasm": ".azle/query/query.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/query", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/query/src/index.did b/examples/query/src/index.did deleted file mode 100644 index ec7752c946..0000000000 --- a/examples/query/src/index.did +++ /dev/null @@ -1,3 +0,0 @@ -service: () -> { - simpleQuery: () -> (text) query; -} diff --git a/examples/randomness/dfx.json b/examples/randomness/dfx.json index 00b9464195..fcd774999c 100644 --- a/examples/randomness/dfx.json +++ b/examples/randomness/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "randomness": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle randomness", - "wasm": ".azle/randomness/randomness.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/randomness", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/randomness/src/index.did b/examples/randomness/src/index.did deleted file mode 100644 index 85dd1aa82a..0000000000 --- a/examples/randomness/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - getRedeployed: () -> (bool) query; - randomNumber: () -> (float64); -} diff --git a/examples/recursion/dfx.json b/examples/recursion/dfx.json index 86b7c2b234..cb6adf4cf2 100644 --- a/examples/recursion/dfx.json +++ b/examples/recursion/dfx.json @@ -1,16 +1,9 @@ { "canisters": { "recursion": { - "type": "custom", + "type": "azle", "main": "src/recursion/index.ts", - "candid": "src/recursion/index.did", - "build": "npx azle recursion", - "wasm": ".azle/recursion/recursion.wasm", - "gzip": true, - "declarations": { - "output": "test/dfx_generated/recursion", - "node_compatibility": true - }, + "candid_gen": "automatic", "env": ["MY_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ [ @@ -18,38 +11,19 @@ "src/recursive_canister.did" ] ], - "metadata": [ - { - "name": "candid:service", - "path": "src/recursion/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "declarations": { + "output": "test/dfx_generated/recursion", + "node_compatibility": true + } }, "recursive_canister": { - "type": "custom", + "type": "azle", "main": "src/recursive_canister/index.ts", - "candid": "src/recursive_canister/index.did", - "build": "npx azle recursive_canister", - "wasm": ".azle/recursive_canister/recursive_canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/recursive_canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/recursive_canister/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/recursion/src/recursion/index.did b/examples/recursion/src/recursion/index.did deleted file mode 100644 index 49134618d7..0000000000 --- a/examples/recursion/src/recursion/index.did +++ /dev/null @@ -1,77 +0,0 @@ -type rec_37 = func (rec_37) -> (rec_37) query; -type rec_38 = func (rec_38) -> (rec_38) query; -type rec_39 = func (rec_39) -> (rec_39) query; -type rec_10 = opt rec_10; -type rec_11 = opt rec_11; -type rec_12 = opt record {rec_12; rec_12}; -type rec_13 = opt record {rec_13; rec_13}; -type rec_8 = opt variant {Leaf:int8; Branch:rec_8}; -type rec_9 = opt variant {Leaf:int8; Branch:rec_9}; -type rec_14 = opt vec rec_14; -type rec_15 = opt vec rec_15; -type rec_16 = record {myOpt:opt rec_16}; -type rec_17 = record {myOpt:opt rec_17}; -type rec_28 = record {myOpt:opt rec_28}; -type rec_20 = record {myVar:variant {num:int8; varRec:rec_20}}; -type rec_21 = record {myVar:variant {num:int8; varRec:rec_21}}; -type rec_30 = record {myVar:variant {num:int8; varRec:rec_30}}; -type rec_18 = record {myVecRecords:vec rec_18}; -type rec_19 = record {myVecRecords:vec rec_19}; -type rec_29 = record {myVecRecords:vec rec_29}; -type rec_42 = service {getMessage: () -> (text) query; myQuery: (rec_42) -> (rec_42) query;}; -type rec_43 = service {getMessage: () -> (text) query; myQuery: (rec_43) -> (rec_43) query;}; -type rec_45 = service {getMessage: () -> (text) query; myQuery: (rec_45) -> (rec_45) query;}; -type rec_46 = service {getMessage: () -> (text) query; myQuery: (rec_46) -> (rec_46) query;}; -type rec_44 = service {getMessage: () -> (text) query; myQuery: (rec_44) -> (rec_44) query;}; -type rec_40 = service {myQuery: (rec_40) -> (rec_40) query;}; -type rec_41 = service {myQuery: (rec_41) -> (rec_41) query;}; -type rec_24 = record {opt rec_24; opt rec_24}; -type rec_25 = record {opt rec_25; opt rec_25}; -type rec_32 = record {opt rec_32; opt rec_32}; -type rec_34 = record {variant {num:int8; varTuple:rec_34}; variant {num:int8; varTuple:rec_34}}; -type rec_35 = record {variant {num:int8; varTuple:rec_35}; variant {num:int8; varTuple:rec_35}}; -type rec_36 = record {variant {num:int8; varTuple:rec_36}; variant {num:int8; varTuple:rec_36}}; -type rec_26 = record {vec rec_26; vec rec_26}; -type rec_27 = record {vec rec_27; vec rec_27}; -type rec_33 = record {vec rec_33; vec rec_33}; -type rec_22 = variant {num:int8; recVariant:rec_22}; -type rec_23 = variant {num:int8; recVariant:rec_23}; -type rec_31 = variant {num:int8; recVariant:rec_31}; -type rec_2 = vec opt rec_2; -type rec_3 = vec opt rec_3; -type rec_4 = vec record {rec_4; rec_4}; -type rec_5 = vec record {rec_5; rec_5}; -type rec_0 = vec variant {Leaf:int8; Branch:rec_0}; -type rec_1 = vec variant {Leaf:int8; Branch:rec_1}; -type rec_6 = vec rec_6; -type rec_7 = vec rec_7; -service: () -> { - testRecFunc: (rec_37) -> (rec_38) query; - testRecFuncReturn: () -> (rec_39) query; - testRecOptWithOpt: (rec_10) -> (rec_11) query; - testRecOptWithTuple: (rec_12) -> (rec_13) query; - testRecOptWithVariant: (rec_8) -> (rec_9) query; - testRecOptWithVec: (rec_14) -> (rec_15) query; - testRecRecordWithOpt: (rec_16) -> (rec_17) query; - testRecRecordWithOptReturn: () -> (rec_28) query; - testRecRecordWithVariant: (rec_20) -> (rec_21) query; - testRecRecordWithVariantReturn: () -> (rec_30) query; - testRecRecordWithVec: (rec_18) -> (rec_19) query; - testRecRecordWithVecReturn: () -> (rec_29) query; - testRecService: (rec_42) -> (rec_43) query; - testRecServiceCall: (rec_45) -> (rec_46); - testRecServiceReturn: () -> (rec_44) query; - testRecServiceSimple: (rec_40) -> (rec_41) query; - testRecTupleWithOpt: (rec_24) -> (rec_25) query; - testRecTupleWithOptReturn: () -> (rec_32) query; - testRecTupleWithVariant: (rec_34) -> (rec_35) query; - testRecTupleWithVariantReturn: () -> (rec_36) query; - testRecTupleWithVec: (rec_26) -> (rec_27) query; - testRecTupleWithVecReturn: () -> (rec_33) query; - testRecVariant: (rec_22) -> (rec_23) query; - testRecVariantReturn: () -> (rec_31) query; - testRecVecWithOpt: (rec_2) -> (rec_3) query; - testRecVecWithTuple: (rec_4) -> (rec_5) query; - testRecVecWithVariant: (rec_0) -> (rec_1) query; - testRecVecWithVec: (rec_6) -> (rec_7) query; -} diff --git a/examples/recursion/src/recursive_canister/index.did b/examples/recursion/src/recursive_canister/index.did deleted file mode 100644 index 7c6f8c66e8..0000000000 --- a/examples/recursion/src/recursive_canister/index.did +++ /dev/null @@ -1,6 +0,0 @@ -type rec_0 = service {getMessage: () -> (text) query; myQuery: (rec_0) -> (rec_0) query;}; -type rec_1 = service {getMessage: () -> (text) query; myQuery: (rec_1) -> (rec_1) query;}; -service: (text) -> { - getMessage: () -> (text) query; - myQuery: (rec_0) -> (rec_1) query; -} diff --git a/examples/rejections/dfx.json b/examples/rejections/dfx.json index 49c5633447..5068ffca94 100644 --- a/examples/rejections/dfx.json +++ b/examples/rejections/dfx.json @@ -1,53 +1,27 @@ { "canisters": { "rejections": { - "type": "custom", + "type": "azle", "main": "src/rejections/index.ts", - "candid": "src/rejections/index.did", - "build": "npx azle rejections", - "wasm": ".azle/rejections/rejections.wasm", - "gzip": true, - "declarations": { - "output": "test/dfx_generated/rejections", - "node_compatibility": true - }, + "candid_gen": "automatic", "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ ["src/some_canister/index.did", "src/some_canister.did"], ["src/nonexistent.did", "src/nonexistent.did"] ], - "metadata": [ - { - "name": "candid:service", - "path": "src/rejections/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "declarations": { + "output": "test/dfx_generated/rejections", + "node_compatibility": true + } }, "some_canister": { - "type": "custom", + "type": "azle", "main": "src/some_canister/index.ts", - "candid": "src/some_canister/index.did", - "build": "npx azle some_canister", - "wasm": ".azle/some_canister/some_canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/some_canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/some_canister/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/rejections/src/rejections/index.did b/examples/rejections/src/rejections/index.did deleted file mode 100644 index a0f63c08ae..0000000000 --- a/examples/rejections/src/rejections/index.did +++ /dev/null @@ -1,7 +0,0 @@ -service: () -> { - getRejectionCodeCanisterError: () -> (variant {NoError; CanisterError; SysTransient; DestinationInvalid; Unknown; SysFatal; CanisterReject}); - getRejectionCodeCanisterReject: () -> (variant {NoError; CanisterError; SysTransient; DestinationInvalid; Unknown; SysFatal; CanisterReject}); - getRejectionCodeDestinationInvalid: () -> (variant {NoError; CanisterError; SysTransient; DestinationInvalid; Unknown; SysFatal; CanisterReject}); - getRejectionCodeNoError: () -> (variant {NoError; CanisterError; SysTransient; DestinationInvalid; Unknown; SysFatal; CanisterReject}); - getRejectionMessage: (text) -> (text); -} diff --git a/examples/rejections/src/some_canister/index.did b/examples/rejections/src/some_canister/index.did deleted file mode 100644 index 4cef085492..0000000000 --- a/examples/rejections/src/some_canister/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - accept: () -> (bool) query; - error: () -> (empty) query; - reject: (text) -> (empty) query; -} diff --git a/examples/robust_imports/dfx.json b/examples/robust_imports/dfx.json index d3140456cc..904f2aa063 100644 --- a/examples/robust_imports/dfx.json +++ b/examples/robust_imports/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "robust_imports": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle robust_imports", - "wasm": ".azle/robust_imports/robust_imports.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "dfx_generated/robust_imports", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/robust_imports/src/index.did b/examples/robust_imports/src/index.did deleted file mode 100644 index d8485d720b..0000000000 --- a/examples/robust_imports/src/index.did +++ /dev/null @@ -1,47 +0,0 @@ -service: () -> { - addSigFigs: (float32) -> (float64) query; - checkCanister: (service {deliver: () -> (text); is_delivered: () -> (bool) query;}) -> (service {deliver: () -> (text); is_delivered: () -> (bool) query;}) query; - checkCanisterAlias: (service {testQuery: () -> (text) query;}) -> (service {testQuery: () -> (text) query;}) query; - checkPrimAliases: (bool, null, text, int, float64) -> () query; - checkWatermelonForSeeds: (bool, variant {Seeds; Seedless}) -> () query; - compareApplesToOranges: (record {"int":int; starInt:int; "int8":int8; "int16":int16; "int32":int32; "int64":int64}, record {"nat":nat; starNat:nat; "nat8":nat8; "nat16":nat16; "nat32":nat32; "nat64":nat64}) -> (bool) query; - compareStars: (record {star:bool}, record {star:bool}) -> (variant {Ok:bool; Err:text}) query; - deepEmptyAlias: () -> (empty) query; - dirtyIlama: () -> (); - getDeepBlob: (vec nat8) -> (vec nat8) query; - getManagementPeach: () -> (principal) query; - getManualAlias: () -> (float64) query; - getMyRecord: () -> (record {id:nat; list:vec nat16; name:opt text; tups:record {text; float64}; description:variant {bad; good; ugly}; depth:record {depth:nat8}}) query; - getMyRecordAlias: () -> (record {id:nat; list:vec nat16; name:opt text; tups:record {text; float64}; description:variant {bad; good; ugly}; depth:record {depth:nat8}}) query; - getNumberAliases: () -> (record {fifth:int; first:int; tenth:nat; third:float64; eighth:int; seventh:float64; second:int; sixth:float32; ninth:int8; eleventh:nat8; twelfth:float64; fourth:int}) query; - getReservedAlias: () -> (reserved) query; - getStable: (nat16) -> (opt text) query; - getSuperAlias: () -> (record {id:nat; list:vec nat16; name:opt text; tups:record {text; float64}; description:variant {bad; good; ugly}; depth:record {depth:nat8}}) query; - handleFarkleberries: (func (text) -> () oneway, func (text) -> (text) query, func (text) -> (text)) -> (record {func (text) -> (text); func (text) -> () oneway; func (text) -> (text) query}) query; - helloAzleTextAlias: () -> (text) query; - helloDeepTextAlias: () -> (text) query; - helloMixedTextAlias: () -> (text) query; - helloStirredTextAlias: () -> (text) query; - helloTextAlias: () -> (text) query; - isFruitPrepared: () -> (bool) query; - isMangoTrickyToEat: () -> (bool) query; - makeCavernousRecord: () -> (record {myRecord:record {int1:int16; int2:int16; int3:int16; int4:int8; int5:int8; int6:int8; int7:int8; "int8":int8; int9:int16}; myDeepTuple:record {text}; myCavernousTuple:record {text}; fathomlessRecord:record {mytext:text}; coveredRecord:record {type_name:text; name:text; count:int8; greeting:opt text}; myTuple:record {text}}) query; - myFathomlessVariantToMyCavernousVariant: (variant {MyInt16:int16; MyInt8:int8}) -> (variant {sixteen; eight}) query; - myVariantToMyDeepVariant: (variant {String:text; Thing:int8}) -> (variant {Thing:int8}) query; - passPrincipal: (principal) -> (principal) query; - peelBanana: (vec nat8) -> (nat8) query; - pickElderberry: () -> (empty); - pitOlives: (opt bool) -> (bool) query; - putTheCoconutInTheLime: (int16) -> (vec int16) query; - removeRambutanSkins: () -> (reserved); - returnFathomlessCanister: (service {query1: () -> (bool) query; update1: () -> (text);}) -> (service {query1: () -> (bool) query; update1: () -> (text);}) query; - returnFathomlessVec: () -> (vec int16) query; - returnFuncAlias: (func (text) -> (text) query) -> (func (text) -> (text) query) query; - returnVec: () -> (vec vec nat8) query; - returnWeird: () -> (int64) query; - setStable: (nat16, text) -> (opt text); - simpleAzleQuery: () -> () query; - simpleDeepQuery: () -> () query; - simpleQuery: () -> () query; - typeCheck: (vec opt int16) -> (int16) query; -} diff --git a/examples/run_time_errors/dfx.json b/examples/run_time_errors/dfx.json index 6c0ba7c684..c2bf04efbc 100644 --- a/examples/run_time_errors/dfx.json +++ b/examples/run_time_errors/dfx.json @@ -1,25 +1,13 @@ { "canisters": { "run_time_errors": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle run_time_errors", - "wasm": ".azle/run_time_errors/run_time_errors.wasm.gz", + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/run_time_errors", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/run_time_errors/src/index.did b/examples/run_time_errors/src/index.did deleted file mode 100644 index 046d700cbb..0000000000 --- a/examples/run_time_errors/src/index.did +++ /dev/null @@ -1,114 +0,0 @@ -type rec_1 = record {id:text}; -type rec_0 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_1}; -type rec_3 = record {id:text}; -type rec_2 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_3}; -type rec_5 = record {id:text}; -type rec_4 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_5}; -type rec_7 = record {id:text}; -type rec_6 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_7}; -type rec_9 = record {id:text}; -type rec_8 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_9}; -type rec_12 = record {id:text}; -type rec_11 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_12}; -type rec_10 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_11; Alpha}; -type rec_15 = record {id:text}; -type rec_14 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_15}; -type rec_13 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_14; Alpha}; -type rec_18 = record {id:text}; -type rec_17 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_18}; -type rec_16 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_17; Alpha}; -type rec_21 = record {id:text}; -type rec_20 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_21}; -type rec_19 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_20; Alpha}; -type rec_24 = record {id:text}; -type rec_23 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_24}; -type rec_22 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_23; Alpha}; -type rec_27 = record {id:text}; -type rec_26 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_27}; -type rec_25 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_26; Alpha}; -type rec_30 = record {id:text}; -type rec_29 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_30}; -type rec_28 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_29; Alpha}; -type rec_33 = record {id:text}; -type rec_32 = record {int:int; string:text; boolean:bool; otherUserDefinedRecord:rec_33}; -type rec_31 = variant {Gamma:int; Beta:bool; Zeta:record {int; text}; Delta:text; Epsilon:rec_32; Alpha}; -service: () -> { - returnNonObjectAsInvalidBlob: () -> (vec nat8) query; - returnEmptyObjectAsInvlidBlob: () -> (vec nat8) query; - returnNonArrayValueAsInvalidFunc: () -> (func () -> () query) query; - returnEmptyObjectAsInvalidFunc: () -> (func () -> () query) query; - returnEmptyArrayAsInvalidFunc: () -> (func () -> () query) query; - returnNonPrincipalValueAsInvalidFunc: () -> (func () -> () query) query; - returnEmptyObjectPrincipalAsInvalidFunc: () -> (func () -> () query) query; - returnArrayWithOnlyPrincipalAsInvalidFunc: () -> (func () -> () query) query; - returnNonStringCanisterMethodNameAsInvalidFunc: () -> (func () -> () query) query; - returnInvalidNumber: () -> (float64) query; - returnInvalidInt: () -> (int) query; - returnInvalidInt8: () -> (int8) query; - returnInvalidInt16: () -> (int16) query; - returnInvalidInt32: () -> (int32) query; - returnInvalidInt64: () -> (int64) query; - returnInvalidNat: () -> (nat) query; - returnInvalidNat8: () -> (nat8) query; - returnInvalidNat16: () -> (nat16) query; - returnInvalidNat32: () -> (nat32) query; - returnInvalidNat64: () -> (nat64) query; - returnInvalidFloat32: () -> (float32) query; - returnInvalidFloat64: () -> (float64) query; - returnNonObject: () -> (opt text) query; - returnBothSomeAndNone: () -> (opt text) query; - returnObjectWithNeitherSomeNorNone: () -> (opt text) query; - returnNonNullNone: () -> (opt text) query; - returnInvalidSomeValue: () -> (opt text) query; - returnInvalidBooleanValue: () -> (bool) query; - returnInvalidEmptyValue: () -> (empty) query; - returnInvalidNullValue: () -> (null) query; - returnInvalidStringValue: () -> (text) query; - returnInvalidTextValue: () -> (text) query; - returnInvalidVoidValue: () -> () query; - returnInvalidVoidAliasValue: () -> () query; - returnInvalidNullAliasValue: () -> (null) query; - returnStringAsInvalidPrincipal: () -> (principal) query; - returnEmptyObjectAsInvalidPrincipal: () -> (principal) query; - returnInvalidToTextPropertyAsInvalidPrincipal: () -> (principal) query; - throwInPrincipalToTextMethodAsInvalidPrincipal: () -> (principal) query; - returnInvalidToTextReturnValueAsInvalidPrincipal: () -> (principal) query; - throwWhenCallingPrincipalFromText: () -> (principal) query; - returnInvalidPrincipalFromTooShortOfText: () -> (principal) query; - returnStringAsInvalidUserDefinedRecord: () -> (rec_0) query; - returnEmptyObjectAsInvalidUserDefinedRecord: () -> (rec_2) query; - returnStringAsInvalidVecUserDefinedRecord: () -> (rec_4) query; - returnObjectAsInvalidVecUserDefinedRecord: () -> (vec rec_6) query; - returnArrayWithInvalidUserDefinedRecord: () -> (vec rec_8) query; - returnNonObjectAsInvalidResult: () -> (variant {Ok:text; Err:text}) query; - returnBothOkAndErr: () -> (variant {Ok:text; Err:text}) query; - returnObjectWithNeitherOkNorErr: () -> (variant {Ok:text; Err:text}) query; - returnInvalidOkValue: () -> (variant {Ok:text; Err:text}) query; - returnInvalidErrValue: () -> (variant {Ok:text; Err:text}) query; - throwBigint: () -> () query; - throwBoolean: () -> () query; - throwClass: () -> () query; - throwCustomError: () -> () query; - throwInt: () -> () query; - throwNull: () -> () query; - throwNullReference: () -> () query; - throwObject: () -> () query; - throwRational: () -> () query; - throwString: () -> () query; - throwSymbol: () -> () query; - throwUndefined: () -> () query; - accessible: () -> (bool); - inaccessible: () -> (bool); - alsoInaccessible: () -> (bool); - returnStringAsInvalidUserDefinedVariant: () -> (rec_10) query; - returnEmptyObjectAsInvalidUserDefinedVariant: () -> (rec_13) query; - returnObjectWithInvalidTagAsInvalidUserDefinedVariant: () -> (rec_16) query; - returnObjectWithMultipleTagsAsInvalidUserDefinedVariant: () -> (rec_19) query; - returnObjectWithInvalidFieldsAsInvalidUserDefinedVariant: () -> (rec_22) query; - returnStringAsInvalidVecUserDefinedVariant: () -> (vec rec_25) query; - returnObjectAsInvalidVecUserDefinedVariant: () -> (vec rec_28) query; - returnArrayWithInvalidUserDefinedVariant: () -> (vec rec_31) query; - returnNonObjectAsInvalidVec: () -> (vec text) query; - returnNonArrayAsInvalidVec: () -> (vec text) query; - returnArrayWithInvalidVecItem: () -> (vec text) query; -} diff --git a/examples/simple_erc20/dfx.json b/examples/simple_erc20/dfx.json index 417e323d73..2a96508ff2 100644 --- a/examples/simple_erc20/dfx.json +++ b/examples/simple_erc20/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "simple_erc20": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle simple_erc20", - "wasm": ".azle/simple_erc20/simple_erc20.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/simple_erc20", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/simple_erc20/src/index.did b/examples/simple_erc20/src/index.did deleted file mode 100644 index 4cf849a10b..0000000000 --- a/examples/simple_erc20/src/index.did +++ /dev/null @@ -1,8 +0,0 @@ -service: () -> { - balance: (text) -> (nat64) query; - initializeSupply: (text, text, text, nat64) -> (bool); - name: () -> (text) query; - ticker: () -> (text) query; - totalSupply: () -> (nat64) query; - transfer: (text, text, nat64) -> (bool); -} diff --git a/examples/simple_user_accounts/dfx.json b/examples/simple_user_accounts/dfx.json index e3f6936b2a..4789ad5a6e 100644 --- a/examples/simple_user_accounts/dfx.json +++ b/examples/simple_user_accounts/dfx.json @@ -1,27 +1,13 @@ { "canisters": { "simple_user_accounts": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", "candid_gen": "custom", - "build": "npx azle simple_user_accounts", - "wasm": ".azle/simple_user_accounts/simple_user_accounts.wasm", - "gzip": true, "declarations": { "output": "test/dfx_generated/simple_user_accounts", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/sqlite/dfx.json b/examples/sqlite/dfx.json index d7325374ea..91c521d94f 100644 --- a/examples/sqlite/dfx.json +++ b/examples/sqlite/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "sqlite": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "candid_gen": "http", - "build": "npx azle sqlite", - "wasm": ".azle/sqlite/sqlite.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/sqlite/src/index.did b/examples/sqlite/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/sqlite/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/stable_b_tree_map_instruction_threshold/dfx.json b/examples/stable_b_tree_map_instruction_threshold/dfx.json index cdccde9143..1a6d803a0b 100644 --- a/examples/stable_b_tree_map_instruction_threshold/dfx.json +++ b/examples/stable_b_tree_map_instruction_threshold/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "stable_b_tree_map_instruction_threshold": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle stable_b_tree_map_instruction_threshold", - "wasm": ".azle/stable_b_tree_map_instruction_threshold/stable_b_tree_map_instruction_threshold.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/stable_b_tree_map_instruction_threshold", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/stable_b_tree_map_instruction_threshold/src/index.did b/examples/stable_b_tree_map_instruction_threshold/src/index.did deleted file mode 100644 index ecce41e204..0000000000 --- a/examples/stable_b_tree_map_instruction_threshold/src/index.did +++ /dev/null @@ -1,14 +0,0 @@ -service: () -> { - insertLargeRecord: (nat32) -> (); - insertMediumRecord: (nat32) -> (); - insertSmallRecord: (nat32) -> (); - itemsLargeRecord: (nat32) -> (vec record {text; record {id:text; age:nat; signature:vec nat8; internetIdentity:principal; username:text; mediumRecord:record {id:text; age:nat; internetIdentity:principal; username:text}; friends:vec text}}) query; - itemsMediumRecord: (nat32) -> (vec record {text; record {id:text; age:nat; internetIdentity:principal; username:text}}) query; - itemsSmallRecord: (nat32) -> (vec record {text; record {id:principal}}) query; - keysLargeRecord: (nat32) -> (vec text) query; - keysMediumRecord: (nat32) -> (vec text) query; - keysSmallRecord: (nat32) -> (vec text) query; - valuesLargeRecord: (nat32) -> (vec record {id:text; age:nat; signature:vec nat8; internetIdentity:principal; username:text; mediumRecord:record {id:text; age:nat; internetIdentity:principal; username:text}; friends:vec text}) query; - valuesMediumRecord: (nat32) -> (vec record {id:text; age:nat; internetIdentity:principal; username:text}) query; - valuesSmallRecord: (nat32) -> (vec record {id:principal}) query; -} diff --git a/examples/stable_memory/dfx.json b/examples/stable_memory/dfx.json index 2e4b1fb77b..69ea3636c8 100644 --- a/examples/stable_memory/dfx.json +++ b/examples/stable_memory/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "stable_memory": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle stable_memory", - "wasm": ".azle/stable_memory/stable_memory.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/stable_memory", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/stable_memory/src/index.did b/examples/stable_memory/src/index.did deleted file mode 100644 index 3fdb8f4002..0000000000 --- a/examples/stable_memory/src/index.did +++ /dev/null @@ -1,11 +0,0 @@ -service: () -> { - stable64Grow: (nat64) -> (nat64); - stable64Read: (nat64, nat64) -> (vec nat8) query; - stable64Size: () -> (nat64) query; - stable64Write: (nat64, vec nat8) -> (); - stableBytes: () -> (vec nat8) query; - stableGrow: (nat32) -> (nat32); - stableRead: (nat32, nat32) -> (vec nat8) query; - stableSize: () -> (nat32) query; - stableWrite: (nat32, vec nat8) -> (); -} diff --git a/examples/stable_structures/dfx.json b/examples/stable_structures/dfx.json index 438134caa9..0feb690762 100644 --- a/examples/stable_structures/dfx.json +++ b/examples/stable_structures/dfx.json @@ -1,70 +1,31 @@ { "canisters": { "canister1": { - "type": "custom", + "type": "azle", "main": "src/canister1/index.ts", - "candid": "src/canister1/index.did", - "build": "npx azle canister1 --native-compilation", - "wasm": ".azle/canister1/canister1.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister1", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister1/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "canister2": { - "type": "custom", + "type": "azle", "main": "src/canister2/index.ts", - "candid": "src/canister2/index.did", - "build": "npx azle canister2 --native-compilation", - "wasm": ".azle/canister2/canister2.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister2/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } }, "canister3": { - "type": "custom", + "type": "azle", "main": "src/canister3/index.ts", - "candid": "src/canister3/index.did", - "build": "npx azle canister3 --native-compilation", - "wasm": ".azle/canister3/canister3.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister3", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/canister3/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/stable_structures/src/canister1/index.did b/examples/stable_structures/src/canister1/index.did deleted file mode 100644 index f3733b8a13..0000000000 --- a/examples/stable_structures/src/canister1/index.did +++ /dev/null @@ -1,48 +0,0 @@ -service: () -> { - getRedeployed: () -> (bool) query; - stableMap0ContainsKey: (nat8) -> (bool) query; - stableMap0Get: (nat8) -> (opt text) query; - stableMap0Insert: (nat8, text) -> (opt text); - stableMap0IsEmpty: () -> (bool) query; - stableMap0Items: () -> (vec record {nat8; text}) query; - stableMap0Keys: () -> (vec nat8) query; - stableMap0Len: () -> (nat64) query; - stableMap0Remove: (nat8) -> (opt text); - stableMap0Values: () -> (vec text) query; - stableMap1ContainsKey: (nat16) -> (bool) query; - stableMap1Get: (nat16) -> (opt vec nat8) query; - stableMap1Insert: (nat16, vec nat8) -> (opt vec nat8); - stableMap1IsEmpty: () -> (bool) query; - stableMap1Items: () -> (vec record {nat16; vec nat8}) query; - stableMap1Keys: () -> (vec nat16) query; - stableMap1Len: () -> (nat64) query; - stableMap1Remove: (nat16) -> (opt vec nat8); - stableMap1Values: () -> (vec vec nat8) query; - stableMap2ContainsKey: (nat32) -> (bool) query; - stableMap2Get: (nat32) -> (opt nat) query; - stableMap2Insert: (nat32, nat) -> (opt nat); - stableMap2IsEmpty: () -> (bool) query; - stableMap2Items: () -> (vec record {nat32; nat}) query; - stableMap2Keys: () -> (vec nat32) query; - stableMap2Len: () -> (nat64) query; - stableMap2Remove: (nat32) -> (opt nat); - stableMap2Values: () -> (vec nat) query; - stableMap3ContainsKey: (variant {Sad; Happy}) -> (bool) query; - stableMap3Get: (variant {Sad; Happy}) -> (opt int) query; - stableMap3Insert: (variant {Sad; Happy}, int) -> (opt int); - stableMap3IsEmpty: () -> (bool) query; - stableMap3Items: () -> (vec record {variant {Sad; Happy}; int}) query; - stableMap3Keys: () -> (vec variant {Sad; Happy}) query; - stableMap3Len: () -> (nat64) query; - stableMap3Remove: (variant {Sad; Happy}) -> (opt int); - stableMap3Values: () -> (vec int) query; - stableMap4ContainsKey: (record {username:text; posts:vec record {title:text}}) -> (bool) query; - stableMap4Get: (record {username:text; posts:vec record {title:text}}) -> (opt float32) query; - stableMap4Insert: (record {username:text; posts:vec record {title:text}}, float32) -> (opt float32); - stableMap4IsEmpty: () -> (bool) query; - stableMap4Items: () -> (vec record {record {username:text; posts:vec record {title:text}}; float32}) query; - stableMap4Keys: () -> (vec record {username:text; posts:vec record {title:text}}) query; - stableMap4Len: () -> (nat64) query; - stableMap4Remove: (record {username:text; posts:vec record {title:text}}) -> (opt float32); - stableMap4Values: () -> (vec float32) query; -} diff --git a/examples/stable_structures/src/canister2/index.did b/examples/stable_structures/src/canister2/index.did deleted file mode 100644 index 40409a17d5..0000000000 --- a/examples/stable_structures/src/canister2/index.did +++ /dev/null @@ -1,48 +0,0 @@ -service: () -> { - getRedeployed: () -> (bool) query; - stableMap5ContainsKey: (opt text) -> (bool) query; - stableMap5Get: (opt text) -> (opt float64) query; - stableMap5Insert: (opt text, float64) -> (opt float64); - stableMap5IsEmpty: () -> (bool) query; - stableMap5Items: () -> (vec record {opt text; float64}) query; - stableMap5Keys: () -> (vec opt text) query; - stableMap5Len: () -> (nat64) query; - stableMap5Remove: (opt text) -> (opt float64); - stableMap5Values: () -> (vec float64) query; - stableMap6ContainsKey: (vec nat64) -> (bool) query; - stableMap6Get: (vec nat64) -> (opt bool) query; - stableMap6Insert: (vec nat64, bool) -> (opt bool); - stableMap6IsEmpty: () -> (bool) query; - stableMap6Items: () -> (vec record {vec nat64; bool}) query; - stableMap6Keys: () -> (vec vec nat64) query; - stableMap6Len: () -> (nat64) query; - stableMap6Remove: (vec nat64) -> (opt bool); - stableMap6Values: () -> (vec bool) query; - stableMap7ContainsKey: (null) -> (bool) query; - stableMap7Get: (null) -> (opt null) query; - stableMap7Insert: (null, null) -> (opt null); - stableMap7IsEmpty: () -> (bool) query; - stableMap7Items: () -> (vec record {null; null}) query; - stableMap7Keys: () -> (vec null) query; - stableMap7Len: () -> (nat64) query; - stableMap7Remove: (null) -> (opt null); - stableMap7Values: () -> (vec null) query; - stableMap8ContainsKey: (bool) -> (bool) query; - stableMap8Get: (bool) -> (opt null) query; - stableMap8Insert: (bool, null) -> (opt null); - stableMap8IsEmpty: () -> (bool) query; - stableMap8Items: () -> (vec record {bool; null}) query; - stableMap8Keys: () -> (vec bool) query; - stableMap8Len: () -> (nat64) query; - stableMap8Remove: (bool) -> (opt null); - stableMap8Values: () -> (vec null) query; - stableMap9ContainsKey: (float64) -> (bool) query; - stableMap9Get: (float64) -> (opt vec text) query; - stableMap9Insert: (float64, vec text) -> (opt vec text); - stableMap9IsEmpty: () -> (bool) query; - stableMap9Items: () -> (vec record {float64; vec text}) query; - stableMap9Keys: () -> (vec float64) query; - stableMap9Len: () -> (nat64) query; - stableMap9Remove: (float64) -> (opt vec text); - stableMap9Values: () -> (vec vec text) query; -} diff --git a/examples/stable_structures/src/canister3/index.did b/examples/stable_structures/src/canister3/index.did deleted file mode 100644 index ad8907e513..0000000000 --- a/examples/stable_structures/src/canister3/index.did +++ /dev/null @@ -1,75 +0,0 @@ -service: () -> { - getRedeployed: () -> (bool) query; - stableMap10ContainsKey: (float32) -> (bool) query; - stableMap10Get: (float32) -> (opt opt bool) query; - stableMap10Insert: (float32, opt bool) -> (opt opt bool); - stableMap10IsEmpty: () -> (bool) query; - stableMap10Items: () -> (vec record {float32; opt bool}) query; - stableMap10Keys: () -> (vec float32) query; - stableMap10Len: () -> (nat64) query; - stableMap10Remove: (float32) -> (opt opt bool); - stableMap10Values: () -> (vec opt bool) query; - stableMap11ContainsKey: (nat) -> (bool) query; - stableMap11Get: (nat) -> (opt record {username:text; posts:vec record {title:text}}) query; - stableMap11Insert: (nat, record {username:text; posts:vec record {title:text}}) -> (opt record {username:text; posts:vec record {title:text}}); - stableMap11IsEmpty: () -> (bool) query; - stableMap11Items: () -> (vec record {nat; record {username:text; posts:vec record {title:text}}}) query; - stableMap11Keys: () -> (vec nat) query; - stableMap11Len: () -> (nat64) query; - stableMap11Remove: (nat) -> (opt record {username:text; posts:vec record {title:text}}); - stableMap11Values: () -> (vec record {username:text; posts:vec record {title:text}}) query; - stableMap12ContainsKey: (vec nat8) -> (bool) query; - stableMap12Get: (vec nat8) -> (opt variant {Sad; Happy}) query; - stableMap12Insert: (vec nat8, variant {Sad; Happy}) -> (opt variant {Sad; Happy}); - stableMap12IsEmpty: () -> (bool) query; - stableMap12Items: () -> (vec record {vec nat8; variant {Sad; Happy}}) query; - stableMap12Keys: () -> (vec vec nat8) query; - stableMap12Len: () -> (nat64) query; - stableMap12Remove: (vec nat8) -> (opt variant {Sad; Happy}); - stableMap12Values: () -> (vec variant {Sad; Happy}) query; - stableMap13ContainsKey: (text) -> (bool) query; - stableMap13Get: (text) -> (opt principal) query; - stableMap13Insert: (text, principal) -> (opt principal); - stableMap13IsEmpty: () -> (bool) query; - stableMap13Items: () -> (vec record {text; principal}) query; - stableMap13Keys: () -> (vec text) query; - stableMap13Len: () -> (nat64) query; - stableMap13Remove: (text) -> (opt principal); - stableMap13Values: () -> (vec principal) query; - stableMap14ContainsKey: (text) -> (bool) query; - stableMap14Get: (text) -> (opt func (record {title:text}) -> (variant {Sad; Happy})) query; - stableMap14Insert: (text, func (record {title:text}) -> (variant {Sad; Happy})) -> (opt func (record {title:text}) -> (variant {Sad; Happy})); - stableMap14IsEmpty: () -> (bool) query; - stableMap14Items: () -> (vec record {text; func (record {title:text}) -> (variant {Sad; Happy})}) query; - stableMap14Keys: () -> (vec text) query; - stableMap14Len: () -> (nat64) query; - stableMap14Remove: (text) -> (opt func (record {title:text}) -> (variant {Sad; Happy})); - stableMap14Values: () -> (vec func (record {title:text}) -> (variant {Sad; Happy})) query; - stableMap15ContainsKey: (func (record {title:text}) -> (variant {Sad; Happy})) -> (bool) query; - stableMap15Get: (func (record {title:text}) -> (variant {Sad; Happy})) -> (opt text) query; - stableMap15Insert: (func (record {title:text}) -> (variant {Sad; Happy}), text) -> (opt text); - stableMap15IsEmpty: () -> (bool) query; - stableMap15Items: () -> (vec record {func (record {title:text}) -> (variant {Sad; Happy}); text}) query; - stableMap15Keys: () -> (vec func (record {title:text}) -> (variant {Sad; Happy})) query; - stableMap15Len: () -> (nat64) query; - stableMap15Remove: (func (record {title:text}) -> (variant {Sad; Happy})) -> (opt text); - stableMap15Values: () -> (vec text) query; - stableMap16ContainsKey: (text) -> (bool) query; - stableMap16Get: (text) -> (opt text) query; - stableMap16Insert: (text, text) -> (opt text); - stableMap16IsEmpty: () -> (bool) query; - stableMap16Items: () -> (vec record {text; text}) query; - stableMap16Keys: () -> (vec text) query; - stableMap16Len: () -> (nat64) query; - stableMap16Remove: (text) -> (opt text); - stableMap16Values: () -> (vec text) query; - stableMap17ContainsKey: (text) -> (bool) query; - stableMap17Get: (text) -> (opt text) query; - stableMap17Insert: (text, text) -> (opt text); - stableMap17IsEmpty: () -> (bool) query; - stableMap17Items: () -> (vec record {text; text}) query; - stableMap17Keys: () -> (vec text) query; - stableMap17Len: () -> (nat64) query; - stableMap17Remove: (text) -> (opt text); - stableMap17Values: () -> (vec text) query; -} diff --git a/examples/tfjs/dfx.json b/examples/tfjs/dfx.json index b29b85a108..7f5e916bf0 100644 --- a/examples/tfjs/dfx.json +++ b/examples/tfjs/dfx.json @@ -1,24 +1,9 @@ { "canisters": { "api": { - "type": "custom", + "type": "azle", "main": "src/api.ts", - "candid": "src/api.did", - "candid_gen": "http", - "build": "npx azle api", - "wasm": ".azle/api/api.wasm", - "gzip": true, - "assets": [["src/spam", "spam"]], - "metadata": [ - { - "name": "candid:service", - "path": "src/api.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "assets": [["src/spam", "spam"]] } } } diff --git a/examples/tfjs/src/api.did b/examples/tfjs/src/api.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/tfjs/src/api.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/examples/timers/dfx.json b/examples/timers/dfx.json index a6cf949c2c..e0889d9465 100644 --- a/examples/timers/dfx.json +++ b/examples/timers/dfx.json @@ -1,27 +1,14 @@ { "canisters": { "timers": { - "type": "custom", + "type": "azle", "main": "src/timers.ts", - "candid": "src/timers.did", - "build": "npx azle timers", - "wasm": ".azle/timers/timers.wasm", - "gzip": true, + "candid_gen": "automatic", + "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/timers", "node_compatibility": true - }, - "env": ["AZLE_TEST_FETCH"], - "metadata": [ - { - "name": "candid:service", - "path": "src/timers.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/timers/src/timers.did b/examples/timers/src/timers.did deleted file mode 100644 index 6811bc1fc2..0000000000 --- a/examples/timers/src/timers.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - clearTimer: (nat64) -> (); - setTimers: (nat64, nat64) -> (record {repeat:nat64; repeatCrossCanister:nat64; inline:nat64; capture:nat64; single:nat64; singleCrossCanister:nat64}); - statusReport: () -> (record {repeat:int8; repeatCrossCanister:vec nat8; inline:int8; capture:text; single:bool; singleCrossCanister:vec nat8}) query; -} diff --git a/examples/tuple_types/dfx.json b/examples/tuple_types/dfx.json index 5d919ed97f..a0fbd3f513 100644 --- a/examples/tuple_types/dfx.json +++ b/examples/tuple_types/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "tuple_types": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle tuple_types", - "wasm": ".azle/tuple_types/tuple_types.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/tuple_types", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/tuple_types/src/index.did b/examples/tuple_types/src/index.did deleted file mode 100644 index 862f8b44db..0000000000 --- a/examples/tuple_types/src/index.did +++ /dev/null @@ -1,36 +0,0 @@ -type rec_4 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_4}; Good}; -type rec_5 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_5}; Good}; -type rec_3 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_3}; Good}; -type rec_1 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_1}; Good}; -type rec_2 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_2}; Good}; -type rec_0 = variant {Bad:record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_0}; Good}; -service: () -> { - complexOneTupleInlineParam: (record {record {text; nat64}}) -> (record {record {text; nat64}}) query; - complexOneTupleInlineReturnType: () -> (record {record {text; nat64}}) query; - complexOneTupleParam: (record {record {text; nat64}}) -> (record {record {text; nat64}}) query; - complexOneTupleReturnType: () -> (record {record {text; nat64}}) query; - complexThreeTupleInlineParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_4}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_5}) query; - complexThreeTupleInlineReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_3}) query; - complexThreeTupleParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_1}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_2}) query; - complexThreeTupleReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}; rec_0}) query; - complexTwoTupleInlineParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; - complexTwoTupleInlineReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; - complexTwoTupleParam: (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; - complexTwoTupleReturnType: () -> (record {record {text; nat64}; record {id:text; primitiveTwoTuple:record {text; nat64}}}) query; - nestedTupleQuery: (record {record {text; record {nat8; nat8}}; int}) -> (record {record {text; record {nat8; nat8}}; int}) query; - primitiveOneTupleInlineParam: (record {text}) -> (record {text}) query; - primitiveOneTupleInlineReturnType: () -> (record {text}) query; - primitiveOneTupleParam: (record {text}) -> (record {text}) query; - primitiveOneTupleReturnType: () -> (record {text}) query; - primitiveThreeTupleInlineParam: (record {text; nat64; principal}) -> (record {text; nat64; principal}) query; - primitiveThreeTupleInlineReturnType: () -> (record {text; nat64; principal}) query; - primitiveThreeTupleParam: (record {text; nat64; principal}) -> (record {text; nat64; principal}) query; - primitiveThreeTupleReturnType: () -> (record {text; nat64; principal}) query; - primitiveTwoTupleInlineParam: (record {text; text}) -> (record {text; text}) query; - primitiveTwoTupleInlineReturnType: () -> (record {text; text}) query; - primitiveTwoTupleParam: (record {text; nat64}) -> (record {text; nat64}) query; - primitiveTwoTupleReturnType: () -> (record {text; nat64}) query; - tupleArrayParamsAndReturnType: (vec record {text; text}) -> (vec record {text; text}) query; - tupleArrayRecordField: () -> (record {headers:vec record {text; text}}) query; - tupleArrayVariantField: () -> (variant {WithHeaders:vec record {text; text}; WithoutHeaders}) query; -} diff --git a/examples/update/dfx.json b/examples/update/dfx.json index 146710d758..8bb79c87f0 100644 --- a/examples/update/dfx.json +++ b/examples/update/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "update": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle update", - "wasm": ".azle/update/update.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/update", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/update/src/index.did b/examples/update/src/index.did deleted file mode 100644 index 9bab52c5ab..0000000000 --- a/examples/update/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - getCurrentMessage: () -> (text) query; - simpleUpdate: (text) -> (); -} diff --git a/examples/vanilla_js/dfx.json b/examples/vanilla_js/dfx.json index 8bdfb7300c..b0901ae883 100644 --- a/examples/vanilla_js/dfx.json +++ b/examples/vanilla_js/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "vanilla_js": { - "type": "custom", + "type": "azle", "main": "src/index.js", - "candid": "src/index.did", - "build": "npx azle vanilla_js", - "wasm": ".azle/vanilla_js/vanilla_js.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/vanilla_js", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/examples/vanilla_js/src/index.did b/examples/vanilla_js/src/index.did deleted file mode 100644 index ba512dc376..0000000000 --- a/examples/vanilla_js/src/index.did +++ /dev/null @@ -1,5 +0,0 @@ -service: () -> { - builtin: () -> (int) query; - packageImport: (text) -> (text) query; - relativeImport: () -> (text) query; -} diff --git a/examples/web_assembly/dfx.json b/examples/web_assembly/dfx.json index 5c0cd02c2e..22f5663ea5 100644 --- a/examples/web_assembly/dfx.json +++ b/examples/web_assembly/dfx.json @@ -1,23 +1,8 @@ { "canisters": { "web_assembly": { - "type": "custom", - "main": "src/index.ts", - "candid": "src/index.did", - "candid_gen": "http", - "build": "npx azle web_assembly", - "wasm": ".azle/web_assembly/web_assembly.wasm", - "gzip": true, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + "type": "azle", + "main": "src/index.ts" } } } diff --git a/examples/web_assembly/src/index.did b/examples/web_assembly/src/index.did deleted file mode 100644 index 7bf084795e..0000000000 --- a/examples/web_assembly/src/index.did +++ /dev/null @@ -1,4 +0,0 @@ -service: () -> { - http_request: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}; certificate_version:opt nat16}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}) query; - http_request_update: (record {url:text; method:text; body:vec nat8; headers:vec record {text; text}}) -> (record {body:vec nat8; headers:vec record {text; text}; upgrade:opt bool; streaming_strategy:opt variant {Callback:record {token:vec nat8; callback:func (vec nat8) -> (opt record {token:opt vec nat8; body:vec nat8}) query}}; status_code:nat16}); -} diff --git a/src/compiler/file_uploader/index.ts b/src/compiler/file_uploader/index.ts index 07ed9fe16b..2454821ecc 100644 --- a/src/compiler/file_uploader/index.ts +++ b/src/compiler/file_uploader/index.ts @@ -9,6 +9,10 @@ export type Src = string; export type Dest = string; export async function uploadFiles(canisterName: string, paths: [Src, Dest][]) { + if (paths.length === 0) { + return; + } + const canisterId = getCanisterId(canisterName); const identityName = generateUploaderIdentity(canisterName); const actor = await createActor(canisterId, identityName); diff --git a/src/compiler/get_candid_and_canister_methods.ts b/src/compiler/get_candid_and_canister_methods.ts index ca5ffa93dc..e902fa1cfd 100644 --- a/src/compiler/get_candid_and_canister_methods.ts +++ b/src/compiler/get_candid_and_canister_methods.ts @@ -7,7 +7,7 @@ import { generateCandidAndCanisterMethods } from './generate_candid_and_canister import { CandidGen, CanisterMethods, CompilerInfo } from './utils/types'; export function getCandidAndCanisterMethods( - candidGen: CandidGen = 'automatic', + candidGen: CandidGen, candidPath: string, compilerInfoPath: string, dockerContainerName: string, diff --git a/src/compiler/get_names.ts b/src/compiler/get_names.ts index 567d8a1a6c..a1049a5ffb 100644 --- a/src/compiler/get_names.ts +++ b/src/compiler/get_names.ts @@ -65,7 +65,8 @@ export function getNamesAfterCli() { const canisterPath = join('.azle', canisterName); const canisterConfig = unwrap(getCanisterConfig(canisterName)); - const candidPath = canisterConfig.candid; + const candidPath = + canisterConfig.candid ?? `.azle/${canisterName}/${canisterName}.did`; const compilerInfoPath = join( canisterPath, diff --git a/src/compiler/index.ts b/src/compiler/index.ts index 433002078d..9e85f655fc 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -1,4 +1,6 @@ +import { IOType } from 'child_process'; import { mkdirSync, writeFileSync } from 'fs'; +import { join } from 'path'; import { compileRustCodeWithCandidAndCompilerInfo } from './compile_rust_code_with_candid_and_compiler_info'; import { setupFileWatcher } from './file_watcher/setup_file_watcher'; @@ -10,6 +12,7 @@ import { prepareDockerImage } from './prepare_docker_image'; import { prepareRustStagingArea } from './prepare_rust_staging_area'; import { logSuccess, time, unwrap } from './utils'; import { green } from './utils/colors'; +import { execSyncPretty } from './utils/exec_sync_pretty'; import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { CompilerInfo } from './utils/types'; @@ -41,6 +44,8 @@ async function azle() { return; } + installDfxExtension(stdioType); + const { canisterName, canisterPath, @@ -91,7 +96,7 @@ async function azle() { ); const { candid, canisterMethods } = getCandidAndCanisterMethods( - canisterConfig.candid_gen, + canisterConfig.candid_gen ?? 'http', candidPath, compilerInfoPath, dockerContainerName, @@ -134,3 +139,14 @@ function createAzleDirectories() { mkdirSync(GLOBAL_AZLE_CONFIG_DIR, { recursive: true }); mkdirSync('.azle', { recursive: true }); } + +// TODO this is just temporary +// TODO until we either make azle an official extension in the DFINITY dfx extensions repo +// TODO or we have a better way for the developer to install the extension locally +function installDfxExtension(stdioType: IOType) { + const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension'); + execSyncPretty( + `cd ${dfxExtensionDirectoryPath} && ./install.sh`, + stdioType + ); +} diff --git a/src/compiler/utils/get_canister_config.ts b/src/compiler/utils/get_canister_config.ts index 28c0a03610..2c9721f2f5 100644 --- a/src/compiler/utils/get_canister_config.ts +++ b/src/compiler/utils/get_canister_config.ts @@ -29,23 +29,23 @@ export function getCanisterConfig( }); } - const { main, candid } = canisterConfig; + // const { main, candid } = canisterConfig; - if (!main || !candid) { - const missingFields = [ - ['"main"', main], - ['"candid"', candid] - ] - .filter(([_, value]) => !value) - .map(([field, _]) => field); - const fieldOrFields = missingFields.length === 1 ? 'field' : 'fields'; - const missingFieldNames = missingFields.join(', '); - return Err({ - error: `Missing ${fieldOrFields} ${missingFieldNames} in ./dfx.json`, - suggestion: `Make sure your dfx.json looks similar to the following:\n\n${exampleDfxJson}`, - exitCode: 4 - }); - } + // if (!main || !candid) { + // const missingFields = [ + // ['"main"', main], + // ['"candid"', candid] + // ] + // .filter(([_, value]) => !value) + // .map(([field, _]) => field); + // const fieldOrFields = missingFields.length === 1 ? 'field' : 'fields'; + // const missingFieldNames = missingFields.join(', '); + // return Err({ + // error: `Missing ${fieldOrFields} ${missingFieldNames} in ./dfx.json`, + // suggestion: `Make sure your dfx.json looks similar to the following:\n\n${exampleDfxJson}`, + // exitCode: 4 + // }); + // } if (require.main?.path === undefined) { throw new Error(`require.main?.path must be defined`); diff --git a/src/compiler/utils/types.ts b/src/compiler/utils/types.ts index 088a967e9f..0b7d274c84 100644 --- a/src/compiler/utils/types.ts +++ b/src/compiler/utils/types.ts @@ -15,13 +15,13 @@ export type DfxJson = Readonly<{ export type JavaScript = string; export type JSCanisterConfig = Readonly<{ - type: 'custom'; + type: 'azle'; main: string; - build: string; + build?: string; build_assets?: string; - candid: string; + candid?: string; candid_gen?: CandidGen; - wasm: string; + wasm?: string; env?: string[]; opt_level?: OptLevel; assets?: [string, string][]; From 7a1b9594a7dc491e89b5a2b17c91058f4a9afbef Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 14:14:41 -0500 Subject: [PATCH 02/14] install the azle extension with a new azle command --- .github/workflows/test.yml | 9 ++++++--- src/compiler/handle_cli.ts | 18 ++++++++++++++++++ src/compiler/index.ts | 16 ---------------- 3 files changed, 24 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a3c35e7e13..27d2c1b7e3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -294,9 +294,6 @@ jobs: - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} shell: bash -l {0} run: npm run lint - - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} - working-directory: ${{ matrix.example_directories }} - run: dfx start --clean --background --host 127.0.0.1:8000 - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} shell: bash -l {0} working-directory: ${{ matrix.example_directories }} @@ -305,6 +302,12 @@ jobs: shell: bash -l {0} working-directory: ${{ matrix.example_directories }} run: npm link azle + - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} + working-directory: ${{ matrix.example_directories }} + run: npx azle install-dfx-extension + - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} + working-directory: ${{ matrix.example_directories }} + run: dfx start --clean --background --host 127.0.0.1:8000 # This is to put wasmedge-quickjs in the correct location for the --native-compilation tests - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} shell: bash -l {0} diff --git a/src/compiler/handle_cli.ts b/src/compiler/handle_cli.ts index a9aae86f0d..557b93a528 100644 --- a/src/compiler/handle_cli.ts +++ b/src/compiler/handle_cli.ts @@ -1,5 +1,6 @@ import { IOType } from 'child_process'; import { rmSync } from 'fs'; +import { join } from 'path'; import { version as azleVersion } from '../../package.json'; import { uploadFiles } from './file_uploader'; @@ -46,6 +47,12 @@ export function handleCli( return true; } + if (commandName === 'install-dfx-extension') { + installDfxExtension(stdioType); + + return true; + } + return false; } @@ -109,3 +116,14 @@ async function handleUploadAssets() { function handleVersionCommand() { console.info(azleVersion); } + +// TODO this is just temporary +// TODO until we either make azle an official extension in the DFINITY dfx extensions repo +// TODO or we have a better way for the developer to install the extension locally +function installDfxExtension(stdioType: IOType) { + const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension'); + execSyncPretty( + `cd ${dfxExtensionDirectoryPath} && ./install.sh`, + stdioType + ); +} diff --git a/src/compiler/index.ts b/src/compiler/index.ts index 9e85f655fc..525b56699d 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -1,6 +1,4 @@ -import { IOType } from 'child_process'; import { mkdirSync, writeFileSync } from 'fs'; -import { join } from 'path'; import { compileRustCodeWithCandidAndCompilerInfo } from './compile_rust_code_with_candid_and_compiler_info'; import { setupFileWatcher } from './file_watcher/setup_file_watcher'; @@ -12,7 +10,6 @@ import { prepareDockerImage } from './prepare_docker_image'; import { prepareRustStagingArea } from './prepare_rust_staging_area'; import { logSuccess, time, unwrap } from './utils'; import { green } from './utils/colors'; -import { execSyncPretty } from './utils/exec_sync_pretty'; import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { CompilerInfo } from './utils/types'; @@ -44,8 +41,6 @@ async function azle() { return; } - installDfxExtension(stdioType); - const { canisterName, canisterPath, @@ -139,14 +134,3 @@ function createAzleDirectories() { mkdirSync(GLOBAL_AZLE_CONFIG_DIR, { recursive: true }); mkdirSync('.azle', { recursive: true }); } - -// TODO this is just temporary -// TODO until we either make azle an official extension in the DFINITY dfx extensions repo -// TODO or we have a better way for the developer to install the extension locally -function installDfxExtension(stdioType: IOType) { - const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension'); - execSyncPretty( - `cd ${dfxExtensionDirectoryPath} && ./install.sh`, - stdioType - ); -} From cfab748d67d164de3ccf48fb11452c0907ac0e65 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 14:15:46 -0500 Subject: [PATCH 03/14] also install the extension in the publish script --- publish-github-action.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/publish-github-action.sh b/publish-github-action.sh index 4c978867a9..91f132d4d7 100755 --- a/publish-github-action.sh +++ b/publish-github-action.sh @@ -39,6 +39,7 @@ done npm install npm link +npx azle install-dfx-extension dfx start --background cd examples/hello_world npm install From db7842b8c77cd77f1ed2d774553cf608b558648f Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 14:23:53 -0500 Subject: [PATCH 04/14] change install extension command location to prevent any premmature dfx interactions --- src/compiler/handle_cli.ts | 18 ------------------ src/compiler/index.ts | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/src/compiler/handle_cli.ts b/src/compiler/handle_cli.ts index 557b93a528..a9aae86f0d 100644 --- a/src/compiler/handle_cli.ts +++ b/src/compiler/handle_cli.ts @@ -1,6 +1,5 @@ import { IOType } from 'child_process'; import { rmSync } from 'fs'; -import { join } from 'path'; import { version as azleVersion } from '../../package.json'; import { uploadFiles } from './file_uploader'; @@ -47,12 +46,6 @@ export function handleCli( return true; } - if (commandName === 'install-dfx-extension') { - installDfxExtension(stdioType); - - return true; - } - return false; } @@ -116,14 +109,3 @@ async function handleUploadAssets() { function handleVersionCommand() { console.info(azleVersion); } - -// TODO this is just temporary -// TODO until we either make azle an official extension in the DFINITY dfx extensions repo -// TODO or we have a better way for the developer to install the extension locally -function installDfxExtension(stdioType: IOType) { - const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension'); - execSyncPretty( - `cd ${dfxExtensionDirectoryPath} && ./install.sh`, - stdioType - ); -} diff --git a/src/compiler/index.ts b/src/compiler/index.ts index 525b56699d..bfb082b652 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -1,4 +1,6 @@ +import { IOType } from 'child_process'; import { mkdirSync, writeFileSync } from 'fs'; +import { join } from 'path'; import { compileRustCodeWithCandidAndCompilerInfo } from './compile_rust_code_with_candid_and_compiler_info'; import { setupFileWatcher } from './file_watcher/setup_file_watcher'; @@ -8,14 +10,23 @@ import { getNamesAfterCli, getNamesBeforeCli } from './get_names'; import { handleCli } from './handle_cli'; import { prepareDockerImage } from './prepare_docker_image'; import { prepareRustStagingArea } from './prepare_rust_staging_area'; -import { logSuccess, time, unwrap } from './utils'; +import { getStdIoType, logSuccess, time, unwrap } from './utils'; import { green } from './utils/colors'; +import { execSyncPretty } from './utils/exec_sync_pretty'; import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { CompilerInfo } from './utils/types'; azle(); async function azle() { + // We must run this before getNamesBeforeCli because + // any dfx commands require the azle extension to be installed + if (process.argv[2] === 'install-dfx-extension') { + installDfxExtension(getStdIoType()); + + return; + } + const { stdioType, dockerfileHash, @@ -134,3 +145,14 @@ function createAzleDirectories() { mkdirSync(GLOBAL_AZLE_CONFIG_DIR, { recursive: true }); mkdirSync('.azle', { recursive: true }); } + +// TODO this is just temporary +// TODO until we either make azle an official extension in the DFINITY dfx extensions repo +// TODO or we have a better way for the developer to install the extension locally +function installDfxExtension(stdioType: IOType) { + const dfxExtensionDirectoryPath = join(__dirname, '../../dfx_extension'); + execSyncPretty( + `cd ${dfxExtensionDirectoryPath} && ./install.sh`, + stdioType + ); +} From f338e7167aeddbe0337da66141b65334d5e8dd51 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 15:12:06 -0500 Subject: [PATCH 05/14] fix various issues with tests because of azle extension --- examples/async_await/dfx.json | 1 + examples/autoreload/src/.gitkeep | 0 examples/canister/dfx.json | 7 ++- examples/canister/src/index.ts | 2 +- examples/complex_types/src/index.did | 46 +++++++++++++++++++ examples/composite_queries/dfx.json | 10 ++-- .../composite_queries/src/canister1/index.ts | 18 ++++---- .../composite_queries/src/canister2/index.ts | 2 +- examples/counter/dfx.json | 2 +- examples/cross_canister_calls/dfx.json | 4 +- .../src/canister1/index.ts | 10 ++-- examples/cycles/dfx.json | 2 +- examples/cycles/src/intermediary/index.ts | 4 +- examples/cycles/test/pretest.ts | 11 +++-- .../func_types/canisters/func_types/index.ts | 2 +- examples/func_types/dfx.json | 4 +- examples/motoko_examples/whoami/dfx.json | 2 +- examples/motoko_examples/whoami/src/index.ts | 2 +- examples/null_example/dfx.json | 2 +- examples/primitive_types/dfx.json | 2 +- examples/recursion/dfx.json | 4 +- examples/recursion/src/recursion/index.ts | 2 +- examples/rejections/dfx.json | 7 ++- examples/simple_user_accounts/dfx.json | 1 + 24 files changed, 106 insertions(+), 41 deletions(-) create mode 100644 examples/autoreload/src/.gitkeep create mode 100644 examples/complex_types/src/index.did diff --git a/examples/async_await/dfx.json b/examples/async_await/dfx.json index cd85e73384..9c6fe2a924 100644 --- a/examples/async_await/dfx.json +++ b/examples/async_await/dfx.json @@ -3,6 +3,7 @@ "async_await": { "type": "azle", "main": "src/async_await.ts", + "candid_gen": "automatic", "env": ["AZLE_TEST_FETCH"], "declarations": { "output": "test/dfx_generated/async_await", diff --git a/examples/autoreload/src/.gitkeep b/examples/autoreload/src/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/examples/canister/dfx.json b/examples/canister/dfx.json index 00e2c11a2b..afb29f81aa 100644 --- a/examples/canister/dfx.json +++ b/examples/canister/dfx.json @@ -5,7 +5,12 @@ "main": "src/index.ts", "candid_gen": "automatic", "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/some_canister.did", "src/some_canister.did"]], + "assets": [ + [ + ".azle/some_canister/some_canister.did", + "candid/some_canister.did" + ] + ], "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/examples/canister/src/index.ts b/examples/canister/src/index.ts index 18f894ea0c..ade23c7efc 100644 --- a/examples/canister/src/index.ts +++ b/examples/canister/src/index.ts @@ -46,7 +46,7 @@ export default Canister({ `icp://${getSomeCanisterPrincipal()}/update1`, { body: serialize({ - candidPath: `/src/some_canister.did` + candidPath: `/candid/some_canister.did` }) } ); diff --git a/examples/complex_types/src/index.did b/examples/complex_types/src/index.did new file mode 100644 index 0000000000..367c03853c --- /dev/null +++ b/examples/complex_types/src/index.did @@ -0,0 +1,46 @@ +type Post = record { + id: text; + author: User; + reactions: vec Reaction; + text: text; + thread: Thread; +}; + +type Reaction = record { + id: text; + author: User; + post: Post; + reactionType: ReactionType; +}; + +type ReactionType = variant { + Fire; + ThumbsUp; + ThumbsDown; +}; + +type Thread = record { + id: text; + author: User; + posts: vec Post; + title: text; +}; + +type User = record { + id: text; + posts: vec Post; + reactions: vec Reaction; + threads: vec Thread; + username: text; +}; + +service: () -> { + createPost: (text, text, text, nat32) -> (Post); + getAllPosts: (nat32) -> (vec Post) query; + createReaction: (text, text, ReactionType, nat32) -> (Reaction); + getAllReactions: (nat32) -> (vec Reaction) query; + createThread: (text, text, nat32) -> (Thread); + getAllThreads: (nat32) -> (vec Thread) query; + createUser: (text, nat32) -> (User); + getAllUsers: (nat32) -> (vec User) query; +} diff --git a/examples/composite_queries/dfx.json b/examples/composite_queries/dfx.json index 9c19b8a429..b846d6b158 100644 --- a/examples/composite_queries/dfx.json +++ b/examples/composite_queries/dfx.json @@ -11,9 +11,9 @@ "AZLE_TEST_FETCH" ], "assets": [ - ["src/canister1/index.did", "src/canister1.did"], - ["src/canister2/index.did", "src/canister2.did"], - ["src/canister3/index.did", "src/canister3.did"] + [".azle/canister1/canister1.did", "candid/canister1.did"], + [".azle/canister2/canister2.did", "candid/canister2.did"], + [".azle/canister3/canister3.did", "candid/canister3.did"] ], "declarations": { "output": "test/dfx_generated/canister1", @@ -25,7 +25,9 @@ "main": "src/canister2/index.ts", "candid_gen": "automatic", "env": ["CANISTER3_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/canister3/index.did", "src/canister3.did"]], + "assets": [ + [".azle/canister3/canister3.did", "candid/canister3.did"] + ], "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true diff --git a/examples/composite_queries/src/canister1/index.ts b/examples/composite_queries/src/canister1/index.ts index 0917c40603..8d1836a70b 100644 --- a/examples/composite_queries/src/canister1/index.ts +++ b/examples/composite_queries/src/canister1/index.ts @@ -27,7 +27,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/simpleQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -45,7 +45,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/manualQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -66,7 +66,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/manualQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -86,7 +86,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/deepQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -104,7 +104,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/updateQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -122,7 +122,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/simpleQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -140,7 +140,7 @@ const CompQueryCanister = Canister({ `icp://${getCanister2Principal()}/deepQuery`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); @@ -195,7 +195,7 @@ async function incCanister1(canister1: any) { `icp://${canister1.principal.toText()}/incCounter`, { body: serialize({ - candidPath: `/src/canister1.did` + candidPath: `/candid/canister1.did` }) } ); @@ -213,7 +213,7 @@ async function incCanister2() { `icp://${getCanister2Principal()}/incCounter`, { body: serialize({ - candidPath: `/src/canister2.did` + candidPath: `/candid/canister2.did` }) } ); diff --git a/examples/composite_queries/src/canister2/index.ts b/examples/composite_queries/src/canister2/index.ts index 255e38ae6e..de13ce52c3 100644 --- a/examples/composite_queries/src/canister2/index.ts +++ b/examples/composite_queries/src/canister2/index.ts @@ -45,7 +45,7 @@ export default Canister({ `icp://${getCanister3Principal()}/deepQuery`, { body: serialize({ - candidPath: `/src/canister3.did` + candidPath: `/candid/canister3.did` }) } ); diff --git a/examples/counter/dfx.json b/examples/counter/dfx.json index 21ed14de1f..4374e8ecf6 100644 --- a/examples/counter/dfx.json +++ b/examples/counter/dfx.json @@ -1,7 +1,7 @@ { "canisters": { "counter": { - "type": "custom", + "type": "azle", "main": "src/index.ts", "candid_gen": "automatic", "declarations": { diff --git a/examples/cross_canister_calls/dfx.json b/examples/cross_canister_calls/dfx.json index c9224a7b4c..28d9a093de 100644 --- a/examples/cross_canister_calls/dfx.json +++ b/examples/cross_canister_calls/dfx.json @@ -5,7 +5,9 @@ "main": "src/canister1/index.ts", "candid_gen": "automatic", "env": ["CANISTER2_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/canister2/index.did", "src/canister2/index.did"]], + "assets": [ + [".azle/canister2/canister2.did", "candid/canister2.did"] + ], "declarations": { "output": "test/dfx_generated/canister1", "node_compatibility": true diff --git a/examples/cross_canister_calls/src/canister1/index.ts b/examples/cross_canister_calls/src/canister1/index.ts index 4584bf9709..73ca994347 100644 --- a/examples/cross_canister_calls/src/canister1/index.ts +++ b/examples/cross_canister_calls/src/canister1/index.ts @@ -29,7 +29,7 @@ export default Canister({ `icp://${getCanister2Principal()}/transfer`, { body: serialize({ - candidPath: '/src/canister2/index.did', + candidPath: '/candid/canister2.did', args: [from, to, amount] }) } @@ -49,7 +49,7 @@ export default Canister({ `icp://${getCanister2Principal()}/balance`, { body: serialize({ - candidPath: '/src/canister2/index.did', + candidPath: '/candid/canister2.did', args: [id] }) } @@ -69,7 +69,7 @@ export default Canister({ `icp://${getCanister2Principal()}/account`, { body: serialize({ - candidPath: '/src/canister2/index.did', + candidPath: '/candid/canister2.did', args: [args] }) } @@ -93,7 +93,7 @@ export default Canister({ `icp://${getCanister2Principal()}/accounts`, { body: serialize({ - candidPath: '/src/canister2/index.did', + candidPath: '/candid/canister2.did', args: [] }) } @@ -113,7 +113,7 @@ export default Canister({ `icp://${getCanister2Principal()}/trap`, { body: serialize({ - candidPath: '/src/canister2/index.did', + candidPath: '/candid/canister2.did', args: [] }) } diff --git a/examples/cycles/dfx.json b/examples/cycles/dfx.json index 72df547f05..2f7ae3dac7 100644 --- a/examples/cycles/dfx.json +++ b/examples/cycles/dfx.json @@ -14,7 +14,7 @@ "main": "src/intermediary/index.ts", "candid_gen": "automatic", "env": ["CYCLES_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["src/cycles/index.did", "src/cycles/index.did"]], + "assets": [[".azle/cycles/cycles.did", "candid/cycles.did"]], "declarations": { "output": "test/dfx_generated/intermediary", "node_compatibility": true diff --git a/examples/cycles/src/intermediary/index.ts b/examples/cycles/src/intermediary/index.ts index 43e89437f2..27870d464f 100644 --- a/examples/cycles/src/intermediary/index.ts +++ b/examples/cycles/src/intermediary/index.ts @@ -26,7 +26,7 @@ export default Canister({ `icp://${getCyclesPrincipal()}/receiveCycles`, { body: serialize({ - candidPath: '/src/cycles/index.did', + candidPath: '/candid/cycles.did', cycles: 1_000_000n }) } @@ -50,7 +50,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://${getCyclesPrincipal()}/receiveCycles128`, { body: serialize({ - candidPath: '/src/cycles/index.did', + candidPath: '/candid/cycles.did', cycles128: 1_000_000n }) }); diff --git a/examples/cycles/test/pretest.ts b/examples/cycles/test/pretest.ts index fd2663e1ca..f69420fa86 100644 --- a/examples/cycles/test/pretest.ts +++ b/examples/cycles/test/pretest.ts @@ -10,13 +10,16 @@ async function pretest() { stdio: 'inherit' }); - execSync(`dfx canister create cycles`, { + execSync(`dfx deploy cycles`, { stdio: 'inherit' }); - execSync(`CYCLES_PRINCIPAL=${getCanisterId('cycles')} dfx deploy`, { - stdio: 'inherit' - }); + execSync( + `CYCLES_PRINCIPAL=${getCanisterId('cycles')} dfx deploy intermediary`, + { + stdio: 'inherit' + } + ); execSync(`dfx generate`, { stdio: 'inherit' diff --git a/examples/func_types/canisters/func_types/index.ts b/examples/func_types/canisters/func_types/index.ts index 4544c19f1a..71d2b555da 100644 --- a/examples/func_types/canisters/func_types/index.ts +++ b/examples/func_types/canisters/func_types/index.ts @@ -113,7 +113,7 @@ export default Canister({ `icp://${getNotifierPrincipal()}/getNotifier`, { body: serialize({ - candidPath: `/src/notifiers.did` + candidPath: `/candid/notifiers.did` }) } ); diff --git a/examples/func_types/dfx.json b/examples/func_types/dfx.json index fca9909932..a22bc2ebbe 100644 --- a/examples/func_types/dfx.json +++ b/examples/func_types/dfx.json @@ -5,7 +5,9 @@ "main": "canisters/func_types/index.ts", "candid_gen": "automatic", "env": ["NOTIFIERS_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [["canisters/notifiers/index.did", "src/notifiers.did"]], + "assets": [ + [".azle/notifiers/notifiers.did", "candid/notifiers.did"] + ], "declarations": { "output": "test/dfx_generated/func_types", "node_compatibility": true diff --git a/examples/motoko_examples/whoami/dfx.json b/examples/motoko_examples/whoami/dfx.json index a2ef795562..111546cf20 100644 --- a/examples/motoko_examples/whoami/dfx.json +++ b/examples/motoko_examples/whoami/dfx.json @@ -5,7 +5,7 @@ "main": "src/index.ts", "candid_gen": "automatic", "env": ["AZLE_TEST_FETCH"], - "assets": [["src/index.did", "src/whoami.did"]], + "assets": [[".azle/whoami/whoami.did", "candid/whoami.did"]], "declarations": { "output": "test/dfx_generated/whoami", "node_compatibility": true diff --git a/examples/motoko_examples/whoami/src/index.ts b/examples/motoko_examples/whoami/src/index.ts index 9d5cc579c0..fcc263ff3c 100644 --- a/examples/motoko_examples/whoami/src/index.ts +++ b/examples/motoko_examples/whoami/src/index.ts @@ -47,7 +47,7 @@ const WhoAmI = Canister({ `icp://${self.principal.toText()}/whoami`, { body: serialize({ - candidPath: `/src/whoami.did` + candidPath: `/candid/whoami.did` }) } ); diff --git a/examples/null_example/dfx.json b/examples/null_example/dfx.json index 6c7a8def51..cd6d083d7a 100644 --- a/examples/null_example/dfx.json +++ b/examples/null_example/dfx.json @@ -1,7 +1,7 @@ { "canisters": { "null_example": { - "type": "custom", + "type": "azle", "main": "src/index.ts", "candid_gen": "automatic", "declarations": { diff --git a/examples/primitive_types/dfx.json b/examples/primitive_types/dfx.json index 452d4bf0d7..8c155bba4b 100644 --- a/examples/primitive_types/dfx.json +++ b/examples/primitive_types/dfx.json @@ -1,7 +1,7 @@ { "canisters": { "primitive_types": { - "type": "custom", + "type": "azle", "main": "src/index.ts", "candid_gen": "automatic", "declarations": { diff --git a/examples/recursion/dfx.json b/examples/recursion/dfx.json index cb6adf4cf2..533f2dd9e7 100644 --- a/examples/recursion/dfx.json +++ b/examples/recursion/dfx.json @@ -7,8 +7,8 @@ "env": ["MY_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ [ - "src/recursive_canister/index.did", - "src/recursive_canister.did" + ".azle/recursive_canister/recursive_canister.did", + "candid/recursive_canister.did" ] ], "declarations": { diff --git a/examples/recursion/src/recursion/index.ts b/examples/recursion/src/recursion/index.ts index f761561a1e..ba163a3714 100644 --- a/examples/recursion/src/recursion/index.ts +++ b/examples/recursion/src/recursion/index.ts @@ -151,7 +151,7 @@ export default Canister({ `icp://${myFullCanister.principal.toText()}/myQuery`, { body: serialize({ - candidPath: `/src/recursive_canister.did`, + candidPath: `/candid/recursive_canister.did`, args: [myFullCanister.principal] }) } diff --git a/examples/rejections/dfx.json b/examples/rejections/dfx.json index 5068ffca94..6ca5bf3cc0 100644 --- a/examples/rejections/dfx.json +++ b/examples/rejections/dfx.json @@ -6,8 +6,11 @@ "candid_gen": "automatic", "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ - ["src/some_canister/index.did", "src/some_canister.did"], - ["src/nonexistent.did", "src/nonexistent.did"] + [ + ".azle/some_canister/some_canister.did", + "candid/some_canister.did" + ], + ["src/nonexistent.did", "candid/nonexistent.did"] ], "declarations": { "output": "test/dfx_generated/rejections", diff --git a/examples/simple_user_accounts/dfx.json b/examples/simple_user_accounts/dfx.json index 4789ad5a6e..ff8ea68f67 100644 --- a/examples/simple_user_accounts/dfx.json +++ b/examples/simple_user_accounts/dfx.json @@ -3,6 +3,7 @@ "simple_user_accounts": { "type": "azle", "main": "src/index.ts", + "candid": "src/index.did", "candid_gen": "custom", "declarations": { "output": "test/dfx_generated/simple_user_accounts", From 8eed7330bf0c1a6341b780cc4ba3d0d6c2e7b2cb Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Tue, 23 Apr 2024 15:18:37 -0500 Subject: [PATCH 06/14] update all property tests to new dfx.json --- property_tests/tests/blob/dfx.json | 19 +++--------------- property_tests/tests/bool/dfx.json | 19 +++--------------- .../canister_methods/http_request/dfx.json | 7 ++----- .../http_request_update/dfx.json | 7 ++----- .../tests/canister_methods/init/dfx.json | 7 ++----- .../canister_methods/inspect_message/dfx.json | 7 ++----- .../canister_methods/post_upgrade/dfx.json | 7 ++----- .../canister_methods/pre_upgrade/dfx.json | 7 ++----- .../tests/canister_methods/query/dfx.json | 7 ++----- .../tests/canister_methods/update/dfx.json | 7 ++----- property_tests/tests/float32/dfx.json | 19 +++--------------- property_tests/tests/float64/dfx.json | 19 +++--------------- property_tests/tests/func/dfx.json | 19 +++--------------- property_tests/tests/int/dfx.json | 19 +++--------------- property_tests/tests/int16/dfx.json | 19 +++--------------- property_tests/tests/int32/dfx.json | 19 +++--------------- property_tests/tests/int64/dfx.json | 19 +++--------------- property_tests/tests/int8/dfx.json | 19 +++--------------- property_tests/tests/nat/dfx.json | 19 +++--------------- property_tests/tests/nat16/dfx.json | 19 +++--------------- property_tests/tests/nat32/dfx.json | 19 +++--------------- property_tests/tests/nat64/dfx.json | 19 +++--------------- property_tests/tests/nat8/dfx.json | 19 +++--------------- property_tests/tests/null/dfx.json | 19 +++--------------- property_tests/tests/opt/dfx.json | 19 +++--------------- property_tests/tests/principal/dfx.json | 19 +++--------------- property_tests/tests/record/dfx.json | 19 +++--------------- property_tests/tests/recursive/dfx.json | 19 +++--------------- property_tests/tests/service/dfx.json | 20 +++---------------- .../tests/stable_b_tree_map/dfx.json | 19 +++--------------- property_tests/tests/text/dfx.json | 19 +++--------------- property_tests/tests/tuple/dfx.json | 19 +++--------------- property_tests/tests/variant/dfx.json | 19 +++--------------- property_tests/tests/vec/dfx.json | 19 +++--------------- 34 files changed, 94 insertions(+), 457 deletions(-) diff --git a/property_tests/tests/blob/dfx.json b/property_tests/tests/blob/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/blob/dfx.json +++ b/property_tests/tests/blob/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/bool/dfx.json b/property_tests/tests/bool/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/bool/dfx.json +++ b/property_tests/tests/bool/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/canister_methods/http_request/dfx.json b/property_tests/tests/canister_methods/http_request/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/http_request/dfx.json +++ b/property_tests/tests/canister_methods/http_request/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/http_request_update/dfx.json b/property_tests/tests/canister_methods/http_request_update/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/http_request_update/dfx.json +++ b/property_tests/tests/canister_methods/http_request_update/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/init/dfx.json b/property_tests/tests/canister_methods/init/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/init/dfx.json +++ b/property_tests/tests/canister_methods/init/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/inspect_message/dfx.json b/property_tests/tests/canister_methods/inspect_message/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/inspect_message/dfx.json +++ b/property_tests/tests/canister_methods/inspect_message/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/post_upgrade/dfx.json b/property_tests/tests/canister_methods/post_upgrade/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/post_upgrade/dfx.json +++ b/property_tests/tests/canister_methods/post_upgrade/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/pre_upgrade/dfx.json b/property_tests/tests/canister_methods/pre_upgrade/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/pre_upgrade/dfx.json +++ b/property_tests/tests/canister_methods/pre_upgrade/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/query/dfx.json b/property_tests/tests/canister_methods/query/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/query/dfx.json +++ b/property_tests/tests/canister_methods/query/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/canister_methods/update/dfx.json b/property_tests/tests/canister_methods/update/dfx.json index 6ab9fbd7e4..64da72016b 100644 --- a/property_tests/tests/canister_methods/update/dfx.json +++ b/property_tests/tests/canister_methods/update/dfx.json @@ -1,12 +1,9 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true diff --git a/property_tests/tests/float32/dfx.json b/property_tests/tests/float32/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/float32/dfx.json +++ b/property_tests/tests/float32/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/float64/dfx.json b/property_tests/tests/float64/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/float64/dfx.json +++ b/property_tests/tests/float64/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/func/dfx.json b/property_tests/tests/func/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/func/dfx.json +++ b/property_tests/tests/func/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/int/dfx.json b/property_tests/tests/int/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/int/dfx.json +++ b/property_tests/tests/int/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/int16/dfx.json b/property_tests/tests/int16/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/int16/dfx.json +++ b/property_tests/tests/int16/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/int32/dfx.json b/property_tests/tests/int32/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/int32/dfx.json +++ b/property_tests/tests/int32/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/int64/dfx.json b/property_tests/tests/int64/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/int64/dfx.json +++ b/property_tests/tests/int64/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/int8/dfx.json b/property_tests/tests/int8/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/int8/dfx.json +++ b/property_tests/tests/int8/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/nat/dfx.json b/property_tests/tests/nat/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/nat/dfx.json +++ b/property_tests/tests/nat/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/nat16/dfx.json b/property_tests/tests/nat16/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/nat16/dfx.json +++ b/property_tests/tests/nat16/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/nat32/dfx.json b/property_tests/tests/nat32/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/nat32/dfx.json +++ b/property_tests/tests/nat32/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/nat64/dfx.json b/property_tests/tests/nat64/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/nat64/dfx.json +++ b/property_tests/tests/nat64/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/nat8/dfx.json b/property_tests/tests/nat8/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/nat8/dfx.json +++ b/property_tests/tests/nat8/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/null/dfx.json b/property_tests/tests/null/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/null/dfx.json +++ b/property_tests/tests/null/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/opt/dfx.json b/property_tests/tests/opt/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/opt/dfx.json +++ b/property_tests/tests/opt/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/principal/dfx.json b/property_tests/tests/principal/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/principal/dfx.json +++ b/property_tests/tests/principal/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/record/dfx.json b/property_tests/tests/record/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/record/dfx.json +++ b/property_tests/tests/record/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/recursive/dfx.json b/property_tests/tests/recursive/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/recursive/dfx.json +++ b/property_tests/tests/recursive/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/service/dfx.json b/property_tests/tests/service/dfx.json index 730ef2d902..64da72016b 100644 --- a/property_tests/tests/service/dfx.json +++ b/property_tests/tests/service/dfx.json @@ -1,27 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, - "opt_level": "1", + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/stable_b_tree_map/dfx.json b/property_tests/tests/stable_b_tree_map/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/stable_b_tree_map/dfx.json +++ b/property_tests/tests/stable_b_tree_map/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/text/dfx.json b/property_tests/tests/text/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/text/dfx.json +++ b/property_tests/tests/text/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/tuple/dfx.json b/property_tests/tests/tuple/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/tuple/dfx.json +++ b/property_tests/tests/tuple/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/variant/dfx.json b/property_tests/tests/variant/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/variant/dfx.json +++ b/property_tests/tests/variant/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } diff --git a/property_tests/tests/vec/dfx.json b/property_tests/tests/vec/dfx.json index 1489081c0b..64da72016b 100644 --- a/property_tests/tests/vec/dfx.json +++ b/property_tests/tests/vec/dfx.json @@ -1,26 +1,13 @@ { "canisters": { "canister": { - "type": "custom", + "type": "azle", "main": "src/index.ts", - "candid": "src/index.did", - "build": "npx azle canister", - "wasm": ".azle/canister/canister.wasm", - "gzip": true, + "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true - }, - "metadata": [ - { - "name": "candid:service", - "path": "src/index.did" - }, - { - "name": "cdk:name", - "content": "azle" - } - ] + } } } } From a4187b1036e6d57ff9fffc0977da9d7b1c939a13 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 24 Apr 2024 07:20:39 -0500 Subject: [PATCH 07/14] fix remaining failing tests, canister did files are now included automatically in the canister /candid directory --- examples/composite_queries/dfx.json | 1 - examples/motoko_examples/whoami/dfx.json | 1 - examples/rejections/src/rejections/index.ts | 10 +++++----- examples/rejections/test/pretest.ts | 6 ++++-- src/compiler/index.ts | 20 ++++++++++++++++++++ 5 files changed, 29 insertions(+), 9 deletions(-) diff --git a/examples/composite_queries/dfx.json b/examples/composite_queries/dfx.json index b846d6b158..1f1eed988d 100644 --- a/examples/composite_queries/dfx.json +++ b/examples/composite_queries/dfx.json @@ -11,7 +11,6 @@ "AZLE_TEST_FETCH" ], "assets": [ - [".azle/canister1/canister1.did", "candid/canister1.did"], [".azle/canister2/canister2.did", "candid/canister2.did"], [".azle/canister3/canister3.did", "candid/canister3.did"] ], diff --git a/examples/motoko_examples/whoami/dfx.json b/examples/motoko_examples/whoami/dfx.json index 111546cf20..87de31486b 100644 --- a/examples/motoko_examples/whoami/dfx.json +++ b/examples/motoko_examples/whoami/dfx.json @@ -5,7 +5,6 @@ "main": "src/index.ts", "candid_gen": "automatic", "env": ["AZLE_TEST_FETCH"], - "assets": [[".azle/whoami/whoami.did", "candid/whoami.did"]], "declarations": { "output": "test/dfx_generated/whoami", "node_compatibility": true diff --git a/examples/rejections/src/rejections/index.ts b/examples/rejections/src/rejections/index.ts index dfe32d6f7c..236ed59df4 100644 --- a/examples/rejections/src/rejections/index.ts +++ b/examples/rejections/src/rejections/index.ts @@ -33,7 +33,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://${getSomeCanisterPrincipal()}/accept`, { body: serialize({ - candidPath: `/src/some_canister.did` + candidPath: `/candid/some_canister.did` }) }); } else { @@ -47,7 +47,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://rkp4c-7iaaa-aaaaa-aaaca-cai/method`, { body: serialize({ - candidPath: `/src/nonexistent.did` + candidPath: `/candid/nonexistent.did` }) }); } else { @@ -64,7 +64,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://${getSomeCanisterPrincipal()}/reject`, { body: serialize({ - candidPath: `/src/some_canister.did`, + candidPath: `/candid/some_canister.did`, args: ['reject'] }) }); @@ -82,7 +82,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://${getSomeCanisterPrincipal()}/error`, { body: serialize({ - candidPath: `/src/some_canister.did` + candidPath: `/candid/some_canister.did` }) }); } else { @@ -99,7 +99,7 @@ export default Canister({ if (process.env.AZLE_TEST_FETCH === 'true') { await fetch(`icp://${getSomeCanisterPrincipal()}/reject`, { body: serialize({ - candidPath: `/src/some_canister.did`, + candidPath: `/candid/some_canister.did`, args: [message] }) }); diff --git a/examples/rejections/test/pretest.ts b/examples/rejections/test/pretest.ts index 198e35169b..09972190a2 100644 --- a/examples/rejections/test/pretest.ts +++ b/examples/rejections/test/pretest.ts @@ -10,12 +10,14 @@ async function pretest() { stdio: 'inherit' }); - execSync(`dfx canister create some_canister`, { + execSync(`dfx deploy some_canister`, { stdio: 'inherit' }); execSync( - `SOME_CANISTER_PRINCIPAL=${getCanisterId('some_canister')} dfx deploy`, + `SOME_CANISTER_PRINCIPAL=${getCanisterId( + 'some_canister' + )} dfx deploy rejections`, { stdio: 'inherit' } diff --git a/src/compiler/index.ts b/src/compiler/index.ts index bfb082b652..8db9de495b 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -114,6 +114,8 @@ async function azle() { nativeCompilation ); + addCanisterDidToAssets(canisterPath, canisterName, candid); + // This is for the dfx.json candid property writeFileSync(candidPath, candid); @@ -156,3 +158,21 @@ function installDfxExtension(stdioType: IOType) { stdioType ); } + +function addCanisterDidToAssets( + canisterPath: string, + canisterName: string, + candid: string +) { + writeFileSync( + join( + canisterPath, + 'canister', + 'src', + 'assets', + 'candid', + `${canisterName}.did` + ), + candid + ); +} From 1975a4704f513a45e31bf8cefa6c0e330e47c765 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 24 Apr 2024 07:30:53 -0500 Subject: [PATCH 08/14] change global candid file paths to scope icp/default files --- examples/ckbtc/wallet/backend/index.ts | 4 ++-- examples/icrc/canisters/proxy/index.ts | 26 +++++++++++------------ src/compiler/utils/get_canister_config.ts | 4 ++-- src/lib/fetch/icp.ts | 7 ++---- the_azle_book/src/bitcoin.md | 2 +- 5 files changed, 20 insertions(+), 23 deletions(-) diff --git a/examples/ckbtc/wallet/backend/index.ts b/examples/ckbtc/wallet/backend/index.ts index 1d01431f6c..10f48db8be 100644 --- a/examples/ckbtc/wallet/backend/index.ts +++ b/examples/ckbtc/wallet/backend/index.ts @@ -35,7 +35,7 @@ export default Canister({ `icp://${getCkBtcPrincipal()}/icrc1_balance_of`, { body: serialize({ - candidPath: `/candid/icrc.did`, + candidPath: `/candid/icp/icrc.did`, args: [ { owner: ic.id(), @@ -146,7 +146,7 @@ export default Canister({ `icp://${getCkBtcPrincipal()}/icrc1_transfer`, { body: serialize({ - candidPath: `/candid/icrc.did`, + candidPath: `/candid/icp/icrc.did`, args: [ { from_subaccount: [ diff --git a/examples/icrc/canisters/proxy/index.ts b/examples/icrc/canisters/proxy/index.ts index 716a66e145..1d5b284e9d 100644 --- a/examples/icrc/canisters/proxy/index.ts +++ b/examples/icrc/canisters/proxy/index.ts @@ -42,7 +42,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_metadata`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -59,7 +59,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_name`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -76,7 +76,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_decimals`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -93,7 +93,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_symbol`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -110,7 +110,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_fee`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -127,7 +127,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_total_supply`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -144,7 +144,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_minting_account`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -165,7 +165,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_balance_of`, { body: serialize({ - candidPath: '/candid/icrc.did', + candidPath: '/candid/icp/icrc.did', args: [ { ...account, @@ -195,7 +195,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_transfer`, { body: serialize({ - candidPath: '/candid/icrc.did', + candidPath: '/candid/icp/icrc.did', args: [ { ...transferArgs, @@ -234,7 +234,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc1_supported_standards`, { body: serialize({ - candidPath: '/candid/icrc.did' + candidPath: '/candid/icp/icrc.did' }) } ); @@ -251,7 +251,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc2_approve`, { body: serialize({ - candidPath: '/candid/icrc.did', + candidPath: '/candid/icp/icrc.did', args: [ { ...approveArgs, @@ -298,7 +298,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc2_transfer_from`, { body: serialize({ - candidPath: '/candid/icrc.did', + candidPath: '/candid/icp/icrc.did', args: [ { ...transferFromArgs, @@ -350,7 +350,7 @@ export default Canister({ `icp://${getIcrcPrincipal()}/icrc2_allowance`, { body: serialize({ - candidPath: '/candid/icrc.did', + candidPath: '/candid/icp/icrc.did', args: [ { ...allowanceArgs, diff --git a/src/compiler/utils/get_canister_config.ts b/src/compiler/utils/get_canister_config.ts index 2c9721f2f5..87a23ee7a1 100644 --- a/src/compiler/utils/get_canister_config.ts +++ b/src/compiler/utils/get_canister_config.ts @@ -57,11 +57,11 @@ export function getCanisterConfig( ...(canisterConfig.assets ?? []), [ join(require.main?.path, 'canisters', 'icrc', 'icrc.did'), - join('candid', 'icrc.did') + join('candid', 'icp', 'icrc.did') ], [ join(require.main?.path, 'canisters', 'management', 'ic.did'), - join('candid', 'aaaaa-aa.did') + join('candid', 'icp', 'management.did') ] ] }); diff --git a/src/lib/fetch/icp.ts b/src/lib/fetch/icp.ts index 6e39a9b7fe..9fc5feb0b8 100644 --- a/src/lib/fetch/icp.ts +++ b/src/lib/fetch/icp.ts @@ -1,5 +1,4 @@ import { IDL } from '@dfinity/candid'; -import { existsSync } from 'fs'; import { ic, Principal } from '../'; import { getUrl } from './url'; @@ -89,10 +88,8 @@ function determineCandidPath(canisterId: string, candidPath?: string): string { return candidPath; } - const filePath = `/candid/${canisterId}.did`; - - if (existsSync(filePath)) { - return filePath; + if (canisterId === 'aaaaa-aa') { + return `/candid/icp/management.did`; } throw new Error( diff --git a/the_azle_book/src/bitcoin.md b/the_azle_book/src/bitcoin.md index d9e0a988d4..0c3fc0f1fe 100644 --- a/the_azle_book/src/bitcoin.md +++ b/the_azle_book/src/bitcoin.md @@ -59,7 +59,7 @@ const response = await fetch( `icp://mc6ru-gyaaa-aaaar-qaaaq-cai/icrc1_balance_of`, { body: serialize({ - candidPath: `/candid/icrc.did`, + candidPath: `/candid/icp/icrc.did`, args: [ { owner: ic.id(), From da81ce2b650f0be215a1819e4c12c8c92d1af09b Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Wed, 24 Apr 2024 08:20:06 -0500 Subject: [PATCH 09/14] add the shebang --- dfx_extension/install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dfx_extension/install.sh b/dfx_extension/install.sh index 2987455008..b24bf06e90 100755 --- a/dfx_extension/install.sh +++ b/dfx_extension/install.sh @@ -1,3 +1,5 @@ +#!/bin/bash + DFX_CACHE_DIR="$(dfx cache show)" dfx cache install mkdir -p "$DFX_CACHE_DIR/extensions/azle" From 4d08dca40faf9007205c4e54c40d3cffe1bc5847 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 25 Apr 2024 06:59:54 -0500 Subject: [PATCH 10/14] only run dfx cache install if the cache directory does not yet exist --- dfx_extension/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dfx_extension/install.sh b/dfx_extension/install.sh index b24bf06e90..1ee9cec1a3 100755 --- a/dfx_extension/install.sh +++ b/dfx_extension/install.sh @@ -1,6 +1,10 @@ #!/bin/bash DFX_CACHE_DIR="$(dfx cache show)" -dfx cache install + +if [ ! -d "$DFX_CACHE_DIR" ]; then + dfx cache install +fi + mkdir -p "$DFX_CACHE_DIR/extensions/azle" cp extension.json "$DFX_CACHE_DIR/extensions/azle/extension.json" From 89bdc0c999d0089c731e96d2eebc36a679e3570e Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 25 Apr 2024 07:05:11 -0500 Subject: [PATCH 11/14] keep extension version up to date with azle version during release --- dfx_extension/extension.json | 2 +- publish-github-action.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/dfx_extension/extension.json b/dfx_extension/extension.json index b1e433059b..2cc6e20005 100644 --- a/dfx_extension/extension.json +++ b/dfx_extension/extension.json @@ -1,6 +1,6 @@ { "name": "azle", - "version": "0.21.1", + "version": "0.0.0", "homepage": "https://github.com/dfinity/dfx-extensions", "authors": "", "summary": "", diff --git a/publish-github-action.sh b/publish-github-action.sh index 91f132d4d7..41104ab280 100755 --- a/publish-github-action.sh +++ b/publish-github-action.sh @@ -11,6 +11,7 @@ directories_json_string="${directories_json_string_with_linebreaks//$'\\n'/''}" directories=$(echo "$directories_json_string" | jq -c -r '.[]') sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json +sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json npm install if [[ "$VERSION" == *"-rc."* ]]; From fe696e10509672ad11591f2263b28682e67175fb Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 25 Apr 2024 07:12:22 -0500 Subject: [PATCH 12/14] put dfx.json field check back in place just for main --- src/compiler/utils/get_canister_config.ts | 38 +++++++++-------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/src/compiler/utils/get_canister_config.ts b/src/compiler/utils/get_canister_config.ts index 87a23ee7a1..1ed536bab8 100644 --- a/src/compiler/utils/get_canister_config.ts +++ b/src/compiler/utils/get_canister_config.ts @@ -29,23 +29,20 @@ export function getCanisterConfig( }); } - // const { main, candid } = canisterConfig; + const { main } = canisterConfig; - // if (!main || !candid) { - // const missingFields = [ - // ['"main"', main], - // ['"candid"', candid] - // ] - // .filter(([_, value]) => !value) - // .map(([field, _]) => field); - // const fieldOrFields = missingFields.length === 1 ? 'field' : 'fields'; - // const missingFieldNames = missingFields.join(', '); - // return Err({ - // error: `Missing ${fieldOrFields} ${missingFieldNames} in ./dfx.json`, - // suggestion: `Make sure your dfx.json looks similar to the following:\n\n${exampleDfxJson}`, - // exitCode: 4 - // }); - // } + if (main === undefined) { + const missingFields = [['"main"', main]] + .filter(([_, value]) => !value) + .map(([field, _]) => field); + const fieldOrFields = missingFields.length === 1 ? 'field' : 'fields'; + const missingFieldNames = missingFields.join(', '); + return Err({ + error: `Missing ${fieldOrFields} ${missingFieldNames} in ./dfx.json`, + suggestion: `Make sure your dfx.json looks similar to the following:\n\n${exampleDfxJson}`, + exitCode: 4 + }); + } if (require.main?.path === undefined) { throw new Error(`require.main?.path must be defined`); @@ -71,13 +68,8 @@ function colorFormattedDfxJsonExample(canisterName: string): string { return ` ${yellow('{')} ${red('"canisters"')}: ${purple('{')} ${red(`"${canisterName}"`)}: ${blue('{')} - ${red('"type"')}: ${green('"custom"')}, - ${red('"main"')}: ${green('"src/index.ts"')}, - ${red('"build"')}: ${green(`"npx azle ${canisterName}"`)}, - ${red('"candid"')}: ${green('"src/index.did"')}, - ${red('"wasm"')}: ${green( - `".azle/${canisterName}/${canisterName}.wasm"` - )}, + ${red('"type"')}: ${green('"azle"')}, + ${red('"main"')}: ${green('"src/index.ts"')} ${blue('}')} ${purple('}')} ${yellow('}')}`; From df6853925b768684aa6cd8b624601260fbb90921 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 25 Apr 2024 07:14:05 -0500 Subject: [PATCH 13/14] put the default value for candid_gen back in its original location, but change it to http --- src/compiler/get_candid_and_canister_methods.ts | 2 +- src/compiler/index.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/get_candid_and_canister_methods.ts b/src/compiler/get_candid_and_canister_methods.ts index e902fa1cfd..fc62cee109 100644 --- a/src/compiler/get_candid_and_canister_methods.ts +++ b/src/compiler/get_candid_and_canister_methods.ts @@ -7,7 +7,7 @@ import { generateCandidAndCanisterMethods } from './generate_candid_and_canister import { CandidGen, CanisterMethods, CompilerInfo } from './utils/types'; export function getCandidAndCanisterMethods( - candidGen: CandidGen, + candidGen: CandidGen = 'http', candidPath: string, compilerInfoPath: string, dockerContainerName: string, diff --git a/src/compiler/index.ts b/src/compiler/index.ts index 8db9de495b..fb9300102d 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -102,7 +102,7 @@ async function azle() { ); const { candid, canisterMethods } = getCandidAndCanisterMethods( - canisterConfig.candid_gen ?? 'http', + canisterConfig.candid_gen, candidPath, compilerInfoPath, dockerContainerName, From 0b7517295164e5e3f5025942aef2daca9536a8cf Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Thu, 25 Apr 2024 08:07:14 -0500 Subject: [PATCH 14/14] remove all examples where the candid file is accessed at .azle --- examples/canister/dfx.json | 8 ++------ examples/canister/src/some_canister.did | 4 ++++ examples/composite_queries/dfx.json | 10 +++++----- examples/composite_queries/src/canister2/index.did | 7 +++++++ examples/composite_queries/src/canister3/index.did | 3 +++ examples/cross_canister_calls/dfx.json | 5 ++--- examples/cross_canister_calls/src/canister2/index.did | 9 +++++++++ examples/cycles/dfx.json | 3 ++- examples/cycles/src/cycles/index.did | 6 ++++++ examples/func_types/canisters/notifiers/index.did | 3 +++ examples/func_types/dfx.json | 3 ++- examples/recursion/dfx.json | 3 ++- examples/recursion/src/recursive_canister/index.did | 6 ++++++ examples/rejections/dfx.json | 6 ++---- examples/rejections/src/some_canister/index.did | 5 +++++ 15 files changed, 60 insertions(+), 21 deletions(-) create mode 100644 examples/canister/src/some_canister.did create mode 100644 examples/composite_queries/src/canister2/index.did create mode 100644 examples/composite_queries/src/canister3/index.did create mode 100644 examples/cross_canister_calls/src/canister2/index.did create mode 100644 examples/cycles/src/cycles/index.did create mode 100644 examples/func_types/canisters/notifiers/index.did create mode 100644 examples/recursion/src/recursive_canister/index.did create mode 100644 examples/rejections/src/some_canister/index.did diff --git a/examples/canister/dfx.json b/examples/canister/dfx.json index afb29f81aa..0e29c3875a 100644 --- a/examples/canister/dfx.json +++ b/examples/canister/dfx.json @@ -5,12 +5,7 @@ "main": "src/index.ts", "candid_gen": "automatic", "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [ - [ - ".azle/some_canister/some_canister.did", - "candid/some_canister.did" - ] - ], + "assets": [["src/some_canister.did", "candid/some_canister.did"]], "declarations": { "output": "test/dfx_generated/canister", "node_compatibility": true @@ -19,6 +14,7 @@ "some_canister": { "type": "azle", "main": "src/some_canister.ts", + "candid": "src/some_canister.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/some_canister", diff --git a/examples/canister/src/some_canister.did b/examples/canister/src/some_canister.did new file mode 100644 index 0000000000..f61de65f9f --- /dev/null +++ b/examples/canister/src/some_canister.did @@ -0,0 +1,4 @@ +service: () -> { + query1: () -> (bool) query; + update1: () -> (text); +} diff --git a/examples/composite_queries/dfx.json b/examples/composite_queries/dfx.json index 1f1eed988d..9dde8280a5 100644 --- a/examples/composite_queries/dfx.json +++ b/examples/composite_queries/dfx.json @@ -11,8 +11,8 @@ "AZLE_TEST_FETCH" ], "assets": [ - [".azle/canister2/canister2.did", "candid/canister2.did"], - [".azle/canister3/canister3.did", "candid/canister3.did"] + ["src/canister2/index.did", "candid/canister2.did"], + ["src/canister3/index.did", "candid/canister3.did"] ], "declarations": { "output": "test/dfx_generated/canister1", @@ -22,11 +22,10 @@ "canister2": { "type": "azle", "main": "src/canister2/index.ts", + "candid": "src/canister2/index.did", "candid_gen": "automatic", "env": ["CANISTER3_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [ - [".azle/canister3/canister3.did", "candid/canister3.did"] - ], + "assets": [["src/canister3/index.did", "candid/canister3.did"]], "declarations": { "output": "test/dfx_generated/canister2", "node_compatibility": true @@ -35,6 +34,7 @@ "canister3": { "type": "azle", "main": "src/canister3/index.ts", + "candid": "src/canister3/index.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister3", diff --git a/examples/composite_queries/src/canister2/index.did b/examples/composite_queries/src/canister2/index.did new file mode 100644 index 0000000000..01f39353d7 --- /dev/null +++ b/examples/composite_queries/src/canister2/index.did @@ -0,0 +1,7 @@ +service: () -> { + deepQuery: () -> (text) query; + incCounter: () -> (nat) query; + manualQuery: () -> (text) query; + simpleQuery: () -> (text) query; + updateQuery: () -> (text); +} diff --git a/examples/composite_queries/src/canister3/index.did b/examples/composite_queries/src/canister3/index.did new file mode 100644 index 0000000000..78eacc0a1e --- /dev/null +++ b/examples/composite_queries/src/canister3/index.did @@ -0,0 +1,3 @@ +service: () -> { + deepQuery: () -> (text) query; +} diff --git a/examples/cross_canister_calls/dfx.json b/examples/cross_canister_calls/dfx.json index 28d9a093de..45c879e55e 100644 --- a/examples/cross_canister_calls/dfx.json +++ b/examples/cross_canister_calls/dfx.json @@ -5,9 +5,7 @@ "main": "src/canister1/index.ts", "candid_gen": "automatic", "env": ["CANISTER2_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [ - [".azle/canister2/canister2.did", "candid/canister2.did"] - ], + "assets": [["src/canister2/index.did", "candid/canister2.did"]], "declarations": { "output": "test/dfx_generated/canister1", "node_compatibility": true @@ -16,6 +14,7 @@ "canister2": { "type": "azle", "main": "src/canister2/index.ts", + "candid": "src/canister2/index.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/canister2", diff --git a/examples/cross_canister_calls/src/canister2/index.did b/examples/cross_canister_calls/src/canister2/index.did new file mode 100644 index 0000000000..25c20581d3 --- /dev/null +++ b/examples/cross_canister_calls/src/canister2/index.did @@ -0,0 +1,9 @@ +service: () -> { + account: (record {id:text}) -> (opt record {id:text; balance:nat64}) query; + accounts: () -> (vec record {id:text; balance:nat64}) query; + balance: (text) -> (nat64) query; + getNotification: () -> (text) query; + receiveNotification: (text) -> (); + transfer: (text, text, nat64) -> (nat64); + trap: () -> (text) query; +} diff --git a/examples/cycles/dfx.json b/examples/cycles/dfx.json index 2f7ae3dac7..ceaf4fcbc2 100644 --- a/examples/cycles/dfx.json +++ b/examples/cycles/dfx.json @@ -3,6 +3,7 @@ "cycles": { "type": "azle", "main": "src/cycles/index.ts", + "candid": "src/cycles/index.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/cycles", @@ -14,7 +15,7 @@ "main": "src/intermediary/index.ts", "candid_gen": "automatic", "env": ["CYCLES_PRINCIPAL", "AZLE_TEST_FETCH"], - "assets": [[".azle/cycles/cycles.did", "candid/cycles.did"]], + "assets": [["src/cycles/index.did", "candid/cycles.did"]], "declarations": { "output": "test/dfx_generated/intermediary", "node_compatibility": true diff --git a/examples/cycles/src/cycles/index.did b/examples/cycles/src/cycles/index.did new file mode 100644 index 0000000000..0d3dfd51c0 --- /dev/null +++ b/examples/cycles/src/cycles/index.did @@ -0,0 +1,6 @@ +service: () -> { + getCanisterBalance: () -> (nat64) query; + getCanisterBalance128: () -> (nat) query; + receiveCycles: () -> (nat64); + receiveCycles128: () -> (nat); +} diff --git a/examples/func_types/canisters/notifiers/index.did b/examples/func_types/canisters/notifiers/index.did new file mode 100644 index 0000000000..9ea58c8334 --- /dev/null +++ b/examples/func_types/canisters/notifiers/index.did @@ -0,0 +1,3 @@ +service: () -> { + getNotifier: () -> (func (vec nat8) -> () oneway) query; +} diff --git a/examples/func_types/dfx.json b/examples/func_types/dfx.json index a22bc2ebbe..4d7c1c6232 100644 --- a/examples/func_types/dfx.json +++ b/examples/func_types/dfx.json @@ -6,7 +6,7 @@ "candid_gen": "automatic", "env": ["NOTIFIERS_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ - [".azle/notifiers/notifiers.did", "candid/notifiers.did"] + ["canisters/notifiers/index.did", "candid/notifiers.did"] ], "declarations": { "output": "test/dfx_generated/func_types", @@ -16,6 +16,7 @@ "notifiers": { "type": "azle", "main": "canisters/notifiers/index.ts", + "candid": "canisters/notifiers/index.did", "candid_gen": "automatic", "env": ["NOTIFIERS_PRINCIPAL"], "declarations": { diff --git a/examples/recursion/dfx.json b/examples/recursion/dfx.json index 533f2dd9e7..e8976930dc 100644 --- a/examples/recursion/dfx.json +++ b/examples/recursion/dfx.json @@ -7,7 +7,7 @@ "env": ["MY_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ [ - ".azle/recursive_canister/recursive_canister.did", + "src/recursive_canister/index.did", "candid/recursive_canister.did" ] ], @@ -19,6 +19,7 @@ "recursive_canister": { "type": "azle", "main": "src/recursive_canister/index.ts", + "candid": "src/recursive_canister/index.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/recursive_canister", diff --git a/examples/recursion/src/recursive_canister/index.did b/examples/recursion/src/recursive_canister/index.did new file mode 100644 index 0000000000..7c6f8c66e8 --- /dev/null +++ b/examples/recursion/src/recursive_canister/index.did @@ -0,0 +1,6 @@ +type rec_0 = service {getMessage: () -> (text) query; myQuery: (rec_0) -> (rec_0) query;}; +type rec_1 = service {getMessage: () -> (text) query; myQuery: (rec_1) -> (rec_1) query;}; +service: (text) -> { + getMessage: () -> (text) query; + myQuery: (rec_0) -> (rec_1) query; +} diff --git a/examples/rejections/dfx.json b/examples/rejections/dfx.json index 6ca5bf3cc0..28a0b93882 100644 --- a/examples/rejections/dfx.json +++ b/examples/rejections/dfx.json @@ -6,10 +6,7 @@ "candid_gen": "automatic", "env": ["SOME_CANISTER_PRINCIPAL", "AZLE_TEST_FETCH"], "assets": [ - [ - ".azle/some_canister/some_canister.did", - "candid/some_canister.did" - ], + ["src/some_canister/index.did", "candid/some_canister.did"], ["src/nonexistent.did", "candid/nonexistent.did"] ], "declarations": { @@ -20,6 +17,7 @@ "some_canister": { "type": "azle", "main": "src/some_canister/index.ts", + "candid": "src/some_canister/index.did", "candid_gen": "automatic", "declarations": { "output": "test/dfx_generated/some_canister", diff --git a/examples/rejections/src/some_canister/index.did b/examples/rejections/src/some_canister/index.did new file mode 100644 index 0000000000..4cef085492 --- /dev/null +++ b/examples/rejections/src/some_canister/index.did @@ -0,0 +1,5 @@ +service: () -> { + accept: () -> (bool) query; + error: () -> (empty) query; + reject: (text) -> (empty) query; +}