Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bitdivine committed Sep 5, 2024
1 parent 02f1098 commit 019bd71
Show file tree
Hide file tree
Showing 6 changed files with 408 additions and 306 deletions.
3 changes: 1 addition & 2 deletions src/example/app_backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use candid::Principal;
use ic_cdk::api::call::call_with_payment128;
use ic_cdk_macros::{update, export_candid};
use ic_cdk_macros::{export_candid, update};
use ic_papi_api::PaymentError;

/// Calls an arbitrary method on an arbitrary canister with an arbitrary amount of cycles attached.
Expand All @@ -17,5 +17,4 @@ async fn call_with_attached_cycles(
ans
}


export_candid!();
2 changes: 1 addition & 1 deletion src/example/paid_service/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use ic_cdk_macros::{update, export_candid};
use ic_cdk_macros::{export_candid, update};
use ic_papi_api::PaymentError;
use ic_papi_guard::guards::attached_cycles::AttachedCyclesPayment;
use ic_papi_guard::guards::PaymentGuard;
Expand Down
7 changes: 4 additions & 3 deletions src/example/paid_service/tests/it/attached_cycles.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::util::pic_canister::{PicCanister, PicCanisterTrait};
use candid::Principal;
use ic_papi_api::PaymentError;
use crate::util::pic_canister::{PicCanister, PicCanisterTrait};
use pocket_ic::PocketIc;
use std::sync::Arc;

pub struct AttachedCyclesTestSetup {
/// The PocketIC instance.
#[allow(dead_code)] // The Arc is used; this makes it accessible without having to refer to a specific canister.
#[allow(dead_code)]
// The Arc is used; this makes it accessible without having to refer to a specific canister.
pic: Arc<PocketIc>,
/// The canister providing the API.
api_canister: PicCanister,
Expand Down Expand Up @@ -71,4 +72,4 @@ fn inter_canister_call_succeeds_with_sufficient_cycles_only() {
);
}
}
}
}
18 changes: 9 additions & 9 deletions src/example/paid_service/tests/it/icrc2.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use crate::util::cycles_ledger::CyclesLedgerPic;
use crate::util::pic_canister::{PicCanister, PicCanisterBuilder, PicCanisterTrait};
use candid::{encode_one, Principal};
use ic_papi_api::PaymentError;
use crate::util::pic_canister::{PicCanister, PicCanisterBuilder, PicCanisterTrait};
use pocket_ic::PocketIc;
use std::sync::Arc;
use crate::util::cycles_ledger::CyclesLedgerPic;

pub struct CallerPaysWithIcRc2TestSetup {
/// The PocketIC instance.
#[allow(dead_code)] // The Arc is used; this makes it accessible without having to refer to a specific canister.
#[allow(dead_code)]
// The Arc is used; this makes it accessible without having to refer to a specific canister.
pic: Arc<PocketIc>,
/// The canister providing the API.
paid_service: PicCanister,
Expand All @@ -21,11 +22,10 @@ impl Default for CallerPaysWithIcRc2TestSetup {
pic.clone(),
&PicCanister::cargo_wasm_path("example_paid_service"),
);
let ledger =
PicCanisterBuilder::default()
.with_wasm(&PicCanister::cargo_wasm_path("example_paid_service"))
.with_arg(encode_one(9).expect("Failed to encode ledger init arg"))
.deploy_to(pic.clone());
let ledger = PicCanisterBuilder::default()
.with_wasm(&PicCanister::cargo_wasm_path("example_paid_service"))
.with_arg(encode_one(9).expect("Failed to encode ledger init arg"))
.deploy_to(pic.clone());
Self {
pic,
paid_service: api_canister,
Expand All @@ -37,4 +37,4 @@ impl Default for CallerPaysWithIcRc2TestSetup {
#[test]
fn icrc2_test_setup_works() {
let _setup = CallerPaysWithIcRc2TestSetup::default();
}
}
Loading

0 comments on commit 019bd71

Please sign in to comment.