Skip to content

Commit ce11c86

Browse files
authored
Merge pull request #20 from make-software/support-node-v152
Casper node v152
2 parents 58d419a + 30327a3 commit ce11c86

23 files changed

Lines changed: 672 additions & 7 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ jobs:
4747
- name: Run test suite
4848
run: composer run-script test
4949
env:
50-
CASPER_PHP_SDK_TEST_NODE_URL: "136.243.187.84:7777"
50+
CASPER_PHP_SDK_TEST_NODE_URL: "65.21.237.160:7777"

docs/API/RpcClientAPI.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,23 @@ Returns purse's balance from the network
118118
| `$stateRootHash` | `string` | Hex-encoded hash of the state root | Yes |
119119
| `$balanceUref` | `CLURef` | Balance URef object | Yes |
120120

121+
---
122+
## Query balance
123+
```php
124+
queryBalance(
125+
string $purseIdentifierType,
126+
string $purseIdentifier,
127+
string $stateRootHash = null
128+
): \GMP
129+
```
130+
Returns a purse’s balance from global state at a given [Block](../Entity/Block.md) or state root hash.
131+
### Parameters
132+
| Name | Type | Description | Required |
133+
|---|----------|-----------------------------------------------------------------------------------------------------------------------|----------|
134+
| `$purseIdentifierType` | `string` | Purse identifier type. Available values: `purse_uref`, `main_purse_under_public_key`, `main_purse_under_account_hash` | Yes |
135+
| `$purseIdentifier` | `string` | Purse identifier | Yes |
136+
| `$stateRootHash` | `string` | Hex-encoded hash of the state root | No |
137+
121138
---
122139
## Get account balance URef by account hash
123140
```php
@@ -238,3 +255,22 @@ Returns an [GlobalState](../Entity/GlobalState.md) object by the given state roo
238255
| `$stateRootHash` | `string` | Hex-encoded hash of the state root | Yes |
239256
| `$key` | `string` | `casper_types::Key` as formatted string | Yes |
240257
| `$path` | `array` | The path components starting from the key as base | No |
258+
259+
---
260+
## Get chainspec info
261+
```php
262+
getChainspecInfo(): ChainspecRegistryBytes
263+
```
264+
Returns a [ChainspecRegistryBytes](../Entity/ChainspecRegistryBytes.md) object
265+
266+
---
267+
## Speculative execution
268+
```php
269+
speculativeExecution(Deploy $signedDeploy, string $blockHash): DeployExecutionResult
270+
```
271+
Puts a [Deploy](../Entity/Deploy.md) to a single node for speculative execution on that node only.
272+
### Parameters
273+
| Name | Type | Description | Required |
274+
|---|------|-------------|----|
275+
| `$signedDeploy` | `Deploy` | Signed [Deploy](../Entity/Deploy.md) object | Yes |
276+
| `$blockHash` | `string` | Hex-encoded hash of the block | Yes |

docs/Entity/BlockRange.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# BlockRange
2+
3+
```php
4+
getLow(): int
5+
```
6+
7+
---
8+
```php
9+
getHigh(): int
10+
```
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# ChainspecRegistryBytes
2+
3+
```php
4+
getChainspecBytes(): string
5+
```
6+
Returns Chainspec.toml bytes
7+
8+
---
9+
```php
10+
getGenesisAccountsBytes(): ?string
11+
```
12+
Returns Accounts.toml bytes or `null`
13+
14+
---
15+
```php
16+
getGlobalStateBytes(): ?string
17+
```
18+
Returns GlobalState.toml bytes or `null`

docs/Entity/Status.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Status
22

3+
```php
4+
getApiVersion(): string
5+
```
6+
Returns node's RPC API version
7+
38
```php
49
getChainspecName(): string
510
```
@@ -46,3 +51,27 @@ Returns [NextUpgrade](NextUpgrade.md) object or `null`
4651
getPeers(): array
4752
```
4853
Returns a list of [Peer](Peer.md) objects that connected to the network
54+
55+
---
56+
```php
57+
getUptime(): string
58+
```
59+
Returns time that passed since the node has started.
60+
61+
---
62+
```php
63+
getReactorState(): string
64+
```
65+
Returns node's reactor state
66+
67+
---
68+
```php
69+
getLastProgress(): \DateTime
70+
```
71+
Returns node's last progress
72+
73+
---
74+
```php
75+
getLastProgress(): BlockRange
76+
```
77+
Returns [BlockRange](BlockRange.md) object

