diff --git a/src/App.tsx b/src/App.tsx index fdd735e..c6fb714 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3125,12 +3125,14 @@ function App() { > {messageQortalRequestExtension?.text3} - + + )} {messageQortalRequestExtension?.text4 && ( + <> + + )} {messageQortalRequestExtension?.html && ( diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index aa1e6f7..cf04b2f 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -2377,6 +2377,11 @@ export const getTxActivitySummary = async (data) => { } }; + function calculateRateFromFee(totalFee, sizeInBytes) { + const fee = (totalFee / sizeInBytes) * 1000; + return fee.toFixed(0); + } + export const updateForeignFee = async (data, isFromExtension) => { const isGateway = await isRunningGateway(); if (isGateway) { @@ -2399,11 +2404,19 @@ export const getTxActivitySummary = async (data) => { const { coin, type, value } = data; + const text3 = + type === 'feerequired' ? `${value} sats` : `${value} sats per kb`; + const text4 = + type === 'feerequired' + ? `*The ${value} sats fee is derived from ${calculateRateFromFee(value, 300)} sats per kb, for a transaction that is approximately 300 bytes in size.` + : ''; + const resPermission = await getUserPermission( { - text1: `Do you give this application to update foreign fees on your node?`, + text1: `Do you give this application permission to update foreign fees on your node?`, text2: `type: ${type === 'feerequired' ? 'unlocking' : 'locking'}`, - text3: `value: ${value}`, + text3: `value: ${text3}`, + text4, highlightedText: `Coin: ${coin}`, }, isFromExtension @@ -2515,7 +2528,7 @@ export const getTxActivitySummary = async (data) => { const resPermission = await getUserPermission( { - text1: `Do you give this application to set the current server?`, + text1: `Do you give this application permission to set the current server?`, text2: `type: ${type}`, text3: `host: ${host}`, highlightedText: `Coin: ${coin}`, @@ -2590,7 +2603,7 @@ export const getTxActivitySummary = async (data) => { const resPermission = await getUserPermission( { - text1: `Do you give this application to add a server?`, + text1: `Do you give this application permission to add a server?`, text2: `type: ${type}`, text3: `host: ${host}`, highlightedText: `Coin: ${coin}`, @@ -2665,7 +2678,7 @@ export const getTxActivitySummary = async (data) => { const resPermission = await getUserPermission( { - text1: `Do you give this application to remove a server?`, + text1: `Do you give this application permission to remove a server?`, text2: `type: ${type}`, text3: `host: ${host}`, highlightedText: `Coin: ${coin}`, @@ -3191,7 +3204,7 @@ const getBuyingFees = async (foreignBlockchain) => { unlock: { sats: unlockFee, fee: unlockFee / QORT_DECIMALS, - byteFee300: calculateFeeFromRate(+unlockFee, 300) / QORT_DECIMALS, + feePerKb: +calculateRateFromFee(+unlockFee, 300) / QORT_DECIMALS, }, }; }; @@ -3278,10 +3291,10 @@ const crosschainAtInfo = await Promise.all(atPromises);
Total Unlocking Fee:
-
${(+buyingFees?.unlock?.byteFee300 * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}
-
- This fee is an estimate based on ${atAddresses?.length} ${atAddresses?.length > 1 ? 'orders' : 'order'} at a 300 byte cost of ${buyingFees?.unlock?.byteFee300?.toFixed(8)} -
+
${(+buyingFees?.unlock?.fee * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}
+
+ This fee is an estimate based on ${atAddresses?.length} ${atAddresses?.length > 1 ? 'orders' : 'order'}, assuming a 300-byte size at a rate of ${buyingFees?.unlock?.feePerKb?.toFixed(8)} ${buyingFees.ticker} per KB. +
Total Locking Fee:
${+buyingFees?.unlock.fee.toFixed(8)} ${buyingFees.ticker} per kb