From 29f6f6ecf25f892f33e0f4e8d027852ecf78c72a Mon Sep 17 00:00:00 2001 From: marcomariscal Date: Fri, 28 Jun 2024 16:31:15 -0700 Subject: [PATCH] feat: handle need sig --- frontend/src/components/WithdrawForm.vue | 7 +++++-- frontend/src/i18n/locales/en-US.json | 1 + frontend/src/i18n/locales/zh-CN.json | 1 + frontend/src/store/wallet.ts | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/WithdrawForm.vue b/frontend/src/components/WithdrawForm.vue index 3659e3da8..ec0f52f11 100644 --- a/frontend/src/components/WithdrawForm.vue +++ b/frontend/src/components/WithdrawForm.vue @@ -18,8 +18,8 @@ emit('initializeWithdraw'); setIsInWithdrawFlow(true); " - :appendButtonLabel="$t('WithdrawForm.withdraw')" - :appendButtonDisable="isInWithdrawFlow || isFeeLoading" + :appendButtonLabel="needSignature ? $t('WithdrawForm.need-signature') : $t('WithdrawForm.withdraw')" + :appendButtonDisable="isInWithdrawFlow || isFeeLoading || needSignature" :appendButtonLoading="isInWithdrawFlow" :disable="isInWithdrawFlow" :label="$t('WithdrawForm.address')" @@ -119,11 +119,13 @@ export default defineComponent({ advancedMode: { type: Boolean, required: true, + default: true, }, }, setup(data, { emit }) { const { NATIVE_TOKEN } = useWalletStore(); const { setIsInWithdrawFlow, isInWithdrawFlow } = useStatusesStore(); + const { needSignature } = useWalletStore(); const content = ref(data.destinationAddress || ''); const nativeTokenSymbol = NATIVE_TOKEN.value.symbol; @@ -138,6 +140,7 @@ export default defineComponent({ emitUpdateDestinationAddress, content, nativeTokenSymbol, + needSignature, isInWithdrawFlow, setIsInWithdrawFlow, }; diff --git a/frontend/src/i18n/locales/en-US.json b/frontend/src/i18n/locales/en-US.json index a7f7e869f..0b4580900 100644 --- a/frontend/src/i18n/locales/en-US.json +++ b/frontend/src/i18n/locales/en-US.json @@ -358,6 +358,7 @@ "view-on-explorer": "View on explorer" }, "WithdrawForm": { + "need-signature": "Need Signature", "withdraw-address": "Enter address to withdraw funds to", "address": "Address", "fetching-fee-estimate": "Fetching fee estimate...", diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json index deddc5a19..def367d02 100644 --- a/frontend/src/i18n/locales/zh-CN.json +++ b/frontend/src/i18n/locales/zh-CN.json @@ -357,6 +357,7 @@ "view-on-explorer": "在区块链浏览器上查看" }, "WithdrawForm": { + "need-signature": "此应用程序需要您的签名才能扫描您收到的资金", "withdraw-address": "输入提款地址", "address": "地址", "fetching-fee-estimate": "在接收费用估计...", diff --git a/frontend/src/store/wallet.ts b/frontend/src/store/wallet.ts index 5fbb3f6db..e886d1203 100644 --- a/frontend/src/store/wallet.ts +++ b/frontend/src/store/wallet.ts @@ -592,7 +592,7 @@ export default function useWalletStore() { // "Direct" properties, i.e. return them directly without modification balances: computed(() => balances.value), stealthKeyRegistry: computed(() => stealthKeyRegistry.value), - hasKeys: computed(() => spendingKeyPair.value?.privateKeyHex && viewingKeyPair.value?.privateKeyHex), + hasKeys: computed(() => !!spendingKeyPair.value?.privateKeyHex && !!viewingKeyPair.value?.privateKeyHex), network: computed(() => network.value), isAccountSetup: computed(() => isAccountSetup.value), isAccountSetupLegacy: computed(() => hasEnsKeys.value || hasCnsKeys.value), // LEGACY @@ -615,6 +615,7 @@ export default function useWalletStore() { tokens: computed(() => tokens.value), userDisplayName: computed(() => userDisplayName.value), connectedWalletLabel: computed(() => lastWallet), + needSignature: computed(() => !spendingKeyPair.value?.privateKeyHex || !viewingKeyPair.value?.privateKeyHex), }; }