Skip to content
Permalink
Browse files

issuances via imgur

  • Loading branch information...
loon3 committed Mar 22, 2019
1 parent b3f92a1 commit 9083a8aecaf0c41dda8f92f752becafb67e6dd26
@@ -6,4 +6,6 @@ apikeys.js
rpw
test
testing_json
*.php
*.php
*.crx
*.pem

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,57 @@
<div id="dialogIssueAsset-container" align="center">
<!--
<div id="dialogIssueAsset-header" style="padding: 15px 0 30px 0; width: 100%;" align="center">
<div id="dialogIssueAsset-icon-lg" style="padding: 0 0 10px 0; width: 100%"></div>
<div align="center" style="width: 100%;">
<div>Available Balance: </div>
<div style="font-weight: bold; font-size: 18pt;"><span id="dialogIssueAsset-balance" class="dialogBuyAsset-strong"></span></div>
</div>
</div>
-->

<div id="dialogIssueAsset-header" style="padding: 15px 0 30px 0; width: 100%; display: none;" align="center">
<div id="dialogIssueAsset-image-container"></div>
<div style="padding-top: 10px;">Asset ID <span id="dialogIssueAsset-assetid">A</span></div>
</div>

<div align="left">

<div id='dialogIssueAsset-imgur-file-upload-container' align="center" style="padding: 20px 20px 10px 20px;">
<form id="imgur">
<label class="btn btn-block btn-info">
Upload your asset image&hellip;
<input id="imgur-file-upload" type="file" style="display: none;" class="imgur" accept="image/*" data-max-size="5000"/>
</label>
</form>
</div>

<div id='dialogIssueAsset-imgur-file-upload-spinner' align='center'></div>

<div id='dialogIssueAsset-form-container' style="display: none;">
<form id="dialogIssueAsset-form">
<div class="form-group">
<label for="dialogIssueAsset-image">Imgur URL</label>
<input id="dialogIssueAsset-image" type="text" class="form-control" autocomplete="off" disabled>
</div>
<div class="form-group">
<label for="dialogIssueAsset-name">Asset Name</label>
<input id="dialogIssueAsset-name" type="text" class="form-control dialogIssueAsset-field-req" autocomplete="off" maxlength="23" placeholder="My First Rare Art">
</div>
<div class="form-group" id="dialogIssueAsset-qty-group">
<label for="dialogIssueAsset-qty">Quantity</label>
<input id="dialogIssueAsset-qty" type="text" class="form-control dialogIssueAsset-field-req" placeholder="100" autocomplete="off">
</div>
<div class="form-check" style="margin: -10px 0 8px 0;" id="dialogIssueAsset-isdivisible-group">
<input type="checkbox" class="form-check-input" id="dialogIssueAsset-isdivisible">
<label class="form-check-label" for="dialogIssueAsset-isdivisible"><span style="font-weight: normal;">Divisible</span></label>
</div>
</form>

<div align="center">Current fee: <b><span class="dialog-transfee"></span> BTC</b></div>
<div align="center" class="dialog-txfeebutton"></div>
</div>
</div>

</div>


@@ -0,0 +1,7 @@
<div id="dialogUploadImage-container" align="center">
<form id="imgur">
<input id="imgur-file-upload" type="file" class="imgur" accept="image/*" data-max-size="5000"/>
</form>
</div>


@@ -29,6 +29,10 @@
<script src="../js/xcp-js/issuance.js" defer></script>
<script src="../js/xcp-js/dex.js" defer></script>

<!--
<script src="../js/common.js"></script>
<script src="../js/imgur.js"></script>
-->
<script src="../js/lib/ipfs.js"></script>
<script src="../js/lib/buffer.js"></script>

@@ -45,6 +49,7 @@
<script src="../js/passphrase.js"></script>
<script src="../js/tab.js"></script>
<script src="../js/collect.js"></script>
<script src="../js/create.js"></script>
<script src="../js/settings.js"></script>

