@@ -8,19 +8,19 @@ describe("crypto", () => {
88
99 it ( "getAddressFromPrivateKey" , ( ) => {
1010 const address = crypto . getAddressFromPrivateKey ( privateKey )
11- expect ( address ) . toBe ( "okexchain1jjvpmgwwgs99nhlje3aag0lackunqgj7xnrnwe " )
12- expect ( address . length ) . toBe ( 48 )
11+ expect ( address ) . toBe ( "ex1jjvpmgwwgs99nhlje3aag0lackunqgj7pcgnd4 " )
12+ expect ( address . length ) . toBe ( 41 )
1313 } )
1414
1515 it ( "getAddressFromPubKey" , ( ) => {
1616 const publicKey = crypto . getPubKeyHexFromPrivateKey ( privateKey )
1717 const address = crypto . getAddressFromPubKey ( publicKey )
18- expect ( address ) . toBe ( "okexchain1jjvpmgwwgs99nhlje3aag0lackunqgj7xnrnwe " )
18+ expect ( address ) . toBe ( "ex1jjvpmgwwgs99nhlje3aag0lackunqgj7pcgnd4 " )
1919 } )
2020
2121 it ( "getPrivateKeyFromKeyStore" , ( ) => {
22- const keyStore = crypto . generateKeyStore ( privateKey , "okexchain " )
23- const pk = crypto . getPrivateKeyFromKeyStore ( keyStore , "okexchain " )
22+ const keyStore = crypto . generateKeyStore ( privateKey , "ex " )
23+ const pk = crypto . getPrivateKeyFromKeyStore ( keyStore , "ex " )
2424 expect ( pk ) . toBe ( privateKey )
2525 } )
2626
@@ -41,9 +41,10 @@ describe("crypto", () => {
4141 } )
4242
4343 it ( "decodeAddressToBuffer" , ( ) => {
44- let address = "okexchain1g7c3nvac7mjgn2m9mqllgat8wwd3aptddw77gw "
44+ let address = "ex1ya7dn2rr8nx07tx9ksq8gvz5utvarrh0knjnjn "
4545 const decod = crypto . decodeAddressToBuffer ( address )
46- expect ( decod . toString ( "hex" ) ) . toBe ( "47b119b3b8f6e489ab65d83ff47567739b1e856d" )
46+ console . log ( decod . toString ( "hex" ) ) ;
47+ expect ( decod . toString ( "hex" ) ) . toBe ( "277cd9a8633cccff2cc5b400743054e2d9d18eef" )
4748 } )
4849
4950 it ( "sign" , ( ) => {
@@ -60,9 +61,11 @@ describe("crypto", () => {
6061 } )
6162
6263 it ( "bech32 and hex" , ( ) => {
63- let bech32Address = "okexchain1g7c3nvac7mjgn2m9mqllgat8wwd3aptddw77gw "
64+ let bech32Address = "ex1ya7dn2rr8nx07tx9ksq8gvz5utvarrh0knjnjn "
6465 let hexAddress = crypto . convertBech32ToHex ( bech32Address )
6566 console . log ( 'hexAddress' , hexAddress ) ;
67+
68+ // let hexAddress = "0x277CD9a8633ccCFF2Cc5B400743054e2d9d18eEf"
6669 let newBech32Address = crypto . convertHexToBech32 ( hexAddress )
6770 console . log ( 'newBech32Address' , newBech32Address )
6871 expect ( bech32Address ) . toBe ( newBech32Address )
0 commit comments