/** * Create a new wallet for an email and return its public key * * @author salvipascual * @param String, email * @return String * */ private function createNewWallet($email) { $block_io = new BlockIo($this->apiKey, $this->pin, 2); $address = $block_io->get_new_address(array('label' => $email)); return $address->data->address; }
// the API version $block_io = new BlockIo($apiKey, $pin, $version); echo "*** Getting account balance\n"; $getBalanceInfo = ""; try { $getBalanceInfo = $block_io->get_balance(); echo "!!! Using Network: " . $getBalanceInfo->data->network . "\n"; echo "Available Amount: " . $getBalanceInfo->data->available_balance . " " . $getBalanceInfo->data->network . "\n"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } echo "\n\n"; echo "*** Create new address\n"; $getNewAddressInfo = ""; try { $getNewAddressInfo = $block_io->get_new_address(array('label' => 'shibetime1')); echo "New Address: " . $getNewAddressInfo->data->address . "\n"; echo "Label: " . $getNewAddressInfo->data->label . "\n"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } echo "\n\n"; try { echo "Getting address for Label='shibetime1'\n"; $getAddressInfo = $block_io->get_address_by_label(array('label' => 'shibetime1')); echo "Status: " . $getAddressInfo->status . "\n"; } catch (Exception $e) { echo $e->getMessage() . "\n"; } echo "Label has Address: " . $block_io->get_address_by_label(array('label' => 'shibetime1'))->data->address . "\n"; echo "\n\n";