Options
All
  • Public
  • Public/Protected
  • All
Menu

@dfinity/agent

Index

Namespaces

Enumerations

Classes

Interfaces

Type Aliases

Variables

Functions

Type Aliases

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

Type declaration

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

HashTree: [typeof Empty] | [typeof Fork, HashTree, HashTree] | [typeof Labeled, ArrayBuffer, HashTree] | [typeof Leaf, ArrayBuffer] | [typeof Pruned, ArrayBuffer]
HttpHeaderField: [string, string]
ManagementCanisterRecord: _SERVICE
NodeIdType: typeof NodeId[keyof typeof NodeId]
NodeSignature: { identity: Uint8Array; signature: Uint8Array; timestamp: bigint }

Type declaration

  • identity: Uint8Array
  • signature: Uint8Array
  • timestamp: bigint
Nonce: Uint8Array & { __nonce__: void }
RequestId: ArrayBuffer & { __requestId__: void }
Signature: ArrayBuffer & { __signature__: void }

A signature array buffer.

Variables

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'
NodeId: { Empty: number; Fork: number; Labeled: number; Leaf: number; Pruned: number } = ...

Type declaration

  • Empty: number
  • Fork: number
  • Labeled: number
  • Leaf: number
  • Pruned: number
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
  • 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

  • fromHex(hex: string): ArrayBuffer
  • hash(data: ArrayBuffer): ArrayBuffer
  • hashOfMap(map: Record<string, unknown>): ArrayBuffer
  • hashTreeToString(tree: HashTree): string
  • hashValue(value: unknown): ArrayBuffer
  • lookupResultToBuffer(result: undefined | ArrayBuffer | HashTree): ArrayBuffer | undefined
  • utility function to constrain the type of a path

    Parameters

    • result: undefined | ArrayBuffer | HashTree

      the result of a lookup

    Returns ArrayBuffer | undefined

    ArrayBuffer or Undefined

  • lookup_path(path: (string | ArrayBuffer)[], tree: HashTree): ArrayBuffer | HashTree | undefined
  • 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