<script src="../js/apikeys.js"></script>
@@ -110,13 +115,19 @@
.collection-item-asset-end:hover {
background-color: rgba(0, 0, 0, 0.1);
}
.issued-item:hover {
background-color: rgba(0, 0, 0, 0.1);
}
.inventory-asset-name {
font-size: 16px;
font-weight: bold;
}
.inventory-asset-name-long {
font-size: 10px;
font-size: 16px;
font-weight: bold;
word-break: break-all;
}
.btn-back {
color: #ffffff;
@@ -315,16 +326,15 @@ <h1>Trade</h1>
<h1>Create</h1>
<p class="lead">
Issue your own cryptogood asset.
<!--
<ul class="list-group">
<li class="list-group-item list-group-item-action h5 list-group-item-dark page-menu">My Issued Cryptogoods</li>
<li class="list-group-item list-group-item-action h5 list-group-item-dark page-menu">Create New Unique (1 of 1)</li>
<li class="list-group-item list-group-item-action h5 list-group-item-dark page-menu">Create New Limited Edition</li>
<li id='page-container-create-new-button' class="list-group-item list-group-item-action h5 list-group-item-dark page-menu">Create New Asset</li>
<li id='page-container-create-manage-button' class="list-group-item list-group-item-action h5 list-group-item-dark page-menu">Manage My Assets</li>
</ul>
-->
<div class="h3" style="padding: 50px; background-color: #38444f;" align="center">Coming soon!</div>
<!-- <div class="h3" style="padding: 50px; background-color: #38444f;" align="center">Coming soon!</div>-->
</p>
</div>
<div class="jumbotron mt-3 jumbotron-tab-container-content" id="page-container-create-content">
</div>

<!--Settings-->
<div class="jumbotron mt-3 jumbotron-tab-container" id="page-container-settings">
@@ -1,24 +1,3 @@
chrome.browserAction.onClicked.addListener(function(tab) {
var chromeid = chrome.runtime.id
var found = false
params = {}
chrome.tabs.query(params, function(results){
console.log(results)
for(var i = 0; i < results.length; i++){
var firstsplit = (results[i].url).split("//")
var secondsplit = firstsplit[1].split("/")
if(chromeid == secondsplit[0]){
found = true
//$(".popup-button").prop('disabled', true)
if(results[i].active == true){
window.close();
} else {
chrome.tabs.update(results[i].id, {active: true});
}
}
}
if(!found){
chrome.tabs.create({'url': chrome.extension.getURL('../html/tab.html')}, function(tab) {});
}
})
});
chrome.tabs.create({'url': chrome.extension.getURL('../html/tab.html')}, function(tab) {});
})
@@ -9,3 +9,28 @@ chrome.browserAction.onClicked.addListener(function(tab) {
// }
// })
})

