Function createAgentManager

  • Agent manager handles the lifecycle of the @dfinity/agent. It is responsible for creating agent and managing the agent's state. You can use it to subscribe to the agent changes. login and logout to the internet identity.

    Example

    import { createAgentManager } from "@ic-reactor/core"

    export const agentManager = createAgentManager() // Connects to IC network by default

    Local Agent Example:

    For development purposes, you might want to connect to a local instance of the IC network:

    // agent.ts
    import { createAgentManager } from "@ic-reactor/core"

    export const agentManager = createAgentManager({
    withLocalEnv: true,
    port: 8000, // Default port is 4943
    })

    Alternatively, you can specify a host directly:

    // agent.ts
    import { createAgentManager } from "@ic-reactor/core"

    export const agentManager = createAgentManager({
    host: "http://localhost:8000",
    })
    
    

    Parameters

    Returns types.AgentManager