@@ -2136,6 +2136,7 @@ describe('Eth', async function () {
21362136 ethImpl = new EthImpl ( null , mirrorNodeInstance , logger ) ;
21372137 } ) ;
21382138
2139+ const contractEvmAddress = '0xd8db0b1dbf8ba6721ef5256ad5fe07d72d1d04b9' ;
21392140 const defaultTxHash = '0x4a563af33c4871b51a8b108aa2fe1dd5280a30dfb7236170ae5e5e7957eb6392' ;
21402141 const defaultTransaction = {
21412142 "accessList" : undefined ,
@@ -2353,6 +2354,7 @@ describe('Eth', async function () {
23532354 it ( 'valid receipt on match' , async function ( ) {
23542355 // mirror node request mocks
23552356 mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , defaultDetailedContractResultByHash ) ;
2357+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 404 ) ;
23562358 const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
23572359
23582360 // Assert the data format
@@ -2390,6 +2392,24 @@ describe('Eth', async function () {
23902392 expect ( receipt . effectiveGasPrice ) . to . eq ( defaultReceipt . effectiveGasPrice ) ;
23912393 } ) ;
23922394
2395+ it ( 'valid receipt with evm address on match' , async function ( ) {
2396+ // mirror node request mocks
2397+ mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , defaultDetailedContractResultByHash ) ;
2398+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 200 , {
2399+ evm_address : contractEvmAddress
2400+ } ) ;
2401+ const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
2402+
2403+ expect ( receipt ) . to . exist ;
2404+ if ( receipt == null ) return ;
2405+
2406+ expect ( validateHash ( receipt . from , 40 ) ) . to . eq ( true ) ;
2407+ if ( receipt . contractAddress ) {
2408+ expect ( validateHash ( receipt . contractAddress , 40 ) ) . to . eq ( true ) ;
2409+ }
2410+ expect ( receipt . contractAddress ) . to . eq ( contractEvmAddress ) ;
2411+ } ) ;
2412+
23932413 it ( "Handles null effectiveGasPrice" , async function ( ) {
23942414 const contractResult = {
23952415 ...defaultDetailedContractResultByHash ,
@@ -2398,6 +2418,7 @@ describe('Eth', async function () {
23982418 } ;
23992419
24002420 mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , contractResult ) ;
2421+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 404 ) ;
24012422 const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
24022423
24032424 expect ( receipt ) . to . exist ;
@@ -2412,6 +2433,7 @@ describe('Eth', async function () {
24122433 bloom : '0x'
24132434 } ;
24142435 mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , receiptWith0xBloom ) ;
2436+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 404 ) ;
24152437 const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
24162438
24172439 expect ( receipt ) . to . exist ;
@@ -2426,6 +2448,7 @@ describe('Eth', async function () {
24262448 } ;
24272449
24282450 mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , receiptWithErrorMessage ) ;
2451+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 404 ) ;
24292452 const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
24302453
24312454 expect ( receipt ) . to . exist ;
@@ -2438,6 +2461,7 @@ describe('Eth', async function () {
24382461 gas_used : null
24392462 } ;
24402463 mock . onGet ( `contracts/results/${ defaultTxHash } ` ) . reply ( 200 , receiptWithNullGasUsed ) ;
2464+ mock . onGet ( `contracts/${ defaultDetailedContractResultByHash . created_contract_ids [ 0 ] } ` ) . reply ( 404 ) ;
24412465 const receipt = await ethImpl . getTransactionReceipt ( defaultTxHash ) ;
24422466
24432467 expect ( receipt ) . to . exist ;
0 commit comments