Ethereum PHP
PHP interface to Ethereum JSON-RPC API.
Select version
•
All
Classes
Namespaces
Files
Functions
Variables
Modules
Pages
TestEthContract.php
Go to the documentation of this file.
1
<?php
9
namespace
Ethereum
;
10
11
use
Ethereum\TestStatic
;
12
use
Exception
;
13
66
abstract
class
TestEthContract
extends
TestEthClient
{
67
68
protected
$data
;
69
protected
$contract
;
70
77
protected
function
setUp()
78
{
87
$contractName = (new \ReflectionClass($this))->getShortName();
88
$fileName = getcwd() .
'/tests/TestEthClient/test_contracts/build/contracts/'
. $contractName .
'.json'
;
89
90
if
(!file_exists($fileName)) {
91
throw
new
Exception
(
92
'You need to compile and deploy the smartcontracts located in TestEthClient/test_contracts/contracts using truffle.'
93
.
' (npm -i -g truffle && truffle compile && truffle migrate)'
94
);
95
}
96
97
$this->data = json_decode(file_get_contents($fileName));
98
$this->contract =
new
SmartContract
(
99
$this->data->abi,
100
$this->data->networks->{NETWORK_ID}->address,
101
new
Ethereum
(SERVER_URL)
102
);
103
}
104
}
Ethereum\SmartContract
Definition:
SmartContract.php:16
Ethereum\TestEthClient
Definition:
TestEthClient.php:64
TestStatic
Exception
Ethereum\TestEthContract\$data
$data
Definition:
TestEthContract.php:68
Ethereum\TestEthContract\$contract
$contract
Definition:
TestEthContract.php:69
Ethereum\TestEthContract
Definition:
TestEthContract.php:66
Ethereum
Definition:
Abi.php:3
src
TestEthContract.php
Generated by
1.8.13