diff --git a/src/components/popups/ProposalDeposit.vue b/src/components/popups/ProposalDeposit.vue index 6140000..d543e99 100644 --- a/src/components/popups/ProposalDeposit.vue +++ b/src/components/popups/ProposalDeposit.vue @@ -16,7 +16,8 @@ import { useClipboard } from "@vueuse/core"; import { useProposals } from "@/composables/useProposals"; import { useTelemetry } from "@/composables/useTelemetry"; -import { formatAmount } from "@/utility"; +import { formatAmount, toPlainObjectString } from "@/utility"; +import { DeliverTxResponse } from "@atomone/govgen-types/types"; interface Props { proposalId?: number; @@ -27,12 +28,12 @@ interface Props { const props = defineProps(); const isOpen = ref(false); -const displayState = ref<"deposited" | "CLI" | "pending">("pending"); +const displayState = ref<"deposited" | "CLI" | "pending" | "error">("pending"); const depositAmount = ref(null); - +const errorMsg = ref(""); const cliDepositInput = ref(""); - +const transacting = ref(false); const depositDenomDecimals = computed(() => { const currencies = chainConfig.currencies.filter((x) => x.coinMinimalDenom == props.depositDenom); if (currencies.length <= 0) { @@ -77,13 +78,21 @@ const signDeposit = async (isCLI = false) => { }, ], }; - - const depot = await depositProposal(depositOptions, isCLI); - //TODO: handle error and get result from chain - - cliDepositInput.value = (isCLI ? depot : "") as string; - displayState.value = isCLI ? "CLI" : "deposited"; - + try { + transacting.value = true; + const depot = await depositProposal(depositOptions, isCLI); + if ((depot as DeliverTxResponse).code !== 0) { + errorMsg.value = (depot as DeliverTxResponse).rawLog ?? toPlainObjectString(depot); + displayState.value = "error"; + } else { + cliDepositInput.value = (isCLI ? depot : "") as string; + displayState.value = isCLI ? "CLI" : "deposited"; + } + } catch (e) { + console.log(e); + errorMsg.value = "" + e; + displayState.value = "error"; + } logEvent("Sign Popup ProposalDeposit", { signOption: isCLI ? "CLI" : "GUI", }); @@ -132,7 +141,7 @@ const { copy, copied, isSupported: isClipboardSupported } = useClipboard(); -
+
+ +
+
+ +
+
@@ -211,6 +226,23 @@ const { copy, copied, isSupported: isClipboardSupported } = useClipboard();
+ + +
+ + + +
-
+
+ +
+
+ +
+
@@ -288,6 +309,24 @@ const { copy, copied, isSupported: isClipboardSupported } = useClipboard(); {{ $t("ui.actions.done") }} + +
+ + + + + +
diff --git a/src/components/proposals/ProposalWrapper.vue b/src/components/proposals/ProposalWrapper.vue index 7fa9cb4..4b3b58c 100644 --- a/src/components/proposals/ProposalWrapper.vue +++ b/src/components/proposals/ProposalWrapper.vue @@ -641,7 +641,7 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${ {{ $t("proposalpage.labels.messages") }}
@@ -662,7 +662,7 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
@@ -693,7 +693,7 @@ onMounted(() => (title.value = `GovGen — #${proposal.value?.proposal[0].id} ${
diff --git a/src/components/ui/UiInfo.vue b/src/components/ui/UiInfo.vue index b18cde2..685f85f 100644 --- a/src/components/ui/UiInfo.vue +++ b/src/components/ui/UiInfo.vue @@ -33,7 +33,7 @@ const isCircled = computed(() => props.circled || props.type === "succe
- +

{{ title }}

diff --git a/src/localization/index.ts b/src/localization/index.ts index ba30b97..39ded98 100644 --- a/src/localization/index.ts +++ b/src/localization/index.ts @@ -191,12 +191,14 @@ export const messages = { ProposalVote: { cta: "Vote", voted: "You voted", + error: "Error", weightedInstructions: "Define weight for each of the voting options. The sum of weights must be equal to 1.", }, ProposalDeposit: { cta: "Deposit", act: "deposited", deposited: "You deposited", + error: "Error", instructions: "Enter deposit amount", }, VotePanel: {