Options
All
  • Public
  • Public/Protected
  • All
Menu

@dfinity/agent

Index

References

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

References

Re-exports defaultStrategy
Re-exports strategy

Type Aliases

ActorConstructor: (new (config: ActorConfig) => ActorSubclass)

Type declaration

ActorMethodMappedExtended<T>: { [ K in keyof T]: T[K] extends FunctionWithArgsAndReturn<infer Args, infer Ret> ? ActorMethodExtended<Args, Ret> : never }

Type Parameters

  • T

ActorMethodMappedWithHttpDetails<T>: { [ K in keyof T]: T[K] extends FunctionWithArgsAndReturn<infer Args, infer Ret> ? ActorMethodWithHttpDetails<Args, Ret> : never }

Type Parameters

  • T

ActorSubclass<T>: Actor & T

A subclass of an actor. Actor class itself is meant to be a based class.

Type Parameters

ApiQueryResponse: QueryResponse & { httpDetails: HttpDetailsResponse; requestId: RequestId }
CanisterInstallMode: { reinstall: null } | { upgrade: [] | [{ skip_pre_upgrade: [] | [boolean] }] } | { install: null }

The mode used when installing a canister.

DerEncodedPublicKey: ArrayBuffer & { __derEncodedPublicKey__?: void }

A public key that is DER encoded. This is a branded ArrayBuffer.

Envelope<T>: Signed<T> | UnSigned<T>

Type Parameters

  • T

FunctionWithArgsAndReturn<Args, Ret>: ((...args: Args) => Ret)

Type Parameters

  • Args extends unknown[] = unknown[]

  • Ret = unknown

Type declaration

    • (...args: Args): Ret
    • Parameters

      • Rest ...args: Args

      Returns Ret

HttpHeaderField: [string, string]
ManagementCanisterRecord: _SERVICE
NodeLabel: ArrayBuffer | Uint8Array
NodeSignature: { identity: Uint8Array; signature: Uint8Array; timestamp: bigint }

Type declaration

  • identity: Uint8Array
  • signature: Uint8Array
  • timestamp: bigint
Nonce: Uint8Array & { __nonce__: void }
PollStrategy: ((canisterId: Principal, requestId: RequestId, status: RequestStatusResponseStatus) => Promise<void>)

Type declaration

PollStrategyFactory: (() => polling.PollStrategy)

Type declaration

RequestId: ArrayBuffer & { __requestId__: void }
Signature: ArrayBuffer & { __signature__: void }

A signature array buffer.

Variables

ACTOR_METHOD_WITH_CERTIFICATE: "certificate" = 'certificate'
ACTOR_METHOD_WITH_HTTP_DETAILS: "http-details" = 'http-details'
DER_COSE_OID: Uint8Array = ...

A DER encoded SEQUENCE(OID) for DER-encoded-COSE

ED25519_OID: Uint8Array = ...

A DER encoded SEQUENCE(OID) for the Ed25519 algorithm

IC_ROOT_KEY: string = ...
MANAGEMENT_CANISTER_ID: "aaaaa-aa" = 'aaaaa-aa'
SECP256K1_OID: Uint8Array = ...

A DER encoded SEQUENCE(OID) for secp256k1 with the ECDSA algorithm

