Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
[Unity] Document new static methods (tx/blocks) (#1096)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xFirekeeper authored Nov 27, 2023
1 parent 10d705f commit f0e3e42
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/unity/blocks/GetBlock.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Get Block
slug: /blocks/getblock
---

Get block data by block number.

## Usage

```csharp
BigInteger blockNumber = 1234567;
var block = await Blocks.GetBlock(blockNumber);
```

14 changes: 14 additions & 0 deletions docs/unity/blocks/GetBlockWithTransactions.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Get Block With Transactions
slug: /blocks/getblockwithtransactions
---

Get block data by block number, including transaction data.

## Usage

```csharp
BigInteger blockNumber = 1234567;
var blockWithTransactions = await Blocks.GetBlockWithTransactions(blockNumber);
```

13 changes: 13 additions & 0 deletions docs/unity/blocks/GetLatestBlockNumber.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Get Latest Block Number
slug: /blocks/getlatestblocknumber
---

Get the latest block number.

## Usage

```csharp
BigInteger blockNumber = await Blocks.GetLatestBlockNumber();
```

13 changes: 13 additions & 0 deletions docs/unity/blocks/GetLatestBlockTimestamp.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Get Latest Block Timestamp
slug: /blocks/getlatestblocktimestamp
---

Get the latest block timestamp.

## Usage

```csharp
BigInteger blocktimestamp = await Blocks.GetLatestBlockTimestamp();
```

24 changes: 24 additions & 0 deletions docs/unity/interacting-with-contracts/prepare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,27 @@ TransactionResult;

</div>
</details>

## Static Methods

Useful static methods for working with transactions.

```csharp
string txHash = "your_tx_hash";
TransactionResult result = await Transaction.WaitForTransactionResult(txHash);
```

<details>
<summary>Configuration</summary>
<div>

### Return Value

Returns the transaction result as a <see cref="TransactionResult"/> object.

```csharp
TransactionResult;
```

</div>
</details>
13 changes: 13 additions & 0 deletions sidebars/unity.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,19 @@ const sidebars = {
],
},

// Blocks

{
type: "category",
label: "Blocks",
items: [
{
type: "autogenerated",
dirName: "blocks",
}
]
},

// Storage
{
type: "doc",
Expand Down

1 comment on commit f0e3e42

@vercel
Copy link

@vercel vercel bot commented on f0e3e42 Nov 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.