Commit 1af9e4bc authored by Kalinka's avatar Kalinka

Controller/:

  - cleanup
  - docs
templates/:
  - remove hinclude
wallet_additions.sql:
  - add docs link
parent 24ebc8d7
......@@ -15,7 +15,7 @@ class BlockController extends AbstractController
const BlockListByIds = 'SELECT b.height,
CAST(b.id AS UNSIGNED) AS id,
b.timestamp + 1407722400 AS unixtime,
FLOOR(pow(0.95,FLOOR(b.height/10800))*10000) AS reward,
FLOOR(POW(0.95,FLOOR(b.height/10800))*10000) AS reward,
FORMAT(b.total_fee / 100000000, 2) AS tx_fee,
FORMAT(b.total_amount / 100000000, 2) AS sent,
bi.tx_count AS tx_count,
......@@ -90,84 +90,6 @@ class BlockController extends AbstractController
const BlockCount = ' SELECT count(height) as COUNT FROM block';
// Transaction Types: https://github.com/burst-apps-team/burstcoin/blob/develop/src/brs/TransactionType.java#L34
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,
CASE
WHEN t.type = 0 THEN
-- Type: Payment
CASE
WHEN t.subtype = 0 THEN 'Ordinary Payment'
WHEN t.subtype = 1 THEN 'MultiOut Payment'
WHEN t.subtype = 2 THEN 'MultiOut-Same Payment'
END
WHEN t.type = 1 THEN
-- Type: Messaging
CASE
WHEN t.subtype = 0 THEN 'Arbritrary Message'
WHEN t.subtype = 1 THEN 'Alias Assignment'
WHEN t.subtype = 5 THEN 'Account Info'
WHEN t.subtype = 6 THEN 'Alias Sell'
WHEN t.subtype = 7 THEN 'Alias Buy'
END
WHEN t.type = 2 THEN
CASE
WHEN t.subtype = 0 THEN 'Asset Issued'
WHEN t.subtype = 1 THEN 'Asset Transfer'
WHEN t.subtype = 2 THEN 'Ask Order Placement'
WHEN t.subtype = 3 THEN 'Bid Order Placement'
WHEN t.subtype = 4 THEN 'Ask Order Cancellation'
WHEN t.subtype = 5 THEN 'Bid Order Cancellation'
END
WHEN t.type = 3 THEN
CASE
WHEN t.subtype = 0 THEN 'Marketplace Listing'
WHEN t.subtype = 1 THEN 'Marketplace Delisting'
WHEN t.subtype = 2 THEN 'Marketplace Price Change'
WHEN t.subtype = 3 THEN 'Marketplace Quantity Change'
WHEN t.subtype = 4 THEN 'Marketplace Purchase'
WHEN t.subtype = 5 THEN 'Marketplace Delivery'
WHEN t.subtype = 6 THEN 'Marketplace Feedback'
WHEN t.subtype = 7 THEN 'Marketplace Refund'
END
WHEN t.type = 4 THEN
CASE
WHEN t.subtype = 0 THEN 'Effective Balance Leasing'
END
WHEN t.type = 20 THEN
CASE
WHEN t.subtype = 0 THEN 'Reward Recipient'
END
WHEN t.type = 21 THEN
CASE
WHEN t.subtype = 0 THEN 'Escrow Creation'
WHEN t.subtype = 1 THEN 'Escrow Signing'
WHEN t.subtype = 2 THEN 'Escrow Result'
WHEN t.subtype = 3 THEN 'Subscription Subscribe'
WHEN t.subtype = 4 THEN 'Subscription Cancel'
WHEN t.subtype = 5 THEN 'Subscription Payment'
END
WHEN t.type = 22 THEN
CASE
WHEN t.subtype = 0 THEN 'AT Creation'
WHEN t.subtype = 1 THEN 'AT Payment'
END
ELSE 'unkown transaction type'
END 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 = ?";
private $entityManager;
......
......@@ -49,21 +49,6 @@ class TransactionController extends AbstractController
WHERE b.id = ?
LIMIT ?,?";
const TransactionCountByAccountId = "SELECT SUM(TXcount) AS TXs FROM (
SELECT count(t.id) AS TXcount
FROM transaction t
WHERE CAST(t.sender_id AS UNSIGNED) = ? OR CAST(t.recipient_id AS UNSIGNED) = ?
UNION
SELECT count(mosr.recipient_id) AS TXcount
FROM mosr
WHERE CAST(mosr.recipient_id AS UNSIGNED) = ?
UNION
SELECT count(mo.recipient_id) AS TXcount
FROM mo
WHERE CAST(mo.recipient_id AS UNSIGNED) = ?
) as x
";
const TransactionByAccountId = " SELECT
CAST(t.id AS UNSIGNED) AS id,
CAST(t.sender_id AS UNSIGNED) AS sender_id,
......@@ -122,7 +107,7 @@ class TransactionController extends AbstractController
}
/**
* @param $blockId
* @param $id
* @param $page
* @Route("/transactions/byBlockId/{id}/{page}", name="transactions_by_blockId", defaults={"page"=0})
* @throws Exception
......@@ -149,7 +134,7 @@ class TransactionController extends AbstractController
}
/**
* @param $accountId
* @param $id
* @param $page
* @return Response
* @throws Exception
......
......@@ -61,7 +61,7 @@
</ul>
<div class="tab-content" id="blockTabContent">
<div class="tab-pane fade show active" id="tx" role="tabpanel" aria-labelledby="tx-tab">
{{ render_hinclude(url('transactions_by_blockId', {'id': block.id }), {'default': 'Loading....'}) }}
<div class="include-html" id="tx-list" include-html="{{ url('transactions_by_blockId', {'id': block.id }) }}">Loading....</div>
</div>
<div class="tab-pane fade" id="asset" role="tabpanel" aria-labelledby="asset-tab">Asset, to be done</div>
</div>
......
......@@ -72,6 +72,7 @@ DELIMITER $$
CREATE FUNCTION getTransactionType(type tinyint(4), subtype tinyint(4))
RETURNS char(100) DETERMINISTIC
BEGIN
-- Transaction Types: https://github.com/burst-apps-team/burstcoin/blob/develop/src/brs/TransactionType.java#L34
IF type = 0 THEN
IF subtype = 0 THEN RETURN 'Ordinary Payment';
ELSEIF subtype = 1 THEN RETURN 'MultiOut Payment';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment