From 913703e2d88a2079c237522cd67ff695c0372e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szpiech?= Date: Wed, 29 Jun 2022 15:45:36 +0200 Subject: [PATCH 01/10] test(token): added validation for vesting page without wallet connected (#673) Co-authored-by: Rado --- apps/token-e2e/src/integration/vesting.cy.js | 34 +++++++++++++++++++ .../src/locators/vesting.locators.js | 5 +++ 2 files changed, 39 insertions(+) create mode 100644 apps/token-e2e/src/integration/vesting.cy.js create mode 100644 apps/token-e2e/src/locators/vesting.locators.js diff --git a/apps/token-e2e/src/integration/vesting.cy.js b/apps/token-e2e/src/integration/vesting.cy.js new file mode 100644 index 000000000..56302b535 --- /dev/null +++ b/apps/token-e2e/src/integration/vesting.cy.js @@ -0,0 +1,34 @@ +import navigation from '../locators/navigation.locators'; +import vesting from '../locators/vesting.locators'; + +context('Vesting Page - verify elements on page', function () { + before('navigate to vesting page', function () { + cy.visit('/') + .get(navigation.section) + .within(() => { + cy.get(navigation.vesting).click(); + }); + }); + + describe('with wallets disconnected', function () { + it('should have vesting tab highlighted', function () { + cy.get(navigation.section).within(() => { + cy.get(navigation.vesting).should('have.attr', 'aria-current'); + }); + }); + + it('should have VESTING header visible', function () { + cy.get(vesting.header).should('be.visible').and('have.text', 'Vesting'); + }); + + it('should have connect Eth wallet info', function () { + cy.get(vesting.connectPrompt).should('be.visible'); + }); + + it('should have connect Eth wallet button', function () { + cy.get(vesting.connectButton) + .should('be.visible') + .and('have.text', 'Connect Ethereum wallet'); + }); + }); +}); diff --git a/apps/token-e2e/src/locators/vesting.locators.js b/apps/token-e2e/src/locators/vesting.locators.js new file mode 100644 index 000000000..9a78ad757 --- /dev/null +++ b/apps/token-e2e/src/locators/vesting.locators.js @@ -0,0 +1,5 @@ +export default { + header: 'header h1', + connectPrompt: '[data-testid="eth-connect-prompt"]', + connectButton: '[data-testid="connect-to-eth-btn"]', +}; From bd18759e5ef356082656e7a08047d0b97fe7ba19 Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Wed, 29 Jun 2022 16:45:03 +0100 Subject: [PATCH 02/10] test: tidy up test (#670) --- libs/wallet/src/connect-dialog/connect-dialog.spec.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx index a69470cc3..10bcc271d 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.spec.tsx @@ -33,6 +33,8 @@ beforeEach(() => { }; }); +const DEFAULT_URL = 'http://localhost:1789/api/v1'; + function generateJSX( props?: Partial, contextValue?: Partial @@ -92,7 +94,7 @@ it('Successful connection using rest auth form', async () => { fireEvent.submit(screen.getByTestId('rest-connector-form')); }); - expect(spy).toHaveBeenCalledWith('http://localhost:1789/api/v1', fields); + expect(spy).toHaveBeenCalledWith(DEFAULT_URL, fields); expect(defaultProps.setDialogOpen).toHaveBeenCalledWith(false); }); @@ -150,7 +152,7 @@ it('Unsuccessful connection using rest auth form', async () => { fireEvent.submit(screen.getByTestId('rest-connector-form')); }); - expect(spy).toHaveBeenCalledWith('http://localhost:1789/api/v1', fields); + expect(spy).toHaveBeenCalledWith(DEFAULT_URL, fields); expect(screen.getByTestId('form-error')).toHaveTextContent( 'Something went wrong' @@ -168,7 +170,7 @@ it('Unsuccessful connection using rest auth form', async () => { }); expect(screen.getByTestId('form-error')).toHaveTextContent( - 'Wallet not running at http://localhost:1789/api/v1' + `Wallet not running at ${DEFAULT_URL}` ); // Reject eg non 200 results From 19980e5fb1771dd555efc85ef9c1d1c548a60592 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Wed, 29 Jun 2022 17:37:39 +0100 Subject: [PATCH 03/10] frontend-monorepo-680: Bring explorer nav colours in line with theme (#681) --- apps/explorer/src/app/components/nav/index.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/explorer/src/app/components/nav/index.tsx b/apps/explorer/src/app/components/nav/index.tsx index 0196b41c6..edd947519 100644 --- a/apps/explorer/src/app/components/nav/index.tsx +++ b/apps/explorer/src/app/components/nav/index.tsx @@ -28,9 +28,10 @@ export const Nav = ({ menuOpen }: NavProps) => { className={({ isActive }) => classnames( 'block mb-8 px-8', - 'text-h5 hover:bg-vega-yellow hover:text-black', + 'text-h5 hover:bg-vega-pink dark:hover:bg-vega-yellow hover:text-white dark:hover:text-black', { - 'bg-vega-yellow text-black': isActive, + 'bg-vega-pink text-white dark:bg-vega-yellow dark:text-black': + isActive, } ) } From 23fef062631da1772a3cdc92e199dbd7f289bdf7 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 29 Jun 2022 18:07:56 +0000 Subject: [PATCH 04/10] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 8713c9c41..f3aeb7f34 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "124186.56041865939631899", + "locked_amount": "124126.81753982917719816", "deposits": [ { "amount": "129999.45", @@ -488,7 +488,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "65037.648892235152359708", + "locked_amount": "64979.046693403605669786", "deposits": [ { "amount": "97499.58", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "88895.23775402196371772604572", + "locked_amount": "88815.13866546682099416431412", "deposits": [ { "amount": "135173.4239508", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "27360.21574884189648315", + "locked_amount": "27335.5628157993102298", "deposits": [ { "amount": "32499.86", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8905.484728998842512346", + "locked_amount": "8897.46043851988015069", "deposits": [ { "amount": "10833.29", @@ -675,7 +675,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "15223.73612998188375", + "locked_amount": "15192.94044384057825", "deposits": [ { "amount": "15000", @@ -761,7 +761,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "0", - "locked_amount": "1793749.89229780380096827", + "locked_amount": "1792411.393387973002519446", "deposits": [ { "amount": "1852091.69", @@ -1777,7 +1777,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "18705.279504739679372649", - "locked_amount": "14447.6106782408306155580286543045", + "locked_amount": "14408.2740878445615591480690045146", "deposits": [ { "amount": "2833.333333", @@ -5228,7 +5228,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "19457.000000000000000003", "total_removed": "5056.88782409978", - "locked_amount": "3491.40304829401407518053832600837138522", + "locked_amount": "3477.978236555048959000536256088280061", "deposits": [ { "amount": "75", @@ -14143,7 +14143,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2780870.39180910746474557688", + "locked_amount": "2778813.58500052209233105593", "deposits": [ { "amount": "1998.95815", @@ -14856,7 +14856,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "8648.631845187181275", - "locked_amount": "15082858.8517601414887782644731138155812382", + "locked_amount": "15075602.8861729134839017475304610730305488", "deposits": [ { "amount": "16249.93", @@ -16985,7 +16985,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2114974.470447369009412382", - "locked_amount": "8274608.90495455977196820197238862", + "locked_amount": "8267875.77245418965719862061931821", "deposits": [ { "amount": "129284.449", @@ -21121,7 +21121,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1404291.506600519461757227", - "locked_amount": "2952444.61922536743378942253962054", + "locked_amount": "2949784.31785282477700500652626813", "deposits": [ { "amount": "552496.6455", @@ -22266,7 +22266,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "34.173053016", - "locked_amount": "440644.80971500656998341987011672", + "locked_amount": "440318.89691897733353615721562656", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index a345ddc51..94faa17a2 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": "41.115480720446473", + "locked_amount": "41.046473871131406", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "315.032242516489036", + "locked_amount": "314.27316717402331", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 10cb37102..440ca40aa 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": "289.25687721968538760028639294774226276", + "locked_amount": "288.5599080416032210002857028792491121", "deposits": [ { "amount": "1000", From 059a4298f492353b4ce58f58c08b9b7281124b01 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 30 Jun 2022 00:11:36 +0000 Subject: [PATCH 05/10] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 28 +++++++++---------- apps/static/src/assets/stagnet1-tranches.json | 4 +-- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index f3aeb7f34..7c4ffe3f0 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "124126.81753982917719816", + "locked_amount": "124066.90992122554899051", "deposits": [ { "amount": "129999.45", @@ -488,7 +488,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "64979.046693403605669786", + "locked_amount": "64920.282900200533309644", "deposits": [ { "amount": "97499.58", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "88815.13866546682099416431412", + "locked_amount": "88734.8187053038755919178598", "deposits": [ { "amount": "135173.4239508", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "27335.5628157993102298", + "locked_amount": "27310.841902795210245196", "deposits": [ { "amount": "32499.86", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8897.46043851988015069", + "locked_amount": "8889.414021223106580976", "deposits": [ { "amount": "10833.29", @@ -675,7 +675,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "15192.94044384057825", + "locked_amount": "15162.0598392210135", "deposits": [ { "amount": "15000", @@ -761,7 +761,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "0", - "locked_amount": "1792411.393387973002519446", + "locked_amount": "1791069.20359461885617424", "deposits": [ { "amount": "1852091.69", @@ -1777,7 +1777,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "18705.279504739679372649", - "locked_amount": "14408.2740878445615591480690045146", + "locked_amount": "14368.8290276002360637150799360994", "deposits": [ { "amount": "2833.333333", @@ -5228,7 +5228,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "19457.000000000000000003", "total_removed": "5056.88782409978", - "locked_amount": "3477.978236555048959000536256088280061", + "locked_amount": "3464.51640617072490869053418046042617951", "deposits": [ { "amount": "75", @@ -14143,7 +14143,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2778813.58500052209233105593", + "locked_amount": "2776751.10658899011722599663", "deposits": [ { "amount": "1998.95815", @@ -14856,7 +14856,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "8648.631845187181275", - "locked_amount": "15075602.8861729134839017475304610730305488", + "locked_amount": "15068326.9124081401505002201985233432454718", "deposits": [ { "amount": "16249.93", @@ -16985,7 +16985,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2114974.470447369009412382", - "locked_amount": "8267875.77245418965719862061931821", + "locked_amount": "8261124.07347787718432629205300499", "deposits": [ { "amount": "129284.449", @@ -21121,7 +21121,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1404291.506600519461757227", - "locked_amount": "2949784.31785282477700500652626813", + "locked_amount": "2947116.68075334794841710467486568", "deposits": [ { "amount": "552496.6455", @@ -22266,7 +22266,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "34.173053016", - "locked_amount": "440318.89691897733353615721562656", + "locked_amount": "439992.08542504086111175159614408", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 94faa17a2..3fbf6605d 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": "41.046473871131406", + "locked_amount": "40.97730530187722", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "314.27316717402331", + "locked_amount": "313.512312912227253", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 440ca40aa..4b55ec46e 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": "288.5599080416032210002857028792491121", + "locked_amount": "287.86130549213593230028501119355657023", "deposits": [ { "amount": "1000", From c0a744ff78838d64830fd91ee27832b876383663 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 30 Jun 2022 06:04:21 +0000 Subject: [PATCH 06/10] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 99 ++++++++++++++----- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 75 insertions(+), 30 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 7c4ffe3f0..b557d147d 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "124066.90992122554899051", + "locked_amount": "124008.79522048927894404", "deposits": [ { "amount": "129999.45", @@ -488,7 +488,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "64920.282900200533309644", + "locked_amount": "64863.27779240751495228", "deposits": [ { "amount": "97499.58", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "88734.8187053038755919178598", + "locked_amount": "88656.90256447211229139727136", "deposits": [ { "amount": "135173.4239508", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "27310.841902795210245196", + "locked_amount": "27286.860838372237989964", "deposits": [ { "amount": "32499.86", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8889.414021223106580976", + "locked_amount": "8881.60841746017135621", "deposits": [ { "amount": "10833.29", @@ -675,7 +675,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "15162.0598392210135", + "locked_amount": "15132.103430706522", "deposits": [ { "amount": "15000", @@ -761,7 +761,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "0", - "locked_amount": "1791069.20359461885617424", + "locked_amount": "1789767.182916946279710248", "deposits": [ { "amount": "1852091.69", @@ -1777,7 +1777,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "18705.279504739679372649", - "locked_amount": "14368.8290276002360637150799360994", + "locked_amount": "14330.5644808688870751077279135335", "deposits": [ { "amount": "2833.333333", @@ -5228,7 +5228,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "19457.000000000000000003", "total_removed": "5056.88782409978", - "locked_amount": "3464.51640617072490869053418046042617951", + "locked_amount": "3451.45746204337938102053216695205479458", "deposits": [ { "amount": "75", @@ -14143,7 +14143,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2776751.10658899011722599663", + "locked_amount": "2774750.35412286080128235476", "deposits": [ { "amount": "1998.95815", @@ -14855,8 +14855,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "8648.631845187181275", - "locked_amount": "15068326.9124081401505002201985233432454718", + "total_removed": "8977.81072959055965", + "locked_amount": "15061268.6943089959842249942267236851946472", "deposits": [ { "amount": "16249.93", @@ -15395,6 +15395,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28" }, + { + "amount": "329.178884403378375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44" + }, { "amount": "2446.31552516990115", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -15535,6 +15540,12 @@ "tranche_id": 2, "tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28" }, + { + "amount": "329.178884403378375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44" + }, { "amount": "2446.31552516990115", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -15579,8 +15590,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "8648.631845187181275", - "remaining_tokens": "186350.535654812818725" + "withdrawn_tokens": "8977.81072959055965", + "remaining_tokens": "186021.35677040944035" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -16984,8 +16995,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2114974.470447369009412382", - "locked_amount": "8261124.07347787718432629205300499", + "total_removed": "2115589.216953946963253382", + "locked_amount": "8254574.43964806567259694358749922", "deposits": [ { "amount": "129284.449", @@ -17249,6 +17260,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60" }, + { + "amount": "614.746506577953841", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d" + }, { "amount": "652.48254356494551875", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -18885,6 +18901,12 @@ "tranche_id": 3, "tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60" }, + { + "amount": "614.746506577953841", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d" + }, { "amount": "652.48254356494551875", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20123,8 +20145,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "155425.60534790600061725", - "remaining_tokens": "203697.86422709399938275" + "withdrawn_tokens": "156040.35185448395445825", + "remaining_tokens": "203083.11772051604554175" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -21121,7 +21143,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1404291.506600519461757227", - "locked_amount": "2947116.68075334794841710467486568", + "locked_amount": "2944528.88081533374708515086111941", "deposits": [ { "amount": "552496.6455", @@ -22265,8 +22287,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "34.173053016", - "locked_amount": "439992.08542504086111175159614408", + "total_removed": "75.634316334", + "locked_amount": "439675.0547599939598141733789954", "deposits": [ { "amount": "3000", @@ -28894,6 +28916,11 @@ "amount": "23.010020292", "user": "0xD27929d68ac0E5fd5C919A5eb5968C1D06D3Fb83", "tx": "0x8daf320262d0384cf5f9c290cc33721587beabd5e93026b3e9b76dc3fcd6659c" + }, + { + "amount": "41.461263318", + "user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19", + "tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c" } ], "users": [ @@ -43808,10 +43835,17 @@ "tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "41.461263318", + "user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19", + "tranche_id": 5, + "tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c" + } + ], "total_tokens": "600", - "withdrawn_tokens": "0", - "remaining_tokens": "600" + "withdrawn_tokens": "41.461263318", + "remaining_tokens": "558.538736682" }, { "address": "0xa37d20cd446898508Ab961c6Be8d3fe1c15413fA", @@ -47944,7 +47978,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "32508.6592656906377", + "total_removed": "32535.6624708206377", "locked_amount": "0", "deposits": [ { @@ -52259,6 +52293,11 @@ "user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D", "tx": "0x901a76735076a5058146ce6fc79628d78d71e8d2b3161459c2daf64ae043f1d5" }, + { + "amount": "27.00320513", + "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", + "tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d" + }, { "amount": "183.6335597275", "user": "0x690Fc36d52eD3f198F0eBDea1557333a1766f786", @@ -64718,6 +64757,12 @@ } ], "withdrawals": [ + { + "amount": "27.00320513", + "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", + "tranche_id": 6, + "tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d" + }, { "amount": "129.597196785", "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", @@ -64738,8 +64783,8 @@ } ], "total_tokens": "500", - "withdrawn_tokens": "472.99679487", - "remaining_tokens": "27.00320513" + "withdrawn_tokens": "500", + "remaining_tokens": "0" }, { "address": "0x45564345F125F78d3C3894A2C5226C673F8eB0Ae", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index 3fbf6605d..ee2fc6c34 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": "40.97730530187722", + "locked_amount": "40.910172501268394", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "313.512312912227253", + "locked_amount": "312.773852105530156", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 4b55ec46e..dc074c51a 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": "287.86130549213593230028501119355657023", + "locked_amount": "287.18326420598677960028433986555048196", "deposits": [ { "amount": "1000", From 8e6c066b9911d8b8dd8206b0b3c949bf06541612 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Thu, 30 Jun 2022 00:52:25 -0700 Subject: [PATCH 07/10] Feat/462 fills table mvp (no pagination) (#645) * feat: scaffold fills components * feat: add query for fills and populate data in basic table * feat: refactor portfolio page to use grid and add fills container * feat: add infinite scroll for fills * feat: try with data provider, get infinite scroll working * chore: remove infinite scrolling as subsequent pr will add it * chore: reorder columns * chore: remove Autosizer from portfolio grid children as its not needed * chore: move fills tab to the end * feat: add storybook, format cells * feat: add unit test for fills table * feat: convert lib to next lib * feat: add pagination variables to fills query to only get latest 300 * fix: fills data provider update function to return result of produce * fix: yarn.lock * fix: cypress run by moving test helpers * fix: re add test helpers for unit tests * fix: global connection tests * fix: use fills from mocks * feat: add update handler for fills * chore: move value formatter functions into module scope --- apps/trading-e2e/src/integration/global.cy.ts | 7 +- .../src/integration/portfolio-fills.cy.ts | 120 +++++++++ .../src/integration/portfolio.cy.ts | 6 - .../src/support/mocks/generate-fills.ts | 134 ++++++++++ apps/trading/pages/portfolio/index.page.tsx | 140 +++++----- libs/fills/.babelrc | 12 + libs/fills/.eslintrc.json | 18 ++ libs/fills/.storybook/main.js | 28 ++ libs/fills/.storybook/preview-head.html | 1 + libs/fills/.storybook/preview.js | 51 ++++ libs/fills/.storybook/styles.css | 3 + libs/fills/.storybook/tsconfig.json | 19 ++ libs/fills/README.md | 7 + libs/fills/jest.config.js | 15 ++ libs/fills/package.json | 4 + libs/fills/postcss.config.js | 10 + libs/fills/project.json | 74 ++++++ libs/fills/src/index.ts | 4 + .../fills/src/lib/__generated__/FillFields.ts | 197 ++++++++++++++ libs/fills/src/lib/__generated__/Fills.ts | 247 ++++++++++++++++++ libs/fills/src/lib/__generated__/FillsSub.ts | 208 +++++++++++++++ libs/fills/src/lib/fills-container.tsx | 18 ++ libs/fills/src/lib/fills-data-provider.ts | 117 +++++++++ libs/fills/src/lib/fills-manager.tsx | 80 ++++++ libs/fills/src/lib/fills-table.spec.tsx | 177 +++++++++++++ libs/fills/src/lib/fills-table.stories.tsx | 18 ++ libs/fills/src/lib/fills-table.tsx | 160 ++++++++++++ libs/fills/src/lib/test-helpers.ts | 134 ++++++++++ libs/fills/src/setup-tests.ts | 1 + libs/fills/tailwind.config.js | 17 ++ libs/fills/tsconfig.json | 28 ++ libs/fills/tsconfig.lib.json | 26 ++ libs/fills/tsconfig.spec.json | 19 ++ libs/types/src/__generated__/globalTypes.ts | 10 + tsconfig.base.json | 1 + workspace.json | 1 + 36 files changed, 2043 insertions(+), 69 deletions(-) create mode 100644 apps/trading-e2e/src/integration/portfolio-fills.cy.ts delete mode 100644 apps/trading-e2e/src/integration/portfolio.cy.ts create mode 100644 apps/trading-e2e/src/support/mocks/generate-fills.ts create mode 100644 libs/fills/.babelrc create mode 100644 libs/fills/.eslintrc.json create mode 100644 libs/fills/.storybook/main.js create mode 100644 libs/fills/.storybook/preview-head.html create mode 100644 libs/fills/.storybook/preview.js create mode 100644 libs/fills/.storybook/styles.css create mode 100644 libs/fills/.storybook/tsconfig.json create mode 100644 libs/fills/README.md create mode 100644 libs/fills/jest.config.js create mode 100644 libs/fills/package.json create mode 100644 libs/fills/postcss.config.js create mode 100644 libs/fills/project.json create mode 100644 libs/fills/src/index.ts create mode 100644 libs/fills/src/lib/__generated__/FillFields.ts create mode 100644 libs/fills/src/lib/__generated__/Fills.ts create mode 100644 libs/fills/src/lib/__generated__/FillsSub.ts create mode 100644 libs/fills/src/lib/fills-container.tsx create mode 100644 libs/fills/src/lib/fills-data-provider.ts create mode 100644 libs/fills/src/lib/fills-manager.tsx create mode 100644 libs/fills/src/lib/fills-table.spec.tsx create mode 100644 libs/fills/src/lib/fills-table.stories.tsx create mode 100644 libs/fills/src/lib/fills-table.tsx create mode 100644 libs/fills/src/lib/test-helpers.ts create mode 100644 libs/fills/src/setup-tests.ts create mode 100644 libs/fills/tailwind.config.js create mode 100644 libs/fills/tsconfig.json create mode 100644 libs/fills/tsconfig.lib.json create mode 100644 libs/fills/tsconfig.spec.json diff --git a/apps/trading-e2e/src/integration/global.cy.ts b/apps/trading-e2e/src/integration/global.cy.ts index 0736720a9..c4c468351 100644 --- a/apps/trading-e2e/src/integration/global.cy.ts +++ b/apps/trading-e2e/src/integration/global.cy.ts @@ -10,6 +10,7 @@ describe('vega wallet', () => { beforeEach(() => { // Using portfolio page as it requires vega wallet connection cy.visit('/portfolio'); + cy.get('main[data-testid="portfolio"]').should('exist'); }); it('can connect', () => { @@ -64,8 +65,10 @@ describe('vega wallet', () => { describe('ethereum wallet', () => { beforeEach(() => { cy.mockWeb3Provider(); - // Using portfolio is it requires Ethereum wallet connection + // Using portfolio withdrawals tab is it requires Ethereum wallet connection cy.visit('/portfolio'); + cy.get('main[data-testid="portfolio"]').should('exist'); + cy.getByTestId('Withdrawals').click(); }); it('can connect', () => { @@ -73,6 +76,6 @@ describe('ethereum wallet', () => { cy.getByTestId('web3-connector-list').should('exist'); cy.getByTestId('web3-connector-MetaMask').click(); cy.getByTestId('web3-connector-list').should('not.exist'); - cy.getByTestId('portfolio-grid').should('exist'); + cy.getByTestId('tab-withdrawals').should('not.be.empty'); }); }); diff --git a/apps/trading-e2e/src/integration/portfolio-fills.cy.ts b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts new file mode 100644 index 000000000..f22eeacd8 --- /dev/null +++ b/apps/trading-e2e/src/integration/portfolio-fills.cy.ts @@ -0,0 +1,120 @@ +import { aliasQuery } from '@vegaprotocol/cypress'; +import { generateFill, generateFills } from '../support/mocks/generate-fills'; +import { Side } from '@vegaprotocol/types'; +import { connectVegaWallet } from '../support/vega-wallet'; + +describe('fills', () => { + before(() => { + const fills = [ + generateFill({ + buyer: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + }), + generateFill({ + id: '1', + seller: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + aggressor: Side.Sell, + buyerFee: { + infrastructureFee: '5000', + }, + market: { + name: 'Apples Daily v3', + positionDecimalPlaces: 2, + }, + }), + generateFill({ + id: '2', + seller: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + aggressor: Side.Buy, + }), + generateFill({ + id: '3', + aggressor: Side.Sell, + market: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + buyer: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + }), + ]; + const result = generateFills({ + party: { + tradesPaged: { + edges: fills.map((f, i) => { + return { + __typename: 'TradeEdge', + node: f, + cursor: i.toString(), + }; + }), + }, + }, + }); + cy.mockGQL((req) => { + aliasQuery(req, 'Fills', result); + }); + cy.visit('/portfolio'); + cy.get('main[data-testid="portfolio"]').should('exist'); + }); + + it('renders fills', () => { + cy.getByTestId('Fills').click(); + cy.getByTestId('tab-fills').contains('Please connect Vega wallet'); + + connectVegaWallet(); + + cy.getByTestId('tab-fills').should('be.visible'); + + cy.getByTestId('tab-fills') + .get('[role="gridcell"][col-id="market.name"]') + .each(($marketSymbol) => { + cy.wrap($marketSymbol).invoke('text').should('not.be.empty'); + }); + cy.getByTestId('tab-fills') + .get('[role="gridcell"][col-id="size"]') + .each(($amount) => { + cy.wrap($amount).invoke('text').should('not.be.empty'); + }); + cy.getByTestId('tab-positions') + .get('[role="gridcell"][col-id="price"]') + .each(($prices) => { + cy.wrap($prices).invoke('text').should('not.be.empty'); + }); + cy.getByTestId('tab-positions') + .get('[role="gridcell"][col-id="price_1"]') + .each(($total) => { + cy.wrap($total).invoke('text').should('not.be.empty'); + }); + cy.getByTestId('tab-positions') + .get('[role="gridcell"][col-id="aggressor"]') + .each(($role) => { + cy.wrap($role) + .invoke('text') + .then((text) => { + const roles = ['Maker', 'Taker']; + expect(roles.indexOf(text.trim())).to.be.greaterThan(-1); + }); + }); + cy.getByTestId('tab-positions') + .get( + '[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]' + ) + .each(($fees) => { + cy.wrap($fees).invoke('text').should('not.be.empty'); + }); + const dateTimeRegex = + /(\d{1,2})\/(\d{1,2})\/(\d{4}), (\d{1,2}):(\d{1,2}):(\d{1,2})/gm; + cy.get('[col-id="createdAt"]').each(($tradeDateTime, index) => { + if (index != 0) { + //ignore header + cy.wrap($tradeDateTime).invoke('text').should('match', dateTimeRegex); + } + }); + }); +}); diff --git a/apps/trading-e2e/src/integration/portfolio.cy.ts b/apps/trading-e2e/src/integration/portfolio.cy.ts deleted file mode 100644 index 7415cac05..000000000 --- a/apps/trading-e2e/src/integration/portfolio.cy.ts +++ /dev/null @@ -1,6 +0,0 @@ -describe('portfolio', () => { - it('requires connecting', () => { - cy.visit('/portfolio'); - cy.get('main[data-testid="portfolio"]').should('exist'); - }); -}); diff --git a/apps/trading-e2e/src/support/mocks/generate-fills.ts b/apps/trading-e2e/src/support/mocks/generate-fills.ts new file mode 100644 index 000000000..fa55d9840 --- /dev/null +++ b/apps/trading-e2e/src/support/mocks/generate-fills.ts @@ -0,0 +1,134 @@ +import type { + Fills, + Fills_party_tradesPaged_edges_node, +} from '@vegaprotocol/fills'; +import { Side } from '@vegaprotocol/types'; +import merge from 'lodash/merge'; +import type { PartialDeep } from 'type-fest'; + +export const generateFills = (override?: PartialDeep): Fills => { + const fills: Fills_party_tradesPaged_edges_node[] = [ + generateFill({ + buyer: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + }), + generateFill({ + id: '1', + seller: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + aggressor: Side.Sell, + buyerFee: { + infrastructureFee: '5000', + }, + market: { + name: 'Apples Daily v3', + positionDecimalPlaces: 2, + }, + }), + generateFill({ + id: '2', + seller: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + aggressor: Side.Buy, + }), + generateFill({ + id: '3', + aggressor: Side.Sell, + market: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + buyer: { + id: Cypress.env('VEGA_PUBLIC_KEY'), + }, + }), + ]; + + const defaultResult: Fills = { + party: { + id: 'buyer-id', + tradesPaged: { + __typename: 'TradeConnection', + totalCount: 1, + edges: fills.map((f) => { + return { + __typename: 'TradeEdge', + node: f, + cursor: '3', + }; + }), + pageInfo: { + __typename: 'PageInfo', + startCursor: '1', + endCursor: '2', + }, + }, + __typename: 'Party', + }, + }; + + return merge(defaultResult, override); +}; + +export const generateFill = ( + override?: PartialDeep +) => { + const defaultFill: Fills_party_tradesPaged_edges_node = { + __typename: 'Trade', + id: '0', + createdAt: new Date().toISOString(), + price: '10000000', + size: '50000', + buyOrder: 'buy-order', + sellOrder: 'sell-order', + aggressor: Side.Buy, + buyer: { + __typename: 'Party', + id: 'buyer-id', + }, + seller: { + __typename: 'Party', + id: 'seller-id', + }, + buyerFee: { + __typename: 'TradeFee', + makerFee: '100', + infrastructureFee: '100', + liquidityFee: '100', + }, + sellerFee: { + __typename: 'TradeFee', + makerFee: '200', + infrastructureFee: '200', + liquidityFee: '200', + }, + market: { + __typename: 'Market', + id: 'market-id', + name: 'UNIDAI Monthly (30 Jun 2022)', + positionDecimalPlaces: 0, + decimalPlaces: 5, + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + id: 'instrument-id', + code: 'instrument-code', + product: { + __typename: 'Future', + settlementAsset: { + __typename: 'Asset', + id: 'asset-id', + symbol: 'SYM', + decimals: 18, + }, + }, + }, + }, + }, + }; + + return merge(defaultFill, override); +}; diff --git a/apps/trading/pages/portfolio/index.page.tsx b/apps/trading/pages/portfolio/index.page.tsx index 143ce1366..43310c627 100644 --- a/apps/trading/pages/portfolio/index.page.tsx +++ b/apps/trading/pages/portfolio/index.page.tsx @@ -5,71 +5,76 @@ import { OrderListContainer } from '@vegaprotocol/order-list'; import { AccountsContainer } from '@vegaprotocol/accounts'; import { AnchorButton, Tab, Tabs } from '@vegaprotocol/ui-toolkit'; import { WithdrawalsContainer } from './withdrawals/withdrawals-container'; +import { FillsContainer } from '@vegaprotocol/fills'; +import classNames from 'classnames'; +import type { ReactNode } from 'react'; const Portfolio = () => { - const tabClassName = 'p-[16px] pl-[316px]'; - + const wrapperClasses = classNames( + 'h-full max-h-full', + 'grid gap-4 grid-rows-[1fr_300px]', + 'bg-black-10 dark:bg-white-10', + 'text-ui' + ); + const tabContentClassName = 'h-full grid gap-4 grid-rows-[min-content_1fr]'; return ( - -
-
- -
- - -
-

- {t('Positions')} -

- -
-
- -
-

- {t('Orders')} -

- -
-
- -
-

- {t('Fills')} -

-
-
- -
-

- {t('History')} -

-
-
-
-
-
-
- - - - - - - {t('Deposit')} - - - +
+ + + +
+

+ {t('Positions')} +

+
+ +
+
+
+ +
+

+ {t('Orders')} +

+
+ +
+
+
+ +
+

+ {t('Fills')} +

+
+ +
+
+
+
+
+ + + + + + +
+
+ + {t('Deposit')} + +
+
+
+ + - -
-
-
-
+ + + + + ); }; @@ -78,3 +83,16 @@ Portfolio.getInitialProps = () => ({ }); export default Portfolio; + +interface PortfolioGridChildProps { + children: ReactNode; + className?: string; +} + +const PortfolioGridChild = ({ + children, + className, +}: PortfolioGridChildProps) => { + const gridChildClasses = classNames('bg-white dark:bg-black', className); + return
{children}
; +}; diff --git a/libs/fills/.babelrc b/libs/fills/.babelrc new file mode 100644 index 000000000..ccae900be --- /dev/null +++ b/libs/fills/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/fills/.eslintrc.json b/libs/fills/.eslintrc.json new file mode 100644 index 000000000..db820c5d0 --- /dev/null +++ b/libs/fills/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*", "__generated__"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/fills/.storybook/main.js b/libs/fills/.storybook/main.js new file mode 100644 index 000000000..9997fd7a1 --- /dev/null +++ b/libs/fills/.storybook/main.js @@ -0,0 +1,28 @@ +const rootMain = require('../../../.storybook/main'); + +module.exports = { + ...rootMain, + + core: { ...rootMain.core, builder: 'webpack5' }, + + stories: [ + ...rootMain.stories, + '../src/lib/**/*.stories.mdx', + '../src/lib/**/*.stories.@(js|jsx|ts|tsx)', + ], + addons: [ + ...rootMain.addons, + '@nrwl/react/plugins/storybook', + 'storybook-addon-themes', + ], + webpackFinal: async (config, { configType }) => { + // apply any global webpack configs that might have been specified in .storybook/main.js + if (rootMain.webpackFinal) { + config = await rootMain.webpackFinal(config, { configType }); + } + + // add your own webpack tweaks if needed + + return config; + }, +}; diff --git a/libs/fills/.storybook/preview-head.html b/libs/fills/.storybook/preview-head.html new file mode 100644 index 000000000..dd2e70030 --- /dev/null +++ b/libs/fills/.storybook/preview-head.html @@ -0,0 +1 @@ + diff --git a/libs/fills/.storybook/preview.js b/libs/fills/.storybook/preview.js new file mode 100644 index 000000000..fd45f3d42 --- /dev/null +++ b/libs/fills/.storybook/preview.js @@ -0,0 +1,51 @@ +import './styles.css'; +import { ThemeContext } from '@vegaprotocol/react-helpers'; +import { useEffect, useState } from 'react'; + +export const parameters = { + actions: { argTypesRegex: '^on[A-Z].*' }, + backgrounds: { disable: true }, + themes: { + default: 'dark', + list: [ + { name: 'dark', class: ['dark', 'bg-black'], color: '#000' }, + { name: 'light', class: '', color: '#FFF' }, + ], + }, +}; + +export const decorators = [ + (Story, context) => { + // storybook-addon-themes doesnt seem to provide the current selected + // theme in context, we need to provid it in JS as some components + // rely on it for rendering + const [theme, setTheme] = useState(context.parameters.themes.default); + + useEffect(() => { + const observer = new MutationObserver((mutationList) => { + if (mutationList.length) { + const body = mutationList[0].target; + if (body.classList.contains('dark')) { + setTheme('dark'); + } else { + setTheme('light'); + } + } + }); + + observer.observe(document.body, { attributes: true }); + + return () => { + observer.disconnect(); + }; + }, []); + + return ( +
+ + + +
+ ); + }, +]; diff --git a/libs/fills/.storybook/styles.css b/libs/fills/.storybook/styles.css new file mode 100644 index 000000000..b5c61c956 --- /dev/null +++ b/libs/fills/.storybook/styles.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; diff --git a/libs/fills/.storybook/tsconfig.json b/libs/fills/.storybook/tsconfig.json new file mode 100644 index 000000000..7a1170995 --- /dev/null +++ b/libs/fills/.storybook/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "emitDecoratorMetadata": true, + "outDir": "" + }, + "files": [ + "../../../node_modules/@nrwl/react/typings/styled-jsx.d.ts", + "../../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "../**/*.spec.ts", + "../**/*.spec.js", + "../**/*.spec.tsx", + "../**/*.spec.jsx" + ], + "include": ["../src/**/*", "*.js"] +} diff --git a/libs/fills/README.md b/libs/fills/README.md new file mode 100644 index 000000000..080b67b03 --- /dev/null +++ b/libs/fills/README.md @@ -0,0 +1,7 @@ +# fills + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test fills` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/fills/jest.config.js b/libs/fills/jest.config.js new file mode 100644 index 000000000..5daeb4ac3 --- /dev/null +++ b/libs/fills/jest.config.js @@ -0,0 +1,15 @@ +module.exports = { + displayName: 'fills', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/fills', + setupFilesAfterEnv: ['./src/setup-tests.ts'], +}; diff --git a/libs/fills/package.json b/libs/fills/package.json new file mode 100644 index 000000000..cb30ed0b7 --- /dev/null +++ b/libs/fills/package.json @@ -0,0 +1,4 @@ +{ + "name": "@vegaprotocol/fills", + "version": "0.0.1" +} diff --git a/libs/fills/postcss.config.js b/libs/fills/postcss.config.js new file mode 100644 index 000000000..cbdd9c22c --- /dev/null +++ b/libs/fills/postcss.config.js @@ -0,0 +1,10 @@ +const { join } = require('path'); + +module.exports = { + plugins: { + tailwindcss: { + config: join(__dirname, 'tailwind.config.js'), + }, + autoprefixer: {}, + }, +}; diff --git a/libs/fills/project.json b/libs/fills/project.json new file mode 100644 index 000000000..96f9c9196 --- /dev/null +++ b/libs/fills/project.json @@ -0,0 +1,74 @@ +{ + "root": "libs/fills", + "sourceRoot": "libs/fills/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/web:rollup", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/fills", + "tsConfig": "libs/fills/tsconfig.lib.json", + "project": "libs/fills/package.json", + "entryFile": "libs/fills/src/index.ts", + "external": ["react/jsx-runtime"], + "rollupConfig": "@nrwl/react/plugins/bundle-rollup", + "compiler": "babel", + "assets": [ + { + "glob": "libs/fills/README.md", + "input": ".", + "output": "." + } + ] + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/fills/**/*.{ts,tsx,js,jsx}"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/fills"], + "options": { + "jestConfig": "libs/fills/jest.config.js", + "passWithNoTests": true + } + }, + "storybook": { + "executor": "@nrwl/storybook:storybook", + "options": { + "uiFramework": "@storybook/react", + "port": 4400, + "config": { + "configFolder": "libs/fills/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + }, + "build-storybook": { + "executor": "@nrwl/storybook:build", + "outputs": ["{options.outputPath}"], + "options": { + "uiFramework": "@storybook/react", + "outputPath": "dist/storybook/fills", + "config": { + "configFolder": "libs/fills/.storybook" + } + }, + "configurations": { + "ci": { + "quiet": true + } + } + } + } +} diff --git a/libs/fills/src/index.ts b/libs/fills/src/index.ts new file mode 100644 index 000000000..76bbc310e --- /dev/null +++ b/libs/fills/src/index.ts @@ -0,0 +1,4 @@ +export * from './lib/fills-container'; +export * from './lib/__generated__/FillFields'; +export * from './lib/__generated__/Fills'; +export * from './lib/__generated__/FillsSub'; diff --git a/libs/fills/src/lib/__generated__/FillFields.ts b/libs/fills/src/lib/__generated__/FillFields.ts new file mode 100644 index 000000000..426e600ee --- /dev/null +++ b/libs/fills/src/lib/__generated__/FillFields.ts @@ -0,0 +1,197 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Side } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL fragment: FillFields +// ==================================================== + +export interface FillFields_buyer { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface FillFields_seller { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface FillFields_buyerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface FillFields_sellerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface FillFields_market_tradableInstrument_instrument_product_settlementAsset { + __typename: "Asset"; + /** + * The id of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset + */ + decimals: number; +} + +export interface FillFields_market_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * The name of the asset (string) + */ + settlementAsset: FillFields_market_tradableInstrument_instrument_product_settlementAsset; +} + +export interface FillFields_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Uniquely identify an instrument across all instruments available on Vega (string) + */ + id: string; + /** + * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) + */ + code: string; + /** + * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) + */ + product: FillFields_market_tradableInstrument_instrument_product; +} + +export interface FillFields_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of or reference to a fully specified instrument. + */ + instrument: FillFields_market_tradableInstrument_instrument; +} + +export interface FillFields_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; + /** + * Market full name + */ + name: string; + /** + * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct + * number denominated in the currency of the Market. (uint64) + * + * Examples: + * Currency Balance decimalPlaces Real Balance + * GBP 100 0 GBP 100 + * GBP 100 2 GBP 1.00 + * GBP 100 4 GBP 0.01 + * GBP 1 4 GBP 0.0001 ( 0.01p ) + * + * GBX (pence) 100 0 GBP 1.00 (100p ) + * GBX (pence) 100 2 GBP 0.01 ( 1p ) + * GBX (pence) 100 4 GBP 0.0001 ( 0.01p ) + * GBX (pence) 1 4 GBP 0.000001 ( 0.0001p) + */ + decimalPlaces: number; + /** + * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes. + * 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market. + */ + positionDecimalPlaces: number; + /** + * An instance of or reference to a tradable instrument. + */ + tradableInstrument: FillFields_market_tradableInstrument; +} + +export interface FillFields { + __typename: "Trade"; + /** + * The hash of the trade data + */ + id: string; + /** + * RFC3339Nano time for when the trade occurred + */ + createdAt: string; + /** + * The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64) + */ + price: string; + /** + * The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64) + */ + size: string; + /** + * The order that bought + */ + buyOrder: string; + /** + * The order that sold + */ + sellOrder: string; + /** + * The aggressor indicates whether this trade was related to a BUY or SELL + */ + aggressor: Side; + /** + * The party that bought + */ + buyer: FillFields_buyer; + /** + * The party that sold + */ + seller: FillFields_seller; + /** + * The fee paid by the buyer side of the trade + */ + buyerFee: FillFields_buyerFee; + /** + * The fee paid by the seller side of the trade + */ + sellerFee: FillFields_sellerFee; + /** + * The market the trade occurred on + */ + market: FillFields_market; +} diff --git a/libs/fills/src/lib/__generated__/Fills.ts b/libs/fills/src/lib/__generated__/Fills.ts new file mode 100644 index 000000000..623edabeb --- /dev/null +++ b/libs/fills/src/lib/__generated__/Fills.ts @@ -0,0 +1,247 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Pagination, Side } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: Fills +// ==================================================== + +export interface Fills_party_tradesPaged_edges_node_buyer { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface Fills_party_tradesPaged_edges_node_seller { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface Fills_party_tradesPaged_edges_node_buyerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface Fills_party_tradesPaged_edges_node_sellerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset { + __typename: "Asset"; + /** + * The id of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset + */ + decimals: number; +} + +export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * The name of the asset (string) + */ + settlementAsset: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset; +} + +export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Uniquely identify an instrument across all instruments available on Vega (string) + */ + id: string; + /** + * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) + */ + code: string; + /** + * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) + */ + product: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product; +} + +export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of or reference to a fully specified instrument. + */ + instrument: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument; +} + +export interface Fills_party_tradesPaged_edges_node_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; + /** + * Market full name + */ + name: string; + /** + * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct + * number denominated in the currency of the Market. (uint64) + * + * Examples: + * Currency Balance decimalPlaces Real Balance + * GBP 100 0 GBP 100 + * GBP 100 2 GBP 1.00 + * GBP 100 4 GBP 0.01 + * GBP 1 4 GBP 0.0001 ( 0.01p ) + * + * GBX (pence) 100 0 GBP 1.00 (100p ) + * GBX (pence) 100 2 GBP 0.01 ( 1p ) + * GBX (pence) 100 4 GBP 0.0001 ( 0.01p ) + * GBX (pence) 1 4 GBP 0.000001 ( 0.0001p) + */ + decimalPlaces: number; + /** + * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes. + * 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market. + */ + positionDecimalPlaces: number; + /** + * An instance of or reference to a tradable instrument. + */ + tradableInstrument: Fills_party_tradesPaged_edges_node_market_tradableInstrument; +} + +export interface Fills_party_tradesPaged_edges_node { + __typename: "Trade"; + /** + * The hash of the trade data + */ + id: string; + /** + * RFC3339Nano time for when the trade occurred + */ + createdAt: string; + /** + * The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64) + */ + price: string; + /** + * The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64) + */ + size: string; + /** + * The order that bought + */ + buyOrder: string; + /** + * The order that sold + */ + sellOrder: string; + /** + * The aggressor indicates whether this trade was related to a BUY or SELL + */ + aggressor: Side; + /** + * The party that bought + */ + buyer: Fills_party_tradesPaged_edges_node_buyer; + /** + * The party that sold + */ + seller: Fills_party_tradesPaged_edges_node_seller; + /** + * The fee paid by the buyer side of the trade + */ + buyerFee: Fills_party_tradesPaged_edges_node_buyerFee; + /** + * The fee paid by the seller side of the trade + */ + sellerFee: Fills_party_tradesPaged_edges_node_sellerFee; + /** + * The market the trade occurred on + */ + market: Fills_party_tradesPaged_edges_node_market; +} + +export interface Fills_party_tradesPaged_edges { + __typename: "TradeEdge"; + node: Fills_party_tradesPaged_edges_node; + cursor: string; +} + +export interface Fills_party_tradesPaged_pageInfo { + __typename: "PageInfo"; + startCursor: string; + endCursor: string; +} + +export interface Fills_party_tradesPaged { + __typename: "TradeConnection"; + /** + * The total number of trades in this connection + */ + totalCount: number; + /** + * The trade in this connection + */ + edges: Fills_party_tradesPaged_edges[]; + /** + * The pagination information + */ + pageInfo: Fills_party_tradesPaged_pageInfo; +} + +export interface Fills_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; + tradesPaged: Fills_party_tradesPaged; +} + +export interface Fills { + /** + * An entity that is trading on the VEGA network + */ + party: Fills_party | null; +} + +export interface FillsVariables { + partyId: string; + marketId?: string | null; + pagination?: Pagination | null; +} diff --git a/libs/fills/src/lib/__generated__/FillsSub.ts b/libs/fills/src/lib/__generated__/FillsSub.ts new file mode 100644 index 000000000..c1b056cf0 --- /dev/null +++ b/libs/fills/src/lib/__generated__/FillsSub.ts @@ -0,0 +1,208 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Side } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL subscription operation: FillsSub +// ==================================================== + +export interface FillsSub_trades_buyer { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface FillsSub_trades_seller { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface FillsSub_trades_buyerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface FillsSub_trades_sellerFee { + __typename: "TradeFee"; + /** + * The maker fee, aggressive party to the other party (the one who had an order in the book) + */ + makerFee: string; + /** + * The infrastructure fee, a fee paid to the node runner to maintain the vega network + */ + infrastructureFee: string; + /** + * The fee paid to the market makers to provide liquidity in the market + */ + liquidityFee: string; +} + +export interface FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset { + __typename: "Asset"; + /** + * The id of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset + */ + decimals: number; +} + +export interface FillsSub_trades_market_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * The name of the asset (string) + */ + settlementAsset: FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset; +} + +export interface FillsSub_trades_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Uniquely identify an instrument across all instruments available on Vega (string) + */ + id: string; + /** + * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) + */ + code: string; + /** + * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) + */ + product: FillsSub_trades_market_tradableInstrument_instrument_product; +} + +export interface FillsSub_trades_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of or reference to a fully specified instrument. + */ + instrument: FillsSub_trades_market_tradableInstrument_instrument; +} + +export interface FillsSub_trades_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; + /** + * Market full name + */ + name: string; + /** + * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct + * number denominated in the currency of the Market. (uint64) + * + * Examples: + * Currency Balance decimalPlaces Real Balance + * GBP 100 0 GBP 100 + * GBP 100 2 GBP 1.00 + * GBP 100 4 GBP 0.01 + * GBP 1 4 GBP 0.0001 ( 0.01p ) + * + * GBX (pence) 100 0 GBP 1.00 (100p ) + * GBX (pence) 100 2 GBP 0.01 ( 1p ) + * GBX (pence) 100 4 GBP 0.0001 ( 0.01p ) + * GBX (pence) 1 4 GBP 0.000001 ( 0.0001p) + */ + decimalPlaces: number; + /** + * positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64). + * i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes. + * 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market. + */ + positionDecimalPlaces: number; + /** + * An instance of or reference to a tradable instrument. + */ + tradableInstrument: FillsSub_trades_market_tradableInstrument; +} + +export interface FillsSub_trades { + __typename: "Trade"; + /** + * The hash of the trade data + */ + id: string; + /** + * RFC3339Nano time for when the trade occurred + */ + createdAt: string; + /** + * The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64) + */ + price: string; + /** + * The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64) + */ + size: string; + /** + * The order that bought + */ + buyOrder: string; + /** + * The order that sold + */ + sellOrder: string; + /** + * The aggressor indicates whether this trade was related to a BUY or SELL + */ + aggressor: Side; + /** + * The party that bought + */ + buyer: FillsSub_trades_buyer; + /** + * The party that sold + */ + seller: FillsSub_trades_seller; + /** + * The fee paid by the buyer side of the trade + */ + buyerFee: FillsSub_trades_buyerFee; + /** + * The fee paid by the seller side of the trade + */ + sellerFee: FillsSub_trades_sellerFee; + /** + * The market the trade occurred on + */ + market: FillsSub_trades_market; +} + +export interface FillsSub { + /** + * Subscribe to the trades updates + */ + trades: FillsSub_trades[] | null; +} + +export interface FillsSubVariables { + partyId: string; +} diff --git a/libs/fills/src/lib/fills-container.tsx b/libs/fills/src/lib/fills-container.tsx new file mode 100644 index 000000000..f5def05a1 --- /dev/null +++ b/libs/fills/src/lib/fills-container.tsx @@ -0,0 +1,18 @@ +import { t } from '@vegaprotocol/react-helpers'; +import { Splash } from '@vegaprotocol/ui-toolkit'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import { FillsManager } from './fills-manager'; + +export const FillsContainer = () => { + const { keypair } = useVegaWallet(); + + if (!keypair) { + return ( + +

{t('Please connect Vega wallet')}

+
+ ); + } + + return ; +}; diff --git a/libs/fills/src/lib/fills-data-provider.ts b/libs/fills/src/lib/fills-data-provider.ts new file mode 100644 index 000000000..d22993790 --- /dev/null +++ b/libs/fills/src/lib/fills-data-provider.ts @@ -0,0 +1,117 @@ +import { gql } from '@apollo/client'; +import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import produce from 'immer'; +import type { FillFields } from './__generated__/FillFields'; +import type { + Fills, + Fills_party_tradesPaged_edges_node, +} from './__generated__/Fills'; +import type { FillsSub } from './__generated__/FillsSub'; + +const FILL_FRAGMENT = gql` + fragment FillFields on Trade { + id + createdAt + price + size + buyOrder + sellOrder + aggressor + buyer { + id + } + seller { + id + } + buyerFee { + makerFee + infrastructureFee + liquidityFee + } + sellerFee { + makerFee + infrastructureFee + liquidityFee + } + market { + id + name + decimalPlaces + positionDecimalPlaces + tradableInstrument { + instrument { + id + code + product { + ... on Future { + settlementAsset { + id + symbol + decimals + } + } + } + } + } + } + } +`; + +export const FILLS_QUERY = gql` + ${FILL_FRAGMENT} + query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) { + party(id: $partyId) { + id + tradesPaged(marketId: $marketId, pagination: $pagination) { + totalCount + edges { + node { + ...FillFields + } + cursor + } + pageInfo { + startCursor + endCursor + } + } + } + } +`; + +export const FILLS_SUB = gql` + ${FILL_FRAGMENT} + subscription FillsSub($partyId: ID!) { + trades(partyId: $partyId) { + ...FillFields + } + } +`; + +const update = (data: FillFields[], delta: FillFields[]) => { + // Add or update incoming trades + return produce(data, (draft) => { + delta.forEach((trade) => { + const index = draft.findIndex((t) => t.id === trade.id); + if (index === -1) { + draft.unshift(trade); + } else { + draft[index] = trade; + } + }); + }); +}; + +const getData = ( + responseData: Fills +): Fills_party_tradesPaged_edges_node[] | null => + responseData.party?.tradesPaged.edges.map((e) => e.node) || null; +const getDelta = (subscriptionData: FillsSub) => subscriptionData.trades || []; + +export const fillsDataProvider = makeDataProvider( + FILLS_QUERY, + FILLS_SUB, + update, + getData, + getDelta +); diff --git a/libs/fills/src/lib/fills-manager.tsx b/libs/fills/src/lib/fills-manager.tsx new file mode 100644 index 000000000..0b1727e65 --- /dev/null +++ b/libs/fills/src/lib/fills-manager.tsx @@ -0,0 +1,80 @@ +import type { AgGridReact } from 'ag-grid-react'; +import { useCallback, useMemo, useRef } from 'react'; +import { FillsTable } from './fills-table'; +import { fillsDataProvider } from './fills-data-provider'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; +import type { FillsVariables } from './__generated__/Fills'; +import type { FillFields } from './__generated__/FillFields'; +import type { FillsSub_trades } from './__generated__/FillsSub'; +import isEqual from 'lodash/isEqual'; + +interface FillsManagerProps { + partyId: string; +} + +export const FillsManager = ({ partyId }: FillsManagerProps) => { + const gridRef = useRef(null); + const variables = useMemo( + () => ({ + partyId, + pagination: { + last: 300, + }, + }), + [partyId] + ); + const update = useCallback((delta: FillsSub_trades[]) => { + if (!gridRef.current) { + return false; + } + const updateRows: FillFields[] = []; + const add: FillFields[] = []; + + delta.forEach((d) => { + if (!gridRef.current?.api) { + return; + } + + const rowNode = gridRef.current.api.getRowNode(d.id); + + if (rowNode) { + if (!isEqual(d, rowNode.data)) { + updateRows.push(d); + } + } else { + add.push(d); + } + }); + + if (updateRows.length || add.length) { + gridRef.current.api.applyTransactionAsync({ + update: updateRows, + add, + addIndex: 0, + }); + } + + return true; + }, []); + + const { data, loading, error } = useDataProvider( + fillsDataProvider, + update, + variables + ); + + const fills = useMemo(() => { + if (!data?.length) { + return []; + } + + return data; + }, [data]); + + return ( + + + + ); +}; diff --git a/libs/fills/src/lib/fills-table.spec.tsx b/libs/fills/src/lib/fills-table.spec.tsx new file mode 100644 index 000000000..df98acf11 --- /dev/null +++ b/libs/fills/src/lib/fills-table.spec.tsx @@ -0,0 +1,177 @@ +import { render, act, screen, waitFor } from '@testing-library/react'; +import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { Side } from '@vegaprotocol/types'; +import type { PartialDeep } from 'type-fest'; + +import { FillsTable } from './fills-table'; +import { generateFill } from './test-helpers'; +import type { FillFields } from './__generated__/FillFields'; + +describe('FillsTable', () => { + let defaultFill: PartialDeep; + + beforeEach(() => { + defaultFill = { + price: '100', + size: '300000', + market: { + name: 'test market', + decimalPlaces: 2, + positionDecimalPlaces: 5, + tradableInstrument: { + instrument: { + product: { + settlementAsset: { + decimals: 2, + symbol: 'BTC', + }, + }, + }, + }, + }, + createdAt: new Date('2022-02-02T14:00:00').toISOString(), + }; + }); + + it('correct columns are rendered', async () => { + await act(async () => { + render(); + }); + + const headers = screen.getAllByRole('columnheader'); + expect(headers).toHaveLength(7); + expect(headers.map((h) => h.textContent?.trim())).toEqual([ + 'Market', + 'Amount', + 'Value', + 'Filled value', + 'Role', + 'Fee', + 'Date', + ]); + }); + + it('formats cells correctly for buyer fill', async () => { + const partyId = 'party-id'; + const buyerFill = generateFill({ + ...defaultFill, + buyer: { + id: partyId, + }, + aggressor: Side.Sell, + buyerFee: { + makerFee: '2', + infrastructureFee: '2', + liquidityFee: '2', + }, + }); + + const { container } = render( + + ); + + // Check grid has been rendered + await waitFor(() => { + expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument(); + }); + + const cells = screen.getAllByRole('gridcell'); + const expectedValues = [ + buyerFill.market.name, + '+3.00000', + '1.00 BTC', + '3.00 BTC', + 'Maker', + '0.06 BTC', + getDateTimeFormat().format(new Date(buyerFill.createdAt)), + ]; + cells.forEach((cell, i) => { + expect(cell).toHaveTextContent(expectedValues[i]); + }); + + const amountCell = cells.find((c) => c.getAttribute('col-id') === 'size'); + expect(amountCell).toHaveClass('text-vega-green'); + }); + + it('formats cells correctly for seller fill', async () => { + const partyId = 'party-id'; + const buyerFill = generateFill({ + ...defaultFill, + seller: { + id: partyId, + }, + aggressor: Side.Sell, + sellerFee: { + makerFee: '1', + infrastructureFee: '1', + liquidityFee: '1', + }, + }); + + const { container } = render( + + ); + + // Check grid has been rendered + await waitFor(() => { + expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument(); + }); + + const cells = screen.getAllByRole('gridcell'); + const expectedValues = [ + buyerFill.market.name, + '-3.00000', + '1.00 BTC', + '3.00 BTC', + 'Taker', + '0.03 BTC', + getDateTimeFormat().format(new Date(buyerFill.createdAt)), + ]; + cells.forEach((cell, i) => { + expect(cell).toHaveTextContent(expectedValues[i]); + }); + + const amountCell = cells.find((c) => c.getAttribute('col-id') === 'size'); + expect(amountCell).toHaveClass('text-vega-red'); + }); + + it('renders correct maker or taker role', async () => { + const partyId = 'party-id'; + const takerFill = generateFill({ + seller: { + id: partyId, + }, + aggressor: Side.Sell, + }); + + const { container, rerender } = render( + + ); + + // Check grid has been rendered + await waitFor(() => { + expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument(); + }); + + expect( + screen + .getAllByRole('gridcell') + .find((c) => c.getAttribute('col-id') === 'aggressor') + ).toHaveTextContent('Taker'); + + const makerFill = generateFill({ + seller: { + id: partyId, + }, + aggressor: Side.Buy, + }); + + rerender(); + + expect( + screen + .getAllByRole('gridcell') + .find((c) => c.getAttribute('col-id') === 'aggressor') + ).toHaveTextContent('Maker'); + }); +}); diff --git a/libs/fills/src/lib/fills-table.stories.tsx b/libs/fills/src/lib/fills-table.stories.tsx new file mode 100644 index 000000000..d24a8b69c --- /dev/null +++ b/libs/fills/src/lib/fills-table.stories.tsx @@ -0,0 +1,18 @@ +import type { Story, Meta } from '@storybook/react'; +import type { FillsTableProps } from './fills-table'; +import { FillsTable } from './fills-table'; +import { generateFills } from './test-helpers'; + +export default { + component: FillsTable, + title: 'FillsTable', +} as Meta; + +const Template: Story = (args) => ; + +export const Default = Template.bind({}); +const fills = generateFills(); +Default.args = { + partyId: 'party-id', + fills: fills.party?.tradesPaged.edges.map((e) => e.node), +}; diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx new file mode 100644 index 000000000..c8199e1ee --- /dev/null +++ b/libs/fills/src/lib/fills-table.tsx @@ -0,0 +1,160 @@ +import type { AgGridReact } from 'ag-grid-react'; +import { + addDecimal, + addDecimalsFormatNumber, + formatNumber, + getDateTimeFormat, + t, +} from '@vegaprotocol/react-helpers'; +import { AgGridColumn } from 'ag-grid-react'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import { forwardRef } from 'react'; +import type { FillFields } from './__generated__/FillFields'; +import type { ValueFormatterParams } from 'ag-grid-community'; +import BigNumber from 'bignumber.js'; +import { Side } from '@vegaprotocol/types'; + +export interface FillsTableProps { + partyId: string; + fills: FillFields[]; +} + +export const FillsTable = forwardRef( + ({ partyId, fills }, ref) => { + return ( + data.id} + > + + { + let className = ''; + if (data.buyer.id === partyId) { + className = 'text-vega-green'; + } else if (data.seller.id) { + className = 'text-vega-red'; + } + return className; + }} + valueFormatter={formatSize(partyId)} + /> + + + + + { + return getDateTimeFormat().format(new Date(value)); + }} + /> + + ); + } +); + +const formatPrice = ({ value, data }: ValueFormatterParams) => { + const asset = + data.market.tradableInstrument.instrument.product.settlementAsset.symbol; + const valueFormatted = addDecimalsFormatNumber( + value, + data.market.decimalPlaces + ); + return `${valueFormatted} ${asset}`; +}; + +const formatSize = (partyId: string) => { + return ({ value, data }: ValueFormatterParams) => { + let prefix; + if (data.buyer.id === partyId) { + prefix = '+'; + } else if (data.seller.id) { + prefix = '-'; + } + + const size = addDecimalsFormatNumber( + value, + data.market.positionDecimalPlaces + ); + return `${prefix}${size}`; + }; +}; + +const formatTotal = ({ value, data }: ValueFormatterParams) => { + const asset = + data.market.tradableInstrument.instrument.product.settlementAsset.symbol; + const size = new BigNumber( + addDecimal(data.size, data.market.positionDecimalPlaces) + ); + const price = new BigNumber(addDecimal(value, data.market.decimalPlaces)); + + const total = size.times(price).toString(); + const valueFormatted = formatNumber(total, data.market.decimalPlaces); + return `${valueFormatted} ${asset}`; +}; + +const formatRole = (partyId: string) => { + return ({ value, data }: ValueFormatterParams) => { + const taker = t('Taker'); + const maker = t('Maker'); + if (data.buyer.id === partyId) { + if (value === Side.Buy) { + return taker; + } else { + return maker; + } + } else if (data.seller.id === partyId) { + if (value === Side.Sell) { + return taker; + } else { + return maker; + } + } else { + return '-'; + } + }; +}; + +const formatFee = (partyId: string) => { + return ({ value, data }: ValueFormatterParams) => { + const asset = value.settlementAsset; + let feesObj; + if (data.buyer.id === partyId) { + feesObj = data.buyerFee; + } else if (data.seller.id === partyId) { + feesObj = data.sellerFee; + } else { + return '-'; + } + + const fee = new BigNumber(feesObj.makerFee) + .plus(feesObj.infrastructureFee) + .plus(feesObj.liquidityFee); + const totalFees = addDecimalsFormatNumber(fee.toString(), asset.decimals); + return `${totalFees} ${asset.symbol}`; + }; +}; diff --git a/libs/fills/src/lib/test-helpers.ts b/libs/fills/src/lib/test-helpers.ts new file mode 100644 index 000000000..19c3b3506 --- /dev/null +++ b/libs/fills/src/lib/test-helpers.ts @@ -0,0 +1,134 @@ +import { Side } from '@vegaprotocol/types'; +import merge from 'lodash/merge'; +import type { PartialDeep } from 'type-fest'; +import type { + Fills, + Fills_party_tradesPaged_edges_node, +} from './__generated__/Fills'; + +export const generateFills = (override?: PartialDeep): Fills => { + const fills: Fills_party_tradesPaged_edges_node[] = [ + generateFill({ + buyer: { + id: 'party-id', + }, + }), + generateFill({ + id: '1', + seller: { + id: 'party-id', + }, + aggressor: Side.Sell, + buyerFee: { + infrastructureFee: '5000', + }, + market: { + name: 'Apples Daily v3', + positionDecimalPlaces: 2, + }, + }), + generateFill({ + id: '2', + seller: { + id: 'party-id', + }, + aggressor: Side.Buy, + }), + generateFill({ + id: '3', + aggressor: Side.Sell, + market: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + buyer: { + id: 'party-id', + }, + }), + ]; + + const defaultResult: Fills = { + party: { + id: 'buyer-id', + tradesPaged: { + __typename: 'TradeConnection', + totalCount: 1, + edges: fills.map((f) => { + return { + __typename: 'TradeEdge', + node: f, + cursor: '3', + }; + }), + pageInfo: { + __typename: 'PageInfo', + startCursor: '1', + endCursor: '2', + }, + }, + __typename: 'Party', + }, + }; + + return merge(defaultResult, override); +}; + +export const generateFill = ( + override?: PartialDeep +) => { + const defaultFill: Fills_party_tradesPaged_edges_node = { + __typename: 'Trade', + id: '0', + createdAt: new Date().toISOString(), + price: '10000000', + size: '50000', + buyOrder: 'buy-order', + sellOrder: 'sell-order', + aggressor: Side.Buy, + buyer: { + __typename: 'Party', + id: 'buyer-id', + }, + seller: { + __typename: 'Party', + id: 'seller-id', + }, + buyerFee: { + __typename: 'TradeFee', + makerFee: '100', + infrastructureFee: '100', + liquidityFee: '100', + }, + sellerFee: { + __typename: 'TradeFee', + makerFee: '200', + infrastructureFee: '200', + liquidityFee: '200', + }, + market: { + __typename: 'Market', + id: 'market-id', + name: 'UNIDAI Monthly (30 Jun 2022)', + positionDecimalPlaces: 0, + decimalPlaces: 5, + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + id: 'instrument-id', + code: 'instrument-code', + product: { + __typename: 'Future', + settlementAsset: { + __typename: 'Asset', + id: 'asset-id', + symbol: 'SYM', + decimals: 18, + }, + }, + }, + }, + }, + }; + + return merge(defaultFill, override); +}; diff --git a/libs/fills/src/setup-tests.ts b/libs/fills/src/setup-tests.ts new file mode 100644 index 000000000..7b0828bfa --- /dev/null +++ b/libs/fills/src/setup-tests.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom'; diff --git a/libs/fills/tailwind.config.js b/libs/fills/tailwind.config.js new file mode 100644 index 000000000..1deb8143d --- /dev/null +++ b/libs/fills/tailwind.config.js @@ -0,0 +1,17 @@ +const { join } = require('path'); +const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind'); +const theme = require('../tailwindcss-config/src/theme'); +const vegaCustomClasses = require('../tailwindcss-config/src/vega-custom-classes'); + +module.exports = { + content: [ + join(__dirname, 'src/**/*.{ts,tsx,html,mdx}'), + join(__dirname, '.storybook/preview.js'), + ...createGlobPatternsForDependencies(__dirname), + ], + darkMode: 'class', + theme: { + extend: theme, + }, + plugins: [vegaCustomClasses], +}; diff --git a/libs/fills/tsconfig.json b/libs/fills/tsconfig.json new file mode 100644 index 000000000..9fff9cc2d --- /dev/null +++ b/libs/fills/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + }, + { + "path": "./.storybook/tsconfig.json" + } + ] +} diff --git a/libs/fills/tsconfig.lib.json b/libs/fills/tsconfig.lib.json new file mode 100644 index 000000000..ad9c3d024 --- /dev/null +++ b/libs/fills/tsconfig.lib.json @@ -0,0 +1,26 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx", + "**/*.stories.ts", + "**/*.stories.js", + "**/*.stories.jsx", + "**/*.stories.tsx" + ], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/libs/fills/tsconfig.spec.json b/libs/fills/tsconfig.spec.json new file mode 100644 index 000000000..86a9fa994 --- /dev/null +++ b/libs/fills/tsconfig.spec.json @@ -0,0 +1,19 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node", "@testing-library/jest-dom"] + }, + "include": [ + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 4e275a805..ba6288849 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -288,6 +288,16 @@ export enum WithdrawalStatus { Rejected = "Rejected", } +/** + * Pagination constructs to support cursor based pagination in the API + */ +export interface Pagination { + first?: number | null; + after?: string | null; + last?: number | null; + before?: string | null; +} + //============================================================== // END Enums and Input Objects //============================================================== diff --git a/tsconfig.base.json b/tsconfig.base.json index 9c8bdb87a..c3bdf503e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -22,6 +22,7 @@ "@vegaprotocol/deal-ticket": ["libs/deal-ticket/src/index.ts"], "@vegaprotocol/deposits": ["libs/deposits/src/index.ts"], "@vegaprotocol/environment": ["libs/environment/src/index.ts"], + "@vegaprotocol/fills": ["libs/fills/src/index.ts"], "@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"], "@vegaprotocol/market-list": ["libs/market-list/src/index.ts"], "@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"], diff --git a/workspace.json b/workspace.json index 5d672ae34..38526f4b7 100644 --- a/workspace.json +++ b/workspace.json @@ -9,6 +9,7 @@ "environment": "libs/environment", "explorer": "apps/explorer", "explorer-e2e": "apps/explorer-e2e", + "fills": "libs/fills", "market-depth": "libs/market-depth", "market-list": "libs/market-list", "network-stats": "libs/network-stats", From 87338c4f2f6f945e5ba041f14a1fcc2a4b84e3ed Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 30 Jun 2022 12:05:17 +0000 Subject: [PATCH 08/10] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 92 ++++++++++++++----- apps/static/src/assets/stagnet1-tranches.json | 4 +- apps/static/src/assets/testnet-tranches.json | 2 +- 3 files changed, 71 insertions(+), 27 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b557d147d..12291450d 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "124008.79522048927894404", + "locked_amount": "123949.3351449367653555", "deposits": [ { "amount": "129999.45", @@ -488,7 +488,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "64863.27779240751495228", + "locked_amount": "64804.952997247079204604", "deposits": [ { "amount": "97499.58", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "88656.90256447211229139727136", + "locked_amount": "88577.18263884362270361639432", "deposits": [ { "amount": "135173.4239508", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "27286.860838372237989964", + "locked_amount": "27262.324604263582721104", "deposits": [ { "amount": "32499.86", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8881.60841746017135621", + "locked_amount": "8873.622111351784071168", "deposits": [ { "amount": "10833.29", @@ -675,7 +675,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "15132.103430706522", + "locked_amount": "15101.45352128623275", "deposits": [ { "amount": "15000", @@ -761,7 +761,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "0", - "locked_amount": "1789767.182916946279710248", + "locked_amount": "1788435.020023831121162896", "deposits": [ { "amount": "1852091.69", @@ -1777,7 +1777,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "18705.279504739679372649", - "locked_amount": "14330.5644808688870751077279135335", + "locked_amount": "14291.414097045104884895635487211", "deposits": [ { "amount": "2833.333333", @@ -5228,7 +5228,7 @@ "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "19457.000000000000000003", "total_removed": "5056.88782409978", - "locked_amount": "3451.45746204337938102053216695205479458", + "locked_amount": "3438.09619897894364166053010683028919314", "deposits": [ { "amount": "75", @@ -14143,7 +14143,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2774750.35412286080128235476", + "locked_amount": "2772703.2835660003368440463", "deposits": [ { "amount": "1998.95815", @@ -14856,7 +14856,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "8977.81072959055965", - "locked_amount": "15061268.6943089959842249942267236851946472", + "locked_amount": "15054047.07609322321427388182456345806299", "deposits": [ { "amount": "16249.93", @@ -16995,8 +16995,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2115589.216953946963253382", - "locked_amount": "8254574.43964806567259694358749922", + "total_removed": "2158746.556523576443330677", + "locked_amount": "8247873.1795980633455589418403988", "deposits": [ { "amount": "129284.449", @@ -17265,6 +17265,21 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d" }, + { + "amount": "17701.463096745440206695", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210" + }, + { + "amount": "20364.3503859717532968", + "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", + "tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5" + }, + { + "amount": "5091.5260869122865738", + "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", + "tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339" + }, { "amount": "652.48254356494551875", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20293,6 +20308,12 @@ } ], "withdrawals": [ + { + "amount": "5091.5260869122865738", + "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", + "tranche_id": 3, + "tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339" + }, { "amount": "6310.1901227904940866", "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", @@ -20319,8 +20340,8 @@ } ], "total_tokens": "66299.71746", - "withdrawn_tokens": "23745.761900811119424", - "remaining_tokens": "42553.955559188880576" + "withdrawn_tokens": "28837.2879877234059978", + "remaining_tokens": "37462.4294722765940022" }, { "address": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", @@ -20637,6 +20658,12 @@ } ], "withdrawals": [ + { + "amount": "20364.3503859717532968", + "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", + "tranche_id": 3, + "tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5" + }, { "amount": "25242.3008271937471296", "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", @@ -20663,8 +20690,8 @@ } ], "total_tokens": "265198.86984", - "withdrawn_tokens": "94983.1600369573350624", - "remaining_tokens": "170215.7098030426649376" + "withdrawn_tokens": "115347.5104229290883592", + "remaining_tokens": "149851.3594170709116408" }, { "address": "0x35022e6c85B50F4904C7BC7e692A9F3bbEE8D2CE", @@ -20834,6 +20861,12 @@ } ], "withdrawals": [ + { + "amount": "17701.463096745440206695", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tranche_id": 3, + "tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210" + }, { "amount": "45513.77740810577941926", "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", @@ -20854,8 +20887,8 @@ } ], "total_tokens": "230391.5181735", - "withdrawn_tokens": "82506.25192192818881679", - "remaining_tokens": "147885.26625157181118321" + "withdrawn_tokens": "100207.715018673629023485", + "remaining_tokens": "130183.803154826370976515" }, { "address": "0xC6b2864fbCD2A8dEC8DEfD1D421bC1E450C370AD", @@ -21142,8 +21175,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1404291.506600519461757227", - "locked_amount": "2944528.88081533374708515086111941", + "total_removed": "1417003.438054406291892727", + "locked_amount": "2941881.17244069509858904234270872", "deposits": [ { "amount": "552496.6455", @@ -21302,6 +21335,11 @@ "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", "tx": "0xc695996be3df837d7040aec8c5532965ac6554d5615575ee46fc87d604e2ebc0" }, + { + "amount": "12711.9314538868301355", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3" + }, { "amount": "13341.31568777778021", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -21670,6 +21708,12 @@ } ], "withdrawals": [ + { + "amount": "12711.9314538868301355", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tranche_id": 4, + "tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3" + }, { "amount": "32683.576612762644585", "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", @@ -21690,8 +21734,8 @@ } ], "total_tokens": "165749.29365", - "withdrawn_tokens": "68641.624849504055385", - "remaining_tokens": "97107.668800495944615" + "withdrawn_tokens": "81353.5563033908855205", + "remaining_tokens": "84395.7373466091144795" }, { "address": "0x72e7BB93E73b2885a22CA29c34759361399a5C0e", @@ -22288,7 +22332,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "75.634316334", - "locked_amount": "439675.0547599939598141733789954", + "locked_amount": "439350.6847287052296870462810756", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index ee2fc6c34..bd07f8956 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": "40.910172501268394", + "locked_amount": "40.84151128868595", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "312.773852105530156", + "locked_amount": "312.01857876712325", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index dc074c51a..d502d2247 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": "287.18326420598677960028433986555048196", + "locked_amount": "286.4897859589040750002836532534246575", "deposits": [ { "amount": "1000", From 282f714d5b8d5c9d1a455987695eef24749f470d Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Thu, 30 Jun 2022 14:38:32 +0100 Subject: [PATCH 09/10] frontend-monorepo-678: Improved text colour for syntax highlighter light theme (#679) --- libs/tailwindcss-config/src/vega-custom-classes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/tailwindcss-config/src/vega-custom-classes.js b/libs/tailwindcss-config/src/vega-custom-classes.js index 796eb8f02..35a174bf2 100644 --- a/libs/tailwindcss-config/src/vega-custom-classes.js +++ b/libs/tailwindcss-config/src/vega-custom-classes.js @@ -13,7 +13,7 @@ const vegaCustomClasses = plugin(function ({ addUtilities }) { overflowX: 'auto', padding: '1em', background: theme.colors.white.DEFAULT, - color: theme.colors.black[25], + color: theme.colors.black[70], border: `1px solid #${theme.colors.black[40]}`, }, '.dark .syntax-highlighter-wrapper .hljs': { From 50693d2df9f601741d36b91ada76ac0c9b489bac Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Thu, 30 Jun 2022 14:57:06 +0100 Subject: [PATCH 10/10] frontend-monorepo-684: Txs list item dialog close button fixed (#685) --- .../app/components/txs/txs-infinite-list-item.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx index caaad0bf7..d5870ee83 100644 --- a/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx +++ b/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx @@ -56,14 +56,14 @@ export const TxsInfiniteListItem = ({ data-testid="command-details" > - setOpen(isOpen)} - intent={Intent.None} - > - - + setOpen(false)} + intent={Intent.None} + > + + );