DeferredActor
DeferredActor<
T
> =DeferredActorInterface
<T
> &object
Defined in: pocket-ic-deferred-actor.ts:21
setIdentity()
Section titled “setIdentity()”setIdentity(
identity
):void
Set a Principal to be used as sender for all calls to the canister. This is a convenience method over setPrincipal that accepts an Identity and internally extracts the Principal.
Parameters
Section titled “Parameters”identity
Section titled “identity”Identity
The identity to set.
Returns
Section titled “Returns”void
Example
Section titled “Example”import { PocketIc } from '@dfinity/pic';import { AnonymousIdentity } from '@dfinity/agent';import { _SERVICE, idlFactory } from '../declarations';
const wasmPath = resolve('..', '..', 'canister.wasm');
const pic = await PocketIc.create();const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);const { actor } = fixture;
actor.setIdentity(new AnonymousIdentity());
setPrincipal()
Section titled “setPrincipal()”setPrincipal(
principal
):void
Set a Principal to be used as sender for all calls to the canister.
Parameters
Section titled “Parameters”principal
Section titled “principal”Principal
The Principal to set.
Returns
Section titled “Returns”void
Example
Section titled “Example”import { PocketIc } from '@dfinity/pic';import { Principal } from '@dfinity/principal';import { _SERVICE, idlFactory } from '../declarations';
const wasmPath = resolve('..', '..', 'canister.wasm');
const pic = await PocketIc.create();const fixture = await pic.setupCanister<_SERVICE>(idlFactory, wasmPath);const { actor } = fixture;
actor.setPrincipal(Principal.anonymous());
Type Parameters
Section titled “Type Parameters”T
extends ActorInterface
<T
> = ActorInterface