1. Go to this page and download the library: Download skopa/ethereum-rpc-wallet library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
skopa / ethereum-rpc-wallet example snippets
use \Skopa\EthereumWallet\Contracts\ERC20TokenContract;
class ExampleContract extends ERC20TokenContract
{
public function getAddress(): string
{
return 'Contract address here';
}
public function getABIJson(): ?string
{
return file_get_contents('ABI.json');
}
public function getDecimals(): int
{
return 18;
}
}
$exampleContract = new ExampleToken();
$networkClient = new JsonRpcNetworkClient(
'http://localhost:8545',
'90'
);
$wallet = \Skopa\EthereumWallet\Wallet::fromPublicAddress(
$network,
'Address in format: 0x...'
);
class ExampleContract extends ERC20TokenContract
{
public function getAddress(): string
{
// ...
}
public function getABIJson(): ?string
{
// ...
}
public function getDecimals(): int
{
// ...
}
public function mint(string $amount)
{
return '0x'
. $this->functionSha('mint')
. $this->formattedArg($amount);
}
}