File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " txms.js" ,
3- "version" : " 1.2.2 " ,
3+ "version" : " 1.2.3 " ,
44 "description" : " Transaction messaging service protocol" ,
55 "main" : " dist/index.js" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -51,8 +51,8 @@ const txms: Transport = {
5151 ( errorHex as Error ) . code = 415 ;
5252 throw errorHex ;
5353 }
54- while ( hex . length % 4 !== 0 ) {
55- hex = '0' + hex ;
54+ if ( hex . length % 4 !== 0 ) {
55+ hex = '0' . repeat ( 4 - ( hex . length % 4 ) ) + hex ;
5656 }
5757 for ( let j = 0 ; j < hex . length ; j += 4 ) {
5858 let hexchar = hex . substring ( j , j + 4 ) ;
@@ -67,13 +67,13 @@ const txms: Transport = {
6767 let l ;
6868 for ( l = 0 ; l < data . length ; l ++ ) {
6969 if ( data [ l ] === '~' ) {
70- hex += ( '000 ' + data . charCodeAt ( l + 1 ) . toString ( 16 ) ) . slice ( - 2 ) + ( '000 ' + data . charCodeAt ( l + 2 ) . toString ( 16 ) ) . slice ( - 2 ) ;
70+ hex += ( '00 ' + data . charCodeAt ( l + 1 ) . toString ( 16 ) ) . slice ( - 2 ) + ( '00 ' + data . charCodeAt ( l + 2 ) . toString ( 16 ) ) . slice ( - 2 ) ;
7171 l = l + 2 ;
7272 } else {
73- hex += ( ( l === 0 ? '' : '000' ) + data . charCodeAt ( l ) . toString ( 16 ) ) . slice ( - 4 ) ;
73+ hex += ( '0000' + data . charCodeAt ( l ) . toString ( 16 ) ) . slice ( - 4 ) ;
7474 }
7575 }
76- return '0x' + hex ;
76+ return '0x' + hex . replace ( / ^ 0 + / , '' ) ;
7777 } ,
7878
7979 getEndpoint ( network ?: number | string , countriesList ?: string | Array < string > ) : { [ key : string ] : Array < string > } {
You can’t perform that action at this time.
0 commit comments