diff --git a/.github/workflows/integration-tests-api.yml b/.github/workflows/integration-tests-api.yml index f191349d4c..d436227849 100644 --- a/.github/workflows/integration-tests-api.yml +++ b/.github/workflows/integration-tests-api.yml @@ -37,7 +37,7 @@ jobs: - name: Install dependencies run: | - npm ci --no-audit + npm ci npx playwright install --with-deps chromium - name: Log in to Docker Hub uses: docker/login-action@v2 diff --git a/package.json b/package.json index 66f4518ed2..811b4cc761 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "test": "lerna run test", "test:ci": "lerna run test:ci", "test:e2e": "lerna run test:e2e", - "test:integration:ui": "lerna run integration-test:ui", - "test:integration:api": "lerna run integration-test:api", + "test:integration:ui": "lerna run integration-tests:ui", + "test:integration:api": "lerna run integration-tests:api", "dev": "lerna run dev", "build": "lerna run build", "start": "lerna run start", diff --git a/packages/app/tests/e2e/features/copying.feature b/packages/app/tests/e2e/features/copying.feature index 37e4cab336..e1f73def6f 100644 --- a/packages/app/tests/e2e/features/copying.feature +++ b/packages/app/tests/e2e/features/copying.feature @@ -102,14 +102,14 @@ Feature: Copying @id272 Scenario Outline: Check hashes copying for Contracts tab on Contracts page - Given I go to page "/address/0x000000000000000000000000000000000000800A" + Given I go to page "/address/0x815858d880932A578b5153680e2786735dD923Eb" When I select "Contract" tab on "Contract" page And I click on the copy button for deployed bytecode Then Clipboard contains "" value Examples: | Text | - | 0x00050000000000020000008003000039000000400030043f00000000030100190000006003300270000000d7033001970000000102200190000000240000c13d000000040230008c0000030a0000413d000000000201043b000000e002200270000000d90420009c0000002c0000a13d000000da0420009c000000380000a13d000000db0420009c000000950000613d000000dc0420009c000001ea0000613d000000dd0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000101043b000000e5011001970000000000100435000000200000043f00000000010000190358033c0000040f000000360000013d0000000001000416000000000101004b0000030a0000c13d000000200100003900000100001004430000012000000443000000d801000041000003590001042e000000e00420009c000000600000213d000000e30120009c000001a60000613d000000e40120009c0000030a0000c13d0000000001000416000000000101004b0000030a0000c13d0000000101000039000000000101041a000001e70000013d000000de0420009c000001af0000613d000000df0220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000600220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002402100370000000000202043b000000e505200197000000e50220009c0000030a0000213d00000000020004110000004401100370000000000301043b000080060120008c000002090000613d000000090100008a000000000112016f000080010110008c000002090000613d000000f001000041000000800010043f0000002001000039000000840010043f0000003e01000039000000a40010043f000000f101000041000000c40010043f000000f201000041000000e40010043f000000f3010000410000035a00010430000000e10420009c000001e30000613d000000e20220009c0000030a0000c13d0000000002000416000000000202004b0000030a0000c13d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000402043b000000e50240009c0000030a0000213d0000002401100370000000000501043b0000000001000411000080010110008c000001ff0000c13d0000000101000039000000000301041a0000000002530019000000000332004b000000000300001900000001030040390000000103300190000000910000c13d000400000005001d000000000021041b0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a0000000403000029000000000232001a000000910000413d000002c20000013d000000fa0100004100000000001004350000001101000039000001e00000013d000000040230008a000000400220008c0000030a0000413d0000000402100370000000000802043b000000e50280009c0000030a0000213d0000002402100370000000000402043b000000e90240009c0000030a0000213d0000002302400039000000ea05000041000000000632004b00000000060000190000000006058019000000ea02200197000000000702004b0000000005008019000000ea0220009c000000000506c019000000000205004b0000030a0000c13d0000000405400039000000000251034f000000000202043b000000e90620009c000001dd0000213d000000bf06200039000000200900008a000000000696016f000000e90760009c000001dd0000213d000000400060043f000000800020043f00000000042400190000002404400039000000000334004b0000030a0000213d0000002003500039000000000131034f0000001f0320018f0000000504200272000000ca0000613d00000000050000190000000506500210000000000761034f000000000707043b000000a00660003900000000007604350000000105500039000000000645004b000000c20000413d000400000009001d000500000008001d000000000503004b000000db0000613d0000000504400210000000000141034f0000000303300210000000a004400039000000000504043300000000053501cf000000000535022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000151019f0000000000140435000000a00120003900000000000104350000000001000416000300000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039035803530000040f0000000102200190000000050400002900000004070000290000030a0000613d000000000101043b000000000201041a00000003090000290000000002920049000000000021041b0000000101000039000000000201041a0000000002920049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000000008000411000000600280021000000058031000390000000000230435000000380210003900000000009204350000006c03100039000000800200043d000000000402004b000001100000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b000001090000413d000000000332001900000000000304350000004c0320003900000000003104350000008b02200039000000000272016f000000000a12001900000000022a004b00000000020000190000000102004039000000e903a0009c000001dd0000213d0000000102200190000001dd0000c13d000100000008001d0000004000a0043f000000ed0200004100000000002a04350000000402a000390000002003000039000000000032043500000000020104330000002403a0003900000000002304350000004403a00039000000000402004b000001330000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000012c0000413d000000000132001900000000000104350000001f01200039000000000171016f000000d702000041000000d703a0009c000000000302001900000000030a401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f000080080200003900020000000a001d0358034e0000040f000000020a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000015c0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000001540000413d000000000705004b0000016b0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000030c0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005040000290000000305000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d00000020021000390000004003000039000000000032043500000000005104350000004003100039000000800200043d00000000002304350000006003100039000000e506400197000000000402004b0000018f0000613d00000000040000190000000005340019000000a007400039000000000707043300000000007504350000002004400039000000000524004b000001880000413d000000000332001900000000000304350000007f02200039000000040220017f000000d703000041000000d70410009c00000000010380190000004001100210000000d70420009c00000000020380190000006002200210000000000112019f0000000002000414000000d70420009c0000000002038019000000c002200210000000000112019f000000ee011001c70000800d020000390000000303000039000000ef040000410000000105000029000003050000013d0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000501000039000000800010043f000000ff01000041000001f20000013d000000040230008a000000200220008c0000030a0000413d0000000401100370000000000401043b000000e50140009c0000030a0000213d0000000001000416000400000001001d00000000010004100000000000100435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d035803530000040f000000050400002900000001022001900000030a0000613d000000000101043b000000000201041a00000004050000290000000002520049000000000021041b0000000101000039000000000201041a0000000002520049000000000021041b000000ec02000041000000400100043d000000200310003900000000002304350000006002400210000000240310003900000000002304350000003802100039000000000052043500000038020000390000000000210435000000f80210009c0000022f0000413d000000fa0100004100000000001004350000004101000039000000040010043f000000fb010000410000035a000104300000000001000416000000000101004b0000030a0000c13d0000001201000039000000800010043f000000e601000041000003590001042e0000000001000416000000000101004b0000030a0000c13d000000c001000039000000400010043f0000000301000039000000800010043f000000e701000041000000a00010043f0000002001000039000000c00010043f0000008001000039000000e002000039035803290000040f000000c00110008a000000d702000041000000d70310009c00000000010280190000006001100210000000e8011001c7000003590001042e000000f001000041000000800010043f0000002001000039000000840010043f0000001f01000039000000a40010043f000000fc01000041000000c40010043f000000fd010000410000035a00010430000400000003001d0000000000400435000000200000043f000000d7010000410000000002000414000000d70320009c0000000002018019000000c001200210000000eb011001c70000801002000039000500000004001d000300000005001d035803530000040f000000050300002900000001022001900000030a0000613d000000000101043b000000000201041a000000040120006c000002d30000813d000000400100043d0000004402100039000000f603000041000000000032043500000024021000390000001f030000390000000000320435000000f0020000410000000000210435000000040210003900000020030000390000000000320435000000d702000041000000d70310009c00000000010280190000004001100210000000f7011001c70000035a000104300000006007100039000000400070043f000000ed020000410000000000270435000000640210003900000020030000390000000000320435000000840310003900000000020104330000000000230435000000a403100039000000000402004b000002440000613d000000000400001900000000053400190000002004400039000000000614001900000000060604330000000000650435000000000524004b0000023d0000413d000000000132001900000000000104350000001f01200039000000200200008a000000000121016f000000d702000041000000d70370009c0000000003020019000000000307401900000040033002100000004401100039000000d70410009c00000000010280190000006001100210000000000131019f0000000003000414000000d70430009c0000000003028019000000c002300210000000000112019f0000800802000039000300000007001d0358034e0000040f000000030a00002900000000030100190000006003300270000000d703300197000000200430008c000000000403001900000020040080390000001f0540018f00000005064002720000026e0000613d0000000007000019000000050870021000000000098a0019000000000881034f000000000808043b00000000008904350000000107700039000000000867004b000002660000413d000000000705004b0000027d0000613d0000000506600210000000000761034f00000000066a00190000000305500210000000000806043300000000085801cf000000000858022f000000000707043b0000010005500089000000000757022f00000000055701cf000000000585019f000000000056043500000001022001900000029f0000613d0000001f01400039000000600210018f0000000001a20019000000000221004b00000000020000190000000102004039000000e90410009c00000005050000290000000404000029000001dd0000213d0000000102200190000001dd0000c13d000000400010043f000000200230008c0000030a0000413d0000000000410435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c7000000e5065001970000800d0200003900000003030000390000000005000411000000f904000041000003050000013d000000400200043d0000001f0430018f0000000505300272000002ac0000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000002a40000413d000000000604004b000002bb0000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000000d701000041000000d70420009c000000000201801900000040012002100000006002300210000000000121019f0000035a00010430000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000203000039000000fe04000041000003050000013d000200000002001d0000000000300435000000200000043f000000d7030000410000000001000414000000d70210009c0000000001038019000000c001100210000000eb011001c70000801002000039035803530000040f000000030300002900000001022001900000030a0000613d0000000204000029000000040240006a000000000101043b000000000021041b00000000003004350000000001000414000000d70210009c000000d701008041000000c001100210000000eb011001c70000801002000039035803530000040f0000000306000029000000050500002900000001022001900000030a0000613d000000000101043b000000000201041a00000004030000290000000002320019000000000021041b000000400100043d0000000000310435000000d7020000410000000003000414000000d70430009c0000000003028019000000d70410009c00000000010280190000004001100210000000c002300210000000000112019f000000f4011001c70000800d020000390000000303000039000000f5040000410358034e0000040f00000001012001900000030a0000613d0000000001000019000003590001042e00000000010000190000035a00010430000000400200043d0000001f0430018f0000000505300272000003190000613d000000000600001900000005076002100000000008720019000000000771034f000000000707043b00000000007804350000000106600039000000000756004b000003110000413d000000000604004b000003280000613d0000000505500210000000000151034f00000000055200190000000304400210000000000605043300000000064601cf000000000646022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000161019f0000000000150435000002bb0000013d00000000030104330000000002320436000000000403004b000003350000613d000000000400001900000000052400190000002004400039000000000614001900000000060604330000000000650435000000000534004b0000032e0000413d000000000123001900000000000104350000001f01300039000000200300008a000000000131016f0000000001120019000000000001042d000000d702000041000000d70310009c00000000010280190000000003000414000000d70430009c0000000003028019000000c0023002100000004001100210000000000121019f000000eb011001c70000801002000039035803530000040f00000001022001900000034c0000613d000000000101043b000000000001042d00000000010000190000035a0001043000000351002104210000000102000039000000000001042d0000000002000019000000000001042d00000356002104230000000102000039000000000001042d0000000002000019000000000001042d0000035800000432000003590001042e0000035a00010430000000000000000000000000000000000000000000000000000000000000000000000000ffffffff00000002000000000000000000000000000000400000010000000000000000000000000000000000000000000000000000000000000000000000000051cff8d80000000000000000000000000000000000000000000000000000000084bc3eaf0000000000000000000000000000000000000000000000000000000084bc3eb00000000000000000000000000000000000000000000000000000000095d89b41000000000000000000000000000000000000000000000000000000009cc7f7080000000000000000000000000000000000000000000000000000000051cff8d900000000000000000000000000000000000000000000000000000000579952fc00000000000000000000000000000000000000000000000000000000313ce56600000000000000000000000000000000000000000000000000000000313ce5670000000000000000000000000000000000000000000000000000000040c10f190000000000000000000000000000000000000000000000000000000006fdde030000000000000000000000000000000000000000000000000000000018160ddd000000000000000000000000ffffffffffffffffffffffffffffffffffffffff000000000000000000000000000000000000002000000080000000000000000045544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000000ffffffffffffffff800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000400000000000000000000000006c0960f90000000000000000000000000000000000000000000000000000000062f84b24000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000c405fe8958410bbaf0c73b7a0c3e20859e86ca168a4c9b0def9c54d2555a306b08c379a0000000000000000000000000000000000000000000000000000000004f6e6c792073797374656d20636f6e7472616374732077697468207370656369616c206163636573732063616e2063616c6c2074686973206d6574686f64000000000000000000000000000000000000000000840000008000000000000000000200000000000000000000000000000000000020000000000000000000000000ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5472616e7366657220616d6f756e7420657863656564732062616c616e6365000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffa02717ead6b9200dd235aad468c9809ea400fe33ac69b5bfaa6d3e90fc922b63984e487b7100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002400000000000000000000000043616c6c61626c65206f6e6c792062792074686520626f6f746c6f616465720000000000000000000000000000000000000000640000008000000000000000000f6798a560793a54c3bcfe86a93cde1e73087d944c0ea20544137d412139688545746865720000000000000000000000000000000000000000000000000000007b182cdf1aa84e348ae5644feda1c98a5a163d38bb021538445530813acd46bb | + | 0x00050000000000020000008003000039000000400030043f0000000003010019000000600330027000000072033001970000000102200190000000960000c13d000000040230008c000001600000413d000000000201043b000000e002200270000000790420009c0000014e0000613d0000007a0220009c000001600000c13d0000000002000416000000000202004b000001600000c13d000000040230008a000000200220008c000001600000413d0000000402100370000000000502043b000000760250009c000001600000213d00000023025000390000007e04000041000000000632004b000000000600001900000000060480190000007e02200197000000000702004b00000000040080190000007e0220009c000000000406c019000000000204004b000001600000c13d0000000406500039000000000261034f000000000402043b000000760240009c0000009c0000213d000000bf07400039000000200200008a000000000727016f000000760870009c0000009c0000213d000000400070043f000000800040043f00000000054500190000002405500039000000000335004b000001600000213d0000002003600039000000000131034f0000001f0340018f0000000505400272000000440000613d00000000060000190000000507600210000000000871034f000000000808043b000000a00770003900000000008704350000000106600039000000000756004b0000003c0000413d000000000603004b000000530000613d0000000505500210000000000151034f0000000303300210000000a005500039000000000605043300000000063601cf000000000636022f000000000101043b0000010003300089000000000131022f00000000013101cf000000000161019f0000000000150435000000a0014000390000000000010435000000800100043d000000760310009c0000009c0000213d000000000400041a000000010340019000000001054002700000007f0350018f000000000305c0190000001f0530008c00000000050000190000000105002039000000000454013f00000001044001900000015c0000c13d000000200430008c000000750000413d0000001f0410003900000005044002700000007b054000410000007b04000041000000200610008c000000000405801900000000000004350000001f0330003900000005033002700000007b03300041000000000534004b000000750000813d000000000004041b0000000104400039000000000534004b000000710000413d0000001f0310008c0000019f0000a13d0000000003210170000000a0040000390000007b020000410000000000000435000000890000613d0000007b0200004100000020060000390000000004000019000000000506001900000080065000390000000006060433000000000062041b000000200650003900000001022000390000002004400039000000000734004b0000007f0000413d000000a004500039000000000313004b000000930000813d0000000303100210000000f80330018f000000010500008a000000000335022f000000000353013f0000000004040433000000000334016f000000000032041b00000001020000390000000103100210000001a90000013d0000000002000416000000000202004b000001600000c13d0000007302300041000000740220009c000000a20000213d0000007f0100004100000000001004350000004101000039000000040010043f0000008001000041000001c5000104300000009f023000390000007502200197000000400020043f0000001f0230018f0000000504300272000000b10000613d00000000050000190000000506500210000000000761034f000000000707043b000000800660003900000000007604350000000105500039000000000645004b000000a90000413d000000000502004b000000c00000613d0000000504400210000000000141034f00000003022002100000008004400039000000000504043300000000052501cf000000000525022f000000000101043b0000010002200089000000000121022f00000000012101cf000000000151019f0000000000140435000000200130008c000001600000413d000000800400043d000000760140009c000001600000213d00000080033000390000009f01400039000000000131004b000001600000813d00000080024000390000000001020433000000760510009c0000009c0000213d0000003f05100039000000200900008a000000000595016f000000400800043d0000000005580019000000000685004b00000000060000190000000106004039000000760750009c0000009c0000213d00000001066001900000009c0000c13d000000400050043f00000000061804360000000004140019000000a004400039000000000334004b000001600000213d000000000301004b000000e90000613d000000000300001900000000046300190000002003300039000000000523001900000000050504330000000000540435000000000413004b000000e20000413d000000000116001900000000000104350000000004080433000000760140009c0000009c0000213d000000000100041a000000010210019000000001011002700000007f0310018f000000000301c0190000001f0130008c00000000010000190000000101002039000000010110018f000000000112004b0000015c0000c13d000000200130008c0000011f0000413d000100000003001d000300000004001d000000000000043500000072010000410000000002000414000000720320009c0000000002018019000000c00120021000000077011001c70000801002000039000500000008001d000400000009001d000200000006001d01c301be0000040f0000000206000029000000040900002900000005080000290000000102200190000001600000613d00000003040000290000001f024000390000000502200270000000200340008c0000000002004019000000000301043b00000001010000290000001f01100039000000050110027000000000011300190000000002230019000000000312004b0000011f0000813d000000000002041b0000000102200039000000000312004b0000011b0000413d0000001f0140008c000001ad0000a13d000300000004001d000000000000043500000072010000410000000002000414000000720320009c0000000002018019000000c00120021000000077011001c70000801002000039000500000008001d000400000009001d01c301be0000040f000000040300002900000005060000290000000102200190000001600000613d000000030700002900000000033701700000002002000039000000000101043b000001400000613d0000002002000039000000000400001900000000056200190000000005050433000000000051041b000000200220003900000001011000390000002004400039000000000534004b000001380000413d000000000373004b0000014b0000813d0000000303700210000000f80330018f000000010400008a000000000334022f000000000343013f00000000026200190000000002020433000000000232016f000000000021041b00000001010000390000000102700210000001b70000013d0000000001000416000000000101004b000001600000c13d000000000100041a000000010310019000000001041002700000007f0240018f000000000204c0190000001f0420008c00000000040000190000000104002039000000000441013f0000000104400190000001620000613d0000007f01000041000000000010043500000022010000390000009f0000013d0000000001000019000001c500010430000000800020043f000000000303004b000001750000613d000000a0010000390000000000000435000000000302004b000001810000613d0000007b0100004100000000040000190000000003040019000000000401041a000000a005300039000000000045043500000001011000390000002004300039000000000524004b0000016b0000413d000000c0013000390000017b0000013d000001000300008a000000000131016f000000a00010043f000000000102004b000000c001000039000000a0010060390000001f01100039000000200200008a000000000121016f0000007c021000410000007d0220009c0000009c0000413d000000400010043f00000020020000390000000003210436000000800200043d00000000002304350000004003100039000000000402004b000001910000613d00000000040000190000000005340019000000a006400039000000000606043300000000006504350000002004400039000000000524004b0000018a0000413d000000000332001900000000000304350000005f02200039000000200300008a000000000232016f0000007203000041000000720420009c0000000002038019000000720410009c000000000103801900000040011002100000006002200210000000000112019f000001c40001042e000000000201004b0000000002000019000001a30000613d000000a00200043d0000000303100210000000010400008a000000000334022f000000000343013f000000000332016f0000000102100210000000000123019f000000000010041b0000000001000019000001c40001042e000000000104004b0000000001000019000001b10000613d00000000010604330000000302400210000000010300008a000000000223022f000000000232013f000000000221016f0000000101400210000000000112019f000000000010041b0000002001000039000001000010044300000120000004430000007801000041000001c40001042e000001c1002104230000000102000039000000000001042d0000000002000019000000000001042d000001c300000432000001c40001042e000001c5000104300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff000000000000009fffffffffffffffffffffffffffffffffffffffffffffffff000000000000007f00000000000000000000000000000000000000000000000000000001ffffffe0000000000000000000000000000000000000000000000000ffffffffffffffff0200000000000000000000000000000000000020000000000000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000000000000000000000000000cfae321700000000000000000000000000000000000000000000000000000000a4136862290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563ffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffffff000000000000008080000000000000000000000000000000000000000000000000000000000000004e487b710000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d2b6fe8cd9af668ef698f6e0992d0e9aacae5e06943b1402d755814260f9fdac | @id266:I @testnet Scenario Outline: Check "" hashes copying on Block page diff --git a/packages/integration-tests/README.md b/packages/integration-tests/README.md index 14ee629b25..494310f4dd 100644 --- a/packages/integration-tests/README.md +++ b/packages/integration-tests/README.md @@ -15,7 +15,7 @@ npm install cp .env.example packages/integration-tests/src/playbook/.env ``` -- Add your private wallet key to `WALLET_PRIVATE_KEY=` By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/entities.ts`. +- Add your private wallet key to `WALLET_PRIVATE_KEY={YOUR_PRIVATE_KEY}`. By default we use `richWalletPrivateKey` private key in `integration-tests/src/playbook/utils/getWallet.ts` from `integration-tests/src/constants.ts`. ## Preparing a local environment @@ -42,13 +42,13 @@ npm run integration-test:ui If you need to run the exact test or/and suite you can change key-words from `it` to `fit` (for the test) and `describe` to `fdescribe` for suite. -If you need to exclude some specific test/suites, you can change keywords `it` to `xit` and/or +If you need to exclude some specific test/suite, you can change keywords `it` to `xit` and/or `describe` to `xdescribe`. The test solution contains two main folders: [src](./src) and [tests](./tests). [src](./src) folder contains: - essential [scenarios](./src/playbook/scenarios/) -- predefined [entities](./src/entities.ts) and [config](./src/config.ts) config files +- predefined [constants](./src/constants.ts) and [config](./src/config.ts) config files - [contracts](./src/playbook/contracts/) folder with a set of contracts - [deploy](./src/playbook/deploy/) folder with a set of deploy scripts - [buffer](./src/playbook/buffer/) folder as a temporary storage of transaction hashes and addresses diff --git a/packages/integration-tests/package.json b/packages/integration-tests/package.json index 24ee6ad63a..19faa6ed50 100644 --- a/packages/integration-tests/package.json +++ b/packages/integration-tests/package.json @@ -2,7 +2,7 @@ "name": "integration-tests", "version": "0.0.0", "title": "Integration tests", - "description": "The test solution for transaction processing`", + "description": "The test solution for Block Explorer API and UI", "repository": "https://github.com/matter-labs/block-explorer", "private": true, "author": "Matter Labs", diff --git a/packages/integration-tests/src/config.ts b/packages/integration-tests/src/config.ts index fd139570c2..cac998fd3e 100644 --- a/packages/integration-tests/src/config.ts +++ b/packages/integration-tests/src/config.ts @@ -1,7 +1,7 @@ -import { Wallets } from "./entities"; +import { Wallets } from "./constants"; export const localConfig = { - gasLimit: { gasLimit: 10000000 }, + l1GasLimit: { gasLimit: 10000000 }, l2GasLimit: 10000000, L1Network: "http://localhost:8545", L2Network: "http://localhost:3050", diff --git a/packages/integration-tests/src/constants.ts b/packages/integration-tests/src/constants.ts new file mode 100644 index 0000000000..e46f4a17c5 --- /dev/null +++ b/packages/integration-tests/src/constants.ts @@ -0,0 +1,85 @@ +import * as path from "path"; + +export enum Buffer { + greeterL2 = "greeterL2.txt", + executeGreeterTx = "executeGreeterTx.txt", + NFTtoL1 = "NFTtoL1.txt", + NFTtoL2 = "NFTtoL2.txt", + L1 = "L1.txt", + L2 = "L2.txt", + L2deposited = "L2deposited.txt", + paymaster = "paymaster.txt", + paymasterDeployTx = "paymasterDeployTx.txt", + paymasterTx = "paymasterTx.txt", + addressMultiTransferETH = "multiTransferETH.txt", + txMultiTransferETH = "txMultiTransferETH.txt", + txMultiTransferCustomTokenI = "txMultiTransferCustomTokenI.txt", + txMultiTransferCustomTokenII = "txMultiTransferCustomTokenII.txt", + addressMultiCallMiddle = "multiCallMiddle.txt", + addressMultiCallCaller = "multiCallCaller.txt", + addressMultiCallRoot = "multiCallRoot.txt", + txMultiCallMiddle = "txMultiCallMiddle.txt", + txMultiCallCaller = "txMultiCallCaller.txt", + txMultiCallRoot = "txmultiCallRoot.txt", + txUseMultiCallContracts = "txUseMultiCallContracts.txt", + txEthTransfer = "txEthTransfer.txt", + txERC20Withdraw = "txERC20Withdraw.txt", + txERC20WithdrawOtherAddress = "txERC20WithdrawOtherAddress.txt", + txEthWithdraw = "txEthWithdraw.txt", + txEthWithdrawOtherAddress = "txEthWithdrawOtherAddress.txt", + txERC20Transfer = "txERC20Transfer.txt", + emptyWalletPrivateKey = "emptyWalletPrivateKey.txt", + emptyWalletAddress = "emptyWalletAddress.txt", + failedState = "failedState.txt", + customToken = "customToken.txt", + txEthDeposit = "txEthDeposit.txt", + txERC20Deposit = "txERC20Deposit.txt", +} + +export const Path = { + playbookRoot: path.join("src", "playbook"), + absolutePathToBufferFiles: path.join(__dirname, "..", "src", "playbook", "buffer"), +}; + +export enum Logger { + deposit = "DEPOSIT", + withdraw = "WITHDRAW", + transfer = "TRANSFER", + txHashStartsWith = "0x", + textSeparator = "======================= ", + txFailedState = "FAILED STATE", +} + +export enum Token { + customL2TokenName = "L2 ERC20 token", + customL2TokenSymbol = "L2", + customL2TokenDecimals = 18, + pullAddressETH = "0x0000000000000000000000000000000000008001", + addressETH = "0x0000000000000000000000000000000000000000", + ERC20AddressETH = "0x000000000000000000000000000000000000800A", +} + +export enum TransactionsType { + fee = "fee", + transfer = "transfer", + refund = "refund", + withdrawal = "withdrawal", +} + +export enum TransactionStatus { + failed = "failed", +} + +export enum Wallets { + mainWalletAddress = "0x586607935E1462ab762F438E0A7b2968A4158975", + secondaryWalletAddress = "0x26A4c5Dfe2cA3c9E7E8C417B689F41b6b5745C37", + richWalletAddress = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", + mainWalletPrivateKey = "0x06ac1584dd1cf69f97a784b2b7812cd0c65a867ec997add028cdf56483c1c299", + secondaryWalletPrivateKey = "e14e6e0b3b610411cf15c3a5aa3252cac9e0a40a9bbe67ceb3b5d506f56576fd", + richWalletPrivateKey = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110", +} + +export enum BlockExplorer { + baseUrl = "http://localhost:3010", + localNetwork = "/?network=local", +} diff --git a/packages/integration-tests/src/entities.ts b/packages/integration-tests/src/entities.ts deleted file mode 100644 index e72f4bb25c..0000000000 --- a/packages/integration-tests/src/entities.ts +++ /dev/null @@ -1,87 +0,0 @@ -export enum Buffer { - greeterL2 = "./buffer/greeterL2.txt", - executeGreeterTx = "./buffer/executeGreeterTx.txt", - NFTtoL1 = "./buffer/NFTtoL1.txt", - NFTtoL2 = "./buffer/NFTtoL2.txt", - L1 = "./buffer/L1.txt", - L2 = "./buffer/L2.txt", - L2deposited = "./buffer/L2deposited.txt", - paymaster = "./buffer/paymaster.txt", - paymasterDeployTx = "./buffer/paymasterDeployTx.txt", - paymasterTx = "./buffer/paymasterTx.txt", - addressMultiTransferETH = "./buffer/multiTransferETH.txt", - txMultiTransferETH = "./buffer/txMultiTransferETH.txt", - txMultiTransferCustomTokenI = "./buffer/txMultiTransferCustomTokenI.txt", - txMultiTransferCustomTokenII = "./buffer/txMultiTransferCustomTokenII.txt", - addressMultiCallMiddle = "./buffer/multiCallMiddle.txt", - addressMultiCallCaller = "./buffer/multiCallCaller.txt", - addressMultiCallRoot = "./buffer/multiCallRoot.txt", - txMultiCallMiddle = "./buffer/txMultiCallMiddle.txt", - txMultiCallCaller = "./buffer/txMultiCallCaller.txt", - txMultiCallRoot = "./buffer/txmultiCallRoot.txt", - txUseMultiCallContracts = "./buffer/txUseMultiCallContracts.txt", - txEthTransfer = "./buffer/txEthTransfer.txt", - txERC20Withdraw = "./buffer/txERC20Withdraw.txt", - txERC20WithdrawOtherAddress = "./buffer/txERC20WithdrawOtherAddress.txt", - txEthWithdraw = "./buffer/txEthWithdraw.txt", - txEthWithdrawOtherAddress = "./buffer/txEthWithdrawOtherAddress.txt", - txERC20Transfer = "./buffer/txERC20Transfer.txt", - emptyWalletPrivateKey = "./buffer/emptyWalletPrivateKey.txt", - emptyWalletAddress = "./buffer/emptyWalletAddress.txt", - failedState = "./buffer/failedState.txt", - customToken = "./buffer/customToken.txt", -} - -export enum Logger { - deposit = "DEPOSIT", - withdraw = "WITHDRAW", - transfer = "TRANSFER", - txHashStartsWith = "0x", - textSeparator = "======================= ", - txFailedState = "FAILED STATE", -} - -export enum Token { - CUST_Address = "0x0928008B245A76E105E02C522b5d309c0887ecA5", - customL2TokenName = "L2 ERC20 token", - customL2TokenSymbol = "L2", - customL2TokenDecimals = 18, - ETHER_PULL_Address = "0x0000000000000000000000000000000000008001", - ETHER_Address = "0x0000000000000000000000000000000000000000", - ETHER_ERC20_Address = "0x000000000000000000000000000000000000800A", -} - -export enum TransactionsType { - fee = "fee", - transfer = "transfer", - refund = "refund", - withdrawal = "withdrawal", -} - -export enum TransactionsStatus { - failed = "failed", -} - -export enum Wallets { - mainWalletAddress = "0x586607935E1462ab762F438E0A7b2968A4158975", - secondWalletAddress = "0x26A4c5Dfe2cA3c9E7E8C417B689F41b6b5745C37", - richWalletAddress = "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049", - mainWalletPrivateKey = "0x06ac1584dd1cf69f97a784b2b7812cd0c65a867ec997add028cdf56483c1c299", - secondWalletPrivateKey = "e14e6e0b3b610411cf15c3a5aa3252cac9e0a40a9bbe67ceb3b5d506f56576fd", - richWalletPrivateKey = "0x7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110", -} - -export enum BlockExplorer { - baseUrl = "http://localhost:3010", - localNetwork = "/?network=local", -} - -const txSumETH = "0.000009"; -export const Values = { - txSumETH: txSumETH, -}; - -/* -export enum Values { - txSumETH = "0.000009", -}*/ diff --git a/packages/integration-tests/src/helper.ts b/packages/integration-tests/src/helper.ts index 71dc978a5a..2482ba4809 100644 --- a/packages/integration-tests/src/helper.ts +++ b/packages/integration-tests/src/helper.ts @@ -1,17 +1,18 @@ -import { execSync } from "child_process"; +import { exec } from "child_process"; import { ethers } from "ethers"; import { promises as fs } from "fs"; import * as path from "path"; import * as request from "supertest"; -import { Provider } from "zksync-web3"; +import { setTimeout } from "timers/promises"; import { environment, localConfig } from "./config"; -import { Logger } from "./entities"; +import { Logger } from "./constants"; +import { getProviderForL1, getProviderForL2 } from "./provider"; import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; export class Helper { - async txHashLogger(txType: string, txValue: string, tokenName?: string) { + async logTransaction(txType: string, txValue: string, tokenName?: string) { const logMessage = `TxHash for ${txType} ${Logger.textSeparator} ${txValue}`; if (tokenName === undefined) { @@ -22,24 +23,28 @@ export class Helper { } async executeScript(script: string) { - const output = execSync(script, { encoding: "utf-8" }); - - try { - console.log(`> Run NPM Script "${script}":\n`, output); - return output; - } catch (e) { - console.log(e); - } + return new Promise((resolve, reject) => { + exec(script, { encoding: "utf-8" }, (error, stdout, stderr) => { + if (error) { + console.error(`Error executing script "${script}":`, error); + console.error(`stderr executing script "${script}":`, stderr); + reject(error); + } else { + console.log(`> Run NPM Script "${script}":\n`, stdout); + resolve(stdout); + } + }); + }); } - async getStringFromFile(fileName: string) { - const absoluteRoute = path.join(__dirname, "..", fileName); + async writeFile(filePath: string, fileName: string, data: string) { + const absoluteRoute = path.join(filePath, fileName); + await fs.writeFile(absoluteRoute, data); + } - try { - return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); - } catch { - console.log(`There is no the expected file: ${fileName}`); - } + async readFile(filePath: string, fileName: string) { + const absoluteRoute = path.join(filePath, fileName); + return await fs.readFile(absoluteRoute, { encoding: "utf-8" }); } async getBalanceETH(walletAddress: string, layer: string) { @@ -47,10 +52,10 @@ export class Helper { let provider: BaseProvider; if (layer == "L1") { network = localConfig.L1Network; - provider = ethers.getDefaultProvider(network); + provider = getProviderForL1(network); } else if (layer == "L2") { network = localConfig.L2Network; - provider = new Provider(network); + provider = getProviderForL2(network); } else { console.log(`Wrong layer: ${layer}`); } @@ -58,10 +63,10 @@ export class Helper { } async delay(ms: number) { - return new Promise((resolve) => setTimeout(resolve, ms)); + await setTimeout(ms); } - async performGETrequest(apiRoute: string) { + async performBlockExplorerApiGetRequest(apiRoute: string) { return request(environment.blockExplorerAPI).get(apiRoute); } @@ -73,7 +78,7 @@ export class Helper { * with a delay between attempts (localConfig.intervalAPIretries). * Throws an error if the action consistently fails after all retries. */ - async retryTestAction(action) { + async runRetriableTestAction(action) { for (let i = 0; i < localConfig.maxAPIretries; i++) { try { await action(); diff --git a/packages/integration-tests/src/playbook/contracts/Caller.sol b/packages/integration-tests/src/playbook/contracts/Caller.sol index 7028ee5148..d8a7ca96ce 100644 --- a/packages/integration-tests/src/playbook/contracts/Caller.sol +++ b/packages/integration-tests/src/playbook/contracts/Caller.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGreeter2 { diff --git a/packages/integration-tests/src/playbook/contracts/Middle.sol b/packages/integration-tests/src/playbook/contracts/Middle.sol index 6a45f3e3f0..311d227246 100644 --- a/packages/integration-tests/src/playbook/contracts/Middle.sol +++ b/packages/integration-tests/src/playbook/contracts/Middle.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IGreeter { diff --git a/packages/integration-tests/src/playbook/contracts/MyERC20.sol b/packages/integration-tests/src/playbook/contracts/MyERC20.sol index 5eb5a63d78..5821702080 100644 --- a/packages/integration-tests/src/playbook/contracts/MyERC20.sol +++ b/packages/integration-tests/src/playbook/contracts/MyERC20.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: UNLICENSED +// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; diff --git a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts index ae4d4d9da6..b6f4c1b6eb 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-greeter.ts @@ -1,19 +1,20 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = await getWallet(hre); const deployer = new Deployer(hre, wallet); const artifact = await deployer.loadArtifact("Greeter"); - const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); + const contract = await deployer.deploy(artifact, [], localConfig.l1GasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); - await fs.writeFile(Buffer.greeterL2, contractAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.greeterL2, contractAddress); } diff --git a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts index 468e7cc9d5..b68dc35c82 100644 --- a/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/deploy-paymaster.ts @@ -1,20 +1,21 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Wallet } from "zksync-web3"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = new Wallet(Wallets.richWalletPrivateKey); // The wallet that will receive ERC20 tokens const emptyWallet = Wallet.createRandom(); console.log(`Empty wallet's address: ${emptyWallet.address}`); - await fs.writeFile(Buffer.emptyWalletAddress, emptyWallet.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress, emptyWallet.address); console.log(`Empty wallet's private key: ${emptyWallet.privateKey}`); - await fs.writeFile(Buffer.emptyWalletPrivateKey, emptyWallet.privateKey); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletPrivateKey, emptyWallet.privateKey); const deployer = new Deployer(hre, wallet); @@ -22,16 +23,16 @@ export default async function (hre: HardhatRuntimeEnvironment) { const erc20Artifact = await deployer.loadArtifact("MyERC20"); const erc20 = await deployer.deploy(erc20Artifact, ["MyToken", "MyToken", 18]); console.log(`ERC20 address: ${erc20.address}`); - await fs.writeFile(Buffer.customToken, erc20.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.customToken, erc20.address); const paymasterArtifact = await deployer.loadArtifact("MyPaymaster"); const paymaster = await deployer.deploy(paymasterArtifact, [erc20.address]); console.log(`Paymaster address: ${paymaster.address}`); - await fs.writeFile(Buffer.paymaster, paymaster.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymaster, paymaster.address); const deployTransaction = await paymaster.deployTransaction; console.log(`Paymaster deploy transaction: ${deployTransaction.hash}`); - await fs.writeFile(Buffer.paymasterDeployTx, deployTransaction.hash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymasterDeployTx, deployTransaction.hash); await ( await deployer.zkWallet.sendTransaction({ diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts index 63b7b72200..a8ef78e7f2 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL1.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL1.ts @@ -1,9 +1,10 @@ -import { promises as fs } from "fs"; import { ethers } from "hardhat"; import { localConfig } from "../../config"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; +const helper = new Helper(); async function main() { const [deployer] = await ethers.getSigners(); @@ -14,9 +15,9 @@ async function main() { console.log("Account balance:", await ethers.utils.formatEther(weiAmount)); const contract = await ethers.getContractFactory("L1"); - const token = await contract.deploy(Wallets.richWalletAddress, localConfig.gasLimit); + const token = await contract.deploy(Wallets.richWalletAddress, localConfig.l1GasLimit); - await fs.writeFile(Buffer.L1, token.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L1, token.address); } main() diff --git a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts index cbebe93761..0213227cb2 100644 --- a/packages/integration-tests/src/playbook/deploy/erc20toL2.ts +++ b/packages/integration-tests/src/playbook/deploy/erc20toL2.ts @@ -1,19 +1,20 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { const wallet = await getWallet(hre); const deployer = new Deployer(hre, wallet); const artifact = await deployer.loadArtifact("L2"); - const contract = await deployer.deploy(artifact, [], localConfig.gasLimit); + const contract = await deployer.deploy(artifact, [], localConfig.l1GasLimit); const contractAddress = contract.address; console.log(`${artifact.contractName} was deployed to ${contractAddress}`); - await fs.writeFile(Buffer.L2, contractAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L2, contractAddress); } diff --git a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts index 73b1924d62..e5444f7c04 100644 --- a/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/multiTransferETH.ts @@ -1,11 +1,12 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import verify from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); const contract_name = "TokenF2L2"; // insert the name of the contract you want to deploy const constructor_arguments = [Wallets.richWalletAddress]; // insert the constructor arguments of the contract you want to deploy @@ -27,7 +28,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { // Show the contract info. console.log(`Contract "${artifact.contractName}" was deployed to ${deployedContract.address}`); - await fs.writeFile(Buffer.addressMultiTransferETH, deployedContract.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH, deployedContract.address); await verify({ hre, contract: deployedContract, contractConstructorArguments: constructor_arguments, artifact }); diff --git a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts index d609e8e28a..ed1f3452b5 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallCaller.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallCaller.ts @@ -1,7 +1,6 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -10,7 +9,6 @@ import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Running deploy script for the contract`); const helper = new Helper(); - const playbookRoot = "src/playbook/"; const wallet = await getWallet(hre); // Create deployer object and load the artifact of the contract we want to deploy. @@ -18,7 +16,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const artifact = await deployer.loadArtifact("GCaller"); // Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. - const addressContractMiddle = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallMiddle); + const addressContractMiddle = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); const contractConstructorArguments = [addressContractMiddle]; console.log(`Arguments for the contract constructor: ${JSON.stringify(contractConstructorArguments)}`); const deployedContract = await deployer.deploy(artifact, contractConstructorArguments); @@ -34,8 +32,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallCaller, address); - await fs.writeFile(Buffer.txMultiCallCaller, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts index c4feb61249..ee88d63c11 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallMiddle.ts @@ -1,7 +1,6 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -11,7 +10,6 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Running deploy script for the contract`); const helper = new Helper(); - const playbookRoot = "src/playbook/"; const wallet = await getWallet(hre); // Create deployer object and load the artifact of the contract we want to deploy. @@ -19,7 +17,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const artifact = await deployer.loadArtifact("Middle"); // Deploy this contract. The returned object will be of a `Contract` type, similarly to ones in `ethers`. - const addressContractRoot = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallRoot); + const addressContractRoot = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); const contractConstructorArguments = [addressContractRoot]; console.log(`Arguments for the contract constructor: ${JSON.stringify(contractConstructorArguments)}`); const deployedContract = await deployer.deploy(artifact, contractConstructorArguments); @@ -35,8 +33,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallMiddle, address); - await fs.writeFile(Buffer.txMultiCallMiddle, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts index b0236342a9..67efa20891 100644 --- a/packages/integration-tests/src/playbook/deploy/multicallRoot.ts +++ b/packages/integration-tests/src/playbook/deploy/multicallRoot.ts @@ -1,12 +1,13 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; +import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { + const helper = new Helper(); console.log(`Running deploy script for the Greeter contract`); const wallet = await getWallet(hre); @@ -48,8 +49,8 @@ export default async function (hre: HardhatRuntimeEnvironment) { const address = deployedContract.address; const txHash = deployedContract.deployTransaction.hash; - await fs.writeFile(Buffer.addressMultiCallRoot, address); - await fs.writeFile(Buffer.txMultiCallRoot, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot, address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot, txHash); return [address, txHash]; } diff --git a/packages/integration-tests/src/playbook/deploy/nftToL1.ts b/packages/integration-tests/src/playbook/deploy/nftToL1.ts index fb1af7d58b..8dfa5242fd 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL1.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL1.ts @@ -1,10 +1,11 @@ -import { promises as fs } from "fs"; import { ethers } from "hardhat"; import * as hardhatConfig from "hardhat"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; +const helper = new Helper(); async function main() { const hre: HardhatRuntimeEnvironment = hardhatConfig; @@ -22,7 +23,7 @@ async function main() { console.error(`The NFT minting has been unsuccessful: ${mintNFT}`); } - await fs.writeFile(Buffer.NFTtoL1, myNFT.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1, myNFT.address); } main() diff --git a/packages/integration-tests/src/playbook/deploy/nftToL2.ts b/packages/integration-tests/src/playbook/deploy/nftToL2.ts index 6ae5c15547..bf22be1a42 100644 --- a/packages/integration-tests/src/playbook/deploy/nftToL2.ts +++ b/packages/integration-tests/src/playbook/deploy/nftToL2.ts @@ -1,13 +1,14 @@ import { Deployer } from "@matterlabs/hardhat-zksync-deploy"; -import { promises as fs } from "fs"; -import { Buffer, Wallets } from "../../entities"; +import { Buffer, Path, Wallets } from "../../constants"; +import { Helper } from "../../helper"; import displayVerificationInfo from "../utils/displayVerificationInfo"; import getWallet from "../utils/getWallet"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { + const helper = new Helper(); console.log(`Running deploy script for the Greeter contract`); const wallet = await getWallet(hre); @@ -30,5 +31,5 @@ export default async function (hre: HardhatRuntimeEnvironment) { displayVerificationInfo({ hre, contract: myNFT, contractConstructorArguments, artifact }); - await fs.writeFile(Buffer.NFTtoL2, myNFT.address); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2, myNFT.address); } diff --git a/packages/integration-tests/src/playbook/deploy/use-greeter.ts b/packages/integration-tests/src/playbook/deploy/use-greeter.ts index d11a3b6610..0c427a1414 100644 --- a/packages/integration-tests/src/playbook/deploy/use-greeter.ts +++ b/packages/integration-tests/src/playbook/deploy/use-greeter.ts @@ -1,20 +1,18 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Wallets } from "../../entities"; -import { Buffer } from "../../entities"; +import { Path, Wallets } from "../../constants"; +import { Buffer } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { - const bufferRoute = "src/playbook/"; const helper = new Helper(); let contract: any; // eslint-disable-line - const greeterContractAddress = await helper.getStringFromFile(bufferRoute + Buffer.greeterL2); + const greeterContractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); const provider = new Provider(localConfig.L2Network); const wallet = new Wallet(Wallets.richWalletPrivateKey, provider); @@ -33,7 +31,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Transaction hash: ${transactionReceipt.transactionHash}`); - await fs.writeFile(Buffer.executeGreeterTx, transactionReceipt.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx, transactionReceipt.transactionHash); return transactionReceipt.transactionHash; } diff --git a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts index 5941892677..21f440d144 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multiCall.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multiCall.ts @@ -1,9 +1,8 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import getWallet from "../utils/getWallet"; @@ -11,8 +10,10 @@ import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function (hre: HardhatRuntimeEnvironment) { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const TRANSFER_CONTRACT_ADDRESS = await helper.getStringFromFile(playbookRoot + Buffer.addressMultiCallCaller); + const TRANSFER_CONTRACT_ADDRESS = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.addressMultiCallCaller + ); const CONTRACT_NAME = "GCaller"; console.log(`Running deploy script for the contract`); @@ -23,7 +24,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { const attachedContract = new ethers.Contract(TRANSFER_CONTRACT_ADDRESS, factoryArtifact.abi, wallet); console.log(`Contract said something like this by default: ${await attachedContract.newCallGreeter()}`); const newGreet = "New Greet!"; - const setNewGreetingHandle = await attachedContract.newSetGreet(newGreet, localConfig.gasLimit); + const setNewGreetingHandle = await attachedContract.newSetGreet(newGreet, localConfig.l1GasLimit); await setNewGreetingHandle.wait(1); const txHash = setNewGreetingHandle.hash; @@ -31,7 +32,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log("Multicall contract caller: ", txHash); console.log(`Contract said after new greeting: ${await attachedContract.newCallGreeter()}`); - await fs.writeFile(Buffer.txUseMultiCallContracts, txHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts, txHash); return txHash; } diff --git a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts index 5995db64d5..5447e7d380 100644 --- a/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts +++ b/packages/integration-tests/src/playbook/deploy/use-multitransferETH.ts @@ -1,30 +1,25 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer, Token, Wallets } from "../../entities"; +import { Buffer, Path, Token, Wallets } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironment) { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const firstToken = playbookRoot + Buffer.L2; - const secondToken = playbookRoot + Buffer.L2deposited; - const buffer = playbookRoot + Buffer.addressMultiTransferETH; const contractName = "TokenF2L2"; // insert the name of the contract you want to deploy - const contractAddress = await helper.getStringFromFile(buffer); + const contractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); //wallets, To const richWalletAddress = Wallets.richWalletAddress; const mainWalletAddress = Wallets.mainWalletAddress; - const secondWalletAddress = Wallets.secondWalletAddress; + const secondaryWalletAddress = Wallets.secondaryWalletAddress; // type of coin, contract - const etherAddress = Token.ETHER_Address; //ETH - const customTokenI = await helper.getStringFromFile(firstToken); - const customTokenII = await helper.getStringFromFile(secondToken); + const etherAddress = Token.addressETH; //ETH + const customTokenI = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + const customTokenII = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); // amount of funds const ethAmount = ethers.utils.parseEther("0.0001"); const customTokenIAmount = ethers.utils.parseUnits("0.01", 18); @@ -48,7 +43,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen to: contractAddress, token: token, amount, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); // await commitment @@ -60,7 +55,7 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen //call the deployed contract. const transferFromContract = await attachedContract.multiTransfer( - [richWalletAddress, mainWalletAddress, secondWalletAddress], + [richWalletAddress, mainWalletAddress, secondaryWalletAddress], [etherAddress, customTokenI, customTokenII], [ethAmount, customTokenIAmount, customTokenIIAmount] ); @@ -90,12 +85,12 @@ export default async function callMultiTransferETH(hre: HardhatRuntimeEnvironmen ); console.log( `balance of wallet 3 is: "${ethers.utils.formatUnits( - await provider.getBalance(secondWalletAddress, "latest", customTokenII), + await provider.getBalance(secondaryWalletAddress, "latest", customTokenII), 18 )}" Custom token II` ); - await fs.writeFile(Buffer.txMultiTransferETH, ethTransfer); - await fs.writeFile(Buffer.txMultiTransferCustomTokenI, customToken1Transfer); - await fs.writeFile(Buffer.txMultiTransferCustomTokenII, customToken2Transfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH, ethTransfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI, customToken1Transfer); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII, customToken2Transfer); } diff --git a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts index c98d397eaa..963d978ef0 100644 --- a/packages/integration-tests/src/playbook/deploy/use-paymaster.ts +++ b/packages/integration-tests/src/playbook/deploy/use-paymaster.ts @@ -1,20 +1,17 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import { Provider, utils, Wallet } from "zksync-web3"; import { localConfig } from "../../config"; -import { Buffer } from "../../entities"; +import { Buffer, Path } from "../../constants"; import { Helper } from "../../helper"; import type { HardhatRuntimeEnvironment } from "hardhat/types"; const helper = new Helper(); export default async function (hre: HardhatRuntimeEnvironment) { - const bufferRoute = "src/playbook/"; - - const PAYMASTER_ADDRESS = await helper.getStringFromFile(bufferRoute + Buffer.paymaster); - const TOKEN_ADDRESS = await helper.getStringFromFile(bufferRoute + Buffer.customToken); - const EMPTY_WALLET_PRIVATE_KEY = await helper.getStringFromFile(bufferRoute + Buffer.emptyWalletPrivateKey); + const PAYMASTER_ADDRESS = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const TOKEN_ADDRESS = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const EMPTY_WALLET_PRIVATE_KEY = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletPrivateKey); const provider = new Provider(localConfig.L2Network); const emptyWallet = new Wallet(EMPTY_WALLET_PRIVATE_KEY, provider); @@ -64,7 +61,7 @@ export default async function (hre: HardhatRuntimeEnvironment) { console.log(`Balance of the user after mint: ${await emptyWallet.getBalance(TOKEN_ADDRESS)}`); - await fs.writeFile(Buffer.paymasterTx, receipt.transactionHash); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx, receipt.transactionHash); console.log(`Transaction hash: ${receipt.transactionHash}`); return receipt.transactionHash; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts index 5860c7bc50..e93e06f5a6 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL1.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL1 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.L1; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployToL1`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployToL1`); - const deployedToken = await helper.getStringFromFile(bufferFile); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); console.log("The custom ERC20 token has been deployed to L1: ", Logger.textSeparator, deployedToken); return deployedToken; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts index 469ae20867..1a6a837493 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployERC20toL2.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployERC20toL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.L2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployToL2`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployToL2`); - const deployedToken = await helper.getStringFromFile(bufferFile); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); console.log("The custom ERC20 token has been deployed to L2: ", Logger.textSeparator, deployedToken); return deployedToken; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts index 934b175849..071cc1c88a 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployGreeterToL2.ts @@ -1,17 +1,15 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; let deployedContract: string; export const deployGreeterToL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.greeterL2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:greeter`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:greeter`); - deployedContract = await helper.getStringFromFile(bufferFile); + deployedContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); console.log("The Greeter contract has been deployed to L2: ", Logger.textSeparator, deployedContract); return deployedContract; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts index bded14535f..9f3b7ca499 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMulticallContracts.ts @@ -1,21 +1,17 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMulticallContracts = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFileRoot = playbookRoot + "/" + Buffer.addressMultiCallRoot; - const bufferFileMiddle = playbookRoot + "/" + Buffer.addressMultiCallMiddle; - const bufferFileCaller = playbookRoot + "/" + Buffer.addressMultiCallCaller; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:root`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:middle`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multicall:caller`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:root`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:middle`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multicall:caller`); - const multiCallRoot = await helper.getStringFromFile(bufferFileRoot); - const multiCallMiddle = await helper.getStringFromFile(bufferFileMiddle); - const multiCallCaller = await helper.getStringFromFile(bufferFileCaller); + const multiCallRoot = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + const multiCallMiddle = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); + const multiCallCaller = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); console.log( "Multicall contracts (Root, Middle and Caller) have been deployed to the address: ", diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts index f86b1a1e73..63c8145a42 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployMultitransferETH.ts @@ -1,15 +1,16 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployMultitransferETH = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.addressMultiTransferETH; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:multitransfer`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:multitransfer`); - const multiTransferContractETH = await helper.getStringFromFile(bufferFile); + const multiTransferContractETH = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.addressMultiTransferETH + ); console.log("The custom multitransfer contract ETH has been deployed to the address: ", multiTransferContractETH); diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts index ad59eb971a..cefbe8752e 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL1.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL1 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.NFTtoL1; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployNFTtoL1`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployNFTtoL1`); - const deployedNFT = await helper.getStringFromFile(bufferFile); + const deployedNFT = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1); console.log("The NFT has been deployed to L1: ", Logger.textSeparator, deployedNFT); return deployedNFT; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts index 25925e28b0..b3c8419c91 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployNFTtoL2.ts @@ -1,15 +1,13 @@ -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployNFTtoL2 = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook"; - const bufferFile = playbookRoot + "/" + Buffer.NFTtoL2; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deployNFTtoL2`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deployNFTtoL2`); - const deployedNFT = await helper.getStringFromFile(bufferFile); + const deployedNFT = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); console.log("The NFT has been deployed to L2: ", Logger.textSeparator, deployedNFT); return deployedNFT; diff --git a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts index d047685687..e8587a12c3 100644 --- a/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/deploy/deployViaPaymaster.ts @@ -1,17 +1,14 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const deployViaPaymaster = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const bufferPaymaster = playbookRoot + Buffer.paymaster; - const bufferCustomToken = playbookRoot + Buffer.paymaster; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:paymaster`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:paymaster`); - const paymasterAddress = await helper.getStringFromFile(bufferPaymaster); - const deployedToken = await helper.getStringFromFile(bufferCustomToken); + const paymasterAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const deployedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); console.log("The custom token has been deployed via Paymaster: ", deployedToken); console.log("The Paymaster transaction: ", paymasterAddress); diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts index f18724a450..01a043ad9c 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositERC20.ts @@ -1,17 +1,14 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); -const playbookRoot = "src/playbook"; -const bufferFile = playbookRoot + "/" + Buffer.L2deposited; export const depositERC20 = async function (sum = "0.5", tokenAddress: string, units = 18) { const deposit = await syncWallet.deposit({ @@ -20,18 +17,17 @@ export const depositERC20 = async function (sum = "0.5", tokenAddress: string, u amount: ethers.utils.parseUnits(sum, units), approveERC20: true, l2GasLimit: localConfig.l2GasLimit, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); - const txHash = deposit.hash; - await deposit.wait(1); - await deposit.waitL1Commit(1); const l2TokenAddress = await syncProvider.l2TokenAddress(tokenAddress); console.log("L2 token address ", l2TokenAddress); - await fs.writeFile(bufferFile, l2TokenAddress); - await helper.txHashLogger(Logger.deposit, txHash, "ERC20 token"); + const txHash = await deposit.waitFinalize(); + await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ERC20 token"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.L2deposited, l2TokenAddress); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts index d76f10f003..d19297b314 100644 --- a/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/deposit/depositETH.ts @@ -2,10 +2,10 @@ import * as ethers from "ethers"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Logger, Values } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; -export const depositEth = async function (sum = Values.txSumETH) { +export const depositEth = async function (sum = "0.000009") { const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); @@ -16,11 +16,10 @@ export const depositEth = async function (sum = Values.txSumETH) { amount: ethers.utils.parseEther(sum), l2GasLimit: localConfig.l2GasLimit, }); - - const txHash = deposit.hash; - await deposit.wait(1); - await helper.txHashLogger(Logger.deposit, txHash, "ETH"); + const txHash = await deposit.waitFinalize(); + await helper.logTransaction(Logger.deposit, txHash.transactionHash, "ETH"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthDeposit, txHash.transactionHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts index 13a1ab0ed3..5ca3dc6662 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferERC20.ts @@ -1,9 +1,8 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const transferERC20 = async function (sum: string, tokenAddress: string, tokenName?: string /*, units = 18*/) { @@ -11,20 +10,18 @@ export const transferERC20 = async function (sum: string, tokenAddress: string, const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const syncWallet2 = new zksync.Wallet(Wallets.secondWalletPrivateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthTransfer; + const syncWallet2 = new zksync.Wallet(Wallets.secondaryWalletPrivateKey, syncProvider, ethProvider); const transfer = await syncWallet.transfer({ to: syncWallet2.address, token: tokenAddress, amount: ethers.utils.parseEther(sum), - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.transfer, txHash, tokenName); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.transfer, txHash, tokenName); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts index 33ef9ed481..d6c6f1f437 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferETH.ts @@ -1,19 +1,16 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Values, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; -export const transferEth = async function (sum = Values.txSumETH, address: string = Wallets.mainWalletPrivateKey) { +export const transferEth = async function (sum = "0.000009", address: string = Wallets.mainWalletPrivateKey) { const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const syncWallet2 = new zksync.Wallet(address, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthTransfer; const transfer = await syncWallet.transfer({ to: syncWallet2.address, @@ -22,8 +19,8 @@ export const transferEth = async function (sum = Values.txSumETH, address: strin }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.transfer, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.transfer, txHash, "ETH"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts index c798cf6a61..f266a47bbe 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/transferFailedState.ts @@ -1,9 +1,8 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const transferFailedState = async function (tokenAddress: string, tokenName?: string) { @@ -12,19 +11,17 @@ export const transferFailedState = async function (tokenAddress: string, tokenNa const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const amount = ethers.utils.parseEther("1.0"); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.failedState; const transfer = await syncWallet.transfer({ to: "0x0000000000000000000000000000000000000000", token: tokenAddress, amount, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = transfer.hash; - await helper.txHashLogger(Logger.txFailedState, txHash, tokenName); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.txFailedState, txHash, tokenName); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.failedState, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts index f9f77d2e36..e58757066f 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useGreeter.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useGreeter = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBuffer = playbookRoot + Buffer.executeGreeterTx; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:greeter`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:greeter`); - const txGreeting = await helper.getStringFromFile(txBuffer); + const txGreeting = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); console.log("Execute the SetGreeting transaction: ", txGreeting); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts index 6abde94494..2a70065122 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultiCall.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultiCallContracts = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBufferUseMultiCall = playbookRoot + Buffer.txUseMultiCallContracts; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:multicall`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:multicall`); - const txUseMultiCallContracts = await helper.getStringFromFile(txBufferUseMultiCall); + const txUseMultiCallContracts = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); return txUseMultiCallContracts; }; diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts index 40ed959414..34143923fd 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/useMultitransferETH.ts @@ -1,19 +1,21 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const useMultitransferETH = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBufferETH = playbookRoot + Buffer.txMultiTransferETH; - const txBufferCustomTokenI = playbookRoot + Buffer.txMultiTransferCustomTokenI; - const txBufferCustomTokenII = playbookRoot + Buffer.txMultiTransferCustomTokenII; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:multitransfer`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:multitransfer`); - const txMultiTransferETH = await helper.getStringFromFile(txBufferETH); - const txMultiTransferCustomTokenI = await helper.getStringFromFile(txBufferCustomTokenI); - const txMultiTransferCustomTokenII = await helper.getStringFromFile(txBufferCustomTokenII); + const txMultiTransferETH = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); + const txMultiTransferCustomTokenI = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.txMultiTransferCustomTokenI + ); + const txMultiTransferCustomTokenII = await helper.readFile( + Path.absolutePathToBufferFiles, + Buffer.txMultiTransferCustomTokenII + ); console.log("The multi transfer transaction for ETH: ", txMultiTransferETH); console.log("The multi transfer transaction for the Custom token I: ", txMultiTransferCustomTokenI); diff --git a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts index 8c667be1c5..3cf2da7c6f 100644 --- a/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts +++ b/packages/integration-tests/src/playbook/scenarios/transfers/usePaymaster.ts @@ -1,15 +1,13 @@ -import { Buffer } from "../../../entities"; +import { Buffer, Path } from "../../../constants"; import { Helper } from "../../../helper"; export const usePaymaster = async function () { const helper = new Helper(); - const playbookRoot = "src/playbook/"; - const txBuffer = playbookRoot + Buffer.paymasterTx; - await helper.executeScript(`cd ${playbookRoot} && npm run compile`); - await helper.executeScript(`cd ${playbookRoot} && npm run deploy:use:paymaster`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run compile`); + await helper.executeScript(`cd ${Path.playbookRoot} && npm run deploy:use:paymaster`); - const txPaymaster = await helper.getStringFromFile(txBuffer); + const txPaymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); console.log("The Paymaster transaction: ", txPaymaster); diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts index 7bcb910033..ff9d874760 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20.ts @@ -1,9 +1,8 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") { @@ -12,8 +11,6 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txERC20Withdraw; const balance = await syncWallet.getBalance(tokenAddress); @@ -24,7 +21,7 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") amount: ethers.utils.parseEther(sum), token: tokenAddress, bridgeAddress: bridges.erc20L2, - // overrides: localConfig.gasLimit, + // overrides: localConfig.l1GasLimit, }); const txHash = withdrawL2.hash; @@ -36,8 +33,8 @@ export const withdrawERC20 = async function (tokenAddress: string, sum = "0.2") console.log(`Your balance is ${balanceAfter.toString()}`); - await helper.txHashLogger(Logger.withdraw, txHash, "Custom token"); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20Withdraw, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts index cf377733b6..68b1fdf6ab 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawERC20toOtherAddress.ts @@ -1,9 +1,8 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; export const withdrawERC20toOtherAddress = async function (tokenAddress: string, sum = "0.2") { @@ -12,8 +11,6 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); const bridges = await syncProvider.getDefaultBridgeAddresses(); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txERC20WithdrawOtherAddress; const balance = await syncWallet.getBalance(tokenAddress); @@ -24,7 +21,7 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, amount: ethers.utils.parseEther(sum), token: tokenAddress, bridgeAddress: bridges.erc20L2, - overrides: localConfig.gasLimit, + overrides: localConfig.l1GasLimit, }); const txHash = withdrawL2.hash; @@ -36,8 +33,8 @@ export const withdrawERC20toOtherAddress = async function (tokenAddress: string, console.log(`Your balance is ${balanceAfter.toString()}`); - await helper.txHashLogger(Logger.withdraw, txHash, "Custom token"); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.withdraw, txHash, "Custom token"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txERC20WithdrawOtherAddress, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts index 8d9a1e4bd7..8355f7bc1e 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETH.ts @@ -1,18 +1,15 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Values } from "../../../entities"; +import { Buffer, Logger, Path } from "../../../constants"; import { Helper } from "../../../helper"; -export const withdrawETH = async function (sum = Values.txSumETH) { +export const withdrawETH = async function (sum = "0.000009") { const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthWithdraw; const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, @@ -22,8 +19,8 @@ export const withdrawETH = async function (sum = Values.txSumETH) { const txHash = withdrawL2.hash; await withdrawL2.waitFinalize(); - await helper.txHashLogger(Logger.withdraw, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.withdraw, txHash, "ETH"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts index dc32bfd07d..e946974c44 100644 --- a/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts +++ b/packages/integration-tests/src/playbook/scenarios/withdrawal/withdrawETHtoOtherAddress.ts @@ -1,18 +1,15 @@ import * as ethers from "ethers"; -import { promises as fs } from "fs"; import * as zksync from "zksync-web3"; import { localConfig } from "../../../config"; -import { Buffer, Logger, Values, Wallets } from "../../../entities"; +import { Buffer, Logger, Path, Wallets } from "../../../constants"; import { Helper } from "../../../helper"; -export const withdrawETHtoOtherAddress = async function (sum = Values.txSumETH) { +export const withdrawETHtoOtherAddress = async function (sum = "0.000009") { const helper = new Helper(); const syncProvider = new zksync.Provider(localConfig.L2Network); const ethProvider = ethers.getDefaultProvider(localConfig.L1Network); const syncWallet = new zksync.Wallet(localConfig.privateKey, syncProvider, ethProvider); - const playbookRoot = "src/playbook/"; - const bufferFile = playbookRoot + Buffer.txEthWithdrawOtherAddress; const withdrawL2 = await syncWallet.withdraw({ token: zksync.utils.ETH_ADDRESS, @@ -23,8 +20,8 @@ export const withdrawETHtoOtherAddress = async function (sum = Values.txSumETH) const txHash = withdrawL2.hash; await withdrawL2.waitFinalize(); - await helper.txHashLogger(Logger.withdraw, txHash, "ETH"); - await fs.writeFile(bufferFile, txHash); + await helper.logTransaction(Logger.withdraw, txHash, "ETH"); + await helper.writeFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress, txHash); return txHash; }; diff --git a/packages/integration-tests/src/playbook/utils/getWallet.ts b/packages/integration-tests/src/playbook/utils/getWallet.ts index c956b5148e..cee3ccef70 100644 --- a/packages/integration-tests/src/playbook/utils/getWallet.ts +++ b/packages/integration-tests/src/playbook/utils/getWallet.ts @@ -1,7 +1,7 @@ import { getDefaultProvider, utils } from "ethers"; import { Provider, Wallet } from "zksync-web3"; -import { Wallets } from "../../entities"; +import { Wallets } from "../../constants"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export default async function (hre: any) { diff --git a/packages/integration-tests/src/provider.ts b/packages/integration-tests/src/provider.ts new file mode 100644 index 0000000000..1a31d6f666 --- /dev/null +++ b/packages/integration-tests/src/provider.ts @@ -0,0 +1,21 @@ +import { ethers } from "ethers"; +import { Provider } from "zksync-web3"; + +import type { BaseProvider } from "@ethersproject/providers/src.ts/base-provider"; + +const providerCacheL1: { [key: string]: BaseProvider } = {}; +const providerCacheL2: { [key: string]: Provider } = {}; + +export function getProviderForL2(network: string): Provider { + if (!providerCacheL2[network]) { + providerCacheL2[network] = new Provider(network); + } + return providerCacheL2[network]; +} + +export function getProviderForL1(network: string): BaseProvider { + if (!providerCacheL1[network]) { + providerCacheL1[network] = ethers.getDefaultProvider(network); + } + return providerCacheL1[network]; +} diff --git a/packages/integration-tests/tests/api/accounts.test.ts b/packages/integration-tests/tests/api/accounts.test.ts index 401b1c702d..4ac7e0c211 100644 --- a/packages/integration-tests/tests/api/accounts.test.ts +++ b/packages/integration-tests/tests/api/accounts.test.ts @@ -2,7 +2,7 @@ import * as request from "supertest"; import { environment } from "../../src/config"; import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/entities"; +import { Buffer, Path, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -10,7 +10,6 @@ describe("API module: Account", () => { jest.setTimeout(localConfig.standardTimeout); const helper = new Helper(); - const bufferFile = "src/playbook/"; let apiRoute: string; let response; const playbook = new Playbook(); @@ -25,13 +24,13 @@ describe("API module: Account", () => { //@id1704 it("Verify /api?module=account&action=balancemulti response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=account&action=balancemulti&address=${Wallets.richWalletAddress},${Wallets.mainWalletAddress}`; const richWalletBalance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2"); const mainWalletBalance = await helper.getBalanceETH(Wallets.mainWalletAddress, "L2"); const richWalletLowerCase = Wallets.richWalletAddress.toLowerCase(); const mainWalletLowerCase = Wallets.mainWalletAddress.toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result.length).toBeGreaterThan(1); @@ -48,10 +47,10 @@ describe("API module: Account", () => { //@id1703 it("Verify /api?module=account&action=balance response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const balance = await helper.getBalanceETH(Wallets.richWalletAddress, "L2"); apiRoute = `/api?module=account&action=balance&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -62,9 +61,9 @@ describe("API module: Account", () => { //@id1705 it("Verify /api?module=account&action=tokenbalance response", async () => { - await helper.retryTestAction(async () => { - apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + await helper.runRetriableTestAction(async () => { + apiRoute = `/api?module=account&action=tokenbalance&contractaddress=${Token.ERC20AddressETH}&address=${Wallets.richWalletAddress}`; + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -75,11 +74,11 @@ describe("API module: Account", () => { //@id1702 it("Verify /api?module=account&action=txlist response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlist&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result.length).toBeGreaterThan(1); @@ -99,7 +98,7 @@ describe("API module: Account", () => { expect(typeof response.body.result[0].isError).toStrictEqual("string"); expect(typeof response.body.result[0].txreceipt_status).toStrictEqual("string"); expect(typeof response.body.result[0].input).toStrictEqual("string"); - expect(typeof response.body.result[0].contractAddress).toBeTruthy(); // can be null + expect(typeof response.body.result[0].contractAddress).toBeTruthy(); expect(typeof response.body.result[0].cumulativeGasUsed).toStrictEqual("string"); expect(typeof response.body.result[0].gasUsed).toStrictEqual("string"); expect(typeof response.body.result[0].confirmations).toStrictEqual("string"); @@ -116,11 +115,11 @@ describe("API module: Account", () => { //@id1852 it("Verify /api?module=account&action=txlistinternal&address=", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -147,11 +146,11 @@ describe("API module: Account", () => { //@id1804 it("Verify /api?module=account&action=txlistinternal", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=account&action=txlistinternal&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=1`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -173,11 +172,11 @@ describe("API module: Account", () => { //@id1805 it("Verify /api?module=account&action=tokentx", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; - apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ETHER_ERC20_Address}&address=${Wallets.richWalletAddress}`; - response = await helper.performGETrequest(apiRoute); + apiRoute = `/api?module=account&action=tokentx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${Token.ERC20AddressETH}&address=${Wallets.richWalletAddress}`; + response = await helper.performBlockExplorerApiGetRequest(apiRoute); console.log(apiRoute); expect(response.status).toBe(200); @@ -212,12 +211,12 @@ describe("API module: Account", () => { //@id1806 it("Verify /api?module=account&action=tokennfttx", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { const blocks = await request(environment.blockExplorerAPI).get("/blocks"); const blockNumber = blocks.body.items[0].number; - const nftAddress = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); + const nftAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); apiRoute = `/api?module=account&action=tokennfttx&page=1&offset=10&sort=desc&endblock=${blockNumber}&startblock=0&contractaddress=${nftAddress}&address=${nftAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -246,9 +245,9 @@ describe("API module: Account", () => { //@id1807 it("Verify /api?module=account&action=getminedblocks", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=account&action=getminedblocks&page=1&offset=10&address=0x0000000000000000000000000000000000000000`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); diff --git a/packages/integration-tests/tests/api/addresses.test.ts b/packages/integration-tests/tests/api/addresses.test.ts index bcf615b88a..237f05be27 100644 --- a/packages/integration-tests/tests/api/addresses.test.ts +++ b/packages/integration-tests/tests/api/addresses.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, Wallets } from "../../src/entities"; +import { Buffer, Path, Token, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,7 +8,6 @@ describe("Address", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let contract: string; let token: string; @@ -28,10 +27,10 @@ describe("Address", () => { //@id1457 it("Verify deployed to L2 NFT via /address/{address}", async () => { - await helper.retryTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.NFTtoL2); + await helper.runRetriableTestAction(async () => { + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); apiRoute = `/address/${token}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual( @@ -51,11 +50,11 @@ describe("Address", () => { //@id1464 it("Verify the deployed Root contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -68,11 +67,11 @@ describe("Address", () => { //@id1465 it("Verify the deployed Middle contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallMiddle); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallMiddle); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -85,11 +84,11 @@ describe("Address", () => { //@id1466 it("Verify the deployed Caller contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ type: "contract" })); @@ -102,10 +101,10 @@ describe("Address", () => { //@id1476 it("Verify the deployed multitransfer contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ address: contract })); @@ -115,10 +114,10 @@ describe("Address", () => { //@id1449 it("Verify the deployed Greeter contract via /address/{address}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); apiRoute = `/address/${contract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toEqual(expect.objectContaining({ address: contract })); @@ -134,12 +133,12 @@ describe("Address", () => { //@id1510 it("Verify the transaction via /address/{address}/logs", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/address/${contract}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toEqual(expect.objectContaining({ address: contract })); @@ -175,14 +174,14 @@ describe("Address", () => { //@id1509 it("Verify the transaction via /address/{address}/transfers", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); - const customTokenAddress = await helper.getStringFromFile(bufferFile + Buffer.customToken); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); + const customTokenAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); apiRoute = `/address/${contract}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); @@ -203,9 +202,7 @@ describe("Address", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "30000000000000000" })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.meta).toStrictEqual(expect.objectContaining({ totalItems: 2 })); diff --git a/packages/integration-tests/tests/api/batches.test.ts b/packages/integration-tests/tests/api/batches.test.ts index 26dc85af5c..b0182d7b61 100644 --- a/packages/integration-tests/tests/api/batches.test.ts +++ b/packages/integration-tests/tests/api/batches.test.ts @@ -10,9 +10,9 @@ describe("Batches", () => { //@id1513 it("Verify the response via /batches", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/batches`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -48,12 +48,12 @@ describe("Batches", () => { //@id1514 //unstable due to null issue with timestamp it("Verify the response via /batches/{batchNumber}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/batches`; - const batches = await helper.performGETrequest(apiRoute); + const batches = await helper.performBlockExplorerApiGetRequest(apiRoute); const batchNumber = batches.body.items[0].number; apiRoute = apiRoute + `/${batchNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.number).toStrictEqual(batchNumber); diff --git a/packages/integration-tests/tests/api/blocks.test.ts b/packages/integration-tests/tests/api/blocks.test.ts index 6aabac5609..e0a6281c7b 100644 --- a/packages/integration-tests/tests/api/blocks.test.ts +++ b/packages/integration-tests/tests/api/blocks.test.ts @@ -10,9 +10,9 @@ describe("Blocks", () => { jest.setTimeout(localConfig.standardTimeout); //@id1511 it("Verify the response via /blocks", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/blocks`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -31,11 +31,11 @@ describe("Blocks", () => { //@id1512 //unstable on CI it("Verify the response via /blocks/{/blockNumber}", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/blocks/${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.number).toStrictEqual(blockNumber); @@ -65,11 +65,11 @@ describe("Blocks", () => { describe("/api?module=block", () => { //@id1700 it("Verify /api?module=block&action=getblockcountdown&blockno={block_number} response", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number + 1; apiRoute = `/api?module=block&action=getblockcountdown&blockno=${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -83,9 +83,9 @@ describe("Blocks", () => { //@id1699 it("Verify /api?module=block&action=getblocknobytime&closest=before×tamp={timestamp} response", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/api?module=block&action=getblocknobytime&closest=before×tamp=1635934550`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -96,11 +96,11 @@ describe("Blocks", () => { //@id1701 it("Verify /api?module=block&action=getblockreward&blockno={blockNumber} response", async () => { - await helper.retryTestAction(async () => { - const blocks = await helper.performGETrequest("/blocks"); + await helper.runRetriableTestAction(async () => { + const blocks = await helper.performBlockExplorerApiGetRequest("/blocks"); const blockNumber = blocks.body.items[0].number; apiRoute = `/api?module=block&action=getblockreward&blockno=${blockNumber}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); diff --git a/packages/integration-tests/tests/api/contracts.test.ts b/packages/integration-tests/tests/api/contracts.test.ts index dbff398343..4bfc593be2 100644 --- a/packages/integration-tests/tests/api/contracts.test.ts +++ b/packages/integration-tests/tests/api/contracts.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Wallets } from "../../src/entities"; +import { Buffer, Path, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,7 +8,6 @@ describe("API module: Contract", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let paymasterContract: string; let paymasterTx: string; @@ -24,13 +23,13 @@ describe("API module: Contract", () => { //@id1696 it("Verify /api?module=contract&action=getcontractcreation&contractaddresses={address1},{address2} response", async () => { - await helper.retryTestAction(async () => { - paymasterContract = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - paymasterTx = await helper.getStringFromFile(bufferFile + Buffer.paymasterDeployTx); - multicallCallerContract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallCaller); - multicallCallerTx = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + await helper.runRetriableTestAction(async () => { + paymasterContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + paymasterTx = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterDeployTx); + multicallCallerContract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); + multicallCallerTx = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/api?module=contract&action=getcontractcreation&contractaddresses=${paymasterContract},${multicallCallerContract}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ contractAddress: paymasterContract })); diff --git a/packages/integration-tests/tests/api/logs.test.ts b/packages/integration-tests/tests/api/logs.test.ts index 3a4bcd4bb2..626e14e1b4 100644 --- a/packages/integration-tests/tests/api/logs.test.ts +++ b/packages/integration-tests/tests/api/logs.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer } from "../../src/entities"; +import { Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -7,7 +7,6 @@ describe("API module: Logs", () => { jest.setTimeout(localConfig.standardTimeout); //works unstable without timeout const helper = new Helper(); - const bufferFile = "src/playbook/"; const playbook = new Playbook(); let apiRoute: string; let contractAddress: string; @@ -22,11 +21,11 @@ describe("API module: Logs", () => { //@id1808 it("Verify /api?module=logs&action=getLogs&page={page}&offset={offset}0&toBlock={toBlock}&fromBlock={fromBlock}&address={address} response", async () => { - await helper.retryTestAction(async () => { - contractAddress = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + await helper.runRetriableTestAction(async () => { + contractAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/api?module=logs&action=getLogs&page=1&offset=10&toBlock=10000&fromBlock=1&address=${contractAddress}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.result[0]).toStrictEqual(expect.objectContaining({ address: contractAddress })); diff --git a/packages/integration-tests/tests/api/stats.test.ts b/packages/integration-tests/tests/api/stats.test.ts index 5f2704ea35..1a8482f4cd 100644 --- a/packages/integration-tests/tests/api/stats.test.ts +++ b/packages/integration-tests/tests/api/stats.test.ts @@ -10,9 +10,9 @@ describe("Stats", () => { //@id1515 it("Verify the response via /stats", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/stats`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.lastSealedBatch).toStrictEqual("number"); diff --git a/packages/integration-tests/tests/api/tokens.test.ts b/packages/integration-tests/tests/api/tokens.test.ts index b708f03f21..b7d4b33cfa 100644 --- a/packages/integration-tests/tests/api/tokens.test.ts +++ b/packages/integration-tests/tests/api/tokens.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionsType, Wallets } from "../../src/entities"; +import { Buffer, Path, Token, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -8,24 +8,23 @@ describe("Tokens", () => { const helper = new Helper(); const playbook = new Playbook(); - const bufferFile = "src/playbook/"; let apiRoute: string; let l2Token: string; let txHash: string; let response; beforeAll(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.L2); + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); }); describe("/tokens", () => { //@id1508 it("Verify the response via /tokens", async () => { - await helper.retryTestAction(async () => { - const l2DepositedToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - const l1Token = await helper.getStringFromFile(bufferFile + Buffer.L1); + await helper.runRetriableTestAction(async () => { + const l2DepositedToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + const l1Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); apiRoute = `/tokens`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -53,9 +52,9 @@ describe("Tokens", () => { //@id1456 it("Verify deployed to L2 custom token via /tokens/{tokenAddress}", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/tokens/${l2Token}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual({ @@ -80,14 +79,14 @@ describe("Tokens", () => { //@id1448 it("Verify the custom ERC20 token transfer via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0].amount).toBe("10000000000000000"); expect(response.body.items[0].from).toBe(Wallets.richWalletAddress); - expect(response.body.items[0].to).toBe(Wallets.secondWalletAddress); + expect(response.body.items[0].to).toBe(Wallets.secondaryWalletAddress); expect(response.body.items[0].token).toEqual(expect.objectContaining({ l2Address: l2Token })); expect(response.body.items[0]).toEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toEqual(expect.objectContaining({ type: "transfer" })); @@ -96,13 +95,13 @@ describe("Tokens", () => { //@id1451 it("Verify the custom token includes paymaster transaction via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + await helper.runRetriableTestAction(async () => { + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + const paymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); @@ -115,14 +114,14 @@ describe("Tokens", () => { //id1803 it("Verify the response via /tokens/{address}/transfers", async () => { - await helper.retryTestAction(async () => { - l2Token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - const paymaster = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + await helper.runRetriableTestAction(async () => { + l2Token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + const paymaster = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); const apiRoute = `/tokens/${l2Token}/transfers?page=1&limit=10`; const decapitalizedTokenAddress = l2Token.toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); diff --git a/packages/integration-tests/tests/api/transactions.test.ts b/packages/integration-tests/tests/api/transactions.test.ts index cdf0d08f96..fd75925e97 100644 --- a/packages/integration-tests/tests/api/transactions.test.ts +++ b/packages/integration-tests/tests/api/transactions.test.ts @@ -1,5 +1,5 @@ import { localConfig } from "../../src/config"; -import { Buffer, Token, TransactionsStatus, TransactionsType, Wallets } from "../../src/entities"; +import { Buffer, Path, Token, TransactionStatus, TransactionsType, Wallets } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; @@ -7,7 +7,6 @@ describe("Transactions", () => { jest.setTimeout(localConfig.extendedTimeout); const helper = new Helper(); - const bufferFile = "src/playbook/"; const playbook = new Playbook(); let apiRoute: string; let contract: string; @@ -16,7 +15,7 @@ describe("Transactions", () => { let response; beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); await playbook.withdrawETHtoOtherAddress(); await playbook.withdrawERC20(customToken); await playbook.withdrawERC20toOtherAddress(customToken); @@ -36,12 +35,37 @@ describe("Transactions", () => { //@id1447 it("Verify transfer ETH L2-L2 via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1].from).toBe(Wallets.richWalletAddress); expect(response.body.items[1].to).toBe(Wallets.mainWalletAddress); expect(response.body.items[1].transactionHash).toBe(txHash); @@ -52,18 +76,39 @@ describe("Transactions", () => { //@id1459 it("Verify the ETH withdrawal via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); @@ -72,7 +117,7 @@ describe("Transactions", () => { expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: "withdrawal" })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: "refund" })); @@ -81,18 +126,39 @@ describe("Transactions", () => { //@id1461 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: "fee" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_ERC20_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: "transfer" })); @@ -101,7 +167,7 @@ describe("Transactions", () => { expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ amount: "9000000000000" })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: "withdrawal" })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: "refund" })); @@ -110,15 +176,13 @@ describe("Transactions", () => { //@id1463 it("Verify the custom token withdrawal via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - const l1Token = bufferFile + "/" + Buffer.L1; - const customTokenL1 = await helper.getStringFromFile(l1Token); - const l2Token = bufferFile + "/" + Buffer.L2deposited; - const customTokenL2 = await helper.getStringFromFile(l2Token); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20WithdrawOtherAddress); + await helper.runRetriableTestAction(async () => { + const customTokenL1 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); + const customTokenL2 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20WithdrawOtherAddress); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.items[0].amount).toStrictEqual("string"); @@ -127,19 +191,17 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -155,7 +217,7 @@ describe("Transactions", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.addressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: customTokenL2 })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); @@ -204,22 +266,20 @@ describe("Transactions", () => { expect(typeof response.body.items[3].amount).toStrictEqual("string"); expect(typeof response.body.items[3].blockNumber).toStrictEqual("number"); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[3].timestamp).toStrictEqual("string"); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[3]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[3]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[3]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -247,123 +307,343 @@ describe("Transactions", () => { describe("/transactions/{transactionHash}", () => { beforeAll(async () => { - const customToken = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); + const customToken = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); await playbook.transferFailedState(customToken); }); //@id1460 it("Verify the ETH withdrawal to the other address via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdrawOtherAddress); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdrawOtherAddress); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); expect(response.body.from).toBe(Wallets.richWalletAddress); expect(response.body.value).toBe("9000000000000"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1462 it("Verify the custom token withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txERC20Withdraw); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20Withdraw); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); expect(response.body.from).toBe(Wallets.richWalletAddress); + expect(typeof response.body.to).toStrictEqual("string"); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1458 it("Verify the ETH withdrawal via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthWithdraw); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthWithdraw); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.hash).toBe(txHash); expect(response.body.to).toBe("0x000000000000000000000000000000000000800A"); expect(response.body.from).toBe(Wallets.richWalletAddress); expect(response.body.value).toBe("9000000000000"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1478 it("Verify transaction for the ETH via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("101000000000000000"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1479 it("Verify transaction for the Custom Token I via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); - // expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })) //unstable on CI + expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1480 it("Verify transaction for the Custom Token II via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body.value).toBe("0"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1454 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); expect(response.body).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); + expect(typeof response.body.from).toStrictEqual("string"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1464:I --> @id1468 it("Verify transaction for the Root contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -371,15 +651,47 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1465:I --> @id1469 it("Verify transaction for the Middle contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -387,15 +699,47 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1466:I --> @id1470 it("Verify transaction for the Caller contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -403,15 +747,47 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(response.body).toStrictEqual( + expect.objectContaining({ to: "0x0000000000000000000000000000000000008006" }) + ); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id1471 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ hash: txHash })); @@ -419,22 +795,85 @@ describe("Transactions", () => { expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.to).toStrictEqual("string"); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual(expect.objectContaining({ revertReason: null })); + expect(typeof response.body.status).toStrictEqual("string"); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); //@id645 it("Verify the transactions with failed state via /transactions/{transactionHash}", async () => { - await helper.retryTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - txHash = await helper.getStringFromFile(bufferFile + Buffer.failedState); + await helper.runRetriableTestAction(async () => { + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.failedState); apiRoute = `/transactions/${txHash}?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.from).toStrictEqual(Wallets.richWalletAddress); expect(response.body.to).toStrictEqual(token); expect(response.body.hash).toStrictEqual(txHash); - expect(response.body.status).toStrictEqual(TransactionsStatus.failed); + expect(response.body.status).toStrictEqual(TransactionStatus.failed); + expect(response.body).toStrictEqual(expect.objectContaining({ value: "0" })); + expect(response.body).toStrictEqual(expect.objectContaining({ isL1Originated: false })); + expect(response.body).toStrictEqual(expect.objectContaining({ transactionIndex: 0 })); + expect(typeof response.body.data).toStrictEqual("string"); + expect(typeof response.body.fee).toStrictEqual("string"); + expect(typeof response.body.nonce).toStrictEqual("number"); + expect(typeof response.body.gasLimit).toStrictEqual("string"); + expect(typeof response.body.gasPrice).toStrictEqual("string"); + expect(typeof response.body.gasPerPubdata).toStrictEqual("string"); + expect(typeof response.body.maxFeePerGas).toStrictEqual("string"); + expect(typeof response.body.maxPriorityFeePerGas).toStrictEqual("string"); + expect(typeof response.body.blockNumber).toStrictEqual("number"); + expect(response.body.blockNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.l1BatchNumber).toStrictEqual("number"); + expect(response.body.l1BatchNumber).toBeGreaterThanOrEqual(0); + expect(typeof response.body.blockHash).toStrictEqual("string"); + expect(response.body.blockHash.length).toBe(66); + expect(typeof response.body.type).toStrictEqual("number"); + expect(response.body.type).toBeGreaterThanOrEqual(0); + expect(typeof response.body.receivedAt).toStrictEqual("string"); + expect(response.body.receivedAt.length).toBe(24); + expect(response.body).toStrictEqual(expect.objectContaining({ error: null })); + expect(response.body).toStrictEqual( + expect.objectContaining({ revertReason: "ERC20: transfer to the zero address" }) + ); + expect(typeof response.body.commitTxHash).toStrictEqual("string"); + expect(response.body.commitTxHash.length).toBe(66); + expect(typeof response.body.executeTxHash).toStrictEqual("string"); + expect(response.body.executeTxHash.length).toBe(66); + expect(typeof response.body.proveTxHash).toStrictEqual("string"); + expect(response.body.proveTxHash.length).toBe(66); + expect(typeof response.body.isL1BatchSealed).toStrictEqual("boolean"); + expect(typeof response.body.gasUsed).toStrictEqual("string"); }); }); }); @@ -447,28 +886,31 @@ describe("Transactions", () => { //@id1481 it("Verify transaction for the ETH via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferETH); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferETH); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -479,9 +921,7 @@ describe("Transactions", () => { expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -489,8 +929,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -498,12 +938,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -511,8 +949,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -525,22 +963,39 @@ describe("Transactions", () => { //@id1482 it("Verify transaction for the Custom tokenI via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - token = await helper.getStringFromFile(bufferFile + Buffer.L2); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenI); + await helper.runRetriableTestAction(async () => { + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenI); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -561,12 +1016,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -574,8 +1027,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -588,23 +1041,40 @@ describe("Transactions", () => { //@id1483 it("Verify transaction for the Custom tokenII via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - const tokenL1 = await helper.getStringFromFile(bufferFile + Buffer.L1); - token = await helper.getStringFromFile(bufferFile + Buffer.L2deposited); - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiTransferETH); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiTransferCustomTokenII); + await helper.runRetriableTestAction(async () => { + const tokenL1 = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2deposited); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiTransferETH); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiTransferCustomTokenII); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); + expect(response.body.items[0]).toStrictEqual( + expect.objectContaining({ + token: { + decimals: 18, + iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, + liquidity: 220000000000, + symbol: "ETH", + name: "Ether", + usdPrice: 1800, + }, + }) + ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: contract })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); @@ -625,12 +1095,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -638,8 +1106,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -652,13 +1120,13 @@ describe("Transactions", () => { //@id1452 it("Verify transaction through Paymaster via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - const paymasterAddress = await helper.getStringFromFile(bufferFile + Buffer.paymaster); - const emptyWallet = await helper.getStringFromFile(bufferFile + Buffer.emptyWalletAddress); - token = await helper.getStringFromFile(bufferFile + Buffer.customToken); - txHash = await helper.getStringFromFile(bufferFile + Buffer.paymasterTx); + await helper.runRetriableTestAction(async () => { + const paymasterAddress = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymaster); + const emptyWallet = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.emptyWalletAddress); + token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.customToken); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.paymasterTx); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: emptyWallet })); @@ -668,6 +1136,11 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: token })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.transfer })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ERC20" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { @@ -683,11 +1156,9 @@ describe("Transactions", () => { }) ); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: paymasterAddress })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -695,8 +1166,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -704,12 +1175,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ to: paymasterAddress })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[2]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[2]).toStrictEqual( @@ -717,8 +1186,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -731,11 +1200,11 @@ describe("Transactions", () => { //@id1455 it("Verify the transaction after SetGreeting execution via transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/transfers`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(typeof response.body.items[0].amount).toStrictEqual("string"); @@ -744,19 +1213,18 @@ describe("Transactions", () => { expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -768,22 +1236,20 @@ describe("Transactions", () => { expect(typeof response.body.items[1].amount).toStrictEqual("string"); expect(typeof response.body.items[1].blockNumber).toStrictEqual("number"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ isInternal: false })); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -810,28 +1276,31 @@ describe("Transactions", () => { //@id1472 it("Verify transaction for the Root contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallRoot); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallRoot); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -839,12 +1308,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -852,8 +1319,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -866,28 +1333,31 @@ describe("Transactions", () => { //@id1473 it("Verify transaction for the Middle contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallMiddle); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallMiddle); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -895,12 +1365,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -908,8 +1376,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -922,28 +1390,31 @@ describe("Transactions", () => { //@id1474 it("Verify transaction for the Caller contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.addressMultiCallRoot); - txHash = await helper.getStringFromFile(bufferFile + Buffer.txMultiCallCaller); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txMultiCallCaller); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -951,12 +1422,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -964,8 +1433,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -978,27 +1447,30 @@ describe("Transactions", () => { //@id1475 it("Verify transaction for the use multicall contract via /transactions/{transactionHash}/transfers", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txUseMultiCallContracts); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txUseMultiCallContracts); apiRoute = `/transactions/${txHash}/transfers?page=1&limit=10`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ from: Wallets.richWalletAddress })); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.ETHER_PULL_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ to: Token.pullAddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[0]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ type: TransactionsType.fee })); expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ fields: null })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ isInternal: false })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ tokenType: "ETH" })); + expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); + expect(typeof response.body.items[0].timestamp).toStrictEqual("string"); + expect(typeof response.body.items[0].amount).toStrictEqual("string"); expect(response.body.items[0]).toStrictEqual( expect.objectContaining({ token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1006,12 +1478,10 @@ describe("Transactions", () => { }, }) ); - expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.ETHER_PULL_Address })); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ from: Token.pullAddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ to: Wallets.richWalletAddress })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ transactionHash: txHash })); - expect(response.body.items[1]).toStrictEqual( - expect.objectContaining({ tokenAddress: Token.ETHER_ERC20_Address }) - ); + expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ tokenAddress: Token.ERC20AddressETH })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ type: TransactionsType.refund })); expect(response.body.items[1]).toStrictEqual(expect.objectContaining({ fields: null })); expect(response.body.items[1]).toStrictEqual( @@ -1019,8 +1489,8 @@ describe("Transactions", () => { token: { decimals: 18, iconURL: "https://assets.coingecko.com/coins/images/279/large/ethereum.png?1698873266", - l1Address: Token.ETHER_Address, - l2Address: Token.ETHER_ERC20_Address, + l1Address: Token.addressETH, + l2Address: Token.ERC20AddressETH, liquidity: 220000000000, symbol: "ETH", name: "Ether", @@ -1035,15 +1505,15 @@ describe("Transactions", () => { describe("/transactions/${txHash}/logs", () => { //@id1507 it("Verify the transaction via /transactions/{transactionHash}/logs", async () => { - await helper.retryTestAction(async () => { - contract = await helper.getStringFromFile(bufferFile + Buffer.greeterL2); - txHash = await helper.getStringFromFile(bufferFile + Buffer.executeGreeterTx); + await helper.runRetriableTestAction(async () => { + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.greeterL2); + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.executeGreeterTx); apiRoute = `/transactions/${txHash}/logs`; const decapitalizedAddress = apiRoute.slice(1).toLowerCase(); - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); - expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + expect(response.body.items[0]).toStrictEqual(expect.objectContaining({ address: Token.ERC20AddressETH })); expect(Array.isArray(response.body.items[0].topics)).toStrictEqual(true); expect(typeof response.body.items[0].data).toStrictEqual("string"); expect(typeof response.body.items[0].blockNumber).toStrictEqual("number"); @@ -1059,7 +1529,7 @@ describe("Transactions", () => { expect(typeof response.body.items[1].transactionIndex).toStrictEqual("number"); expect(typeof response.body.items[1].logIndex).toStrictEqual("number"); expect(typeof response.body.items[1].timestamp).toStrictEqual("string"); - expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ address: Token.ETHER_ERC20_Address })); + expect(response.body.items[2]).toStrictEqual(expect.objectContaining({ address: Token.ERC20AddressETH })); expect(Array.isArray(response.body.items[2].topics)).toStrictEqual(true); expect(typeof response.body.items[2].data).toStrictEqual("string"); expect(typeof response.body.items[2].blockNumber).toStrictEqual("number"); @@ -1087,9 +1557,9 @@ describe("Transactions", () => { describe("/transactions", () => { //@id1506 it("Verify the transaction via /transactions", async () => { - await helper.retryTestAction(async () => { + await helper.runRetriableTestAction(async () => { apiRoute = `/transactions`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(Array.isArray(response.body.items)).toStrictEqual(true); @@ -1151,10 +1621,10 @@ describe("Transactions", () => { describe("/api?module=transaction", () => { //@id1697 it("Verify /api?module=transaction&action=getstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=getstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); @@ -1165,10 +1635,10 @@ describe("Transactions", () => { //@id1698 it("Verify /api?module=transaction&action=gettxreceiptstatus response", async () => { - await helper.retryTestAction(async () => { - txHash = await helper.getStringFromFile(bufferFile + Buffer.txEthTransfer); + await helper.runRetriableTestAction(async () => { + txHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthTransfer); apiRoute = `/api?module=transaction&action=gettxreceiptstatus&txhash=${txHash}`; - response = await helper.performGETrequest(apiRoute); + response = await helper.performBlockExplorerApiGetRequest(apiRoute); expect(response.status).toBe(200); expect(response.body).toStrictEqual(expect.objectContaining({ status: "1" })); diff --git a/packages/integration-tests/tests/hooks/global.ts b/packages/integration-tests/tests/hooks/global.ts index 2512d8878f..3c4541d0aa 100644 --- a/packages/integration-tests/tests/hooks/global.ts +++ b/packages/integration-tests/tests/hooks/global.ts @@ -1,16 +1,14 @@ -import { Buffer } from "../../src/entities"; +import { Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import { Playbook } from "../../src/playbook/playbook"; export default async () => { const playbook = new Playbook(); const helper = new Helper(); - const bufferRoute = "src/playbook/"; await playbook.deployERC20toL2(); await playbook.deployERC20toL1(); await playbook.depositETH("0.0000001"); - const bufferFile = bufferRoute + Buffer.L1; - const token = await helper.getStringFromFile(bufferFile); + const token = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L1); await playbook.depositERC20("100", token, 18); }; diff --git a/packages/integration-tests/tests/ui/deposit.spec.ts b/packages/integration-tests/tests/ui/deposit.spec.ts new file mode 100644 index 0000000000..c2a3faf847 --- /dev/null +++ b/packages/integration-tests/tests/ui/deposit.spec.ts @@ -0,0 +1,49 @@ +import { expect, test } from "@playwright/test"; + +import { config } from "./config"; +import { BlockExplorer, Buffer, Path, Wallets } from "../../src/constants"; +import { Helper } from "../../src/helper"; + +import type { Locator } from "@playwright/test"; + +const helper = new Helper(); +let url: string; +let depositTxHash: string; +let initiatorAddress: string; +let hash, initiatorAddressElement, ethValue, erc20Value: Locator; + +//@id1660 +test("Check Deposit ETH transaction on BE", async ({ page }) => { + depositTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txEthDeposit); + url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; + initiatorAddress = Wallets.richWalletAddress; + + await page.goto(url); + + hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + initiatorAddressElement = await page.locator(`text=${initiatorAddress}`).first(); + ethValue = await page.locator(`text=0.0000001`).first(); + + await expect(hash).toBeVisible(config.defaultTimeout); + await expect(ethValue).toBeVisible(config.defaultTimeout); + await expect(initiatorAddressElement).toBeVisible(config.defaultTimeout); +}); + +//@id1681 +test("Check on BE Deposit the custom ERC-20 token", async ({ page }) => { + depositTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.txERC20Deposit); + url = BlockExplorer.baseUrl + `/tx/${depositTxHash}` + BlockExplorer.localNetwork; + initiatorAddress = Wallets.richWalletAddress; + + await page.goto(url); + + hash = await page.locator(`//*[text()="Transaction Hash"]/..//..//*[text()="${depositTxHash}"]`).first(); + initiatorAddressElement = await page.locator( + `//*[text()="From"]/..//*[text()="L1"]/..//*[text()="0x36615Cf349d...c049"]` + ); + erc20Value = await page.locator(`//*[text()="0x36615Cf349d...c049"]/..//..//*[text()="100"]`); + + await expect(hash).toBeVisible(config.defaultTimeout); + await expect(erc20Value).toBeVisible(config.defaultTimeout); + await expect(initiatorAddressElement).toBeVisible(config.defaultTimeout); +}); diff --git a/packages/integration-tests/tests/ui/multiCall.spec.ts b/packages/integration-tests/tests/ui/multiCall.spec.ts index 38e723834d..e97a9c871f 100644 --- a/packages/integration-tests/tests/ui/multiCall.spec.ts +++ b/packages/integration-tests/tests/ui/multiCall.spec.ts @@ -1,23 +1,20 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/entities"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let contract: string; let element: Locator; let selector: string; //@id1684 test("Check Multicall - Caller contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallCaller; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -32,8 +29,7 @@ test("Check Multicall - Caller contract address", async ({ page }) => { //@id1690 test("Check Multicall - Middle contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallMiddle; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallCaller); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -48,8 +44,7 @@ test("Check Multicall - Middle contract address", async ({ page }) => { //@id1691 test("Check Multicall - Root contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiCallRoot; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.addressMultiCallRoot); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/nft.spec.ts b/packages/integration-tests/tests/ui/nft.spec.ts index 2e301ed232..7ca4ee2763 100644 --- a/packages/integration-tests/tests/ui/nft.spec.ts +++ b/packages/integration-tests/tests/ui/nft.spec.ts @@ -1,22 +1,19 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer } from "../../src/entities"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let contract: string; let element: Locator; //@id1658 test("Check the L2 NFT contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.NFTtoL2; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL2); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; @@ -30,8 +27,7 @@ test("Check the L2 NFT contract address", async ({ page }) => { //@id1657 test("Check the L1 NFT contract address", async ({ page }) => { - bufferFile = bufferRoute + Buffer.NFTtoL1; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.NFTtoL1); url = BlockExplorer.baseUrl + BlockExplorer.localNetwork; const targetUrl = BlockExplorer.baseUrl + `/address/${contract}`; diff --git a/packages/integration-tests/tests/ui/transactions.spec.ts b/packages/integration-tests/tests/ui/transactions.spec.ts index 74cff4083c..6369fd3b82 100644 --- a/packages/integration-tests/tests/ui/transactions.spec.ts +++ b/packages/integration-tests/tests/ui/transactions.spec.ts @@ -1,25 +1,21 @@ import { expect, test } from "@playwright/test"; import { config } from "./config"; -import { BlockExplorer, Buffer, Token, Values, Wallets } from "../../src/entities"; +import { BlockExplorer, Buffer, Path } from "../../src/constants"; import { Helper } from "../../src/helper"; import type { Locator } from "@playwright/test"; -const bufferRoute = "src/playbook/"; const helper = new Helper(); let url: string; -let bufferFile; let failedTxHash: string; let contract: string; -let transaction: string; let element: Locator; let selector: string; //@id1656 test("Verify failed tx", async ({ page }) => { - bufferFile = bufferRoute + Buffer.failedState; - failedTxHash = await helper.getStringFromFile(bufferFile); + failedTxHash = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.failedState); url = BlockExplorer.baseUrl + `/tx/${failedTxHash}` + BlockExplorer.localNetwork; await page.goto(url); @@ -32,8 +28,7 @@ test("Verify failed tx", async ({ page }) => { //@id1655 test("Verify deployed the own ERC20 token contract", async ({ page }) => { - bufferFile = bufferRoute + Buffer.L2; - contract = await helper.getStringFromFile(bufferFile); + contract = await helper.readFile(Path.absolutePathToBufferFiles, Buffer.L2); url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork; await page.goto(url); @@ -43,86 +38,3 @@ test("Verify deployed the own ERC20 token contract", async ({ page }) => { await expect(element).toBeVisible(config.extraTimeout); }); - -//@id1682 -test(" Check on BE Transfer ETH token via Portal", async ({ page }) => { - bufferFile = bufferRoute + Buffer.txEthWithdraw; - transaction = await helper.getStringFromFile(bufferFile); - url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork; - - await page.goto(url); - //Check transaction hash - selector = `text=${transaction}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - //Check address of sender - selector = `text=${Wallets.richWalletAddress}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - //Check address of receiver - selector = `text=${Token.ETHER_ERC20_Address}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - - //Check transaction amount - selector = `text=${Values.txSumETH}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); -}); - -//@id1680 -test(" Check on BE Transfer custom ERC-20 token via Portal", async ({ page }) => { - bufferFile = bufferRoute + Buffer.txMultiTransferCustomTokenI; - transaction = await helper.getStringFromFile(bufferFile); - const bufferFileToAdress = bufferRoute + Buffer.L2; - const adressTo = await helper.getStringFromFile(bufferFileToAdress); - url = BlockExplorer.baseUrl + `/tx/${transaction}` + BlockExplorer.localNetwork; - - await page.goto(url); - //Check transaction hash - selector = `text=${transaction}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - //Check address of receiver - selector = `text=${Wallets.richWalletAddress}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - //Check address of receiver - selector = `text=${adressTo}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - - //Check transaction amount - selector = `text= 1 `; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); -}); - -//@id1683 -test("Check on BE contract that makes multiple transfers based on stored/retrieved ETH + ERC20", async ({ page }) => { - bufferFile = bufferRoute + Buffer.addressMultiTransferETH; - contract = await helper.getStringFromFile(bufferFile); - - const bufferFileAddress = bufferRoute + Buffer.txMultiTransferETH; - const txAddress = await helper.getStringFromFile(bufferFileAddress); - url = BlockExplorer.baseUrl + `/address/${contract}` + BlockExplorer.localNetwork; - - await page.goto(url); - //Check contract address - selector = `text=${contract}`; - element = await page.locator(selector).first(); - - await expect(element).toBeVisible(config.extraTimeout); - //Check transaction hash - selector = `text=${txAddress}`; - element = await page.locator(selector).first(); - await expect(element).toBeVisible(config.extraTimeout); -});