diff --git a/src/App.tsx b/src/App.tsx index b0e5f00..8f1126a 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -3316,12 +3316,14 @@ function App() { > {messageQortalRequestExtension?.text3} - + + )} {messageQortalRequestExtension?.text4 && ( + <> + + )} {messageQortalRequestExtension?.html && ( diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 4e14b74..cdc7adb 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -2321,6 +2321,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) { @@ -2343,11 +2348,18 @@ 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 @@ -2459,7 +2471,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}`, @@ -2535,7 +2547,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}`, @@ -2610,7 +2622,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}`, @@ -3131,7 +3143,7 @@ const getBuyingFees = async (foreignBlockchain) => { unlock: { sats: unlockFee, fee: unlockFee / QORT_DECIMALS, - byteFee300: calculateFeeFromRate(+unlockFee, 300) / QORT_DECIMALS, + feePerKb: +calculateRateFromFee(+unlockFee, 300) / QORT_DECIMALS, }, }; }; @@ -3215,11 +3227,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