Example #1
0
function getAccountUnspent(Client $client, $userId)
{
    $accountAddresses = sendRpcCommand($client, 'getaddressesbyaccount', [$userId]);
    $accountUnspent = [];
    if (!empty($accountAddresses)) {
        $unspents = sendRpcCommand($client, 'listunspent', [0, 9999999]);
        foreach ($unspents as $unspent) {
        }
    }
    return $accountUnspent;
}
 public function index(Manager $fractal, InfoTransformer $infoTransformer)
 {
     $miningInfo = sendRpcCommand($this->client, 'getmininginfo');
     if ($miningInfo === false) {
         return $this->setStatusCode(500)->respond(['errors' => ['unknown-error']]);
     }
     $lastBlock = Block::orderBy('height', 'desc')->first();
     $omc_btc_price = getOption('omc_btc_price');
     $btc_usd_price = getOption('btc_usd_price');
     $item = new Item((object) ['mining_info' => $miningInfo->result, 'last_block' => $lastBlock, 'omc_btc_price' => $omc_btc_price, 'btc_usd_price' => $btc_usd_price], $infoTransformer);
     $data = $fractal->setSerializer(new ArraySerializer())->createData($item)->toArray();
     return $this->respond($data);
 }
 public function validateMessage(Request $request)
 {
     $validator = \Validator::make($request->all(), ['address' => 'required,array', 'ips' => 'required,array'], ['array' => ':attribute-not-array', 'required' => ':attribute-required']);
     if ($validator->fails()) {
         $errors = [];
         foreach ($validator->errors()->all() as $error) {
             $errors[] = $error;
         }
         return $this->setStatusCode(400)->respond(['errors' => $errors]);
     }
     $verifyMessage = sendRpcCommand($this->client, 'verifymessage', [$request->input('address', ''), $request->input('signature', ''), $request->input('message', '')]);
     if ($verifyMessage === false) {
         return $this->setStatusCode(500)->respond(['errors' => ['unknown-error']]);
     }
     return $this->respond(['verified' => (bool) $verifyMessage->result]);
 }