Options
All
  • Public
  • Public/Protected
  • All
Menu

Main service exposed to outside. Needs to be instantiated with username, password, toolName (optional) and environment (optional) fields. If no environment specified it will default to prod. Please note that this is exported as Client.

example

import { Client } from 'mythxjs'.

const mythx = new Client('0x0000000000000000000000000000000000000000', 'trial', 'testTool', 'https://staging.api.mythx.io/v1/');

Hierarchy

  • ClientService

Index

Constructors

constructor

  • new ClientService(ethAddress?: undefined | string, password?: undefined | string, toolName?: string, environment?: string, accessToken?: string): ClientService
  • Parameters

    • Optional ethAddress: undefined | string
    • Optional password: undefined | string
    • Default value toolName: string = "MythXJS"
    • Default value environment: string = "https://api.mythx.io/v1"
    • Default value accessToken: string = ""

    Returns ClientService

Properties

Static MYTHX_API_ENVIRONMENT

MYTHX_API_ENVIRONMENT: any

Methods

analyze

  • analyze(options: AnalyzeOptions, propertyChecking?: undefined | false | true): Promise<AnalysisSubmission>
  • Submit a smart contract using custom parameters.

    Parameters

    • options: AnalyzeOptions

      Object containing options to submit to API

    • Optional propertyChecking: undefined | false | true

      Only Assertion Violations Check enabling flag

    Returns Promise<AnalysisSubmission>

    Resolves with API response, or throws error

createGroup

  • createGroup(groupName?: undefined | string): Promise<Group>
  • Create an analysis submission group.

    Parameters

    • Optional groupName: undefined | string

      (optional) - String that defines a group name

    Returns Promise<Group>

    Resolves with API response, or throws error

getAnalysesList

  • getAnalysesList(): Promise<AnalysisList>

getAnalysisStatus

  • getAnalysisStatus(uuid: string): Promise<AnalysisSubmission>
  • Get status for analysis on given UUID.

    Parameters

    • uuid: string

      unique identifier of analysis job

    Returns Promise<AnalysisSubmission>

    Resolves with API response, or throws error

getChallenge

  • getChallenge(ethAddress?: undefined | string): Promise<any>
  • Generates authentication challenge (Metamask only for now). The Metamask flow needs to be handled on the front end since MythXJS does not have Web3 dependencies.

    Parameters

    • Optional ethAddress: undefined | string

      Ethereum address for Mythx account

    Returns Promise<any>

    Resolves with API response or throw error

getDetectedIssues

  • getDetectedIssues(uuid: string): Promise<DetectedIssues>
  • Gets the array of issues from the API.

    Parameters

    • uuid: string

      unique identifier of analysis job

    Returns Promise<DetectedIssues>

    Resolves with API response, or throws error

getGroupById

  • getGroupById(groupId: string): Promise<Group>
  • Get a single analyses group by ID.

    Parameters

    • groupId: string

      (required) - String that defines a unique group ID

    Returns Promise<Group>

    Resolves with API response, or throws error

getPdf

  • getPdf(uuid: string): Promise<any>
  • Get API generated PDF.

    Parameters

    • uuid: string

      Unique identifier of analysis job

    Returns Promise<any>

    Resolves with API response, or throws error

getStats

  • getStats(queryString?: undefined | string): Promise<Array<StatsResponse>>
  • Returns API stats. Internal only, needs admin credentials to be accessed. @returns {Promise} Resolves with API response or throw error

    Parameters

    • Optional queryString: undefined | string

    Returns Promise<Array<StatsResponse>>

getUsers

  • Retrieve list of registred API users or just caller user object if no required permission.

    Parameters

    • queryString: string

      Query string for detailed list (query parameters: offset, orderBy, email, ethAddress)

    Returns Promise<UsersResponse>

    Resolves with API response or throw error

getVersion

  • getVersion(): Promise<Version>
  • Returns API current version. Does not require login. @returns Resolves with API response or throw error

    Returns Promise<Version>

groupOperation

  • groupOperation(groupId: any, operationType?: any): Promise<Group>
  • Perform operations on specific group.

    Parameters

    • groupId: any

      String that defines a unique group ID

    • Optional operationType: any

      (optional) - Type of operation to be performed in the group (e.g. "seal_group")

    Returns Promise<Group>

    Resolves with API response, or throws error

listGroups

  • listGroups(queryString?: undefined | string): Promise<AnalysisGroups>
  • Get list of analyses groups.

    Parameters

    • Optional queryString: undefined | string

      Query string for detailed list of groups (query parameters: offset, createdBy, groupName, dateFrom, dateTo)

    Returns Promise<AnalysisGroups>

    Resolves with API response, or throws error

login

  • login(ethAddress?: undefined | string, password?: undefined | string): Promise<JwtTokensInterface>
  • Login to the API using ethAddress and password specified in the library constructor.

    Parameters

    • Optional ethAddress: undefined | string

      Ethereum address for Mythx account

    • Optional password: undefined | string

      Password for Ethereum address

    Returns Promise<JwtTokensInterface>

    Returns an object containing two tokens (access+refresh) that can be saved in storage.

loginWithSignature

  • Login to the API using metamask challenge result message. In order to get the object containing the message use getChallenge and handle Metamask login in the frontend.

    Parameters

    • signature: string

      Signature passed by provider. In case of metamask this will be returned after signing challenge.

    • provider: string

      pass a provider value for the HTTP headers. If nothing is passed defaults to MetaMask

    Returns Promise<JwtTokensInterface>

    Returns an object containing two tokens (access+refresh) that can be saved in storage.

logout

  • logout(): Promise<__type>

submitBytecode

  • submitBytecode(bytecode: string): Promise<AnalysisSubmission>
  • Submit a smart contract using bytecode only. This will likely be deprecated in future.

    Parameters

    • bytecode: string

      Compiled bytecode of a smart contract for example "0xfe".

    Returns Promise<AnalysisSubmission>

    Resolves with API response, or throws error

submitSourceCode

  • submitSourceCode(sourceCode: string, contractName: string, propertyChecking?: undefined | false | true): Promise<AnalysisSubmission>
  • Submit a smart contract using sourcecode only. This will likely be deprecated in future.

    Parameters

    • sourceCode: string

      String containing smart contract sourcecode.

    • contractName: string

      Name of the contract to submit for analysis.

    • Optional propertyChecking: undefined | false | true

      Only Assertion Violations Check enabling flag

    Returns Promise<AnalysisSubmission>

    Resolves with API response, or throws errors

Object literals

Static jwtTokens

jwtTokens: object

access

access: string = ""

refresh

refresh: string = ""

Generated using TypeDoc