mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-06 16:36:58 +00:00
Refactor unable_ from auth
This commit is contained in:
parent
cc3002a085
commit
37672c309b
@ -1,4 +1,5 @@
|
|||||||
import { getBaseApi } from '../background';
|
import { getBaseApi } from '../background';
|
||||||
|
import i18n from '../i18n/i18n';
|
||||||
import {
|
import {
|
||||||
createSymmetricKeyAndNonce,
|
createSymmetricKeyAndNonce,
|
||||||
decryptGroupData,
|
decryptGroupData,
|
||||||
@ -40,7 +41,11 @@ async function findUsableApi() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error('No usable API found');
|
throw new Error(
|
||||||
|
i18n.t('question:message.error.no_api_found', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getSaveWallet() {
|
async function getSaveWallet() {
|
||||||
@ -178,7 +183,11 @@ export const encryptAndPublishSymmetricKeyGroupChat = async ({
|
|||||||
numberOfMembers: groupmemberPublicKeys.length,
|
numberOfMembers: groupmemberPublicKeys.length,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Cannot encrypt content');
|
throw new Error(
|
||||||
|
i18n.t('auth:message.error.encrypt_content', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.message);
|
throw new Error(error.message);
|
||||||
@ -242,7 +251,11 @@ export const encryptAndPublishSymmetricKeyGroupChatForAdmins = async ({
|
|||||||
numberOfMembers: groupmemberPublicKeys.length,
|
numberOfMembers: groupmemberPublicKeys.length,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Cannot encrypt content');
|
throw new Error(
|
||||||
|
i18n.t('auth:message.error.encrypt_content', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.message);
|
throw new Error(error.message);
|
||||||
@ -256,7 +269,12 @@ export const publishGroupEncryptedResource = async ({
|
|||||||
try {
|
try {
|
||||||
if (encryptedData && identifier) {
|
if (encryptedData && identifier) {
|
||||||
const registeredName = await getNameInfo();
|
const registeredName = await getNameInfo();
|
||||||
if (!registeredName) throw new Error('You need a name to publish');
|
if (!registeredName)
|
||||||
|
throw new Error(
|
||||||
|
i18n.t('core:message.generic.name_publish', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
const data = await publishData({
|
const data = await publishData({
|
||||||
registeredName,
|
registeredName,
|
||||||
file: encryptedData,
|
file: encryptedData,
|
||||||
@ -268,7 +286,11 @@ export const publishGroupEncryptedResource = async ({
|
|||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Cannot encrypt content');
|
throw new Error(
|
||||||
|
i18n.t('auth:message.error.encrypt_content', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
throw new Error(error.message);
|
throw new Error(error.message);
|
||||||
@ -291,7 +313,12 @@ export const publishOnQDN = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
if (data && service) {
|
if (data && service) {
|
||||||
const registeredName = await getNameInfo();
|
const registeredName = await getNameInfo();
|
||||||
if (!registeredName) throw new Error('You need a name to publish');
|
if (!registeredName)
|
||||||
|
throw new Error(
|
||||||
|
i18n.t('core:message.generic.name_publish', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const res = await publishData({
|
const res = await publishData({
|
||||||
registeredName,
|
registeredName,
|
||||||
|
@ -162,7 +162,7 @@ export const AdminSpaceInner = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
message:
|
message:
|
||||||
response?.error ||
|
response?.error ||
|
||||||
t('auth:message.error.unable_reencrypt_secret_key', {
|
t('auth:message.error.reencrypt_secret_key', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
@ -173,7 +173,7 @@ export const AdminSpaceInner = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
message:
|
message:
|
||||||
error?.message ||
|
error?.message ||
|
||||||
t('auth:message.error.unable_reencrypt_secret_key', {
|
t('auth:message.error.reencrypt_secret_key', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -85,7 +85,7 @@ export const AttachmentCard = ({
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
t('auth:message.error.unable_decrypt', {
|
t('auth:message.error.decrypt', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -180,7 +180,7 @@ export const Embed = ({ embedLink }) => {
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
t('auth:message.error.unable_decrypt', {
|
t('auth:message.error.decrypt', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -141,7 +141,7 @@ export const BlockedUsersModal = () => {
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
message:
|
message:
|
||||||
error?.message ||
|
error?.message ||
|
||||||
t('auth:message.error.unable_block_user', {
|
t('auth:message.error.block_user', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -359,7 +359,7 @@ export const NotAuthenticated = ({
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(
|
console.error(
|
||||||
it('auth:message.error.unable_set_apikey', {
|
it('auth:message.error.set_apikey', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
error.message ||
|
error.message ||
|
||||||
@ -398,7 +398,7 @@ export const NotAuthenticated = ({
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(
|
console.error(
|
||||||
it('auth:message.error.unable_set_apikey', {
|
it('auth:message.error.set_apikey', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
error.message ||
|
error.message ||
|
||||||
@ -682,7 +682,7 @@ export const NotAuthenticated = ({
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(
|
console.error(
|
||||||
it('auth:message.error.unable_set_apikey', {
|
it('auth:message.error.set_apikey', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
error.message ||
|
error.message ||
|
||||||
@ -836,7 +836,7 @@ export const NotAuthenticated = ({
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(
|
console.error(
|
||||||
it('auth:message.error.unable_set_apikey', {
|
it('auth:message.error.set_apikey', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
error.message ||
|
error.message ||
|
||||||
@ -902,7 +902,7 @@ export const NotAuthenticated = ({
|
|||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error(
|
console.error(
|
||||||
it('auth:message.error.unable_set_apikey', {
|
it('auth:message.error.set_apikey', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
}),
|
}),
|
||||||
error.message ||
|
error.message ||
|
||||||
|
@ -52,18 +52,19 @@
|
|||||||
"error": {
|
"error": {
|
||||||
"account_creation": "could not create account.",
|
"account_creation": "could not create account.",
|
||||||
"address_not_existing": "address does not exist on blockchain",
|
"address_not_existing": "address does not exist on blockchain",
|
||||||
|
"block_user": "unable to block user",
|
||||||
"decrypt_data": "could not decrypt data",
|
"decrypt_data": "could not decrypt data",
|
||||||
|
"decrypt": "unable to decrypt",
|
||||||
|
"encrypt_content": "cannot encrypt content",
|
||||||
|
"fetch_user_account": "unable to fetch user account",
|
||||||
"field_not_found_json": "{{ field }} not found in JSON",
|
"field_not_found_json": "{{ field }} not found in JSON",
|
||||||
"incorrect_password": "incorrect password",
|
"incorrect_password": "incorrect password",
|
||||||
"invalid_qortal_link": "invalid qortal link",
|
"invalid_qortal_link": "invalid qortal link",
|
||||||
"invalid_secret_key": "secretKey is not valid",
|
"invalid_secret_key": "secretKey is not valid",
|
||||||
"name_not_existing": "name does not exist",
|
"name_not_existing": "name does not exist",
|
||||||
"name_not_registered": "name not registered",
|
"name_not_registered": "name not registered",
|
||||||
"unable_block_user": "unable to block user",
|
"reencrypt_secret_key": "unable to re-encrypt secret key",
|
||||||
"unable_set_apikey": "failed to set API key:",
|
"set_apikey": "failed to set API key:"
|
||||||
"unable_fetch_user_account": "unable to fetch user account",
|
|
||||||
"unable_decrypt": "unable to decrypt",
|
|
||||||
"unable_reencrypt_secret_key": "unable to re-encrypt secret key"
|
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
"blocked_addresses": "blocked addresses- blocks processing of txs",
|
"blocked_addresses": "blocked addresses- blocks processing of txs",
|
||||||
|
@ -15,14 +15,18 @@
|
|||||||
"create_tradebot": "unable to create tradebot",
|
"create_tradebot": "unable to create tradebot",
|
||||||
"decrypt": "unable to decrypt",
|
"decrypt": "unable to decrypt",
|
||||||
"encrypt": "unable to encrypt",
|
"encrypt": "unable to encrypt",
|
||||||
|
"encryption_requires_public_key": "encrypting data requires public keys",
|
||||||
"fetch_balance": "unable to fetch balance",
|
"fetch_balance": "unable to fetch balance",
|
||||||
"fetch_group": "failed to fetch the group",
|
"fetch_group": "failed to fetch the group",
|
||||||
"fetch_list": "failed to fetch the list",
|
"fetch_list": "failed to fetch the list",
|
||||||
"fetch_poll": "failed to fetch poll",
|
"fetch_poll": "failed to fetch poll",
|
||||||
"insufficient_balance_qort": "your QORT balance is insufficient",
|
"insufficient_balance_qort": "your QORT balance is insufficient",
|
||||||
"insufficient_balance": "your asset balance is insufficient",
|
"insufficient_balance": "your asset balance is insufficient",
|
||||||
|
"insufficient_funds": "insufficient funds",
|
||||||
"missing_fields": "missing fields: {{ fields }}",
|
"missing_fields": "missing fields: {{ fields }}",
|
||||||
|
"no_api_found": "no usable API found",
|
||||||
"no_data_encrypted_resource": "no data in the encrypted resource",
|
"no_data_encrypted_resource": "no data in the encrypted resource",
|
||||||
|
"no_data_file_submitted": "no data or file was submitted",
|
||||||
"no_group_found": "group not found",
|
"no_group_found": "group not found",
|
||||||
"no_group_key": "no group key found",
|
"no_group_key": "no group key found",
|
||||||
"no_poll": "poll not found",
|
"no_poll": "poll not found",
|
||||||
@ -32,7 +36,9 @@
|
|||||||
"submit_sell_order": "failed to submit sell order",
|
"submit_sell_order": "failed to submit sell order",
|
||||||
"timeout_request": "request timed out",
|
"timeout_request": "request timed out",
|
||||||
"update_foreign_fee": "failed to update foreign fee",
|
"update_foreign_fee": "failed to update foreign fee",
|
||||||
"user_declined_request": "user declined request"
|
"upload_encryption": "upload failed due to failed encryption",
|
||||||
|
"user_declined_request": "user declined request",
|
||||||
|
"user_qortal_name": "user has no Qortal name"
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
"include_data_decrypt": "please include data to decrypt",
|
"include_data_decrypt": "please include data to decrypt",
|
||||||
@ -52,8 +58,10 @@
|
|||||||
"permission_list_hosted_data": "do you give this application permission to get a list of your hosted data?",
|
"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?",
|
"permission_delete_hosts_resources": "do you give this application permission to delete {{ size }} hosted resources?",
|
||||||
"permission_pay_publish": "do you give this application permission to make the following payments and publishes?",
|
"permission_pay_publish": "do you give this application permission to make the following payments and publishes?",
|
||||||
|
"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?",
|
"permission_transfer_asset": "do you give this application permission to transfer the following asset?",
|
||||||
"poll": "poll: {{ name }}",
|
"poll": "poll: {{ name }}",
|
||||||
"request_create_poll": "you are requesting to create the poll below:",
|
"request_create_poll": "you are requesting to create the poll below:",
|
||||||
"request_vote_poll": "you are being requested to vote on the poll below:"
|
"request_vote_poll": "you are being requested to vote on the poll below:",
|
||||||
|
"to_recipient": "to: {{ recipient }}"
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ export const getUserAccount = async ({
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
i18n.t('auth:message.error.unable_fetch_user_account', {
|
i18n.t('auth:message.error.fetch_user_account', {
|
||||||
postProcess: 'capitalizeFirstChar',
|
postProcess: 'capitalizeFirstChar',
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -1288,7 +1288,11 @@ export const publishQDNResource = async (
|
|||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
if (!data.file && !data.data64 && !data.base64) {
|
if (!data.file && !data.data64 && !data.base64) {
|
||||||
throw new Error('No data or file was submitted');
|
throw new Error(
|
||||||
|
i18n.t('question:message.error.no_data_file_submitted', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// Use "default" if user hasn't specified an identifier
|
// Use "default" if user hasn't specified an identifier
|
||||||
const service = data.service;
|
const service = data.service;
|
||||||
@ -1301,8 +1305,13 @@ export const publishQDNResource = async (
|
|||||||
const registeredName = await getNameInfo();
|
const registeredName = await getNameInfo();
|
||||||
const name = registeredName;
|
const name = registeredName;
|
||||||
if (!name) {
|
if (!name) {
|
||||||
throw new Error('User has no Qortal name');
|
throw new Error(
|
||||||
|
i18n.t('question:message.error.user_qortal_name', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let identifier = data.identifier;
|
let identifier = data.identifier;
|
||||||
let data64 = data.data64 || data.base64;
|
let data64 = data.data64 || data.base64;
|
||||||
const filename = data.filename;
|
const filename = data.filename;
|
||||||
@ -1332,7 +1341,11 @@ export const publishQDNResource = async (
|
|||||||
(!data.publicKeys ||
|
(!data.publicKeys ||
|
||||||
(Array.isArray(data.publicKeys) && data.publicKeys.length === 0))
|
(Array.isArray(data.publicKeys) && data.publicKeys.length === 0))
|
||||||
) {
|
) {
|
||||||
throw new Error('Encrypting data requires public keys');
|
throw new Error(
|
||||||
|
i18n.t('question:message.error.encryption_requires_public_key', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.encrypt) {
|
if (data.encrypt) {
|
||||||
@ -1352,7 +1365,10 @@ export const publishQDNResource = async (
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
error.message || 'Upload failed due to failed encryption'
|
error.message ||
|
||||||
|
i18n.t('question:message.error.upload_encryption', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1693,7 +1709,10 @@ export const publishMultipleQDNResources = async (
|
|||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMsg =
|
const errorMsg =
|
||||||
error?.message || 'Upload failed due to failed encryption';
|
error?.message ||
|
||||||
|
i18n.t('question:message.error.upload_encryption', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
failedPublishesIdentifiers.push({
|
failedPublishesIdentifiers.push({
|
||||||
reason: errorMsg,
|
reason: errorMsg,
|
||||||
identifier: resource.identifier,
|
identifier: resource.identifier,
|
||||||
@ -3558,7 +3577,7 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
walletBalance = await response.text();
|
walletBalance = await response.text();
|
||||||
}
|
}
|
||||||
if (isNaN(Number(walletBalance))) {
|
if (isNaN(Number(walletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch QORT Balance. Try again!';
|
const errorMsg = 'Failed to Fetch QORT Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3569,21 +3588,25 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const amountDecimals = Number(amount) * QORT_DECIMALS;
|
const amountDecimals = Number(amount) * QORT_DECIMALS;
|
||||||
const fee: number = await sendQortFee();
|
const fee: number = await sendQortFee();
|
||||||
if (amountDecimals + fee * QORT_DECIMALS > walletBalanceDecimals) {
|
if (amountDecimals + fee * QORT_DECIMALS > walletBalanceDecimals) {
|
||||||
let errorMsg = 'Insufficient Funds!';
|
const errorMsg = i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
let errorMsg = 'Invalid Amount!';
|
const errorMsg = 'Invalid Amount!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
if (recipient.length === 0) {
|
if (recipient.length === 0) {
|
||||||
let errorMsg = 'Receiver cannot be empty!';
|
const errorMsg = 'Receiver cannot be empty!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
fee: fee,
|
fee: fee,
|
||||||
@ -3626,7 +3649,9 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} BTC`,
|
foreignFee: `${fee} BTC`,
|
||||||
@ -3675,18 +3700,24 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const ltcWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
const ltcWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
||||||
|
|
||||||
if (isNaN(Number(ltcWalletBalance))) {
|
if (isNaN(Number(ltcWalletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch LTC Balance. Try again!';
|
const errorMsg = 'Failed to Fetch LTC Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
const ltcWalletBalanceDecimals = Number(ltcWalletBalance);
|
const ltcWalletBalanceDecimals = Number(ltcWalletBalance);
|
||||||
const ltcAmountDecimals = Number(amount);
|
const ltcAmountDecimals = Number(amount);
|
||||||
const fee = feePerByte * 1000; // default 0.00030000
|
const fee = feePerByte * 1000; // default 0.00030000
|
||||||
if (ltcAmountDecimals + fee > ltcWalletBalanceDecimals) {
|
if (ltcAmountDecimals + fee > ltcWalletBalanceDecimals) {
|
||||||
throw new Error('Insufficient Funds!');
|
throw new Error(
|
||||||
|
i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} LTC`,
|
foreignFee: `${fee} LTC`,
|
||||||
@ -3733,21 +3764,28 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const feePerByte = data.fee ? data.fee : dogeFeePerByte;
|
const feePerByte = data.fee ? data.fee : dogeFeePerByte;
|
||||||
const dogeWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
const dogeWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
||||||
if (isNaN(Number(dogeWalletBalance))) {
|
if (isNaN(Number(dogeWalletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch DOGE Balance. Try again!';
|
const errorMsg = 'Failed to Fetch DOGE Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
const dogeWalletBalanceDecimals = Number(dogeWalletBalance);
|
const dogeWalletBalanceDecimals = Number(dogeWalletBalance);
|
||||||
const dogeAmountDecimals = Number(amount);
|
const dogeAmountDecimals = Number(amount);
|
||||||
const fee = feePerByte * 5000; // default 0.05000000
|
const fee = feePerByte * 5000; // default 0.05000000
|
||||||
if (dogeAmountDecimals + fee > dogeWalletBalanceDecimals) {
|
if (dogeAmountDecimals + fee > dogeWalletBalanceDecimals) {
|
||||||
let errorMsg = 'Insufficient Funds!';
|
const errorMsg = i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
text2: `To: ${recipient}`,
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
|
text2: i18n.t('question:to_recipient', {
|
||||||
|
recipient: recipient,
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} DOGE`,
|
foreignFee: `${fee} DOGE`,
|
||||||
},
|
},
|
||||||
@ -3794,20 +3832,24 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const feePerByte = data.fee ? data.fee : dgbFeePerByte;
|
const feePerByte = data.fee ? data.fee : dgbFeePerByte;
|
||||||
const dgbWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
const dgbWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
||||||
if (isNaN(Number(dgbWalletBalance))) {
|
if (isNaN(Number(dgbWalletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch DGB Balance. Try again!';
|
const errorMsg = 'Failed to Fetch DGB Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
const dgbWalletBalanceDecimals = Number(dgbWalletBalance);
|
const dgbWalletBalanceDecimals = Number(dgbWalletBalance);
|
||||||
const dgbAmountDecimals = Number(amount);
|
const dgbAmountDecimals = Number(amount);
|
||||||
const fee = feePerByte * 500; // default 0.00005000
|
const fee = feePerByte * 500; // default 0.00005000
|
||||||
if (dgbAmountDecimals + fee > dgbWalletBalanceDecimals) {
|
if (dgbAmountDecimals + fee > dgbWalletBalanceDecimals) {
|
||||||
let errorMsg = 'Insufficient Funds!';
|
const errorMsg = i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} DGB`,
|
foreignFee: `${fee} DGB`,
|
||||||
@ -3855,20 +3897,24 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const feePerByte = data.fee ? data.fee : rvnFeePerByte;
|
const feePerByte = data.fee ? data.fee : rvnFeePerByte;
|
||||||
const rvnWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
const rvnWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
||||||
if (isNaN(Number(rvnWalletBalance))) {
|
if (isNaN(Number(rvnWalletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch RVN Balance. Try again!';
|
const errorMsg = 'Failed to Fetch RVN Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
const rvnWalletBalanceDecimals = Number(rvnWalletBalance);
|
const rvnWalletBalanceDecimals = Number(rvnWalletBalance);
|
||||||
const rvnAmountDecimals = Number(amount);
|
const rvnAmountDecimals = Number(amount);
|
||||||
const fee = feePerByte * 500; // default 0.00562500
|
const fee = feePerByte * 500; // default 0.00562500
|
||||||
if (rvnAmountDecimals + fee > rvnWalletBalanceDecimals) {
|
if (rvnAmountDecimals + fee > rvnWalletBalanceDecimals) {
|
||||||
let errorMsg = 'Insufficient Funds!';
|
const errorMsg = i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} RVN`,
|
foreignFee: `${fee} RVN`,
|
||||||
@ -3916,20 +3962,24 @@ export const sendCoin = async (data, isFromExtension) => {
|
|||||||
const arrrWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
const arrrWalletBalance = await getWalletBalance({ coin: checkCoin }, true);
|
||||||
|
|
||||||
if (isNaN(Number(arrrWalletBalance))) {
|
if (isNaN(Number(arrrWalletBalance))) {
|
||||||
let errorMsg = 'Failed to Fetch ARRR Balance. Try again!';
|
const errorMsg = 'Failed to Fetch ARRR Balance. Try again!';
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
const arrrWalletBalanceDecimals = Number(arrrWalletBalance);
|
const arrrWalletBalanceDecimals = Number(arrrWalletBalance);
|
||||||
const arrrAmountDecimals = Number(amount);
|
const arrrAmountDecimals = Number(amount);
|
||||||
const fee = 0.0001;
|
const fee = 0.0001;
|
||||||
if (arrrAmountDecimals + fee > arrrWalletBalanceDecimals) {
|
if (arrrAmountDecimals + fee > arrrWalletBalanceDecimals) {
|
||||||
let errorMsg = 'Insufficient Funds!';
|
const errorMsg = i18n.t('question:message.error.insufficient_funds', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
});
|
||||||
throw new Error(errorMsg);
|
throw new Error(errorMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
const resPermission = await getUserPermission(
|
const resPermission = await getUserPermission(
|
||||||
{
|
{
|
||||||
text1: 'Do you give this application permission to send coins?',
|
text1: i18n.t('question:permission_send_coins', {
|
||||||
|
postProcess: 'capitalizeFirstChar',
|
||||||
|
}),
|
||||||
text2: `To: ${recipient}`,
|
text2: `To: ${recipient}`,
|
||||||
highlightedText: `${amount} ${checkCoin}`,
|
highlightedText: `${amount} ${checkCoin}`,
|
||||||
foreignFee: `${fee} ARRR`,
|
foreignFee: `${fee} ARRR`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user