MCPcopy Create free account
hub / github.com/dfinity/orbit / create_account

Function create_account

tests/integration/src/utils.rs:695–767  ·  view source on GitHub ↗
(
    env: &PocketIc,
    station_id: Principal,
    requester: Principal,
    input: AddAccountOperationInput,
)

Source from the content-addressed store, hash-verified

693}
694
695pub fn create_account(
696 env: &PocketIc,
697 station_id: Principal,
698 requester: Principal,
699 input: AddAccountOperationInput,
700) -> AccountDTO {
701 let add_account_request = CreateRequestInput {
702 operation: RequestOperationInput::AddAccount(input),
703 title: None,
704 summary: None,
705 execution_plan: Some(RequestExecutionScheduleDTO::Immediate),
706 expiration_dt: None,
707 deduplication_key: None,
708 tags: None,
709 };
710 let res: (ApiResult<CreateRequestResponse>,) = update_candid_as(
711 env,
712 station_id,
713 requester,
714 "create_request",
715 (add_account_request,),
716 )
717 .unwrap();
718
719 // wait for the request to be approved (timer's period is 5 seconds)
720 env.advance_time(Duration::from_secs(5));
721 env.tick();
722
723 let account_creation_request_dto = res.0.unwrap().request;
724 match account_creation_request_dto.status {
725 RequestStatusDTO::Approved => {}
726 _ => {
727 panic!("request must be approved by now");
728 }
729 };
730
731 // wait for the request to be executed (timer's period is 5 seconds)
732 env.advance_time(Duration::from_secs(5));
733 env.tick();
734
735 // fetch the created account id from the request
736 let get_request_args = GetRequestInput {
737 request_id: account_creation_request_dto.id,
738 with_full_info: Some(false),
739 };
740 let res: (ApiResult<CreateRequestResponse>,) = update_candid_as(
741 env,
742 station_id,
743 requester,
744 "get_request",
745 (get_request_args,),
746 )
747 .unwrap();
748 let finalized_request = res.0.unwrap().request;
749 match finalized_request.status {
750 RequestStatusDTO::Completed { .. } => {}
751 _ => {
752 panic!(

Callers 4

create_icp_accountFunction · 0.70
make_icrc1_transferFunction · 0.70
make_icrc1_icp_transferFunction · 0.70
test_fetch_balancesFunction · 0.70

Calls

no outgoing calls

Tested by 3

make_icrc1_transferFunction · 0.56
make_icrc1_icp_transferFunction · 0.56
test_fetch_balancesFunction · 0.56