Skip to content

Commit

Permalink
snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
dariorussi committed Mar 1, 2025
1 parent c2abbf4 commit 5bb2321
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 35 deletions.
277 changes: 258 additions & 19 deletions crates/sui-framework/docs/sui/tx_context.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,27 @@ title: Module `sui::tx_context`

- [Struct `TxContext`](#sui_tx_context_TxContext)
- [Function `sender`](#sui_tx_context_sender)
- [Function `native_sender`](#sui_tx_context_native_sender)
- [Function `digest`](#sui_tx_context_digest)
- [Function `epoch`](#sui_tx_context_epoch)
- [Function `native_epoch`](#sui_tx_context_native_epoch)
- [Function `epoch_timestamp_ms`](#sui_tx_context_epoch_timestamp_ms)
- [Function `native_epoch_timestamp_ms`](#sui_tx_context_native_epoch_timestamp_ms)
- [Function `sponsor`](#sui_tx_context_sponsor)
- [Function `fresh_object_address`](#sui_tx_context_fresh_object_address)
- [Function `fresh_id`](#sui_tx_context_fresh_id)
- [Function `ids_created`](#sui_tx_context_ids_created)
- [Function `native_ids_created`](#sui_tx_context_native_ids_created)
- [Function `native_gas_price`](#sui_tx_context_native_gas_price)
- [Function `native_gas_budget`](#sui_tx_context_native_gas_budget)
- [Function `option_sponsor`](#sui_tx_context_option_sponsor)
- [Function `native_sponsor`](#sui_tx_context_native_sponsor)
- [Function `derive_id`](#sui_tx_context_derive_id)


<pre><code></code></pre>
<pre><code><b>use</b> <a href="../std/option.md#std_option">std::option</a>;
<b>use</b> <a href="../std/vector.md#std_vector">std::vector</a>;
</code></pre>



Expand Down Expand Up @@ -81,7 +93,7 @@ Return the address of the user that signed the current
transaction


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sender">sender</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): <b>address</b>
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sender">sender</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): <b>address</b>
</code></pre>


Expand All @@ -90,13 +102,35 @@ transaction
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sender">sender</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): <b>address</b> {
self.<a href="../sui/tx_context.md#sui_tx_context_sender">sender</a>
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sender">sender</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): <b>address</b> {
<a href="../sui/tx_context.md#sui_tx_context_native_sender">native_sender</a>()
}
</code></pre>



</details>

<a name="sui_tx_context_native_sender"></a>

## Function `native_sender`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_sender">native_sender</a>(): <b>address</b>
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_sender">native_sender</a>(): <b>address</b>;
</code></pre>



</details>

<a name="sui_tx_context_digest"></a>
Expand Down Expand Up @@ -132,7 +166,7 @@ Please do not use as a source of randomness.
Return the current epoch


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch">epoch</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch">epoch</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
</code></pre>


Expand All @@ -141,13 +175,35 @@ Return the current epoch
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch">epoch</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
self.<a href="../sui/tx_context.md#sui_tx_context_epoch">epoch</a>
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch">epoch</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
<a href="../sui/tx_context.md#sui_tx_context_native_epoch">native_epoch</a>()
}
</code></pre>



</details>

<a name="sui_tx_context_native_epoch"></a>

## Function `native_epoch`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_epoch">native_epoch</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_epoch">native_epoch</a>(): u64;
</code></pre>



</details>

<a name="sui_tx_context_epoch_timestamp_ms"></a>
Expand All @@ -157,7 +213,54 @@ Return the current epoch
Return the epoch start time as a unix timestamp in milliseconds.


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch_timestamp_ms">epoch_timestamp_ms</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch_timestamp_ms">epoch_timestamp_ms</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch_timestamp_ms">epoch_timestamp_ms</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
<a href="../sui/tx_context.md#sui_tx_context_native_epoch_timestamp_ms">native_epoch_timestamp_ms</a>()
}
</code></pre>



</details>

<a name="sui_tx_context_native_epoch_timestamp_ms"></a>

## Function `native_epoch_timestamp_ms`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_epoch_timestamp_ms">native_epoch_timestamp_ms</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_epoch_timestamp_ms">native_epoch_timestamp_ms</a>(): u64;
</code></pre>



</details>

<a name="sui_tx_context_sponsor"></a>

## Function `sponsor`

Return the adress of the transaction sponsor or <code>None</code> if there was no sponsor.


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sponsor">sponsor</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;<b>address</b>&gt;
</code></pre>


Expand All @@ -166,8 +269,8 @@ Return the epoch start time as a unix timestamp in milliseconds.
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_epoch_timestamp_ms">epoch_timestamp_ms</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
self.<a href="../sui/tx_context.md#sui_tx_context_epoch_timestamp_ms">epoch_timestamp_ms</a>
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_sponsor">sponsor</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): Option&lt;<b>address</b>&gt; {
<a href="../sui/tx_context.md#sui_tx_context_option_sponsor">option_sponsor</a>()
}
</code></pre>

Expand All @@ -184,7 +287,7 @@ occur as the address for a user.
In other words, the generated address is a globally unique object ID.


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_object_address">fresh_object_address</a>(ctx: &<b>mut</b> <a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): <b>address</b>
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_object_address">fresh_object_address</a>(_ctx: &<b>mut</b> <a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): <b>address</b>
</code></pre>


Expand All @@ -193,16 +296,35 @@ In other words, the generated address is a globally unique object ID.
<summary>Implementation</summary>


<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_object_address">fresh_object_address</a>(ctx: &<b>mut</b> <a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): <b>address</b> {
<b>let</b> <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a> = ctx.<a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>;
<b>let</b> id = <a href="../sui/tx_context.md#sui_tx_context_derive_id">derive_id</a>(*&ctx.tx_hash, <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>);
ctx.<a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a> = <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a> + 1;
id
<pre><code><b>public</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_object_address">fresh_object_address</a>(_ctx: &<b>mut</b> <a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): <b>address</b> {
<a href="../sui/tx_context.md#sui_tx_context_fresh_id">fresh_id</a>()
}
</code></pre>



</details>

<a name="sui_tx_context_fresh_id"></a>

## Function `fresh_id`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_id">fresh_id</a>(): <b>address</b>
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_fresh_id">fresh_id</a>(): <b>address</b>;
</code></pre>



</details>

<a name="sui_tx_context_ids_created"></a>
Expand All @@ -213,7 +335,7 @@ Return the number of id's created by the current transaction.
Hidden for now, but may expose later


<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">sui::tx_context::TxContext</a>): u64
</code></pre>


Expand All @@ -222,13 +344,130 @@ Hidden for now, but may expose later
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>(self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
self.<a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>
<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_ids_created">ids_created</a>(_self: &<a href="../sui/tx_context.md#sui_tx_context_TxContext">TxContext</a>): u64 {
<a href="../sui/tx_context.md#sui_tx_context_native_ids_created">native_ids_created</a>()
}
</code></pre>



</details>

<a name="sui_tx_context_native_ids_created"></a>

## Function `native_ids_created`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_ids_created">native_ids_created</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_ids_created">native_ids_created</a>(): u64;
</code></pre>



</details>

<a name="sui_tx_context_native_gas_price"></a>

## Function `native_gas_price`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_gas_price">native_gas_price</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_gas_price">native_gas_price</a>(): u64;
</code></pre>



</details>

<a name="sui_tx_context_native_gas_budget"></a>

## Function `native_gas_budget`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_gas_budget">native_gas_budget</a>(): u64
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_gas_budget">native_gas_budget</a>(): u64;
</code></pre>



</details>

<a name="sui_tx_context_option_sponsor"></a>

## Function `option_sponsor`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_option_sponsor">option_sponsor</a>(): <a href="../std/option.md#std_option_Option">std::option::Option</a>&lt;<b>address</b>&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_option_sponsor">option_sponsor</a>(): Option&lt;<b>address</b>&gt; {
<b>let</b> <a href="../sui/tx_context.md#sui_tx_context_sponsor">sponsor</a> = <a href="../sui/tx_context.md#sui_tx_context_native_sponsor">native_sponsor</a>();
<b>if</b> (<a href="../sui/tx_context.md#sui_tx_context_sponsor">sponsor</a>.length() == 0) {
option::none()
} <b>else</b> {
option::some(<a href="../sui/tx_context.md#sui_tx_context_sponsor">sponsor</a>[0])
}
}
</code></pre>



</details>

<a name="sui_tx_context_native_sponsor"></a>

## Function `native_sponsor`



<pre><code><b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_sponsor">native_sponsor</a>(): vector&lt;<b>address</b>&gt;
</code></pre>



<details>
<summary>Implementation</summary>


<pre><code><b>native</b> <b>fun</b> <a href="../sui/tx_context.md#sui_tx_context_native_sponsor">native_sponsor</a>(): vector&lt;<b>address</b>&gt;;
</code></pre>



</details>

<a name="sui_tx_context_derive_id"></a>
Expand Down
Binary file modified crates/sui-framework/packages_compiled/sui-framework
Binary file not shown.
Loading

0 comments on commit 5bb2321

Please sign in to comment.