@@ -302,22 +302,30 @@ describe('@tokenmanagement HTS Precompile Token Management Acceptance Tests', as
302302 token . name = TOKEN_UPDATE_NAME ;
303303 token . symbol = TOKEN_UPDATE_SYMBOL ;
304304 token . memo = TOKEN_UPDATE_MEMO ;
305- token . treasury = mainContractAddress ;
305+ token . treasury = accounts [ 0 ] . wallet . address ;
306306 }
307307
308- function checkUpdatedTokenInfo ( tokenInfo ) {
308+ async function checkUpdatedTokenInfo ( tokenInfo ) {
309+ //token info return treasury as long zero address, we convert it to evm address to compare
310+ const treasury = await mirrorNodeAddressReq ( tokenInfo . treasury ) ;
309311 expect ( tokenInfo . name ) . to . equal ( TOKEN_UPDATE_NAME ) ;
310312 expect ( tokenInfo . symbol ) . to . equal ( TOKEN_UPDATE_SYMBOL ) ;
311- expect ( tokenInfo . treasury ) . to . equal ( mainContractAddress ) ;
313+ expect ( treasury . toLowerCase ( ) ) . to . equal ( accounts [ 0 ] . wallet . address . toLowerCase ( ) ) ;
312314 expect ( tokenInfo . memo ) . to . equal ( TOKEN_UPDATE_MEMO ) ;
313315 }
314316
317+ async function mirrorNodeAddressReq ( address ) {
318+ const accountEvmAddress = await mirrorNode . get ( `/accounts/${ address } ?transactiontype=cryptotransfer` , requestId ) ;
319+ return accountEvmAddress . evm_address ;
320+ }
321+
315322 it ( 'should update fungible token properties' , async function ( ) {
316323 const txBeforeInfo = await mainContract . getTokenInfoPublic ( HTSTokenContractAddress , { gasLimit : 1000000 } ) ;
317324 const tokenInfoBefore = ( ( await txBeforeInfo . wait ( ) ) . events . filter ( e => e . event === 'TokenInfo' ) [ 0 ] . args . tokenInfo ) [ 0 ] ;
318325
326+ //updating only token info, not token keys
319327 const token = {
320- ...tokenInfoBefore , tokenKeys : [ { ... tokenInfoBefore . tokenKeys [ 0 ] } ]
328+ ...tokenInfoBefore , tokenKeys : [ ]
321329 } ;
322330
323331 setUpdatedValues ( token ) ;
@@ -328,15 +336,16 @@ describe('@tokenmanagement HTS Precompile Token Management Acceptance Tests', as
328336
329337 const txAfterInfo = await mainContract . getTokenInfoPublic ( HTSTokenContractAddress , { gasLimit : 1000000 } ) ;
330338 const tokenInfoAfter = ( ( await txAfterInfo . wait ( ) ) . events . filter ( e => e . event === 'TokenInfo' ) [ 0 ] . args . tokenInfo ) [ 0 ] ;
331- checkUpdatedTokenInfo ( tokenInfoAfter ) ;
339+ await checkUpdatedTokenInfo ( tokenInfoAfter ) ;
332340 } ) ;
333341
334342 it ( 'should update non-fungible token properties' , async function ( ) {
335343 const txBeforeInfo = await mainContract . getTokenInfoPublic ( NftHTSTokenContractAddress , { gasLimit : 1000000 } ) ;
336344 const tokenInfoBefore = ( ( await txBeforeInfo . wait ( ) ) . events . filter ( e => e . event === 'TokenInfo' ) [ 0 ] . args . tokenInfo ) [ 0 ] ;
337345
346+ //updating only token info, not token keys
338347 const token = {
339- ...tokenInfoBefore , tokenKeys : [ { ... tokenInfoBefore . tokenKeys [ 0 ] } ]
348+ ...tokenInfoBefore , tokenKeys : [ ]
340349 } ;
341350
342351 setUpdatedValues ( token ) ;
@@ -346,7 +355,7 @@ describe('@tokenmanagement HTS Precompile Token Management Acceptance Tests', as
346355
347356 const txAfterInfo = await mainContract . getTokenInfoPublic ( NftHTSTokenContractAddress , { gasLimit : 1000000 } ) ;
348357 const tokenInfoAfter = ( ( await txAfterInfo . wait ( ) ) . events . filter ( e => e . event === 'TokenInfo' ) [ 0 ] . args . tokenInfo ) [ 0 ] ;
349- checkUpdatedTokenInfo ( tokenInfoAfter ) ;
358+ await checkUpdatedTokenInfo ( tokenInfoAfter ) ;
350359 } ) ;
351360 } ) ;
352361
@@ -614,21 +623,6 @@ describe('@tokenmanagement HTS Precompile Token Management Acceptance Tests', as
614623 } ) ;
615624
616625 describe ( 'HTS Precompile Key management Tests' , async function ( ) {
617- it ( 'should be able to execute getTokenKey' , async function ( ) {
618- const tx = await mainContract . getTokenKeyPublic ( HTSTokenContractAddress , 2 ) ;
619- const result = await tx . wait ( ) ;
620- const { responseCode } = result . events . filter ( e => e . event === 'ResponseCode' ) [ 0 ] . args ;
621- expect ( responseCode ) . to . equal ( TX_SUCCESS_CODE ) ;
622- const { key } = result . events . filter ( e => e . event === 'TokenKey' ) [ 0 ] . args ;
623-
624- expect ( key ) . to . exist ;
625- expect ( key . inheritAccountKey ) . to . eq ( false ) ;
626- expect ( key . contractId ) . to . eq ( '0x0000000000000000000000000000000000000000' ) ;
627- expect ( key . ed25519 ) . to . eq ( '0x' ) ;
628- expect ( key . ECDSA_secp256k1 ) . to . exist ;
629- expect ( key . delegatableContractId ) . to . eq ( '0x0000000000000000000000000000000000000000' ) ;
630- } ) ;
631-
632626 it ( 'should be able to execute updateTokenKeys' , async function ( ) {
633627 // Get key value before update
634628 const getKeyTx = await mainContract . getTokenKeyPublic ( HTSTokenContractAddress , 2 ) ;
@@ -661,5 +655,21 @@ describe('@tokenmanagement HTS Precompile Token Management Acceptance Tests', as
661655 expect ( updatedKey . delegatableContractId ) . to . eq ( updateKey [ 4 ] ) ;
662656 expect ( updatedKey . ECDSA_secp256k1 ) . to . not . eq ( originalKey . ECDSA_secp256k1 ) ;
663657 } ) ;
658+
659+ it ( 'should be able to execute getTokenKey' , async function ( ) {
660+ const tx = await mainContract . getTokenKeyPublic ( HTSTokenContractAddress , 2 ) ;
661+ const result = await tx . wait ( ) ;
662+ const { responseCode } = result . events . filter ( e => e . event === 'ResponseCode' ) [ 0 ] . args ;
663+ expect ( responseCode ) . to . equal ( TX_SUCCESS_CODE ) ;
664+ const { key } = result . events . filter ( e => e . event === 'TokenKey' ) [ 0 ] . args ;
665+
666+ expect ( key ) . to . exist ;
667+ expect ( key . inheritAccountKey ) . to . eq ( false ) ;
668+ expect ( key . contractId ) . to . eq ( '0x0000000000000000000000000000000000000000' ) ;
669+ expect ( key . ed25519 ) . to . eq ( '0x' ) ;
670+ expect ( key . ECDSA_secp256k1 ) . to . exist ;
671+ expect ( key . delegatableContractId ) . to . eq ( '0x0000000000000000000000000000000000000000' ) ;
672+ } ) ;
673+
664674 } ) ;
665675} ) ;
0 commit comments