diff --git a/.github/workflows/capsule-cypress-nightly.yml b/.github/workflows/capsule-cypress-nightly.yml index e9f0604e5..d0be1106d 100644 --- a/.github/workflows/capsule-cypress-nightly.yml +++ b/.github/workflows/capsule-cypress-nightly.yml @@ -12,7 +12,6 @@ jobs: runs-on: ubuntu-latest env: GO111MODULE: 'on' - GOPROXY: ${{ secrets.GO_PROXY }} steps: ####### ## Setup langs diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index dafd748c0..f269f718b 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -14,7 +14,6 @@ jobs: if: ${{ github.event_name == 'pull_request' }} env: GO111MODULE: 'on' - GOPROXY: ${{ secrets.GO_PROXY }} steps: ####### ## Setup langs diff --git a/apps/explorer-e2e/cypress.config.js b/apps/explorer-e2e/cypress.config.js index bb5505737..3809d21c9 100644 --- a/apps/explorer-e2e/cypress.config.js +++ b/apps/explorer-e2e/cypress.config.js @@ -15,6 +15,8 @@ module.exports = defineConfig({ videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', chromeWebSecurity: false, + viewportWidth: 1440, + viewportHeight: 900, }, env: { environment: 'CUSTOM', diff --git a/apps/simple-trading-app-e2e/cypress.config.js b/apps/simple-trading-app-e2e/cypress.config.js index 5d4f4da90..1436e587c 100644 --- a/apps/simple-trading-app-e2e/cypress.config.js +++ b/apps/simple-trading-app-e2e/cypress.config.js @@ -15,5 +15,7 @@ module.exports = defineConfig({ videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', chromeWebSecurity: false, + viewportWidth: 1440, + viewportHeight: 900, }, }); diff --git a/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts index 1b9dc07f9..333ca44b2 100644 --- a/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts +++ b/apps/simple-trading-app-e2e/src/integration/market-selector.test.ts @@ -42,8 +42,8 @@ describe('market selector', () => { .find('[role="button"]') .should('have.length', 1); cy.get('input[placeholder="Search"]').clear(); - cy.get('input[placeholder="Search"]').type('a'); - const filtered = markets.filter((market) => market.name.match(/a/i)); + cy.get('input[placeholder="Search"]').type('app'); + const filtered = markets.filter((market) => market.name.match(/app/i)); cy.getByTestId('market-pane') .children() .find('[role="button"]') @@ -76,7 +76,6 @@ describe('market selector', () => { .children() .find('[role="button"]') .should('have.length', markets.length); - cy.pause(); cy.getByTestId('dialog-close').click(); cy.get('input[placeholder="Search"]').should( 'have.value', diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 827845f24..5de37bc16 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -71,7 +71,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "120687.60294909203186805", + "locked_amount": "120450.26235752800414383", "deposits": [ { "amount": "129999.45", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "61605.4975572212290407", + "locked_amount": "61372.6885461730976664", "deposits": [ { "amount": "97499.58", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "84204.0794152667057160273426", + "locked_amount": "83885.86968996291364071230136", "deposits": [ { "amount": "135173.4239508", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "25916.368952284834442322", + "locked_amount": "25818.43022173346529338", "deposits": [ { "amount": "32499.86", @@ -620,7 +620,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8435.52660747719195897", + "locked_amount": "8403.648501057666105483", "deposits": [ { "amount": "10833.29", @@ -708,7 +708,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "13420.127094655797", + "locked_amount": "13297.7850430253625", "deposits": [ { "amount": "15000", @@ -794,7 +794,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "179856.049568108351", - "locked_amount": "1715358.109875174368620276", + "locked_amount": "1710040.653982735209492448", "deposits": [ { "amount": "1852091.69", @@ -1846,7 +1846,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "19238.601152747179372649", - "locked_amount": "12143.787034497502163478850106205", + "locked_amount": "11987.514524408138935750336335075", "deposits": [ { "amount": "2833.333333", @@ -3330,8 +3330,8 @@ "tranche_id": 10, "tranche_start": "2021-07-15T23:37:11.000Z", "tranche_end": "2021-07-15T23:37:11.000Z", - "total_added": "3904968.150000000000000001", - "total_removed": "3896778.640000000000000001", + "total_added": "4170968.150000000000000001", + "total_removed": "4162778.640000000000000001", "locked_amount": "0", "deposits": [ { @@ -3339,6 +3339,11 @@ "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", "tx": "0x167fe6c654897398dcfdab9305133b4410b15bac8f5a30bb1260a94a14a65aad" }, + { + "amount": "266000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0x38ac30c041395b629839409fb10385426997cf40be0e3026dd726e7c77e019cc" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -3786,6 +3791,11 @@ "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", "tx": "0x873061bbe5702251e087833b87033296fef9c6fb4f6c2be7586e1e74e20a4f52" }, + { + "amount": "266000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tx": "0x5b5515073f03593ae5cddd66030154af5847aedbd680835bbc1998a168e74699" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4177,6 +4187,12 @@ "tranche_id": 10, "tx": "0x167fe6c654897398dcfdab9305133b4410b15bac8f5a30bb1260a94a14a65aad" }, + { + "amount": "266000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0x38ac30c041395b629839409fb10385426997cf40be0e3026dd726e7c77e019cc" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4281,6 +4297,12 @@ "tranche_id": 10, "tx": "0x873061bbe5702251e087833b87033296fef9c6fb4f6c2be7586e1e74e20a4f52" }, + { + "amount": "266000", + "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", + "tranche_id": 10, + "tx": "0x5b5515073f03593ae5cddd66030154af5847aedbd680835bbc1998a168e74699" + }, { "amount": "30000", "user": "0xb2d6DEC77558Cf8EdB7c428d23E70Eab0688544f", @@ -4372,8 +4394,8 @@ "tx": "0xac16a4ce688d40a482a59914d68c3a676592f8804ee8f0781b66a4ba5ccfbdfc" } ], - "total_tokens": "745651", - "withdrawn_tokens": "745651", + "total_tokens": "1011651", + "withdrawn_tokens": "1011651", "remaining_tokens": "0" }, { @@ -5393,9 +5415,9 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "24284.000000000000000003", - "total_removed": "6875.88980798578", - "locked_amount": "3376.2614414003058740004170970319634705", + "total_added": "24344.000000000000000003", + "total_removed": "7424.31284562443", + "locked_amount": "3317.87584195839735528040887395357686461", "deposits": [ { "amount": "25", @@ -5862,6 +5884,11 @@ "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", "tx": "0x8e664532cfa2031eb5f6ce7c99cd673fa767599654a35b73d76407ed46763ad4" }, + { + "amount": "60", + "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", + "tx": "0x23fdff0f268bba36817cb496454cbc4be34306eaaaf330d5d26134849c480153" + }, { "amount": "75", "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -9084,6 +9111,11 @@ "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", "tx": "0x4c4e0fd7a8adbad24d6cc6e8fdf4f832ac9a39b2a04b954ec0d77e36a79c0e90" }, + { + "amount": "548.42303763865", + "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", + "tx": "0x48c16186c1e0021ee4b7194df991c93ec3a26971d009a9a3aaaec67c0abc89e9" + }, { "amount": "4.429693048", "user": "0xc5467213593778E528f0eB8117cc7AFBC5b7491b", @@ -10086,12 +10118,25 @@ "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", "tranche_id": 11, "tx": "0x8e664532cfa2031eb5f6ce7c99cd673fa767599654a35b73d76407ed46763ad4" + }, + { + "amount": "60", + "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", + "tranche_id": 11, + "tx": "0x23fdff0f268bba36817cb496454cbc4be34306eaaaf330d5d26134849c480153" } ], - "withdrawals": [], - "total_tokens": "575", - "withdrawn_tokens": "0", - "remaining_tokens": "575" + "withdrawals": [ + { + "amount": "548.42303763865", + "user": "0x44d145E145B7811ad309032D4c5CdeB1bf044719", + "tranche_id": 11, + "tx": "0x48c16186c1e0021ee4b7194df991c93ec3a26971d009a9a3aaaec67c0abc89e9" + } + ], + "total_tokens": "635", + "withdrawn_tokens": "548.42303763865", + "remaining_tokens": "86.57696236135" }, { "address": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", @@ -15925,7 +15970,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "106452.6400159857469", - "locked_amount": "2660409.42081862296035011689", + "locked_amount": "2652238.43698016889396750676", "deposits": [ { "amount": "1998.95815", @@ -16659,8 +16704,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "62889.84066484668888", - "locked_amount": "14657898.8329277585456883041909973431305758", + "total_removed": "63288.646809993954255", + "locked_amount": "14629073.3850061841914328106732955796688294", "deposits": [ { "amount": "16249.93", @@ -17209,6 +17254,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x148f389a5771abdc96c5a51c1fc0e306d135763c60f6839db6763690022a1a36" }, + { + "amount": "398.806145147265375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x4961efbe6ce942c38f74c5cbf8a5c7f8f6586c1bda1df0a17c7a1fd80aae6905" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17411,6 +17461,12 @@ "tranche_id": 2, "tx": "0x148f389a5771abdc96c5a51c1fc0e306d135763c60f6839db6763690022a1a36" }, + { + "amount": "398.806145147265375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x4961efbe6ce942c38f74c5cbf8a5c7f8f6586c1bda1df0a17c7a1fd80aae6905" + }, { "amount": "579.636872035866225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -17551,8 +17607,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "13652.2521999360072", - "remaining_tokens": "181346.9153000639928" + "withdrawn_tokens": "14051.058345083272575", + "remaining_tokens": "180948.109154916727425" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -18991,8 +19047,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2413723.131389663831937297", - "locked_amount": "7880269.64303812390931654596122858", + "total_removed": "2414153.780525405655617797", + "locked_amount": "7853521.23058973302728403033753401", "deposits": [ { "amount": "129284.449", @@ -19276,6 +19332,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x5b2ba568e3f60b624456972f011948b6870274b94ddba2f11eb876b4e875be1a" }, + { + "amount": "430.6491357418236805", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x63919ba0a519b04dfe5a5b222e5952117f1cdbb1e6194ae85b22a4ed8cef6fa5" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -21004,6 +21065,12 @@ "tranche_id": 3, "tx": "0x5b2ba568e3f60b624456972f011948b6870274b94ddba2f11eb876b4e875be1a" }, + { + "amount": "430.6491357418236805", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x63919ba0a519b04dfe5a5b222e5952117f1cdbb1e6194ae85b22a4ed8cef6fa5" + }, { "amount": "509.31853983395369725", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -22350,8 +22417,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "164980.154441085289241", - "remaining_tokens": "194143.315133914710759" + "withdrawn_tokens": "165410.8035768271129215", + "remaining_tokens": "193712.6659981728870785" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -23414,8 +23481,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1543188.041113165491270727", - "locked_amount": "2796638.79189818404440572191528324", + "total_removed": "1572374.955637071973431516", + "locked_amount": "2786070.33236677382072939102631165", "deposits": [ { "amount": "552496.6455", @@ -23569,6 +23636,16 @@ "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", "tx": "0x9c4cfa505550e13a41c2eb84a767412539ccae45bb280b5235423aadce942f2e" }, + { + "amount": "4864.10259512983202665", + "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", + "tx": "0x36fed3740bfbe979fd84ff55a1f65310eaf83047b27a9dc5516e083acfcc3b3f" + }, + { + "amount": "24322.811928776650134139", + "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", + "tx": "0xc391f34bee2ee3186396191a8828e498e817ec73ebde827b525322561d6c10ac" + }, { "amount": "4089.266768653121589", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -24191,6 +24268,12 @@ } ], "withdrawals": [ + { + "amount": "4864.10259512983202665", + "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", + "tranche_id": 4, + "tx": "0x36fed3740bfbe979fd84ff55a1f65310eaf83047b27a9dc5516e083acfcc3b3f" + }, { "amount": "3536.43115201266299695", "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", @@ -24223,8 +24306,8 @@ } ], "total_tokens": "92082.572555", - "withdrawn_tokens": "42713.498699646151249", - "remaining_tokens": "49369.073855353848751" + "withdrawn_tokens": "47577.60129477598327565", + "remaining_tokens": "44504.97126022401672435" }, { "address": "0x1dC9B91DE003fd503F25cB5d114cf0fc68F7aFe6", @@ -24252,6 +24335,12 @@ } ], "withdrawals": [ + { + "amount": "24322.811928776650134139", + "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", + "tranche_id": 4, + "tx": "0xc391f34bee2ee3186396191a8828e498e817ec73ebde827b525322561d6c10ac" + }, { "amount": "17683.07845319664597116", "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", @@ -24290,8 +24379,8 @@ } ], "total_tokens": "460415.072915097", - "withdrawn_tokens": "213567.593206108177102902", - "remaining_tokens": "246847.479708988822897098" + "withdrawn_tokens": "237890.405134884827237041", + "remaining_tokens": "222524.667780212172762959" }, { "address": "0xd66e4853c0880df150e7329974715BFC8d2da47D", @@ -24615,7 +24704,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "279.2296426169", - "locked_amount": "421557.080277297961550599391172", + "locked_amount": "420262.3411807600824310398427194", "deposits": [ { "amount": "3000", @@ -50413,7 +50502,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "36329.8823647506377", + "total_removed": "36852.7133578316377", "locked_amount": "0", "deposits": [ { @@ -54678,6 +54767,21 @@ "user": "0x5cce57661D758497446B57592D31667aafd60465", "tx": "0x8d9b31eaaecaa4f74f05f93d33e61d0691eba3a6f23a9033dbfcaeca1c9a00c4" }, + { + "amount": "250", + "user": "0x57a88037954e15AFFDf9bc29097e0B5f5A1BfF35", + "tx": "0x3da3cd5b323439c576ad7a3410d833da0da994ee652b29dd751a4c0edbf0ca99" + }, + { + "amount": "250", + "user": "0x5f3Bce4B242d00ED748d48172C1f2D47A0bcB19B", + "tx": "0xc06577f7fd53a100da581edbc8231a870d7b148329c8aa250eb942473004e5e6" + }, + { + "amount": "22.830993081", + "user": "0xe627552C6338855983a147fa5235E5D92a3C2891", + "tx": "0x3c75d0f2db07e4b2c54411e3d1a6124e63bc0f99ca4d171bd8679158aee3e698" + }, { "amount": "60.4448387275", "user": "0xEe3183EcE9ee7d73Fb7bA7F4eB262A2dE68C42B0", @@ -56736,6 +56840,12 @@ } ], "withdrawals": [ + { + "amount": "22.830993081", + "user": "0xe627552C6338855983a147fa5235E5D92a3C2891", + "tranche_id": 6, + "tx": "0x3c75d0f2db07e4b2c54411e3d1a6124e63bc0f99ca4d171bd8679158aee3e698" + }, { "amount": "24.17784646", "user": "0xe627552C6338855983a147fa5235E5D92a3C2891", @@ -56756,8 +56866,8 @@ } ], "total_tokens": "100", - "withdrawn_tokens": "77.169006919", - "remaining_tokens": "22.830993081" + "withdrawn_tokens": "100", + "remaining_tokens": "0" }, { "address": "0x2394462d77c51A174D912E229d426917051af04F", @@ -69757,10 +69867,17 @@ "tx": "0xe32a466fc780a0fb3fd84a804f622931ebfaf3f428bff0dc6d141270410e75f8" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x5f3Bce4B242d00ED748d48172C1f2D47A0bcB19B", + "tranche_id": 6, + "tx": "0xc06577f7fd53a100da581edbc8231a870d7b148329c8aa250eb942473004e5e6" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x57a88037954e15AFFDf9bc29097e0B5f5A1BfF35", @@ -69772,10 +69889,17 @@ "tx": "0xe32a466fc780a0fb3fd84a804f622931ebfaf3f428bff0dc6d141270410e75f8" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x57a88037954e15AFFDf9bc29097e0B5f5A1BfF35", + "tranche_id": 6, + "tx": "0x3da3cd5b323439c576ad7a3410d833da0da994ee652b29dd751a4c0edbf0ca99" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x949ECa8174BBa367901e9a195B77B2eA7d862c43", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 1d41d76ec..207e5aba5 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "37.074508498224257", + "locked_amount": "36.800409056316585", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "270.58154807204466", + "locked_amount": "267.5664542110604", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 0a0b6b2d2..3c46339a7 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "248.4430577752410060002459832255200406", + "locked_amount": "245.674653411973640000243242231100964", "deposits": [ { "amount": "1000", diff --git a/apps/stats-e2e/cypress.config.js b/apps/stats-e2e/cypress.config.js index 9070d1a83..dd9c84416 100644 --- a/apps/stats-e2e/cypress.config.js +++ b/apps/stats-e2e/cypress.config.js @@ -15,5 +15,7 @@ module.exports = defineConfig({ videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', chromeWebSecurity: false, + viewportWidth: 1440, + viewportHeight: 900, }, }); diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js index 0a2bcad52..59465a683 100644 --- a/apps/token-e2e/cypress.config.js +++ b/apps/token-e2e/cypress.config.js @@ -14,6 +14,8 @@ module.exports = defineConfig({ videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', chromeWebSecurity: false, + viewportWidth: 1440, + viewportHeight: 900, }, env: { ethProviderUrl: 'http://localhost:8545/', diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/token-e2e/src/integration/flow/staking-flow.cy.js index 46d5618db..e9e84e398 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -1,28 +1,44 @@ -const pageSpinner = 'splash-loader'; -const menuBar = 'nav'; -const validatorList = '[data-testid="node-list-item-name"]'; -const removeStakeRadioButton = '[data-testid="remove-stake-radio"]'; -const tokenAmountInputBox = '[data-testid="token-amount-input"]'; -const tokenSubmitButton = '[data-testid="token-input-submit-button"]'; +/// +const stakeValidatorList = '[data-testid="node-list-item-name"]'; +const stakeValidatorWithinList = '[data-testid="node-list-item"]'; +const stakeRemoveStakeRadioButton = '[data-testid="remove-stake-radio"]'; +const stakeTokenAmountInputBox = '[data-testid="token-amount-input"]'; +const stakeTokenSubmitButton = '[data-testid="token-input-submit-button"]'; const stakeNextEpochValue = '[data-testid="stake-next-epoch"]'; -const vegaWalletContainer = '[data-testid="vega-wallet"]'; - +const stakeThisEpochValue = '[data-testid="stake-this-epoch"]'; +const stakeAddStakeRadioButton = '[data-testid="add-stake-radio"]'; +const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]'; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); +const vegaWalletAssociatedBalance = '[data-testid="currency-value"]'; +const vegaWalletUnstakedBalance = + '[data-testid="vega-wallet-balance-unstaked"]'; +const vegaWalletStakedBalances = + '[data-testid="vega-wallet-balance-staked-validators"]'; +const vegaWalletThisEpochBalances = + '[data-testid="vega-wallet-balance-this-epoch"]'; +const vegaWalletNextEpochBalances = + '[data-testid="vega-wallet-balance-next-epoch"]'; +const ethWalletAssociatedBalances = + '[data-testid="eth-wallet-associated-balances"]'; +const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]'; +const ethWalletContainer = '[data-testid="ethereum-wallet"]'; +const txTimeout = { timeout: 40000 }; +const epochTimeout = { timeout: 10000 }; context('Staking Flow - with eth and vega wallets connected', function () { before('visit staking tab and connect vega wallet', function () { cy.vega_wallet_import(); cy.visit('/'); - cy.get(menuBar, { timeout: 20000 }).should('be.visible'); + cy.verify_page_header('The $VEGA token'); cy.vega_wallet_connect(); cy.vega_wallet_set_specified_approval_amount('1000'); cy.reload(); - cy.get(menuBar, { timeout: 20000 }).should('be.visible'); + cy.verify_page_header('The $VEGA token'); cy.ethereum_wallet_connect(); cy.navigate_to('staking'); - cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); - cy.get(validatorList).first().invoke('text').as('validatorName'); - cy.get(validatorList).last().invoke('text').as('otherValidatorName'); + cy.wait_for_spinner(); + cy.get(stakeValidatorList).first().invoke('text').as('validatorName'); + cy.get(stakeValidatorList).last().invoke('text').as('otherValidatorName'); }); describe('Eth wallet - contains VEGA tokens', function () { @@ -36,219 +52,505 @@ context('Staking Flow - with eth and vega wallets connected', function () { it('Able to stake against a validator', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); - cy.ethereum_wallet_check_associated_value_is('3.0'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '3.000000000000000000' + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout ); + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('3.0', txTimeout) + .should('be.visible'); + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 3.0, txTimeout); + cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '2.000000000000000000' + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' - ); - staking_validator_page_check_stake_next_epoch_value('2.0'); - staking_validator_page_check_stake_this_epoch_value('2.0'); + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName); + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.get(stakeThisEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '2.0') + .and('contain', '100%'); }); it('Able to stake against mulitple validators', function () { cy.staking_page_associate_tokens('5'); - cy.vega_wallet_check_unstaked_value_is('5.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 5.0, + txTimeout + ); + cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' - ); + + cy.get(vegaWalletStakedBalances, txTimeout) + .contains(this.validatorName, txTimeout) + .parent() + .should('contain', 2.0, txTimeout); + cy.navigate_to('staking'); - cy.get(validatorList).contains(this.otherValidatorName).click(); + cy.get(stakeValidatorList).contains(this.otherValidatorName).click(); + cy.staking_validator_page_add_stake('1'); - vega_wallet_check_validator_staked_value_is( - this.otherValidatorName, - '1.000000000000000000' + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('have.length', 2, txTimeout) + .contains(this.otherValidatorName, txTimeout) + .parent() + .should('contain', 1.0, txTimeout); + + cy.get(vegaWalletStakedBalances, txTimeout) + .contains(this.validatorName, txTimeout) + .parent() + .should('contain', 2.0, txTimeout); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '2.0') + .and('contain', '66.67%'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.otherValidatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '1.0') + .and('contain', '33.33%'); }); - it.skip('Able to remove part of a stake against a validator', function () { + it('Able to remove part of a stake against a validator', function () { cy.staking_page_associate_tokens('4'); - cy.vega_wallet_check_unstaked_value_is('4.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 4.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('3'); - staking_validator_page_check_stake_next_epoch_value('3.0'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '3.000000000000000000' + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(3.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 3.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); cy.navigate_to('staking'); - cy.get(validatorList).contains(this.validatorName).click(); + cy.get(stakeValidatorList).contains(this.validatorName).click(); - cy.staking_validator_page_removeStake('1'); - staking_validator_page_check_stake_next_epoch_value('2.0'); - staking_validator_page_check_stake_this_epoch_value('3.0'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '2.000000000000000000' + cy.staking_validator_page_remove_stake('1'); + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletThisEpochBalances, txTimeout) + .should('contain', 3.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'This Epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout ); - vega_wallet_check_validator_stake_this_epoch_value_is( - this.validatorName, - '3.000000000000000000' - ); - cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' - ); - staking_validator_page_check_stake_next_epoch_value('2.0'); - staking_validator_page_check_stake_this_epoch_value('2.0'); + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName); + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.get(stakeThisEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '2.0') + .and('contain', '100%'); }); it('Able to remove a full stake against a validator', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('1'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '1.000000000000000000' + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 1.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); cy.navigate_to('staking'); - cy.get(validatorList).contains(this.validatorName).click(); - cy.staking_validator_page_removeStake('1'); - staking_validator_page_check_stake_next_epoch_value('0.0'); + cy.get(stakeValidatorList).contains(this.validatorName).click(); - vega_wallet_check_validator_stake_this_epoch_value_is( - this.validatorName, - '1.000000000000000000' + cy.staking_validator_page_remove_stake('1'); + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(0.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletThisEpochBalances, txTimeout) + .should('contain', 1.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'This Epoch'); + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 0.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout ); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '0.000000000000000000' - ); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); - staking_validator_page_check_stake_next_epoch_value('0.0'); - staking_validator_page_check_stake_this_epoch_value('0.0'); - vega_wallet_check_validator_no_longer_showing(this.validatorName); + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(0.0, epochTimeout) + .should('be.visible'); + + cy.get(stakeThisEpochValue, epochTimeout) + .contains(0.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletStakedBalances, txTimeout) + .contains(this.validatorName, txTimeout) + .should('not.exist', txTimeout); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '0.0'); }); - it.skip('Unable to remove a stake with a negative value for a validator', function () { + it('Unable to remove a stake with a negative value for a validator', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - staking_validator_page_check_stake_next_epoch_value('2.0'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '2.000000000000000000' + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); cy.navigate_to('staking'); - cy.get(validatorList).contains(this.validatorName).click(); - cy.get(removeStakeRadioButton).click({ force: true }); - cy.get(tokenAmountInputBox).type('-0.1'); - cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(tokenSubmitButton) - .should('be.disabled', { timeout: 8000 }) + + cy.get(stakeValidatorList).contains(this.validatorName).click(); + + cy.get(stakeRemoveStakeRadioButton).click({ force: true }); + + cy.get(stakeTokenAmountInputBox).type('-0.1'); + + cy.contains('Waiting for next epoch to start', epochTimeout); + + cy.get(stakeTokenSubmitButton) + .should('be.disabled', epochTimeout) .and('contain', `Remove -0.1 $VEGA tokens at the end of epoch`) .and('be.visible'); }); - it.skip('Unable to remove a stake greater than staked amount next epoch for a validator', function () { + it('Unable to remove a stake greater than staked amount next epoch for a validator', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - staking_validator_page_check_stake_next_epoch_value('2.0'); - vega_wallet_check_validator_stake_next_epoch_value_is( - this.validatorName, - '2.000000000000000000' + + cy.get(stakeNextEpochValue, epochTimeout) + .contains(2.0, epochTimeout) + .should('be.visible'); + + cy.get(vegaWalletNextEpochBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName) + .and('contain', 'Next epoch'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); cy.navigate_to('staking'); - cy.get(validatorList).contains(this.validatorName).click(); - cy.get(removeStakeRadioButton).click({ force: true }); - cy.get(tokenAmountInputBox).type(4); - cy.contains('Waiting for next epoch to start', { timeout: 10000 }); - cy.get(tokenSubmitButton) - .should('be.disabled', { timeout: 8000 }) + + cy.get(stakeValidatorList).contains(this.validatorName).click(); + + cy.get(stakeRemoveStakeRadioButton).click({ force: true }); + + cy.get(stakeTokenAmountInputBox).type(4); + + cy.contains('Waiting for next epoch to start', epochTimeout); + + cy.get(stakeTokenSubmitButton) + .should('be.disabled', epochTimeout) .and('contain', `Remove 4 $VEGA tokens at the end of epoch`) .and('be.visible'); }); - it.skip('Disassociating all tokens - removes all staked tokens', function () { + it('Disassociating all tokens - removes all staked tokens', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName); + cy.navigate_to('staking'); + cy.staking_page_disassociate_all_tokens(); - cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing( - vegaWalletPublicKeyShort + + cy.get(ethWalletContainer).within(() => { + cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( + 'not.exist' + ); + }); + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('0.0', txTimeout) + .should('be.visible'); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + '0.000000000000000000', + txTimeout ); - cy.ethereum_wallet_check_associated_value_is('0.0'); - cy.vega_wallet_check_associated_value_is('0.000000000000000000'); - vega_wallet_check_validator_no_longer_showing(this.validatorName); + + cy.get(vegaWalletStakedBalances, txTimeout) + .contains(this.validatorName, txTimeout) + .should('not.exist', txTimeout); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '0.0'); }); it('Disassociating some tokens - prioritizes unstaked tokens', function () { cy.staking_page_associate_tokens('3'); - cy.vega_wallet_check_unstaked_value_is('3.000000000000000000'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); cy.get('button').contains('Select a validator to nominate').click(); - cy.get(validatorList).contains(this.validatorName).click(); + cy.get(stakeValidatorList).contains(this.validatorName).click(); cy.staking_validator_page_add_stake('2'); - cy.vega_wallet_check_unstaked_value_is('1.000000000000000000'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName); + cy.navigate_to('staking'); + cy.staking_page_disassociate_tokens('1'); - cy.ethereum_wallet_check_associated_value_is('2.0'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - vega_wallet_check_validator_staked_value_is( - this.validatorName, - '2.000000000000000000' + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('2.0', txTimeout) + .should('be.visible'); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + '2.000000000000000000', + txTimeout ); + + cy.get(vegaWalletStakedBalances, txTimeout) + .should('contain', 2.0, txTimeout) + .and('contain', this.validatorName); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorWithinList, epochTimeout) + .contains(this.validatorName) + .parent() + .contains('Total stake') + .parent() + .should('contain', '2.0') + .and('contain', '100%'); + }); + + it('Selecting use maximum where tokens are allready staked - suggests the unstaked token amount', function () { + cy.staking_page_associate_tokens('3'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 3.0, + txTimeout + ); + + cy.get('button').contains('Select a validator to nominate').click(); + cy.get(stakeValidatorList).contains(this.validatorName).click(); + + cy.staking_validator_page_add_stake('2'); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout + ); + + cy.navigate_to('staking'); + + cy.get(stakeValidatorList).contains(this.otherValidatorName).click(); + + cy.get(stakeAddStakeRadioButton).click({ force: true }); + + cy.get(stakeMaximumTokens, { timeout: 60000 }).click(); + + cy.get(stakeTokenSubmitButton).should('contain', 'Add 1 $VEGA tokens'); }); after( @@ -259,77 +561,3 @@ context('Staking Flow - with eth and vega wallets connected', function () { ); }); }); - -function staking_validator_page_check_stake_next_epoch_value(expectedVal) { - cy.highlight( - `Checking Staking Page - Validator Stake Next Epoch Value is ${expectedVal}` - ); - cy.get(stakeNextEpochValue, { timeout: 10000 }) - .contains(expectedVal, { timeout: 10000 }) - .should('be.visible'); -} - -function staking_validator_page_check_stake_this_epoch_value(expectedVal) { - cy.highlight( - `Checking Staking Page - Validator Stake This Epoch Value is ${expectedVal}` - ); - cy.get(stakeNextEpochValue, { timeout: 10000 }) - .contains(expectedVal, { timeout: 10000 }) - .should('be.visible'); -} - -function vega_wallet_check_validator_stake_next_epoch_value_is( - validatorName, - expectedVal -) { - cy.highlight( - `Checking vega wallet - Stake Next Epoch Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWalletContainer).within(() => { - cy.contains(`${validatorName} (Next epoch)`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -} - -function vega_wallet_check_validator_stake_this_epoch_value_is( - validatorName, - expectedVal -) { - cy.highlight( - `Checking vega wallet - Stake This Epoch Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWalletContainer).within(() => { - cy.contains(`${validatorName} (This Epoch)`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -} - -function vega_wallet_check_validator_no_longer_showing(validatorName) { - cy.highlight( - `Checking Validator and therefore stake removed for ${validatorName}` - ); - cy.get(vegaWalletContainer).within(() => { - cy.contains(`${validatorName}`, { timeout: 40000 }).should('not.exist', { - timeout: 40000, - }); - }); -} - -function vega_wallet_check_validator_staked_value_is( - validatorName, - expectedVal -) { - cy.highlight( - `Checking Validator Stake Value for ${validatorName} is ${expectedVal}` - ); - cy.get(vegaWalletContainer).within(() => { - cy.contains(`${validatorName}`, { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -} diff --git a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js index 7d87be4b4..12074d615 100644 --- a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/token-association-flow.cy.js @@ -1,7 +1,12 @@ -const pageSpinner = 'splash-loader'; -const menuBar = 'nav'; const validatorList = '[data-testid="node-list-item-name"]'; - +const ethWalletContainer = '[data-testid="ethereum-wallet"]'; +const ethWalletAssociatedBalances = + '[data-testid="eth-wallet-associated-balances"]'; +const ethWalletTotalAssociatedBalance = '[data-testid="currency-locked"]'; +const vegaWalletAssociatedBalance = '[data-testid="currency-value"]'; +const vegaWalletUnstakedBalance = + '[data-testid="vega-wallet-balance-unstaked"]'; +const txTimeout = { timeout: 40000 }; const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort'); context( @@ -10,14 +15,14 @@ context( before('visit staking tab and connect vega wallet', function () { cy.vega_wallet_import(); cy.visit('/'); - cy.get(menuBar, { timeout: 20000 }).should('be.visible'); + cy.verify_page_header('The $VEGA token'); cy.vega_wallet_connect(); cy.vega_wallet_set_specified_approval_amount('1000'); cy.reload(); - cy.get(menuBar, { timeout: 20000 }).should('be.visible'); + cy.verify_page_header('The $VEGA token'); cy.ethereum_wallet_connect(); cy.navigate_to('staking'); - cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); + cy.wait_for_spinner(); cy.get(validatorList).first().invoke('text').as('validatorName'); }); @@ -27,71 +32,140 @@ context( function () { cy.vega_wallet_teardown(); cy.navigate_to('staking'); - cy.get(pageSpinner, { timeout: 20000 }).should('not.exist'); + cy.wait_for_spinner(); } ); it('Able to associate tokens', function () { cy.staking_page_associate_tokens('2'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '2.000000000000000000' + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 2.0, txTimeout); + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('2.0', txTimeout) + .should('be.visible'); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout + ); + + cy.get(vegaWalletUnstakedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout ); - cy.ethereum_wallet_check_associated_value_is('2.0'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.vega_wallet_check_unstaked_value_is('2.000000000000000000'); }); it('Able to disassociate tokens', function () { cy.staking_page_associate_tokens('2'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '2.000000000000000000' - ); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 2.0, txTimeout); + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('2.0', txTimeout) + .should('be.visible'); + cy.get('button').contains('Select a validator to nominate').click(); + cy.staking_page_disassociate_tokens('1'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1.000000000000000000' - ); - cy.ethereum_wallet_check_associated_value_is('1.0'); - cy.vega_wallet_check_associated_value_is('1.000000000000000000'); + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 1.0, txTimeout); + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('1.0', txTimeout) + .should('be.visible'); }); it('Able to associate more tokens than the approved amount of 1000 - requires re-approval', function () { cy.staking_page_associate_tokens('1001', true); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1,001.000000000000000000' + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', '1,001.000000000000000000', txTimeout); + + cy.get(ethWalletTotalAssociatedBalance, txTimeout) + .contains('1,001.00', txTimeout) + .should('be.visible'); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + '1,001.000000000000000000', + txTimeout ); - cy.ethereum_wallet_check_associated_value_is('1,001.00'); - cy.vega_wallet_check_associated_value_is('1,001.000000000000000000'); }); it('Able to disassociate a partial amount of tokens currently associated', function () { cy.staking_page_associate_tokens('2'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.get('button').contains('Select a validator to nominate').click(); - cy.staking_page_disassociate_tokens('1'); - cy.ethereum_wallet_check_associated_vega_key_value_is( - vegaWalletPublicKeyShort, - '1.000000000000000000' + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout + ); + + cy.get('button').contains('Select a validator to nominate').click(); + + cy.staking_page_disassociate_tokens('1'); + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 1.0, txTimeout); + + cy.get(ethWalletAssociatedBalances, txTimeout) + .contains(vegaWalletPublicKeyShort) + .parent() + .should('contain', 1.0, txTimeout); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 1.0, + txTimeout ); - cy.ethereum_wallet_check_associated_value_is('1.0'); - cy.vega_wallet_check_associated_value_is('1.000000000000000000'); }); it('Able to disassociate all tokens', function () { cy.staking_page_associate_tokens('2'); - cy.vega_wallet_check_associated_value_is('2.000000000000000000'); - cy.get('button').contains('Select a validator to nominate').click(); - cy.staking_page_disassociate_all_tokens(); - cy.ethereum_wallet_check_associated_vega_key_is_no_longer_showing( - vegaWalletPublicKeyShort + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 2.0, + txTimeout + ); + + cy.get('button').contains('Select a validator to nominate').click(); + + cy.staking_page_disassociate_all_tokens(); + + cy.get(ethWalletContainer).within(() => { + cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( + 'not.exist' + ); + }); + + cy.get(ethWalletContainer).within(() => { + cy.contains(vegaWalletPublicKeyShort, { timeout: 20000 }).should( + 'not.exist' + ); + }); + + cy.get(vegaWalletAssociatedBalance, txTimeout).should( + 'contain', + 0.0, + txTimeout ); - cy.ethereum_wallet_check_associated_value_is('0.0'); - cy.vega_wallet_check_associated_value_is('0.000000000000000000'); }); }); } diff --git a/apps/token-e2e/src/support/common.functions.js b/apps/token-e2e/src/support/common.functions.js index 3f02096b0..065fd18ae 100644 --- a/apps/token-e2e/src/support/common.functions.js +++ b/apps/token-e2e/src/support/common.functions.js @@ -14,6 +14,7 @@ const navigation = { rewards: '[href="/rewards"]', withdraw: '[href="/withdraw"]', governance: '[href="/governance"]', + pageSpinner: 'splash-loader', }; Cypress.Commands.add('navigate_to', (page) => { @@ -31,3 +32,7 @@ Cypress.Commands.add('verify_tab_highlighted', (page) => { Cypress.Commands.add('verify_page_header', (text) => { return cy.get('header h1').should('be.visible').and('have.text', text); }); + +Cypress.Commands.add('wait_for_spinner', () => { + cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist'); +}); diff --git a/apps/token-e2e/src/support/staking.functions.js b/apps/token-e2e/src/support/staking.functions.js index 42652b3fb..40bd9fa0a 100644 --- a/apps/token-e2e/src/support/staking.functions.js +++ b/apps/token-e2e/src/support/staking.functions.js @@ -9,7 +9,6 @@ const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]'; const stakeMaximumTokens = '[data-testid="token-amount-use-maximum"]'; Cypress.Commands.add('wait_for_begining_of_epoch', () => { - cy.highlight(`Waiting for next epoch to start`); cy.contains('Waiting for next epoch to start', { timeout: 10000 }).should( 'not.exist' ); @@ -26,13 +25,9 @@ Cypress.Commands.add('staking_validator_page_add_stake', (stake) => { .and('contain', `Add ${stake} $VEGA tokens`) .and('be.visible') .click(); - cy.contains( - 'At the beginning of the next epoch your $VEGA will be nominated to the validator', - { timeout: 20000 } - ).should('be.visible'); }); -Cypress.Commands.add('staking_validator_page_removeStake', (stake) => { +Cypress.Commands.add('staking_validator_page_remove_stake', (stake) => { cy.highlight(`Removing a stake of ${stake}`); cy.get(removeStakeRadioButton).click({ force: true }); cy.get(tokenAmountInputBox).type(stake); @@ -42,9 +37,6 @@ Cypress.Commands.add('staking_validator_page_removeStake', (stake) => { .and('contain', `Remove ${stake} $VEGA tokens at the end of epoch`) .and('be.visible') .click(); - cy.contains(`${stake} $VEGA has been removed from validator`).should( - 'be.visible' - ); }); Cypress.Commands.add( diff --git a/apps/token-e2e/src/support/wallet-eth.functions.js b/apps/token-e2e/src/support/wallet-eth.functions.js index 1a4bec47d..73afc921b 100644 --- a/apps/token-e2e/src/support/wallet-eth.functions.js +++ b/apps/token-e2e/src/support/wallet-eth.functions.js @@ -16,42 +16,3 @@ Cypress.Commands.add('ethereum_wallet_connect', () => { cy.contains('Locked', { timeout: 15000 }).should('be.visible'); }); }); - -Cypress.Commands.add( - 'ethereum_wallet_check_associated_value_is', - (expectedVal) => { - cy.highlight(`Checking Eth Wallet - Associated Value is ${expectedVal}`); - cy.get(ethWalletContainer).within(() => { - cy.contains('Associated', { timeout: 20000 }) - .parent() - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); - } -); - -Cypress.Commands.add( - 'ethereum_wallet_check_associated_vega_key_value_is', - (vegaShortPublicKey, expectedVal) => { - cy.highlight( - `Checking Eth Wallet - Vega Key Associated Value is ${expectedVal} for key ${vegaShortPublicKey}` - ); - cy.get(ethWalletContainer).within(() => { - cy.contains(vegaShortPublicKey, { timeout: 20000 }) - .parent() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); - } -); - -Cypress.Commands.add( - 'ethereum_wallet_check_associated_vega_key_is_no_longer_showing', - (vegaShortPublicKey) => { - cy.highlight('Checking Eth Wallet - Vega Key Associated is not showing'); - cy.get(ethWalletContainer).within(() => { - cy.contains(vegaShortPublicKey, { timeout: 20000 }).should('not.exist'); - }); - } -); diff --git a/apps/token-e2e/src/support/wallet-teardown.functions.js b/apps/token-e2e/src/support/wallet-teardown.functions.js index 5642c07e0..46eabf2f6 100644 --- a/apps/token-e2e/src/support/wallet-teardown.functions.js +++ b/apps/token-e2e/src/support/wallet-teardown.functions.js @@ -5,6 +5,7 @@ import { } from '@vegaprotocol/smart-contracts'; import { ethers, Wallet } from 'ethers'; +const vegaWalletAssociatedBalance = '[data-testid="currency-value"]'; const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic'); const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey'); const vegaTokenContractAddress = Cypress.env('vegaTokenContractAddress'); @@ -41,7 +42,12 @@ before('Vega wallet teardown prep', function () { Cypress.Commands.add('vega_wallet_teardown', function () { cy.vega_wallet_teardown_staking(this.stakingBridgeContract); cy.vega_wallet_teardown_vesting(this.vestingContract); - cy.vega_wallet_check_associated_value_is('0.000000000000000000'); + + cy.get(vegaWalletAssociatedBalance, { timeout: transactionTimeout }).should( + 'contain', + '0.000000000000000000', + { timeout: transactionTimeout } + ); }); Cypress.Commands.add( diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js index 3ab43139d..f77a2759d 100644 --- a/apps/token-e2e/src/support/wallet-vega.functions.js +++ b/apps/token-e2e/src/support/wallet-vega.functions.js @@ -33,24 +33,3 @@ Cypress.Commands.add('vega_wallet_connect', () => { }); cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible'); }); - -Cypress.Commands.add('vega_wallet_check_unstaked_value_is', (expectedVal) => { - cy.highlight(`Checking vega wallet - Unstaked Value is ${expectedVal}`); - cy.get(vegaWalletContainer).within(() => { - cy.contains('Unstaked', { timeout: 40000 }) - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -}); - -Cypress.Commands.add('vega_wallet_check_associated_value_is', (expectedVal) => { - cy.highlight(`Checking vega wallet - Associated Value is ${expectedVal}`); - cy.get(vegaWalletContainer).within(() => { - cy.contains('Associated', { timeout: 40000 }) - .parent() - .siblings() - .contains(expectedVal, { timeout: 40000 }) - .should('be.visible'); - }); -}); diff --git a/apps/token/src/components/eth-wallet/eth-wallet.tsx b/apps/token/src/components/eth-wallet/eth-wallet.tsx index 509542acc..aa0e15280 100644 --- a/apps/token/src/components/eth-wallet/eth-wallet.tsx +++ b/apps/token/src/components/eth-wallet/eth-wallet.tsx @@ -83,12 +83,14 @@ const AssociatedAmounts = ({ /> {vestingAssociationByVegaKey.map(([key, amount]) => { return ( - +
+ +
); })} diff --git a/apps/token/src/components/vega-wallet/vega-wallet.tsx b/apps/token/src/components/vega-wallet/vega-wallet.tsx index 8eac261b9..ff81d2a17 100644 --- a/apps/token/src/components/vega-wallet/vega-wallet.tsx +++ b/apps/token/src/components/vega-wallet/vega-wallet.tsx @@ -154,31 +154,37 @@ const VegaWalletConnected = ({ vegaKeys }: VegaWalletConnectedProps) => { balance={currentStakeAvailable} dark={true} /> - +
+ +
{delegatedNodes.length ? ( ) : null} {delegatedNodes.map((d) => ( -
+
{d.currentEpochStake && d.currentEpochStake.isGreaterThan(0) && ( - +
+ +
)} {d.hasStakePending && ( - +
+ +
)}
))} diff --git a/apps/trading-e2e/cypress.config.js b/apps/trading-e2e/cypress.config.js index 467cb94ca..763d95ab5 100644 --- a/apps/trading-e2e/cypress.config.js +++ b/apps/trading-e2e/cypress.config.js @@ -27,6 +27,8 @@ module.exports = defineConfig({ chromeWebSecurity: false, projectId: 'et4snf', defaultCommandTimeout: 10000, + viewportWidth: 1440, + viewportHeight: 900, }, env: { TRADING_TEST_VEGA_WALLET_NAME: 'UI_Trading_Test', diff --git a/apps/trading-e2e/src/integration/deposit.cy.ts b/apps/trading-e2e/src/integration/deposit.cy.ts index d8c43a9e6..b9d8abf40 100644 --- a/apps/trading-e2e/src/integration/deposit.cy.ts +++ b/apps/trading-e2e/src/integration/deposit.cy.ts @@ -1,10 +1,12 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { generateDepositPage } from '../support/mocks/generate-deposit-page'; +import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; describe('deposit form validation', () => { beforeEach(() => { cy.mockWeb3Provider(); cy.mockGQL((req) => { + aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); aliasQuery(req, 'DepositPage', generateDepositPage()); }); cy.visit('/portfolio/deposit'); diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index 62a3b1774..a3e8906df 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -32,11 +32,11 @@ describe('home', () => { }); cy.visit('/'); - cy.wait('@GQL'); - cy.contains('Loading...').should('be.visible'); cy.contains('Loading...').should('not.exist'); - cy.get('main[data-testid="market"]').should('exist'); // Wait for page to be rendered to before checking url + cy.wait('@GQL'); + + cy.get('main[data-testid="market"]', { timeout: 20000 }).should('exist'); // Wait for page to be rendered to before checking url cy.url().should('include', `/markets/${oldestMarket.id}`); // Should redirect to oldest market }); diff --git a/apps/trading-e2e/src/integration/portfolio-fills.cy.ts b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts index f22eeacd8..17bc02bb1 100644 --- a/apps/trading-e2e/src/integration/portfolio-fills.cy.ts +++ b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts @@ -2,6 +2,7 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { generateFill, generateFills } from '../support/mocks/generate-fills'; import { Side } from '@vegaprotocol/types'; import { connectVegaWallet } from '../support/vega-wallet'; +import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; describe('fills', () => { before(() => { @@ -58,6 +59,7 @@ describe('fills', () => { }); cy.mockGQL((req) => { aliasQuery(req, 'Fills', result); + aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); }); cy.visit('/portfolio'); cy.get('main[data-testid="portfolio"]').should('exist'); @@ -65,7 +67,7 @@ describe('fills', () => { it('renders fills', () => { cy.getByTestId('Fills').click(); - cy.getByTestId('tab-fills').contains('Please connect Vega wallet'); + cy.getByTestId('tab-fills').contains('Connect your Vega wallet'); connectVegaWallet(); diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index 388b8102a..5d7da6044 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -11,7 +11,7 @@ beforeEach(() => { describe('accounts', () => { it('renders accounts', () => { - cy.getByTestId('Accounts').click(); + cy.getByTestId('Collateral').click(); cy.getByTestId('tab-accounts').contains('Please connect Vega wallet'); connectVegaWallet(); diff --git a/apps/trading-e2e/src/integration/withdraw.cy.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts index c53ba11b1..1cca11113 100644 --- a/apps/trading-e2e/src/integration/withdraw.cy.ts +++ b/apps/trading-e2e/src/integration/withdraw.cy.ts @@ -1,5 +1,6 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { connectEthereumWallet } from '../support/ethereum-wallet'; +import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; import { generateWithdrawPageQuery } from '../support/mocks/generate-withdraw-page-query'; import { connectVegaWallet } from '../support/vega-wallet'; @@ -15,6 +16,7 @@ describe('withdraw', () => { cy.mockWeb3Provider(); cy.mockGQL((req) => { aliasQuery(req, 'WithdrawPageQuery', generateWithdrawPageQuery()); + aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); }); cy.visit('/portfolio/withdraw'); diff --git a/apps/trading-e2e/src/integration/withdrawals.cy.ts b/apps/trading-e2e/src/integration/withdrawals.cy.ts index 5e1665247..1665f2860 100644 --- a/apps/trading-e2e/src/integration/withdrawals.cy.ts +++ b/apps/trading-e2e/src/integration/withdrawals.cy.ts @@ -1,5 +1,6 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { connectEthereumWallet } from '../support/ethereum-wallet'; +import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; import { generateWithdrawals } from '../support/mocks/generate-withdrawals'; import { connectVegaWallet } from '../support/vega-wallet'; @@ -8,6 +9,7 @@ describe('withdrawals', () => { cy.mockWeb3Provider(); cy.mockGQL((req) => { aliasQuery(req, 'Withdrawals', generateWithdrawals()); + aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); }); cy.visit('/portfolio/withdrawals'); @@ -16,8 +18,6 @@ describe('withdrawals', () => { // It also requires connection Ethereum wallet connectEthereumWallet(); - - cy.contains('Withdrawals'); }); it('renders history of withdrawals', () => { @@ -27,7 +27,6 @@ describe('withdrawals', () => { const etherScanLink = `${Cypress.env( 'ETHERSCAN_URL' )}/tx/0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03`; - cy.contains('Withdrawals'); const row = '.ag-center-cols-container[role="rowgroup"] > [role="row"]'; diff --git a/apps/trading-e2e/src/support/mocks/generate-network-parameters.ts b/apps/trading-e2e/src/support/mocks/generate-network-parameters.ts new file mode 100644 index 000000000..24076245e --- /dev/null +++ b/apps/trading-e2e/src/support/mocks/generate-network-parameters.ts @@ -0,0 +1,37 @@ +import merge from 'lodash/merge'; +import type { NetworkParamsQuery } from '@vegaprotocol/web3'; +import type { PartialDeep } from 'type-fest'; + +export const generateNetworkParameters = ( + override?: PartialDeep +): NetworkParamsQuery => { + const defaultResult: NetworkParamsQuery = { + networkParameters: [ + { + __typename: 'NetworkParameter', + key: 'blockchains.ethereumConfig', + value: JSON.stringify({ + network_id: '3', + chain_id: '3', + collateral_bridge_contract: { + address: '0x947893AaA0A7b55f66990b3B4781514b691Fdd4a', + }, + multisig_control_contract: { + address: '0xaE15126d2d1fAbF7cfA7cAD3cbD4921DfC87F620', + deployment_block_height: 12341882, + }, + staking_bridge_contract: { + address: '0x7896C9491962D5839783CB6e0492ECebd34Bb35F', + deployment_block_height: 11177313, + }, + token_vesting_contract: { + address: '0x9F10cBeEf03A564Fb914c2010c0Cd55E9BB11406', + deployment_block_height: 11177353, + }, + confirmations: 3, + }), + }, + ], + }; + return merge(defaultResult, override); +}; diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index 2d6dc26c9..c4d2d5d43 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -10,7 +10,7 @@ export const Navbar = () => { {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - + {[ @@ -39,7 +39,7 @@ const NavLink = ({ name, path, exact, testId = name }: NavLinkProps) => { 'uppercase xs:text-ui sm:text-body-large md:text-h5 lg:text-h4', { 'bg-vega-pink dark:bg-vega-yellow text-white dark:text-black': isActive, - 'text-black dark:text-white': !isActive, + 'text-white': !isActive, } ); return ( diff --git a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx index 2822ea561..67fafec5b 100644 --- a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx +++ b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx @@ -24,12 +24,14 @@ export const VegaWalletConnectButton = ({ return ( {isConnected && ( - Vega key: + + Vega key: + )} diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index e5e10d23a..7d5210fe8 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -28,9 +28,9 @@ function AppBody({ Component, pageProps }: AppProps) { return ( -
+
-
+
c !== null); const headerItemClassName = 'whitespace-nowrap flex flex-col'; const itemClassName = - 'font-sans font-normal mb-0 text-dark/80 dark:text-white/80 text-ui-small'; + 'font-sans font-normal mb-0 text-black-60 dark:text-white-80 text-ui-small'; const itemValueClassName = 'capitalize font-sans tracking-tighter text-black dark:text-white text-ui'; const headerClassName = classNames( @@ -68,7 +68,7 @@ export const TradeMarketHeader = ({
+ +
+
+ ); }} /> ); diff --git a/apps/trading/pages/portfolio/withdrawals/index.page.tsx b/apps/trading/pages/portfolio/withdrawals/index.page.tsx index b1159d33f..e229e9e08 100644 --- a/apps/trading/pages/portfolio/withdrawals/index.page.tsx +++ b/apps/trading/pages/portfolio/withdrawals/index.page.tsx @@ -1,25 +1,12 @@ -import { t } from '@vegaprotocol/react-helpers'; -import { AnchorButton } from '@vegaprotocol/ui-toolkit'; import { VegaWalletContainer } from '../../../components/vega-wallet-container'; import { Web3Container } from '../../../components/web3-container'; -import { WithdrawalsContainer } from './withdrawals-container'; +import { WithdrawalsContainer } from '../withdrawals-container'; const Withdrawals = () => { return ( -
-
-

{t('Withdrawals')}

- - {t('Start withdrawal')} - -
- -
+
); diff --git a/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx b/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx index 87622b3f4..975738a44 100644 --- a/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx @@ -32,7 +32,7 @@ export const DealTicketLimitAmount = ({ />
-
@
+
@
-
@
-
+
@
+
{price && quoteName ? ( <> ~{price} {quoteName} diff --git a/libs/deal-ticket/src/components/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket.tsx index eeffb3220..13022bbe2 100644 --- a/libs/deal-ticket/src/components/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket.tsx @@ -62,7 +62,7 @@ export const DealTicket = ({ ); return ( -
+ { export const Info = ({ market }: InfoProps) => { const headerClassName = - 'text-h5 font-bold uppercase text-black dark:text-white'; + 'text-h5 font-medium uppercase text-black dark:text-white'; const marketDataPanels = [ { title: t('Current fees'), diff --git a/libs/deposits/src/lib/deposit-limits.tsx b/libs/deposits/src/lib/deposit-limits.tsx index 2677f254b..8a668829b 100644 --- a/libs/deposits/src/lib/deposit-limits.tsx +++ b/libs/deposits/src/lib/deposit-limits.tsx @@ -8,12 +8,19 @@ interface DepositLimitsProps { } export const DepositLimits = ({ limits }: DepositLimitsProps) => { - const maxLimit = limits.max.isEqualTo(Infinity) - ? t('No limit') - : limits.max.toString(); + let maxLimit = ''; + + if (limits.max.isEqualTo(Infinity)) { + maxLimit = t('No limit'); + } else if (limits.max.isGreaterThan(1_000_000)) { + maxLimit = t('1m+'); + } else { + maxLimit = limits.max.toString(); + } + return ( <> -

{t('Temporary deposit limits')}

+

{t('Deposit limits')}

diff --git a/libs/deposits/src/lib/deposit-manager.tsx b/libs/deposits/src/lib/deposit-manager.tsx index 21efb1cb8..ec0a7572c 100644 --- a/libs/deposits/src/lib/deposit-manager.tsx +++ b/libs/deposits/src/lib/deposit-manager.tsx @@ -77,7 +77,7 @@ export const DepositManager = ({ const allowance = useGetAllowance(tokenContract, decimals); // Set up approve transaction - const approve = useSubmitApproval(tokenContract); + const approve = useSubmitApproval(tokenContract, decimals); // Set up deposit transaction const { confirmationEvent, ...deposit } = useSubmitDeposit(); diff --git a/libs/deposits/src/lib/use-submit-approval.ts b/libs/deposits/src/lib/use-submit-approval.ts index 2ad905071..3db4e847e 100644 --- a/libs/deposits/src/lib/use-submit-approval.ts +++ b/libs/deposits/src/lib/use-submit-approval.ts @@ -1,17 +1,21 @@ +import { removeDecimal } from '@vegaprotocol/react-helpers'; import type { Token } from '@vegaprotocol/smart-contracts'; import { useEthereumConfig, useEthereumTransaction } from '@vegaprotocol/web3'; -export const useSubmitApproval = (contract: Token | null) => { +export const useSubmitApproval = ( + contract: Token | null, + decimals: number | undefined +) => { const { config } = useEthereumConfig(); const transaction = useEthereumTransaction(() => { - if (!contract || !config) { + if (!contract || !config || decimals === undefined) { return null; } - return contract.approve( - config.collateral_bridge_contract.address, - Number.MAX_SAFE_INTEGER.toString() - ); + + const amount = removeDecimal('1000000', decimals); + + return contract.approve(config.collateral_bridge_contract.address, amount); }); return transaction; diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx index 9948f3231..5e8f018a3 100644 --- a/libs/market-depth/src/lib/orderbook-row.tsx +++ b/libs/market-depth/src/lib/orderbook-row.tsx @@ -66,7 +66,7 @@ export const OrderbookRow = React.memo( relativeAsk={cumulativeRelativeAsk} relativeBid={cumulativeRelativeBid} indicativeVolume={indicativeVolume} - className="pr-4" + className="pr-4 text-black dark:text-white" /> ); diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 37df5c8d6..01d8f0de6 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -282,7 +282,7 @@ export const Orderbook = ({ const hasData = renderedRows.data && renderedRows.data.length !== 0; return (
onResolutionChange(Number(e.currentTarget.value))} value={resolution} - className="block bg-black-25 dark:bg-white-25 text-black dark:text-white focus-visible:shadow-focus dark:focus-visible:shadow-focus-dark focus-visible:outline-0 font-mono w-100 text-right w-full h-full" + className="block bg-black-10 dark:bg-black-70 text-black dark:text-white focus-visible:shadow-focus dark:focus-visible:shadow-focus-dark focus-visible:outline-0 font-mono w-100 text-right w-full h-full" data-testid="resolution" > {new Array(3) diff --git a/libs/market-list/src/lib/components/landing/select-market-list.tsx b/libs/market-list/src/lib/components/landing/select-market-list.tsx index d95844ac1..bd6fbccc3 100644 --- a/libs/market-list/src/lib/components/landing/select-market-list.tsx +++ b/libs/market-list/src/lib/components/landing/select-market-list.tsx @@ -67,6 +67,7 @@ export const SelectMarketList = ({ onKeyPress={(event) => handleKeyPress(event, id)} onClick={() => onSelect(id)} data-testid={`market-link-${id}`} + className={`focus:decoration-vega-yellow`} > {marketName} @@ -106,7 +107,10 @@ export const SelectMarketList = ({
- + {t('Or view full market list')}
diff --git a/libs/react-helpers/src/lib/grid/price-cell.tsx b/libs/react-helpers/src/lib/grid/price-cell.tsx index 8f6f97125..1e99e1479 100644 --- a/libs/react-helpers/src/lib/grid/price-cell.tsx +++ b/libs/react-helpers/src/lib/grid/price-cell.tsx @@ -20,13 +20,13 @@ export const PriceCell = React.memo( : [value]; return ( {valueSplit[0]} {valueSplit[1] ? decimalSeparator : null} {valueSplit[1] ? ( - + {valueSplit[1]} ) : null} diff --git a/libs/smart-contracts/src/contracts/collateral-bridge-new.ts b/libs/smart-contracts/src/contracts/collateral-bridge-new.ts index db86c3c8d..a9e725f21 100644 --- a/libs/smart-contracts/src/contracts/collateral-bridge-new.ts +++ b/libs/smart-contracts/src/contracts/collateral-bridge-new.ts @@ -36,6 +36,9 @@ export class CollateralBridgeNew { isAssetListed(address: string) { return this.contract.is_asset_listed(address); } + getWithdrawThreshold(assetSource: string) { + return this.contract.get_withdraw_threshold(assetSource); + } withdrawAsset( assetSource: string, amount: string, diff --git a/libs/smart-contracts/src/contracts/collateral-bridge.ts b/libs/smart-contracts/src/contracts/collateral-bridge.ts index 42f458129..71c0b6b1e 100644 --- a/libs/smart-contracts/src/contracts/collateral-bridge.ts +++ b/libs/smart-contracts/src/contracts/collateral-bridge.ts @@ -41,6 +41,9 @@ export class CollateralBridge { isAssetListed(address: string) { return this.contract.is_asset_listed(address); } + getWithdrawThreshold(assetSource: string) { + return this.contract.get_withdraw_threshold(assetSource); + } withdrawAsset( assetSource: string, amount: string, diff --git a/libs/trades/src/lib/trades-table.tsx b/libs/trades/src/lib/trades-table.tsx index 8c045709f..24942f798 100644 --- a/libs/trades/src/lib/trades-table.tsx +++ b/libs/trades/src/lib/trades-table.tsx @@ -59,13 +59,13 @@ export const TradesTable = forwardRef( getRowId={({ data }) => data.id} ref={ref} defaultColDef={{ - flex: 1, resizable: true, }} > { return addDecimalsFormatNumber(value, data.market.decimalPlaces); @@ -74,6 +74,7 @@ export const TradesTable = forwardRef( { return addDecimal(value, data.market.positionDecimalPlaces); }} @@ -82,6 +83,7 @@ export const TradesTable = forwardRef( { return getDateTimeFormat().format(new Date(value)); }} diff --git a/libs/ui-toolkit/src/components/accordion/accordion.tsx b/libs/ui-toolkit/src/components/accordion/accordion.tsx index 3116e611c..0caa7d11b 100644 --- a/libs/ui-toolkit/src/components/accordion/accordion.tsx +++ b/libs/ui-toolkit/src/components/accordion/accordion.tsx @@ -36,7 +36,7 @@ export const Accordion = ({ panels }: AccordionProps) => { className={triggerClassNames} >

{title} diff --git a/libs/ui-toolkit/src/components/accordion/chevron-down.tsx b/libs/ui-toolkit/src/components/accordion/chevron-down.tsx index 8b150dc62..70e2e0c80 100644 --- a/libs/ui-toolkit/src/components/accordion/chevron-down.tsx +++ b/libs/ui-toolkit/src/components/accordion/chevron-down.tsx @@ -4,22 +4,22 @@ export const ChevronDownIcon = ({ active }: ChevronDownIconProps) => { : 'transform duration-300 ease'; return ( - - - - - - - + + + + + + + ); }; diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index d070017c7..e3716b5fe 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -42,7 +42,7 @@ export function Dialog({ />