From b5a492cd3ca2ecd277958562e4cef338f83da0e3 Mon Sep 17 00:00:00 2001 From: onmax Date: Wed, 23 Feb 2022 00:01:19 +0100 Subject: [PATCH] updated signBTCtx request to hub --- src/components/FeeSelector.vue | 19 ++++--------------- src/components/modals/BtcSendModal.vue | 20 +++++++++----------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/components/FeeSelector.vue b/src/components/FeeSelector.vue index 1ec73c836..537a78928 100644 --- a/src/components/FeeSelector.vue +++ b/src/components/FeeSelector.vue @@ -31,24 +31,13 @@ export default defineComponent({ const availableDelay = Math.min((fees as number[]).length - 1, delay.value); let fee = (fees as number[])[availableDelay] || 1; - let durationConfirmation = 0; - // Set minimum fees for each step if (Config.environment === ENV_MAIN) { switch (delay.value) { - case 1: - fee = Math.max(fee, 20); - durationConfirmation = 15 * 60; // 15 minutes - break; - case 12: - fee = Math.max(fee, 10); - durationConfirmation = 60 * 60 * 3; // 3 hours - break; - default: - fee = Math.max(fee, 5); - durationConfirmation = 60 * 60 * 6; // 6 hours - break; + case 1: fee = Math.max(fee, 20); break; + case 12: fee = Math.max(fee, 10); break; + default: fee = Math.max(fee, 5); break; } } else { switch (delay.value) { @@ -58,7 +47,7 @@ export default defineComponent({ } } - context.emit('fee', { fee, durationConfirmation }); + context.emit('fee', { fee, delay: delay.value }); }); const speed = computed(() => { diff --git a/src/components/modals/BtcSendModal.vue b/src/components/modals/BtcSendModal.vue index e6f286419..c36b83e8a 100644 --- a/src/components/modals/BtcSendModal.vue +++ b/src/components/modals/BtcSendModal.vue @@ -190,7 +190,7 @@ export default defineComponent({ } = useBtcLabelsStore(); const { state: network$, isFetchingTxHistory } = useBtcNetworkStore(); - const durationConfirmation = ref(3 * 60 * 60); // Fee selector has 2-4h option by default. Setting it as 3h. + const delay = ref(12); // Same value as Fee Selector default value const recipientWithLabel = ref<{address: string, label: string, type: RecipientType} | null>(null); @@ -346,11 +346,12 @@ export default defineComponent({ amount.value = maxSendableAmount.value; } - interface FeeSelectorEvent {fee: number; durationConfirmation: number} - function updateFee({ fee: newFeePerByte, durationConfirmation: _duration }: FeeSelectorEvent) { + interface FeeSelectorEvent {fee: number; delay: number} + function updateFee({ fee: newFeePerByte, delay: newDelay }: FeeSelectorEvent) { const isSendingMax = amount.value === maxSendableAmount.value; feePerByte.value = newFeePerByte; - durationConfirmation.value = _duration; + + delay.value = newDelay; if (isSendingMax) sendMax(); } @@ -462,8 +463,6 @@ export default defineComponent({ changeAddress = nextChangeAddress.value; } - const fiatCurrency = useAccountStore().activeCurrency; - try { const plainTx = await sendBtcTransaction({ accountId: useAccountStore().state.activeAccountId!, @@ -485,11 +484,10 @@ export default defineComponent({ value: requiredInputs.value.changeAmount, }, } : {}), - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - fiatCurrency: fiatCurrency.value, - fiatRate: exchangeRates.value.btc[activeCurrency.value], - durationConfirmation: durationConfirmation.value, + fiatCurrency: fiat$.currency, + fiatRate: exchangeRates.value.btc[fiat$.currency] || 0, // Hub will handle this + delay: delay.value, + feePerByte: feePerByte.value, }); if (!plainTx) {