This commit is contained in:
PhilReact 2025-05-04 20:42:51 +03:00
parent 32143fd623
commit 6b091a9e64
2 changed files with 27 additions and 12 deletions

View File

@ -3316,12 +3316,14 @@ function App() {
> >
{messageQortalRequestExtension?.text3} {messageQortalRequestExtension?.text3}
</TextP> </TextP>
<Spacer height="15px" />
</Box> </Box>
<Spacer height="15px" />
</> </>
)} )}
{messageQortalRequestExtension?.text4 && ( {messageQortalRequestExtension?.text4 && (
<>
<Box <Box
sx={{ sx={{
display: "flex", display: "flex",
@ -3339,6 +3341,8 @@ function App() {
{messageQortalRequestExtension?.text4} {messageQortalRequestExtension?.text4}
</TextP> </TextP>
</Box> </Box>
<Spacer height="15px" />
</>
)} )}
{messageQortalRequestExtension?.html && ( {messageQortalRequestExtension?.html && (

View File

@ -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) => { export const updateForeignFee = async (data, isFromExtension) => {
const isGateway = await isRunningGateway(); const isGateway = await isRunningGateway();
if (isGateway) { if (isGateway) {
@ -2343,11 +2348,18 @@ export const getTxActivitySummary = async (data) => {
const { coin, type, value } = 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( 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'}`, text2: `type: ${type === 'feerequired' ? 'unlocking' : 'locking'}`,
text3: `value: ${value}`, text3: `value: ${text3}`,
text4,
highlightedText: `Coin: ${coin}`, highlightedText: `Coin: ${coin}`,
}, },
isFromExtension isFromExtension
@ -2459,7 +2471,7 @@ export const getTxActivitySummary = async (data) => {
const resPermission = await getUserPermission( 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}`, text2: `type: ${type}`,
text3: `host: ${host}`, text3: `host: ${host}`,
highlightedText: `Coin: ${coin}`, highlightedText: `Coin: ${coin}`,
@ -2535,7 +2547,7 @@ export const getTxActivitySummary = async (data) => {
const resPermission = await getUserPermission( 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}`, text2: `type: ${type}`,
text3: `host: ${host}`, text3: `host: ${host}`,
highlightedText: `Coin: ${coin}`, highlightedText: `Coin: ${coin}`,
@ -2610,7 +2622,7 @@ export const getTxActivitySummary = async (data) => {
const resPermission = await getUserPermission( 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}`, text2: `type: ${type}`,
text3: `host: ${host}`, text3: `host: ${host}`,
highlightedText: `Coin: ${coin}`, highlightedText: `Coin: ${coin}`,
@ -3131,7 +3143,7 @@ const getBuyingFees = async (foreignBlockchain) => {
unlock: { unlock: {
sats: unlockFee, sats: unlockFee,
fee: unlockFee / QORT_DECIMALS, 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);
<div class="fee-container"> <div class="fee-container">
<div class="fee-label">Total Unlocking Fee:</div> <div class="fee-label">Total Unlocking Fee:</div>
<div>${(+buyingFees?.unlock?.byteFee300 * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}</div> <div>${(+buyingFees?.unlock?.fee * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}</div>
<div class="fee-description"> <div class="fee-description">
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)} 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.
</div> </div>
<div class="fee-label">Total Locking Fee:</div> <div class="fee-label">Total Locking Fee:</div>
<div>${+buyingFees?.unlock.fee.toFixed(8)} ${buyingFees.ticker} per kb</div> <div>${+buyingFees?.unlock.fee.toFixed(8)} ${buyingFees.ticker} per kb</div>