Exemple #1
0
def GetblockByHeightInternal(block_height) :
	html = web.GetHeader("block")

	result = web.collection_blocks.find_one({"height":block_height})
	if result :
		html = html + GetBlockResult(result)
	else :
		html = html + _("Block Not Found!")

	html = html + web.GetFooter()

	return html	
Exemple #2
0
def GetAssetByHashPagesInternal(assetid, page):
    html = web.GetHeader("asset")

    tx_asset = web.collection_txs.find_one({"txid": assetid})
    if tx_asset:
        html = html + GetAssetResult(tx_asset, page)
    else:
        html = html + _("ASSET Not Found!")

    html = html + web.GetFooter()

    return html
Exemple #3
0
def GetAssetPage(page):
    html = web.GetHeader("asset")

    html = html + '<div name="asset" align="center">\n'
    html = html + '<br/><br/>\n'
    html = html + '<h2>' + _('Asset Information') + '</h2>\n'

    html = html + GetAssetInternal(page, web.ASSET_PER_PAGE)

    html = html + '</div>\n'

    html = html + web.GetFooter()

    return html
Exemple #4
0
def GetblockPage(page) :
	html = web.GetHeader("block")

	html = html + '<div name="block" align="center">\n'
	html = html + '<br/><br/>\n'
	html = html + '<h2>'+ _("Block Information") +'</h2>\n'

	Pagination = GetBlockPagination(page)

	html = html + Pagination
	html = html + GetblockInternal(page,web.BLOCK_PER_PAGE)
	html = html + '<br/>\n'
	html = html + Pagination
	html = html + '</div>\n'

	html = html + web.GetFooter()

	return html
Exemple #5
0
def GetAdsByAddressPagesInternal(address, assetid, page):
    html = web.GetHeader("address")

    #asset = "c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"
    if assetid == None:
        asset_adddress = web.collection_ads.find({
            "asset": {
                "$ne": "0"
            },
            "address": address
        }).sort("first_tx_time", 1)
        address_all = web.collection_ads.find_one({
            "asset": "0",
            "address": address
        })
        if asset_adddress and address_all:
            html = html + GetAddressResult(asset_adddress, address_all, page)
        else:
            html = html + _("Address Not Found!")
    else:
        asset_adddress = web.collection_ads.find({
            "asset": {
                "$ne": "0"
            },
            "address": address
        }).sort("first_tx_time", 1)
        address_all = web.collection_ads.find_one({
            "asset": assetid,
            "address": address
        })
        if asset_adddress and address_all:
            html = html + GetAddressResult(asset_adddress, address_all, page)
        else:
            html = html + _("Asset or Address Not Found!")

    html = html + web.GetFooter()

    return html
Exemple #6
0
def GetAddressPage(assetid, page):
    html = web.GetHeader("address")

    html = html + '<div name="address" align="center">\n'
    html = html + '<br/><br/>\n'
    html = html + '<h2>' + _("Address Information") + '</h2>\n'

    html = html + '<div class="container">\n'

    count = web.collection_txs.find({"type": "RegisterTransaction"}).count()
    results = web.collection_txs.find({
        "type": "RegisterTransaction"
    }).sort("height", 1)
    row = int(math.ceil(count / 4))

    r = 0
    for i in range(0, row + 1):
        html = html + '<div class="row">\n'
        html = html + '<div class="column column-20"></div>\n'

        for j in range(0, 4):
            if i == 0 and j == 0:
                if assetid == None:
                    html = html + '<div class="column column-15"><a href="/address/"><b>[' + _(
                        'All Asset') + ']</b></a></div>\n'
                else:
                    html = html + '<div class="column column-15"><a href="/address/">[' + _(
                        'All Asset') + ']</a></div>\n'
                continue

            if r >= count:
                html = html + '<div class="column column-15"></div>\n'
            elif assetid == results[r]['txid']:
                html = html + '<div class="column column-15"><a href="/address/' + results[
                    r]['txid'] + '"><b>[' + web.GetAssetNameByAsset(
                        results[r]['asset']) + ']</b></a></div>\n'
            else:
                html = html + '<div class="column column-15"><a href="/address/' + results[
                    r]['txid'] + '">[' + web.GetAssetNameByAsset(
                        results[r]['asset']) + ']</a></div>\n'
            r = r + 1

        html = html + '<div class="column column-20"></div>\n'
        html = html + '</div>\n'

    html = html + '</div>\n'

    html = html + '<br/>\n'

    if assetid != None:
        html = html + '<h4>- ' + web.GetAssetName(assetid) + ' -</h4>\n'

    Pagination = GetAdsPagination(assetid, page)

    html = html + Pagination
    html = html + GetAddressInternal(assetid, page, web.ADS_PER_PAGE)
    html = html + '<br/>\n'
    html = html + Pagination
    html = html + '</div>\n'

    html = html + web.GetFooter()

    return html