src/Entity/BlockRange.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Casper\Entity;
4+
5+
class BlockRange
6+
{
7+
private int $low;
8+
9+
private int $high;
10+
11+
public function __construct(int $low, int $high)
12+
{
13+
$this->low = $low;
14+
$this->high = $high;
15+
}
16+
17+
public function getLow(): int
18+
{
19+
return $this->low;
20+
}
21+
22+
public function getHigh(): int
23+
{
24+
return $this->high;
25+
}
26+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
namespace Casper\Entity;
4+
5+
class ChainspecRegistryBytes
6+
{
7+
private string $chainspecBytes;
8+
9+
private ?string $genesisAccountsBytes;
10+
11+
private ?string $globalStateBytes;
12+
13+
public function __construct(
14+
string $chainspecBytes,
15+
?string $genesisAccountsBytes,
16+
?string $globalStateBytes
17+
)
18+
{
19+
$this->chainspecBytes = $chainspecBytes;
20+
$this->genesisAccountsBytes = $genesisAccountsBytes;
21+
$this->globalStateBytes = $globalStateBytes;
22+
}
23+
24+
public function getChainspecBytes(): string
25+
{
26+
return $this->chainspecBytes;
27+
}
28+
29+
public function getGenesisAccountsBytes(): ?string
30+
{
31+
return $this->genesisAccountsBytes;
32+
}
33+
34+
public function getGlobalStateBytes(): ?string
35+
{
36+
return $this->globalStateBytes;
37+
}
38+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Casper\Entity;
4+
5+
class DeployExecutionResult
6+
{
7+
private string $blockHash;
8+
9+
private DeployExecutionResultData $result;
10+
11+
public function __construct(string $blockHash, DeployExecutionResultData $result)
12+
{
13+
$this->blockHash = $blockHash;
14+
$this->result = $result;
15+
}
16+
17+
public function getBlockHash(): string
18+
{
19+
return $this->blockHash;
20+
}
21+
22+
public function getResult(): DeployExecutionResultData
23+
{
24+
return $this->result;
25+
}
26+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?php
2+
3+
namespace Casper\Entity;
4+
5+
class DeployExecutionResultData
6+
{
7+
private string $status;
8+
9+
private Effect $effect;
10+
11+
private array $transfers;
12+
13+
private \GMP $cost;
14+
15+
private ?string $errorMessage = null;
16+
17+
public function __construct(string $status, Effect $effect, array $transfers, \GMP $cost, ?string $errorMessage)
18+
{
19+
$this->status = $status;
20+
$this->effect = $effect;
21+
$this->transfers = $transfers;
22+
$this->cost = $cost;
23+
$this->errorMessage = $errorMessage;
24+
}
25+
26+
public function getStatus(): string
27+
{
28+
return $this->status;
29+
}
30+
31+
public function getEffect(): Effect
32+
{
33+
return $this->effect;
34+
}
35+
36+
public function getTransfers(): array
37+
{
38+
return $this->transfers;
39+
}
40+
41+
public function getCost(): \GMP
42+
{
43+
return $this->cost;
44+
}
45+
46+
public function getErrorMessage(): ?string
47+
{
48+
return $this->errorMessage;
49+
}
50+
}

src/Entity/Effect.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
namespace Casper\Entity;
4+
5+
class Effect
6+
{
7+
/**
8+
* @var Operation[]
9+
*/
10+
private array $operations;
11+
12+
/**
13+
* @var Transform[]
14+
*/
15+
private array $transforms;
16+
17+
public function __construct(array $operations, array $transforms)
18+
{
19+
$this->operations = $operations;
20+
$this->transforms = $transforms;
21+
}
22+
23+
public function getOperations(): array
24+
{
25+
return $this->operations;
26+
}
27+
28+
public function getTransforms(): array
29+
{
30+
return $this->transforms;
31+
}
32+
}

0 commit comments

Comments
 (0)