diff --git a/src/i18n/locales/en/question.json b/src/i18n/locales/en/question.json index 542ee8d..28000a5 100644 --- a/src/i18n/locales/en/question.json +++ b/src/i18n/locales/en/question.json @@ -47,6 +47,7 @@ "registered_name": "a registered name is needed to publish", "retrieve_file": "failed to retrieve file", "retrieve_keys": "unable to retrieve keys", + "same_foreign_blockchain": "all requested ATs need to be of the same foreign Blockchain.", "send": "failed to send", "submit_sell_order": "failed to submit sell order", "timeout_request": "request timed out", @@ -79,6 +80,12 @@ "permission_all_item_list": "do you give this application permission to add the following to the list {{ name }}:", "permission_authenticate": "do you give this application permission to authenticate?", "permission_buy_order": "do you give this application permission to perform a buy order?", + "permission_buy_order_fee_estimation_one": "this fee is an estimate based on {{ quantity }} order, assuming a 300-byte size at a rate of {{ fee }} {{ ticker }} per KB.", + "permission_buy_order_fee_estimation_other": "this fee is an estimate based on {{ quantity }} orders, assuming a 300-byte size at a rate of {{ fee }} {{ ticker }} per KB.", + "permission_buy_order_per_kb": "{{ fee }} {{ ticker }} per kb", + "permission_buy_order_quantity_one": "{{ quantity }} buy order", + "permission_buy_order_quantity_other": "{{ quantity }} buy orders", + "permission_buy_order_ticker": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}", "permission_fetch_balance": "do you give this application permission to fetch your {{ coin }} balance", "permission_list_hosted_data": "do you give this application permission to get a list of your hosted data?", "permission_delete_hosts_resources": "do you give this application permission to delete {{ size }} hosted resources?", @@ -90,5 +97,7 @@ "poll": "poll: {{ name }}", "request_create_poll": "you are requesting to create the poll below:", "request_vote_poll": "you are being requested to vote on the poll below:", - "to_recipient": "to: {{ recipient }}" + "to_recipient": "to: {{ recipient }}", + "total_locking_fee": "total Locking Fee:", + "total_unlocking_fee": "total Unlocking Fee:" } diff --git a/src/qortalRequests/get.ts b/src/qortalRequests/get.ts index 832cc9e..90218e7 100644 --- a/src/qortalRequests/get.ts +++ b/src/qortalRequests/get.ts @@ -4229,7 +4229,9 @@ export const createBuyOrder = async (data, isFromExtension) => { const resData = await resAddress.json(); if (foreignBlockchain !== resData?.foreignBlockchain) { throw new Error( - 'All requested ATs need to be of the same foreign Blockchain.' + i18n.t('core:message.error.same_foreign_blockchain', { + postProcess: 'capitalizeFirstChar', + }) ); } return resData; @@ -4237,23 +4239,30 @@ export const createBuyOrder = async (data, isFromExtension) => { ); const crosschainAtInfo = await Promise.all(atPromises); + try { const buyingFees = await getBuyingFees(foreignBlockchain); const resPermission = await getUserPermission( { text1: i18n.t('question:permission_buy_order', { postProcess: 'capitalizeFirstChar', - }), // TODO translate better - text2: `${atAddresses?.length}${' '} - ${`buy order${atAddresses?.length === 1 ? '' : 's'}`}`, - text3: `${crosschainAtInfo?.reduce((latest, cur) => { - return latest + +cur?.qortAmount; - }, 0)} QORT FOR ${roundUpToDecimals( - crosschainAtInfo?.reduce((latest, cur) => { - return latest + +cur?.expectedForeignAmount; - }, 0) - )} - ${` ${buyingFees.ticker}`}`, + }), + text2: i18n.t('question:permission_buy_order_quantity', { + quantity: atAddresses?.length, + postProcess: 'capitalizeFirstChar', + }), + text3: i18n.t('question:permission_buy_order_ticker', { + qort_amount: crosschainAtInfo?.reduce((latest, cur) => { + return latest + +cur?.qortAmount; + }, 0), + foreign_amount: roundUpToDecimals( + crosschainAtInfo?.reduce((latest, cur) => { + return latest + +cur?.expectedForeignAmount; + }, 0) + ), + ticker: buyingFees.ticker, + postProcess: 'capitalizeFirstChar', + }), highlightedText: i18n.t('auth:node.using_public_gateway', { gateway: isGateway, postProcess: 'capitalizeFirstChar', @@ -4283,15 +4292,27 @@ export const createBuyOrder = async (data, isFromExtension) => {