UNPKG

@dfinity/ic-management

Version:

A library for interfacing with the IC management canister.

3 lines (2 loc) • 19.8 kB
"use strict";var Mt=Object.defineProperty;var Jt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Xt=Object.prototype.hasOwnProperty;var Yt=(t,e)=>{for(var s in e)Mt(t,s,{get:e[s],enumerable:!0})},Zt=(t,e,s,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Kt(e))!Xt.call(t,a)&&a!==s&&Mt(t,a,{get:()=>e[a],enumerable:!(r=Jt(e,a))||r.enumerable});return t};var $t=t=>Zt(Mt({},"__esModule",{value:!0}),t);var Lt={};Yt(Lt,{ICManagementCanister:()=>O,LogVisibility:()=>Qt,UnsupportedLogVisibility:()=>P,decodeSnapshotId:()=>jt,encodeSnapshotId:()=>It,mapSnapshotId:()=>v,toCanisterSettings:()=>f});module.exports=$t(Lt);var Gt=require("@dfinity/principal"),i=require("@dfinity/utils");var Et=({IDL:t})=>{let e=t.Variant({mainnet:t.Null,testnet:t.Null}),s=t.Text,r=t.Record({network:e,address:s,min_confirmations:t.Opt(t.Nat32)}),a=t.Nat64,c=a,o=t.Nat32,d=t.Record({start_height:o,end_height:t.Opt(o),network:e}),m=t.Vec(t.Nat8),g=t.Record({tip_height:o,block_headers:t.Vec(m)}),F=t.Record({network:e}),S=t.Nat64,T=t.Vec(S),z=t.Record({network:e,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:s}),q=t.Vec(t.Nat8),U=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),A=t.Record({height:t.Nat32,value:a,outpoint:U}),M=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:o,tip_block_hash:q,utxos:t.Vec(A)}),W=t.Record({transaction:t.Vec(t.Nat8),network:e}),n=t.Principal,E=t.Record({canister_id:n,num_requested_changes:t.Opt(t.Nat64)}),H=t.Variant({from_user:t.Record({user_id:t.Principal}),from_canister:t.Record({canister_version:t.Opt(t.Nat64),canister_id:t.Principal})}),_=t.Vec(t.Nat8),B=t.Variant({creation:t.Record({controllers:t.Vec(t.Principal)}),code_deployment:t.Record({mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),module_hash:t.Vec(t.Nat8)}),load_snapshot:t.Record({canister_version:t.Nat64,taken_at_timestamp:t.Nat64,snapshot_id:_}),controllers_change:t.Record({controllers:t.Vec(t.Principal)}),code_uninstall:t.Null}),Q=t.Record({timestamp_nanos:t.Nat64,canister_version:t.Nat64,origin:H,details:B}),j=t.Record({controllers:t.Vec(t.Principal),module_hash:t.Opt(t.Vec(t.Nat8)),recent_changes:t.Vec(Q),total_num_changes:t.Nat64}),G=t.Record({canister_id:n}),N=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),J=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:N,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),K=t.Record({memory_metrics:t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:J,query_stats:t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),X=t.Record({canister_id:n}),p=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(N),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),Y=t.Record({settings:t.Opt(p),sender_canister_version:t.Opt(t.Nat64)}),Z=t.Record({canister_id:n}),$=t.Record({canister_id:n}),I=t.Record({canister_id:n,snapshot_id:_}),L=t.Record({canister_id:n}),y=t.Variant({secp256k1:t.Null}),D=t.Record({key_id:t.Record({name:t.Text,curve:y}),canister_id:t.Opt(n),derivation_path:t.Vec(t.Vec(t.Nat8))}),tt=t.Record({public_key:t.Vec(t.Nat8),chain_code:t.Vec(t.Nat8)}),et=t.Record({canister_id:n}),st=t.Record({idx:t.Nat64,timestamp_nanos:t.Nat64,content:t.Vec(t.Nat8)}),nt=t.Record({canister_log_records:t.Vec(st)}),R=t.Record({value:t.Text,name:t.Text}),u=t.Record({status:t.Nat,body:t.Vec(t.Nat8),headers:t.Vec(R)}),rt=t.Record({url:t.Text,method:t.Variant({get:t.Null,head:t.Null,post:t.Null}),max_response_bytes:t.Opt(t.Nat64),body:t.Opt(t.Vec(t.Nat8)),transform:t.Opt(t.Record({function:t.Func([t.Record({context:t.Vec(t.Nat8),response:u})],[u],[]),context:t.Vec(t.Nat8)})),headers:t.Vec(R)}),b=t.Variant({reinstall:t.Null,upgrade:t.Opt(t.Record({wasm_memory_persistence:t.Opt(t.Variant({keep:t.Null,replace:t.Null})),skip_pre_upgrade:t.Opt(t.Bool)})),install:t.Null}),h=t.Record({hash:t.Vec(t.Nat8)}),at=t.Record({arg:t.Vec(t.Nat8),wasm_module_hash:t.Vec(t.Nat8),mode:b,chunk_hashes_list:t.Vec(h),target_canister:n,store_canister:t.Opt(n),sender_canister_version:t.Opt(t.Nat64)}),it=t.Vec(t.Nat8),ct=t.Record({arg:t.Vec(t.Nat8),wasm_module:it,mode:b,canister_id:n,sender_canister_version:t.Opt(t.Nat64)}),ot=t.Record({canister_id:n}),k=t.Record({id:_,total_size:t.Nat64,taken_at_timestamp:t.Nat64}),_t=t.Vec(k),lt=t.Record({canister_id:n,sender_canister_version:t.Opt(t.Nat64),snapshot_id:_}),dt=t.Record({start_at_timestamp_nanos:t.Nat64,subnet_id:t.Principal}),pt=t.Record({num_block_failures_total:t.Nat64,node_id:t.Principal,num_blocks_proposed_total:t.Nat64}),ut=t.Vec(t.Record({timestamp_nanos:t.Nat64,node_metrics:t.Vec(pt)})),ht=t.Record({settings:t.Opt(p),specified_id:t.Opt(n),amount:t.Opt(t.Nat),sender_canister_version:t.Opt(t.Nat64)}),mt=t.Record({canister_id:n}),gt=t.Record({canister_id:n,amount:t.Nat}),Nt=t.Vec(t.Nat8),V=t.Variant({ed25519:t.Null,bip340secp256k1:t.Null}),yt=t.Record({key_id:t.Record({algorithm:V,name:t.Text}),canister_id:t.Opt(n),derivation_path:t.Vec(t.Vec(t.Nat8))}),Rt=t.Record({public_key:t.Vec(t.Nat8),chain_code:t.Vec(t.Nat8)}),bt=t.Record({key_id:t.Record({name:t.Text,curve:y}),derivation_path:t.Vec(t.Vec(t.Nat8)),message_hash:t.Vec(t.Nat8)}),kt=t.Record({signature:t.Vec(t.Nat8)}),Vt=t.Variant({bip341:t.Record({merkle_root_hash:t.Vec(t.Nat8)})}),ft=t.Record({aux:t.Opt(Vt),key_id:t.Record({algorithm:V,name:t.Text}),derivation_path:t.Vec(t.Vec(t.Nat8)),message:t.Vec(t.Nat8)}),vt=t.Record({signature:t.Vec(t.Nat8)}),Pt=t.Record({canister_id:n}),Ct=t.Record({canister_id:n}),xt=t.Record({canister_id:n}),wt=t.Vec(h),Ot=t.Record({subnet_id:t.Principal}),Ft=t.Record({replica_version:t.Text}),St=t.Record({replace_snapshot:t.Opt(_),canister_id:n}),Tt=k,zt=t.Record({canister_id:n,sender_canister_version:t.Opt(t.Nat64)}),qt=t.Record({canister_id:t.Principal,settings:p,sender_canister_version:t.Opt(t.Nat64)}),Ut=t.Record({chunk:t.Vec(t.Nat8),canister_id:t.Principal}),At=h;return t.Service({bitcoin_get_balance:t.Func([r],[c],[]),bitcoin_get_block_headers:t.Func([d],[g],[]),bitcoin_get_current_fee_percentiles:t.Func([F],[T],[]),bitcoin_get_utxos:t.Func([z],[M],[]),bitcoin_send_transaction:t.Func([W],[],[]),canister_info:t.Func([E],[j],[]),canister_status:t.Func([G],[K],[]),clear_chunk_store:t.Func([X],[],[]),create_canister:t.Func([Y],[Z],[]),delete_canister:t.Func([$],[],[]),delete_canister_snapshot:t.Func([I],[],[]),deposit_cycles:t.Func([L],[],[]),ecdsa_public_key:t.Func([D],[tt],[]),fetch_canister_logs:t.Func([et],[nt],[]),http_request:t.Func([rt],[u],[]),install_chunked_code:t.Func([at],[],[]),install_code:t.Func([ct],[],[]),list_canister_snapshots:t.Func([ot],[_t],[]),load_canister_snapshot:t.Func([lt],[],[]),node_metrics_history:t.Func([dt],[ut],[]),provisional_create_canister_with_cycles:t.Func([ht],[mt],[]),provisional_top_up_canister:t.Func([gt],[],[]),raw_rand:t.Func([],[Nt],[]),schnorr_public_key:t.Func([yt],[Rt],[]),sign_with_ecdsa:t.Func([bt],[kt],[]),sign_with_schnorr:t.Func([ft],[vt],[]),start_canister:t.Func([Pt],[],[]),stop_canister:t.Func([Ct],[],[]),stored_chunks:t.Func([xt],[wt],[]),subnet_info:t.Func([Ot],[Ft],[]),take_canister_snapshot:t.Func([St],[Tt],[]),uninstall_code:t.Func([zt],[],[]),update_settings:t.Func([qt],[],[]),upload_chunk:t.Func([Ut],[At],[])})};var Ht=({IDL:t})=>{let e=t.Variant({mainnet:t.Null,testnet:t.Null}),s=t.Text,r=t.Record({network:e,address:s,min_confirmations:t.Opt(t.Nat32)}),a=t.Nat64,c=a,o=t.Nat32,d=t.Record({start_height:o,end_height:t.Opt(o),network:e}),m=t.Vec(t.Nat8),g=t.Record({tip_height:o,block_headers:t.Vec(m)}),F=t.Record({network:e}),S=t.Nat64,T=t.Vec(S),z=t.Record({network:e,filter:t.Opt(t.Variant({page:t.Vec(t.Nat8),min_confirmations:t.Nat32})),address:s}),q=t.Vec(t.Nat8),U=t.Record({txid:t.Vec(t.Nat8),vout:t.Nat32}),A=t.Record({height:t.Nat32,value:a,outpoint:U}),M=t.Record({next_page:t.Opt(t.Vec(t.Nat8)),tip_height:o,tip_block_hash:q,utxos:t.Vec(A)}),W=t.Record({transaction:t.Vec(t.Nat8),network:e}),n=t.Principal,E=t.Record({canister_id:n,num_requested_changes:t.Opt(t.Nat64)}),H=t.Variant({from_user:t.Record({user_id:t.Principal}),from_canister:t.Record({canister_version:t.Opt(t.Nat64),canister_id:t.Principal})}),_=t.Vec(t.Nat8),B=t.Variant({creation:t.Record({controllers:t.Vec(t.Principal)}),code_deployment:t.Record({mode:t.Variant({reinstall:t.Null,upgrade:t.Null,install:t.Null}),module_hash:t.Vec(t.Nat8)}),load_snapshot:t.Record({canister_version:t.Nat64,taken_at_timestamp:t.Nat64,snapshot_id:_}),controllers_change:t.Record({controllers:t.Vec(t.Principal)}),code_uninstall:t.Null}),Q=t.Record({timestamp_nanos:t.Nat64,canister_version:t.Nat64,origin:H,details:B}),j=t.Record({controllers:t.Vec(t.Principal),module_hash:t.Opt(t.Vec(t.Nat8)),recent_changes:t.Vec(Q),total_num_changes:t.Nat64}),G=t.Record({canister_id:n}),N=t.Variant({controllers:t.Null,public:t.Null,allowed_viewers:t.Vec(t.Principal)}),J=t.Record({freezing_threshold:t.Nat,wasm_memory_threshold:t.Nat,controllers:t.Vec(t.Principal),reserved_cycles_limit:t.Nat,log_visibility:N,wasm_memory_limit:t.Nat,memory_allocation:t.Nat,compute_allocation:t.Nat}),K=t.Record({memory_metrics:t.Record({wasm_binary_size:t.Nat,wasm_chunk_store_size:t.Nat,canister_history_size:t.Nat,stable_memory_size:t.Nat,snapshots_size:t.Nat,wasm_memory_size:t.Nat,global_memory_size:t.Nat,custom_sections_size:t.Nat}),status:t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),memory_size:t.Nat,cycles:t.Nat,settings:J,query_stats:t.Record({response_payload_bytes_total:t.Nat,num_instructions_total:t.Nat,num_calls_total:t.Nat,request_payload_bytes_total:t.Nat}),idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8)),reserved_cycles:t.Nat}),X=t.Record({canister_id:n}),p=t.Record({freezing_threshold:t.Opt(t.Nat),wasm_memory_threshold:t.Opt(t.Nat),controllers:t.Opt(t.Vec(t.Principal)),reserved_cycles_limit:t.Opt(t.Nat),log_visibility:t.Opt(N),wasm_memory_limit:t.Opt(t.Nat),memory_allocation:t.Opt(t.Nat),compute_allocation:t.Opt(t.Nat)}),Y=t.Record({settings:t.Opt(p),sender_canister_version:t.Opt(t.Nat64)}),Z=t.Record({canister_id:n}),$=t.Record({canister_id:n}),I=t.Record({canister_id:n,snapshot_id:_}),L=t.Record({canister_id:n}),y=t.Variant({secp256k1:t.Null}),D=t.Record({key_id:t.Record({name:t.Text,curve:y}),canister_id:t.Opt(n),derivation_path:t.Vec(t.Vec(t.Nat8))}),tt=t.Record({public_key:t.Vec(t.Nat8),chain_code:t.Vec(t.Nat8)}),et=t.Record({canister_id:n}),st=t.Record({idx:t.Nat64,timestamp_nanos:t.Nat64,content:t.Vec(t.Nat8)}),nt=t.Record({canister_log_records:t.Vec(st)}),R=t.Record({value:t.Text,name:t.Text}),u=t.Record({status:t.Nat,body:t.Vec(t.Nat8),headers:t.Vec(R)}),rt=t.Record({url:t.Text,method:t.Variant({get:t.Null,head:t.Null,post:t.Null}),max_response_bytes:t.Opt(t.Nat64),body:t.Opt(t.Vec(t.Nat8)),transform:t.Opt(t.Record({function:t.Func([t.Record({context:t.Vec(t.Nat8),response:u})],[u],["query"]),context:t.Vec(t.Nat8)})),headers:t.Vec(R)}),b=t.Variant({reinstall:t.Null,upgrade:t.Opt(t.Record({wasm_memory_persistence:t.Opt(t.Variant({keep:t.Null,replace:t.Null})),skip_pre_upgrade:t.Opt(t.Bool)})),install:t.Null}),h=t.Record({hash:t.Vec(t.Nat8)}),at=t.Record({arg:t.Vec(t.Nat8),wasm_module_hash:t.Vec(t.Nat8),mode:b,chunk_hashes_list:t.Vec(h),target_canister:n,store_canister:t.Opt(n),sender_canister_version:t.Opt(t.Nat64)}),it=t.Vec(t.Nat8),ct=t.Record({arg:t.Vec(t.Nat8),wasm_module:it,mode:b,canister_id:n,sender_canister_version:t.Opt(t.Nat64)}),ot=t.Record({canister_id:n}),k=t.Record({id:_,total_size:t.Nat64,taken_at_timestamp:t.Nat64}),_t=t.Vec(k),lt=t.Record({canister_id:n,sender_canister_version:t.Opt(t.Nat64),snapshot_id:_}),dt=t.Record({start_at_timestamp_nanos:t.Nat64,subnet_id:t.Principal}),pt=t.Record({num_block_failures_total:t.Nat64,node_id:t.Principal,num_blocks_proposed_total:t.Nat64}),ut=t.Vec(t.Record({timestamp_nanos:t.Nat64,node_metrics:t.Vec(pt)})),ht=t.Record({settings:t.Opt(p),specified_id:t.Opt(n),amount:t.Opt(t.Nat),sender_canister_version:t.Opt(t.Nat64)}),mt=t.Record({canister_id:n}),gt=t.Record({canister_id:n,amount:t.Nat}),Nt=t.Vec(t.Nat8),V=t.Variant({ed25519:t.Null,bip340secp256k1:t.Null}),yt=t.Record({key_id:t.Record({algorithm:V,name:t.Text}),canister_id:t.Opt(n),derivation_path:t.Vec(t.Vec(t.Nat8))}),Rt=t.Record({public_key:t.Vec(t.Nat8),chain_code:t.Vec(t.Nat8)}),bt=t.Record({key_id:t.Record({name:t.Text,curve:y}),derivation_path:t.Vec(t.Vec(t.Nat8)),message_hash:t.Vec(t.Nat8)}),kt=t.Record({signature:t.Vec(t.Nat8)}),Vt=t.Variant({bip341:t.Record({merkle_root_hash:t.Vec(t.Nat8)})}),ft=t.Record({aux:t.Opt(Vt),key_id:t.Record({algorithm:V,name:t.Text}),derivation_path:t.Vec(t.Vec(t.Nat8)),message:t.Vec(t.Nat8)}),vt=t.Record({signature:t.Vec(t.Nat8)}),Pt=t.Record({canister_id:n}),Ct=t.Record({canister_id:n}),xt=t.Record({canister_id:n}),wt=t.Vec(h),Ot=t.Record({subnet_id:t.Principal}),Ft=t.Record({replica_version:t.Text}),St=t.Record({replace_snapshot:t.Opt(_),canister_id:n}),Tt=k,zt=t.Record({canister_id:n,sender_canister_version:t.Opt(t.Nat64)}),qt=t.Record({canister_id:t.Principal,settings:p,sender_canister_version:t.Opt(t.Nat64)}),Ut=t.Record({chunk:t.Vec(t.Nat8),canister_id:t.Principal}),At=h;return t.Service({bitcoin_get_balance:t.Func([r],[c],[]),bitcoin_get_block_headers:t.Func([d],[g],[]),bitcoin_get_current_fee_percentiles:t.Func([F],[T],[]),bitcoin_get_utxos:t.Func([z],[M],[]),bitcoin_send_transaction:t.Func([W],[],[]),canister_info:t.Func([E],[j],[]),canister_status:t.Func([G],[K],[]),clear_chunk_store:t.Func([X],[],[]),create_canister:t.Func([Y],[Z],[]),delete_canister:t.Func([$],[],[]),delete_canister_snapshot:t.Func([I],[],[]),deposit_cycles:t.Func([L],[],[]),ecdsa_public_key:t.Func([D],[tt],[]),fetch_canister_logs:t.Func([et],[nt],["query"]),http_request:t.Func([rt],[u],[]),install_chunked_code:t.Func([at],[],[]),install_code:t.Func([ct],[],[]),list_canister_snapshots:t.Func([ot],[_t],[]),load_canister_snapshot:t.Func([lt],[],[]),node_metrics_history:t.Func([dt],[ut],[]),provisional_create_canister_with_cycles:t.Func([ht],[mt],[]),provisional_top_up_canister:t.Func([gt],[],[]),raw_rand:t.Func([],[Nt],[]),schnorr_public_key:t.Func([yt],[Rt],[]),sign_with_ecdsa:t.Func([bt],[kt],[]),sign_with_schnorr:t.Func([ft],[vt],[]),start_canister:t.Func([Pt],[],[]),stop_canister:t.Func([Ct],[],[]),stored_chunks:t.Func([xt],[wt],[]),subnet_info:t.Func([Ot],[Ft],[]),take_canister_snapshot:t.Func([St],[Tt],[]),uninstall_code:t.Func([zt],[],[]),update_settings:t.Func([qt],[],[]),upload_chunk:t.Func([Ut],[At],[])})};var Bt=require("@dfinity/principal"),l=require("@dfinity/utils"),Qt=(s=>(s[s.Controllers=0]="Controllers",s[s.Public=1]="Public",s))(Qt||{}),P=class extends Error{},f=({controllers:t,freezingThreshold:e,memoryAllocation:s,computeAllocation:r,reservedCyclesLimit:a,logVisibility:c,wasmMemoryLimit:o,wasmMemoryThreshold:d}={})=>{let m=()=>{switch(c){case 0:return{controllers:null};case 1:return{public:null};default:throw new P}};return{controllers:(0,l.toNullable)(t==null?void 0:t.map(g=>Bt.Principal.fromText(g))),freezing_threshold:(0,l.toNullable)(e),memory_allocation:(0,l.toNullable)(s),compute_allocation:(0,l.toNullable)(r),reserved_cycles_limit:(0,l.toNullable)(a),log_visibility:(0,l.isNullish)(c)?[]:[m()],wasm_memory_limit:(0,l.toNullable)(o),wasm_memory_threshold:(0,l.toNullable)(d)}};var C=require("@dfinity/utils"),It=t=>(0,C.uint8ArrayToHexString)(t),jt=t=>(0,C.hexStringToUint8Array)(t),v=t=>typeof t=="string"?jt(t):t;var x=require("@dfinity/principal"),w=require("@dfinity/utils"),Wt=(t,e,s)=>{let r=e[0];if((0,w.nonNullish)(r)&&typeof r=="object"){if(t==="install_chunked_code"&&(0,w.nonNullish)(r.target_canister))return{effectiveCanisterId:x.Principal.from(r.target_canister)};if((0,w.nonNullish)(r.canister_id))return{effectiveCanisterId:x.Principal.from(r.canister_id)}}return{effectiveCanisterId:x.Principal.fromHex("")}};var O=class t{constructor(e){this.service=e;this.createCanister=async({settings:e,senderCanisterVersion:s}={})=>{let{create_canister:r}=this.service,{canister_id:a}=await r({settings:(0,i.toNullable)(f(e)),sender_canister_version:(0,i.toNullable)(s)});return a};this.updateSettings=({canisterId:e,senderCanisterVersion:s,settings:r})=>{let{update_settings:a}=this.service;return a({canister_id:e,sender_canister_version:(0,i.toNullable)(s),settings:f(r)})};this.installCode=({canisterId:e,wasmModule:s,senderCanisterVersion:r,...a})=>{let{install_code:c}=this.service;return c({...a,canister_id:e,wasm_module:s,sender_canister_version:(0,i.toNullable)(r)})};this.uploadChunk=({canisterId:e,...s})=>{let{upload_chunk:r}=this.service;return r({canister_id:e,...s})};this.clearChunkStore=async({canisterId:e})=>{let{clear_chunk_store:s}=this.service;await s({canister_id:e})};this.storedChunks=async({canisterId:e})=>{let{stored_chunks:s}=this.service;return s({canister_id:e})};this.installChunkedCode=async({senderCanisterVersion:e,chunkHashesList:s,targetCanisterId:r,storeCanisterId:a,wasmModuleHash:c,...o})=>{let{install_chunked_code:d}=this.service;await d({...o,target_canister:r,store_canister:(0,i.toNullable)(a),sender_canister_version:(0,i.toNullable)(e),chunk_hashes_list:s,wasm_module_hash:typeof c=="string"?(0,i.hexStringToUint8Array)(c):c})};this.uninstallCode=({canisterId:e,senderCanisterVersion:s})=>{let{uninstall_code:r}=this.service;return r({canister_id:e,sender_canister_version:(0,i.toNullable)(s)})};this.startCanister=e=>{let{start_canister:s}=this.service;return s({canister_id:e})};this.stopCanister=e=>{let{stop_canister:s}=this.service;return s({canister_id:e})};this.canisterStatus=e=>{let{canister_status:s}=this.service;return s({canister_id:e})};this.deleteCanister=e=>{let{delete_canister:s}=this.service;return s({canister_id:e})};this.provisionalCreateCanisterWithCycles=async({settings:e,amount:s,canisterId:r}={})=>{let{provisional_create_canister_with_cycles:a}=this.service,{canister_id:c}=await a({settings:(0,i.toNullable)(f(e)),amount:(0,i.toNullable)(s),specified_id:(0,i.toNullable)(r),sender_canister_version:[]});return c};this.fetchCanisterLogs=e=>{let{fetch_canister_logs:s}=this.service;return s({canister_id:e})};this.takeCanisterSnapshot=({canisterId:e,snapshotId:s})=>{let{take_canister_snapshot:r}=this.service;return r({canister_id:e,replace_snapshot:(0,i.toNullable)((0,i.nonNullish)(s)?v(s):void 0)})};this.listCanisterSnapshots=async({canisterId:e})=>{let{list_canister_snapshots:s}=this.service;return s({canister_id:e})};this.loadCanisterSnapshot=async({canisterId:e,snapshotId:s,senderCanisterVersion:r})=>{let{load_canister_snapshot:a}=this.service;await a({canister_id:e,snapshot_id:v(s),sender_canister_version:(0,i.toNullable)(r)})};this.deleteCanisterSnapshot=async({canisterId:e,snapshotId:s})=>{let{delete_canister_snapshot:r}=this.service;await r({canister_id:e,snapshot_id:v(s)})};this.service=e}static create(e){let{service:s}=(0,i.createServices)({options:{...e,canisterId:Gt.Principal.fromHex(""),callTransform:Wt,queryTransform:Wt},idlFactory:Ht,certifiedIdlFactory:Et});return new t(s)}};0&&(module.exports={ICManagementCanister,LogVisibility,UnsupportedLogVisibility,decodeSnapshotId,encodeSnapshotId,mapSnapshotId,toCanisterSettings}); //# sourceMappingURL=index.cjs.js.map