Exemple #7
0
def GetRankByHashInternal(assetid, limitnum):
    html = web.GetHeader("rank")

    html = html + '<div name="address" align="center">\n'
    html = html + '<br/><br/>\n'
    html = html + '<h2>' + _("Rank") + '</h2>\n'

    html = html + '<div class="container">\n'

    count = web.collection_txs.find({"type": "RegisterTransaction"}).count()
    results = web.collection_txs.find({
        "type": "RegisterTransaction"
    }).sort("height", 1)
    row = int(math.ceil(count / 4))

    r = 0
    for i in range(0, row + 1):
        html = html + '<div class="row">\n'
        html = html + '<div class="column column-20"></div>\n'

        for j in range(0, 4):
            if r >= count:
                html = html + '<div class="column column-15"></div>\n'
            elif assetid == results[r]['txid']:
                html = html + '<div class="column column-15"><a href="/rank/' + results[
                    r]['txid'] + '"><b>[' + web.GetAssetNameByAsset(
                        results[r]['asset']) + ']</b></a></div>\n'
            else:
                html = html + '<div class="column column-15"><a href="/rank/' + results[
                    r]['txid'] + '">[' + web.GetAssetNameByAsset(
                        results[r]['asset']) + ']</a></div>\n'
            r = r + 1

        html = html + '<div class="column column-20"></div>\n'
        html = html + '</div>\n'

    html = html + '</div>\n'

    html = html + '<br/>\n'

    if assetid != None:
        html = html + '<h4>- ' + web.GetAssetName(assetid) + ' -</h4>\n'

    html = html + '<div class="container">\n'
    html = html + '<table width="80%" border="0" cellpadding="3" cellspacing="0" align="center">'
    html = html + '<tr align="left">'
    html = html + '<th>' + _('Rank') + '</th><th>' + _(
        'Address') + '</th><th>' + _('Asset') + '</th><th>' + _(
            'Value') + '</th><th>' + _('Transaction Counts') + '</th><th>' + _(
                'Last Transaction Time') + '</th><th>' + _(
                    'First Transaction Time') + '</th>' + '<br/>'
    html = html + '</tr>'

    rank = 0
    #results = collection_ads.find({"asset":"c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b"}).sort("value",-1).limit(200)
    results = web.collection_ads.find({
        "asset": assetid
    }).sort("value", -1).limit(limitnum)
    if results:
        for result in results:
            rank = rank + 1
            html = html + '<tr>'
            html = html + '<td>' + str(rank) + '</td>'
            html = html + '<td>' + '<a href="/address/' + result[
                'address'] + '">' + result['address'] + '</a></td>'
            html = html + '<td>' + web.GetAssetName(result['asset']) + '</td>'
            html = html + '<td>' + str(result['value']) + '</td>'
            html = html + '<td>' + str(len(result['txid_list'])) + '</td>'
            html = html + '<td>' + web.GetLocalTime(
                result['last_tx_time']) + '</td>'
            html = html + '<td>' + web.GetLocalTime(
                result['first_tx_time']) + '</td>'
            html = html + '</tr>'

    html = html + '</table>\n'
    html = html + '</div>\n'

    html = html + '</div>\n'

    html = html + web.GetFooter()

    return html
Exemple #8
0
def GetApi() :
	html = web.GetHeader("api")

	html = html + '<div name="asset" align="center">\n'
	html = html + '<br/><br/>\n'
	html = html + '<h2>' + _('API Interface') + '</h2>\n'

	html = html + '<div class="container">\n'

	html = html + '<table width="80%" border="0" cellpadding="3" cellspacing="0" align="center">\n'
	html = html + '<tr align="left">\n'
	html = html + '<th>' + _('Interface Name') + '</th><th>' + _('Call Address') + '</th><th>' + _('Parameter') + '</th><th>' + _('Example') + '</th>\n'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get address value') + '</a></td>'
	html = html + '<td>/api/v1/address/get_value/<b>{address}</b></td>'
	html = html + '<td>address</td>'
	html = html + '<td><a href="/api/v1/address/get_value/AQVh2pG732YvtNaxEGkQUei3YA4cvo7d2i">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get current block height') + '</a></td>'
	html = html + '<td>/api/v1/block/get_current_height</td>'
	html = html + '<td>' + _('None') + '</td>'
	html = html + '<td><a href="/api/v1/block/get_current_height">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get current block') + '</a></td>'
	html = html + '<td>/api/v1/block/get_current_block</td>'
	html = html + '<td>' + _('None') + '</td>'
	html = html + '<td><a href="/api/v1/block/get_current_block">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get block by height') + '</a></td>'
	html = html + '<td>/api/v1/block/get_block/<b>{height}</b></td>'
	html = html + '<td>height</td>'
	html = html + '<td><a href="/api/v1/block/get_block/0">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get block by hash') + '</a></td>'
	html = html + '<td>/api/v1/block/get_block/<b>{blockhash}</b></td>'
	html = html + '<td>blockhash</td>'
	html = html + '<td><a href="/api/v1/block/get_block/d42561e3d30e15be6400b6df2f328e02d2bf6354c41dce433bc57687c82144bf">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '<tr>'
	html = html + '<td>' + _('Get transaction by txid') + '</a></td>'
	html = html + '<td>/api/v1/tx/get_tx/<b>{txid}</b></td>'
	html = html + '<td>txid</td>'
	html = html + '<td><a href="/api/v1/tx/get_tx/3631f66024ca6f5b033d7e0809eb993443374830025af904fb51b0334f127cda">' + _('Example') + '</a></td>'
	html = html + '</tr>'

	html = html + '</table>\n'

	html = html + '</div>\n'

	html = html + '</div>\n'

	html = html + web.GetFooter()

	return html