usePlug
React Hook for Connecting to the Plug Wallet and Creating Canister Actors
usePlug.ts
usePlug.tsGlobal Type Declaration
declare global {
interface Window {
ic?: {
plug?: {
isConnected: () => Promise<boolean> | boolean;
requestConnect: (opts: { ... }) => Promise<boolean>;
createActor: <T>(opts: { canisterId: string; interfaceFactory: any; }) => Promise<T>;
getPrincipal: () => Promise<{ toText: () => string }>;
disconnect?: () => Promise<void>;
};
};
}
}Types
The usePlug Hook
usePlug HookLast updated