File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -108,21 +108,21 @@ export const rejectMessage = (id: number) => {
108108} ;
109109
110110export const decodeEthMessage = ( hex : string ) => {
111- hex = hex . trim ( ) ;
112- if ( hex . startsWith ( '0x' ) ) {
113- hex = hex . substring ( 2 ) ;
111+ let message = hex . trim ( ) ;
112+ if ( message . startsWith ( '0x' ) ) {
113+ message = message . substring ( 2 ) ;
114114 }
115115
116116 // Validate input.
117- if ( hex . length % 2 !== 0 || ! / ^ [ 0 - 9 a - f A - F ] * $ / . test ( hex ) ) {
117+ if ( message . length % 2 !== 0 || ! / ^ [ 0 - 9 a - f A - F ] * $ / . test ( message ) ) {
118118 console . error ( 'Invalid hex string' ) ;
119119 return null ;
120120 }
121121
122122 // Create a Uint8Array from the hex string.
123- const bytes = new Uint8Array ( hex . length / 2 ) ;
123+ const bytes = new Uint8Array ( message . length / 2 ) ;
124124 for ( let i = 0 ; i < bytes . length ; i ++ ) {
125- const byte = parseInt ( hex . substring ( i * 2 , i * 2 + 2 ) , 16 ) ;
125+ const byte = parseInt ( message . substring ( i * 2 , i * 2 + 2 ) , 16 ) ;
126126 if ( isNaN ( byte ) ) {
127127 console . error ( 'Invalid byte in hex string' ) ;
128128 return null ;
You can’t perform that action at this time.
0 commit comments