Skip to content

Commit

Permalink
Merge pull request #5430 from LiskHQ/5429-fix-issues-observed-on-3.0.…
Browse files Browse the repository at this point in the history
…0-rc.3

Fix issues observed on 3.0.0-rc.3
  • Loading branch information
ManuGowda authored Nov 13, 2023
2 parents 5b8453f + cd1c229 commit ad695fd
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/modules/transaction/__fixtures__/mockTransactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const transaction = (index) => ({
executionStatus: 'pending',
meta: {
recipient: {
address: 'lsk24cd35u4jdq8szo3pnsqe5dsxwrnazyqqqg5eu',
address: 'lsktk7bj2yadx5vq3f87gh5cwca7ptpk5djpxhhc3',
publicKey: '2ca9a7...c23079',
name: 'genesis_49',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,28 @@ export default (t) => [
{
title: t('ID'),
classList: grid['col-xs-2'],
placeholder: 'walletWithAddress',
},
{
title: t('Sender'),
classList: grid['col-xs-2'],
placeholder: 'walletWithAddress',
},
{
title: t('Height'),
classList: grid['col-xs-2'],
classList: `${grid['col-xs-1']} ${styles.transactionFeeCell}`,
},
{
title: t('Type'),
classList: `${grid['col-xs-4']} ${grid['col-md-3']}`,
classList: `${grid['col-xs-2']} ${grid['col-md-2']}`,
},
{
title: t('Value'),
classList: `${grid['col-xs-2']} ${grid['col-md-2']}`,
},
{
title: t('Date'),
classList: `${grid['col-md-2']} ${styles.transactionFeeCell}`,
classList: `${grid['col-md-2']} ${grid['col-xs-3']}`,
},
{
title: t('Status'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import styles from './ExplorerTransactions.css';

export default (t, activeToken, changeSort) => [
{
title: t('Recipient'),
title: t('Sender'),
classList: `${grid['col-xs-3']} ${styles.transactionTitle}`,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const TransactionDetails = () => {
fee,
block = {},
executionStatus,
meta,
} = transactionData;
const [txModule, txType] = splitModuleAndCommand(moduleCommand);

Expand All @@ -72,6 +73,11 @@ const TransactionDetails = () => {
value: sender,
type: 'address',
},
meta?.recipient && {
label: t('Recipient'),
value: meta.recipient,
type: 'address',
},
{
label: t('Fee'),
value: <TokenAmount val={fee} token={feeToken} />,
Expand Down Expand Up @@ -113,7 +119,7 @@ const TransactionDetails = () => {
label: t('Parameters'),
type: 'expand',
},
];
].filter((value) => value);
}, [transactionData]);

if (error || (isEmpty(transactionMetaData) && !isFetching)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ describe('TransactionDetailsView', () => {
it('should display Transaction Events properly', async () => {
expect(screen.getByText('Type')).toBeTruthy();
expect(screen.getByText('Sender')).toBeTruthy();
expect(screen.getByText('Recipient')).toBeTruthy();
expect(screen.getByText('Fee')).toBeTruthy();
expect(screen.getByText('Date')).toBeTruthy();
expect(screen.getByText('Nonce')).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

& > div:last-child {
justify-content: flex-start;
justify-content: flex-end;
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/modules/transaction/components/TransactionRow/schemas.css
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
}

& > *:last-child {
justify-content: center;
margin-left: auto;
}

@media (--medium-viewport) {
Expand Down Expand Up @@ -107,8 +107,8 @@
}

& > *:nth-child(5) {
flex-basis: 8.33333333%;
max-width: 8.33333333%;
flex-basis: 16.66666667%;
max-width: 16.66666667%;
}

& > *:first-child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useAuth } from '@auth/hooks/queries';
import { useCurrentAccount } from '@account/hooks';
import useNonceSync from '@auth/hooks/useNonceSync';
import HWSigning from '@hardwareWallet/components/HWSigning/HWSigning';
import { TRANSACTION_SIGNING_TYPES } from 'src/modules/wallet/configuration/constants';
import styles from './txSignatureCollector.css';
import { joinModuleAndCommand, fromTransactionJSON, encodeTransaction } from '../../utils';
import { MODULE_COMMANDS_NAME_MAP } from '../../configuration/moduleCommand';
Expand All @@ -30,7 +31,7 @@ const TxSignatureCollector = ({
fees,
selectedPriority,
confirmText,
type = 'transaction',
type = TRANSACTION_SIGNING_TYPES.TRANSACTION,
}) => {
const [currentAccount] = useCurrentAccount();
const { moduleCommandSchemas, messagesSchemas } = useCommandSchema();
Expand Down Expand Up @@ -108,12 +109,14 @@ const TxSignatureCollector = ({
};

const onEnterPasswordSuccess = ({ privateKey }) => {
const paramsSchema = moduleCommandSchemas[moduleCommand];
const transaction = fromTransactionJSON(transactionJSON, paramsSchema);
const buffer = encodeTransaction(transaction, paramsSchema);
const transactionHex = cryptography.utils.hash(buffer).toString('hex');
if (isTransactionAuthor) {
incrementNonce(transactionHex);
if (type !== TRANSACTION_SIGNING_TYPES.MESSAGE) {
const paramsSchema = moduleCommandSchemas[moduleCommand];
const transaction = fromTransactionJSON(transactionJSON, paramsSchema);
const buffer = encodeTransaction(transaction, paramsSchema);
const transactionHex = cryptography.utils.hash(buffer).toString('hex');
if (isTransactionAuthor) {
incrementNonce(transactionHex);
}
}
txVerification(privateKey, currentAccount?.metadata.pubkey);
};
Expand Down
11 changes: 11 additions & 0 deletions src/modules/wallet/components/RegisterMultisigForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import BoxContent from 'src/theme/box/content';
import BoxHeader from 'src/theme/box/header';
import { TertiaryButton } from 'src/theme/buttons';
import Feedback from 'src/theme/feedback/feedback';
import { Input } from 'src/theme';
import { MODULE_COMMANDS_NAME_MAP } from '@transaction/configuration/moduleCommand';
import TxComposer from '@transaction/components/TxComposer';
Expand Down Expand Up @@ -77,6 +78,7 @@ const Form = ({ nextStep, prevState = {}, onNext, authQuery }) => {
getInitialSignaturesState(prevState)
);
const [members, setMembers] = useState(() => getInitialMembersState(prevState));
const [requiredSignatureError, setRequiredSignatureError] = useState('');

const [currentAccount] = useCurrentAccount();
const [currentApplication] = useCurrentApplication();
Expand Down Expand Up @@ -124,6 +126,12 @@ const Form = ({ nextStep, prevState = {}, onNext, authQuery }) => {
const changeNumberOfSignatures = (e) => {
const value = e.target.value ? Number(e.target.value) : undefined;

if (value > MAX_MULTI_SIG_MEMBERS) {
setRequiredSignatureError(`Cannot have more than ${MAX_MULTI_SIG_MEMBERS} required signature`);
return;
}

setRequiredSignatureError('');
setNumberOfSignatures(value);
};

Expand Down Expand Up @@ -226,6 +234,9 @@ const Form = ({ nextStep, prevState = {}, onNext, authQuery }) => {
autoComplete="off"
name="required-signatures"
/>
{!!requiredSignatureError && (
<Feedback message={requiredSignatureError} status="error" />
)}
</div>
<div className={`${styles.membersControls} multisignature-members-controls`}>
<span>{t('Members')}</span>
Expand Down
4 changes: 4 additions & 0 deletions src/modules/wallet/configuration/constants.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
export const MAX_MULTI_SIG_MEMBERS = 64;
export const DEFAULT_SIGNATURE_BYTE_SIZE = 64;
export const TRANSACTION_SIGNING_TYPES = {
MESSAGE: 'message',
TRANSACTION: 'transaction',
};

0 comments on commit ad695fd

Please sign in to comment.