本文整理汇总了PHP中jsonRPCClient::sendfrom方法的典型用法代码示例。如果您正苦于以下问题:PHP jsonRPCClient::sendfrom方法的具体用法?PHP jsonRPCClient::sendfrom怎么用?PHP jsonRPCClient::sendfrom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jsonRPCClient
的用法示例。
在下文中一共展示了jsonRPCClient::sendfrom方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: json_encode
<?php
$included = true;
include '../../inc/db-conf.php';
include '../../inc/wallet_driver.php';
$wallet = new jsonRPCClient($driver_login);
include '../../inc/functions.php';
if (empty($_GET['amount']) || empty($_GET['valid_addr']) || empty($_GET['_unique']) || mysql_num_rows(mysql_query("SELECT `id` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1")) == 0) {
exit;
}
$player = mysql_fetch_array(mysql_query("SELECT `id`,`balance` FROM `players` WHERE `hash`='" . prot($_GET['_unique']) . "' LIMIT 1"));
$validate = $wallet->validateaddress($_GET['valid_addr']);
if ($validate['isvalid'] == false) {
$error = 'yes';
$con = 0;
} else {
if (!is_numeric($_GET['amount']) || (double) $_GET['amount'] > $player['balance'] || (double) $_GET['amount'] < 0.001) {
$error = 'yes';
$con = 1;
} else {
$amount = (double) $_GET['amount'] - 0.0002;
$txid = $wallet->sendfrom('', $_GET['valid_addr'], $amount);
mysql_query("UPDATE `players` SET `balance`=`balance`-" . prot($_GET['amount']) . " WHERE `id`={$player['id']} LIMIT 1");
$error = 'no';
$con = $txid;
}
}
$return = array('error' => $error, 'content' => $con);
echo json_encode($return);
示例2: cashout
function cashout($sendaddress)
{
if ($this->validateToken()) {
$ab = $this->getAccountBalance($this->__get("token"));
if ($ab === null) {
return false;
}
if ($ab - '.0004' < 0) {
return false;
} else {
$ab = $ab - 0.0004;
}
try {
$bitcoind = new jsonRPCClient('http://' . $this->__get("username") . ':' . $this->__get("password") . '@' . $this->__get("btcserver") . ':' . $this->__get("btcport") . '/');
$balance = $bitcoind->sendfrom(md5($this->__get("token")), $sendaddress, $ab, 2);
} catch (Exception $e) {
return false;
}
$this->__set("balance", $ab);
$this->__set("access_token", JWT::encode($this->__get("access_token"), $_ENV['token_key']));
return true;
} else {
return false;
}
}
示例3: LTC_transaction_o_complete
public static function LTC_transaction_o_complete()
{
$id = Core::validate($_GET['id']);
$hash = Core::validate($_GET['hash']);
$at = new AtLtc();
if (!$at->findById($id)) {
header('Location: ' . URL_WRONG_DATA_INPUT);
exit;
}
if ($hash != self::hash_for_money_output_link($at->getId(), $at->getUID())) {
header('Location: ' . URL_WRONG_DATA_INPUT);
exit;
}
$amount = $at->getValue();
$wallets = self::LTC_MinAndMaxWallets();
if ($wallets['max'] == null || $wallets['max']['current_balance'] < $amount) {
header('Location: ' . URL_SERVER_ERROR);
exit;
}
$wallet = new WalletsLtc();
$wallet->findById($wallets['max']['id']);
$rpcClient = new jsonRPCClient('http://' . LTC_RPC_USER . ':' . LTC_RPC_PASSWORD . '@' . LTC_RPC_HOST . ':' . LTC_RPC_PORT . '/');
try {
$transaction_hash = $rpcClient->sendfrom($wallet->getAccount(), $amount, LTC_CONFIRMATIONS);
} catch (Exception $e) {
header('Location: ' . URL_SERVER_ERROR);
exit;
}
$currency = new Currency();
$currency->findBy(array('Name' => 'LTC'));
$limits = self::transactionLimits($currency->getId(), 'LTC', 1);
$feeVolume = $amount * $limits['fee'];
$feeVolume = Core::round_up($feeVolume, 8);
$purses = Purse::findBy(array('UID' => $at->getUID(), 'CurId' => $currency->getId()));
$purse = new Purse();
$purse->findById($purses[0]['id']);
$purse->addValue(-($amount + $feeVolume));
$purse->save();
$systemFeeVolume = $amount * $limits['system_fee'];
$systemFeeVolume = Core::round_up($systemFeeVolume, 8);
$profit = ($feeVolume - $systemFeeVolume) * $wallet->getShare();
$wallet->setProfit($wallet->getProfit() + $profit);
$wallet->save();
$at->setDone(1);
$at->setTransactionHash($transaction_hash);
$at->setTimestamp(Core::timestamp_gmp());
$at->save();
header('Location: ' . URL_SUCCESS_PAYMENT);
}
示例4: array
$amount = $_GET['amount'];
if (trim($amount) == "") {
$data = array("error" => 4, "errormsg" => "Invalid Amount", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
if (!is_numeric($amount)) {
$data = array("error" => 4, "errormsg" => "Invalid Amount", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
//ok lets sends some coin
try {
$txid = @$bitcoin->sendfrom("john", (string) $qr, (double) $amount);
$data = array("error" => 0, "errormsg" => "", "time" => time(), "command" => $command, "txid" => $txid);
header('Content-Type: application/json');
echo json_encode($data);
exit;
} catch (Exception $e) {
$data = array("error" => 5, "errormsg" => "Error Processing Transaction", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
exit;
}
print_r($output);
} else {
$data = array("error" => 2, "errormsg" => "Invalid Command", "time" => time());
header('Content-Type: application/json');
echo json_encode($data);
示例5: VALUES
mysql_query("INSERT INTO `transactions` (`id`, `amount`, `topay`, `address`, `state`, `tx`, `date`) VALUES (NULL, '" . $amount . "', '" . $topay . "', '" . $address . "', '0', '" . $trans['txid'] . "', " . time() . ");");
}
}
$query = mysql_query("SELECT SUM(amount) FROM `transactions`;");
$query = mysql_fetch_row($query);
$money = $query[0];
$query = mysql_query("SELECT SUM(topay) FROM `transactions` WHERE `state` > 0;");
$query = mysql_fetch_row($query);
$money -= $query[0];
$query = mysql_query("SELECT * FROM `transactions` WHERE `state` = 0 AND `topay` > 0 ORDER BY `id` ASC;");
while ($row = mysql_fetch_assoc($query)) {
print "Money: " . $money . "\n";
if ($money < $row['topay']) {
break;
}
mysql_query("UPDATE `transactions` SET `state` = 1 WHERE `id` = " . $row['id'] . ";");
$money -= $row['topay'];
}
// Paying out
if (time() - $lastPayout > $config['payout-check']) {
$lastPayout = time();
$query = mysql_query('SELECT * FROM `transactions` WHERE `state` = 1 ORDER BY `date` ASC;');
while ($row = mysql_fetch_assoc($query)) {
$txout = $client->sendfrom($config['ponziacc'], $row['address'], round((double) $row['topay'], 4) - $row['amount'] * $config['fee']);
mysql_query("UPDATE `transactions` SET `state` = 2, `out` = '" . $txout . "' WHERE `id` = " . $row['id'] . ";");
print $row['topay'] . " " . $config['val'] . " sent to " . $row['address'] . ".\n";
}
}
echo "Waiting...\n";
sleep(20);
}
示例6: funct_Billing_JSONRPC_SendFrom
function funct_Billing_JSONRPC_SendFrom($strWalletAddress, $intAmount, $strFromAddress)
{
//send to an address and specify sent from as well
$mybtc = new jsonRPCClient(JSONRPC_CONNECTIONSTRING);
//- ** requires second password
$strWalletAddress = $mybtc->sendfrom($strFromAddress, $strWalletAddress, $intAmount);
return $strTransactionID;
}