> For the complete documentation index, see [llms.txt](https://docs.talus.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_interface/onchain_tool_result.md).

# nexus\_interface::onchain\_tool\_result

* [Struct `OnchainToolResult`](#struct-onchaintoolresult)
* [Struct `OnchainToolResultInnerV1`](#struct-onchaintoolresultinnerv1)
* [Struct `InputCommitmentKey`](#struct-inputcommitmentkey)
* [Struct `InputCommitment`](#struct-inputcommitment)
* [Constants](#constants)
* [Function `new`](#function-new)
* [Function `finalize_and_share`](#function-finalize_and_share)
* [Function `consume`](#function-consume)
* [Function `id`](#function-id)
* [Function `is_finalized`](#function-is_finalized)
* [Function `execution_id`](#function-execution_id)
* [Function `input_commitment`](#function-input_commitment)

### Struct `OnchainToolResult`

Durable result layout for a canonical on-chain Tool invocation.

```move
public struct OnchainToolResult has key
```

<details>

<summary>Fields</summary>

[`id`](#nexus_interface_onchain_tool_result_id)`: sui::object::UID`

</details>

#### Struct `OnchainToolResultInnerV1`

Version one stored layout for \[[`OnchainToolResult`](#nexus_interface_onchain_tool_result_OnchainToolResult)].

The stable \[[`OnchainToolResult`](#nexus_interface_onchain_tool_result_OnchainToolResult)] cannot contain these fields because its published layout must remain unchanged while stored data evolves.

```move
public struct OnchainToolResultInnerV1 has store
```

<details>

<summary>Fields</summary>

[`execution_id`](#nexus_interface_onchain_tool_result_execution_id)`: sui::object::IDfinalized: boolstamps: std::option::Option<sui::vec_map::VecMap<sui::object::ID, vector<u8>>>tag: std::option::Option<vector<u8>>named_payload: std::option::Option<sui::vec_map::VecMap<vector<u8>,` [`nexus_primitives::data::NexusData`](/talus-docs-v2.1.0/reference/move/nexus_primitives/data.md#nexus_primitives_data_NexusData)`>>finalize_tx_digest: std::option::Option<vector<u8>>finalize_recipient: std::option::Option<address>`

</details>

#### Struct `InputCommitmentKey`

Private-construction key for the result's canonical input-commitment dynamic field.

```move
public struct InputCommitmentKey has copy, drop, store
```

<details>

<summary>Fields</summary>

</details>

#### Struct `InputCommitment`

Private-construction value for the result's canonical input-commitment dynamic field.

```move
public struct InputCommitment has store
```

<details>

<summary>Fields</summary>

`bytes: vector<u8>`

</details>

#### Constants

```move
#[error]
const EWorksheetUidMismatch: vector<u8> = b"Worksheet was not created from the expected execution UID";
```

```move
#[error]
const EWorksheetRequiredStampMissing: vector<u8> = b"Worksheet is missing required creation stamps";
```

```move
#[error]
const EWorksheetUnexpectedStampCount: vector<u8> = b"Worksheet has an unexpected stamp count";
```

```move
#[error]
const EAlreadyFinalized: vector<u8> = b"Onchain tool result is already finalized";
```

```move
#[error]
const ENotFinalized: vector<u8> = b"Onchain tool result is not finalized";
```

```move
#[error]
const EInputCommitmentLength: vector<u8> = b"Onchain tool input commitment must be 32 bytes";
```

```move
const SHA256_LEN: u64 = 32;
```

#### Function `new`

Creates an owned empty result bound to the execution UID that created the worksheet.

```move
public fun new(execution_uid: &sui::object::UID, worksheet: &nexus_primitives::proof_of_uid::ProofOfUID, stamp: &nexus_interface::authorization::AgentVertexAuthorizationStamp, ctx: &mut sui::tx_context::TxContext): nexus_interface::onchain_tool_result::OnchainToolResult
```

#### Function `finalize_and_share`

Finalizes and shares the result after every required UID has participated.

The result satisfies its own requirement before completing \[UIDRequirements]. This verifies that no requirements remain and binds them to this exact result without restricting which caller may complete the operation.

```move
public fun finalize_and_share(result: nexus_interface::onchain_tool_result::OnchainToolResult, requirements: nexus_primitives::proof_of_uid::UIDRequirements, output: nexus_primitives::tagged_output::TaggedOutput, ctx: &mut sui::tx_context::TxContext)
```

#### Function `consume`

Consumes and deletes the finalized result, returning the exact durable contents workflow needs.

```move
public fun consume(result: nexus_interface::onchain_tool_result::OnchainToolResult, execution_uid: &sui::object::UID): (sui::vec_map::VecMap<sui::object::ID, vector<u8>>, vector<u8>, sui::vec_map::VecMap<vector<u8>, nexus_primitives::data::NexusData>, vector<u8>, address)
```

#### Function `id`

The object ID of the result.

```move
public fun id(result: &nexus_interface::onchain_tool_result::OnchainToolResult): sui::object::ID
```

#### Function `is_finalized`

Whether the result has been finalized by its tool.

```move
public fun is_finalized(result: &nexus_interface::onchain_tool_result::OnchainToolResult): bool
```

#### Function `execution_id`

The ID of the execution this result belongs to.

```move
public fun execution_id(result: &nexus_interface::onchain_tool_result::OnchainToolResult): sui::object::ID
```

#### Function `input_commitment`

Returns the canonical resolved-input commitment stamped for this Tool invocation.

```move
public fun input_commitment(result: &nexus_interface::onchain_tool_result::OnchainToolResult): vector<u8>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_interface/onchain_tool_result.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
