mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-06 16:36:58 +00:00
Merge pull request #49 from nbenaglia/feature/i18n-chat
i18n: Add translations for Chat
This commit is contained in:
commit
201f1cf66d
@ -1,10 +1,25 @@
|
|||||||
# I18N Guidelines
|
# I18N Guidelines
|
||||||
|
|
||||||
In JSON file:
|
[react-i18next](https://react.i18next.com/) is the framework used for internationalization.
|
||||||
|
|
||||||
|
## Locales
|
||||||
|
|
||||||
|
Locales are in folder `./src/i18n/locales`, one folder per language.
|
||||||
|
|
||||||
|
A single JSON file represents a namespace (group of translation).
|
||||||
|
It's a key/value structure.
|
||||||
|
|
||||||
|
Please:
|
||||||
|
|
||||||
- Keep the file sorted
|
- Keep the file sorted
|
||||||
- Always write in lowercase
|
- First letter of each value is lowercase
|
||||||
|
|
||||||
In GUI:
|
Translation in GUI:
|
||||||
|
|
||||||
- If the first letter of the translation must be uppercase, use the postProcess, for example: `{t_auth('advanced_users', { postProcess: 'capitalizeFirst' })}`
|
- If the first letter of the translation must be uppercase, use the postProcess, for example: `t('core:advanced_users', { postProcess: 'capitalizeFirst' })`
|
||||||
|
- For all translation in uppercase `{ postProcess: 'capitalizeAll' }`
|
||||||
|
- See `.src/i18n/i18n.ts` for processor definition
|
||||||
|
|
||||||
|
## Missing language?
|
||||||
|
|
||||||
|
- Please open an issue on the project's github repository and specify the missing language
|
||||||
|
474
src/App.tsx
474
src/App.tsx
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -178,7 +178,7 @@ export const AppPublish = ({ names, categories }) => {
|
|||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.publish_app', {
|
message: t('core:message.question.publish_app', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
|
@ -113,7 +113,7 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
|
|||||||
const fee = await getFee('CREATE_POLL');
|
const fee = await getFee('CREATE_POLL');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.rate_app', {
|
message: t('core:message.question.rate_app', {
|
||||||
rate: newValue,
|
rate: newValue,
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -192,7 +192,7 @@ export const AppsPrivate = ({ myName }) => {
|
|||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.publish_app', {
|
message: t('core:message.question.publish_app', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
|
@ -216,7 +216,9 @@ export const DownloadWallet = ({
|
|||||||
</Box>
|
</Box>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
|
|
||||||
{!keepCurrentPassword && (
|
{!keepCurrentPassword && (
|
||||||
<>
|
<>
|
||||||
<CustomLabel htmlFor="standard-adornment-password">
|
<CustomLabel htmlFor="standard-adornment-password">
|
||||||
@ -226,11 +228,13 @@ export const DownloadWallet = ({
|
|||||||
</CustomLabel>
|
</CustomLabel>
|
||||||
|
|
||||||
<Spacer height="5px" />
|
<Spacer height="5px" />
|
||||||
|
|
||||||
<PasswordField
|
<PasswordField
|
||||||
id="standard-adornment-password"
|
id="standard-adornment-password"
|
||||||
value={newPassword}
|
value={newPassword}
|
||||||
onChange={(e) => setNewPassword(e.target.value)}
|
onChange={(e) => setNewPassword(e.target.value)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useContext, useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { MyContext } from '../../App';
|
|
||||||
import { Box, Typography } from '@mui/material';
|
import { Box, Typography } from '@mui/material';
|
||||||
import { AdminSpaceInner } from './AdminSpaceInner';
|
import { AdminSpaceInner } from './AdminSpaceInner';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const AdminSpace = ({
|
export const AdminSpace = ({
|
||||||
selectedGroup,
|
selectedGroup,
|
||||||
@ -19,6 +19,8 @@ export const AdminSpace = ({
|
|||||||
isOwner,
|
isOwner,
|
||||||
}) => {
|
}) => {
|
||||||
const [isMoved, setIsMoved] = useState(false);
|
const [isMoved, setIsMoved] = useState(false);
|
||||||
|
const { t } = useTranslation(['core', 'group']);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
setTimeout(() => setIsMoved(true), 300); // Wait for the fade-out to complete before moving
|
setTimeout(() => setIsMoved(true), 300); // Wait for the fade-out to complete before moving
|
||||||
@ -35,10 +37,10 @@ export const AdminSpace = ({
|
|||||||
height: 'calc(100vh - 70px)',
|
height: 'calc(100vh - 70px)',
|
||||||
left: hide && '-1000px',
|
left: hide && '-1000px',
|
||||||
opacity: hide ? 0 : 1,
|
opacity: hide ? 0 : 1,
|
||||||
|
overflow: 'auto',
|
||||||
position: hide ? 'fixed' : 'relative',
|
position: hide ? 'fixed' : 'relative',
|
||||||
visibility: hide && 'hidden',
|
visibility: hide && 'hidden',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
overflow: 'auto',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!isAdmin && (
|
{!isAdmin && (
|
||||||
@ -50,9 +52,14 @@ export const AdminSpace = ({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography>Sorry, this space is only for Admins.</Typography>
|
<Typography>
|
||||||
|
{t('core:message.generic.space_for_admins', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isAdmin && (
|
{isAdmin && (
|
||||||
<AdminSpaceInner
|
<AdminSpaceInner
|
||||||
setIsForceShowCreationKeyPopup={setIsForceShowCreationKeyPopup}
|
setIsForceShowCreationKeyPopup={setIsForceShowCreationKeyPopup}
|
||||||
|
@ -16,6 +16,8 @@ import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
|||||||
import { formatTimestampForum } from '../../utils/time';
|
import { formatTimestampForum } from '../../utils/time';
|
||||||
import { Spacer } from '../../common/Spacer';
|
import { Spacer } from '../../common/Spacer';
|
||||||
import { GroupAvatar } from './GroupAvatar';
|
import { GroupAvatar } from './GroupAvatar';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
export const getPublishesFromAdminsAdminSpace = async (
|
export const getPublishesFromAdminsAdminSpace = async (
|
||||||
admins: string[],
|
admins: string[],
|
||||||
@ -26,7 +28,7 @@ export const getPublishesFromAdminsAdminSpace = async (
|
|||||||
const response = await fetch(url);
|
const response = await fetch(url);
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error('network error');
|
throw new Error(i18next.t('core:message.error.network_generic'));
|
||||||
}
|
}
|
||||||
const adminData = await response.json();
|
const adminData = await response.json();
|
||||||
|
|
||||||
@ -72,6 +74,7 @@ export const AdminSpaceInner = ({
|
|||||||
const [isLoadingPublishKey, setIsLoadingPublishKey] = useState(false);
|
const [isLoadingPublishKey, setIsLoadingPublishKey] = useState(false);
|
||||||
const { show, setInfoSnackCustom, setOpenSnackGlobal } =
|
const { show, setInfoSnackCustom, setOpenSnackGlobal } =
|
||||||
useContext(MyContext);
|
useContext(MyContext);
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const getAdminGroupSecretKey = useCallback(async () => {
|
const getAdminGroupSecretKey = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@ -81,20 +84,24 @@ export const AdminSpaceInner = ({
|
|||||||
selectedGroup
|
selectedGroup
|
||||||
);
|
);
|
||||||
if (getLatestPublish === false) return;
|
if (getLatestPublish === false) return;
|
||||||
let data;
|
|
||||||
|
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${getBaseApiReact()}/arbitrary/DOCUMENT_PRIVATE/${
|
`${getBaseApiReact()}/arbitrary/DOCUMENT_PRIVATE/${
|
||||||
getLatestPublish.name
|
getLatestPublish.name
|
||||||
}/${getLatestPublish.identifier}?encoding=base64&rebuild=true`
|
}/${getLatestPublish.identifier}?encoding=base64&rebuild=true`
|
||||||
);
|
);
|
||||||
data = await res.text();
|
|
||||||
|
|
||||||
|
const data = await res.text();
|
||||||
const decryptedKey: any = await decryptResource(data);
|
const decryptedKey: any = await decryptResource(data);
|
||||||
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
||||||
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
||||||
|
|
||||||
if (!validateSecretKey(decryptedKeyToObject))
|
if (!validateSecretKey(decryptedKeyToObject))
|
||||||
throw new Error('SecretKey is not valid');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
setAdminGroupSecretKey(decryptedKeyToObject);
|
setAdminGroupSecretKey(decryptedKeyToObject);
|
||||||
setAdminGroupSecretKeyPublishDetails(getLatestPublish);
|
setAdminGroupSecretKeyPublishDetails(getLatestPublish);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -125,7 +132,10 @@ export const AdminSpaceInner = ({
|
|||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: 'Would you like to perform an ARBITRARY transaction?',
|
message: t('core:message.question.perform_transaction', {
|
||||||
|
action: 'ARBITRARY',
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -141,22 +151,31 @@ export const AdminSpaceInner = ({
|
|||||||
if (!response?.error) {
|
if (!response?.error) {
|
||||||
setInfoSnackCustom({
|
setInfoSnackCustom({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message:
|
message: t('auth:message.success.reencrypted_secret_key', {
|
||||||
'Successfully re-encrypted secret key. It may take a couple of minutes for the changes to propagate. Refresh the group in 5 mins.',
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnackGlobal(true);
|
setOpenSnackGlobal(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setInfoSnackCustom({
|
setInfoSnackCustom({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: response?.error || 'unable to re-encrypt secret key',
|
message:
|
||||||
|
response?.error ||
|
||||||
|
t('auth:message.error.unable_reencrypt_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnackGlobal(true);
|
setOpenSnackGlobal(true);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setInfoSnackCustom({
|
setInfoSnackCustom({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: error?.message || 'unable to re-encrypt secret key',
|
message:
|
||||||
|
error?.message ||
|
||||||
|
t('auth:message.error.unable_reencrypt_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnackGlobal(true);
|
setOpenSnackGlobal(true);
|
||||||
});
|
});
|
||||||
@ -184,10 +203,13 @@ export const AdminSpaceInner = ({
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Reminder: After publishing the key, it will take a couple of minutes for
|
{t('auth:message.error.publishing_key', {
|
||||||
it to appear. Please just wait.
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Spacer height="25px" />
|
<Spacer height="25px" />
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
border: '1px solid gray',
|
border: '1px solid gray',
|
||||||
@ -201,28 +223,43 @@ export const AdminSpaceInner = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isFetchingGroupSecretKey && (
|
{isFetchingGroupSecretKey && (
|
||||||
<Typography>Fetching Group secret key publishes</Typography>
|
|
||||||
)}
|
|
||||||
{!isFetchingGroupSecretKey &&
|
|
||||||
groupSecretKeyPublishDetails === false && (
|
|
||||||
<Typography>No secret key published yet</Typography>
|
|
||||||
)}
|
|
||||||
{groupSecretKeyPublishDetails && (
|
|
||||||
<Typography>
|
<Typography>
|
||||||
Last encryption date:{' '}
|
{t('auth:message.generic.fetching_group_secret_key', {
|
||||||
{formatTimestampForum(
|
postProcess: 'capitalizeFirst',
|
||||||
groupSecretKeyPublishDetails?.updated ||
|
})}
|
||||||
groupSecretKeyPublishDetails?.created
|
|
||||||
)}{' '}
|
|
||||||
{` by ${groupSecretKeyPublishDetails?.name}`}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!isFetchingGroupSecretKey &&
|
||||||
|
groupSecretKeyPublishDetails === false && (
|
||||||
|
<Typography>
|
||||||
|
{t('auth:message.generic.no_secret_key_published', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{groupSecretKeyPublishDetails && (
|
||||||
|
<Typography>
|
||||||
|
{t('auth:message.generic.last_encryption_date', {
|
||||||
|
date: formatTimestampForum(
|
||||||
|
groupSecretKeyPublishDetails?.updated ||
|
||||||
|
groupSecretKeyPublishDetails?.created
|
||||||
|
),
|
||||||
|
name: groupSecretKeyPublishDetails?.name,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
disabled={isFetchingGroupSecretKey}
|
disabled={isFetchingGroupSecretKey}
|
||||||
onClick={() => setIsForceShowCreationKeyPopup(true)}
|
onClick={() => setIsForceShowCreationKeyPopup(true)}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
>
|
>
|
||||||
Publish group secret key
|
{t('auth:action.publish_group_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
@ -232,9 +269,9 @@ export const AdminSpaceInner = ({
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
This key is to encrypt GROUP related content. This is the only one
|
{t('auth:tips.key_encrypt_group', {
|
||||||
used in this UI as of now. All group members will be able to see
|
postProcess: 'capitalizeFirst',
|
||||||
content encrypted with this key.
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
@ -253,26 +290,41 @@ export const AdminSpaceInner = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{isFetchingAdminGroupSecretKey && (
|
{isFetchingAdminGroupSecretKey && (
|
||||||
<Typography>Fetching Admins secret key</Typography>
|
|
||||||
)}
|
|
||||||
{!isFetchingAdminGroupSecretKey && !adminGroupSecretKey && (
|
|
||||||
<Typography>No secret key published yet</Typography>
|
|
||||||
)}
|
|
||||||
{adminGroupSecretKeyPublishDetails && (
|
|
||||||
<Typography>
|
<Typography>
|
||||||
Last encryption date:{' '}
|
{t('auth:message.generic.fetching_admin_secret_key', {
|
||||||
{formatTimestampForum(
|
postProcess: 'capitalizeFirst',
|
||||||
adminGroupSecretKeyPublishDetails?.updated ||
|
})}
|
||||||
adminGroupSecretKeyPublishDetails?.created
|
|
||||||
)}
|
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{!isFetchingAdminGroupSecretKey && !adminGroupSecretKey && (
|
||||||
|
<Typography>
|
||||||
|
{t('auth:message.generic.no_secret_key_published', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{adminGroupSecretKeyPublishDetails && (
|
||||||
|
<Typography>
|
||||||
|
{t('auth:message.generic.last_encryption_date', {
|
||||||
|
date: formatTimestampForum(
|
||||||
|
adminGroupSecretKeyPublishDetails?.updated ||
|
||||||
|
adminGroupSecretKeyPublishDetails?.created
|
||||||
|
),
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
)}
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
disabled={isFetchingAdminGroupSecretKey}
|
disabled={isFetchingAdminGroupSecretKey}
|
||||||
onClick={createCommonSecretForAdmins}
|
onClick={createCommonSecretForAdmins}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
>
|
>
|
||||||
Publish admin secret key
|
{t('auth:action.publish_admin_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
@ -282,11 +334,14 @@ export const AdminSpaceInner = ({
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
This key is to encrypt ADMIN related content. Only admins would see
|
{t('auth:tips.key_encrypt_admin', {
|
||||||
content encrypted with it.
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Spacer height="25px" />
|
<Spacer height="25px" />
|
||||||
|
|
||||||
{isOwner && (
|
{isOwner && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -301,7 +356,11 @@ export const AdminSpaceInner = ({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography>Group Avatar</Typography>
|
<Typography>
|
||||||
|
{t('group:group.avatar', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
|
|
||||||
<GroupAvatar
|
<GroupAvatar
|
||||||
setOpenSnack={setOpenSnackGlobal}
|
setOpenSnack={setOpenSnackGlobal}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import TipTap from './TipTap';
|
import TipTap from './TipTap';
|
||||||
import {
|
import {
|
||||||
AuthenticatedContainerInnerTop,
|
AuthenticatedContainerInnerTop,
|
||||||
@ -8,7 +8,7 @@ import { Box, CircularProgress, useTheme } from '@mui/material';
|
|||||||
import { objectToBase64 } from '../../qdn/encryption/group-encryption';
|
import { objectToBase64 } from '../../qdn/encryption/group-encryption';
|
||||||
import ShortUniqueId from 'short-unique-id';
|
import ShortUniqueId from 'short-unique-id';
|
||||||
import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar';
|
import { LoadingSnackbar } from '../Snackbar/LoadingSnackbar';
|
||||||
import { getBaseApi, getFee } from '../../background';
|
import { getFee } from '../../background';
|
||||||
import {
|
import {
|
||||||
decryptPublishes,
|
decryptPublishes,
|
||||||
getTempPublish,
|
getTempPublish,
|
||||||
@ -24,6 +24,7 @@ import {
|
|||||||
pauseAllQueues,
|
pauseAllQueues,
|
||||||
resumeAllQueues,
|
resumeAllQueues,
|
||||||
} from '../../App';
|
} from '../../App';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const tempKey = 'accouncement-comment';
|
const tempKey = 'accouncement-comment';
|
||||||
|
|
||||||
@ -39,10 +40,10 @@ export const AnnouncementDiscussion = ({
|
|||||||
isPrivate,
|
isPrivate,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const [comments, setComments] = useState([]);
|
const [comments, setComments] = useState([]);
|
||||||
const [tempPublishedList, setTempPublishedList] = useState([]);
|
const [tempPublishedList, setTempPublishedList] = useState([]);
|
||||||
const firstMountRef = useRef(false);
|
const firstMountRef = useRef(false);
|
||||||
@ -100,7 +101,12 @@ export const AnnouncementDiscussion = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -131,9 +137,13 @@ export const AnnouncementDiscussion = ({
|
|||||||
pauseAllQueues();
|
pauseAllQueues();
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
await show({
|
await show({
|
||||||
message: 'Would you like to perform a ARBITRARY transaction?',
|
message: t('core:message.question.perform_transaction', {
|
||||||
|
action: 'ARBITRARY',
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
const htmlContent = editorRef.current.getHTML();
|
const htmlContent = editorRef.current.getHTML();
|
||||||
@ -155,10 +165,11 @@ export const AnnouncementDiscussion = ({
|
|||||||
: await encryptChatMessage(message64, secretKeyObject);
|
: await encryptChatMessage(message64, secretKeyObject);
|
||||||
const randomUid = uid.rnd();
|
const randomUid = uid.rnd();
|
||||||
const identifier = `cm-${selectedAnnouncement.identifier}-${randomUid}`;
|
const identifier = `cm-${selectedAnnouncement.identifier}-${randomUid}`;
|
||||||
|
|
||||||
const res = await publishAnc({
|
const res = await publishAnc({
|
||||||
encryptedData: encryptSingle,
|
encryptedData: encryptSingle,
|
||||||
identifier,
|
identifier,
|
||||||
});
|
}); // TODO remove unused?
|
||||||
|
|
||||||
const dataToSaveToStorage = {
|
const dataToSaveToStorage = {
|
||||||
name: myName,
|
name: myName,
|
||||||
@ -168,12 +179,13 @@ export const AnnouncementDiscussion = ({
|
|||||||
created: Date.now(),
|
created: Date.now(),
|
||||||
announcementId: selectedAnnouncement.identifier,
|
announcementId: selectedAnnouncement.identifier,
|
||||||
};
|
};
|
||||||
|
|
||||||
await saveTempPublish({ data: dataToSaveToStorage, key: tempKey });
|
await saveTempPublish({ data: dataToSaveToStorage, key: tempKey });
|
||||||
setTempData();
|
setTempData();
|
||||||
|
|
||||||
clearEditorContent();
|
clearEditorContent();
|
||||||
}
|
}
|
||||||
// send chat message
|
// TODO send chat message
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
} finally {
|
} finally {
|
||||||
@ -182,14 +194,12 @@ export const AnnouncementDiscussion = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getComments = React.useCallback(
|
const getComments = useCallback(
|
||||||
async (selectedAnnouncement, isPrivate) => {
|
async (selectedAnnouncement, isPrivate) => {
|
||||||
try {
|
try {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const offset = 0;
|
const offset = 0;
|
||||||
|
|
||||||
// dispatch(setIsLoadingGlobal(true))
|
|
||||||
const identifier = `cm-${selectedAnnouncement.identifier}`;
|
const identifier = `cm-${selectedAnnouncement.identifier}`;
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=20&includemetadata=false&offset=${offset}&reverse=true&prefix=true`;
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=20&includemetadata=false&offset=${offset}&reverse=true&prefix=true`;
|
||||||
const response = await fetch(url, {
|
const response = await fetch(url, {
|
||||||
@ -209,8 +219,6 @@ export const AnnouncementDiscussion = ({
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
} finally {
|
} finally {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
|
|
||||||
// dispatch(setIsLoadingGlobal(false))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[secretKey]
|
[secretKey]
|
||||||
@ -259,7 +267,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
return sortedList;
|
return sortedList;
|
||||||
}, [tempPublishedList, comments]);
|
}, [tempPublishedList, comments]);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (!secretKey && isPrivate) return;
|
if (!secretKey && isPrivate) return;
|
||||||
if (selectedAnnouncement && !firstMountRef.current && isPrivate !== null) {
|
if (selectedAnnouncement && !firstMountRef.current && isPrivate !== null) {
|
||||||
getComments(selectedAnnouncement, isPrivate);
|
getComments(selectedAnnouncement, isPrivate);
|
||||||
@ -299,6 +307,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<AnnouncementList
|
<AnnouncementList
|
||||||
announcementData={data}
|
announcementData={data}
|
||||||
initialMessages={combinedListTempAndReal}
|
initialMessages={combinedListTempAndReal}
|
||||||
@ -308,6 +317,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
loadMore={loadMore}
|
loadMore={loadMore}
|
||||||
myName={myName}
|
myName={myName}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.palette.background.default,
|
backgroundColor: theme.palette.background.default,
|
||||||
@ -343,6 +353,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
setIsFocusedParent={setIsFocusedParent}
|
setIsFocusedParent={setIsFocusedParent}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -359,7 +370,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
setIsFocusedParent(false);
|
setIsFocusedParent(false);
|
||||||
clearEditorContent();
|
clearEditorContent();
|
||||||
// Unfocus the editor
|
// TODO Unfocus the editor
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
@ -371,7 +382,7 @@ export const AnnouncementDiscussion = ({
|
|||||||
padding: '5px',
|
padding: '5px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{` Close`}
|
{t('core:action.close', { postProcess: 'capitalizeFirst' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
)}
|
)}
|
||||||
<CustomButton
|
<CustomButton
|
||||||
@ -402,7 +413,9 @@ export const AnnouncementDiscussion = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{` Publish Comment`}
|
{t('core:action.publish_comment', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
@ -410,7 +423,9 @@ export const AnnouncementDiscussion = ({
|
|||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
message: 'Loading comments... please wait.',
|
message: t('core:loading.comments', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { MessageDisplay } from './MessageDisplay';
|
import { MessageDisplay } from './MessageDisplay';
|
||||||
import { Avatar, Box, Typography, useTheme } from '@mui/material';
|
import { Avatar, Box, Typography, useTheme } from '@mui/material';
|
||||||
import { formatTimestamp } from '../../utils/time';
|
import { formatTimestamp } from '../../utils/time';
|
||||||
import ChatBubbleIcon from '@mui/icons-material/ChatBubble';
|
import ChatBubbleIcon from '@mui/icons-material/ChatBubble';
|
||||||
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos';
|
||||||
import { getBaseApi } from '../../background';
|
|
||||||
import { requestQueueCommentCount } from './GroupAnnouncements';
|
import { requestQueueCommentCount } from './GroupAnnouncements';
|
||||||
import { CustomLoader } from '../../common/CustomLoader';
|
import { CustomLoader } from '../../common/CustomLoader';
|
||||||
import { getArbitraryEndpointReact, getBaseApiReact } from '../../App';
|
import { getArbitraryEndpointReact, getBaseApiReact } from '../../App';
|
||||||
import { WrapperUserAction } from '../WrapperUserAction';
|
import { WrapperUserAction } from '../WrapperUserAction';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const AnnouncementItem = ({
|
export const AnnouncementItem = ({
|
||||||
message,
|
message,
|
||||||
@ -18,12 +18,12 @@ export const AnnouncementItem = ({
|
|||||||
myName,
|
myName,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const [commentLength, setCommentLength] = useState(0);
|
const [commentLength, setCommentLength] = useState(0);
|
||||||
const getNumberOfComments = React.useCallback(async () => {
|
|
||||||
|
const getNumberOfComments = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const offset = 0;
|
const offset = 0;
|
||||||
|
|
||||||
// dispatch(setIsLoadingGlobal(true))
|
|
||||||
const identifier = `cm-${message.identifier}`;
|
const identifier = `cm-${message.identifier}`;
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=0&includemetadata=false&offset=${offset}&reverse=true&prefix=true`;
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=0&includemetadata=false&offset=${offset}&reverse=true&prefix=true`;
|
||||||
|
|
||||||
@ -84,6 +84,7 @@ export const AnnouncementItem = ({
|
|||||||
{message?.name?.charAt(0)}
|
{message?.name?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
</WrapperUserAction>
|
</WrapperUserAction>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -106,6 +107,7 @@ export const AnnouncementItem = ({
|
|||||||
{message?.name}
|
{message?.name}
|
||||||
</Typography>
|
</Typography>
|
||||||
</WrapperUserAction>
|
</WrapperUserAction>
|
||||||
|
|
||||||
{!messageData?.decryptedData && (
|
{!messageData?.decryptedData && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -117,6 +119,7 @@ export const AnnouncementItem = ({
|
|||||||
<CustomLoader />
|
<CustomLoader />
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{messageData?.decryptedData?.message && (
|
{messageData?.decryptedData?.message && (
|
||||||
<>
|
<>
|
||||||
{messageData?.type === 'notification' ? (
|
{messageData?.type === 'notification' ? (
|
||||||
@ -150,6 +153,7 @@ export const AnnouncementItem = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{!disableComment && (
|
{!disableComment && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -189,10 +193,13 @@ export const AnnouncementItem = ({
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Leave comment
|
{t('core:action.leave_comment', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<ArrowForwardIosIcon
|
<ArrowForwardIosIcon
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
|
@ -3,6 +3,7 @@ import { CellMeasurerCache } from 'react-virtualized';
|
|||||||
import { AnnouncementItem } from './AnnouncementItem';
|
import { AnnouncementItem } from './AnnouncementItem';
|
||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import { CustomButton } from '../../styles/App-styles';
|
import { CustomButton } from '../../styles/App-styles';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const cache = new CellMeasurerCache({
|
const cache = new CellMeasurerCache({
|
||||||
fixedWidth: true,
|
fixedWidth: true,
|
||||||
@ -18,8 +19,8 @@ export const AnnouncementList = ({
|
|||||||
loadMore,
|
loadMore,
|
||||||
myName,
|
myName,
|
||||||
}) => {
|
}) => {
|
||||||
const listRef = useRef(null);
|
|
||||||
const [messages, setMessages] = useState(initialMessages);
|
const [messages, setMessages] = useState(initialMessages);
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
cache.clearAll();
|
cache.clearAll();
|
||||||
@ -36,9 +37,9 @@ export const AnnouncementList = ({
|
|||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
flexShrink: 1,
|
flexShrink: 1,
|
||||||
|
overflow: 'auto',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
overflow: 'auto',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{messages.map((message) => {
|
{messages.map((message) => {
|
||||||
@ -69,19 +70,7 @@ export const AnnouncementList = ({
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
{/* <AutoSizer>
|
|
||||||
{({ height, width }) => (
|
|
||||||
<List
|
|
||||||
ref={listRef}
|
|
||||||
width={width}
|
|
||||||
height={height}
|
|
||||||
rowCount={messages.length}
|
|
||||||
rowHeight={cache.rowHeight}
|
|
||||||
rowRenderer={rowRenderer}
|
|
||||||
deferredMeasurementCache={cache}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</AutoSizer> */}
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -92,7 +81,9 @@ export const AnnouncementList = ({
|
|||||||
>
|
>
|
||||||
{showLoadMore && (
|
{showLoadMore && (
|
||||||
<CustomButton onClick={loadMore}>
|
<CustomButton onClick={loadMore}>
|
||||||
Load older announcements
|
{t('core:action.load_announcements', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
|
@ -1,12 +1,4 @@
|
|||||||
import React, {
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
useCallback,
|
|
||||||
useEffect,
|
|
||||||
useMemo,
|
|
||||||
useReducer,
|
|
||||||
useRef,
|
|
||||||
useState,
|
|
||||||
} from 'react';
|
|
||||||
|
|
||||||
import { ChatList } from './ChatList';
|
import { ChatList } from './ChatList';
|
||||||
import Tiptap from './TipTap';
|
import Tiptap from './TipTap';
|
||||||
import { CustomButton } from '../../styles/App-styles';
|
import { CustomButton } from '../../styles/App-styles';
|
||||||
@ -31,9 +23,9 @@ import {
|
|||||||
} from '../../utils/events';
|
} from '../../utils/events';
|
||||||
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
|
||||||
import ShortUniqueId from 'short-unique-id';
|
import ShortUniqueId from 'short-unique-id';
|
||||||
import { ReturnIcon } from '../../assets/Icons/ReturnIcon';
|
|
||||||
import { ExitIcon } from '../../assets/Icons/ExitIcon';
|
import { ExitIcon } from '../../assets/Icons/ExitIcon';
|
||||||
import { ReplyPreview } from './MessageItem';
|
import { ReplyPreview } from './MessageItem';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const uid = new ShortUniqueId({ length: 5 });
|
const uid = new ShortUniqueId({ length: 5 });
|
||||||
|
|
||||||
@ -50,21 +42,20 @@ export const ChatDirect = ({
|
|||||||
setMobileViewModeKeepOpen,
|
setMobileViewModeKeepOpen,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const { queueChats, addToQueue, processWithNewMessages } = useMessageQueue();
|
const { queueChats, addToQueue, processWithNewMessages } = useMessageQueue();
|
||||||
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
const [onEditMessage, setOnEditMessage] = useState(null);
|
const [onEditMessage, setOnEditMessage] = useState(null);
|
||||||
|
|
||||||
const [messages, setMessages] = useState([]);
|
const [messages, setMessages] = useState([]);
|
||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const [directToValue, setDirectToValue] = useState('');
|
const [directToValue, setDirectToValue] = useState('');
|
||||||
const hasInitialized = useRef(false);
|
const hasInitialized = useRef(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = useState(null);
|
||||||
const [publicKeyOfRecipient, setPublicKeyOfRecipient] = React.useState('');
|
const [publicKeyOfRecipient, setPublicKeyOfRecipient] = useState('');
|
||||||
const hasInitializedWebsocket = useRef(false);
|
const hasInitializedWebsocket = useRef(false);
|
||||||
const [chatReferences, setChatReferences] = useState({});
|
const [chatReferences, setChatReferences] = useState({});
|
||||||
|
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
const socketRef = useRef(null);
|
const socketRef = useRef(null);
|
||||||
const timeoutIdRef = useRef(null);
|
const timeoutIdRef = useRef(null);
|
||||||
@ -74,12 +65,8 @@ export const ChatDirect = ({
|
|||||||
const setEditorRef = (editorInstance) => {
|
const setEditorRef = (editorInstance) => {
|
||||||
editorRef.current = editorInstance;
|
editorRef.current = editorInstance;
|
||||||
};
|
};
|
||||||
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
|
||||||
|
|
||||||
const triggerRerender = () => {
|
|
||||||
forceUpdate(); // Trigger re-render by updating the state
|
|
||||||
};
|
|
||||||
const publicKeyOfRecipientRef = useRef(null);
|
const publicKeyOfRecipientRef = useRef(null);
|
||||||
|
|
||||||
const getPublicKeyFunc = async (address) => {
|
const getPublicKeyFunc = async (address) => {
|
||||||
try {
|
try {
|
||||||
const publicKey = await getPublicKey(address);
|
const publicKey = await getPublicKey(address);
|
||||||
@ -229,7 +216,12 @@ export const ChatDirect = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -397,11 +389,20 @@ export const ChatDirect = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
throw new Error(error);
|
if (error instanceof Error) {
|
||||||
|
throw new Error(error.message);
|
||||||
|
} else {
|
||||||
|
throw new Error(String(error));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const clearEditorContent = () => {
|
const clearEditorContent = () => {
|
||||||
@ -432,8 +433,14 @@ export const ChatDirect = ({
|
|||||||
try {
|
try {
|
||||||
if (messageSize > 4000) return;
|
if (messageSize > 4000) return;
|
||||||
|
|
||||||
|
// TODO set magic number in a proper file
|
||||||
if (+balance < 4)
|
if (+balance < 4)
|
||||||
throw new Error('You need at least 4 QORT to send a message');
|
throw new Error(
|
||||||
|
t('group:message.error.qortals_required', {
|
||||||
|
quantity: 4,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
const htmlContent = editorRef.current.getHTML();
|
const htmlContent = editorRef.current.getHTML();
|
||||||
@ -500,7 +507,10 @@ export const ChatDirect = ({
|
|||||||
type: 'error',
|
type: 'error',
|
||||||
message:
|
message:
|
||||||
errorMsg === 'invalid signature'
|
errorMsg === 'invalid signature'
|
||||||
? 'You need at least 4 QORT to send a message'
|
? t('group:message.error.qortals_required', {
|
||||||
|
quantity: 4,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
: errorMsg,
|
: errorMsg,
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
@ -566,13 +576,14 @@ export const ChatDirect = ({
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Close Direct Chat
|
{t('core:action.close_chat', { postProcess: 'capitalizeFirst' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{isNewChat && (
|
{isNewChat && (
|
||||||
<>
|
<>
|
||||||
<Spacer height="30px" />
|
<Spacer height="30px" />
|
||||||
|
|
||||||
<Input
|
<Input
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: '18px',
|
fontSize: '18px',
|
||||||
@ -686,13 +697,19 @@ export const ChatDirect = ({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography // TODO set magic number in a proper file
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
color:
|
color:
|
||||||
messageSize > 4000 ? theme.palette.other.danger : 'unset',
|
messageSize > 4000 ? theme.palette.other.danger : 'unset',
|
||||||
}}
|
}}
|
||||||
>{`Your message size is of ${messageSize} bytes out of a maximum of 4000`}</Typography>
|
>
|
||||||
|
{t('core:message.error.message_size', {
|
||||||
|
maximum: 4000,
|
||||||
|
size: messageSize,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -746,7 +763,7 @@ export const ChatDirect = ({
|
|||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
message: 'Loading chat... please wait.',
|
message: t('core:loading.chat', { postProcess: 'capitalizeFirst' }),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, {
|
import {
|
||||||
useCallback,
|
useCallback,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
@ -50,6 +50,8 @@ import CloseIcon from '@mui/icons-material/Close';
|
|||||||
import { throttle } from 'lodash';
|
import { throttle } from 'lodash';
|
||||||
import ImageIcon from '@mui/icons-material/Image';
|
import ImageIcon from '@mui/icons-material/Image';
|
||||||
import { messageHasImage } from '../../utils/chat';
|
import { messageHasImage } from '../../utils/chat';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const uid = new ShortUniqueId({ length: 5 });
|
const uid = new ShortUniqueId({ length: 5 });
|
||||||
const uidImages = new ShortUniqueId({ length: 12 });
|
const uidImages = new ShortUniqueId({ length: 12 });
|
||||||
|
|
||||||
@ -75,8 +77,8 @@ export const ChatGroup = ({
|
|||||||
const [isSending, setIsSending] = useState(false);
|
const [isSending, setIsSending] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const [isMoved, setIsMoved] = useState(false);
|
const [isMoved, setIsMoved] = useState(false);
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = useState(null);
|
||||||
const hasInitialized = useRef(false);
|
const hasInitialized = useRef(false);
|
||||||
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
const [replyMessage, setReplyMessage] = useState(null);
|
const [replyMessage, setReplyMessage] = useState(null);
|
||||||
@ -93,8 +95,8 @@ export const ChatGroup = ({
|
|||||||
const { queueChats, addToQueue, processWithNewMessages } = useMessageQueue();
|
const { queueChats, addToQueue, processWithNewMessages } = useMessageQueue();
|
||||||
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
||||||
const lastReadTimestamp = useRef(null);
|
const lastReadTimestamp = useRef(null);
|
||||||
|
|
||||||
const handleUpdateRef = useRef(null);
|
const handleUpdateRef = useRef(null);
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const getTimestampEnterChat = async (selectedGroup) => {
|
const getTimestampEnterChat = async (selectedGroup) => {
|
||||||
try {
|
try {
|
||||||
@ -129,7 +131,12 @@ export const ChatGroup = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -154,9 +161,6 @@ export const ChatGroup = ({
|
|||||||
return Array.from(uniqueMembers);
|
return Array.from(uniqueMembers);
|
||||||
}, [messages]);
|
}, [messages]);
|
||||||
|
|
||||||
const triggerRerender = () => {
|
|
||||||
forceUpdate(); // Trigger re-render by updating the state
|
|
||||||
};
|
|
||||||
const setEditorRef = (editorInstance) => {
|
const setEditorRef = (editorInstance) => {
|
||||||
editorRef.current = editorInstance;
|
editorRef.current = editorInstance;
|
||||||
};
|
};
|
||||||
@ -168,6 +172,7 @@ export const ChatGroup = ({
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}, [selectedGroup, queueChats]);
|
}, [selectedGroup, queueChats]);
|
||||||
|
|
||||||
const tempChatReferences = useMemo(() => {
|
const tempChatReferences = useMemo(() => {
|
||||||
if (!selectedGroup) return [];
|
if (!selectedGroup) return [];
|
||||||
if (queueChats[selectedGroup]) {
|
if (queueChats[selectedGroup]) {
|
||||||
@ -184,12 +189,6 @@ export const ChatGroup = ({
|
|||||||
}
|
}
|
||||||
}, [secretKey]);
|
}, [secretKey]);
|
||||||
|
|
||||||
// const getEncryptedSecretKey = useCallback(()=> {
|
|
||||||
// const response = getResource()
|
|
||||||
// const decryptResponse = decryptResource()
|
|
||||||
// return
|
|
||||||
// }, [])
|
|
||||||
|
|
||||||
const checkForFirstSecretKeyNotification = (messages) => {
|
const checkForFirstSecretKeyNotification = (messages) => {
|
||||||
messages?.forEach((message) => {
|
messages?.forEach((message) => {
|
||||||
try {
|
try {
|
||||||
@ -250,7 +249,6 @@ export const ChatGroup = ({
|
|||||||
const dataRemovedBlock = responseData?.filter((item) => {
|
const dataRemovedBlock = responseData?.filter((item) => {
|
||||||
return !isUserBlocked(item?.sender, item?.senderName);
|
return !isUserBlocked(item?.sender, item?.senderName);
|
||||||
});
|
});
|
||||||
|
|
||||||
decryptMessages(dataRemovedBlock, false);
|
decryptMessages(dataRemovedBlock, false);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -273,6 +271,7 @@ export const ChatGroup = ({
|
|||||||
const filterUIMessages = encryptedMessages.filter(
|
const filterUIMessages = encryptedMessages.filter(
|
||||||
(item) => !isExtMsg(item.data)
|
(item) => !isExtMsg(item.data)
|
||||||
);
|
);
|
||||||
|
|
||||||
const decodedUIMessages =
|
const decodedUIMessages =
|
||||||
decodeBase64ForUIChatMessages(filterUIMessages);
|
decodeBase64ForUIChatMessages(filterUIMessages);
|
||||||
|
|
||||||
@ -280,6 +279,7 @@ export const ChatGroup = ({
|
|||||||
...decodedUIMessages,
|
...decodedUIMessages,
|
||||||
...response,
|
...response,
|
||||||
];
|
];
|
||||||
|
|
||||||
const combineUIAndExtensionMsgs = processWithNewMessages(
|
const combineUIAndExtensionMsgs = processWithNewMessages(
|
||||||
combineUIAndExtensionMsgsBefore.map((item) => ({
|
combineUIAndExtensionMsgsBefore.map((item) => ({
|
||||||
...item,
|
...item,
|
||||||
@ -287,16 +287,24 @@ export const ChatGroup = ({
|
|||||||
})),
|
})),
|
||||||
selectedGroup
|
selectedGroup
|
||||||
);
|
);
|
||||||
|
|
||||||
res(combineUIAndExtensionMsgs);
|
res(combineUIAndExtensionMsgs);
|
||||||
|
|
||||||
if (isInitiated) {
|
if (isInitiated) {
|
||||||
const formatted = combineUIAndExtensionMsgs
|
const formatted = combineUIAndExtensionMsgs
|
||||||
.filter((rawItem) => !rawItem?.chatReference)
|
.filter((rawItem) => !rawItem?.chatReference)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
|
const message = (
|
||||||
|
<p>
|
||||||
|
{t('group:message.generic.group_key_created', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
);
|
||||||
const additionalFields =
|
const additionalFields =
|
||||||
item?.data === 'NDAwMQ=='
|
item?.data === 'NDAwMQ==' // TODO put magic string somewhere in a file
|
||||||
? {
|
? {
|
||||||
text: '<p>First group key created.</p>',
|
text: message,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
return {
|
return {
|
||||||
@ -362,7 +370,9 @@ export const ChatGroup = ({
|
|||||||
!newTimestamp
|
!newTimestamp
|
||||||
) {
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Invalid content, sender, or timestamp in reaction data',
|
t('group:message.generic.invalid_content', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
item
|
item
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -435,10 +445,17 @@ export const ChatGroup = ({
|
|||||||
const formatted = combineUIAndExtensionMsgs
|
const formatted = combineUIAndExtensionMsgs
|
||||||
.filter((rawItem) => !rawItem?.chatReference)
|
.filter((rawItem) => !rawItem?.chatReference)
|
||||||
.map((item) => {
|
.map((item) => {
|
||||||
|
const message = (
|
||||||
|
<p>
|
||||||
|
{t('group:message.generic.group_key_created', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</p>
|
||||||
|
);
|
||||||
const additionalFields =
|
const additionalFields =
|
||||||
item?.data === 'NDAwMQ=='
|
item?.data === 'NDAwMQ=='
|
||||||
? {
|
? {
|
||||||
text: '<p>First group key created.</p>',
|
text: message,
|
||||||
}
|
}
|
||||||
: {};
|
: {};
|
||||||
const divide =
|
const divide =
|
||||||
@ -510,7 +527,9 @@ export const ChatGroup = ({
|
|||||||
!newTimestamp
|
!newTimestamp
|
||||||
) {
|
) {
|
||||||
console.warn(
|
console.warn(
|
||||||
'Invalid content, sender, or timestamp in reaction data',
|
t('group:message.generic.invalid_content', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
item
|
item
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
@ -583,7 +602,12 @@ export const ChatGroup = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -615,6 +639,7 @@ export const ChatGroup = ({
|
|||||||
console.error('Error during ping:', error);
|
console.error('Error during ping:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const initWebsocketMessageGroup = () => {
|
const initWebsocketMessageGroup = () => {
|
||||||
let socketLink = `${getBaseApiReactSocket()}/websockets/chat/messages?txGroupId=${selectedGroup}&encoding=BASE64&limit=100`;
|
let socketLink = `${getBaseApiReactSocket()}/websockets/chat/messages?txGroupId=${selectedGroup}&encoding=BASE64&limit=100`;
|
||||||
socketRef.current = new WebSocket(socketLink);
|
socketRef.current = new WebSocket(socketLink);
|
||||||
@ -709,7 +734,12 @@ export const ChatGroup = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -744,7 +774,12 @@ export const ChatGroup = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -760,12 +795,22 @@ export const ChatGroup = ({
|
|||||||
|
|
||||||
const sendMessage = async () => {
|
const sendMessage = async () => {
|
||||||
try {
|
try {
|
||||||
if (messageSize > 4000) return;
|
if (messageSize > 4000) return; // TODO magic number
|
||||||
if (isPrivate === null)
|
if (isPrivate === null)
|
||||||
throw new Error('Unable to determine if group is private');
|
throw new Error(
|
||||||
|
t('group:message.error.unable_determine_group_private', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
if (+balance < 4)
|
if (+balance < 4)
|
||||||
throw new Error('You need at least 4 QORT to send a message');
|
// TODO magic number
|
||||||
|
throw new Error(
|
||||||
|
t('group:message.error.qortals_required', {
|
||||||
|
quantity: 4,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
pauseAllQueues();
|
pauseAllQueues();
|
||||||
if (editorRef.current) {
|
if (editorRef.current) {
|
||||||
const htmlContent = editorRef.current.getHTML();
|
const htmlContent = editorRef.current.getHTML();
|
||||||
@ -782,35 +827,50 @@ export const ChatGroup = ({
|
|||||||
if (replyMessage?.chatReference) {
|
if (replyMessage?.chatReference) {
|
||||||
repliedTo = replyMessage?.chatReference;
|
repliedTo = replyMessage?.chatReference;
|
||||||
}
|
}
|
||||||
let chatReference = onEditMessage?.signature;
|
|
||||||
|
const chatReference = onEditMessage?.signature;
|
||||||
|
|
||||||
const publicData = isPrivate
|
const publicData = isPrivate
|
||||||
? {}
|
? {}
|
||||||
: {
|
: {
|
||||||
isEdited: chatReference ? true : false,
|
isEdited: chatReference ? true : false,
|
||||||
};
|
};
|
||||||
const imagesToPublish = [];
|
|
||||||
|
interface ImageToPublish {
|
||||||
|
service: string;
|
||||||
|
identifier: string;
|
||||||
|
name: string;
|
||||||
|
base64: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const imagesToPublish: ImageToPublish[] = [];
|
||||||
const deleteImage =
|
const deleteImage =
|
||||||
onEditMessage && isDeleteImage && messageHasImage(onEditMessage);
|
onEditMessage && isDeleteImage && messageHasImage(onEditMessage);
|
||||||
|
|
||||||
if (deleteImage) {
|
if (deleteImage) {
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
message: 'Would you like to delete your previous chat image?',
|
message: t('core:message.question.delete_chat_image', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// TODO magic string
|
||||||
await window.sendMessage('publishOnQDN', {
|
await window.sendMessage('publishOnQDN', {
|
||||||
data: 'RA==',
|
data: 'RA==',
|
||||||
identifier: onEditMessage?.images[0]?.identifier,
|
identifier: onEditMessage?.images[0]?.identifier,
|
||||||
service: onEditMessage?.images[0]?.service,
|
service: onEditMessage?.images[0]?.service,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chatImagesToSave?.length > 0) {
|
if (chatImagesToSave?.length > 0) {
|
||||||
const imageToSave = chatImagesToSave[0];
|
const imageToSave = chatImagesToSave[0];
|
||||||
|
|
||||||
const base64ToSave = isPrivate
|
const base64ToSave = isPrivate
|
||||||
? await encryptChatMessage(imageToSave, secretKeyObject)
|
? await encryptChatMessage(imageToSave, secretKeyObject)
|
||||||
: imageToSave;
|
: imageToSave;
|
||||||
|
|
||||||
// 1 represents public group, 0 is private
|
// 1 represents public group, 0 is private
|
||||||
const identifier = `grp-q-manager_${isPrivate ? 0 : 1}_group_${selectedGroup}_${uidImages.rnd()}`;
|
const identifier = `grp-q-manager_${isPrivate ? 0 : 1}_group_${selectedGroup}_${uidImages.rnd()}`;
|
||||||
imagesToPublish.push({
|
imagesToPublish.push({
|
||||||
@ -822,14 +882,18 @@ export const ChatGroup = ({
|
|||||||
|
|
||||||
const res = await window.sendMessage(
|
const res = await window.sendMessage(
|
||||||
'PUBLISH_MULTIPLE_QDN_RESOURCES',
|
'PUBLISH_MULTIPLE_QDN_RESOURCES',
|
||||||
|
|
||||||
{
|
{
|
||||||
resources: imagesToPublish,
|
resources: imagesToPublish,
|
||||||
},
|
},
|
||||||
240000,
|
240000,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
if (res !== true) throw new Error('Unable to publish images');
|
if (res !== true)
|
||||||
|
throw new Error(
|
||||||
|
t('core:message.error.unable_publish_image', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const images =
|
const images =
|
||||||
@ -868,7 +932,6 @@ export const ChatGroup = ({
|
|||||||
isPrivate === false
|
isPrivate === false
|
||||||
? JSON.stringify(objectMessage)
|
? JSON.stringify(objectMessage)
|
||||||
: await encryptChatMessage(message64, secretKeyObject);
|
: await encryptChatMessage(message64, secretKeyObject);
|
||||||
// const res = await sendChatGroup({groupId: selectedGroup,messageText: encryptSingle})
|
|
||||||
|
|
||||||
const sendMessageFunc = async () => {
|
const sendMessageFunc = async () => {
|
||||||
return await sendChatGroup({
|
return await sendChatGroup({
|
||||||
@ -979,18 +1042,25 @@ export const ChatGroup = ({
|
|||||||
.setContent(message?.messageText || message?.text)
|
.setContent(message?.messageText || message?.text)
|
||||||
.run();
|
.run();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleReaction = useCallback(
|
const handleReaction = useCallback(
|
||||||
async (reaction, chatMessage, reactionState = true) => {
|
async (reaction, chatMessage, reactionState = true) => {
|
||||||
try {
|
try {
|
||||||
if (isSending) return;
|
if (isSending) return;
|
||||||
if (+balance < 4)
|
if (+balance < 4)
|
||||||
throw new Error('You need at least 4 QORT to send a message');
|
// TODO magic number
|
||||||
pauseAllQueues();
|
throw new Error(
|
||||||
|
t('group:message.error.qortals_required', {
|
||||||
|
quantity: 4,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
pauseAllQueues();
|
||||||
setIsSending(true);
|
setIsSending(true);
|
||||||
|
|
||||||
const message = '';
|
const message = '';
|
||||||
const secretKeyObject = await getSecretKey(false, true);
|
const secretKeyObject = await getSecretKey(false, true);
|
||||||
|
|
||||||
const otherData = {
|
const otherData = {
|
||||||
specialId: uid.rnd(),
|
specialId: uid.rnd(),
|
||||||
type: 'reaction',
|
type: 'reaction',
|
||||||
@ -1011,8 +1081,6 @@ export const ChatGroup = ({
|
|||||||
secretKeyObject,
|
secretKeyObject,
|
||||||
reactiontypeNumber
|
reactiontypeNumber
|
||||||
);
|
);
|
||||||
// const res = await sendChatGroup({groupId: selectedGroup,messageText: encryptSingle})
|
|
||||||
|
|
||||||
const sendMessageFunc = async () => {
|
const sendMessageFunc = async () => {
|
||||||
return await sendChatGroup({
|
return await sendChatGroup({
|
||||||
groupId: selectedGroup,
|
groupId: selectedGroup,
|
||||||
@ -1033,12 +1101,6 @@ export const ChatGroup = ({
|
|||||||
chatReference: chatMessage.signature,
|
chatReference: chatMessage.signature,
|
||||||
};
|
};
|
||||||
addToQueue(sendMessageFunc, messageObj, 'chat-reaction', selectedGroup);
|
addToQueue(sendMessageFunc, messageObj, 'chat-reaction', selectedGroup);
|
||||||
// setTimeout(() => {
|
|
||||||
// executeEvent("sent-new-message-group", {})
|
|
||||||
// }, 150);
|
|
||||||
// clearEditorContent()
|
|
||||||
// setReplyMessage(null)
|
|
||||||
|
|
||||||
// send chat message
|
// send chat message
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMsg = error?.message || error;
|
const errorMsg = error?.message || error;
|
||||||
@ -1070,7 +1132,9 @@ export const ChatGroup = ({
|
|||||||
) {
|
) {
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
type: 'error',
|
type: 'error',
|
||||||
message: 'This message already has an image',
|
message: t('core:message.generic.message_with_image', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
return;
|
return;
|
||||||
@ -1079,6 +1143,7 @@ export const ChatGroup = ({
|
|||||||
},
|
},
|
||||||
[chatImagesToSave, onEditMessage?.images, isDeleteImage]
|
[chatImagesToSave, onEditMessage?.images, isDeleteImage]
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
@ -1087,34 +1152,36 @@ export const ChatGroup = ({
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
left: hide && '-100000px',
|
left: hide && '-100000px',
|
||||||
opacity: hide ? 0 : 1,
|
opacity: hide ? 0 : 1,
|
||||||
|
padding: '10px',
|
||||||
position: hide ? 'absolute' : 'relative',
|
position: hide ? 'absolute' : 'relative',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
padding: '10px',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ChatList
|
<ChatList
|
||||||
isPrivate={isPrivate}
|
|
||||||
hasSecretKey={!!secretKey}
|
|
||||||
openQManager={openQManager}
|
|
||||||
enableMentions
|
|
||||||
onReply={onReply}
|
|
||||||
onEdit={onEdit}
|
|
||||||
chatId={selectedGroup}
|
chatId={selectedGroup}
|
||||||
initialMessages={messages}
|
|
||||||
myAddress={myAddress}
|
|
||||||
tempMessages={tempMessages}
|
|
||||||
handleReaction={handleReaction}
|
|
||||||
chatReferences={chatReferences}
|
chatReferences={chatReferences}
|
||||||
tempChatReferences={tempChatReferences}
|
enableMentions
|
||||||
|
handleReaction={handleReaction}
|
||||||
|
hasSecretKey={!!secretKey}
|
||||||
|
initialMessages={messages}
|
||||||
|
isPrivate={isPrivate}
|
||||||
members={members}
|
members={members}
|
||||||
|
myAddress={myAddress}
|
||||||
myName={myName}
|
myName={myName}
|
||||||
|
onEdit={onEdit}
|
||||||
|
onReply={onReply}
|
||||||
|
openQManager={openQManager}
|
||||||
selectedGroup={selectedGroup}
|
selectedGroup={selectedGroup}
|
||||||
|
tempChatReferences={tempChatReferences}
|
||||||
|
tempMessages={tempMessages}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{(!!secretKey || isPrivate === false) && (
|
{(!!secretKey || isPrivate === false) && (
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.palette.background.surface,
|
backgroundColor: theme.palette.background.surface,
|
||||||
|
border: `1px solid ${theme.palette.border.subtle}`,
|
||||||
|
borderRadius: '10px',
|
||||||
bottom: isFocusedParent ? '0px' : 'unset',
|
bottom: isFocusedParent ? '0px' : 'unset',
|
||||||
boxSizing: 'border-box',
|
boxSizing: 'border-box',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -1127,8 +1194,6 @@ export const ChatGroup = ({
|
|||||||
top: isFocusedParent ? '0px' : 'unset',
|
top: isFocusedParent ? '0px' : 'unset',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
zIndex: isFocusedParent ? 5 : 'unset',
|
zIndex: isFocusedParent ? 5 : 'unset',
|
||||||
border: `1px solid ${theme.palette.border.subtle}`,
|
|
||||||
borderRadius: '10px',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -1146,9 +1211,9 @@ export const ChatGroup = ({
|
|||||||
sx={{
|
sx={{
|
||||||
alignItems: 'flex-start',
|
alignItems: 'flex-start',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
width: '100%',
|
|
||||||
gap: '10px',
|
|
||||||
flexWrap: 'wrap',
|
flexWrap: 'wrap',
|
||||||
|
gap: '10px',
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!isDeleteImage &&
|
{!isDeleteImage &&
|
||||||
@ -1158,19 +1223,20 @@ export const ChatGroup = ({
|
|||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
style={{
|
style={{
|
||||||
position: 'relative',
|
|
||||||
height: '50px',
|
height: '50px',
|
||||||
|
position: 'relative',
|
||||||
width: '50px',
|
width: '50px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ImageIcon
|
<ImageIcon
|
||||||
color="primary"
|
color="primary"
|
||||||
sx={{
|
sx={{
|
||||||
|
borderRadius: '3px',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
borderRadius: '3px',
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Tooltip title="Delete image">
|
<Tooltip title="Delete image">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => setIsDeleteImage(true)}
|
onClick={() => setIsDeleteImage(true)}
|
||||||
@ -1200,12 +1266,13 @@ export const ChatGroup = ({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{chatImagesToSave.map((imgBase64, index) => (
|
{chatImagesToSave.map((imgBase64, index) => (
|
||||||
<div
|
<div
|
||||||
key={index}
|
key={index}
|
||||||
style={{
|
style={{
|
||||||
position: 'relative',
|
|
||||||
height: '50px',
|
height: '50px',
|
||||||
|
position: 'relative',
|
||||||
width: '50px',
|
width: '50px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -1218,6 +1285,7 @@ export const ChatGroup = ({
|
|||||||
borderRadius: '3px',
|
borderRadius: '3px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Tooltip title="Remove image">
|
<Tooltip title="Remove image">
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
@ -1252,6 +1320,7 @@ export const ChatGroup = ({
|
|||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{replyMessage && (
|
{replyMessage && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -1276,6 +1345,7 @@ export const ChatGroup = ({
|
|||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{onEditMessage && (
|
{onEditMessage && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -1321,13 +1391,19 @@ export const ChatGroup = ({
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography
|
<Typography //TODO magic number
|
||||||
sx={{
|
sx={{
|
||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
color:
|
color:
|
||||||
messageSize > 4000 ? theme.palette.other.danger : 'unset',
|
messageSize > 4000 ? theme.palette.other.danger : 'unset',
|
||||||
}}
|
}}
|
||||||
>{`Your message size is of ${messageSize} bytes out of a maximum of 4000`}</Typography>
|
>
|
||||||
|
{t('core:message.error.message_size', {
|
||||||
|
maximum: 4000,
|
||||||
|
size: messageSize,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -1378,6 +1454,7 @@ export const ChatGroup = ({
|
|||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{isOpenQManager !== null && (
|
{isOpenQManager !== null && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -1417,6 +1494,7 @@ export const ChatGroup = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography>Q-Manager</Typography>
|
<Typography>Q-Manager</Typography>
|
||||||
|
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsOpenQManager(false);
|
setIsOpenQManager(false);
|
||||||
@ -1429,14 +1507,16 @@ export const ChatGroup = ({
|
|||||||
/>
|
/>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Divider />
|
<Divider />
|
||||||
|
|
||||||
<AppViewerContainer
|
<AppViewerContainer
|
||||||
customHeight="560px"
|
customHeight="560px"
|
||||||
app={{
|
app={{
|
||||||
tabId: '5558588',
|
|
||||||
name: 'Q-Manager',
|
name: 'Q-Manager',
|
||||||
service: 'APP',
|
|
||||||
path: `?groupId=${selectedGroup}`,
|
path: `?groupId=${selectedGroup}`,
|
||||||
|
service: 'APP',
|
||||||
|
tabId: '5558588',
|
||||||
}}
|
}}
|
||||||
isSelected
|
isSelected
|
||||||
/>
|
/>
|
||||||
@ -1447,7 +1527,7 @@ export const ChatGroup = ({
|
|||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
message: 'Loading chat... please wait.',
|
message: t('core:loading.chat', { postProcess: 'capitalizeFirst' }),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
|
|||||||
import { Box, Button, Typography, useTheme } from '@mui/material';
|
import { Box, Button, Typography, useTheme } from '@mui/material';
|
||||||
import { ChatOptions } from './ChatOptions';
|
import { ChatOptions } from './ChatOptions';
|
||||||
import ErrorBoundary from '../../common/ErrorBoundary';
|
import ErrorBoundary from '../../common/ErrorBoundary';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const ChatList = ({
|
export const ChatList = ({
|
||||||
initialMessages,
|
initialMessages,
|
||||||
@ -180,6 +181,7 @@ export const ChatList = ({
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -202,11 +204,11 @@ export const ChatList = ({
|
|||||||
ref={parentRef}
|
ref={parentRef}
|
||||||
className="List"
|
className="List"
|
||||||
style={{
|
style={{
|
||||||
|
display: 'flex',
|
||||||
flexGrow: 1,
|
flexGrow: 1,
|
||||||
|
height: '0px',
|
||||||
overflow: 'auto',
|
overflow: 'auto',
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
display: 'flex',
|
|
||||||
height: '0px',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
@ -324,19 +326,23 @@ export const ChatList = ({
|
|||||||
<div
|
<div
|
||||||
key={virtualRow.index}
|
key={virtualRow.index}
|
||||||
style={{
|
style={{
|
||||||
position: 'absolute',
|
|
||||||
top: 0,
|
|
||||||
left: '50%',
|
|
||||||
transform: `translateY(${virtualRow.start}px) translateX(-50%)`,
|
|
||||||
width: '100%',
|
|
||||||
padding: '10px 0',
|
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
display: 'flex',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
gap: '5px',
|
gap: '5px',
|
||||||
|
left: '50%',
|
||||||
|
padding: '10px 0',
|
||||||
|
position: 'absolute',
|
||||||
|
top: 0,
|
||||||
|
transform: `translateY(${virtualRow.start}px) translateX(-50%)`,
|
||||||
|
width: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Typography>Error loading message.</Typography>
|
<Typography>
|
||||||
|
{t('core:message.error.message_loading', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</Typography>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -363,26 +369,28 @@ export const ChatList = ({
|
|||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<Typography>
|
<Typography>
|
||||||
Error loading content: Invalid Data
|
{t('group:message.generic.invalid_data', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<MessageItem
|
<MessageItem
|
||||||
|
handleReaction={handleReaction}
|
||||||
isLast={index === messages.length - 1}
|
isLast={index === messages.length - 1}
|
||||||
|
isPrivate={isPrivate}
|
||||||
|
isTemp={!!message?.isTemp}
|
||||||
|
isUpdating={isUpdating}
|
||||||
lastSignature={lastSignature}
|
lastSignature={lastSignature}
|
||||||
message={message}
|
message={message}
|
||||||
onSeen={handleMessageSeen}
|
|
||||||
isTemp={!!message?.isTemp}
|
|
||||||
myAddress={myAddress}
|
myAddress={myAddress}
|
||||||
onReply={onReply}
|
|
||||||
onEdit={onEdit}
|
onEdit={onEdit}
|
||||||
|
onReply={onReply}
|
||||||
|
onSeen={handleMessageSeen}
|
||||||
|
reactions={reactions}
|
||||||
reply={reply}
|
reply={reply}
|
||||||
replyIndex={replyIndex}
|
replyIndex={replyIndex}
|
||||||
scrollToItem={goToMessage}
|
scrollToItem={goToMessage}
|
||||||
handleReaction={handleReaction}
|
|
||||||
reactions={reactions}
|
|
||||||
isUpdating={isUpdating}
|
|
||||||
isPrivate={isPrivate}
|
|
||||||
/>
|
/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</div>
|
</div>
|
||||||
@ -391,6 +399,7 @@ export const ChatList = ({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{showScrollButton && (
|
{showScrollButton && (
|
||||||
<button
|
<button
|
||||||
onClick={() => scrollToBottom()}
|
onClick={() => scrollToBottom()}
|
||||||
@ -408,9 +417,12 @@ export const ChatList = ({
|
|||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Scroll to Unread Messages
|
{t('group:action.scroll_unread_messages', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{showScrollDownButton && !showScrollButton && (
|
{showScrollDownButton && !showScrollButton && (
|
||||||
<Button
|
<Button
|
||||||
onClick={() => scrollToBottom()}
|
onClick={() => scrollToBottom()}
|
||||||
@ -431,10 +443,13 @@ export const ChatList = ({
|
|||||||
textTransform: 'none',
|
textTransform: 'none',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Scroll to bottom
|
{t('group:action.scroll_unread_messages', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{enableMentions && (hasSecretKey || isPrivate === false) && (
|
{enableMentions && (hasSecretKey || isPrivate === false) && (
|
||||||
<ChatOptions
|
<ChatOptions
|
||||||
openQManager={openQManager}
|
openQManager={openQManager}
|
||||||
|
@ -24,7 +24,6 @@ import {
|
|||||||
AppsSearchLeft,
|
AppsSearchLeft,
|
||||||
AppsSearchRight,
|
AppsSearchRight,
|
||||||
} from '../Apps/Apps-styles';
|
} from '../Apps/Apps-styles';
|
||||||
|
|
||||||
import IconClearInput from '../../assets/svgs/ClearInput.svg';
|
import IconClearInput from '../../assets/svgs/ClearInput.svg';
|
||||||
import { CellMeasurerCache } from 'react-virtualized';
|
import { CellMeasurerCache } from 'react-virtualized';
|
||||||
import { getBaseApiReact } from '../../App';
|
import { getBaseApiReact } from '../../App';
|
||||||
@ -35,6 +34,7 @@ import { ContextMenuMentions } from '../ContextMenuMentions';
|
|||||||
import { convert } from 'html-to-text';
|
import { convert } from 'html-to-text';
|
||||||
import { generateHTML } from '@tiptap/react';
|
import { generateHTML } from '@tiptap/react';
|
||||||
import ErrorBoundary from '../../common/ErrorBoundary';
|
import ErrorBoundary from '../../common/ErrorBoundary';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const extractTextFromHTML = (htmlString = '') => {
|
const extractTextFromHTML = (htmlString = '') => {
|
||||||
return convert(htmlString, {
|
return convert(htmlString, {
|
||||||
@ -60,10 +60,12 @@ export const ChatOptions = ({
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [selectedMember, setSelectedMember] = useState(0);
|
const [selectedMember, setSelectedMember] = useState(0);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const parentRef = useRef(null);
|
const parentRef = useRef(null);
|
||||||
const parentRefMentions = useRef(null);
|
const parentRefMentions = useRef(null);
|
||||||
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
||||||
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
||||||
|
|
||||||
const messages = useMemo(() => {
|
const messages = useMemo(() => {
|
||||||
return untransformedMessages?.map((item) => {
|
return untransformedMessages?.map((item) => {
|
||||||
if (item?.messageText) {
|
if (item?.messageText) {
|
||||||
@ -80,7 +82,7 @@ export const ChatOptions = ({
|
|||||||
messageText: transformedMessage,
|
messageText: transformedMessage,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// error
|
console.log(error);
|
||||||
}
|
}
|
||||||
} else return item;
|
} else return item;
|
||||||
});
|
});
|
||||||
@ -102,7 +104,12 @@ export const ChatOptions = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -154,6 +161,7 @@ export const ChatOptions = ({
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedMember) {
|
if (selectedMember) {
|
||||||
return messages
|
return messages
|
||||||
.filter(
|
.filter(
|
||||||
@ -165,6 +173,7 @@ export const ChatOptions = ({
|
|||||||
)
|
)
|
||||||
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
.filter((message) =>
|
.filter((message) =>
|
||||||
extractTextFromHTML(
|
extractTextFromHTML(
|
||||||
@ -187,6 +196,7 @@ export const ChatOptions = ({
|
|||||||
)
|
)
|
||||||
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
.filter((message) =>
|
.filter((message) =>
|
||||||
extractTextFromHTML(message?.decryptedData?.message)?.includes(
|
extractTextFromHTML(message?.decryptedData?.message)?.includes(
|
||||||
@ -251,6 +261,7 @@ export const ChatOptions = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -268,9 +279,12 @@ export const ChatOptions = ({
|
|||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No results
|
{t('core:message.generic.no_results', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -387,6 +401,7 @@ export const ChatOptions = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -415,6 +430,7 @@ export const ChatOptions = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</AppsSearchLeft>
|
</AppsSearchLeft>
|
||||||
|
|
||||||
<AppsSearchRight>
|
<AppsSearchRight>
|
||||||
{searchValue && (
|
{searchValue && (
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
@ -427,6 +443,7 @@ export const ChatOptions = ({
|
|||||||
)}
|
)}
|
||||||
</AppsSearchRight>
|
</AppsSearchRight>
|
||||||
</AppsSearchContainer>
|
</AppsSearchContainer>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -444,8 +461,11 @@ export const ChatOptions = ({
|
|||||||
value={selectedMember}
|
value={selectedMember}
|
||||||
>
|
>
|
||||||
<MenuItem value={0}>
|
<MenuItem value={0}>
|
||||||
<em>By member</em>
|
<em>
|
||||||
|
{t('core:sort.by_member', { postProcess: 'capitalizeFirst' })}
|
||||||
|
</em>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
{members?.map((member) => {
|
{members?.map((member) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem key={member} value={member}>
|
<MenuItem key={member} value={member}>
|
||||||
@ -454,6 +474,7 @@ export const ChatOptions = ({
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
{!!selectedMember && (
|
{!!selectedMember && (
|
||||||
<CloseIcon
|
<CloseIcon
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -475,9 +496,12 @@ export const ChatOptions = ({
|
|||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No results
|
{t('core:message.generic.no_results', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -544,7 +568,9 @@ export const ChatOptions = ({
|
|||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<Typography>
|
<Typography>
|
||||||
Error loading content: Invalid Data
|
{t('group:message.generic.invalid_data', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -566,6 +592,7 @@ export const ChatOptions = ({
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -605,7 +632,7 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
SEARCH
|
{t('core:action.search', { postProcess: 'capitalizeAll' })}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -628,6 +655,7 @@ export const ChatOptions = ({
|
|||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMode('default');
|
setMode('default');
|
||||||
@ -645,7 +673,7 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Q-MANAGER
|
{t('core:q_apps.q_manager', { postProcess: 'capitalizeAll' })}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -668,6 +696,7 @@ export const ChatOptions = ({
|
|||||||
<InsertLinkIcon sx={{ color: theme.palette.text.primary }} />
|
<InsertLinkIcon sx={{ color: theme.palette.text.primary }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<ContextMenuMentions
|
<ContextMenuMentions
|
||||||
getTimestampMention={getTimestampMention}
|
getTimestampMention={getTimestampMention}
|
||||||
groupId={selectedGroup}
|
groupId={selectedGroup}
|
||||||
@ -688,7 +717,9 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
MENTIONED
|
{t('core:message.generic.mentioned', {
|
||||||
|
postProcess: 'capitalizeAll',
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -767,6 +798,7 @@ const ShowMessage = ({ message, goToMessage, messages }) => {
|
|||||||
>
|
>
|
||||||
{message?.senderName?.charAt(0)}
|
{message?.senderName?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontWight: 600,
|
fontWight: 600,
|
||||||
@ -787,6 +819,7 @@ const ShowMessage = ({ message, goToMessage, messages }) => {
|
|||||||
>
|
>
|
||||||
{formatTimestamp(message.timestamp)}
|
{formatTimestamp(message.timestamp)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useContext } from 'react';
|
import { useContext, useState } from 'react';
|
||||||
import { Box, Button, Typography, useTheme } from '@mui/material';
|
import { Box, Button, Typography, useTheme } from '@mui/material';
|
||||||
import { CustomizedSnackbars } from '../Snackbar/Snackbar';
|
import { CustomizedSnackbars } from '../Snackbar/Snackbar';
|
||||||
import { LoadingButton } from '@mui/lab';
|
import { LoadingButton } from '@mui/lab';
|
||||||
@ -18,6 +18,7 @@ import { base64ToUint8Array } from '../../qdn/encryption/group-encryption';
|
|||||||
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { txListAtom } from '../../atoms/global';
|
import { txListAtom } from '../../atoms/global';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const CreateCommonSecret = ({
|
export const CreateCommonSecret = ({
|
||||||
groupId,
|
groupId,
|
||||||
@ -34,14 +35,14 @@ export const CreateCommonSecret = ({
|
|||||||
const { show } = useContext(MyContext);
|
const { show } = useContext(MyContext);
|
||||||
const setTxList = useSetAtom(txListAtom);
|
const setTxList = useSetAtom(txListAtom);
|
||||||
|
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = useState(null);
|
||||||
const [isLoading, setIsLoading] = React.useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const getPublishesFromAdmins = async (admins: string[]) => {
|
const getPublishesFromAdmins = async (admins: string[]) => {
|
||||||
// const validApi = await findUsableApi();
|
|
||||||
const queryString = admins.map((name) => `name=${name}`).join('&');
|
const queryString = admins.map((name) => `name=${name}`).join('&');
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
||||||
groupId
|
groupId
|
||||||
@ -55,9 +56,11 @@ export const CreateCommonSecret = ({
|
|||||||
const filterId = adminData.filter(
|
const filterId = adminData.filter(
|
||||||
(data: any) => data.identifier === `symmetric-qchat-group-${groupId}`
|
(data: any) => data.identifier === `symmetric-qchat-group-${groupId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filterId?.length === 0) {
|
if (filterId?.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedData = filterId.sort((a: any, b: any) => {
|
const sortedData = filterId.sort((a: any, b: any) => {
|
||||||
// Get the most recent date for both a and b
|
// Get the most recent date for both a and b
|
||||||
const dateA = a.updated ? new Date(a.updated) : new Date(a.created);
|
const dateA = a.updated ? new Date(a.updated) : new Date(a.created);
|
||||||
@ -78,8 +81,13 @@ export const CreateCommonSecret = ({
|
|||||||
pauseAllQueues();
|
pauseAllQueues();
|
||||||
|
|
||||||
const { names } = await getGroupAdmins(groupId);
|
const { names } = await getGroupAdmins(groupId);
|
||||||
|
|
||||||
if (!names.length) {
|
if (!names.length) {
|
||||||
throw new Error('Network error');
|
throw new Error(
|
||||||
|
t('core:message.error.network_generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const publish = await getPublishesFromAdmins(names);
|
const publish = await getPublishesFromAdmins(names);
|
||||||
|
|
||||||
@ -92,15 +100,18 @@ export const CreateCommonSecret = ({
|
|||||||
publish.identifier
|
publish.identifier
|
||||||
}?encoding=base64&rebuild=true`
|
}?encoding=base64&rebuild=true`
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = await res.text();
|
const data = await res.text();
|
||||||
|
|
||||||
const decryptedKey: any = await decryptResource(data);
|
const decryptedKey: any = await decryptResource(data);
|
||||||
|
|
||||||
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
||||||
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
||||||
|
|
||||||
if (!validateSecretKey(decryptedKeyToObject))
|
if (!validateSecretKey(decryptedKeyToObject))
|
||||||
throw new Error('SecretKey is not valid');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
if (decryptedKeyToObject) {
|
if (decryptedKeyToObject) {
|
||||||
return decryptedKeyToObject;
|
return decryptedKeyToObject;
|
||||||
@ -113,17 +124,31 @@ export const CreateCommonSecret = ({
|
|||||||
const createCommonSecret = async () => {
|
const createCommonSecret = async () => {
|
||||||
try {
|
try {
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: 'Would you like to perform an ARBITRARY transaction?',
|
message: t('core:message.question.perform_transaction', {
|
||||||
|
action: 'ARBITRARY',
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
});
|
});
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const secretKey2 = await getSecretKey();
|
const secretKey2 = await getSecretKey();
|
||||||
|
|
||||||
if (!secretKey2 && secretKey2 !== false)
|
if (!secretKey2 && secretKey2 !== false)
|
||||||
throw new Error('invalid secret key');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
if (secretKey2 && !validateSecretKey(secretKey2))
|
if (secretKey2 && !validateSecretKey(secretKey2))
|
||||||
throw new Error('invalid secret key');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const secretKeyToSend = !secretKey2 ? null : secretKey2;
|
const secretKeyToSend = !secretKey2 ? null : secretKey2;
|
||||||
|
|
||||||
@ -136,16 +161,26 @@ export const CreateCommonSecret = ({
|
|||||||
if (!response?.error) {
|
if (!response?.error) {
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message:
|
message: t('auth:message.success.reencrypted_secret_key', {
|
||||||
'Successfully re-encrypted secret key. It may take a couple of minutes for the changes to propagate. Refresh the group in 5 mins.',
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
setTxList((prev) => [
|
setTxList((prev) => [
|
||||||
{
|
{
|
||||||
...response,
|
...response,
|
||||||
type: 'created-common-secret',
|
type: 'created-common-secret',
|
||||||
label: `Published secret key for group ${groupId}: awaiting confirmation`,
|
label: t('group:message.success.published_secret_key', {
|
||||||
labelDone: `Published secret key for group ${groupId}: success!`,
|
group_id: groupId,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
|
labelDone: t(
|
||||||
|
'group:message.success.published_secret_key_label',
|
||||||
|
{
|
||||||
|
group_id: groupId,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}
|
||||||
|
),
|
||||||
done: false,
|
done: false,
|
||||||
groupId,
|
groupId,
|
||||||
},
|
},
|
||||||
@ -187,13 +222,15 @@ export const CreateCommonSecret = ({
|
|||||||
variant="contained"
|
variant="contained"
|
||||||
onClick={createCommonSecret}
|
onClick={createCommonSecret}
|
||||||
>
|
>
|
||||||
Re-encrypt key
|
{t('auth:action.reencrypt_key', { postProcess: 'capitalizeFirst' })}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
|
|
||||||
{noSecretKey ? (
|
{noSecretKey ? (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography>
|
<Typography>
|
||||||
There is no group secret key. Be the first admin to publish one!
|
{t('group:message.generic.group_no_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
) : isOwner &&
|
) : isOwner &&
|
||||||
@ -202,14 +239,17 @@ export const CreateCommonSecret = ({
|
|||||||
userInfo.name !== secretKeyDetails?.name ? (
|
userInfo.name !== secretKeyDetails?.name ? (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography>
|
<Typography>
|
||||||
The latest group secret key was published by a non-owner. As the
|
{t('group:message.generic.group_secret_key_no_owner', {
|
||||||
owner of the group please re-encrypt the key as a safeguard
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
) : isForceShowCreationKeyPopup ? null : (
|
) : isForceShowCreationKeyPopup ? null : (
|
||||||
<Box>
|
<Box>
|
||||||
<Typography>
|
<Typography>
|
||||||
The group member list has changed. Please re-encrypt the secret key.
|
{t('group:message.generic.group_member_list_changed', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
@ -228,7 +268,7 @@ export const CreateCommonSecret = ({
|
|||||||
}}
|
}}
|
||||||
size="small"
|
size="small"
|
||||||
>
|
>
|
||||||
Hide
|
{t('core:action.hide', { postProcess: 'capitalizeFirst' })}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
import React, {
|
import {
|
||||||
useCallback,
|
useCallback,
|
||||||
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
|
useReducer,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
@ -140,9 +142,9 @@ export const GroupAnnouncements = ({
|
|||||||
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
|
const [selectedAnnouncement, setSelectedAnnouncement] = useState(null);
|
||||||
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
const [isFocusedParent, setIsFocusedParent] = useState(false);
|
||||||
|
|
||||||
const { show } = React.useContext(MyContext);
|
const { show } = useContext(MyContext);
|
||||||
const [openSnack, setOpenSnack] = React.useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
const [infoSnack, setInfoSnack] = React.useState(null);
|
const [infoSnack, setInfoSnack] = useState(null);
|
||||||
const hasInitialized = useRef(false);
|
const hasInitialized = useRef(false);
|
||||||
const hasInitializedWebsocket = useRef(false);
|
const hasInitializedWebsocket = useRef(false);
|
||||||
const editorRef = useRef(null);
|
const editorRef = useRef(null);
|
||||||
@ -150,12 +152,13 @@ export const GroupAnnouncements = ({
|
|||||||
const setEditorRef = (editorInstance) => {
|
const setEditorRef = (editorInstance) => {
|
||||||
editorRef.current = editorInstance;
|
editorRef.current = editorInstance;
|
||||||
};
|
};
|
||||||
const [, forceUpdate] = React.useReducer((x) => x + 1, 0);
|
const [, forceUpdate] = useReducer((x) => x + 1, 0);
|
||||||
const { t } = useTranslation(['core', 'group']);
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const triggerRerender = () => {
|
const triggerRerender = () => {
|
||||||
forceUpdate(); // Trigger re-render by updating the state
|
forceUpdate(); // Trigger re-render by updating the state
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!selectedGroup) return;
|
if (!selectedGroup) return;
|
||||||
(async () => {
|
(async () => {
|
||||||
@ -231,7 +234,12 @@ export const GroupAnnouncements = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -254,7 +262,12 @@ export const GroupAnnouncements = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@ -289,7 +302,7 @@ export const GroupAnnouncements = ({
|
|||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'ARBITRARY',
|
action: 'ARBITRARY',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
@ -334,7 +347,7 @@ export const GroupAnnouncements = ({
|
|||||||
setTempData(selectedGroup);
|
setTempData(selectedGroup);
|
||||||
clearEditorContent();
|
clearEditorContent();
|
||||||
}
|
}
|
||||||
// TODO send chat message
|
// send chat message
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!error) return;
|
if (!error) return;
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
@ -348,7 +361,7 @@ export const GroupAnnouncements = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getAnnouncements = React.useCallback(
|
const getAnnouncements = useCallback(
|
||||||
async (selectedGroup, isPrivate) => {
|
async (selectedGroup, isPrivate) => {
|
||||||
try {
|
try {
|
||||||
const offset = 0;
|
const offset = 0;
|
||||||
@ -384,7 +397,7 @@ export const GroupAnnouncements = ({
|
|||||||
[secretKey]
|
[secretKey]
|
||||||
);
|
);
|
||||||
|
|
||||||
React.useEffect(() => {
|
useEffect(() => {
|
||||||
if (!secretKey && isPrivate) return;
|
if (!secretKey && isPrivate) return;
|
||||||
if (
|
if (
|
||||||
selectedGroup &&
|
selectedGroup &&
|
||||||
@ -429,7 +442,7 @@ export const GroupAnnouncements = ({
|
|||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
||||||
const checkNewMessages = React.useCallback(async () => {
|
const checkNewMessages = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
const identifier = `grp-${selectedGroup}-anc-`;
|
const identifier = `grp-${selectedGroup}-anc-`;
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=20&includemetadata=false&offset=${0}&reverse=true&prefix=true`;
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT&identifier=${identifier}&limit=20&includemetadata=false&offset=${0}&reverse=true&prefix=true`;
|
||||||
@ -583,7 +596,9 @@ export const GroupAnnouncements = ({
|
|||||||
fontSize: '30px',
|
fontSize: '30px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
Group Announcements
|
{t('group:message.generic.group_announcement', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Spacer height={'25px'} />
|
<Spacer height={'25px'} />
|
||||||
@ -602,10 +617,13 @@ export const GroupAnnouncements = ({
|
|||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No announcements
|
{t('group:message.generic.no_announcement', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<AnnouncementList
|
<AnnouncementList
|
||||||
announcementData={announcementData}
|
announcementData={announcementData}
|
||||||
initialMessages={combinedListTempAndReal}
|
initialMessages={combinedListTempAndReal}
|
||||||
@ -686,7 +704,7 @@ export const GroupAnnouncements = ({
|
|||||||
padding: '5px',
|
padding: '5px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{` Close`}
|
{t('core:action.close', { postProcess: 'capitalizeFirst' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -720,7 +738,9 @@ export const GroupAnnouncements = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{` Publish Announcement`}
|
{t('group:action.publish_announcement', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
</Box>
|
</Box>
|
||||||
</div>
|
</div>
|
||||||
@ -736,7 +756,9 @@ export const GroupAnnouncements = ({
|
|||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
message: 'Loading announcements... please wait.',
|
message: t('core:loading.announcements', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,6 +20,7 @@ import { getFee } from '../../background';
|
|||||||
import { fileToBase64 } from '../../utils/fileReading';
|
import { fileToBase64 } from '../../utils/fileReading';
|
||||||
import { LoadingButton } from '@mui/lab';
|
import { LoadingButton } from '@mui/lab';
|
||||||
import ErrorIcon from '@mui/icons-material/Error';
|
import ErrorIcon from '@mui/icons-material/Error';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const GroupAvatar = ({
|
export const GroupAvatar = ({
|
||||||
myName,
|
myName,
|
||||||
@ -32,7 +33,7 @@ export const GroupAvatar = ({
|
|||||||
const [avatarFile, setAvatarFile] = useState(null);
|
const [avatarFile, setAvatarFile] = useState(null);
|
||||||
const [tempAvatar, setTempAvatar] = useState(null);
|
const [tempAvatar, setTempAvatar] = useState(null);
|
||||||
const { show } = useContext(MyContext);
|
const { show } = useContext(MyContext);
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const [anchorEl, setAnchorEl] = useState(null);
|
const [anchorEl, setAnchorEl] = useState(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
// Handle child element click to open Popover
|
// Handle child element click to open Popover
|
||||||
@ -68,6 +69,7 @@ export const GroupAvatar = ({
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!myName || !groupId) return;
|
if (!myName || !groupId) return;
|
||||||
checkIfAvatarExists(myName, groupId);
|
checkIfAvatarExists(myName, groupId);
|
||||||
@ -77,14 +79,24 @@ export const GroupAvatar = ({
|
|||||||
try {
|
try {
|
||||||
if (!groupId) return;
|
if (!groupId) return;
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
if (+balance < +fee.fee)
|
if (+balance < +fee.fee)
|
||||||
throw new Error(`Publishing an Avatar requires ${fee.fee}`);
|
throw new Error(
|
||||||
|
t('core:message.generic.avatar_publish_fee', {
|
||||||
|
fee: fee.fee,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: 'Would you like to publish an avatar?',
|
message: t('core:message.question.publish_avatar', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
});
|
});
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
const avatarBase64 = await fileToBase64(avatarFile);
|
const avatarBase64 = await fileToBase64(avatarFile);
|
||||||
|
|
||||||
await new Promise((res, rej) => {
|
await new Promise((res, rej) => {
|
||||||
window
|
window
|
||||||
.sendMessage('publishOnQDN', {
|
.sendMessage('publishOnQDN', {
|
||||||
@ -100,7 +112,12 @@ export const GroupAvatar = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
setAvatarFile(null);
|
setAvatarFile(null);
|
||||||
@ -132,6 +149,7 @@ export const GroupAvatar = ({
|
|||||||
>
|
>
|
||||||
{myName?.charAt(0)}
|
{myName?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
|
|
||||||
<ButtonBase onClick={handleChildClick}>
|
<ButtonBase onClick={handleChildClick}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -139,9 +157,10 @@ export const GroupAvatar = ({
|
|||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
change avatar
|
{t('core:action.change_avatar', { postProcess: 'capitalizeFirst' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<PopoverComp
|
<PopoverComp
|
||||||
myName={myName}
|
myName={myName}
|
||||||
avatarFile={avatarFile}
|
avatarFile={avatarFile}
|
||||||
@ -170,6 +189,7 @@ export const GroupAvatar = ({
|
|||||||
>
|
>
|
||||||
{myName?.charAt(0)}
|
{myName?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
|
|
||||||
<ButtonBase onClick={handleChildClick}>
|
<ButtonBase onClick={handleChildClick}>
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
@ -177,9 +197,10 @@ export const GroupAvatar = ({
|
|||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
change avatar
|
{t('core:action.change_avatar', { postProcess: 'capitalizeFirst' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<PopoverComp
|
<PopoverComp
|
||||||
myName={myName}
|
myName={myName}
|
||||||
avatarFile={avatarFile}
|
avatarFile={avatarFile}
|
||||||
@ -205,9 +226,10 @@ export const GroupAvatar = ({
|
|||||||
opacity: 0.5,
|
opacity: 0.5,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
set avatar
|
{t('core:action.set_avatar', { postProcess: 'capitalizeFirst' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<PopoverComp
|
<PopoverComp
|
||||||
myName={myName}
|
myName={myName}
|
||||||
avatarFile={avatarFile}
|
avatarFile={avatarFile}
|
||||||
@ -235,6 +257,8 @@ const PopoverComp = ({
|
|||||||
myName,
|
myName,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popover
|
<Popover
|
||||||
id={id}
|
id={id}
|
||||||
@ -256,19 +280,28 @@ const PopoverComp = ({
|
|||||||
fontSize: '12px',
|
fontSize: '12px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
(500 KB max. for GIFS){' '}
|
{t('core:message.generic.avatar_size', {
|
||||||
|
size: 500, // TODO magic number
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<ImageUploader onPick={(file) => setAvatarFile(file)}>
|
<ImageUploader onPick={(file) => setAvatarFile(file)}>
|
||||||
<Button variant="contained">Choose Image</Button>
|
<Button variant="contained">
|
||||||
|
{t('core:action.choose_image', { postProcess: 'capitalizeFirst' })}
|
||||||
|
</Button>
|
||||||
</ImageUploader>
|
</ImageUploader>
|
||||||
|
|
||||||
{avatarFile?.name}
|
{avatarFile?.name}
|
||||||
|
|
||||||
<Spacer height="25px" />
|
<Spacer height="25px" />
|
||||||
|
|
||||||
{!myName && (
|
{!myName && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
alignItems: 'center',
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
gap: '5px',
|
gap: '5px',
|
||||||
alignItems: 'center',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<ErrorIcon
|
<ErrorIcon
|
||||||
@ -277,19 +310,22 @@ const PopoverComp = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
<Typography>
|
<Typography>
|
||||||
A registered name is required to set an avatar
|
{t('core:message.generic.avatar_registered_name', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Spacer height="25px" />
|
<Spacer height="25px" />
|
||||||
|
|
||||||
<LoadingButton
|
<LoadingButton
|
||||||
loading={isLoading}
|
loading={isLoading}
|
||||||
disabled={!avatarFile || !myName}
|
disabled={!avatarFile || !myName}
|
||||||
onClick={publishAvatar}
|
onClick={publishAvatar}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
>
|
>
|
||||||
Publish avatar
|
{t('group:action.publish_avatar', { postProcess: 'capitalizeFirst' })}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
</Box>
|
</Box>
|
||||||
</Popover>
|
</Popover>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export default forwardRef((props, ref) => {
|
export default forwardRef((props, ref) => {
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||||
|
|
||||||
const selectItem = (index) => {
|
const selectItem = (index) => {
|
||||||
@ -61,7 +64,11 @@ export default forwardRef((props, ref) => {
|
|||||||
</button>
|
</button>
|
||||||
))
|
))
|
||||||
) : (
|
) : (
|
||||||
<div className="item">No result</div>
|
<div className="item">
|
||||||
|
{t('core:message.generic.no_results', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -171,8 +171,9 @@ export const MessageDisplay = ({ htmlContent, isReply }) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
//error
|
console.log(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const res = extractComponents(url);
|
const res = extractComponents(url);
|
||||||
if (res) {
|
if (res) {
|
||||||
const { service, name, identifier, path } = res;
|
const { service, name, identifier, path } = res;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import React, {
|
import {
|
||||||
|
memo,
|
||||||
useCallback,
|
useCallback,
|
||||||
useContext,
|
useContext,
|
||||||
useEffect,
|
useEffect,
|
||||||
@ -47,6 +48,7 @@ import level9Img from '../../assets/badges/level-9.png';
|
|||||||
import level10Img from '../../assets/badges/level-10.png';
|
import level10Img from '../../assets/badges/level-10.png';
|
||||||
import { Embed } from '../Embeds/Embed';
|
import { Embed } from '../Embeds/Embed';
|
||||||
import { buildImageEmbedLink, messageHasImage } from '../../utils/chat';
|
import { buildImageEmbedLink, messageHasImage } from '../../utils/chat';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const getBadgeImg = (level) => {
|
const getBadgeImg = (level) => {
|
||||||
switch (level?.toString()) {
|
switch (level?.toString()) {
|
||||||
@ -77,7 +79,7 @@ const getBadgeImg = (level) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const UserBadge = React.memo(({ userInfo }) => {
|
const UserBadge = memo(({ userInfo }) => {
|
||||||
return (
|
return (
|
||||||
<Tooltip disableFocusListener title={`level ${userInfo ?? 0}`}>
|
<Tooltip disableFocusListener title={`level ${userInfo ?? 0}`}>
|
||||||
<img
|
<img
|
||||||
@ -92,7 +94,7 @@ const UserBadge = React.memo(({ userInfo }) => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
export const MessageItem = React.memo(
|
export const MessageItem = memo(
|
||||||
({
|
({
|
||||||
message,
|
message,
|
||||||
onSeen,
|
onSeen,
|
||||||
@ -168,12 +170,15 @@ export const MessageItem = React.memo(
|
|||||||
}, [message?.id]);
|
}, [message?.id]);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{message?.divide && (
|
{message?.divide && (
|
||||||
<div className="unread-divider" id="unread-divider-id">
|
<div className="unread-divider" id="unread-divider-id">
|
||||||
Unread messages below
|
{t('core:message.generic.unread_messages', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
@ -261,6 +266,7 @@ export const MessageItem = React.memo(
|
|||||||
{message?.senderName || message?.sender}
|
{message?.senderName || message?.sender}
|
||||||
</Typography>
|
</Typography>
|
||||||
</WrapperUserAction>
|
</WrapperUserAction>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -278,6 +284,7 @@ export const MessageItem = React.memo(
|
|||||||
<EditIcon />
|
<EditIcon />
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isShowingAsReply && (
|
{!isShowingAsReply && (
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -287,6 +294,7 @@ export const MessageItem = React.memo(
|
|||||||
<ReplyIcon />
|
<ReplyIcon />
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isShowingAsReply && handleReaction && (
|
{!isShowingAsReply && handleReaction && (
|
||||||
<ReactionPicker
|
<ReactionPicker
|
||||||
onReaction={(val) => {
|
onReaction={(val) => {
|
||||||
@ -306,6 +314,7 @@ export const MessageItem = React.memo(
|
|||||||
)}
|
)}
|
||||||
</Box>
|
</Box>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
{reply && (
|
{reply && (
|
||||||
<>
|
<>
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
@ -332,6 +341,7 @@ export const MessageItem = React.memo(
|
|||||||
flexShrink: 0,
|
flexShrink: 0,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
padding: '5px',
|
padding: '5px',
|
||||||
@ -343,11 +353,16 @@ export const MessageItem = React.memo(
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Replied to {reply?.senderName || reply?.senderAddress}
|
{t('core:message.generic.replied_to', {
|
||||||
|
person: reply?.senderName || reply?.senderAddress,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
{reply?.messageText && (
|
{reply?.messageText && (
|
||||||
<MessageDisplay htmlContent={htmlReply} />
|
<MessageDisplay htmlContent={htmlReply} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{reply?.decryptedData?.type === 'notification' ? (
|
{reply?.decryptedData?.type === 'notification' ? (
|
||||||
<MessageDisplay
|
<MessageDisplay
|
||||||
htmlContent={reply.decryptedData?.data?.message}
|
htmlContent={reply.decryptedData?.data?.message}
|
||||||
@ -359,6 +374,7 @@ export const MessageItem = React.memo(
|
|||||||
</Box>
|
</Box>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{htmlText && <MessageDisplay htmlContent={htmlText} />}
|
{htmlText && <MessageDisplay htmlContent={htmlText} />}
|
||||||
|
|
||||||
{message?.decryptedData?.type === 'notification' ? (
|
{message?.decryptedData?.type === 'notification' ? (
|
||||||
@ -453,14 +469,17 @@ export const MessageItem = React.memo(
|
|||||||
>
|
>
|
||||||
<Box sx={{ p: 2 }}>
|
<Box sx={{ p: 2 }}>
|
||||||
<Typography variant="subtitle1" sx={{ marginBottom: 1 }}>
|
<Typography variant="subtitle1" sx={{ marginBottom: 1 }}>
|
||||||
People who reacted with {selectedReaction}
|
{t('core:message.generic.people_reaction', {
|
||||||
|
reaction: selectedReaction,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<List
|
<List
|
||||||
sx={{
|
sx={{
|
||||||
overflow: 'auto',
|
|
||||||
maxWidth: '300px',
|
|
||||||
maxHeight: '300px',
|
maxHeight: '300px',
|
||||||
|
maxWidth: '300px',
|
||||||
|
overflow: 'auto',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{reactions[selectedReaction]?.map((reactionItem) => (
|
{reactions[selectedReaction]?.map((reactionItem) => (
|
||||||
@ -473,6 +492,7 @@ export const MessageItem = React.memo(
|
|||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
color="primary"
|
color="primary"
|
||||||
@ -494,12 +514,17 @@ export const MessageItem = React.memo(
|
|||||||
{reactions[selectedReaction]?.find(
|
{reactions[selectedReaction]?.find(
|
||||||
(item) => item?.sender === myAddress
|
(item) => item?.sender === myAddress
|
||||||
)
|
)
|
||||||
? 'Remove Reaction'
|
? t('core:action.remove_reaction', {
|
||||||
: 'Add Reaction'}
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
: t('core:action.add_reaction', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
</Box>
|
</Box>
|
||||||
</Popover>
|
</Popover>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -525,8 +550,12 @@ export const MessageItem = React.memo(
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{message?.status === 'failed-permanent'
|
{message?.status === 'failed-permanent'
|
||||||
? 'Failed to update'
|
? t('core:message.error.update_failed', {
|
||||||
: 'Updating...'}
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
: t('core:message.generic.updating', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : isTemp ? (
|
) : isTemp ? (
|
||||||
<Typography
|
<Typography
|
||||||
@ -537,8 +566,12 @@ export const MessageItem = React.memo(
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{message?.status === 'failed-permanent'
|
{message?.status === 'failed-permanent'
|
||||||
? 'Failed to send'
|
? t('core:message.error.send_failed', {
|
||||||
: 'Sending...'}
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
: t('core:message.generic.sending', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
@ -551,7 +584,9 @@ export const MessageItem = React.memo(
|
|||||||
fontStyle: 'italic',
|
fontStyle: 'italic',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Edited
|
{t('core:message.generic.edited', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
<Typography
|
<Typography
|
||||||
@ -577,6 +612,7 @@ export const MessageItem = React.memo(
|
|||||||
|
|
||||||
export const ReplyPreview = ({ message, isEdit = false }) => {
|
export const ReplyPreview = ({ message, isEdit = false }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
@ -612,7 +648,9 @@ export const ReplyPreview = ({ message, isEdit = false }) => {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Editing Message
|
{t('core:message.generic.editing_message', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
) : (
|
) : (
|
||||||
<Typography
|
<Typography
|
||||||
@ -621,7 +659,10 @@ export const ReplyPreview = ({ message, isEdit = false }) => {
|
|||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Replied to {message?.senderName || message?.senderAddress}
|
{t('core:message.generic.replied_to', {
|
||||||
|
person: message?.senderName || message?.senderAddress,
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
|
import { memo, useCallback, useEffect, useMemo, useRef } from 'react';
|
||||||
import { EditorProvider, useCurrentEditor } from '@tiptap/react';
|
import { EditorProvider, useCurrentEditor } from '@tiptap/react';
|
||||||
import StarterKit from '@tiptap/starter-kit';
|
import StarterKit from '@tiptap/starter-kit';
|
||||||
import { Color } from '@tiptap/extension-color';
|
import { Color } from '@tiptap/extension-color';
|
||||||
@ -31,6 +31,8 @@ import { isDisabledEditorEnterAtom } from '../../atoms/global.js';
|
|||||||
import { Box, Checkbox, Typography, useTheme } from '@mui/material';
|
import { Box, Checkbox, Typography, useTheme } from '@mui/material';
|
||||||
import { useAtom } from 'jotai';
|
import { useAtom } from 'jotai';
|
||||||
import { fileToBase64 } from '../../utils/fileReading/index.js';
|
import { fileToBase64 } from '../../utils/fileReading/index.js';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import i18next from 'i18next';
|
||||||
|
|
||||||
function textMatcher(doc, from) {
|
function textMatcher(doc, from) {
|
||||||
const textBeforeCursor = doc.textBetween(0, from, ' ', ' ');
|
const textBeforeCursor = doc.textBetween(0, from, ' ', ' ');
|
||||||
@ -42,7 +44,7 @@ function textMatcher(doc, from) {
|
|||||||
return { start, query };
|
return { start, query };
|
||||||
}
|
}
|
||||||
|
|
||||||
const MenuBar = React.memo(
|
const MenuBar = memo(
|
||||||
({
|
({
|
||||||
setEditorRef,
|
setEditorRef,
|
||||||
isChat,
|
isChat,
|
||||||
@ -52,6 +54,7 @@ const MenuBar = React.memo(
|
|||||||
const { editor } = useCurrentEditor();
|
const { editor } = useCurrentEditor();
|
||||||
const fileInputRef = useRef(null);
|
const fileInputRef = useRef(null);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (editor && setEditorRef) {
|
if (editor && setEditorRef) {
|
||||||
@ -143,6 +146,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatBoldIcon />
|
<FormatBoldIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleItalic().run()}
|
onClick={() => editor.chain().focus().toggleItalic().run()}
|
||||||
disabled={!editor.can().chain().focus().toggleItalic().run()}
|
disabled={!editor.can().chain().focus().toggleItalic().run()}
|
||||||
@ -155,6 +159,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatItalicIcon />
|
<FormatItalicIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleStrike().run()}
|
onClick={() => editor.chain().focus().toggleStrike().run()}
|
||||||
disabled={!editor.can().chain().focus().toggleStrike().run()}
|
disabled={!editor.can().chain().focus().toggleStrike().run()}
|
||||||
@ -167,6 +172,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<StrikethroughSIcon />
|
<StrikethroughSIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleCode().run()}
|
onClick={() => editor.chain().focus().toggleCode().run()}
|
||||||
disabled={!editor.can().chain().focus().toggleCode().run()}
|
disabled={!editor.can().chain().focus().toggleCode().run()}
|
||||||
@ -179,6 +185,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<CodeIcon />
|
<CodeIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().unsetAllMarks().run()}
|
onClick={() => editor.chain().focus().unsetAllMarks().run()}
|
||||||
sx={{
|
sx={{
|
||||||
@ -194,6 +201,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatClearIcon />
|
<FormatClearIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
onClick={() => editor.chain().focus().toggleBulletList().run()}
|
||||||
sx={{
|
sx={{
|
||||||
@ -205,6 +213,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatListBulletedIcon />
|
<FormatListBulletedIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
||||||
sx={{
|
sx={{
|
||||||
@ -216,6 +225,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatListNumberedIcon />
|
<FormatListNumberedIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
||||||
sx={{
|
sx={{
|
||||||
@ -227,6 +237,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<DeveloperModeIcon />
|
<DeveloperModeIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
||||||
sx={{
|
sx={{
|
||||||
@ -238,6 +249,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatQuoteIcon />
|
<FormatQuoteIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().setHorizontalRule().run()}
|
onClick={() => editor.chain().focus().setHorizontalRule().run()}
|
||||||
disabled={!editor.can().chain().focus().setHorizontalRule().run()}
|
disabled={!editor.can().chain().focus().setHorizontalRule().run()}
|
||||||
@ -245,6 +257,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<HorizontalRuleIcon />
|
<HorizontalRuleIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
editor.chain().focus().toggleHeading({ level: 1 }).run()
|
editor.chain().focus().toggleHeading({ level: 1 }).run()
|
||||||
@ -258,6 +271,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<FormatHeadingIcon fontSize="small" />
|
<FormatHeadingIcon fontSize="small" />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().undo().run()}
|
onClick={() => editor.chain().focus().undo().run()}
|
||||||
disabled={!editor.can().chain().focus().undo().run()}
|
disabled={!editor.can().chain().focus().undo().run()}
|
||||||
@ -265,6 +279,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<UndoIcon />
|
<UndoIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<IconButton
|
<IconButton
|
||||||
onClick={() => editor.chain().focus().redo().run()}
|
onClick={() => editor.chain().focus().redo().run()}
|
||||||
disabled={!editor.can().chain().focus().redo().run()}
|
disabled={!editor.can().chain().focus().redo().run()}
|
||||||
@ -272,13 +287,14 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<RedoIcon />
|
<RedoIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
{isChat && (
|
{isChat && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
marginLeft: '5px',
|
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
display: 'flex',
|
||||||
|
marginLeft: '5px',
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setIsDisabledEditorEnter(!isDisabledEditorEnter);
|
setIsDisabledEditorEnter(!isDisabledEditorEnter);
|
||||||
@ -304,10 +320,13 @@ const MenuBar = React.memo(
|
|||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
disable enter
|
{t('core:action.disable_enter', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isChat && (
|
{!isChat && (
|
||||||
<>
|
<>
|
||||||
<IconButton
|
<IconButton
|
||||||
@ -319,6 +338,7 @@ const MenuBar = React.memo(
|
|||||||
>
|
>
|
||||||
<ImageIcon />
|
<ImageIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
type="file"
|
type="file"
|
||||||
ref={fileInputRef}
|
ref={fileInputRef}
|
||||||
@ -348,7 +368,7 @@ const extensions = [
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
Placeholder.configure({
|
Placeholder.configure({
|
||||||
placeholder: 'Start typing here...',
|
placeholder: 'Start typing here...', // doesn't work i18next.t('core:action.start_typing'),
|
||||||
}),
|
}),
|
||||||
ImageResize,
|
ImageResize,
|
||||||
];
|
];
|
||||||
@ -416,12 +436,6 @@ export default ({
|
|||||||
setEditorRef(editorInstance);
|
setEditorRef(editorInstance);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// const users = [
|
|
||||||
// { id: 1, label: 'Alice' },
|
|
||||||
// { id: 2, label: 'Bob' },
|
|
||||||
// { id: 3, label: 'Charlie' },
|
|
||||||
// ];
|
|
||||||
|
|
||||||
const users = useMemo(() => {
|
const users = useMemo(() => {
|
||||||
return (membersWithNames || [])?.map((item) => {
|
return (membersWithNames || [])?.map((item) => {
|
||||||
return {
|
return {
|
||||||
|
@ -70,7 +70,7 @@ export const JoinGroup = () => {
|
|||||||
const fee = await getFee('JOIN_GROUP');
|
const fee = await getFee('JOIN_GROUP');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'JOIN_GROUP',
|
action: 'JOIN_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -118,7 +118,7 @@ export const AddGroup = ({ address, open, setOpen }) => {
|
|||||||
const fee = await getFee('CREATE_GROUP');
|
const fee = await getFee('CREATE_GROUP');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'CREATE_GROUP',
|
action: 'CREATE_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -113,7 +113,7 @@ export const AddGroupList = ({ setInfoSnack, setOpenSnack }) => {
|
|||||||
const fee = await getFee('JOIN_GROUP');
|
const fee = await getFee('JOIN_GROUP');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'JOIN_GROUP',
|
action: 'JOIN_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -182,7 +182,7 @@ export const NewThread = ({
|
|||||||
const missingFields: string[] = [];
|
const missingFields: string[] = [];
|
||||||
|
|
||||||
if (!isMessage && !threadTitle) {
|
if (!isMessage && !threadTitle) {
|
||||||
errorMsg = t('core:question.provide_thread', {
|
errorMsg = t('core:message.question.provide_thread', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ export const NewThread = ({
|
|||||||
feeToShow = +feeToShow * 2;
|
feeToShow = +feeToShow * 2;
|
||||||
}
|
}
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'ARBITRARY',
|
action: 'ARBITRARY',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -1073,7 +1073,7 @@ export const Thread = ({
|
|||||||
<LoadingSnackbar
|
<LoadingSnackbar
|
||||||
open={isLoading}
|
open={isLoading}
|
||||||
info={{
|
info={{
|
||||||
message: t('core:loading_posts', { postProcess: 'capitalizeFirst' }),
|
message: t('core:loading.posts', { postProcess: 'capitalizeFirst' }),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</GroupContainer>
|
</GroupContainer>
|
||||||
|
@ -373,7 +373,6 @@ export const Group = ({
|
|||||||
desktopViewMode,
|
desktopViewMode,
|
||||||
}: GroupProps) => {
|
}: GroupProps) => {
|
||||||
const [desktopSideView, setDesktopSideView] = useState('groups');
|
const [desktopSideView, setDesktopSideView] = useState('groups');
|
||||||
|
|
||||||
const [secretKey, setSecretKey] = useState(null);
|
const [secretKey, setSecretKey] = useState(null);
|
||||||
const [secretKeyPublishDate, setSecretKeyPublishDate] = useState(null);
|
const [secretKeyPublishDate, setSecretKeyPublishDate] = useState(null);
|
||||||
const lastFetchedSecretKey = useRef(null);
|
const lastFetchedSecretKey = useRef(null);
|
||||||
@ -396,14 +395,11 @@ export const Group = ({
|
|||||||
const [openAddGroup, setOpenAddGroup] = useState(false);
|
const [openAddGroup, setOpenAddGroup] = useState(false);
|
||||||
const [isInitialGroups, setIsInitialGroups] = useState(false);
|
const [isInitialGroups, setIsInitialGroups] = useState(false);
|
||||||
const [openManageMembers, setOpenManageMembers] = useState(false);
|
const [openManageMembers, setOpenManageMembers] = useState(false);
|
||||||
|
|
||||||
const setMemberGroups = useSetAtom(memberGroupsAtom);
|
const setMemberGroups = useSetAtom(memberGroupsAtom);
|
||||||
|
|
||||||
const lastGroupNotification = useRef<null | number>(null);
|
const lastGroupNotification = useRef<null | number>(null);
|
||||||
const [timestampEnterData, setTimestampEnterData] = useAtom(
|
const [timestampEnterData, setTimestampEnterData] = useAtom(
|
||||||
timestampEnterDataAtom
|
timestampEnterDataAtom
|
||||||
);
|
);
|
||||||
|
|
||||||
const [chatMode, setChatMode] = useState('groups');
|
const [chatMode, setChatMode] = useState('groups');
|
||||||
const [newChat, setNewChat] = useState(false);
|
const [newChat, setNewChat] = useState(false);
|
||||||
const [openSnack, setOpenSnack] = useState(false);
|
const [openSnack, setOpenSnack] = useState(false);
|
||||||
|
@ -32,6 +32,7 @@ import {
|
|||||||
|
|
||||||
import { timeDifferenceForNotificationChats } from './Group';
|
import { timeDifferenceForNotificationChats } from './Group';
|
||||||
import { useAtom, useAtomValue } from 'jotai';
|
import { useAtom, useAtomValue } from 'jotai';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const GroupList = ({
|
export const GroupList = ({
|
||||||
selectGroupFunc,
|
selectGroupFunc,
|
||||||
@ -49,6 +50,7 @@ export const GroupList = ({
|
|||||||
myAddress,
|
myAddress,
|
||||||
}) => {
|
}) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const [isRunningPublicNode] = useAtom(isRunningPublicNodeAtom);
|
const [isRunningPublicNode] = useAtom(isRunningPublicNodeAtom);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -86,7 +88,9 @@ export const GroupList = ({
|
|||||||
? theme.palette.text.primary
|
? theme.palette.text.primary
|
||||||
: theme.palette.text.secondary
|
: theme.palette.text.secondary
|
||||||
}
|
}
|
||||||
label="Groups"
|
label={t('group:group.group_other', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
selected={desktopSideView === 'groups'}
|
selected={desktopSideView === 'groups'}
|
||||||
customWidth="75px"
|
customWidth="75px"
|
||||||
>
|
>
|
||||||
@ -102,6 +106,7 @@ export const GroupList = ({
|
|||||||
/>
|
/>
|
||||||
</IconWrapper>
|
</IconWrapper>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDesktopSideView('directs');
|
setDesktopSideView('directs');
|
||||||
@ -116,7 +121,9 @@ export const GroupList = ({
|
|||||||
? theme.palette.text.primary
|
? theme.palette.text.primary
|
||||||
: theme.palette.text.secondary
|
: theme.palette.text.secondary
|
||||||
}
|
}
|
||||||
label="Messaging"
|
label={t('group:group.messaging', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
selected={desktopSideView === 'directs'}
|
selected={desktopSideView === 'directs'}
|
||||||
>
|
>
|
||||||
<MessagingIcon
|
<MessagingIcon
|
||||||
@ -165,6 +172,7 @@ export const GroupList = ({
|
|||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -185,7 +193,7 @@ export const GroupList = ({
|
|||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
Group
|
{t('group:group.group', { postProcess: 'capitalizeFirst' })}
|
||||||
</CustomButton>
|
</CustomButton>
|
||||||
|
|
||||||
{!isRunningPublicNode && (
|
{!isRunningPublicNode && (
|
||||||
@ -273,6 +281,7 @@ const GroupItem = React.memo(
|
|||||||
</Avatar>
|
</Avatar>
|
||||||
)}
|
)}
|
||||||
</ListItemAvatar>
|
</ListItemAvatar>
|
||||||
|
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary={group.groupId === '0' ? 'General' : group.groupName}
|
primary={group.groupId === '0' ? 'General' : group.groupName}
|
||||||
secondary={
|
secondary={
|
||||||
@ -302,6 +311,7 @@ const GroupItem = React.memo(
|
|||||||
fontSize: '16px',
|
fontSize: '16px',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{announcement && !announcement?.seentimestamp && (
|
{announcement && !announcement?.seentimestamp && (
|
||||||
<CampaignIcon
|
<CampaignIcon
|
||||||
sx={{
|
sx={{
|
||||||
@ -311,6 +321,7 @@ const GroupItem = React.memo(
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -335,6 +346,7 @@ const GroupItem = React.memo(
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{groupProperty?.isOpen === false && (
|
{groupProperty?.isOpen === false && (
|
||||||
<LockIcon
|
<LockIcon
|
||||||
sx={{
|
sx={{
|
||||||
|
@ -17,7 +17,7 @@ export const InviteMember = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
|
|||||||
const fee = await getFee('GROUP_INVITE');
|
const fee = await getFee('GROUP_INVITE');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'GROUP_INVITE',
|
action: 'GROUP_INVITE',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -88,7 +88,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => {
|
|||||||
try {
|
try {
|
||||||
const fee = await getFee('CANCEL_GROUP_BAN');
|
const fee = await getFee('CANCEL_GROUP_BAN');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'CANCEL_GROUP_BAN',
|
action: 'CANCEL_GROUP_BAN',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -276,7 +276,7 @@ export const ListOfGroupPromotions = () => {
|
|||||||
const groupId = group.groupId;
|
const groupId = group.groupId;
|
||||||
const fee = await getFee('JOIN_GROUP');
|
const fee = await getFee('JOIN_GROUP');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'JOIN_GROUP',
|
action: 'JOIN_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
@ -575,7 +575,7 @@ export const ListOfGroupPromotions = () => {
|
|||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<Typography>
|
<Typography>
|
||||||
{t('group.message.generic.invalid_data', {
|
{t('group:message.generic.invalid_data', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -94,7 +94,7 @@ export const ListOfInvites = ({
|
|||||||
const fee = await getFee('CANCEL_GROUP_INVITE');
|
const fee = await getFee('CANCEL_GROUP_INVITE');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'CANCEL_GROUP_INVITE',
|
action: 'CANCEL_GROUP_INVITE',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -97,7 +97,7 @@ export const ListOfJoinRequests = ({
|
|||||||
const fee = await getFee('GROUP_INVITE');
|
const fee = await getFee('GROUP_INVITE');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'GROUP_INVITE',
|
action: 'GROUP_INVITE',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -59,7 +59,7 @@ const ListOfMembers = ({
|
|||||||
try {
|
try {
|
||||||
const fee = await getFee('GROUP_KICK');
|
const fee = await getFee('GROUP_KICK');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'GROUP_KICK',
|
action: 'GROUP_KICK',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
@ -117,7 +117,7 @@ const ListOfMembers = ({
|
|||||||
const fee = await getFee('GROUP_BAN');
|
const fee = await getFee('GROUP_BAN');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'GROUP_BAN',
|
action: 'GROUP_BAN',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
@ -177,7 +177,7 @@ const ListOfMembers = ({
|
|||||||
try {
|
try {
|
||||||
const fee = await getFee('ADD_GROUP_ADMIN');
|
const fee = await getFee('ADD_GROUP_ADMIN');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'ADD_GROUP_ADMIN',
|
action: 'ADD_GROUP_ADMIN',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
@ -234,7 +234,7 @@ const ListOfMembers = ({
|
|||||||
try {
|
try {
|
||||||
const fee = await getFee('REMOVE_GROUP_ADMIN');
|
const fee = await getFee('REMOVE_GROUP_ADMIN');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'REMOVE_GROUP_ADMIN',
|
action: 'REMOVE_GROUP_ADMIN',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -84,7 +84,7 @@ export const ManageMembers = ({
|
|||||||
setIsLoadingLeave(true);
|
setIsLoadingLeave(true);
|
||||||
const fee = await getFee('LEAVE_GROUP');
|
const fee = await getFee('LEAVE_GROUP');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'LEAVE_GROUP',
|
action: 'LEAVE_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -76,7 +76,7 @@ export const ThingsToDoInitial = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{!isLoaded
|
{!isLoaded
|
||||||
? t('core:loading', { postProcess: 'capitalizeFirst' })
|
? t('core:loading.generic', { postProcess: 'capitalizeFirst' })
|
||||||
: t('tutorial:initial.getting_started', {
|
: t('tutorial:initial.getting_started', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
|
@ -99,7 +99,7 @@ export const UserListOfInvites = ({
|
|||||||
const fee = await getFee('JOIN_GROUP');
|
const fee = await getFee('JOIN_GROUP');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
action: 'JOIN_GROUP',
|
action: 'JOIN_GROUP',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
|
@ -301,7 +301,7 @@ export const Minting = ({ setIsOpenMinting, myAddress, show }) => {
|
|||||||
const createRewardShare = useCallback(async (publicKey, recipient) => {
|
const createRewardShare = useCallback(async (publicKey, recipient) => {
|
||||||
const fee = await getFee('REWARD_SHARE');
|
const fee = await getFee('REWARD_SHARE');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.perform_transaction', {
|
message: t('core:message.question.perform_transaction', {
|
||||||
// TODO move from group into core namespace
|
// TODO move from group into core namespace
|
||||||
action: 'REWARD_SHARE',
|
action: 'REWARD_SHARE',
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
|
@ -37,7 +37,8 @@ export const QortPayment = ({ balance, show, onSuccess, defaultPaymentTo }) => {
|
|||||||
setSendPaymentError('Please enter your wallet password');
|
setSendPaymentError('Please enter your wallet password');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const fee = await getFee('PAYMENT');
|
|
||||||
|
const fee = await getFee('PAYMENT'); // TODO translate
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: `Would you like to transfer ${Number(paymentAmount)} QORT?`,
|
message: `Would you like to transfer ${Number(paymentAmount)} QORT?`,
|
||||||
@ -148,7 +149,7 @@ export const QortPayment = ({ balance, show, onSuccess, defaultPaymentTo }) => {
|
|||||||
<Spacer height="6px" />
|
<Spacer height="6px" />
|
||||||
|
|
||||||
<CustomLabel htmlFor="standard-adornment-password">
|
<CustomLabel htmlFor="standard-adornment-password">
|
||||||
Confirm Wallet Password
|
Confirm wallet password
|
||||||
</CustomLabel>
|
</CustomLabel>
|
||||||
|
|
||||||
<Spacer height="5px" />
|
<Spacer height="5px" />
|
||||||
|
@ -127,7 +127,7 @@ export const RegisterName = ({
|
|||||||
|
|
||||||
const fee = await getFee('REGISTER_NAME');
|
const fee = await getFee('REGISTER_NAME');
|
||||||
await show({
|
await show({
|
||||||
message: t('core:question.register_name', {
|
message: t('core:message.question.register_name', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
|
@ -155,7 +155,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: t('core:save_options.publish_qnd', {
|
message: t('core:message.generic.publish_qnd', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
}),
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
@ -306,7 +306,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.settings', {
|
{t('core:message.generic.settings', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>{' '}
|
</Typography>{' '}
|
||||||
@ -335,7 +335,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.qdn', {
|
{t('core:message.generic.qdn', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Button>
|
</Button>
|
||||||
@ -366,7 +366,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.register_name', {
|
{t('core:message.generic.register_name', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -387,7 +387,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.unsaved_changes', {
|
{t('core:message.generic.unsaved_changes', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -424,7 +424,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:question.reset_qdn', {
|
{t('core:message.question.reset_qdn', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -446,7 +446,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.revert_qdn', {
|
{t('core:message.generic.revert_qdn', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
@ -461,7 +461,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{' '}
|
{' '}
|
||||||
{t('core:question.reset_pinned', {
|
{t('core:message.question.reset_pinned', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -471,7 +471,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
onClick={revertChanges}
|
onClick={revertChanges}
|
||||||
variant="contained"
|
variant="contained"
|
||||||
>
|
>
|
||||||
{t('core:save_options.revert_default', {
|
{t('core:message.generic.revert_default', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
@ -495,7 +495,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:question.overwrite_changes', {
|
{t('core:message.question.overwrite_changes', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
@ -517,7 +517,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.overwrite_qdn', {
|
{t('core:message.generic.overwrite_qdn', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</LoadingButton>
|
</LoadingButton>
|
||||||
@ -537,7 +537,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
|||||||
fontSize: '14px',
|
fontSize: '14px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:save_options.no_pinned_changes', {
|
{t('core:message.generic.no_pinned_changes', {
|
||||||
postProcess: 'capitalizeFirst',
|
postProcess: 'capitalizeFirst',
|
||||||
})}
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
@ -1,175 +1,186 @@
|
|||||||
|
|
||||||
|
|
||||||
// Qortal TX types
|
// Qortal TX types
|
||||||
const TX_TYPES = {
|
const TX_TYPES = {
|
||||||
1: "Genesis",
|
1: 'Genesis',
|
||||||
2: "Payment",
|
2: 'Payment',
|
||||||
3: "Name registration",
|
3: 'Name registration',
|
||||||
4: "Name update",
|
4: 'Name update',
|
||||||
5: "Sell name",
|
5: 'Sell name',
|
||||||
6: "Cancel sell name",
|
6: 'Cancel sell name',
|
||||||
7: "Buy name",
|
7: 'Buy name',
|
||||||
8: "Create poll",
|
8: 'Create poll',
|
||||||
9: "Vote in poll",
|
9: 'Vote in poll',
|
||||||
10: "Arbitrary",
|
10: 'Arbitrary',
|
||||||
11: "Issue asset",
|
11: 'Issue asset',
|
||||||
12: "Transfer asset",
|
12: 'Transfer asset',
|
||||||
13: "Create asset order",
|
13: 'Create asset order',
|
||||||
14: "Cancel asset order",
|
14: 'Cancel asset order',
|
||||||
15: "Multi-payment transaction",
|
15: 'Multi-payment transaction',
|
||||||
16: "Deploy AT",
|
16: 'Deploy AT',
|
||||||
17: "Message",
|
17: 'Message',
|
||||||
18: "Chat",
|
18: 'Chat',
|
||||||
19: "Publicize",
|
19: 'Publicize',
|
||||||
20: "Airdrop",
|
20: 'Airdrop',
|
||||||
21: "AT",
|
21: 'AT',
|
||||||
22: "Create group",
|
22: 'Create group',
|
||||||
23: "Update group",
|
23: 'Update group',
|
||||||
24: "Add group admin",
|
24: 'Add group admin',
|
||||||
25: "Remove group admin",
|
25: 'Remove group admin',
|
||||||
26: "Group ban",
|
26: 'Group ban',
|
||||||
27: "Cancel group ban",
|
27: 'Cancel group ban',
|
||||||
28: "Group kick",
|
28: 'Group kick',
|
||||||
29: "Group invite",
|
29: 'Group invite',
|
||||||
30: "Cancel group invite",
|
30: 'Cancel group invite',
|
||||||
31: "Join group",
|
31: 'Join group',
|
||||||
32: "Leave group",
|
32: 'Leave group',
|
||||||
33: "Group approval",
|
33: 'Group approval',
|
||||||
34: "Set group",
|
34: 'Set group',
|
||||||
35: "Update asset",
|
35: 'Update asset',
|
||||||
36: "Account flags",
|
36: 'Account flags',
|
||||||
37: "Enable forging",
|
37: 'Enable forging',
|
||||||
38: "Reward share",
|
38: 'Reward share',
|
||||||
39: "Account level",
|
39: 'Account level',
|
||||||
40: "Transfer privs",
|
40: 'Transfer privs',
|
||||||
41: "Presence"
|
41: 'Presence',
|
||||||
}
|
};
|
||||||
|
|
||||||
// Qortal error codes
|
// Qortal error codes
|
||||||
const ERROR_CODES = {
|
const ERROR_CODES = {
|
||||||
1: "Valid OK",
|
1: 'Valid OK',
|
||||||
2: "Invalid address",
|
2: 'Invalid address',
|
||||||
3: "Negative amount",
|
3: 'Negative amount',
|
||||||
4: "Nagative fee",
|
4: 'Nagative fee',
|
||||||
5: "No balance",
|
5: 'No balance',
|
||||||
6: "Invalid reference",
|
6: 'Invalid reference',
|
||||||
7: "Invalid time length",
|
7: 'Invalid time length',
|
||||||
8: "Invalid value length",
|
8: 'Invalid value length',
|
||||||
9: "Name already registered",
|
9: 'Name already registered',
|
||||||
10: "Name does not exist",
|
10: 'Name does not exist',
|
||||||
11: "Invalid name owner",
|
11: 'Invalid name owner',
|
||||||
12: "Name already for sale",
|
12: 'Name already for sale',
|
||||||
13: "Name not for sale",
|
13: 'Name not for sale',
|
||||||
14: "Name buyer already owner",
|
14: 'Name buyer already owner',
|
||||||
15: "Invalid amount",
|
15: 'Invalid amount',
|
||||||
16: "Invalid seller",
|
16: 'Invalid seller',
|
||||||
17: "Name not lowercase",
|
17: 'Name not lowercase',
|
||||||
18: "Invalid description length",
|
18: 'Invalid description length',
|
||||||
19: "Invalid options length",
|
19: 'Invalid options length',
|
||||||
20: "Invalid option length",
|
20: 'Invalid option length',
|
||||||
21: "Duplicate option",
|
21: 'Duplicate option',
|
||||||
22: "Poll already created",
|
22: 'Poll already created',
|
||||||
23: "Poll already has votes",
|
23: 'Poll already has votes',
|
||||||
24: "Poll does not exist",
|
24: 'Poll does not exist',
|
||||||
25: "Option does not exist",
|
25: 'Option does not exist',
|
||||||
26: "Already voted for that option",
|
26: 'Already voted for that option',
|
||||||
27: "Invalid data length",
|
27: 'Invalid data length',
|
||||||
28: "Invalid quantity",
|
28: 'Invalid quantity',
|
||||||
29: "Asset does not exist",
|
29: 'Asset does not exist',
|
||||||
30: "Invalid return",
|
30: 'Invalid return',
|
||||||
31: "Have equals want",
|
31: 'Have equals want',
|
||||||
32: "Order does not exist",
|
32: 'Order does not exist',
|
||||||
33: "Invalid order creator",
|
33: 'Invalid order creator',
|
||||||
34: "Invalid payments length",
|
34: 'Invalid payments length',
|
||||||
35: "Negative price",
|
35: 'Negative price',
|
||||||
36: "Invalid creation bytes",
|
36: 'Invalid creation bytes',
|
||||||
37: "Invalid tags length",
|
37: 'Invalid tags length',
|
||||||
38: "Invalid type length",
|
38: 'Invalid type length',
|
||||||
39: "Invalid AT transaction",
|
39: 'Invalid AT transaction',
|
||||||
40: "Insufficient fee",
|
40: 'Insufficient fee',
|
||||||
41: "Asset does not match AT",
|
41: 'Asset does not match AT',
|
||||||
|
|
||||||
43: "Asset already exists",
|
43: 'Asset already exists',
|
||||||
44: "Missing creator",
|
44: 'Missing creator',
|
||||||
45: "Timestamp too old",
|
45: 'Timestamp too old',
|
||||||
46: "Timestamp too new",
|
46: 'Timestamp too new',
|
||||||
47: "Too many unconfirmed",
|
47: 'Too many unconfirmed',
|
||||||
48: "Group already exists",
|
48: 'Group already exists',
|
||||||
49: "Group does not exist",
|
49: 'Group does not exist',
|
||||||
50: "Invalid group owner",
|
50: 'Invalid group owner',
|
||||||
51: "Already group memeber",
|
51: 'Already group memeber',
|
||||||
52: "Group owner can not leave",
|
52: 'Group owner can not leave',
|
||||||
53: "Not group member",
|
53: 'Not group member',
|
||||||
54: "Already group admin",
|
54: 'Already group admin',
|
||||||
55: "Not group admin",
|
55: 'Not group admin',
|
||||||
56: "Invalid lifetime",
|
56: 'Invalid lifetime',
|
||||||
57: "Invite unknown",
|
57: 'Invite unknown',
|
||||||
58: "Ban exists",
|
58: 'Ban exists',
|
||||||
59: "Ban unknown",
|
59: 'Ban unknown',
|
||||||
60: "Banned from group",
|
60: 'Banned from group',
|
||||||
61: "Join request",
|
61: 'Join request',
|
||||||
62: "Invalid group approval threshold",
|
62: 'Invalid group approval threshold',
|
||||||
63: "Group ID mismatch",
|
63: 'Group ID mismatch',
|
||||||
64: "Invalid group ID",
|
64: 'Invalid group ID',
|
||||||
65: "Transaction unknown",
|
65: 'Transaction unknown',
|
||||||
66: "Transaction already confirmed",
|
66: 'Transaction already confirmed',
|
||||||
67: "Invalid TX group",
|
67: 'Invalid TX group',
|
||||||
68: "TX group ID mismatch",
|
68: 'TX group ID mismatch',
|
||||||
69: "Multiple names forbidden",
|
69: 'Multiple names forbidden',
|
||||||
70: "Invalid asset owner",
|
70: 'Invalid asset owner',
|
||||||
71: "AT is finished",
|
71: 'AT is finished',
|
||||||
72: "No flag permission",
|
72: 'No flag permission',
|
||||||
73: "Not minting accout",
|
73: 'Not minting accout',
|
||||||
|
|
||||||
77: "Invalid rewardshare percent",
|
77: 'Invalid rewardshare percent',
|
||||||
78: "Public key unknown",
|
78: 'Public key unknown',
|
||||||
79: "Invalid public key",
|
79: 'Invalid public key',
|
||||||
80: "AT unknown",
|
80: 'AT unknown',
|
||||||
81: "AT already exists",
|
81: 'AT already exists',
|
||||||
82: "Group approval not required",
|
82: 'Group approval not required',
|
||||||
83: "Group approval decided",
|
83: 'Group approval decided',
|
||||||
84: "Maximum reward shares",
|
84: 'Maximum reward shares',
|
||||||
85: "Transaction already exists",
|
85: 'Transaction already exists',
|
||||||
86: "No blockchain lock",
|
86: 'No blockchain lock',
|
||||||
87: "Order already closed",
|
87: 'Order already closed',
|
||||||
88: "Clock not synced",
|
88: 'Clock not synced',
|
||||||
89: "Asset not spendable",
|
89: 'Asset not spendable',
|
||||||
90: "Account can not reward share",
|
90: 'Account can not reward share',
|
||||||
91: "Self share exists",
|
91: 'Self share exists',
|
||||||
92: "Account already exists",
|
92: 'Account already exists',
|
||||||
93: "Invalid group block delay",
|
93: 'Invalid group block delay',
|
||||||
94: "Incorrect nonce",
|
94: 'Incorrect nonce',
|
||||||
95: "Ivalid timestamp signature",
|
95: 'Ivalid timestamp signature',
|
||||||
96: "Address blocked",
|
96: 'Address blocked',
|
||||||
97: "Name Blocked",
|
97: 'Name Blocked',
|
||||||
98: "Group approval required",
|
98: 'Group approval required',
|
||||||
99: "Account not transferable",
|
99: 'Account not transferable',
|
||||||
|
|
||||||
999: "Ivalid but ok",
|
999: 'Ivalid but ok',
|
||||||
1000: "Not yet released."
|
1000: 'Not yet released.',
|
||||||
}
|
};
|
||||||
|
|
||||||
// Qortal 8 decimals
|
// Qortal 8 decimals
|
||||||
const QORT_DECIMALS = 1e8
|
const QORT_DECIMALS = 1e8;
|
||||||
|
|
||||||
// Q for Qortal
|
// Q for Qortal
|
||||||
const ADDRESS_VERSION = 58
|
const ADDRESS_VERSION = 58;
|
||||||
|
|
||||||
// Proxy for api calls
|
// Proxy for api calls
|
||||||
const PROXY_URL = "/proxy/"
|
const PROXY_URL = '/proxy/';
|
||||||
|
|
||||||
// Chat reference timestamp
|
// Chat reference timestamp
|
||||||
const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 1674316800000
|
const CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP = 1674316800000;
|
||||||
|
|
||||||
// Dynamic fee timestamp
|
// Dynamic fee timestamp
|
||||||
const DYNAMIC_FEE_TIMESTAMP = 1692118800000
|
const DYNAMIC_FEE_TIMESTAMP = 1692118800000;
|
||||||
|
|
||||||
|
|
||||||
// Used as a salt for all Qora addresses. Salts used for storing your private keys in local storage will be randomly generated
|
// Used as a salt for all Qora addresses. Salts used for storing your private keys in local storage will be randomly generated
|
||||||
const STATIC_SALT = new Uint8Array([54, 190, 201, 206, 65, 29, 123, 129, 147, 231, 180, 166, 171, 45, 95, 165, 78, 200, 208, 194, 44, 207, 221, 146, 45, 238, 68, 68, 69, 102, 62, 6])
|
const STATIC_SALT = new Uint8Array([
|
||||||
const BCRYPT_ROUNDS = 10 // Remember that the total work spent on key derivation is BCRYPT_ROUNDS * KDF_THREADS
|
54, 190, 201, 206, 65, 29, 123, 129, 147, 231, 180, 166, 171, 45, 95, 165, 78,
|
||||||
const BCRYPT_VERSION = "2a"
|
200, 208, 194, 44, 207, 221, 146, 45, 238, 68, 68, 69, 102, 62, 6,
|
||||||
const STATIC_BCRYPT_SALT = `$${BCRYPT_VERSION}$${BCRYPT_ROUNDS}$IxVE941tXVUD4cW0TNVm.O`
|
]);
|
||||||
const KDF_THREADS = 16
|
const BCRYPT_ROUNDS = 10; // Remember that the total work spent on key derivation is BCRYPT_ROUNDS * KDF_THREADS
|
||||||
|
const BCRYPT_VERSION = '2a';
|
||||||
|
const STATIC_BCRYPT_SALT = `$${BCRYPT_VERSION}$${BCRYPT_ROUNDS}$IxVE941tXVUD4cW0TNVm.O`;
|
||||||
|
const KDF_THREADS = 16;
|
||||||
|
|
||||||
export { TX_TYPES, ERROR_CODES, QORT_DECIMALS, PROXY_URL, STATIC_SALT, ADDRESS_VERSION, KDF_THREADS, STATIC_BCRYPT_SALT, CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP, DYNAMIC_FEE_TIMESTAMP }
|
export {
|
||||||
|
TX_TYPES,
|
||||||
|
ERROR_CODES,
|
||||||
|
QORT_DECIMALS,
|
||||||
|
PROXY_URL,
|
||||||
|
STATIC_SALT,
|
||||||
|
ADDRESS_VERSION,
|
||||||
|
KDF_THREADS,
|
||||||
|
STATIC_BCRYPT_SALT,
|
||||||
|
CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP,
|
||||||
|
DYNAMIC_FEE_TIMESTAMP,
|
||||||
|
};
|
||||||
|
@ -1,8 +1,26 @@
|
|||||||
{
|
{
|
||||||
"account": {
|
"account": {
|
||||||
"your": "ihr Konto",
|
"your": "dein Konto",
|
||||||
"account_many": "Konten",
|
"account_many": "Konten",
|
||||||
"account_one": "Konto"
|
"account_one": "Konto",
|
||||||
|
"selected": "ausgewähltes Konto"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"add": {
|
||||||
|
"account": "Konto hinzufügen",
|
||||||
|
"seed_phrase": "Seed-Phrase hinzufügen"
|
||||||
|
},
|
||||||
|
"authenticate": "authentifizieren",
|
||||||
|
"create_account": "Konto erstellen",
|
||||||
|
"create_qortal_account": "erstelle dein Qortal-Konto, indem du unten auf <next>WEITER</next> klickst.",
|
||||||
|
"choose_password": "neues Passwort wählen",
|
||||||
|
"download_account": "Konto herunterladen",
|
||||||
|
"export_seedphrase": "Seedphrase exportieren",
|
||||||
|
"publish_admin_secret_key": "Admin-Geheimschlüssel veröffentlichen",
|
||||||
|
"publish_group_secret_key": "Gruppen-Geheimschlüssel veröffentlichen",
|
||||||
|
"reencrypt_key": "Schlüssel neu verschlüsseln",
|
||||||
|
"return_to_list": "zur Liste zurückkehren",
|
||||||
|
"setup_qortal_account": "Qortal-Konto einrichten"
|
||||||
},
|
},
|
||||||
"advanced_users": "für fortgeschrittene Benutzer",
|
"advanced_users": "für fortgeschrittene Benutzer",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
@ -13,11 +31,33 @@
|
|||||||
"key": "API-Schlüssel",
|
"key": "API-Schlüssel",
|
||||||
"select_valid": "gültigen API-Schlüssel auswählen"
|
"select_valid": "gültigen API-Schlüssel auswählen"
|
||||||
},
|
},
|
||||||
"authenticate": "authentifizieren",
|
|
||||||
"build_version": "Build-Version",
|
"build_version": "Build-Version",
|
||||||
"create_account": "Konto erstellen",
|
"message": {
|
||||||
"download_account": "Konto herunterladen",
|
"error": {
|
||||||
"keep_secure": "Bewahren Sie Ihre Kontodatei sicher auf",
|
"account_creation": "Konto konnte nicht erstellt werden.",
|
||||||
|
"field_not_found_json": "{{ field }} nicht im JSON gefunden",
|
||||||
|
"incorrect_password": "falsches Passwort",
|
||||||
|
"invalid_secret_key": "Geheimschlüssel ist ungültig",
|
||||||
|
"unable_reencrypt_secret_key": "Geheimschlüssel konnte nicht neu verschlüsselt werden"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"congrats_setup": "Glückwunsch, du bist startklar!",
|
||||||
|
"no_account": "keine gespeicherten Konten",
|
||||||
|
"no_minimum_length": "es gibt keine Mindestlängenanforderung",
|
||||||
|
"no_secret_key_published": "noch kein Geheimschlüssel veröffentlicht",
|
||||||
|
"fetching_admin_secret_key": "Admin-Geheimschlüssel wird abgerufen",
|
||||||
|
"fetching_group_secret_key": "Gruppen-Geheimschlüssel wird veröffentlicht",
|
||||||
|
"last_encryption_date": "letztes Verschlüsselungsdatum: {{ date }} von {{ name }}",
|
||||||
|
"keep_secure": "halte deine Kontodatei sicher",
|
||||||
|
"publishing_key": "Hinweis: Nach der Veröffentlichung des Schlüssels dauert es ein paar Minuten, bis er erscheint. Bitte etwas Geduld.",
|
||||||
|
"seedphrase_notice": "eine <seed>SEEDPHRASE</seed> wurde im Hintergrund zufällig generiert.",
|
||||||
|
"type_seed": "gib deine Seed-Phrase ein oder füge sie ein",
|
||||||
|
"your_accounts": "deine gespeicherten Konten"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "Geheimschlüssel erfolgreich neu verschlüsselt. Die Änderungen werden in ein paar Minuten wirksam. Bitte die Gruppe in 5 Minuten aktualisieren."
|
||||||
|
}
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"choose": "benutzerdefinierten Node auswählen",
|
"choose": "benutzerdefinierten Node auswählen",
|
||||||
"custom_many": "benutzerdefinierte Nodes",
|
"custom_many": "benutzerdefinierte Nodes",
|
||||||
@ -26,17 +66,31 @@
|
|||||||
"using": "verwende Node",
|
"using": "verwende Node",
|
||||||
"using_public": "öffentlichen Node verwenden"
|
"using_public": "öffentlichen Node verwenden"
|
||||||
},
|
},
|
||||||
|
"note": "Hinweis",
|
||||||
"password": "Passwort",
|
"password": "Passwort",
|
||||||
"password_confirmation": "Passwort bestätigen",
|
"password_confirmation": "Passwort bestätigen",
|
||||||
"return_to_list": "zurück zur Liste",
|
"seed": "Seed-Phrase",
|
||||||
|
"seed_your": "deine Seedphrase",
|
||||||
|
"tips": {
|
||||||
|
"additional_wallet": "verwende diese Option, um weitere Qortal-Wallets zu verbinden, die du bereits erstellt hast, um dich später mit ihnen anzumelden. Du benötigst deine Sicherungs-JSON-Datei.",
|
||||||
|
"digital_id": "deine Wallet ist wie deine digitale ID auf Qortal und dient zur Anmeldung im Qortal-Interface. Sie enthält deine öffentliche Adresse und den Qortal-Namen, den du später auswählst. Jede Transaktion ist mit deiner ID verknüpft. Hier verwaltest du dein QORT und andere handelbare Kryptowährungen auf Qortal.",
|
||||||
|
"existing_account": "du hast bereits ein Qortal-Konto? Gib hier deine geheime Sicherungsphrase ein, um darauf zuzugreifen. Diese Phrase ist eine Möglichkeit zur Wiederherstellung deines Kontos.",
|
||||||
|
"key_encrypt_admin": "dieser Schlüssel dient der Verschlüsselung von ADMIN-Inhalten. Nur Admins können diese Inhalte sehen.",
|
||||||
|
"key_encrypt_group": "dieser Schlüssel dient der Verschlüsselung von GRUPPEN-Inhalten. Aktuell wird nur dieser Schlüssel in der Benutzeroberfläche verwendet. Alle Gruppenmitglieder können die Inhalte sehen.",
|
||||||
|
"new_account": "ein Konto zu erstellen bedeutet, eine neue Wallet und digitale ID für die Nutzung von Qortal zu generieren. Nach der Kontoerstellung kannst du QORT erhalten, einen Namen und Avatar kaufen, Videos und Blogs veröffentlichen und vieles mehr.",
|
||||||
|
"new_users": "neue Nutzer starten hier!",
|
||||||
|
"safe_place": "speichere dein Konto an einem Ort, den du nicht vergisst!",
|
||||||
|
"view_seedphrase": "wenn du die SEEDPHRASE ANZEIGEN möchtest, klicke auf das Wort 'SEEDPHRASE' in diesem Text. Seedphrases erzeugen den privaten Schlüssel für dein Qortal-Konto. Aus Sicherheitsgründen werden sie standardmäßig NICHT angezeigt.",
|
||||||
|
"wallet_secure": "halte deine Wallet-Datei sicher."
|
||||||
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "Wallet-Passwort bestätigen",
|
"password_confirmation": "Wallet-Passwort bestätigen",
|
||||||
"password": "Wallet-Passwort",
|
"password": "Wallet-Passwort",
|
||||||
"keep_password": "aktuelles Passwort beibehalten",
|
"keep_password": "aktuelles Passwort behalten",
|
||||||
"new_password": "neues Passwort",
|
"new_password": "neues Passwort",
|
||||||
"error": {
|
"error": {
|
||||||
"missing_new_password": "bitte neues Passwort eingeben",
|
"missing_new_password": "bitte ein neues Passwort eingeben",
|
||||||
"missing_password": "bitte Passwort eingeben"
|
"missing_password": "bitte dein Passwort eingeben"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"welcome": "willkommen bei"
|
"welcome": "willkommen bei"
|
||||||
|
@ -12,9 +12,15 @@
|
|||||||
},
|
},
|
||||||
"authenticate": "authenticate",
|
"authenticate": "authenticate",
|
||||||
"create_account": "create account",
|
"create_account": "create account",
|
||||||
|
"create_qortal_account": "create your Qortal account by clicking <next>NEXT</next> below.",
|
||||||
"choose_password": "choose new password",
|
"choose_password": "choose new password",
|
||||||
"download_account": "download account",
|
"download_account": "download account",
|
||||||
"return_to_list": "return to list"
|
"export_seedphrase": "export Seedphrase",
|
||||||
|
"publish_admin_secret_key": "publish admin secret key",
|
||||||
|
"publish_group_secret_key": "publish group secret key",
|
||||||
|
"reencrypt_key": "re-encrypt key",
|
||||||
|
"return_to_list": "return to list",
|
||||||
|
"setup_qortal_account": "set up your Qortal account"
|
||||||
},
|
},
|
||||||
"advanced_users": "for advanced users",
|
"advanced_users": "for advanced users",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
@ -28,13 +34,28 @@
|
|||||||
"build_version": "build version",
|
"build_version": "build version",
|
||||||
"message": {
|
"message": {
|
||||||
"error": {
|
"error": {
|
||||||
"account_creation": "could not create account."
|
"account_creation": "could not create account.",
|
||||||
|
"field_not_found_json": "{{ field }} not found in JSON",
|
||||||
|
"incorrect_password": "incorrect password",
|
||||||
|
"invalid_secret_key": "secretKey is not valid",
|
||||||
|
"unable_reencrypt_secret_key": "unable to re-encrypt secret key"
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
"no_account": "No accounts saved",
|
"congrats_setup": "congrats, you’re all set up!",
|
||||||
|
"no_account": "no accounts saved",
|
||||||
|
"no_minimum_length": "there is no minimum length requirement",
|
||||||
|
"no_secret_key_published": "no secret key published yet",
|
||||||
|
"fetching_admin_secret_key": "fetching Admins secret key",
|
||||||
|
"fetching_group_secret_key": "fetching Group secret key publishes",
|
||||||
|
"last_encryption_date": "last encryption date: {{ date }} by {{ name }}",
|
||||||
"keep_secure": "keep your account file secure",
|
"keep_secure": "keep your account file secure",
|
||||||
|
"publishing_key": "reminder: After publishing the key, it will take a couple of minutes for it to appear. Please just wait.",
|
||||||
|
"seedphrase_notice": "a <seed>SEEDPHRASE</seed> has been randomly generated in the background.",
|
||||||
"type_seed": "type or paste in your seed-phrase",
|
"type_seed": "type or paste in your seed-phrase",
|
||||||
"your_accounts": "your saved accounts"
|
"your_accounts": "your saved accounts"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "successfully re-encrypted secret key. It may take a couple of minutes for the changes to propagate. Refresh the group in 5 mins."
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node": {
|
"node": {
|
||||||
@ -49,12 +70,18 @@
|
|||||||
"password": "password",
|
"password": "password",
|
||||||
"password_confirmation": "confirm password",
|
"password_confirmation": "confirm password",
|
||||||
"seed": "seed phrase",
|
"seed": "seed phrase",
|
||||||
|
"seed_your": "your seedphrase",
|
||||||
"tips": {
|
"tips": {
|
||||||
"additional_wallet": "use this option to connect additional Qortal wallets you've already made, in order to login with them afterwards. You will need access to your backup JSON file in order to do so.",
|
"additional_wallet": "use this option to connect additional Qortal wallets you've already made, in order to login with them afterwards. You will need access to your backup JSON file in order to do so.",
|
||||||
"digital_id": "your wallet is like your digital ID on Qortal, and is how you will login to the Qortal User Interface. It holds your public address and the Qortal name you will eventually choose. Every transaction you make is linked to your ID, and this is where you manage all your QORT and other tradeable cryptocurrencies on Qortal.",
|
"digital_id": "your wallet is like your digital ID on Qortal, and is how you will login to the Qortal User Interface. It holds your public address and the Qortal name you will eventually choose. Every transaction you make is linked to your ID, and this is where you manage all your QORT and other tradeable cryptocurrencies on Qortal.",
|
||||||
"existing_account": "already have a Qortal account? Enter your secret backup phrase here to access it. This phrase is one of the ways to recover your account.",
|
"existing_account": "already have a Qortal account? Enter your secret backup phrase here to access it. This phrase is one of the ways to recover your account.",
|
||||||
|
"key_encrypt_admin": "this key is to encrypt ADMIN related content. Only admins would see content encrypted with it.",
|
||||||
|
"key_encrypt_group": "this key is to encrypt GROUP related content. This is the only one used in this UI as of now. All group members will be able to see content encrypted with this key.",
|
||||||
"new_account": "creating an account means creating a new wallet and digital ID to start using Qortal. Once you have made your account, you can start doing things like obtaining some QORT, buying a name and avatar, publishing videos and blogs, and much more.",
|
"new_account": "creating an account means creating a new wallet and digital ID to start using Qortal. Once you have made your account, you can start doing things like obtaining some QORT, buying a name and avatar, publishing videos and blogs, and much more.",
|
||||||
"new_users": "new users start here!"
|
"new_users": "new users start here!",
|
||||||
|
"safe_place": "save your account in a place where you will remember it!",
|
||||||
|
"view_seedphrase": "if you wish to VIEW THE SEEDPHRASE, click the word 'SEEDPHRASE' in this text. Seedphrases are used to generate the private key for your Qortal account. For security by default, seedphrases are NOT displayed unless specifically chosen.",
|
||||||
|
"wallet_secure": "keep your wallet file secure."
|
||||||
},
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "confirm wallet password",
|
"password_confirmation": "confirm wallet password",
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
"action": {
|
"action": {
|
||||||
"add": "add",
|
"add": "add",
|
||||||
"add_custom_framework": "add custom framework",
|
"add_custom_framework": "add custom framework",
|
||||||
|
"add_reaction": "add reaction",
|
||||||
"accept": "accept",
|
"accept": "accept",
|
||||||
"access": "access",
|
"access": "access",
|
||||||
"backup_account": "backup account",
|
"backup_account": "backup account",
|
||||||
@ -9,11 +10,14 @@
|
|||||||
"cancel": "cancel",
|
"cancel": "cancel",
|
||||||
"cancel_invitation": "cancel invitation",
|
"cancel_invitation": "cancel invitation",
|
||||||
"change": "change",
|
"change": "change",
|
||||||
|
"change_avatar": "change avatar",
|
||||||
"change_file": "change file",
|
"change_file": "change file",
|
||||||
"change_language": "change language",
|
"change_language": "change language",
|
||||||
"choose": "choose",
|
"choose": "choose",
|
||||||
"choose_file": "choose file",
|
"choose_file": "choose file",
|
||||||
|
"choose_image": "choose image",
|
||||||
"close": "close",
|
"close": "close",
|
||||||
|
"close_chat": "close Direct Chat",
|
||||||
"continue": "continue",
|
"continue": "continue",
|
||||||
"continue_logout": "continue to logout",
|
"continue_logout": "continue to logout",
|
||||||
"copy_link": "copy link",
|
"copy_link": "copy link",
|
||||||
@ -24,13 +28,18 @@
|
|||||||
"choose_name": "choose a name",
|
"choose_name": "choose a name",
|
||||||
"decline": "decline",
|
"decline": "decline",
|
||||||
"decrypt": "decrypt",
|
"decrypt": "decrypt",
|
||||||
|
"disable_enter": "disable enter",
|
||||||
"download": "download",
|
"download": "download",
|
||||||
"edit": "edit",
|
"edit": "edit",
|
||||||
"enter_name": "enter a name",
|
"enter_name": "enter a name",
|
||||||
"export": "export",
|
"export": "export",
|
||||||
|
"get_qort": "get QORT at Q-Trade",
|
||||||
|
"hide": "hide",
|
||||||
"import": "import",
|
"import": "import",
|
||||||
"invite": "invite",
|
"invite": "invite",
|
||||||
"join": "join",
|
"join": "join",
|
||||||
|
"leave_comment": "leave comment",
|
||||||
|
"load_announcements": "load older announcements",
|
||||||
"login": "login",
|
"login": "login",
|
||||||
"logout": "logout",
|
"logout": "logout",
|
||||||
"new": {
|
"new": {
|
||||||
@ -46,15 +55,21 @@
|
|||||||
"post_message": "post message",
|
"post_message": "post message",
|
||||||
"publish": "publish",
|
"publish": "publish",
|
||||||
"publish_app": "publish your app",
|
"publish_app": "publish your app",
|
||||||
|
"publish_comment": "publish comment",
|
||||||
"register_name": "register name",
|
"register_name": "register name",
|
||||||
"remove": "remove",
|
"remove": "remove",
|
||||||
|
"remove_reaction": "remove reaction",
|
||||||
"return_apps_dashboard": "return to Apps Dashboard",
|
"return_apps_dashboard": "return to Apps Dashboard",
|
||||||
"save": "save",
|
"save": "save",
|
||||||
|
"search": "search",
|
||||||
"search_apps": "search for apps",
|
"search_apps": "search for apps",
|
||||||
"select_app_type": "select App Type",
|
"select_app_type": "select App Type",
|
||||||
"select_category": "select Category",
|
"select_category": "select Category",
|
||||||
"select_name_app": "select Name/App",
|
"select_name_app": "select Name/App",
|
||||||
|
"set_avatar": "set avatar",
|
||||||
"start_minting": "start minting",
|
"start_minting": "start minting",
|
||||||
|
"start_typing": "start typing here...",
|
||||||
|
"transfer_qort": "Transfer QORT",
|
||||||
"unpin": "unpin",
|
"unpin": "unpin",
|
||||||
"unpin_app": "unpin app",
|
"unpin_app": "unpin app",
|
||||||
"unpin_from_dashboard": "unpin from dashboard",
|
"unpin_from_dashboard": "unpin from dashboard",
|
||||||
@ -93,6 +108,7 @@
|
|||||||
"payment": "payment fee",
|
"payment": "payment fee",
|
||||||
"publish": "publish fee"
|
"publish": "publish fee"
|
||||||
},
|
},
|
||||||
|
"for": "for",
|
||||||
"general_settings": "general settings",
|
"general_settings": "general settings",
|
||||||
"identifier": "identifier",
|
"identifier": "identifier",
|
||||||
"last_height": "last height",
|
"last_height": "last height",
|
||||||
@ -103,8 +119,13 @@
|
|||||||
"join_request": "join request list",
|
"join_request": "join request list",
|
||||||
"member": "member list"
|
"member": "member list"
|
||||||
},
|
},
|
||||||
"loading": "loading...",
|
"loading": {
|
||||||
"loading_posts": "loading posts... please wait.",
|
"announcements": "announcements",
|
||||||
|
"generic": "loading...",
|
||||||
|
"chat": "loading chat... please wait.",
|
||||||
|
"comments": "loading comments... please wait.",
|
||||||
|
"posts": "loading posts... please wait."
|
||||||
|
},
|
||||||
"message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations",
|
"message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations",
|
||||||
"message": {
|
"message": {
|
||||||
"error": {
|
"error": {
|
||||||
@ -112,21 +133,38 @@
|
|||||||
"app_need_name": "your app needs a name",
|
"app_need_name": "your app needs a name",
|
||||||
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
|
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
|
||||||
"generic": "an error occurred",
|
"generic": "an error occurred",
|
||||||
"incorrect_password": "incorrect password",
|
"invalid_signature": "invalid signature",
|
||||||
"invalid_zip": "invalid zip",
|
"invalid_zip": "invalid zip",
|
||||||
|
"message_loading": "error loading message.",
|
||||||
|
"message_size": "your message size is of {{ size }} bytes out of a maximum of {{ maximum }}",
|
||||||
"minting_account_add": "unable to add minting account",
|
"minting_account_add": "unable to add minting account",
|
||||||
"minting_account_remove": "unable to remove minting account",
|
"minting_account_remove": "unable to remove minting account",
|
||||||
"missing_fields": "missing: {{ fields }}",
|
"missing_fields": "missing: {{ fields }}",
|
||||||
"navigation_timeout": "navigation timeout",
|
"navigation_timeout": "navigation timeout",
|
||||||
|
"network_generic": "network error",
|
||||||
|
"password_not_matching": "password fields do not match!",
|
||||||
|
"password_wrong": "unable to authenticate. Wrong password",
|
||||||
"publish_app": "unable to publish app",
|
"publish_app": "unable to publish app",
|
||||||
"rating_option": "cannot find rating option",
|
"rating_option": "cannot find rating option",
|
||||||
"save_qdn": "unable to save to QDN",
|
"save_qdn": "unable to save to QDN",
|
||||||
|
"send_failed": "failed to send",
|
||||||
"unable_encrypt_app": "unable to encrypt app. App not published'",
|
"unable_encrypt_app": "unable to encrypt app. App not published'",
|
||||||
"unable_publish_app": "unable to publish app",
|
"unable_publish_app": "unable to publish app",
|
||||||
"unable_rate": "unable to rate"
|
"unable_publish_image": "unable to publish image",
|
||||||
|
"unable_rate": "unable to rate",
|
||||||
|
"update_failed": "failed to update"
|
||||||
},
|
},
|
||||||
"generic": {
|
"generic": {
|
||||||
|
"avatar_size": "{{ size }} KB max. for GIFS",
|
||||||
|
"buy_order_request": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting {{count}} buy order</span>",
|
||||||
|
"buy_order_request_other": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting {{count}} buy orders</span>",
|
||||||
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
|
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
|
||||||
|
"edited": "edited",
|
||||||
|
"editing_message": "editing message",
|
||||||
|
"fee_qort": "fee: {{ message }} QORT",
|
||||||
|
"foreign_fee": "foreign fee: {{ message }}",
|
||||||
|
"mentioned": "mentioned",
|
||||||
|
"message_with_image": "this message already has an image",
|
||||||
"name_available": "{{ name }} is available",
|
"name_available": "{{ name }} is available",
|
||||||
"name_benefits": "benefits of a name",
|
"name_benefits": "benefits of a name",
|
||||||
"name_checking": "checking if name already exists",
|
"name_checking": "checking if name already exists",
|
||||||
@ -136,19 +174,50 @@
|
|||||||
"name_registration": "your balance is {{ balance }} QORT. A name registration requires a {{ fee }} QORT fee",
|
"name_registration": "your balance is {{ balance }} QORT. A name registration requires a {{ fee }} QORT fee",
|
||||||
"name_unavailable": "{{ name }} is unavailable",
|
"name_unavailable": "{{ name }} is unavailable",
|
||||||
"no_description": "no description",
|
"no_description": "no description",
|
||||||
|
"no_minting_details": "cannot view minting details on the gateway",
|
||||||
"no_notifications": "no new notifications",
|
"no_notifications": "no new notifications",
|
||||||
|
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
||||||
"no_results": "no results",
|
"no_results": "no results",
|
||||||
"one_app_per_name": "note: Currently, only one App and Website is allowed per Name.",
|
"one_app_per_name": "note: Currently, only one App and Website is allowed per Name.",
|
||||||
|
"overwrite_qdn": "overwrite to QDN",
|
||||||
|
"password_confirm": "please confirm a password",
|
||||||
|
"password_enter": "please enter a password",
|
||||||
|
"payment_request": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting a payment</span>",
|
||||||
|
"people_reaction": "people who reacted with {{ reaction }}",
|
||||||
"publish_data": "publish data to Qortal: anything from apps to videos. Fully decentralized!",
|
"publish_data": "publish data to Qortal: anything from apps to videos. Fully decentralized!",
|
||||||
"publishing": "publishing... Please wait.",
|
"publishing": "publishing... Please wait.",
|
||||||
|
"qdn": "use QDN saving",
|
||||||
"rating": "rating for {{ service }} {{ name }}",
|
"rating": "rating for {{ service }} {{ name }}",
|
||||||
|
"register_name": "you need a registered Qortal name to save your pinned apps to QDN.",
|
||||||
|
"replied_to": "replied to {{ person }}",
|
||||||
|
"revert_default": "revert to default",
|
||||||
|
"revert_qdn": "revert to QDN",
|
||||||
|
"save_qdn": "save to QDN",
|
||||||
"secure_ownership": "secure ownership of data published by your name. You can even sell your name, along with your data to a third party.",
|
"secure_ownership": "secure ownership of data published by your name. You can even sell your name, along with your data to a third party.",
|
||||||
"select_file": "please select a file",
|
"select_file": "please select a file",
|
||||||
"select_image": "please select an image for a logo",
|
"select_image": "please select an image for a logo",
|
||||||
"select_zip": "select .zip file containing static content:"
|
"select_zip": "select .zip file containing static content:",
|
||||||
|
"sending": "sending...",
|
||||||
|
"settings": "you are using the export/import way of saving settings.",
|
||||||
|
"space_for_admins": "sorry, this space is only for Admins.",
|
||||||
|
"unread_messages": "unread messages below",
|
||||||
|
"unsaved_changes": "you have unsaved changes to your pinned apps. Save them to QDN.",
|
||||||
|
"updating": "updating"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
"new_user": "are you a new user?"
|
"logout": "are you sure you would like to logout?",
|
||||||
|
"new_user": "are you a new user?",
|
||||||
|
"delete_chat_image": "would you like to delete your previous chat image?",
|
||||||
|
"perform_transaction": "would you like to perform a {{action}} transaction?",
|
||||||
|
"provide_thread": "please provide a thread title",
|
||||||
|
"publish_app": "would you like to publish this app?",
|
||||||
|
"publish_avatar": "would you like to publish an avatar?",
|
||||||
|
"publish_qdn": "would you like to publish your settings to QDN (encrypted)?",
|
||||||
|
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
||||||
|
"rate_app": "would you like to rate this app a rating of {{ rate }}?. It will create a POLL tx.",
|
||||||
|
"register_name": "would you like to register this name?",
|
||||||
|
"reset_pinned": "don't like your current local changes? Would you like to reset to the default pinned apps?",
|
||||||
|
"reset_qdn": "don't like your current local changes? Would you like to reset to your saved QDN pinned apps?"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"minting": "(minting)",
|
"minting": "(minting)",
|
||||||
@ -181,32 +250,14 @@
|
|||||||
"q_apps": {
|
"q_apps": {
|
||||||
"about": "about this Q-App",
|
"about": "about this Q-App",
|
||||||
"q_mail": "q-mail",
|
"q_mail": "q-mail",
|
||||||
|
"q_manager": "q-manager",
|
||||||
"q_sandbox": "q-Sandbox"
|
"q_sandbox": "q-Sandbox"
|
||||||
},
|
},
|
||||||
"question": {
|
|
||||||
"perform_transaction": "would you like to perform a {{action}} transaction?",
|
|
||||||
"provide_thread": "please provide a thread title",
|
|
||||||
"publish_app": "would you like to publish this app?",
|
|
||||||
"publish_qdn": "would you like to publish your settings to QDN (encrypted)?",
|
|
||||||
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
|
||||||
"rate_app": "would you like to rate this app a rating of {{ rate }}?. It will create a POLL tx.",
|
|
||||||
"register_name": "would you like to register this name?",
|
|
||||||
"reset_pinned": "don't like your current local changes? Would you like to reset to the default pinned apps?",
|
|
||||||
"reset_qdn": "don't like your current local changes? Would you like to reset to your saved QDN pinned apps?"
|
|
||||||
},
|
|
||||||
"save_options": {
|
|
||||||
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
|
||||||
"overwrite_qdn": "overwrite to QDN",
|
|
||||||
"qdn": "use QDN saving",
|
|
||||||
"register_name": "you need a registered Qortal name to save your pinned apps to QDN.",
|
|
||||||
"revert_default": "revert to default",
|
|
||||||
"revert_qdn": "revert to QDN",
|
|
||||||
"save_qdn": "save to QDN",
|
|
||||||
"settings": "you are using the export/import way of saving settings.",
|
|
||||||
"unsaved_changes": "you have unsaved changes to your pinned apps. Save them to QDN."
|
|
||||||
},
|
|
||||||
"server": "server",
|
"server": "server",
|
||||||
"settings": "settings",
|
"settings": "settings",
|
||||||
|
"sort": {
|
||||||
|
"by_member": "by member"
|
||||||
|
},
|
||||||
"supply": "supply",
|
"supply": "supply",
|
||||||
"tags": "tags",
|
"tags": "tags",
|
||||||
"theme": {
|
"theme": {
|
||||||
@ -226,6 +277,8 @@
|
|||||||
"user_lookup": "user lookup",
|
"user_lookup": "user lookup",
|
||||||
"zip": "zip",
|
"zip": "zip",
|
||||||
"wallet": {
|
"wallet": {
|
||||||
|
"litecoin": "litecoin wallet",
|
||||||
|
"qortal": "qortal wallet",
|
||||||
"wallet": "wallet",
|
"wallet": "wallet",
|
||||||
"wallet_other": "wallets"
|
"wallet_other": "wallets"
|
||||||
},
|
},
|
||||||
|
@ -18,10 +18,14 @@
|
|||||||
"make_admin": "make an admin",
|
"make_admin": "make an admin",
|
||||||
"manage_members": "manage members",
|
"manage_members": "manage members",
|
||||||
"promote_group": "promote your group to non-members",
|
"promote_group": "promote your group to non-members",
|
||||||
|
"publish_announcement": "publish announcement",
|
||||||
|
"publish_avatar": "publish avatar",
|
||||||
"refetch_page": "refetch page",
|
"refetch_page": "refetch page",
|
||||||
"remove_admin": "remove as admin",
|
"remove_admin": "remove as admin",
|
||||||
"remove_minting_account": "remove minting account",
|
"remove_minting_account": "remove minting account",
|
||||||
"return_to_thread": "return to threads",
|
"return_to_thread": "return to threads",
|
||||||
|
"scroll_bottom": "scroll to bottom",
|
||||||
|
"scroll_unread_messages": "scroll to Unread Messages",
|
||||||
"select_group": "select a group",
|
"select_group": "select a group",
|
||||||
"visit_q_mintership": "visit Q-Mintership"
|
"visit_q_mintership": "visit Q-Mintership"
|
||||||
},
|
},
|
||||||
@ -33,12 +37,16 @@
|
|||||||
"maximum": "maximum Block delay for Group Transaction Approvals"
|
"maximum": "maximum Block delay for Group Transaction Approvals"
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
"avatar": "group avatar",
|
||||||
"closed": "closed (private) - users need permission to join",
|
"closed": "closed (private) - users need permission to join",
|
||||||
"description": "description of group",
|
"description": "description of group",
|
||||||
"id": "group id",
|
"id": "group id",
|
||||||
"invites": "group invites",
|
"invites": "group invites",
|
||||||
|
"group": "group",
|
||||||
|
"group_other": "groups",
|
||||||
"management": "group management",
|
"management": "group management",
|
||||||
"member_number": "number of members",
|
"member_number": "number of members",
|
||||||
|
"messaging": "messaging",
|
||||||
"name": "group name",
|
"name": "group name",
|
||||||
"open": "open (public)",
|
"open": "open (public)",
|
||||||
"private": "private group",
|
"private": "private group",
|
||||||
@ -54,12 +62,20 @@
|
|||||||
"latest_mails": "latest Q-Mails",
|
"latest_mails": "latest Q-Mails",
|
||||||
"message": {
|
"message": {
|
||||||
"generic": {
|
"generic": {
|
||||||
|
"avatar_publish_fee": "publishing an Avatar requires {{ fee }}",
|
||||||
|
"avatar_registered_name": "a registered name is required to set an avatar",
|
||||||
"admin_only": "only groups where you are an admin will be shown",
|
"admin_only": "only groups where you are an admin will be shown",
|
||||||
"already_in_group": "you are already in this group!",
|
"already_in_group": "you are already in this group!",
|
||||||
"closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request",
|
"closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request",
|
||||||
"descrypt_wallet": "decrypting wallet...",
|
"descrypt_wallet": "decrypting wallet...",
|
||||||
"encryption_key": "the group's first common encryption key is in the process of creation. Please wait a few minutes for it to be retrieved by the network. Checking every 2 minutes...",
|
"encryption_key": "the group's first common encryption key is in the process of creation. Please wait a few minutes for it to be retrieved by the network. Checking every 2 minutes...",
|
||||||
|
"group_announcement": "group Announcements",
|
||||||
"group_invited_you": "{{group}} has invited you",
|
"group_invited_you": "{{group}} has invited you",
|
||||||
|
"group_key_created": "first group key created.",
|
||||||
|
"group_member_list_changed": "the group member list has changed. Please re-encrypt the secret key.",
|
||||||
|
"group_no_secret_key": "there is no group secret key. Be the first admin to publish one!",
|
||||||
|
"group_secret_key_no_owner": "the latest group secret key was published by a non-owner. As the owner of the group please re-encrypt the key as a safeguard.",
|
||||||
|
"invalid_content": "invalid content, sender, or timestamp in reaction data",
|
||||||
"invalid_data": "error loading content: Invalid Data",
|
"invalid_data": "error loading content: Invalid Data",
|
||||||
"latest_promotion": "only the latest promotion from the week will be shown for your group.",
|
"latest_promotion": "only the latest promotion from the week will be shown for your group.",
|
||||||
"loading_members": "loading member list with names... please wait.",
|
"loading_members": "loading member list with names... please wait.",
|
||||||
@ -74,6 +90,7 @@
|
|||||||
"node_minting": "This node is minting:",
|
"node_minting": "This node is minting:",
|
||||||
"node_minting_account": "node's minting accounts",
|
"node_minting_account": "node's minting accounts",
|
||||||
"node_minting_key": "you currently have a minting key for this account attached to this node",
|
"node_minting_key": "you currently have a minting key for this account attached to this node",
|
||||||
|
"no_announcement": "no announcements",
|
||||||
"no_display": "nothing to display",
|
"no_display": "nothing to display",
|
||||||
"no_selection": "no group selected",
|
"no_selection": "no group selected",
|
||||||
"not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.",
|
"not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.",
|
||||||
@ -93,8 +110,10 @@
|
|||||||
"group_secret_key": "cannot get group secret key",
|
"group_secret_key": "cannot get group secret key",
|
||||||
"name_required": "please provide a name",
|
"name_required": "please provide a name",
|
||||||
"notify_admins": "try notifying an admin from the list of admins below:",
|
"notify_admins": "try notifying an admin from the list of admins below:",
|
||||||
|
"qortals_required": "you need at least {{ quantity }} QORT to send a message",
|
||||||
"timeout_reward": "timeout waiting for reward share confirmation",
|
"timeout_reward": "timeout waiting for reward share confirmation",
|
||||||
"thread_id": "unable to locate thread Id",
|
"thread_id": "unable to locate thread Id",
|
||||||
|
"unable_determine_group_private": "unable to determine if group is private",
|
||||||
"unable_minting": "unable to start minting"
|
"unable_minting": "unable to start minting"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
@ -119,6 +138,8 @@
|
|||||||
"invitation_request": "accepted join request: awaiting confirmation",
|
"invitation_request": "accepted join request: awaiting confirmation",
|
||||||
"loading_threads": "loading threads... please wait.",
|
"loading_threads": "loading threads... please wait.",
|
||||||
"post_creation": "successfully created post. It may take some time for the publish to propagate",
|
"post_creation": "successfully created post. It may take some time for the publish to propagate",
|
||||||
|
"published_secret_key": "published secret key for group {{ group_id }}: awaiting confirmation",
|
||||||
|
"published_secret_key_label": "published secret key for group {{ group_id }}: success!",
|
||||||
"registered_name": "successfully registered. It may take a couple of minutes for the changes to propagate",
|
"registered_name": "successfully registered. It may take a couple of minutes for the changes to propagate",
|
||||||
"registered_name_label": "registered name: awaiting confirmation. This may take a couple minutes.",
|
"registered_name_label": "registered name: awaiting confirmation. This may take a couple minutes.",
|
||||||
"registered_name_success": "registered name: success!",
|
"registered_name_success": "registered name: success!",
|
||||||
|
@ -2,22 +2,62 @@
|
|||||||
"account": {
|
"account": {
|
||||||
"your": "tu cuenta",
|
"your": "tu cuenta",
|
||||||
"account_many": "cuentas",
|
"account_many": "cuentas",
|
||||||
"account_one": "cuenta"
|
"account_one": "cuenta",
|
||||||
|
"selected": "cuenta seleccionada"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"add": {
|
||||||
|
"account": "añadir cuenta",
|
||||||
|
"seed_phrase": "añadir frase semilla"
|
||||||
|
},
|
||||||
|
"authenticate": "autenticar",
|
||||||
|
"create_account": "crear cuenta",
|
||||||
|
"create_qortal_account": "crea tu cuenta Qortal haciendo clic en <next>SIGUIENTE</next> abajo.",
|
||||||
|
"choose_password": "elige nueva contraseña",
|
||||||
|
"download_account": "descargar cuenta",
|
||||||
|
"export_seedphrase": "exportar frase semilla",
|
||||||
|
"publish_admin_secret_key": "publicar clave secreta de administrador",
|
||||||
|
"publish_group_secret_key": "publicar clave secreta de grupo",
|
||||||
|
"reencrypt_key": "reencriptar clave",
|
||||||
|
"return_to_list": "volver a la lista",
|
||||||
|
"setup_qortal_account": "configurar tu cuenta Qortal"
|
||||||
},
|
},
|
||||||
"advanced_users": "para usuarios avanzados",
|
"advanced_users": "para usuarios avanzados",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
"alternative": "alternativa: Seleccionar archivo",
|
"alternative": "alternativa: seleccionar archivo",
|
||||||
"change": "cambiar clave API",
|
"change": "cambiar API key",
|
||||||
"enter": "ingresar clave API",
|
"enter": "ingresar API key",
|
||||||
"import": "importar clave API",
|
"import": "importar API key",
|
||||||
"key": "clave API",
|
"key": "clave API",
|
||||||
"select_valid": "selecciona una clave API válida"
|
"select_valid": "selecciona una API key válida"
|
||||||
},
|
},
|
||||||
"authenticate": "autenticar",
|
|
||||||
"build_version": "versión de compilación",
|
"build_version": "versión de compilación",
|
||||||
"create_account": "crear cuenta",
|
"message": {
|
||||||
"download_account": "descargar cuenta",
|
"error": {
|
||||||
"keep_secure": "mantén tu archivo de cuenta seguro",
|
"account_creation": "no se pudo crear la cuenta.",
|
||||||
|
"field_not_found_json": "{{ field }} no encontrado en el JSON",
|
||||||
|
"incorrect_password": "contraseña incorrecta",
|
||||||
|
"invalid_secret_key": "clave secreta no válida",
|
||||||
|
"unable_reencrypt_secret_key": "no se pudo reencriptar la clave secreta"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"congrats_setup": "¡felicidades, estás listo!",
|
||||||
|
"no_account": "no hay cuentas guardadas",
|
||||||
|
"no_minimum_length": "no hay un requisito de longitud mínima",
|
||||||
|
"no_secret_key_published": "aún no se ha publicado una clave secreta",
|
||||||
|
"fetching_admin_secret_key": "obteniendo clave secreta de administrador",
|
||||||
|
"fetching_group_secret_key": "publicando clave secreta de grupo",
|
||||||
|
"last_encryption_date": "última fecha de encriptación: {{ date }} por {{ name }}",
|
||||||
|
"keep_secure": "mantén tu archivo de cuenta seguro",
|
||||||
|
"publishing_key": "recordatorio: después de publicar la clave, tardará un par de minutos en aparecer. Por favor espera.",
|
||||||
|
"seedphrase_notice": "una <seed>FRASE SEMILLA</seed> se ha generado aleatoriamente en segundo plano.",
|
||||||
|
"type_seed": "escribe o pega tu frase semilla",
|
||||||
|
"your_accounts": "tus cuentas guardadas"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "clave secreta reencriptada con éxito. Puede tardar unos minutos en reflejarse. Actualiza el grupo en 5 minutos."
|
||||||
|
}
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"choose": "elegir nodo personalizado",
|
"choose": "elegir nodo personalizado",
|
||||||
"custom_many": "nodos personalizados",
|
"custom_many": "nodos personalizados",
|
||||||
@ -26,17 +66,31 @@
|
|||||||
"using": "usando nodo",
|
"using": "usando nodo",
|
||||||
"using_public": "usando nodo público"
|
"using_public": "usando nodo público"
|
||||||
},
|
},
|
||||||
|
"note": "nota",
|
||||||
"password": "contraseña",
|
"password": "contraseña",
|
||||||
"password_confirmation": "confirmar contraseña",
|
"password_confirmation": "confirmar contraseña",
|
||||||
"return_to_list": "volver a la lista",
|
"seed": "frase semilla",
|
||||||
|
"seed_your": "tu frase semilla",
|
||||||
|
"tips": {
|
||||||
|
"additional_wallet": "usa esta opción para conectar billeteras Qortal adicionales que ya hayas creado, para poder iniciar sesión con ellas más tarde. Necesitarás acceso a tu archivo de respaldo JSON.",
|
||||||
|
"digital_id": "tu billetera es como tu identificación digital en Qortal, y es la forma en que iniciarás sesión en la interfaz de usuario de Qortal. Contiene tu dirección pública y el nombre de Qortal que eventualmente elegirás. Cada transacción está vinculada a tu ID, y aquí es donde gestionas todo tu QORT y otras criptomonedas intercambiables en Qortal.",
|
||||||
|
"existing_account": "¿ya tienes una cuenta Qortal? Ingresa aquí tu frase de respaldo secreta para acceder. Esta frase es una de las formas de recuperar tu cuenta.",
|
||||||
|
"key_encrypt_admin": "esta clave es para cifrar contenido relacionado con ADMIN. Solo los administradores podrán ver el contenido cifrado con ella.",
|
||||||
|
"key_encrypt_group": "esta clave es para cifrar contenido relacionado con GRUPO. Es la única utilizada en esta interfaz. Todos los miembros del grupo podrán ver el contenido cifrado con esta clave.",
|
||||||
|
"new_account": "crear una cuenta significa crear una nueva billetera e identificación digital para comenzar a usar Qortal. Una vez que hayas creado tu cuenta, puedes empezar a obtener QORT, comprar un nombre y avatar, publicar videos y blogs, y mucho más.",
|
||||||
|
"new_users": "¡los nuevos usuarios comienzan aquí!",
|
||||||
|
"safe_place": "guarda tu cuenta en un lugar que recuerdes.",
|
||||||
|
"view_seedphrase": "si deseas VER LA FRASE SEMILLA, haz clic en la palabra 'FRASE SEMILLA' en este texto. Las frases semilla se usan para generar la clave privada de tu cuenta Qortal. Por seguridad, no se muestran por defecto.",
|
||||||
|
"wallet_secure": "mantén segura tu billetera."
|
||||||
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "confirmar contraseña del monedero",
|
"password_confirmation": "confirmar contraseña de la billetera",
|
||||||
"password": "contraseña del monedero",
|
"password": "contraseña de la billetera",
|
||||||
"keep_password": "mantener la contraseña actual",
|
"keep_password": "mantener la contraseña actual",
|
||||||
"new_password": "nueva contraseña",
|
"new_password": "nueva contraseña",
|
||||||
"error": {
|
"error": {
|
||||||
"missing_new_password": "por favor ingresa una nueva contraseña",
|
"missing_new_password": "por favor, ingresa una nueva contraseña",
|
||||||
"missing_password": "por favor ingresa tu contraseña"
|
"missing_password": "por favor, ingresa tu contraseña"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"welcome": "bienvenido a"
|
"welcome": "bienvenido a"
|
||||||
|
@ -1,38 +1,92 @@
|
|||||||
{
|
{
|
||||||
"account": {
|
"account": {
|
||||||
"your": "ton compte",
|
"your": "votre compte",
|
||||||
"account_many": "comptes",
|
"account_many": "comptes",
|
||||||
"account_one": "compte"
|
"account_one": "compte",
|
||||||
|
"selected": "compte sélectionné"
|
||||||
|
},
|
||||||
|
"action": {
|
||||||
|
"add": {
|
||||||
|
"account": "ajouter un compte",
|
||||||
|
"seed_phrase": "ajouter une phrase secrète"
|
||||||
|
},
|
||||||
|
"authenticate": "authentifier",
|
||||||
|
"create_account": "créer un compte",
|
||||||
|
"create_qortal_account": "créez votre compte Qortal en cliquant sur <next>SUIVANT</next> ci-dessous.",
|
||||||
|
"choose_password": "choisissez un nouveau mot de passe",
|
||||||
|
"download_account": "télécharger le compte",
|
||||||
|
"export_seedphrase": "exporter la phrase secrète",
|
||||||
|
"publish_admin_secret_key": "publier la clé secrète admin",
|
||||||
|
"publish_group_secret_key": "publier la clé secrète du groupe",
|
||||||
|
"reencrypt_key": "re-chiffrer la clé",
|
||||||
|
"return_to_list": "retour à la liste",
|
||||||
|
"setup_qortal_account": "configurer votre compte Qortal"
|
||||||
},
|
},
|
||||||
"advanced_users": "pour les utilisateurs avancés",
|
"advanced_users": "pour les utilisateurs avancés",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
"alternative": "alternative : Sélectionner un fichier",
|
"alternative": "alternative : sélection de fichier",
|
||||||
"change": "changer la clé API",
|
"change": "changer la clé API",
|
||||||
"enter": "entrer la clé API",
|
"enter": "entrer la clé API",
|
||||||
"import": "importer la clé API",
|
"import": "importer la clé API",
|
||||||
"key": "clé API",
|
"key": "clé API",
|
||||||
"select_valid": "sélectionnez une clé API valide"
|
"select_valid": "sélectionner une clé API valide"
|
||||||
},
|
},
|
||||||
"authenticate": "authentifier",
|
|
||||||
"build_version": "version de build",
|
"build_version": "version de build",
|
||||||
"create_account": "créer un compte",
|
"message": {
|
||||||
"download_account": "télécharger le compte",
|
"error": {
|
||||||
"keep_secure": "Gardez votre fichier de compte en sécurité",
|
"account_creation": "impossible de créer le compte.",
|
||||||
|
"field_not_found_json": "{{ field }} introuvable dans le JSON",
|
||||||
|
"incorrect_password": "mot de passe incorrect",
|
||||||
|
"invalid_secret_key": "clé secrète invalide",
|
||||||
|
"unable_reencrypt_secret_key": "impossible de re-chiffrer la clé secrète"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"congrats_setup": "félicitations, tout est prêt !",
|
||||||
|
"no_account": "aucun compte enregistré",
|
||||||
|
"no_minimum_length": "aucune exigence de longueur minimale",
|
||||||
|
"no_secret_key_published": "aucune clé secrète publiée pour le moment",
|
||||||
|
"fetching_admin_secret_key": "récupération de la clé secrète admin",
|
||||||
|
"fetching_group_secret_key": "publication de la clé secrète du groupe",
|
||||||
|
"last_encryption_date": "dernière date de chiffrement : {{ date }} par {{ name }}",
|
||||||
|
"keep_secure": "gardez votre fichier de compte en sécurité",
|
||||||
|
"publishing_key": "rappel : après publication, la clé peut mettre quelques minutes à apparaître. Veuillez patienter.",
|
||||||
|
"seedphrase_notice": "une <seed>PHRASE SECRÈTE</seed> a été générée aléatoirement en arrière-plan.",
|
||||||
|
"type_seed": "saisissez ou collez votre phrase secrète",
|
||||||
|
"your_accounts": "vos comptes enregistrés"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "clé secrète re-chiffrée avec succès. Les modifications peuvent prendre quelques minutes pour se propager. Rafraîchissez le groupe dans 5 minutes."
|
||||||
|
}
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"choose": "choisir un nœud personnalisé",
|
"choose": "choisir un nœud personnalisé",
|
||||||
"custom_many": "nœuds personnalisés",
|
"custom_many": "nœuds personnalisés",
|
||||||
"use_custom": "utiliser un nœud personnalisé",
|
"use_custom": "utiliser un nœud personnalisé",
|
||||||
"use_local": "utiliser un nœud local",
|
"use_local": "utiliser un nœud local",
|
||||||
"using": "utilise le nœud",
|
"using": "utilisation du nœud",
|
||||||
"using_public": "utilise un nœud public"
|
"using_public": "utilisation d’un nœud public"
|
||||||
},
|
},
|
||||||
|
"note": "note",
|
||||||
"password": "mot de passe",
|
"password": "mot de passe",
|
||||||
"password_confirmation": "confirmer le mot de passe",
|
"password_confirmation": "confirmer le mot de passe",
|
||||||
"return_to_list": "retour à la liste",
|
"seed": "phrase secrète",
|
||||||
|
"seed_your": "votre phrase secrète",
|
||||||
|
"tips": {
|
||||||
|
"additional_wallet": "utilisez cette option pour connecter d'autres portefeuilles Qortal que vous avez déjà créés, afin de pouvoir vous y connecter ultérieurement. Vous aurez besoin de votre fichier de sauvegarde JSON.",
|
||||||
|
"digital_id": "votre portefeuille est comme votre identifiant numérique sur Qortal, et c’est ainsi que vous vous connecterez à l’interface utilisateur Qortal. Il contient votre adresse publique et le nom Qortal que vous choisirez. Chaque transaction est liée à votre ID, et c’est là que vous gérez votre QORT et d'autres cryptomonnaies échangeables sur Qortal.",
|
||||||
|
"existing_account": "vous avez déjà un compte Qortal ? Entrez ici votre phrase secrète de sauvegarde pour y accéder. C’est un des moyens de récupérer votre compte.",
|
||||||
|
"key_encrypt_admin": "cette clé est utilisée pour chiffrer le contenu ADMIN. Seuls les administrateurs peuvent voir ce contenu.",
|
||||||
|
"key_encrypt_group": "cette clé est utilisée pour chiffrer le contenu du GROUPE. C’est la seule utilisée dans cette interface pour le moment. Tous les membres du groupe pourront voir le contenu chiffré avec cette clé.",
|
||||||
|
"new_account": "créer un compte signifie créer un nouveau portefeuille et identifiant numérique pour commencer à utiliser Qortal. Une fois votre compte créé, vous pourrez obtenir du QORT, acheter un nom et un avatar, publier des vidéos et blogs, et bien plus.",
|
||||||
|
"new_users": "nouveaux utilisateurs, commencez ici !",
|
||||||
|
"safe_place": "sauvegardez votre compte dans un endroit sûr et mémorable !",
|
||||||
|
"view_seedphrase": "si vous souhaitez VOIR LA PHRASE SECRÈTE, cliquez sur le mot 'PHRASE SECRÈTE' dans ce texte. Les phrases secrètes servent à générer la clé privée de votre compte Qortal. Par sécurité, elles ne sont PAS affichées par défaut.",
|
||||||
|
"wallet_secure": "gardez votre fichier de portefeuille sécurisé."
|
||||||
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "confirmer le mot de passe du portefeuille",
|
"password_confirmation": "confirmer le mot de passe du portefeuille",
|
||||||
"password": "mot de passe du portefeuille",
|
"password": "mot de passe du portefeuille",
|
||||||
"keep_password": "garder le mot de passe actuel",
|
"keep_password": "conserver le mot de passe actuel",
|
||||||
"new_password": "nouveau mot de passe",
|
"new_password": "nouveau mot de passe",
|
||||||
"error": {
|
"error": {
|
||||||
"missing_new_password": "veuillez entrer un nouveau mot de passe",
|
"missing_new_password": "veuillez entrer un nouveau mot de passe",
|
||||||
|
@ -2,47 +2,96 @@
|
|||||||
"account": {
|
"account": {
|
||||||
"your": "il tuo account",
|
"your": "il tuo account",
|
||||||
"account_many": "account",
|
"account_many": "account",
|
||||||
"account_one": "account"
|
"account_one": "account",
|
||||||
|
"selected": "account selezionato"
|
||||||
},
|
},
|
||||||
"advanced_users": "per utenti avanzati",
|
"action": {
|
||||||
|
"add": {
|
||||||
|
"account": "aggiungi account",
|
||||||
|
"seed_phrase": "aggiungi frase segreta"
|
||||||
|
},
|
||||||
|
"authenticate": "autenticazione",
|
||||||
|
"create_account": "crea account",
|
||||||
|
"create_qortal_account": "crea il tuo account Qortal cliccando su <next>AVANTI</next> qui sotto.",
|
||||||
|
"choose_password": "scegli una nuova password",
|
||||||
|
"download_account": "scarica account",
|
||||||
|
"export_seedphrase": "esporta frase segreta",
|
||||||
|
"publish_admin_secret_key": "pubblica chiave segreta admin",
|
||||||
|
"publish_group_secret_key": "pubblica chiave segreta gruppo",
|
||||||
|
"reencrypt_key": "ricripta chiave",
|
||||||
|
"return_to_list": "torna alla lista",
|
||||||
|
"setup_qortal_account": "configura il tuo account Qortal"
|
||||||
|
},
|
||||||
|
"advanced_users": "per utenti esperti",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
"alternative": "alternativa: selezione file",
|
"alternative": "alternativa: seleziona file",
|
||||||
"change": "cambia APIkey",
|
"change": "cambia chiave API",
|
||||||
"enter": "inserisci APIkey",
|
"enter": "inserisci chiave API",
|
||||||
"import": "importa APIkey",
|
"import": "importa chiave API",
|
||||||
"key": "chiave API",
|
"key": "chiave API",
|
||||||
"select_valid": "seleziona una APIkey valida"
|
"select_valid": "seleziona una chiave API valida"
|
||||||
},
|
},
|
||||||
"authenticate": "autentica",
|
|
||||||
"build_version": "versione build",
|
"build_version": "versione build",
|
||||||
"create_account": "crea account",
|
"message": {
|
||||||
"download_account": "scarica account",
|
"error": {
|
||||||
"keep_secure": "mantieni sicuro il file del tuo account",
|
"account_creation": "impossibile creare l’account.",
|
||||||
|
"field_not_found_json": "{{ field }} non trovato nel JSON",
|
||||||
|
"incorrect_password": "password errata",
|
||||||
|
"invalid_secret_key": "chiave segreta non valida",
|
||||||
|
"unable_reencrypt_secret_key": "impossibile ricriptare la chiave segreta"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"congrats_setup": "congratulazioni, sei pronto!",
|
||||||
|
"no_account": "nessun account salvato",
|
||||||
|
"no_minimum_length": "nessun requisito di lunghezza minima",
|
||||||
|
"no_secret_key_published": "nessuna chiave segreta pubblicata",
|
||||||
|
"fetching_admin_secret_key": "recupero chiave segreta admin",
|
||||||
|
"fetching_group_secret_key": "pubblicazione chiave segreta gruppo",
|
||||||
|
"last_encryption_date": "ultima data di cifratura: {{ date }} da {{ name }}",
|
||||||
|
"keep_secure": "mantieni sicuro il tuo file account",
|
||||||
|
"publishing_key": "promemoria: dopo la pubblicazione della chiave, ci vorranno alcuni minuti per vederla. Attendere cortesemente.",
|
||||||
|
"seedphrase_notice": "una <seed>FRASE SEGRETA</seed> è stata generata automaticamente in background.",
|
||||||
|
"type_seed": "digita o incolla la tua frase segreta",
|
||||||
|
"your_accounts": "i tuoi account salvati"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "chiave segreta ricriptata con successo. Potrebbero volerci alcuni minuti per vedere le modifiche. Aggiorna il gruppo tra 5 minuti."
|
||||||
|
}
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"choose": "scegli nodo personalizzato",
|
"choose": "scegli nodo personalizzato",
|
||||||
"custom_many": "nodi personalizzati",
|
"custom_many": "nodi personalizzati",
|
||||||
"use_custom": "usa nodo personalizzato",
|
"use_custom": "usa nodo personalizzato",
|
||||||
"use_local": "usa nodo locale",
|
"use_local": "usa nodo locale",
|
||||||
"using": "utilizzo nodo",
|
"using": "utilizzo nodo",
|
||||||
"using_public": "utilizzo nodo pubblico"
|
"using_public": "utilizzo di nodo pubblico"
|
||||||
},
|
},
|
||||||
|
"note": "nota",
|
||||||
"password": "password",
|
"password": "password",
|
||||||
"password_confirmation": "conferma password",
|
"password_confirmation": "conferma password",
|
||||||
"return_to_list": "torna alla lista",
|
"seed": "frase segreta",
|
||||||
|
"seed_your": "la tua frase segreta",
|
||||||
"tips": {
|
"tips": {
|
||||||
"digital_id": "il tuo wallet è come la tua identità digitale su Qortal ed è il modo in cui accederai all'interfaccia utente di Qortal. Contiene il tuo indirizzo pubblico e il nome Qortal che sceglierai. Ogni transazione che esegui è collegata alla tua identità ed è qui che gestisci tutti i tuoi QORT e altre criptovalute scambiabili su Qortal.",
|
"additional_wallet": "usa questa opzione per connettere altri portafogli Qortal che hai già creato, per accedervi successivamente. Avrai bisogno del file JSON di backup.",
|
||||||
"new_account": "creare un account significa creare un nuovo wallet e un'identità digitale per iniziare a usare Qortal. Una volta creato l'account, potrai iniziare a ottenere QORT, acquistare un nome e un avatar, pubblicare video e blog, e molto altro.",
|
"digital_id": "il tuo portafoglio è come la tua ID digitale su Qortal, ed è il modo con cui accedi all’interfaccia utente. Contiene il tuo indirizzo pubblico e il nome Qortal che sceglierai. Ogni transazione è legata alla tua ID, e qui gestisci QORT e altre criptovalute scambiabili su Qortal.",
|
||||||
"new_users": "i nuovi utenti iniziano qui!"
|
"existing_account": "hai già un account Qortal? Inserisci qui la tua frase di backup segreta per accedervi. Questa frase è uno dei modi per recuperare l'account.",
|
||||||
|
"key_encrypt_admin": "questa chiave serve a criptare contenuti legati agli ADMIN. Solo gli admin potranno vederli.",
|
||||||
|
"key_encrypt_group": "questa chiave serve a criptare contenuti di GRUPPO. È l’unica usata in questa interfaccia. Tutti i membri del gruppo potranno vederli.",
|
||||||
|
"new_account": "creare un account significa creare un nuovo portafoglio e una nuova ID digitale per iniziare a usare Qortal. Una volta creato l’account, potrai ottenere QORT, acquistare un nome e avatar, pubblicare video e blog, e molto altro.",
|
||||||
|
"new_users": "nuovi utenti, iniziate qui!",
|
||||||
|
"safe_place": "salva il tuo account in un posto sicuro che ricorderai!",
|
||||||
|
"view_seedphrase": "se vuoi VEDERE LA FRASE SEGRETA, clicca sulla parola 'FRASE SEGRETA' in questo testo. Le frasi segrete generano la chiave privata del tuo account. Per sicurezza, non vengono mostrate di default.",
|
||||||
|
"wallet_secure": "mantieni sicuro il tuo file portafoglio."
|
||||||
},
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "conferma password del wallet",
|
"password_confirmation": "conferma password portafoglio",
|
||||||
"password": "password del wallet",
|
"password": "password del portafoglio",
|
||||||
"keep_password": "mantieni password corrente",
|
"keep_password": "mantieni password attuale",
|
||||||
"new_password": "nuova password",
|
"new_password": "nuova password",
|
||||||
"error": {
|
"error": {
|
||||||
"missing_new_password": "per favore inserisci una nuova password",
|
"missing_new_password": "inserisci una nuova password",
|
||||||
"missing_password": "per favore inserisci la tua password"
|
"missing_password": "inserisci la tua password"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"welcome": "benvenuto in"
|
"welcome": "benvenuto su"
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,98 @@
|
|||||||
{
|
{
|
||||||
"action": {
|
"action": {
|
||||||
"add": "aggiungi",
|
"add": "aggiungi",
|
||||||
|
"add_custom_framework": "aggiungi custom framework",
|
||||||
|
"add_reaction": "adaggiungid reazione",
|
||||||
"accept": "accetta",
|
"accept": "accetta",
|
||||||
|
"access": "accedi",
|
||||||
"backup_account": "esegui backup account",
|
"backup_account": "esegui backup account",
|
||||||
"backup_wallet": "esegui backup portafoglio",
|
"backup_wallet": "esegui backup wallet",
|
||||||
"cancel": "annulla",
|
"cancel": "cancella",
|
||||||
"cancel_invitation": "annulla invito",
|
"cancel_invitation": "cancella invito",
|
||||||
"change": "cambia",
|
"change": "cambia",
|
||||||
|
"change_avatar": "cambia avatar",
|
||||||
|
"change_file": "cambia file",
|
||||||
"change_language": "cambia lingua",
|
"change_language": "cambia lingua",
|
||||||
"choose": "scegli",
|
"choose": "scegli",
|
||||||
|
"choose_file": "scegli file",
|
||||||
|
"choose_image": "scegli immagine",
|
||||||
"close": "chiudi",
|
"close": "chiudi",
|
||||||
|
"close_chat": "chiudi Chat Diretta",
|
||||||
"continue": "continua",
|
"continue": "continua",
|
||||||
"continue_logout": "continua con il logout",
|
"continue_logout": "continua il logout",
|
||||||
"create_thread": "crea discussione",
|
"copy_link": "copia link",
|
||||||
"decline": "rifiuta",
|
"create_apps": "crea apps",
|
||||||
"decrypt": "decifra",
|
"create_file": "crea file",
|
||||||
|
"create_thread": "crea thread",
|
||||||
|
"choose_logo": "scegli a logo",
|
||||||
|
"choose_name": "scegli a name",
|
||||||
|
"decline": "declina",
|
||||||
|
"decrypt": "decripta",
|
||||||
|
"disable_enter": "disabilita invio",
|
||||||
|
"download": "download",
|
||||||
"edit": "modifica",
|
"edit": "modifica",
|
||||||
|
"enter_name": "inserisci un nome",
|
||||||
"export": "esporta",
|
"export": "esporta",
|
||||||
|
"get_qort": "ottieni QORT in Q-Trade",
|
||||||
|
"hide": "nascondi",
|
||||||
"import": "importa",
|
"import": "importa",
|
||||||
"invite": "invita",
|
"invite": "invita",
|
||||||
"join": "unisciti",
|
"join": "unisciti",
|
||||||
"logout": "esci",
|
"leave_comment": "lascia un commento",
|
||||||
|
"load_announcements": "load older announcements",
|
||||||
|
"login": "login",
|
||||||
|
"logout": "logout",
|
||||||
"new": {
|
"new": {
|
||||||
"post": "nuovo post",
|
"post": "nuovo post",
|
||||||
"thread": "nuova discussione"
|
"thread": "nuova discussione"
|
||||||
},
|
},
|
||||||
"notify": "notifica",
|
"notify": "notify",
|
||||||
"post": "pubblica",
|
"open": "open",
|
||||||
"post_message": "invia messaggio"
|
"pin": "pin",
|
||||||
|
"pin_app": "pin app",
|
||||||
|
"pin_from_dashboard": "pin from dashboard",
|
||||||
|
"post": "post",
|
||||||
|
"post_message": "post message",
|
||||||
|
"publish": "publish",
|
||||||
|
"publish_app": "publish your app",
|
||||||
|
"publish_comment": "publish comment",
|
||||||
|
"register_name": "register name",
|
||||||
|
"remove": "remove",
|
||||||
|
"remove_reaction": "remove reaction",
|
||||||
|
"return_apps_dashboard": "return to Apps Dashboard",
|
||||||
|
"save": "save",
|
||||||
|
"search": "search",
|
||||||
|
"search_apps": "search for apps",
|
||||||
|
"select_app_type": "select App Type",
|
||||||
|
"select_category": "select Category",
|
||||||
|
"select_name_app": "select Name/App",
|
||||||
|
"set_avatar": "set avatar",
|
||||||
|
"start_minting": "start minting",
|
||||||
|
"start_typing": "start typing here...",
|
||||||
|
"transfer_qort": "Transfer QORT",
|
||||||
|
"unpin": "unpin",
|
||||||
|
"unpin_app": "unpin app",
|
||||||
|
"unpin_from_dashboard": "unpin from dashboard",
|
||||||
|
"update": "update",
|
||||||
|
"update_app": "update your app"
|
||||||
},
|
},
|
||||||
"admin": "amministratore",
|
"admin": "admin",
|
||||||
|
"all": "all",
|
||||||
|
"api": "API",
|
||||||
|
"app": "app",
|
||||||
|
"app_name": "app name",
|
||||||
|
"app_service_type": "app service type",
|
||||||
|
"apps_dashboard": "apps Dashboard",
|
||||||
|
"apps_official": "official Apps",
|
||||||
|
"category": "category",
|
||||||
|
"category_other": "categories",
|
||||||
"core": {
|
"core": {
|
||||||
"block_height": "altezza blocco",
|
"block_height": "altezza blocco",
|
||||||
"information": "informazioni core",
|
"information": "informazioni core",
|
||||||
"peers": "peer connessi",
|
"peers": "peer connessi",
|
||||||
"version": "versione core"
|
"version": "versione core"
|
||||||
},
|
},
|
||||||
|
"domain": "domain",
|
||||||
"ui": {
|
"ui": {
|
||||||
"version": "versione UI"
|
"version": "versione UI"
|
||||||
},
|
},
|
||||||
@ -44,27 +101,123 @@
|
|||||||
"one": "uno"
|
"one": "uno"
|
||||||
},
|
},
|
||||||
"description": "descrizione",
|
"description": "descrizione",
|
||||||
"downloading_qdn": "scaricamento da QDN",
|
"devmode_apps": "dev Mode Apps",
|
||||||
|
"directory": "directory",
|
||||||
|
"downloading_qdn": "download da QDN",
|
||||||
"fee": {
|
"fee": {
|
||||||
"payment": "commissione di pagamento",
|
"payment": "commissione di pagamento",
|
||||||
"publish": "commissione di pubblicazione"
|
"publish": "commissione di pubblicazione"
|
||||||
},
|
},
|
||||||
|
"for": "per",
|
||||||
"general_settings": "impostazioni generali",
|
"general_settings": "impostazioni generali",
|
||||||
"last_height": "ultima altezza",
|
"identifier": "identificatore",
|
||||||
|
"last_height": "altezza ultima",
|
||||||
|
"level": "livello",
|
||||||
|
"library": "libreria",
|
||||||
"list": {
|
"list": {
|
||||||
"invite": "lista inviti",
|
"invite": "lista inviti",
|
||||||
"join_request": "lista richieste di adesione",
|
"join_request": "lista richieste di adesione",
|
||||||
"member": "lista membri"
|
"member": "lista membri"
|
||||||
},
|
},
|
||||||
"loading": "caricamento...",
|
"loading": {
|
||||||
"loading_posts": "caricamento post... attendere.",
|
"announcements": "annunci",
|
||||||
"message_us": "contattaci su Telegram o Discord se hai bisogno di 4 QORT per iniziare a chattare senza limitazioni",
|
"generic": "caricamento...",
|
||||||
|
"chat": "caricamento chat... attendere, per favore.",
|
||||||
|
"comments": "caricamento commenti... attendere, per favore.",
|
||||||
|
"posts": "caricamento post... attendere, per favore."
|
||||||
|
},
|
||||||
|
"message_us": "please message us on Telegram or Discord if you need 4 QORT to start chatting without any limitations",
|
||||||
"message": {
|
"message": {
|
||||||
"error": {
|
"error": {
|
||||||
"generic": "si è verificato un errore",
|
"address_not_found": "your address was not found",
|
||||||
"incorrect_password": "password errata",
|
"app_need_name": "your app needs a name",
|
||||||
"missing_field": "manca: {{ field }}",
|
"file_too_large": "file {{ filename }} is too large. Max size allowed is {{ size }} MB.",
|
||||||
"save_qdn": "impossibile salvare su QDN"
|
"generic": "an error occurred",
|
||||||
|
"invalid_signature": "invalid signature",
|
||||||
|
"invalid_zip": "invalid zip",
|
||||||
|
"message_loading": "error loading message.",
|
||||||
|
"message_size": "your message size is of {{ size }} bytes out of a maximum of {{ maximum }}",
|
||||||
|
"minting_account_add": "unable to add minting account",
|
||||||
|
"minting_account_remove": "unable to remove minting account",
|
||||||
|
"missing_fields": "missing: {{ fields }}",
|
||||||
|
"navigation_timeout": "navigation timeout",
|
||||||
|
"network_generic": "network error",
|
||||||
|
"password_not_matching": "password fields do not match!",
|
||||||
|
"password_wrong": "unable to authenticate. Wrong password",
|
||||||
|
"publish_app": "unable to publish app",
|
||||||
|
"rating_option": "cannot find rating option",
|
||||||
|
"save_qdn": "unable to save to QDN",
|
||||||
|
"send_failed": "failed to send",
|
||||||
|
"unable_encrypt_app": "unable to encrypt app. App not published'",
|
||||||
|
"unable_publish_app": "unable to publish app",
|
||||||
|
"unable_publish_image": "unable to publish image",
|
||||||
|
"unable_rate": "unable to rate",
|
||||||
|
"update_failed": "failed to update"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"avatar_size": "{{ size }} KB max. for GIFS",
|
||||||
|
"buy_order_request": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting {{count}} buy order</span>",
|
||||||
|
"buy_order_request_other": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting {{count}} buy orders</span>",
|
||||||
|
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
|
||||||
|
"edited": "edited",
|
||||||
|
"editing_message": "editing message",
|
||||||
|
"fee_qort": "fee: {{ message }} QORT",
|
||||||
|
"foreign_fee": "foreign fee: {{ message }}",
|
||||||
|
"mentioned": "mentioned",
|
||||||
|
"message_with_image": "this message already has an image",
|
||||||
|
"name_available": "{{ name }} is available",
|
||||||
|
"name_benefits": "benefits of a name",
|
||||||
|
"name_checking": "checking if name already exists",
|
||||||
|
"name_preview": "you need a name to use preview",
|
||||||
|
"name_publish": "you need a Qortal name to publish",
|
||||||
|
"name_rate": "you need a name to rate.",
|
||||||
|
"name_registration": "your balance is {{ balance }} QORT. A name registration requires a {{ fee }} QORT fee",
|
||||||
|
"name_unavailable": "{{ name }} is unavailable",
|
||||||
|
"no_description": "no description",
|
||||||
|
"no_minting_details": "cannot view minting details on the gateway",
|
||||||
|
"no_notifications": "no new notifications",
|
||||||
|
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
||||||
|
"no_results": "no results",
|
||||||
|
"one_app_per_name": "note: Currently, only one App and Website is allowed per Name.",
|
||||||
|
"overwrite_qdn": "overwrite to QDN",
|
||||||
|
"password_confirm": "please confirm a password",
|
||||||
|
"password_enter": "please enter a password",
|
||||||
|
"payment_request": "the Application <br/><italic>{{hostname}}</italic> <br/><span>is requesting a payment</span>",
|
||||||
|
"people_reaction": "people who reacted with {{ reaction }}",
|
||||||
|
"publish_data": "publish data to Qortal: anything from apps to videos. Fully decentralized!",
|
||||||
|
"publishing": "publishing... Please wait.",
|
||||||
|
"qdn": "use QDN saving",
|
||||||
|
"rating": "rating for {{ service }} {{ name }}",
|
||||||
|
"register_name": "you need a registered Qortal name to save your pinned apps to QDN.",
|
||||||
|
"replied_to": "replied to {{ person }}",
|
||||||
|
"revert_default": "revert to default",
|
||||||
|
"revert_qdn": "revert to QDN",
|
||||||
|
"save_qdn": "save to QDN",
|
||||||
|
"secure_ownership": "secure ownership of data published by your name. You can even sell your name, along with your data to a third party.",
|
||||||
|
"select_file": "please select a file",
|
||||||
|
"select_image": "please select an image for a logo",
|
||||||
|
"select_zip": "select .zip file containing static content:",
|
||||||
|
"sending": "sending...",
|
||||||
|
"settings": "you are using the export/import way of saving settings.",
|
||||||
|
"space_for_admins": "sorry, this space is only for Admins.",
|
||||||
|
"unread_messages": "unread messages below",
|
||||||
|
"unsaved_changes": "you have unsaved changes to your pinned apps. Save them to QDN.",
|
||||||
|
"updating": "updating"
|
||||||
|
},
|
||||||
|
"question": {
|
||||||
|
"logout": "are you sure you would like to logout?",
|
||||||
|
"new_user": "are you a new user?",
|
||||||
|
"delete_chat_image": "would you like to delete your previous chat image?",
|
||||||
|
"perform_transaction": "would you like to perform a {{action}} transaction?",
|
||||||
|
"provide_thread": "please provide a thread title",
|
||||||
|
"publish_app": "would you like to publish this app?",
|
||||||
|
"publish_avatar": "would you like to publish an avatar?",
|
||||||
|
"publish_qdn": "would you like to publish your settings to QDN (encrypted)?",
|
||||||
|
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
||||||
|
"rate_app": "would you like to rate this app a rating of {{ rate }}?. It will create a POLL tx.",
|
||||||
|
"register_name": "would you like to register this name?",
|
||||||
|
"reset_pinned": "don't like your current local changes? Would you like to reset to the default pinned apps?",
|
||||||
|
"reset_qdn": "don't like your current local changes? Would you like to reset to your saved QDN pinned apps?"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"minting": "(in conio)",
|
"minting": "(in conio)",
|
||||||
@ -73,13 +226,18 @@
|
|||||||
"synchronizing": "sincronizzazione"
|
"synchronizing": "sincronizzazione"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"order_submitted": "il tuo ordine di acquisto è stato inviato",
|
"order_submitted": "your buy order was submitted",
|
||||||
"publish_qdn": "pubblicato con successo su QDN",
|
"published": "successfully published. Please wait a couple minutes for the network to propogate the changes.",
|
||||||
"request_read": "ho letto questa richiesta",
|
"published_qdn": "successfully published to QDN",
|
||||||
"transfer": "il trasferimento è riuscito!"
|
"rated_app": "successfully rated. Please wait a couple minutes for the network to propogate the changes.",
|
||||||
|
"request_read": "I have read this request",
|
||||||
|
"transfer": "the transfer was succesful!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minting_status": "stato conio",
|
"minting_status": "stato del conio",
|
||||||
|
"name": "nome",
|
||||||
|
"name_app": "nome/App",
|
||||||
|
"none": "nessuno",
|
||||||
"page": {
|
"page": {
|
||||||
"last": "ultima",
|
"last": "ultima",
|
||||||
"first": "prima",
|
"first": "prima",
|
||||||
@ -89,27 +247,13 @@
|
|||||||
"payment_notification": "notifica di pagamento",
|
"payment_notification": "notifica di pagamento",
|
||||||
"price": "prezzo",
|
"price": "prezzo",
|
||||||
"q_mail": "q-mail",
|
"q_mail": "q-mail",
|
||||||
"question": {
|
"server": "server",
|
||||||
"new_user": "sei un nuovo utente?"
|
"settings": "settings",
|
||||||
|
"sort": {
|
||||||
|
"by_member": "by member"
|
||||||
},
|
},
|
||||||
"save_options": {
|
"supply": "supply",
|
||||||
"no_pinned_changes": "attualmente non hai modifiche nelle app fissate",
|
"tags": "tags",
|
||||||
"overwrite_changes": "l'app non è riuscita a scaricare le tue app fissate salvate su QDN. Vuoi sovrascrivere le modifiche?",
|
|
||||||
"overwrite_qdn": "sovrascrivi su QDN",
|
|
||||||
"publish_qdn": "vuoi pubblicare le tue impostazioni su QDN (crittografate)?",
|
|
||||||
"qdn": "usa salvataggio QDN",
|
|
||||||
"register_name": "hai bisogno di un nome Qortal registrato per salvare le app fissate su QDN.",
|
|
||||||
"reset_pinned": "non ti piacciono le modifiche locali? Vuoi ripristinare le app fissate predefinite?",
|
|
||||||
"reset_qdn": "non ti piacciono le modifiche locali? Vuoi ripristinare le app fissate salvate su QDN?",
|
|
||||||
"revert_default": "ripristina ai valori predefiniti",
|
|
||||||
"revert_qdn": "ripristina da QDN",
|
|
||||||
"save_qdn": "salva su QDN",
|
|
||||||
"save": "salva",
|
|
||||||
"settings": "stai usando il metodo di esportazione/importazione per salvare le impostazioni.",
|
|
||||||
"unsaved_changes": "hai modifiche non salvate nelle app fissate. Salvale su QDN."
|
|
||||||
},
|
|
||||||
"settings": "impostazioni",
|
|
||||||
"supply": "offerta",
|
|
||||||
"theme": {
|
"theme": {
|
||||||
"dark": "modalità scura",
|
"dark": "modalità scura",
|
||||||
"light": "modalità chiara"
|
"light": "modalità chiara"
|
||||||
@ -125,9 +269,13 @@
|
|||||||
"title": "titolo",
|
"title": "titolo",
|
||||||
"tutorial": "tutorial",
|
"tutorial": "tutorial",
|
||||||
"user_lookup": "ricerca utente",
|
"user_lookup": "ricerca utente",
|
||||||
|
"zip": "zip",
|
||||||
"wallet": {
|
"wallet": {
|
||||||
|
"litecoin": "portafoglio litecoin",
|
||||||
|
"qortal": "portafoglio qortal",
|
||||||
"wallet": "portafoglio",
|
"wallet": "portafoglio",
|
||||||
"wallet_other": "portafogli"
|
"wallet_other": "portafogli"
|
||||||
},
|
},
|
||||||
|
"website": "website",
|
||||||
"welcome": "benvenuto"
|
"welcome": "benvenuto"
|
||||||
}
|
}
|
||||||
|
@ -16,9 +16,17 @@
|
|||||||
"load_members": "carica membri con nomi",
|
"load_members": "carica membri con nomi",
|
||||||
"make_admin": "rendi amministratore",
|
"make_admin": "rendi amministratore",
|
||||||
"manage_members": "gestisci membri",
|
"manage_members": "gestisci membri",
|
||||||
|
"promote_group": "promuovi il gruppo ai non-membri",
|
||||||
|
"publish_announcement": "pubblica annuncio",
|
||||||
|
"publish_avatar": "pubblica avatar",
|
||||||
"refetch_page": "ricarica pagina",
|
"refetch_page": "ricarica pagina",
|
||||||
"remove_admin": "rimuovi come amministratore",
|
"remove_admin": "rimuovi come amministratore",
|
||||||
"return_to_thread": "torna alle discussioni"
|
"remove_minting_account": "rimuovi account di conio",
|
||||||
|
"return_to_thread": "torna alle discussioni",
|
||||||
|
"scroll_bottom": "vai in fondo",
|
||||||
|
"scroll_unread_messages": "vai ai messaggi non letti",
|
||||||
|
"select_group": "seleziona un gruppo",
|
||||||
|
"visit_q_mintership": "visita Q-Mintership"
|
||||||
},
|
},
|
||||||
"advanced_options": "opzioni avanzate",
|
"advanced_options": "opzioni avanzate",
|
||||||
"approval_threshold": "soglia di approvazione del gruppo (numero / percentuale di amministratori che devono approvare una transazione)",
|
"approval_threshold": "soglia di approvazione del gruppo (numero / percentuale di amministratori che devono approvare una transazione)",
|
||||||
@ -28,14 +36,21 @@
|
|||||||
"maximum": "ritardo massimo dei blocchi per le approvazioni delle transazioni di gruppo"
|
"maximum": "ritardo massimo dei blocchi per le approvazioni delle transazioni di gruppo"
|
||||||
},
|
},
|
||||||
"group": {
|
"group": {
|
||||||
|
"avatar": "avatar del gruppo",
|
||||||
"closed": "chiuso (privato) – gli utenti hanno bisogno del permesso per entrare",
|
"closed": "chiuso (privato) – gli utenti hanno bisogno del permesso per entrare",
|
||||||
"description": "descrizione del gruppo",
|
"description": "descrizione del gruppo",
|
||||||
"id": "ID gruppo",
|
"id": "ID gruppo",
|
||||||
"invites": "inviti del gruppo",
|
"invites": "inviti del gruppo",
|
||||||
|
"group": "gruppo",
|
||||||
|
"group_other": "gruppi",
|
||||||
"management": "gestione del gruppo",
|
"management": "gestione del gruppo",
|
||||||
"member_number": "numero di membri",
|
"member_number": "numero di membri",
|
||||||
|
"messaging": "messaggi",
|
||||||
"name": "nome del gruppo",
|
"name": "nome del gruppo",
|
||||||
"open": "aperto (pubblico)",
|
"open": "aperto (pubblico)",
|
||||||
|
"private": "gruppo privato",
|
||||||
|
"promotions": "promozione gruppi",
|
||||||
|
"public": "gruppo pubblico",
|
||||||
"type": "tipo di gruppo"
|
"type": "tipo di gruppo"
|
||||||
},
|
},
|
||||||
"invitation_expiry": "tempo di scadenza dell'invito",
|
"invitation_expiry": "tempo di scadenza dell'invito",
|
||||||
@ -46,16 +61,40 @@
|
|||||||
"latest_mails": "ultimi Q-Mails",
|
"latest_mails": "ultimi Q-Mails",
|
||||||
"message": {
|
"message": {
|
||||||
"generic": {
|
"generic": {
|
||||||
|
"avatar_publish_fee": "publishing an Avatar requires {{ fee }}",
|
||||||
|
"avatar_registered_name": "a registered name is required to set an avatar",
|
||||||
|
"admin_only": "only groups where you are an admin will be shown",
|
||||||
"already_in_group": "sei già in questo gruppo!",
|
"already_in_group": "sei già in questo gruppo!",
|
||||||
"closed_group": "questo è un gruppo chiuso/privato, devi aspettare che un admin accetti la tua richiesta",
|
"closed_group": "questo è un gruppo chiuso/privato, devi aspettare che un admin accetti la tua richiesta",
|
||||||
"descrypt_wallet": "decrittazione portafoglio in corso...",
|
"descrypt_wallet": "decrittazione portafoglio in corso...",
|
||||||
"encryption_key": "la prima chiave di cifratura comune del gruppo è in fase di creazione. Attendere qualche minuto affinché venga recuperata dalla rete. Controllo ogni 2 minuti...",
|
"encryption_key": "la prima chiave di cifratura comune del gruppo è in fase di creazione. Attendere qualche minuto affinché venga recuperata dalla rete. Controllo ogni 2 minuti...",
|
||||||
|
"group_announcement": "group Announcements",
|
||||||
"group_invited_you": "{{group}} ti ha invitato",
|
"group_invited_you": "{{group}} ti ha invitato",
|
||||||
|
"group_key_created": "first group key created.",
|
||||||
|
"group_member_list_changed": "the group member list has changed. Please re-encrypt the secret key.",
|
||||||
|
"group_no_secret_key": "there is no group secret key. Be the first admin to publish one!",
|
||||||
|
"group_secret_key_no_owner": "the latest group secret key was published by a non-owner. As the owner of the group please re-encrypt the key as a safeguard.",
|
||||||
|
"invalid_content": "invalid content, sender, or timestamp in reaction data",
|
||||||
|
"invalid_data": "error loading content: Invalid Data",
|
||||||
|
"latest_promotion": "only the latest promotion from the week will be shown for your group.",
|
||||||
"loading_members": "caricamento elenco membri con nomi... attendere.",
|
"loading_members": "caricamento elenco membri con nomi... attendere.",
|
||||||
|
"max_chars": "max 200 characters. Publish Fee",
|
||||||
|
"manage_minting": "manage your minting",
|
||||||
|
"minter_group": "you are currently not part of the MINTER group",
|
||||||
|
"mintership_app": "visit the Q-Mintership app to apply to be a minter",
|
||||||
|
"minting_account": "minting account:",
|
||||||
|
"minting_keys_per_node": "only 2 minting keys are allowed per node. Please remove one if you would like to mint with this account.",
|
||||||
|
"minting_keys_per_node_different": "only 2 minting keys are allowed per node. Please remove one if you would like to add a different account.",
|
||||||
|
"next_level": "blocks remaining until next level:",
|
||||||
|
"node_minting": "This node is minting:",
|
||||||
|
"node_minting_account": "node's minting accounts",
|
||||||
|
"node_minting_key": "you currently have a minting key for this account attached to this node",
|
||||||
|
"no_announcement": "no announcements",
|
||||||
"no_display": "niente da mostrare",
|
"no_display": "niente da mostrare",
|
||||||
"no_selection": "nessun gruppo selezionato",
|
"no_selection": "nessun gruppo selezionato",
|
||||||
"not_part_group": "non fai parte del gruppo cifrato. Attendi che un amministratore re-critti le chiavi.",
|
"not_part_group": "non fai parte del gruppo cifrato. Attendi che un amministratore re-critti le chiavi.",
|
||||||
"only_encrypted": "verranno mostrati solo i messaggi non cifrati.",
|
"only_encrypted": "verranno mostrati solo i messaggi non cifrati.",
|
||||||
|
"only_private_groups": "only private groups will be shown",
|
||||||
"private_key_copied": "chiave privata copiata",
|
"private_key_copied": "chiave privata copiata",
|
||||||
"provide_message": "inserisci un primo messaggio per la discussione",
|
"provide_message": "inserisci un primo messaggio per la discussione",
|
||||||
"secure_place": "conserva la tua chiave privata in un luogo sicuro. Non condividerla!",
|
"secure_place": "conserva la tua chiave privata in un luogo sicuro. Non condividerla!",
|
||||||
@ -66,10 +105,15 @@
|
|||||||
"descrypt_wallet": "errore nella decrittazione del portafoglio {{ :errorMessage }}",
|
"descrypt_wallet": "errore nella decrittazione del portafoglio {{ :errorMessage }}",
|
||||||
"description_required": "inserisci una descrizione",
|
"description_required": "inserisci una descrizione",
|
||||||
"group_info": "impossibile accedere alle informazioni del gruppo",
|
"group_info": "impossibile accedere alle informazioni del gruppo",
|
||||||
|
"group_promotion": "error publishing the promotion. Please try again",
|
||||||
"group_secret_key": "impossibile ottenere la chiave segreta del gruppo",
|
"group_secret_key": "impossibile ottenere la chiave segreta del gruppo",
|
||||||
"name_required": "inserisci un nome",
|
"name_required": "inserisci un nome",
|
||||||
"notify_admins": "prova a contattare un amministratore dalla lista qui sotto:",
|
"notify_admins": "prova a contattare un amministratore dalla lista qui sotto:",
|
||||||
"thread_id": "impossibile trovare l'ID della discussione"
|
"qortals_required": "you need at least {{ quantity }} QORT to send a message",
|
||||||
|
"timeout_reward": "timeout waiting for reward share confirmation",
|
||||||
|
"thread_id": "impossibile trovare l'ID della discussione",
|
||||||
|
"unable_determine_group_private": "unable to determine if group is private",
|
||||||
|
"unable_minting": "unable to start minting"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"group_ban": "membro bannato con successo dal gruppo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
"group_ban": "membro bannato con successo dal gruppo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
||||||
@ -87,19 +131,27 @@
|
|||||||
"group_leave_name": "uscito dal gruppo {{group_name}}: in attesa di conferma",
|
"group_leave_name": "uscito dal gruppo {{group_name}}: in attesa di conferma",
|
||||||
"group_leave_label": "uscito dal gruppo {{name}}: successo!",
|
"group_leave_label": "uscito dal gruppo {{name}}: successo!",
|
||||||
"group_member_admin": "membro nominato amministratore con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
"group_member_admin": "membro nominato amministratore con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
||||||
|
"group_promotion": "successfully published promotion. It may take a couple of minutes for the promotion to appear",
|
||||||
"group_remove_member": "amministratore rimosso con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
"group_remove_member": "amministratore rimosso con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
||||||
"invitation_cancellation": "invito annullato con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
"invitation_cancellation": "invito annullato con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
||||||
"invitation_request": "richiesta di adesione accettata: in attesa di conferma",
|
"invitation_request": "richiesta di adesione accettata: in attesa di conferma",
|
||||||
"loading_threads": "caricamento discussioni... attendere.",
|
"loading_threads": "caricamento discussioni... attendere.",
|
||||||
"post_creation": "post creato con successo. Potrebbe volerci un po' per la pubblicazione",
|
"post_creation": "post creato con successo. Potrebbe volerci un po' per la pubblicazione",
|
||||||
|
"published_secret_key": "published secret key for group {{ group_id }}: awaiting confirmation",
|
||||||
|
"published_secret_key_label": "published secret key for group {{ group_id }}: success!",
|
||||||
|
"registered_name": "successfully registered. It may take a couple of minutes for the changes to propagate",
|
||||||
|
"registered_name_label": "registered name: awaiting confirmation. This may take a couple minutes.",
|
||||||
|
"registered_name_success": "registered name: success!",
|
||||||
|
"rewardshare_add": "add rewardshare: awaiting confirmation",
|
||||||
|
"rewardshare_add_label": "add rewardshare: success!",
|
||||||
|
"rewardshare_creation": "confirming creation of rewardshare on chain. Please be patient, this could take up to 90 seconds.",
|
||||||
|
"rewardshare_confirmed": "rewardshare confirmed. Please click Next.",
|
||||||
|
"rewardshare_remove": "remove rewardshare: awaiting confirmation",
|
||||||
|
"rewardshare_remove_label": "remove rewardshare: success!",
|
||||||
"thread_creation": "discussione creata con successo. Potrebbe volerci un po' per la pubblicazione",
|
"thread_creation": "discussione creata con successo. Potrebbe volerci un po' per la pubblicazione",
|
||||||
"unbanned_user": "utente sbannato con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
"unbanned_user": "utente sbannato con successo. Potrebbero volerci alcuni minuti affinché le modifiche si propaghino",
|
||||||
"user_joined": "utente entrato con successo!"
|
"user_joined": "utente entrato con successo!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"question": {
|
|
||||||
"perform_transaction": "vuoi eseguire una transazione di tipo {{action}}?",
|
|
||||||
"provide_thread": "inserisci un titolo per la discussione"
|
|
||||||
},
|
|
||||||
"thread_posts": "nuovi messaggi nella discussione"
|
"thread_posts": "nuovi messaggi nella discussione"
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,28 @@
|
|||||||
{
|
{
|
||||||
"account": {
|
"account": {
|
||||||
"your": "Ваш аккаунт",
|
"your": "ваш аккаунт",
|
||||||
"account_many": "аккаунты",
|
"account_many": "аккаунты",
|
||||||
"account_one": "аккаунт"
|
"account_one": "аккаунт",
|
||||||
|
"selected": "выбранный аккаунт"
|
||||||
},
|
},
|
||||||
"advanced_users": "для продвинутых пользователей",
|
"action": {
|
||||||
|
"add": {
|
||||||
|
"account": "добавить аккаунт",
|
||||||
|
"seed_phrase": "добавить seed-фразу"
|
||||||
|
},
|
||||||
|
"authenticate": "аутентификация",
|
||||||
|
"create_account": "создать аккаунт",
|
||||||
|
"create_qortal_account": "создайте свой аккаунт Qortal, нажав <next>ДАЛЕЕ</next> ниже.",
|
||||||
|
"choose_password": "выберите новый пароль",
|
||||||
|
"download_account": "скачать аккаунт",
|
||||||
|
"export_seedphrase": "экспортировать seed-фразу",
|
||||||
|
"publish_admin_secret_key": "опубликовать секретный ключ администратора",
|
||||||
|
"publish_group_secret_key": "опубликовать секретный ключ группы",
|
||||||
|
"reencrypt_key": "перешифровать ключ",
|
||||||
|
"return_to_list": "вернуться к списку",
|
||||||
|
"setup_qortal_account": "настройте ваш аккаунт Qortal"
|
||||||
|
},
|
||||||
|
"advanced_users": "для опытных пользователей",
|
||||||
"apikey": {
|
"apikey": {
|
||||||
"alternative": "альтернатива: выбрать файл",
|
"alternative": "альтернатива: выбрать файл",
|
||||||
"change": "изменить API-ключ",
|
"change": "изменить API-ключ",
|
||||||
@ -13,11 +31,33 @@
|
|||||||
"key": "API-ключ",
|
"key": "API-ключ",
|
||||||
"select_valid": "выберите действительный API-ключ"
|
"select_valid": "выберите действительный API-ключ"
|
||||||
},
|
},
|
||||||
"authenticate": "аутентификация",
|
|
||||||
"build_version": "версия сборки",
|
"build_version": "версия сборки",
|
||||||
"create_account": "создать аккаунт",
|
"message": {
|
||||||
"download_account": "скачать аккаунт",
|
"error": {
|
||||||
"keep_secure": "Храните файл аккаунта в безопасности",
|
"account_creation": "не удалось создать аккаунт.",
|
||||||
|
"field_not_found_json": "{{ field }} не найден в JSON",
|
||||||
|
"incorrect_password": "неверный пароль",
|
||||||
|
"invalid_secret_key": "некорректный секретный ключ",
|
||||||
|
"unable_reencrypt_secret_key": "не удалось перешифровать секретный ключ"
|
||||||
|
},
|
||||||
|
"generic": {
|
||||||
|
"congrats_setup": "поздравляем, всё готово!",
|
||||||
|
"no_account": "аккаунты не сохранены",
|
||||||
|
"no_minimum_length": "требование к минимальной длине отсутствует",
|
||||||
|
"no_secret_key_published": "секретный ключ еще не опубликован",
|
||||||
|
"fetching_admin_secret_key": "получение секретного ключа администратора",
|
||||||
|
"fetching_group_secret_key": "публикация секретного ключа группы",
|
||||||
|
"last_encryption_date": "дата последнего шифрования: {{ date }}, автор: {{ name }}",
|
||||||
|
"keep_secure": "храните файл аккаунта в безопасности",
|
||||||
|
"publishing_key": "напоминание: после публикации ключа может пройти несколько минут до его появления. Пожалуйста, подождите.",
|
||||||
|
"seedphrase_notice": "в фоновом режиме была случайным образом сгенерирована <seed>SEED-ФРАЗА</seed>.",
|
||||||
|
"type_seed": "введите или вставьте свою seed-фразу",
|
||||||
|
"your_accounts": "ваши сохранённые аккаунты"
|
||||||
|
},
|
||||||
|
"success": {
|
||||||
|
"reencrypted_secret_key": "секретный ключ успешно перешифрован. Обновления могут занять несколько минут. Обновите группу через 5 минут."
|
||||||
|
}
|
||||||
|
},
|
||||||
"node": {
|
"node": {
|
||||||
"choose": "выбрать пользовательский узел",
|
"choose": "выбрать пользовательский узел",
|
||||||
"custom_many": "пользовательские узлы",
|
"custom_many": "пользовательские узлы",
|
||||||
@ -26,17 +66,31 @@
|
|||||||
"using": "используется узел",
|
"using": "используется узел",
|
||||||
"using_public": "используется публичный узел"
|
"using_public": "используется публичный узел"
|
||||||
},
|
},
|
||||||
|
"note": "заметка",
|
||||||
"password": "пароль",
|
"password": "пароль",
|
||||||
"password_confirmation": "подтвердите пароль",
|
"password_confirmation": "подтвердите пароль",
|
||||||
"return_to_list": "вернуться к списку",
|
"seed": "seed-фраза",
|
||||||
|
"seed_your": "ваша seed-фраза",
|
||||||
|
"tips": {
|
||||||
|
"additional_wallet": "используйте эту опцию, чтобы подключить дополнительные кошельки Qortal, которые вы уже создали. Вам понадобится файл резервной копии JSON.",
|
||||||
|
"digital_id": "ваш кошелёк — это ваш цифровой идентификатор в Qortal. Через него вы входите в интерфейс пользователя Qortal. Он содержит ваш публичный адрес и выбранное вами имя Qortal. Все ваши транзакции связаны с этим ID. Здесь вы управляете QORT и другими криптовалютами в Qortal.",
|
||||||
|
"existing_account": "уже есть аккаунт Qortal? Введите здесь вашу секретную фразу восстановления для доступа. Это один из способов восстановить аккаунт.",
|
||||||
|
"key_encrypt_admin": "этот ключ используется для шифрования контента, связанного с АДМИНИСТРАТОРОМ. Только администраторы смогут его видеть.",
|
||||||
|
"key_encrypt_group": "этот ключ используется для шифрования контента ГРУППЫ. В данный момент он единственный, используемый в этом интерфейсе. Все участники группы смогут видеть зашифрованный контент.",
|
||||||
|
"new_account": "создание аккаунта создаёт новый кошелёк и цифровой ID для начала работы с Qortal. После этого вы сможете получать QORT, покупать имя и аватар, публиковать видео и блоги и многое другое.",
|
||||||
|
"new_users": "новые пользователи — начните отсюда!",
|
||||||
|
"safe_place": "сохраните свой аккаунт в надёжном месте, которое вы не забудете!",
|
||||||
|
"view_seedphrase": "если вы хотите ПОСМОТРЕТЬ SEED-ФРАЗУ, нажмите на слово 'SEED-ФРАЗА' в этом тексте. Seed-фразы используются для генерации приватного ключа аккаунта. В целях безопасности по умолчанию они НЕ отображаются.",
|
||||||
|
"wallet_secure": "держите файл кошелька в безопасности."
|
||||||
|
},
|
||||||
"wallet": {
|
"wallet": {
|
||||||
"password_confirmation": "подтвердите пароль кошелька",
|
"password_confirmation": "подтвердите пароль кошелька",
|
||||||
"password": "пароль кошелька",
|
"password": "пароль кошелька",
|
||||||
"keep_password": "сохранить текущий пароль",
|
"keep_password": "оставить текущий пароль",
|
||||||
"new_password": "новый пароль",
|
"new_password": "новый пароль",
|
||||||
"error": {
|
"error": {
|
||||||
"missing_new_password": "пожалуйста, введите новый пароль",
|
"missing_new_password": "введите новый пароль",
|
||||||
"missing_password": "пожалуйста, введите ваш пароль"
|
"missing_password": "введите пароль"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"welcome": "добро пожаловать в"
|
"welcome": "добро пожаловать в"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -55,7 +55,6 @@ import { QORT_DECIMALS } from '../constants/constants';
|
|||||||
import Base58 from '../deps/Base58';
|
import Base58 from '../deps/Base58';
|
||||||
import ed2curve from '../deps/ed2curve';
|
import ed2curve from '../deps/ed2curve';
|
||||||
import nacl from '../deps/nacl-fast';
|
import nacl from '../deps/nacl-fast';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
base64ToUint8Array,
|
base64ToUint8Array,
|
||||||
createSymmetricKeyAndNonce,
|
createSymmetricKeyAndNonce,
|
||||||
@ -86,7 +85,7 @@ import { RequestQueueWithPromise } from '../utils/queue/queue';
|
|||||||
import utils from '../utils/utils';
|
import utils from '../utils/utils';
|
||||||
import ShortUniqueId from 'short-unique-id';
|
import ShortUniqueId from 'short-unique-id';
|
||||||
import { isValidBase64WithDecode } from '../utils/decode';
|
import { isValidBase64WithDecode } from '../utils/decode';
|
||||||
|
//TODO translate
|
||||||
const uid = new ShortUniqueId({ length: 6 });
|
const uid = new ShortUniqueId({ length: 6 });
|
||||||
|
|
||||||
export const requestQueueGetAtAddresses = new RequestQueueWithPromise(10);
|
export const requestQueueGetAtAddresses = new RequestQueueWithPromise(10);
|
||||||
@ -132,6 +131,7 @@ export async function retryTransaction(
|
|||||||
throwError,
|
throwError,
|
||||||
retries = MAX_RETRIES
|
retries = MAX_RETRIES
|
||||||
) {
|
) {
|
||||||
|
// TODO transalte
|
||||||
let attempt = 0;
|
let attempt = 0;
|
||||||
while (attempt < retries) {
|
while (attempt < retries) {
|
||||||
try {
|
try {
|
||||||
|
@ -228,5 +228,5 @@ export const CustomLabel = styled(InputLabel)(({ theme }) => ({
|
|||||||
fontFamily: 'Inter',
|
fontFamily: 'Inter',
|
||||||
fontSize: '15px',
|
fontSize: '15px',
|
||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
lineHeight: '12px',
|
lineHeight: '24px',
|
||||||
}));
|
}));
|
||||||
|
@ -1,37 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class AddGroupAdminTransaction extends TransactionBase {
|
export default class AddGroupAdminTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 24
|
this.type = 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(this._rGroupIdBytes, this._recipient, this._feeBytes);
|
||||||
this._rGroupIdBytes,
|
return params;
|
||||||
this._recipient,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,45 +1,48 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class BuyNameTransacion extends TransactionBase {
|
export default class BuyNameTransacion extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 7
|
this.type = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set name(name) {
|
set name(name) {
|
||||||
this.nameText = name
|
this.nameText = name;
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name);
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._nameLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._nameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set sellPrice(sellPrice) {
|
set sellPrice(sellPrice) {
|
||||||
this._sellPrice = sellPrice * QORT_DECIMALS
|
this._sellPrice = sellPrice * QORT_DECIMALS;
|
||||||
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice)
|
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._nameLength,
|
this._nameLength,
|
||||||
this._nameBytes,
|
this._nameBytes,
|
||||||
this._sellPriceBytes,
|
this._sellPriceBytes,
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,37 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class CancelGroupBanTransaction extends TransactionBase {
|
export default class CancelGroupBanTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 27
|
this.type = 27;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(this._rGroupIdBytes, this._recipient, this._feeBytes);
|
||||||
this._rGroupIdBytes,
|
return params;
|
||||||
this._recipient,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,36 +1,33 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class CancelGroupInviteTransaction extends TransactionBase {
|
export default class CancelGroupInviteTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 30
|
this.type = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(this._rGroupIdBytes, this._recipient, this._feeBytes);
|
||||||
this._rGroupIdBytes,
|
return params;
|
||||||
this._recipient,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class CancelSellNameTransacion extends TransactionBase {
|
export default class CancelSellNameTransacion extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 6
|
this.type = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set name(name) {
|
set name(name) {
|
||||||
this.nameText = name
|
this.nameText = name;
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name);
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._nameLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._nameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(this._nameLength, this._nameBytes, this._feeBytes);
|
||||||
this._nameLength,
|
return params;
|
||||||
this._nameBytes,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,148 +1,161 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS, TX_TYPES } from '../constants/constants'
|
import { QORT_DECIMALS, TX_TYPES } from '../constants/constants';
|
||||||
import nacl from '../deps/nacl-fast'
|
import nacl from '../deps/nacl-fast';
|
||||||
import Base58 from '../deps/Base58'
|
import Base58 from '../deps/Base58';
|
||||||
import utils from '../utils/utils'
|
import utils from '../utils/utils';
|
||||||
|
|
||||||
export default class ChatBase {
|
export default class ChatBase {
|
||||||
static get utils() {
|
static get utils() {
|
||||||
return utils
|
return utils;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get nacl() {
|
static get nacl() {
|
||||||
return nacl
|
return nacl;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get Base58() {
|
static get Base58() {
|
||||||
return Base58
|
return Base58;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
this.fee = 0;
|
||||||
this.fee = 0
|
this.groupID = 0;
|
||||||
this.groupID = 0
|
this.tests = [
|
||||||
this.tests = [
|
() => {
|
||||||
() => {
|
if (!(this._type >= 1 && this._type in TX_TYPES)) {
|
||||||
if (!(this._type >= 1 && this._type in TX_TYPES)) {
|
return 'Invalid type: ' + this.type;
|
||||||
return 'Invalid type: ' + this.type
|
}
|
||||||
}
|
return true;
|
||||||
return true
|
},
|
||||||
},
|
() => {
|
||||||
() => {
|
if (this._fee < 0) {
|
||||||
if (this._fee < 0) {
|
return 'Invalid fee: ' + this._fee / QORT_DECIMALS;
|
||||||
return 'Invalid fee: ' + this._fee / QORT_DECIMALS
|
}
|
||||||
}
|
return true;
|
||||||
return true
|
},
|
||||||
},
|
() => {
|
||||||
() => {
|
if (this._groupID < 0 || !Number.isInteger(this._groupID)) {
|
||||||
if (this._groupID < 0 || !Number.isInteger(this._groupID)) {
|
return 'Invalid groupID: ' + this._groupID;
|
||||||
return 'Invalid groupID: ' + this._groupID
|
}
|
||||||
}
|
return true;
|
||||||
return true
|
},
|
||||||
},
|
() => {
|
||||||
() => {
|
if (!new Date(this._timestamp).getTime() > 0) {
|
||||||
if (!(new Date(this._timestamp)).getTime() > 0) {
|
return 'Invalid timestamp: ' + this._timestamp;
|
||||||
return 'Invalid timestamp: ' + this._timestamp
|
}
|
||||||
}
|
return true;
|
||||||
return true
|
},
|
||||||
},
|
() => {
|
||||||
() => {
|
if (
|
||||||
|
!(
|
||||||
if (!(this._lastReference instanceof Uint8Array && this._lastReference.byteLength == 64)) {
|
this._lastReference instanceof Uint8Array &&
|
||||||
return 'Invalid last reference: ' + this._lastReference
|
this._lastReference.byteLength == 64
|
||||||
}
|
)
|
||||||
return true
|
) {
|
||||||
},
|
return 'Invalid last reference: ' + this._lastReference;
|
||||||
() => {
|
}
|
||||||
if (!(this._keyPair)) {
|
return true;
|
||||||
return 'keyPair must be specified'
|
},
|
||||||
}
|
() => {
|
||||||
if (!(this._keyPair.publicKey instanceof Uint8Array && this._keyPair.publicKey.byteLength === 32)) {
|
if (!this._keyPair) {
|
||||||
return 'Invalid publicKey'
|
return 'keyPair must be specified';
|
||||||
}
|
}
|
||||||
if (!(this._keyPair.privateKey instanceof Uint8Array && this._keyPair.privateKey.byteLength === 64)) {
|
if (
|
||||||
return 'Invalid privateKey'
|
!(
|
||||||
}
|
this._keyPair.publicKey instanceof Uint8Array &&
|
||||||
return true
|
this._keyPair.publicKey.byteLength === 32
|
||||||
}
|
)
|
||||||
]
|
) {
|
||||||
}
|
return 'Invalid publicKey';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!(
|
||||||
|
this._keyPair.privateKey instanceof Uint8Array &&
|
||||||
|
this._keyPair.privateKey.byteLength === 64
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return 'Invalid privateKey';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
set keyPair(keyPair) {
|
set keyPair(keyPair) {
|
||||||
this._keyPair = keyPair
|
this._keyPair = keyPair;
|
||||||
}
|
}
|
||||||
|
|
||||||
set type(type) {
|
set type(type) {
|
||||||
this.typeText = TX_TYPES[type]
|
this.typeText = TX_TYPES[type];
|
||||||
this._type = type
|
this._type = type;
|
||||||
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
this._typeBytes = this.constructor.utils.int32ToBytes(this._type);
|
||||||
}
|
}
|
||||||
|
|
||||||
set groupID(groupID) {
|
set groupID(groupID) {
|
||||||
this._groupID = groupID
|
this._groupID = groupID;
|
||||||
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
set timestamp(timestamp) {
|
set timestamp(timestamp) {
|
||||||
this._timestamp = timestamp
|
this._timestamp = timestamp;
|
||||||
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set lastReference(lastReference) {
|
set lastReference(lastReference) {
|
||||||
|
this._lastReference =
|
||||||
|
lastReference instanceof Uint8Array
|
||||||
|
? lastReference
|
||||||
|
: this.constructor.Base58.decode(lastReference);
|
||||||
|
}
|
||||||
|
|
||||||
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
get params() {
|
||||||
}
|
return [
|
||||||
|
this._typeBytes,
|
||||||
|
this._timestampBytes,
|
||||||
|
this._groupIDBytes,
|
||||||
|
this._lastReference,
|
||||||
|
this._keyPair.publicKey,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
get params() {
|
get chatBytes() {
|
||||||
return [
|
const isValid = this.validParams();
|
||||||
this._typeBytes,
|
if (!isValid.valid) {
|
||||||
this._timestampBytes,
|
throw new Error(isValid.message);
|
||||||
this._groupIDBytes,
|
}
|
||||||
this._lastReference,
|
|
||||||
this._keyPair.publicKey
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
get chatBytes() {
|
let result = new Uint8Array();
|
||||||
const isValid = this.validParams()
|
|
||||||
if (!isValid.valid) {
|
|
||||||
throw new Error(isValid.message)
|
|
||||||
}
|
|
||||||
|
|
||||||
let result = new Uint8Array()
|
this.params.forEach((item) => {
|
||||||
|
result = this.constructor.utils.appendBuffer(result, item);
|
||||||
|
});
|
||||||
|
|
||||||
this.params.forEach(item => {
|
this._chatBytes = result;
|
||||||
result = this.constructor.utils.appendBuffer(result, item)
|
|
||||||
})
|
|
||||||
|
|
||||||
this._chatBytes = result
|
return this._chatBytes;
|
||||||
|
}
|
||||||
|
|
||||||
return this._chatBytes
|
validParams() {
|
||||||
}
|
let finalResult = {
|
||||||
|
valid: true,
|
||||||
|
};
|
||||||
|
|
||||||
validParams() {
|
this.tests.some((test) => {
|
||||||
let finalResult = {
|
const result = test();
|
||||||
valid: true
|
if (result !== true) {
|
||||||
}
|
finalResult = {
|
||||||
|
valid: false,
|
||||||
this.tests.some(test => {
|
message: result,
|
||||||
const result = test()
|
};
|
||||||
if (result !== true) {
|
return true;
|
||||||
finalResult = {
|
}
|
||||||
valid: false,
|
});
|
||||||
message: result
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return finalResult
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return finalResult;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,92 +1,126 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import ChatBase from './ChatBase'
|
import ChatBase from './ChatBase';
|
||||||
import nacl from '../deps/nacl-fast'
|
import nacl from '../deps/nacl-fast';
|
||||||
import ed2curve from '../deps/ed2curve'
|
import ed2curve from '../deps/ed2curve';
|
||||||
import { Sha256 } from 'asmcrypto.js'
|
import { Sha256 } from 'asmcrypto.js';
|
||||||
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../constants/constants'
|
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../constants/constants';
|
||||||
|
|
||||||
export default class ChatTransaction extends ChatBase {
|
export default class ChatTransaction extends ChatBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 18
|
this.type = 18;
|
||||||
this.fee = 0
|
this.fee = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipientPublicKey(recipientPublicKey) {
|
set recipientPublicKey(recipientPublicKey) {
|
||||||
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
this._base58RecipientPublicKey =
|
||||||
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
recipientPublicKey instanceof Uint8Array
|
||||||
}
|
? this.constructor.Base58.encode(recipientPublicKey)
|
||||||
|
: recipientPublicKey;
|
||||||
|
this._recipientPublicKey = this.constructor.Base58.decode(
|
||||||
|
this._base58RecipientPublicKey
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set proofOfWorkNonce(proofOfWorkNonce) {
|
set proofOfWorkNonce(proofOfWorkNonce) {
|
||||||
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
this._proofOfWorkNonce =
|
||||||
}
|
this.constructor.utils.int32ToBytes(proofOfWorkNonce);
|
||||||
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this._hasReceipient = new Uint8Array(1)
|
recipient instanceof Uint8Array
|
||||||
this._hasReceipient[0] = 1
|
? recipient
|
||||||
}
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this._hasReceipient = new Uint8Array(1);
|
||||||
|
this._hasReceipient[0] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
set hasChatReference(hasChatReference) {
|
set hasChatReference(hasChatReference) {
|
||||||
this._hasChatReference = new Uint8Array(1)
|
this._hasChatReference = new Uint8Array(1);
|
||||||
this._hasChatReference[0] = hasChatReference
|
this._hasChatReference[0] = hasChatReference;
|
||||||
}
|
}
|
||||||
|
|
||||||
set chatReference(chatReference) {
|
set chatReference(chatReference) {
|
||||||
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
this._chatReference =
|
||||||
}
|
chatReference instanceof Uint8Array
|
||||||
|
? chatReference
|
||||||
|
: this.constructor.Base58.decode(chatReference);
|
||||||
|
}
|
||||||
|
|
||||||
set message(message) {
|
set message(message) {
|
||||||
this.messageText = message;
|
this.messageText = message;
|
||||||
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
this._message = this.constructor.utils.stringtoUTF8Array(message);
|
||||||
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
this._messageLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._message.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set isEncrypted(isEncrypted) {
|
set isEncrypted(isEncrypted) {
|
||||||
this._isEncrypted = new Uint8Array(1)
|
this._isEncrypted = new Uint8Array(1);
|
||||||
this._isEncrypted[0] = isEncrypted
|
this._isEncrypted[0] = isEncrypted;
|
||||||
|
|
||||||
if (isEncrypted === 1) {
|
if (isEncrypted === 1) {
|
||||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
const convertedPrivateKey = ed2curve.convertSecretKey(
|
||||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
this._keyPair.privateKey
|
||||||
const sharedSecret = new Uint8Array(32)
|
);
|
||||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
const convertedPublicKey = ed2curve.convertPublicKey(
|
||||||
|
this._recipientPublicKey
|
||||||
|
);
|
||||||
|
const sharedSecret = new Uint8Array(32);
|
||||||
|
nacl.lowlevel.crypto_scalarmult(
|
||||||
|
sharedSecret,
|
||||||
|
convertedPrivateKey,
|
||||||
|
convertedPublicKey
|
||||||
|
);
|
||||||
|
|
||||||
this._chatEncryptionSeed = new Sha256().process(sharedSecret).finish().result
|
this._chatEncryptionSeed = new Sha256()
|
||||||
this._encryptedMessage = nacl.secretbox(this._message, this._lastReference.slice(0, 24), this._chatEncryptionSeed)
|
.process(sharedSecret)
|
||||||
}
|
.finish().result;
|
||||||
|
this._encryptedMessage = nacl.secretbox(
|
||||||
|
this._message,
|
||||||
|
this._lastReference.slice(0, 24),
|
||||||
|
this._chatEncryptionSeed
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
this._myMessage = isEncrypted === 1 ? this._encryptedMessage : this._message
|
this._myMessage =
|
||||||
this._myMessageLenth = isEncrypted === 1 ? this.constructor.utils.int32ToBytes(this._myMessage.length) : this._messageLength
|
isEncrypted === 1 ? this._encryptedMessage : this._message;
|
||||||
}
|
this._myMessageLenth =
|
||||||
|
isEncrypted === 1
|
||||||
|
? this.constructor.utils.int32ToBytes(this._myMessage.length)
|
||||||
|
: this._messageLength;
|
||||||
|
}
|
||||||
|
|
||||||
set isText(isText) {
|
set isText(isText) {
|
||||||
this._isText = new Uint8Array(1)
|
this._isText = new Uint8Array(1);
|
||||||
this._isText[0] = isText
|
this._isText[0] = isText;
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._proofOfWorkNonce,
|
this._proofOfWorkNonce,
|
||||||
this._hasReceipient,
|
this._hasReceipient,
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._myMessageLenth,
|
this._myMessageLenth,
|
||||||
this._myMessage,
|
this._myMessage,
|
||||||
this._isEncrypted,
|
this._isEncrypted,
|
||||||
this._isText,
|
this._isText,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
|
|
||||||
// After the feature trigger timestamp we need to include chat reference
|
// After the feature trigger timestamp we need to include chat reference
|
||||||
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
if (
|
||||||
params.push(this._hasChatReference)
|
new Date(this._timestamp).getTime() >=
|
||||||
|
CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP
|
||||||
|
) {
|
||||||
|
params.push(this._hasChatReference);
|
||||||
|
|
||||||
if (this._hasChatReference[0] == 1) {
|
if (this._hasChatReference[0] == 1) {
|
||||||
params.push(this._chatReference)
|
params.push(this._chatReference);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,64 +1,73 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class CreateGroupTransaction extends TransactionBase {
|
export default class CreateGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 22
|
this.type = 22;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set rGroupName(rGroupName) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._rGroupName = rGroupName;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
}
|
this._rGroupName
|
||||||
|
);
|
||||||
|
this._rGroupNameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rGroupNameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupName(rGroupName) {
|
set rGroupDesc(rGroupDesc) {
|
||||||
this._rGroupName = rGroupName
|
this._rGroupDesc = rGroupDesc;
|
||||||
this._rGroupNameBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupName)
|
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
this._rGroupNameLength = this.constructor.utils.int32ToBytes(this._rGroupNameBytes.length)
|
this._rGroupDesc
|
||||||
}
|
);
|
||||||
|
this._rGroupDescLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rGroupDescBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupDesc(rGroupDesc) {
|
set rGroupType(rGroupType) {
|
||||||
this._rGroupDesc = rGroupDesc
|
this._rGroupType = new Uint8Array(1);
|
||||||
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(this._rGroupDesc)
|
this._rGroupType[0] = rGroupType;
|
||||||
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
}
|
||||||
}
|
|
||||||
|
|
||||||
set rGroupType(rGroupType) {
|
set rGroupApprovalThreshold(rGroupApprovalThreshold) {
|
||||||
this._rGroupType = new Uint8Array(1)
|
this._rGroupApprovalThreshold = new Uint8Array(1);
|
||||||
this._rGroupType[0] = rGroupType
|
this._rGroupApprovalThreshold[0] = rGroupApprovalThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupApprovalThreshold(rGroupApprovalThreshold) {
|
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
|
||||||
this._rGroupApprovalThreshold = new Uint8Array(1)
|
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(
|
||||||
this._rGroupApprovalThreshold[0] = rGroupApprovalThreshold
|
rGroupMinimumBlockDelay
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupMinimumBlockDelay(rGroupMinimumBlockDelay) {
|
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
|
||||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(rGroupMinimumBlockDelay)
|
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(
|
||||||
}
|
rGroupMaximumBlockDelay
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupMaximumBlockDelay(rGroupMaximumBlockDelay) {
|
get params() {
|
||||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(rGroupMaximumBlockDelay)
|
const params = super.params;
|
||||||
}
|
params.push(
|
||||||
|
this._rGroupNameLength,
|
||||||
get params() {
|
this._rGroupNameBytes,
|
||||||
const params = super.params
|
this._rGroupDescLength,
|
||||||
params.push(
|
this._rGroupDescBytes,
|
||||||
this._rGroupNameLength,
|
this._rGroupType,
|
||||||
this._rGroupNameBytes,
|
this._rGroupApprovalThreshold,
|
||||||
this._rGroupDescLength,
|
this._rGroupMinimumBlockDelayBytes,
|
||||||
this._rGroupDescBytes,
|
this._rGroupMaximumBlockDelayBytes,
|
||||||
this._rGroupType,
|
this._feeBytes
|
||||||
this._rGroupApprovalThreshold,
|
);
|
||||||
this._rGroupMinimumBlockDelayBytes,
|
return params;
|
||||||
this._rGroupMaximumBlockDelayBytes,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,73 +1,84 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { QORT_DECIMALS } from '../constants/constants'
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from './TransactionBase'
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class CreatePollTransaction extends TransactionBase {
|
export default class CreatePollTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 8
|
this.type = 8;
|
||||||
this._options = []
|
this._options = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
addOption(option) {
|
addOption(option) {
|
||||||
const optionBytes = this.constructor.utils.stringtoUTF8Array(option)
|
const optionBytes = this.constructor.utils.stringtoUTF8Array(option);
|
||||||
const optionLength = this.constructor.utils.int32ToBytes(optionBytes.length)
|
const optionLength = this.constructor.utils.int32ToBytes(
|
||||||
this._options.push({ length: optionLength, bytes: optionBytes })
|
optionBytes.length
|
||||||
}
|
);
|
||||||
|
this._options.push({ length: optionLength, bytes: optionBytes });
|
||||||
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set ownerAddress(ownerAddress) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._ownerAddress =
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
ownerAddress instanceof Uint8Array
|
||||||
}
|
? ownerAddress
|
||||||
|
: this.constructor.Base58.decode(ownerAddress);
|
||||||
|
}
|
||||||
|
|
||||||
set ownerAddress(ownerAddress) {
|
set rPollName(rPollName) {
|
||||||
this._ownerAddress = ownerAddress instanceof Uint8Array ? ownerAddress : this.constructor.Base58.decode(ownerAddress)
|
this._rPollName = rPollName;
|
||||||
}
|
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
|
this._rPollName
|
||||||
|
);
|
||||||
|
this._rPollNameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rPollNameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rPollName(rPollName) {
|
set rPollDesc(rPollDesc) {
|
||||||
this._rPollName = rPollName
|
this._rPollDesc = rPollDesc;
|
||||||
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(this._rPollName)
|
this._rPollDescBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length)
|
this._rPollDesc
|
||||||
|
);
|
||||||
|
this._rPollDescLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rPollDescBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
set rOptions(rOptions) {
|
||||||
|
const optionsArray = rOptions[0].split(', ').map((opt) => opt.trim());
|
||||||
|
this._pollOptions = optionsArray;
|
||||||
|
|
||||||
set rPollDesc(rPollDesc) {
|
for (let i = 0; i < optionsArray.length; i++) {
|
||||||
this._rPollDesc = rPollDesc
|
this.addOption(optionsArray[i]);
|
||||||
this._rPollDescBytes = this.constructor.utils.stringtoUTF8Array(this._rPollDesc)
|
}
|
||||||
this._rPollDescLength = this.constructor.utils.int32ToBytes(this._rPollDescBytes.length)
|
|
||||||
}
|
|
||||||
|
|
||||||
set rOptions(rOptions) {
|
this._rNumberOfOptionsBytes = this.constructor.utils.int32ToBytes(
|
||||||
const optionsArray = rOptions[0].split(', ').map(opt => opt.trim())
|
optionsArray.length
|
||||||
this._pollOptions = optionsArray
|
);
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < optionsArray.length; i++) {
|
get params() {
|
||||||
this.addOption(optionsArray[i])
|
const params = super.params;
|
||||||
}
|
params.push(
|
||||||
|
this._ownerAddress,
|
||||||
|
this._rPollNameLength,
|
||||||
|
this._rPollNameBytes,
|
||||||
|
this._rPollDescLength,
|
||||||
|
this._rPollDescBytes,
|
||||||
|
this._rNumberOfOptionsBytes
|
||||||
|
);
|
||||||
|
|
||||||
this._rNumberOfOptionsBytes = this.constructor.utils.int32ToBytes(optionsArray.length)
|
// Push the dynamic options
|
||||||
}
|
for (let i = 0; i < this._options.length; i++) {
|
||||||
|
params.push(this._options[i].length, this._options[i].bytes);
|
||||||
|
}
|
||||||
|
|
||||||
|
params.push(this._feeBytes);
|
||||||
|
|
||||||
get params() {
|
return params;
|
||||||
const params = super.params
|
}
|
||||||
params.push(
|
|
||||||
this._ownerAddress,
|
|
||||||
this._rPollNameLength,
|
|
||||||
this._rPollNameBytes,
|
|
||||||
this._rPollDescLength,
|
|
||||||
this._rPollDescBytes,
|
|
||||||
this._rNumberOfOptionsBytes
|
|
||||||
)
|
|
||||||
|
|
||||||
// Push the dynamic options
|
|
||||||
for (let i = 0; i < this._options.length; i++) {
|
|
||||||
params.push(this._options[i].length, this._options[i].bytes)
|
|
||||||
}
|
|
||||||
|
|
||||||
params.push(this._feeBytes)
|
|
||||||
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,78 +1,90 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import TransactionBase from './TransactionBase';
|
||||||
import TransactionBase from './TransactionBase'
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import { QORT_DECIMALS } from '../constants/constants'
|
|
||||||
|
|
||||||
export default class DeployAtTransaction extends TransactionBase {
|
export default class DeployAtTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 16
|
this.type = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
|
set rAmount(rAmount) {
|
||||||
|
this._rAmount = Math.round(rAmount * QORT_DECIMALS);
|
||||||
|
this._rAmountBytes = this.constructor.utils.int64ToBytes(this._rAmount);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set rName(rName) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._rName = rName;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._rNameBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
}
|
this._rName.toLocaleLowerCase()
|
||||||
|
);
|
||||||
|
this._rNameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rNameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rAmount(rAmount) {
|
set rDescription(rDescription) {
|
||||||
this._rAmount = Math.round(rAmount * QORT_DECIMALS)
|
this._rDescription = rDescription;
|
||||||
this._rAmountBytes = this.constructor.utils.int64ToBytes(this._rAmount)
|
this._rDescriptionBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
}
|
this._rDescription.toLocaleLowerCase()
|
||||||
|
);
|
||||||
|
this._rDescriptionLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rDescriptionBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rName(rName) {
|
set atType(atType) {
|
||||||
this._rName = rName
|
this._atType = atType;
|
||||||
this._rNameBytes = this.constructor.utils.stringtoUTF8Array(this._rName.toLocaleLowerCase())
|
this._atTypeBytes = this.constructor.utils.stringtoUTF8Array(this._atType);
|
||||||
this._rNameLength = this.constructor.utils.int32ToBytes(this._rNameBytes.length)
|
this._atTypeLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._atTypeBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rDescription(rDescription) {
|
set rTags(rTags) {
|
||||||
this._rDescription = rDescription
|
this._rTags = rTags;
|
||||||
this._rDescriptionBytes = this.constructor.utils.stringtoUTF8Array(this._rDescription.toLocaleLowerCase())
|
this._rTagsBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
this._rDescriptionLength = this.constructor.utils.int32ToBytes(this._rDescriptionBytes.length)
|
this._rTags.toLocaleLowerCase()
|
||||||
}
|
);
|
||||||
|
this._rTagsLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rTagsBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set atType(atType) {
|
set rCreationBytes(rCreationBytes) {
|
||||||
this._atType = atType
|
const decode = this.constructor.Base58.decode(rCreationBytes);
|
||||||
this._atTypeBytes = this.constructor.utils.stringtoUTF8Array(this._atType)
|
this._rCreationBytes = this.constructor.utils.stringtoUTF8Array(decode);
|
||||||
this._atTypeLength = this.constructor.utils.int32ToBytes(this._atTypeBytes.length)
|
this._rCreationBytesLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._rCreationBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rTags(rTags) {
|
set rAssetId(rAssetId) {
|
||||||
this._rTags = rTags
|
this._rAssetId = this.constructor.utils.int64ToBytes(rAssetId);
|
||||||
this._rTagsBytes = this.constructor.utils.stringtoUTF8Array(this._rTags.toLocaleLowerCase())
|
}
|
||||||
this._rTagsLength = this.constructor.utils.int32ToBytes(this._rTagsBytes.length)
|
|
||||||
}
|
|
||||||
|
|
||||||
set rCreationBytes(rCreationBytes) {
|
get params() {
|
||||||
const decode = this.constructor.Base58.decode(rCreationBytes)
|
const params = super.params;
|
||||||
this._rCreationBytes = this.constructor.utils.stringtoUTF8Array(decode)
|
params.push(
|
||||||
this._rCreationBytesLength = this.constructor.utils.int32ToBytes(this._rCreationBytes.length)
|
this._rNameLength,
|
||||||
}
|
this._rNameBytes,
|
||||||
|
this._rDescriptionLength,
|
||||||
set rAssetId(rAssetId) {
|
this._rDescriptionBytes,
|
||||||
this._rAssetId = this.constructor.utils.int64ToBytes(rAssetId)
|
this._atTypeLength,
|
||||||
}
|
this._atTypeBytes,
|
||||||
|
this._rTagsLength,
|
||||||
get params() {
|
this._rTagsBytes,
|
||||||
const params = super.params
|
this._rCreationBytesLength,
|
||||||
params.push(
|
this._rCreationBytes,
|
||||||
this._rNameLength,
|
this._rAmountBytes,
|
||||||
this._rNameBytes,
|
this._rAssetId,
|
||||||
this._rDescriptionLength,
|
this._feeBytes
|
||||||
this._rDescriptionBytes,
|
);
|
||||||
this._atTypeLength,
|
return params;
|
||||||
this._atTypeBytes,
|
}
|
||||||
this._rTagsLength,
|
|
||||||
this._rTagsBytes,
|
|
||||||
this._rCreationBytesLength,
|
|
||||||
this._rCreationBytes,
|
|
||||||
this._rAmountBytes,
|
|
||||||
this._rAssetId,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,50 +1,56 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class GroupBanTransaction extends TransactionBase {
|
export default class GroupBanTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 26
|
this.type = 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set rBanReason(rBanReason) {
|
set rBanReason(rBanReason) {
|
||||||
this._rBanReason = rBanReason
|
this._rBanReason = rBanReason;
|
||||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason)
|
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
|
this._rBanReason
|
||||||
}
|
);
|
||||||
|
this._rBanReasonLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rBanReasonBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rBanTime(rBanTime) {
|
set rBanTime(rBanTime) {
|
||||||
this._rBanTime = rBanTime
|
this._rBanTime = rBanTime;
|
||||||
this._rBanTimeBytes = this.constructor.utils.int32ToBytes(this._rBanTime)
|
this._rBanTimeBytes = this.constructor.utils.int32ToBytes(this._rBanTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupIdBytes,
|
this._rGroupIdBytes,
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._rBanReasonLength,
|
this._rBanReasonLength,
|
||||||
this._rBanReasonBytes,
|
this._rBanReasonBytes,
|
||||||
this._rBanTimeBytes,
|
this._rBanTimeBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,72 +1,79 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import ChatBase from './ChatBase';
|
||||||
import ChatBase from './ChatBase'
|
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../constants/constants';
|
||||||
import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../constants/constants'
|
|
||||||
|
|
||||||
export default class GroupChatTransaction extends ChatBase {
|
export default class GroupChatTransaction extends ChatBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.type = 18
|
this.type = 18;
|
||||||
this.fee = 0
|
this.fee = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
set proofOfWorkNonce(proofOfWorkNonce) {
|
set proofOfWorkNonce(proofOfWorkNonce) {
|
||||||
this._proofOfWorkNonce = this.constructor.utils.int32ToBytes(proofOfWorkNonce)
|
this._proofOfWorkNonce =
|
||||||
}
|
this.constructor.utils.int32ToBytes(proofOfWorkNonce);
|
||||||
|
}
|
||||||
|
|
||||||
set hasReceipient(hasReceipient) {
|
set hasReceipient(hasReceipient) {
|
||||||
this._hasReceipient = new Uint8Array(1)
|
this._hasReceipient = new Uint8Array(1);
|
||||||
this._hasReceipient[0] = hasReceipient
|
this._hasReceipient[0] = hasReceipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
set message(message) {
|
set message(message) {
|
||||||
this.messageText = message
|
this.messageText = message;
|
||||||
|
|
||||||
this._message = this.constructor.utils.stringtoUTF8Array(message)
|
|
||||||
this._messageLength = this.constructor.utils.int32ToBytes(this._message.length)
|
|
||||||
}
|
|
||||||
|
|
||||||
set hasChatReference(hasChatReference) {
|
this._message = this.constructor.utils.stringtoUTF8Array(message);
|
||||||
this._hasChatReference = new Uint8Array(1)
|
this._messageLength = this.constructor.utils.int32ToBytes(
|
||||||
this._hasChatReference[0] = hasChatReference
|
this._message.length
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set chatReference(chatReference) {
|
set hasChatReference(hasChatReference) {
|
||||||
this._chatReference = chatReference instanceof Uint8Array ? chatReference : this.constructor.Base58.decode(chatReference)
|
this._hasChatReference = new Uint8Array(1);
|
||||||
}
|
this._hasChatReference[0] = hasChatReference;
|
||||||
|
}
|
||||||
|
|
||||||
set isEncrypted(isEncrypted) {
|
set chatReference(chatReference) {
|
||||||
this._isEncrypted = new Uint8Array(1)
|
this._chatReference =
|
||||||
this._isEncrypted[0] = isEncrypted
|
chatReference instanceof Uint8Array
|
||||||
}
|
? chatReference
|
||||||
|
: this.constructor.Base58.decode(chatReference);
|
||||||
|
}
|
||||||
|
|
||||||
set isText(isText) {
|
set isEncrypted(isEncrypted) {
|
||||||
this._isText = new Uint8Array(1)
|
this._isEncrypted = new Uint8Array(1);
|
||||||
this._isText[0] = isText
|
this._isEncrypted[0] = isEncrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
set isText(isText) {
|
||||||
const params = super.params
|
this._isText = new Uint8Array(1);
|
||||||
params.push(
|
this._isText[0] = isText;
|
||||||
this._proofOfWorkNonce,
|
}
|
||||||
this._hasReceipient,
|
|
||||||
this._messageLength,
|
|
||||||
this._message,
|
|
||||||
this._isEncrypted,
|
|
||||||
this._isText,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
|
|
||||||
// After the feature trigger timestamp we need to include chat reference
|
get params() {
|
||||||
if (new Date(this._timestamp).getTime() >= CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP) {
|
const params = super.params;
|
||||||
params.push(this._hasChatReference)
|
params.push(
|
||||||
|
this._proofOfWorkNonce,
|
||||||
|
this._hasReceipient,
|
||||||
|
this._messageLength,
|
||||||
|
this._message,
|
||||||
|
this._isEncrypted,
|
||||||
|
this._isText,
|
||||||
|
this._feeBytes
|
||||||
|
);
|
||||||
|
|
||||||
if (this._hasChatReference[0] == 1) {
|
// After the feature trigger timestamp we need to include chat reference
|
||||||
params.push(this._chatReference)
|
if (
|
||||||
}
|
new Date(this._timestamp).getTime() >=
|
||||||
}
|
CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP
|
||||||
|
) {
|
||||||
|
params.push(this._hasChatReference);
|
||||||
|
|
||||||
return params
|
if (this._hasChatReference[0] == 1) {
|
||||||
}
|
params.push(this._chatReference);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,46 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class GroupInviteTransaction extends TransactionBase {
|
export default class GroupInviteTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 29
|
this.type = 29;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set rInviteTime(rInviteTime) {
|
set rInviteTime(rInviteTime) {
|
||||||
this._rInviteTime = rInviteTime
|
this._rInviteTime = rInviteTime;
|
||||||
this._rInviteTimeBytes = this.constructor.utils.int32ToBytes(this._rInviteTime)
|
this._rInviteTimeBytes = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._rInviteTime
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupIdBytes,
|
this._rGroupIdBytes,
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._rInviteTimeBytes,
|
this._rInviteTimeBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,50 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import TransactionBase from './TransactionBase';
|
||||||
import TransactionBase from "./TransactionBase"
|
|
||||||
|
|
||||||
|
|
||||||
export default class GroupKickTransaction extends TransactionBase {
|
export default class GroupKickTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 28
|
this.type = 28;
|
||||||
}
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set rGroupId(rGroupId) {
|
||||||
this._rGroupId = rGroupId
|
this._rGroupId = rGroupId;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set rBanReason(rBanReason) {
|
set rBanReason(rBanReason) {
|
||||||
this._rBanReason = rBanReason
|
this._rBanReason = rBanReason;
|
||||||
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(this._rBanReason)
|
this._rBanReasonBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
this._rBanReasonLength = this.constructor.utils.int32ToBytes(this._rBanReasonBytes.length)
|
this._rBanReason
|
||||||
}
|
);
|
||||||
|
this._rBanReasonLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rBanReasonBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
this.theRecipient = recipient
|
recipient instanceof Uint8Array
|
||||||
}
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._rGroupIdBytes,
|
this._rGroupIdBytes,
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._rBanReasonLength,
|
this._rBanReasonLength,
|
||||||
this._rBanReasonBytes,
|
this._rBanReasonBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,33 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class JoinGroupTransaction extends TransactionBase {
|
export default class JoinGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 31
|
this.type = 31;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
|
set registrantAddress(registrantAddress) {
|
||||||
|
this._registrantAddress =
|
||||||
|
registrantAddress instanceof Uint8Array
|
||||||
|
? registrantAddress
|
||||||
|
: this.constructor.Base58.decode(registrantAddress);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set rGroupId(rGroupId) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._rGroupId = rGroupId;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
set registrantAddress(registrantAddress) {
|
get params() {
|
||||||
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress)
|
const params = super.params;
|
||||||
}
|
params.push(this._rGroupIdBytes, this._feeBytes);
|
||||||
|
return params;
|
||||||
set rGroupId(rGroupId) {
|
}
|
||||||
this._rGroupId = rGroupId
|
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
get params() {
|
|
||||||
const params = super.params
|
|
||||||
params.push(
|
|
||||||
this._rGroupIdBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,34 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class LeaveGroupTransaction extends TransactionBase {
|
export default class LeaveGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 32
|
this.type = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
|
||||||
this._fee = fee * QORT_DECIMALS
|
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
|
||||||
}
|
|
||||||
|
|
||||||
set registrantAddress(registrantAddress) {
|
set fee(fee) {
|
||||||
this._registrantAddress = registrantAddress instanceof Uint8Array ? registrantAddress : this.constructor.Base58.decode(registrantAddress)
|
this._fee = fee * QORT_DECIMALS;
|
||||||
}
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set registrantAddress(registrantAddress) {
|
||||||
this._rGroupId = rGroupId
|
this._registrantAddress =
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
registrantAddress instanceof Uint8Array
|
||||||
}
|
? registrantAddress
|
||||||
|
: this.constructor.Base58.decode(registrantAddress);
|
||||||
|
}
|
||||||
|
|
||||||
get params() {
|
set rGroupId(rGroupId) {
|
||||||
const params = super.params
|
this._rGroupId = rGroupId;
|
||||||
params.push(
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
this._rGroupIdBytes,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
get params() {
|
||||||
return params
|
const params = super.params;
|
||||||
}
|
params.push(this._rGroupIdBytes, this._feeBytes);
|
||||||
|
return params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,36 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from '../constants/constants'
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from './TransactionBase'
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class PaymentTransaction extends TransactionBase {
|
export default class PaymentTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 2
|
this.type = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
}
|
recipient instanceof Uint8Array
|
||||||
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
}
|
||||||
|
|
||||||
set dialogto(dialogto) {
|
set dialogto(dialogto) {
|
||||||
this._dialogto = dialogto
|
this._dialogto = dialogto;
|
||||||
}
|
}
|
||||||
|
|
||||||
set dialogamount(dialogamount) {
|
set dialogamount(dialogamount) {
|
||||||
this._dialogamount = dialogamount
|
this._dialogamount = dialogamount;
|
||||||
}
|
}
|
||||||
|
|
||||||
set amount(amount) {
|
set amount(amount) {
|
||||||
this._amount = Math.round(amount * QORT_DECIMALS)
|
this._amount = Math.round(amount * QORT_DECIMALS);
|
||||||
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount)
|
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(this._recipient, this._amountBytes, this._feeBytes);
|
||||||
this._recipient,
|
return params;
|
||||||
this._amountBytes,
|
}
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,44 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class RegisterNameTransaction extends TransactionBase {
|
export default class RegisterNameTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 3
|
this.type = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set name(name) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this.nameText = name;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name);
|
||||||
}
|
this._nameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._nameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set name(name) {
|
set value(value) {
|
||||||
this.nameText = name
|
this.valueText =
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
value.length === 0 ? 'Registered Name on the Qortal Chain' : value;
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._valueBytes = this.constructor.utils.stringtoUTF8Array(this.valueText);
|
||||||
}
|
this._valueLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._valueBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set value(value) {
|
get params() {
|
||||||
this.valueText = value.length === 0 ? "Registered Name on the Qortal Chain" : value
|
const params = super.params;
|
||||||
this._valueBytes = this.constructor.utils.stringtoUTF8Array(this.valueText)
|
params.push(
|
||||||
this._valueLength = this.constructor.utils.int32ToBytes(this._valueBytes.length)
|
this._nameLength,
|
||||||
}
|
this._nameBytes,
|
||||||
|
this._valueLength,
|
||||||
get params() {
|
this._valueBytes,
|
||||||
const params = super.params
|
this._feeBytes
|
||||||
params.push(
|
);
|
||||||
this._nameLength,
|
return params;
|
||||||
this._nameBytes,
|
}
|
||||||
this._valueLength,
|
|
||||||
this._valueBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,34 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class RemoveGroupAdminTransaction extends TransactionBase {
|
export default class RemoveGroupAdminTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 25
|
this.type = 25;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set rGroupId(rGroupId) {
|
||||||
|
this._rGroupId = rGroupId;
|
||||||
|
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
set recipient(recipient) {
|
||||||
|
this._recipient =
|
||||||
|
recipient instanceof Uint8Array
|
||||||
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
this.theRecipient = recipient;
|
||||||
|
}
|
||||||
|
|
||||||
set rGroupId(rGroupId) {
|
set fee(fee) {
|
||||||
this._rGroupId = rGroupId
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._rGroupIdBytes = this.constructor.utils.int32ToBytes(this._rGroupId)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
get params() {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
const params = super.params;
|
||||||
this.theRecipient = recipient
|
params.push(this._rGroupIdBytes, this._recipient, this._feeBytes);
|
||||||
}
|
return params;
|
||||||
|
}
|
||||||
set fee(fee) {
|
|
||||||
this._fee = fee * QORT_DECIMALS
|
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
|
||||||
}
|
|
||||||
|
|
||||||
get params() {
|
|
||||||
const params = super.params
|
|
||||||
params.push(
|
|
||||||
this._rGroupIdBytes,
|
|
||||||
this._recipient,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,46 +1,50 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { DYNAMIC_FEE_TIMESTAMP } from "../constants/constants"
|
import { DYNAMIC_FEE_TIMESTAMP } from '../constants/constants';
|
||||||
import Base58 from "../deps/Base58"
|
import Base58 from '../deps/Base58';
|
||||||
import publicKeyToAddress from "../utils/generateWallet/publicKeyToAddress"
|
import publicKeyToAddress from '../utils/generateWallet/publicKeyToAddress';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class RemoveRewardShareTransaction extends TransactionBase {
|
export default class RemoveRewardShareTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 38
|
this.type = 38;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set rewardShareKeyPairPublicKey(rewardShareKeyPairPublicKey) {
|
||||||
|
this._rewardShareKeyPairPublicKey = Base58.decode(
|
||||||
|
rewardShareKeyPairPublicKey
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rewardShareKeyPairPublicKey(rewardShareKeyPairPublicKey) {
|
set recipient(recipient) {
|
||||||
this._rewardShareKeyPairPublicKey = Base58.decode(rewardShareKeyPairPublicKey)
|
const _address = publicKeyToAddress(this._keyPair.publicKey);
|
||||||
}
|
this._recipient =
|
||||||
|
recipient instanceof Uint8Array
|
||||||
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
|
||||||
set recipient(recipient) {
|
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
||||||
const _address = publicKeyToAddress(this._keyPair.publicKey)
|
this.fee = _address === recipient ? 0 : 0.01;
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
} else {
|
||||||
|
this.fee = _address === recipient ? 0 : 0.001;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
set percentageShare(share) {
|
||||||
this.fee = _address === recipient ? 0 : 0.01
|
this._percentageShare = share * 100;
|
||||||
} else {
|
this._percentageShareBytes = this.constructor.utils.int64ToBytes(
|
||||||
this.fee = _address === recipient ? 0 : 0.001
|
this._percentageShare
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
set percentageShare(share) {
|
get params() {
|
||||||
this._percentageShare = share * 100
|
const params = super.params;
|
||||||
this._percentageShareBytes = this.constructor.utils.int64ToBytes(this._percentageShare)
|
params.push(
|
||||||
}
|
this._recipient,
|
||||||
|
this._rewardShareKeyPairPublicKey,
|
||||||
get params() {
|
this._percentageShareBytes,
|
||||||
const params = super.params
|
this._feeBytes
|
||||||
params.push(
|
);
|
||||||
this._recipient,
|
return params;
|
||||||
this._rewardShareKeyPairPublicKey,
|
}
|
||||||
this._percentageShareBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,60 +1,86 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import TransactionBase from './TransactionBase'
|
import TransactionBase from './TransactionBase';
|
||||||
|
import { Sha256 } from 'asmcrypto.js';
|
||||||
import { Sha256 } from 'asmcrypto.js'
|
import nacl from '../deps/nacl-fast';
|
||||||
import nacl from '../deps/nacl-fast'
|
import ed2curve from '../deps/ed2curve';
|
||||||
import ed2curve from '../deps/ed2curve'
|
import { DYNAMIC_FEE_TIMESTAMP } from '../constants/constants';
|
||||||
import { DYNAMIC_FEE_TIMESTAMP } from '../constants/constants'
|
import publicKeyToAddress from '../utils/generateWallet/publicKeyToAddress';
|
||||||
import publicKeyToAddress from '../utils/generateWallet/publicKeyToAddress'
|
|
||||||
|
|
||||||
export default class RewardShareTransaction extends TransactionBase {
|
export default class RewardShareTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 38
|
this.type = 38;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set recipientPublicKey(recipientPublicKey) {
|
||||||
|
this._base58RecipientPublicKey =
|
||||||
|
recipientPublicKey instanceof Uint8Array
|
||||||
|
? this.constructor.Base58.encode(recipientPublicKey)
|
||||||
|
: recipientPublicKey;
|
||||||
|
this._recipientPublicKey = this.constructor.Base58.decode(
|
||||||
|
this._base58RecipientPublicKey
|
||||||
|
);
|
||||||
|
this.recipient = publicKeyToAddress(this._recipientPublicKey);
|
||||||
|
|
||||||
|
const convertedPrivateKey = ed2curve.convertSecretKey(
|
||||||
|
this._keyPair.privateKey
|
||||||
|
);
|
||||||
|
const convertedPublicKey = ed2curve.convertPublicKey(
|
||||||
|
this._recipientPublicKey
|
||||||
|
);
|
||||||
|
const sharedSecret = new Uint8Array(32);
|
||||||
|
|
||||||
set recipientPublicKey(recipientPublicKey) {
|
nacl.lowlevel.crypto_scalarmult(
|
||||||
this._base58RecipientPublicKey = recipientPublicKey instanceof Uint8Array ? this.constructor.Base58.encode(recipientPublicKey) : recipientPublicKey
|
sharedSecret,
|
||||||
this._recipientPublicKey = this.constructor.Base58.decode(this._base58RecipientPublicKey)
|
convertedPrivateKey,
|
||||||
this.recipient = publicKeyToAddress(this._recipientPublicKey)
|
convertedPublicKey
|
||||||
|
);
|
||||||
|
|
||||||
const convertedPrivateKey = ed2curve.convertSecretKey(this._keyPair.privateKey)
|
this._rewardShareSeed = new Sha256().process(sharedSecret).finish().result;
|
||||||
const convertedPublicKey = ed2curve.convertPublicKey(this._recipientPublicKey)
|
this._base58RewardShareSeed = this.constructor.Base58.encode(
|
||||||
const sharedSecret = new Uint8Array(32)
|
this._rewardShareSeed
|
||||||
|
);
|
||||||
|
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(
|
||||||
|
this._rewardShareSeed
|
||||||
|
);
|
||||||
|
|
||||||
nacl.lowlevel.crypto_scalarmult(sharedSecret, convertedPrivateKey, convertedPublicKey)
|
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
||||||
|
this.fee =
|
||||||
|
recipientPublicKey ===
|
||||||
|
this.constructor.Base58.encode(this._keyPair.publicKey)
|
||||||
|
? 0
|
||||||
|
: 0.01;
|
||||||
|
} else {
|
||||||
|
this.fee =
|
||||||
|
recipientPublicKey ===
|
||||||
|
this.constructor.Base58.encode(this._keyPair.publicKey)
|
||||||
|
? 0
|
||||||
|
: 0.001;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this._rewardShareSeed = new Sha256().process(sharedSecret).finish().result
|
set recipient(recipient) {
|
||||||
this._base58RewardShareSeed = this.constructor.Base58.encode(this._rewardShareSeed)
|
this._recipient =
|
||||||
this._rewardShareKeyPair = nacl.sign.keyPair.fromSeed(this._rewardShareSeed)
|
recipient instanceof Uint8Array
|
||||||
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
|
}
|
||||||
|
|
||||||
if (new Date(this._timestamp).getTime() >= DYNAMIC_FEE_TIMESTAMP) {
|
set percentageShare(share) {
|
||||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.01)
|
this._percentageShare = share * 100;
|
||||||
} else {
|
this._percentageShareBytes = this.constructor.utils.int64ToBytes(
|
||||||
this.fee = (recipientPublicKey === this.constructor.Base58.encode(this._keyPair.publicKey) ? 0 : 0.001)
|
this._percentageShare
|
||||||
}
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
get params() {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
const params = super.params;
|
||||||
}
|
params.push(
|
||||||
|
this._recipient,
|
||||||
set percentageShare(share) {
|
this._rewardShareKeyPair.publicKey,
|
||||||
this._percentageShare = share * 100
|
this._percentageShareBytes,
|
||||||
this._percentageShareBytes = this.constructor.utils.int64ToBytes(this._percentageShare)
|
this._feeBytes
|
||||||
}
|
);
|
||||||
|
return params;
|
||||||
get params() {
|
}
|
||||||
const params = super.params
|
|
||||||
params.push(
|
|
||||||
this._recipient,
|
|
||||||
this._rewardShareKeyPair.publicKey,
|
|
||||||
this._percentageShareBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class SellNameTransacion extends TransactionBase {
|
export default class SellNameTransacion extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 5
|
this.type = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set name(name) {
|
set name(name) {
|
||||||
this.nameText = name
|
this.nameText = name;
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name);
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._nameLength = this.constructor.utils.int32ToBytes(
|
||||||
}
|
this._nameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set sellPrice(sellPrice) {
|
set sellPrice(sellPrice) {
|
||||||
this.showSellPrice = sellPrice
|
this.showSellPrice = sellPrice;
|
||||||
this._sellPrice = sellPrice * QORT_DECIMALS
|
this._sellPrice = sellPrice * QORT_DECIMALS;
|
||||||
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice)
|
this._sellPriceBytes = this.constructor.utils.int64ToBytes(this._sellPrice);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._nameLength,
|
this._nameLength,
|
||||||
this._nameBytes,
|
this._nameBytes,
|
||||||
this._sellPriceBytes,
|
this._sellPriceBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,64 +2,64 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CrossChain - TradeBot Create Request (Sell Action)
|
* CrossChain - TradeBot Create Request (Sell Action)
|
||||||
*
|
*
|
||||||
* These are special types of transactions (JSON ENCODED)
|
* These are special types of transactions (JSON ENCODED)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class TradeBotCreateRequest {
|
export default class TradeBotCreateRequest {
|
||||||
constructor() {
|
constructor() {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
this.creatorPublicKey(txnReq.creatorPublicKey)
|
this.creatorPublicKey(txnReq.creatorPublicKey);
|
||||||
this.qortAmount(txnReq.qortAmount)
|
this.qortAmount(txnReq.qortAmount);
|
||||||
this.fundingQortAmount(txnReq.fundingQortAmount)
|
this.fundingQortAmount(txnReq.fundingQortAmount);
|
||||||
this.foreignBlockchain(txnReq.foreignBlockchain)
|
this.foreignBlockchain(txnReq.foreignBlockchain);
|
||||||
this.foreignAmount(txnReq.foreignAmount)
|
this.foreignAmount(txnReq.foreignAmount);
|
||||||
this.tradeTimeout(txnReq.tradeTimeout)
|
this.tradeTimeout(txnReq.tradeTimeout);
|
||||||
this.receivingAddress(txnReq.receivingAddress)
|
this.receivingAddress(txnReq.receivingAddress);
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
creatorPublicKey(creatorPublicKey) {
|
creatorPublicKey(creatorPublicKey) {
|
||||||
this._creatorPublicKey = creatorPublicKey
|
this._creatorPublicKey = creatorPublicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
qortAmount(qortAmount) {
|
qortAmount(qortAmount) {
|
||||||
this._qortAmount = qortAmount
|
this._qortAmount = qortAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
fundingQortAmount(fundingQortAmount) {
|
fundingQortAmount(fundingQortAmount) {
|
||||||
this._fundingQortAmount = fundingQortAmount
|
this._fundingQortAmount = fundingQortAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignBlockchain(foreignBlockchain) {
|
foreignBlockchain(foreignBlockchain) {
|
||||||
this._foreignBlockchain = foreignBlockchain
|
this._foreignBlockchain = foreignBlockchain;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignAmount(foreignAmount) {
|
foreignAmount(foreignAmount) {
|
||||||
this._foreignAmount = foreignAmount
|
this._foreignAmount = foreignAmount;
|
||||||
}
|
}
|
||||||
|
|
||||||
tradeTimeout(tradeTimeout) {
|
tradeTimeout(tradeTimeout) {
|
||||||
this._tradeTimeout = tradeTimeout
|
this._tradeTimeout = tradeTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
receivingAddress(receivingAddress) {
|
receivingAddress(receivingAddress) {
|
||||||
this._receivingAddress = receivingAddress
|
this._receivingAddress = receivingAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
return {
|
return {
|
||||||
creatorPublicKey: this._creatorPublicKey,
|
creatorPublicKey: this._creatorPublicKey,
|
||||||
qortAmount: this._qortAmount,
|
qortAmount: this._qortAmount,
|
||||||
fundingQortAmount: this._fundingQortAmount,
|
fundingQortAmount: this._fundingQortAmount,
|
||||||
foreignBlockchain: this._foreignBlockchain,
|
foreignBlockchain: this._foreignBlockchain,
|
||||||
foreignAmount: this._foreignAmount,
|
foreignAmount: this._foreignAmount,
|
||||||
tradeTimeout: this._tradeTimeout,
|
tradeTimeout: this._tradeTimeout,
|
||||||
receivingAddress: this._receivingAddress
|
receivingAddress: this._receivingAddress,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,35 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CrossChain - DELETE TradeOffer
|
* CrossChain - DELETE TradeOffer
|
||||||
*
|
*
|
||||||
* These are special types of transactions (JSON ENCODED)
|
* These are special types of transactions (JSON ENCODED)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class DeleteTradeOffer {
|
export default class DeleteTradeOffer {
|
||||||
constructor() {
|
constructor() {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
this.creatorPublicKey(txnReq.creatorPublicKey)
|
this.creatorPublicKey(txnReq.creatorPublicKey);
|
||||||
this.atAddress(txnReq.atAddress)
|
this.atAddress(txnReq.atAddress);
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
creatorPublicKey(creatorPublicKey) {
|
creatorPublicKey(creatorPublicKey) {
|
||||||
this._creatorPublicKey = creatorPublicKey
|
this._creatorPublicKey = creatorPublicKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
atAddress(atAddress) {
|
atAddress(atAddress) {
|
||||||
this._atAddress = atAddress
|
this._atAddress = atAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
return {
|
return {
|
||||||
creatorPublicKey: this._creatorPublicKey,
|
creatorPublicKey: this._creatorPublicKey,
|
||||||
atAddress: this._atAddress
|
atAddress: this._atAddress,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,36 +7,35 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
export class TradeBotRespondMultipleRequest {
|
export class TradeBotRespondMultipleRequest {
|
||||||
constructor() {
|
constructor() {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
this.addresses(txnReq.addresses)
|
this.addresses(txnReq.addresses);
|
||||||
this.foreignKey(txnReq.foreignKey)
|
this.foreignKey(txnReq.foreignKey);
|
||||||
this.receivingAddress(txnReq.receivingAddress)
|
this.receivingAddress(txnReq.receivingAddress);
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
addresses(addresses) {
|
addresses(addresses) {
|
||||||
this._addresses = addresses
|
this._addresses = addresses;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignKey(foreignKey) {
|
foreignKey(foreignKey) {
|
||||||
this._foreignKey = foreignKey
|
this._foreignKey = foreignKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
receivingAddress(receivingAddress) {
|
receivingAddress(receivingAddress) {
|
||||||
this._receivingAddress = receivingAddress
|
this._receivingAddress = receivingAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
return {
|
return {
|
||||||
addresses: this._addresses,
|
addresses: this._addresses,
|
||||||
foreignKey: this._foreignKey,
|
foreignKey: this._foreignKey,
|
||||||
receivingAddress: this._receivingAddress
|
receivingAddress: this._receivingAddress,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,40 +2,40 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* CrossChain - TradeBot Respond Request (Buy Action)
|
* CrossChain - TradeBot Respond Request (Buy Action)
|
||||||
*
|
*
|
||||||
* These are special types of transactions (JSON ENCODED)
|
* These are special types of transactions (JSON ENCODED)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default class TradeBotRespondRequest {
|
export default class TradeBotRespondRequest {
|
||||||
constructor() {
|
constructor() {
|
||||||
// ...
|
// ...
|
||||||
}
|
}
|
||||||
|
|
||||||
createTransaction(txnReq) {
|
createTransaction(txnReq) {
|
||||||
this.atAddress(txnReq.atAddress)
|
this.atAddress(txnReq.atAddress);
|
||||||
this.foreignKey(txnReq.foreignKey)
|
this.foreignKey(txnReq.foreignKey);
|
||||||
this.receivingAddress(txnReq.receivingAddress)
|
this.receivingAddress(txnReq.receivingAddress);
|
||||||
|
|
||||||
return this.txnRequest()
|
return this.txnRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
atAddress(atAddress) {
|
atAddress(atAddress) {
|
||||||
this._atAddress = atAddress
|
this._atAddress = atAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreignKey(foreignKey) {
|
foreignKey(foreignKey) {
|
||||||
this._foreignKey = foreignKey
|
this._foreignKey = foreignKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
receivingAddress(receivingAddress) {
|
receivingAddress(receivingAddress) {
|
||||||
this._receivingAddress = receivingAddress
|
this._receivingAddress = receivingAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
txnRequest() {
|
txnRequest() {
|
||||||
return {
|
return {
|
||||||
atAddress: this._atAddress,
|
atAddress: this._atAddress,
|
||||||
foreignKey: this._foreignKey,
|
foreignKey: this._foreignKey,
|
||||||
receivingAddress: this._receivingAddress
|
receivingAddress: this._receivingAddress,
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,165 +1,188 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import nacl from '../deps/nacl-fast'
|
import nacl from '../deps/nacl-fast';
|
||||||
import Base58 from '../deps/Base58'
|
import Base58 from '../deps/Base58';
|
||||||
import utils from '../utils/utils'
|
import utils from '../utils/utils';
|
||||||
import { QORT_DECIMALS, TX_TYPES } from '../constants/constants.js'
|
import { QORT_DECIMALS, TX_TYPES } from '../constants/constants.js';
|
||||||
|
|
||||||
export default class TransactionBase {
|
export default class TransactionBase {
|
||||||
static get utils() {
|
static get utils() {
|
||||||
return utils
|
return utils;
|
||||||
}
|
}
|
||||||
static get nacl() {
|
static get nacl() {
|
||||||
return nacl
|
return nacl;
|
||||||
}
|
}
|
||||||
static get Base58() {
|
static get Base58() {
|
||||||
return Base58
|
return Base58;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.fee = 0
|
this.fee = 0;
|
||||||
this.groupID = 0
|
this.groupID = 0;
|
||||||
this.timestamp = Date.now()
|
this.timestamp = Date.now();
|
||||||
this.tests = [
|
this.tests = [
|
||||||
() => {
|
() => {
|
||||||
if (!(this._type >= 1 && this._type in TX_TYPES)) {
|
if (!(this._type >= 1 && this._type in TX_TYPES)) {
|
||||||
return 'Invalid type: ' + this.type
|
return 'Invalid type: ' + this.type;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (this._fee < 0) {
|
if (this._fee < 0) {
|
||||||
return 'Invalid fee: ' + this._fee / QORT_DECIMALS
|
return 'Invalid fee: ' + this._fee / QORT_DECIMALS;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (this._groupID < 0 || !Number.isInteger(this._groupID)) {
|
if (this._groupID < 0 || !Number.isInteger(this._groupID)) {
|
||||||
return 'Invalid groupID: ' + this._groupID
|
return 'Invalid groupID: ' + this._groupID;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (!(new Date(this._timestamp)).getTime() > 0) {
|
if (!new Date(this._timestamp).getTime() > 0) {
|
||||||
return 'Invalid timestamp: ' + this._timestamp
|
return 'Invalid timestamp: ' + this._timestamp;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
if (!(this._lastReference instanceof Uint8Array && this._lastReference.byteLength == 64)) {
|
if (
|
||||||
if (this._lastReference == 0) {
|
!(
|
||||||
return 'Invalid last reference. Please ensure that you have at least 0.001 QORT for the transaction fee.'
|
this._lastReference instanceof Uint8Array &&
|
||||||
}
|
this._lastReference.byteLength == 64
|
||||||
return 'Invalid last reference: ' + this._lastReference
|
)
|
||||||
}
|
) {
|
||||||
return true
|
if (this._lastReference == 0) {
|
||||||
},
|
return 'Invalid last reference. Please ensure that you have at least 0.001 QORT for the transaction fee.';
|
||||||
() => {
|
}
|
||||||
if (!(this._keyPair)) {
|
return 'Invalid last reference: ' + this._lastReference;
|
||||||
return 'keyPair must be specified'
|
}
|
||||||
}
|
return true;
|
||||||
if (!(this._keyPair.publicKey instanceof Uint8Array && this._keyPair.publicKey.byteLength === 32)) {
|
},
|
||||||
return 'Invalid publicKey'
|
() => {
|
||||||
}
|
if (!this._keyPair) {
|
||||||
if (!(this._keyPair.privateKey instanceof Uint8Array && this._keyPair.privateKey.byteLength === 64)) {
|
return 'keyPair must be specified';
|
||||||
return 'Invalid privateKey'
|
}
|
||||||
}
|
if (
|
||||||
return true
|
!(
|
||||||
}
|
this._keyPair.publicKey instanceof Uint8Array &&
|
||||||
]
|
this._keyPair.publicKey.byteLength === 32
|
||||||
}
|
)
|
||||||
|
) {
|
||||||
|
return 'Invalid publicKey';
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
!(
|
||||||
|
this._keyPair.privateKey instanceof Uint8Array &&
|
||||||
|
this._keyPair.privateKey.byteLength === 64
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return 'Invalid privateKey';
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
set keyPair(keyPair) {
|
set keyPair(keyPair) {
|
||||||
this._keyPair = keyPair
|
this._keyPair = keyPair;
|
||||||
}
|
}
|
||||||
|
|
||||||
set type(type) {
|
set type(type) {
|
||||||
this.typeText = TX_TYPES[type]
|
this.typeText = TX_TYPES[type];
|
||||||
this._type = type
|
this._type = type;
|
||||||
this._typeBytes = this.constructor.utils.int32ToBytes(this._type)
|
this._typeBytes = this.constructor.utils.int32ToBytes(this._type);
|
||||||
}
|
}
|
||||||
|
|
||||||
set groupID(groupID) {
|
set groupID(groupID) {
|
||||||
this._groupID = groupID
|
this._groupID = groupID;
|
||||||
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID)
|
this._groupIDBytes = this.constructor.utils.int32ToBytes(this._groupID);
|
||||||
}
|
}
|
||||||
|
|
||||||
set timestamp(timestamp) {
|
set timestamp(timestamp) {
|
||||||
this._timestamp = timestamp
|
this._timestamp = timestamp;
|
||||||
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp)
|
this._timestampBytes = this.constructor.utils.int64ToBytes(this._timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set fee(fee) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._fee = fee * QORT_DECIMALS;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
set lastReference(lastReference) {
|
set lastReference(lastReference) {
|
||||||
this._lastReference = lastReference instanceof Uint8Array ? lastReference : this.constructor.Base58.decode(lastReference)
|
this._lastReference =
|
||||||
}
|
lastReference instanceof Uint8Array
|
||||||
|
? lastReference
|
||||||
|
: this.constructor.Base58.decode(lastReference);
|
||||||
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
return [
|
return [
|
||||||
this._typeBytes,
|
this._typeBytes,
|
||||||
this._timestampBytes,
|
this._timestampBytes,
|
||||||
this._groupIDBytes,
|
this._groupIDBytes,
|
||||||
this._lastReference,
|
this._lastReference,
|
||||||
this._keyPair.publicKey
|
this._keyPair.publicKey,
|
||||||
]
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
get signedBytes() {
|
get signedBytes() {
|
||||||
if (!this._signedBytes) {
|
if (!this._signedBytes) {
|
||||||
this.sign()
|
this.sign();
|
||||||
}
|
}
|
||||||
return this._signedBytes
|
return this._signedBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
validParams() {
|
validParams() {
|
||||||
let finalResult = {
|
let finalResult = {
|
||||||
valid: true
|
valid: true,
|
||||||
}
|
};
|
||||||
this.tests.some(test => {
|
this.tests.some((test) => {
|
||||||
const result = test()
|
const result = test();
|
||||||
if (result !== true) {
|
if (result !== true) {
|
||||||
finalResult = {
|
finalResult = {
|
||||||
valid: false,
|
valid: false,
|
||||||
message: result
|
message: result,
|
||||||
}
|
};
|
||||||
return true // exists the loop
|
return true; // exists the loop
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return finalResult
|
return finalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
generateBase() {
|
generateBase() {
|
||||||
const isValid = this.validParams()
|
const isValid = this.validParams();
|
||||||
if (!isValid.valid) {
|
if (!isValid.valid) {
|
||||||
throw new Error(isValid.message)
|
throw new Error(isValid.message);
|
||||||
}
|
}
|
||||||
let result = new Uint8Array()
|
let result = new Uint8Array();
|
||||||
|
|
||||||
this.params.forEach(item => {
|
this.params.forEach((item) => {
|
||||||
result = this.constructor.utils.appendBuffer(result, item)
|
result = this.constructor.utils.appendBuffer(result, item);
|
||||||
})
|
});
|
||||||
|
|
||||||
this._base = result
|
this._base = result;
|
||||||
return result
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
sign() {
|
sign() {
|
||||||
if (!this._keyPair) {
|
if (!this._keyPair) {
|
||||||
throw new Error('keyPair not defined')
|
throw new Error('keyPair not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._base) {
|
if (!this._base) {
|
||||||
this.generateBase()
|
this.generateBase();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._signature = this.constructor.nacl.sign.detached(this._base, this._keyPair.privateKey)
|
this._signature = this.constructor.nacl.sign.detached(
|
||||||
|
this._base,
|
||||||
|
this._keyPair.privateKey
|
||||||
|
);
|
||||||
|
|
||||||
this._signedBytes = this.constructor.utils.appendBuffer(this._base, this._signature)
|
this._signedBytes = this.constructor.utils.appendBuffer(
|
||||||
|
this._base,
|
||||||
|
this._signature
|
||||||
|
);
|
||||||
|
|
||||||
return this._signature
|
return this._signature;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,37 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from '../constants/constants'
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from './TransactionBase'
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class TransferAssetTransaction extends TransactionBase {
|
export default class TransferAssetTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 12
|
this.type = 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
set recipient(recipient) {
|
set recipient(recipient) {
|
||||||
this._recipient = recipient instanceof Uint8Array ? recipient : this.constructor.Base58.decode(recipient)
|
this._recipient =
|
||||||
|
recipient instanceof Uint8Array
|
||||||
|
? recipient
|
||||||
|
: this.constructor.Base58.decode(recipient);
|
||||||
}
|
}
|
||||||
|
|
||||||
set amount(amount) {
|
set amount(amount) {
|
||||||
this._amount = Math.round(amount * QORT_DECIMALS)
|
this._amount = Math.round(amount * QORT_DECIMALS);
|
||||||
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount)
|
this._amountBytes = this.constructor.utils.int64ToBytes(this._amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
set assetId(assetId) {
|
set assetId(assetId) {
|
||||||
this._assetId = this.constructor.utils.int64ToBytes(assetId)
|
this._assetId = this.constructor.utils.int64ToBytes(assetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
get params() {
|
get params() {
|
||||||
const params = super.params
|
const params = super.params;
|
||||||
params.push(
|
params.push(
|
||||||
this._recipient,
|
this._recipient,
|
||||||
this._assetId,
|
this._assetId,
|
||||||
this._amountBytes,
|
this._amountBytes,
|
||||||
this._feeBytes
|
this._feeBytes
|
||||||
)
|
);
|
||||||
return params
|
return params;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,62 +1,64 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import { QORT_DECIMALS } from "../constants/constants";
|
import TransactionBase from './TransactionBase';
|
||||||
import TransactionBase from "./TransactionBase";
|
|
||||||
|
|
||||||
export default class UpdateGroupTransaction extends TransactionBase {
|
export default class UpdateGroupTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 23
|
this.type = 23;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
set newOwner(newOwner) {
|
||||||
|
this._newOwner =
|
||||||
|
newOwner instanceof Uint8Array
|
||||||
|
? newOwner
|
||||||
|
: this.constructor.Base58.decode(newOwner);
|
||||||
|
}
|
||||||
|
set newIsOpen(newIsOpen) {
|
||||||
|
this._rGroupType = new Uint8Array(1);
|
||||||
|
this._rGroupType[0] = newIsOpen;
|
||||||
|
}
|
||||||
|
set newDescription(newDescription) {
|
||||||
|
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
|
newDescription.toLocaleLowerCase()
|
||||||
|
);
|
||||||
|
this._rGroupDescLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rGroupDescBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
set newApprovalThreshold(newApprovalThreshold) {
|
||||||
|
this._rGroupApprovalThreshold = new Uint8Array(1);
|
||||||
|
this._rGroupApprovalThreshold[0] = newApprovalThreshold;
|
||||||
|
}
|
||||||
|
set newMinimumBlockDelay(newMinimumBlockDelay) {
|
||||||
|
this._rGroupMinimumBlockDelayBytes =
|
||||||
|
this.constructor.utils.int32ToBytes(newMinimumBlockDelay);
|
||||||
|
}
|
||||||
|
set newMaximumBlockDelay(newMaximumBlockDelay) {
|
||||||
|
this._rGroupMaximumBlockDelayBytes =
|
||||||
|
this.constructor.utils.int32ToBytes(newMaximumBlockDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
set _groupId(_groupId) {
|
||||||
|
this._groupBytes = this.constructor.utils.int32ToBytes(_groupId);
|
||||||
set fee(fee) {
|
}
|
||||||
this._fee = fee * QORT_DECIMALS
|
get params() {
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
const params = super.params;
|
||||||
}
|
params.push(
|
||||||
set newOwner(newOwner) {
|
this._groupBytes,
|
||||||
this._newOwner = newOwner instanceof Uint8Array ? newOwner : this.constructor.Base58.decode(newOwner)
|
this._newOwner,
|
||||||
}
|
this._rGroupDescLength,
|
||||||
set newIsOpen(newIsOpen) {
|
this._rGroupDescBytes,
|
||||||
|
this._rGroupType,
|
||||||
this._rGroupType = new Uint8Array(1)
|
this._rGroupApprovalThreshold,
|
||||||
this._rGroupType[0] = newIsOpen
|
this._rGroupMinimumBlockDelayBytes,
|
||||||
}
|
this._rGroupMaximumBlockDelayBytes,
|
||||||
set newDescription(newDescription) {
|
this._feeBytes
|
||||||
this._rGroupDescBytes = this.constructor.utils.stringtoUTF8Array(newDescription.toLocaleLowerCase())
|
);
|
||||||
this._rGroupDescLength = this.constructor.utils.int32ToBytes(this._rGroupDescBytes.length)
|
return params;
|
||||||
}
|
}
|
||||||
set newApprovalThreshold(newApprovalThreshold) {
|
}
|
||||||
this._rGroupApprovalThreshold = new Uint8Array(1)
|
|
||||||
this._rGroupApprovalThreshold[0] = newApprovalThreshold;
|
|
||||||
}
|
|
||||||
set newMinimumBlockDelay(newMinimumBlockDelay) {
|
|
||||||
this._rGroupMinimumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMinimumBlockDelay)
|
|
||||||
}
|
|
||||||
set newMaximumBlockDelay(newMaximumBlockDelay) {
|
|
||||||
|
|
||||||
this._rGroupMaximumBlockDelayBytes = this.constructor.utils.int32ToBytes(newMaximumBlockDelay)
|
|
||||||
}
|
|
||||||
|
|
||||||
set _groupId(_groupId){
|
|
||||||
this._groupBytes = this.constructor.utils.int32ToBytes(_groupId)
|
|
||||||
}
|
|
||||||
get params() {
|
|
||||||
const params = super.params
|
|
||||||
params.push(
|
|
||||||
this._groupBytes,
|
|
||||||
this._newOwner,
|
|
||||||
this._rGroupDescLength,
|
|
||||||
this._rGroupDescBytes,
|
|
||||||
this._rGroupType,
|
|
||||||
this._rGroupApprovalThreshold,
|
|
||||||
this._rGroupMinimumBlockDelayBytes,
|
|
||||||
this._rGroupMaximumBlockDelayBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -1,51 +1,56 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import { QORT_DECIMALS } from "../constants/constants"
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from "./TransactionBase"
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
|
|
||||||
export default class UpdateNameTransaction extends TransactionBase {
|
export default class UpdateNameTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 4
|
this.type = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
|
set name(name) {
|
||||||
|
this.nameText = name;
|
||||||
|
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name);
|
||||||
|
this._nameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._nameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set newName(newName) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this.newNameText = newName;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._newNameBytes = this.constructor.utils.stringtoUTF8Array(newName);
|
||||||
}
|
this._newNameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._newNameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set name(name) {
|
set newData(newData) {
|
||||||
this.nameText = name
|
this.newDataText =
|
||||||
this._nameBytes = this.constructor.utils.stringtoUTF8Array(name)
|
newData.length === 0 ? 'Registered Name on the Qortal Chain' : newData;
|
||||||
this._nameLength = this.constructor.utils.int32ToBytes(this._nameBytes.length)
|
this._newDataBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
}
|
this.newDataText
|
||||||
|
);
|
||||||
|
this._newDataLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._newDataBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set newName(newName) {
|
get params() {
|
||||||
this.newNameText = newName
|
const params = super.params;
|
||||||
this._newNameBytes = this.constructor.utils.stringtoUTF8Array(newName)
|
params.push(
|
||||||
this._newNameLength = this.constructor.utils.int32ToBytes(this._newNameBytes.length)
|
this._nameLength,
|
||||||
}
|
this._nameBytes,
|
||||||
|
this._newNameLength,
|
||||||
set newData(newData) {
|
this._newNameBytes,
|
||||||
this.newDataText = newData.length === 0 ? "Registered Name on the Qortal Chain" : newData
|
this._newDataLength,
|
||||||
this._newDataBytes = this.constructor.utils.stringtoUTF8Array(this.newDataText)
|
this._newDataBytes,
|
||||||
this._newDataLength = this.constructor.utils.int32ToBytes(this._newDataBytes.length)
|
this._feeBytes
|
||||||
}
|
);
|
||||||
|
return params;
|
||||||
get params() {
|
}
|
||||||
const params = super.params
|
|
||||||
params.push(
|
|
||||||
this._nameLength,
|
|
||||||
this._nameBytes,
|
|
||||||
this._newNameLength,
|
|
||||||
this._newNameBytes,
|
|
||||||
this._newDataLength,
|
|
||||||
this._newDataBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,38 +1,42 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { QORT_DECIMALS } from '../constants/constants'
|
import { QORT_DECIMALS } from '../constants/constants';
|
||||||
import TransactionBase from './TransactionBase'
|
import TransactionBase from './TransactionBase';
|
||||||
|
|
||||||
export default class VoteOnPollTransaction extends TransactionBase {
|
export default class VoteOnPollTransaction extends TransactionBase {
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.type = 9
|
this.type = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set fee(fee) {
|
||||||
|
this._fee = fee * QORT_DECIMALS;
|
||||||
|
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee);
|
||||||
|
}
|
||||||
|
|
||||||
set fee(fee) {
|
set rPollName(rPollName) {
|
||||||
this._fee = fee * QORT_DECIMALS
|
this._rPollName = rPollName;
|
||||||
this._feeBytes = this.constructor.utils.int64ToBytes(this._fee)
|
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(
|
||||||
}
|
this._rPollName
|
||||||
|
);
|
||||||
|
this._rPollNameLength = this.constructor.utils.int32ToBytes(
|
||||||
|
this._rPollNameBytes.length
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rPollName(rPollName) {
|
set rOptionIndex(rOptionIndex) {
|
||||||
this._rPollName = rPollName
|
this._rOptionIndex = rOptionIndex;
|
||||||
this._rPollNameBytes = this.constructor.utils.stringtoUTF8Array(this._rPollName)
|
this._rOptionIndexBytes = this.constructor.utils.int32ToBytes(
|
||||||
this._rPollNameLength = this.constructor.utils.int32ToBytes(this._rPollNameBytes.length)
|
this._rOptionIndex
|
||||||
}
|
);
|
||||||
|
}
|
||||||
|
|
||||||
set rOptionIndex(rOptionIndex) {
|
get params() {
|
||||||
this._rOptionIndex = rOptionIndex
|
const params = super.params;
|
||||||
this._rOptionIndexBytes = this.constructor.utils.int32ToBytes(this._rOptionIndex)
|
params.push(
|
||||||
}
|
this._rPollNameLength,
|
||||||
|
this._rPollNameBytes,
|
||||||
get params() {
|
this._rOptionIndexBytes,
|
||||||
const params = super.params
|
this._feeBytes
|
||||||
params.push(
|
);
|
||||||
this._rPollNameLength,
|
return params;
|
||||||
this._rPollNameBytes,
|
}
|
||||||
this._rOptionIndexBytes,
|
|
||||||
this._feeBytes
|
|
||||||
)
|
|
||||||
return params
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,40 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import nacl from '../deps/nacl-fast'
|
import nacl from '../deps/nacl-fast';
|
||||||
import utils from '../utils/utils'
|
import utils from '../utils/utils';
|
||||||
|
|
||||||
export const signChat = (chatBytes, nonce, keyPair) => {
|
export const signChat = (chatBytes, nonce, keyPair) => {
|
||||||
if (!chatBytes) {
|
if (!chatBytes) {
|
||||||
throw new Error('Chat Bytes not defined')
|
throw new Error('Chat Bytes not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!nonce) {
|
if (!nonce) {
|
||||||
throw new Error('Nonce not defined')
|
throw new Error('Nonce not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keyPair) {
|
if (!keyPair) {
|
||||||
throw new Error('keyPair not defined')
|
throw new Error('keyPair not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
const _nonce = utils.int32ToBytes(nonce)
|
const _nonce = utils.int32ToBytes(nonce);
|
||||||
|
|
||||||
if (chatBytes.length === undefined) {
|
if (chatBytes.length === undefined) {
|
||||||
const _chatBytesBuffer = Object.keys(chatBytes).map(function (key) { return chatBytes[key]; })
|
const _chatBytesBuffer = Object.keys(chatBytes).map(function (key) {
|
||||||
|
return chatBytes[key];
|
||||||
|
});
|
||||||
|
|
||||||
const chatBytesBuffer = new Uint8Array(_chatBytesBuffer)
|
const chatBytesBuffer = new Uint8Array(_chatBytesBuffer);
|
||||||
chatBytesBuffer.set(_nonce, 112)
|
chatBytesBuffer.set(_nonce, 112);
|
||||||
|
|
||||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey);
|
||||||
|
|
||||||
return utils.appendBuffer(chatBytesBuffer, signature)
|
return utils.appendBuffer(chatBytesBuffer, signature);
|
||||||
} else {
|
} else {
|
||||||
const chatBytesBuffer = new Uint8Array(chatBytes)
|
const chatBytesBuffer = new Uint8Array(chatBytes);
|
||||||
chatBytesBuffer.set(_nonce, 112)
|
chatBytesBuffer.set(_nonce, 112);
|
||||||
|
|
||||||
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey)
|
const signature = nacl.sign.detached(chatBytesBuffer, keyPair.privateKey);
|
||||||
|
|
||||||
return utils.appendBuffer(chatBytesBuffer, signature)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return utils.appendBuffer(chatBytesBuffer, signature);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,30 +1,31 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
|
import nacl from '../deps/nacl-fast';
|
||||||
import nacl from '../deps/nacl-fast'
|
import Base58 from '../deps/Base58';
|
||||||
import Base58 from '../deps/Base58'
|
import utils from '../utils/utils';
|
||||||
import utils from '../utils/utils'
|
|
||||||
|
|
||||||
const signTradeBotTransaction = async (unsignedTxn, keyPair) => {
|
const signTradeBotTransaction = async (unsignedTxn, keyPair) => {
|
||||||
if (!unsignedTxn) {
|
if (!unsignedTxn) {
|
||||||
throw new Error('Unsigned Transaction Bytes not defined')
|
throw new Error('Unsigned Transaction Bytes not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!keyPair) {
|
if (!keyPair) {
|
||||||
throw new Error('keyPair not defined')
|
throw new Error('keyPair not defined');
|
||||||
}
|
}
|
||||||
|
|
||||||
const txnBuffer = Base58.decode(unsignedTxn)
|
const txnBuffer = Base58.decode(unsignedTxn);
|
||||||
|
|
||||||
if (keyPair.privateKey.length === undefined) {
|
if (keyPair.privateKey.length === undefined) {
|
||||||
const _privateKey = Object.keys(keyPair.privateKey).map(function (key) { return keyPair.privateKey[key] })
|
const _privateKey = Object.keys(keyPair.privateKey).map(function (key) {
|
||||||
const privateKey = new Uint8Array(_privateKey)
|
return keyPair.privateKey[key];
|
||||||
const signature = nacl.sign.detached(txnBuffer, privateKey)
|
});
|
||||||
return utils.appendBuffer(txnBuffer, signature)
|
const privateKey = new Uint8Array(_privateKey);
|
||||||
} else {
|
const signature = nacl.sign.detached(txnBuffer, privateKey);
|
||||||
const signature = nacl.sign.detached(txnBuffer, keyPair.privateKey)
|
return utils.appendBuffer(txnBuffer, signature);
|
||||||
return utils.appendBuffer(txnBuffer, signature)
|
} else {
|
||||||
}
|
const signature = nacl.sign.detached(txnBuffer, keyPair.privateKey);
|
||||||
}
|
return utils.appendBuffer(txnBuffer, signature);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
export default signTradeBotTransaction
|
export default signTradeBotTransaction;
|
||||||
|
@ -1,68 +1,65 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import PaymentTransaction from './PaymentTransaction.js'
|
import PaymentTransaction from './PaymentTransaction.js';
|
||||||
import ChatTransaction from './ChatTransaction.js'
|
import ChatTransaction from './ChatTransaction.js';
|
||||||
import GroupChatTransaction from './GroupChatTransaction.js'
|
import GroupChatTransaction from './GroupChatTransaction.js';
|
||||||
import GroupInviteTransaction from './GroupInviteTransaction.js'
|
import GroupInviteTransaction from './GroupInviteTransaction.js';
|
||||||
import CancelGroupInviteTransaction from './CancelGroupInviteTransaction.js'
|
import CancelGroupInviteTransaction from './CancelGroupInviteTransaction.js';
|
||||||
import GroupKickTransaction from './GroupKickTransaction.js'
|
import GroupKickTransaction from './GroupKickTransaction.js';
|
||||||
import GroupBanTransaction from './GroupBanTransaction.js'
|
import GroupBanTransaction from './GroupBanTransaction.js';
|
||||||
import CancelGroupBanTransaction from './CancelGroupBanTransaction.js'
|
import CancelGroupBanTransaction from './CancelGroupBanTransaction.js';
|
||||||
import CreateGroupTransaction from './CreateGroupTransaction.js'
|
import CreateGroupTransaction from './CreateGroupTransaction.js';
|
||||||
import LeaveGroupTransaction from './LeaveGroupTransaction.js'
|
import LeaveGroupTransaction from './LeaveGroupTransaction.js';
|
||||||
import JoinGroupTransaction from './JoinGroupTransaction.js'
|
import JoinGroupTransaction from './JoinGroupTransaction.js';
|
||||||
import AddGroupAdminTransaction from './AddGroupAdminTransaction.js'
|
import AddGroupAdminTransaction from './AddGroupAdminTransaction.js';
|
||||||
import RemoveGroupAdminTransaction from './RemoveGroupAdminTransaction.js'
|
import RemoveGroupAdminTransaction from './RemoveGroupAdminTransaction.js';
|
||||||
import RegisterNameTransaction from './RegisterNameTransaction.js'
|
import RegisterNameTransaction from './RegisterNameTransaction.js';
|
||||||
import VoteOnPollTransaction from './VoteOnPollTransaction.js'
|
import VoteOnPollTransaction from './VoteOnPollTransaction.js';
|
||||||
import CreatePollTransaction from './CreatePollTransaction.js'
|
import CreatePollTransaction from './CreatePollTransaction.js';
|
||||||
import DeployAtTransaction from './DeployAtTransaction.js'
|
import DeployAtTransaction from './DeployAtTransaction.js';
|
||||||
import RewardShareTransaction from './RewardShareTransaction.js'
|
import RewardShareTransaction from './RewardShareTransaction.js';
|
||||||
import RemoveRewardShareTransaction from './RemoveRewardShareTransaction.js'
|
import RemoveRewardShareTransaction from './RemoveRewardShareTransaction.js';
|
||||||
import UpdateNameTransaction from './UpdateNameTransaction.js'
|
import UpdateNameTransaction from './UpdateNameTransaction.js';
|
||||||
import UpdateGroupTransaction from './UpdateGroupTransaction.js'
|
import UpdateGroupTransaction from './UpdateGroupTransaction.js';
|
||||||
import SellNameTransacion from './SellNameTransacion.js'
|
import SellNameTransacion from './SellNameTransacion.js';
|
||||||
import CancelSellNameTransacion from './CancelSellNameTransacion.js'
|
import CancelSellNameTransacion from './CancelSellNameTransacion.js';
|
||||||
import BuyNameTransacion from './BuyNameTransacion.js'
|
import BuyNameTransacion from './BuyNameTransacion.js';
|
||||||
import TransferAssetTransaction from './TransferAssetTransaction.js'
|
import TransferAssetTransaction from './TransferAssetTransaction.js';
|
||||||
|
|
||||||
|
|
||||||
export const transactionTypes = {
|
export const transactionTypes = {
|
||||||
2: PaymentTransaction,
|
2: PaymentTransaction,
|
||||||
3: RegisterNameTransaction,
|
3: RegisterNameTransaction,
|
||||||
4: UpdateNameTransaction,
|
4: UpdateNameTransaction,
|
||||||
5: SellNameTransacion,
|
5: SellNameTransacion,
|
||||||
6: CancelSellNameTransacion,
|
6: CancelSellNameTransacion,
|
||||||
7: BuyNameTransacion,
|
7: BuyNameTransacion,
|
||||||
8: CreatePollTransaction,
|
8: CreatePollTransaction,
|
||||||
9: VoteOnPollTransaction,
|
9: VoteOnPollTransaction,
|
||||||
12: TransferAssetTransaction,
|
12: TransferAssetTransaction,
|
||||||
16: DeployAtTransaction,
|
16: DeployAtTransaction,
|
||||||
18: ChatTransaction,
|
18: ChatTransaction,
|
||||||
181: GroupChatTransaction,
|
181: GroupChatTransaction,
|
||||||
22: CreateGroupTransaction,
|
22: CreateGroupTransaction,
|
||||||
23: UpdateGroupTransaction,
|
23: UpdateGroupTransaction,
|
||||||
24: AddGroupAdminTransaction,
|
24: AddGroupAdminTransaction,
|
||||||
25: RemoveGroupAdminTransaction,
|
25: RemoveGroupAdminTransaction,
|
||||||
26: GroupBanTransaction,
|
26: GroupBanTransaction,
|
||||||
27: CancelGroupBanTransaction,
|
27: CancelGroupBanTransaction,
|
||||||
28: GroupKickTransaction,
|
28: GroupKickTransaction,
|
||||||
29: GroupInviteTransaction,
|
29: GroupInviteTransaction,
|
||||||
30: CancelGroupInviteTransaction,
|
30: CancelGroupInviteTransaction,
|
||||||
31: JoinGroupTransaction,
|
31: JoinGroupTransaction,
|
||||||
32: LeaveGroupTransaction,
|
32: LeaveGroupTransaction,
|
||||||
38: RewardShareTransaction,
|
38: RewardShareTransaction,
|
||||||
381: RemoveRewardShareTransaction
|
381: RemoveRewardShareTransaction,
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
export const createTransaction = (type, keyPair, params) => {
|
export const createTransaction = (type, keyPair, params) => {
|
||||||
const tx = new transactionTypes[type]()
|
const tx = new transactionTypes[type]();
|
||||||
tx.keyPair = keyPair
|
tx.keyPair = keyPair;
|
||||||
Object.keys(params).forEach(param => {
|
Object.keys(params).forEach((param) => {
|
||||||
|
tx[param] = params[param];
|
||||||
tx[param] = params[param]
|
});
|
||||||
})
|
|
||||||
|
|
||||||
return tx
|
return tx;
|
||||||
}
|
};
|
||||||
|
@ -17,7 +17,6 @@ export function decodeIfEncoded(input) {
|
|||||||
|
|
||||||
export const isValidBase64 = (str: string): boolean => {
|
export const isValidBase64 = (str: string): boolean => {
|
||||||
if (typeof str !== 'string' || str.length % 4 !== 0) return false;
|
if (typeof str !== 'string' || str.length % 4 !== 0) return false;
|
||||||
|
|
||||||
const base64Regex = /^[A-Za-z0-9+/]*={0,2}$/;
|
const base64Regex = /^[A-Za-z0-9+/]*={0,2}$/;
|
||||||
return base64Regex.test(str);
|
return base64Regex.test(str);
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@ import { crypto } from '../constants/decryptWallet';
|
|||||||
import Base58 from '../deps/Base58';
|
import Base58 from '../deps/Base58';
|
||||||
import { AES_CBC, HmacSha512 } from 'asmcrypto.js';
|
import { AES_CBC, HmacSha512 } from 'asmcrypto.js';
|
||||||
import { doInitWorkers, kdf } from '../deps/kdf';
|
import { doInitWorkers, kdf } from '../deps/kdf';
|
||||||
|
import i18n from 'i18next';
|
||||||
|
|
||||||
export const decryptStoredWallet = async (password, wallet) => {
|
export const decryptStoredWallet = async (password, wallet) => {
|
||||||
const threads = doInitWorkers(crypto.kdfThreads);
|
const threads = doInitWorkers(crypto.kdfThreads);
|
||||||
@ -18,7 +19,7 @@ export const decryptStoredWallet = async (password, wallet) => {
|
|||||||
.process(encryptedSeedBytes)
|
.process(encryptedSeedBytes)
|
||||||
.finish().result;
|
.finish().result;
|
||||||
if (Base58.encode(mac) !== wallet.mac) {
|
if (Base58.encode(mac) !== wallet.mac) {
|
||||||
throw new Error('Incorrect password');
|
throw new Error(i18n.t('auth:message.error.incorrect_password')); // TODO: i18n non-react integration
|
||||||
}
|
}
|
||||||
const decryptedBytes = AES_CBC.decrypt(
|
const decryptedBytes = AES_CBC.decrypt(
|
||||||
encryptedSeedBytes,
|
encryptedSeedBytes,
|
||||||
|
@ -5,119 +5,123 @@ import { doInitWorkers, kdf } from '../../deps/kdf';
|
|||||||
import PhraseWallet from './phrase-wallet';
|
import PhraseWallet from './phrase-wallet';
|
||||||
import * as WORDLISTS from './wordlists';
|
import * as WORDLISTS from './wordlists';
|
||||||
import FileSaver from 'file-saver';
|
import FileSaver from 'file-saver';
|
||||||
|
|
||||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||||
import { mimeToExtensionMap } from '../memeTypes';
|
import { mimeToExtensionMap } from '../memeTypes';
|
||||||
export function generateRandomSentence(template = 'adverb verb noun adjective noun adverb verb noun adjective noun adjective verbed adjective noun', maxWordLength = 0, capitalize = true) {
|
|
||||||
const partsOfSpeechMap = {
|
|
||||||
'noun': 'nouns',
|
|
||||||
'adverb': 'adverbs',
|
|
||||||
'adv': 'adverbs',
|
|
||||||
'verb': 'verbs',
|
|
||||||
'interjection': 'interjections',
|
|
||||||
'adjective': 'adjectives',
|
|
||||||
'adj': 'adjectives',
|
|
||||||
'verbed': 'verbed'
|
|
||||||
};
|
|
||||||
|
|
||||||
let _wordlists = WORDLISTS;
|
export function generateRandomSentence(
|
||||||
|
template = 'adverb verb noun adjective noun adverb verb noun adjective noun adjective verbed adjective noun',
|
||||||
function _RNG(entropy) {
|
maxWordLength = 0,
|
||||||
if (entropy > 1074) {
|
capitalize = true
|
||||||
throw new Error('Javascript can not handle that much entropy!');
|
) {
|
||||||
}
|
const partsOfSpeechMap = {
|
||||||
let randNum = 0;
|
noun: 'nouns',
|
||||||
const crypto = window.crypto || window.msCrypto;
|
adverb: 'adverbs',
|
||||||
|
adv: 'adverbs',
|
||||||
if (crypto) {
|
verb: 'verbs',
|
||||||
const entropy256 = Math.ceil(entropy / 8);
|
interjection: 'interjections',
|
||||||
let buffer = new Uint8Array(entropy256);
|
adjective: 'adjectives',
|
||||||
crypto.getRandomValues(buffer);
|
adj: 'adjectives',
|
||||||
randNum = buffer.reduce((num, value) => num * 256 + value, 0) / Math.pow(256, entropy256);
|
verbed: 'verbed',
|
||||||
} else {
|
|
||||||
console.warn('Secure RNG not found. Using Math.random');
|
|
||||||
randNum = Math.random();
|
|
||||||
}
|
|
||||||
return randNum;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _capitalize(str) {
|
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWord(partOfSpeech) {
|
|
||||||
let words = _wordlists[partsOfSpeechMap[partOfSpeech]];
|
|
||||||
if (maxWordLength) {
|
|
||||||
words = words.filter(word => word.length <= maxWordLength);
|
|
||||||
}
|
|
||||||
const requiredEntropy = Math.log(words.length) / Math.log(2);
|
|
||||||
const index = Math.floor(_RNG(requiredEntropy) * words.length);
|
|
||||||
return words[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
function parse(template) {
|
|
||||||
return template.split(/\s+/).map(token => {
|
|
||||||
const match = token.match(/^(\w+)(.*)$/);
|
|
||||||
if (!match) return token; // No match, return original token
|
|
||||||
|
|
||||||
const [ , partOfSpeech, rest ] = match;
|
|
||||||
if (partsOfSpeechMap[partOfSpeech]) {
|
|
||||||
let word = getWord(partOfSpeech);
|
|
||||||
if (capitalize && token === token[0].toUpperCase() + token.slice(1).toLowerCase()) {
|
|
||||||
word = _capitalize(word);
|
|
||||||
}
|
|
||||||
return word + rest;
|
|
||||||
}
|
|
||||||
|
|
||||||
return token;
|
|
||||||
}).join(' ');
|
|
||||||
}
|
|
||||||
|
|
||||||
return parse(template);
|
|
||||||
}
|
|
||||||
|
|
||||||
export const createAccount = async(generatedSeedPhrase)=> {
|
|
||||||
if(!generatedSeedPhrase) throw new Error('No generated seed-phrase')
|
|
||||||
const threads = doInitWorkers(crypto.kdfThreads)
|
|
||||||
|
|
||||||
const seed = await kdf(generatedSeedPhrase, void 0, threads)
|
|
||||||
const wallet = new PhraseWallet(seed, walletVersion)
|
|
||||||
return wallet
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
const hasExtension = (filename) => {
|
|
||||||
return filename.includes(".") && filename.split(".").pop().length > 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const saveFileToDisk = async (data, qortAddress) => {
|
let _wordlists = WORDLISTS;
|
||||||
|
|
||||||
const dataString = JSON.stringify(data);
|
|
||||||
const blob = new Blob([dataString], { type: 'application/json' });
|
|
||||||
const fileName = "qortal_backup_" + qortAddress + ".json";
|
|
||||||
|
|
||||||
await FileSaver.saveAs(blob, fileName);
|
function _RNG(entropy) {
|
||||||
|
if (entropy > 1074) {
|
||||||
|
throw new Error('Javascript can not handle that much entropy!');
|
||||||
|
}
|
||||||
|
let randNum = 0;
|
||||||
|
const crypto = window.crypto || window.msCrypto;
|
||||||
|
|
||||||
|
if (crypto) {
|
||||||
|
const entropy256 = Math.ceil(entropy / 8);
|
||||||
|
let buffer = new Uint8Array(entropy256);
|
||||||
|
crypto.getRandomValues(buffer);
|
||||||
|
randNum =
|
||||||
|
buffer.reduce((num, value) => num * 256 + value, 0) /
|
||||||
|
Math.pow(256, entropy256);
|
||||||
|
} else {
|
||||||
|
console.warn('Secure RNG not found. Using Math.random');
|
||||||
|
randNum = Math.random();
|
||||||
|
}
|
||||||
|
return randNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _capitalize(str) {
|
||||||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWord(partOfSpeech) {
|
||||||
|
let words = _wordlists[partsOfSpeechMap[partOfSpeech]];
|
||||||
|
if (maxWordLength) {
|
||||||
|
words = words.filter((word) => word.length <= maxWordLength);
|
||||||
|
}
|
||||||
|
const requiredEntropy = Math.log(words.length) / Math.log(2);
|
||||||
|
const index = Math.floor(_RNG(requiredEntropy) * words.length);
|
||||||
|
return words[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse(template) {
|
||||||
|
return template
|
||||||
|
.split(/\s+/)
|
||||||
|
.map((token) => {
|
||||||
|
const match = token.match(/^(\w+)(.*)$/);
|
||||||
|
if (!match) return token; // No match, return original token
|
||||||
|
|
||||||
|
const [, partOfSpeech, rest] = match;
|
||||||
|
if (partsOfSpeechMap[partOfSpeech]) {
|
||||||
|
let word = getWord(partOfSpeech);
|
||||||
|
if (
|
||||||
|
capitalize &&
|
||||||
|
token === token[0].toUpperCase() + token.slice(1).toLowerCase()
|
||||||
|
) {
|
||||||
|
word = _capitalize(word);
|
||||||
|
}
|
||||||
|
return word + rest;
|
||||||
|
}
|
||||||
|
|
||||||
|
return token;
|
||||||
|
})
|
||||||
|
.join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return parse(template);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const createAccount = async (generatedSeedPhrase) => {
|
||||||
|
if (!generatedSeedPhrase) throw new Error('No generated seed-phrase');
|
||||||
|
const threads = doInitWorkers(crypto.kdfThreads);
|
||||||
|
|
||||||
|
const seed = await kdf(generatedSeedPhrase, void 0, threads);
|
||||||
|
const wallet = new PhraseWallet(seed, walletVersion);
|
||||||
|
return wallet;
|
||||||
|
};
|
||||||
|
|
||||||
|
const hasExtension = (filename) => {
|
||||||
|
return filename.includes('.') && filename.split('.').pop().length > 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const saveFileToDisk = async (data, qortAddress) => {
|
||||||
|
const dataString = JSON.stringify(data);
|
||||||
|
const blob = new Blob([dataString], { type: 'application/json' });
|
||||||
|
const fileName = 'qortal_backup_' + qortAddress + '.json';
|
||||||
|
|
||||||
|
await FileSaver.saveAs(blob, fileName);
|
||||||
|
};
|
||||||
|
|
||||||
export const saveFileToDiskGeneric = async (blob, filename) => {
|
export const saveFileToDiskGeneric = async (blob, filename) => {
|
||||||
const timestamp = new Date()
|
const timestamp = new Date().toISOString().replace(/:/g, '-'); // Safe timestamp for filenames
|
||||||
.toISOString()
|
|
||||||
.replace(/:/g, "-"); // Safe timestamp for filenames
|
|
||||||
|
|
||||||
const fileExtension = mimeToExtensionMap[blob.type]
|
|
||||||
let fileName = filename || "qortal_file_" + timestamp + "." + fileExtension;
|
|
||||||
fileName = hasExtension(fileName) ? fileName : fileName + "." + fileExtension;
|
|
||||||
|
|
||||||
await FileSaver.saveAs(blob, fileName);
|
const fileExtension = mimeToExtensionMap[blob.type];
|
||||||
|
let fileName = filename || 'qortal_file_' + timestamp + '.' + fileExtension;
|
||||||
|
fileName = hasExtension(fileName) ? fileName : fileName + '.' + fileExtension;
|
||||||
|
|
||||||
}
|
await FileSaver.saveAs(blob, fileName);
|
||||||
|
};
|
||||||
|
|
||||||
export const saveSeedPhraseToDisk = async (data) => {
|
export const saveSeedPhraseToDisk = async (data) => {
|
||||||
|
const blob = new Blob([data], { type: 'text/plain;charset=utf-8' });
|
||||||
const blob = new Blob([data], { type: 'text/plain;charset=utf-8' })
|
const fileName = 'qortal_seedphrase.txt';
|
||||||
const fileName = "qortal_seedphrase.txt"
|
|
||||||
|
|
||||||
await FileSaver.saveAs(blob, fileName);
|
await FileSaver.saveAs(blob, fileName);
|
||||||
|
};
|
||||||
}
|
|
||||||
|
@ -1,31 +1,37 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
import {AES_CBC, HmacSha512} from 'asmcrypto.js'
|
import { AES_CBC, HmacSha512 } from 'asmcrypto.js';
|
||||||
|
import Base58 from '../../deps/Base58';
|
||||||
|
import { doInitWorkers, kdf } from '../../deps/kdf.js';
|
||||||
|
import { crypto as cryptoVals } from '../../constants/decryptWallet.js';
|
||||||
|
|
||||||
import Base58 from '../../deps/Base58'
|
const getRandomValues = crypto
|
||||||
import { doInitWorkers, kdf } from '../../deps/kdf.js'
|
? crypto.getRandomValues.bind(crypto)
|
||||||
import { crypto as cryptoVals } from '../../constants/decryptWallet.js'
|
: msCrypto.getRandomValues.bind(msCrypto);
|
||||||
|
|
||||||
const getRandomValues = crypto ? crypto.getRandomValues.bind(crypto) : msCrypto.getRandomValues.bind(msCrypto)
|
|
||||||
export const generateSaveWalletData = async (wallet, password, kdfThreads) => {
|
export const generateSaveWalletData = async (wallet, password, kdfThreads) => {
|
||||||
const threads = doInitWorkers(cryptoVals.kdfThreads)
|
const threads = doInitWorkers(cryptoVals.kdfThreads);
|
||||||
|
|
||||||
let iv = new Uint8Array(16)
|
let iv = new Uint8Array(16);
|
||||||
getRandomValues(iv)
|
getRandomValues(iv);
|
||||||
let salt = new Uint8Array(32)
|
let salt = new Uint8Array(32);
|
||||||
getRandomValues(salt)
|
getRandomValues(salt);
|
||||||
const key = await kdf(password, salt, threads)
|
const key = await kdf(password, salt, threads);
|
||||||
const encryptionKey = key.slice(0, 32)
|
const encryptionKey = key.slice(0, 32);
|
||||||
const macKey = key.slice(32, 63)
|
const macKey = key.slice(32, 63);
|
||||||
const encryptedSeed = AES_CBC.encrypt(wallet._byteSeed, encryptionKey, false, iv)
|
const encryptedSeed = AES_CBC.encrypt(
|
||||||
const mac = new HmacSha512(macKey).process(encryptedSeed).finish().result
|
wallet._byteSeed,
|
||||||
return {
|
encryptionKey,
|
||||||
address0: wallet._addresses[0].address,
|
false,
|
||||||
encryptedSeed: Base58.encode(encryptedSeed),
|
iv
|
||||||
salt: Base58.encode(salt),
|
);
|
||||||
iv: Base58.encode(iv),
|
const mac = new HmacSha512(macKey).process(encryptedSeed).finish().result;
|
||||||
version: wallet._walletVersion,
|
return {
|
||||||
mac: Base58.encode(mac),
|
address0: wallet._addresses[0].address,
|
||||||
kdfThreads
|
encryptedSeed: Base58.encode(encryptedSeed),
|
||||||
}
|
salt: Base58.encode(salt),
|
||||||
}
|
iv: Base58.encode(iv),
|
||||||
|
version: wallet._walletVersion,
|
||||||
|
mac: Base58.encode(mac),
|
||||||
|
kdfThreads,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
@ -2,36 +2,36 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
|
|
||||||
export const EXCEPTIONS = {
|
export const EXCEPTIONS = {
|
||||||
'are': 'were',
|
are: 'were',
|
||||||
'eat': 'ate',
|
eat: 'ate',
|
||||||
'go': 'went',
|
go: 'went',
|
||||||
'have': 'had',
|
have: 'had',
|
||||||
'inherit': 'inherited',
|
inherit: 'inherited',
|
||||||
'is': 'was',
|
is: 'was',
|
||||||
'run': 'ran',
|
run: 'ran',
|
||||||
'sit': 'sat',
|
sit: 'sat',
|
||||||
'visit': 'visited'
|
visit: 'visited',
|
||||||
}
|
};
|
||||||
|
|
||||||
export const getPastTense = (verb, exceptions = EXCEPTIONS) => {
|
export const getPastTense = (verb, exceptions = EXCEPTIONS) => {
|
||||||
if (exceptions[verb]) {
|
if (exceptions[verb]) {
|
||||||
return exceptions[verb]
|
return exceptions[verb];
|
||||||
}
|
}
|
||||||
if ((/e$/i).test(verb)) {
|
if (/e$/i.test(verb)) {
|
||||||
return verb + 'd'
|
return verb + 'd';
|
||||||
}
|
}
|
||||||
if ((/[aeiou]c$/i).test(verb)) {
|
if (/[aeiou]c$/i.test(verb)) {
|
||||||
return verb + 'ked'
|
return verb + 'ked';
|
||||||
}
|
}
|
||||||
// for american english only
|
// for american english only
|
||||||
if ((/el$/i).test(verb)) {
|
if (/el$/i.test(verb)) {
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
}
|
||||||
if ((/[aeio][aeiou][dlmnprst]$/).test(verb)) {
|
if (/[aeio][aeiou][dlmnprst]$/.test(verb)) {
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
}
|
||||||
if ((/[aeiou][bdglmnprst]$/i).test(verb)) {
|
if (/[aeiou][bdglmnprst]$/i.test(verb)) {
|
||||||
return verb.replace(/(.+[aeiou])([bdglmnprst])/, '$1$2$2ed')
|
return verb.replace(/(.+[aeiou])([bdglmnprst])/, '$1$2$2ed');
|
||||||
}
|
}
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
};
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
export function convertQortalLinks(inputHtml: string) {
|
export function convertQortalLinks(inputHtml: string) {
|
||||||
// Regular expression to match 'qortal://...' URLs.
|
// Regular expression to match 'qortal://...' URLs.
|
||||||
// This will stop at the first whitespace, comma, or HTML tag
|
// This will stop at the first whitespace, comma, or HTML tag
|
||||||
var regex = /(qortal:\/\/[^\s,<]+)/g;
|
var regex = /(qortal:\/\/[^\s,<]+)/g;
|
||||||
|
|
||||||
// Replace matches in inputHtml with formatted anchor tag
|
// Replace matches in inputHtml with formatted anchor tag
|
||||||
var outputHtml = inputHtml.replace(regex, function (match) {
|
var outputHtml = inputHtml.replace(regex, function (match) {
|
||||||
return `<a href="${match}" class="qortal-link">${match}</a>`;
|
return `<a href="${match}" class="qortal-link">${match}</a>`;
|
||||||
});
|
});
|
||||||
|
|
||||||
return outputHtml;
|
return outputHtml;
|
||||||
}
|
}
|
||||||
|
@ -1,173 +1,182 @@
|
|||||||
// Author: irontiga <irontiga@gmail.com>
|
// Author: irontiga <irontiga@gmail.com>
|
||||||
|
|
||||||
import { html, LitElement, css } from 'lit'
|
import { html, LitElement, css } from 'lit';
|
||||||
import * as WORDLISTS from './wordList'
|
import * as WORDLISTS from './wordList';
|
||||||
|
|
||||||
class RandomSentenceGenerator extends LitElement {
|
class RandomSentenceGenerator extends LitElement {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
return {
|
return {
|
||||||
template: { type: String, attribute: 'template' },
|
template: { type: String, attribute: 'template' },
|
||||||
parsedString: { type: String },
|
parsedString: { type: String },
|
||||||
fetchedWordlistCount: { type: Number, value: 0 },
|
fetchedWordlistCount: { type: Number, value: 0 },
|
||||||
capitalize: { type: Boolean },
|
capitalize: { type: Boolean },
|
||||||
partsOfSpeechMap: { type: Object },
|
partsOfSpeechMap: { type: Object },
|
||||||
templateEntropy: { type: Number, reflect: true, attribute: 'template-entropy' },
|
templateEntropy: {
|
||||||
maxWordLength: { type: Number, attribute: 'max-word-length' }
|
type: Number,
|
||||||
}
|
reflect: true,
|
||||||
}
|
attribute: 'template-entropy',
|
||||||
|
},
|
||||||
|
maxWordLength: { type: Number, attribute: 'max-word-length' },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super()
|
super();
|
||||||
this.template = 'adjective noun verb adverb.'
|
this.template = 'adjective noun verb adverb.';
|
||||||
this.maxWordLength = 0
|
this.maxWordLength = 0;
|
||||||
this.parsedString = ''
|
this.parsedString = '';
|
||||||
this.fetchedWordlistCount = 0
|
this.fetchedWordlistCount = 0;
|
||||||
this.capitalize = true
|
this.capitalize = true;
|
||||||
this.partsOfSpeechMap = {
|
this.partsOfSpeechMap = {
|
||||||
'noun': 'nouns',
|
noun: 'nouns',
|
||||||
'adverb': 'adverbs',
|
adverb: 'adverbs',
|
||||||
'adv': 'adverbs',
|
adv: 'adverbs',
|
||||||
'verb': 'verbs',
|
verb: 'verbs',
|
||||||
'interjection': 'interjections',
|
interjection: 'interjections',
|
||||||
'adjective': 'adjectives',
|
adjective: 'adjectives',
|
||||||
'adj': 'adjectives',
|
adj: 'adjectives',
|
||||||
'verbed': 'verbed'
|
verbed: 'verbed',
|
||||||
}
|
};
|
||||||
this.partsOfSpeech = Object.keys(this.partsOfSpeechMap)
|
this.partsOfSpeech = Object.keys(this.partsOfSpeechMap);
|
||||||
this._wordlists = WORDLISTS
|
this._wordlists = WORDLISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static styles = css`
|
static styles = css`
|
||||||
div {
|
div {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
background-color: #1f2023;
|
background-color: #1f2023;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return html`
|
return html` <div>${this.parsedString}</div> `;
|
||||||
<div>${this.parsedString}</div>
|
}
|
||||||
`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
|
||||||
firstUpdated() {
|
updated(changedProperties) {
|
||||||
// ...
|
let regen = false;
|
||||||
}
|
|
||||||
|
|
||||||
updated(changedProperties) {
|
if (changedProperties.has('template')) {
|
||||||
let regen = false
|
regen = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (changedProperties.has('template')) {
|
if (changedProperties.has('maxWordLength')) {
|
||||||
regen = true
|
console.dir(this.maxWordLength);
|
||||||
}
|
|
||||||
|
|
||||||
if (changedProperties.has('maxWordLength')) {
|
if (this.maxWordLength) {
|
||||||
console.dir(this.maxWordLength)
|
const wl = { ...this._wordlists };
|
||||||
|
|
||||||
if (this.maxWordLength) {
|
for (const partOfSpeech in this._wordlists) {
|
||||||
const wl = { ...this._wordlists }
|
if (Array.isArray(this._wordlists[partOfSpeech])) {
|
||||||
|
wl[partOfSpeech] = this._wordlists[partOfSpeech].filter(
|
||||||
|
(word) => word.length <= this.maxWordLength
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (const partOfSpeech in this._wordlists) {
|
this._wordlists = wl;
|
||||||
if (Array.isArray(this._wordlists[partOfSpeech])) {
|
}
|
||||||
wl[partOfSpeech] = this._wordlists[partOfSpeech].filter(word => word.length <= this.maxWordLength)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this._wordlists = wl
|
regen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
regen = true
|
if (regen) this.generate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (regen) this.generate()
|
_RNG(entropy) {
|
||||||
}
|
if (entropy > 1074) {
|
||||||
|
throw new Error('Javascript can not handle that much entropy!');
|
||||||
|
}
|
||||||
|
|
||||||
_RNG(entropy) {
|
let randNum = 0;
|
||||||
if (entropy > 1074) {
|
|
||||||
throw new Error('Javascript can not handle that much entropy!')
|
|
||||||
}
|
|
||||||
|
|
||||||
let randNum = 0
|
const crypto = window.crypto || window.msCrypto;
|
||||||
|
|
||||||
const crypto = window.crypto || window.msCrypto
|
if (crypto) {
|
||||||
|
const entropy256 = Math.ceil(entropy / 8);
|
||||||
|
|
||||||
if (crypto) {
|
let buffer = new Uint8Array(entropy256);
|
||||||
const entropy256 = Math.ceil(entropy / 8)
|
|
||||||
|
|
||||||
let buffer = new Uint8Array(entropy256)
|
crypto.getRandomValues(buffer);
|
||||||
|
|
||||||
crypto.getRandomValues(buffer)
|
randNum =
|
||||||
|
buffer.reduce((num, value) => {
|
||||||
|
return num * value;
|
||||||
|
}, 1) / Math.pow(256, entropy256);
|
||||||
|
} else {
|
||||||
|
console.warn('Secure RNG not found. Using Math.random');
|
||||||
|
|
||||||
randNum = buffer.reduce((num, value) => {
|
randNum = Math.random();
|
||||||
return num * value
|
}
|
||||||
}, 1) / Math.pow(256, entropy256)
|
|
||||||
} else {
|
|
||||||
console.warn('Secure RNG not found. Using Math.random')
|
|
||||||
|
|
||||||
randNum = Math.random()
|
return randNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
return randNum
|
setRNG(fn) {
|
||||||
}
|
this._RNG = fn;
|
||||||
|
}
|
||||||
|
|
||||||
setRNG(fn) {
|
_captitalize(str) {
|
||||||
this._RNG = fn
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_captitalize(str) {
|
getWord(partOfSpeech) {
|
||||||
return str.charAt(0).toUpperCase() + str.slice(1)
|
const words = this._wordlists[this.partsOfSpeechMap[partOfSpeech]];
|
||||||
}
|
const requiredEntropy = Math.log(words.length) / Math.log(2);
|
||||||
|
const index = this._RNG(requiredEntropy) * words.length;
|
||||||
|
|
||||||
getWord(partOfSpeech) {
|
return {
|
||||||
const words = this._wordlists[this.partsOfSpeechMap[partOfSpeech]]
|
word: words[Math.round(index)],
|
||||||
const requiredEntropy = Math.log(words.length) / Math.log(2)
|
entropy: words.length,
|
||||||
const index = this._RNG(requiredEntropy) * words.length
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
generate() {
|
||||||
word: words[Math.round(index)],
|
this.parsedString = this.parse(this.template);
|
||||||
entropy: words.length
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generate() {
|
parse(template) {
|
||||||
this.parsedString = this.parse(this.template)
|
const split = template.split(/[\s]/g);
|
||||||
}
|
|
||||||
|
|
||||||
parse(template) {
|
let entropy = 1;
|
||||||
const split = template.split(/[\s]/g)
|
|
||||||
|
|
||||||
let entropy = 1
|
const final = split.map((word) => {
|
||||||
|
const lower = word.toLowerCase();
|
||||||
|
|
||||||
const final = split.map(word => {
|
this.partsOfSpeech.some((partOfSpeech) => {
|
||||||
const lower = word.toLowerCase()
|
const partOfSpeechIndex = lower.indexOf(partOfSpeech); // Check it exists
|
||||||
|
const nextChar = word.charAt(partOfSpeech.length);
|
||||||
|
|
||||||
this.partsOfSpeech.some(partOfSpeech => {
|
if (
|
||||||
const partOfSpeechIndex = lower.indexOf(partOfSpeech) // Check it exists
|
partOfSpeechIndex === 0 &&
|
||||||
const nextChar = word.charAt(partOfSpeech.length)
|
!(nextChar && nextChar.match(/[a-zA-Z]/g) != null)
|
||||||
|
) {
|
||||||
|
const replacement = this.getWord(partOfSpeech);
|
||||||
|
word = replacement.word + word.slice(partOfSpeech.length); // Append the rest of the "word" (punctuation)
|
||||||
|
entropy = entropy * replacement.entropy;
|
||||||
|
|
||||||
if (partOfSpeechIndex === 0 && !(nextChar && (nextChar.match(/[a-zA-Z]/g) != null))) {
|
return true;
|
||||||
const replacement = this.getWord(partOfSpeech)
|
}
|
||||||
word = replacement.word + word.slice(partOfSpeech.length) // Append the rest of the "word" (punctuation)
|
});
|
||||||
entropy = entropy * replacement.entropy
|
|
||||||
|
|
||||||
return true
|
return word;
|
||||||
}
|
});
|
||||||
})
|
|
||||||
|
|
||||||
return word
|
this.templateEntropy = Math.floor(Math.log(entropy) / Math.log(8));
|
||||||
})
|
|
||||||
|
|
||||||
this.templateEntropy = Math.floor(Math.log(entropy) / Math.log(8))
|
return final.join(' ');
|
||||||
|
}
|
||||||
return final.join(' ')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.customElements.define('random-sentence-generator', RandomSentenceGenerator)
|
window.customElements.define(
|
||||||
|
'random-sentence-generator',
|
||||||
|
RandomSentenceGenerator
|
||||||
|
);
|
||||||
|
|
||||||
export default RandomSentenceGenerator
|
export default RandomSentenceGenerator;
|
||||||
|
@ -1,40 +1,40 @@
|
|||||||
export const EXCEPTIONS = {
|
export const EXCEPTIONS = {
|
||||||
'are': 'were',
|
are: 'were',
|
||||||
'eat': 'ate',
|
eat: 'ate',
|
||||||
'go': 'went',
|
go: 'went',
|
||||||
'have': 'had',
|
have: 'had',
|
||||||
'inherit': 'inherited',
|
inherit: 'inherited',
|
||||||
'is': 'was',
|
is: 'was',
|
||||||
'run': 'ran',
|
run: 'ran',
|
||||||
'sit': 'sat',
|
sit: 'sat',
|
||||||
'visit': 'visited'
|
visit: 'visited',
|
||||||
}
|
};
|
||||||
|
|
||||||
export const getPastTense = (verb, exceptions = EXCEPTIONS) => {
|
export const getPastTense = (verb, exceptions = EXCEPTIONS) => {
|
||||||
if (exceptions[verb]) {
|
if (exceptions[verb]) {
|
||||||
return exceptions[verb]
|
return exceptions[verb];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((/e$/i).test(verb)) {
|
if (/e$/i.test(verb)) {
|
||||||
return verb + 'd'
|
return verb + 'd';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((/[aeiou]c$/i).test(verb)) {
|
if (/[aeiou]c$/i.test(verb)) {
|
||||||
return verb + 'ked'
|
return verb + 'ked';
|
||||||
}
|
}
|
||||||
|
|
||||||
// for american english only
|
// for american english only
|
||||||
if ((/el$/i).test(verb)) {
|
if (/el$/i.test(verb)) {
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((/[aeio][aeiou][dlmnprst]$/).test(verb)) {
|
if (/[aeio][aeiou][dlmnprst]$/.test(verb)) {
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((/[aeiou][bdglmnprst]$/i).test(verb)) {
|
if (/[aeiou][bdglmnprst]$/i.test(verb)) {
|
||||||
return verb.replace(/(.+[aeiou])([bdglmnprst])/, '$1$2$2ed')
|
return verb.replace(/(.+[aeiou])([bdglmnprst])/, '$1$2$2ed');
|
||||||
}
|
}
|
||||||
|
|
||||||
return verb + 'ed'
|
return verb + 'ed';
|
||||||
}
|
};
|
||||||
|
@ -4,6 +4,7 @@ import Base58 from '../deps/Base58';
|
|||||||
|
|
||||||
export const validateAddress = (address) => {
|
export const validateAddress = (address) => {
|
||||||
let isAddress = false;
|
let isAddress = false;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const decodePubKey = Base58.decode(address);
|
const decodePubKey = Base58.decode(address);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user