chrome.browserAction.onClicked.addListener(function(tab) {
var chromeid = chrome.runtime.id
var found = false
params = {}
chrome.tabs.query(params, function(results){
console.log(results)
for(var i = 0; i < results.length; i++){
var firstsplit = (results[i].url).split("//")
var secondsplit = firstsplit[1].split("/")
if(chromeid == secondsplit[0]){
found = true
//$(".popup-button").prop('disabled', true)
if(results[i].active == true){
window.close();
} else {
chrome.tabs.update(results[i].id, {active: true});
}
}
}
if(!found){
chrome.tabs.create({'url': chrome.extension.getURL('../html/tab.html')}, function(tab) {});
}
})
});
@@ -118,14 +118,21 @@ function getutxos(add_from, mnemonic, amountremaining, callback){
var privkey = getprivkey(add_from, mnemonic);
var source_html = "https://api.blockcypher.com/v1/btc/main/addrs/"+add_from+"?unspentOnly=1&includeScript=1"

var total_utxo = new Array();
var total_utxo = new Array();
var satoshi_change = 0;

$.getJSON( source_html, function( data ) {

data = data.txrefs

console.log(amountremaining);

console.log(data);

if(!data){
callback(total_utxo, satoshi_change);
}

data.sort(function(a, b) {
return b.value - a.value
});
@@ -158,9 +165,7 @@ function getutxos(add_from, mnemonic, amountremaining, callback){
});

if (amountremaining < 0) {
var satoshi_change = -(amountremaining.toFixed(8) * 100000000).toFixed(0);
} else {
var satoshi_change = 0;
satoshi_change = -(amountremaining.toFixed(8) * 100000000).toFixed(0);
}

console.log(total_utxo)
@@ -37,7 +37,7 @@ function pageCollectInventory(address){

var collection = ""
var collectionUnknown = ""
var name, cardImage, isLongname, isLargeCollection, isEmptyCollection, cardDivisible, cardQty, collectionEntry
var name, cardImage, isLongname, isLargeCollection, isEmptyCollection, cardDivisible, cardQty, collectionEntry, cardAlias


$.getJSON( source_html, function( data ) {
@@ -70,28 +70,51 @@ function pageCollectInventory(address){
for(var i=0; i < assetArrayLength; i++){

cardDivisible = data['data'][i]['asset']['divisible']
cardDescription = data['data'][i]['asset']['description']
cardQty = data['data'][i]['balance']['quantity']
cardQty = Number(cardQty).toFixed(8).replace(/\.?0+$/,"")
cardAlias = ""


if(data['data'][i]['card'] == false){
cardImage = "../images/unknown.png"
if(cardDescription.length >= 16){
var checkImgur = cardDescription.substring(0, 5);
if(checkImgur == "imgur"){
var descArray = cardDescription.split(";");
cardImage = "https://i.imgur.com/"+descArray[0].substring(6);
cardAlias = descArray[1]
}
}
} else {
cardImage = data['data'][i]['card']['image']
}



if(data['data'][i]['asset']['long_name'] == null){
name = data['data'][i]['asset']['name']
isLongname = ""
} else {
name = data['data'][i]['asset']['long_name']
isLongname = "-long"
}
if(name.charAt(0) == "A"){isLongname = "-long"}
if(name.charAt(0) == "A"){
isLongname = "-long"
}

if(!cardAlias){
var display_name = name
cardAlias = ""
} else {
var display_name = cardAlias
isLongname = ""
}

collectionEntry = ""
collectionEntry += "<div class='col-sm-6 col-md-4 col-lg-3 col-xl-2 collection-item-asset' style='padding: 20px 0 16px 0' data-assetname='"+name+"' data-assetimage='"+cardImage+"' data-divisible='"+cardDivisible+"' data-quantity='"+cardQty+"' data-description='No Description'>"
collectionEntry += "<div class='col-sm-6 col-md-4 col-lg-3 col-xl-2 collection-item-asset' style='padding: 20px 0 16px 0' data-assetname='"+name+"' data-assetimage='"+cardImage+"' data-divisible='"+cardDivisible+"' data-quantity='"+cardQty+"' data-description='"+cardDescription+"' data-alias='"+cardAlias+"'>"
collectionEntry += "<div align='center' style='margin: auto;'><div style=''><img class='lozad' data-src='"+cardImage+"' width='120px'></div>"
collectionEntry += "<div class='inventory-asset-name"+isLongname+"' style='font-weight: bold; padding-top: 8px;'>"+name+"</div>"
collectionEntry += "<div class='inventory-asset-name"+isLongname+"' style='font-weight: bold; padding: 8px 8px 0 8px;'>"+display_name+"</div>"
collectionEntry += "<div class='inventory-asset-qty' style='font-size: 11pt; color: #FFEB70;'>x"+cardQty+"</div>"
collectionEntry += "</div></div>"

@@ -129,7 +152,7 @@ function pageCollectInventory(address){
})
}

function pageCollectAsset(assetname, assetimage, assetdivisible, assetquantity, assetdescription){
function pageCollectAsset(assetname, assetimage, assetdivisible, assetquantity, assetdescription, assetalias){

$("#page-container-collect-content").html("<div align='center'><i class='fa fa-spinner fa-spin fa-3x fa-fw'></i></div>")

@@ -139,29 +162,51 @@ function pageCollectAsset(assetname, assetimage, assetdivisible, assetquantity,
$("#leftbar-container").html("<div align='left' style='position: fixed; top: 50%; left: 0px; vertical-align: middle; transform: translateY(-50%);'><button id='page-inventory-back-button' type='button' class='btn btn-back'><i class='fa fa-arrow-left fa-2x'></i></button></div>")

var assetInfo = ""

assetquantity = Number(assetquantity).toFixed(8).replace(/\.?0+$/,"")

assetInfo += "<div align= 'center' style='position: relative; top: -30px; background-color: #38444f;'>Asset Information</div>"
assetInfo += "<div style='padding: 0 15px 0 15px;'>"
assetInfo += "<div class='row' style='width: 100%; padding: 0 0 28px 0; text-align: center; margin: auto;'><div class='col'><button type='button' class='btn btn-primary btn-block asset-send-button' data-image='"+assetimage+"' data-asset='"+assetname+"' data-qty='"+assetquantity+"' data-divisible='"+assetdivisible+"'>Send</button></div><div class='col'><button type='button' class='btn btn-info btn-block' disabled>Trade (Soon!)</button></div></div>"
assetInfo += "<div class='row' style='width: 100%; padding: 0 0 28px 0; text-align: center; margin: auto;'><div class='col'><button type='button' class='btn btn-primary btn-block asset-send-button' data-image='"+assetimage+"' data-asset='"+assetname+"' data-qty='"+assetquantity+"' data-divisible='"+assetdivisible+"' data-alias='"+assetalias+"'>Send</button></div><div class='col'><button type='button' class='btn btn-info btn-block' disabled>Trade (Soon!)</button></div></div>"

//<div class='col'><button type='button' class='btn btn-info btn-block' disabled>Trade (Soon!)</button></div><div class='col'><button type='button' class='btn btn-success btn-block' disabled>Gift (Soon!)</button></div><div class='col'><button type='button' class='btn btn-warning btn-block' disabled>Bonus (Soon!)</button></div>

assetInfo += "<div class='row' style='background-color: #38444F;'><div id='container-collect-asset-name' class='col-lg-6' style='padding: 10px 10px 10px 20px; font-size: 32px; font-weight: bold;'>"+assetname+"</div><div id='container-collect-asset-qty' class='col-lg-6'><div style='font-weight: bold; color: #FFEB70; padding: 10px 0 10px 0; font-size: 32px;'><span style='font-size: 18px;'>x </span>"+assetquantity+"</div></div></div>"
if(assetalias.length > 0){
var assetname_display = assetalias + " <div style='font-size: 18px; color: #868e96;'>ID // <span style='color: #D3BDB0;'>" + assetname + "</span></div>"

assetdescription = ""
} else {
var assetname_display = assetname
}

assetInfo += "<div class='row' style='background-color: #38444F;'><div id='container-collect-asset-name' class='col-lg-6' style='padding: 10px 10px 10px 20px; font-size: 32px; font-weight: bold;'>"+assetname_display+"</div><div id='container-collect-asset-qty' class='col-lg-6'><div style='font-weight: bold; color: #FFEB70; padding: 10px 0 10px 0; font-size: 32px;'><span style='font-size: 18px;'>x </span>"+assetquantity+"</div></div></div>"
assetInfo += "<div class='row' style='background-color: #D3BDB0;'>"
assetInfo += "<div class='col-lg-12' align='center' style='padding: 20px;'>"
assetInfo += "<div class='col-lg-6' align='center' style='padding: 20px;'>"
assetInfo += "<img src='"+assetimage+"' style='width: 100%; max-width: 400px;'></div>"
// assetInfo += "<div class='col-lg-6' style='font-weight: bold; padding: 20px; color: #38444f;'>"
// assetInfo += "<h4>"+assetdescription+"</h4>"
// assetInfo += "</div>"
assetInfo += "<div class='col-lg-6' style='font-weight: bold; padding: 20px; color: #38444f;'>"
assetInfo += "<h4>"+assetdescription+"</h4>"

var source_html = "https://xchain.io/api/asset/"+assetname

$.getJSON( source_html, function( data ) {
assetInfo += "<div style='font-size: 18px; font-weight: 300; padding-top: 10px;'>Created By:<br><span style='font-weight: bold;'>"+data.issuer+"</span></div>"
assetInfo += "<div style='font-size: 18px; font-weight: 300; padding-top: 10px;'>Total Issued:<br><span style='font-weight: bold;'>"+data.supply+"</span></div>"
assetInfo += "<div style='font-size: 18px; font-weight: 300; padding-top: 10px;'>Divisible:<br><span style='font-weight: bold;'>"+data.divisible+"</span></div>"
assetInfo += "<div style='font-size: 18px; font-weight: 300; padding-top: 10px;'>Locked:<br><span style='font-weight: bold;'>"+data.locked+"</span></div>"
assetInfo += "</div></div></div></div>"

$("#page-container-collect-content").html(assetInfo)
})

assetInfo += "</div>"
assetInfo += "</div>"
assetInfo += "</div>"

// assetInfo += "</div>"
//
// assetInfo += "</div>"
// assetInfo += "</div>"
// assetInfo += "</div>"


$("#page-container-collect-content").html(assetInfo)


}

Oops, something went wrong.

0 comments on commit 9083a8a

Please sign in to comment.
You can’t perform that action at this time.