Selected multisig address
@@ -5038,9 +5038,39 @@
Fees
memoized: false,
memoizedFee: 0
};
+ let dynamicFeeCalculation = {
+ timestamp: null,
+ receivers: null,
+ totalAmount: 0
+ }
function calculateFees() {
if (getRef('fees_selector').value === 'custom') return;
if (getRef('receiver_container').children.length === 0) return;
+ const receivers = [...getRef('receiver_container').querySelectorAll('.receiver-input')].map(input => input.value.trim()).join('');
+ const totalAmount = [...getRef('receiver_container').querySelectorAll('.amount-input')].map(input => {
+ return parseFloat(input.value.trim())
+ }).reduce((a, b) => a + b, 0);
+ if (
+ dynamicFeeCalculation.receivers === receivers &&
+ Date.now() - dynamicFeeCalculation.timestamp < (1000 * 60 * 5) &&
+ dynamicFeeCalculation.totalAmount <= totalAmount
+ ) {
+ if (dynamicFeeCalculation.memoizedFee) {
+ getRef('send_fee').value = dynamicFeeCalculation.memoizedFee.toFixed(8);
+ renderElem(getRef('selected_fee_tip'), html``)
+ getRef('initiate_transaction').disabled = false;
+ } else {
+ getRef('fees_section').classList.add('hidden')
+ getRef('error_section').classList.remove('hidden')
+ renderElem(getRef('error_section'), html`
+
+
+ ${dynamicFeeCalculation.error}
+
+ `)
+ }
+ return
+ };
const allValid = [...getRef('receiver_container').querySelectorAll('sm-input')].every(input => input.isValid)
if (!allValid && feeMemo.memoized) return;
getRef('fees_selector').children[0].click();
@@ -5062,20 +5092,25 @@
Fees
getRef('send_fee').value = fee.toFixed(8);
renderElem(getRef('selected_fee_tip'), html``)
getRef('initiate_transaction').disabled = false;
+ dynamicFeeCalculation.memoizedFee = fee;
}).catch(e => {
getRef('fees_section').classList.add('hidden')
getRef('error_section').classList.remove('hidden')
renderElem(getRef('error_section'), html`
-
-
+
+
${e}
-
- `)
+
+ `)
+ dynamicFeeCalculation.memoizedFee = null;
+ dynamicFeeCalculation.error = e;
console.error(e)
}).finally(_ => {
getRef('send_fee_loader').animate(fadeOut, animOptions).onfinish = _ =>
getRef('send_fee_loader').classList.add('hidden')
-
+ dynamicFeeCalculation.receivers = receivers;
+ dynamicFeeCalculation.timestamp = Date.now();
+ dynamicFeeCalculation.totalAmount = totalAmount;
})
feeMemo.memoized = false;
} else {
@@ -5168,47 +5203,7 @@
Fees
}
const messengerIllustration = `
-
`
+
`
document.querySelectorAll('.messenger-illustration').forEach(elem => {
elem.innerHTML = messengerIllustration
})