Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DragonchainClient

HTTP Client that interfaces with the dragonchain api, using credentials stored on your machine.

class

DragonchainClient

Hierarchy

  • DragonchainClient

Index

Constructors

constructor

  • new DragonchainClient(dragonchainId?: string, verify?: boolean, injected?: any): DragonchainClient
  • Create an Instance of a DragonchainClient.

    Parameters

    • Default value dragonchainId: string = ""

      id of a target dragonchain

    • Default value verify: boolean = true

      verify SSL Certs when talking to local dragonchains

    • Default value injected: any = {}

      used only for testing

    Returns DragonchainClient

Methods

createBulkTransaction

createContract

createTransaction

  • Create a new Transaction on your Dragonchain. This transaction, if properly structured, will be received by your dragonchain, hashed, and put into a queue for processing into a block. A POST request is made to the callback URL when the transaction has settled into a block on the Blockchain. The body of this POST request is the schema of an L1DragonchainTransactionFull. The transaction_id returned from this function can be used for checking the status of this transaction. Most importantly; the block in which it has been fixated.

    Parameters

    Returns Promise<Response<DragonchainTransactionCreateResponse>>

deleteSmartContract

deleteTransactionType

getBlock

getSecret

  • getSecret(secretName: string): string

getSmartContract

getSmartContractHeap

  • getSmartContractHeap(key: string, scName: string, jsonParse?: boolean): Promise<Response<string>>
  • getSmartContractHeap Get from the smart contract heap This function, (unlike other SDK methods) returns raw utf-8 text by design. If you expect the result to be parsed json pass true as the jsonParse parameter.

    Parameters

    • key: string

      the key under which data has been stored in heap

    • scName: string

      the name of smart contract

    • Default value jsonParse: boolean = false

      attempt to parse heap data as JSON. Throws JSONParse error if it fails.

    Returns Promise<Response<string>>

getStatus

getTransaction

getVerifications

listSmartcontractHeap

  • listSmartcontractHeap(scName: string, key?: string): Promise<Response<string[]>>
  • listSmartcontractHeap List objects from a smart contract heap

    Parameters

    • scName: string

      the name of smart contract

    • Default value key: string = ""

      the sub-key ('folder') to list in the SC heap (optional. Defaults to root of SC heap)

    Returns Promise<Response<string[]>>

listTransactionTypes

overrideCredentials

  • overrideCredentials(authKeyId: string, authKey: string): void
  • This method is used to override this SDK's attempt to automatically fetch credentials automatically with manually specified creds

    Parameters

    • authKeyId: string

      Auth Key ID used in HMAC

    • authKey: string

      Auth Key used in HMAC

    Returns void

queryBlocks

querySmartContracts

  • querySmartContracts(luceneQuery?: undefined | string, sort?: undefined | string, offset?: number, limit?: number): Promise<Response<SmartContractAtRest>>

queryTransactions

registerTransactionType

setDragonchainId

  • setDragonchainId(dragonchainId: string, setEndpoint?: boolean): void
  • Change the dragonchainId for this DragonchainClient instance.

    After using this command, subsequent requests to your dragonchain will attempt to re-locate credentials for the new dragonchain

    Parameters

    • dragonchainId: string

      The id of the dragonchain you want to set

    • Default value setEndpoint: boolean = true

      Whether or not to set a new endpoint automatically (for managed chains at .api.dragonchain.com)

    Returns void

setEndpoint

  • setEndpoint(endpoint: string): void

updateDragonnetConfig

updateMatchmakingConfig

  • updateMatchmakingConfig(askingPrice?: undefined | number, broadcastInterval?: undefined | number): Promise<Response<UpdateResponse>>
  • Update your matchmaking data. If you are a level 2-4, you're required to update your asking price.

    Parameters

    • Optional askingPrice: undefined | number

      (0.0001-1000.0000) the price in DRGN to charge L1 nodes for your verification of their data. Setting this number too high will cause L1's to ignore you more often.

    • Optional broadcastInterval: undefined | number

      Broadcast Interval is only for level 5 chains

    Returns Promise<Response<UpdateResponse>>

updateSmartContract

  • updateSmartContract(contractId: string, image?: undefined | string, cmd?: undefined | string, executionOrder?: SmartContractExecutionOrder, desiredState?: SmartContractDesiredState, args?: string[], env?: undefined | __type, secrets?: undefined | __type, seconds?: undefined | number, cron?: undefined | string, auth?: undefined | string): Promise<Response<UpdateResponse>>
  • Updates existing contract fields

    Parameters

    • contractId: string
    • Optional image: undefined | string

      The docker image containing the smart contract logic

    • Optional cmd: undefined | string

      Entrypoint command to run in the docker container

    • Optional executionOrder: SmartContractExecutionOrder

      Order of execution. Valid values 'parallel' or 'serial'

    • Optional desiredState: SmartContractDesiredState

      Change the state of a contract. Valid values are "active" and "inactive". You may only change the state of an active or inactive contract.

    • Optional args: string[]

      List of arguments to the cmd field

    • Optional env: undefined | __type

      mapping of environment variables for your contract

    • Optional secrets: undefined | __type

      mapping of secrets for your contract

    • Optional seconds: undefined | number

      The seconds of scheduled execution

    • Optional cron: undefined | string

      The rate of scheduled execution specified as a cron

    • Optional auth: undefined | string

      basic-auth for pulling docker images, base64 encoded (e.g. username:password)

    Returns Promise<Response<UpdateResponse>>

updateTransactionType