Skip to content

Commit

Permalink
Merge pull request #15 from make-software/add_new_rpc_methods
Browse files Browse the repository at this point in the history
Added missed documentation for query_global_state rpc method
  • Loading branch information
RomanovSci authored Feb 8, 2023
2 parents 00ad7f8 + 9e3e732 commit 34cef04
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ $latestBlockHash = $latestBlock->getHash();
- [getEraSummaryBySwitchBlockHash](docs/API/RpcClientAPI.md#Get-era-summary-by-switch-block-hash)
- [getEraSummaryBySwitchBlockHeight](docs/API/RpcClientAPI.md#Get-era-summary-by-switch-block-height)
- [getDictionaryItemByURef](docs/API/RpcClientAPI.md#Get-dictionary-item)
- [getGlobalStateByBlock](docs/API/RpcClientAPI.md#Get-global-state-by-block)
- [getGlobalStateByStateRootHash](docs/API/RpcClientAPI.md#Get-global-state-by-state-root-hash)

### DeployService
- [makeDeploy](docs/API/DeployServiceAPI.md#Make-deploy)
Expand Down
21 changes: 19 additions & 2 deletions docs/API/RpcClientAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ Returns an item from a Dictionary ([StoredValue](../Entity/StoredValue.md) objec
| `$seedUref` | `string` | The dictionary's seed URef | Yes |

---
## Get global state
## Get global state by block
```php
getGlobalState(
getGlobalStateByBlock(
string $blockHash,
string $key,
array $path
Expand All @@ -221,3 +221,20 @@ Returns an [GlobalState](../Entity/GlobalState.md) object by the given block has
| `$blockHash` | `string` | Hex-encoded hash of the block | Yes |
| `$key` | `string` | `casper_types::Key` as formatted string | Yes |
| `$path` | `array` | The path components starting from the key as base | No |

---
## Get global state by state root hash
```php
getGlobalStateByStateRootHash(
string $stateRootHash,
string $key,
array $path
): GlobalState
```
Returns an [GlobalState](../Entity/GlobalState.md) object by the given state root hash and key
### Parameters
| Name | Type | Description | Required |
|---|------|-------------|----|
| `$stateRootHash` | `string` | Hex-encoded hash of the state root | Yes |
| `$key` | `string` | `casper_types::Key` as formatted string | Yes |
| `$path` | `array` | The path components starting from the key as base | No |
2 changes: 1 addition & 1 deletion docs/Entity/GlobalState.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# GlobalState

```php
getBlockHeader(): BlockHeader
getBlockHeader(): ?BlockHeader
```
Returns [BlockHeader](BlockHeader.md) object

Expand Down

0 comments on commit 34cef04

Please sign in to comment.