Executing From An Instance

Execute operations from a Hats Account instance. Only wearers of the instance's hat can call the following functions.

execute

Execute an operation.

const executionResult = await hatsAccount1ofNClient.execute({
    account,
    instance,
    operation,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    operation: Operation;
}
  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - The Hats Account instance.

  • operation - An object of type Operation, which includes the operation's execution data.

Response:

{
  status: "success" | "reverted";
  transactionHash: `0x${string}`;
}

An object of type ExecutionResult, includes:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

executeBatch

Execute a batch of operations.

const executionResult = await hatsAccount1ofNClient.executeBatch({
    account,
    instance,
    operations,
});

Arguments:

{
    account: Account | Address;
    instance: Address;
    operations: Operation[];
}
  • account - Viem account (Address for JSON-RPC accounts or Account for other types).

  • instance - The Hats Account instance.

  • operations - An array of Operation objects, each includes an operation's execution data.

Response:

{
  status: "success" | "reverted";
  transactionHash: `0x${string}`;
}

An object of type ExecutionResult, includes:

  • status - "success" if transaction was successful, "reverted" if transaction reverted.

  • transactionHash - transaction's hash.

Last updated