diff --git a/examples/accounts.php b/examples/accounts.php new file mode 100644 index 0000000..3125d34 --- /dev/null +++ b/examples/accounts.php @@ -0,0 +1,27 @@ +eth; + +echo 'Eth Get Account and Balance' . PHP_EOL; +$eth->accounts(function ($err, $accounts) use ($eth) { + if ($err !== null) { + echo 'Error: ' . $err->getMessage(); + return; + } + foreach ($accounts->result as $account) { + echo 'Account: ' . $account . PHP_EOL; + + $eth->getBalance($account, function ($err, $balance) { + if ($err !== null) { + echo 'Error: ' . $err->getMessage(); + return; + } + echo 'Balance: ' . $balance->result . PHP_EOL; + }); + } +}); \ No newline at end of file