Function createReactorStore

  • Create a new actor manager with the given options. Its create a new agent manager if not provided. It also creates a new actor manager with the given options.

    Example


    import { candid, canisterId, idlFactory } from "./declarations/candid"

    type Candid = typeof candid

    const { agentManager, callMethod } = createReactorStore<Candid>({
    canisterId,
    idlFactory,
    })

    // Usage example
    await agentManager.authenticate()
    const authClient = agentManager.getAuth()

    authClient?.login({
    onSuccess: () => {
    console.log("Logged in successfully")
    },
    onError: (error) => {
    console.error("Failed to login:", error)
    },
    })

    // Call a method
    const version = callMethod("version")

    console.log("Response from version method:", await version)

    Type Parameters

    Returns classes.ActorManager<A>