NOTE: The bundle is compatible with Symfony
2.0
upwards.
-
Download this bundle to your project first. The preferred way to do it is to use Composer package manager:
$ composer require hexim/zcash-bundle
-
Add this bundle to your application's kernel:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Hexim\HeximZcashBundle\HeximZcashBundle(), // ... ); }
-
Configure the bundle in your config:
# app/config/config.yml hexim_zcash: rpc_password: "%zcash_rpc_password%" rpc_user: "%zcash_rpc_user%" rpc_port: "%zcash_rpc_port%"
# app/config/parameters.yml parameters: zcash_rpc_password: password zcash_rpc_user: user zcash_rpc_port: 8282
In your application controller methods:
public function yourAction(Request $request)
{
$wallet = $this->get('hexim_zcash.wallet');
if (!$walletInfo = $wallet->getWalletInfo()) {
throw new \Exception('Error: ' . $wallet->getError());
}
...
}
public function yourAction(Request $request)
{
$wallet = $this->get('hexim_zcash.wallet');
$walletInfo = $wallet->getWalletInfo();
$transactions = $wallet->listTransactions($walletInfo['result']['txcount']);
...
}
public function yourAction(Request $request)
{
$myAddress = "t1ededed...";
$zcashUtil = $this->get('hexim_zcash.util');
if ($data = $zcashUtil->validateAddress($myAddress) {
if (!$data['result']['isvalid']) {
$this->addFlash('error', ' Sorry but this tAddress is not valid zcash address.');
return $this->render('any.html.twig', [
'anyForm' => $form->createView(),
]);
}
}
...
}