useAgent
(options?: HttpAgentOptions) => IdentityKitAgent | undefined
Hook to get identityKitAgent, which manages when to show approval pop-ups to make canister calls or
not, it uses built-in signerAgent to show pop-ups and dfinity HttpAgent with identity from
identitykit
otherwise.
Return values
Agent|undefined
ℹ️
Retrieved agent will be undefined until user is connected and agent is created under the hood
Usage
import { useAgent } from "@nfid/identitykit/react"
const agent = useAgent()
Or with your custom options:
import { useAgent } from "@nfid/identitykit/react"
const agent = useAgent({ retryTimes: 1, host: "https://my-custom-host.ic0.app" })
⚠️
If no custom configuration is provided, the agent typically defaults to https://ic0.app or the relevant boundary node based on the environment, if the environment is not recognized, it falls back to https://icp-api.io, to change it as well as other agent settings provide options to hook