Initiates a subscription to the blockchain events based on the specified parameters. This function supports subscriptions to new block headers ('newHeads') and log entries ('logs') that match given filter criteria. It ensures that the provided parameters are valid and that the provider is available before setting up the subscription and generating a unique subscription ID.

  • Parameters

    • thorClient: ThorClient

      An instance of ThorClient used to interact with the blockchain, such as retrieving the current best block when setting up a new subscription.

    • params: ethSubscribeParams

      Parameters for the subscription, conforming to ethSubscribeParams. The first element of the array specifies the type of subscription, and the second element (if present) provides additional options, such as filter criteria for log subscriptions.

    • Optionalprovider: VeChainProvider

      An optional VeChainProvider instance that contains the subscription manager. The subscription manager is used to store and manage active subscriptions. If the provider is not provided or is undefined, the function throws an error.

    Returns Promise<string>

    A Promise that resolves to a string representing the unique ID of the created subscription.