Skip to content

Commit

Permalink
Merge pull request #210 from bitfinity-network/EPROD_601_create_canis…
Browse files Browse the repository at this point in the history
…ter_with_settings

Add create_canister_with_settings
  • Loading branch information
ufoscout authored Feb 27, 2024
2 parents 0d80b82 + 52726d9 commit 235f406
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions ic-exports/src/pocket_ic/nio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::sync::Arc;
use std::time::{Duration, SystemTime};

use candid::Principal;
use ic_cdk::api::management_canister::main::CanisterSettings;
use ic_cdk::api::management_canister::provisional::CanisterId;
use pocket_ic::common::rest::{BlobCompression, BlobId};
use pocket_ic::{CallError, PocketIc, UserError, WasmResult};
Expand Down Expand Up @@ -188,21 +189,17 @@ impl PocketIcAsync {
.unwrap()
}

// todo: implement after pocket-ic will update `ic-cdk` dependency version.
// because currently they use `0.10` and canister-sdk uses `0.11`.
// Issue: https://infinityswap.atlassian.net/browse/EPROD-601
//
/// Create a canister with custom settings.
// pub async fn create_canister_with_settings(
// &self,
// settings: Option<CanisterSettings>,
// sender: Option<Principal>,
// ) -> CanisterId {
// let client = self.0.clone();
// tokio::task::spawn_blocking(move || client.create_canister_with_settings(settings, sender))
// .await
// .unwrap()
// }
// Create a canister with custom settings.
pub async fn create_canister_with_settings(
&self,
settings: Option<CanisterSettings>,
sender: Option<Principal>,
) -> CanisterId {
let client = self.0.clone();
tokio::task::spawn_blocking(move || client.create_canister_with_settings(sender, settings))
.await
.unwrap()
}

/// Install a WASM module on an existing canister.
pub async fn install_canister(
Expand Down

0 comments on commit 235f406

Please sign in to comment.