Skip to content

Commit

Permalink
fix: fix truncated public key size (#868)
Browse files Browse the repository at this point in the history
* fixed issue with truncated public key size

* fixed prettier issue

---------

Co-authored-by: ost-ptk <[email protected]>
Co-authored-by: Vynnyk Dmytro <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2023
1 parent e2dde80 commit b6a2b8c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
10 changes: 5 additions & 5 deletions e2e-tests/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,29 @@ export const IMPORTED_ACCOUNT = {
accountName: ACCOUNT_NAMES.importedAccountName,
publicKey:
'0184f6d260f4ee6869ddb36affe15456de6ae045278fa2f467bb677561ce0dad55',
truncatedPublicKey: '0184...ad55'
truncatedPublicKey: '0184f...dad55'
};

export const DEFAULT_FIRST_ACCOUNT = {
accountName: ACCOUNT_NAMES.defaultFirstAccountName,
publicKey:
'0202b1943511b8c23b1b2b8ed7ddcedffcc7be70d9366a5005c7beab08a81b7ae633',
truncatedPublicKey: '0202...e633'
truncatedPublicKey: '0202b...ae633'
};

export const DEFAULT_SECOND_ACCOUNT = {
accountName: ACCOUNT_NAMES.defaultSecondAccountName,
publicKey:
'0203b2e05f074452f5e69ba512310deceaca152ebd3394eadcec26c6e68e91aa7724',
truncatedPublicKey: '0203...7724'
truncatedPublicKey: '0203b...a7724'
};

export const VALIDATOR = {
name: 'Validator',
truncatedPublicKey: '0106...a2ca'
truncatedPublicKey: '0106c...ca2ca'
};

export const NEW_VALIDATOR = {
name: 'New validator',
truncatedPublicKey: '017d...009e'
truncatedPublicKey: '017d9...2009e'
};
1 change: 0 additions & 1 deletion src/libs/layout/header/header-connection-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function HeaderConnectionStatus() {
<Hash
value={activeAccount?.publicKey!}
variant={HashVariant.ListSubtextHash}
truncatedSize="small"
truncated
withoutTooltip
color="contentOnFill"
Expand Down
10 changes: 8 additions & 2 deletions src/libs/ui/components/hash/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type TruncateKeySize = 'tiny' | 'small' | 'medium' | 'max';
export type TruncateKeySize = 'tiny' | 'small' | 'base' | 'medium' | 'max';

export function truncateKey(
key: string,
Expand All @@ -10,12 +10,18 @@ export function truncateKey(
beginOfKey = key.slice(0, 3);
endOfKey = key.slice(key.length - 3);
break;

case 'small':
default:
beginOfKey = key.slice(0, 4);
endOfKey = key.slice(key.length - 4);
break;

case 'base':
default:
beginOfKey = key.slice(0, 5);
endOfKey = key.slice(key.length - 5);
break;

case 'medium':
beginOfKey = key.slice(0, 10);
endOfKey = key.slice(key.length - 10);
Expand Down

0 comments on commit b6a2b8c

Please sign in to comment.