Skip to content

Commit

Permalink
Merge pull request #956 from multiversx/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
andrei-marinica committed Aug 7, 2024
2 parents 8d82f52 + c9f5287 commit dc53bae
Show file tree
Hide file tree
Showing 11 changed files with 418 additions and 30 deletions.
8 changes: 8 additions & 0 deletions docs/developers/developer-reference/sc-api-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ A smart contract call that runs out of gas will revert all operations, so this f
get_block_timestamp() -> u64
```

Returns the timestamp of the current block, in seconds (UNIX timestamp).

[comment]: # (mx-context-auto)

### get_block_nonce
Expand All @@ -154,6 +156,8 @@ get_block_timestamp() -> u64
get_block_nonce() -> u64
```

Returns the unique nonce of the block that includes the current transaction.

[comment]: # (mx-context-auto)

### get_block_round
Expand All @@ -162,6 +166,8 @@ get_block_nonce() -> u64
get_block_round() -> u64
```

Returns the round number of the current block. Each epoch consists of a fixed number of rounds. The round number resets to 1 at the start of every new epoch.

[comment]: # (mx-context-auto)

### get_block_epoch
Expand All @@ -170,6 +176,8 @@ get_block_round() -> u64
get_block_epoch() -> u64
```

Returns the epoch of the current block.

These functions are mostly used for setting up deadlines, so they've been grouped together.

[comment]: # (mx-context-auto)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,5 +285,5 @@ async fn test_full_farm_scenario() {
}
```

As illustrated, these tests resemble typical Rust tests but apply scenarios directly on the actual blockchain, facilitated by the [interactor tx environment](//developers/transactions/tx-env.md#interactor). These tests can be executed with `cargo test` or `sc-meta test`, seamlessly integrating into your standard testing workflow.
As illustrated, these tests resemble typical Rust tests but apply scenarios directly on the actual blockchain, facilitated by the [interactor tx environment](/developers/transactions/tx-env#interactor). These tests can be executed with `cargo test` or `sc-meta test`, seamlessly integrating into your standard testing workflow.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ title: Interactors Overview

## Overview

Interactors are Rust-based microservices designed to facilitate interactions with smart contracts on the blockchain. They are essential for system testing and managing the setup and execution of smart contracts in a live blockchain environment. Making use of unified syntax, proxies, and the capability to be autogenerated using `sc-meta all snippets`, interactors streamline the interaction process, providing a quick and efficient solution for system testing, seamlessly integrating with the development workflow.
Interactors are Rust programs designed to facilitate interactions with smart contracts on the blockchain. They are essential for system testing and managing the setup and execution of smart contracts in a live blockchain environment. Making use of unified syntax, proxies, and the capability to be autogenerated using `sc-meta all snippets`, interactors streamline the interaction process, providing a quick and efficient solution for system testing, seamlessly integrating with the development workflow.

[comment]: # (mx-context-auto)

Expand All @@ -26,7 +26,9 @@ Before using interactors, make sure you have the following setup:
```
- choose default toolchain
```bash
rustup update
rustup default stable
rustup target add wasm32-unknown-unknown
```
- check installed toolchains
```bash
Expand Down
2 changes: 1 addition & 1 deletion docs/developers/transactions/tx-env.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Not yet available, coming soon.

## Interactor

The interactors are microservices written in Rust, used for interacting with the smart contract on the real blockchain (deploy/upgrade, query, call) and system testing. Interactor environments such as `InteractorExecEnv` and `InteractorQueryEnv` are essential for transactions meant to be ran on the real blockchain, from a different environment than the smart contract. The easiest way to create transactions using the interactor environments is to create an instance of the `Interactor` struct.
The interactors are Rust programs, used for interacting with the smart contract on the real blockchain (deploy/upgrade, query, call) and system testing. Interactor environments such as `InteractorExecEnv` and `InteractorQueryEnv` are essential for transactions meant to be ran on the real blockchain, from a different environment than the smart contract. The easiest way to create transactions using the interactor environments is to create an instance of the `Interactor` struct.

```rust title=interact.rs
const GATEWAY: &str = "https://devnet-gateway.multiversx.com";
Expand Down
Loading

0 comments on commit dc53bae

Please sign in to comment.