Commits (4)
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="burst" uuid="3daad82b-bf0e-48a9-8dff-4ae2d8f1e685">
<driver-ref>mariadb</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>org.mariadb.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mariadb://5.9.77.104:3306/burst</jdbc-url>
<driver-properties>
<property name="autoReconnect" value="true" />
<property name="zeroDateTimeBehavior" value="convertToNull" />
<property name="tinyInt1isBit" value="false" />
<property name="characterEncoding" value="utf8" />
<property name="characterSetResults" value="utf8" />
<property name="yearIsDateType" value="false" />
</driver-properties>
</data-source>
</component>
</project>
\ No newline at end of file
......@@ -23,7 +23,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/reflection" />
<excludeFolder url="file://$MODULE_DIR$/vendor/easycorp/easy-log-handler" />
<excludeFolder url="file://$MODULE_DIR$/vendor/egulias/email-validator" />
<excludeFolder url="file://$MODULE_DIR$/vendor/facebook/webdriver" />
<excludeFolder url="file://$MODULE_DIR$/vendor/fig/link-util" />
<excludeFolder url="file://$MODULE_DIR$/vendor/jdorn/sql-formatter" />
<excludeFolder url="file://$MODULE_DIR$/vendor/monolog/monolog" />
......@@ -73,7 +72,6 @@
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/monolog-bundle" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/options-resolver" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/orm-pack" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/panther" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/phpunit-bridge" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-icu" />
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-idn" />
......
......@@ -47,7 +47,6 @@
<path value="$PROJECT_DIR$/vendor/symfony/security-core" />
<path value="$PROJECT_DIR$/vendor/symfony/security-http" />
<path value="$PROJECT_DIR$/vendor/symfony/inflector" />
<path value="$PROJECT_DIR$/vendor/symfony/panther" />
<path value="$PROJECT_DIR$/vendor/symfony/web-link" />
<path value="$PROJECT_DIR$/vendor/symfony/var-exporter" />
<path value="$PROJECT_DIR$/vendor/symfony/web-profiler-bundle" />
......@@ -80,7 +79,6 @@
<path value="$PROJECT_DIR$/vendor/twig/twig" />
<path value="$PROJECT_DIR$/vendor/sensio/framework-extra-bundle" />
<path value="$PROJECT_DIR$/vendor/easycorp/easy-log-handler" />
<path value="$PROJECT_DIR$/vendor/facebook/webdriver" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-docblock" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/type-resolver" />
<path value="$PROJECT_DIR$/vendor/phpdocumentor/reflection-common" />
......
......@@ -28,9 +28,9 @@ class BlockController extends AbstractController
LEFT JOIN account af ON (bi.generator_id = af.id AND af.latest = 1)
LEFT JOIN account ap ON (bi.recipient_id = ap.id AND ap.latest = 1)
WHERE b.db_id IN (?)
ORDER BY b.db_id DESC';
ORDER BY b.db_id DESC -- BlockController/BlockListByIds';
const BlockDBIDList = 'SELECT b.db_id FROM block b ORDER BY b.db_id DESC LIMIT ?,?';
const BlockDBIDList = 'SELECT b.db_id FROM block b ORDER BY b.db_id DESC LIMIT ?,? -- BlockController/BlockDBIDList';
const BlockDetails = ' SELECT CAST(b.id AS UNSIGNED) AS id,
b.height,
......@@ -58,7 +58,7 @@ class BlockController extends AbstractController
LEFT JOIN account ap ON (bi.recipient_id = ap.id AND ap.latest = 1)
LEFT JOIN block nb ON (b.id = nb.previous_block_id)
LEFT JOIN block pb ON (b.previous_block_id = pb.id)
WHERE CAST(b.id AS UNSIGNED) = ?';
WHERE CAST(b.id AS UNSIGNED) = ? -- BlockController/BlockDetails';
const BlockDetailsHeight = ' SELECT CAST(b.id AS UNSIGNED) AS id,
b.height,
......@@ -86,9 +86,9 @@ class BlockController extends AbstractController
LEFT JOIN account ap ON (bi.recipient_id = ap.id AND ap.latest = 1)
LEFT JOIN block nb ON (b.id = nb.previous_block_id)
LEFT JOIN block pb ON (b.previous_block_id = pb.id)
WHERE b.height = ?';
WHERE b.height = ? -- BlockController/BlockDetailsHeight';
const BlockCount = ' SELECT count(height) as COUNT FROM block';
const BlockCount = ' SELECT count(height) as COUNT FROM block -- BlockController/BlockCount';
private $entityManager;
......
......@@ -13,61 +13,128 @@ class TransactionController extends AbstractController
{
const TxPerPage = 50;
const TransactionsByHeight = " SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
s.name AS sender_name,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
r.name AS recipient_name,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type -- ,
-- (SELECT count(mo.db_id) FROM mo WHERE mo.db_id = t.db_id) AS mo_count,
-- (SELECT count(mosr.db_id) FROM mosr WHERE mosr.db_id = t.db_id) AS mosr_count
FROM transaction t
LEFT JOIN account s ON (t.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (t.recipient_id = r.id AND r.latest = 1)
WHERE t.height = ?
LIMIT ?,?";
const TransactionsByBlockId = " SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
s.name AS sender_name,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
r.name AS recipient_name,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type -- ,
-- (SELECT count(mo.db_id) FROM mo WHERE mo.db_id = t.db_id) AS mo_count,
-- (SELECT count(mosr.db_id) FROM mosr WHERE mosr.db_id = t.db_id) AS mosr_count
FROM transaction t
LEFT JOIN account s ON (t.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (t.recipient_id = r.id AND r.latest = 1)
JOIN block b ON (t.height = b.height)
WHERE b.id = ?
LIMIT ?,?";
const TransactionByAccountId = " SELECT
CAST(t.id AS UNSIGNED) AS id,
const TransactionsByHeight = " SELECT x.id, x.sender_id, x.recipient_id, x.fee, x.amount, x.unixtime,
x.transaction_type, s.name AS sender_name, r.name AS recipient_name
FROM (
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
s.name AS sender_name,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
r.name AS recipient_name,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type -- ,
-- (SELECT count(mo.db_id) FROM mo WHERE mo.db_id = t.db_id) AS mo_count,
-- (SELECT count(mosr.db_id) FROM mosr WHERE mosr.db_id = t.db_id) AS mosr_count
getTransactionType(t.type, t.subtype) as transaction_type
FROM transaction t
WHERE t.height = ?
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(mo.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type
FROM mo
JOIN transaction t ON (mo.db_id = t.db_id AND t.height = ?)
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / mos.recipient_count / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type
FROM mosr
LEFT JOIN mos ON (mos.db_id = mosr.db_id)
JOIN transaction t ON (mosr.db_id = t.db_id AND t.height = ?)
) as x
LEFT JOIN account s ON (x.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (x.recipient_id = r.id AND r.latest = 1) -- TransactionController/TransactionsByHeight";
const TransactionsByBlockId = " SELECT x.id, x.sender_id, x.recipient_id, x.fee, x.amount, x.unixtime,
x.transaction_type, s.name AS sender_name, r.name AS recipient_name
FROM (
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type
FROM transaction t
JOIN block b ON (t.height = b.height AND CAST(b.id AS UNSIGNED) = ?)
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(mo.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type
FROM mo
LEFT JOIN transaction t ON (mo.db_id = t.db_id)
JOIN block b ON (t.height = b.height AND CAST(b.id AS UNSIGNED) = ?)
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / mos.recipient_count / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type
FROM mosr
LEFT JOIN mos ON (mos.db_id = mosr.db_id)
LEFT JOIN transaction t ON (mosr.db_id = t.db_id)
JOIN block b ON (t.height = b.height AND CAST(b.id AS UNSIGNED) = ?)
) as x
LEFT JOIN account s ON (x.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (x.recipient_id = r.id AND r.latest = 1) -- TransactionController/TransactionsByBlockId";
const TransactionByAccountId = "SELECT x.id, x.sender_id, x.recipient_id, x.fee, x.amount, x.unixtime,
x.transaction_type, x.block_id, x.height, s.name AS sender_name, r.name as recipient_name
FROM (
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(t.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type,
CAST(t.block_id AS UNSIGNED) as block_id,
t.height
FROM transaction t
LEFT JOIN account s ON (t.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (t.recipient_id = r.id AND r.latest = 1)
WHERE CAST(t.sender_id AS UNSIGNED) = ? OR CAST(t.recipient_id AS UNSIGNED) = ?
ORDER BY t.timestamp DESC
LIMIT ?,?";
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(mo.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(mo.amount / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type,
CAST(t.block_id AS UNSIGNED) as block_id,
t.height
FROM mo
LEFT JOIN transaction t ON (mo.db_id = t.db_id)
WHERE CAST(mo.recipient_id AS UNSIGNED) = ?
UNION
SELECT CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
CAST(mosr.recipient_id AS UNSIGNED) AS recipient_id,
FORMAT(t.fee / 100000000, 2) AS fee,
FORMAT(t.amount / mos.recipient_count / 100000000, 2) AS amount,
t.timestamp + 1407722400 AS unixtime,
getTransactionType(t.type, t.subtype) as transaction_type,
CAST(t.block_id AS UNSIGNED) as block_id,
t.height
FROM mosr
LEFT JOIN mos ON (mosr.db_id = mos.db_id)
LEFT JOIN transaction t ON (mosr.db_id = t.db_id)
WHERE CAST(mosr.recipient_id AS UNSIGNED) = ?
) as x
LEFT JOIN account s ON (x.sender_id = s.id AND s.latest = 1)
LEFT JOIN account r ON (x.recipient_id = r.id AND r.latest = 1)
ORDER BY x.unixtime DESC -- TransactionController/TransactionsByAccountId";
......@@ -92,14 +159,21 @@ class TransactionController extends AbstractController
$con = $this->entityManager->getConnection();
$stmt = $con->prepare(self::TransactionsByHeight);
$stmt->bindValue(1, $id);
$stmt->bindValue(2, $start, ParameterType::INTEGER);
$stmt->bindValue(3, self::TxPerPage, ParameterType::INTEGER);
$stmt->bindValue(2, $id);
$stmt->bindValue(3, $id);
$stmt->execute();
$transactions = $stmt->fetchAll();
$Data = $this->paginationCalculator(count($transactions), $page);
$Data['transactions'] = $transactions;
$showTransactions = [];
for($i = $start; $i < $start + self::TxPerPage; $i++) {
if(isset($transactions[$i])) {
$showTransactions[] = $transactions[$i];
}
}
$Data['transactions'] = $showTransactions;
$Data['route'] = 'transactions_by_height';
$Data['id'] = $id;
......@@ -119,14 +193,21 @@ class TransactionController extends AbstractController
$con = $this->entityManager->getConnection();
$stmt = $con->prepare(self::TransactionsByBlockId);
$stmt->bindValue(1, $id);
$stmt->bindValue(2, $start, ParameterType::INTEGER);
$stmt->bindValue(3, self::TxPerPage, ParameterType::INTEGER);
$stmt->bindValue(2, $id);
$stmt->bindValue(3, $id);
$stmt->execute();
$transactions = $stmt->fetchAll();
$Data = $this->paginationCalculator(count($transactions), $page);
$Data['transactions'] = $transactions;
$showTransactions = [];
for($i = $start; $i < $start + self::TxPerPage; $i++) {
if(isset($transactions[$i])) {
$showTransactions[] = $transactions[$i];
}
}
$Data['transactions'] = $showTransactions;
$Data['route'] = 'transactions_by_blockId';
$Data['id'] = $id;
......@@ -147,14 +228,22 @@ class TransactionController extends AbstractController
$stmt = $con->prepare(self::TransactionByAccountId);
$stmt->bindValue(1, $id);
$stmt->bindValue(2, $id);
$stmt->bindValue(3, $start, ParameterType::INTEGER);
$stmt->bindValue(4, self::TxPerPage, ParameterType::INTEGER);
$stmt->bindValue(3, $id);
$stmt->bindValue(4, $id);
$stmt->execute();
$transactions = $stmt->fetchAll();
$Data = $this->paginationCalculator(count($transactions), $page);
$Data['transactions'] = $transactions;
// As we cannot limit + offset via SQL and use this number for pagination calculation, we have to limit + offset here
$showTransactions = [];
for($i = $start; $i < $start + self::TxPerPage; $i++) {
if(isset($transactions[$i])) {
$showTransactions[] = $transactions[$i];
}
}
$Data['transactions'] = $showTransactions;
$Data['route'] = 'transactions_by_accountId';
$Data['id'] = $id;
......
......@@ -46,6 +46,9 @@
<th>Recipient</th>
<th>Amount</th>
<th>Fee</th>
{% if route != "transactions_by_height" and route != "transactions_by_blockId" %}
<th>Block</th>
{% endif %}
<th>Timestamp</th>
</thead>
<tbody>
......@@ -69,6 +72,9 @@
</td>
<td>{{ transaction.amount }}</td>
<td>{{ transaction.fee }}</td>
{% if route != "transactions_by_height" and route != "transactions_by_blockId" %}
<td><a href="{{ url('block_details', {'block_id': transaction.block_id}) }}">{{ transaction.height }}</a></td>
{% endif %}
<td>{{ transaction.unixtime | date ("Y-m-d H:i:s", "Europe/Berlin") }}</td>
</tr>
{% endfor %}
......