Skip to main content

PocketIcBuilder

Struct PocketIcBuilder 

Source
pub struct PocketIcBuilder { /* private fields */ }

Implementations§

Source§

impl PocketIcBuilder

Source

pub fn new() -> Self

Source

pub fn new_with_config(config: impl Into<ExtendedSubnetConfigSet>) -> Self

Source

pub fn build(self) -> Result<PocketIc, ClientError>

Source

pub async fn build_async(self) -> Result<PocketIcAsync, ClientError>

Source

pub fn with_server_url(self, server_url: Url) -> Self

Use an already running PocketIC server.

Source

pub fn with_max_request_time_ms(self, max_request_time_ms: Option<u64>) -> Self

Source

pub fn with_state_dir(self, state_dir: PathBuf) -> Self

Source

pub fn with_state(self, state_dir: PocketIcState) -> Self

Source

pub fn with_read_only_state(self, read_only_state_dir: &PocketIcState) -> Self

Source

pub fn with_icp_config(self, icp_config: IcpConfig) -> Self

Source

pub fn with_log_level(self, log_level: Level) -> Self

Source

pub fn with_bitcoind_addr(self, bitcoind_addr: SocketAddr) -> Self

Source

pub fn with_bitcoind_addrs(self, bitcoind_addrs: Vec<SocketAddr>) -> Self

Source

pub fn with_dogecoind_addrs(self, dogecoind_addrs: Vec<SocketAddr>) -> Self

Source

pub fn with_nns_subnet(self) -> Self

Add an empty NNS subnet unless an NNS subnet has already been added.

Source

pub fn with_nns_state(self, path_to_state: PathBuf) -> Self

Add an NNS subnet with state loaded from the given state directory. Note that the provided path must be accessible for the PocketIC server process.

path_to_state should lead to a directory which is expected to have the following structure:

path_to_state/ |– backups |– checkpoints |– diverged_checkpoints |– diverged_state_markers |– fs_tmp |– page_deltas |– states_metadata.pbuf |– tip `– tmp

Source

pub fn with_subnet_state( self, subnet_kind: SubnetKind, path_to_state: PathBuf, ) -> Self

Add a subnet with state loaded from the given state directory. Note that the provided path must be accessible for the PocketIC server process.

path_to_state should point to a directory which is expected to have the following structure:

path_to_state/ |– backups |– checkpoints |– diverged_checkpoints |– diverged_state_markers |– fs_tmp |– page_deltas |– states_metadata.pbuf |– tip `– tmp

Source

pub fn with_sns_subnet(self) -> Self

Add an empty sns subnet unless an SNS subnet has already been added.

Source

pub fn with_ii_subnet(self) -> Self

Add an empty II subnet unless an II subnet has already been added.

Source

pub fn with_fiduciary_subnet(self) -> Self

Add an empty fiduciary subnet unless a fiduciary subnet has already been added.

Source

pub fn with_bitcoin_subnet(self) -> Self

Add an empty bitcoin subnet unless a bitcoin subnet has already been added.

Source

pub fn with_test_threshold_keys_subnet(self) -> Self

Add an empty test threshold keys subnet unless a test threshold keys subnet has already been added.

Source

pub fn with_system_subnet(self) -> Self

Add an empty generic system subnet.

Source

pub fn with_application_subnet(self) -> Self

Add an empty generic application subnet.

Source

pub fn with_verified_application_subnet(self) -> Self

Add an empty generic verified application subnet.

Source

pub fn with_benchmarking_application_subnet(self) -> Self

Add an empty generic application subnet with benchmarking instruction configuration.

Source

pub fn with_benchmarking_system_subnet(self) -> Self

Add an empty generic system subnet with benchmarking instruction configuration.

Source

pub fn with_icp_features(self, icp_features: IcpFeatures) -> Self

Enables selected ICP features supported by PocketIC and implemented by system canisters (deployed to the PocketIC instance automatically when creating a new PocketIC instance). Subnets to which the system canisters are deployed are automatically declared as empty subnets, e.g., PocketIcBuilder::with_nns_subnet is implicitly implied by specifying the icp_token feature.

Source

pub fn with_initial_timestamp(self, initial_timestamp_nanos: u64) -> Self

👎Deprecated:

Use with_initial_time instead

Sets the initial timestamp of the new instance to the provided value which must be at least

  • 10 May 2021 10:00:01 AM CEST if the cycles_minting feature is enabled in icp_features;
  • 06 May 2021 21:17:10 CEST otherwise.
Source

pub fn with_initial_time(self, initial_time: Time) -> Self

Sets the initial time of the new instance to the provided value which must be at least

  • 10 May 2021 10:00:01 AM CEST if the cycles_minting feature is enabled in icp_features;
  • 06 May 2021 21:17:10 CEST otherwise.
Source

pub fn with_auto_progress(self) -> Self

Configures the new instance to make progress automatically, i.e., periodically update the time of the IC instance to the real time and execute rounds on the subnets. Building the instance only returns after the certified time of the IC instance has been updated for the first time.

Source

pub fn with_http_gateway( self, http_gateway_config: InstanceHttpGatewayConfig, ) -> Self

Source

pub fn with_mainnet_nns_subnet_id(self) -> Self

Source

pub fn disable_ingress_validation(self) -> Self

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SendSyncUnwindSafe for T
where T: Send + Sync + UnwindSafe + ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more