This commit is contained in:
PhilReact 2025-05-04 20:42:31 +03:00
parent a7a4cb18da
commit a8209b5522
3 changed files with 54 additions and 39 deletions

View File

@ -3316,8 +3316,8 @@ function App() {
>
{messageQortalRequestExtension?.text3}
</TextP>
<Spacer height="15px" />
</Box>
<Spacer height="15px" />
</>
)}

View File

@ -159,6 +159,9 @@ export const AddGroup = ({ address, open, setOpen }) => {
},
...prev,
]);
setName('');
setDescription('');
setGroupType('1');
res(response);
return;
}
@ -430,12 +433,12 @@ export const AddGroup = ({ address, open, setOpen }) => {
onChange={handleChangeApprovalThreshold}
>
<MenuItem value={0}>
{t('core.count.none', {
{t('core:count.none', {
postProcess: 'capitalize',
})}
</MenuItem>
<MenuItem value={1}>
{t('core.count.one', {
{t('core:count.one', {
postProcess: 'capitalize',
})}
</MenuItem>
@ -454,7 +457,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
}}
>
<Label>
{t('group.block_delay.minimum', {
{t('group:block_delay.minimum', {
postProcess: 'capitalize',
})}
</Label>
@ -466,40 +469,40 @@ export const AddGroup = ({ address, open, setOpen }) => {
onChange={handleChangeMinBlock}
>
<MenuItem value={5}>
{t('core.time.minute', { count: 5 })}
{t('core:time.minute', { count: 5 })}
</MenuItem>
<MenuItem value={10}>
{t('core.time.minute', { count: 10 })}
{t('core:time.minute', { count: 10 })}
</MenuItem>
<MenuItem value={30}>
{t('core.time.minute', { count: 30 })}
{t('core:time.minute', { count: 30 })}
</MenuItem>
<MenuItem value={60}>
{t('core.time.hour', { count: 1 })}
{t('core:time.hour', { count: 1 })}
</MenuItem>
<MenuItem value={180}>
{t('core.time.hour', { count: 3 })}
{t('core:time.hour', { count: 3 })}
</MenuItem>
<MenuItem value={300}>
{t('core.time.hour', { count: 5 })}
{t('core:time.hour', { count: 5 })}
</MenuItem>
<MenuItem value={420}>
{t('core.time.hour', { count: 7 })}
{t('core:time.hour', { count: 7 })}
</MenuItem>
<MenuItem value={720}>
{t('core.time.hour', { count: 12 })}
{t('core:time.hour', { count: 12 })}
</MenuItem>
<MenuItem value={1440}>
{t('core.time.day', { count: 1 })}
{t('core:time.day', { count: 1 })}
</MenuItem>
<MenuItem value={4320}>
{t('core.time.day', { count: 3 })}
{t('core:time.day', { count: 3 })}
</MenuItem>
<MenuItem value={7200}>
{t('core.time.day', { count: 5 })}
{t('core:time.day', { count: 5 })}
</MenuItem>
<MenuItem value={10080}>
{t('core.time.day', { count: 7 })}
{t('core:time.day', { count: 7 })}
</MenuItem>
</Select>
</Box>
@ -511,7 +514,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
}}
>
<Label>
{t('group.block_delay.maximum', {
{t('group:block_delay.maximum', {
postProcess: 'capitalize',
})}
</Label>
@ -523,37 +526,37 @@ export const AddGroup = ({ address, open, setOpen }) => {
onChange={handleChangeMaxBlock}
>
<MenuItem value={60}>
{t('core.time.hour', { count: 1 })}
{t('core:time.hour', { count: 1 })}
</MenuItem>
<MenuItem value={180}>
3{t('core.time.hour', { count: 3 })}
3{t('core:time.hour', { count: 3 })}
</MenuItem>
<MenuItem value={300}>
{t('core.time.hour', { count: 5 })}
{t('core:time.hour', { count: 5 })}
</MenuItem>
<MenuItem value={420}>
{t('core.time.hour', { count: 7 })}
{t('core:time.hour', { count: 7 })}
</MenuItem>
<MenuItem value={720}>
{t('core.time.hour', { count: 12 })}
{t('core:time.hour', { count: 12 })}
</MenuItem>
<MenuItem value={1440}>
{t('core.time.day', { count: 1 })}
{t('core:time.day', { count: 1 })}
</MenuItem>
<MenuItem value={4320}>
{t('core.time.day', { count: 3 })}
{t('core:time.day', { count: 3 })}
</MenuItem>
<MenuItem value={7200}>
{t('core.time.day', { count: 5 })}
{t('core:time.day', { count: 5 })}
</MenuItem>
<MenuItem value={10080}>
{t('core.time.day', { count: 7 })}
{t('core:time.day', { count: 7 })}
</MenuItem>
<MenuItem value={14400}>
{t('core.time.day', { count: 10 })}
{t('core:time.day', { count: 10 })}
</MenuItem>
<MenuItem value={21600}>
{t('core.time.day', { count: 15 })}
{t('core:time.day', { count: 15 })}
</MenuItem>
</Select>
</Box>
@ -570,7 +573,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
color="primary"
onClick={handleCreateGroup}
>
{t('group.action.create', {
{t('group:action.create_group', {
postProcess: 'capitalize',
})}
</Button>

View File

@ -2655,6 +2655,11 @@ export const getForeignFee = 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) {
@ -2677,11 +2682,18 @@ export const updateForeignFee = async (data, isFromExtension) => {
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
@ -2792,7 +2804,7 @@ export const setCurrentForeignServer = async (data, isFromExtension) => {
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}`,
@ -2863,7 +2875,7 @@ export const addForeignServer = async (data, isFromExtension) => {
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}`,
@ -2934,7 +2946,7 @@ export const removeForeignServer = async (data, isFromExtension) => {
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}`,
@ -3559,7 +3571,7 @@ const getBuyingFees = async (foreignBlockchain) => {
unlock: {
sats: unlockFee,
fee: unlockFee / QORT_DECIMALS,
byteFee300: calculateFeeFromRate(+unlockFee, 300) / QORT_DECIMALS,
feePerKb: +calculateRateFromFee(+unlockFee, 300) / QORT_DECIMALS,
},
};
};
@ -3641,10 +3653,10 @@ export const createBuyOrder = async (data, isFromExtension) => {
<div class="fee-container">
<div class="fee-label">Total Unlocking Fee:</div>
<div>${(+buyingFees?.unlock?.byteFee300 * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}</div>
<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)}
</div>
<div>${(+buyingFees?.unlock?.fee * atAddresses?.length)?.toFixed(8)} ${buyingFees.ticker}</div>
<div class="fee-description">
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 class="fee-label">Total Locking Fee:</div>
<div>${+buyingFees?.lock.fee.toFixed(8)} ${buyingFees.ticker} per kb</div>