Options
All
  • Public
  • Public/Protected
  • All
Menu

dragonchain-sdk

Index

Type aliases

BlockSchemaType

CustomIndexType

CustomIndexType: "text" | "tag" | "number"

HmacAlgorithm

HmacAlgorithm: "SHA256" | "SHA3-256" | "BLAKE2b512"

SmartContractExecutionOrder

SmartContractExecutionOrder: "parallel" | "serial"

SupportedInterchains

SupportedInterchains: "ethereum" | "bitcoin" | "binance"

failureCode

failureCode: "PARAM_ERROR" | "NOT_FOUND"

Type of failure

levelVerifications

levelVerifications: L2BlockAtRest[] | L3BlockAtRest[] | L4BlockAtRest[] | L5BlockAtRest[]

Functions

Const createClient

  • createClient(options?: { algorithm?: HmacAlgorithm; authKey?: undefined | string; authKeyId?: undefined | string; dragonchainId?: undefined | string; endpoint?: undefined | string; verify?: undefined | false | true }): Promise<DragonchainClient>
  • Create and return an instantiation of a dragonchain client

    Parameters

    • Default value options: { algorithm?: HmacAlgorithm; authKey?: undefined | string; authKeyId?: undefined | string; dragonchainId?: undefined | string; endpoint?: undefined | string; verify?: undefined | false | true } = {}
      • Optional algorithm?: HmacAlgorithm

        The hmac algorithm to use when generating authenticated requests. Defaults to SHA256

      • Optional authKey?: undefined | string

        AuthKey to explicitly use with this client. Must be set along with authKeyId or it will be ignored

      • Optional authKeyId?: undefined | string

        AuthKeyId to explicitly use with this client. Must be set along with authKey or it will be ignored

      • Optional dragonchainId?: undefined | string

        DragonchainId for this client. Not necessary if DRAGONCHAIN_ID env var is set, or if default is set in config file

      • Optional endpoint?: undefined | string

        Endpoint to explicitly use with this client. Should not have a trailing slash and look something like https://some.url

      • Optional verify?: undefined | false | true

        Whether or not to verify the https certificate for https connections. Defaults to true if not provided

    Returns Promise<DragonchainClient>

Const getDragonchainCredentials

  • Get the credentials for a dragonchain. First checks environment, then configuration files, then a smart contract location

    throws

    {FailureByDesign}

    Parameters

    • dragonchainId: string

      dragonchainId to get credentials for

    • Default value injected: any = { getCredsFromEnvVars, getCredsFromFile, getCredsAsSmartContract }

    Returns Promise<DragonchainCredentials>

    Credentials of the dragonchain

Const getDragonchainId

  • getDragonchainId(injected?: any): Promise<string>
  • Get the default configured dragonchainId from environment/config file

    throws

    {FailureByDesign}

    Parameters

    • Default value injected: any = { getIdFromEnvVars, getIdFromFile }

    Returns Promise<string>

Const setLogger

  • setLogger(newLogger?: any): void
  • Set the logger that the sdk uses

    By default this logger will do nothing, thorwing away all logs

    Parameters

    • Default value newLogger: any = { log: nullLog, info: nullLog, warn: nullLog, error: nullLog, debug: nullLog }

      a logger object that implements functions for: log, info, warn, error, and debug

    Returns void