diff --git a/README.md b/README.md index a93fdd35..09b83944 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ commands to keep in mind; The following scripts can be found in [./bin](./bin): +- update-management-idl - Update the management canister IDL in @dfinity/agent + Monorepo-related scripts run in this order, but are usually invoked by `npm install`: - npm-postinstall - Run with `npm run postinstall` in this monorepo package. diff --git a/bin/update-management-idl.ts b/bin/update-management-idl.ts new file mode 100644 index 00000000..638255f8 --- /dev/null +++ b/bin/update-management-idl.ts @@ -0,0 +1,49 @@ +import { $, cd, fetch } from 'zx'; +import path from 'path'; + +fetch( + 'https://raw.githubusercontent.com/dfinity/interface-spec/master/spec/_attachments/ic.did', +).then(async res => { + res.text().then(async text => { + const root = path.resolve(__dirname, '..'); + + const candid = text; + + await cd(`${root}/packages/agent/src/canisters`); + + await $`echo ${candid} > management.did`; + let ts = (await $`didc bind management.did -t ts`).toString(); + let js = (await $`didc bind management.did -t js`).toString(); + + const didcVersion = await $`didc --version`; + + const prefix = `/* + * This file is generated from the candid for asset management. + * didc version: ${didcVersion.toString().split(' ')[1].trim()} + */ +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore + +`; + + // replace first line of service + + ts = ts.replace(`export interface _SERVICE {`, `export default interface _SERVICE {`); + js = js.replace(`export const idlFactory = ({ IDL }) => {`, `export default ({ IDL }) => {`); + + // remove init function + js = js.split('export const init = ({ IDL }) => {')[0]; + + ts = prefix + ts; + js = prefix + js; + + await $`echo ${js} > management_idl.ts`; + await $`echo ${ts} > management_service.ts`; + + await cd(`${root}`); + + await $`npm run prettier:format`; + + console.log('Done!'); + }); +}); diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 9630cf4e..6721977a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,9 +5,11 @@ ### Added - feat!: add support for proof of absence in Certificate lookups +- feat: `update-management-idl` automation to update the management canister IDL in `@dfinity/agent` ### Changed +- chore: update management canister interface with latest bitcoin features - fix: publish script will correctly update the `package-lock.json` file with the correct dependencies when making a new release - chore: updates agent error response to read "Gateway returns error" instead of "Server"` - chore: updates dfinity/conventional-pr-title-action to v4.0.0 diff --git a/package-lock.json b/package-lock.json index 10abd6e7..ed362955 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,7 +40,8 @@ "typescript": "^5.2.2", "url": "^0.11.3", "webcrypto-core": "^1.7.7", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "zx": "^8.1.2" }, "engines": { "node": "^12 || ^14 || ^16 || >=17", @@ -5358,9 +5359,10 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "20.11.19", + "version": "20.14.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.1.tgz", + "integrity": "sha512-T2MzSGEu+ysB/FkWfqmhV3PLyQlowdptmmgD20C6QxsS8Fmv5SjpZ1ayXaEC0S21/h5UJ9iA6W/5vSNU5l00OA==", "dev": true, - "license": "MIT", "dependencies": { "undici-types": "~5.26.4" } @@ -20682,6 +20684,22 @@ "url": "https://github.com/sponsors/wooorm" } }, + "node_modules/zx": { + "version": "8.1.2", + "resolved": "https://registry.npmjs.org/zx/-/zx-8.1.2.tgz", + "integrity": "sha512-zkCiXKh8D/eo6r58OmJvO5mc2NthcSRvysb3fuS6VQlHPbEPBcxduRwM3m6ZfHj+7cLHcrahCnuO2TDAbW+6xw==", + "dev": true, + "bin": { + "zx": "build/cli.js" + }, + "engines": { + "node": ">= 12.17.0" + }, + "optionalDependencies": { + "@types/fs-extra": "^11.0.4", + "@types/node": ">=20.12.12" + } + }, "packages/agent": { "name": "@dfinity/agent", "version": "1.3.0", diff --git a/package.json b/package.json index 7be5da62..7f30f593 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,8 @@ "typescript": "^5.2.2", "url": "^0.11.3", "webcrypto-core": "^1.7.7", - "yargs": "^17.7.2" + "yargs": "^17.7.2", + "zx": "^8.1.2" }, "engines": { "node": "^12 || ^14 || ^16 || >=17", @@ -68,7 +69,8 @@ "prepare": "husky install", "prettier:check": "npx -p prettier -p pretty-quick pretty-quick --check", "prettier:format": "npx -p prettier -p pretty-quick pretty-quick", - "postversion": "npm run prettier:format" + "postversion": "npm run prettier:format", + "update-management-idl": "ts-node bin/update-management-idl.ts" }, "repository": { "type": "git", diff --git a/packages/agent/src/actor.ts b/packages/agent/src/actor.ts index 42834339..cc4193ea 100644 --- a/packages/agent/src/actor.ts +++ b/packages/agent/src/actor.ts @@ -16,7 +16,7 @@ import { RequestId } from './request_id'; import { toHex } from './utils/buffer'; import { CreateCertificateOptions } from './certificate'; import managementCanisterIdl from './canisters/management_idl'; -import _SERVICE, { canister_settings } from './canisters/management_service'; +import _SERVICE, { canister_install_mode, canister_settings } from './canisters/management_service'; export class ActorCallError extends AgentError { constructor( @@ -243,7 +243,7 @@ export class Actor { public static async install( fields: { module: ArrayBuffer; - mode?: CanisterInstallMode; + mode?: canister_install_mode; arg?: ArrayBuffer; }, config: ActorConfig, diff --git a/packages/agent/src/canisters/management.did b/packages/agent/src/canisters/management.did index 33db98ba..5af5069a 100644 --- a/packages/agent/src/canisters/management.did +++ b/packages/agent/src/canisters/management.did @@ -1,83 +1,84 @@ -// https://github.com/dfinity/interface-spec/blob/master/spec/_attachments/ic.did type canister_id = principal; type wasm_module = blob; type log_visibility = variant { - controllers; - public; + controllers; + public; }; type canister_settings = record { - controllers : opt vec principal; - compute_allocation : opt nat; - memory_allocation : opt nat; - freezing_threshold : opt nat; - reserved_cycles_limit : opt nat; - log_visibility : opt log_visibility; + controllers : opt vec principal; + compute_allocation : opt nat; + memory_allocation : opt nat; + freezing_threshold : opt nat; + reserved_cycles_limit : opt nat; + log_visibility : opt log_visibility; }; type definite_canister_settings = record { - controllers : vec principal; - compute_allocation : nat; - memory_allocation : nat; - freezing_threshold : nat; - reserved_cycles_limit : nat; - log_visibility : log_visibility; + controllers : vec principal; + compute_allocation : nat; + memory_allocation : nat; + freezing_threshold : nat; + reserved_cycles_limit : nat; + log_visibility : log_visibility; }; type change_origin = variant { - from_user : record { - user_id : principal; - }; - from_canister : record { - canister_id : principal; - canister_version : opt nat64; - }; + from_user : record { + user_id : principal; + }; + from_canister : record { + canister_id : principal; + canister_version : opt nat64; + }; }; type change_details = variant { - creation : record { - controllers : vec principal; - }; - code_uninstall; - code_deployment : record { - mode : variant { install; reinstall; upgrade }; - module_hash : blob; - }; - controllers_change : record { - controllers : vec principal; - }; + creation : record { + controllers : vec principal; + }; + code_uninstall; + code_deployment : record { + mode : variant { install; reinstall; upgrade }; + module_hash : blob; + }; + controllers_change : record { + controllers : vec principal; + }; }; type change = record { - timestamp_nanos : nat64; - canister_version : nat64; - origin : change_origin; - details : change_details; + timestamp_nanos : nat64; + canister_version : nat64; + origin : change_origin; + details : change_details; }; -type chunk_hash = blob; +type chunk_hash = record { + hash : blob; +}; type http_header = record { - name : text; - value : text; + name : text; + value : text; }; type http_request_result = record { - status : nat; - headers : vec http_header; - body : blob; + status : nat; + headers : vec http_header; + body : blob; }; type ecdsa_curve = variant { - secp256k1; + secp256k1; }; type satoshi = nat64; type bitcoin_network = variant { - mainnet; - testnet; + mainnet; + testnet; }; type bitcoin_address = text; @@ -85,239 +86,245 @@ type bitcoin_address = text; type block_hash = blob; type outpoint = record { - txid : blob; - vout : nat32; + txid : blob; + vout : nat32; }; type utxo = record { - outpoint : outpoint; - value : satoshi; - height : nat32; + outpoint : outpoint; + value : satoshi; + height : nat32; }; type bitcoin_get_utxos_args = record { - address : bitcoin_address; - network : bitcoin_network; - filter : opt variant { - min_confirmations : nat32; - page : blob; - }; + address : bitcoin_address; + network : bitcoin_network; + filter : opt variant { + min_confirmations : nat32; + page : blob; + }; }; type bitcoin_get_utxos_query_args = record { - address : bitcoin_address; - network : bitcoin_network; - filter : opt variant { - min_confirmations : nat32; - page : blob; - }; + address : bitcoin_address; + network : bitcoin_network; + filter : opt variant { + min_confirmations : nat32; + page : blob; + }; }; type bitcoin_get_current_fee_percentiles_args = record { - network : bitcoin_network; + network : bitcoin_network; }; type bitcoin_get_utxos_result = record { - utxos : vec utxo; - tip_block_hash : block_hash; - tip_height : nat32; - next_page : opt blob; + utxos : vec utxo; + tip_block_hash : block_hash; + tip_height : nat32; + next_page : opt blob; }; type bitcoin_get_utxos_query_result = record { - utxos : vec utxo; - tip_block_hash : block_hash; - tip_height : nat32; - next_page : opt blob; + utxos : vec utxo; + tip_block_hash : block_hash; + tip_height : nat32; + next_page : opt blob; }; type bitcoin_get_balance_args = record { - address : bitcoin_address; - network : bitcoin_network; - min_confirmations : opt nat32; + address : bitcoin_address; + network : bitcoin_network; + min_confirmations : opt nat32; }; type bitcoin_get_balance_query_args = record { - address : bitcoin_address; - network : bitcoin_network; - min_confirmations : opt nat32; + address : bitcoin_address; + network : bitcoin_network; + min_confirmations : opt nat32; }; type bitcoin_send_transaction_args = record { - transaction : blob; - network : bitcoin_network; + transaction : blob; + network : bitcoin_network; }; type millisatoshi_per_byte = nat64; type node_metrics = record { - node_id : principal; - num_blocks_total : nat64; - num_block_failures_total : nat64; + node_id : principal; + num_blocks_proposed_total : nat64; + num_block_failures_total : nat64; }; type create_canister_args = record { - settings : opt canister_settings; - sender_canister_version : opt nat64; + settings : opt canister_settings; + sender_canister_version : opt nat64; }; type create_canister_result = record { - canister_id : canister_id; + canister_id : canister_id; }; type update_settings_args = record { - canister_id : principal; - settings : canister_settings; - sender_canister_version : opt nat64; + canister_id : principal; + settings : canister_settings; + sender_canister_version : opt nat64; }; type upload_chunk_args = record { - canister_id : principal; - chunk : blob; + canister_id : principal; + chunk : blob; }; type clear_chunk_store_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type stored_chunks_args = record { - canister_id : canister_id; + canister_id : canister_id; }; -type install_code_args = record { - mode : variant { +type canister_install_mode = variant { install; reinstall; upgrade : opt record { - skip_pre_upgrade : opt bool; + skip_pre_upgrade : opt bool; + wasm_memory_persistence : opt variant { + keep; + replace; + }; }; - }; - canister_id : canister_id; - wasm_module : wasm_module; - arg : blob; - sender_canister_version : opt nat64; +}; + +type install_code_args = record { + mode : canister_install_mode; + canister_id : canister_id; + wasm_module : wasm_module; + arg : blob; + sender_canister_version : opt nat64; }; type install_chunked_code_args = record { - mode : variant { - install; - reinstall; - upgrade : opt record { - skip_pre_upgrade : opt bool; - }; - }; - target_canister : canister_id; - storage_canister : opt canister_id; - chunk_hashes_list : vec chunk_hash; - wasm_module_hash : blob; - arg : blob; - sender_canister_version : opt nat64; + mode : canister_install_mode; + target_canister : canister_id; + store_canister : opt canister_id; + chunk_hashes_list : vec chunk_hash; + wasm_module_hash : blob; + arg : blob; + sender_canister_version : opt nat64; }; type uninstall_code_args = record { - canister_id : canister_id; - sender_canister_version : opt nat64; + canister_id : canister_id; + sender_canister_version : opt nat64; }; type start_canister_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type stop_canister_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type canister_status_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type canister_status_result = record { - status : variant { running; stopping; stopped }; - settings : definite_canister_settings; - module_hash : opt blob; - memory_size : nat; - cycles : nat; - reserved_cycles : nat; - idle_cycles_burned_per_day : nat; + status : variant { running; stopping; stopped }; + settings : definite_canister_settings; + module_hash : opt blob; + memory_size : nat; + cycles : nat; + reserved_cycles : nat; + idle_cycles_burned_per_day : nat; + query_stats: record { + num_calls_total: nat; + num_instructions_total: nat; + request_payload_bytes_total: nat; + response_payload_bytes_total: nat; + }; }; type canister_info_args = record { - canister_id : canister_id; - num_requested_changes : opt nat64; + canister_id : canister_id; + num_requested_changes : opt nat64; }; type canister_info_result = record { - total_num_changes : nat64; - recent_changes : vec change; - module_hash : opt blob; - controllers : vec principal; + total_num_changes : nat64; + recent_changes : vec change; + module_hash : opt blob; + controllers : vec principal; }; type delete_canister_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type deposit_cycles_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type http_request_args = record { - url : text; - max_response_bytes : opt nat64; - method : variant { get; head; post }; - headers : vec http_header; - body : opt blob; - transform : opt record { - function : func(record { response : http_request_result; context : blob }) -> (http_request_result) query; - context : blob; - }; + url : text; + max_response_bytes : opt nat64; + method : variant { get; head; post }; + headers : vec http_header; + body : opt blob; + transform : opt record { + function : func(record { response : http_request_result; context : blob }) -> (http_request_result) query; + context : blob; + }; }; type ecdsa_public_key_args = record { - canister_id : opt canister_id; - derivation_path : vec blob; - key_id : record { curve : ecdsa_curve; name : text }; + canister_id : opt canister_id; + derivation_path : vec blob; + key_id : record { curve : ecdsa_curve; name : text }; }; type ecdsa_public_key_result = record { - public_key : blob; - chain_code : blob; + public_key : blob; + chain_code : blob; }; type sign_with_ecdsa_args = record { - message_hash : blob; - derivation_path : vec blob; - key_id : record { curve : ecdsa_curve; name : text }; + message_hash : blob; + derivation_path : vec blob; + key_id : record { curve : ecdsa_curve; name : text }; }; type sign_with_ecdsa_result = record { - signature : blob; + signature : blob; }; type node_metrics_history_args = record { - subnet_id : principal; - start_at_timestamp_nanos : nat64; + subnet_id : principal; + start_at_timestamp_nanos : nat64; }; type node_metrics_history_result = vec record { - timestamp_nanos : nat64; - node_metrics : vec node_metrics; + timestamp_nanos : nat64; + node_metrics : vec node_metrics; }; type provisional_create_canister_with_cycles_args = record { - amount : opt nat; - settings : opt canister_settings; - specified_id : opt canister_id; - sender_canister_version : opt nat64; + amount : opt nat; + settings : opt canister_settings; + specified_id : opt canister_id; + sender_canister_version : opt nat64; }; type provisional_create_canister_with_cycles_result = record { - canister_id : canister_id; + canister_id : canister_id; }; type provisional_top_up_canister_args = record { - canister_id : canister_id; - amount : nat; + canister_id : canister_id; + amount : nat; }; type raw_rand_result = blob; @@ -333,56 +340,57 @@ type bitcoin_get_balance_query_result = satoshi; type bitcoin_get_current_fee_percentiles_result = vec millisatoshi_per_byte; type fetch_canister_logs_args = record { - canister_id : canister_id; + canister_id : canister_id; }; type canister_log_record = record { - idx : nat64; - timestamp_nanos : nat64; - content : blob; + idx: nat64; + timestamp_nanos: nat64; + content: blob; }; type fetch_canister_logs_result = record { - canister_log_records : vec canister_log_record; + canister_log_records: vec canister_log_record; }; service ic : { - create_canister : (create_canister_args) -> (create_canister_result); - update_settings : (update_settings_args) -> (); - upload_chunk : (upload_chunk_args) -> (upload_chunk_result); - clear_chunk_store : (clear_chunk_store_args) -> (); - stored_chunks : (stored_chunks_args) -> (stored_chunks_result); - install_code : (install_code_args) -> (); - install_chunked_code : (install_chunked_code_args) -> (); - uninstall_code : (uninstall_code_args) -> (); - start_canister : (start_canister_args) -> (); - stop_canister : (stop_canister_args) -> (); - canister_status : (canister_status_args) -> (canister_status_result); - canister_info : (canister_info_args) -> (canister_info_result); - delete_canister : (delete_canister_args) -> (); - deposit_cycles : (deposit_cycles_args) -> (); - raw_rand : () -> (raw_rand_result); - http_request : (http_request_args) -> (http_request_result); - - // Threshold ECDSA signature - ecdsa_public_key : (ecdsa_public_key_args) -> (ecdsa_public_key_result); - sign_with_ecdsa : (sign_with_ecdsa_args) -> (sign_with_ecdsa_result); - - // bitcoin interface - bitcoin_get_balance : (bitcoin_get_balance_args) -> (bitcoin_get_balance_result); - bitcoin_get_balance_query : (bitcoin_get_balance_query_args) -> (bitcoin_get_balance_query_result) query; - bitcoin_get_utxos : (bitcoin_get_utxos_args) -> (bitcoin_get_utxos_result); - bitcoin_get_utxos_query : (bitcoin_get_utxos_query_args) -> (bitcoin_get_utxos_query_result) query; - bitcoin_send_transaction : (bitcoin_send_transaction_args) -> (); - bitcoin_get_current_fee_percentiles : (bitcoin_get_current_fee_percentiles_args) -> (bitcoin_get_current_fee_percentiles_result); - - // metrics interface - node_metrics_history : (node_metrics_history_args) -> (node_metrics_history_result); - - // provisional interfaces for the pre-ledger world - provisional_create_canister_with_cycles : (provisional_create_canister_with_cycles_args) -> (provisional_create_canister_with_cycles_result); - provisional_top_up_canister : (provisional_top_up_canister_args) -> (); - - // canister logging - fetch_canister_logs : (fetch_canister_logs_args) -> (fetch_canister_logs_result) query; + create_canister : (create_canister_args) -> (create_canister_result); + update_settings : (update_settings_args) -> (); + upload_chunk : (upload_chunk_args) -> (upload_chunk_result); + clear_chunk_store : (clear_chunk_store_args) -> (); + stored_chunks : (stored_chunks_args) -> (stored_chunks_result); + install_code : (install_code_args) -> (); + install_chunked_code : (install_chunked_code_args) -> (); + uninstall_code : (uninstall_code_args) -> (); + start_canister : (start_canister_args) -> (); + stop_canister : (stop_canister_args) -> (); + canister_status : (canister_status_args) -> (canister_status_result); + canister_info : (canister_info_args) -> (canister_info_result); + delete_canister : (delete_canister_args) -> (); + deposit_cycles : (deposit_cycles_args) -> (); + raw_rand : () -> (raw_rand_result); + http_request : (http_request_args) -> (http_request_result); + + // Threshold ECDSA signature + ecdsa_public_key : (ecdsa_public_key_args) -> (ecdsa_public_key_result); + sign_with_ecdsa : (sign_with_ecdsa_args) -> (sign_with_ecdsa_result); + + // bitcoin interface + bitcoin_get_balance : (bitcoin_get_balance_args) -> (bitcoin_get_balance_result); + bitcoin_get_balance_query : (bitcoin_get_balance_query_args) -> (bitcoin_get_balance_query_result) query; + bitcoin_get_utxos : (bitcoin_get_utxos_args) -> (bitcoin_get_utxos_result); + bitcoin_get_utxos_query : (bitcoin_get_utxos_query_args) -> (bitcoin_get_utxos_query_result) query; + bitcoin_send_transaction : (bitcoin_send_transaction_args) -> (); + bitcoin_get_current_fee_percentiles : (bitcoin_get_current_fee_percentiles_args) -> (bitcoin_get_current_fee_percentiles_result); + + // metrics interface + node_metrics_history : (node_metrics_history_args) -> (node_metrics_history_result); + + // provisional interfaces for the pre-ledger world + provisional_create_canister_with_cycles : (provisional_create_canister_with_cycles_args) -> (provisional_create_canister_with_cycles_result); + provisional_top_up_canister : (provisional_top_up_canister_args) -> (); + + // canister logging + fetch_canister_logs : (fetch_canister_logs_args) -> (fetch_canister_logs_result) query; }; + diff --git a/packages/agent/src/canisters/management_idl.ts b/packages/agent/src/canisters/management_idl.ts index bad5b8ea..aaf376a2 100644 --- a/packages/agent/src/canisters/management_idl.ts +++ b/packages/agent/src/canisters/management_idl.ts @@ -1,10 +1,10 @@ -/** +/* * This file is generated from the candid for asset management. - * didc version: 0.3.6 + * didc version: 0.4.0 */ - // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore + export default ({ IDL }) => { const bitcoin_network = IDL.Variant({ mainnet: IDL.Null, @@ -136,6 +136,12 @@ export default ({ IDL }) => { memory_size: IDL.Nat, cycles: IDL.Nat, settings: definite_canister_settings, + query_stats: IDL.Record({ + response_payload_bytes_total: IDL.Nat, + num_instructions_total: IDL.Nat, + num_calls_total: IDL.Nat, + request_payload_bytes_total: IDL.Nat, + }), idle_cycles_burned_per_day: IDL.Nat, module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), reserved_cycles: IDL.Nat, @@ -207,29 +213,31 @@ export default ({ IDL }) => { ), headers: IDL.Vec(http_header), }); - const chunk_hash = IDL.Vec(IDL.Nat8); + const canister_install_mode = IDL.Variant({ + reinstall: IDL.Null, + upgrade: IDL.Opt( + IDL.Record({ + wasm_memory_persistence: IDL.Opt(IDL.Variant({ keep: IDL.Null, replace: IDL.Null })), + skip_pre_upgrade: IDL.Opt(IDL.Bool), + }), + ), + install: IDL.Null, + }); + const chunk_hash = IDL.Record({ hash: IDL.Vec(IDL.Nat8) }); const install_chunked_code_args = IDL.Record({ arg: IDL.Vec(IDL.Nat8), wasm_module_hash: IDL.Vec(IDL.Nat8), - mode: IDL.Variant({ - reinstall: IDL.Null, - upgrade: IDL.Opt(IDL.Record({ skip_pre_upgrade: IDL.Opt(IDL.Bool) })), - install: IDL.Null, - }), + mode: canister_install_mode, chunk_hashes_list: IDL.Vec(chunk_hash), target_canister: canister_id, + store_canister: IDL.Opt(canister_id), sender_canister_version: IDL.Opt(IDL.Nat64), - storage_canister: IDL.Opt(canister_id), }); const wasm_module = IDL.Vec(IDL.Nat8); const install_code_args = IDL.Record({ arg: IDL.Vec(IDL.Nat8), wasm_module: wasm_module, - mode: IDL.Variant({ - reinstall: IDL.Null, - upgrade: IDL.Opt(IDL.Record({ skip_pre_upgrade: IDL.Opt(IDL.Bool) })), - install: IDL.Null, - }), + mode: canister_install_mode, canister_id: canister_id, sender_canister_version: IDL.Opt(IDL.Nat64), }); @@ -240,7 +248,7 @@ export default ({ IDL }) => { const node_metrics = IDL.Record({ num_block_failures_total: IDL.Nat64, node_id: IDL.Principal, - num_blocks_total: IDL.Nat64, + num_blocks_proposed_total: IDL.Nat64, }); const node_metrics_history_result = IDL.Vec( IDL.Record({ diff --git a/packages/agent/src/canisters/management_service.ts b/packages/agent/src/canisters/management_service.ts index 8cedd28d..10041ac2 100644 --- a/packages/agent/src/canisters/management_service.ts +++ b/packages/agent/src/canisters/management_service.ts @@ -1,10 +1,10 @@ -/** +/* * This file is generated from the candid for asset management. - * didc version: 0.3.6 + * didc version: 0.4.0 */ - // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore + import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; import type { IDL } from '@dfinity/candid'; @@ -65,6 +65,19 @@ export interface canister_info_result { recent_changes: Array; total_num_changes: bigint; } +export type canister_install_mode = + | { reinstall: null } + | { + upgrade: + | [] + | [ + { + wasm_memory_persistence: [] | [{ keep: null } | { replace: null }]; + skip_pre_upgrade: [] | [boolean]; + }, + ]; + } + | { install: null }; export interface canister_log_record { idx: bigint; timestamp_nanos: bigint; @@ -86,6 +99,12 @@ export interface canister_status_result { memory_size: bigint; cycles: bigint; settings: definite_canister_settings; + query_stats: { + response_payload_bytes_total: bigint; + num_instructions_total: bigint; + num_calls_total: bigint; + request_payload_bytes_total: bigint; + }; idle_cycles_burned_per_day: bigint; module_hash: [] | [Uint8Array | number[]]; reserved_cycles: bigint; @@ -116,7 +135,9 @@ export type change_origin = canister_id: Principal; }; }; -export type chunk_hash = Uint8Array | number[]; +export interface chunk_hash { + hash: Uint8Array | number[]; +} export interface clear_chunk_store_args { canister_id: canister_id; } @@ -177,22 +198,16 @@ export interface http_request_result { export interface install_chunked_code_args { arg: Uint8Array | number[]; wasm_module_hash: Uint8Array | number[]; - mode: - | { reinstall: null } - | { upgrade: [] | [{ skip_pre_upgrade: [] | [boolean] }] } - | { install: null }; + mode: canister_install_mode; chunk_hashes_list: Array; target_canister: canister_id; + store_canister: [] | [canister_id]; sender_canister_version: [] | [bigint]; - storage_canister: [] | [canister_id]; } export interface install_code_args { arg: Uint8Array | number[]; wasm_module: wasm_module; - mode: - | { reinstall: null } - | { upgrade: [] | [{ skip_pre_upgrade: [] | [boolean] }] } - | { install: null }; + mode: canister_install_mode; canister_id: canister_id; sender_canister_version: [] | [bigint]; } @@ -201,7 +216,7 @@ export type millisatoshi_per_byte = bigint; export interface node_metrics { num_block_failures_total: bigint; node_id: Principal; - num_blocks_total: bigint; + num_blocks_proposed_total: bigint; } export interface node_metrics_history_args { start_at_timestamp_nanos: bigint;