@ohos-ports/azle 0.33.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.scripts/add_metadata_to_dfx_json.js +54 -0
- package/.scripts/cargo_expand.sh +17 -0
- package/.scripts/class_migration/add_example_dependency.js +54 -0
- package/.scripts/class_migration/change_to_custom_candid_gen.js +76 -0
- package/.scripts/class_migration/clean_package.js +27 -0
- package/.scripts/class_migration/copy_generated_candid_from_example.js +90 -0
- package/.scripts/class_migration/delete_tests_file.js +22 -0
- package/.scripts/class_migration/do_all_packages.js +61 -0
- package/.scripts/class_migration/modify_pretest.js +57 -0
- package/.scripts/class_migration/name_package.js +62 -0
- package/.scripts/class_migration/update_test.js +38 -0
- package/.scripts/class_migration/update_ts_config.js +48 -0
- package/.scripts/class_migration/update_typescript.js +99 -0
- package/.scripts/clean_all_projects.ts +91 -0
- package/.scripts/delete_git_branches.sh +20 -0
- package/.scripts/dev_dependencies/add_dev_dependencies.js +53 -0
- package/.scripts/dev_dependencies/remove_dev_dependencies.js +44 -0
- package/.scripts/examples-survey.json +5651 -0
- package/.scripts/file_generator/bin.js +4 -0
- package/.scripts/file_generator/index.ts +59 -0
- package/.scripts/file_generator/main.ts +55 -0
- package/.scripts/find_multiline_files.ts +101 -0
- package/.scripts/hash_file.ts +9 -0
- package/.scripts/hash_file_by_parts/bin.js +4 -0
- package/.scripts/hash_file_by_parts/index.ts +48 -0
- package/.scripts/hash_file_by_parts/main.ts +10 -0
- package/.scripts/jest_isolate_modules.js +29 -0
- package/.scripts/jest_migration.sh +31 -0
- package/.scripts/reorder_dfx_json.js +72 -0
- package/.scripts/setup_release_branch.sh +34 -0
- package/.scripts/simplify_tsconfig.js +37 -0
- package/.scripts/survey_examples.ts +396 -0
- package/.scripts/tsx_migration/ts_node_to_tsx.js +76 -0
- package/.scripts/update_candid.sh +40 -0
- package/.scripts/update_dfx_json_main.js +66 -0
- package/.scripts/update_dfx_json_with_optimize.py +22 -0
- package/.scripts/update_jest_configs.ts +248 -0
- package/LICENSE +21 -0
- package/LICENSE_EXTENSION.md +42 -0
- package/NOTICE +222 -0
- package/README.md +78 -0
- package/dist/canister_templates/experimental.wasm +0 -0
- package/dist/canister_templates/licenses.yml +29186 -0
- package/dist/canister_templates/stable.wasm +0 -0
- package/examples/README.md +22 -0
- package/examples/experimental/demo/hello_world_http_server/README.md +120 -0
- package/examples/experimental/demo/hello_world_http_server/benchmarks.json +42 -0
- package/examples/experimental/demo/hello_world_http_server/benchmarks.md +28 -0
- package/examples/experimental/demo/hello_world_http_server/dfx.json +13 -0
- package/examples/experimental/demo/hello_world_http_server/env.d.ts +9 -0
- package/examples/experimental/demo/hello_world_http_server/jest.config.js +10 -0
- package/examples/experimental/demo/hello_world_http_server/package-lock.json +8409 -0
- package/examples/experimental/demo/hello_world_http_server/package.json +20 -0
- package/examples/experimental/demo/hello_world_http_server/src/backend/index.ts +23 -0
- package/examples/experimental/demo/hello_world_http_server/src/frontend/index.html +16 -0
- package/examples/experimental/demo/hello_world_http_server/src/frontend/index.ts +62 -0
- package/examples/experimental/demo/hello_world_http_server/test/pretest.ts +13 -0
- package/examples/experimental/demo/hello_world_http_server/test/test.ts +9 -0
- package/examples/experimental/demo/hello_world_http_server/test/tests.ts +27 -0
- package/examples/experimental/demo/hello_world_http_server/tsconfig.json +13 -0
- package/examples/package-lock.json +8746 -0
- package/examples/package.json +17 -0
- package/examples/stable/demo/hello_world/README.md +97 -0
- package/examples/stable/demo/hello_world/benchmarks.json +28 -0
- package/examples/stable/demo/hello_world/benchmarks.md +26 -0
- package/examples/stable/demo/hello_world/dfx.json +12 -0
- package/examples/stable/demo/hello_world/jest.config.js +10 -0
- package/examples/stable/demo/hello_world/package-lock.json +5524 -0
- package/examples/stable/demo/hello_world/package.json +14 -0
- package/examples/stable/demo/hello_world/src/index.ts +15 -0
- package/examples/stable/demo/hello_world/test/pretest.ts +17 -0
- package/examples/stable/demo/hello_world/test/test.ts +15 -0
- package/examples/stable/demo/hello_world/test/tests.ts +27 -0
- package/examples/stable/demo/hello_world/tsconfig.json +10 -0
- package/jest.config.dev.js +10 -0
- package/package.json +102 -0
- package/src/build.ts +98 -0
- package/src/experimental/build/assert_experimental.ts +5 -0
- package/src/experimental/build/commands/build/candid_and_method_meta.ts +30 -0
- package/src/experimental/build/commands/build/custom_js_modules/acorn/acorn.ts +6 -0
- package/src/experimental/build/commands/build/custom_js_modules/acorn/walk.ts +6 -0
- package/src/experimental/build/commands/build/custom_js_modules/async_hooks.ts +11 -0
- package/src/experimental/build/commands/build/custom_js_modules/https.ts +6 -0
- package/src/experimental/build/commands/build/custom_js_modules/perf_hooks.ts +12 -0
- package/src/experimental/build/commands/build/file_watcher/file_watcher.ts +152 -0
- package/src/experimental/build/commands/build/file_watcher/file_watcher_loader.js +9 -0
- package/src/experimental/build/commands/build/file_watcher/setup_file_watcher.ts +61 -0
- package/src/experimental/build/commands/build/get_context.ts +61 -0
- package/src/experimental/build/commands/build/index.ts +87 -0
- package/src/experimental/build/commands/build/javascript.ts +194 -0
- package/src/experimental/build/commands/build/wasm_binary/index.ts +32 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/Cargo.toml +26 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/autoreload.rs +46 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/benchmarking.rs +35 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/candid.rs +106 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/chunk.rs +11 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/execute_method_js.rs +46 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/guards.rs +9 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/accept_message.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/call_raw.rs +265 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/candid_compiler.rs +19 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/candid_decode.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/candid_encode.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/canister_cycle_balance.rs +12 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/canister_self.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/canister_version.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/certified_data_set.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/clear_timer.rs +18 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/cycles_burn.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/data_certificate.rs +13 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/debug_print.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/drain_microtasks.rs +23 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/in_replicated_execution.rs +8 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/is_controller.rs +16 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/mod.rs +351 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_arg_data.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_caller.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_cycles_accept.rs +17 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_cycles_available.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_cycles_refunded.rs +10 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_method_name.rs +8 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_reject.rs +16 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_reject_code.rs +8 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_reject_msg.rs +8 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/msg_reply.rs +19 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/notify_raw.rs +65 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/performance_counter.rs +19 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/rand_bytes.rs +25 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/rand_seed.rs +30 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/set_timer.rs +83 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/set_timer_interval.rs +66 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_contains_key.rs +32 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_get.rs +36 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_init.rs +29 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_insert.rs +46 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_is_empty.rs +23 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_items.rs +59 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_keys.rs +54 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_len.rs +23 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_remove.rs +36 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/stable_b_tree_map_values.rs +54 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/time.rs +8 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/ic/trap.rs +14 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/init_and_post_upgrade.rs +212 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/internal_canister_methods.rs +142 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/lib.rs +35 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/stable_b_tree_map.rs +50 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/bytes_to_human_readable.rs +20 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/file_info.rs +60 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/hash.rs +111 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/mod.rs +20 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/reset.rs +15 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/upload_file/upload_file_chunk.rs +88 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/wasm_binary_manipulation.rs +276 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/web_assembly/instantiate.rs +195 -0
- package/src/experimental/build/commands/build/wasm_binary/rust/experimental_canister_template/src/web_assembly/mod.rs +24 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/bytes_to_human_readable.ts +27 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/expand_paths.ts +50 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/get_files_to_upload.ts +21 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/incomplete_files.ts +28 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/index.ts +43 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/on_before_exit.ts +34 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/upload_file.ts +91 -0
- package/src/experimental/build/commands/upload_assets/file_uploader/uploader_actor.ts +51 -0
- package/src/experimental/build/commands/upload_assets/index.ts +16 -0
- package/src/experimental/build/commands/upload_assets/uploader_identity.ts +23 -0
- package/src/experimental/build/index.ts +61 -0
- package/src/experimental/build/utils/dfx.ts +212 -0
- package/src/experimental/build/utils/filter_async.ts +14 -0
- package/src/experimental/build/utils/find_project_root.ts +67 -0
- package/src/experimental/build/utils/global_paths.ts +8 -0
- package/src/experimental/build/utils/log_success.ts +18 -0
- package/src/experimental/build/utils/types.ts +34 -0
- package/src/experimental/lib/assert_experimental.ts +19 -0
- package/src/experimental/lib/fetch/file.ts +15 -0
- package/src/experimental/lib/fetch/headers.ts +85 -0
- package/src/experimental/lib/fetch/http.ts +293 -0
- package/src/experimental/lib/fetch/icp.ts +98 -0
- package/src/experimental/lib/fetch/index.ts +97 -0
- package/src/experimental/lib/fetch/response.ts +171 -0
- package/src/experimental/lib/fetch/url.ts +15 -0
- package/src/experimental/lib/globals.ts +146 -0
- package/src/experimental/lib/http_client/fetch_ic/actor.ts +131 -0
- package/src/experimental/lib/http_client/fetch_ic/agent.ts +20 -0
- package/src/experimental/lib/http_client/fetch_ic/call.ts +257 -0
- package/src/experimental/lib/http_client/fetch_ic/get_canister_id.ts +25 -0
- package/src/experimental/lib/http_client/fetch_ic/host.ts +30 -0
- package/src/experimental/lib/http_client/fetch_ic/identity.ts +52 -0
- package/src/experimental/lib/http_client/fetch_ic/index.ts +95 -0
- package/src/experimental/lib/http_client/fetch_ic/response.ts +8 -0
- package/src/experimental/lib/http_client/index.ts +6 -0
- package/src/experimental/lib/http_client/to_jwt.ts +6 -0
- package/src/experimental/lib/ic/azle_ic_experimental.ts +92 -0
- package/src/experimental/lib/ic/candid_compiler.ts +14 -0
- package/src/experimental/lib/ic/index.ts +10 -0
- package/src/experimental/lib/ic/set_outgoing_http_options.ts +18 -0
- package/src/experimental/lib/index.ts +7 -0
- package/src/experimental/lib/server.ts +279 -0
- package/src/experimental/lib/threshold_wallet/calculate_rsv_for_tecdsa.ts +45 -0
- package/src/experimental/lib/threshold_wallet/ecdsa_public_key.ts +33 -0
- package/src/experimental/lib/threshold_wallet/index.ts +7 -0
- package/src/experimental/lib/threshold_wallet/register_get_url.ts +36 -0
- package/src/experimental/lib/threshold_wallet/sign_with_ecdsa.ts +28 -0
- package/src/experimental/lib/threshold_wallet/wallet.ts +99 -0
- package/src/experimental/test/property/arbitraries/candid/candid_definition_arb/complex_candid_definition_memo.ts +113 -0
- package/src/experimental/test/property/arbitraries/candid/candid_definition_arb/index.ts +73 -0
- package/src/experimental/test/property/arbitraries/candid/candid_definition_arb/recursive_candid_definition_memo.ts +28 -0
- package/src/experimental/test/property/arbitraries/candid/candid_definition_arb/simple_candid_definition_arb.ts +116 -0
- package/src/experimental/test/property/arbitraries/candid/candid_definition_arb/types.ts +117 -0
- package/src/experimental/test/property/arbitraries/candid/candid_return_type_arb.ts +22 -0
- package/src/experimental/test/property/arbitraries/candid/candid_type.ts +83 -0
- package/src/experimental/test/property/arbitraries/candid/candid_value_and_meta_arb.ts +84 -0
- package/src/experimental/test/property/arbitraries/candid/candid_value_and_meta_arb_generator.ts +63 -0
- package/src/experimental/test/property/arbitraries/candid/candid_values_arb.ts +173 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/blob_arb/definition_arb.ts +11 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/blob_arb/index.ts +19 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/blob_arb/values_arb.ts +11 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/opt_arb/definition_arb.ts +172 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/opt_arb/index.ts +29 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/opt_arb/values_arb.ts +88 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/record_arb/definition_arb.ts +184 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/record_arb/index.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/record_arb/values_arb.ts +95 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/tuple_arb/definition_arb.ts +159 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/tuple_arb/index.ts +31 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/tuple_arb/values_arbs.ts +76 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/variant_arb/definition_arbs.ts +257 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/variant_arb/index.ts +37 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/variant_arb/values_arb.ts +92 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/vec_arb/definition_arb.ts +203 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/vec_arb/index.ts +39 -0
- package/src/experimental/test/property/arbitraries/candid/constructed/vec_arb/values_arb.ts +257 -0
- package/src/experimental/test/property/arbitraries/candid/corresponding_js_type.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/bool_arb.ts +28 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/floats/float32_arb.ts +56 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/floats/float64_arb.ts +56 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/index.ts +11 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/int16_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/int32_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/int64_arb.ts +41 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/int8_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/ints/int_arb.ts +39 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/index.ts +11 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/nat16_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/nat32_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/nat64_arb.ts +41 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/nat8_arb.ts +34 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/nats/nat_arb.ts +39 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/null_arb.ts +33 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/text_arb.ts +47 -0
- package/src/experimental/test/property/arbitraries/candid/primitive/void_arb.ts +33 -0
- package/src/experimental/test/property/arbitraries/candid/recursive/definition_arb.ts +125 -0
- package/src/experimental/test/property/arbitraries/candid/recursive/index.ts +35 -0
- package/src/experimental/test/property/arbitraries/candid/recursive/values_arb.ts +43 -0
- package/src/experimental/test/property/arbitraries/candid/reference/func_arb/definition_arb.ts +198 -0
- package/src/experimental/test/property/arbitraries/candid/reference/func_arb/index.ts +23 -0
- package/src/experimental/test/property/arbitraries/candid/reference/func_arb/values_arb.ts +70 -0
- package/src/experimental/test/property/arbitraries/candid/reference/principal_arb.ts +43 -0
- package/src/experimental/test/property/arbitraries/candid/reference/service_arb/definition_arb.ts +163 -0
- package/src/experimental/test/property/arbitraries/candid/reference/service_arb/index.ts +41 -0
- package/src/experimental/test/property/arbitraries/candid/reference/service_arb/service_method_arb.ts +110 -0
- package/src/experimental/test/property/arbitraries/candid/reference/service_arb/values_arb.ts +20 -0
- package/src/experimental/test/property/arbitraries/candid/simple_type_arbs/candid_type_to_azle_candid_type.ts +66 -0
- package/src/experimental/test/property/arbitraries/candid/simple_type_arbs/definition_arb.ts +95 -0
- package/src/experimental/test/property/arbitraries/candid/simple_type_arbs/values_arb.ts +19 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/bigint.ts +5 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/blob.ts +5 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/boolean.ts +5 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/float.ts +18 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/null.ts +5 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/number.ts +5 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/principal.ts +7 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/string.ts +12 -0
- package/src/experimental/test/property/arbitraries/candid/to_src_literal/void.ts +5 -0
- package/src/experimental/test/property/arbitraries/canister_arb.ts +195 -0
- package/src/experimental/test/property/arbitraries/canister_methods/index.ts +79 -0
- package/src/experimental/test/property/arbitraries/canister_methods/init_method_arb.ts +127 -0
- package/src/experimental/test/property/arbitraries/canister_methods/inspect_message_method_arb.ts +55 -0
- package/src/experimental/test/property/arbitraries/canister_methods/post_upgrade_method_arb.ts +133 -0
- package/src/experimental/test/property/arbitraries/canister_methods/pre_upgrade_method_arb.ts +57 -0
- package/src/experimental/test/property/arbitraries/canister_methods/query_method_arb.ts +141 -0
- package/src/experimental/test/property/arbitraries/canister_methods/update_method_arb.ts +158 -0
- package/src/experimental/test/property/arbitraries/config.ts +4 -0
- package/src/experimental/test/property/arbitraries/http/body_arb.ts +7 -0
- package/src/experimental/test/property/arbitraries/http/headers_arb.ts +22 -0
- package/src/experimental/test/property/arbitraries/http/request_arb.ts +158 -0
- package/src/experimental/test/property/arbitraries/http/response_arb.ts +192 -0
- package/src/experimental/test/property/arbitraries/js_name_arb.ts +144 -0
- package/src/experimental/test/property/arbitraries/stable_b_tree_map_arb.ts +55 -0
- package/src/experimental/test/property/arbitraries/types.ts +24 -0
- package/src/experimental/test/property/arbitraries/unique_identifier_arb.ts +38 -0
- package/src/experimental/test/property/arbitraries/unique_primitive_arb.ts +22 -0
- package/src/experimental/test/property/are_params_correctly_ordered.ts +19 -0
- package/src/experimental/test/property/get_actor.ts +39 -0
- package/src/experimental/test/property/index.ts +141 -0
- package/src/experimental/test/property/test/index.ts +226 -0
- package/src/experimental/test/property/visitors/LICENCE +201 -0
- package/src/experimental/test/property/visitors/cli-string-visitor.ts +138 -0
- package/src/experimental/test/set_experimental.ts +1 -0
- package/src/exports/_internal/dfx.ts +1 -0
- package/src/exports/_internal/globals.ts +1 -0
- package/src/exports/_internal/test/candid_deep_equal.ts +1 -0
- package/src/exports/_internal/test.ts +1 -0
- package/src/exports/_internal/type_tests/assert_type.ts +1 -0
- package/src/exports/_internal.ts +1 -0
- package/src/exports/canisters/ck_btc_ledger/idl.ts +1 -0
- package/src/exports/canisters/ck_eth_ledger/idl.ts +1 -0
- package/src/exports/canisters/cycles_ledger/idl.ts +1 -0
- package/src/exports/canisters/evm_rpc/idl.ts +1 -0
- package/src/exports/canisters/exchange_rate/idl.ts +1 -0
- package/src/exports/canisters/http_gateway/idl.ts +1 -0
- package/src/exports/canisters/icrc_1/idl.ts +1 -0
- package/src/exports/canisters/icrc_10/idl.ts +1 -0
- package/src/exports/canisters/icrc_2/idl.ts +1 -0
- package/src/exports/canisters/icrc_3/idl.ts +1 -0
- package/src/exports/canisters/icrc_37/idl.ts +1 -0
- package/src/exports/canisters/icrc_7/idl.ts +1 -0
- package/src/exports/canisters/llm/idl.ts +1 -0
- package/src/exports/canisters/management/idl.ts +1 -0
- package/src/exports/canisters/nns_cycles_minting/idl.ts +1 -0
- package/src/exports/canisters/nns_governance/idl.ts +1 -0
- package/src/exports/canisters/nns_icp_ledger/idl.ts +1 -0
- package/src/exports/canisters/nns_internet_identity/idl.ts +1 -0
- package/src/exports/canisters/nns_registry/idl.ts +1 -0
- package/src/exports/canisters/nns_sns_w/idl.ts +1 -0
- package/src/exports/experimental/_internal/dfx.ts +1 -0
- package/src/exports/experimental/_internal/globals.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_definition_arb/types.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_definition_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_return_type_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_value_and_meta_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_value_and_meta_arb_generator.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/candid_values_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/blob_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/opt_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/record_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/tuple_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/variant_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/constructed/vec_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/corresponding_js_type.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/bool_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/floats/float32_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/floats/float64_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/ints/int16_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/ints/int32_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/ints/int64_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/ints/int8_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/ints/int_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/nats/nat16_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/nats/nat32_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/nats/nat64_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/nats/nat8_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/nats/nat_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/null_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/text_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/primitive/void_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/recursive.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/reference/func_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/reference/principal_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/candid/reference/service_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/init_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/inspect_message_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/post_upgrade_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/pre_upgrade_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/query_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods/update_method_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/canister_methods.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/config.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/http/body_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/http/headers_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/http/request_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/http/response_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/stable_b_tree_map_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/types.ts +1 -0
- package/src/exports/experimental/_internal/test/property/arbitraries/unique_identifier_arb.ts +1 -0
- package/src/exports/experimental/_internal/test/property/are_params_correctly_ordered.ts +1 -0
- package/src/exports/experimental/_internal/test/property/test.ts +1 -0
- package/src/exports/experimental/_internal/test/property.ts +1 -0
- package/src/exports/experimental/_internal/test/set_experimental.ts +1 -0
- package/src/exports/experimental/_internal.ts +8 -0
- package/src/exports/experimental/http_client.ts +1 -0
- package/src/exports/experimental.ts +3 -0
- package/src/stable/build/commands/build/candid_and_method_meta/execute.ts +134 -0
- package/src/stable/build/commands/build/candid_and_method_meta/index.ts +27 -0
- package/src/stable/build/commands/build/get_context.ts +79 -0
- package/src/stable/build/commands/build/index.ts +48 -0
- package/src/stable/build/commands/build/javascript.ts +259 -0
- package/src/stable/build/commands/build/wasm_binary/compile.ts +27 -0
- package/src/stable/build/commands/build/wasm_binary/index.ts +30 -0
- package/src/stable/build/commands/build/wasm_binary/manipulate.ts +268 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/Cargo.toml +23 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/benchmarking.rs +45 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/candid_and_method_meta.rs +49 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/execute_method_js.rs +65 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/guards.rs +11 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/accept_message.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/call_raw.rs +362 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/candid_decode.rs +18 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/candid_encode.rs +19 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/canister_cycle_balance.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/canister_self.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/canister_version.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/certified_data_set.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/clear_timer.rs +15 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/cycles_burn.rs +17 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/data_certificate.rs +13 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/debug_print.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/drain_microtasks.rs +22 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/in_replicated_execution.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/is_controller.rs +11 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/mod.rs +219 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_arg_data.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_caller.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_cycles_accept.rs +17 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_cycles_available.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_cycles_refunded.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_method_name.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_reject.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_reject_code.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_reject_msg.rs +6 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/msg_reply.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/notify_raw.rs +62 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/performance_counter.rs +17 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/rand_bytes.rs +21 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/rand_seed.rs +26 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/set_timer.rs +92 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/set_timer_interval.rs +62 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_contains_key.rs +18 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_get.rs +21 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_init.rs +19 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_insert.rs +44 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_is_empty.rs +11 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_items.rs +48 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_keys.rs +43 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_len.rs +16 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_remove.rs +21 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/stable_b_tree_map_values.rs +43 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/time.rs +8 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/ic/trap.rs +22 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/init_and_post_upgrade.rs +98 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/initialize_context.rs +102 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/internal_canister_methods.rs +122 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/lib.rs +39 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/rquickjs_utils/call_with_error_handling.rs +26 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/rquickjs_utils/error.rs +27 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/rquickjs_utils/mod.rs +7 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/rquickjs_utils/with_ctx.rs +24 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/stable_b_tree_map.rs +84 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/state.rs +55 -0
- package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/wasm_binary_manipulation.rs +296 -0
- package/src/stable/build/commands/clean.ts +15 -0
- package/src/stable/build/commands/dev/audit.ts +39 -0
- package/src/stable/build/commands/dev/setup/index.ts +41 -0
- package/src/stable/build/commands/dev/setup/install_cargo-audit.sh +11 -0
- package/src/stable/build/commands/dev/setup/install_cargo-auditable.sh +16 -0
- package/src/stable/build/commands/dev/setup/install_cargo-bundle-licenses.sh +11 -0
- package/src/stable/build/commands/dev/setup/install_cargo-deny.sh +11 -0
- package/src/stable/build/commands/dev/setup/install_dfx.sh +36 -0
- package/src/stable/build/commands/dev/setup/install_node.sh +25 -0
- package/src/stable/build/commands/dev/setup/install_rust.sh +24 -0
- package/src/stable/build/commands/dev/setup/install_wasi2ic.sh +11 -0
- package/src/stable/build/commands/dev/template/experimental.ts +28 -0
- package/src/stable/build/commands/dev/template/generate_licenses.ts +28 -0
- package/src/stable/build/commands/dev/template/stable.ts +27 -0
- package/src/stable/build/commands/extension/install.ts +25 -0
- package/src/stable/build/commands/generate/index.ts +21 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/Cargo.toml +12 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/build.sh +9 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/licenses.md +1 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/pkg/candid_to_ts_js.d.ts +18 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/pkg/candid_to_ts_js.js +144 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/pkg/candid_to_ts_js_bg.wasm +0 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/pkg/candid_to_ts_js_bg.wasm.d.ts +9 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/pkg/package.json +11 -0
- package/src/stable/build/commands/generate/rust/candid_to_ts_js/src/lib.rs +31 -0
- package/src/stable/build/commands/new.ts +165 -0
- package/src/stable/build/commands/version.ts +5 -0
- package/src/stable/build/dfx_extension/extension.json +36 -0
- package/src/stable/build/dfx_extension/install.sh +10 -0
- package/src/stable/build/index.ts +282 -0
- package/src/stable/build/utils/dfx.ts +10 -0
- package/src/stable/build/utils/dfx_root.ts +34 -0
- package/src/stable/build/utils/exec_sync_pretty.ts +17 -0
- package/src/stable/build/utils/experimental_message.ts +19 -0
- package/src/stable/build/utils/get_canister_config.ts +52 -0
- package/src/stable/build/utils/global_paths.ts +26 -0
- package/src/stable/build/utils/types.ts +87 -0
- package/src/stable/lib/canister_methods/heartbeat.ts +29 -0
- package/src/stable/lib/canister_methods/index.ts +405 -0
- package/src/stable/lib/canister_methods/init.ts +71 -0
- package/src/stable/lib/canister_methods/inspect_message.ts +79 -0
- package/src/stable/lib/canister_methods/on_low_wasm_memory.ts +27 -0
- package/src/stable/lib/canister_methods/post_upgrade.ts +73 -0
- package/src/stable/lib/canister_methods/pre_upgrade.ts +27 -0
- package/src/stable/lib/canister_methods/query.ts +69 -0
- package/src/stable/lib/canister_methods/update.ts +66 -0
- package/src/stable/lib/canisters/NOTICE +15 -0
- package/src/stable/lib/canisters/ck_btc_ledger/idl/README.md +9 -0
- package/src/stable/lib/canisters/ck_btc_ledger/idl/index.did +289 -0
- package/src/stable/lib/canisters/ck_btc_ledger/idl/index.ts +1143 -0
- package/src/stable/lib/canisters/ck_eth_ledger/idl/README.md +9 -0
- package/src/stable/lib/canisters/ck_eth_ledger/idl/index.did +289 -0
- package/src/stable/lib/canisters/ck_eth_ledger/idl/index.ts +1143 -0
- package/src/stable/lib/canisters/cycles_ledger/idl/README.md +9 -0
- package/src/stable/lib/canisters/cycles_ledger/idl/index.did +272 -0
- package/src/stable/lib/canisters/cycles_ledger/idl/index.ts +978 -0
- package/src/stable/lib/canisters/evm_rpc/idl/README.md +9 -0
- package/src/stable/lib/canisters/evm_rpc/idl/index.did +311 -0
- package/src/stable/lib/canisters/evm_rpc/idl/index.ts +1028 -0
- package/src/stable/lib/canisters/exchange_rate/idl/README.md +9 -0
- package/src/stable/lib/canisters/exchange_rate/idl/index.did +83 -0
- package/src/stable/lib/canisters/exchange_rate/idl/index.ts +165 -0
- package/src/stable/lib/canisters/http_gateway/idl/README.md +9 -0
- package/src/stable/lib/canisters/http_gateway/idl/http-gateway.did +49 -0
- package/src/stable/lib/canisters/http_gateway/idl/index.ts +120 -0
- package/src/stable/lib/canisters/icrc_1/idl/ICRC-1.did +63 -0
- package/src/stable/lib/canisters/icrc_1/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_1/idl/index.ts +151 -0
- package/src/stable/lib/canisters/icrc_10/idl/ICRC-10.did +8 -0
- package/src/stable/lib/canisters/icrc_10/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_10/idl/index.ts +32 -0
- package/src/stable/lib/canisters/icrc_2/idl/ICRC-2.did +76 -0
- package/src/stable/lib/canisters/icrc_2/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_2/idl/index.ts +226 -0
- package/src/stable/lib/canisters/icrc_3/idl/ICRC-3.did +59 -0
- package/src/stable/lib/canisters/icrc_3/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_3/idl/index.ts +156 -0
- package/src/stable/lib/canisters/icrc_37/idl/ICRC-37.did +152 -0
- package/src/stable/lib/canisters/icrc_37/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_37/idl/index.ts +466 -0
- package/src/stable/lib/canisters/icrc_7/idl/ICRC-7.did +67 -0
- package/src/stable/lib/canisters/icrc_7/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/icrc_7/idl/index.ts +213 -0
- package/src/stable/lib/canisters/llm/idl/README.md +9 -0
- package/src/stable/lib/canisters/llm/idl/index.did +21 -0
- package/src/stable/lib/canisters/llm/idl/index.ts +43 -0
- package/src/stable/lib/canisters/management/idl/README.md +10 -0
- package/src/stable/lib/canisters/management/idl/ic.did +502 -0
- package/src/stable/lib/canisters/management/idl/index.ts +1257 -0
- package/src/stable/lib/canisters/nns_cycles_minting/idl/README.md +9 -0
- package/src/stable/lib/canisters/nns_cycles_minting/idl/index.did +241 -0
- package/src/stable/lib/canisters/nns_cycles_minting/idl/index.ts +394 -0
- package/src/stable/lib/canisters/nns_governance/idl/README.md +9 -0
- package/src/stable/lib/canisters/nns_governance/idl/index.did +1316 -0
- package/src/stable/lib/canisters/nns_governance/idl/index.ts +3599 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/LICENSE +202 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/NOTICE +14 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/README.md +18 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/address/index.ts +82 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/index.did +264 -0
- package/src/stable/lib/canisters/nns_icp_ledger/idl/index.ts +1020 -0
- package/src/stable/lib/canisters/nns_internet_identity/idl/README.md +9 -0
- package/src/stable/lib/canisters/nns_internet_identity/idl/index.did +779 -0
- package/src/stable/lib/canisters/nns_internet_identity/idl/index.ts +1509 -0
- package/src/stable/lib/canisters/nns_registry/idl/README.md +9 -0
- package/src/stable/lib/canisters/nns_registry/idl/index.did +493 -0
- package/src/stable/lib/canisters/nns_registry/idl/index.ts +1421 -0
- package/src/stable/lib/canisters/nns_sns_w/idl/README.md +9 -0
- package/src/stable/lib/canisters/nns_sns_w/idl/index.did +352 -0
- package/src/stable/lib/canisters/nns_sns_w/idl/index.ts +887 -0
- package/src/stable/lib/did_file/idl_to_string.ts +79 -0
- package/src/stable/lib/did_file/index.ts +2 -0
- package/src/stable/lib/did_file/visitor/did_visitor.ts +135 -0
- package/src/stable/lib/did_file/visitor/escape_candid_name.ts +100 -0
- package/src/stable/lib/did_file/visitor/extract_candid.ts +31 -0
- package/src/stable/lib/did_file/visitor/index.ts +1 -0
- package/src/stable/lib/did_file/visitor/visit/func.ts +31 -0
- package/src/stable/lib/did_file/visitor/visit/opt.ts +16 -0
- package/src/stable/lib/did_file/visitor/visit/primitive.ts +11 -0
- package/src/stable/lib/did_file/visitor/visit/record.ts +24 -0
- package/src/stable/lib/did_file/visitor/visit/recursive.ts +32 -0
- package/src/stable/lib/did_file/visitor/visit/service.ts +107 -0
- package/src/stable/lib/did_file/visitor/visit/tuple.ts +20 -0
- package/src/stable/lib/did_file/visitor/visit/variant.ts +26 -0
- package/src/stable/lib/did_file/visitor/visit/vec.ts +16 -0
- package/src/stable/lib/error.ts +55 -0
- package/src/stable/lib/execute_and_reply_with_candid_serde.ts +245 -0
- package/src/stable/lib/func.ts +7 -0
- package/src/stable/lib/globals.ts +250 -0
- package/src/stable/lib/ic_apis/NOTICE +203 -0
- package/src/stable/lib/ic_apis/azle_ic_stable.ts +86 -0
- package/src/stable/lib/ic_apis/call.ts +397 -0
- package/src/stable/lib/ic_apis/candid_decode.ts +26 -0
- package/src/stable/lib/ic_apis/candid_encode.ts +27 -0
- package/src/stable/lib/ic_apis/canister_cycle_balance.ts +28 -0
- package/src/stable/lib/ic_apis/canister_self.ts +25 -0
- package/src/stable/lib/ic_apis/canister_version.ts +33 -0
- package/src/stable/lib/ic_apis/certified_data_set.ts +35 -0
- package/src/stable/lib/ic_apis/chunk.ts +42 -0
- package/src/stable/lib/ic_apis/clear_timer.ts +53 -0
- package/src/stable/lib/ic_apis/cycles_burn.ts +32 -0
- package/src/stable/lib/ic_apis/data_certificate.ts +30 -0
- package/src/stable/lib/ic_apis/in_replicated_execution.ts +20 -0
- package/src/stable/lib/ic_apis/index.ts +37 -0
- package/src/stable/lib/ic_apis/is_controller.ts +31 -0
- package/src/stable/lib/ic_apis/msg_arg_data.ts +28 -0
- package/src/stable/lib/ic_apis/msg_caller.ts +32 -0
- package/src/stable/lib/ic_apis/msg_cycles_accept.ts +27 -0
- package/src/stable/lib/ic_apis/msg_cycles_available.ts +25 -0
- package/src/stable/lib/ic_apis/msg_cycles_refunded.ts +25 -0
- package/src/stable/lib/ic_apis/msg_method_name.ts +21 -0
- package/src/stable/lib/ic_apis/msg_reject.ts +28 -0
- package/src/stable/lib/ic_apis/msg_reject_code.ts +40 -0
- package/src/stable/lib/ic_apis/msg_reject_msg.ts +24 -0
- package/src/stable/lib/ic_apis/msg_reply.ts +34 -0
- package/src/stable/lib/ic_apis/performance_counter.ts +31 -0
- package/src/stable/lib/ic_apis/rand_seed.ts +40 -0
- package/src/stable/lib/ic_apis/set_timer.ts +80 -0
- package/src/stable/lib/ic_apis/set_timer_interval.ts +87 -0
- package/src/stable/lib/ic_apis/time.ts +26 -0
- package/src/stable/lib/ic_apis/trap.ts +29 -0
- package/src/stable/lib/index.ts +16 -0
- package/src/stable/lib/json.ts +39 -0
- package/src/stable/lib/stable_structures/stable_b_tree_map.ts +488 -0
- package/src/stable/lib/stable_structures/stable_json.ts +254 -0
- package/src/stable/lib/state.ts +322 -0
- package/src/stable/test/benchmarks/_azle_get_benchmarks.did +9 -0
- package/src/stable/test/benchmarks/index.ts +273 -0
- package/src/stable/test/candid_deep_equal.ts +99 -0
- package/src/stable/test/canister_names.ts +36 -0
- package/src/stable/test/fuzz.ts +102 -0
- package/src/stable/test/get_canister_actor.ts +45 -0
- package/src/stable/test/global_state.ts +202 -0
- package/src/stable/test/index.ts +274 -0
- package/src/stable/test/memory_state.ts +187 -0
- package/src/stable/test/property/default_prop_test_params.ts +36 -0
- package/src/stable/test/type/assert_type.ts +9 -0
- package/tsconfig.dev.json +10 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
use std::error::Error;
|
|
2
|
+
|
|
3
|
+
use rquickjs::Ctx;
|
|
4
|
+
|
|
5
|
+
use crate::CONTEXT_REF_CELL;
|
|
6
|
+
|
|
7
|
+
pub fn with_ctx<F, R>(callback: F) -> Result<R, Box<dyn Error>>
|
|
8
|
+
where
|
|
9
|
+
F: FnOnce(Ctx) -> Result<R, Box<dyn Error>>,
|
|
10
|
+
{
|
|
11
|
+
CONTEXT_REF_CELL.with(|context_ref_cell| {
|
|
12
|
+
let context_ref = context_ref_cell.borrow();
|
|
13
|
+
let context = context_ref
|
|
14
|
+
.as_ref()
|
|
15
|
+
.ok_or("QuickJS context not initialized")?;
|
|
16
|
+
|
|
17
|
+
context.with(|ctx| {
|
|
18
|
+
let result = callback(ctx.clone())
|
|
19
|
+
.map_err(|e| format!("QuickJS callback execution failed: {e}"))?;
|
|
20
|
+
|
|
21
|
+
Ok(result)
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
use std::{borrow::Cow, cell::RefCell, collections::BTreeMap};
|
|
2
|
+
|
|
3
|
+
use ic_stable_structures::{storable::Bound, StableBTreeMap, Storable};
|
|
4
|
+
use rquickjs::{Ctx, Result};
|
|
5
|
+
|
|
6
|
+
use crate::{ic::throw_error, Memory};
|
|
7
|
+
|
|
8
|
+
#[allow(unused)]
|
|
9
|
+
pub type AzleStableBTreeMap =
|
|
10
|
+
StableBTreeMap<AzleStableBTreeMapKey, AzleStableBTreeMapValue, Memory>;
|
|
11
|
+
|
|
12
|
+
thread_local! {
|
|
13
|
+
pub static STABLE_B_TREE_MAPS: RefCell<BTreeMap<u8, AzleStableBTreeMap>> = RefCell::new(BTreeMap::new());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone)]
|
|
17
|
+
pub struct AzleStableBTreeMapKey {
|
|
18
|
+
pub bytes: Vec<u8>,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
impl Storable for AzleStableBTreeMapKey {
|
|
22
|
+
fn to_bytes(&self) -> Cow<[u8]> {
|
|
23
|
+
Cow::Borrowed(&self.bytes)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
fn from_bytes(bytes: Cow<[u8]>) -> Self {
|
|
27
|
+
AzleStableBTreeMapKey {
|
|
28
|
+
bytes: bytes.to_vec(),
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const BOUND: Bound = Bound::Unbounded;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone)]
|
|
36
|
+
pub struct AzleStableBTreeMapValue {
|
|
37
|
+
pub bytes: Vec<u8>,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
impl Storable for AzleStableBTreeMapValue {
|
|
41
|
+
fn to_bytes(&self) -> Cow<[u8]> {
|
|
42
|
+
Cow::Borrowed(&self.bytes)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
fn from_bytes(bytes: Cow<[u8]>) -> Self {
|
|
46
|
+
AzleStableBTreeMapValue {
|
|
47
|
+
bytes: bytes.to_vec(),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const BOUND: Bound = Bound::Unbounded;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
pub fn with_stable_b_tree_map<F, R>(ctx: Ctx, memory_id: u8, f: F) -> Result<R>
|
|
55
|
+
where
|
|
56
|
+
F: FnOnce(&AzleStableBTreeMap) -> R,
|
|
57
|
+
{
|
|
58
|
+
STABLE_B_TREE_MAPS.with(|stable_b_tree_maps| {
|
|
59
|
+
let stable_b_tree_maps = stable_b_tree_maps.borrow();
|
|
60
|
+
|
|
61
|
+
let stable_b_tree_map = stable_b_tree_maps.get(&memory_id).ok_or(throw_error(
|
|
62
|
+
ctx,
|
|
63
|
+
&format!("Could not find StableBTreeMap with memory id {memory_id}"),
|
|
64
|
+
))?;
|
|
65
|
+
|
|
66
|
+
Ok(f(stable_b_tree_map))
|
|
67
|
+
})
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
pub fn with_stable_b_tree_map_mut<F, R>(ctx: Ctx, memory_id: u8, f: F) -> Result<R>
|
|
71
|
+
where
|
|
72
|
+
F: FnOnce(&mut AzleStableBTreeMap) -> R,
|
|
73
|
+
{
|
|
74
|
+
STABLE_B_TREE_MAPS.with(|stable_b_tree_maps| {
|
|
75
|
+
let mut stable_b_tree_maps = stable_b_tree_maps.borrow_mut();
|
|
76
|
+
|
|
77
|
+
let stable_b_tree_map = stable_b_tree_maps.get_mut(&memory_id).ok_or(throw_error(
|
|
78
|
+
ctx,
|
|
79
|
+
&format!("Could not find StableBTreeMap with memory id {memory_id}"),
|
|
80
|
+
))?;
|
|
81
|
+
|
|
82
|
+
Ok(f(stable_b_tree_map))
|
|
83
|
+
})
|
|
84
|
+
}
|
package/src/stable/build/commands/build/wasm_binary/rust/stable_canister_template/src/state.rs
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
use std::error::Error;
|
|
2
|
+
|
|
3
|
+
use rquickjs::{Ctx, Object, Value};
|
|
4
|
+
|
|
5
|
+
use crate::rquickjs_utils::call_with_error_handling;
|
|
6
|
+
|
|
7
|
+
/// Dispatches an action to the Azle JavaScript runtime.
|
|
8
|
+
///
|
|
9
|
+
/// This function creates a JavaScript action object with the provided type and payload,
|
|
10
|
+
/// along with location information (filepath and function name), and dispatches it to
|
|
11
|
+
/// the Azle runtime by calling the global `_azleDispatch` function. Actions are used
|
|
12
|
+
/// for important global state changes in Azle.
|
|
13
|
+
///
|
|
14
|
+
/// # Arguments
|
|
15
|
+
///
|
|
16
|
+
/// * `ctx` - The QuickJS context in which the action will be created and dispatched
|
|
17
|
+
/// * `action_type` - The type of the action to be dispatched
|
|
18
|
+
/// * `payload` - The payload of the action as a QuickJS Value
|
|
19
|
+
/// * `filepath` - The filepath where the action is being dispatched from
|
|
20
|
+
/// * `function_name` - The name of the function dispatching the action
|
|
21
|
+
///
|
|
22
|
+
/// # Returns
|
|
23
|
+
///
|
|
24
|
+
/// * `Ok(())` if the action was successfully dispatched
|
|
25
|
+
/// * `Err` containing the error if any operation fails
|
|
26
|
+
///
|
|
27
|
+
/// # Errors
|
|
28
|
+
///
|
|
29
|
+
/// This function may return an error if:
|
|
30
|
+
/// - Creating JavaScript objects fails
|
|
31
|
+
/// - Setting properties on JavaScript objects fails
|
|
32
|
+
/// - Calling the `_azleDispatch` function fails
|
|
33
|
+
pub fn dispatch_action<'a>(
|
|
34
|
+
ctx: Ctx<'a>,
|
|
35
|
+
action_type: &str,
|
|
36
|
+
payload: Value<'a>,
|
|
37
|
+
filepath: &str,
|
|
38
|
+
function_name: &str,
|
|
39
|
+
) -> Result<(), Box<dyn Error>> {
|
|
40
|
+
let action = Object::new(ctx.clone())?;
|
|
41
|
+
|
|
42
|
+
action.set("type", action_type)?;
|
|
43
|
+
action.set("payload", payload)?;
|
|
44
|
+
|
|
45
|
+
let location = Object::new(ctx.clone())?;
|
|
46
|
+
|
|
47
|
+
location.set("filepath", filepath)?;
|
|
48
|
+
location.set("functionName", function_name)?;
|
|
49
|
+
|
|
50
|
+
action.set("location", location)?;
|
|
51
|
+
|
|
52
|
+
call_with_error_handling(&ctx, &ctx.globals().get("_azleDispatch")?, (action,))?;
|
|
53
|
+
|
|
54
|
+
Ok(())
|
|
55
|
+
}
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
use core::ptr::read_volatile;
|
|
2
|
+
use std::{error::Error, str};
|
|
3
|
+
|
|
4
|
+
use serde::{Deserialize, Serialize};
|
|
5
|
+
use serde_json;
|
|
6
|
+
|
|
7
|
+
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
8
|
+
pub struct WasmData {
|
|
9
|
+
#[serde(rename = "envVars")]
|
|
10
|
+
pub env_vars: Vec<(String, String)>,
|
|
11
|
+
#[serde(rename = "mainJsPath")]
|
|
12
|
+
pub main_js_path: String,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[inline(never)]
|
|
16
|
+
#[unsafe(no_mangle)]
|
|
17
|
+
extern "C" fn init_js_passive_data(js_vec_location: i32) {
|
|
18
|
+
// Without something like this to make the function bodies different,
|
|
19
|
+
// the init_js_passive_data and init_wasm_data_passive_data functions
|
|
20
|
+
// seem to be optimized into the same function in the Wasm binary
|
|
21
|
+
// This causes problems during Wasm binary manipulation
|
|
22
|
+
let _ = format!("prevent init_js_passive_data and init_wasm_data_passive_data optimization");
|
|
23
|
+
|
|
24
|
+
// This is used to prevent compiler optimizations that interfere with the Wasm binary manipulation
|
|
25
|
+
unsafe { read_volatile(&js_vec_location) };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Used to provide a safe value for the read_volatile and to differentiate between the
|
|
29
|
+
// js_passive_data_size and wasm_data_passive_data_size function bodies
|
|
30
|
+
// Without this problems happen during Wasm binary manipulation
|
|
31
|
+
static JS_PASSIVE_DATA_SIZE: usize = 0;
|
|
32
|
+
|
|
33
|
+
#[inline(never)]
|
|
34
|
+
#[unsafe(no_mangle)]
|
|
35
|
+
extern "C" fn js_passive_data_size() -> usize {
|
|
36
|
+
// This is used to prevent compiler optimizations that interfere with the Wasm binary manipulation
|
|
37
|
+
unsafe { read_volatile(&JS_PASSIVE_DATA_SIZE) }
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Inspired from: https://github.com/adambratschikaye/wasm-inject-data/blob/main/src/static_wasm.rs
|
|
41
|
+
// Most likely a derivative work licensed under the Apache License, Version 2.0: https://github.com/adambratschikaye/wasm-inject-data/blob/main/LICENSE
|
|
42
|
+
pub fn get_js_code() -> Result<Vec<u8>, Box<dyn Error>> {
|
|
43
|
+
let size = js_passive_data_size();
|
|
44
|
+
|
|
45
|
+
let mut js_vec = vec![243; size];
|
|
46
|
+
|
|
47
|
+
// This cast to usize appears to be well defined and safe
|
|
48
|
+
let js_vec_location = js_vec.as_mut_ptr() as usize;
|
|
49
|
+
|
|
50
|
+
init_js_passive_data(i32::try_from(js_vec_location)?);
|
|
51
|
+
|
|
52
|
+
Ok(js_vec)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#[inline(never)]
|
|
56
|
+
#[unsafe(no_mangle)]
|
|
57
|
+
extern "C" fn init_wasm_data_passive_data(wasm_data_vec_location: i32) {
|
|
58
|
+
// This is used to prevent compiler optimizations that interfere with the Wasm binary manipulation
|
|
59
|
+
unsafe { read_volatile(&wasm_data_vec_location) };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Used to provide a safe value for the read_volatile and to differentiate between the
|
|
63
|
+
// js_passive_data_size and wasm_data_passive_data_size function bodies
|
|
64
|
+
// Without this problems happen during Wasm binary manipulation
|
|
65
|
+
static WASM_DATA_PASSIVE_DATA_SIZE: usize = 0;
|
|
66
|
+
|
|
67
|
+
#[inline(never)]
|
|
68
|
+
#[unsafe(no_mangle)]
|
|
69
|
+
extern "C" fn wasm_data_passive_data_size() -> usize {
|
|
70
|
+
// This is used to prevent compiler optimizations that interfere with the Wasm binary manipulation
|
|
71
|
+
unsafe { read_volatile(&WASM_DATA_PASSIVE_DATA_SIZE) }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Inspired from: https://github.com/adambratschikaye/wasm-inject-data/blob/main/src/static_wasm.rs
|
|
75
|
+
// Most likely a derivative work licensed under the Apache License, Version 2.0: https://github.com/adambratschikaye/wasm-inject-data/blob/main/LICENSE
|
|
76
|
+
pub fn get_wasm_data() -> Result<WasmData, Box<dyn Error>> {
|
|
77
|
+
let size = wasm_data_passive_data_size();
|
|
78
|
+
|
|
79
|
+
let mut wasm_data_vec = vec![243; size];
|
|
80
|
+
|
|
81
|
+
// This cast to usize appears to be well defined and safe
|
|
82
|
+
let wasm_data_vec_location = wasm_data_vec.as_mut_ptr() as usize;
|
|
83
|
+
|
|
84
|
+
init_wasm_data_passive_data(i32::try_from(wasm_data_vec_location)?);
|
|
85
|
+
|
|
86
|
+
let wasm_data_str = str::from_utf8(&wasm_data_vec).map_err(|e| {
|
|
87
|
+
format!(
|
|
88
|
+
"WasmData conversion failed while converting Vec<u8> to String: {}",
|
|
89
|
+
e
|
|
90
|
+
)
|
|
91
|
+
})?;
|
|
92
|
+
|
|
93
|
+
let wasm_data: WasmData = serde_json::from_str(wasm_data_str).map_err(|e| {
|
|
94
|
+
format!(
|
|
95
|
+
"WasmData conversion failed while converting String to WasmData struct: {}",
|
|
96
|
+
e
|
|
97
|
+
)
|
|
98
|
+
})?;
|
|
99
|
+
|
|
100
|
+
Ok(wasm_data)
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// For get_js_code and get_wasm_data above:
|
|
104
|
+
|
|
105
|
+
// Copyright © 2024 DFINITY Foundation
|
|
106
|
+
|
|
107
|
+
// Each file in this repository is licensed under the license as
|
|
108
|
+
// described in the LICENSE file in the same directory that contains the
|
|
109
|
+
// file or, if that doesn't exist, the first LICENSE file in any
|
|
110
|
+
// higher-level directory.
|
|
111
|
+
|
|
112
|
+
// Unless stated otherwise as described above, all files in this
|
|
113
|
+
// directory are licensed under the Apache License, Version 2.0 (the
|
|
114
|
+
// "License"); you may not use these files except in compliance with the
|
|
115
|
+
// License. You may obtain a copy of the License at
|
|
116
|
+
|
|
117
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
118
|
+
|
|
119
|
+
// The Apache-2.0 license is also copied below:
|
|
120
|
+
|
|
121
|
+
// Apache License
|
|
122
|
+
// Version 2.0, January 2004
|
|
123
|
+
// http://www.apache.org/licenses/
|
|
124
|
+
|
|
125
|
+
// TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
126
|
+
|
|
127
|
+
// 1. Definitions.
|
|
128
|
+
|
|
129
|
+
// "License" shall mean the terms and conditions for use, reproduction,
|
|
130
|
+
// and distribution as defined by Sections 1 through 9 of this document.
|
|
131
|
+
|
|
132
|
+
// "Licensor" shall mean the copyright owner or entity authorized by
|
|
133
|
+
// the copyright owner that is granting the License.
|
|
134
|
+
|
|
135
|
+
// "Legal Entity" shall mean the union of the acting entity and all
|
|
136
|
+
// other entities that control, are controlled by, or are under common
|
|
137
|
+
// control with that entity. For the purposes of this definition,
|
|
138
|
+
// "control" means (i) the power, direct or indirect, to cause the
|
|
139
|
+
// direction or management of such entity, whether by contract or
|
|
140
|
+
// otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
141
|
+
// outstanding shares, or (iii) beneficial ownership of such entity.
|
|
142
|
+
|
|
143
|
+
// "You" (or "Your") shall mean an individual or Legal Entity
|
|
144
|
+
// exercising permissions granted by this License.
|
|
145
|
+
|
|
146
|
+
// "Source" form shall mean the preferred form for making modifications,
|
|
147
|
+
// including but not limited to software source code, documentation
|
|
148
|
+
// source, and configuration files.
|
|
149
|
+
|
|
150
|
+
// "Object" form shall mean any form resulting from mechanical
|
|
151
|
+
// transformation or translation of a Source form, including but
|
|
152
|
+
// not limited to compiled object code, generated documentation,
|
|
153
|
+
// and conversions to other media types.
|
|
154
|
+
|
|
155
|
+
// "Work" shall mean the work of authorship, whether in Source or
|
|
156
|
+
// Object form, made available under the License, as indicated by a
|
|
157
|
+
// copyright notice that is included in or attached to the work
|
|
158
|
+
// (an example is provided in the Appendix below).
|
|
159
|
+
|
|
160
|
+
// "Derivative Works" shall mean any work, whether in Source or Object
|
|
161
|
+
// form, that is based on (or derived from) the Work and for which the
|
|
162
|
+
// editorial revisions, annotations, elaborations, or other modifications
|
|
163
|
+
// represent, as a whole, an original work of authorship. For the purposes
|
|
164
|
+
// of this License, Derivative Works shall not include works that remain
|
|
165
|
+
// separable from, or merely link (or bind by name) to the interfaces of,
|
|
166
|
+
// the Work and Derivative Works thereof.
|
|
167
|
+
|
|
168
|
+
// "Contribution" shall mean any work of authorship, including
|
|
169
|
+
// the original version of the Work and any modifications or additions
|
|
170
|
+
// to that Work or Derivative Works thereof, that is intentionally
|
|
171
|
+
// submitted to Licensor for inclusion in the Work by the copyright owner
|
|
172
|
+
// or by an individual or Legal Entity authorized to submit on behalf of
|
|
173
|
+
// the copyright owner. For the purposes of this definition, "submitted"
|
|
174
|
+
// means any form of electronic, verbal, or written communication sent
|
|
175
|
+
// to the Licensor or its representatives, including but not limited to
|
|
176
|
+
// communication on electronic mailing lists, source code control systems,
|
|
177
|
+
// and issue tracking systems that are managed by, or on behalf of, the
|
|
178
|
+
// Licensor for the purpose of discussing and improving the Work, but
|
|
179
|
+
// excluding communication that is conspicuously marked or otherwise
|
|
180
|
+
// designated in writing by the copyright owner as "Not a Contribution."
|
|
181
|
+
|
|
182
|
+
// "Contributor" shall mean Licensor and any individual or Legal Entity
|
|
183
|
+
// on behalf of whom a Contribution has been received by Licensor and
|
|
184
|
+
// subsequently incorporated within the Work.
|
|
185
|
+
|
|
186
|
+
// 2. Grant of Copyright License. Subject to the terms and conditions of
|
|
187
|
+
// this License, each Contributor hereby grants to You a perpetual,
|
|
188
|
+
// worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
189
|
+
// copyright license to reproduce, prepare Derivative Works of,
|
|
190
|
+
// publicly display, publicly perform, sublicense, and distribute the
|
|
191
|
+
// Work and such Derivative Works in Source or Object form.
|
|
192
|
+
|
|
193
|
+
// 3. Grant of Patent License. Subject to the terms and conditions of
|
|
194
|
+
// this License, each Contributor hereby grants to You a perpetual,
|
|
195
|
+
// worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
196
|
+
// (except as stated in this section) patent license to make, have made,
|
|
197
|
+
// use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
198
|
+
// where such license applies only to those patent claims licensable
|
|
199
|
+
// by such Contributor that are necessarily infringed by their
|
|
200
|
+
// Contribution(s) alone or by combination of their Contribution(s)
|
|
201
|
+
// with the Work to which such Contribution(s) was submitted. If You
|
|
202
|
+
// institute patent litigation against any entity (including a
|
|
203
|
+
// cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
204
|
+
// or a Contribution incorporated within the Work constitutes direct
|
|
205
|
+
// or contributory patent infringement, then any patent licenses
|
|
206
|
+
// granted to You under this License for that Work shall terminate
|
|
207
|
+
// as of the date such litigation is filed.
|
|
208
|
+
|
|
209
|
+
// 4. Redistribution. You may reproduce and distribute copies of the
|
|
210
|
+
// Work or Derivative Works thereof in any medium, with or without
|
|
211
|
+
// modifications, and in Source or Object form, provided that You
|
|
212
|
+
// meet the following conditions:
|
|
213
|
+
|
|
214
|
+
// (a) You must give any other recipients of the Work or
|
|
215
|
+
// Derivative Works a copy of this License; and
|
|
216
|
+
|
|
217
|
+
// (b) You must cause any modified files to carry prominent notices
|
|
218
|
+
// stating that You changed the files; and
|
|
219
|
+
|
|
220
|
+
// (c) You must retain, in the Source form of any Derivative Works
|
|
221
|
+
// that You distribute, all copyright, patent, trademark, and
|
|
222
|
+
// attribution notices from the Source form of the Work,
|
|
223
|
+
// excluding those notices that do not pertain to any part of
|
|
224
|
+
// the Derivative Works; and
|
|
225
|
+
|
|
226
|
+
// (d) If the Work includes a "NOTICE" text file as part of its
|
|
227
|
+
// distribution, then any Derivative Works that You distribute must
|
|
228
|
+
// include a readable copy of the attribution notices contained
|
|
229
|
+
// within such NOTICE file, excluding those notices that do not
|
|
230
|
+
// pertain to any part of the Derivative Works, in at least one
|
|
231
|
+
// of the following places: within a NOTICE text file distributed
|
|
232
|
+
// as part of the Derivative Works; within the Source form or
|
|
233
|
+
// documentation, if provided along with the Derivative Works; or,
|
|
234
|
+
// within a display generated by the Derivative Works, if and
|
|
235
|
+
// wherever such third-party notices normally appear. The contents
|
|
236
|
+
// of the NOTICE file are for informational purposes only and
|
|
237
|
+
// do not modify the License. You may add Your own attribution
|
|
238
|
+
// notices within Derivative Works that You distribute, alongside
|
|
239
|
+
// or as an addendum to the NOTICE text from the Work, provided
|
|
240
|
+
// that such additional attribution notices cannot be construed
|
|
241
|
+
// as modifying the License.
|
|
242
|
+
|
|
243
|
+
// You may add Your own copyright statement to Your modifications and
|
|
244
|
+
// may provide additional or different license terms and conditions
|
|
245
|
+
// for use, reproduction, or distribution of Your modifications, or
|
|
246
|
+
// for any such Derivative Works as a whole, provided Your use,
|
|
247
|
+
// reproduction, and distribution of the Work otherwise complies with
|
|
248
|
+
// the conditions stated in this License.
|
|
249
|
+
|
|
250
|
+
// 5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
251
|
+
// any Contribution intentionally submitted for inclusion in the Work
|
|
252
|
+
// by You to the Licensor shall be under the terms and conditions of
|
|
253
|
+
// this License, without any additional terms or conditions.
|
|
254
|
+
// Notwithstanding the above, nothing herein shall supersede or modify
|
|
255
|
+
// the terms of any separate license agreement you may have executed
|
|
256
|
+
// with Licensor regarding such Contributions.
|
|
257
|
+
|
|
258
|
+
// 6. Trademarks. This License does not grant permission to use the trade
|
|
259
|
+
// names, trademarks, service marks, or product names of the Licensor,
|
|
260
|
+
// except as required for reasonable and customary use in describing the
|
|
261
|
+
// origin of the Work and reproducing the content of the NOTICE file.
|
|
262
|
+
|
|
263
|
+
// 7. Disclaimer of Warranty. Unless required by applicable law or
|
|
264
|
+
// agreed to in writing, Licensor provides the Work (and each
|
|
265
|
+
// Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
266
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
267
|
+
// implied, including, without limitation, any warranties or conditions
|
|
268
|
+
// of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
269
|
+
// PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
270
|
+
// appropriateness of using or redistributing the Work and assume any
|
|
271
|
+
// risks associated with Your exercise of permissions under this License.
|
|
272
|
+
|
|
273
|
+
// 8. Limitation of Liability. In no event and under no legal theory,
|
|
274
|
+
// whether in tort (including negligence), contract, or otherwise,
|
|
275
|
+
// unless required by applicable law (such as deliberate and grossly
|
|
276
|
+
// negligent acts) or agreed to in writing, shall any Contributor be
|
|
277
|
+
// liable to You for damages, including any direct, indirect, special,
|
|
278
|
+
// incidental, or consequential damages of any character arising as a
|
|
279
|
+
// result of this License or out of the use or inability to use the
|
|
280
|
+
// Work (including but not limited to damages for loss of goodwill,
|
|
281
|
+
// work stoppage, computer failure or malfunction, or any and all
|
|
282
|
+
// other commercial damages or losses), even if such Contributor
|
|
283
|
+
// has been advised of the possibility of such damages.
|
|
284
|
+
|
|
285
|
+
// 9. Accepting Warranty or Additional Liability. While redistributing
|
|
286
|
+
// the Work or Derivative Works thereof, You may choose to offer,
|
|
287
|
+
// and charge a fee for, acceptance of support, warranty, indemnity,
|
|
288
|
+
// or other liability obligations and/or rights consistent with this
|
|
289
|
+
// License. However, in accepting such obligations, You may act only
|
|
290
|
+
// on Your own behalf and on Your sole responsibility, not on behalf
|
|
291
|
+
// of any other Contributor, and only if You agree to indemnify,
|
|
292
|
+
// defend, and hold each Contributor harmless for any liability
|
|
293
|
+
// incurred by, or claims asserted against, such Contributor by reason
|
|
294
|
+
// of your accepting any such warranty or additional liability.
|
|
295
|
+
|
|
296
|
+
// END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { rm } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
|
|
4
|
+
import { getDfxRoot } from '#utils/dfx_root';
|
|
5
|
+
|
|
6
|
+
export async function runCommand(): Promise<void> {
|
|
7
|
+
const dotAzlePath = join(getDfxRoot(), '.azle');
|
|
8
|
+
|
|
9
|
+
await rm(dotAzlePath, {
|
|
10
|
+
recursive: true,
|
|
11
|
+
force: true
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.info(`${dotAzlePath} directory deleted`);
|
|
15
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ExecSyncOptionsWithBufferEncoding, IOType } from 'child_process';
|
|
2
|
+
|
|
3
|
+
import { execSyncPretty } from '#utils/exec_sync_pretty';
|
|
4
|
+
import { AZLE_ROOT } from '#utils/global_paths';
|
|
5
|
+
|
|
6
|
+
export async function runCommand(ioType: IOType = 'inherit'): Promise<void> {
|
|
7
|
+
const options = {
|
|
8
|
+
cwd: AZLE_ROOT,
|
|
9
|
+
stdio: ioType
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
runAuditCommand('npm audit', options);
|
|
13
|
+
runAuditCommand('npm run license-check', options);
|
|
14
|
+
|
|
15
|
+
runAuditCommand('cargo audit', options);
|
|
16
|
+
runAuditCommand('cargo audit bin ~/.cargo/bin/cargo-auditable', options);
|
|
17
|
+
runAuditCommand('cargo audit bin ~/.cargo/bin/cargo-audit', options);
|
|
18
|
+
runAuditCommand(
|
|
19
|
+
'cargo audit bin ~/.cargo/bin/cargo-bundle-licenses',
|
|
20
|
+
options
|
|
21
|
+
);
|
|
22
|
+
runAuditCommand('cargo audit bin ~/.cargo/bin/cargo-deny', options);
|
|
23
|
+
runAuditCommand('cargo audit bin ~/.cargo/bin/wasi2ic', options);
|
|
24
|
+
runAuditCommand('cargo deny check', options);
|
|
25
|
+
|
|
26
|
+
console.info('\n🎉 All security audit checks completed successfully!');
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Runs an audit command and logs a success message
|
|
30
|
+
* @param command - The command to execute
|
|
31
|
+
* @param options - Options to pass to execSyncPretty
|
|
32
|
+
*/
|
|
33
|
+
function runAuditCommand(
|
|
34
|
+
command: string,
|
|
35
|
+
options?: ExecSyncOptionsWithBufferEncoding
|
|
36
|
+
): void {
|
|
37
|
+
execSyncPretty(command, options);
|
|
38
|
+
console.info(`✓ ${command} completed successfully`);
|
|
39
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { execSyncPretty } from '#utils/exec_sync_pretty';
|
|
2
|
+
import { AZLE_ROOT } from '#utils/global_paths';
|
|
3
|
+
|
|
4
|
+
import { azle } from '../../../../../../package.json';
|
|
5
|
+
|
|
6
|
+
type DependencyName =
|
|
7
|
+
| 'dfx'
|
|
8
|
+
| 'node'
|
|
9
|
+
| 'rust'
|
|
10
|
+
| 'cargo-auditable'
|
|
11
|
+
| 'cargo-audit'
|
|
12
|
+
| 'cargo-bundle-licenses'
|
|
13
|
+
| 'cargo-deny'
|
|
14
|
+
| 'wasi2ic';
|
|
15
|
+
|
|
16
|
+
type DependencyInstallInfo = {
|
|
17
|
+
[key in DependencyName]: boolean;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export async function runCommand(
|
|
21
|
+
dependenciesToInstall: DependencyInstallInfo
|
|
22
|
+
): Promise<void> {
|
|
23
|
+
for (const key in dependenciesToInstall) {
|
|
24
|
+
const dependency = key as DependencyName;
|
|
25
|
+
if (dependenciesToInstall[dependency] === true) {
|
|
26
|
+
installDependency(dependency);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function installDependency(dependency: DependencyName): void {
|
|
32
|
+
console.info(`Installing ${dependency}...`);
|
|
33
|
+
const version = azle.globalDependencies[dependency];
|
|
34
|
+
const script = `install_${dependency}.sh`;
|
|
35
|
+
execSyncPretty(
|
|
36
|
+
`${AZLE_ROOT}/src/stable/build/commands/dev/setup/${script} ${version}`,
|
|
37
|
+
{
|
|
38
|
+
stdio: 'inherit'
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
VERSION=$1
|
|
4
|
+
|
|
5
|
+
if [[ $VERSION =~ ^https?:// ]]; then
|
|
6
|
+
echo "Installing cargo-audit from repository $VERSION"
|
|
7
|
+
cargo auditable install cargo-audit --git "$VERSION"
|
|
8
|
+
else
|
|
9
|
+
echo "Installing cargo-audit version $VERSION"
|
|
10
|
+
cargo auditable install cargo-audit --version "$VERSION"
|
|
11
|
+
fi
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
VERSION=$1
|
|
4
|
+
|
|
5
|
+
# cargo-auditable allows us to run cargo audit bin on our global cargo dependencies.
|
|
6
|
+
# We first install cargo-auditable so that it can be used to install itself.
|
|
7
|
+
# Without this, cargo audit bin would not be able to audit cargo-auditable itself.
|
|
8
|
+
if [[ $VERSION =~ ^https?:// ]]; then
|
|
9
|
+
echo "Installing cargo-auditable from repository $VERSION"
|
|
10
|
+
cargo install cargo-auditable --git "$VERSION" --locked
|
|
11
|
+
cargo auditable install cargo-auditable --git "$VERSION" --locked --force
|
|
12
|
+
else
|
|
13
|
+
echo "Installing cargo-auditable version $VERSION"
|
|
14
|
+
cargo install cargo-auditable --version "$VERSION" --locked
|
|
15
|
+
cargo auditable install cargo-auditable --version "$VERSION" --locked --force
|
|
16
|
+
fi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
VERSION=$1
|
|
4
|
+
|
|
5
|
+
if [[ $VERSION =~ ^https?:// ]]; then
|
|
6
|
+
echo "Installing cargo-bundle-licenses from repository $VERSION"
|
|
7
|
+
cargo auditable install cargo-bundle-licenses --git "$VERSION" --locked
|
|
8
|
+
else
|
|
9
|
+
echo "Installing cargo-bundle-licenses version $VERSION"
|
|
10
|
+
cargo auditable install cargo-bundle-licenses --version "$VERSION" --locked
|
|
11
|
+
fi
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
VERSION=$1
|
|
4
|
+
|
|
5
|
+
if [[ $VERSION =~ ^https?:// ]]; then
|
|
6
|
+
echo "Installing cargo-deny from repository $VERSION"
|
|
7
|
+
cargo auditable install cargo-deny --git "$VERSION" --locked
|
|
8
|
+
else
|
|
9
|
+
echo "Installing cargo-deny version $VERSION"
|
|
10
|
+
cargo auditable install cargo-deny --version "$VERSION" --locked
|
|
11
|
+
fi
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
set -eou pipefail
|
|
4
|
+
|
|
5
|
+
if [ -z "$1" ]; then
|
|
6
|
+
echo "Error: No DFX version specified."
|
|
7
|
+
echo "Usage: ./install_dfx.sh <DFX_VERSION>"
|
|
8
|
+
exit 1
|
|
9
|
+
fi
|
|
10
|
+
|
|
11
|
+
DFX_VERSION=$1
|
|
12
|
+
|
|
13
|
+
# Install or update dfx using the official installation script
|
|
14
|
+
echo "Installing dfx version $DFX_VERSION..."
|
|
15
|
+
DFXVM_INIT_YES=true DFX_VERSION=$DFX_VERSION sh -ci "$(curl --retry 3 -fsSL https://sdk.dfinity.org/install.sh)"
|
|
16
|
+
|
|
17
|
+
# Determine the correct dfx path based on the operating system
|
|
18
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
19
|
+
# macOS
|
|
20
|
+
DFX_PATH="$HOME/Library/Application Support/org.dfinity.dfx/bin"
|
|
21
|
+
else
|
|
22
|
+
# Linux and others
|
|
23
|
+
DFX_PATH="$HOME/.local/share/dfx/bin"
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Add dfx to PATH for current session so the installation can be verified
|
|
27
|
+
export PATH="$DFX_PATH:$PATH"
|
|
28
|
+
|
|
29
|
+
# Verify installation
|
|
30
|
+
if ! command -v dfx &> /dev/null; then
|
|
31
|
+
echo "dfx installation verification failed" >&2
|
|
32
|
+
exit 1
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
echo "dfx $DFX_VERSION installation completed."
|
|
36
|
+
exit 0
|