Execution Utils

The ExecutionUtility class in the SDK provides utility functions for working with hook executions and emitted transactions in the XRPL.

Getting Hook Executions from Transaction Metadata

The getHookExecutionsFromMeta function is used to retrieve hook executions from transaction metadata. It takes in the following parameters:

  • client: The XRPL client object.
  • meta: The transaction metadata object.

Here is an example of using the getHookExecutionsFromMeta function:

import { TransactionMetadata } from '@transia/xrpl'
import {
  serverUrl,
  setupClient,
  ExecutionUtility 
} from '@transia/hooks-toolkit'

const testContext = (await setupClient(
  serverUrl
)) as XrplIntegrationTestContext

const meta: TransactionMetadata = {}

const hookExecutions = await ExecutionUtility.getHookExecutionsFromMeta(
  testContext.client, 
  meta
)

In the example above, we create an XRPL client object and retrieve the hook executions from the transaction metadata using the getHookExecutionsFromMeta function.

Getting Hook Executions from Transaction Hash

The getHookExecutionsFromTx function is used to retrieve hook executions from a transaction hash. It takes in the following parameters:

  • client: The XRPL client object.
  • hash: The transaction hash.

Here is an example of using the getHookExecutionsFromTx function:

import {
  serverUrl,
  setupClient,
  ExecutionUtility 
} from '@transia/hooks-toolkit'

const testContext = (await setupClient(
  serverUrl
)) as XrplIntegrationTestContext

const hash = '...'

const hookExecutions = await ExecutionUtility.getHookExecutionsFromTx(
  testContext.client,
  hash
)

In the example above, we create an XRPL client object and retrieve the hook executions from the transaction hash using the getHookExecutionsFromTx function.

Getting Hook Emitted Transactions from Transaction Metadata

The getHookEmittedTxsFromMeta function is used to retrieve hook emitted transactions from transaction metadata. It takes in the following parameters:

  • client: The XRPL client object.
  • meta: The transaction metadata object.

Here is an example of using the getHookEmittedTxsFromMeta function:

import { TransactionMetadata } from '@transia/xrpl'
import {
  serverUrl,
  setupClient,
  ExecutionUtility 
} from '@transia/hooks-toolkit'

const testContext = (await setupClient(
  serverUrl
)) as XrplIntegrationTestContext

const meta: TransactionMetadata = ...

const hookEmittedTxs = await ExecutionUtility.getHookEmittedTxsFromMeta(
  testContext.client,
  meta
)

In the example above, we create an XRPL client object and retrieve the hook emitted transactions from the transaction metadata using the getHookEmittedTxsFromMeta function.


The ExecutionUtility class provides convenient functions for retrieving hook executions and emitted transactions from XRPL transaction metadata.

Was this page helpful?