diff --git a/candid/ic.did b/candid/ic.did index 702b7ef49..b4ed746f2 100644 --- a/candid/ic.did +++ b/candid/ic.did @@ -1,9 +1,12 @@ +// Generated from dfinity/portal commit 7b300dc97a1636f8134410e9a40f3556acf9b496 for file 'docs/references/_attachments/ic.did' type canister_id = principal; type wasm_module = blob; +type snapshot_id = blob; type log_visibility = variant { controllers; public; + allowed_viewers : vec principal; }; type canister_settings = record { @@ -45,6 +48,11 @@ type change_details = variant { mode : variant { install; reinstall; upgrade }; module_hash : blob; }; + load_snapshot : record { + canister_version : nat64; + snapshot_id : snapshot_id; + taken_at_timestamp : nat64; + }; controllers_change : record { controllers : vec principal; }; @@ -90,7 +98,13 @@ type bitcoin_network = variant { type bitcoin_address = text; -type block_hash = blob; +type bitcoin_block_hash = blob; + +type bitcoin_block_header = blob; + +type millisatoshi_per_byte = nat64; + +type bitcoin_block_height = nat32; type outpoint = record { txid : blob; @@ -112,30 +126,10 @@ type bitcoin_get_utxos_args = record { }; }; -type bitcoin_get_utxos_query_args = record { - 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; -}; - type bitcoin_get_utxos_result = record { 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; + tip_block_hash : bitcoin_block_hash; + tip_height : bitcoin_block_height; next_page : opt blob; }; @@ -145,18 +139,29 @@ type bitcoin_get_balance_args = record { min_confirmations : opt nat32; }; -type bitcoin_get_balance_query_args = record { - address : bitcoin_address; +type bitcoin_get_balance_result = satoshi; + +type bitcoin_get_current_fee_percentiles_args = record { network : bitcoin_network; - min_confirmations : opt nat32; }; +type bitcoin_get_current_fee_percentiles_result = vec millisatoshi_per_byte; + type bitcoin_send_transaction_args = record { transaction : blob; network : bitcoin_network; }; -type millisatoshi_per_byte = nat64; +type bitcoin_get_block_headers_args = record { + start_height : bitcoin_block_height; + end_height : opt bitcoin_block_height; + network: bitcoin_network; +}; + +type bitcoin_get_block_headers_result = record { + tip_height : bitcoin_block_height; + block_headers : vec bitcoin_block_header; +}; type node_metrics = record { node_id : principal; @@ -339,6 +344,14 @@ type node_metrics_history_result = vec record { node_metrics : vec node_metrics; }; +type subnet_info_args = record { + subnet_id : principal; +}; + +type subnet_info_result = record { + replica_version : text; +}; + type provisional_create_canister_with_cycles_args = record { amount : opt nat; settings : opt canister_settings; @@ -361,11 +374,35 @@ type stored_chunks_result = vec chunk_hash; type upload_chunk_result = chunk_hash; -type bitcoin_get_balance_result = satoshi; +type snapshot = record { + id : snapshot_id; + taken_at_timestamp : nat64; + total_size : nat64; +}; -type bitcoin_get_balance_query_result = satoshi; +type take_canister_snapshot_args = record { + canister_id : canister_id; + replace_snapshot : opt snapshot_id; +}; -type bitcoin_get_current_fee_percentiles_result = vec millisatoshi_per_byte; +type take_canister_snapshot_result = snapshot; + +type load_canister_snapshot_args = record { + canister_id : canister_id; + snapshot_id : snapshot_id; + sender_canister_version : opt nat64; +}; + +type list_canister_snapshots_args = record { + canister_id : canister_id; +}; + +type list_canister_snapshots_result = vec snapshot; + +type delete_canister_snapshot_args = record { + canister_id : canister_id; + snapshot_id : snapshot_id; +}; type fetch_canister_logs_args = record { canister_id : canister_id; @@ -409,19 +446,27 @@ service ic : { // 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); + bitcoin_get_block_headers : (bitcoin_get_block_headers_args) -> (bitcoin_get_block_headers_result); // metrics interface node_metrics_history : (node_metrics_history_args) -> (node_metrics_history_result); + // subnet info + subnet_info : (subnet_info_args) -> (subnet_info_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 snapshots + take_canister_snapshot : (take_canister_snapshot_args) -> (take_canister_snapshot_result); + load_canister_snapshot : (load_canister_snapshot_args) -> (); + list_canister_snapshots : (list_canister_snapshots_args) -> (list_canister_snapshots_result); + delete_canister_snapshot : (delete_canister_snapshot_args) -> (); + // canister logging fetch_canister_logs : (fetch_canister_logs_args) -> (fetch_canister_logs_result) query; }; diff --git a/scripts/did.ic.sh b/scripts/did.ic.sh new file mode 100755 index 000000000..f3a5b07fb --- /dev/null +++ b/scripts/did.ic.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +download_did() { + local raw_url="$1" + local out_filename="$2" + local folder="$3" + + local out_path="${folder}/${out_filename}" + + # Extract repository, branch, and file path from the raw URL + local repo=$(echo "$raw_url" | awk -F '/' '{print $4"/"$5}') + local branch=$(echo "$raw_url" | awk -F '/' '{print $6}') + local file_path=$(echo "$raw_url" | awk -F "$branch/" '{print $2}') + + # Get the latest commit hash for the specified file + local api_url="https://api.github.com/repos/${repo}/commits?path=${file_path}&sha=${branch}" + local commit_hash=$(curl -s "$api_url" | jq -r '.[0].sha') + + if [ -z "$commit_hash" ]; then + echo "Failed to retrieve commit hash for ${file_path} in ${repo}." + return 1 + fi + + echo "Downloading ${raw_url} -> REPO_ROOT/${out_path}" + { + echo "// Generated from ${repo} commit ${commit_hash} for file '${file_path}'" + curl -s "$raw_url" + } >"${out_path}" +} + +download_did https://raw.githubusercontent.com/dfinity/portal/master/docs/references/_attachments/ic.did "ic.did" "candid" \ No newline at end of file diff --git a/src/declarations/ic/ic.did.d.ts b/src/declarations/ic/ic.did.d.ts index f3bf13a37..6b9217d4a 100644 --- a/src/declarations/ic/ic.did.d.ts +++ b/src/declarations/ic/ic.did.d.ts @@ -3,18 +3,24 @@ import type { IDL } from '@dfinity/candid'; import type { Principal } from '@dfinity/principal'; export type bitcoin_address = string; +export type bitcoin_block_hash = Uint8Array | number[]; +export type bitcoin_block_header = Uint8Array | number[]; +export type bitcoin_block_height = number; export interface bitcoin_get_balance_args { network: bitcoin_network; address: bitcoin_address; min_confirmations: [] | [number]; } -export interface bitcoin_get_balance_query_args { +export type bitcoin_get_balance_result = satoshi; +export interface bitcoin_get_block_headers_args { + start_height: bitcoin_block_height; + end_height: [] | [bitcoin_block_height]; network: bitcoin_network; - address: bitcoin_address; - min_confirmations: [] | [number]; } -export type bitcoin_get_balance_query_result = satoshi; -export type bitcoin_get_balance_result = satoshi; +export interface bitcoin_get_block_headers_result { + tip_height: bitcoin_block_height; + block_headers: Array; +} export interface bitcoin_get_current_fee_percentiles_args { network: bitcoin_network; } @@ -24,21 +30,10 @@ export interface bitcoin_get_utxos_args { filter: [] | [{ page: Uint8Array | number[] } | { min_confirmations: number }]; address: bitcoin_address; } -export interface bitcoin_get_utxos_query_args { - network: bitcoin_network; - filter: [] | [{ page: Uint8Array | number[] } | { min_confirmations: number }]; - address: bitcoin_address; -} -export interface bitcoin_get_utxos_query_result { - next_page: [] | [Uint8Array | number[]]; - tip_height: number; - tip_block_hash: block_hash; - utxos: Array; -} export interface bitcoin_get_utxos_result { next_page: [] | [Uint8Array | number[]]; - tip_height: number; - tip_block_hash: block_hash; + tip_height: bitcoin_block_height; + tip_block_hash: bitcoin_block_hash; utxos: Array; } export type bitcoin_network = { mainnet: null } | { testnet: null }; @@ -46,7 +41,6 @@ export interface bitcoin_send_transaction_args { transaction: Uint8Array | number[]; network: bitcoin_network; } -export type block_hash = Uint8Array | number[]; export type canister_id = Principal; export interface canister_info_args { canister_id: canister_id; @@ -119,6 +113,13 @@ export type change_details = module_hash: Uint8Array | number[]; }; } + | { + load_snapshot: { + canister_version: bigint; + taken_at_timestamp: bigint; + snapshot_id: snapshot_id; + }; + } | { controllers_change: { controllers: Array } } | { code_uninstall: null }; export type change_origin = @@ -154,6 +155,10 @@ export interface definite_canister_settings { export interface delete_canister_args { canister_id: canister_id; } +export interface delete_canister_snapshot_args { + canister_id: canister_id; + snapshot_id: snapshot_id; +} export interface deposit_cycles_args { canister_id: canister_id; } @@ -206,7 +211,19 @@ export interface install_code_args { canister_id: canister_id; sender_canister_version: [] | [bigint]; } -export type log_visibility = { controllers: null } | { public: null }; +export interface list_canister_snapshots_args { + canister_id: canister_id; +} +export type list_canister_snapshots_result = Array; +export interface load_canister_snapshot_args { + canister_id: canister_id; + sender_canister_version: [] | [bigint]; + snapshot_id: snapshot_id; +} +export type log_visibility = + | { controllers: null } + | { public: null } + | { allowed_viewers: Array }; export type millisatoshi_per_byte = bigint; export interface node_metrics { num_block_failures_total: bigint; @@ -266,6 +283,12 @@ export interface sign_with_schnorr_args { export interface sign_with_schnorr_result { signature: Uint8Array | number[]; } +export interface snapshot { + id: snapshot_id; + total_size: bigint; + taken_at_timestamp: bigint; +} +export type snapshot_id = Uint8Array | number[]; export interface start_canister_args { canister_id: canister_id; } @@ -276,6 +299,17 @@ export interface stored_chunks_args { canister_id: canister_id; } export type stored_chunks_result = Array; +export interface subnet_info_args { + subnet_id: Principal; +} +export interface subnet_info_result { + replica_version: string; +} +export interface take_canister_snapshot_args { + replace_snapshot: [] | [snapshot_id]; + canister_id: canister_id; +} +export type take_canister_snapshot_result = snapshot; export interface uninstall_code_args { canister_id: canister_id; sender_canister_version: [] | [bigint]; @@ -298,31 +332,33 @@ export interface utxo { export type wasm_module = Uint8Array | number[]; export interface _SERVICE { bitcoin_get_balance: ActorMethod<[bitcoin_get_balance_args], bitcoin_get_balance_result>; - bitcoin_get_balance_query: ActorMethod< - [bitcoin_get_balance_query_args], - bitcoin_get_balance_query_result + bitcoin_get_block_headers: ActorMethod< + [bitcoin_get_block_headers_args], + bitcoin_get_block_headers_result >; bitcoin_get_current_fee_percentiles: ActorMethod< [bitcoin_get_current_fee_percentiles_args], bitcoin_get_current_fee_percentiles_result >; bitcoin_get_utxos: ActorMethod<[bitcoin_get_utxos_args], bitcoin_get_utxos_result>; - bitcoin_get_utxos_query: ActorMethod< - [bitcoin_get_utxos_query_args], - bitcoin_get_utxos_query_result - >; bitcoin_send_transaction: ActorMethod<[bitcoin_send_transaction_args], undefined>; canister_info: ActorMethod<[canister_info_args], canister_info_result>; canister_status: ActorMethod<[canister_status_args], canister_status_result>; clear_chunk_store: ActorMethod<[clear_chunk_store_args], undefined>; create_canister: ActorMethod<[create_canister_args], create_canister_result>; delete_canister: ActorMethod<[delete_canister_args], undefined>; + delete_canister_snapshot: ActorMethod<[delete_canister_snapshot_args], undefined>; deposit_cycles: ActorMethod<[deposit_cycles_args], undefined>; ecdsa_public_key: ActorMethod<[ecdsa_public_key_args], ecdsa_public_key_result>; fetch_canister_logs: ActorMethod<[fetch_canister_logs_args], fetch_canister_logs_result>; http_request: ActorMethod<[http_request_args], http_request_result>; install_chunked_code: ActorMethod<[install_chunked_code_args], undefined>; install_code: ActorMethod<[install_code_args], undefined>; + list_canister_snapshots: ActorMethod< + [list_canister_snapshots_args], + list_canister_snapshots_result + >; + load_canister_snapshot: ActorMethod<[load_canister_snapshot_args], undefined>; node_metrics_history: ActorMethod<[node_metrics_history_args], node_metrics_history_result>; provisional_create_canister_with_cycles: ActorMethod< [provisional_create_canister_with_cycles_args], @@ -336,6 +372,8 @@ export interface _SERVICE { start_canister: ActorMethod<[start_canister_args], undefined>; stop_canister: ActorMethod<[stop_canister_args], undefined>; stored_chunks: ActorMethod<[stored_chunks_args], stored_chunks_result>; + subnet_info: ActorMethod<[subnet_info_args], subnet_info_result>; + take_canister_snapshot: ActorMethod<[take_canister_snapshot_args], take_canister_snapshot_result>; uninstall_code: ActorMethod<[uninstall_code_args], undefined>; update_settings: ActorMethod<[update_settings_args], undefined>; upload_chunk: ActorMethod<[upload_chunk_args], upload_chunk_result>; diff --git a/src/declarations/ic/ic.factory.did.js b/src/declarations/ic/ic.factory.did.js index a3cd60498..f709bf40e 100644 --- a/src/declarations/ic/ic.factory.did.js +++ b/src/declarations/ic/ic.factory.did.js @@ -12,12 +12,17 @@ export const idlFactory = ({ IDL }) => { }); const satoshi = IDL.Nat64; const bitcoin_get_balance_result = satoshi; - const bitcoin_get_balance_query_args = IDL.Record({ - network: bitcoin_network, - address: bitcoin_address, - min_confirmations: IDL.Opt(IDL.Nat32) + const bitcoin_block_height = IDL.Nat32; + const bitcoin_get_block_headers_args = IDL.Record({ + start_height: bitcoin_block_height, + end_height: IDL.Opt(bitcoin_block_height), + network: bitcoin_network + }); + const bitcoin_block_header = IDL.Vec(IDL.Nat8); + const bitcoin_get_block_headers_result = IDL.Record({ + tip_height: bitcoin_block_height, + block_headers: IDL.Vec(bitcoin_block_header) }); - const bitcoin_get_balance_query_result = satoshi; const bitcoin_get_current_fee_percentiles_args = IDL.Record({ network: bitcoin_network }); @@ -33,7 +38,7 @@ export const idlFactory = ({ IDL }) => { ), address: bitcoin_address }); - const block_hash = IDL.Vec(IDL.Nat8); + const bitcoin_block_hash = IDL.Vec(IDL.Nat8); const outpoint = IDL.Record({ txid: IDL.Vec(IDL.Nat8), vout: IDL.Nat32 @@ -45,24 +50,8 @@ export const idlFactory = ({ IDL }) => { }); const bitcoin_get_utxos_result = IDL.Record({ next_page: IDL.Opt(IDL.Vec(IDL.Nat8)), - tip_height: IDL.Nat32, - tip_block_hash: block_hash, - utxos: IDL.Vec(utxo) - }); - const bitcoin_get_utxos_query_args = IDL.Record({ - network: bitcoin_network, - filter: IDL.Opt( - IDL.Variant({ - page: IDL.Vec(IDL.Nat8), - min_confirmations: IDL.Nat32 - }) - ), - address: bitcoin_address - }); - const bitcoin_get_utxos_query_result = IDL.Record({ - next_page: IDL.Opt(IDL.Vec(IDL.Nat8)), - tip_height: IDL.Nat32, - tip_block_hash: block_hash, + tip_height: bitcoin_block_height, + tip_block_hash: bitcoin_block_hash, utxos: IDL.Vec(utxo) }); const bitcoin_send_transaction_args = IDL.Record({ @@ -81,6 +70,7 @@ export const idlFactory = ({ IDL }) => { canister_id: IDL.Principal }) }); + const snapshot_id = IDL.Vec(IDL.Nat8); const change_details = IDL.Variant({ creation: IDL.Record({ controllers: IDL.Vec(IDL.Principal) }), code_deployment: IDL.Record({ @@ -91,6 +81,11 @@ export const idlFactory = ({ IDL }) => { }), module_hash: IDL.Vec(IDL.Nat8) }), + load_snapshot: IDL.Record({ + canister_version: IDL.Nat64, + taken_at_timestamp: IDL.Nat64, + snapshot_id: snapshot_id + }), controllers_change: IDL.Record({ controllers: IDL.Vec(IDL.Principal) }), @@ -111,7 +106,8 @@ export const idlFactory = ({ IDL }) => { const canister_status_args = IDL.Record({ canister_id: canister_id }); const log_visibility = IDL.Variant({ controllers: IDL.Null, - public: IDL.Null + public: IDL.Null, + allowed_viewers: IDL.Vec(IDL.Principal) }); const definite_canister_settings = IDL.Record({ freezing_threshold: IDL.Nat, @@ -157,6 +153,10 @@ export const idlFactory = ({ IDL }) => { }); const create_canister_result = IDL.Record({ canister_id: canister_id }); const delete_canister_args = IDL.Record({ canister_id: canister_id }); + const delete_canister_snapshot_args = IDL.Record({ + canister_id: canister_id, + snapshot_id: snapshot_id + }); const deposit_cycles_args = IDL.Record({ canister_id: canister_id }); const ecdsa_curve = IDL.Variant({ secp256k1: IDL.Null }); const ecdsa_public_key_args = IDL.Record({ @@ -237,6 +237,20 @@ export const idlFactory = ({ IDL }) => { canister_id: canister_id, sender_canister_version: IDL.Opt(IDL.Nat64) }); + const list_canister_snapshots_args = IDL.Record({ + canister_id: canister_id + }); + const snapshot = IDL.Record({ + id: snapshot_id, + total_size: IDL.Nat64, + taken_at_timestamp: IDL.Nat64 + }); + const list_canister_snapshots_result = IDL.Vec(snapshot); + const load_canister_snapshot_args = IDL.Record({ + canister_id: canister_id, + sender_canister_version: IDL.Opt(IDL.Nat64), + snapshot_id: snapshot_id + }); const node_metrics_history_args = IDL.Record({ start_at_timestamp_nanos: IDL.Nat64, subnet_id: IDL.Principal @@ -305,6 +319,13 @@ export const idlFactory = ({ IDL }) => { const stop_canister_args = IDL.Record({ canister_id: canister_id }); const stored_chunks_args = IDL.Record({ canister_id: canister_id }); const stored_chunks_result = IDL.Vec(chunk_hash); + const subnet_info_args = IDL.Record({ subnet_id: IDL.Principal }); + const subnet_info_result = IDL.Record({ replica_version: IDL.Text }); + const take_canister_snapshot_args = IDL.Record({ + replace_snapshot: IDL.Opt(snapshot_id), + canister_id: canister_id + }); + const take_canister_snapshot_result = snapshot; const uninstall_code_args = IDL.Record({ canister_id: canister_id, sender_canister_version: IDL.Opt(IDL.Nat64) @@ -321,10 +342,10 @@ export const idlFactory = ({ IDL }) => { const upload_chunk_result = chunk_hash; return IDL.Service({ bitcoin_get_balance: IDL.Func([bitcoin_get_balance_args], [bitcoin_get_balance_result], []), - bitcoin_get_balance_query: IDL.Func( - [bitcoin_get_balance_query_args], - [bitcoin_get_balance_query_result], - ['query'] + bitcoin_get_block_headers: IDL.Func( + [bitcoin_get_block_headers_args], + [bitcoin_get_block_headers_result], + [] ), bitcoin_get_current_fee_percentiles: IDL.Func( [bitcoin_get_current_fee_percentiles_args], @@ -332,17 +353,13 @@ export const idlFactory = ({ IDL }) => { [] ), bitcoin_get_utxos: IDL.Func([bitcoin_get_utxos_args], [bitcoin_get_utxos_result], []), - bitcoin_get_utxos_query: IDL.Func( - [bitcoin_get_utxos_query_args], - [bitcoin_get_utxos_query_result], - ['query'] - ), bitcoin_send_transaction: IDL.Func([bitcoin_send_transaction_args], [], []), canister_info: IDL.Func([canister_info_args], [canister_info_result], []), canister_status: IDL.Func([canister_status_args], [canister_status_result], []), clear_chunk_store: IDL.Func([clear_chunk_store_args], [], []), create_canister: IDL.Func([create_canister_args], [create_canister_result], []), delete_canister: IDL.Func([delete_canister_args], [], []), + delete_canister_snapshot: IDL.Func([delete_canister_snapshot_args], [], []), deposit_cycles: IDL.Func([deposit_cycles_args], [], []), ecdsa_public_key: IDL.Func([ecdsa_public_key_args], [ecdsa_public_key_result], []), fetch_canister_logs: IDL.Func( @@ -353,6 +370,12 @@ export const idlFactory = ({ IDL }) => { http_request: IDL.Func([http_request_args], [http_request_result], []), install_chunked_code: IDL.Func([install_chunked_code_args], [], []), install_code: IDL.Func([install_code_args], [], []), + list_canister_snapshots: IDL.Func( + [list_canister_snapshots_args], + [list_canister_snapshots_result], + [] + ), + load_canister_snapshot: IDL.Func([load_canister_snapshot_args], [], []), node_metrics_history: IDL.Func([node_metrics_history_args], [node_metrics_history_result], []), provisional_create_canister_with_cycles: IDL.Func( [provisional_create_canister_with_cycles_args], @@ -367,6 +390,12 @@ export const idlFactory = ({ IDL }) => { start_canister: IDL.Func([start_canister_args], [], []), stop_canister: IDL.Func([stop_canister_args], [], []), stored_chunks: IDL.Func([stored_chunks_args], [stored_chunks_result], []), + subnet_info: IDL.Func([subnet_info_args], [subnet_info_result], []), + take_canister_snapshot: IDL.Func( + [take_canister_snapshot_args], + [take_canister_snapshot_result], + [] + ), uninstall_code: IDL.Func([uninstall_code_args], [], []), update_settings: IDL.Func([update_settings_args], [], []), upload_chunk: IDL.Func([upload_chunk_args], [upload_chunk_result], []) diff --git a/src/declarations/ic/ic.factory.did.mjs b/src/declarations/ic/ic.factory.did.mjs index a3cd60498..f709bf40e 100644 --- a/src/declarations/ic/ic.factory.did.mjs +++ b/src/declarations/ic/ic.factory.did.mjs @@ -12,12 +12,17 @@ export const idlFactory = ({ IDL }) => { }); const satoshi = IDL.Nat64; const bitcoin_get_balance_result = satoshi; - const bitcoin_get_balance_query_args = IDL.Record({ - network: bitcoin_network, - address: bitcoin_address, - min_confirmations: IDL.Opt(IDL.Nat32) + const bitcoin_block_height = IDL.Nat32; + const bitcoin_get_block_headers_args = IDL.Record({ + start_height: bitcoin_block_height, + end_height: IDL.Opt(bitcoin_block_height), + network: bitcoin_network + }); + const bitcoin_block_header = IDL.Vec(IDL.Nat8); + const bitcoin_get_block_headers_result = IDL.Record({ + tip_height: bitcoin_block_height, + block_headers: IDL.Vec(bitcoin_block_header) }); - const bitcoin_get_balance_query_result = satoshi; const bitcoin_get_current_fee_percentiles_args = IDL.Record({ network: bitcoin_network }); @@ -33,7 +38,7 @@ export const idlFactory = ({ IDL }) => { ), address: bitcoin_address }); - const block_hash = IDL.Vec(IDL.Nat8); + const bitcoin_block_hash = IDL.Vec(IDL.Nat8); const outpoint = IDL.Record({ txid: IDL.Vec(IDL.Nat8), vout: IDL.Nat32 @@ -45,24 +50,8 @@ export const idlFactory = ({ IDL }) => { }); const bitcoin_get_utxos_result = IDL.Record({ next_page: IDL.Opt(IDL.Vec(IDL.Nat8)), - tip_height: IDL.Nat32, - tip_block_hash: block_hash, - utxos: IDL.Vec(utxo) - }); - const bitcoin_get_utxos_query_args = IDL.Record({ - network: bitcoin_network, - filter: IDL.Opt( - IDL.Variant({ - page: IDL.Vec(IDL.Nat8), - min_confirmations: IDL.Nat32 - }) - ), - address: bitcoin_address - }); - const bitcoin_get_utxos_query_result = IDL.Record({ - next_page: IDL.Opt(IDL.Vec(IDL.Nat8)), - tip_height: IDL.Nat32, - tip_block_hash: block_hash, + tip_height: bitcoin_block_height, + tip_block_hash: bitcoin_block_hash, utxos: IDL.Vec(utxo) }); const bitcoin_send_transaction_args = IDL.Record({ @@ -81,6 +70,7 @@ export const idlFactory = ({ IDL }) => { canister_id: IDL.Principal }) }); + const snapshot_id = IDL.Vec(IDL.Nat8); const change_details = IDL.Variant({ creation: IDL.Record({ controllers: IDL.Vec(IDL.Principal) }), code_deployment: IDL.Record({ @@ -91,6 +81,11 @@ export const idlFactory = ({ IDL }) => { }), module_hash: IDL.Vec(IDL.Nat8) }), + load_snapshot: IDL.Record({ + canister_version: IDL.Nat64, + taken_at_timestamp: IDL.Nat64, + snapshot_id: snapshot_id + }), controllers_change: IDL.Record({ controllers: IDL.Vec(IDL.Principal) }), @@ -111,7 +106,8 @@ export const idlFactory = ({ IDL }) => { const canister_status_args = IDL.Record({ canister_id: canister_id }); const log_visibility = IDL.Variant({ controllers: IDL.Null, - public: IDL.Null + public: IDL.Null, + allowed_viewers: IDL.Vec(IDL.Principal) }); const definite_canister_settings = IDL.Record({ freezing_threshold: IDL.Nat, @@ -157,6 +153,10 @@ export const idlFactory = ({ IDL }) => { }); const create_canister_result = IDL.Record({ canister_id: canister_id }); const delete_canister_args = IDL.Record({ canister_id: canister_id }); + const delete_canister_snapshot_args = IDL.Record({ + canister_id: canister_id, + snapshot_id: snapshot_id + }); const deposit_cycles_args = IDL.Record({ canister_id: canister_id }); const ecdsa_curve = IDL.Variant({ secp256k1: IDL.Null }); const ecdsa_public_key_args = IDL.Record({ @@ -237,6 +237,20 @@ export const idlFactory = ({ IDL }) => { canister_id: canister_id, sender_canister_version: IDL.Opt(IDL.Nat64) }); + const list_canister_snapshots_args = IDL.Record({ + canister_id: canister_id + }); + const snapshot = IDL.Record({ + id: snapshot_id, + total_size: IDL.Nat64, + taken_at_timestamp: IDL.Nat64 + }); + const list_canister_snapshots_result = IDL.Vec(snapshot); + const load_canister_snapshot_args = IDL.Record({ + canister_id: canister_id, + sender_canister_version: IDL.Opt(IDL.Nat64), + snapshot_id: snapshot_id + }); const node_metrics_history_args = IDL.Record({ start_at_timestamp_nanos: IDL.Nat64, subnet_id: IDL.Principal @@ -305,6 +319,13 @@ export const idlFactory = ({ IDL }) => { const stop_canister_args = IDL.Record({ canister_id: canister_id }); const stored_chunks_args = IDL.Record({ canister_id: canister_id }); const stored_chunks_result = IDL.Vec(chunk_hash); + const subnet_info_args = IDL.Record({ subnet_id: IDL.Principal }); + const subnet_info_result = IDL.Record({ replica_version: IDL.Text }); + const take_canister_snapshot_args = IDL.Record({ + replace_snapshot: IDL.Opt(snapshot_id), + canister_id: canister_id + }); + const take_canister_snapshot_result = snapshot; const uninstall_code_args = IDL.Record({ canister_id: canister_id, sender_canister_version: IDL.Opt(IDL.Nat64) @@ -321,10 +342,10 @@ export const idlFactory = ({ IDL }) => { const upload_chunk_result = chunk_hash; return IDL.Service({ bitcoin_get_balance: IDL.Func([bitcoin_get_balance_args], [bitcoin_get_balance_result], []), - bitcoin_get_balance_query: IDL.Func( - [bitcoin_get_balance_query_args], - [bitcoin_get_balance_query_result], - ['query'] + bitcoin_get_block_headers: IDL.Func( + [bitcoin_get_block_headers_args], + [bitcoin_get_block_headers_result], + [] ), bitcoin_get_current_fee_percentiles: IDL.Func( [bitcoin_get_current_fee_percentiles_args], @@ -332,17 +353,13 @@ export const idlFactory = ({ IDL }) => { [] ), bitcoin_get_utxos: IDL.Func([bitcoin_get_utxos_args], [bitcoin_get_utxos_result], []), - bitcoin_get_utxos_query: IDL.Func( - [bitcoin_get_utxos_query_args], - [bitcoin_get_utxos_query_result], - ['query'] - ), bitcoin_send_transaction: IDL.Func([bitcoin_send_transaction_args], [], []), canister_info: IDL.Func([canister_info_args], [canister_info_result], []), canister_status: IDL.Func([canister_status_args], [canister_status_result], []), clear_chunk_store: IDL.Func([clear_chunk_store_args], [], []), create_canister: IDL.Func([create_canister_args], [create_canister_result], []), delete_canister: IDL.Func([delete_canister_args], [], []), + delete_canister_snapshot: IDL.Func([delete_canister_snapshot_args], [], []), deposit_cycles: IDL.Func([deposit_cycles_args], [], []), ecdsa_public_key: IDL.Func([ecdsa_public_key_args], [ecdsa_public_key_result], []), fetch_canister_logs: IDL.Func( @@ -353,6 +370,12 @@ export const idlFactory = ({ IDL }) => { http_request: IDL.Func([http_request_args], [http_request_result], []), install_chunked_code: IDL.Func([install_chunked_code_args], [], []), install_code: IDL.Func([install_code_args], [], []), + list_canister_snapshots: IDL.Func( + [list_canister_snapshots_args], + [list_canister_snapshots_result], + [] + ), + load_canister_snapshot: IDL.Func([load_canister_snapshot_args], [], []), node_metrics_history: IDL.Func([node_metrics_history_args], [node_metrics_history_result], []), provisional_create_canister_with_cycles: IDL.Func( [provisional_create_canister_with_cycles_args], @@ -367,6 +390,12 @@ export const idlFactory = ({ IDL }) => { start_canister: IDL.Func([start_canister_args], [], []), stop_canister: IDL.Func([stop_canister_args], [], []), stored_chunks: IDL.Func([stored_chunks_args], [stored_chunks_result], []), + subnet_info: IDL.Func([subnet_info_args], [subnet_info_result], []), + take_canister_snapshot: IDL.Func( + [take_canister_snapshot_args], + [take_canister_snapshot_result], + [] + ), uninstall_code: IDL.Func([uninstall_code_args], [], []), update_settings: IDL.Func([update_settings_args], [], []), upload_chunk: IDL.Func([upload_chunk_args], [upload_chunk_result], [])