function funct_Billing_JSONRPC_GetLabel($strWalletAddress) { //works //give address and get back label $mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING); $strReturnInfo = $mybtc->getaccount($strWalletAddress); return $strReturnInfo; }
public static function LTC_processing() { $transaction_hash = Core::validate($_POST['transaction_hash']); $address = Core::validate($_POST['address']); $value_in_ltc = Core::validate($_POST['amount']); $confirmations = Core::validate($_POST['confirmations']); if ($_GET['test'] == true) { exit; } $at_ltc = new AtLtc(); $exist = $at_ltc->findBy(array('address' => $address, 'type' => 0, 'done' => 0)); if ($exist == false) { return; } if ($confirmations >= LTC_CONFIRMATIONS) { $currency = new Currency(); $currency->findBy(array('Name' => 'LTC')); $limits = self::transactionLimits($currency->getId(), 'LTC', 0); if ($value_in_ltc < $limits['min'] || $limits['max'] != null && $value_in_ltc > $limits['max']) { return; } $litecoin = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ":" . LTC_RPC_PORT . '/'); try { $account = $litecoin->getaccount($address); } catch (Exception $e) { return; } $wallets = WalletsLtc::findBy(array('account' => $account)); if (empty($wallets)) { return; } $feeVolume = $value_in_ltc * $limits['fee']; $feeVolume = Core::round_up($feeVolume, 8); $purses = Purse::findBy(array('UID' => $at_ltc->getUID(), 'CurId' => $currency->getId())); $purse = new Purse(); $purse->findById($purses[0]['id']); $purse->addValue($value_in_ltc - $feeVolume); $purse->save(); $wallet = new WalletsLtc(); $wallet->findById($wallets[0]['id']); $profit = $feeVolume * $wallet->getShare(); $wallet->setProfit($wallet->getProfit() + $profit); $wallet->save(); $at_ltc->setDone(1); $at_ltc->setTransactionHash($transaction_hash); $at_ltc->setValue($value_in_ltc); $at_ltc->setTimestamp(Core::timestamp_gmp()); $at_ltc->save(); } }