Interface AgentProviderProps

interface AgentProviderProps {
    children?: ReactNode;
    fetch?: {
        (input, init?): Promise<Response>;
        (input, init?): Promise<Response>;
    };
    fetchOptions?: Record<string, unknown>;
    callOptions?: Record<string, unknown>;
    host?: string;
    identity?: types.Identity | Promise<types.Identity>;
    ingressExpiryInMinutes?: number;
    credentials?: {
        name: string;
        password?: string;
    };
    useQueryNonces?: boolean;
    retryTimes?: number;
    backoffStrategy?: BackoffStrategyFactory;
    verifyQuerySignatures?: boolean;
    logToConsole?: boolean;
    rootKey?: ArrayBuffer;
    port?: number;
    withLocalEnv?: boolean;
    withDevtools?: boolean;
    withProcessEnv?: boolean;
    disableAuthenticateOnMount?: boolean;
    agentManager?: types.AgentManager;
}

Hierarchy (view full)

Properties

children?: ReactNode
fetch?: {
    (input, init?): Promise<Response>;
    (input, init?): Promise<Response>;
}

Type declaration

fetchOptions?: Record<string, unknown>
callOptions?: Record<string, unknown>
host?: string
ingressExpiryInMinutes?: number

The maximum time a request can be delayed before being rejected.

Default

5 minutes
credentials?: {
    name: string;
    password?: string;
}

Type declaration

  • name: string
  • Optional password?: string
useQueryNonces?: boolean

Adds a unique Nonce with each query. Enabling will prevent queries from being answered with a cached response.

Example

const agent = new HttpAgent({ useQueryNonces: true });
agent.addTransform(makeNonceTransform(makeNonce);

Default

false
retryTimes?: number

Number of times to retry requests before throwing an error

Default

3
backoffStrategy?: BackoffStrategyFactory

The strategy to use for backoff when retrying requests

verifyQuerySignatures?: boolean

Whether the agent should verify signatures signed by node keys on query responses. Increases security, but adds overhead and must make a separate request to cache the node keys for the canister's subnet.

Default

true
logToConsole?: boolean

Whether to log to the console. Defaults to false.

rootKey?: ArrayBuffer

Alternate root key to use for verifying certificates. If not provided, the default IC root key will be used.

port?: number
withLocalEnv?: boolean
withDevtools?: boolean
withProcessEnv?: boolean
disableAuthenticateOnMount?: boolean
agentManager?: types.AgentManager