+
-
+
-
+
(Price may still change after pressing the button, so make sure to check the {{ $config.tokenSymbol }} amount in wallet.)
@@ -201,6 +202,7 @@ import { useEthers, shortenAddress } from 'vue-dapp';
import { useToast } from "vue-toastification/dist/index.mjs";
import ChatFeed from "~/components/chat/ChatFeed.vue";
import ConnectWalletButton from "~/components/ConnectWalletButton.vue";
+import SwitchChainButton from '~/components/SwitchChainButton.vue';
import WaitingToast from "~/components/WaitingToast";
import AddImageToCollectionModal from "~/components/nft/collection/AddImageToCollectionModal";
import ChangeCollectionPreviewModal from "~/components/nft/collection/ChangeCollectionPreviewModal";
@@ -242,6 +244,7 @@ export default {
ChatFeed,
ConnectWalletButton,
RemoveImageFromCollectionModal,
+ SwitchChainButton,
WaitingToast
},
@@ -282,7 +285,15 @@ export default {
}
return false;
- }
+ },
+
+ isSupportedChain() {
+ if (this.chainId === this.$config.supportedChainId) {
+ return true;
+ } else {
+ return false;
+ }
+ },
},
methods: {
diff --git a/pages/nft/create.vue b/pages/nft/create.vue
index 90d7c579..f9bb8fd6 100644
--- a/pages/nft/create.vue
+++ b/pages/nft/create.vue
@@ -134,7 +134,7 @@
@@ -173,6 +174,7 @@ import { ethers } from 'ethers';
import { useEthers } from 'vue-dapp';
import { useToast } from "vue-toastification/dist/index.mjs";
import ConnectWalletButton from "~/components/ConnectWalletButton.vue";
+import SwitchChainButton from '~/components/SwitchChainButton.vue';
import WaitingToast from "~/components/WaitingToast";
import FileUploadModal from "~/components/storage/FileUploadModal.vue";
import { useUserStore } from '~/store/user';
@@ -202,6 +204,7 @@ export default {
components: {
ConnectWalletButton,
FileUploadModal,
+ SwitchChainButton,
WaitingToast
},
@@ -245,6 +248,14 @@ export default {
fieldsValid() {
return this.cName && this.cSymbol && this.cImage && this.cDescription && this.nftName && this.ratio;
},
+
+ isSupportedChain() {
+ if (this.chainId === this.$config.supportedChainId) {
+ return true;
+ } else {
+ return false;
+ }
+ },
},
methods: {
@@ -338,7 +349,20 @@ export default {
}
} catch (e) {
console.error(e);
- this.toast(e.message, {type: "error"});
+
+ try {
+ let extractMessage = e.message.split("reason=")[1];
+ extractMessage = extractMessage.split(", method=")[0];
+ extractMessage = extractMessage.replace(/"/g, "");
+ extractMessage = extractMessage.replace('execution reverted:', "Error:");
+
+ console.log(extractMessage);
+
+ this.toast(extractMessage, {type: "error"});
+ } catch (e) {
+ this.toast("Transaction has failed.", {type: "error"});
+ }
+
this.waitingCreate = false;
}
}