> 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_tool/time_pass.md).

# nexus\_tool::time\_pass

* [Struct `Policy`](#struct-policy)
* [Struct `Config`](#struct-config)
* [Struct `State`](#struct-state)
* [Struct `TimePassCreatedEvent`](#struct-timepasscreatedevent)
* [Struct `TimePassOfferChangedEvent`](#struct-timepassofferchangedevent)
* [Constants](#constants)
* [Function `enable`](#function-enable)
* [Function `buy`](#function-buy)
* [Function `buy_more`](#function-buy_more)
* [Function `close_issuance`](#function-close_issuance)
* [Function `open_issuance`](#function-open_issuance)
* [Function `update_terms`](#function-update_terms)
* [Function `offer`](#function-offer)
* [Function `issue`](#function-issue)
* [Function `update_window`](#function-update_window)
* [Function `get_invocation`](#function-get_invocation)
* [Function `collect`](#function-collect)
* [Function `derive_id`](#function-derive_id)
* [Function `share`](#function-share)
* [Function `window`](#function-window)

### Struct `Policy`

Private construction witness for this policy.

```move
public struct Policy has drop
```

<details>

<summary>Fields</summary>

</details>

#### Struct `Config`

Owner configured sale terms for time passes.

```move
public struct Config has store
```

<details>

<summary>Fields</summary>

`issuance_enabled: boolprice_per_ms: u64minimum_duration_ms: u64maximum_duration_ms: u64`

</details>

#### Struct `State`

Policy state for one inclusive start and exclusive end window.

```move
public struct State has store
```

<details>

<summary>Fields</summary>

`valid_from_ms: u64valid_until_ms: u64`

</details>

#### Struct `TimePassCreatedEvent`

Records creation of one canonical time pass \[PolicyAccount].

```move
public struct TimePassCreatedEvent has copy, drop
```

<details>

<summary>Fields</summary>

`tool: sui::object::IDcashier: sui::object::IDpass: sui::object::IDbeneficiary:` [`nexus_interface::payment::PaymentSourceKind`](/talus-docs-v2.1.0/reference/move/nexus_interface/payment.md#nexus_interface_payment_PaymentSourceKind)`valid_from_ms: u64valid_until_ms: u64`

</details>

#### Struct `TimePassOfferChangedEvent`

Records the complete commercial offer for future time pass purchases.

```move
public struct TimePassOfferChangedEvent has copy, drop
```

<details>

<summary>Fields</summary>

`cashier: sui::object::IDissuance_enabled: boolprice_per_ms: u64minimum_duration_ms: u64maximum_duration_ms: u64`

</details>

#### Constants

```move
#[error]
const EInvalidPassDuration: vector<u8> = b"Pass duration is outside the configured range";
```

```move
#[error]
const EInvalidPassWindow: vector<u8> = b"Pass validity window is empty";
```

```move
#[error]
const EInvalidPassPrice: vector<u8> = b"Pass price must be greater than zero";
```

```move
#[error]
const EIssuanceClosed: vector<u8> = b"Time pass issuance is closed";
```

```move
#[error]
const EPassMismatch: vector<u8> = b"Time pass does not authorize this invocation request";
```

```move
#[error]
const EPassNotActive: vector<u8> = b"Time pass is not active at invocation admission";
```

```move
#[error]
const EPassOverflow: vector<u8> = b"Time pass arithmetic overflow";
```

#### Function `enable`

Enables time pass admission and sales.

```move
public fun enable(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>, price_per_ms: u64, minimum_duration_ms: u64, maximum_duration_ms: u64)
```

#### Function `buy`

Purchases and shares the canonical pass while transferring prepaid SUI to the cashier. The public call returns only the deposit ID.

```move
public fun buy(cashier: &mut nexus_tool::tool_cashier::ToolCashier, pay_with: &mut sui::coin::Coin<sui::sui::SUI>, beneficiary: nexus_interface::payment::PaymentSourceKind, duration_ms: u64, clock: &sui::clock::Clock, ctx: &mut sui::tx_context::TxContext): sui::object::ID
```

#### Function `buy_more`

Purchases more duration for an existing canonical time pass account.

```move
public fun buy_more(cashier: &nexus_tool::tool_cashier::ToolCashier, pass: &mut nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>, pay_with: &mut sui::coin::Coin<sui::sui::SUI>, duration_ms: u64, clock: &sui::clock::Clock, ctx: &mut sui::tx_context::TxContext): sui::object::ID
```

#### Function `close_issuance`

Stops purchases and owner issuance without invalidating existing passes.

```move
public fun close_issuance(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>)
```

#### Function `open_issuance`

Resumes purchases and owner issuance for canonical time pass accounts.

```move
public fun open_issuance(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>)
```

#### Function `update_terms`

Replaces the sale terms used only for future purchases and grants.

```move
public fun update_terms(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>, price_per_ms: u64, minimum_duration_ms: u64, maximum_duration_ms: u64)
```

#### Function `offer`

Returns the current time pass offer.

```move
public fun offer(cashier: &nexus_tool::tool_cashier::ToolCashier): (bool, u64, u64, u64)
```

#### Function `issue`

Issues a time pass under Tool owner authority.

```move
public fun issue(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>, beneficiary: nexus_interface::payment::PaymentSourceKind, valid_from_ms: u64, valid_until_ms: u64, ctx: &mut sui::tx_context::TxContext): nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>
```

#### Function `update_window`

Replaces the validity window of an existing canonical pass.

```move
public fun update_window(cashier: &nexus_tool::tool_cashier::ToolCashier, pass: &mut nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>, valid_from_ms: u64, valid_until_ms: u64)
```

#### Function `get_invocation`

Creates an Invocation when admission occurs inside the pass window.

Validity is evaluated at \[InvocationRequest] authorization time. The start is inclusive and the end is exclusive.

```move
public fun get_invocation(cashier: &nexus_tool::tool_cashier::ToolCashier, pass: &nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>, request: nexus_interface::payment::InvocationRequest, ctx: &mut sui::tx_context::TxContext): nexus_tool::invocation::Invocation
```

#### Function `collect`

Collects finalized time pass Invocations under Tool owner authority.

```move
public fun collect(cashier: &mut nexus_tool::tool_cashier::ToolCashier, owner_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_tool::tool_cashier::OverToolCashier>, invocations: vector<sui::transfer::Receiving<nexus_tool::invocation::Invocation>>): sui::balance::Balance<sui::sui::SUI>
```

#### Function `derive_id`

Derives the canonical time pass account for \[beneficiary].

```move
public fun derive_id(cashier: sui::object::ID, beneficiary: nexus_interface::payment::PaymentSourceKind): sui::object::ID
```

#### Function `share`

Shares a time pass account for concurrent admission reads.

```move
public fun share(pass: nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>)
```

#### Function `window`

Returns the inclusive start and exclusive end of \[pass].

```move
public fun window(pass: &nexus_tool::tool_cashier::PolicyAccount<nexus_tool::time_pass::Policy, nexus_tool::time_pass::State>): (u64, u64)
```


---

# 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_tool/time_pass.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.
