Class SmartContractsClient

Smart Contracts Client object enables smart contract deployment, calls and streaming of events.

Hierarchy

  • BaseClient
    • SmartContractsClient

Implements

Constructors

Properties

clientConfig: IClientConfig
mnsResolver: MnsResolver
publicApiClient: PublicApiClient
walletClient: IWalletClient

Methods

  • Helper method to wait for a specific condition on an operation's status.

    Parameters

    • opId: string

      The operation id to check.

    • timeout: number = WAIT_STATUS_TIMEOUT
    • statusCheck: ((status) => boolean)

      A callback function that defines the condition for the operation status.

    Returns Promise<EOperationStatus>

    A promise that resolves to the status of the operation.

  • Compacts bytes payload per operation.

    Parameters

    • data: DataType

      The operation data.

    • opTypeId: OperationTypeId

      The operation type id.

    • expirePeriod: number

      The expire period.

    Returns Buffer

    The compacted bytes payload.

  • Sends a post JSON rpc request to the node.

    Type Parameters

    • T

    Parameters

    • resource: JSON_RPC_REQUEST_METHOD

      The rpc method to call.

    • params: object

      The parameters to pass to the rpc method.

    Returns Promise<T>

    A promise that resolves as the result of the rpc method.

    Throws

    An error if the rpc method returns an error.

  • Set new providers as IProvider.

    Parameters

    • providers: IProvider[]

      The new providers to set as an array of IProvider.

    Returns void

    Throws

    Will throw an error if no public providers are included in the given array of providers.

    Throws

    Will throw an error if no private providers are included in the given array of providers.

  • Watches the status of an operation and invokes a callback function when the status changes.

    Parameters

    • opId: string

      The ID of the operation to watch.

    • callback: ((status, error?) => void)

      The function to call when the operation status changes. It receives the new status and a potential error as a parameter.

        • (status, error?): void
        • Parameters

          Returns void

    • timeInterval: number = TX_POLL_INTERVAL_MS

      The interval in milliseconds at which to check the operation status. Defaults to 1000 ms.

    • timeout: number = WAIT_OPERATION_TIMEOUT

      The time at which to stop checking the operation status. Defaults is 16000 ms.

    Returns Promise<(() => void)>

    A Promise that resolves to a function that can be called to stop watching the operation status.

Generated using TypeDoc