Skip to content

Commit 6b21f01

Browse files
committed
rename to formatPubkeyShort
1 parent 9704b89 commit 6b21f01

File tree

1 file changed

+9
-2
lines changed
  • packages/solana-contrib/src/utils

1 file changed

+9
-2
lines changed

packages/solana-contrib/src/utils/misc.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,16 @@ export const valueAsPromise = async <T>(
6868
* @param pubkey
6969
* @returns
7070
*/
71-
export const shortenPubkey = (pubkey: PublicKey): string => {
71+
export const formatPubkeyShort = (
72+
pubkey: PublicKey,
73+
leading = 7,
74+
trailing = 7
75+
): string => {
7276
const str = pubkey.toString();
7377
return str.length > 20
74-
? `${str.substring(0, 7)}.....${str.substring(str.length - 7, str.length)}`
78+
? `${str.substring(0, leading)}.....${str.substring(
79+
str.length - trailing,
80+
str.length
81+
)}`
7582
: str;
7683
};

0 commit comments

Comments
 (0)