> 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/reference/move/nexus_registry/priority_fee_vault.md).

# nexus\_registry::priority\_fee\_vault

* [Struct `PriorityFeeVault`](#struct-priorityfeevault)
* [Struct `PriorityFeeVaultInnerV1`](#struct-priorityfeevaultinnerv1)
* [Struct `PriorityFeeAccount`](#struct-priorityfeeaccount)
* [Struct `PriorityFeeVaultOwnerCap`](#struct-priorityfeevaultownercap)
* [Struct `PriorityFeeDeposit`](#struct-priorityfeedeposit)
* [Struct `PriorityFeeDepositCreatedEvent`](#struct-priorityfeedepositcreatedevent)
* [Struct `PriorityFeeShareChange`](#struct-priorityfeesharechange)
* [Struct `PriorityFeeSharesCollectedEvent`](#struct-priorityfeesharescollectedevent)
* [Struct `PriorityFeeWithdrawnEvent`](#struct-priorityfeewithdrawnevent)
* [Struct `PriorityFeeSwapEvent`](#struct-priorityfeeswapevent)
* [Struct `PriorityFeeVaultConfiguredEvent`](#struct-priorityfeevaultconfiguredevent)
* [Constants](#constants)
* [Function `create_deposit`](#function-create_deposit)
* [Function `collect_deposits`](#function-collect_deposits)
* [Function `swap_us_for_sui`](#function-swap_us_for_sui)
* [Function `withdraw_priority_fee`](#function-withdraw_priority_fee)
* [Function `configure`](#function-configure)
* [Function `leader_account`](#function-leader_account)
* [Function `exchange_rate_million_mists_us`](#function-exchange_rate_million_mists_us)
* [Function `total_share`](#function-total_share)
* [Function `sui_balance`](#function-sui_balance)
* [Function `us_balance`](#function-us_balance)
* [Function `quote_swap_us_for_sui`](#function-quote_swap_us_for_sui)

### Struct `PriorityFeeVault`

```move
public struct PriorityFeeVault has key
```

<details>

<summary>Fields</summary>

`id: sui::object::UID`

</details>

#### Struct `PriorityFeeVaultInnerV1`

Version one stored layout for \[[`PriorityFeeVault`](#nexus_registry_priority_fee_vault_PriorityFeeVault)].

```move
public struct PriorityFeeVaultInnerV1 has store
```

<details>

<summary>Fields</summary>

[`sui_balance`](#nexus_registry_priority_fee_vault_sui_balance)`: sui::balance::Balance<sui::sui::SUI>`[`us_balance`](#nexus_registry_priority_fee_vault_us_balance)`: sui::balance::Balance<talus::us::US>`[`exchange_rate_million_mists_us`](#nexus_registry_priority_fee_vault_exchange_rate_million_mists_us)`: u64`[`total_share`](#nexus_registry_priority_fee_vault_total_share)`: u64leader_accounts: sui::vec_map::VecMap<sui::object::ID,` [`nexus_registry::priority_fee_vault::PriorityFeeAccount`](#nexus_registry_priority_fee_vault_PriorityFeeAccount)`>`

</details>

#### Struct `PriorityFeeAccount`

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

<details>

<summary>Fields</summary>

[`share`](#nexus_registry_priority_fee_vault_share)`: u64`

</details>

#### Struct `PriorityFeeVaultOwnerCap`

```move
public struct PriorityFeeVaultOwnerCap has key, store
```

<details>

<summary>Fields</summary>

`id: sui::object::UIDvault: sui::object::ID`

</details>

#### Struct `PriorityFeeDeposit`

Receiving child transferred to the vault before atomic collection.

```move
public struct PriorityFeeDeposit has key
```

<details>

<summary>Fields</summary>

`id: sui::object::UIDamount: sui::balance::Balance<sui::sui::SUI>leader_cap_id: sui::object::ID`

</details>

#### Struct `PriorityFeeDepositCreatedEvent`

Identifies a newly created deposit that is immediately transferred to the vault address. Collection later receives that vault-address child as `Receiving<PriorityFeeDeposit>`.

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

<details>

<summary>Fields</summary>

`vault: sui::object::IDdeposit_id: sui::object::IDleader_cap_id: sui::object::IDamount: u64`

</details>

#### Struct `PriorityFeeShareChange`

One leader's aggregate share increase in a successful collection batch.

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

<details>

<summary>Fields</summary>

`leader_cap_id: sui::object::IDshare_delta: u64`

</details>

#### Struct `PriorityFeeSharesCollectedEvent`

Aggregate accounting changes emitted once for a successful collection batch.

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

<details>

<summary>Fields</summary>

`vault: sui::object::IDdeposit_count: u64changes: vector<`[`nexus_registry::priority_fee_vault::PriorityFeeShareChange`](#nexus_registry_priority_fee_vault_PriorityFeeShareChange)`>total_share_delta: u64`

</details>

#### Struct `PriorityFeeWithdrawnEvent`

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

<details>

<summary>Fields</summary>

`vault: sui::object::IDleader_cap_id: sui::object::IDshare_to_withdraw: u64us_out: u64us_refunded: u64`

</details>

#### Struct `PriorityFeeSwapEvent`

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

<details>

<summary>Fields</summary>

`vault: sui::object::IDus_in: u64us_refunded: u64sui_out: u64`

</details>

#### Struct `PriorityFeeVaultConfiguredEvent`

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

<details>

<summary>Fields</summary>

`vault: sui::object::ID`[`exchange_rate_million_mists_us`](#nexus_registry_priority_fee_vault_exchange_rate_million_mists_us)`: u64`

</details>

#### Constants

```move
#[error]
const EInvalidPriorityFeeWithdrawal: vector<u8> = b"Invalid priority fee withdrawal";
```

```move
#[error]
const EInvalidExchangeRate: vector<u8> = b"Exchange rate must be greater than zero";
```

```move
#[error]
const EInvalidSwapAmount: vector<u8> = b"Invalid priority fee swap amount";
```

```move
#[error]
const EInvalidPriorityFeeVaultOwner: vector<u8> = b"Invalid priority fee vault owner cap";
```

```move
#[error]
const EInsufficientLiquidityForSwap: vector<u8> = b"Insufficient priority fee vault liquidity";
```

```move
#[error]
const EIntegerConversionOverflow: vector<u8> = b"Integer conversion overflow";
```

```move
#[error]
const EEmptyPriorityFeeDepositBatch: vector<u8> = b"Priority fee deposit batch must not be empty";
```

```move
const MAX_U64: u128 = 18446744073709551615;
```

```move
const MISTS_PER_EXCHANGE_RATE_UNIT: u128 = 1000000;
```

#### Function `create_deposit`

Transfers SUI to the \[[`PriorityFeeVault`](#nexus_registry_priority_fee_vault_PriorityFeeVault)] address as a vault-address child deposit. It is not an object-owned deposit held by the caller.

```move
public fun create_deposit(self: &nexus_registry::priority_fee_vault::PriorityFeeVault, amount: sui::balance::Balance<sui::sui::SUI>, leader_cap_id: sui::object::ID, ctx: &mut sui::tx_context::TxContext)
```

#### Function `collect_deposits`

Receives and accounts for an atomic batch of vault-address children through `Receiving<PriorityFeeDeposit>`.

```move
public fun collect_deposits(self: &mut nexus_registry::priority_fee_vault::PriorityFeeVault, leader_registry: &nexus_registry::leader::LeaderRegistry, deposits: vector<sui::transfer::Receiving<nexus_registry::priority_fee_vault::PriorityFeeDeposit>>)
```

#### Function `swap_us_for_sui`

```move
public fun swap_us_for_sui(self: &mut nexus_registry::priority_fee_vault::PriorityFeeVault, input: sui::coin::Coin<talus::us::US>, min_sui_out: u64, ctx: &mut sui::tx_context::TxContext): (sui::coin::Coin<sui::sui::SUI>, sui::coin::Coin<talus::us::US>)
```

#### Function `withdraw_priority_fee`

```move
public fun withdraw_priority_fee(self: &mut nexus_registry::priority_fee_vault::PriorityFeeVault, leader_registry: &nexus_registry::leader::LeaderRegistry, leader_cap: &nexus_primitives::owner_cap::CloneableOwnerCap<nexus_registry::leader_cap::OverNetwork>, share_to_withdraw: u64, ctx: &mut sui::tx_context::TxContext): sui::coin::Coin<talus::us::US>
```

#### Function `configure`

```move
public fun configure(self: &mut nexus_registry::priority_fee_vault::PriorityFeeVault, owner_cap: &nexus_registry::priority_fee_vault::PriorityFeeVaultOwnerCap, exchange_rate_million_mists_us: u64)
```

#### Function `leader_account`

```move
public fun leader_account(self: &nexus_registry::priority_fee_vault::PriorityFeeVault, leader_cap_id: sui::object::ID): u64
```

#### Function `exchange_rate_million_mists_us`

```move
public fun exchange_rate_million_mists_us(self: &nexus_registry::priority_fee_vault::PriorityFeeVault): u64
```

#### Function `total_share`

```move
public fun total_share(self: &nexus_registry::priority_fee_vault::PriorityFeeVault): u64
```

#### Function `sui_balance`

```move
public fun sui_balance(self: &nexus_registry::priority_fee_vault::PriorityFeeVault): u64
```

#### Function `us_balance`

```move
public fun us_balance(self: &nexus_registry::priority_fee_vault::PriorityFeeVault): u64
```

#### Function `quote_swap_us_for_sui`

```move
public fun quote_swap_us_for_sui(self: &nexus_registry::priority_fee_vault::PriorityFeeVault, us_in: 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/reference/move/nexus_registry/priority_fee_vault.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.
