From a9c06ee2ff9efe220554cd6cefef68246ddd90be Mon Sep 17 00:00:00 2001 From: sc0Vu Date: Fri, 5 Jan 2018 18:19:58 +0800 Subject: [PATCH] Example sendTransaction.php. --- examples/sendTransaction.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/sendTransaction.php b/examples/sendTransaction.php index 3ec9497..a9050d3 100644 --- a/examples/sendTransaction.php +++ b/examples/sendTransaction.php @@ -10,8 +10,8 @@ $eth->accounts(function ($err, $accounts) use ($eth) { echo 'Error: ' . $err->getMessage(); return; } - $fromAccount = $accounts->result[0]; - $toAccount = $accounts->result[1]; + $fromAccount = $accounts[0]; + $toAccount = $accounts[1]; // get balance $eth->getBalance($fromAccount, function ($err, $balance) use($fromAccount) { @@ -19,14 +19,14 @@ $eth->accounts(function ($err, $accounts) use ($eth) { echo 'Error: ' . $err->getMessage(); return; } - echo $fromAccount . ' Balance: ' . $balance->result . PHP_EOL; + echo $fromAccount . ' Balance: ' . $balance . PHP_EOL; }); $eth->getBalance($toAccount, function ($err, $balance) use($toAccount) { if ($err !== null) { echo 'Error: ' . $err->getMessage(); return; } - echo $toAccount . ' Balance: ' . $balance->result . PHP_EOL; + echo $toAccount . ' Balance: ' . $balance . PHP_EOL; }); // send transaction @@ -39,7 +39,7 @@ $eth->accounts(function ($err, $accounts) use ($eth) { echo 'Error: ' . $err->getMessage(); return; } - echo 'Tx hash: ' . $transaction->result . PHP_EOL; + echo 'Tx hash: ' . $transaction . PHP_EOL; // get balance $eth->getBalance($fromAccount, function ($err, $balance) use($fromAccount) { @@ -47,14 +47,14 @@ $eth->accounts(function ($err, $accounts) use ($eth) { echo 'Error: ' . $err->getMessage(); return; } - echo $fromAccount . ' Balance: ' . $balance->result . PHP_EOL; + echo $fromAccount . ' Balance: ' . $balance . PHP_EOL; }); $eth->getBalance($toAccount, function ($err, $balance) use($toAccount) { if ($err !== null) { echo 'Error: ' . $err->getMessage(); return; } - echo $toAccount . ' Balance: ' . $balance->result . PHP_EOL; + echo $toAccount . ' Balance: ' . $balance . PHP_EOL; }); }); }); \ No newline at end of file