Add transaltions

This commit is contained in:
Nicola Benaglia 2025-05-23 15:02:50 +02:00
parent a89de90ee0
commit 421996b572
2 changed files with 39 additions and 10 deletions

View File

@ -11,6 +11,8 @@
"message": {
"error": {
"add_to_list": "failed to add to list",
"at_info": "cannot find AT info.",
"buy_order": "failed to submit trade order",
"cancel_sell_order": "failed to Cancel Sell Order. Try again!",
"copy_clipboard": "failed to copy to clipboard",
"create_sell_order": "failed to Create Sell Order. Try again!",
@ -20,13 +22,14 @@
"encrypt": "unable to encrypt",
"encryption_failed": "encryption failed",
"encryption_requires_public_key": "encrypting data requires public keys",
"fetch_balance": "unable to fetch balance",
"fetch_balance_token": "failed to fetch {{ token }} Balance. Try again!",
"fetch_balance": "unable to fetch balance",
"fetch_generic": "unable to fetch",
"fetch_group": "failed to fetch the group",
"fetch_list": "failed to fetch the list",
"fetch_poll": "failed to fetch poll",
"fetch_recipient_public_key": "failed to fetch recipient's public key",
"get_foreign_fee": "error in get foreign fee",
"insufficient_balance_qort": "your QORT balance is insufficient",
"insufficient_balance": "your asset balance is insufficient",
"insufficient_funds": "insufficient funds",
@ -51,8 +54,8 @@
"send": "failed to send",
"submit_sell_order": "failed to submit sell order",
"timeout_request": "request timed out",
"get_foreign_fee": "error in get foreign fee",
"update_foreign_fee": "failed to update foreign fee",
"update_tradebot": "unable to update tradebot",
"upload_encryption": "upload failed due to failed encryption",
"user_qortal_name": "user has no Qortal name"
},
@ -92,6 +95,8 @@
"permission_pay_publish": "do you give this application permission to make the following payments and publishes?",
"permission_publish_qdn": "do you give this application permission to publish to QDN?",
"permission_remove_from_list": "do you give this application permission to remove the following from the list {{ name }}:",
"permission_sell_order": "do you give this application permission to perform a sell order?",
"permission_sell_order_detail": "{{ qort_amount }} QORT for {{ foreign_amount }} {{ ticker }}",
"permission_send_coins": "do you give this application permission to send coins?",
"permission_transfer_asset": "do you give this application permission to transfer the following asset?",
"poll": "poll: {{ name }}",

View File

@ -4335,7 +4335,12 @@ export const createBuyOrder = async (data, isFromExtension) => {
);
}
} catch (error) {
throw new Error(error?.message || 'Failed to submit trade order.');
throw new Error(
error?.message ||
i18n.t('question:message.error.buy_order', {
postProcess: 'capitalizeFirstChar',
})
);
}
};
@ -4352,7 +4357,14 @@ const cancelTradeOfferTradeBot = async (body, keyPair) => {
body: bodyToString,
});
if (!deleteTradeBotResponse.ok) throw new Error('Unable to update tradebot');
if (!deleteTradeBotResponse.ok) {
throw new Error(
i18n.t('question:message.error.update_tradebot', {
postProcess: 'capitalizeFirstChar',
})
);
}
const unsignedTxn = await deleteTradeBotResponse.text();
const signedTxnBytes = await signTradeBotTransaction(unsignedTxn, keyPair);
const signedBytes = Base58.encode(signedTxnBytes);
@ -4505,11 +4517,15 @@ export const createSellOrder = async (data, isFromExtension) => {
try {
const resPermission = await getUserPermission(
{
text1:
'Do you give this application permission to perform a sell order?',
text2: `${data.qortAmount}${' '}
${`QORT`}`,
text3: `FOR ${parsedForeignAmount} ${data.foreignBlockchain}`,
text1: i18n.t('question:permission_sell_order', {
postProcess: 'capitalizeFirstChar',
}),
text2: i18n.t('question:permission_sell_order_detail', {
qort_amount: data.qortAmount,
foreign_amount: parsedForeignAmount,
ticker: data.foreignBlockchain,
postProcess: 'capitalizeFirstChar',
}),
fee: '0.02',
},
isFromExtension
@ -4559,6 +4575,7 @@ export const createSellOrder = async (data, isFromExtension) => {
export const cancelSellOrder = async (data, isFromExtension) => {
const requiredFields = ['atAddress'];
const missingFields: string[] = [];
requiredFields.forEach((field) => {
if (!data[field]) {
missingFields.push(field);
@ -4576,7 +4593,14 @@ export const cancelSellOrder = async (data, isFromExtension) => {
const url = await createEndpoint(`/crosschain/trade/${data.atAddress}`);
const resAddress = await fetch(url);
const resData = await resAddress.json();
if (!resData?.qortalAtAddress) throw new Error('Cannot find AT info.');
if (!resData?.qortalAtAddress)
throw new Error(
i18n.t('question:message.error.at_info', {
postProcess: 'capitalizeFirstChar',
})
);
try {
const fee = await getFee('MESSAGE');