ensure user switches to avax network

This commit is contained in:
lza_menace
2022-01-02 21:38:22 -08:00
parent 0505a1eded
commit 5c3948f5ed
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -83,6 +83,7 @@
}
async function getTokenID(ipfsHash) {
await addAvalancheNetwork();
if (ipfsHash != '') {
const tokenId = await contract.methods.metadataTokenId(ipfsHash).call();
return tokenId;
@@ -90,6 +91,7 @@
}
async function isMinted(ipfsHash) {
await addAvalancheNetwork();
if (ipfsHash != '') {
const tokenId = await getTokenID(ipfsHash)
if (tokenId == 0) {
+5 -1
View File
@@ -70,7 +70,7 @@
</div>
</section>
{% include 'includes/footer.html' %}
<script type="text/javascript">
async function saveDB() {
await fetch('{{ url_for("api.update_user" ) }}', {
@@ -99,6 +99,7 @@
async function fetchUserProfile() {
await addAvalancheNetwork();
_walletAddress = w3.utils.toChecksumAddress('{{ user.public_address }}');
const userProfile = await contract.methods.userProfile(_walletAddress).call();
if (userProfile.userHandle){document.getElementById('userHandle').innerHTML = userProfile.userHandle};
@@ -114,6 +115,7 @@
if (handle == "") {
notif('Cannot publish an empty value.', 'warning');
}
await addAvalancheNetwork();
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserHandle(handle).estimateGas(function(err, gas){
@@ -139,6 +141,7 @@
if (address == "") {
notif('Cannot publish an empty value.', 'warning');
}
await addAvalancheNetwork();
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserWowneroAddress(address).estimateGas(function(err, gas){
@@ -164,6 +167,7 @@
if (_hash == "") {
notif('Cannot publish an empty value.', 'warning');
}
await addAvalancheNetwork();
const walletAddress = await getMetamaskAccount();
const gasPrice = await w3.eth.getGasPrice();
const gasLimit = await contract.methods.setUserMetadata(_hash).estimateGas(function(err, gas){