Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add create_canister_with_settings #210

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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