Functions

  • blsVerify(pk: Uint8Array, sig: Uint8Array, msg: Uint8Array): boolean
  • Parameters

    • pk: Uint8Array

      primary key: Uint8Array

    • sig: Uint8Array

      signature: Uint8Array

    • msg: Uint8Array

      message: Uint8Array

    Returns boolean

    boolean

  • bufEquals(b1: ArrayBuffer, b2: ArrayBuffer): boolean
  • bufFromBufLike(bufLike: number[] | ArrayBufferLike | ArrayBufferView | DataView | Uint8Array | [number] | { buffer: ArrayBuffer }): ArrayBuffer
  • Returns a true ArrayBuffer from an ArrayBufferLike object.

    Parameters

    • bufLike: number[] | ArrayBufferLike | ArrayBufferView | DataView | Uint8Array | [number] | { buffer: ArrayBuffer }

      a buffer-like object

    Returns ArrayBuffer

    ArrayBuffer

  • check_canister_ranges(params: { canisterId: Principal; subnetId: Principal; tree: HashTree }): boolean
  • Check if a canister falls within a range of canisters

    Parameters

    • params: { canisterId: Principal; subnetId: Principal; tree: HashTree }

      the parameters to check

      • canisterId: Principal

        Principal

      • subnetId: Principal

        Principal

      • tree: HashTree

        HashTree

    Returns boolean

    boolean

  • compare(b1: ArrayBuffer, b2: ArrayBuffer): number
  • Parameters

    • b1: ArrayBuffer

      array buffer 1

    • b2: ArrayBuffer

      array buffer 2

    Returns number

    number - negative if b1 < b2, positive if b1 > b2, 0 if b1 === b2

  • concat(...buffers: ArrayBuffer[]): ArrayBuffer
  • decodeLen(buf: Uint8Array, offset: number): number
  • decodeLenBytes(buf: Uint8Array, offset: number): number
  • encodeLen(buf: Uint8Array, offset: number, len: number): number
  • encodeLenBytes(len: number): number
  • fetchCandid(canisterId: string, agent?: HttpAgent): Promise<string>
  • Retrieves the Candid interface for the specified canister.

    Parameters

    • canisterId: string

      A string corresponding to the canister ID

    • Optional agent: HttpAgent

      The agent to use for the request (usually an HttpAgent)

    Returns Promise<string>

    Candid source code

  • find_label(label: ArrayBuffer, tree: HashTree): LabelLookupResult
  • fromHex(hex: string): ArrayBuffer
  • hash(data: ArrayBuffer): ArrayBuffer
  • hashOfMap(map: Record<string, unknown>): ArrayBuffer
  • hashTreeToString(tree: HashTree): string
  • hashValue(value: unknown): ArrayBuffer
  • lookupResultToBuffer(result: LookupResult): ArrayBuffer | undefined
  • Polls the IC to check the status of the given request then returns the response bytes once the request has been processed.

    Parameters

    • agent: Agent

      The agent to use to poll read_state.

    • canisterId: Principal

      The effective canister ID.

    • requestId: RequestId

      The Request ID to poll status for.

    • strategy: polling.PollStrategy = ...

      A polling strategy.

    • Optional request: any

      Request for the readState call.

    • Optional blsVerify: VerifyFunc

      optional replacement function that verifies the BLS signature of a certificate.

    Returns Promise<{ certificate: Certificate; reply: ArrayBuffer }>

  • randomNumber(): number
  • reconstruct(t: HashTree): Promise<ArrayBuffer>
  • requestIdOf(request: Record<string, any>): RequestId
  • toHex(buffer: ArrayBuffer): string
  • Transforms a buffer to an hexadecimal string. This will use the buffer as an Uint8Array.

    Parameters

    • buffer: ArrayBuffer

      The buffer to return the hexadecimal string of.

    Returns string

  • uint8ToBuf(arr: Uint8Array): ArrayBuffer
  • Returns a true ArrayBuffer from a Uint8Array, as Uint8Array.buffer is unsafe.

    Parameters

    • arr: Uint8Array

      Uint8Array to convert

    Returns ArrayBuffer

    ArrayBuffer

  • unwrapDER(derEncoded: ArrayBuffer, oid: Uint8Array): Uint8Array
  • Extracts a payload from the given derEncoded data, and checks that it was tagged with the given oid.

    derEncoded = SEQUENCE(oid, BITSTRING(payload))

    Parameters

    • derEncoded: ArrayBuffer

      The DER encoded and tagged data

    • oid: Uint8Array

      The DER encoded (and SEQUENCE wrapped!) expected OID

    Returns Uint8Array

    The unwrapped payload

  • verify(pk: Uint8Array, sig: Uint8Array, msg: Uint8Array): boolean
  • wrapDER(payload: ArrayBuffer, oid: Uint8Array): Uint8Array
  • Wraps the given payload in a DER encoding tagged with the given encoded oid like so: SEQUENCE(oid, BITSTRING(payload))

    Parameters

    • payload: ArrayBuffer

      The payload to encode as the bit string

    • oid: Uint8Array

      The DER encoded (and SEQUENCE wrapped!) OID to tag the payload with

    Returns Uint8Array

Generated using TypeDoc