@ -21,40 +21,67 @@
< p > Tipped WOW: < strong > < span id = "tippedWOW" > ?< / span > < / strong > < / p >
< h3 > From Local Database< / h3 >
< p >
Handle:
{# Handle #}
{% if is_user %}
< input id = "handleInput" type = "text" placeholder = "{{ user.handle }}" value = "{{ user.handle }}" > < / input >
< a onclick = "publishHandleAVAX()" class = "publishAVAX" > Publish AVAX< / a >
< div class = "field" >
< label class = "label" > Handle< / label >
< div class = "control columns" >
< div class = "column is-two-thirds" >
< input id = "handleInput" class = "input" type = "text" placeholder = "{{ user.handle }}" value = "{{ user.handle }}" >
< p class = "help" > The username/handle you want to be referenced by.< / p >
< / div >
< div class = "column" >
< a id = "publishHandle" onclick = "publishHandle()" class = "publishAVAX button" > Publish AVAX< / a >
< / div >
< / div >
< / div >
{% else %}
< strong > {{ user.handle }}< / strong >
< p > < strong > Handle:< / strong > {{ user.handle }}< / p >
{% endif %}
< / p >
< p >
Wownero Address:
{# Wownero Address #}
{% if is_user %}
< input id = "wowneroAddressInput" type = "text" placeholder = "{{ user.wownero_address or '' }}" value = "{{ user.wownero_address or '' }}" > < / input >
< a onclick = "publishWowneroAddress()" class = "publishAVAX" > Publish AVAX< / a >
< div class = "field" >
< label class = "label" > Wownero Address< / label >
< div class = "control columns" >
< div class = "column is-two-thirds" >
< input id = "wowneroAddressInput" class = "input" type = "text" placeholder = "{{ user.wownero_address or '' }}" value = "{{ user.wownero_address or '' }}" >
< p class = "help" > The Wownero wallet address you want to receive tips on.< / p >
< / div >
< div class = "column" >
< a id = "publishWowneroAddress" onclick = "publishWowneroAddress()" class = "publishAVAX button" > Publish AVAX< / a >
< / div >
< / div >
< / div >
{% else %}
< strong > < span class = "wrap" > {{ user.wownero_address }}< / span > < / strong >
< p > < strong > Wownero Address:< / strong > < span class = "wrap" > {{ user.wownero_address or '?' }}< / span > < / p >
{% endif %}
< / p >
< p >
Metadata IPFS Hash:
{# Metadata IPFS Hash #}
{% if is_user %}
< input id = "metadataIPFSHashInput" type = "text" placeholder = "{{ user.ipfs_hash or '' }}" value = "{{ user.ipfs_hash or '' }}" > < / input >
< a onclick = "publishMetadataIPFSHash()" class = "publishAVAX" > Publish AVAX< / a >
< div class = "field" >
< label class = "label" > Metadata IPFS Hash< / label >
< div class = "control columns" >
< div class = "column is-two-thirds" >
< input id = "metadataIPFSHashInput" class = "input" type = "text" placeholder = "{{ user.ipfs_hash or '' }}" value = "{{ user.ipfs_hash or '' }}" >
< p class = "help" > The IPFS hash of your profile metadata.< / p >
< / div >
< div class = "column" >
< a id = "publishMetadataIPFSHash" onclick = "publishMetadataIPFSHash()" class = "publishAVAX button" > Publish AVAX< / a >
< / div >
< / div >
< / div >
{% else %}
< strong > {{ user.ipfs_hash }}< / strong >
< p > < strong > Metadata IPFS Hash:< / strong > {{ user.ipfs_hash or '' }}< / p >
{% endif %}
< / p >
< p > Register Date: < strong > {{ user.register_date }}< / strong > < / p >
< p > Last Login Date: < strong > {{ user.last_login_date }}< / strong > < / p >
< p > Moderator: < strong > {{ user.is_moderator() }}< / strong > < / p >
< p > Verified: < strong > {{ user.verified }}< / strong > < / p >
< p > Memes Posted: < strong > {{ user.memes | length }}< / strong > < / p >
< p > < strong > Register Date: < / strong > {{ user.register_date }} ({{ user.register_date | humanize }})< / p >
< p > < strong > Last Login Date: < / strong > {{ user.last_login_date }} ({{ user.last_login_date | humanize }})< / p >
< p > < strong > Moderator: < / strong > {{ user.is_moderator() }}< / p >
< p > < strong > Verified: < / strong > {{ user.verified }}< / p >
< p > < strong > Memes Posted: < / strong > {{ user.memes | length }}< / p >
{% if user.bio %}
< p > Bio: {{ user.bio }}< / p >
< p > < strong > Bio: < / strong > {{ user.bio }}< / p >
{% endif %}
{% if user.website %}
< p > Website: < a href = "{{ user.website_url }}" target = "_blank" > {{ user.website_url }}< / a > < / p >
@ -105,23 +132,26 @@
if (userProfile.userHandle){document.getElementById('userHandle').innerHTML = userProfile.userHandle};
if (userProfile.wowneroAddress){document.getElementById('wowneroAddress').innerHTML = userProfile.wowneroAddress};
if (userProfile.metadataIPFSHash){document.getElementById('metadataIPFSHash').innerHTML = userProfile.metadataIPFSHash};
if (userProfile.tippedAVAX){document.getElementById('tippedAVAX').innerHTML = userProfile.tippedAVAX};
document.getElementById('tippedWOWX').innerHTML = 0 ;
if (userProfile.tippedAVAX){document.getElementById('tippedAVAX').innerHTML = w3.utils.fromWei( userProfile.tippedAVAX) };
if (userProfile.tippedWOWX){ document.getElementById('tippedWOWX').innerHTML = w3.utils.fromWei(userProfile.tippedWOWX)} ;
return
}
async function publishHandleAVAX() {
async function publishHandle() {
document.getElementById('publishHandle').classList.add('is-loading');
const handle = document.getElementById('handleInput').value;
if (handle == "") {
notif('Cannot publish an empty value.', 'warning');
document.getElementById('publishHandle').classList.remove('is-loading');
return false;
}
await addAvalancheNetwork();
try {
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserHandle(handle).estimateGas(function(err, gas){
return gas;
});
try {
notif(`Publishing user handle "${handle}" to the Avalanche blockchain for address ${walletAddress.slice(0, 6)}...${walletAddress.slice(-6)}.`, 'info');
let res = await contract.methods.setUserHandle(handle).send({
from: walletAddress,
@ -133,21 +163,25 @@
window.location.href = "";
} catch(e) {
notif(e.message, 'warning');
document.getElementById('publishHandle').classList.remove('is-loading');
}
}
async function publishWowneroAddress() {
document.getElementById('publishWowneroAddress').classList.add('is-loading');
const address = document.getElementById('wowneroAddressInput').value;
if (address == "") {
notif('Cannot publish an empty value.', 'warning');
document.getElementById('publishWowneroAddress').classList.remove('is-loading');
return false;
}
await addAvalancheNetwork();
try {
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserWowneroAddress(address).estimateGas(function(err, gas){
return gas;
});
try {
notif(`Publishing Wownero address "${address.slice(0, 6)}...${address.slice(-6)}" to the Avalanche blockchain for address ${walletAddress.slice(0, 6)}...${walletAddress.slice(-6)}.`, 'info');
let res = await contract.methods.setUserWowneroAddress(address).send({
from: walletAddress,
@ -159,22 +193,26 @@
window.location.href = "";
} catch(e) {
notif(e.message, 'warning');
document.getElementById('publishWowneroAddress').classList.remove('is-loading');
}
}
async function publishMetadataIPFSHash() {
document.getElementById('publishMetadataIPFSHash').classList.add('is-loading');
const _hash = document.getElementById('metadataIPFSHashInput').value;
if (_hash == "") {
notif('Cannot publish an empty value.', 'warning');
document.getElementById('publishMetadataIPFSHash').classList.remove('is-loading');
return false;
}
await addAvalancheNetwork();
try {
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserMetadata(_hash).estimateGas(function(err, gas){
return gas;
});
try {
notif(`Publishing user profile metadata IPFS hash ${_hash} to the Avalanche blockchain for address ${walletAddress.slice(0, 6)}...${walletAddress.slice(-6)}.`, 'info');
notif(`Publishing user profile metadata IPFS hash "${_hash}" to the Avalanche blockchain for address ${walletAddress.slice(0, 6)}...${walletAddress.slice(-6)}.`, 'info');
let res = await contract.methods.setUserMetadata(_hash).send({
from: walletAddress,
value: 0,
@ -185,6 +223,7 @@
window.location.href = "";
} catch(e) {
notif(e.message, 'warning');
document.getElementById('publishMetadataIPFSHash').classList.remove('is-loading');
}
}
@ -193,8 +232,5 @@
});
< / script >
< style >
input { width: 30%; }
< / style >
< / body >
< / html >