Skip to content

Commit

Permalink
updated signBTCtx request to hub
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Feb 22, 2022
1 parent 3feb0b8 commit b5a492c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
19 changes: 4 additions & 15 deletions src/components/FeeSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -58,7 +47,7 @@ export default defineComponent({
}
}
context.emit('fee', { fee, durationConfirmation });
context.emit('fee', { fee, delay: delay.value });
});
const speed = computed(() => {
Expand Down
20 changes: 9 additions & 11 deletions src/components/modals/BtcSendModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -462,8 +463,6 @@ export default defineComponent({
changeAddress = nextChangeAddress.value;
}
const fiatCurrency = useAccountStore().activeCurrency;
try {
const plainTx = await sendBtcTransaction({
accountId: useAccountStore().state.activeAccountId!,
Expand All @@ -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) {
Expand Down

0 comments on commit b5a492c

Please sign in to comment.