From 578d6ecf6fdb95c94d9d9836111a24eed48998a7 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 6 Sep 2022 00:08:57 +0000 Subject: [PATCH 01/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 50 ++++++++++++-------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 17af2e84d..bb0642994 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -212,7 +212,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107996.023348302538472835", + "locked_amount": "107936.02786848641935224", "deposits": [ { "amount": "129999.45", @@ -278,7 +278,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "52203.22326864535972", + "locked_amount": "52166.777219685443", "deposits": [ { "amount": "2600", @@ -662,7 +662,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "49156.240242964405462782", + "locked_amount": "49097.390266096535661786", "deposits": [ { "amount": "97499.58", @@ -695,7 +695,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "67188.09394129019011339723764", + "locked_amount": "67107.65618293646347597256748", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +728,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20679.181387351489634202", + "locked_amount": "20654.424218367917176256", "deposits": [ { "amount": "32499.86", @@ -761,7 +761,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6730.87287555657587691", + "locked_amount": "6722.814657290304874002", "deposits": [ { "amount": "10833.29", @@ -869,7 +869,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "6877.99337635869525", + "locked_amount": "6847.06748188405725", "deposits": [ { "amount": "15000", @@ -955,7 +955,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1431011.82807038631089486", + "locked_amount": "1429667.669805819350218286", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1241,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "34241.76526645531325", + "locked_amount": "34183.34968800321925", "deposits": [ { "amount": "12500", @@ -2108,7 +2108,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3787.2518622181223065369776702388", + "locked_amount": "3747.7489513881696342917062292252", "deposits": [ { "amount": "2833.333333", @@ -5831,7 +5831,7 @@ "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "35910.000000000000000003", - "total_removed": "16162.59106856284", + "total_removed": "16732.59106856284", "locked_amount": "0", "deposits": [ { @@ -11896,6 +11896,11 @@ "user": "0xaaaaFd67947Ef241D8C24C863893800083855Ed6", "tx": "0x26f83e1b57a646b5266f07b00f13f47d3983978d96e921349b24a8b2df0fbc3d" }, + { + "amount": "570", + "user": "0x33Ce1D9E53AFb7367E34749517C086405a651a95", + "tx": "0x818a1a6d0d22a088d468459803255b5f698843f7a89829991e2dc7920d8e8be6" + }, { "amount": "3.678519786", "user": "0xc5467213593778E528f0eB8117cc7AFBC5b7491b", @@ -14583,10 +14588,17 @@ "tx": "0x2368becf6a676e7a6a866d621fc7d6f321b70463f1d7fd00e2f88802d3c8807c" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "570", + "user": "0x33Ce1D9E53AFb7367E34749517C086405a651a95", + "tranche_id": 11, + "tx": "0x818a1a6d0d22a088d468459803255b5f698843f7a89829991e2dc7920d8e8be6" + } + ], "total_tokens": "570", - "withdrawn_tokens": "0", - "remaining_tokens": "570" + "withdrawn_tokens": "570", + "remaining_tokens": "0" }, { "address": "0x94097462EF7c43D0aC732E7B18f830096D95207C", @@ -22202,7 +22214,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2223468.2790719446818264312", + "locked_amount": "2221402.77580550785195308478", "deposits": [ { "amount": "1998.95815", @@ -23059,7 +23071,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "188731.5544957414143694", - "locked_amount": "13116465.8335210202174881886663000658191403", + "locked_amount": "13109179.1887282219720601794047636901757232", "deposits": [ { "amount": "16249.93", @@ -26055,7 +26067,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2723422.352074488493348197", - "locked_amount": "6449905.55149414870763985024766746", + "locked_amount": "6443143.950397334081710571173710405", "deposits": [ { "amount": "129284.449", @@ -31116,7 +31128,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1733643.914423703455421207", - "locked_amount": "2231493.288559158210914140485303645", + "locked_amount": "2228821.739071983619620810817548931", "deposits": [ { "amount": "552496.6455", @@ -32514,7 +32526,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "2932.49091410726", - "locked_amount": "352321.25870548864931294453272452", + "locked_amount": "351993.96790600178014459879857936", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 35c7dc1f2..5488eac6e 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "100.40186580416034230009940778792491123", + "locked_amount": "99.70182204464736060009871467529173006", "deposits": [ { "amount": "1000", From 5eb06254de5f9538cff40168ecaf2de48b320bc9 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Mon, 5 Sep 2022 18:30:13 -0700 Subject: [PATCH 02/66] feat (#896): large withdraws (#1180) * feat: add deposits table to deposits tab on portfolio page * feat: refactor use-withdraw hook to not invoke eth tx * feat: rename hook for clarity * feat: fix withdrawal creation test * feat: update withdraw-manager and withrawals-table tests * chore: fix lint * feat: remove web3 input to avoid double dialog * chore: use renderHook from testing-library/react * chore: update to use non deprecated fields * chore: remove usage of all bridge contract * feat: correctly merge cache update in withdrawals table * feat: changes to support token app withdrawals * chore: add height to ag grid table wrapping element * feat: add txhash col to withdraw table * feat: provide better ui if withdrawal is not ready to be completed * feat: use separate dialogs for txs * feat: allow user to immediately complete withdrawal if delay not triggered * feat: add withdraw store to tidy up state management * chore: fix tests * chore: convert callback to promises, fix tests, delete withdraw page * chore: fix lint errors * fix: withdrawals link in nav * feat: style changes after design update * fix: proposal form test * chore: tidy error ui logic * feat: review comments * chore: lint * feat: add better typing for tables * chore: put withdrawals tab at the end * chore: update i18n * fix: dialog in positions manager due to rename * chore: increase spacing in withdrawal form * chore: update tests * chore: lint * chore: use new assetsConnection and update cy test * fix: incorrect shape of withdrawal generate function * feat: delete withdrawals page now that its shown on the portfolio page * chore: update tests to check for withdrawals page * chore: fix tests again * fix: page title test --- .../deal-ticket/deal-ticket-steps.tsx | 7 +- .../token-e2e/src/integration/view/home.cy.js | 2 +- .../src/integration/view/withdraw.cy.js | 13 +- .../token-e2e/src/support/common.functions.js | 2 +- apps/token/src/components/nav/nav.tsx | 2 +- apps/token/src/i18n/translations/dev.json | 2 +- apps/token/src/routes/router-config.tsx | 12 - apps/token/src/routes/routes.ts | 1 - .../withdraw/__generated__/WithdrawPage.ts | 207 ---------------- .../src/routes/withdraw/eth-address-input.tsx | 57 ----- apps/token/src/routes/withdraw/index.tsx | 166 ------------- apps/token/src/routes/withdrawals/index.tsx | 156 ++----------- .../src/integration/withdraw.cy.ts | 24 +- .../src/integration/withdrawals.cy.ts | 77 ------ .../mocks/generate-withdraw-page-query.ts | 2 +- .../src/support/mocks/generate-withdrawals.ts | 107 +++++---- apps/trading/.env | 2 +- apps/trading/.env.testnet | 2 +- apps/trading/lib/apollo-client.ts | 3 + .../portfolio/__generated__/AssetFields.ts | 46 ++++ .../__generated__/WithdrawFormQuery.ts | 119 ++++++++++ .../pages/portfolio/deposits-container.tsx | 26 ++- apps/trading/pages/portfolio/index.page.tsx | 11 +- .../pages/portfolio/withdraw/index.page.tsx | 36 --- .../withdraw/withdraw-page-container.tsx | 101 -------- .../pages/portfolio/withdrawals-container.tsx | 68 +++--- .../portfolio/withdrawals/index.page.tsx | 15 -- .../src/components/deal-ticket-manager.tsx | 7 +- libs/deposits/src/index.ts | 2 + .../src/lib/__generated__/DepositEventSub.ts | 83 +++++++ .../src/lib/__generated__/DepositFields.ts | 58 +++++ .../src/lib/__generated__/Deposits.ts | 94 ++++++++ .../src/lib/__generated__/DepositsQuery.ts | 94 ++++++++ libs/deposits/src/lib/deposits-table.tsx | 81 +++++++ libs/deposits/src/lib/use-deposits.ts | 153 ++++++++++++ .../governance/src/lib/proposal-form.spec.tsx | 2 +- libs/governance/src/lib/proposal-form.tsx | 43 ++-- .../proposals-hooks/use-proposal-submit.ts | 5 +- .../lib/components/order-list/order-list.tsx | 8 +- .../src/lib/order-hooks/use-order-cancel.tsx | 4 +- .../src/lib/order-hooks/use-order-edit.tsx | 4 +- .../src/lib/order-hooks/use-order-submit.tsx | 4 +- libs/positions/src/lib/positions-manager.tsx | 6 +- libs/positions/src/lib/use-close-position.ts | 4 +- .../src/contracts/collateral-bridge.ts | 3 + .../src/components/ag-grid/index.tsx | 28 +++ libs/wallet/src/use-vega-transaction.tsx | 4 +- .../vega-transaction-dialog.tsx | 18 +- libs/web3/src/index.ts | 2 +- .../dialog-rows.tsx | 0 .../ethereum-transaction-dialog.spec.tsx} | 24 +- .../ethereum-transaction-dialog.tsx | 125 ++++++++++ .../lib/ethereum-transaction-dialog/index.ts | 1 + libs/web3/src/lib/transaction-dialog/index.ts | 1 - .../transaction-dialog/transaction-dialog.tsx | 115 --------- .../web3/src/lib/use-ethereum-transaction.tsx | 6 +- libs/withdraws/src/index.ts | 7 +- .../src/lib/__generated__/AssetFields.ts | 46 ++++ .../lib/__generated__/WithdrawFormQuery.ts | 42 ++-- .../src/lib/__generated__/WithdrawalEvent.ts | 22 ++ .../src/lib/__generated__/WithdrawalFields.ts | 22 ++ .../src/lib/__generated__/Withdrawals.ts | 47 +++- libs/withdraws/src/lib/test-helpers.ts | 11 +- .../src/lib/use-complete-withdraw.spec.tsx | 18 +- .../src/lib/use-complete-withdraw.ts | 17 +- .../src/lib/use-create-withdraw.spec.tsx | 197 ++++++++++++++++ libs/withdraws/src/lib/use-create-withdraw.ts | 74 ++++++ .../src/lib/use-get-withdraw-delay.ts | 21 ++ .../src/lib/use-get-withdraw-limits.tsx | 30 --- .../src/lib/use-get-withdraw-threshold.tsx | 32 +++ .../src/lib/use-verify-withdrawal.ts | 135 +++++++++++ libs/withdraws/src/lib/use-withdraw.spec.tsx | 189 --------------- libs/withdraws/src/lib/use-withdraw.ts | 115 --------- .../src/lib/use-withdrawal-approval.ts | 58 +++++ .../withdraws/src/lib/use-withdrawal-event.ts | 61 +++++ .../src/lib/use-withdrawals.spec.tsx | 74 +++++- libs/withdraws/src/lib/use-withdrawals.ts | 70 ++++-- .../src/lib/withdraw-dialog.spec.tsx | 113 --------- libs/withdraws/src/lib/withdraw-dialog.tsx | 182 --------------- .../src/lib/withdraw-form-container.tsx | 90 +++++++ libs/withdraws/src/lib/withdraw-form.spec.tsx | 13 +- libs/withdraws/src/lib/withdraw-form.tsx | 220 +++++++++--------- libs/withdraws/src/lib/withdraw-limits.tsx | 43 ++-- .../src/lib/withdraw-manager.spec.tsx | 89 +++---- libs/withdraws/src/lib/withdraw-manager.tsx | 146 +++++------- libs/withdraws/src/lib/withdraw-store.ts | 24 ++ libs/withdraws/src/lib/withdrawal-dialogs.tsx | 49 ++++ .../withdraws/src/lib/withdrawal-feedback.tsx | 96 ++++++++ .../src/lib/withdrawals-table.spec.tsx | 97 ++++---- libs/withdraws/src/lib/withdrawals-table.tsx | 199 ++++++++++++---- libs/withdraws/tsconfig.spec.json | 1 - 91 files changed, 2713 insertions(+), 2182 deletions(-) delete mode 100644 apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts delete mode 100644 apps/token/src/routes/withdraw/eth-address-input.tsx delete mode 100644 apps/token/src/routes/withdraw/index.tsx delete mode 100644 apps/trading-e2e/src/integration/withdrawals.cy.ts create mode 100644 apps/trading/pages/portfolio/__generated__/AssetFields.ts create mode 100644 apps/trading/pages/portfolio/__generated__/WithdrawFormQuery.ts delete mode 100644 apps/trading/pages/portfolio/withdraw/index.page.tsx delete mode 100644 apps/trading/pages/portfolio/withdraw/withdraw-page-container.tsx delete mode 100644 apps/trading/pages/portfolio/withdrawals/index.page.tsx create mode 100644 libs/deposits/src/lib/__generated__/DepositEventSub.ts create mode 100644 libs/deposits/src/lib/__generated__/DepositFields.ts create mode 100644 libs/deposits/src/lib/__generated__/Deposits.ts create mode 100644 libs/deposits/src/lib/__generated__/DepositsQuery.ts create mode 100644 libs/deposits/src/lib/deposits-table.tsx create mode 100644 libs/deposits/src/lib/use-deposits.ts rename libs/web3/src/lib/{transaction-dialog => ethereum-transaction-dialog}/dialog-rows.tsx (100%) rename libs/web3/src/lib/{transaction-dialog/transaction-dialog.spec.tsx => ethereum-transaction-dialog/ethereum-transaction-dialog.spec.tsx} (82%) create mode 100644 libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx create mode 100644 libs/web3/src/lib/ethereum-transaction-dialog/index.ts delete mode 100644 libs/web3/src/lib/transaction-dialog/index.ts delete mode 100644 libs/web3/src/lib/transaction-dialog/transaction-dialog.tsx create mode 100644 libs/withdraws/src/lib/__generated__/AssetFields.ts rename apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts => libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts (61%) create mode 100644 libs/withdraws/src/lib/use-create-withdraw.spec.tsx create mode 100644 libs/withdraws/src/lib/use-create-withdraw.ts create mode 100644 libs/withdraws/src/lib/use-get-withdraw-delay.ts delete mode 100644 libs/withdraws/src/lib/use-get-withdraw-limits.tsx create mode 100644 libs/withdraws/src/lib/use-get-withdraw-threshold.tsx create mode 100644 libs/withdraws/src/lib/use-verify-withdrawal.ts delete mode 100644 libs/withdraws/src/lib/use-withdraw.spec.tsx delete mode 100644 libs/withdraws/src/lib/use-withdraw.ts create mode 100644 libs/withdraws/src/lib/use-withdrawal-approval.ts create mode 100644 libs/withdraws/src/lib/use-withdrawal-event.ts delete mode 100644 libs/withdraws/src/lib/withdraw-dialog.spec.tsx delete mode 100644 libs/withdraws/src/lib/withdraw-dialog.tsx create mode 100644 libs/withdraws/src/lib/withdraw-form-container.tsx create mode 100644 libs/withdraws/src/lib/withdraw-store.ts create mode 100644 libs/withdraws/src/lib/withdrawal-dialogs.tsx create mode 100644 libs/withdraws/src/lib/withdrawal-feedback.tsx diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx index e8b584fd2..adeafd80b 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx @@ -110,8 +110,7 @@ export const DealTicketSteps = ({ fieldErrors: errors, }); - const { submit, transaction, finalizedOrder, TransactionDialog } = - useOrderSubmit(); + const { submit, transaction, finalizedOrder, Dialog } = useOrderSubmit(); const onSizeChange = (value: number[]) => { const newVal = new BigNumber(value[0]) @@ -249,13 +248,13 @@ export const DealTicketSteps = ({ notionalSize={notionalSize || emptyString} fees={fees || emptyString} /> - - + ), disabled: true, diff --git a/apps/token-e2e/src/integration/view/home.cy.js b/apps/token-e2e/src/integration/view/home.cy.js index 4654d8b5f..5aa137bb8 100644 --- a/apps/token-e2e/src/integration/view/home.cy.js +++ b/apps/token-e2e/src/integration/view/home.cy.js @@ -3,7 +3,7 @@ const navHome = '[href="/"]'; const navVesting = '[href="/vesting"]'; const navStaking = '[href="/staking"]'; const navRewards = '[href="/rewards"]'; -const navWithdraw = '[href="/withdraw"]'; +const navWithdraw = '[href="/withdrawals"]'; const navGovernance = '[href="/governance"]'; const tokenDetailsTable = '.token-details'; diff --git a/apps/token-e2e/src/integration/view/withdraw.cy.js b/apps/token-e2e/src/integration/view/withdraw.cy.js index 9036b375a..da417d05b 100644 --- a/apps/token-e2e/src/integration/view/withdraw.cy.js +++ b/apps/token-e2e/src/integration/view/withdraw.cy.js @@ -1,18 +1,17 @@ const connectToVegaBtn = '[data-testid="connect-to-vega-wallet-btn"]'; -const warning = '[data-testid="callout"]'; context('Withdraw Page - verify elements on page', function () { - before('navigate to withdraw page', function () { - cy.visit('/').navigate_to('withdraw'); + before('navigate to withdrawals page', function () { + cy.visit('/').navigate_to('withdrawals'); }); describe('with wallets disconnected', function () { it('should have withdraw tab highlighted', function () { - cy.verify_tab_highlighted('withdraw'); + cy.verify_tab_highlighted('withdrawals'); }); it('should have WITHDRAW header visible', function () { - cy.verify_page_header('Withdraw'); + cy.verify_page_header('Withdrawals'); }); it('should have connect Vega wallet button', function () { @@ -20,9 +19,5 @@ context('Withdraw Page - verify elements on page', function () { .should('be.visible') .and('have.text', 'Connect Vega wallet'); }); - - it('should have withdraw information box', function () { - cy.get(warning).should('be.visible'); - }); }); }); diff --git a/apps/token-e2e/src/support/common.functions.js b/apps/token-e2e/src/support/common.functions.js index 434e17657..4266ef186 100644 --- a/apps/token-e2e/src/support/common.functions.js +++ b/apps/token-e2e/src/support/common.functions.js @@ -12,7 +12,7 @@ const navigation = { vesting: '[href="/vesting"]', staking: '[href="/staking"]', rewards: '[href="/rewards"]', - withdraw: '[href="/withdraw"]', + withdrawals: '[href="/withdrawals"]', governance: '[href="/governance"]', pageSpinner: '[data-testid="splash-loader"]', }; diff --git a/apps/token/src/components/nav/nav.tsx b/apps/token/src/components/nav/nav.tsx index 64ef6a1e7..af047ea3f 100644 --- a/apps/token/src/components/nav/nav.tsx +++ b/apps/token/src/components/nav/nav.tsx @@ -224,7 +224,7 @@ const NavLinks = ({ { route: Routes.VESTING, text: t('Vesting') }, { route: Routes.STAKING, text: t('Staking') }, { route: Routes.REWARDS, text: t('Rewards') }, - { route: Routes.WITHDRAW, text: t('Withdraw') }, + { route: Routes.WITHDRAWALS, text: t('Withdraw') }, { route: Routes.GOVERNANCE, text: t('Governance') }, ]; const navClasses = classNames('flex', { diff --git a/apps/token/src/i18n/translations/dev.json b/apps/token/src/i18n/translations/dev.json index 104624212..cdb4b97a1 100644 --- a/apps/token/src/i18n/translations/dev.json +++ b/apps/token/src/i18n/translations/dev.json @@ -452,7 +452,7 @@ "withdrawFormAmountLabel": "How much would you like to withdraw?", "withdrawFormSubmitButtonIdle": "Withdraw {{amount}} {{symbol}} tokens", "withdrawFormSubmitButtonPending": "Preparing", - "withdrawalsTitle": "Incomplete withdrawals", + "withdrawalsTitle": "Withdrawals", "withdrawalsText": "These withdrawals need to be completed with an Ethereum transaction.", "withdrawalsNone": "You don't have any pending withdrawals.", "withdrawalsCompleteButton": "Finish withdrawal", diff --git a/apps/token/src/routes/router-config.tsx b/apps/token/src/routes/router-config.tsx index b5dde8c76..afb370ad4 100644 --- a/apps/token/src/routes/router-config.tsx +++ b/apps/token/src/routes/router-config.tsx @@ -143,13 +143,6 @@ const LazyContracts = React.lazy( ) ); -const LazyWithdraw = React.lazy( - () => - import( - /* webpackChunkName: "route-withdraw", webpackPrefetch: true */ './withdraw' - ) -); - const LazyWithdrawals = React.lazy( () => import( @@ -201,11 +194,6 @@ const routerConfig = [ name: 'Rewards', component: LazyRewards, }, - { - path: Routes.WITHDRAW, - name: 'Withdraw', - component: LazyWithdraw, - }, { path: Routes.WITHDRAWALS, name: 'Withdrawals', diff --git a/apps/token/src/routes/routes.ts b/apps/token/src/routes/routes.ts index 7e5b74033..d79a9d1bb 100644 --- a/apps/token/src/routes/routes.ts +++ b/apps/token/src/routes/routes.ts @@ -4,7 +4,6 @@ export default { CLAIM: '/claim', STAKING: '/staking', REWARDS: '/rewards', - WITHDRAW: '/withdraw', WITHDRAWALS: '/withdrawals', GOVERNANCE: '/governance', VESTING: '/vesting', diff --git a/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts b/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts deleted file mode 100644 index 0f9478cf8..000000000 --- a/apps/token/src/routes/withdraw/__generated__/WithdrawPage.ts +++ /dev/null @@ -1,207 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { AccountType, WithdrawalStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL query operation: WithdrawPage -// ==================================================== - -export interface WithdrawPage_party_accounts_asset_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface WithdrawPage_party_accounts_asset_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type WithdrawPage_party_accounts_asset_source = WithdrawPage_party_accounts_asset_source_BuiltinAsset | WithdrawPage_party_accounts_asset_source_ERC20; - -export interface WithdrawPage_party_accounts_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: WithdrawPage_party_accounts_asset_source; -} - -export interface WithdrawPage_party_accounts { - __typename: "Account"; - /** - * Balance as string - current account balance (approx. as balances can be updated several times per second) - */ - balance: string; - balanceFormatted: string; - /** - * Account type (General, Margin, etc) - */ - type: AccountType; - /** - * Asset, the 'currency' - */ - asset: WithdrawPage_party_accounts_asset; -} - -export interface WithdrawPage_party_withdrawals_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; -} - -export interface WithdrawPage_party_withdrawals_details { - __typename: "Erc20WithdrawalDetails"; - /** - * The ethereum address of the receiver of the asset funds - */ - receiverAddress: string; -} - -export interface WithdrawPage_party_withdrawals { - __typename: "Withdrawal"; - /** - * The Vega internal ID of the withdrawal - */ - id: string; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The asset to be withdrawn - */ - asset: WithdrawPage_party_withdrawals_asset; - /** - * The current status of the withdrawal - */ - status: WithdrawalStatus; - /** - * RFC3339Nano time at which the withdrawal was created - */ - createdTimestamp: string; - /** - * RFC3339Nano time at which the withdrawal was finalised - */ - withdrawnTimestamp: string | null; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; - /** - * Foreign chain specific details about the withdrawal - */ - details: WithdrawPage_party_withdrawals_details | null; -} - -export interface WithdrawPage_party { - __typename: "Party"; - /** - * Party identifier - */ - id: string; - /** - * Collateral accounts relating to a party - */ - accounts: WithdrawPage_party_accounts[] | null; - /** - * The list of all withdrawals initiated by the party - */ - withdrawals: WithdrawPage_party_withdrawals[] | null; -} - -export interface WithdrawPage_assetsConnection_edges_node_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface WithdrawPage_assetsConnection_edges_node_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type WithdrawPage_assetsConnection_edges_node_source = WithdrawPage_assetsConnection_edges_node_source_BuiltinAsset | WithdrawPage_assetsConnection_edges_node_source_ERC20; - -export interface WithdrawPage_assetsConnection_edges_node { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: WithdrawPage_assetsConnection_edges_node_source; -} - -export interface WithdrawPage_assetsConnection_edges { - __typename: "AssetEdge"; - node: WithdrawPage_assetsConnection_edges_node; -} - -export interface WithdrawPage_assetsConnection { - __typename: "AssetsConnection"; - /** - * The assets - */ - edges: (WithdrawPage_assetsConnection_edges | null)[] | null; -} - -export interface WithdrawPage { - /** - * An entity that is trading on the Vega network - */ - party: WithdrawPage_party | null; - /** - * The list of all assets in use in the Vega network or the specified asset if ID is provided - */ - assetsConnection: WithdrawPage_assetsConnection; -} - -export interface WithdrawPageVariables { - partyId: string; -} diff --git a/apps/token/src/routes/withdraw/eth-address-input.tsx b/apps/token/src/routes/withdraw/eth-address-input.tsx deleted file mode 100644 index 5ea788f78..000000000 --- a/apps/token/src/routes/withdraw/eth-address-input.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { - Callout, - FormGroup, - Intent, - Input, - ButtonLink, -} from '@vegaprotocol/ui-toolkit'; -import React from 'react'; -import { useTranslation } from 'react-i18next'; - -interface EthAddressSelectorProps { - address: string; - connectedAddress: string; - onChange: (newAddress: string) => void; - isValid: boolean; -} - -export const EthAddressInput = ({ - connectedAddress, - address, - onChange, - isValid, -}: EthAddressSelectorProps) => { - const { t } = useTranslation(); - const [useConnectedWallet, setUseConnectedWallet] = - React.useState(true); - React.useEffect(() => { - if (useConnectedWallet) { - onChange(connectedAddress); - } - }, [connectedAddress, onChange, useConnectedWallet]); - - return ( - - onChange(e.target.value)} - value={address} - disabled={useConnectedWallet} - // leftElement={} TODO: render Ethereum icon in input when https://github.com/vegaprotocol/frontend-monorepo/issues/273 - autoComplete="off" - type="text" - required={true} - /> -
- setUseConnectedWallet(!useConnectedWallet)}> - {useConnectedWallet ? t('enterAddress') : t('useConnectedWallet')} - -
- {isValid ? null : ( - {t('invalidAddress')} - )} -
- ); -}; diff --git a/apps/token/src/routes/withdraw/index.tsx b/apps/token/src/routes/withdraw/index.tsx deleted file mode 100644 index 89a33c358..000000000 --- a/apps/token/src/routes/withdraw/index.tsx +++ /dev/null @@ -1,166 +0,0 @@ -import { gql, useQuery } from '@apollo/client'; -import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { Link } from 'react-router-dom'; - -import { Heading } from '../../components/heading'; -import { SplashLoader } from '../../components/splash-loader'; -import { VegaWalletContainer } from '../../components/vega-wallet-container'; -import type { VegaKeyExtended } from '@vegaprotocol/wallet'; -import Routes from '../routes'; -import type { - WithdrawPage, - WithdrawPageVariables, -} from './__generated__/WithdrawPage'; -import { WithdrawManager } from '@vegaprotocol/withdraws'; -import { AccountType } from '@vegaprotocol/types'; -import { assetsConnectionToAssets } from '@vegaprotocol/react-helpers'; - -const Withdraw = () => { - const { t } = useTranslation(); - - return ( - <> - -

{t('withdrawPageText')}

-
- - {(currVegaKey) => } - -
- -

{t('withdrawPageInfoCalloutText')}

-
- - ); -}; - -const WITHDRAW_PAGE_QUERY = gql` - query WithdrawPage($partyId: ID!) { - party(id: $partyId) { - id - accounts { - balance - balanceFormatted @client - type - asset { - id - name - symbol - decimals - source { - __typename - ... on ERC20 { - contractAddress - } - } - } - } - withdrawals { - id - amount - asset { - id - symbol - decimals - } - status - createdTimestamp - withdrawnTimestamp - txHash - details { - ... on Erc20WithdrawalDetails { - receiverAddress - } - } - } - } - assetsConnection { - edges { - node { - id - symbol - name - decimals - source { - ... on ERC20 { - contractAddress - } - } - } - } - } - } -`; - -interface WithdrawContainerProps { - currVegaKey: VegaKeyExtended; -} - -export const WithdrawContainer = ({ currVegaKey }: WithdrawContainerProps) => { - const { t } = useTranslation(); - const { data, loading, error } = useQuery< - WithdrawPage, - WithdrawPageVariables - >(WITHDRAW_PAGE_QUERY, { - variables: { partyId: currVegaKey?.pub }, - }); - - const accounts = React.useMemo(() => { - if (!data?.party?.accounts) return []; - // You can only withdraw from general accounts - return data.party.accounts.filter( - (a) => a.type === AccountType.ACCOUNT_TYPE_GENERAL - ); - }, [data]); - - // Note there is a small period where the withdrawal might have a tx hash but is technically - // not complete yet as the tx hash gets set before the transaction is confirmed - const hasPendingWithdrawals = React.useMemo(() => { - if (!data?.party?.withdrawals?.length) return false; - return data.party.withdrawals.some((w) => w.txHash === null); - }, [data]); - - if (error) { - return ( -
-

{t('Something went wrong')}

- {error &&
{error.message}
} -
- ); - } - - if (loading || !data) { - return ( - - - - ); - } - - const assets = assetsConnectionToAssets(data.assetsConnection); - - return ( - <> - {hasPendingWithdrawals && ( -
- -

{t('pendingWithdrawalsCalloutText')}

-

- - {t('pendingWithdrawalsCalloutButton')} - -

-
-
- )} - - - ); -}; - -export default Withdraw; diff --git a/apps/token/src/routes/withdrawals/index.tsx b/apps/token/src/routes/withdrawals/index.tsx index 8154d0e30..ad0b63878 100644 --- a/apps/token/src/routes/withdrawals/index.tsx +++ b/apps/token/src/routes/withdrawals/index.tsx @@ -1,22 +1,15 @@ import { Button, Splash } from '@vegaprotocol/ui-toolkit'; -import { format } from 'date-fns'; -import orderBy from 'lodash/orderBy'; -import React from 'react'; import { useTranslation } from 'react-i18next'; -import { Link } from '@vegaprotocol/ui-toolkit'; -import { useEnvironment } from '@vegaprotocol/environment'; import { Heading } from '../../components/heading'; -import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import { SplashLoader } from '../../components/splash-loader'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; -import { BigNumber } from '../../lib/bignumber'; -import { DATE_FORMAT_DETAILED } from '../../lib/date-formats'; -import { addDecimal } from '../../lib/decimals'; -import { truncateMiddle } from '../../lib/truncate-middle'; -import type { Withdrawals_party_withdrawals } from '@vegaprotocol/withdraws'; -import { useCompleteWithdraw, useWithdrawals } from '@vegaprotocol/withdraws'; -import { WithdrawalStatus } from '@vegaprotocol/types'; +import { + useWithdrawals, + WithdrawalDialogs, + WithdrawalsTable, +} from '@vegaprotocol/withdraws'; +import { useState } from 'react'; const Withdrawals = () => { const { t } = useTranslation(); @@ -32,19 +25,9 @@ const Withdrawals = () => { }; const WithdrawPendingContainer = () => { + const [withdrawDialog, setWithdrawDialog] = useState(false); const { t } = useTranslation(); - const { submit, Dialog } = useCompleteWithdraw(); - const { data, loading, error } = useWithdrawals(); - - const withdrawals = React.useMemo(() => { - if (!data?.party?.withdrawals?.length) return []; - - return orderBy( - data.party.withdrawals, - [(w) => new Date(w.createdTimestamp)], - ['desc'] - ); - }, [data]); + const { withdrawals, loading, error } = useWithdrawals(); if (error) { return ( @@ -55,7 +38,7 @@ const WithdrawPendingContainer = () => { ); } - if (loading || !data) { + if (loading) { return ( @@ -63,122 +46,23 @@ const WithdrawPendingContainer = () => { ); } - if (!withdrawals.length) { - return

{t('withdrawalsNone')}

; - } - return ( <> -

{t('withdrawalsPreparedWarningHeading')}

+
+

{t('withdrawalsPreparedWarningHeading')}

+ +

{t('withdrawalsText')}

{t('withdrawalsPreparedWarningText')}

-
    - {withdrawals.map((w) => ( -
  • - -
  • - ))} -
- +
+ +
+ ); }; -interface WithdrawalProps { - withdrawal: Withdrawals_party_withdrawals; - complete: (withdrawalId: string) => void; -} - -export const Withdrawal = ({ withdrawal, complete }: WithdrawalProps) => { - const { ETHERSCAN_URL } = useEnvironment(); - const { t } = useTranslation(); - let status; - let footer = null; - - if (withdrawal.pendingOnForeignChain) { - status = t('Pending'); - footer = ( - - ); - } else if (withdrawal.status === WithdrawalStatus.STATUS_FINALIZED) { - if (withdrawal.txHash) { - status = t('Complete'); - } else { - status = t('Incomplete'); - footer = ( - - ); - } - } else { - status = withdrawal.status; - } - - return ( -
- - - {t('Withdraw')} - - {addDecimal( - new BigNumber(withdrawal.amount), - withdrawal.asset.decimals - )}{' '} - {withdrawal.asset.symbol} - - - - {t('toEthereum')} - - - {truncateMiddle(withdrawal.details?.receiverAddress ?? '')} - - - - - {t('created')} - - {format( - new Date(withdrawal.createdTimestamp), - DATE_FORMAT_DETAILED - )} - - - - {t('withdrawalTransaction', { foreignChain: 'Ethereum' })} - - {withdrawal.txHash ? ( - - {truncateMiddle(withdrawal.txHash)} - - ) : ( - '-' - )} - - - - {t('status')} - {status} - - - {footer} -
- ); -}; - export default Withdrawals; diff --git a/apps/trading-e2e/src/integration/withdraw.cy.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts index 580b35060..b13b78e74 100644 --- a/apps/trading-e2e/src/integration/withdraw.cy.ts +++ b/apps/trading-e2e/src/integration/withdraw.cy.ts @@ -1,7 +1,8 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { connectEthereumWallet } from '../support/ethereum-wallet'; import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; -import { generateWithdrawPageQuery } from '../support/mocks/generate-withdraw-page-query'; +import { generateWithdrawFormQuery } from '../support/mocks/generate-withdraw-page-query'; +import { generateWithdrawals } from '../support/mocks/generate-withdrawals'; import { connectVegaWallet } from '../support/vega-wallet'; describe('withdraw', () => { @@ -16,10 +17,13 @@ describe('withdraw', () => { beforeEach(() => { cy.mockWeb3Provider(); cy.mockGQL((req) => { - aliasQuery(req, 'WithdrawPageQuery', generateWithdrawPageQuery()); + aliasQuery(req, 'Withdrawals', generateWithdrawals()); aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); + aliasQuery(req, 'WithdrawFormQuery', generateWithdrawFormQuery()); }); - cy.visit('/portfolio/withdraw'); + + cy.visit('/portfolio'); + cy.getByTestId('Withdrawals').click(); // Withdraw page requires vega wallet connection connectVegaWallet(); @@ -27,15 +31,14 @@ describe('withdraw', () => { // It also requires connection Ethereum wallet connectEthereumWallet(); - cy.wait('@WithdrawPageQuery'); - cy.contains('Withdraw'); + cy.mockGQL((req) => { + aliasQuery(req, 'WithdrawFormQuery', generateWithdrawFormQuery()); + }); + cy.getByTestId('withdraw-dialog-button').click(); + cy.wait('@WithdrawFormQuery'); }); it('form validation', () => { - // Prompts that there are incomplete withdrawals - cy.contains('You have incomplete withdrawals'); - cy.getByTestId('complete-withdrawals-prompt').should('exist'); - cy.getByTestId(submitWithdrawBtn).click(); cy.getByTestId(formFieldError).should('contain.text', 'Required'); @@ -82,9 +85,8 @@ describe('withdraw', () => { cy.getByTestId(submitWithdrawBtn).click(); cy.getByTestId('dialog-title').should( 'have.text', - 'Withdrawal transaction pending' + 'Awaiting network confirmation' ); - cy.getByTestId('dialog-text').should('have.text', 'Awaiting transaction'); }); it.skip('creates a withdrawal on submit'); // Needs capsule diff --git a/apps/trading-e2e/src/integration/withdrawals.cy.ts b/apps/trading-e2e/src/integration/withdrawals.cy.ts deleted file mode 100644 index 084fcabbb..000000000 --- a/apps/trading-e2e/src/integration/withdrawals.cy.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { aliasQuery } from '@vegaprotocol/cypress'; -import { connectEthereumWallet } from '../support/ethereum-wallet'; -import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; -import { generateWithdrawals } from '../support/mocks/generate-withdrawals'; -import { connectVegaWallet } from '../support/vega-wallet'; - -describe('withdrawals', () => { - beforeEach(() => { - cy.mockWeb3Provider(); - cy.mockGQL((req) => { - aliasQuery(req, 'Withdrawals', generateWithdrawals()); - aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); - }); - cy.visit('/portfolio/withdrawals'); - - // Withdraw page requires vega wallet connection - connectVegaWallet(); - - // It also requires connection Ethereum wallet - connectEthereumWallet(); - }); - - it('renders history of withdrawals', () => { - const ethAddressLink = `${Cypress.env( - 'ETHERSCAN_URL' - )}/address/0x72c22822A19D20DE7e426fB84aa047399Ddd8853`; - const etherScanLink = `${Cypress.env( - 'ETHERSCAN_URL' - )}/tx/0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03`; - - const row = '.ag-center-cols-container[role="rowgroup"] > [role="row"]'; - - // First row is incomplete - cy.get(row) - .eq(0) - .find('[col-id="asset.symbol"]') - .should('contain.text', 'AST0'); - cy.get(row) - .eq(0) - .find('[col-id="amount"]') - .should('contain.text', '0.00100'); - cy.get(row) - .eq(0) - .find('[col-id="details.receiverAddress"]') - .should('contain.text', '0x72c2…dd8853') - .find('a') - .should('have.attr', 'href', ethAddressLink); - cy.get(row) - .eq(0) - .find('[col-id="createdTimestamp"]') - .invoke('text') - .should('not.be.empty'); - cy.get(row) - .eq(0) - .find('[col-id="status"]') - .should('contain.text', 'Open') - .find('button') - .contains('Click to complete'); - - // Second row is complete so last cell should have a link to the tx - cy.get(row) - .eq(1) - .find('[col-id="status"]') - .should('contain.text', 'Finalized') - .find('a') - .contains('View on Etherscan') - .should('have.attr', 'href', etherScanLink); - }); - - it('renders a link to start a new withdrawal', () => { - cy.getByTestId('start-withdrawal').click(); - cy.url().should('include', '/portfolio/withdraw'); - }); - - it.skip('renders pending and unfinished withdrawals'); - it.skip('can complete unfinished withdrawals'); // Needs capsule -}); diff --git a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts index fb26f30d6..510ec1ae4 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts @@ -2,7 +2,7 @@ import { AccountType } from '@vegaprotocol/types'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; -export const generateWithdrawPageQuery = ( +export const generateWithdrawFormQuery = ( // eslint-disable-next-line @typescript-eslint/no-explicit-any override?: PartialDeep ) => { diff --git a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts index a134200b4..87b61c911 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts @@ -1,55 +1,74 @@ import { WithdrawalStatus } from '@vegaprotocol/types'; +import type { Withdrawals } from '@vegaprotocol/withdraws'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; -export const generateWithdrawals = ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - override?: PartialDeep -) => { - const defaultResult = { +export const generateWithdrawals = (override?: PartialDeep) => { + const defaultResult: Withdrawals = { party: { id: 'party-0', - withdrawals: [ - { - id: 'withdrawal-0', - status: WithdrawalStatus.STATUS_FINALIZED, - amount: '100', - txHash: null, - createdTimestamp: new Date('2022-02-02').toISOString(), - withdrawnTimestamp: new Date('2022-02-02').toISOString(), - details: { - __typename: 'Erc20WithdrawalDetails', - receiverAddress: '0x72c22822A19D20DE7e426fB84aa047399Ddd8853', + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: [ + { + __typename: 'WithdrawalEdge', + node: { + id: 'withdrawal-0', + status: WithdrawalStatus.STATUS_FINALIZED, + amount: '100', + txHash: null, + createdTimestamp: new Date('2022-02-02').toISOString(), + withdrawnTimestamp: new Date('2022-02-02').toISOString(), + pendingOnForeignChain: false, + details: { + __typename: 'Erc20WithdrawalDetails', + receiverAddress: '0x72c22822A19D20DE7e426fB84aa047399Ddd8853', + }, + asset: { + __typename: 'Asset', + id: 'asset-0', + name: 'asset-0 name', + symbol: 'AST0', + decimals: 5, + source: { + __typename: 'ERC20', + contractAddress: '0x123', + }, + }, + __typename: 'Withdrawal', + }, }, - asset: { - __typename: 'Asset', - id: 'asset-0', - symbol: 'AST0', - decimals: 5, + { + __typename: 'WithdrawalEdge', + node: { + id: 'withdrawal-1', + status: WithdrawalStatus.STATUS_FINALIZED, + amount: '100', + txHash: + '0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03', + createdTimestamp: new Date('2022-02-01').toISOString(), + withdrawnTimestamp: new Date('2022-02-01').toISOString(), + pendingOnForeignChain: false, + details: { + __typename: 'Erc20WithdrawalDetails', + receiverAddress: '0x72c22822A19D20DE7e426fB84aa047399Ddd8853', + }, + asset: { + __typename: 'Asset', + id: 'asset-0', + name: 'asset-0 name', + symbol: 'AST0', + decimals: 5, + source: { + __typename: 'ERC20', + contractAddress: '0x123', + }, + }, + __typename: 'Withdrawal', + }, }, - __typename: 'Withdrawal', - }, - { - id: 'withdrawal-1', - status: WithdrawalStatus.STATUS_FINALIZED, - amount: '100', - txHash: - '0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03', - createdTimestamp: new Date('2022-02-01').toISOString(), - withdrawnTimestamp: new Date('2022-02-01').toISOString(), - details: { - __typename: 'Erc20WithdrawalDetails', - receiverAddress: '0x72c22822A19D20DE7e426fB84aa047399Ddd8853', - }, - asset: { - __typename: 'Asset', - id: 'asset-0', - symbol: 'AST0', - decimals: 5, - }, - __typename: 'Withdrawal', - }, - ], + ], + }, __typename: 'Party', }, }; diff --git a/apps/trading/.env b/apps/trading/.env index 5e9905ad6..7bbc2ccfd 100644 --- a/apps/trading/.env +++ b/apps/trading/.env @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql +NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"} diff --git a/apps/trading/.env.testnet b/apps/trading/.env.testnet index 5bd96ac0e..762151b78 100644 --- a/apps/trading/.env.testnet +++ b/apps/trading/.env.testnet @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql +NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql NX_VEGA_NETWORKS='{\"MAINNET\":\"https://alpha.console.vega.xyz\"}' NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io diff --git a/apps/trading/lib/apollo-client.ts b/apps/trading/lib/apollo-client.ts index 35dbfc61f..27af935ee 100644 --- a/apps/trading/lib/apollo-client.ts +++ b/apps/trading/lib/apollo-client.ts @@ -51,6 +51,9 @@ export function createClient(base?: string) { }, }, }, + ERC20: { + keyFields: ['contractAddress'], + }, }, }); diff --git a/apps/trading/pages/portfolio/__generated__/AssetFields.ts b/apps/trading/pages/portfolio/__generated__/AssetFields.ts new file mode 100644 index 000000000..8a0b8f28b --- /dev/null +++ b/apps/trading/pages/portfolio/__generated__/AssetFields.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL fragment: AssetFields +// ==================================================== + +export interface AssetFields_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface AssetFields_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_source_ERC20; + +export interface AssetFields { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: AssetFields_source; +} diff --git a/apps/trading/pages/portfolio/__generated__/WithdrawFormQuery.ts b/apps/trading/pages/portfolio/__generated__/WithdrawFormQuery.ts new file mode 100644 index 000000000..43b487671 --- /dev/null +++ b/apps/trading/pages/portfolio/__generated__/WithdrawFormQuery.ts @@ -0,0 +1,119 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { AccountType } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: WithdrawFormQuery +// ==================================================== + +export interface WithdrawFormQuery_party_withdrawals { + __typename: "Withdrawal"; + /** + * The Vega internal ID of the withdrawal + */ + id: string; + /** + * Hash of the transaction on the foreign chain + */ + txHash: string | null; +} + +export interface WithdrawFormQuery_party_accounts_asset { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; +} + +export interface WithdrawFormQuery_party_accounts { + __typename: "Account"; + /** + * Account type (General, Margin, etc) + */ + type: AccountType; + /** + * Balance as string - current account balance (approx. as balances can be updated several times per second) + */ + balance: string; + /** + * Asset, the 'currency' + */ + asset: WithdrawFormQuery_party_accounts_asset; +} + +export interface WithdrawFormQuery_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; + /** + * The list of all withdrawals initiated by the party + */ + withdrawals: WithdrawFormQuery_party_withdrawals[] | null; + /** + * Collateral accounts relating to a party + */ + accounts: WithdrawFormQuery_party_accounts[] | null; +} + +export interface WithdrawFormQuery_assets_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface WithdrawFormQuery_assets_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type WithdrawFormQuery_assets_source = WithdrawFormQuery_assets_source_BuiltinAsset | WithdrawFormQuery_assets_source_ERC20; + +export interface WithdrawFormQuery_assets { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: WithdrawFormQuery_assets_source; +} + +export interface WithdrawFormQuery { + /** + * An entity that is trading on the Vega network + */ + party: WithdrawFormQuery_party | null; + /** + * The list of all assets in use in the Vega network + */ + assets: WithdrawFormQuery_assets[] | null; +} + +export interface WithdrawFormQueryVariables { + partyId: string; +} diff --git a/apps/trading/pages/portfolio/deposits-container.tsx b/apps/trading/pages/portfolio/deposits-container.tsx index 9d3dc16ba..cf44f8c14 100644 --- a/apps/trading/pages/portfolio/deposits-container.tsx +++ b/apps/trading/pages/portfolio/deposits-container.tsx @@ -1,17 +1,29 @@ +import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; +import { DepositsTable } from '@vegaprotocol/deposits'; +import { useDeposits } from '@vegaprotocol/deposits'; import { t } from '@vegaprotocol/react-helpers'; -import { Button } from '@vegaprotocol/ui-toolkit'; import Link from 'next/link'; export const DepositsContainer = () => { + const { deposits, loading, error } = useDeposits(); + return ( -
-
-
+
+
+

{t('Deposits')}

- + +
+
+ { + return ; + }} + />
); diff --git a/apps/trading/pages/portfolio/index.page.tsx b/apps/trading/pages/portfolio/index.page.tsx index 8f06f58b2..63139b4d4 100644 --- a/apps/trading/pages/portfolio/index.page.tsx +++ b/apps/trading/pages/portfolio/index.page.tsx @@ -1,4 +1,3 @@ -import { Web3Container } from '@vegaprotocol/web3'; import { t } from '@vegaprotocol/react-helpers'; import { PositionsContainer } from '@vegaprotocol/positions'; import { OrderListContainer } from '@vegaprotocol/orders'; @@ -67,14 +66,12 @@ const Portfolio = () => { - + + + - - - - - + diff --git a/apps/trading/pages/portfolio/withdraw/index.page.tsx b/apps/trading/pages/portfolio/withdraw/index.page.tsx deleted file mode 100644 index 3d085b5a7..000000000 --- a/apps/trading/pages/portfolio/withdraw/index.page.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useRouter } from 'next/router'; -import { useMemo } from 'react'; -import { WithdrawPageContainer } from './withdraw-page-container'; -import { VegaWalletContainer } from '../../../components/vega-wallet-container'; -import { Web3Container } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; - -const Withdraw = () => { - const { query } = useRouter(); - - // AssetId can be specified in the query string to allow link to deposit a particular asset - const assetId = useMemo(() => { - if (query.assetId && Array.isArray(query.assetId)) { - return undefined; - } - - if (Array.isArray(query.assetId)) { - return undefined; - } - - return query.assetId; - }, [query]); - - return ( - - -
-

{t('Withdraw')}

- -
-
-
- ); -}; - -export default Withdraw; diff --git a/apps/trading/pages/portfolio/withdraw/withdraw-page-container.tsx b/apps/trading/pages/portfolio/withdraw/withdraw-page-container.tsx deleted file mode 100644 index 92d221593..000000000 --- a/apps/trading/pages/portfolio/withdraw/withdraw-page-container.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { gql } from '@apollo/client'; -import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers'; -import { Splash } from '@vegaprotocol/ui-toolkit'; -import { useVegaWallet } from '@vegaprotocol/wallet'; -import { WithdrawManager } from '@vegaprotocol/withdraws'; -import { ASSET_FRAGMENT } from '../../../lib/query-fragments'; -import Link from 'next/link'; -import { PageQueryContainer } from '../../../components/page-query-container'; -import type { - WithdrawPageQuery, - WithdrawPageQueryVariables, -} from './__generated__/WithdrawPageQuery'; - -const WITHDRAW_PAGE_QUERY = gql` - ${ASSET_FRAGMENT} - query WithdrawPageQuery($partyId: ID!) { - party(id: $partyId) { - id - withdrawals { - id - txHash - } - accounts { - type - balance - asset { - id - symbol - } - } - } - assetsConnection { - edges { - node { - ...AssetFields - } - } - } - } -`; - -interface WithdrawPageContainerProps { - assetId?: string; -} - -/** - * Fetches data required for the Deposit page - */ -export const WithdrawPageContainer = ({ - assetId, -}: WithdrawPageContainerProps) => { - const { keypair } = useVegaWallet(); - - return ( - - query={WITHDRAW_PAGE_QUERY} - options={{ - variables: { partyId: keypair?.pub || '' }, - skip: !keypair?.pub, - }} - render={(data) => { - const assets = assetsConnectionToAssets(data.assetsConnection); - if (!assets.length) { - return ( - -

{t('No assets on this network')}

-
- ); - } - - const hasIncompleteWithdrawals = data.party?.withdrawals?.some( - (w) => w.txHash === null - ); - - return ( - <> - {hasIncompleteWithdrawals ? ( -

- {t('You have incomplete withdrawals.')}{' '} - - {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - - {t('Click here to finish withdrawal')} - - -

- ) : null} - - - ); - }} - /> - ); -}; diff --git a/apps/trading/pages/portfolio/withdrawals-container.tsx b/apps/trading/pages/portfolio/withdrawals-container.tsx index 5a13071a8..61d4a16f0 100644 --- a/apps/trading/pages/portfolio/withdrawals-container.tsx +++ b/apps/trading/pages/portfolio/withdrawals-container.tsx @@ -1,36 +1,50 @@ -import orderBy from 'lodash/orderBy'; import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; -import { useWithdrawals, WithdrawalsTable } from '@vegaprotocol/withdraws'; -import Link from 'next/link'; +import { + useWithdrawals, + WithdrawalDialogs, + WithdrawalsTable, +} from '@vegaprotocol/withdraws'; import { t } from '@vegaprotocol/react-helpers'; +import { useState } from 'react'; +import { VegaWalletContainer } from '../../components/vega-wallet-container'; +import { Web3Container } from '@vegaprotocol/web3'; export const WithdrawalsContainer = () => { - const { data, loading, error } = useWithdrawals(); + const { withdrawals, loading, error } = useWithdrawals(); + const [withdrawDialog, setWithdrawDialog] = useState(false); + console.log('render'); return ( - { - const withdrawals = orderBy( - data.party?.withdrawals || [], - (w) => new Date(w.createdTimestamp).getTime(), - 'desc' - ); - return ( -
- -
- - - -
+ + +
+
+

+ {t('Withdrawals')} +

+ +
+
+ { + return ; + }} + />
- ); - }} - /> +
+ +
+
); }; diff --git a/apps/trading/pages/portfolio/withdrawals/index.page.tsx b/apps/trading/pages/portfolio/withdrawals/index.page.tsx deleted file mode 100644 index f6742483b..000000000 --- a/apps/trading/pages/portfolio/withdrawals/index.page.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { VegaWalletContainer } from '../../../components/vega-wallet-container'; -import { Web3Container } from '@vegaprotocol/web3'; -import { WithdrawalsContainer } from '../withdrawals-container'; - -const Withdrawals = () => { - return ( - - - - - - ); -}; - -export default Withdrawals; diff --git a/libs/deal-ticket/src/components/deal-ticket-manager.tsx b/libs/deal-ticket/src/components/deal-ticket-manager.tsx index ca816a587..fa16dc3af 100644 --- a/libs/deal-ticket/src/components/deal-ticket-manager.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-manager.tsx @@ -16,8 +16,7 @@ export const DealTicketManager = ({ market, children, }: DealTicketManagerProps) => { - const { submit, transaction, finalizedOrder, TransactionDialog } = - useOrderSubmit(); + const { submit, transaction, finalizedOrder, Dialog } = useOrderSubmit(); return ( <> @@ -33,13 +32,13 @@ export const DealTicketManager = ({ } /> )} - - +
); }; diff --git a/libs/deposits/src/index.ts b/libs/deposits/src/index.ts index d267d759e..07125c4da 100644 --- a/libs/deposits/src/index.ts +++ b/libs/deposits/src/index.ts @@ -1 +1,3 @@ export * from './lib/deposit-manager'; +export * from './lib/use-deposits'; +export * from './lib/deposits-table'; diff --git a/libs/deposits/src/lib/__generated__/DepositEventSub.ts b/libs/deposits/src/lib/__generated__/DepositEventSub.ts new file mode 100644 index 000000000..411994334 --- /dev/null +++ b/libs/deposits/src/lib/__generated__/DepositEventSub.ts @@ -0,0 +1,83 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { DepositStatus } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL subscription operation: DepositEventSub +// ==================================================== + +export interface DepositEventSub_busEvents_event_TimeUpdate { + __typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Order" | "Trade" | "Account" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Withdrawal" | "OracleSpec" | "LiquidityProvision"; +} + +export interface DepositEventSub_busEvents_event_Deposit_asset { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; +} + +export interface DepositEventSub_busEvents_event_Deposit { + __typename: "Deposit"; + /** + * The Vega internal ID of the deposit + */ + id: string; + /** + * The current status of the deposit + */ + status: DepositStatus; + /** + * The amount to be withdrawn + */ + amount: string; + /** + * The asset to be withdrawn + */ + asset: DepositEventSub_busEvents_event_Deposit_asset; + /** + * RFC3339Nano time at which the deposit was created + */ + createdTimestamp: string; + /** + * RFC3339Nano time at which the deposit was finalised + */ + creditedTimestamp: string | null; + /** + * Hash of the transaction on the foreign chain + */ + txHash: string | null; +} + +export type DepositEventSub_busEvents_event = DepositEventSub_busEvents_event_TimeUpdate | DepositEventSub_busEvents_event_Deposit; + +export interface DepositEventSub_busEvents { + __typename: "BusEvent"; + /** + * the payload - the wrapped event + */ + event: DepositEventSub_busEvents_event; +} + +export interface DepositEventSub { + /** + * Subscribe to event data from the event bus + */ + busEvents: DepositEventSub_busEvents[] | null; +} + +export interface DepositEventSubVariables { + partyId: string; +} diff --git a/libs/deposits/src/lib/__generated__/DepositFields.ts b/libs/deposits/src/lib/__generated__/DepositFields.ts new file mode 100644 index 000000000..8026e39f3 --- /dev/null +++ b/libs/deposits/src/lib/__generated__/DepositFields.ts @@ -0,0 +1,58 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { DepositStatus } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL fragment: DepositFields +// ==================================================== + +export interface DepositFields_asset { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; +} + +export interface DepositFields { + __typename: "Deposit"; + /** + * The Vega internal ID of the deposit + */ + id: string; + /** + * The current status of the deposit + */ + status: DepositStatus; + /** + * The amount to be withdrawn + */ + amount: string; + /** + * The asset to be withdrawn + */ + asset: DepositFields_asset; + /** + * RFC3339Nano time at which the deposit was created + */ + createdTimestamp: string; + /** + * RFC3339Nano time at which the deposit was finalised + */ + creditedTimestamp: string | null; + /** + * Hash of the transaction on the foreign chain + */ + txHash: string | null; +} diff --git a/libs/deposits/src/lib/__generated__/Deposits.ts b/libs/deposits/src/lib/__generated__/Deposits.ts new file mode 100644 index 000000000..0d203133a --- /dev/null +++ b/libs/deposits/src/lib/__generated__/Deposits.ts @@ -0,0 +1,94 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { DepositStatus } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: Deposits +// ==================================================== + +export interface Deposits_party_depositsConnection_edges_node_asset { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; +} + +export interface Deposits_party_depositsConnection_edges_node { + __typename: "Deposit"; + /** + * The Vega internal ID of the deposit + */ + id: string; + /** + * The current status of the deposit + */ + status: DepositStatus; + /** + * The amount to be withdrawn + */ + amount: string; + /** + * The asset to be withdrawn + */ + asset: Deposits_party_depositsConnection_edges_node_asset; + /** + * RFC3339Nano time at which the deposit was created + */ + createdTimestamp: string; + /** + * RFC3339Nano time at which the deposit was finalised + */ + creditedTimestamp: string | null; + /** + * Hash of the transaction on the foreign chain + */ + txHash: string | null; +} + +export interface Deposits_party_depositsConnection_edges { + __typename: "DepositEdge"; + node: Deposits_party_depositsConnection_edges_node; +} + +export interface Deposits_party_depositsConnection { + __typename: "DepositsConnection"; + /** + * The deposits + */ + edges: (Deposits_party_depositsConnection_edges | null)[] | null; +} + +export interface Deposits_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; + /** + * The list of all deposits for a party by the party + */ + depositsConnection: Deposits_party_depositsConnection; +} + +export interface Deposits { + /** + * An entity that is trading on the Vega network + */ + party: Deposits_party | null; +} + +export interface DepositsVariables { + partyId: string; +} diff --git a/libs/deposits/src/lib/__generated__/DepositsQuery.ts b/libs/deposits/src/lib/__generated__/DepositsQuery.ts new file mode 100644 index 000000000..23140dd02 --- /dev/null +++ b/libs/deposits/src/lib/__generated__/DepositsQuery.ts @@ -0,0 +1,94 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { DepositStatus } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: DepositsQuery +// ==================================================== + +export interface DepositsQuery_party_depositsConnection_edges_node_asset { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; +} + +export interface DepositsQuery_party_depositsConnection_edges_node { + __typename: "Deposit"; + /** + * The Vega internal ID of the deposit + */ + id: string; + /** + * The current status of the deposit + */ + status: DepositStatus; + /** + * The amount to be withdrawn + */ + amount: string; + /** + * The asset to be withdrawn + */ + asset: DepositsQuery_party_depositsConnection_edges_node_asset; + /** + * RFC3339Nano time at which the deposit was created + */ + createdTimestamp: string; + /** + * RFC3339Nano time at which the deposit was finalised + */ + creditedTimestamp: string | null; + /** + * Hash of the transaction on the foreign chain + */ + txHash: string | null; +} + +export interface DepositsQuery_party_depositsConnection_edges { + __typename: "DepositEdge"; + node: DepositsQuery_party_depositsConnection_edges_node; +} + +export interface DepositsQuery_party_depositsConnection { + __typename: "DepositsConnection"; + /** + * The deposits + */ + edges: (DepositsQuery_party_depositsConnection_edges | null)[] | null; +} + +export interface DepositsQuery_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; + /** + * The list of all deposits for a party by the party + */ + depositsConnection: DepositsQuery_party_depositsConnection; +} + +export interface DepositsQuery { + /** + * An entity that is trading on the Vega network + */ + party: DepositsQuery_party | null; +} + +export interface DepositsQueryVariables { + partyId: string; +} diff --git a/libs/deposits/src/lib/deposits-table.tsx b/libs/deposits/src/lib/deposits-table.tsx new file mode 100644 index 000000000..907eccc50 --- /dev/null +++ b/libs/deposits/src/lib/deposits-table.tsx @@ -0,0 +1,81 @@ +import { AgGridColumn } from 'ag-grid-react'; +import { + t, + addDecimalsFormatNumber, + getDateTimeFormat, + truncateByChars, +} from '@vegaprotocol/react-helpers'; +import type { + VegaICellRendererParams, + VegaValueFormatterParams, +} from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit'; +import type { DepositFields } from './__generated__/DepositFields'; +import { useEnvironment } from '@vegaprotocol/environment'; +import { DepositStatusMapping } from '@vegaprotocol/types'; + +export interface DepositsTableProps { + deposits: DepositFields[]; +} + +export const DepositsTable = ({ deposits }: DepositsTableProps) => { + const { ETHERSCAN_URL } = useEnvironment(); + return ( + + + ) => { + return addDecimalsFormatNumber(value, data.asset.decimals); + }} + /> + ) => { + return getDateTimeFormat().format(new Date(value)); + }} + /> + ) => { + return DepositStatusMapping[value]; + }} + /> + ) => { + if (!value) return '-'; + return ( + + {truncateByChars(value)} + + ); + }} + /> + + ); +}; diff --git a/libs/deposits/src/lib/use-deposits.ts b/libs/deposits/src/lib/use-deposits.ts new file mode 100644 index 000000000..f53ea2783 --- /dev/null +++ b/libs/deposits/src/lib/use-deposits.ts @@ -0,0 +1,153 @@ +import uniqBy from 'lodash/uniqBy'; +import compact from 'lodash/compact'; +import orderBy from 'lodash/orderBy'; +import { gql, useQuery } from '@apollo/client'; +import type { UpdateQueryFn } from '@apollo/client/core/watchQueryOptions'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useEffect, useMemo } from 'react'; +import type { + DepositEventSub, + DepositEventSubVariables, + DepositEventSub_busEvents_event, + DepositEventSub_busEvents_event_Deposit, +} from './__generated__/DepositEventSub'; +import type { Deposits, DepositsVariables } from './__generated__/Deposits'; + +const DEPOSIT_FRAGMENT = gql` + fragment DepositFields on Deposit { + id + status + amount + asset { + id + symbol + decimals + } + createdTimestamp + creditedTimestamp + txHash + } +`; + +const DEPOSITS_QUERY = gql` + ${DEPOSIT_FRAGMENT} + query DepositsQuery($partyId: ID!) { + party(id: $partyId) { + id + depositsConnection { + edges { + node { + ...DepositFields + } + } + } + } + } +`; + +const DEPOSITS_BUS_EVENT_SUB = gql` + ${DEPOSIT_FRAGMENT} + subscription DepositEventSub($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Deposit]) { + event { + ... on Deposit { + ...DepositFields + } + } + } + } +`; + +export const useDeposits = () => { + const { keypair } = useVegaWallet(); + const { data, loading, error, subscribeToMore } = useQuery< + Deposits, + DepositsVariables + >(DEPOSITS_QUERY, { + variables: { partyId: keypair?.pub || '' }, + skip: !keypair?.pub, + }); + + const deposits = useMemo(() => { + if (!data?.party?.depositsConnection.edges?.length) { + return []; + } + + return orderBy( + compact(data.party?.depositsConnection.edges?.map((d) => d?.node)), + ['createdTimestamp'], + ['desc'] + ); + }, [data]); + + useEffect(() => { + if (!keypair?.pub) return; + + const unsub = subscribeToMore({ + document: DEPOSITS_BUS_EVENT_SUB, + variables: { partyId: keypair?.pub }, + updateQuery, + }); + + return () => { + unsub(); + }; + }, [keypair?.pub, subscribeToMore]); + + return { data, loading, error, deposits }; +}; + +const updateQuery: UpdateQueryFn< + Deposits, + DepositEventSubVariables, + DepositEventSub +> = (prev, { subscriptionData, variables }) => { + console.log(subscriptionData); + if (!subscriptionData.data.busEvents?.length || !variables?.partyId) { + return prev; + } + + const curr = + compact(prev.party?.depositsConnection.edges?.map((e) => e?.node)) || []; + const incoming = subscriptionData.data.busEvents + .map((e) => e.event) + .filter(isDepositEvent); + + const deposits = uniqBy([...incoming, ...curr], 'id'); + + if (!prev.party) { + return { + ...prev, + party: { + __typename: 'Party', + id: variables?.partyId, + depositsConnection: { + __typename: 'DepositsConnection', + edges: deposits.map((d) => ({ __typename: 'DepositEdge', node: d })), + }, + }, + }; + } + + return { + ...prev, + party: { + ...prev.party, + id: variables?.partyId, + depositsConnection: { + __typename: 'DepositsConnection', + edges: deposits.map((d) => ({ __typename: 'DepositEdge', node: d })), + }, + }, + }; +}; + +const isDepositEvent = ( + event: DepositEventSub_busEvents_event +): event is DepositEventSub_busEvents_event_Deposit => { + if (event.__typename === 'Deposit') { + return true; + } + + return false; +}; diff --git a/libs/governance/src/lib/proposal-form.spec.tsx b/libs/governance/src/lib/proposal-form.spec.tsx index 848f8d82a..a7ce03de4 100644 --- a/libs/governance/src/lib/proposal-form.spec.tsx +++ b/libs/governance/src/lib/proposal-form.spec.tsx @@ -160,7 +160,7 @@ describe('ProposalForm', () => { }); expect(screen.getByTestId('dialog-title')).toHaveTextContent( - 'Proposal rejected' + 'Proposal submitted' ); }); diff --git a/libs/governance/src/lib/proposal-form.tsx b/libs/governance/src/lib/proposal-form.tsx index 268bb966f..c63f7b2b4 100644 --- a/libs/governance/src/lib/proposal-form.tsx +++ b/libs/governance/src/lib/proposal-form.tsx @@ -12,7 +12,6 @@ import { getProposalDialogTitle, } from '../utils'; import { t } from '@vegaprotocol/react-helpers'; -import { ProposalState } from '@vegaprotocol/types'; export interface FormFields { proposalData: string; @@ -24,7 +23,7 @@ export const ProposalForm = () => { handleSubmit, formState: { isSubmitting, errors }, } = useForm(); - const { finalizedProposal, submit, TransactionDialog } = useProposalSubmit(); + const { finalizedProposal, submit, Dialog } = useProposalSubmit(); const hasError = Boolean(errors.proposalData?.message); @@ -63,31 +62,23 @@ export const ProposalForm = () => { )} - - - - {finalizedProposal?.rejectionReason ? ( - + + + {finalizedProposal?.rejectionReason ? (

{finalizedProposal.rejectionReason}

-
- ) : ( - - )} + ) : undefined} + ); }; diff --git a/libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts b/libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts index a125b800d..e5038b003 100644 --- a/libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts +++ b/libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts @@ -10,8 +10,7 @@ export const useProposalSubmit = () => { const { keypair } = useVegaWallet(); const waitForProposalEvent = useProposalEvent(); - const { send, transaction, setComplete, TransactionDialog } = - useVegaTransaction(); + const { send, transaction, setComplete, Dialog } = useVegaTransaction(); const [finalizedProposal, setFinalizedProposal] = useState(null); @@ -52,7 +51,7 @@ export const useProposalSubmit = () => { return { transaction, finalizedProposal, - TransactionDialog, + Dialog, submit, }; }; diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 0fdd81514..3bc939924 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -62,7 +62,7 @@ export const OrderList = forwardRef( ref={ref} setEditOrder={setEditOrder} /> - @@ -70,15 +70,15 @@ export const OrderList = forwardRef( transaction={orderCancel.transaction} order={orderCancel.cancelledOrder} /> - - + - + {editOrder && ( { transaction, reset: resetTransaction, setComplete, - TransactionDialog, + Dialog, } = useVegaTransaction(); const reset = useCallback(() => { @@ -62,7 +62,7 @@ export const useOrderCancel = () => { return { transaction, cancelledOrder, - TransactionDialog, + Dialog, cancel, reset, }; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.tsx index a5fed3015..0a3a5dfe3 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.tsx @@ -22,7 +22,7 @@ export const useOrderEdit = (order: OrderFields | null) => { transaction, reset: resetTransaction, setComplete, - TransactionDialog, + Dialog, } = useVegaTransaction(); const waitForOrderEvent = useOrderEvent(); @@ -71,7 +71,7 @@ export const useOrderEdit = (order: OrderFields | null) => { return { transaction, updatedOrder, - TransactionDialog, + Dialog, edit, reset, }; diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.tsx index 1a14bc209..d6e28a1c5 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -102,7 +102,7 @@ export const useOrderSubmit = () => { transaction, reset: resetTransaction, setComplete, - TransactionDialog, + Dialog, } = useVegaTransaction(); const [finalizedOrder, setFinalizedOrder] = @@ -158,7 +158,7 @@ export const useOrderSubmit = () => { return { transaction, finalizedOrder, - TransactionDialog, + Dialog, submit, reset, }; diff --git a/libs/positions/src/lib/positions-manager.tsx b/libs/positions/src/lib/positions-manager.tsx index d8b34f738..a47a47675 100644 --- a/libs/positions/src/lib/positions-manager.tsx +++ b/libs/positions/src/lib/positions-manager.tsx @@ -16,7 +16,7 @@ const getSymbols = (positions: Position[]) => export const PositionsManager = ({ partyId }: PositionsManagerProps) => { const variables = useMemo(() => ({ partyId }), [partyId]); const assetSymbols = useRef(); - const { submit, TransactionDialog } = useClosePosition(); + const { submit, Dialog } = useClosePosition(); const onClose = useCallback( (position: Position) => { submit(position); @@ -55,9 +55,9 @@ export const PositionsManager = ({ partyId }: PositionsManagerProps) => { /> ))} - +

Your position was not closed! This is still not implemented.

-
+ ); }; diff --git a/libs/positions/src/lib/use-close-position.ts b/libs/positions/src/lib/use-close-position.ts index 2903b6bc2..a7aced9e0 100644 --- a/libs/positions/src/lib/use-close-position.ts +++ b/libs/positions/src/lib/use-close-position.ts @@ -15,7 +15,7 @@ export const useClosePosition = () => { transaction, reset: resetTransaction, setComplete, - TransactionDialog, + Dialog, } = useVegaTransaction(); const reset = useCallback(() => { @@ -57,7 +57,7 @@ export const useClosePosition = () => { return { transaction, - TransactionDialog, + Dialog, submit, reset, }; diff --git a/libs/smart-contracts/src/contracts/collateral-bridge.ts b/libs/smart-contracts/src/contracts/collateral-bridge.ts index c7124d855..50b4705ee 100644 --- a/libs/smart-contracts/src/contracts/collateral-bridge.ts +++ b/libs/smart-contracts/src/contracts/collateral-bridge.ts @@ -34,6 +34,9 @@ export class CollateralBridge { get_withdraw_threshold(assetSource: string) { return this.contract.get_withdraw_threshold(assetSource); } + default_withdraw_delay() { + return this.contract.default_withdraw_delay(); + } withdraw_asset( assetSource: string, amount: string, diff --git a/libs/ui-toolkit/src/components/ag-grid/index.tsx b/libs/ui-toolkit/src/components/ag-grid/index.tsx index 79f8cc18c..252416c6e 100644 --- a/libs/ui-toolkit/src/components/ag-grid/index.tsx +++ b/libs/ui-toolkit/src/components/ag-grid/index.tsx @@ -1,2 +1,30 @@ +import type { Get } from 'type-fest'; +import type { + ICellRendererParams, + ValueFormatterParams, +} from 'ag-grid-community'; + export * from './ag-grid-lazy'; export * from './ag-grid-dynamic'; + +type Field = string | readonly string[]; + +type RowHelper = Omit< + TObj, + 'data' | 'value' +> & { + data: TRow; + value: Get; +}; + +export type VegaValueFormatterParams = RowHelper< + ValueFormatterParams, + TRow, + TField +>; + +export type VegaICellRendererParams = RowHelper< + ICellRendererParams, + TRow, + TField +>; diff --git a/libs/wallet/src/use-vega-transaction.tsx b/libs/wallet/src/use-vega-transaction.tsx index 9c3a8b2ad..e2bab2755 100644 --- a/libs/wallet/src/use-vega-transaction.tsx +++ b/libs/wallet/src/use-vega-transaction.tsx @@ -102,7 +102,7 @@ export const useVegaTransaction = () => { [sendTx, setTransaction, reset] ); - const TransactionDialog = useMemo(() => { + const Dialog = useMemo(() => { return (props: DialogProps) => ( { reset, setComplete, setTransaction, - TransactionDialog, + Dialog, }; }; diff --git a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx index 0512971bb..009221a0f 100644 --- a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx +++ b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx @@ -43,6 +43,7 @@ export const VegaTransactionDialog = ({ intent={computedIntent} title={computedTitle} icon={computedIcon} + size="small" > {content} @@ -59,8 +60,9 @@ interface VegaDialogProps { export const VegaDialog = ({ transaction }: VegaDialogProps) => { const { VEGA_EXPLORER_URL } = useEnvironment(); + let content = null; if (transaction.status === VegaTxStatus.Requested) { - return ( + content = (

{t( 'Please open your wallet application and confirm or reject the transaction' @@ -70,7 +72,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => { } if (transaction.status === VegaTxStatus.Error) { - return ( + content = (

{transaction.error && formatLabel(transaction.error)}

{transaction.details && ( @@ -81,7 +83,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => { } if (transaction.status === VegaTxStatus.Pending) { - return ( + content = (

{t('Please wait for your transaction to be confirmed')} -   @@ -102,7 +104,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => { } if (transaction.status === VegaTxStatus.Complete) { - return ( + content = (

{t('Your transaction has been confirmed')} -   @@ -122,7 +124,7 @@ export const VegaDialog = ({ transaction }: VegaDialogProps) => { ); } - return null; + return

{content}
; }; const getIntent = (transaction: VegaTxState) => { @@ -160,7 +162,11 @@ const getIcon = (transaction: VegaTxState) => { case VegaTxStatus.Requested: return ; case VegaTxStatus.Pending: - return ; + return ( + + + + ); case VegaTxStatus.Error: return ; case VegaTxStatus.Complete: diff --git a/libs/web3/src/index.ts b/libs/web3/src/index.ts index c0c4dbdb9..80b2c4c21 100644 --- a/libs/web3/src/index.ts +++ b/libs/web3/src/index.ts @@ -6,7 +6,7 @@ export * from './lib/use-token-decimals'; export * from './lib/use-ethereum-config'; export * from './lib/use-ethereum-read-contract'; export * from './lib/use-ethereum-transaction'; -export * from './lib/transaction-dialog'; +export * from './lib/ethereum-transaction-dialog'; export * from './lib/web3-provider'; export * from './lib/web3-connect-dialog'; export * from './lib/web3-wallet-input'; diff --git a/libs/web3/src/lib/transaction-dialog/dialog-rows.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx similarity index 100% rename from libs/web3/src/lib/transaction-dialog/dialog-rows.tsx rename to libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx diff --git a/libs/web3/src/lib/transaction-dialog/transaction-dialog.spec.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.spec.tsx similarity index 82% rename from libs/web3/src/lib/transaction-dialog/transaction-dialog.spec.tsx rename to libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.spec.tsx index 01b44151d..314295942 100644 --- a/libs/web3/src/lib/transaction-dialog/transaction-dialog.spec.tsx +++ b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.spec.tsx @@ -3,8 +3,8 @@ import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; import { EthereumError } from '../ethereum-error'; import { EthTxStatus } from '../use-ethereum-transaction'; -import type { TransactionDialogProps } from './transaction-dialog'; -import { TransactionDialog } from './transaction-dialog'; +import type { EthereumTransactionDialogProps } from './ethereum-transaction-dialog'; +import { EthereumTransactionDialog } from './ethereum-transaction-dialog'; jest.mock('@web3-react/core', () => ({ useWeb3React: () => ({ @@ -12,11 +12,11 @@ jest.mock('@web3-react/core', () => ({ }), })); -let props: TransactionDialogProps; +let props: EthereumTransactionDialogProps; beforeEach(() => { props = { - name: 'test', + title: 'test', onChange: jest.fn(), transaction: { status: EthTxStatus.Default, @@ -29,9 +29,11 @@ beforeEach(() => { }; }); -const generateJsx = (moreProps?: PartialDeep) => { +const generateJsx = ( + moreProps?: PartialDeep +) => { const mergedProps = merge(props, moreProps); - return ; + return ; }; it('Opens when tx starts and closes if the user rejects the tx', () => { @@ -57,7 +59,7 @@ it('Opens when tx starts and closes if the user rejects the tx', () => { expect(container).toBeEmptyDOMElement(); }); -it('Doesn\t repoen if user dismissed the dialog', () => { +it("Doesn't repoen if user dismissed the dialog", () => { const { container, rerender } = render( generateJsx({ transaction: { status: EthTxStatus.Pending } }) ); @@ -87,7 +89,7 @@ it('Dialog states', () => { transaction: { status: EthTxStatus.Pending, confirmations: 0 }, }) ); - expect(screen.getByText(`${props.name} pending`)).toBeInTheDocument(); + expect(screen.getByText(`${props.title} pending`)).toBeInTheDocument(); expect(screen.getByText('Confirmed in wallet')).toBeInTheDocument(); expect( screen.getByText('Awaiting Ethereum transaction 0/1 confirmations...') @@ -100,7 +102,7 @@ it('Dialog states', () => { transaction: { status: EthTxStatus.Complete, confirmations: 1 }, }) ); - expect(screen.getByText(`${props.name} pending`)).toBeInTheDocument(); + expect(screen.getByText(`${props.title} pending`)).toBeInTheDocument(); expect(screen.getByText('Confirmed in wallet')).toBeInTheDocument(); expect(screen.getByText('Ethereum transaction complete')).toBeInTheDocument(); @@ -113,7 +115,7 @@ it('Dialog states', () => { }, }) ); - expect(screen.getByText(`${props.name} complete`)).toBeInTheDocument(); + expect(screen.getByText(`${props.title} complete`)).toBeInTheDocument(); expect(screen.getByText('Confirmed in wallet')).toBeInTheDocument(); expect(screen.getByText('Transaction confirmed')).toBeInTheDocument(); @@ -128,6 +130,6 @@ it('Dialog states', () => { }, }) ); - expect(screen.getByText(`${props.name} failed`)).toBeInTheDocument(); + expect(screen.getByText(`${props.title} failed`)).toBeInTheDocument(); expect(screen.getByText(`Error: ${reason}`)).toBeInTheDocument(); }); diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx new file mode 100644 index 000000000..bbb39fe85 --- /dev/null +++ b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx @@ -0,0 +1,125 @@ +import { t } from '@vegaprotocol/react-helpers'; +import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; +import { isEthereumError } from '../ethereum-error'; +import type { EthTxState, TxError } from '../use-ethereum-transaction'; +import { EthTxStatus } from '../use-ethereum-transaction'; +import { ConfirmRow, TxRow, ConfirmationEventRow } from './dialog-rows'; + +export interface EthereumTransactionDialogProps { + title: string; + onChange: (isOpen: boolean) => void; + transaction: EthTxState; + // Undefined means this dialog isn't expecting an additional event for a complete state, a boolean + // value means it is but hasn't been received yet + requiredConfirmations?: number; +} + +export const EthereumTransactionDialog = ({ + onChange, + title, + transaction, + requiredConfirmations = 1, +}: EthereumTransactionDialogProps) => { + const { status, error, confirmations, txHash } = transaction; + return ( + + + + ); +}; + +export const TransactionContent = ({ + status, + error, + txHash, + confirmations, + requiredConfirmations = 1, +}: { + status: EthTxStatus; + error: TxError | null; + txHash: string | null; + confirmations: number; + requiredConfirmations?: number; +}) => { + if (status === EthTxStatus.Error) { + let errorMessage = ''; + + if (isEthereumError(error)) { + errorMessage = error.reason; + } else if (error instanceof Error) { + errorMessage = error.message; + } + + return ( +

+ {t('Error')}: {errorMessage} +

+ ); + } + + return ( +
+ + + +
+ ); +}; + +export const getWrapperProps = (title: string, status: EthTxStatus) => { + const propsMap = { + [EthTxStatus.Default]: { + title: '', + icon: null, + intent: undefined, + }, + [EthTxStatus.Error]: { + title: t(`${title} failed`), + icon: , + intent: Intent.Danger, + }, + [EthTxStatus.Requested]: { + title: t('Confirm transaction'), + icon: , + intent: Intent.Warning, + }, + [EthTxStatus.Pending]: { + title: t(`${title} pending`), + icon: ( + + + + ), + intent: Intent.None, + }, + [EthTxStatus.Complete]: { + title: t(`${title} pending`), + icon: , + intent: Intent.None, + }, + [EthTxStatus.Confirmed]: { + title: t(`${title} complete`), + icon: , + intent: Intent.Success, + }, + }; + + return propsMap[status]; +}; diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/index.ts b/libs/web3/src/lib/ethereum-transaction-dialog/index.ts new file mode 100644 index 000000000..9b4612333 --- /dev/null +++ b/libs/web3/src/lib/ethereum-transaction-dialog/index.ts @@ -0,0 +1 @@ +export * from './ethereum-transaction-dialog'; diff --git a/libs/web3/src/lib/transaction-dialog/index.ts b/libs/web3/src/lib/transaction-dialog/index.ts deleted file mode 100644 index efaeaf442..000000000 --- a/libs/web3/src/lib/transaction-dialog/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './transaction-dialog'; diff --git a/libs/web3/src/lib/transaction-dialog/transaction-dialog.tsx b/libs/web3/src/lib/transaction-dialog/transaction-dialog.tsx deleted file mode 100644 index edef4538d..000000000 --- a/libs/web3/src/lib/transaction-dialog/transaction-dialog.tsx +++ /dev/null @@ -1,115 +0,0 @@ -import { t } from '@vegaprotocol/react-helpers'; -import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; -import { isEthereumError } from '../ethereum-error'; -import type { EthTxState } from '../use-ethereum-transaction'; -import { EthTxStatus } from '../use-ethereum-transaction'; -import { ConfirmRow, TxRow, ConfirmationEventRow } from './dialog-rows'; - -export interface TransactionDialogProps { - name: string; - onChange: (isOpen: boolean) => void; - transaction: EthTxState; - // Undefined means this dialog isn't expecting an additional event for a complete state, a boolean - // value means it is but hasn't been received yet - requiredConfirmations?: number; -} - -export const TransactionDialog = ({ - onChange, - name, - transaction, - requiredConfirmations = 1, -}: TransactionDialogProps) => { - const { status, error, confirmations, txHash } = transaction; - - const renderContent = () => { - if (status === EthTxStatus.Error) { - const classNames = 'break-all text-black dark:text-white'; - if (isEthereumError(error)) { - return ( -

- {t('Error')}: {error.reason} -

- ); - } - - if (error instanceof Error) { - return ( -

- {t('Error')}: {error.message} -

- ); - } - - return ( -

- {t('Error')}: {t('Unknown error')} -

- ); - } - - return ( - <> - - - - - ); - }; - - const getWrapperProps = () => { - const propsMap = { - [EthTxStatus.Default]: { - title: '', - icon: null, - intent: undefined, - }, - [EthTxStatus.Error]: { - title: t(`${name} failed`), - icon: , - intent: Intent.Danger, - }, - [EthTxStatus.Requested]: { - title: t('Confirm transaction'), - icon: , - intent: Intent.Warning, - }, - [EthTxStatus.Pending]: { - title: t(`${name} pending`), - icon: , - intent: Intent.None, - }, - [EthTxStatus.Complete]: { - title: t(`${name} pending`), - icon: , - intent: Intent.None, - }, - [EthTxStatus.Confirmed]: { - title: t(`${name} complete`), - icon: , - intent: Intent.Success, - }, - }; - - return propsMap[status]; - }; - - const { intent, title, icon } = getWrapperProps(); - return ( - - {renderContent()} - - ); -}; diff --git a/libs/web3/src/lib/use-ethereum-transaction.tsx b/libs/web3/src/lib/use-ethereum-transaction.tsx index cbd043642..ce1cfe285 100644 --- a/libs/web3/src/lib/use-ethereum-transaction.tsx +++ b/libs/web3/src/lib/use-ethereum-transaction.tsx @@ -4,7 +4,7 @@ import { useCallback, useMemo, useState } from 'react'; import type { EthereumError } from './ethereum-error'; import { isExpectedEthereumError } from './ethereum-error'; import { isEthereumError } from './ethereum-error'; -import { TransactionDialog } from './transaction-dialog'; +import { EthereumTransactionDialog } from './ethereum-transaction-dialog'; export enum EthTxStatus { Default = 'Default', @@ -152,8 +152,8 @@ export const useEthereumTransaction = < const Dialog = useMemo(() => { return () => ( - { reset(); }} diff --git a/libs/withdraws/src/index.ts b/libs/withdraws/src/index.ts index 41cbea1fe..329c09dd4 100644 --- a/libs/withdraws/src/index.ts +++ b/libs/withdraws/src/index.ts @@ -1,7 +1,12 @@ +export * from './lib/withdrawal-dialogs'; export * from './lib/withdraw-form'; +export * from './lib/withdraw-form-container'; export * from './lib/withdraw-manager'; export * from './lib/withdrawals-table'; +export * from './lib/withdrawal-feedback'; export * from './lib/use-complete-withdraw'; -export * from './lib/use-withdraw'; +export * from './lib/use-create-withdraw'; +export * from './lib/use-verify-withdrawal'; export * from './lib/use-withdrawals'; export * from './lib/__generated__/Withdrawals'; +export * from './lib/__generated__/WithdrawalFields'; diff --git a/libs/withdraws/src/lib/__generated__/AssetFields.ts b/libs/withdraws/src/lib/__generated__/AssetFields.ts new file mode 100644 index 000000000..8a0b8f28b --- /dev/null +++ b/libs/withdraws/src/lib/__generated__/AssetFields.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL fragment: AssetFields +// ==================================================== + +export interface AssetFields_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface AssetFields_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_source_ERC20; + +export interface AssetFields { + __typename: "Asset"; + /** + * The ID of the asset + */ + id: string; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: AssetFields_source; +} diff --git a/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts b/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts similarity index 61% rename from apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts rename to libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts index 57c74885f..1e3e504d5 100644 --- a/apps/trading/pages/portfolio/withdraw/__generated__/WithdrawPageQuery.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts @@ -6,10 +6,10 @@ import { AccountType } from "@vegaprotocol/types"; // ==================================================== -// GraphQL query operation: WithdrawPageQuery +// GraphQL query operation: WithdrawFormQuery // ==================================================== -export interface WithdrawPageQuery_party_withdrawals { +export interface WithdrawFormQuery_party_withdrawals { __typename: "Withdrawal"; /** * The Vega internal ID of the withdrawal @@ -21,7 +21,7 @@ export interface WithdrawPageQuery_party_withdrawals { txHash: string | null; } -export interface WithdrawPageQuery_party_accounts_asset { +export interface WithdrawFormQuery_party_accounts_asset { __typename: "Asset"; /** * The ID of the asset @@ -33,7 +33,7 @@ export interface WithdrawPageQuery_party_accounts_asset { symbol: string; } -export interface WithdrawPageQuery_party_accounts { +export interface WithdrawFormQuery_party_accounts { __typename: "Account"; /** * Account type (General, Margin, etc) @@ -46,10 +46,10 @@ export interface WithdrawPageQuery_party_accounts { /** * Asset, the 'currency' */ - asset: WithdrawPageQuery_party_accounts_asset; + asset: WithdrawFormQuery_party_accounts_asset; } -export interface WithdrawPageQuery_party { +export interface WithdrawFormQuery_party { __typename: "Party"; /** * Party identifier @@ -58,18 +58,18 @@ export interface WithdrawPageQuery_party { /** * The list of all withdrawals initiated by the party */ - withdrawals: WithdrawPageQuery_party_withdrawals[] | null; + withdrawals: WithdrawFormQuery_party_withdrawals[] | null; /** * Collateral accounts relating to a party */ - accounts: WithdrawPageQuery_party_accounts[] | null; + accounts: WithdrawFormQuery_party_accounts[] | null; } -export interface WithdrawPageQuery_assetsConnection_edges_node_source_BuiltinAsset { +export interface WithdrawFormQuery_assetsConnection_edges_node_source_BuiltinAsset { __typename: "BuiltinAsset"; } -export interface WithdrawPageQuery_assetsConnection_edges_node_source_ERC20 { +export interface WithdrawFormQuery_assetsConnection_edges_node_source_ERC20 { __typename: "ERC20"; /** * The address of the ERC20 contract @@ -77,9 +77,9 @@ export interface WithdrawPageQuery_assetsConnection_edges_node_source_ERC20 { contractAddress: string; } -export type WithdrawPageQuery_assetsConnection_edges_node_source = WithdrawPageQuery_assetsConnection_edges_node_source_BuiltinAsset | WithdrawPageQuery_assetsConnection_edges_node_source_ERC20; +export type WithdrawFormQuery_assetsConnection_edges_node_source = WithdrawFormQuery_assetsConnection_edges_node_source_BuiltinAsset | WithdrawFormQuery_assetsConnection_edges_node_source_ERC20; -export interface WithdrawPageQuery_assetsConnection_edges_node { +export interface WithdrawFormQuery_assetsConnection_edges_node { __typename: "Asset"; /** * The ID of the asset @@ -100,33 +100,33 @@ export interface WithdrawPageQuery_assetsConnection_edges_node { /** * The origin source of the asset (e.g: an ERC20 asset) */ - source: WithdrawPageQuery_assetsConnection_edges_node_source; + source: WithdrawFormQuery_assetsConnection_edges_node_source; } -export interface WithdrawPageQuery_assetsConnection_edges { +export interface WithdrawFormQuery_assetsConnection_edges { __typename: "AssetEdge"; - node: WithdrawPageQuery_assetsConnection_edges_node; + node: WithdrawFormQuery_assetsConnection_edges_node; } -export interface WithdrawPageQuery_assetsConnection { +export interface WithdrawFormQuery_assetsConnection { __typename: "AssetsConnection"; /** * The assets */ - edges: (WithdrawPageQuery_assetsConnection_edges | null)[] | null; + edges: (WithdrawFormQuery_assetsConnection_edges | null)[] | null; } -export interface WithdrawPageQuery { +export interface WithdrawFormQuery { /** * An entity that is trading on the Vega network */ - party: WithdrawPageQuery_party | null; + party: WithdrawFormQuery_party | null; /** * The list of all assets in use in the Vega network or the specified asset if ID is provided */ - assetsConnection: WithdrawPageQuery_assetsConnection; + assetsConnection: WithdrawFormQuery_assetsConnection; } -export interface WithdrawPageQueryVariables { +export interface WithdrawFormQueryVariables { partyId: string; } diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts index 1e296daff..9eb0a2b40 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts @@ -13,12 +13,30 @@ export interface WithdrawalEvent_busEvents_event_TimeUpdate { __typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Order" | "Trade" | "Account" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "OracleSpec" | "LiquidityProvision"; } +export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type WithdrawalEvent_busEvents_event_Withdrawal_asset_source = WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset | WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20; + export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { __typename: "Asset"; /** * The ID of the asset */ id: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; /** * The symbol of the asset (e.g: GBP) */ @@ -27,6 +45,10 @@ export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: WithdrawalEvent_busEvents_event_Withdrawal_asset_source; } export interface WithdrawalEvent_busEvents_event_Withdrawal_details { diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts index 49a87274f..aabde6ee1 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts @@ -9,12 +9,30 @@ import { WithdrawalStatus } from "@vegaprotocol/types"; // GraphQL fragment: WithdrawalFields // ==================================================== +export interface WithdrawalFields_asset_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface WithdrawalFields_asset_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type WithdrawalFields_asset_source = WithdrawalFields_asset_source_BuiltinAsset | WithdrawalFields_asset_source_ERC20; + export interface WithdrawalFields_asset { __typename: "Asset"; /** * The ID of the asset */ id: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; /** * The symbol of the asset (e.g: GBP) */ @@ -23,6 +41,10 @@ export interface WithdrawalFields_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: WithdrawalFields_asset_source; } export interface WithdrawalFields_details { diff --git a/libs/withdraws/src/lib/__generated__/Withdrawals.ts b/libs/withdraws/src/lib/__generated__/Withdrawals.ts index 6f437780d..a10d6bf9c 100644 --- a/libs/withdraws/src/lib/__generated__/Withdrawals.ts +++ b/libs/withdraws/src/lib/__generated__/Withdrawals.ts @@ -9,12 +9,30 @@ import { WithdrawalStatus } from "@vegaprotocol/types"; // GraphQL query operation: Withdrawals // ==================================================== -export interface Withdrawals_party_withdrawals_asset { +export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset { + __typename: "BuiltinAsset"; +} + +export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20 { + __typename: "ERC20"; + /** + * The address of the ERC20 contract + */ + contractAddress: string; +} + +export type Withdrawals_party_withdrawalsConnection_edges_node_asset_source = Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset | Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20; + +export interface Withdrawals_party_withdrawalsConnection_edges_node_asset { __typename: "Asset"; /** * The ID of the asset */ id: string; + /** + * The full name of the asset (e.g: Great British Pound) + */ + name: string; /** * The symbol of the asset (e.g: GBP) */ @@ -23,9 +41,13 @@ export interface Withdrawals_party_withdrawals_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The origin source of the asset (e.g: an ERC20 asset) + */ + source: Withdrawals_party_withdrawalsConnection_edges_node_asset_source; } -export interface Withdrawals_party_withdrawals_details { +export interface Withdrawals_party_withdrawalsConnection_edges_node_details { __typename: "Erc20WithdrawalDetails"; /** * The ethereum address of the receiver of the asset funds @@ -33,7 +55,7 @@ export interface Withdrawals_party_withdrawals_details { receiverAddress: string; } -export interface Withdrawals_party_withdrawals { +export interface Withdrawals_party_withdrawalsConnection_edges_node { __typename: "Withdrawal"; /** * The Vega internal ID of the withdrawal @@ -50,7 +72,7 @@ export interface Withdrawals_party_withdrawals { /** * The asset to be withdrawn */ - asset: Withdrawals_party_withdrawals_asset; + asset: Withdrawals_party_withdrawalsConnection_edges_node_asset; /** * RFC3339Nano time at which the withdrawal was created */ @@ -66,13 +88,26 @@ export interface Withdrawals_party_withdrawals { /** * Foreign chain specific details about the withdrawal */ - details: Withdrawals_party_withdrawals_details | null; + details: Withdrawals_party_withdrawalsConnection_edges_node_details | null; /** * Whether or the not the withdrawal is being processed on Ethereum */ pendingOnForeignChain: boolean; } +export interface Withdrawals_party_withdrawalsConnection_edges { + __typename: "WithdrawalEdge"; + node: Withdrawals_party_withdrawalsConnection_edges_node; +} + +export interface Withdrawals_party_withdrawalsConnection { + __typename: "WithdrawalsConnection"; + /** + * The withdrawals + */ + edges: (Withdrawals_party_withdrawalsConnection_edges | null)[] | null; +} + export interface Withdrawals_party { __typename: "Party"; /** @@ -82,7 +117,7 @@ export interface Withdrawals_party { /** * The list of all withdrawals initiated by the party */ - withdrawals: Withdrawals_party_withdrawals[] | null; + withdrawalsConnection: Withdrawals_party_withdrawalsConnection; } export interface Withdrawals { diff --git a/libs/withdraws/src/lib/test-helpers.ts b/libs/withdraws/src/lib/test-helpers.ts index d19a84a51..a9d1d4694 100644 --- a/libs/withdraws/src/lib/test-helpers.ts +++ b/libs/withdraws/src/lib/test-helpers.ts @@ -3,7 +3,7 @@ import { AccountType, WithdrawalStatus } from '@vegaprotocol/types'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; import type { Account } from './types'; -import type { Withdrawals_party_withdrawals } from './__generated__/Withdrawals'; +import type { Withdrawals_party_withdrawalsConnection_edges_node } from './__generated__/Withdrawals'; export const generateAsset = (override?: PartialDeep) => { const defaultAsset: Asset = { @@ -33,8 +33,8 @@ export const generateAccount = (override?: PartialDeep) => { }; export const generateWithdrawal = ( - override?: PartialDeep -): Withdrawals_party_withdrawals => { + override?: PartialDeep +): Withdrawals_party_withdrawalsConnection_edges_node => { return merge( { __typename: 'Withdrawal', @@ -43,9 +43,14 @@ export const generateWithdrawal = ( amount: '100', asset: { __typename: 'Asset', + name: 'asset-name', id: 'asset-id', symbol: 'asset-symbol', decimals: 2, + source: { + __typename: 'ERC20', + contractAddress: '0x123', + }, }, createdTimestamp: '2022-04-20T00:00:00', withdrawnTimestamp: null, diff --git a/libs/withdraws/src/lib/use-complete-withdraw.spec.tsx b/libs/withdraws/src/lib/use-complete-withdraw.spec.tsx index b125ff0fa..606dab54a 100644 --- a/libs/withdraws/src/lib/use-complete-withdraw.spec.tsx +++ b/libs/withdraws/src/lib/use-complete-withdraw.spec.tsx @@ -10,13 +10,17 @@ import * as web3 from '@vegaprotocol/web3'; import * as sentry from '@sentry/react'; import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval'; -jest.mock('@vegaprotocol/web3', () => ({ - useBridgeContract: jest.fn().mockReturnValue({ - withdraw_asset: jest.fn(), - isNewContract: true, - }), - useEthereumTransaction: jest.fn(), -})); +jest.mock('@vegaprotocol/web3', () => { + const orig = jest.requireActual('@vegaprotocol/web3'); + return { + ...orig, + useBridgeContract: jest.fn().mockReturnValue({ + withdraw_asset: jest.fn(), + isNewContract: true, + }), + useEthereumTransaction: jest.fn(), + }; +}); function setup(mocks?: MockedResponse[]) { const wrapper = ({ children }: { children: ReactNode }) => ( diff --git a/libs/withdraws/src/lib/use-complete-withdraw.ts b/libs/withdraws/src/lib/use-complete-withdraw.ts index 354ae2285..4749b8f2b 100644 --- a/libs/withdraws/src/lib/use-complete-withdraw.ts +++ b/libs/withdraws/src/lib/use-complete-withdraw.ts @@ -1,7 +1,11 @@ import { gql, useApolloClient } from '@apollo/client'; import { captureException } from '@sentry/react'; import type { CollateralBridge } from '@vegaprotocol/smart-contracts'; -import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3'; +import { + EthTxStatus, + useBridgeContract, + useEthereumTransaction, +} from '@vegaprotocol/web3'; import { useCallback, useEffect, useState } from 'react'; import { ERC20_APPROVAL_QUERY } from './queries'; import type { @@ -21,7 +25,7 @@ export const useCompleteWithdraw = () => { const { query, cache } = useApolloClient(); const contract = useBridgeContract(); const [id, setId] = useState(''); - const { transaction, perform, Dialog } = useEthereumTransaction< + const { transaction, perform, reset, Dialog } = useEthereumTransaction< CollateralBridge, 'withdraw_asset' >(contract, 'withdraw_asset'); @@ -29,6 +33,7 @@ export const useCompleteWithdraw = () => { const submit = useCallback( async (withdrawalId: string) => { setId(withdrawalId); + try { if (!contract) { return; @@ -39,6 +44,7 @@ export const useCompleteWithdraw = () => { }); const approval = res.data.erc20WithdrawalApproval; + if (!approval) { throw new Error('Could not retrieve withdrawal approval'); } @@ -65,12 +71,13 @@ export const useCompleteWithdraw = () => { fragment: PENDING_WITHDRAWAL_FRAGMMENT, data: { __typename: 'Withdrawal', - pendingOnForeignChain: true, + pendingOnForeignChain: + transaction.status === EthTxStatus.Pending ? true : false, txHash: transaction.txHash, }, }); } - }, [cache, transaction.txHash, id]); + }, [cache, transaction.status, transaction.txHash, id]); - return { transaction, Dialog, submit, withdrawalId: id }; + return { transaction, reset, Dialog, submit, withdrawalId: id }; }; diff --git a/libs/withdraws/src/lib/use-create-withdraw.spec.tsx b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx new file mode 100644 index 000000000..3c937f09b --- /dev/null +++ b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx @@ -0,0 +1,197 @@ +import { act, renderHook } from '@testing-library/react'; +import type { MockedResponse } from '@apollo/client/testing'; +import { MockedProvider } from '@apollo/client/testing'; +import type { ReactNode } from 'react'; +import { ERC20_APPROVAL_QUERY } from './queries'; +import type { WithdrawalArgs } from './use-create-withdraw'; +import { useCreateWithdraw } from './use-create-withdraw'; +import type { Erc20Approval } from './__generated__/Erc20Approval'; +import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; +import { + initialState, + VegaTxStatus, + VegaWalletContext, +} from '@vegaprotocol/wallet'; +import { waitFor } from '@testing-library/react'; +import { determineId } from '@vegaprotocol/react-helpers'; +import type { + WithdrawalEvent, + WithdrawalEvent_busEvents_event_Withdrawal, +} from './__generated__/WithdrawalEvent'; +import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals'; +import { WithdrawalStatus } from '@vegaprotocol/types'; + +function setup( + vegaWalletContext: Partial, + mocks?: MockedResponse[] +) { + const wrapper = ({ children }: { children: ReactNode }) => ( + + + {children} + + + ); + return renderHook(() => useCreateWithdraw(), { wrapper }); +} + +const txHash = 'tx-hash'; +const signature = + 'cfe592d169f87d0671dd447751036d0dddc165b9c4b65e5a5060e2bbadd1aa726d4cbe9d3c3b327bcb0bff4f83999592619a2493f9bbd251fae99ce7ce766909'; +const derivedWithdrawalId = determineId(signature); + +beforeAll(() => { + jest.useFakeTimers(); +}); + +afterAll(() => { + jest.useRealTimers(); +}); + +const pubkey = '0x123'; +let mockSend: jest.Mock; +let withdrawalInput: WithdrawalArgs; +let withdrawalEvent: WithdrawalEvent_busEvents_event_Withdrawal; +let mockERC20Approval: MockedResponse; +let mockWithdrawalEvent: MockedResponse; + +beforeEach(() => { + mockSend = jest + .fn() + .mockReturnValue( + Promise.resolve({ txHash, tx: { signature: { value: signature } } }) + ); + withdrawalEvent = { + id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50', + status: WithdrawalStatus.STATUS_OPEN, + amount: '100', + asset: { + __typename: 'Asset', + id: 'asset-id', + name: 'asset-name', + symbol: 'asset-symbol', + decimals: 2, + source: { + __typename: 'ERC20', + contractAddress: '0x123', + }, + }, + createdTimestamp: '2022-07-05T14:25:47.815283706Z', + withdrawnTimestamp: '2022-07-05T14:25:47.815283706Z', + txHash: '0x123', + details: { + __typename: 'Erc20WithdrawalDetails', + receiverAddress: '0x123', + }, + pendingOnForeignChain: false, + __typename: 'Withdrawal', + }; + withdrawalInput = { + amount: '100', + asset: 'asset-id', + receiverAddress: 'receiver-address', + availableTimestamp: null, + }; + mockERC20Approval = { + request: { + query: ERC20_APPROVAL_QUERY, + variables: { withdrawalId: derivedWithdrawalId }, + }, + result: { + data: { + erc20WithdrawalApproval: { + __typename: 'Erc20WithdrawalApproval', + assetSource: 'asset-source', + amount: '100', + nonce: '1', + signatures: 'signatures', + targetAddress: 'targetAddress', + expiry: 'expiry', + creation: '1', + }, + }, + }, + delay: 2000, + }; + mockWithdrawalEvent = { + request: { + query: WITHDRAWAL_BUS_EVENT_SUB, + variables: { partyId: pubkey }, + }, + result: { + data: { + busEvents: [ + { + event: withdrawalEvent, + __typename: 'BusEvent', + }, + ], + }, + }, + delay: 1000, + }; +}); + +it('creates withdrawal and waits for approval creation', async () => { + const { result } = setup( + // @ts-ignore only need pub property from keypair + { sendTx: mockSend, keypair: { pub: pubkey } }, + [mockWithdrawalEvent, mockERC20Approval] + ); + + expect(result.current.transaction).toEqual(initialState); + expect(result.current.submit).toEqual(expect.any(Function)); + expect(result.current.reset).toEqual(expect.any(Function)); + expect(result.current.approval).toEqual(null); + + act(() => { + result.current.submit(withdrawalInput); + }); + + expect(mockSend).toHaveBeenCalledWith({ + pubKey: pubkey, + propagate: true, + withdrawSubmission: { + amount: withdrawalInput.amount, + asset: withdrawalInput.asset, + ext: { + erc20: { + receiverAddress: withdrawalInput.receiverAddress, + }, + }, + }, + }); + + expect(result.current.transaction.status).toEqual(VegaTxStatus.Requested); + + await waitFor(() => { + expect(result.current.transaction.status).toEqual(VegaTxStatus.Pending); + expect(result.current.transaction.dialogOpen).toBe(true); + // Withdrawal event should not be found yet + expect(result.current.withdrawal).toEqual(null); + // Poll for erc20Approval should not be complete yet + expect(result.current.approval).toEqual(null); + }); + + await act(async () => { + // Advance time by delay plus interval length to ensure mock result is triggered + // eslint-disable-next-line + jest.advanceTimersByTime(mockWithdrawalEvent.delay! + 1000); + }); + + expect(result.current.withdrawal).toEqual(withdrawalEvent); + + await act(async () => { + // Advance time by delay plus interval length to ensure mock result is triggered + // eslint-disable-next-line + jest.advanceTimersByTime(mockERC20Approval.delay! + 1000); + }); + + expect(result.current.transaction.status).toEqual(VegaTxStatus.Complete); + expect(result.current.approval).toEqual( + // @ts-ignore MockedRespones types inteferring + mockERC20Approval.result.data.erc20WithdrawalApproval + ); +}); diff --git a/libs/withdraws/src/lib/use-create-withdraw.ts b/libs/withdraws/src/lib/use-create-withdraw.ts new file mode 100644 index 000000000..58a1807d7 --- /dev/null +++ b/libs/withdraws/src/lib/use-create-withdraw.ts @@ -0,0 +1,74 @@ +import { determineId } from '@vegaprotocol/react-helpers'; +import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; +import { useCallback, useState } from 'react'; +import { useWithdrawalApproval } from './use-withdrawal-approval'; +import { useWithdrawalEvent } from './use-withdrawal-event'; +import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval'; +import type { WithdrawalFields } from './__generated__/WithdrawalFields'; + +export interface WithdrawalArgs { + amount: string; + asset: string; + receiverAddress: string; + availableTimestamp: number | null; +} + +export const useCreateWithdraw = () => { + const waitForWithdrawalApproval = useWithdrawalApproval(); + const waitForWithdrawal = useWithdrawalEvent(); + const [approval, setApproval] = + useState(null); + const [withdrawal, setWithdrawal] = useState(null); + const [availableTimestamp, setAvailableTimestamp] = useState( + null + ); + + const { keypair } = useVegaWallet(); + const { transaction, send, setComplete, reset, Dialog } = + useVegaTransaction(); + + const submit = useCallback( + async (withdrawal: WithdrawalArgs) => { + if (!keypair) { + return; + } + + setAvailableTimestamp(withdrawal.availableTimestamp); + + const res = await send({ + pubKey: keypair.pub, + propagate: true, + withdrawSubmission: { + amount: withdrawal.amount, + asset: withdrawal.asset, + ext: { + erc20: { + receiverAddress: withdrawal.receiverAddress, + }, + }, + }, + }); + + if (res?.signature) { + const id = determineId(res.signature); + + const withdrawal = await waitForWithdrawal(id, keypair.pub); + setWithdrawal(withdrawal); + const approval = await waitForWithdrawalApproval(withdrawal.id); + setApproval(approval); + setComplete(); + } + }, + [keypair, send, waitForWithdrawal, waitForWithdrawalApproval, setComplete] + ); + + return { + transaction, + submit, + reset, + approval, + withdrawal, + availableTimestamp, + Dialog, + }; +}; diff --git a/libs/withdraws/src/lib/use-get-withdraw-delay.ts b/libs/withdraws/src/lib/use-get-withdraw-delay.ts new file mode 100644 index 000000000..14a64e198 --- /dev/null +++ b/libs/withdraws/src/lib/use-get-withdraw-delay.ts @@ -0,0 +1,21 @@ +import * as Sentry from '@sentry/react'; +import { useBridgeContract } from '@vegaprotocol/web3'; +import { useCallback } from 'react'; + +/** + * Gets the delay in seconds thats required if the withdrawal amount is + * over the withdrawal threshold (contract.get_withdraw_threshold) + */ +export const useGetWithdrawDelay = () => { + const contract = useBridgeContract(); + const getDelay = useCallback(async () => { + try { + const res = await contract?.default_withdraw_delay(); + return res.toNumber(); + } catch (err) { + Sentry.captureException(err); + } + }, [contract]); + + return getDelay; +}; diff --git a/libs/withdraws/src/lib/use-get-withdraw-limits.tsx b/libs/withdraws/src/lib/use-get-withdraw-limits.tsx deleted file mode 100644 index a1cc7bcf1..000000000 --- a/libs/withdraws/src/lib/use-get-withdraw-limits.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { useCallback } from 'react'; -import { useBridgeContract, useEthereumReadContract } from '@vegaprotocol/web3'; -import BigNumber from 'bignumber.js'; -import type { Asset } from '@vegaprotocol/react-helpers'; -import { addDecimal } from '@vegaprotocol/react-helpers'; - -export const useGetWithdrawLimits = (asset?: Asset) => { - const contract = useBridgeContract(); - const getLimits = useCallback(async () => { - if (!contract || !asset || asset.source.__typename !== 'ERC20') { - return; - } - - return contract.get_withdraw_threshold(asset.source.contractAddress); - }, [asset, contract]); - - const { - state: { data }, - } = useEthereumReadContract(getLimits); - - if (!data || !asset) return null; - - const value = new BigNumber(addDecimal(data.toString(), asset.decimals)); - const max = value.isEqualTo(0) - ? new BigNumber(Infinity) - : value.minus(new BigNumber(addDecimal('1', asset.decimals))); - return { - max, - }; -}; diff --git a/libs/withdraws/src/lib/use-get-withdraw-threshold.tsx b/libs/withdraws/src/lib/use-get-withdraw-threshold.tsx new file mode 100644 index 000000000..fff3a856d --- /dev/null +++ b/libs/withdraws/src/lib/use-get-withdraw-threshold.tsx @@ -0,0 +1,32 @@ +import { useCallback } from 'react'; +import { useBridgeContract } from '@vegaprotocol/web3'; +import BigNumber from 'bignumber.js'; +import type { Asset } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/react-helpers'; + +/** + * Returns a function to get the threshold amount for a withdrawal. If a withdrawal amount + * is greater than this value it will incur a delay before being able to be completed. The delay is set + * on the smart contract and can be retrieved using contract.default_withdraw_delay + */ +export const useGetWithdrawThreshold = () => { + const contract = useBridgeContract(); + const getThreshold = useCallback( + async (asset: Asset | undefined) => { + if (!contract || asset?.source.__typename !== 'ERC20') { + return new BigNumber(Infinity); + } + const res = await contract.get_withdraw_threshold( + asset.source.contractAddress + ); + const value = new BigNumber(addDecimal(res.toString(), asset.decimals)); + const threshold = value.isEqualTo(0) + ? new BigNumber(Infinity) + : value.minus(new BigNumber(addDecimal('1', asset.decimals))); + return threshold; + }, + [contract] + ); + + return getThreshold; +}; diff --git a/libs/withdraws/src/lib/use-verify-withdrawal.ts b/libs/withdraws/src/lib/use-verify-withdrawal.ts new file mode 100644 index 000000000..55803216d --- /dev/null +++ b/libs/withdraws/src/lib/use-verify-withdrawal.ts @@ -0,0 +1,135 @@ +import { useCallback, useState } from 'react'; +import { captureException } from '@sentry/react'; +import type { WithdrawalFields } from './__generated__/WithdrawalFields'; +import BigNumber from 'bignumber.js'; +import { addDecimal, t } from '@vegaprotocol/react-helpers'; +import { useGetWithdrawThreshold } from './use-get-withdraw-threshold'; +import { useGetWithdrawDelay } from './use-get-withdraw-delay'; +import { ERC20_APPROVAL_QUERY } from './queries'; +import type { + Erc20Approval, + Erc20ApprovalVariables, +} from './__generated__/Erc20Approval'; +import { useApolloClient } from '@apollo/client'; + +export enum ApprovalStatus { + Idle = 'Idle', + Pending = 'Pending', + Delayed = 'Delayed', + Error = 'Error', + Ready = 'Ready', +} + +export interface VerifyState { + status: ApprovalStatus; + message: string; + threshold: BigNumber; + completeTimestamp: number | null; + dialogOpen: boolean; +} + +const initialState = { + status: ApprovalStatus.Idle, + message: '', + threshold: new BigNumber(Infinity), + completeTimestamp: null, + dialogOpen: false, +}; + +export const useVerifyWithdrawal = () => { + const client = useApolloClient(); + const getThreshold = useGetWithdrawThreshold(); + const getDelay = useGetWithdrawDelay(); + const [state, _setState] = useState(initialState); + + const setState = useCallback( + (update: Partial) => { + _setState((curr) => ({ + ...curr, + ...update, + })); + }, + [_setState] + ); + + const reset = useCallback(() => { + setState(initialState); + }, [setState]); + + const verify = useCallback( + async (withdrawal: WithdrawalFields) => { + try { + setState({ dialogOpen: true }); + + if (withdrawal.asset.source.__typename !== 'ERC20') { + setState({ + status: ApprovalStatus.Error, + message: t( + `Invalid asset source: ${withdrawal.asset.source.__typename}` + ), + }); + return false; + } + + setState({ + status: ApprovalStatus.Pending, + message: t('Verifying withdrawal approval'), + }); + + const amount = new BigNumber( + addDecimal(withdrawal.amount, withdrawal.asset.decimals) + ); + + const threshold = await getThreshold(withdrawal.asset); + + if (threshold && amount.isGreaterThan(threshold)) { + const delaySecs = await getDelay(); + const completeTimestamp = + new Date(withdrawal.createdTimestamp).getTime() + delaySecs * 1000; + + if (Date.now() < completeTimestamp) { + setState({ + status: ApprovalStatus.Delayed, + threshold, + completeTimestamp, + }); + return false; + } + } + + const res = await client.query({ + query: ERC20_APPROVAL_QUERY, + variables: { withdrawalId: withdrawal.id }, + }); + + const approval = res.data.erc20WithdrawalApproval; + if (!approval) { + setState({ + status: ApprovalStatus.Error, + }); + return false; + } + + if (approval.signatures.length < 3) { + setState({ + status: ApprovalStatus.Error, + }); + return false; + } + + setState({ status: ApprovalStatus.Ready, dialogOpen: false }); + + return true; + } catch (err) { + captureException(err); + setState({ + status: ApprovalStatus.Error, + }); + return false; + } + }, + [getThreshold, getDelay, client, setState] + ); + + return { verify, state, reset }; +}; diff --git a/libs/withdraws/src/lib/use-withdraw.spec.tsx b/libs/withdraws/src/lib/use-withdraw.spec.tsx deleted file mode 100644 index c94d91175..000000000 --- a/libs/withdraws/src/lib/use-withdraw.spec.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import { act, renderHook } from '@testing-library/react'; -import type { MockedResponse } from '@apollo/client/testing'; -import { MockedProvider } from '@apollo/client/testing'; -import type { ReactNode } from 'react'; -import { ERC20_APPROVAL_QUERY } from './queries'; -import * as web3 from '@vegaprotocol/web3'; -import * as wallet from '@vegaprotocol/wallet'; -import type { WithdrawalFields } from './use-withdraw'; -import { useWithdraw } from './use-withdraw'; -import type { Erc20Approval } from './__generated__/Erc20Approval'; - -jest.mock('@vegaprotocol/web3', () => ({ - useBridgeContract: jest.fn().mockReturnValue({ - withdraw_asset: jest.fn(), - isNewContract: true, - }), - useEthereumTransaction: jest.fn(), -})); - -jest.mock('@vegaprotocol/wallet', () => ({ - useVegaWallet: jest.fn().mockReturnValue({ keypair: { pub: 'pubkey' } }), - useVegaTransaction: jest.fn().mockReturnValue({ - transaction: {}, - send: jest.fn(), - reset: jest.fn(), - }), -})); - -function setup(mocks?: MockedResponse[], cancelled = false) { - const wrapper = ({ children }: { children: ReactNode }) => ( - {children} - ); - return renderHook(() => useWithdraw(cancelled), { wrapper }); -} - -const signature = - 'cfe592d169f87d0671dd447751036d0dddc165b9c4b65e5a5060e2bbadd1aa726d4cbe9d3c3b327bcb0bff4f83999592619a2493f9bbd251fae99ce7ce766909'; -const derivedWithdrawalId = - '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50'; - -beforeAll(() => { - jest.useFakeTimers(); -}); - -afterAll(() => { - jest.useRealTimers(); -}); - -let pubkey: string; -let mockSend: jest.Mock; -let mockPerform: jest.Mock; -let mockEthReset: jest.Mock; -let mockVegaReset: jest.Mock; -let withdrawalInput: WithdrawalFields; -let mockERC20Approval: MockedResponse; - -beforeEach(() => { - pubkey = 'pubkey'; - mockSend = jest.fn().mockReturnValue(Promise.resolve({ signature })); - mockPerform = jest.fn(); - mockEthReset = jest.fn(); - mockVegaReset = jest.fn(); - - jest.spyOn(web3, 'useEthereumTransaction').mockReturnValue({ - // @ts-ignore allow null transaction as its not used in hook logic - transaction: null, - perform: mockPerform, - reset: mockEthReset, - }); - jest - .spyOn(wallet, 'useVegaWallet') - // @ts-ignore only need to mock keypair - .mockReturnValue({ keypair: { pub: pubkey } }); - jest.spyOn(wallet, 'useVegaTransaction').mockReturnValue({ - // @ts-ignore allow null transaction as its not used in hook logic - transaction: null, - send: mockSend, - reset: mockVegaReset, - }); - - withdrawalInput = { - amount: '100', - asset: 'asset-id', - receiverAddress: 'receiver-address', - }; - mockERC20Approval = { - request: { - query: ERC20_APPROVAL_QUERY, - variables: { withdrawalId: derivedWithdrawalId }, - }, - result: { - data: { - erc20WithdrawalApproval: { - __typename: 'Erc20WithdrawalApproval', - assetSource: 'asset-source', - amount: '100', - nonce: '1', - signatures: 'signatures', - targetAddress: 'targetAddress', - expiry: 'expiry', - creation: '1', - }, - }, - }, - delay: 5000, - }; -}); - -it('Creates withdrawal and immediately submits Ethereum transaction', async () => { - const { result } = setup([mockERC20Approval]); - - await act(async () => { - result.current.submit(withdrawalInput); - }); - - expect(mockSend).toHaveBeenCalledWith({ - pubKey: pubkey, - propagate: true, - withdrawSubmission: { - amount: withdrawalInput.amount, - asset: withdrawalInput.asset, - ext: { - erc20: { - receiverAddress: withdrawalInput.receiverAddress, - }, - }, - }, - }); - - expect(result.current.withdrawalId).toEqual(derivedWithdrawalId); - - // Query 'poll' not returned yet and eth transaction shouldn't have - // started - expect(result.current.approval).toEqual(null); - expect(mockPerform).not.toHaveBeenCalled(); - - // Advance query delay time so query result is returned and the - // eth transaction should be called with the approval query result - await act(async () => { - jest.advanceTimersByTime(mockERC20Approval.delay || 0); - }); - - expect(result.current.approval).toEqual( - // @ts-ignore MockedRespones types inteferring - mockERC20Approval.result.data.erc20WithdrawalApproval - ); - // @ts-ignore MockedRespones types inteferring - const withdrawal = mockERC20Approval.result.data.erc20WithdrawalApproval; - expect(mockPerform).toHaveBeenCalledWith( - withdrawal.assetSource, - withdrawal.amount, - withdrawal.targetAddress, - withdrawal.creation, - withdrawal.nonce, - withdrawal.signatures - ); -}); - -it('Doesnt perform Ethereum tx if cancelled', async () => { - const { result } = setup([mockERC20Approval], true); - - await act(async () => { - result.current.submit(withdrawalInput); - }); - - await act(async () => { - jest.advanceTimersByTime(mockERC20Approval.delay || 0); - }); - - expect(result.current.approval).toEqual( - // @ts-ignore MockedRespone types inteferring - mockERC20Approval.result.data.erc20WithdrawalApproval - ); - - // Approval set, but cancelled flag is set, so the Ethereum - // TX should not be invoked - expect(mockPerform).not.toHaveBeenCalled(); -}); - -it('Reset will reset both transactions', async () => { - const { result } = setup([mockERC20Approval]); - - await act(async () => { - result.current.reset(); - }); - - expect(mockEthReset).toHaveBeenCalled(); - expect(mockVegaReset).toHaveBeenCalled(); -}); diff --git a/libs/withdraws/src/lib/use-withdraw.ts b/libs/withdraws/src/lib/use-withdraw.ts deleted file mode 100644 index 6a670a0c7..000000000 --- a/libs/withdraws/src/lib/use-withdraw.ts +++ /dev/null @@ -1,115 +0,0 @@ -import { useQuery } from '@apollo/client'; -import { determineId } from '@vegaprotocol/react-helpers'; -import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3'; -import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; -import { useCallback, useEffect, useState } from 'react'; -import { ERC20_APPROVAL_QUERY } from './queries'; -import type { - Erc20Approval, - Erc20Approval_erc20WithdrawalApproval, - Erc20ApprovalVariables, -} from './__generated__/Erc20Approval'; -import type { CollateralBridge } from '@vegaprotocol/smart-contracts'; - -export interface WithdrawalFields { - amount: string; - asset: string; - receiverAddress: string; -} - -export const useWithdraw = (cancelled: boolean) => { - const [withdrawalId, setWithdrawalId] = useState(null); - const [approval, setApproval] = - useState(null); - - const contract = useBridgeContract(); - const { keypair } = useVegaWallet(); - const { - transaction: vegaTx, - send, - reset: resetVegaTx, - } = useVegaTransaction(); - - const { - transaction: ethTx, - perform, - reset: resetEthTx, - } = useEthereumTransaction( - contract, - 'withdraw_asset' - ); - - const { data, stopPolling } = useQuery( - ERC20_APPROVAL_QUERY, - { - variables: { withdrawalId: withdrawalId || '' }, - skip: !withdrawalId, - pollInterval: 1000, - } - ); - - const submit = useCallback( - async (withdrawal: WithdrawalFields) => { - if (!keypair) { - return; - } - - const res = await send({ - pubKey: keypair.pub, - propagate: true, - withdrawSubmission: { - amount: withdrawal.amount, - asset: withdrawal.asset, - ext: { - erc20: { - receiverAddress: withdrawal.receiverAddress, - }, - }, - }, - }); - - if (res?.signature) { - setWithdrawalId(determineId(res.signature)); - } - }, - [keypair, send] - ); - - useEffect(() => { - if ( - data?.erc20WithdrawalApproval && - data.erc20WithdrawalApproval.signatures.length > 2 - ) { - stopPolling(); - setApproval(data.erc20WithdrawalApproval); - } - }, [data, stopPolling]); - - useEffect(() => { - if (approval && contract && !cancelled) { - perform( - approval.assetSource, - approval.amount, - approval.targetAddress, - approval.creation, - approval.nonce, - approval.signatures - ); - } - // eslint-disable-next-line - }, [approval, contract]); - - const reset = useCallback(() => { - resetVegaTx(); - resetEthTx(); - }, [resetVegaTx, resetEthTx]); - - return { - submit, - reset, - approval, - withdrawalId, - vegaTx, - ethTx, - }; -}; diff --git a/libs/withdraws/src/lib/use-withdrawal-approval.ts b/libs/withdraws/src/lib/use-withdrawal-approval.ts new file mode 100644 index 000000000..9ee4fbe30 --- /dev/null +++ b/libs/withdraws/src/lib/use-withdrawal-approval.ts @@ -0,0 +1,58 @@ +import { useApolloClient } from '@apollo/client'; +import { useCallback, useEffect, useRef } from 'react'; +import { ERC20_APPROVAL_QUERY } from './queries'; +import type { + Erc20Approval, + Erc20ApprovalVariables, + Erc20Approval_erc20WithdrawalApproval, +} from './__generated__/Erc20Approval'; + +type WaitForApproval = ( + id: string +) => Promise; + +export const useWithdrawalApproval = () => { + const client = useApolloClient(); + // eslint-disable-next-line + const intervalRef = useRef(); + + const waitForWithdrawalApproval = useCallback( + (id) => { + return new Promise((resolve) => { + intervalRef.current = setInterval(async () => { + try { + const res = await client.query< + Erc20Approval, + Erc20ApprovalVariables + >({ + query: ERC20_APPROVAL_QUERY, + variables: { withdrawalId: id }, + fetchPolicy: 'network-only', + }); + + if ( + res.data.erc20WithdrawalApproval && + res.data.erc20WithdrawalApproval.signatures.length > 2 + ) { + clearInterval(intervalRef.current); + resolve(res.data.erc20WithdrawalApproval); + } + } catch (err) { + // no op as the query will error until the approval is created + } + }, 1000); + }); + }, + [client] + ); + + useEffect(() => { + return () => { + if (intervalRef.current) { + clearInterval(intervalRef.current); + } + }; + }, []); + + return waitForWithdrawalApproval; +}; diff --git a/libs/withdraws/src/lib/use-withdrawal-event.ts b/libs/withdraws/src/lib/use-withdrawal-event.ts new file mode 100644 index 000000000..370e67781 --- /dev/null +++ b/libs/withdraws/src/lib/use-withdrawal-event.ts @@ -0,0 +1,61 @@ +import { useApolloClient } from '@apollo/client'; +import { useCallback, useEffect, useRef } from 'react'; +import type { Subscription } from 'zen-observable-ts'; +import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals'; +import type { + WithdrawalEvent, + WithdrawalEventVariables, + WithdrawalEvent_busEvents_event_Withdrawal, +} from './__generated__/WithdrawalEvent'; + +type WaitForWithdrawalEvent = ( + id: string, + partyId: string +) => Promise; +export const useWithdrawalEvent = () => { + const client = useApolloClient(); + const subRef = useRef(null); + + const waitForWithdrawalEvent = useCallback( + (id, partyId) => { + return new Promise((resolve) => { + subRef.current = client + .subscribe({ + query: WITHDRAWAL_BUS_EVENT_SUB, + variables: { partyId }, + }) + .subscribe(({ data }) => { + if (!data?.busEvents?.length) { + return; + } + + // No types available for the subscription result + const matchingWithdrawalEvent = data.busEvents.find((e) => { + if (e.event.__typename !== 'Withdrawal') { + return false; + } + + return e.event.id === id; + }); + + if ( + matchingWithdrawalEvent && + matchingWithdrawalEvent.event.__typename === 'Withdrawal' + ) { + resolve(matchingWithdrawalEvent.event); + subRef.current?.unsubscribe(); + } + }); + }); + }, + [client] + ); + + useEffect(() => { + return () => { + subRef.current?.unsubscribe(); + }; + }, []); + + return waitForWithdrawalEvent; +}; diff --git a/libs/withdraws/src/lib/use-withdrawals.spec.tsx b/libs/withdraws/src/lib/use-withdrawals.spec.tsx index cc00b1fa8..09b4abc27 100644 --- a/libs/withdraws/src/lib/use-withdrawals.spec.tsx +++ b/libs/withdraws/src/lib/use-withdrawals.spec.tsx @@ -7,11 +7,11 @@ import type { } from './__generated__/WithdrawalEvent'; import type { Withdrawals, - Withdrawals_party_withdrawals, + Withdrawals_party_withdrawalsConnection_edges_node, } from './__generated__/Withdrawals'; describe('updateQuery', () => { - it('Updates existing withdrawals', () => { + it('updates existing withdrawals', () => { const withdrawal = generateWithdrawal({ id: '1', status: WithdrawalStatus.STATUS_OPEN, @@ -27,7 +27,15 @@ describe('updateQuery', () => { party: { __typename: 'Party', id: 'party-id', - withdrawals: [withdrawalUpdate], + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: [ + { + __typename: 'WithdrawalEdge', + node: withdrawalUpdate, + }, + ], + }, }, }); }); @@ -48,21 +56,45 @@ describe('updateQuery', () => { party: { __typename: 'Party', id: 'party-id', - withdrawals: [withdrawalUpdate, withdrawal], + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: [ + { + __typename: 'WithdrawalEdge', + node: withdrawalUpdate, + }, + { + __typename: 'WithdrawalEdge', + node: withdrawal, + }, + ], + }, }, }); }); - it('Creates new party if not present', () => { + it('creates new party if not present', () => { + const partyId = 'party-id'; const withdrawalUpdate = generateWithdrawal({ id: '2', }); const incoming = mockSub([withdrawalUpdate]); - expect(updateQuery({ party: null }, incoming)).toEqual({ + expect( + updateQuery({ party: null }, { ...incoming, variables: { partyId } }) + ).toEqual({ party: { __typename: 'Party', - withdrawals: [withdrawalUpdate], + id: partyId, + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: [ + { + __typename: 'WithdrawalEdge', + node: withdrawalUpdate, + }, + ], + }, }, }); }); @@ -89,20 +121,42 @@ describe('updateQuery', () => { party: { __typename: 'Party', id: 'party-id', - withdrawals: [withdrawalUpdate, withdrawalNew, withdrawal2], + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: [ + { + __typename: 'WithdrawalEdge', + node: withdrawalUpdate, + }, + { + __typename: 'WithdrawalEdge', + node: withdrawalNew, + }, + { + __typename: 'WithdrawalEdge', + node: withdrawal2, + }, + ], + }, }, }); }); }); const mockQuery = ( - withdrawals: Withdrawals_party_withdrawals[] + withdrawals: Withdrawals_party_withdrawalsConnection_edges_node[] ): Withdrawals => { return { party: { __typename: 'Party', id: 'party-id', - withdrawals, + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges: withdrawals.map((w) => ({ + __typename: 'WithdrawalEdge', + node: w, + })), + }, }, }; }; diff --git a/libs/withdraws/src/lib/use-withdrawals.ts b/libs/withdraws/src/lib/use-withdrawals.ts index 78c74549d..37c8977c8 100644 --- a/libs/withdraws/src/lib/use-withdrawals.ts +++ b/libs/withdraws/src/lib/use-withdrawals.ts @@ -1,8 +1,10 @@ +import orderBy from 'lodash/orderBy'; +import compact from 'lodash/compact'; import { gql, useQuery } from '@apollo/client'; import type { UpdateQueryFn } from '@apollo/client/core/watchQueryOptions'; import { useVegaWallet } from '@vegaprotocol/wallet'; import uniqBy from 'lodash/uniqBy'; -import { useEffect } from 'react'; +import { useEffect, useMemo } from 'react'; import type { WithdrawalEvent, WithdrawalEventVariables, @@ -12,6 +14,7 @@ import type { import type { Withdrawals, WithdrawalsVariables, + Withdrawals_party_withdrawalsConnection_edges, } from './__generated__/Withdrawals'; const WITHDRAWAL_FRAGMENT = gql` @@ -21,8 +24,14 @@ const WITHDRAWAL_FRAGMENT = gql` amount asset { id + name symbol decimals + source { + ... on ERC20 { + contractAddress + } + } } createdTimestamp withdrawnTimestamp @@ -41,8 +50,12 @@ export const WITHDRAWALS_QUERY = gql` query Withdrawals($partyId: ID!) { party(id: $partyId) { id - withdrawals { - ...WithdrawalFields + withdrawalsConnection { + edges { + node { + ...WithdrawalFields + } + } } } } @@ -63,7 +76,7 @@ export const WITHDRAWAL_BUS_EVENT_SUB = gql` export const useWithdrawals = () => { const { keypair } = useVegaWallet(); - const { subscribeToMore, ...queryResult } = useQuery< + const { data, loading, error, subscribeToMore } = useQuery< Withdrawals, WithdrawalsVariables >(WITHDRAWALS_QUERY, { @@ -85,19 +98,36 @@ export const useWithdrawals = () => { }; }, [keypair?.pub, subscribeToMore]); - return queryResult; + const withdrawals = useMemo(() => { + if (!data?.party?.withdrawalsConnection?.edges) { + return []; + } + + return orderBy( + compact(data.party.withdrawalsConnection.edges).map((edge) => edge.node), + 'createdTimestamp', + 'desc' + ); + }, [data]); + + return { + data, + loading, + error, + withdrawals, + }; }; export const updateQuery: UpdateQueryFn< Withdrawals, WithdrawalEventVariables, WithdrawalEvent -> = (prev, { subscriptionData }) => { +> = (prev, { subscriptionData, variables }) => { if (!subscriptionData.data.busEvents?.length) { return prev; } - const curr = prev.party?.withdrawals || []; + const curr = prev.party?.withdrawalsConnection.edges || []; const incoming = subscriptionData.data.busEvents .map((e) => { return { @@ -105,21 +135,28 @@ export const updateQuery: UpdateQueryFn< pendingOnForeignChain: false, }; }) - .filter( - isWithdrawalEvent - // Need this type cast here, TS can't infer that we've filtered any event types - // that arent Withdrawals - ) as WithdrawalEvent_busEvents_event_Withdrawal[]; + .filter(isWithdrawalEvent) + .map( + (w) => + ({ + __typename: 'WithdrawalEdge', + node: w, + } as Withdrawals_party_withdrawalsConnection_edges) + ); - const withdrawals = uniqBy([...incoming, ...curr], 'id'); + const edges = uniqBy([...incoming, ...curr], 'node.id'); // Write new party to cache if not present if (!prev.party) { return { ...prev, party: { + id: variables?.partyId, __typename: 'Party', - withdrawals, + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges, + }, }, } as Withdrawals; } @@ -128,7 +165,10 @@ export const updateQuery: UpdateQueryFn< ...prev, party: { ...prev.party, - withdrawals, + withdrawalsConnection: { + __typename: 'WithdrawalsConnection', + edges, + }, }, }; }; diff --git a/libs/withdraws/src/lib/withdraw-dialog.spec.tsx b/libs/withdraws/src/lib/withdraw-dialog.spec.tsx deleted file mode 100644 index 0afb0a634..000000000 --- a/libs/withdraws/src/lib/withdraw-dialog.spec.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import merge from 'lodash/merge'; -import { - initialState as vegaTxInitialState, - VegaTxStatus, -} from '@vegaprotocol/wallet'; -import { - EthTxStatus, - initialState as ethTxInitialState, -} from '@vegaprotocol/web3'; -import type { WithdrawDialogProps } from './withdraw-dialog'; -import { WithdrawDialog } from './withdraw-dialog'; -import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval'; -import type { PartialDeep } from 'type-fest'; - -const approval: Erc20Approval_erc20WithdrawalApproval = { - __typename: 'Erc20WithdrawalApproval', - assetSource: 'asset-source', - amount: '100', - nonce: '1', - signatures: 'signatures', - targetAddress: 'target-address', - expiry: 'expiry', - creation: '1660158537747', -}; - -const generateJsx = (override?: PartialDeep) => { - const defaultProps = { - vegaTx: vegaTxInitialState, - ethTx: ethTxInitialState, - approval: null, - dialogOpen: true, - onDialogChange: jest.fn(), - }; - const props = merge(defaultProps, override); - return ; -}; - -it('Dialog transaction states', () => { - const { rerender } = render( - generateJsx({ - vegaTx: { - status: VegaTxStatus.Requested, - }, - }) - ); - expect(screen.getByRole('dialog')).toBeInTheDocument(); - expect(screen.getByText('Confirm withdrawal')).toBeInTheDocument(); - - rerender( - generateJsx({ - vegaTx: { - status: VegaTxStatus.Pending, - }, - }) - ); - - expect( - screen.getByText('Withdrawal transaction pending') - ).toBeInTheDocument(); - - rerender( - generateJsx({ - vegaTx: { - status: VegaTxStatus.Error, - }, - }) - ); - expect(screen.getByText('Withdrawal transaction failed')).toBeInTheDocument(); - - rerender( - generateJsx({ - approval, - vegaTx: { - status: VegaTxStatus.Pending, - }, - ethTx: { - status: EthTxStatus.Requested, - }, - }) - ); - expect(screen.getByText('Confirm transaction')).toBeInTheDocument(); - - const txHash = 'tx-hash'; - rerender( - generateJsx({ - approval, - ethTx: { - status: EthTxStatus.Pending, - txHash, - }, - }) - ); - expect(screen.getByText('Ethereum transaction pending')).toBeInTheDocument(); - expect(screen.getByText('View on Etherscan')).toHaveAttribute( - 'href', - expect.stringContaining(txHash) - ); - - rerender( - generateJsx({ - approval, - ethTx: { - status: EthTxStatus.Complete, - }, - }) - ); - expect(screen.getByText('Ethereum transaction complete')).toBeInTheDocument(); - expect(screen.getByText('View on Etherscan')).toHaveAttribute( - 'href', - expect.stringContaining(txHash) - ); -}); diff --git a/libs/withdraws/src/lib/withdraw-dialog.tsx b/libs/withdraws/src/lib/withdraw-dialog.tsx deleted file mode 100644 index 331f75cbb..000000000 --- a/libs/withdraws/src/lib/withdraw-dialog.tsx +++ /dev/null @@ -1,182 +0,0 @@ -import { Link, Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; -import { useEnvironment } from '@vegaprotocol/environment'; -import type { VegaTxState } from '@vegaprotocol/wallet'; -import { VegaTxStatus } from '@vegaprotocol/wallet'; -import type { ReactNode } from 'react'; -import type { EthTxState } from '@vegaprotocol/web3'; -import { isEthereumError } from '@vegaprotocol/web3'; -import { EthTxStatus } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; -import type { Erc20Approval_erc20WithdrawalApproval } from './__generated__/Erc20Approval'; - -export interface WithdrawDialogProps { - vegaTx: VegaTxState; - ethTx: EthTxState; - approval: Erc20Approval_erc20WithdrawalApproval | null; - dialogOpen: boolean; - onDialogChange: (isOpen: boolean) => void; -} - -export const WithdrawDialog = ({ - vegaTx, - ethTx, - approval, - dialogOpen, - onDialogChange, -}: WithdrawDialogProps) => { - const { ETHERSCAN_URL } = useEnvironment(); - const { intent, title, icon, children } = getProps( - approval, - vegaTx, - ethTx, - ETHERSCAN_URL - ); - return ( - - {children} - - ); -}; - -interface StepProps { - children: ReactNode; -} - -const Step = ({ children }: StepProps) => { - return ( -

- {children} -

- ); -}; - -interface DialogProps { - title: string; - icon: ReactNode; - children: ReactNode; - intent?: Intent; -} - -const getProps = ( - approval: Erc20Approval_erc20WithdrawalApproval | null, - vegaTx: VegaTxState, - ethTx: EthTxState, - ethUrl: string -) => { - const vegaTxPropsMap: Record = { - [VegaTxStatus.Default]: { - title: '', - icon: null, - intent: undefined, - children: null, - }, - [VegaTxStatus.Error]: { - title: t('Withdrawal transaction failed'), - icon: , - intent: Intent.Danger, - children: ( - -

{vegaTx.error}

-
- ), - }, - [VegaTxStatus.Requested]: { - title: t('Confirm withdrawal'), - icon: , - intent: Intent.Warning, - children: Confirm withdrawal in Vega wallet, - }, - [VegaTxStatus.Pending]: { - title: t('Withdrawal transaction pending'), - icon: , - intent: Intent.None, - children: Awaiting transaction, - }, - [VegaTxStatus.Complete]: { - title: t('Withdrawal transaction complete'), - icon: , - intent: Intent.Success, - children: Withdrawal created, - }, - }; - - const completeProps = { - title: t('Withdrawal complete'), - icon: , - intent: Intent.Success, - children: ( - - {t('Ethereum transaction complete')} - - {t('View on Etherscan')} - - - ), - }; - - const ethTxPropsMap: Record = { - [EthTxStatus.Default]: { - title: '', - icon: null, - intent: undefined, - children: null, - }, - [EthTxStatus.Error]: { - title: t('Ethereum transaction failed'), - icon: , - intent: Intent.Danger, - children: ( - - {isEthereumError(ethTx.error) - ? `Error: ${ethTx.error.reason}` - : ethTx.error instanceof Error - ? t(`Error: ${ethTx.error.message}`) - : t('Something went wrong')} - - ), - }, - [EthTxStatus.Requested]: { - title: t('Confirm transaction'), - icon: , - intent: Intent.Warning, - children: {t('Confirm transaction in wallet')}, - }, - [EthTxStatus.Pending]: { - title: t('Ethereum transaction pending'), - icon: , - intent: Intent.None, - children: ( - - - {t( - `Awaiting Ethereum transaction ${ethTx.confirmations}/1 confirmations...` - )} - - - {t('View on Etherscan')} - - - ), - }, - [EthTxStatus.Complete]: completeProps, - [EthTxStatus.Confirmed]: completeProps, - }; - - return approval ? ethTxPropsMap[ethTx.status] : vegaTxPropsMap[vegaTx.status]; -}; diff --git a/libs/withdraws/src/lib/withdraw-form-container.tsx b/libs/withdraws/src/lib/withdraw-form-container.tsx new file mode 100644 index 000000000..c237f6761 --- /dev/null +++ b/libs/withdraws/src/lib/withdraw-form-container.tsx @@ -0,0 +1,90 @@ +import compact from 'lodash/compact'; +import { gql, useQuery } from '@apollo/client'; +import { t } from '@vegaprotocol/react-helpers'; +import { useMemo } from 'react'; +import type { WithdrawalArgs } from './use-create-withdraw'; +import { WithdrawManager } from './withdraw-manager'; +import type { WithdrawFormQuery } from './__generated__/WithdrawFormQuery'; + +export const ASSET_FRAGMENT = gql` + fragment AssetFields on Asset { + id + symbol + name + decimals + source { + ... on ERC20 { + contractAddress + } + } + } +`; + +const WITHDRAW_FORM_QUERY = gql` + ${ASSET_FRAGMENT} + query WithdrawFormQuery($partyId: ID!) { + party(id: $partyId) { + id + withdrawals { + id + txHash + } + accounts { + type + balance + asset { + id + symbol + } + } + } + assetsConnection { + edges { + node { + ...AssetFields + } + } + } + } +`; + +interface WithdrawFormContainerProps { + partyId?: string; + submit: (args: WithdrawalArgs) => void; +} + +export const WithdrawFormContainer = ({ + partyId, + submit, +}: WithdrawFormContainerProps) => { + const { data, loading, error } = useQuery( + WITHDRAW_FORM_QUERY, + { + variables: { partyId }, + } + ); + + const assets = useMemo(() => { + if (!data?.assetsConnection.edges) { + return []; + } + + return compact(data.assetsConnection.edges).map((e) => e.node); + }, [data]); + + if (loading || !data) { + return
{t('Loading...')}
; + } + + if (error) { + return
{t('Something went wrong')}
; + } + + return ( + + ); +}; diff --git a/libs/withdraws/src/lib/withdraw-form.spec.tsx b/libs/withdraws/src/lib/withdraw-form.spec.tsx index fe9883ae7..92bdc589b 100644 --- a/libs/withdraws/src/lib/withdraw-form.spec.tsx +++ b/libs/withdraws/src/lib/withdraw-form.spec.tsx @@ -26,13 +26,9 @@ beforeEach(() => { props = { assets, min: new BigNumber(0.00001), - max: { - balance: new BigNumber(100), - threshold: new BigNumber(200), - }, - limits: { - max: new BigNumber(200), - }, + balance: new BigNumber(100), + threshold: new BigNumber(200), + delay: 100, selectedAsset: undefined, onSelectAsset: jest.fn(), submitWithdraw: jest.fn().mockReturnValue(Promise.resolve()), @@ -112,6 +108,7 @@ describe('Withdrawal form', () => { asset: props.assets[0].id, amount: '4000000', receiverAddress: MOCK_ETH_ADDRESS, + availableTimestamp: null, }); }); }); @@ -123,7 +120,7 @@ describe('Withdrawal form', () => { fireEvent.click(screen.getByText('Use maximum')); expect(screen.getByLabelText('Amount')).toHaveValue( - Number(props.max.balance.toFixed(asset.decimals)) + Number(props.balance.toFixed(asset.decimals)) ); }); }); diff --git a/libs/withdraws/src/lib/withdraw-form.tsx b/libs/withdraws/src/lib/withdraw-form.tsx index 27c967dbf..fad2ba142 100644 --- a/libs/withdraws/src/lib/withdraw-form.tsx +++ b/libs/withdraws/src/lib/withdraw-form.tsx @@ -5,7 +5,6 @@ import { t, removeDecimal, required, - maxSafe, isAssetTypeERC20, } from '@vegaprotocol/react-helpers'; import { @@ -15,12 +14,11 @@ import { InputError, Select, } from '@vegaprotocol/ui-toolkit'; -import { Web3WalletInput } from '@vegaprotocol/web3'; import { useWeb3React } from '@web3-react/core'; import BigNumber from 'bignumber.js'; import type { ButtonHTMLAttributes, ReactNode } from 'react'; -import { useForm, Controller } from 'react-hook-form'; -import type { WithdrawalFields } from './use-withdraw'; +import { useForm, Controller, useWatch } from 'react-hook-form'; +import type { WithdrawalArgs } from './use-create-withdraw'; import { WithdrawLimits } from './withdraw-limits'; interface FormFields { @@ -31,25 +29,22 @@ interface FormFields { export interface WithdrawFormProps { assets: Asset[]; - max: { - balance: BigNumber; - threshold: BigNumber; - }; min: BigNumber; + balance: BigNumber; selectedAsset?: Asset; - limits: { - max: BigNumber; - } | null; + threshold: BigNumber; + delay: number | undefined; onSelectAsset: (assetId: string) => void; - submitWithdraw: (withdrawal: WithdrawalFields) => void; + submitWithdraw: (withdrawal: WithdrawalArgs) => void; } export const WithdrawForm = ({ assets, - max, + balance, min, selectedAsset, - limits, + threshold, + delay, onSelectAsset, submitWithdraw, }: WithdrawFormProps) => { @@ -67,6 +62,9 @@ export const WithdrawForm = ({ to: address, }, }); + + const amount = useWatch({ name: 'amount', control }); + const onSubmit = async (fields: FormFields) => { if (!selectedAsset) { throw new Error('Asset not selected'); @@ -75,103 +73,117 @@ export const WithdrawForm = ({ asset: selectedAsset.id, amount: removeDecimal(fields.amount, selectedAsset.decimals), receiverAddress: fields.to, + availableTimestamp: + new BigNumber(fields.amount).isGreaterThan(threshold) && delay + ? Date.now() + delay * 1000 + : null, }); }; return ( -
- - ( - + <> +
+

{t('There are two steps required to make a withdrawal')}

+
    +
  1. {t('Step 1 - Release funds from Vega')}
  2. +
  3. {t('Step 2 - Transfer funds to your Ethereum wallet')}
  4. +
+
+ + + ( + + )} + /> + {errors.asset?.message && ( + {errors.asset.message} )} - /> - {errors.asset?.message && ( - {errors.asset.message} + + + + {errors.to?.message && ( + {errors.to.message} + )} + + {selectedAsset && threshold && ( +
+ +
)} -
- - - {errors.to?.message && ( - {errors.to.message} - )} - - {selectedAsset && limits && ( -
- -
- )} - - { - const value = new BigNumber(v); - if (value.isGreaterThan(max.balance)) { - return t('Insufficient amount in account'); - } else if (value.isGreaterThan(max.threshold)) { - return t('Amount is above temporary withdrawal limit'); - } - return maxSafe(BigNumber.minimum(max.balance, max.threshold))( - v - ); + + { + const value = new BigNumber(v); + if (value.isGreaterThan(balance)) { + return t('Insufficient amount in account'); + } + return true; + }, + minSafe: (value) => minSafe(min)(value), }, - minSafe: (value) => minSafe(min)(value), - }, - })} - /> - {errors.amount?.message && ( - - {errors.amount.message} - - )} - {selectedAsset && ( - { - setValue('amount', max.balance.toFixed(selectedAsset.decimals)); - clearErrors('amount'); - }} - > - {t('Use maximum')} - - )} - - - + })} + /> + {errors.amount?.message && ( + {errors.amount.message} + )} + {selectedAsset && ( + { + setValue('amount', balance.toFixed(selectedAsset.decimals)); + clearErrors('amount'); + }} + > + {t('Use maximum')} + + )} +
+ + + ); }; diff --git a/libs/withdraws/src/lib/withdraw-limits.tsx b/libs/withdraws/src/lib/withdraw-limits.tsx index 2639cb573..ebb2141c2 100644 --- a/libs/withdraws/src/lib/withdraw-limits.tsx +++ b/libs/withdraws/src/lib/withdraw-limits.tsx @@ -1,24 +1,35 @@ import { t } from '@vegaprotocol/react-helpers'; -import type BigNumber from 'bignumber.js'; +import BigNumber from 'bignumber.js'; +import { formatDistanceToNow } from 'date-fns'; interface WithdrawLimitsProps { - limits: { - max: BigNumber; - }; + amount: string; + threshold: BigNumber; balance: BigNumber; + delay: number | undefined; } -export const WithdrawLimits = ({ limits, balance }: WithdrawLimitsProps) => { - let maxLimit = ''; +export const WithdrawLimits = ({ + amount, + threshold, + balance, + delay, +}: WithdrawLimitsProps) => { + let text = ''; - if (limits.max.isEqualTo(Infinity)) { - maxLimit = t('No limit'); - } else if (limits.max.isGreaterThan(1_000_000)) { - maxLimit = t('1m+'); + if (threshold.isEqualTo(Infinity)) { + text = t('No limit'); + } else if (threshold.isGreaterThan(1_000_000)) { + text = t('1m+'); } else { - maxLimit = limits.max.toString(); + text = threshold.toString(); } + const delayTime = + new BigNumber(amount).isGreaterThan(threshold) && delay + ? formatDistanceToNow(Date.now() + delay * 1000) + : t('None'); + return ( @@ -27,8 +38,14 @@ export const WithdrawLimits = ({ limits, balance }: WithdrawLimitsProps) => { - - + + + + + +
{balance.toString()}
{t('Maximum withdrawal')}{maxLimit} + {t('Delayed withdrawal threshold')} + {text}
{t('Delay time')}{delayTime}
diff --git a/libs/withdraws/src/lib/withdraw-manager.spec.tsx b/libs/withdraws/src/lib/withdraw-manager.spec.tsx index 9c3a42d51..2f583f43e 100644 --- a/libs/withdraws/src/lib/withdraw-manager.spec.tsx +++ b/libs/withdraws/src/lib/withdraw-manager.spec.tsx @@ -1,14 +1,8 @@ -import { fireEvent, render, screen } from '@testing-library/react'; +import { act, fireEvent, render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; import { generateAccount, generateAsset } from './test-helpers'; import type { WithdrawManagerProps } from './withdraw-manager'; import { WithdrawManager } from './withdraw-manager'; -import * as withdrawHook from './use-withdraw'; -import { initialState as vegaTxInitialState } from '@vegaprotocol/wallet'; -import { - EthereumError, - EthTxStatus, - initialState as ethTxInitialState, -} from '@vegaprotocol/web3'; import BigNumber from 'bignumber.js'; const ethereumAddress = '0x72c22822A19D20DE7e426fB84aa047399Ddd8853'; @@ -17,72 +11,46 @@ jest.mock('@web3-react/core', () => ({ useWeb3React: () => ({ account: ethereumAddress }), })); -jest.mock('./use-get-withdraw-limits', () => ({ - useGetWithdrawLimits: () => { - return { max: new BigNumber(1000000) }; +jest.mock('./use-get-withdraw-threshold', () => ({ + useGetWithdrawThreshold: () => { + return () => Promise.resolve(new BigNumber(100)); + }, +})); + +jest.mock('./use-get-withdraw-delay', () => ({ + useGetWithdrawDelay: () => { + return () => Promise.resolve(10000); }, })); let props: WithdrawManagerProps; -let useWithdrawValue: ReturnType; -let useWithdraw: jest.SpyInstance; -let mockSubmit: jest.Mock; -let mockReset: jest.Mock; beforeEach(() => { props = { assets: [generateAsset()], accounts: [generateAccount()], - initialAssetId: undefined, + submit: jest.fn(), }; - mockSubmit = jest.fn(); - mockReset = jest.fn(); - useWithdrawValue = { - ethTx: ethTxInitialState, - vegaTx: vegaTxInitialState, - approval: null, - withdrawalId: null, - submit: mockSubmit, - reset: mockReset, - }; - useWithdraw = jest - .spyOn(withdrawHook, 'useWithdraw') - .mockReturnValue(useWithdrawValue); }); const generateJsx = (props: WithdrawManagerProps) => ( ); -it('Valid form submission opens transaction dialog', async () => { +it('calls submit if valid form submission', async () => { render(generateJsx(props)); - submitValid(); - expect(await screen.findByRole('dialog')).toBeInTheDocument(); - expect(mockReset).toHaveBeenCalled(); - expect(mockSubmit).toHaveBeenCalledWith({ + await act(async () => { + await submitValid(); + }); + expect(props.submit).toHaveBeenCalledWith({ amount: '1000', asset: props.assets[0].id, receiverAddress: ethereumAddress, + availableTimestamp: null, }); }); -it('Expected Ethereum error closes the dialog', async () => { - const { rerender } = render(generateJsx(props)); - submitValid(); - expect(await screen.findByRole('dialog')).toBeInTheDocument(); - useWithdraw.mockReturnValue({ - ...useWithdrawValue, - ethTx: { - ...useWithdrawValue.ethTx, - status: EthTxStatus.Error, - error: new EthereumError('User rejected transaction', 4001, 'reason'), - }, - }); - rerender(generateJsx(props)); - expect(screen.queryByRole('dialog')).not.toBeInTheDocument(); -}); - -it('Correct min max values provided to form', async () => { +it('validates correctly', async () => { render(generateJsx(props)); // Set other fields to be valid @@ -99,7 +67,7 @@ it('Correct min max values provided to form', async () => { }); fireEvent.submit(screen.getByTestId('withdraw-form')); expect(await screen.findByText('Value is below minimum')).toBeInTheDocument(); - expect(mockSubmit).not.toBeCalled(); + expect(props.submit).not.toBeCalled(); fireEvent.change(screen.getByLabelText('Amount'), { target: { value: '0.00001' }, @@ -113,19 +81,14 @@ it('Correct min max values provided to form', async () => { expect( await screen.findByText('Insufficient amount in account') ).toBeInTheDocument(); - expect(mockSubmit).not.toBeCalled(); + expect(props.submit).not.toBeCalled(); }); -it('Initial asset id can preselect asset', async () => { - const asset = props.assets[0]; - render(generateJsx({ ...props, initialAssetId: asset.id })); - expect(screen.getByLabelText('Asset')).toHaveValue(asset.id); -}); - -const submitValid = () => { - fireEvent.change(screen.getByLabelText('Asset'), { - target: { value: props.assets[0].id }, - }); +const submitValid = async () => { + await userEvent.selectOptions( + screen.getByLabelText('Asset'), + props.assets[0].id + ); fireEvent.change(screen.getByLabelText('To (Ethereum address)'), { target: { value: ethereumAddress }, }); diff --git a/libs/withdraws/src/lib/withdraw-manager.tsx b/libs/withdraws/src/lib/withdraw-manager.tsx index b39f6cbbd..563379203 100644 --- a/libs/withdraws/src/lib/withdraw-manager.tsx +++ b/libs/withdraws/src/lib/withdraw-manager.tsx @@ -1,118 +1,78 @@ -import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; +import { useCallback } from 'react'; import sortBy from 'lodash/sortBy'; import { WithdrawForm } from './withdraw-form'; -import type { WithdrawalFields } from './use-withdraw'; -import { useWithdraw } from './use-withdraw'; -import { WithdrawDialog } from './withdraw-dialog'; -import { isExpectedEthereumError, EthTxStatus } from '@vegaprotocol/web3'; -import type { Asset } from '@vegaprotocol/react-helpers'; +import type { WithdrawalArgs } from './use-create-withdraw'; import { addDecimal } from '@vegaprotocol/react-helpers'; import { AccountType } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import type { Account } from './types'; -import { useGetWithdrawLimits } from './use-get-withdraw-limits'; +import { useGetWithdrawThreshold } from './use-get-withdraw-threshold'; +import { captureException } from '@sentry/react'; +import { useGetWithdrawDelay } from './use-get-withdraw-delay'; +import { useWithdrawStore } from './withdraw-store'; +import type { AssetFields } from './__generated__/AssetFields'; export interface WithdrawManagerProps { - assets: Asset[]; + assets: AssetFields[]; accounts: Account[]; - initialAssetId?: string; + submit: (args: WithdrawalArgs) => void; } export const WithdrawManager = ({ assets, accounts, - initialAssetId, + submit, }: WithdrawManagerProps) => { - const dialogDismissed = useRef(false); - const [dialogOpen, setDialogOpen] = useState(false); - const [assetId, setAssetId] = useState(initialAssetId); + const { asset, balance, min, threshold, delay, update } = useWithdrawStore(); + const getThreshold = useGetWithdrawThreshold(); + const getDelay = useGetWithdrawDelay(); - const { ethTx, vegaTx, approval, submit, reset } = useWithdraw( - dialogDismissed.current - ); + // Everytime an asset is selected we need to find the corresponding + // account, balance, min viable amount and delay threshold + const handleSelectAsset = useCallback( + async (id: string) => { + const asset = assets.find((a) => a.id === id); + const account = accounts.find( + (a) => + a.type === AccountType.ACCOUNT_TYPE_GENERAL && + a.asset.id === asset?.id + ); + const balance = + account && asset + ? new BigNumber(addDecimal(account.balance, asset.decimals)) + : new BigNumber(0); + const min = asset + ? new BigNumber(addDecimal('1', asset.decimals)) + : new BigNumber(0); - // Find the asset object from the select box - const asset = useMemo(() => { - return assets?.find((a) => a.id === assetId); - }, [assets, assetId]); + // Query collateral bridge for threshold for selected asset + // and subsequent delay if withdrawal amount is larger than it + let threshold; + let delay; - const account = useMemo(() => { - return accounts.find( - (a) => - a.type === AccountType.ACCOUNT_TYPE_GENERAL && a.asset.id === asset?.id - ); - }, [asset, accounts]); + try { + const result = await Promise.all([getThreshold(asset), getDelay()]); + threshold = result[0]; + delay = result[1]; + } catch (err) { + captureException(err); + } - const limits = useGetWithdrawLimits(asset); - - const max = useMemo(() => { - if (!asset) { - return { - balance: new BigNumber(0), - threshold: new BigNumber(0), - }; - } - - const balance = account - ? new BigNumber(addDecimal(account.balance, asset.decimals)) - : new BigNumber(0); - - return { - balance, - threshold: limits ? limits.max : new BigNumber(Infinity), - }; - }, [asset, account, limits]); - - const min = useMemo(() => { - return asset - ? new BigNumber(addDecimal('1', asset.decimals)) - : new BigNumber(0); - }, [asset]); - - const handleSubmit = useCallback( - (args: WithdrawalFields) => { - reset(); - setDialogOpen(true); - submit(args); - dialogDismissed.current = false; + update({ asset, balance, min, threshold, delay }); }, - [submit, reset] + [accounts, assets, update, getThreshold, getDelay] ); - // Close dialog if error is due to user rejecting the tx - useEffect(() => { - if ( - ethTx.status === EthTxStatus.Error && - isExpectedEthereumError(ethTx.error) - ) { - setDialogOpen(false); - } - }, [ethTx.status, ethTx.error]); - return ( - <> - setAssetId(id)} - assets={sortBy(assets, 'name')} - max={max} - min={min} - submitWithdraw={handleSubmit} - limits={limits} - /> - { - setDialogOpen(isOpen); - - if (!isOpen) { - dialogDismissed.current = true; - } - }} - /> - + ); }; diff --git a/libs/withdraws/src/lib/withdraw-store.ts b/libs/withdraws/src/lib/withdraw-store.ts new file mode 100644 index 000000000..bbd48249c --- /dev/null +++ b/libs/withdraws/src/lib/withdraw-store.ts @@ -0,0 +1,24 @@ +import type { Asset } from '@vegaprotocol/react-helpers'; +import BigNumber from 'bignumber.js'; +import type { SetState } from 'zustand'; +import create from 'zustand'; + +interface WithdrawStore { + asset: Asset | undefined; + balance: BigNumber; + min: BigNumber; + threshold: BigNumber; + delay: number | undefined; + update: (state: Partial) => void; +} + +export const useWithdrawStore = create((set: SetState) => ({ + asset: undefined, + balance: new BigNumber(0), + min: new BigNumber(0), + threshold: new BigNumber(0), + delay: undefined, + update: (updatedState) => { + set(updatedState); + }, +})); diff --git a/libs/withdraws/src/lib/withdrawal-dialogs.tsx b/libs/withdraws/src/lib/withdrawal-dialogs.tsx new file mode 100644 index 000000000..6dcec74b1 --- /dev/null +++ b/libs/withdraws/src/lib/withdrawal-dialogs.tsx @@ -0,0 +1,49 @@ +import { t } from '@vegaprotocol/react-helpers'; +import { Dialog } from '@vegaprotocol/ui-toolkit'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useCompleteWithdraw } from './use-complete-withdraw'; +import { useCreateWithdraw } from './use-create-withdraw'; +import { WithdrawFormContainer } from './withdraw-form-container'; +import { WithdrawalFeedback } from './withdrawal-feedback'; + +export const WithdrawalDialogs = ({ + withdrawDialog, + setWithdrawDialog, +}: { + withdrawDialog: boolean; + setWithdrawDialog: (open: boolean) => void; +}) => { + const { keypair } = useVegaWallet(); + const createWithdraw = useCreateWithdraw(); + const completeWithdraw = useCompleteWithdraw(); + return ( + <> + setWithdrawDialog(isOpen)} + size="small" + > + { + setWithdrawDialog(false); + createWithdraw.submit(args); + }} + /> + + + { + createWithdraw.reset(); + completeWithdraw.submit(id); + }} + /> + + + + ); +}; diff --git a/libs/withdraws/src/lib/withdrawal-feedback.tsx b/libs/withdraws/src/lib/withdrawal-feedback.tsx new file mode 100644 index 000000000..8b1ef82be --- /dev/null +++ b/libs/withdraws/src/lib/withdrawal-feedback.tsx @@ -0,0 +1,96 @@ +import { useEnvironment } from '@vegaprotocol/environment'; +import { + addDecimalsFormatNumber, + t, + truncateByChars, +} from '@vegaprotocol/react-helpers'; +import { + Button, + KeyValueTable, + KeyValueTableRow, +} from '@vegaprotocol/ui-toolkit'; +import type { VegaTxState } from '@vegaprotocol/wallet'; +import { formatDistanceToNow } from 'date-fns'; +import type { WithdrawalFields } from './__generated__/WithdrawalFields'; + +export const WithdrawalFeedback = ({ + transaction, + withdrawal, + submitWithdraw, + availableTimestamp, +}: { + transaction: VegaTxState; + withdrawal: WithdrawalFields | null; + submitWithdraw: (withdrawalId: string) => void; + availableTimestamp: number | null; +}) => { + const { VEGA_EXPLORER_URL } = useEnvironment(); + const isAvailable = + availableTimestamp === null || Date.now() > availableTimestamp; + return ( +
+

+ {t('Your funds have been unlocked for withdrawal')} -{' '} + + {t('View in block explorer')} + +

+ {withdrawal && ( + + + {t('Asset')} + {withdrawal.asset.symbol} + + + {t('Amount')} + + {addDecimalsFormatNumber( + withdrawal.amount, + withdrawal.asset.decimals + )} + + + {withdrawal.details && ( + + {t('Recipient')} + + {truncateByChars(withdrawal.details.receiverAddress)} + + + )} + + )} + {isAvailable ? ( + + ) : ( +

+ {t( + `Available to withdraw in ${formatDistanceToNow( + availableTimestamp + )}` + )} +

+ )} +
+ ); +}; diff --git a/libs/withdraws/src/lib/withdrawals-table.spec.tsx b/libs/withdraws/src/lib/withdrawals-table.spec.tsx index b2095fdf4..69cf3496f 100644 --- a/libs/withdraws/src/lib/withdrawals-table.spec.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.spec.tsx @@ -4,7 +4,7 @@ import { addDecimalsFormatNumber, getDateTimeFormat, } from '@vegaprotocol/react-helpers'; -import { WithdrawalStatus } from '@vegaprotocol/types'; +import { WithdrawalStatus, WithdrawalStatusMapping } from '@vegaprotocol/types'; import { generateWithdrawal } from './test-helpers'; import type { StatusCellProps, @@ -12,7 +12,7 @@ import type { } from './withdrawals-table'; import { StatusCell } from './withdrawals-table'; import { WithdrawalsTable } from './withdrawals-table'; -import type { Withdrawals_party_withdrawals } from './__generated__/Withdrawals'; +import type { Withdrawals_party_withdrawalsConnection_edges_node } from './__generated__/Withdrawals'; jest.mock('@web3-react/core', () => ({ useWeb3React: () => ({ provider: undefined }), @@ -24,38 +24,66 @@ const generateJsx = (props: WithdrawalsTableProps) => ( ); -it('Renders the correct columns', async () => { - const withdrawal = generateWithdrawal(); - await act(async () => { - render(generateJsx({ withdrawals: [withdrawal] })); +describe('renders the correct columns', () => { + it('incomplete withdrawal', async () => { + const withdrawal = generateWithdrawal(); + await act(async () => { + render(generateJsx({ withdrawals: [withdrawal] })); + }); + + const headers = screen.getAllByRole('columnheader'); + expect(headers).toHaveLength(6); + expect(headers.map((h) => h.textContent?.trim())).toEqual([ + 'Asset', + 'Amount', + 'Recipient', + 'Created at', + 'TX hash', + 'Status', + ]); + + const cells = screen.getAllByRole('gridcell'); + const expectedValues = [ + 'asset-symbol', + addDecimalsFormatNumber(withdrawal.amount, withdrawal.asset.decimals), + '123456\u2026123456', + getDateTimeFormat().format(new Date(withdrawal.createdTimestamp)), + '-', + WithdrawalStatusMapping[withdrawal.status], + ]; + cells.forEach((cell, i) => { + expect(cell).toHaveTextContent(expectedValues[i]); + }); }); - const headers = screen.getAllByRole('columnheader'); - expect(headers).toHaveLength(5); - expect(headers.map((h) => h.textContent?.trim())).toEqual([ - 'Asset', - 'Amount', - 'Recipient', - 'Created at', - 'Status', - ]); + it('completed withdrawal', async () => { + const withdrawal = generateWithdrawal({ + txHash: '0x1234567891011121314', + status: WithdrawalStatus.STATUS_FINALIZED, + }); - const cells = screen.getAllByRole('gridcell'); - const expectedValues = [ - 'asset-symbol', - addDecimalsFormatNumber(withdrawal.amount, withdrawal.asset.decimals), - '123456\u2026123456', - getDateTimeFormat().format(new Date(withdrawal.createdTimestamp)), - withdrawal.status, - ]; - cells.forEach((cell, i) => { - expect(cell).toHaveTextContent(expectedValues[i]); + await act(async () => { + render(generateJsx({ withdrawals: [withdrawal] })); + }); + + const cells = screen.getAllByRole('gridcell'); + const expectedValues = [ + 'asset-symbol', + addDecimalsFormatNumber(withdrawal.amount, withdrawal.asset.decimals), + '123456…123456', + getDateTimeFormat().format(new Date(withdrawal.createdTimestamp)), + '0x1234…121314', + WithdrawalStatusMapping[withdrawal.status], + ]; + cells.forEach((cell, i) => { + expect(cell).toHaveTextContent(expectedValues[i]); + }); }); }); describe('StatusCell', () => { let props: StatusCellProps; - let withdrawal: Withdrawals_party_withdrawals; + let withdrawal: Withdrawals_party_withdrawalsConnection_edges_node; let mockComplete: jest.Mock; beforeEach(() => { @@ -76,9 +104,7 @@ describe('StatusCell', () => { render(); expect(screen.getByText('Open')).toBeInTheDocument(); - fireEvent.click( - screen.getByText('Click to complete', { selector: 'button' }) - ); + fireEvent.click(screen.getByText('Complete', { selector: 'button' })); expect(mockComplete).toHaveBeenCalled(); }); @@ -102,18 +128,5 @@ describe('StatusCell', () => { render(); expect(screen.getByText('Finalized')).toBeInTheDocument(); - expect(screen.getByText('View on Etherscan')).toHaveAttribute( - 'href', - expect.stringContaining(props.data.txHash) - ); - }); - - it('Fallback', () => { - props.value = WithdrawalStatus.STATUS_REJECTED; - props.data.pendingOnForeignChain = false; - props.data.txHash = '0x123'; - render(); - - expect(screen.getByText('STATUS_REJECTED')).toBeInTheDocument(); }); }); diff --git a/libs/withdraws/src/lib/withdrawals-table.tsx b/libs/withdraws/src/lib/withdrawals-table.tsx index d4edf680a..66994eeff 100644 --- a/libs/withdraws/src/lib/withdrawals-table.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.tsx @@ -1,7 +1,3 @@ -import type { - ICellRendererParams, - ValueFormatterParams, -} from 'ag-grid-community'; import { AgGridColumn } from 'ag-grid-react'; import { getDateTimeFormat, @@ -9,19 +5,40 @@ import { truncateByChars, addDecimalsFormatNumber, } from '@vegaprotocol/react-helpers'; -import { WithdrawalStatus } from '@vegaprotocol/types'; -import { Link, AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import type { + VegaICellRendererParams, + VegaValueFormatterParams, +} from '@vegaprotocol/ui-toolkit'; +import { + Dialog, + Link, + AgGridDynamic as AgGrid, + Intent, + Loader, + Icon, +} from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { useCompleteWithdraw } from './use-complete-withdraw'; -import type { Withdrawals_party_withdrawals } from './__generated__/Withdrawals'; +import type { WithdrawalFields } from './__generated__/WithdrawalFields'; +import type { VerifyState } from './use-verify-withdrawal'; +import { ApprovalStatus, useVerifyWithdrawal } from './use-verify-withdrawal'; export interface WithdrawalsTableProps { - withdrawals: Withdrawals_party_withdrawals[]; + withdrawals: WithdrawalFields[]; } export const WithdrawalsTable = ({ withdrawals }: WithdrawalsTableProps) => { const { ETHERSCAN_URL } = useEnvironment(); - const { submit, Dialog } = useCompleteWithdraw(); + const { + submit, + reset: resetTx, + Dialog: EthereumTransactionDialog, + } = useCompleteWithdraw(); + const { + verify, + state: verifyState, + reset: resetVerification, + } = useVerifyWithdrawal(); return ( <> @@ -35,51 +52,105 @@ export const WithdrawalsTable = ({ withdrawals }: WithdrawalsTableProps) => { > { + valueFormatter={({ + value, + data, + }: VegaValueFormatterParams) => { return addDecimalsFormatNumber(value, data.asset.decimals); }} /> { + valueFormatter={({ + value, + }: VegaValueFormatterParams< + WithdrawalFields, + 'details.receiverAddress' + >) => { + if (!value) return '-'; return truncateByChars(value); }} /> { + valueFormatter={({ + value, + }: VegaValueFormatterParams< + WithdrawalFields, + 'createdTimestamp' + >) => { return getDateTimeFormat().format(new Date(value)); }} /> ) => { + if (!value) return '-'; + return ( + + {truncateByChars(value)} + + ); + }} + /> + { + const verified = await verify(withdrawal); + + if (!verified) { + return; + } + + submit(withdrawal.id); + }, + ethUrl: ETHERSCAN_URL, + }} /> - + { + if (!isOpen) { + resetTx(); + resetVerification(); + } + }} + open={verifyState.dialogOpen} + size="small" + {...getVerifyDialogProps(verifyState.status)} + > + + + ); }; -export interface StatusCellProps extends ICellRendererParams { +export interface StatusCellProps + extends VegaICellRendererParams { ethUrl: string; - complete: (withdrawalId: string) => void; + complete: (withdrawal: WithdrawalFields) => void; } -export const StatusCell = ({ - ethUrl, - value, - data, - complete, -}: StatusCellProps) => { +export const StatusCell = ({ ethUrl, data, complete }: StatusCellProps) => { if (data.pendingOnForeignChain) { return (
@@ -98,37 +169,22 @@ export const StatusCell = ({ ); } - if (value === WithdrawalStatus.STATUS_FINALIZED) { + if (!data.txHash) { return (
- {data.txHash ? ( - <> - {t('Finalized')} - - {t('View on Etherscan')} - - - ) : ( - <> - {t('Open')} - - - )} + {t('Open')} +
); } - return value; + return {t('Finalized')}; }; -export interface RecipientCellProps extends ICellRendererParams { +export interface RecipientCellProps + extends VegaICellRendererParams { ethUrl: string; } @@ -148,3 +204,48 @@ const RecipientCell = ({ ); }; + +const getVerifyDialogProps = (status: ApprovalStatus) => { + if (status === ApprovalStatus.Error) { + return { + intent: Intent.Danger, + icon: , + }; + } + + if (status === ApprovalStatus.Pending) { + return { intent: Intent.None, icon: }; + } + + if (status === ApprovalStatus.Delayed) { + return { intent: Intent.Warning, icon: }; + } + + return { intent: Intent.None }; +}; + +const VerificationStatus = ({ state }: { state: VerifyState }) => { + if (state.status === ApprovalStatus.Error) { + return

{t('Something went wrong')}

; + } + + if (state.status === ApprovalStatus.Pending) { + return

{t('Verifying...')}

; + } + + if (state.status === ApprovalStatus.Delayed && state.completeTimestamp) { + const formattedTime = getDateTimeFormat().format( + new Date(state.completeTimestamp) + ); + return ( + <> +

+ {t("The amount you're withdrawing has triggered a time delay")} +

+

{t(`Cannot be completed until ${formattedTime}`)}

+ + ); + } + + return null; +}; diff --git a/libs/withdraws/tsconfig.spec.json b/libs/withdraws/tsconfig.spec.json index 526986384..3da863401 100644 --- a/libs/withdraws/tsconfig.spec.json +++ b/libs/withdraws/tsconfig.spec.json @@ -15,7 +15,6 @@ "**/*.test.jsx", "**/*.spec.jsx", "**/*.d.ts", - "src/lib/withdraw-manager.foo.tsx", "jest.config.ts" ] } From 7fe282a9fbb0f06d183bdfc1568a774bb99d52bb Mon Sep 17 00:00:00 2001 From: macqbat Date: Tue, 6 Sep 2022 08:13:17 +0200 Subject: [PATCH 03/66] feat: [console-lite] - refactor market-list view afetr design update (#1244) * feat: [console-lite] - refactor market-list view afetr design update * feat: [console-lite] - refactor market-list fix failing test * feat: [console-lite] - refactor market-list fix failing test * feat: [console-lite] - refactor market-list fix failing test Co-authored-by: maciek --- .../src/integration/market-selector.test.ts | 4 +- .../src/support/mocks/commons.ts | 9 +- .../src/support/mocks/generate-markets.ts | 116 ------------------ .../src/app/components/drawer/drawer.tsx | 3 +- .../src/app/components/header/header.tsx | 2 +- .../__generated__/SimpleMarkets.ts | 24 ---- .../simple-market-list/constants.ts | 2 + .../simple-market-list/data-provider.ts | 21 +--- .../simple-market-list.spec.tsx | 12 +- .../simple-market-list/simple-market-list.tsx | 9 +- .../simple-market-toolbar.tsx | 10 +- apps/console-lite/src/app/constants/index.ts | 2 +- .../src/app/hooks/use-column-definitions.tsx | 6 +- .../src/app/hooks/use-markets-filter-data.ts | 2 +- .../src/hooks/use-screen-dimensions.ts | 4 +- 15 files changed, 32 insertions(+), 194 deletions(-) diff --git a/apps/console-lite-e2e/src/integration/market-selector.test.ts b/apps/console-lite-e2e/src/integration/market-selector.test.ts index 352311f40..fef2122c8 100644 --- a/apps/console-lite-e2e/src/integration/market-selector.test.ts +++ b/apps/console-lite-e2e/src/integration/market-selector.test.ts @@ -69,9 +69,7 @@ describe('market selector', () => { cy.get('input[placeholder="Search"]').clear(); cy.get('input[placeholder="Search"]').type('aa'); const filtered = markets.filter( - (market) => - market.data.market.state === 'STATE_ACTIVE' && - market.name.match(/aa/i) + (market) => market.state === 'STATE_ACTIVE' && market.name.match(/aa/i) ); cy.getByTestId('market-pane') .children() diff --git a/apps/console-lite-e2e/src/support/mocks/commons.ts b/apps/console-lite-e2e/src/support/mocks/commons.ts index 0b7b90522..e0f67fb75 100644 --- a/apps/console-lite-e2e/src/support/mocks/commons.ts +++ b/apps/console-lite-e2e/src/support/mocks/commons.ts @@ -76,14 +76,7 @@ const protoCandles = [ export const protoMarket = { id: 'first-btcusd-id', name: 'AAVEDAI Monthly (30 Jun 2022)', - data: { - market: { - id: 'first-btcusd-id', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, + state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'AAVEDAI.MF21', diff --git a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts index 9a7b50bdd..114af877a 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts @@ -8,14 +8,6 @@ export const generateSimpleMarkets = () => { id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a', name: 'CELUSD (June 2022)', state: 'Active', - data: { - market: { - id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a', - state: 'STATE_PENDING', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'CELUSD', @@ -45,14 +37,6 @@ export const generateSimpleMarkets = () => { id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255', name: 'XMRUSD market', state: 'Suspended', - data: { - market: { - id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'XMRUSD', @@ -82,14 +66,6 @@ export const generateSimpleMarkets = () => { id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f', name: 'UNIDAI Monthly (30 Jun 2022)', state: 'Active', - data: { - market: { - id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f', - state: 'STATE_SUSPENDED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'UNIDAI.MF21', @@ -193,14 +169,6 @@ export const generateSimpleMarkets = () => { id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4', name: 'XMRUSD market', state: 'Pending', - data: { - market: { - id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'XMRUSD', @@ -303,14 +271,6 @@ export const generateSimpleMarkets = () => { id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6', name: 'ApeCoin (18 Jul 2022)', state: 'Closed', - data: { - market: { - id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'APE/USD', @@ -339,14 +299,6 @@ export const generateSimpleMarkets = () => { id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74', name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Settled', - data: { - market: { - id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'BTCUSD.MF21', @@ -377,14 +329,6 @@ export const generateSimpleMarkets = () => { id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2', name: 'Builders Club x ETHcc', state: 'Settled', - data: { - market: { - id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'LTCUSD', @@ -475,14 +419,6 @@ export const generateSimpleMarkets = () => { id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823', name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Pending', - data: { - market: { - id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'BTCUSD.MF21', @@ -513,14 +449,6 @@ export const generateSimpleMarkets = () => { id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6', name: 'ETHBTC Quarterly (30 Jun 2022)', state: 'Active', - data: { - market: { - id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'ETHBTC.QM21', @@ -624,14 +552,6 @@ export const generateSimpleMarkets = () => { id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850', name: 'Apple Monthly (30 Jun 2022)', state: 'Active', - data: { - market: { - id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'AAPL.MF21', @@ -736,14 +656,6 @@ export const generateSimpleMarkets = () => { id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6', name: 'Tesla Quarterly (30 Jun 2022)', state: 'Active', - data: { - market: { - id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6', - state: 'STATE_ACTIVE', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'TSLA.QM21', @@ -848,14 +760,6 @@ export const generateSimpleMarkets = () => { id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a', name: 'Go big or Go home', state: 'Active', - data: { - market: { - id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a', - state: 'STATE_SUSPENDED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'LTCUSD', @@ -899,14 +803,6 @@ export const generateSimpleMarkets = () => { id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f', name: 'BTCUSD Monthly (08 Jul 2022)', state: 'Active', - data: { - market: { - id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'BTCUSD.MF21', @@ -937,14 +833,6 @@ export const generateSimpleMarkets = () => { id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47', name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Active', - data: { - market: { - id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47', - state: 'STATE_PROPOSED', - __typename: 'Market', - }, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { code: 'BTCUSD.MF21', @@ -983,10 +871,6 @@ export const generateLongListMarkets = (count: number) => { ...protoMarket, id: id + i, name: name + i, - data: { - ...protoMarket.data, - id: id + i, - }, }); } return { markets }; diff --git a/apps/console-lite/src/app/components/drawer/drawer.tsx b/apps/console-lite/src/app/components/drawer/drawer.tsx index 465124817..ef7fb9015 100644 --- a/apps/console-lite/src/app/components/drawer/drawer.tsx +++ b/apps/console-lite/src/app/components/drawer/drawer.tsx @@ -22,9 +22,8 @@ export const NavigationDrawer = ({ const width = 'w-full md:w-auto md:min-w-[15%] shrink-0'; const position = 'absolute inset-0 h-full z-10 md:static'; const background = 'bg-black/50 dark:bg-white/50'; - const border = 'border-r border-neutral-300 dark:border-neutral-700'; const flex = 'flex justify-end overflow-hidden'; - const joinedClasses = [flex, width, position, background, border].join(' '); + const joinedClasses = [flex, width, position, background].join(' '); const outerStyles = classNames(joinedClasses, { visible: isMenuOpen, diff --git a/apps/console-lite/src/app/components/header/header.tsx b/apps/console-lite/src/app/components/header/header.tsx index bb3586cfd..ebc7b8410 100644 --- a/apps/console-lite/src/app/components/header/header.tsx +++ b/apps/console-lite/src/app/components/header/header.tsx @@ -12,7 +12,7 @@ const Header = () => { } = useContext(LocalContext); return (
diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts index 1e0ea0b65..ac8761d5a 100644 --- a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts +++ b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts @@ -9,26 +9,6 @@ import { MarketState } from "@vegaprotocol/types"; // GraphQL query operation: SimpleMarkets // ==================================================== -export interface SimpleMarkets_markets_data_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * Current state of the market - */ - state: MarketState; -} - -export interface SimpleMarkets_markets_data { - __typename: "MarketData"; - /** - * market ID of the associated mark price - */ - market: SimpleMarkets_markets_data_market; -} - export interface SimpleMarkets_markets_tradableInstrument_instrument_metadata { __typename: "InstrumentMetadata"; /** @@ -107,10 +87,6 @@ export interface SimpleMarkets_markets { * Current state of the market */ state: MarketState; - /** - * marketData for the given market - */ - data: SimpleMarkets_markets_data | null; /** * An instance of, or reference to, a tradable instrument. */ diff --git a/apps/console-lite/src/app/components/simple-market-list/constants.ts b/apps/console-lite/src/app/components/simple-market-list/constants.ts index 523dca420..d834f7239 100644 --- a/apps/console-lite/src/app/components/simple-market-list/constants.ts +++ b/apps/console-lite/src/app/components/simple-market-list/constants.ts @@ -195,3 +195,5 @@ export const ROW_CLASS_RULES = { 'cursor-pointer': ({ data }: { data: SimpleMarkets_markets }) => IS_MARKET_TRADABLE(data || {}), }; + +export const LARGE_SCREENS = ['xl', 'xxl']; diff --git a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts index 67a5d294e..2032149a1 100644 --- a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts +++ b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts @@ -10,25 +10,12 @@ import type { SimpleMarketDataSub_marketData, } from './__generated__/SimpleMarketDataSub'; -const MARKET_DATA_FRAGMENT = gql` - fragment SimpleMarketDataFields on MarketData { - market { - id - state - } - } -`; - export const MARKETS_QUERY = gql` - ${MARKET_DATA_FRAGMENT} query SimpleMarkets($CandleSince: String!) { markets { id name state - data { - ...SimpleMarketDataFields - } tradableInstrument { instrument { code @@ -55,10 +42,12 @@ export const MARKETS_QUERY = gql` `; const MARKET_DATA_SUB = gql` - ${MARKET_DATA_FRAGMENT} subscription SimpleMarketDataSub { marketData { - ...SimpleMarketDataFields + market { + id + state + } } } `; @@ -78,7 +67,7 @@ const update = ( return produce(data, (draft) => { const index = draft.findIndex((m) => m.id === delta.market.id); if (index !== -1) { - draft[index].data = delta; + draft[index].state = delta.market.state; } // @TODO - else push new market to draft }); diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx index 22caa75ee..3fe962126 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx @@ -66,11 +66,7 @@ describe('SimpleMarketList', () => { const data = [ { id: '1', - data: { - market: { - state: MarketState.STATE_ACTIVE, - }, - }, + state: MarketState.STATE_ACTIVE, tradableInstrument: { instrument: { product: { @@ -86,11 +82,7 @@ describe('SimpleMarketList', () => { }, { id: '2', - data: { - market: { - state: MarketState.STATE_ACTIVE, - }, - }, + state: MarketState.STATE_ACTIVE, tradableInstrument: { instrument: { product: { diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.tsx index c42d935d3..0161cfaea 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.tsx @@ -45,7 +45,7 @@ export type RouterParams = Partial<{ }>; const SimpleMarketList = () => { - const { isMobile } = useScreenDimensions(); + const { isMobile, screenSize } = useScreenDimensions(); const navigate = useNavigate(); const params = useParams(); const theme = useContext(ThemeContext); @@ -80,7 +80,7 @@ const SimpleMarketList = () => { useEffect(() => { const statuses: Record = {}; data?.forEach((market) => { - statuses[market.id] = market.data?.market.state || ''; + statuses[market.id] = market.state || ''; }); statusesRef.current = statuses; }, [data, statusesRef]); @@ -129,6 +129,10 @@ const SimpleMarketList = () => { [handleRowClicked] ); + const shouldSuppressHorizontalScroll = useMemo(() => { + return !isMobile && constants.LARGE_SCREENS.includes(screenSize); + }, [isMobile, screenSize]); + return (
@@ -156,6 +160,7 @@ const SimpleMarketList = () => { suppressRowTransform onCellKeyDown={onCellKeyDown} tabToNextCell={onTabToNextCell} + suppressHorizontalScroll={shouldSuppressHorizontalScroll} />
diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx index b87dbddab..0896095f9 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx @@ -75,7 +75,7 @@ const SimpleMarketToolbar = ({ data }: Props) => { ); return ( -
+
    { style={sliderStyles} />
-
-
+
+
setOpen(open)}> { {STATES_FILTER.map(({ value, text }) => ( {
{activeNumber > 0 && (
    diff --git a/apps/console-lite/src/app/constants/index.ts b/apps/console-lite/src/app/constants/index.ts index feaea0f08..fc26ee723 100644 --- a/apps/console-lite/src/app/constants/index.ts +++ b/apps/console-lite/src/app/constants/index.ts @@ -10,7 +10,7 @@ export const TRADABLE_STATES = { }; export const IS_MARKET_TRADABLE = (market: SimpleMarkets_markets) => - Boolean((market.data?.market.state ?? '') in TRADABLE_STATES && market?.id); + Boolean((market.state ?? '') in TRADABLE_STATES && market?.id); export const MARKET_STATES_MAP: Record = { [MarketState.STATE_ACTIVE]: t('Active'), diff --git a/apps/console-lite/src/app/hooks/use-column-definitions.tsx b/apps/console-lite/src/app/hooks/use-column-definitions.tsx index 5a8ea69c0..647b0e427 100644 --- a/apps/console-lite/src/app/hooks/use-column-definitions.tsx +++ b/apps/console-lite/src/app/hooks/use-column-definitions.tsx @@ -93,13 +93,13 @@ const useColumnDefinitions = ({ isMobile }: Props) => { { colId: 'status', headerName: t('Status'), - field: 'data.market.state', + field: 'state', headerClass: 'uppercase', minWidth: 100, cellRenderer: ({ data }: { data: SimpleMarkets_markets }) => (
    -
    - {MARKET_STATES_MAP[data.data?.market.state || '']} +
    + {MARKET_STATES_MAP[data.state || '']}
    ), diff --git a/apps/console-lite/src/app/hooks/use-markets-filter-data.ts b/apps/console-lite/src/app/hooks/use-markets-filter-data.ts index 7763209f1..71ca60f02 100644 --- a/apps/console-lite/src/app/hooks/use-markets-filter-data.ts +++ b/apps/console-lite/src/app/hooks/use-markets-filter-data.ts @@ -27,7 +27,7 @@ const useMarketsFilterData = ( : params.state ? params.state : MarketState.STATE_ACTIVE; - if (state && state !== item.data?.market.state) { + if (state && state !== item.state) { return false; } return true; diff --git a/libs/react-helpers/src/hooks/use-screen-dimensions.ts b/libs/react-helpers/src/hooks/use-screen-dimensions.ts index 403fe1c5c..fb07b695a 100644 --- a/libs/react-helpers/src/hooks/use-screen-dimensions.ts +++ b/libs/react-helpers/src/hooks/use-screen-dimensions.ts @@ -7,7 +7,7 @@ type Screen = keyof typeof theme.screens; interface Props { isMobile: boolean; - screen: Screen; + screenSize: Screen; width: number; } @@ -17,7 +17,7 @@ export const useScreenDimensions = (): Props => { () => ({ width, isMobile: width < parseInt(theme.screens.md), - screen: Object.entries(theme.screens).reduce((agg: Screen, entry) => { + screenSize: Object.entries(theme.screens).reduce((agg: Screen, entry) => { if (width > parseInt(entry[1])) { agg = entry[0] as Screen; } From b531094fda58e43cd7db09209a9080d99301e920 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 6 Sep 2022 06:27:47 +0000 Subject: [PATCH 04/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 68 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index bb0642994..17428068b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -212,7 +212,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107936.02786848641935224", + "locked_amount": "107873.61895098970631037", "deposits": [ { "amount": "129999.45", @@ -278,7 +278,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "52166.777219685443", + "locked_amount": "52128.86505580923114", "deposits": [ { "amount": "2600", @@ -662,7 +662,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "49097.390266096535661786", + "locked_amount": "49036.17293168589766671", "deposits": [ { "amount": "97499.58", @@ -695,7 +695,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "67107.65618293646347597256748", + "locked_amount": "67023.98265552900343460273988", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +728,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20654.424218367917176256", + "locked_amount": "20628.671142948182692878", "deposits": [ { "amount": "32499.86", @@ -761,7 +761,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6722.814657290304874002", + "locked_amount": "6714.432281143110831333", "deposits": [ { "amount": "10833.29", @@ -869,7 +869,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "6847.06748188405725", + "locked_amount": "6814.8975317028975", "deposits": [ { "amount": "15000", @@ -955,7 +955,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1429667.669805819350218286", + "locked_amount": "1428269.440097631821889706", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1241,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "34183.34968800321925", + "locked_amount": "34122.58422654992175", "deposits": [ { "amount": "12500", @@ -2108,7 +2108,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3747.7489513881696342917062292252", + "locked_amount": "3706.6569572842430364840535158828", "deposits": [ { "amount": "2833.333333", @@ -22214,7 +22214,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2221402.77580550785195308478", + "locked_amount": "2219254.18355590338597256321", "deposits": [ { "amount": "1998.95815", @@ -23071,7 +23071,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "188731.5544957414143694", - "locked_amount": "13109179.1887282219720601794047636901757232", + "locked_amount": "13101599.4241343663486712119938425995485266", "deposits": [ { "amount": "16249.93", @@ -26067,7 +26067,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2723422.352074488493348197", - "locked_amount": "6443143.950397334081710571173710405", + "locked_amount": "6436110.350427968215899328596699654", "deposits": [ { "amount": "129284.449", @@ -31128,7 +31128,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1733643.914423703455421207", - "locked_amount": "2228821.739071983619620810817548931", + "locked_amount": "2226042.72118522878513742745317631", "deposits": [ { "amount": "552496.6455", @@ -32525,8 +32525,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "2932.49091410726", - "locked_amount": "351993.96790600178014459879857936", + "total_removed": "3136.87798919126", + "locked_amount": "351653.51118217502811748422729576", "deposits": [ { "amount": "3000", @@ -39255,6 +39255,16 @@ "user": "0xfeF4b56A370135A17Eef5ba8f5c308451a64Cf86", "tx": "0x81e9c325aed64b826afc0bb413245ee51468bb5238310bcdb1d4149d7cf3e713" }, + { + "amount": "102.190930996", + "user": "0x256274a216e0a349dC18cae08Ca45631176AF437", + "tx": "0x8a46d0c86f1676570dc3a867c85fc7d645551af2287f1cd115fba15d65618dc3" + }, + { + "amount": "102.196144088", + "user": "0xB3ae40b11af91BbD456022Bd42B4f36A8C0AEA9D", + "tx": "0x881dab195eb46b51f46181384e17fa7488b55ebae7bcb78eaeddf5c9375db4db" + }, { "amount": "35.252308472", "user": "0xFBD4E1d0D89632c279F06a1d9bb9438647D99a29", @@ -58658,10 +58668,17 @@ "tx": "0xe32a466fc780a0fb3fd84a804f622931ebfaf3f428bff0dc6d141270410e75f8" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "102.196144088", + "user": "0xB3ae40b11af91BbD456022Bd42B4f36A8C0AEA9D", + "tranche_id": 5, + "tx": "0x881dab195eb46b51f46181384e17fa7488b55ebae7bcb78eaeddf5c9375db4db" + } + ], "total_tokens": "400", - "withdrawn_tokens": "0", - "remaining_tokens": "400" + "withdrawn_tokens": "102.196144088", + "remaining_tokens": "297.803855912" }, { "address": "0x256274a216e0a349dC18cae08Ca45631176AF437", @@ -58673,10 +58690,17 @@ "tx": "0xe32a466fc780a0fb3fd84a804f622931ebfaf3f428bff0dc6d141270410e75f8" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "102.190930996", + "user": "0x256274a216e0a349dC18cae08Ca45631176AF437", + "tranche_id": 5, + "tx": "0x8a46d0c86f1676570dc3a867c85fc7d645551af2287f1cd115fba15d65618dc3" + } + ], "total_tokens": "400", - "withdrawn_tokens": "0", - "remaining_tokens": "400" + "withdrawn_tokens": "102.190930996", + "remaining_tokens": "297.809069004" }, { "address": "0xB0473C4FeBd722a6d7eE561329d3134030318132", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 5488eac6e..0c83cb936 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "99.70182204464736060009871467529173006", + "locked_amount": "98.97381881024855080009799388001014708", "deposits": [ { "amount": "1000", From a57d4844968a9585e1866ba1cbe0bc5069623b9e Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Tue, 6 Sep 2022 10:03:10 +0100 Subject: [PATCH 05/66] Fix/1083: Update type generator (#1219) * feat: add new generator with config * feat: split off gql queries to separate files for the new generator * fix: delete dummy schema * feat: add generated queries with new codegen * fix: regenerate from scratch and remove duplicates * fix: libs and app gen folders * fix: remove more duplicate queries * fix: add generated files to be ignored by the formatter * fix: format * fix: generated imports * fix: lint * fix: accounts export * fix: more imports * fix: add type alias for new type system and regenerate * fix: format * fix: delete leftover file from merge --- .prettierignore | 1 + README.md | 2 +- apps/console-lite/.eslintrc.json | 2 +- .../components/deal-ticket/MarketTags.graphql | 11 + .../deal-ticket/PartyBalance.graphql | 14 + .../deal-ticket/__generated___/MarketTags.ts | 54 + .../__generated___/PartyBalance.ts | 57 + .../app/components/deposits/Deposits.graphql | 17 + .../deposits/__generated___/Deposits.ts | 57 + .../simple-market-list/Candles.graphql | 5 + .../simple-market-list/SimpleMarkets.graphql | 44 + .../__generated___/Candles.ts | 43 + .../__generated___/SimpleMarkets.ts | 117 + .../src/app/hooks/EstimateOrder.graphql | 30 + .../src/app/hooks/MarketMarkPrice.graphql | 8 + .../src/app/hooks/MarketPositions.graphql | 25 + .../src/app/hooks/PartyMarketData.graphql | 28 + .../app/hooks/__generated___/EstimateOrder.ts | 78 + .../hooks/__generated___/MarketMarkPrice.ts | 51 + .../hooks/__generated___/MarketPositions.ts | 68 + .../hooks/__generated___/PartyMarketData.ts | 71 + apps/explorer/.eslintrc.json | 2 +- .../src/app/routes/assets/Assets.graphql | 27 + .../routes/assets/__generated___/Assets.ts | 67 + .../app/routes/governance/Proposals.graphql | 74 + .../governance/__generated___/Proposals.ts | 114 + .../src/app/routes/markets/Markets.graphql | 134 + .../routes/markets/__generated___/Markets.ts | 174 + .../NetworkParameters.graphql | 6 + .../__generated___/NetworkParameters.ts | 46 + .../app/routes/oracles/OracleSpecs.graphql | 22 + .../oracles/__generated___/OracleSpecs.ts | 62 + .../app/routes/parties/PartyAssets.graphql | 32 + .../parties/__generated___/PartyAssets.ts | 75 + .../src/app/routes/validators/Nodes.graphql | 23 + .../routes/validators/__generated___/Nodes.ts | 63 + apps/token/.eslintrc.json | 2 +- apps/token/client.graphql | 43 + .../vega-wallet/Delegations.graphql | 37 + .../vega-wallet/__generated__/Delegations.ts | 6 + .../__generated__/PartyDelegations.ts | 52 - .../vega-wallet/__generated___/Delegations.ts | 80 + apps/token/src/hooks/NetworkParams.graphql | 6 + .../hooks/__generated__/Erc20ApprovalPoll.ts | 48 - .../src/hooks/__generated__/WithdrawalPoll.ts | 93 - .../src/hooks/__generated___/NetworkParams.ts | 46 + .../src/routes/governance/Proposal.graphql | 96 + .../governance/__generated___/Proposal.ts | 174 + .../components/vote-details/Stake.graphql | 9 + .../vote-details/__generated__/VoteButtons.ts | 3 + .../vote-details/__generated___/Stake.ts | 52 + apps/token/src/routes/home/NodeData.graphql | 6 + .../src/routes/home/__generated__/NodeData.ts | 3 + .../routes/home/__generated___/NodeData.ts | 46 + .../src/routes/rewards/home/Rewards.graphql | 42 + .../rewards/home/__generated__/Epoch.ts | 43 - .../rewards/home/__generated__/Rewards.ts | 9 + .../rewards/home/__generated___/Rewards.ts | 85 + apps/token/src/routes/staking/Nodes.graphql | 23 + .../routes/staking/PartyDelegations.graphql | 16 + apps/token/src/routes/staking/Staking.graphql | 62 + .../src/routes/staking/__generated__/Nodes.ts | 9 + .../staking/__generated__/PartyDelegations.ts | 3 + .../routes/staking/__generated__/Staking.ts | 21 + .../routes/staking/__generated___/Nodes.ts | 63 + .../__generated___/PartyDelegations.ts | 59 + .../routes/staking/__generated___/Staking.ts | 105 + .../associate/PartyStakeLinkings.graphql | 12 + .../__generated___/PartyStakeLinkings.ts | 55 + apps/trading/.eslintrc.json | 2 +- apps/trading/pages/markets/Market.graphql | 59 + .../pages/markets/__generated___/Market.ts | 106 + .../pages/portfolio/deposit/Deposit.graphql | 17 + .../deposit/__generated___/Deposit.ts | 57 + libs/accounts/.eslintrc.json | 2 +- libs/accounts/src/lib/Accounts.graphql | 34 + libs/accounts/src/lib/__generated__/index.ts | 3 - .../src/lib/__generated___/Accounts.ts | 110 + libs/accounts/src/lib/index.ts | 4 +- libs/assets/.eslintrc.json | 2 +- libs/assets/src/lib/Assets.graphql | 20 + libs/assets/src/lib/__generated___/Assets.ts | 60 + libs/assets/src/lib/index.ts | 1 + libs/candles-chart/.eslintrc.json | 2 +- libs/candles-chart/src/lib/Candles.graphql | 31 + libs/candles-chart/src/lib/Chart.graphql | 12 + .../src/lib/__generated__/index.ts | 4 - .../src/lib/__generated___/Candles.ts | 113 + .../src/lib/__generated___/Chart.ts | 55 + libs/candles-chart/src/lib/index.ts | 5 +- libs/deal-ticket/.eslintrc.json | 2 +- .../src/components/DealTicket.graphql | 30 + .../src/components/MarketInfo.graphql | 139 + .../src/components/MarketNames.graphql | 20 + .../src/components/__generated__/index.ts | 3 - .../components/__generated___/DealTicket.ts | 73 + .../components/__generated___/MarketInfo.ts | 186 + .../components/__generated___/MarketNames.ts | 60 + .../src/components/deal-ticket-container.tsx | 2 +- libs/deal-ticket/src/components/index.ts | 4 +- .../src/components/info-market.tsx | 2 +- .../src/components/market-selector.tsx | 2 +- libs/deposits/.eslintrc.json | 2 +- libs/deposits/src/lib/Deposit.graphql | 11 + .../src/lib/__generated___/Deposit.ts | 49 + libs/environment/.eslintrc.json | 2 +- libs/fills/.eslintrc.json | 2 +- libs/fills/src/lib/Fills.graphql | 72 + libs/fills/src/lib/__generated___/Fills.ts | 152 + libs/governance/.eslintrc.json | 2 +- .../src/lib/proposals-hooks/Proposal.graphql | 14 + .../__generated___/Proposal.ts | 52 + libs/market-depth/.eslintrc.json | 2 +- libs/market-depth/src/lib/MarketDepth.graphql | 65 + .../src/lib/__generated__/index.ts | 2 - .../src/lib/__generated___/MarketDepth.ts | 139 + libs/market-depth/src/lib/index.ts | 3 +- .../src/lib/use-orderbook-data.spec.tsx | 5 +- .../src/lib/use-orderbook-data.ts | 2 +- libs/market-list/.eslintrc.json | 2 +- libs/market-list/src/lib/MarketData.graphql | 75 + .../src/lib/__generated__/index.ts | 3 - .../src/lib/__generated___/MarketData.ts | 150 + .../markets-container/market-list-table.tsx | 2 +- .../markets-container/markets-container.tsx | 2 +- .../src/lib/components/select-market.tsx | 2 +- libs/market-list/src/lib/index.ts | 4 +- .../src/lib/markets-data-provider.ts | 2 +- libs/network-stats/.eslintrc.json | 2 +- .../components/stats-manager/Stats.graphql | 23 + .../stats-manager/__generated___/Stats.ts | 63 + libs/orders/.eslintrc.json | 2 +- .../__generated__/index.ts | 3 - .../components/order-data-provider/index.ts | 4 +- .../order-feedback/order-feedback.tsx | 2 +- .../lib/components/order-list/order-list.tsx | 2 +- .../orders/src/lib/order-hooks/Orders.graphql | 78 + .../lib/order-hooks/__generated__/index.ts | 1 - .../lib/order-hooks/__generated___/Orders.ts | 187 + libs/orders/src/lib/order-hooks/index.ts | 2 +- .../lib/order-hooks/use-order-cancel.spec.tsx | 5 +- .../src/lib/order-hooks/use-order-cancel.tsx | 2 +- .../lib/order-hooks/use-order-edit.spec.tsx | 5 +- .../src/lib/order-hooks/use-order-edit.tsx | 2 +- .../src/lib/order-hooks/use-order-event.ts | 2 +- .../lib/order-hooks/use-order-submit.spec.tsx | 5 +- .../src/lib/order-hooks/use-order-submit.tsx | 2 +- libs/positions/.eslintrc.json | 2 +- libs/positions/src/lib/Positions.graphql | 60 + .../src/lib/__generated___/Positions.ts | 136 + libs/trades/.eslintrc.json | 2 +- libs/trades/src/lib/Trades.graphql | 37 + libs/trades/src/lib/__generated___/Trades.ts | 115 + libs/types/.env | 2 +- libs/types/.eslintrc.json | 2 +- libs/types/apollo.config.js | 11 +- libs/types/codegen.yml | 29 + libs/types/project.json | 1 + libs/types/src/__generated__/index.ts | 1 - libs/types/src/__generated__/types.ts | 4177 +++++++++++++++++ libs/types/src/index.ts | 5 +- libs/wallet/.eslintrc.json | 2 +- libs/web3/.eslintrc.json | 2 +- libs/web3/src/lib/NetworkParams.graphql | 6 + .../src/lib/__generated___/NetworkParams.ts | 46 + libs/withdraws/.eslintrc.json | 2 +- libs/withdraws/src/lib/Erc20Approval.graphql | 11 + libs/withdraws/src/lib/Withdraw.graphql | 32 + libs/withdraws/src/lib/Withdrawal.graphql | 38 + .../src/lib/__generated___/Erc20Approval.ts | 54 + .../src/lib/__generated___/Withdraw.ts | 75 + .../src/lib/__generated___/Withdrawal.ts | 114 + package.json | 7 + tsconfig.base.json | 1 + yarn.lock | 1654 ++++++- 175 files changed, 11763 insertions(+), 406 deletions(-) create mode 100644 apps/console-lite/src/app/components/deal-ticket/MarketTags.graphql create mode 100644 apps/console-lite/src/app/components/deal-ticket/PartyBalance.graphql create mode 100644 apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts create mode 100644 apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts create mode 100644 apps/console-lite/src/app/components/deposits/Deposits.graphql create mode 100644 apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts create mode 100644 apps/console-lite/src/app/components/simple-market-list/Candles.graphql create mode 100644 apps/console-lite/src/app/components/simple-market-list/SimpleMarkets.graphql create mode 100644 apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts create mode 100644 apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts create mode 100644 apps/console-lite/src/app/hooks/EstimateOrder.graphql create mode 100644 apps/console-lite/src/app/hooks/MarketMarkPrice.graphql create mode 100644 apps/console-lite/src/app/hooks/MarketPositions.graphql create mode 100644 apps/console-lite/src/app/hooks/PartyMarketData.graphql create mode 100644 apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts create mode 100644 apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts create mode 100644 apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts create mode 100644 apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts create mode 100644 apps/explorer/src/app/routes/assets/Assets.graphql create mode 100644 apps/explorer/src/app/routes/assets/__generated___/Assets.ts create mode 100644 apps/explorer/src/app/routes/governance/Proposals.graphql create mode 100644 apps/explorer/src/app/routes/governance/__generated___/Proposals.ts create mode 100644 apps/explorer/src/app/routes/markets/Markets.graphql create mode 100644 apps/explorer/src/app/routes/markets/__generated___/Markets.ts create mode 100644 apps/explorer/src/app/routes/network-parameters/NetworkParameters.graphql create mode 100644 apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts create mode 100644 apps/explorer/src/app/routes/oracles/OracleSpecs.graphql create mode 100644 apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts create mode 100644 apps/explorer/src/app/routes/parties/PartyAssets.graphql create mode 100644 apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts create mode 100644 apps/explorer/src/app/routes/validators/Nodes.graphql create mode 100644 apps/explorer/src/app/routes/validators/__generated___/Nodes.ts create mode 100644 apps/token/client.graphql create mode 100644 apps/token/src/components/vega-wallet/Delegations.graphql delete mode 100644 apps/token/src/components/vega-wallet/__generated__/PartyDelegations.ts create mode 100644 apps/token/src/components/vega-wallet/__generated___/Delegations.ts create mode 100644 apps/token/src/hooks/NetworkParams.graphql delete mode 100644 apps/token/src/hooks/__generated__/Erc20ApprovalPoll.ts delete mode 100644 apps/token/src/hooks/__generated__/WithdrawalPoll.ts create mode 100644 apps/token/src/hooks/__generated___/NetworkParams.ts create mode 100644 apps/token/src/routes/governance/Proposal.graphql create mode 100644 apps/token/src/routes/governance/__generated___/Proposal.ts create mode 100644 apps/token/src/routes/governance/components/vote-details/Stake.graphql create mode 100644 apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts create mode 100644 apps/token/src/routes/home/NodeData.graphql create mode 100644 apps/token/src/routes/home/__generated___/NodeData.ts create mode 100644 apps/token/src/routes/rewards/home/Rewards.graphql delete mode 100644 apps/token/src/routes/rewards/home/__generated__/Epoch.ts create mode 100644 apps/token/src/routes/rewards/home/__generated___/Rewards.ts create mode 100644 apps/token/src/routes/staking/Nodes.graphql create mode 100644 apps/token/src/routes/staking/PartyDelegations.graphql create mode 100644 apps/token/src/routes/staking/Staking.graphql create mode 100644 apps/token/src/routes/staking/__generated___/Nodes.ts create mode 100644 apps/token/src/routes/staking/__generated___/PartyDelegations.ts create mode 100644 apps/token/src/routes/staking/__generated___/Staking.ts create mode 100644 apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql create mode 100644 apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts create mode 100644 apps/trading/pages/markets/Market.graphql create mode 100644 apps/trading/pages/markets/__generated___/Market.ts create mode 100644 apps/trading/pages/portfolio/deposit/Deposit.graphql create mode 100644 apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts create mode 100644 libs/accounts/src/lib/Accounts.graphql delete mode 100644 libs/accounts/src/lib/__generated__/index.ts create mode 100644 libs/accounts/src/lib/__generated___/Accounts.ts create mode 100644 libs/assets/src/lib/Assets.graphql create mode 100644 libs/assets/src/lib/__generated___/Assets.ts create mode 100644 libs/candles-chart/src/lib/Candles.graphql create mode 100644 libs/candles-chart/src/lib/Chart.graphql delete mode 100644 libs/candles-chart/src/lib/__generated__/index.ts create mode 100644 libs/candles-chart/src/lib/__generated___/Candles.ts create mode 100644 libs/candles-chart/src/lib/__generated___/Chart.ts create mode 100644 libs/deal-ticket/src/components/DealTicket.graphql create mode 100644 libs/deal-ticket/src/components/MarketInfo.graphql create mode 100644 libs/deal-ticket/src/components/MarketNames.graphql delete mode 100644 libs/deal-ticket/src/components/__generated__/index.ts create mode 100644 libs/deal-ticket/src/components/__generated___/DealTicket.ts create mode 100644 libs/deal-ticket/src/components/__generated___/MarketInfo.ts create mode 100644 libs/deal-ticket/src/components/__generated___/MarketNames.ts create mode 100644 libs/deposits/src/lib/Deposit.graphql create mode 100644 libs/deposits/src/lib/__generated___/Deposit.ts create mode 100644 libs/fills/src/lib/Fills.graphql create mode 100644 libs/fills/src/lib/__generated___/Fills.ts create mode 100644 libs/governance/src/lib/proposals-hooks/Proposal.graphql create mode 100644 libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts create mode 100644 libs/market-depth/src/lib/MarketDepth.graphql delete mode 100644 libs/market-depth/src/lib/__generated__/index.ts create mode 100644 libs/market-depth/src/lib/__generated___/MarketDepth.ts create mode 100644 libs/market-list/src/lib/MarketData.graphql delete mode 100644 libs/market-list/src/lib/__generated__/index.ts create mode 100644 libs/market-list/src/lib/__generated___/MarketData.ts create mode 100644 libs/network-stats/src/components/stats-manager/Stats.graphql create mode 100644 libs/network-stats/src/components/stats-manager/__generated___/Stats.ts delete mode 100644 libs/orders/src/lib/components/order-data-provider/__generated__/index.ts create mode 100644 libs/orders/src/lib/order-hooks/Orders.graphql delete mode 100644 libs/orders/src/lib/order-hooks/__generated__/index.ts create mode 100644 libs/orders/src/lib/order-hooks/__generated___/Orders.ts create mode 100644 libs/positions/src/lib/Positions.graphql create mode 100644 libs/positions/src/lib/__generated___/Positions.ts create mode 100644 libs/trades/src/lib/Trades.graphql create mode 100644 libs/trades/src/lib/__generated___/Trades.ts create mode 100644 libs/types/codegen.yml delete mode 100644 libs/types/src/__generated__/index.ts create mode 100644 libs/types/src/__generated__/types.ts create mode 100644 libs/web3/src/lib/NetworkParams.graphql create mode 100644 libs/web3/src/lib/__generated___/NetworkParams.ts create mode 100644 libs/withdraws/src/lib/Erc20Approval.graphql create mode 100644 libs/withdraws/src/lib/Withdraw.graphql create mode 100644 libs/withdraws/src/lib/Withdrawal.graphql create mode 100644 libs/withdraws/src/lib/__generated___/Erc20Approval.ts create mode 100644 libs/withdraws/src/lib/__generated___/Withdraw.ts create mode 100644 libs/withdraws/src/lib/__generated___/Withdrawal.ts diff --git a/.prettierignore b/.prettierignore index 6b83ad2e8..344ebc105 100644 --- a/.prettierignore +++ b/.prettierignore @@ -3,6 +3,7 @@ /dist /coverage __generated__ +__generated___ apps/static/src/assets/devnet-tranches.json apps/static/src/assets/mainnet-tranches.json diff --git a/README.md b/README.md index 8d68ec8ad..e22e0863e 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Run `nx serve my-app` for a dev server. Navigate to the port specified in `app/< ### Using Apollo GraphQL and Generate Types -In order to generate the schemas for your GraphQL queries, you can run `NX_VEGA_URL=[YOUR URL HERE] nx run types:generate`. +In order to generate the schemas for your GraphQL queries, you can run `GRAPHQL_SCHEMA_PATH=[YOUR SCHEMA FILE / API URL HERE] nx run types:generate`. ```bash export NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql diff --git a/apps/console-lite/.eslintrc.json b/apps/console-lite/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/apps/console-lite/.eslintrc.json +++ b/apps/console-lite/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/console-lite/src/app/components/deal-ticket/MarketTags.graphql b/apps/console-lite/src/app/components/deal-ticket/MarketTags.graphql new file mode 100644 index 000000000..5026d5bd5 --- /dev/null +++ b/apps/console-lite/src/app/components/deal-ticket/MarketTags.graphql @@ -0,0 +1,11 @@ +query MarketTags($marketId: ID!) { + market(id: $marketId) { + tradableInstrument { + instrument { + metadata { + tags + } + } + } + } +} diff --git a/apps/console-lite/src/app/components/deal-ticket/PartyBalance.graphql b/apps/console-lite/src/app/components/deal-ticket/PartyBalance.graphql new file mode 100644 index 000000000..fc75976c0 --- /dev/null +++ b/apps/console-lite/src/app/components/deal-ticket/PartyBalance.graphql @@ -0,0 +1,14 @@ +query PartyBalanceQuery($partyId: ID!) { + party(id: $partyId) { + accounts { + type + balance + asset { + id + symbol + name + decimals + } + } + } +} diff --git a/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts b/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts new file mode 100644 index 000000000..99e0ebbc4 --- /dev/null +++ b/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts @@ -0,0 +1,54 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketTagsQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type MarketTagsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null } } } } | null }; + + +export const MarketTagsDocument = gql` + query MarketTags($marketId: ID!) { + market(id: $marketId) { + tradableInstrument { + instrument { + metadata { + tags + } + } + } + } +} + `; + +/** + * __useMarketTagsQuery__ + * + * To run a query within a React component, call `useMarketTagsQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketTagsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketTagsQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useMarketTagsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketTagsDocument, options); + } +export function useMarketTagsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketTagsDocument, options); + } +export type MarketTagsQueryHookResult = ReturnType; +export type MarketTagsLazyQueryHookResult = ReturnType; +export type MarketTagsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts b/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts new file mode 100644 index 000000000..37892e30e --- /dev/null +++ b/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts @@ -0,0 +1,57 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PartyBalanceQueryQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PartyBalanceQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } }> | null } | null }; + + +export const PartyBalanceQueryDocument = gql` + query PartyBalanceQuery($partyId: ID!) { + party(id: $partyId) { + accounts { + type + balance + asset { + id + symbol + name + decimals + } + } + } +} + `; + +/** + * __usePartyBalanceQueryQuery__ + * + * To run a query within a React component, call `usePartyBalanceQueryQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyBalanceQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePartyBalanceQueryQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyBalanceQueryQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PartyBalanceQueryDocument, options); + } +export function usePartyBalanceQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PartyBalanceQueryDocument, options); + } +export type PartyBalanceQueryQueryHookResult = ReturnType; +export type PartyBalanceQueryLazyQueryHookResult = ReturnType; +export type PartyBalanceQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/components/deposits/Deposits.graphql b/apps/console-lite/src/app/components/deposits/Deposits.graphql new file mode 100644 index 000000000..a60049458 --- /dev/null +++ b/apps/console-lite/src/app/components/deposits/Deposits.graphql @@ -0,0 +1,17 @@ +query Deposits { + assetsConnection { + edges { + node { + id + name + symbol + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} diff --git a/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts b/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts new file mode 100644 index 000000000..8e8972412 --- /dev/null +++ b/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts @@ -0,0 +1,57 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type DepositsQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type DepositsQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } }; + + +export const DepositsDocument = gql` + query Deposits { + assetsConnection { + edges { + node { + id + name + symbol + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} + `; + +/** + * __useDepositsQuery__ + * + * To run a query within a React component, call `useDepositsQuery` and pass it any options that fit your needs. + * When your component renders, `useDepositsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDepositsQuery({ + * variables: { + * }, + * }); + */ +export function useDepositsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(DepositsDocument, options); + } +export function useDepositsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(DepositsDocument, options); + } +export type DepositsQueryHookResult = ReturnType; +export type DepositsLazyQueryHookResult = ReturnType; +export type DepositsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/components/simple-market-list/Candles.graphql b/apps/console-lite/src/app/components/simple-market-list/Candles.graphql new file mode 100644 index 000000000..5ac33b8bc --- /dev/null +++ b/apps/console-lite/src/app/components/simple-market-list/Candles.graphql @@ -0,0 +1,5 @@ +subscription CandleLive($marketId: ID!) { + candles(marketId: $marketId, interval: INTERVAL_I1H) { + close + } +} diff --git a/apps/console-lite/src/app/components/simple-market-list/SimpleMarkets.graphql b/apps/console-lite/src/app/components/simple-market-list/SimpleMarkets.graphql new file mode 100644 index 000000000..ab6310ece --- /dev/null +++ b/apps/console-lite/src/app/components/simple-market-list/SimpleMarkets.graphql @@ -0,0 +1,44 @@ +fragment SimpleMarketDataFields on MarketData { + market { + id + state + } +} + +query SimpleMarkets($CandleSince: String!) { + markets { + id + name + state + data { + ...SimpleMarketDataFields + } + tradableInstrument { + instrument { + code + metadata { + tags + } + product { + __typename + ... on Future { + quoteName + settlementAsset { + symbol + } + } + } + } + } + candles(interval: INTERVAL_I1H, since: $CandleSince) { + open + close + } + } +} + +subscription SimpleMarketDataSub { + marketData { + ...SimpleMarketDataFields + } +} diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts b/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts new file mode 100644 index 000000000..10852a97c --- /dev/null +++ b/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts @@ -0,0 +1,43 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type CandleLiveSubscriptionVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type CandleLiveSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', close: string } }; + + +export const CandleLiveDocument = gql` + subscription CandleLive($marketId: ID!) { + candles(marketId: $marketId, interval: INTERVAL_I1H) { + close + } +} + `; + +/** + * __useCandleLiveSubscription__ + * + * To run a query within a React component, call `useCandleLiveSubscription` and pass it any options that fit your needs. + * When your component renders, `useCandleLiveSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useCandleLiveSubscription({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useCandleLiveSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(CandleLiveDocument, options); + } +export type CandleLiveSubscriptionHookResult = ReturnType; +export type CandleLiveSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts b/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts new file mode 100644 index 000000000..ee1e0743e --- /dev/null +++ b/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts @@ -0,0 +1,117 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type SimpleMarketDataFieldsFragment = { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } }; + +export type SimpleMarketsQueryVariables = Types.Exact<{ + CandleSince: Types.Scalars['String']; +}>; + + +export type SimpleMarketsQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, state: Types.MarketState, data?: { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', symbol: string } } } }, candles?: Array<{ __typename?: 'Candle', open: string, close: string } | null> | null }> | null }; + +export type SimpleMarketDataSubSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; + + +export type SimpleMarketDataSubSubscription = { __typename?: 'Subscription', marketData: { __typename?: 'MarketData', market: { __typename?: 'Market', id: string, state: Types.MarketState } } }; + +export const SimpleMarketDataFieldsFragmentDoc = gql` + fragment SimpleMarketDataFields on MarketData { + market { + id + state + } +} + `; +export const SimpleMarketsDocument = gql` + query SimpleMarkets($CandleSince: String!) { + markets { + id + name + state + data { + ...SimpleMarketDataFields + } + tradableInstrument { + instrument { + code + metadata { + tags + } + product { + __typename + ... on Future { + quoteName + settlementAsset { + symbol + } + } + } + } + } + candles(interval: INTERVAL_I1H, since: $CandleSince) { + open + close + } + } +} + ${SimpleMarketDataFieldsFragmentDoc}`; + +/** + * __useSimpleMarketsQuery__ + * + * To run a query within a React component, call `useSimpleMarketsQuery` and pass it any options that fit your needs. + * When your component renders, `useSimpleMarketsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useSimpleMarketsQuery({ + * variables: { + * CandleSince: // value for 'CandleSince' + * }, + * }); + */ +export function useSimpleMarketsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(SimpleMarketsDocument, options); + } +export function useSimpleMarketsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(SimpleMarketsDocument, options); + } +export type SimpleMarketsQueryHookResult = ReturnType; +export type SimpleMarketsLazyQueryHookResult = ReturnType; +export type SimpleMarketsQueryResult = Apollo.QueryResult; +export const SimpleMarketDataSubDocument = gql` + subscription SimpleMarketDataSub { + marketData { + ...SimpleMarketDataFields + } +} + ${SimpleMarketDataFieldsFragmentDoc}`; + +/** + * __useSimpleMarketDataSubSubscription__ + * + * To run a query within a React component, call `useSimpleMarketDataSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useSimpleMarketDataSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useSimpleMarketDataSubSubscription({ + * variables: { + * }, + * }); + */ +export function useSimpleMarketDataSubSubscription(baseOptions?: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(SimpleMarketDataSubDocument, options); + } +export type SimpleMarketDataSubSubscriptionHookResult = ReturnType; +export type SimpleMarketDataSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/hooks/EstimateOrder.graphql b/apps/console-lite/src/app/hooks/EstimateOrder.graphql new file mode 100644 index 000000000..0f9ba762c --- /dev/null +++ b/apps/console-lite/src/app/hooks/EstimateOrder.graphql @@ -0,0 +1,30 @@ +query EstimateOrder( + $marketId: ID! + $partyId: ID! + $price: String + $size: String! + $side: Side! + $timeInForce: OrderTimeInForce! + $expiration: String + $type: OrderType! +) { + estimateOrder( + marketId: $marketId + partyId: $partyId + price: $price + size: $size + side: $side + timeInForce: $timeInForce + expiration: $expiration + type: $type + ) { + fee { + makerFee + infrastructureFee + liquidityFee + } + marginLevels { + initialLevel + } + } +} diff --git a/apps/console-lite/src/app/hooks/MarketMarkPrice.graphql b/apps/console-lite/src/app/hooks/MarketMarkPrice.graphql new file mode 100644 index 000000000..6cca545c8 --- /dev/null +++ b/apps/console-lite/src/app/hooks/MarketMarkPrice.graphql @@ -0,0 +1,8 @@ +query MarketMarkPrice($marketId: ID!) { + market(id: $marketId) { + decimalPlaces + data { + markPrice + } + } +} diff --git a/apps/console-lite/src/app/hooks/MarketPositions.graphql b/apps/console-lite/src/app/hooks/MarketPositions.graphql new file mode 100644 index 000000000..55b5323de --- /dev/null +++ b/apps/console-lite/src/app/hooks/MarketPositions.graphql @@ -0,0 +1,25 @@ +query MarketPositions($partyId: ID!) { + party(id: $partyId) { + id + accounts { + type + balance + asset { + decimals + } + market { + id + } + } + positionsConnection { + edges { + node { + openVolume + market { + id + } + } + } + } + } +} diff --git a/apps/console-lite/src/app/hooks/PartyMarketData.graphql b/apps/console-lite/src/app/hooks/PartyMarketData.graphql new file mode 100644 index 000000000..dfd7daff4 --- /dev/null +++ b/apps/console-lite/src/app/hooks/PartyMarketData.graphql @@ -0,0 +1,28 @@ +query PartyMarketData($partyId: ID!) { + party(id: $partyId) { + id + accounts { + type + balance + asset { + id + decimals + } + market { + id + } + } + marginsConnection { + edges { + node { + market { + id + } + initialLevel + maintenanceLevel + searchLevel + } + } + } + } +} diff --git a/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts b/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts new file mode 100644 index 000000000..a9584623d --- /dev/null +++ b/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts @@ -0,0 +1,78 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type EstimateOrderQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + partyId: Types.Scalars['ID']; + price?: Types.InputMaybe; + size: Types.Scalars['String']; + side: Types.Side; + timeInForce: Types.OrderTimeInForce; + expiration?: Types.InputMaybe; + type: Types.OrderType; +}>; + + +export type EstimateOrderQuery = { __typename?: 'Query', estimateOrder: { __typename?: 'OrderEstimate', fee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, marginLevels: { __typename?: 'MarginLevels', initialLevel: string } } }; + + +export const EstimateOrderDocument = gql` + query EstimateOrder($marketId: ID!, $partyId: ID!, $price: String, $size: String!, $side: Side!, $timeInForce: OrderTimeInForce!, $expiration: String, $type: OrderType!) { + estimateOrder( + marketId: $marketId + partyId: $partyId + price: $price + size: $size + side: $side + timeInForce: $timeInForce + expiration: $expiration + type: $type + ) { + fee { + makerFee + infrastructureFee + liquidityFee + } + marginLevels { + initialLevel + } + } +} + `; + +/** + * __useEstimateOrderQuery__ + * + * To run a query within a React component, call `useEstimateOrderQuery` and pass it any options that fit your needs. + * When your component renders, `useEstimateOrderQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useEstimateOrderQuery({ + * variables: { + * marketId: // value for 'marketId' + * partyId: // value for 'partyId' + * price: // value for 'price' + * size: // value for 'size' + * side: // value for 'side' + * timeInForce: // value for 'timeInForce' + * expiration: // value for 'expiration' + * type: // value for 'type' + * }, + * }); + */ +export function useEstimateOrderQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(EstimateOrderDocument, options); + } +export function useEstimateOrderLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(EstimateOrderDocument, options); + } +export type EstimateOrderQueryHookResult = ReturnType; +export type EstimateOrderLazyQueryHookResult = ReturnType; +export type EstimateOrderQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts b/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts new file mode 100644 index 000000000..c229f45ac --- /dev/null +++ b/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts @@ -0,0 +1,51 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketMarkPriceQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type MarketMarkPriceQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', markPrice: string } | null } | null }; + + +export const MarketMarkPriceDocument = gql` + query MarketMarkPrice($marketId: ID!) { + market(id: $marketId) { + decimalPlaces + data { + markPrice + } + } +} + `; + +/** + * __useMarketMarkPriceQuery__ + * + * To run a query within a React component, call `useMarketMarkPriceQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketMarkPriceQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketMarkPriceQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useMarketMarkPriceQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketMarkPriceDocument, options); + } +export function useMarketMarkPriceLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketMarkPriceDocument, options); + } +export type MarketMarkPriceQueryHookResult = ReturnType; +export type MarketMarkPriceLazyQueryHookResult = ReturnType; +export type MarketMarkPriceQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts b/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts new file mode 100644 index 000000000..090290948 --- /dev/null +++ b/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts @@ -0,0 +1,68 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketPositionsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type MarketPositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, positionsConnection: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', openVolume: string, market: { __typename?: 'Market', id: string } } }> | null } } | null }; + + +export const MarketPositionsDocument = gql` + query MarketPositions($partyId: ID!) { + party(id: $partyId) { + id + accounts { + type + balance + asset { + decimals + } + market { + id + } + } + positionsConnection { + edges { + node { + openVolume + market { + id + } + } + } + } + } +} + `; + +/** + * __useMarketPositionsQuery__ + * + * To run a query within a React component, call `useMarketPositionsQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketPositionsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketPositionsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useMarketPositionsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketPositionsDocument, options); + } +export function useMarketPositionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketPositionsDocument, options); + } +export type MarketPositionsQueryHookResult = ReturnType; +export type MarketPositionsLazyQueryHookResult = ReturnType; +export type MarketPositionsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts b/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts new file mode 100644 index 000000000..b4e7f2c8c --- /dev/null +++ b/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts @@ -0,0 +1,71 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PartyMarketDataQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PartyMarketDataQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, decimals: number }, market?: { __typename?: 'Market', id: string } | null }> | null, marginsConnection: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', initialLevel: string, maintenanceLevel: string, searchLevel: string, market: { __typename?: 'Market', id: string } } }> | null } } | null }; + + +export const PartyMarketDataDocument = gql` + query PartyMarketData($partyId: ID!) { + party(id: $partyId) { + id + accounts { + type + balance + asset { + id + decimals + } + market { + id + } + } + marginsConnection { + edges { + node { + market { + id + } + initialLevel + maintenanceLevel + searchLevel + } + } + } + } +} + `; + +/** + * __usePartyMarketDataQuery__ + * + * To run a query within a React component, call `usePartyMarketDataQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyMarketDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePartyMarketDataQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyMarketDataQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PartyMarketDataDocument, options); + } +export function usePartyMarketDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PartyMarketDataDocument, options); + } +export type PartyMarketDataQueryHookResult = ReturnType; +export type PartyMarketDataLazyQueryHookResult = ReturnType; +export type PartyMarketDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/.eslintrc.json b/apps/explorer/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/apps/explorer/.eslintrc.json +++ b/apps/explorer/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/explorer/src/app/routes/assets/Assets.graphql b/apps/explorer/src/app/routes/assets/Assets.graphql new file mode 100644 index 000000000..00e113473 --- /dev/null +++ b/apps/explorer/src/app/routes/assets/Assets.graphql @@ -0,0 +1,27 @@ +query AssetsQuery { + assetsConnection { + edges { + node { + id + name + symbol + decimals + source { + ... on ERC20 { + contractAddress + } + ... on BuiltinAsset { + maxFaucetAmountMint + } + } + infrastructureFeeAccount { + type + balance + market { + id + } + } + } + } + } +} diff --git a/apps/explorer/src/app/routes/assets/__generated___/Assets.ts b/apps/explorer/src/app/routes/assets/__generated___/Assets.ts new file mode 100644 index 000000000..2d89adea5 --- /dev/null +++ b/apps/explorer/src/app/routes/assets/__generated___/Assets.ts @@ -0,0 +1,67 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type AssetsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } } } | null> | null } }; + + +export const AssetsQueryDocument = gql` + query AssetsQuery { + assetsConnection { + edges { + node { + id + name + symbol + decimals + source { + ... on ERC20 { + contractAddress + } + ... on BuiltinAsset { + maxFaucetAmountMint + } + } + infrastructureFeeAccount { + type + balance + market { + id + } + } + } + } + } +} + `; + +/** + * __useAssetsQueryQuery__ + * + * To run a query within a React component, call `useAssetsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useAssetsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAssetsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useAssetsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(AssetsQueryDocument, options); + } +export function useAssetsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(AssetsQueryDocument, options); + } +export type AssetsQueryQueryHookResult = ReturnType; +export type AssetsQueryLazyQueryHookResult = ReturnType; +export type AssetsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/governance/Proposals.graphql b/apps/explorer/src/app/routes/governance/Proposals.graphql new file mode 100644 index 000000000..02aa5ee8c --- /dev/null +++ b/apps/explorer/src/app/routes/governance/Proposals.graphql @@ -0,0 +1,74 @@ +query ProposalsQuery { + proposals { + id + reference + state + datetime + rejectionReason + party { + id + } + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + instrument { + name + } + } + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + symbol + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + } + } + votes { + yes { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + no { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + } + } +} diff --git a/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts b/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts new file mode 100644 index 000000000..b807b5e9d --- /dev/null +++ b/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts @@ -0,0 +1,114 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type ProposalsQueryQuery = { __typename?: 'Query', proposals?: Array<{ __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', symbol: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } }> | null }; + + +export const ProposalsQueryDocument = gql` + query ProposalsQuery { + proposals { + id + reference + state + datetime + rejectionReason + party { + id + } + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + instrument { + name + } + } + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + symbol + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + } + } + votes { + yes { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + no { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + } + } +} + `; + +/** + * __useProposalsQueryQuery__ + * + * To run a query within a React component, call `useProposalsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useProposalsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(ProposalsQueryDocument, options); + } +export function useProposalsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(ProposalsQueryDocument, options); + } +export type ProposalsQueryQueryHookResult = ReturnType; +export type ProposalsQueryLazyQueryHookResult = ReturnType; +export type ProposalsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/markets/Markets.graphql b/apps/explorer/src/app/routes/markets/Markets.graphql new file mode 100644 index 000000000..2b17af4ce --- /dev/null +++ b/apps/explorer/src/app/routes/markets/Markets.graphql @@ -0,0 +1,134 @@ +query MarketsQuery { + markets { + id + name + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + tradableInstrument { + instrument { + name + metadata { + tags + } + id + code + product { + ... on Future { + settlementAsset { + id + name + decimals + globalRewardPoolAccount { + balance + } + } + } + } + } + riskModel { + ... on LogNormalRiskModel { + tau + riskAversionParameter + params { + r + sigma + mu + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + marginCalculator { + scalingFactors { + searchLevel + initialMargin + collateralRelease + } + } + } + decimalPlaces + openingAuction { + durationSecs + volume + } + priceMonitoringSettings { + parameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + tradingMode + state + proposal { + id + } + state + accounts { + asset { + id + name + } + balance + type + } + data { + markPrice + bestBidPrice + bestBidVolume + bestOfferPrice + bestOfferVolume + bestStaticBidPrice + bestStaticBidVolume + bestStaticOfferPrice + bestStaticOfferVolume + midPrice + staticMidPrice + timestamp + openInterest + auctionEnd + auctionStart + indicativePrice + indicativeVolume + trigger + extensionTrigger + targetStake + suppliedStake + priceMonitoringBounds { + minValidPrice + maxValidPrice + trigger { + auctionExtensionSecs + probability + } + referencePrice + } + marketValueProxy + liquidityProviderFeeShare { + party { + id + } + equityLikeShare + averageEntryValuation + } + } + } +} diff --git a/apps/explorer/src/app/routes/markets/__generated___/Markets.ts b/apps/explorer/src/app/routes/markets/__generated___/Markets.ts new file mode 100644 index 000000000..deb1d2bdd --- /dev/null +++ b/apps/explorer/src/app/routes/markets/__generated___/Markets.ts @@ -0,0 +1,174 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'Account', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'Account', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null }; + + +export const MarketsQueryDocument = gql` + query MarketsQuery { + markets { + id + name + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + tradableInstrument { + instrument { + name + metadata { + tags + } + id + code + product { + ... on Future { + settlementAsset { + id + name + decimals + globalRewardPoolAccount { + balance + } + } + } + } + } + riskModel { + ... on LogNormalRiskModel { + tau + riskAversionParameter + params { + r + sigma + mu + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + marginCalculator { + scalingFactors { + searchLevel + initialMargin + collateralRelease + } + } + } + decimalPlaces + openingAuction { + durationSecs + volume + } + priceMonitoringSettings { + parameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + tradingMode + state + proposal { + id + } + state + accounts { + asset { + id + name + } + balance + type + } + data { + markPrice + bestBidPrice + bestBidVolume + bestOfferPrice + bestOfferVolume + bestStaticBidPrice + bestStaticBidVolume + bestStaticOfferPrice + bestStaticOfferVolume + midPrice + staticMidPrice + timestamp + openInterest + auctionEnd + auctionStart + indicativePrice + indicativeVolume + trigger + extensionTrigger + targetStake + suppliedStake + priceMonitoringBounds { + minValidPrice + maxValidPrice + trigger { + auctionExtensionSecs + probability + } + referencePrice + } + marketValueProxy + liquidityProviderFeeShare { + party { + id + } + equityLikeShare + averageEntryValuation + } + } + } +} + `; + +/** + * __useMarketsQueryQuery__ + * + * To run a query within a React component, call `useMarketsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketsQueryDocument, options); + } +export function useMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketsQueryDocument, options); + } +export type MarketsQueryQueryHookResult = ReturnType; +export type MarketsQueryLazyQueryHookResult = ReturnType; +export type MarketsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/network-parameters/NetworkParameters.graphql b/apps/explorer/src/app/routes/network-parameters/NetworkParameters.graphql new file mode 100644 index 000000000..7fbac2c00 --- /dev/null +++ b/apps/explorer/src/app/routes/network-parameters/NetworkParameters.graphql @@ -0,0 +1,6 @@ +query NetworkParametersQuery { + networkParameters { + key + value + } +} diff --git a/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts b/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts new file mode 100644 index 000000000..d40f46c02 --- /dev/null +++ b/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts @@ -0,0 +1,46 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NetworkParametersQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NetworkParametersQueryQuery = { __typename?: 'Query', networkParameters?: Array<{ __typename?: 'NetworkParameter', key: string, value: string }> | null }; + + +export const NetworkParametersQueryDocument = gql` + query NetworkParametersQuery { + networkParameters { + key + value + } +} + `; + +/** + * __useNetworkParametersQueryQuery__ + * + * To run a query within a React component, call `useNetworkParametersQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useNetworkParametersQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNetworkParametersQueryQuery({ + * variables: { + * }, + * }); + */ +export function useNetworkParametersQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NetworkParametersQueryDocument, options); + } +export function useNetworkParametersQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NetworkParametersQueryDocument, options); + } +export type NetworkParametersQueryQueryHookResult = ReturnType; +export type NetworkParametersQueryLazyQueryHookResult = ReturnType; +export type NetworkParametersQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql b/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql new file mode 100644 index 000000000..a6d2c122d --- /dev/null +++ b/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql @@ -0,0 +1,22 @@ +query OracleSpecs { + oracleSpecs { + status + id + createdAt + updatedAt + pubKeys + filters { + key { + name + type + } + conditions { + value + operator + } + } + data { + pubKeys + } + } +} diff --git a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts new file mode 100644 index 000000000..9f53d037c --- /dev/null +++ b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts @@ -0,0 +1,62 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type OracleSpecsQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type OracleSpecsQuery = { __typename?: 'Query', oracleSpecs?: Array<{ __typename?: 'OracleSpec', status: Types.OracleSpecStatus, id: string, createdAt: string, updatedAt?: string | null, pubKeys?: Array | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null, data: Array<{ __typename?: 'OracleData', pubKeys?: Array | null }> }> | null }; + + +export const OracleSpecsDocument = gql` + query OracleSpecs { + oracleSpecs { + status + id + createdAt + updatedAt + pubKeys + filters { + key { + name + type + } + conditions { + value + operator + } + } + data { + pubKeys + } + } +} + `; + +/** + * __useOracleSpecsQuery__ + * + * To run a query within a React component, call `useOracleSpecsQuery` and pass it any options that fit your needs. + * When your component renders, `useOracleSpecsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOracleSpecsQuery({ + * variables: { + * }, + * }); + */ +export function useOracleSpecsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(OracleSpecsDocument, options); + } +export function useOracleSpecsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(OracleSpecsDocument, options); + } +export type OracleSpecsQueryHookResult = ReturnType; +export type OracleSpecsLazyQueryHookResult = ReturnType; +export type OracleSpecsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/parties/PartyAssets.graphql b/apps/explorer/src/app/routes/parties/PartyAssets.graphql new file mode 100644 index 000000000..344ac3660 --- /dev/null +++ b/apps/explorer/src/app/routes/parties/PartyAssets.graphql @@ -0,0 +1,32 @@ +query PartyAssetsQuery($partyId: ID!) { + party(id: $partyId) { + id + delegations { + amount + node { + id + name + } + epoch + } + stake { + currentStakeAvailable + } + accounts { + asset { + name + id + decimals + symbol + source { + __typename + ... on ERC20 { + contractAddress + } + } + } + type + balance + } + } +} diff --git a/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts b/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts new file mode 100644 index 000000000..9c10bbff9 --- /dev/null +++ b/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts @@ -0,0 +1,75 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PartyAssetsQueryQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PartyAssetsQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string }, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null }; + + +export const PartyAssetsQueryDocument = gql` + query PartyAssetsQuery($partyId: ID!) { + party(id: $partyId) { + id + delegations { + amount + node { + id + name + } + epoch + } + stake { + currentStakeAvailable + } + accounts { + asset { + name + id + decimals + symbol + source { + __typename + ... on ERC20 { + contractAddress + } + } + } + type + balance + } + } +} + `; + +/** + * __usePartyAssetsQueryQuery__ + * + * To run a query within a React component, call `usePartyAssetsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyAssetsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePartyAssetsQueryQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyAssetsQueryQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PartyAssetsQueryDocument, options); + } +export function usePartyAssetsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PartyAssetsQueryDocument, options); + } +export type PartyAssetsQueryQueryHookResult = ReturnType; +export type PartyAssetsQueryLazyQueryHookResult = ReturnType; +export type PartyAssetsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/validators/Nodes.graphql b/apps/explorer/src/app/routes/validators/Nodes.graphql new file mode 100644 index 000000000..413ef2944 --- /dev/null +++ b/apps/explorer/src/app/routes/validators/Nodes.graphql @@ -0,0 +1,23 @@ +query NodesQuery { + nodes { + id + name + infoUrl + avatarUrl + pubkey + tmPubkey + ethereumAddress + location + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + epochData { + total + offline + online + } + status + name + } +} diff --git a/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts b/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts new file mode 100644 index 000000000..bf86e7858 --- /dev/null +++ b/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts @@ -0,0 +1,63 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodesQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NodesQueryQuery = { __typename?: 'Query', nodes?: Array<{ __typename?: 'Node', id: string, name: string, infoUrl: string, avatarUrl?: string | null, pubkey: string, tmPubkey: string, ethereumAddress: string, location: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, status: Types.NodeStatus, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null }> | null }; + + +export const NodesQueryDocument = gql` + query NodesQuery { + nodes { + id + name + infoUrl + avatarUrl + pubkey + tmPubkey + ethereumAddress + location + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + epochData { + total + offline + online + } + status + name + } +} + `; + +/** + * __useNodesQueryQuery__ + * + * To run a query within a React component, call `useNodesQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useNodesQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNodesQueryQuery({ + * variables: { + * }, + * }); + */ +export function useNodesQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NodesQueryDocument, options); + } +export function useNodesQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NodesQueryDocument, options); + } +export type NodesQueryQueryHookResult = ReturnType; +export type NodesQueryLazyQueryHookResult = ReturnType; +export type NodesQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/.eslintrc.json b/apps/token/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/apps/token/.eslintrc.json +++ b/apps/token/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/token/client.graphql b/apps/token/client.graphql new file mode 100644 index 000000000..137c4d621 --- /dev/null +++ b/apps/token/client.graphql @@ -0,0 +1,43 @@ +extend type Delegation { + "The amount field formatted by the client" + amountFormatted: String! +} + +extend type PartyStake { + "The currently available stake formatted by the client" + currentStakeAvailableFormatted: String! +} + +extend type NodeData { + "The total staked field formatted by the client" + stakedTotalFormatted: String! +} + +extend type Node { + "The total staked field formatted by the client" + stakedTotalFormatted: String! + + "The pending staked field formatted by the client" + pendingStakeFormatted: String! + + "The stakes by operator field formatted by the client" + stakedByOperatorFormatted: String! + + "The stakes by delegates field formatted by the client" + stakedByDelegatesFormatted: String! +} + +extend type Reward { + "The amount field formatted by the client" + amountFormatted: String! +} + +extend type RewardPerAssetDetail { + "The total amount field formatted by the client" + totalAmountFormatted: String! +} + +extend type Account { + "The balance field formatted by the client" + balanceFormatted: String! +} diff --git a/apps/token/src/components/vega-wallet/Delegations.graphql b/apps/token/src/components/vega-wallet/Delegations.graphql new file mode 100644 index 000000000..bc4f3c207 --- /dev/null +++ b/apps/token/src/components/vega-wallet/Delegations.graphql @@ -0,0 +1,37 @@ +query Delegations($partyId: ID!) { + epoch { + id + } + party(id: $partyId) { + id + delegations { + amountFormatted @client + amount + node { + id + name + } + epoch + } + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + accounts { + asset { + name + id + decimals + symbol + source { + __typename + ... on ERC20 { + contractAddress + } + } + } + type + balance + } + } +} diff --git a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts b/apps/token/src/components/vega-wallet/__generated__/Delegations.ts index 0648b1180..0392833ad 100644 --- a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts +++ b/apps/token/src/components/vega-wallet/__generated__/Delegations.ts @@ -28,6 +28,9 @@ export interface Delegations_party_delegations_node { export interface Delegations_party_delegations { __typename: "Delegation"; + /** + * The amount field formatted by the client + */ amountFormatted: string; /** * Amount delegated @@ -49,6 +52,9 @@ export interface Delegations_party_stake { * The stake currently available for the party */ currentStakeAvailable: string; + /** + * The currently available stake formatted by the client + */ currentStakeAvailableFormatted: string; } diff --git a/apps/token/src/components/vega-wallet/__generated__/PartyDelegations.ts b/apps/token/src/components/vega-wallet/__generated__/PartyDelegations.ts deleted file mode 100644 index dfcb618d6..000000000 --- a/apps/token/src/components/vega-wallet/__generated__/PartyDelegations.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL query operation: PartyDelegations -// ==================================================== - -export interface PartyDelegations_epoch { - __typename: "Epoch"; - /** - * Presumably this is an integer or something. If there's no such thing, disregard - */ - id: string; -} - -export interface PartyDelegations_party_delegations { - __typename: "Delegation"; - /** - * Amount delegated - */ - amount: string; - /** - * URL of node you are delegating to - */ - node: string; - /** - * Epoch of delegation - */ - epoch: number; -} - -export interface PartyDelegations_party { - __typename: "Party"; - delegations: PartyDelegations_party_delegations[] | null; -} - -export interface PartyDelegations { - /** - * get data for a specific epoch, if id omitted it gets the current epoch - */ - epoch: PartyDelegations_epoch; - /** - * An entity that is trading on the VEGA network - */ - party: PartyDelegations_party | null; -} - -export interface PartyDelegationsVariables { - partyId: string; -} diff --git a/apps/token/src/components/vega-wallet/__generated___/Delegations.ts b/apps/token/src/components/vega-wallet/__generated___/Delegations.ts new file mode 100644 index 000000000..5d6610ba9 --- /dev/null +++ b/apps/token/src/components/vega-wallet/__generated___/Delegations.ts @@ -0,0 +1,80 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type DelegationsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amountFormatted: string, amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stake: { __typename?: 'PartyStake', currentStakeAvailable: string, currentStakeAvailableFormatted: string }, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } }> | null } | null }; + + +export const DelegationsDocument = gql` + query Delegations($partyId: ID!) { + epoch { + id + } + party(id: $partyId) { + id + delegations { + amountFormatted @client + amount + node { + id + name + } + epoch + } + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + accounts { + asset { + name + id + decimals + symbol + source { + __typename + ... on ERC20 { + contractAddress + } + } + } + type + balance + } + } +} + `; + +/** + * __useDelegationsQuery__ + * + * To run a query within a React component, call `useDelegationsQuery` and pass it any options that fit your needs. + * When your component renders, `useDelegationsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDelegationsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useDelegationsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(DelegationsDocument, options); + } +export function useDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(DelegationsDocument, options); + } +export type DelegationsQueryHookResult = ReturnType; +export type DelegationsLazyQueryHookResult = ReturnType; +export type DelegationsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/hooks/NetworkParams.graphql b/apps/token/src/hooks/NetworkParams.graphql new file mode 100644 index 000000000..fade0b2ce --- /dev/null +++ b/apps/token/src/hooks/NetworkParams.graphql @@ -0,0 +1,6 @@ +query NetworkParams { + networkParameters { + key + value + } +} diff --git a/apps/token/src/hooks/__generated__/Erc20ApprovalPoll.ts b/apps/token/src/hooks/__generated__/Erc20ApprovalPoll.ts deleted file mode 100644 index 468c76bf9..000000000 --- a/apps/token/src/hooks/__generated__/Erc20ApprovalPoll.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL query operation: Erc20ApprovalPoll -// ==================================================== - -export interface Erc20ApprovalPoll_erc20WithdrawalApproval { - __typename: "Erc20WithdrawalApproval"; - /** - * The source asset in the ethereum network - */ - assetSource: string; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The nonce to be used in the request - */ - nonce: string; - /** - * Signature aggregate from the nodes, in the following format: - * 0x + sig1 + sig2 + ... + sigN - */ - signatures: string; - /** - * The target address which will receive the funds - */ - targetAddress: string; - /** - * Timestamp in seconds for expiry of the approval - */ - expiry: string; -} - -export interface Erc20ApprovalPoll { - /** - * find an erc20 withdrawal approval using its withdrawal id - */ - erc20WithdrawalApproval: Erc20ApprovalPoll_erc20WithdrawalApproval | null; -} - -export interface Erc20ApprovalPollVariables { - withdrawalId: string; -} diff --git a/apps/token/src/hooks/__generated__/WithdrawalPoll.ts b/apps/token/src/hooks/__generated__/WithdrawalPoll.ts deleted file mode 100644 index ba964b42e..000000000 --- a/apps/token/src/hooks/__generated__/WithdrawalPoll.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { WithdrawalStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL query operation: WithdrawalPoll -// ==================================================== - -export interface WithdrawalPoll_party_withdrawals_asset { - __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 WithdrawalPoll_party_withdrawals_details { - __typename: "Erc20WithdrawalDetails"; - /** - * The ethereum address of the receiver of the asset funds - */ - receiverAddress: string; -} - -export interface WithdrawalPoll_party_withdrawals { - __typename: "Withdrawal"; - /** - * The Vega internal id of the withdrawal - */ - id: string; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The current status of the withdrawal - */ - status: WithdrawalStatus; - /** - * The asset to be withdrawn - */ - asset: WithdrawalPoll_party_withdrawals_asset; - /** - * RFC3339Nano time at which the withdrawal was created - */ - createdTimestamp: string; - /** - * RFC3339Nano time at which the withdrawal was finalized - */ - withdrawnTimestamp: string | null; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; - /** - * Foreign chain specific details about the withdrawal - */ - details: WithdrawalPoll_party_withdrawals_details | null; -} - -export interface WithdrawalPoll_party { - __typename: "Party"; - /** - * Party identifier - */ - id: string; - /** - * The list of all withdrawals initiated by the party - */ - withdrawals: WithdrawalPoll_party_withdrawals[] | null; -} - -export interface WithdrawalPoll { - /** - * An entity that is trading on the VEGA network - */ - party: WithdrawalPoll_party | null; -} - -export interface WithdrawalPollVariables { - partyId: string; -} diff --git a/apps/token/src/hooks/__generated___/NetworkParams.ts b/apps/token/src/hooks/__generated___/NetworkParams.ts new file mode 100644 index 000000000..1208760a1 --- /dev/null +++ b/apps/token/src/hooks/__generated___/NetworkParams.ts @@ -0,0 +1,46 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NetworkParamsQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NetworkParamsQuery = { __typename?: 'Query', networkParameters?: Array<{ __typename?: 'NetworkParameter', key: string, value: string }> | null }; + + +export const NetworkParamsDocument = gql` + query NetworkParams { + networkParameters { + key + value + } +} + `; + +/** + * __useNetworkParamsQuery__ + * + * To run a query within a React component, call `useNetworkParamsQuery` and pass it any options that fit your needs. + * When your component renders, `useNetworkParamsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNetworkParamsQuery({ + * variables: { + * }, + * }); + */ +export function useNetworkParamsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NetworkParamsDocument, options); + } +export function useNetworkParamsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NetworkParamsDocument, options); + } +export type NetworkParamsQueryHookResult = ReturnType; +export type NetworkParamsLazyQueryHookResult = ReturnType; +export type NetworkParamsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/governance/Proposal.graphql b/apps/token/src/routes/governance/Proposal.graphql new file mode 100644 index 000000000..f792a2c04 --- /dev/null +++ b/apps/token/src/routes/governance/Proposal.graphql @@ -0,0 +1,96 @@ +fragment ProposalFields on Proposal { + id + reference + state + datetime + rejectionReason + errorDetails + party { + id + } + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + decimalPlaces + metadata + instrument { + name + code + futureProduct { + settlementAsset { + symbol + } + } + } + } + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + name + symbol + source { + ... on BuiltinAsset { + __typename + maxFaucetAmountMint + } + ... on ERC20 { + __typename + contractAddress + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + } + } + votes { + yes { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + no { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + } +} + +query Proposal($proposalId: ID!) { + proposal(id: $proposalId) { + ...ProposalFields + } +} + +query Proposals { + proposals { + ...ProposalFields + } +} diff --git a/apps/token/src/routes/governance/__generated___/Proposal.ts b/apps/token/src/routes/governance/__generated___/Proposal.ts new file mode 100644 index 000000000..29e37bd12 --- /dev/null +++ b/apps/token/src/routes/governance/__generated___/Proposal.ts @@ -0,0 +1,174 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', name: string, symbol: string, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } }; + +export type ProposalQueryVariables = Types.Exact<{ + proposalId: Types.Scalars['ID']; +}>; + + +export type ProposalQuery = { __typename?: 'Query', proposal: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', name: string, symbol: string, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } } }; + +export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type ProposalsQuery = { __typename?: 'Query', proposals?: Array<{ __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', name: string, symbol: string, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string } } }> | null } } }> | null }; + +export const ProposalFieldsFragmentDoc = gql` + fragment ProposalFields on Proposal { + id + reference + state + datetime + rejectionReason + errorDetails + party { + id + } + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + decimalPlaces + metadata + instrument { + name + code + futureProduct { + settlementAsset { + symbol + } + } + } + } + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + name + symbol + source { + ... on BuiltinAsset { + __typename + maxFaucetAmountMint + } + ... on ERC20 { + __typename + contractAddress + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + } + } + votes { + yes { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + no { + totalTokens + totalNumber + votes { + value + party { + id + stake { + currentStakeAvailable + } + } + datetime + } + } + } +} + `; +export const ProposalDocument = gql` + query Proposal($proposalId: ID!) { + proposal(id: $proposalId) { + ...ProposalFields + } +} + ${ProposalFieldsFragmentDoc}`; + +/** + * __useProposalQuery__ + * + * To run a query within a React component, call `useProposalQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalQuery({ + * variables: { + * proposalId: // value for 'proposalId' + * }, + * }); + */ +export function useProposalQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(ProposalDocument, options); + } +export function useProposalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(ProposalDocument, options); + } +export type ProposalQueryHookResult = ReturnType; +export type ProposalLazyQueryHookResult = ReturnType; +export type ProposalQueryResult = Apollo.QueryResult; +export const ProposalsDocument = gql` + query Proposals { + proposals { + ...ProposalFields + } +} + ${ProposalFieldsFragmentDoc}`; + +/** + * __useProposalsQuery__ + * + * To run a query within a React component, call `useProposalsQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalsQuery({ + * variables: { + * }, + * }); + */ +export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(ProposalsDocument, options); + } +export function useProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(ProposalsDocument, options); + } +export type ProposalsQueryHookResult = ReturnType; +export type ProposalsLazyQueryHookResult = ReturnType; +export type ProposalsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/governance/components/vote-details/Stake.graphql b/apps/token/src/routes/governance/components/vote-details/Stake.graphql new file mode 100644 index 000000000..62a50c5d0 --- /dev/null +++ b/apps/token/src/routes/governance/components/vote-details/Stake.graphql @@ -0,0 +1,9 @@ +query VoteButtons($partyId: ID!) { + party(id: $partyId) { + id + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + } +} diff --git a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts index c15e858c8..094fd9d4d 100644 --- a/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts +++ b/apps/token/src/routes/governance/components/vote-details/__generated__/VoteButtons.ts @@ -13,6 +13,9 @@ export interface VoteButtons_party_stake { * The stake currently available for the party */ currentStakeAvailable: string; + /** + * The currently available stake formatted by the client + */ currentStakeAvailableFormatted: string; } diff --git a/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts b/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts new file mode 100644 index 000000000..aa930de95 --- /dev/null +++ b/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts @@ -0,0 +1,52 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type VoteButtonsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type VoteButtonsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string, currentStakeAvailableFormatted: string } } | null }; + + +export const VoteButtonsDocument = gql` + query VoteButtons($partyId: ID!) { + party(id: $partyId) { + id + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + } +} + `; + +/** + * __useVoteButtonsQuery__ + * + * To run a query within a React component, call `useVoteButtonsQuery` and pass it any options that fit your needs. + * When your component renders, `useVoteButtonsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useVoteButtonsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useVoteButtonsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(VoteButtonsDocument, options); + } +export function useVoteButtonsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(VoteButtonsDocument, options); + } +export type VoteButtonsQueryHookResult = ReturnType; +export type VoteButtonsLazyQueryHookResult = ReturnType; +export type VoteButtonsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/home/NodeData.graphql b/apps/token/src/routes/home/NodeData.graphql new file mode 100644 index 000000000..a7f45f0c5 --- /dev/null +++ b/apps/token/src/routes/home/NodeData.graphql @@ -0,0 +1,6 @@ +query NodeData { + nodeData { + stakedTotal + stakedTotalFormatted @client + } +} diff --git a/apps/token/src/routes/home/__generated__/NodeData.ts b/apps/token/src/routes/home/__generated__/NodeData.ts index 2aa7a6ccd..87c202515 100644 --- a/apps/token/src/routes/home/__generated__/NodeData.ts +++ b/apps/token/src/routes/home/__generated__/NodeData.ts @@ -13,6 +13,9 @@ export interface NodeData_nodeData { * Total staked amount across all nodes */ stakedTotal: string; + /** + * The total staked field formatted by the client + */ stakedTotalFormatted: string; } diff --git a/apps/token/src/routes/home/__generated___/NodeData.ts b/apps/token/src/routes/home/__generated___/NodeData.ts new file mode 100644 index 000000000..b2bc06f54 --- /dev/null +++ b/apps/token/src/routes/home/__generated___/NodeData.ts @@ -0,0 +1,46 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NodeDataQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string } | null }; + + +export const NodeDataDocument = gql` + query NodeData { + nodeData { + stakedTotal + stakedTotalFormatted @client + } +} + `; + +/** + * __useNodeDataQuery__ + * + * To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs. + * When your component renders, `useNodeDataQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNodeDataQuery({ + * variables: { + * }, + * }); + */ +export function useNodeDataQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NodeDataDocument, options); + } +export function useNodeDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NodeDataDocument, options); + } +export type NodeDataQueryHookResult = ReturnType; +export type NodeDataLazyQueryHookResult = ReturnType; +export type NodeDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/rewards/home/Rewards.graphql b/apps/token/src/routes/rewards/home/Rewards.graphql new file mode 100644 index 000000000..c847f6573 --- /dev/null +++ b/apps/token/src/routes/rewards/home/Rewards.graphql @@ -0,0 +1,42 @@ +query Rewards($partyId: ID!) { + party(id: $partyId) { + id + rewardDetails { + asset { + id + symbol + } + rewards { + rewardType + asset { + id + } + party { + id + } + epoch { + id + } + amount + amountFormatted @client + percentageOfTotal + receivedAt + } + totalAmount + totalAmountFormatted @client + } + delegations { + amount + amountFormatted @client + epoch + } + } + epoch { + id + timestamps { + start + end + expiry + } + } +} diff --git a/apps/token/src/routes/rewards/home/__generated__/Epoch.ts b/apps/token/src/routes/rewards/home/__generated__/Epoch.ts deleted file mode 100644 index a9410c6e9..000000000 --- a/apps/token/src/routes/rewards/home/__generated__/Epoch.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL query operation: Epoch -// ==================================================== - -export interface Epoch_epoch_timestamps { - __typename: "EpochTimestamps"; - /** - * RFC3339 timestamp - Vega time of epoch start, null if not started - */ - start: string | null; - /** - * RFC3339 timestamp - Vega time of epoch end, null if not ended - */ - end: string | null; - /** - * RFC3339 timestamp - Vega time of epoch expiry - */ - expiry: string | null; -} - -export interface Epoch_epoch { - __typename: "Epoch"; - /** - * Presumably this is an integer or something. If there's no such thing, disregard - */ - id: string; - /** - * Timestamps for start/end etc - */ - timestamps: Epoch_epoch_timestamps; -} - -export interface Epoch { - /** - * get data for a specific epoch, if id omitted it gets the current epoch - */ - epoch: Epoch_epoch; -} diff --git a/apps/token/src/routes/rewards/home/__generated__/Rewards.ts b/apps/token/src/routes/rewards/home/__generated__/Rewards.ts index 63d4cb34a..3d659de4d 100644 --- a/apps/token/src/routes/rewards/home/__generated__/Rewards.ts +++ b/apps/token/src/routes/rewards/home/__generated__/Rewards.ts @@ -67,6 +67,9 @@ export interface Rewards_party_rewardDetails_rewards { * Amount received for this reward */ amount: string; + /** + * The amount field formatted by the client + */ amountFormatted: string; /** * Percentage out of the total distributed reward @@ -92,6 +95,9 @@ export interface Rewards_party_rewardDetails { * The total amount of rewards received for this asset. */ totalAmount: string; + /** + * The total amount field formatted by the client + */ totalAmountFormatted: string; } @@ -101,6 +107,9 @@ export interface Rewards_party_delegations { * Amount delegated */ amount: string; + /** + * The amount field formatted by the client + */ amountFormatted: string; /** * Epoch of delegation diff --git a/apps/token/src/routes/rewards/home/__generated___/Rewards.ts b/apps/token/src/routes/rewards/home/__generated___/Rewards.ts new file mode 100644 index 000000000..c39358064 --- /dev/null +++ b/apps/token/src/routes/rewards/home/__generated___/Rewards.ts @@ -0,0 +1,85 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type RewardsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type RewardsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, rewardDetails?: Array<{ __typename?: 'RewardPerAssetDetail', totalAmount: string, totalAmountFormatted: string, asset: { __typename?: 'Asset', id: string, symbol: string }, rewards?: Array<{ __typename?: 'Reward', rewardType: Types.AccountType, amount: string, amountFormatted: string, percentageOfTotal: string, receivedAt: string, asset: { __typename?: 'Asset', id: string }, party: { __typename?: 'Party', id: string }, epoch: { __typename?: 'Epoch', id: string } } | null> | null } | null> | null, delegations?: Array<{ __typename?: 'Delegation', amount: string, amountFormatted: string, epoch: number }> | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: string | null, end?: string | null, expiry?: string | null } } }; + + +export const RewardsDocument = gql` + query Rewards($partyId: ID!) { + party(id: $partyId) { + id + rewardDetails { + asset { + id + symbol + } + rewards { + rewardType + asset { + id + } + party { + id + } + epoch { + id + } + amount + amountFormatted @client + percentageOfTotal + receivedAt + } + totalAmount + totalAmountFormatted @client + } + delegations { + amount + amountFormatted @client + epoch + } + } + epoch { + id + timestamps { + start + end + expiry + } + } +} + `; + +/** + * __useRewardsQuery__ + * + * To run a query within a React component, call `useRewardsQuery` and pass it any options that fit your needs. + * When your component renders, `useRewardsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useRewardsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useRewardsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(RewardsDocument, options); + } +export function useRewardsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(RewardsDocument, options); + } +export type RewardsQueryHookResult = ReturnType; +export type RewardsLazyQueryHookResult = ReturnType; +export type RewardsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/Nodes.graphql b/apps/token/src/routes/staking/Nodes.graphql new file mode 100644 index 000000000..7c00c9bab --- /dev/null +++ b/apps/token/src/routes/staking/Nodes.graphql @@ -0,0 +1,23 @@ +query Nodes { + nodes { + avatarUrl + id + name + pubkey + stakedTotal + stakedTotalFormatted @client + pendingStake + pendingStakeFormatted @client + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + status + } + } + nodeData { + stakedTotal + stakedTotalFormatted @client + } +} diff --git a/apps/token/src/routes/staking/PartyDelegations.graphql b/apps/token/src/routes/staking/PartyDelegations.graphql new file mode 100644 index 000000000..c083a9a40 --- /dev/null +++ b/apps/token/src/routes/staking/PartyDelegations.graphql @@ -0,0 +1,16 @@ +query PartyDelegations($partyId: ID!) { + party(id: $partyId) { + id + delegations { + amount + amountFormatted @client + node { + id + } + epoch + } + } + epoch { + id + } +} diff --git a/apps/token/src/routes/staking/Staking.graphql b/apps/token/src/routes/staking/Staking.graphql new file mode 100644 index 000000000..e12befdff --- /dev/null +++ b/apps/token/src/routes/staking/Staking.graphql @@ -0,0 +1,62 @@ +query Staking($partyId: ID!) { + party(id: $partyId) { + id + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + delegations { + amount + amountFormatted @client + epoch + node { + id + } + } + } + epoch { + id + timestamps { + start + end + expiry + } + } + nodes { + id + name + pubkey + infoUrl + location + ethereumAddress + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + stakedByOperatorFormatted @client + stakedByDelegatesFormatted @client + stakedTotalFormatted @client + pendingStakeFormatted @client + epochData { + total + offline + online + } + status + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + stakeScore + } + } + nodeData { + stakedTotal + stakedTotalFormatted @client + totalNodes + inactiveNodes + validatingNodes + uptime + } +} diff --git a/apps/token/src/routes/staking/__generated__/Nodes.ts b/apps/token/src/routes/staking/__generated__/Nodes.ts index 3c08e0f34..1cb2737bf 100644 --- a/apps/token/src/routes/staking/__generated__/Nodes.ts +++ b/apps/token/src/routes/staking/__generated__/Nodes.ts @@ -49,11 +49,17 @@ export interface Nodes_nodes { * Total amount staked on node */ stakedTotal: string; + /** + * The total staked field formatted by the client + */ stakedTotalFormatted: string; /** * Amount of stake on the next epoch */ pendingStake: string; + /** + * The pending staked field formatted by the client + */ pendingStakeFormatted: string; /** * Ranking scores and status for the validator for the current epoch @@ -67,6 +73,9 @@ export interface Nodes_nodeData { * Total staked amount across all nodes */ stakedTotal: string; + /** + * The total staked field formatted by the client + */ stakedTotalFormatted: string; } diff --git a/apps/token/src/routes/staking/__generated__/PartyDelegations.ts b/apps/token/src/routes/staking/__generated__/PartyDelegations.ts index ff1d7c7d3..c6a3ed4fe 100644 --- a/apps/token/src/routes/staking/__generated__/PartyDelegations.ts +++ b/apps/token/src/routes/staking/__generated__/PartyDelegations.ts @@ -21,6 +21,9 @@ export interface PartyDelegations_party_delegations { * Amount delegated */ amount: string; + /** + * The amount field formatted by the client + */ amountFormatted: string; /** * URL of node you are delegating to diff --git a/apps/token/src/routes/staking/__generated__/Staking.ts b/apps/token/src/routes/staking/__generated__/Staking.ts index 506f1f57b..d796170fe 100644 --- a/apps/token/src/routes/staking/__generated__/Staking.ts +++ b/apps/token/src/routes/staking/__generated__/Staking.ts @@ -15,6 +15,9 @@ export interface Staking_party_stake { * The stake currently available for the party */ currentStakeAvailable: string; + /** + * The currently available stake formatted by the client + */ currentStakeAvailableFormatted: string; } @@ -32,6 +35,9 @@ export interface Staking_party_delegations { * Amount delegated */ amount: string; + /** + * The amount field formatted by the client + */ amountFormatted: string; /** * Epoch of delegation @@ -159,9 +165,21 @@ export interface Staking_nodes { * Amount of stake on the next epoch */ pendingStake: string; + /** + * The stakes by operator field formatted by the client + */ stakedByOperatorFormatted: string; + /** + * The stakes by delegates field formatted by the client + */ stakedByDelegatesFormatted: string; + /** + * The total staked field formatted by the client + */ stakedTotalFormatted: string; + /** + * The pending staked field formatted by the client + */ pendingStakeFormatted: string; epochData: Staking_nodes_epochData | null; status: NodeStatus; @@ -177,6 +195,9 @@ export interface Staking_nodeData { * Total staked amount across all nodes */ stakedTotal: string; + /** + * The total staked field formatted by the client + */ stakedTotalFormatted: string; /** * Total number of nodes diff --git a/apps/token/src/routes/staking/__generated___/Nodes.ts b/apps/token/src/routes/staking/__generated___/Nodes.ts new file mode 100644 index 000000000..c51582125 --- /dev/null +++ b/apps/token/src/routes/staking/__generated___/Nodes.ts @@ -0,0 +1,63 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodesQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NodesQuery = { __typename?: 'Query', nodes?: Array<{ __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedTotal: string, stakedTotalFormatted: string, pendingStake: string, pendingStakeFormatted: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } }> | null, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string } | null }; + + +export const NodesDocument = gql` + query Nodes { + nodes { + avatarUrl + id + name + pubkey + stakedTotal + stakedTotalFormatted @client + pendingStake + pendingStakeFormatted @client + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + status + } + } + nodeData { + stakedTotal + stakedTotalFormatted @client + } +} + `; + +/** + * __useNodesQuery__ + * + * To run a query within a React component, call `useNodesQuery` and pass it any options that fit your needs. + * When your component renders, `useNodesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNodesQuery({ + * variables: { + * }, + * }); + */ +export function useNodesQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NodesDocument, options); + } +export function useNodesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NodesDocument, options); + } +export type NodesQueryHookResult = ReturnType; +export type NodesLazyQueryHookResult = ReturnType; +export type NodesQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/__generated___/PartyDelegations.ts b/apps/token/src/routes/staking/__generated___/PartyDelegations.ts new file mode 100644 index 000000000..71ee9e4f9 --- /dev/null +++ b/apps/token/src/routes/staking/__generated___/PartyDelegations.ts @@ -0,0 +1,59 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PartyDelegationsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PartyDelegationsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amount: string, amountFormatted: string, epoch: number, node: { __typename?: 'Node', id: string } }> | null } | null, epoch: { __typename?: 'Epoch', id: string } }; + + +export const PartyDelegationsDocument = gql` + query PartyDelegations($partyId: ID!) { + party(id: $partyId) { + id + delegations { + amount + amountFormatted @client + node { + id + } + epoch + } + } + epoch { + id + } +} + `; + +/** + * __usePartyDelegationsQuery__ + * + * To run a query within a React component, call `usePartyDelegationsQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyDelegationsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePartyDelegationsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyDelegationsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PartyDelegationsDocument, options); + } +export function usePartyDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PartyDelegationsDocument, options); + } +export type PartyDelegationsQueryHookResult = ReturnType; +export type PartyDelegationsLazyQueryHookResult = ReturnType; +export type PartyDelegationsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/__generated___/Staking.ts b/apps/token/src/routes/staking/__generated___/Staking.ts new file mode 100644 index 000000000..af5b483fc --- /dev/null +++ b/apps/token/src/routes/staking/__generated___/Staking.ts @@ -0,0 +1,105 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type StakingQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type StakingQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', currentStakeAvailable: string, currentStakeAvailableFormatted: string }, delegations?: Array<{ __typename?: 'Delegation', amount: string, amountFormatted: string, epoch: number, node: { __typename?: 'Node', id: string } }> | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: string | null, end?: string | null, expiry?: string | null } }, nodes?: Array<{ __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, stakedByOperatorFormatted: string, stakedByDelegatesFormatted: string, stakedTotalFormatted: string, pendingStakeFormatted: string, status: Types.NodeStatus, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string } }> | null, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string, totalNodes: number, inactiveNodes: number, validatingNodes: number, uptime: number } | null }; + + +export const StakingDocument = gql` + query Staking($partyId: ID!) { + party(id: $partyId) { + id + stake { + currentStakeAvailable + currentStakeAvailableFormatted @client + } + delegations { + amount + amountFormatted @client + epoch + node { + id + } + } + } + epoch { + id + timestamps { + start + end + expiry + } + } + nodes { + id + name + pubkey + infoUrl + location + ethereumAddress + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + stakedByOperatorFormatted @client + stakedByDelegatesFormatted @client + stakedTotalFormatted @client + pendingStakeFormatted @client + epochData { + total + offline + online + } + status + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + stakeScore + } + } + nodeData { + stakedTotal + stakedTotalFormatted @client + totalNodes + inactiveNodes + validatingNodes + uptime + } +} + `; + +/** + * __useStakingQuery__ + * + * To run a query within a React component, call `useStakingQuery` and pass it any options that fit your needs. + * When your component renders, `useStakingQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useStakingQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useStakingQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(StakingDocument, options); + } +export function useStakingLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(StakingDocument, options); + } +export type StakingQueryHookResult = ReturnType; +export type StakingLazyQueryHookResult = ReturnType; +export type StakingQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql b/apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql new file mode 100644 index 000000000..2f236a0b1 --- /dev/null +++ b/apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql @@ -0,0 +1,12 @@ +query PartyStakeLinkings($partyId: ID!) { + party(id: $partyId) { + id + stake { + linkings { + id + txHash + status + } + } + } +} diff --git a/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts b/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts new file mode 100644 index 000000000..48dd96edc --- /dev/null +++ b/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts @@ -0,0 +1,55 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PartyStakeLinkingsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PartyStakeLinkingsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stake: { __typename?: 'PartyStake', linkings?: Array<{ __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus }> | null } } | null }; + + +export const PartyStakeLinkingsDocument = gql` + query PartyStakeLinkings($partyId: ID!) { + party(id: $partyId) { + id + stake { + linkings { + id + txHash + status + } + } + } +} + `; + +/** + * __usePartyStakeLinkingsQuery__ + * + * To run a query within a React component, call `usePartyStakeLinkingsQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyStakeLinkingsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePartyStakeLinkingsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyStakeLinkingsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PartyStakeLinkingsDocument, options); + } +export function usePartyStakeLinkingsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PartyStakeLinkingsDocument, options); + } +export type PartyStakeLinkingsQueryHookResult = ReturnType; +export type PartyStakeLinkingsLazyQueryHookResult = ReturnType; +export type PartyStakeLinkingsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/trading/.eslintrc.json b/apps/trading/.eslintrc.json index bc7243829..4219c80ff 100644 --- a/apps/trading/.eslintrc.json +++ b/apps/trading/.eslintrc.json @@ -5,7 +5,7 @@ "next", "next/core-web-vitals" ], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/apps/trading/pages/markets/Market.graphql b/apps/trading/pages/markets/Market.graphql new file mode 100644 index 000000000..32c296d05 --- /dev/null +++ b/apps/trading/pages/markets/Market.graphql @@ -0,0 +1,59 @@ +query Market($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + name + tradingMode + state + decimalPlaces + positionDecimalPlaces + data { + market { + id + } + auctionStart + auctionEnd + markPrice + indicativeVolume + indicativePrice + suppliedStake + targetStake + bestBidVolume + bestOfferVolume + bestStaticBidVolume + bestStaticOfferVolume + trigger + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + oracleSpecForTradingTermination { + id + } + quoteName + settlementAsset { + id + symbol + name + } + } + } + } + } + marketTimestamps { + open + close + } + candles(interval: $interval, since: $since) { + open + close + volume + } + } +} diff --git a/apps/trading/pages/markets/__generated___/Market.ts b/apps/trading/pages/markets/__generated___/Market.ts new file mode 100644 index 000000000..dc98077fa --- /dev/null +++ b/apps/trading/pages/markets/__generated___/Market.ts @@ -0,0 +1,106 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; + since: Types.Scalars['String']; +}>; + + +export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, tradingMode: Types.MarketTradingMode, state: Types.MarketState, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', auctionStart?: string | null, auctionEnd?: string | null, markPrice: string, indicativeVolume: string, indicativePrice: string, suppliedStake?: string | null, targetStake?: string | null, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, volume: string } | null> | null } | null }; + + +export const MarketDocument = gql` + query Market($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + name + tradingMode + state + decimalPlaces + positionDecimalPlaces + data { + market { + id + } + auctionStart + auctionEnd + markPrice + indicativeVolume + indicativePrice + suppliedStake + targetStake + bestBidVolume + bestOfferVolume + bestStaticBidVolume + bestStaticOfferVolume + trigger + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + oracleSpecForTradingTermination { + id + } + quoteName + settlementAsset { + id + symbol + name + } + } + } + } + } + marketTimestamps { + open + close + } + candles(interval: $interval, since: $since) { + open + close + volume + } + } +} + `; + +/** + * __useMarketQuery__ + * + * To run a query within a React component, call `useMarketQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketQuery({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * since: // value for 'since' + * }, + * }); + */ +export function useMarketQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketDocument, options); + } +export function useMarketLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketDocument, options); + } +export type MarketQueryHookResult = ReturnType; +export type MarketLazyQueryHookResult = ReturnType; +export type MarketQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/trading/pages/portfolio/deposit/Deposit.graphql b/apps/trading/pages/portfolio/deposit/Deposit.graphql new file mode 100644 index 000000000..e004bf2f6 --- /dev/null +++ b/apps/trading/pages/portfolio/deposit/Deposit.graphql @@ -0,0 +1,17 @@ +query DepositPage { + assetsConnection { + edges { + node { + id + symbol + name + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} diff --git a/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts b/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts new file mode 100644 index 000000000..7157ef251 --- /dev/null +++ b/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts @@ -0,0 +1,57 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type DepositPageQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type DepositPageQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } }; + + +export const DepositPageDocument = gql` + query DepositPage { + assetsConnection { + edges { + node { + id + symbol + name + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} + `; + +/** + * __useDepositPageQuery__ + * + * To run a query within a React component, call `useDepositPageQuery` and pass it any options that fit your needs. + * When your component renders, `useDepositPageQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDepositPageQuery({ + * variables: { + * }, + * }); + */ +export function useDepositPageQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(DepositPageDocument, options); + } +export function useDepositPageLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(DepositPageDocument, options); + } +export type DepositPageQueryHookResult = ReturnType; +export type DepositPageLazyQueryHookResult = ReturnType; +export type DepositPageQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/accounts/.eslintrc.json b/libs/accounts/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/accounts/.eslintrc.json +++ b/libs/accounts/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/accounts/src/lib/Accounts.graphql b/libs/accounts/src/lib/Accounts.graphql new file mode 100644 index 000000000..c2b7da82c --- /dev/null +++ b/libs/accounts/src/lib/Accounts.graphql @@ -0,0 +1,34 @@ +fragment AccountFields on Account { + type + balance + market { + id + name + } + asset { + id + symbol + decimals + } +} + +query Accounts($partyId: ID!) { + party(id: $partyId) { + id + accountsConnection { + edges { + node { + type + balance + } + } + } + } +} + +subscription AccountSubscribe($partyId: ID!) { + accounts(partyId: $partyId) { + type + balance + } +} diff --git a/libs/accounts/src/lib/__generated__/index.ts b/libs/accounts/src/lib/__generated__/index.ts deleted file mode 100644 index 8d304cb35..000000000 --- a/libs/accounts/src/lib/__generated__/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './AccountFields'; -export * from './AccountSubscribe'; -export * from './Accounts'; diff --git a/libs/accounts/src/lib/__generated___/Accounts.ts b/libs/accounts/src/lib/__generated___/Accounts.ts new file mode 100644 index 000000000..92e6e678f --- /dev/null +++ b/libs/accounts/src/lib/__generated___/Accounts.ts @@ -0,0 +1,110 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, name: string } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; + +export type AccountsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accountsConnection: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'Account', type: Types.AccountType, balance: string } } | null> | null } } | null }; + +export type AccountSubscribeSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type AccountSubscribeSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string } }; + +export const AccountFieldsFragmentDoc = gql` + fragment AccountFields on Account { + type + balance + market { + id + name + } + asset { + id + symbol + decimals + } +} + `; +export const AccountsDocument = gql` + query Accounts($partyId: ID!) { + party(id: $partyId) { + id + accountsConnection { + edges { + node { + type + balance + } + } + } + } +} + `; + +/** + * __useAccountsQuery__ + * + * To run a query within a React component, call `useAccountsQuery` and pass it any options that fit your needs. + * When your component renders, `useAccountsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAccountsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useAccountsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(AccountsDocument, options); + } +export function useAccountsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(AccountsDocument, options); + } +export type AccountsQueryHookResult = ReturnType; +export type AccountsLazyQueryHookResult = ReturnType; +export type AccountsQueryResult = Apollo.QueryResult; +export const AccountSubscribeDocument = gql` + subscription AccountSubscribe($partyId: ID!) { + accounts(partyId: $partyId) { + type + balance + } +} + `; + +/** + * __useAccountSubscribeSubscription__ + * + * To run a query within a React component, call `useAccountSubscribeSubscription` and pass it any options that fit your needs. + * When your component renders, `useAccountSubscribeSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAccountSubscribeSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useAccountSubscribeSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(AccountSubscribeDocument, options); + } +export type AccountSubscribeSubscriptionHookResult = ReturnType; +export type AccountSubscribeSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/accounts/src/lib/index.ts b/libs/accounts/src/lib/index.ts index 58ebfe888..867400896 100644 --- a/libs/accounts/src/lib/index.ts +++ b/libs/accounts/src/lib/index.ts @@ -1,4 +1,6 @@ -export * from './__generated__'; +export * from './__generated__/Accounts'; +export * from './__generated__/AccountFields'; +export * from './__generated__/AccountSubscribe'; export * from './accounts-container'; export * from './accounts-data-provider'; export * from './accounts-manager'; diff --git a/libs/assets/.eslintrc.json b/libs/assets/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/assets/.eslintrc.json +++ b/libs/assets/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/assets/src/lib/Assets.graphql b/libs/assets/src/lib/Assets.graphql new file mode 100644 index 000000000..996835bfd --- /dev/null +++ b/libs/assets/src/lib/Assets.graphql @@ -0,0 +1,20 @@ +query AssetsConnection { + assetsConnection { + edges { + node { + id + name + symbol + decimals + quantum + source { + ... on ERC20 { + contractAddress + lifetimeLimit + withdrawThreshold + } + } + } + } + } +} diff --git a/libs/assets/src/lib/__generated___/Assets.ts b/libs/assets/src/lib/__generated___/Assets.ts new file mode 100644 index 000000000..a59ce11a4 --- /dev/null +++ b/libs/assets/src/lib/__generated___/Assets.ts @@ -0,0 +1,60 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type AssetsConnectionQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type AssetsConnectionQuery = { __typename?: 'Query', assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } | null> | null } }; + + +export const AssetsConnectionDocument = gql` + query AssetsConnection { + assetsConnection { + edges { + node { + id + name + symbol + decimals + quantum + source { + ... on ERC20 { + contractAddress + lifetimeLimit + withdrawThreshold + } + } + } + } + } +} + `; + +/** + * __useAssetsConnectionQuery__ + * + * To run a query within a React component, call `useAssetsConnectionQuery` and pass it any options that fit your needs. + * When your component renders, `useAssetsConnectionQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAssetsConnectionQuery({ + * variables: { + * }, + * }); + */ +export function useAssetsConnectionQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(AssetsConnectionDocument, options); + } +export function useAssetsConnectionLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(AssetsConnectionDocument, options); + } +export type AssetsConnectionQueryHookResult = ReturnType; +export type AssetsConnectionLazyQueryHookResult = ReturnType; +export type AssetsConnectionQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/assets/src/lib/index.ts b/libs/assets/src/lib/index.ts index 2fca25b42..513d2726b 100644 --- a/libs/assets/src/lib/index.ts +++ b/libs/assets/src/lib/index.ts @@ -1 +1,2 @@ +export * from './__generated__/AssetsConnection'; export * from './asset-details-dialog'; diff --git a/libs/candles-chart/.eslintrc.json b/libs/candles-chart/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/candles-chart/.eslintrc.json +++ b/libs/candles-chart/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/candles-chart/src/lib/Candles.graphql b/libs/candles-chart/src/lib/Candles.graphql new file mode 100644 index 000000000..931453460 --- /dev/null +++ b/libs/candles-chart/src/lib/Candles.graphql @@ -0,0 +1,31 @@ +fragment CandleFields on Candle { + datetime + high + low + open + close + volume +} + +query Candles($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + decimalPlaces + tradableInstrument { + instrument { + id + name + code + } + } + candles(interval: $interval, since: $since) { + ...CandleFields + } + } +} + +subscription CandlesSub($marketId: ID!, $interval: Interval!) { + candles(marketId: $marketId, interval: $interval) { + ...CandleFields + } +} diff --git a/libs/candles-chart/src/lib/Chart.graphql b/libs/candles-chart/src/lib/Chart.graphql new file mode 100644 index 000000000..217f05ba6 --- /dev/null +++ b/libs/candles-chart/src/lib/Chart.graphql @@ -0,0 +1,12 @@ +query Chart($marketId: ID!) { + market(id: $marketId) { + decimalPlaces + data { + priceMonitoringBounds { + minValidPrice + maxValidPrice + referencePrice + } + } + } +} diff --git a/libs/candles-chart/src/lib/__generated__/index.ts b/libs/candles-chart/src/lib/__generated__/index.ts deleted file mode 100644 index fe793f3c2..000000000 --- a/libs/candles-chart/src/lib/__generated__/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './CandleFields'; -export * from './Candles'; -export * from './CandlesSub'; -export * from './Chart'; diff --git a/libs/candles-chart/src/lib/__generated___/Candles.ts b/libs/candles-chart/src/lib/__generated___/Candles.ts new file mode 100644 index 000000000..bceb3114d --- /dev/null +++ b/libs/candles-chart/src/lib/__generated___/Candles.ts @@ -0,0 +1,113 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string }; + +export type CandlesQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; + since: Types.Scalars['String']; +}>; + + +export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null }; + +export type CandlesSubSubscriptionVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; +}>; + + +export type CandlesSubSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } }; + +export const CandleFieldsFragmentDoc = gql` + fragment CandleFields on Candle { + datetime + high + low + open + close + volume +} + `; +export const CandlesDocument = gql` + query Candles($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + decimalPlaces + tradableInstrument { + instrument { + id + name + code + } + } + candles(interval: $interval, since: $since) { + ...CandleFields + } + } +} + ${CandleFieldsFragmentDoc}`; + +/** + * __useCandlesQuery__ + * + * To run a query within a React component, call `useCandlesQuery` and pass it any options that fit your needs. + * When your component renders, `useCandlesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useCandlesQuery({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * since: // value for 'since' + * }, + * }); + */ +export function useCandlesQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(CandlesDocument, options); + } +export function useCandlesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(CandlesDocument, options); + } +export type CandlesQueryHookResult = ReturnType; +export type CandlesLazyQueryHookResult = ReturnType; +export type CandlesQueryResult = Apollo.QueryResult; +export const CandlesSubDocument = gql` + subscription CandlesSub($marketId: ID!, $interval: Interval!) { + candles(marketId: $marketId, interval: $interval) { + ...CandleFields + } +} + ${CandleFieldsFragmentDoc}`; + +/** + * __useCandlesSubSubscription__ + * + * To run a query within a React component, call `useCandlesSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useCandlesSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useCandlesSubSubscription({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * }, + * }); + */ +export function useCandlesSubSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(CandlesSubDocument, options); + } +export type CandlesSubSubscriptionHookResult = ReturnType; +export type CandlesSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/__generated___/Chart.ts b/libs/candles-chart/src/lib/__generated___/Chart.ts new file mode 100644 index 000000000..4e1b09874 --- /dev/null +++ b/libs/candles-chart/src/lib/__generated___/Chart.ts @@ -0,0 +1,55 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ChartQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type ChartQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string }> | null } | null } | null }; + + +export const ChartDocument = gql` + query Chart($marketId: ID!) { + market(id: $marketId) { + decimalPlaces + data { + priceMonitoringBounds { + minValidPrice + maxValidPrice + referencePrice + } + } + } +} + `; + +/** + * __useChartQuery__ + * + * To run a query within a React component, call `useChartQuery` and pass it any options that fit your needs. + * When your component renders, `useChartQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useChartQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useChartQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(ChartDocument, options); + } +export function useChartLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(ChartDocument, options); + } +export type ChartQueryHookResult = ReturnType; +export type ChartLazyQueryHookResult = ReturnType; +export type ChartQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/index.ts b/libs/candles-chart/src/lib/index.ts index 0b861afa4..97c2a33d3 100644 --- a/libs/candles-chart/src/lib/index.ts +++ b/libs/candles-chart/src/lib/index.ts @@ -1,3 +1,6 @@ -export * from './__generated__'; +export * from './__generated__/CandleFields'; +export * from './__generated__/Candles'; +export * from './__generated__/CandlesSub'; +export * from './__generated__/Chart'; export * from './candles-chart'; export * from './data-source'; diff --git a/libs/deal-ticket/.eslintrc.json b/libs/deal-ticket/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/deal-ticket/.eslintrc.json +++ b/libs/deal-ticket/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/deal-ticket/src/components/DealTicket.graphql b/libs/deal-ticket/src/components/DealTicket.graphql new file mode 100644 index 000000000..a166e6eab --- /dev/null +++ b/libs/deal-ticket/src/components/DealTicket.graphql @@ -0,0 +1,30 @@ +query DealTicketQuery($marketId: ID!) { + market(id: $marketId) { + id + name + decimalPlaces + positionDecimalPlaces + state + tradingMode + tradableInstrument { + instrument { + id + product { + ... on Future { + quoteName + settlementAsset { + id + symbol + name + } + } + } + } + } + depth { + lastTrade { + price + } + } + } +} diff --git a/libs/deal-ticket/src/components/MarketInfo.graphql b/libs/deal-ticket/src/components/MarketInfo.graphql new file mode 100644 index 000000000..26e392243 --- /dev/null +++ b/libs/deal-ticket/src/components/MarketInfo.graphql @@ -0,0 +1,139 @@ +query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + name + decimalPlaces + positionDecimalPlaces + state + accounts { + type + asset { + id + } + balance + } + tradingMode + accounts { + type + asset { + id + } + balance + } + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + priceMonitoringSettings { + parameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + } + riskFactors { + market + short + long + } + accounts { + type + asset { + id + } + balance + } + data { + market { + id + } + markPrice + indicativeVolume + bestBidVolume + bestOfferVolume + bestStaticBidVolume + bestStaticOfferVolume + openInterest + bestBidPrice + bestOfferPrice + trigger + priceMonitoringBounds { + minValidPrice + maxValidPrice + trigger { + horizonSecs + probability + auctionExtensionSecs + } + referencePrice + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + candles(interval: $interval, since: $since) { + volume + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + quoteName + settlementAsset { + id + symbol + name + } + oracleSpecForSettlementPrice { + id + } + oracleSpecForTradingTermination { + id + } + oracleSpecBinding { + settlementPriceProperty + tradingTerminationProperty + } + } + } + } + riskModel { + ... on LogNormalRiskModel { + tau + riskAversionParameter + params { + r + sigma + mu + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + } + depth { + lastTrade { + price + } + } + } +} diff --git a/libs/deal-ticket/src/components/MarketNames.graphql b/libs/deal-ticket/src/components/MarketNames.graphql new file mode 100644 index 000000000..ce9722be8 --- /dev/null +++ b/libs/deal-ticket/src/components/MarketNames.graphql @@ -0,0 +1,20 @@ +query MarketNames { + markets { + id + name + state + tradableInstrument { + instrument { + code + metadata { + tags + } + product { + ... on Future { + quoteName + } + } + } + } + } +} diff --git a/libs/deal-ticket/src/components/__generated__/index.ts b/libs/deal-ticket/src/components/__generated__/index.ts deleted file mode 100644 index b9d08aad0..000000000 --- a/libs/deal-ticket/src/components/__generated__/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './DealTicketQuery'; -export * from './MarketInfoQuery'; -export * from './MarketNames'; diff --git a/libs/deal-ticket/src/components/__generated___/DealTicket.ts b/libs/deal-ticket/src/components/__generated___/DealTicket.ts new file mode 100644 index 000000000..8d88fb1ee --- /dev/null +++ b/libs/deal-ticket/src/components/__generated___/DealTicket.ts @@ -0,0 +1,73 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type DealTicketQueryQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; + + +export const DealTicketQueryDocument = gql` + query DealTicketQuery($marketId: ID!) { + market(id: $marketId) { + id + name + decimalPlaces + positionDecimalPlaces + state + tradingMode + tradableInstrument { + instrument { + id + product { + ... on Future { + quoteName + settlementAsset { + id + symbol + name + } + } + } + } + } + depth { + lastTrade { + price + } + } + } +} + `; + +/** + * __useDealTicketQueryQuery__ + * + * To run a query within a React component, call `useDealTicketQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useDealTicketQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDealTicketQueryQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useDealTicketQueryQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(DealTicketQueryDocument, options); + } +export function useDealTicketQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(DealTicketQueryDocument, options); + } +export type DealTicketQueryQueryHookResult = ReturnType; +export type DealTicketQueryLazyQueryHookResult = ReturnType; +export type DealTicketQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts new file mode 100644 index 000000000..54dd4244d --- /dev/null +++ b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts @@ -0,0 +1,186 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketInfoQueryQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; + since: Types.Scalars['String']; +}>; + + +export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; + + +export const MarketInfoQueryDocument = gql` + query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + name + decimalPlaces + positionDecimalPlaces + state + accounts { + type + asset { + id + } + balance + } + tradingMode + accounts { + type + asset { + id + } + balance + } + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + priceMonitoringSettings { + parameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + } + riskFactors { + market + short + long + } + accounts { + type + asset { + id + } + balance + } + data { + market { + id + } + markPrice + indicativeVolume + bestBidVolume + bestOfferVolume + bestStaticBidVolume + bestStaticOfferVolume + openInterest + bestBidPrice + bestOfferPrice + trigger + priceMonitoringBounds { + minValidPrice + maxValidPrice + trigger { + horizonSecs + probability + auctionExtensionSecs + } + referencePrice + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + candles(interval: $interval, since: $since) { + volume + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + quoteName + settlementAsset { + id + symbol + name + } + oracleSpecForSettlementPrice { + id + } + oracleSpecForTradingTermination { + id + } + oracleSpecBinding { + settlementPriceProperty + tradingTerminationProperty + } + } + } + } + riskModel { + ... on LogNormalRiskModel { + tau + riskAversionParameter + params { + r + sigma + mu + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + } + depth { + lastTrade { + price + } + } + } +} + `; + +/** + * __useMarketInfoQueryQuery__ + * + * To run a query within a React component, call `useMarketInfoQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketInfoQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketInfoQueryQuery({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * since: // value for 'since' + * }, + * }); + */ +export function useMarketInfoQueryQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketInfoQueryDocument, options); + } +export function useMarketInfoQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketInfoQueryDocument, options); + } +export type MarketInfoQueryQueryHookResult = ReturnType; +export type MarketInfoQueryLazyQueryHookResult = ReturnType; +export type MarketInfoQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/deal-ticket/src/components/__generated___/MarketNames.ts b/libs/deal-ticket/src/components/__generated___/MarketNames.ts new file mode 100644 index 000000000..2e9f19474 --- /dev/null +++ b/libs/deal-ticket/src/components/__generated___/MarketNames.ts @@ -0,0 +1,60 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null }; + + +export const MarketNamesDocument = gql` + query MarketNames { + markets { + id + name + state + tradableInstrument { + instrument { + code + metadata { + tags + } + product { + ... on Future { + quoteName + } + } + } + } + } +} + `; + +/** + * __useMarketNamesQuery__ + * + * To run a query within a React component, call `useMarketNamesQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketNamesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketNamesQuery({ + * variables: { + * }, + * }); + */ +export function useMarketNamesQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketNamesDocument, options); + } +export function useMarketNamesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketNamesDocument, options); + } +export type MarketNamesQueryHookResult = ReturnType; +export type MarketNamesLazyQueryHookResult = ReturnType; +export type MarketNamesQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/deal-ticket/src/components/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket-container.tsx index a031309f0..085481e7f 100644 --- a/libs/deal-ticket/src/components/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-container.tsx @@ -2,7 +2,7 @@ import { gql, useQuery } from '@apollo/client'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { DealTicketManager } from './deal-ticket-manager'; import { t } from '@vegaprotocol/react-helpers'; -import type { DealTicketQuery_market, DealTicketQuery } from './__generated__'; +import type { DealTicketQuery_market, DealTicketQuery } from './'; const DEAL_TICKET_QUERY = gql` query DealTicketQuery($marketId: ID!) { diff --git a/libs/deal-ticket/src/components/index.ts b/libs/deal-ticket/src/components/index.ts index 384200706..740de3af5 100644 --- a/libs/deal-ticket/src/components/index.ts +++ b/libs/deal-ticket/src/components/index.ts @@ -1,4 +1,6 @@ -export * from './__generated__'; +export * from './__generated__/DealTicketQuery'; +export * from './__generated__/MarketInfoQuery'; +export * from './__generated__/MarketNames'; export * from './deal-ticket-amount'; export * from './deal-ticket-container'; export * from './deal-ticket-limit-amount'; diff --git a/libs/deal-ticket/src/components/info-market.tsx b/libs/deal-ticket/src/components/info-market.tsx index e7fb234e6..074c2a385 100644 --- a/libs/deal-ticket/src/components/info-market.tsx +++ b/libs/deal-ticket/src/components/info-market.tsx @@ -20,7 +20,7 @@ import { import startCase from 'lodash/startCase'; import pick from 'lodash/pick'; import omit from 'lodash/omit'; -import type { MarketInfoQuery, MarketInfoQuery_market } from './__generated__'; +import type { MarketInfoQuery, MarketInfoQuery_market } from './'; import BigNumber from 'bignumber.js'; import { useQuery } from '@apollo/client'; import { totalFees } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/components/market-selector.tsx b/libs/deal-ticket/src/components/market-selector.tsx index 898a5ac0f..eef06a9d2 100644 --- a/libs/deal-ticket/src/components/market-selector.tsx +++ b/libs/deal-ticket/src/components/market-selector.tsx @@ -9,7 +9,7 @@ import React, { import * as DialogPrimitives from '@radix-ui/react-dialog'; import { gql, useQuery } from '@apollo/client'; import classNames from 'classnames'; -import type { DealTicketQuery_market } from './__generated__'; +import type { DealTicketQuery_market } from './'; import { ButtonLink, Icon, diff --git a/libs/deposits/.eslintrc.json b/libs/deposits/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/deposits/.eslintrc.json +++ b/libs/deposits/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/deposits/src/lib/Deposit.graphql b/libs/deposits/src/lib/Deposit.graphql new file mode 100644 index 000000000..390455e17 --- /dev/null +++ b/libs/deposits/src/lib/Deposit.graphql @@ -0,0 +1,11 @@ +subscription DepositEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Deposit]) { + event { + ... on Deposit { + id + txHash + status + } + } + } +} diff --git a/libs/deposits/src/lib/__generated___/Deposit.ts b/libs/deposits/src/lib/__generated___/Deposit.ts new file mode 100644 index 000000000..ab1a3f633 --- /dev/null +++ b/libs/deposits/src/lib/__generated___/Deposit.ts @@ -0,0 +1,49 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type DepositEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type DepositEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit', id: string, txHash?: string | null, status: Types.DepositStatus } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null }; + + +export const DepositEventDocument = gql` + subscription DepositEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Deposit]) { + event { + ... on Deposit { + id + txHash + status + } + } + } +} + `; + +/** + * __useDepositEventSubscription__ + * + * To run a query within a React component, call `useDepositEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useDepositEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDepositEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useDepositEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(DepositEventDocument, options); + } +export type DepositEventSubscriptionHookResult = ReturnType; +export type DepositEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/environment/.eslintrc.json b/libs/environment/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/environment/.eslintrc.json +++ b/libs/environment/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/fills/.eslintrc.json b/libs/fills/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/fills/.eslintrc.json +++ b/libs/fills/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/fills/src/lib/Fills.graphql b/libs/fills/src/lib/Fills.graphql new file mode 100644 index 000000000..4db669bb3 --- /dev/null +++ b/libs/fills/src/lib/Fills.graphql @@ -0,0 +1,72 @@ +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 + } + } + } + } + } + } +} + +query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) { + party(id: $partyId) { + id + tradesConnection(marketId: $marketId, pagination: $pagination) { + edges { + node { + ...FillFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + +subscription FillsSub($partyId: ID!) { + trades(partyId: $partyId) { + ...FillFields + } +} diff --git a/libs/fills/src/lib/__generated___/Fills.ts b/libs/fills/src/lib/__generated___/Fills.ts new file mode 100644 index 000000000..abceb245c --- /dev/null +++ b/libs/fills/src/lib/__generated___/Fills.ts @@ -0,0 +1,152 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type FillFieldsFragment = { __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } }; + +export type FillsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; + marketId?: Types.InputMaybe; + pagination?: Types.InputMaybe; +}>; + + +export type FillsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, tradesConnection: { __typename?: 'TradeConnection', edges: Array<{ __typename?: 'TradeEdge', cursor: string, node: { __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } } }>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } } | null }; + +export type FillsSubSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type FillsSubSubscription = { __typename?: 'Subscription', trades?: Array<{ __typename?: 'Trade', id: string, createdAt: string, price: string, size: string, buyOrder: string, sellOrder: string, aggressor: Types.Side, buyer: { __typename?: 'Party', id: string }, seller: { __typename?: 'Party', id: string }, buyerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, sellerFee: { __typename?: 'TradeFee', makerFee: string, infrastructureFee: string, liquidityFee: string }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } } } }> | null }; + +export const FillFieldsFragmentDoc = 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 FillsDocument = gql` + query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) { + party(id: $partyId) { + id + tradesConnection(marketId: $marketId, pagination: $pagination) { + edges { + node { + ...FillFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + ${FillFieldsFragmentDoc}`; + +/** + * __useFillsQuery__ + * + * To run a query within a React component, call `useFillsQuery` and pass it any options that fit your needs. + * When your component renders, `useFillsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useFillsQuery({ + * variables: { + * partyId: // value for 'partyId' + * marketId: // value for 'marketId' + * pagination: // value for 'pagination' + * }, + * }); + */ +export function useFillsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(FillsDocument, options); + } +export function useFillsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(FillsDocument, options); + } +export type FillsQueryHookResult = ReturnType; +export type FillsLazyQueryHookResult = ReturnType; +export type FillsQueryResult = Apollo.QueryResult; +export const FillsSubDocument = gql` + subscription FillsSub($partyId: ID!) { + trades(partyId: $partyId) { + ...FillFields + } +} + ${FillFieldsFragmentDoc}`; + +/** + * __useFillsSubSubscription__ + * + * To run a query within a React component, call `useFillsSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useFillsSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useFillsSubSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useFillsSubSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(FillsSubDocument, options); + } +export type FillsSubSubscriptionHookResult = ReturnType; +export type FillsSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/governance/.eslintrc.json b/libs/governance/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/governance/.eslintrc.json +++ b/libs/governance/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/governance/src/lib/proposals-hooks/Proposal.graphql b/libs/governance/src/lib/proposals-hooks/Proposal.graphql new file mode 100644 index 000000000..82c11ee53 --- /dev/null +++ b/libs/governance/src/lib/proposals-hooks/Proposal.graphql @@ -0,0 +1,14 @@ +subscription ProposalEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Proposal]) { + type + event { + ... on Proposal { + id + reference + state + rejectionReason + errorDetails + } + } + } +} diff --git a/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts b/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts new file mode 100644 index 000000000..b13a16f80 --- /dev/null +++ b/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts @@ -0,0 +1,52 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type ProposalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', type: Types.BusEventType, event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null }; + + +export const ProposalEventDocument = gql` + subscription ProposalEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Proposal]) { + type + event { + ... on Proposal { + id + reference + state + rejectionReason + errorDetails + } + } + } +} + `; + +/** + * __useProposalEventSubscription__ + * + * To run a query within a React component, call `useProposalEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useProposalEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useProposalEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(ProposalEventDocument, options); + } +export type ProposalEventSubscriptionHookResult = ReturnType; +export type ProposalEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/market-depth/.eslintrc.json b/libs/market-depth/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/market-depth/.eslintrc.json +++ b/libs/market-depth/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/market-depth/src/lib/MarketDepth.graphql b/libs/market-depth/src/lib/MarketDepth.graphql new file mode 100644 index 000000000..31df77f47 --- /dev/null +++ b/libs/market-depth/src/lib/MarketDepth.graphql @@ -0,0 +1,65 @@ +query MarketDepth($marketId: ID!) { + market(id: $marketId) { + id + decimalPlaces + positionDecimalPlaces + data { + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + market { + id + } + } + depth { + lastTrade { + price + } + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + } + } +} + +subscription MarketDepthSubscription($marketId: ID!) { + marketDepthUpdate(marketId: $marketId) { + market { + id + positionDecimalPlaces + data { + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + market { + id + } + } + } + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + } +} diff --git a/libs/market-depth/src/lib/__generated__/index.ts b/libs/market-depth/src/lib/__generated__/index.ts deleted file mode 100644 index 64c059419..000000000 --- a/libs/market-depth/src/lib/__generated__/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from './MarketDepth'; -export * from './MarketDepthSubscription'; diff --git a/libs/market-depth/src/lib/__generated___/MarketDepth.ts b/libs/market-depth/src/lib/__generated___/MarketDepth.ts new file mode 100644 index 000000000..48a8e2f14 --- /dev/null +++ b/libs/market-depth/src/lib/__generated___/MarketDepth.ts @@ -0,0 +1,139 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketDepthQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type MarketDepthQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', staticMidPrice: string, marketTradingMode: Types.MarketTradingMode, indicativeVolume: string, indicativePrice: string, bestStaticBidPrice: string, bestStaticOfferPrice: string, market: { __typename?: 'Market', id: string } } | null, depth: { __typename?: 'MarketDepth', sequenceNumber: string, lastTrade?: { __typename?: 'Trade', price: string } | null, sell?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null, buy?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null } } | null }; + +export type MarketDepthSubscriptionSubscriptionVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type MarketDepthSubscriptionSubscription = { __typename?: 'Subscription', marketDepthUpdate: { __typename?: 'MarketDepthUpdate', sequenceNumber: string, market: { __typename?: 'Market', id: string, positionDecimalPlaces: number, data?: { __typename?: 'MarketData', staticMidPrice: string, marketTradingMode: Types.MarketTradingMode, indicativeVolume: string, indicativePrice: string, bestStaticBidPrice: string, bestStaticOfferPrice: string, market: { __typename?: 'Market', id: string } } | null }, sell?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null, buy?: Array<{ __typename?: 'PriceLevel', price: string, volume: string, numberOfOrders: string }> | null } }; + + +export const MarketDepthDocument = gql` + query MarketDepth($marketId: ID!) { + market(id: $marketId) { + id + decimalPlaces + positionDecimalPlaces + data { + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + market { + id + } + } + depth { + lastTrade { + price + } + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + } + } +} + `; + +/** + * __useMarketDepthQuery__ + * + * To run a query within a React component, call `useMarketDepthQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketDepthQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketDepthQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useMarketDepthQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketDepthDocument, options); + } +export function useMarketDepthLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketDepthDocument, options); + } +export type MarketDepthQueryHookResult = ReturnType; +export type MarketDepthLazyQueryHookResult = ReturnType; +export type MarketDepthQueryResult = Apollo.QueryResult; +export const MarketDepthSubscriptionDocument = gql` + subscription MarketDepthSubscription($marketId: ID!) { + marketDepthUpdate(marketId: $marketId) { + market { + id + positionDecimalPlaces + data { + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + market { + id + } + } + } + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + } +} + `; + +/** + * __useMarketDepthSubscriptionSubscription__ + * + * To run a query within a React component, call `useMarketDepthSubscriptionSubscription` and pass it any options that fit your needs. + * When your component renders, `useMarketDepthSubscriptionSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketDepthSubscriptionSubscription({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useMarketDepthSubscriptionSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(MarketDepthSubscriptionDocument, options); + } +export type MarketDepthSubscriptionSubscriptionHookResult = ReturnType; +export type MarketDepthSubscriptionSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/market-depth/src/lib/index.ts b/libs/market-depth/src/lib/index.ts index 475756d00..1f989d811 100644 --- a/libs/market-depth/src/lib/index.ts +++ b/libs/market-depth/src/lib/index.ts @@ -1,4 +1,5 @@ -export * from './__generated__'; +export * from './__generated__/MarketDepth'; +export * from './__generated__/MarketDepthSubscription'; export * from './depth-chart'; export * from './market-depth-data-provider'; export * from './orderbook-container'; diff --git a/libs/market-depth/src/lib/use-orderbook-data.spec.tsx b/libs/market-depth/src/lib/use-orderbook-data.spec.tsx index df74e69af..8464ebe72 100644 --- a/libs/market-depth/src/lib/use-orderbook-data.spec.tsx +++ b/libs/market-depth/src/lib/use-orderbook-data.spec.tsx @@ -1,10 +1,7 @@ import { MockedProvider } from '@apollo/client/testing'; import { renderHook, act } from '@testing-library/react'; import { MarketTradingMode } from '@vegaprotocol/types'; -import type { - MarketDepth_market, - MarketDepth_market_data, -} from './__generated__'; +import type { MarketDepth_market, MarketDepth_market_data } from './'; import { useOrderBookData } from './use-orderbook-data'; const mockData: MarketDepth_market = { diff --git a/libs/market-depth/src/lib/use-orderbook-data.ts b/libs/market-depth/src/lib/use-orderbook-data.ts index b94e7cded..ace259830 100644 --- a/libs/market-depth/src/lib/use-orderbook-data.ts +++ b/libs/market-depth/src/lib/use-orderbook-data.ts @@ -2,7 +2,7 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import throttle from 'lodash/throttle'; import { useDataProvider } from '@vegaprotocol/react-helpers'; import dataProvider from './market-depth-data-provider'; -import type { MarketDepth_market } from './__generated__'; +import type { MarketDepth_market } from './'; interface Props { variables: { marketId: string }; diff --git a/libs/market-list/.eslintrc.json b/libs/market-list/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/market-list/.eslintrc.json +++ b/libs/market-list/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/market-list/src/lib/MarketData.graphql b/libs/market-list/src/lib/MarketData.graphql new file mode 100644 index 000000000..5bc5f9906 --- /dev/null +++ b/libs/market-list/src/lib/MarketData.graphql @@ -0,0 +1,75 @@ +fragment MarketDataFields on MarketData { + market { + id + state + tradingMode + } + bestBidPrice + bestOfferPrice + markPrice + trigger + indicativeVolume +} + +query MarketList($interval: Interval!, $since: String!) { + markets { + id + name + decimalPlaces + positionDecimalPlaces + state + tradingMode + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + data { + market { + id + state + tradingMode + } + bestBidPrice + bestOfferPrice + markPrice + trigger + indicativeVolume + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + settlementAsset { + symbol + } + } + } + } + } + marketTimestamps { + open + close + } + candles(interval: $interval, since: $since) { + open + close + high + low + } + } +} + +subscription MarketDataSub { + marketData { + ...MarketDataFields + } +} diff --git a/libs/market-list/src/lib/__generated__/index.ts b/libs/market-list/src/lib/__generated__/index.ts deleted file mode 100644 index bb8baa234..000000000 --- a/libs/market-list/src/lib/__generated__/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './MarketDataFields'; -export * from './MarketDataSub'; -export * from './MarketList'; diff --git a/libs/market-list/src/lib/__generated___/MarketData.ts b/libs/market-list/src/lib/__generated___/MarketData.ts new file mode 100644 index 000000000..21a5964ac --- /dev/null +++ b/libs/market-list/src/lib/__generated___/MarketData.ts @@ -0,0 +1,150 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type MarketDataFieldsFragment = { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } }; + +export type MarketListQueryVariables = Types.Exact<{ + interval: Types.Interval; + since: Types.Scalars['String']; +}>; + + +export type MarketListQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, data?: { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', symbol: string } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, candles?: Array<{ __typename?: 'Candle', open: string, close: string, high: string, low: string } | null> | null }> | null }; + +export type MarketDataSubSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; + + +export type MarketDataSubSubscription = { __typename?: 'Subscription', marketData: { __typename?: 'MarketData', bestBidPrice: string, bestOfferPrice: string, markPrice: string, trigger: Types.AuctionTrigger, indicativeVolume: string, market: { __typename?: 'Market', id: string, state: Types.MarketState, tradingMode: Types.MarketTradingMode } } }; + +export const MarketDataFieldsFragmentDoc = gql` + fragment MarketDataFields on MarketData { + market { + id + state + tradingMode + } + bestBidPrice + bestOfferPrice + markPrice + trigger + indicativeVolume +} + `; +export const MarketListDocument = gql` + query MarketList($interval: Interval!, $since: String!) { + markets { + id + name + decimalPlaces + positionDecimalPlaces + state + tradingMode + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + data { + market { + id + state + tradingMode + } + bestBidPrice + bestOfferPrice + markPrice + trigger + indicativeVolume + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + settlementAsset { + symbol + } + } + } + } + } + marketTimestamps { + open + close + } + candles(interval: $interval, since: $since) { + open + close + high + low + } + } +} + `; + +/** + * __useMarketListQuery__ + * + * To run a query within a React component, call `useMarketListQuery` and pass it any options that fit your needs. + * When your component renders, `useMarketListQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketListQuery({ + * variables: { + * interval: // value for 'interval' + * since: // value for 'since' + * }, + * }); + */ +export function useMarketListQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(MarketListDocument, options); + } +export function useMarketListLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(MarketListDocument, options); + } +export type MarketListQueryHookResult = ReturnType; +export type MarketListLazyQueryHookResult = ReturnType; +export type MarketListQueryResult = Apollo.QueryResult; +export const MarketDataSubDocument = gql` + subscription MarketDataSub { + marketData { + ...MarketDataFields + } +} + ${MarketDataFieldsFragmentDoc}`; + +/** + * __useMarketDataSubSubscription__ + * + * To run a query within a React component, call `useMarketDataSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useMarketDataSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useMarketDataSubSubscription({ + * variables: { + * }, + * }); + */ +export function useMarketDataSubSubscription(baseOptions?: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(MarketDataSubDocument, options); + } +export type MarketDataSubSubscriptionHookResult = ReturnType; +export type MarketDataSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index fd4ef1c38..e19f2dfdd 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -22,7 +22,7 @@ import { MarketTradingModeMapping, AuctionTriggerMapping, } from '@vegaprotocol/types'; -import type { MarketList_markets } from '../../__generated__'; +import type { MarketList_markets } from '../../'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; type Props = AgGridReactProps | AgReactUiProps; diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index e57da74e6..98c8e3508 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -10,7 +10,7 @@ import type { MarketList_markets, MarketList_markets_data, MarketDataSub_marketData, -} from '../../__generated__'; +} from '../../'; import { marketsDataProvider as dataProvider } from '../../markets-data-provider'; import { Interval, MarketState } from '@vegaprotocol/types'; diff --git a/libs/market-list/src/lib/components/select-market.tsx b/libs/market-list/src/lib/components/select-market.tsx index 419a8fad5..130742d2b 100644 --- a/libs/market-list/src/lib/components/select-market.tsx +++ b/libs/market-list/src/lib/components/select-market.tsx @@ -17,7 +17,7 @@ import { } from './select-market-columns'; import { columnHeaders } from './select-market-columns'; import { columns } from './select-market-columns'; -import type { MarketList_markets } from '../__generated__'; +import type { MarketList_markets } from '../'; import { useVegaWallet } from '@vegaprotocol/wallet'; import type { Positions } from '@vegaprotocol/positions'; import { POSITIONS_QUERY } from '@vegaprotocol/positions'; diff --git a/libs/market-list/src/lib/index.ts b/libs/market-list/src/lib/index.ts index 5c41ec6c2..8030e9e48 100644 --- a/libs/market-list/src/lib/index.ts +++ b/libs/market-list/src/lib/index.ts @@ -1,4 +1,6 @@ -export * from './__generated__'; +export * from './__generated__/MarketDataFields'; +export * from './__generated__/MarketList'; +export * from './__generated__/MarketDataSub'; export * from './components'; export * from './utils'; export * from './markets-data-provider'; diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 86d3c9f3c..4eff74ada 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -6,7 +6,7 @@ import type { MarketDataSub_marketData, MarketList, MarketList_markets, -} from './__generated__'; +} from './'; import { useMemo } from 'react'; import { Interval } from '@vegaprotocol/types'; import { mapDataToMarketList } from './utils'; diff --git a/libs/network-stats/.eslintrc.json b/libs/network-stats/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/network-stats/.eslintrc.json +++ b/libs/network-stats/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/network-stats/src/components/stats-manager/Stats.graphql b/libs/network-stats/src/components/stats-manager/Stats.graphql new file mode 100644 index 000000000..5730803ce --- /dev/null +++ b/libs/network-stats/src/components/stats-manager/Stats.graphql @@ -0,0 +1,23 @@ +query NetworkStats { + nodeData { + stakedTotal + totalNodes + inactiveNodes + validatingNodes + uptime + } + statistics { + status + blockHeight + blockDuration + backlogLength + txPerBlock + tradesPerSecond + ordersPerSecond + averageOrdersPerBlock + vegaTime + appVersion + chainVersion + chainId + } +} diff --git a/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts b/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts new file mode 100644 index 000000000..a629ad1c3 --- /dev/null +++ b/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts @@ -0,0 +1,63 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NetworkStatsQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NetworkStatsQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string, totalNodes: number, inactiveNodes: number, validatingNodes: number, uptime: number } | null, statistics: { __typename?: 'Statistics', status: string, blockHeight: string, blockDuration: string, backlogLength: string, txPerBlock: string, tradesPerSecond: string, ordersPerSecond: string, averageOrdersPerBlock: string, vegaTime: string, appVersion: string, chainVersion: string, chainId: string } }; + + +export const NetworkStatsDocument = gql` + query NetworkStats { + nodeData { + stakedTotal + totalNodes + inactiveNodes + validatingNodes + uptime + } + statistics { + status + blockHeight + blockDuration + backlogLength + txPerBlock + tradesPerSecond + ordersPerSecond + averageOrdersPerBlock + vegaTime + appVersion + chainVersion + chainId + } +} + `; + +/** + * __useNetworkStatsQuery__ + * + * To run a query within a React component, call `useNetworkStatsQuery` and pass it any options that fit your needs. + * When your component renders, `useNetworkStatsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNetworkStatsQuery({ + * variables: { + * }, + * }); + */ +export function useNetworkStatsQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NetworkStatsDocument, options); + } +export function useNetworkStatsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NetworkStatsDocument, options); + } +export type NetworkStatsQueryHookResult = ReturnType; +export type NetworkStatsLazyQueryHookResult = ReturnType; +export type NetworkStatsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/orders/.eslintrc.json b/libs/orders/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/orders/.eslintrc.json +++ b/libs/orders/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/index.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/index.ts deleted file mode 100644 index 9e0340c91..000000000 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from './OrderFields'; -export * from './OrderSub'; -export * from './Orders'; diff --git a/libs/orders/src/lib/components/order-data-provider/index.ts b/libs/orders/src/lib/components/order-data-provider/index.ts index d154614ff..13a0cc4e4 100644 --- a/libs/orders/src/lib/components/order-data-provider/index.ts +++ b/libs/orders/src/lib/components/order-data-provider/index.ts @@ -1,2 +1,4 @@ -export * from './__generated__'; +export * from './__generated__/OrderFields'; +export * from './__generated__/OrderSub'; +export * from './__generated__/Orders'; export * from './order-data-provider'; diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index e829966f5..7f8981033 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -1,5 +1,5 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__'; +import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__/OrderEvent'; import { addDecimalsFormatNumber, t, diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 3bc939924..926acc68d 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -37,7 +37,7 @@ import BigNumber from 'bignumber.js'; import { useOrderCancel } from '../../order-hooks/use-order-cancel'; import { useOrderEdit } from '../../order-hooks/use-order-edit'; import { OrderEditDialog } from './order-edit-dialog'; -import type { OrderFields } from '../order-data-provider/__generated__'; +import type { OrderFields } from '../'; import { OrderFeedback } from '../order-feedback'; type OrderListProps = AgGridReactProps | AgReactUiProps; diff --git a/libs/orders/src/lib/order-hooks/Orders.graphql b/libs/orders/src/lib/order-hooks/Orders.graphql new file mode 100644 index 000000000..82fb1970e --- /dev/null +++ b/libs/orders/src/lib/order-hooks/Orders.graphql @@ -0,0 +1,78 @@ +fragment OrderFields on Order { + id + market { + id + name + decimalPlaces + positionDecimalPlaces + tradableInstrument { + instrument { + id + code + } + } + } + type + side + size + status + rejectionReason + price + timeInForce + remaining + expiresAt + createdAt + updatedAt +} + +query Orders($partyId: ID!, $pagination: Pagination) { + party(id: $partyId) { + id + ordersConnection(pagination: $pagination) { + edges { + node { + ...OrderFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + +subscription OrderSub($partyId: ID!) { + orders(partyId: $partyId) { + ...OrderFields + } +} + +subscription OrderEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Order]) { + type + event { + ... on Order { + type + id + status + rejectionReason + createdAt + size + price + timeInForce + expiresAt + side + market { + id + name + decimalPlaces + positionDecimalPlaces + } + } + } + } +} diff --git a/libs/orders/src/lib/order-hooks/__generated__/index.ts b/libs/orders/src/lib/order-hooks/__generated__/index.ts deleted file mode 100644 index 20f35ba26..000000000 --- a/libs/orders/src/lib/order-hooks/__generated__/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './OrderEvent'; diff --git a/libs/orders/src/lib/order-hooks/__generated___/Orders.ts b/libs/orders/src/lib/order-hooks/__generated___/Orders.ts new file mode 100644 index 000000000..37417d7a9 --- /dev/null +++ b/libs/orders/src/lib/order-hooks/__generated___/Orders.ts @@ -0,0 +1,187 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type OrderFieldsFragment = { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: string | null, createdAt: string, updatedAt?: string | null, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string } } } }; + +export type OrdersQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; + pagination?: Types.InputMaybe; +}>; + + +export type OrdersQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, ordersConnection: { __typename?: 'OrderConnection', edges?: Array<{ __typename?: 'OrderEdge', cursor?: string | null, node: { __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: string | null, createdAt: string, updatedAt?: string | null, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string } } } } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } } | null }; + +export type OrderSubSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type OrderSubSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'Order', id: string, type?: Types.OrderType | null, side: Types.Side, size: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, remaining: string, expiresAt?: string | null, createdAt: string, updatedAt?: string | null, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, code: string } } } }> | null }; + +export type OrderEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type OrderEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', type: Types.BusEventType, event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: string, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: string | null, side: Types.Side, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number } } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal' } }> | null }; + +export const OrderFieldsFragmentDoc = gql` + fragment OrderFields on Order { + id + market { + id + name + decimalPlaces + positionDecimalPlaces + tradableInstrument { + instrument { + id + code + } + } + } + type + side + size + status + rejectionReason + price + timeInForce + remaining + expiresAt + createdAt + updatedAt +} + `; +export const OrdersDocument = gql` + query Orders($partyId: ID!, $pagination: Pagination) { + party(id: $partyId) { + id + ordersConnection(pagination: $pagination) { + edges { + node { + ...OrderFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + ${OrderFieldsFragmentDoc}`; + +/** + * __useOrdersQuery__ + * + * To run a query within a React component, call `useOrdersQuery` and pass it any options that fit your needs. + * When your component renders, `useOrdersQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOrdersQuery({ + * variables: { + * partyId: // value for 'partyId' + * pagination: // value for 'pagination' + * }, + * }); + */ +export function useOrdersQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(OrdersDocument, options); + } +export function useOrdersLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(OrdersDocument, options); + } +export type OrdersQueryHookResult = ReturnType; +export type OrdersLazyQueryHookResult = ReturnType; +export type OrdersQueryResult = Apollo.QueryResult; +export const OrderSubDocument = gql` + subscription OrderSub($partyId: ID!) { + orders(partyId: $partyId) { + ...OrderFields + } +} + ${OrderFieldsFragmentDoc}`; + +/** + * __useOrderSubSubscription__ + * + * To run a query within a React component, call `useOrderSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useOrderSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOrderSubSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useOrderSubSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(OrderSubDocument, options); + } +export type OrderSubSubscriptionHookResult = ReturnType; +export type OrderSubSubscriptionResult = Apollo.SubscriptionResult; +export const OrderEventDocument = gql` + subscription OrderEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Order]) { + type + event { + ... on Order { + type + id + status + rejectionReason + createdAt + size + price + timeInForce + expiresAt + side + market { + id + name + decimalPlaces + positionDecimalPlaces + } + } + } + } +} + `; + +/** + * __useOrderEventSubscription__ + * + * To run a query within a React component, call `useOrderEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useOrderEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOrderEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useOrderEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(OrderEventDocument, options); + } +export type OrderEventSubscriptionHookResult = ReturnType; +export type OrderEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/orders/src/lib/order-hooks/index.ts b/libs/orders/src/lib/order-hooks/index.ts index 427149e15..5b4a979df 100644 --- a/libs/orders/src/lib/order-hooks/index.ts +++ b/libs/orders/src/lib/order-hooks/index.ts @@ -1,4 +1,4 @@ -export * from './__generated__'; +export * from './__generated__/OrderEvent'; export * from './order-event-query'; export * from './use-order-cancel'; export * from './use-order-submit'; diff --git a/libs/orders/src/lib/order-hooks/use-order-cancel.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-cancel.spec.tsx index 4656f6a43..38489a2a5 100644 --- a/libs/orders/src/lib/order-hooks/use-order-cancel.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-cancel.spec.tsx @@ -8,10 +8,7 @@ import type { VegaWalletContextShape, } from '@vegaprotocol/wallet'; import { useOrderCancel } from './use-order-cancel'; -import type { - OrderEvent, - OrderEvent_busEvents, -} from './__generated__/OrderEvent'; +import type { OrderEvent, OrderEvent_busEvents } from './'; import { ORDER_EVENT_SUB } from './order-event-query'; const defaultWalletContext = { diff --git a/libs/orders/src/lib/order-hooks/use-order-cancel.tsx b/libs/orders/src/lib/order-hooks/use-order-cancel.tsx index 04b0fb0e1..117e21f90 100644 --- a/libs/orders/src/lib/order-hooks/use-order-cancel.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-cancel.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import { useVegaWallet, useVegaTransaction } from '@vegaprotocol/wallet'; -import type { OrderEvent_busEvents_event_Order } from './__generated__/OrderEvent'; +import type { OrderEvent_busEvents_event_Order } from './'; import * as Sentry from '@sentry/react'; import { useOrderEvent } from './use-order-event'; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx index 06eb2350b..95b0e4591 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx @@ -6,10 +6,7 @@ import type { import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet'; import type { ReactNode } from 'react'; import { useOrderEdit } from './use-order-edit'; -import type { - OrderEvent, - OrderEvent_busEvents, -} from './__generated__/OrderEvent'; +import type { OrderEvent, OrderEvent_busEvents } from './'; import { ORDER_EVENT_SUB } from './order-event-query'; import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.tsx index 0a3a5dfe3..8d644dfe8 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.tsx @@ -1,7 +1,7 @@ import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; import { useState, useCallback } from 'react'; import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; -import type { OrderEvent_busEvents_event_Order } from './__generated__'; +import type { OrderEvent_busEvents_event_Order } from './'; import * as Sentry from '@sentry/react'; import type { OrderFields } from '../components'; import { useOrderEvent } from './use-order-event'; diff --git a/libs/orders/src/lib/order-hooks/use-order-event.ts b/libs/orders/src/lib/order-hooks/use-order-event.ts index e7b257a75..8e3a0edaf 100644 --- a/libs/orders/src/lib/order-hooks/use-order-event.ts +++ b/libs/orders/src/lib/order-hooks/use-order-event.ts @@ -5,7 +5,7 @@ import type { OrderEvent, OrderEventVariables, OrderEvent_busEvents_event_Order, -} from './__generated__'; +} from './'; import type { Subscription } from 'zen-observable-ts'; export const useOrderEvent = () => { diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx index e294a3e02..1410a7a6f 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx @@ -15,10 +15,7 @@ import { import type { ReactNode } from 'react'; import type { Order } from './use-order-submit'; import { useOrderSubmit } from './use-order-submit'; -import type { - OrderEvent, - OrderEvent_busEvents, -} from './__generated__/OrderEvent'; +import type { OrderEvent, OrderEvent_busEvents } from './'; import { ORDER_EVENT_SUB } from './order-event-query'; import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.tsx index d6e28a1c5..b36f0beee 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import type { ReactNode } from 'react'; -import type { OrderEvent_busEvents_event_Order } from './__generated__'; +import type { OrderEvent_busEvents_event_Order } from './__generated__/OrderEvent'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { determineId, toNanoSeconds } from '@vegaprotocol/react-helpers'; import { useVegaTransaction } from '@vegaprotocol/wallet'; diff --git a/libs/positions/.eslintrc.json b/libs/positions/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/positions/.eslintrc.json +++ b/libs/positions/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/positions/src/lib/Positions.graphql b/libs/positions/src/lib/Positions.graphql new file mode 100644 index 000000000..5bebb82e5 --- /dev/null +++ b/libs/positions/src/lib/Positions.graphql @@ -0,0 +1,60 @@ +fragment PositionFields on Position { + realisedPNL + openVolume + unrealisedPNL + averageEntryPrice + updatedAt + marginsConnection { + edges { + node { + market { + id + } + maintenanceLevel + searchLevel + initialLevel + collateralReleaseLevel + asset { + symbol + } + } + } + } + market { + id + name + decimalPlaces + positionDecimalPlaces + tradingMode + tradableInstrument { + instrument { + name + } + } + data { + markPrice + market { + id + } + } + } +} + +query Positions($partyId: ID!) { + party(id: $partyId) { + id + positionsConnection { + edges { + node { + ...PositionFields + } + } + } + } +} + +subscription PositionsSubscription($partyId: ID!) { + positions(partyId: $partyId) { + ...PositionFields + } +} diff --git a/libs/positions/src/lib/__generated___/Positions.ts b/libs/positions/src/lib/__generated___/Positions.ts new file mode 100644 index 000000000..402816484 --- /dev/null +++ b/libs/positions/src/lib/__generated___/Positions.ts @@ -0,0 +1,136 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PositionFieldsFragment = { __typename?: 'Position', realisedPNL: string, openVolume: string, unrealisedPNL: string, averageEntryPrice: string, updatedAt?: string | null, marginsConnection: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', maintenanceLevel: string, searchLevel: string, initialLevel: string, collateralReleaseLevel: string, market: { __typename?: 'Market', id: string }, asset: { __typename?: 'Asset', symbol: string } } }> | null }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } }, data?: { __typename?: 'MarketData', markPrice: string, market: { __typename?: 'Market', id: string } } | null } }; + +export type PositionsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PositionsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, positionsConnection: { __typename?: 'PositionConnection', edges?: Array<{ __typename?: 'PositionEdge', node: { __typename?: 'Position', realisedPNL: string, openVolume: string, unrealisedPNL: string, averageEntryPrice: string, updatedAt?: string | null, marginsConnection: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', maintenanceLevel: string, searchLevel: string, initialLevel: string, collateralReleaseLevel: string, market: { __typename?: 'Market', id: string }, asset: { __typename?: 'Asset', symbol: string } } }> | null }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } }, data?: { __typename?: 'MarketData', markPrice: string, market: { __typename?: 'Market', id: string } } | null } } }> | null } } | null }; + +export type PositionsSubscriptionSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type PositionsSubscriptionSubscription = { __typename?: 'Subscription', positions: { __typename?: 'Position', realisedPNL: string, openVolume: string, unrealisedPNL: string, averageEntryPrice: string, updatedAt?: string | null, marginsConnection: { __typename?: 'MarginConnection', edges?: Array<{ __typename?: 'MarginEdge', node: { __typename?: 'MarginLevels', maintenanceLevel: string, searchLevel: string, initialLevel: string, collateralReleaseLevel: string, market: { __typename?: 'Market', id: string }, asset: { __typename?: 'Asset', symbol: string } } }> | null }, market: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } }, data?: { __typename?: 'MarketData', markPrice: string, market: { __typename?: 'Market', id: string } } | null } } }; + +export const PositionFieldsFragmentDoc = gql` + fragment PositionFields on Position { + realisedPNL + openVolume + unrealisedPNL + averageEntryPrice + updatedAt + marginsConnection { + edges { + node { + market { + id + } + maintenanceLevel + searchLevel + initialLevel + collateralReleaseLevel + asset { + symbol + } + } + } + } + market { + id + name + decimalPlaces + positionDecimalPlaces + tradingMode + tradableInstrument { + instrument { + name + } + } + data { + markPrice + market { + id + } + } + } +} + `; +export const PositionsDocument = gql` + query Positions($partyId: ID!) { + party(id: $partyId) { + id + positionsConnection { + edges { + node { + ...PositionFields + } + } + } + } +} + ${PositionFieldsFragmentDoc}`; + +/** + * __usePositionsQuery__ + * + * To run a query within a React component, call `usePositionsQuery` and pass it any options that fit your needs. + * When your component renders, `usePositionsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePositionsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePositionsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(PositionsDocument, options); + } +export function usePositionsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(PositionsDocument, options); + } +export type PositionsQueryHookResult = ReturnType; +export type PositionsLazyQueryHookResult = ReturnType; +export type PositionsQueryResult = Apollo.QueryResult; +export const PositionsSubscriptionDocument = gql` + subscription PositionsSubscription($partyId: ID!) { + positions(partyId: $partyId) { + ...PositionFields + } +} + ${PositionFieldsFragmentDoc}`; + +/** + * __usePositionsSubscriptionSubscription__ + * + * To run a query within a React component, call `usePositionsSubscriptionSubscription` and pass it any options that fit your needs. + * When your component renders, `usePositionsSubscriptionSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = usePositionsSubscriptionSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePositionsSubscriptionSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(PositionsSubscriptionDocument, options); + } +export type PositionsSubscriptionSubscriptionHookResult = ReturnType; +export type PositionsSubscriptionSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/trades/.eslintrc.json b/libs/trades/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/trades/.eslintrc.json +++ b/libs/trades/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/trades/src/lib/Trades.graphql b/libs/trades/src/lib/Trades.graphql new file mode 100644 index 000000000..784deb49b --- /dev/null +++ b/libs/trades/src/lib/Trades.graphql @@ -0,0 +1,37 @@ +fragment TradeFields on Trade { + id + price + size + createdAt + market { + id + decimalPlaces + positionDecimalPlaces + } +} + +query Trades($marketId: ID!, $pagination: Pagination) { + market(id: $marketId) { + id + tradesConnection(pagination: $pagination) { + edges { + node { + ...TradeFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + +subscription TradesSub($marketId: ID!) { + trades(marketId: $marketId) { + ...TradeFields + } +} diff --git a/libs/trades/src/lib/__generated___/Trades.ts b/libs/trades/src/lib/__generated___/Trades.ts new file mode 100644 index 000000000..9bc466259 --- /dev/null +++ b/libs/trades/src/lib/__generated___/Trades.ts @@ -0,0 +1,115 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type TradeFieldsFragment = { __typename?: 'Trade', id: string, price: string, size: string, createdAt: string, market: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number } }; + +export type TradesQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + pagination?: Types.InputMaybe; +}>; + + +export type TradesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, tradesConnection: { __typename?: 'TradeConnection', edges: Array<{ __typename?: 'TradeEdge', cursor: string, node: { __typename?: 'Trade', id: string, price: string, size: string, createdAt: string, market: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number } } }>, pageInfo: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } } } | null }; + +export type TradesSubSubscriptionVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + + +export type TradesSubSubscription = { __typename?: 'Subscription', trades?: Array<{ __typename?: 'Trade', id: string, price: string, size: string, createdAt: string, market: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number } }> | null }; + +export const TradeFieldsFragmentDoc = gql` + fragment TradeFields on Trade { + id + price + size + createdAt + market { + id + decimalPlaces + positionDecimalPlaces + } +} + `; +export const TradesDocument = gql` + query Trades($marketId: ID!, $pagination: Pagination) { + market(id: $marketId) { + id + tradesConnection(pagination: $pagination) { + edges { + node { + ...TradeFields + } + cursor + } + pageInfo { + startCursor + endCursor + hasNextPage + hasPreviousPage + } + } + } +} + ${TradeFieldsFragmentDoc}`; + +/** + * __useTradesQuery__ + * + * To run a query within a React component, call `useTradesQuery` and pass it any options that fit your needs. + * When your component renders, `useTradesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useTradesQuery({ + * variables: { + * marketId: // value for 'marketId' + * pagination: // value for 'pagination' + * }, + * }); + */ +export function useTradesQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(TradesDocument, options); + } +export function useTradesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(TradesDocument, options); + } +export type TradesQueryHookResult = ReturnType; +export type TradesLazyQueryHookResult = ReturnType; +export type TradesQueryResult = Apollo.QueryResult; +export const TradesSubDocument = gql` + subscription TradesSub($marketId: ID!) { + trades(marketId: $marketId) { + ...TradeFields + } +} + ${TradeFieldsFragmentDoc}`; + +/** + * __useTradesSubSubscription__ + * + * To run a query within a React component, call `useTradesSubSubscription` and pass it any options that fit your needs. + * When your component renders, `useTradesSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useTradesSubSubscription({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useTradesSubSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(TradesSubDocument, options); + } +export type TradesSubSubscriptionHookResult = ReturnType; +export type TradesSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/types/.env b/libs/types/.env index 72694fe98..7607da6a5 100644 --- a/libs/types/.env +++ b/libs/types/.env @@ -1 +1 @@ -NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql +GRAPHQL_SCHEMA_PATH=https://api.n04.d.vega.xyz/graphql diff --git a/libs/types/.eslintrc.json b/libs/types/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/types/.eslintrc.json +++ b/libs/types/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/types/apollo.config.js b/libs/types/apollo.config.js index a1641bfe9..7f306cb72 100644 --- a/libs/types/apollo.config.js +++ b/libs/types/apollo.config.js @@ -3,9 +3,14 @@ module.exports = { service: { name: 'vega', url: - process.env.NX_VEGA_URL || 'https://api.n07.testnet.vega.xyz/graphql', + process.env.GRAPHQL_SCHEMA_PATH || + 'https://api.n07.testnet.vega.xyz/graphql', }, - includes: ['../../{apps,libs}/**/*.{ts,tsx,js,jsx,graphql}'], - excludes: ['**/generic-data-provider.ts'], + includes: [ + '../../{apps,libs}/**/*.{ts,tsx,js,jsx}', + '../../apps/token/client.graphql', + '../../apps/trading/client.graphql', + ], + excludes: ['**/generic-data-provider.ts', '**/__generated___/*'], }, }; diff --git a/libs/types/codegen.yml b/libs/types/codegen.yml new file mode 100644 index 000000000..527db3252 --- /dev/null +++ b/libs/types/codegen.yml @@ -0,0 +1,29 @@ +schema: + - ${GRAPHQL_SCHEMA_PATH} + - apps/trading/client.graphql + - apps/token/client.graphql +documents: '{apps,libs}/**/*.graphql' +config: + preResolveTypes: true + namingConvention: keep +generates: + libs/types/src/__generated__/types.ts: + - typescript + libs/**/__generated__: + preset: near-operation-file + presetConfig: + folder: __generated___ + extension: .ts + baseTypesPath: ~@vegaprotocol/types/types + plugins: + - typescript-operations + - typescript-react-apollo + apps/**/__generated__: + preset: near-operation-file + presetConfig: + folder: __generated___ + extension: .ts + baseTypesPath: ~@vegaprotocol/types/types + plugins: + - typescript-operations + - typescript-react-apollo diff --git a/libs/types/project.json b/libs/types/project.json index 6e495201a..db81d2ba3 100644 --- a/libs/types/project.json +++ b/libs/types/project.json @@ -44,6 +44,7 @@ "options": { "commands": [ "npx apollo client:codegen --config=libs/types/apollo.config.js --target=typescript --globalTypesFile=libs/types/src/__generated__/globalTypes.ts", + "npx graphql-codegen --config=libs/types/codegen.yml", "node libs/types/fix-imports" ], "parallel": false diff --git a/libs/types/src/__generated__/index.ts b/libs/types/src/__generated__/index.ts deleted file mode 100644 index 1eba4846b..000000000 --- a/libs/types/src/__generated__/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './globalTypes'; diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts new file mode 100644 index 000000000..fabcb37c7 --- /dev/null +++ b/libs/types/src/__generated__/types.ts @@ -0,0 +1,4177 @@ +export type Maybe = T | null; +export type InputMaybe = Maybe; +export type Exact = { [K in keyof T]: T[K] }; +export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; +export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; +/** All built-in and custom scalars, mapped to their actual values */ +export type Scalars = { + ID: string; + String: string; + Boolean: boolean; + Int: number; + Float: number; + Timestamp: any; +}; + +/** An account record */ +export type Account = { + __typename?: 'Account'; + /** Asset, the 'currency' */ + asset: Asset; + /** Balance as string - current account balance (approx. as balances can be updated several times per second) */ + balance: Scalars['String']; + /** The balance field formatted by the client */ + balanceFormatted: Scalars['String']; + /** Market (only relevant to margin accounts) */ + market?: Maybe; + /** Account type (General, Margin, etc) */ + type: AccountType; +}; + +export type AccountEdge = { + __typename?: 'AccountEdge'; + /** Cursor identifying the account */ + cursor: Scalars['String']; + /** The account */ + node: Account; +}; + +export enum AccountField { + AccountId = 'AccountId', + AccountType = 'AccountType', + AssetId = 'AssetId', + MarketId = 'MarketId', + PartyId = 'PartyId' +} + +export type AccountFilter = { + accountTypes?: InputMaybe>; + assetId?: InputMaybe; + marketIds?: InputMaybe>; + partyIds?: InputMaybe>; +}; + +/** The various account types in Vega (used by collateral) */ +export enum AccountType { + /** Bond - an account use to maintain liquidity commitments */ + ACCOUNT_TYPE_BOND = 'ACCOUNT_TYPE_BOND', + /** External - an account use to refer to external account */ + ACCOUNT_TYPE_EXTERNAL = 'ACCOUNT_TYPE_EXTERNAL', + /** Infrastructure fee account - the account where all infrastructure fees are collected */ + ACCOUNT_TYPE_FEES_INFRASTRUCTURE = 'ACCOUNT_TYPE_FEES_INFRASTRUCTURE', + /** Liquidity fee account - the account contains fees earned by providing liquidity */ + ACCOUNT_TYPE_FEES_LIQUIDITY = 'ACCOUNT_TYPE_FEES_LIQUIDITY', + /** Market maker fee account - holds fees paid to the passive side when a trade matches */ + ACCOUNT_TYPE_FEES_MAKER = 'ACCOUNT_TYPE_FEES_MAKER', + /** General account - the account containing 'unused' collateral for parties */ + ACCOUNT_TYPE_GENERAL = 'ACCOUNT_TYPE_GENERAL', + /** Global insurance pool account for an asset */ + ACCOUNT_TYPE_GLOBAL_INSURANCE = 'ACCOUNT_TYPE_GLOBAL_INSURANCE', + /** GlobalReward - a global account for the reward pool */ + ACCOUNT_TYPE_GLOBAL_REWARD = 'ACCOUNT_TYPE_GLOBAL_REWARD', + /** Insurance pool account - only for 'system' party */ + ACCOUNT_TYPE_INSURANCE = 'ACCOUNT_TYPE_INSURANCE', + /** + * Margin - The leverage account for parties, contains funds set aside for the margin needed to support + * a party's open positions. Each party will have a margin account for each market they have traded in. + * The required initial margin is allocated to each market from the general account, and it cannot be withdrawn + * or used as margin on another market until it's released back into the general account. + * The protocol uses an internal accounting system to segregate funds held as margin from other funds + * to ensure they are never lost or 'double spent' + */ + ACCOUNT_TYPE_MARGIN = 'ACCOUNT_TYPE_MARGIN', + /** PendingTransfers - a global account for the pending transfers pool */ + ACCOUNT_TYPE_PENDING_TRANSFERS = 'ACCOUNT_TYPE_PENDING_TRANSFERS', + /** RewardLpReceivedFees - an account holding rewards for a liquidity provider's received fees */ + ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES = 'ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES', + /** RewardMakerReceivedFees - an account holding rewards for maker received fees */ + ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES = 'ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES', + /** RewardMarketProposers - an account holding rewards for market proposers */ + ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS = 'ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS', + /** RewardTakerPaidFees - an account holding rewards for taker paid fees */ + ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES = 'ACCOUNT_TYPE_REWARD_TAKER_PAID_FEES', + /** Settlement - only for 'system' party */ + ACCOUNT_TYPE_SETTLEMENT = 'ACCOUNT_TYPE_SETTLEMENT' +} + +export type AccountsConnection = { + __typename?: 'AccountsConnection'; + /** List of accounts available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +export type AggregatedBalance = { + __typename?: 'AggregatedBalance'; + /** Account identifier, if query was grouped by account - else null */ + accountId?: Maybe; + /** Account type, if query was grouped by account type - else null */ + accountType?: Maybe; + /** Asset identifier, if query was grouped by asset - else null */ + assetId?: Maybe; + /** Net balance of the accounts specified in the filter at this time */ + balance: Scalars['String']; + /** Market identifier, if query was grouped by market - else null */ + marketId?: Maybe; + /** Party identifier, if query was grouped by party - else null */ + partyId?: Maybe; + /** RFC3339Nano time from at which this balance was relevant */ + timestamp: Scalars['Timestamp']; +}; + +/** Represents an asset in Vega */ +export type Asset = { + __typename?: 'Asset'; + /** The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ + decimals: Scalars['Int']; + /** The global reward pool account for this asset */ + globalRewardPoolAccount?: Maybe; + /** The ID of the asset */ + id: Scalars['ID']; + /** The infrastructure fee account for this asset */ + infrastructureFeeAccount: Account; + /** The liquidity provision reward account for this asset */ + lpFeeRewardAccount?: Maybe; + /** The maker fee reward account for this asset */ + makerFeeRewardAccount?: Maybe; + /** The market proposer reward account for this asset */ + marketProposerRewardAccount?: Maybe; + /** The full name of the asset (e.g: Great British Pound) */ + name: Scalars['String']; + /** The minimum economically meaningful amount in the asset */ + quantum: Scalars['String']; + /** The origin source of the asset (e.g: an ERC20 asset) */ + source: AssetSource; + /** The status of the asset in the Vega network */ + status: AssetStatus; + /** The symbol of the asset (e.g: GBP) */ + symbol: Scalars['String']; + /** The taker fee reward account for this asset */ + takerFeeRewardAccount?: Maybe; +}; + +export type AssetEdge = { + __typename?: 'AssetEdge'; + cursor: Scalars['String']; + node: Asset; +}; + +/** One of the possible asset sources */ +export type AssetSource = BuiltinAsset | ERC20; + +export enum AssetStatus { + /** Asset can be used on the Vega network */ + STATUS_ENABLED = 'STATUS_ENABLED', + /** Asset is pending listing on the ethereum bridge */ + STATUS_PENDING_LISTING = 'STATUS_PENDING_LISTING', + /** Asset is proposed to be added to the network */ + STATUS_PROPOSED = 'STATUS_PROPOSED', + /** Asset has been rejected */ + STATUS_REJECTED = 'STATUS_REJECTED' +} + +export type AssetsConnection = { + __typename?: 'AssetsConnection'; + /** The assets */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +/** + * An auction duration is used to configure 3 auction periods: + * 1. `duration > 0`, `volume == 0`: + * The auction will last for at least N seconds. + * 2. `duration == 0`, `volume > 0`: + * The auction will end once the given volume will match at uncrossing. + * 3. `duration > 0`, `volume > 0`: + * The auction will take at least N seconds, but can end sooner if the market can trade a certain volume. + */ +export type AuctionDuration = { + __typename?: 'AuctionDuration'; + /** Duration of the auction in seconds */ + durationSecs: Scalars['Int']; + /** Target uncrossing trading volume */ + volume: Scalars['Int']; +}; + +export type AuctionEvent = { + __typename?: 'AuctionEvent'; + /** RFC3339Nano optional end time of auction */ + auctionEnd: Scalars['String']; + /** RFC3339Nano start time of auction */ + auctionStart: Scalars['String']; + /** What, if anything, extended the ongoing auction */ + extensionTrigger?: Maybe; + /** Event fired because of auction end */ + leave: Scalars['Boolean']; + /** The ID of the market that went into auction */ + marketId: Scalars['ID']; + /** Event related to opening auction */ + openingAuction: Scalars['Boolean']; + /** What triggered the auction */ + trigger: AuctionTrigger; +}; + +export enum AuctionTrigger { + /** Auction because market has a frequent batch auction trading mode */ + AUCTION_TRIGGER_BATCH = 'AUCTION_TRIGGER_BATCH', + /** Liquidity monitoring */ + AUCTION_TRIGGER_LIQUIDITY = 'AUCTION_TRIGGER_LIQUIDITY', + /** Opening auction */ + AUCTION_TRIGGER_OPENING = 'AUCTION_TRIGGER_OPENING', + /** Price monitoring */ + AUCTION_TRIGGER_PRICE = 'AUCTION_TRIGGER_PRICE', + /** Invalid trigger (or no auction) */ + AUCTION_TRIGGER_UNSPECIFIED = 'AUCTION_TRIGGER_UNSPECIFIED' +} + +/** A Vega builtin asset, mostly for testing purpose */ +export type BuiltinAsset = { + __typename?: 'BuiltinAsset'; + /** Maximum amount that can be requested by a party through the built-in asset faucet at a time */ + maxFaucetAmountMint: Scalars['String']; +}; + +export type BusEvent = { + __typename?: 'BusEvent'; + /** the block hash */ + block: Scalars['String']; + /** the payload - the wrapped event */ + event: Event; + /** the ID for this event */ + eventId: Scalars['ID']; + /** the type of event */ + type: BusEventType; +}; + +export enum BusEventType { + /** An account has been updated */ + Account = 'Account', + /** An asset has been created or update */ + Asset = 'Asset', + /** A market has either entered or exited auction */ + Auction = 'Auction', + /** Collateral has deposited in to this Vega network via the bridge */ + Deposit = 'Deposit', + /** A liquidity commitment change occurred */ + LiquidityProvision = 'LiquidityProvision', + /** A position has been closed without sufficient insurance pool balance to cover it */ + LossSocialization = 'LossSocialization', + /** Margin levels have changed for a position */ + MarginLevels = 'MarginLevels', + /** constant for market events - mainly used for logging */ + Market = 'Market', + /** A new market has been created */ + MarketCreated = 'MarketCreated', + /** Market data has been updated */ + MarketData = 'MarketData', + /** A market has progressed by one tick */ + MarketTick = 'MarketTick', + /** A market has been updated */ + MarketUpdated = 'MarketUpdated', + /** Validator node signatures for an event */ + NodeSignature = 'NodeSignature', + /** An oracle spec has been registered */ + OracleSpec = 'OracleSpec', + /** An order has been created or updated */ + Order = 'Order', + /** A party has been updated */ + Party = 'Party', + /** A position resolution event has occurred */ + PositionResolution = 'PositionResolution', + /** A governance proposal has been created or updated */ + Proposal = 'Proposal', + /** A risk factor adjustment was made */ + RiskFactor = 'RiskFactor', + /** A distressed position has been settled */ + SettleDistressed = 'SettleDistressed', + /** A position has been settled */ + SettlePosition = 'SettlePosition', + /** Vega Time has changed */ + TimeUpdate = 'TimeUpdate', + /** A trade has been created */ + Trade = 'Trade', + /** A balance has been transferred between accounts */ + TransferResponses = 'TransferResponses', + /** A vote has been placed on a governance proposal */ + Vote = 'Vote', + /** Collateral has been withdrawn from this Vega network via the bridge */ + Withdrawal = 'Withdrawal' +} + +/** Candle stick representation of trading */ +export type Candle = { + __typename?: 'Candle'; + /** Close price (uint64) */ + close: Scalars['String']; + /** RFC3339Nano formatted date and time for the candle */ + datetime: Scalars['String']; + /** High price (uint64) */ + high: Scalars['String']; + /** Interval price (string) */ + interval: Interval; + /** Low price (uint64) */ + low: Scalars['String']; + /** Open price (uint64) */ + open: Scalars['String']; + /** Unix epoch+nanoseconds for when the candle occurred */ + timestamp: Scalars['String']; + /** Volume price (uint64) */ + volume: Scalars['String']; +}; + +export type CandleDataConnection = { + __typename?: 'CandleDataConnection'; + /** The candles */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type CandleEdge = { + __typename?: 'CandleEdge'; + cursor: Scalars['String']; + node: CandleNode; +}; + +export type CandleNode = { + __typename?: 'CandleNode'; + /** Close price (uint64) */ + close: Scalars['String']; + /** High price (uint64) */ + high: Scalars['String']; + /** RFC3339Nano formatted date and time for the candle */ + lastUpdate: Scalars['String']; + /** Low price (uint64) */ + low: Scalars['String']; + /** Open price (uint64) */ + open: Scalars['String']; + /** Unix epoch+nanoseconds for when the candle occurred */ + start: Scalars['String']; + /** Volume price (uint64) */ + volume: Scalars['String']; +}; + +/** Condition describes the condition that must be validated by the oracle engine */ +export type Condition = { + __typename?: 'Condition'; + /** comparator is the type of comparison to make on the value. */ + operator: ConditionOperator; + /** value is used by the comparator. */ + value?: Maybe; +}; + +/** Comparator describes the type of comparison. */ +export enum ConditionOperator { + /** Verify if the property values are strictly equal or not. */ + OPERATOR_EQUALS = 'OPERATOR_EQUALS', + /** Verify if the oracle data value is greater than the Condition value. */ + OPERATOR_GREATER_THAN = 'OPERATOR_GREATER_THAN', + /** + * Verify if the oracle data value is greater than or equal to the Condition + * value. + */ + OPERATOR_GREATER_THAN_OR_EQUAL = 'OPERATOR_GREATER_THAN_OR_EQUAL', + /** Verify if the oracle data value is less than the Condition value. */ + OPERATOR_LESS_THAN = 'OPERATOR_LESS_THAN', + /** + * Verify if the oracle data value is less or equal to than the Condition + * value. + */ + OPERATOR_LESS_THAN_OR_EQUAL = 'OPERATOR_LESS_THAN_OR_EQUAL' +} + +/** A mode where Vega tries to execute orders as soon as they are received */ +export type ContinuousTrading = { + __typename?: 'ContinuousTrading'; + /** Size of an increment in price in terms of the quote currency */ + tickSize: Scalars['String']; +}; + +export type Delegation = { + __typename?: 'Delegation'; + /** Amount delegated */ + amount: Scalars['String']; + /** The amount field formatted by the client */ + amountFormatted: Scalars['String']; + /** Epoch of delegation */ + epoch: Scalars['Int']; + /** URL of node you are delegating to */ + node: Node; + /** Party that is delegating */ + party: Party; +}; + +export type DelegationEdge = { + __typename?: 'DelegationEdge'; + /** The cursor for the data item */ + cursor: Scalars['String']; + /** The delegation information */ + node: Delegation; +}; + +export type DelegationsConnection = { + __typename?: 'DelegationsConnection'; + /** The delegation information available on this connection */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo: PageInfo; +}; + +/** The details of a deposit processed by Vega */ +export type Deposit = { + __typename?: 'Deposit'; + /** The amount to be withdrawn */ + amount: Scalars['String']; + /** The asset to be withdrawn */ + asset: Asset; + /** RFC3339Nano time at which the deposit was created */ + createdTimestamp: Scalars['String']; + /** RFC3339Nano time at which the deposit was finalised */ + creditedTimestamp?: Maybe; + /** The Vega internal ID of the deposit */ + id: Scalars['ID']; + /** The PartyID initiating the deposit */ + party: Party; + /** The current status of the deposit */ + status: DepositStatus; + /** Hash of the transaction on the foreign chain */ + txHash?: Maybe; +}; + +export type DepositEdge = { + __typename?: 'DepositEdge'; + cursor: Scalars['String']; + node: Deposit; +}; + +/** The status of a deposit */ +export enum DepositStatus { + /** The deposit have been cancelled by the network, either because it expired, or something went wrong with the foreign chain */ + STATUS_CANCELLED = 'STATUS_CANCELLED', + /** The deposit was finalised, it was valid, the foreign chain has executed it and the network updated all accounts */ + STATUS_FINALIZED = 'STATUS_FINALIZED', + /** The deposit is open and being processed by the network */ + STATUS_OPEN = 'STATUS_OPEN' +} + +export type DepositsConnection = { + __typename?: 'DepositsConnection'; + /** The deposits */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +/** Frequent batch auctions trading mode */ +export type DiscreteTrading = { + __typename?: 'DiscreteTrading'; + /** Duration of the discrete trading batch in nanoseconds. Maximum 1 month. */ + duration: Scalars['Int']; + /** Size of an increment in price in terms of the quote currency */ + tickSize: Scalars['String']; +}; + +export enum DispatchMetric { + DISPATCH_METRIC_LP_FEES_RECEIVED = 'DISPATCH_METRIC_LP_FEES_RECEIVED', + DISPATCH_METRIC_MAKER_FEES_RECEIVED = 'DISPATCH_METRIC_MAKER_FEES_RECEIVED', + DISPATCH_METRIC_MARKET_VALUE = 'DISPATCH_METRIC_MARKET_VALUE', + DISPATCH_METRIC_TAKER_FEES_PAID = 'DISPATCH_METRIC_TAKER_FEES_PAID' +} + +export type DispatchStrategy = { + __typename?: 'DispatchStrategy'; + /** Defines the data that will be used to compare markets so as to distribute rewards appropriately */ + dispatchMetric: DispatchMetric; + /** The asset to use for measuring contribution to the metric */ + dispatchMetricAssetId: Scalars['ID']; + /** Scope the dispatch to this market only under the metric asset */ + marketIdsInScope?: Maybe>; +}; + +/** An asset originated from an Ethereum ERC20 Token */ +export type ERC20 = { + __typename?: 'ERC20'; + /** The address of the ERC20 contract */ + contractAddress: Scalars['String']; + /** + * The lifetime limits deposit per address + * Note: this is a temporary measure for alpha mainnet + */ + lifetimeLimit: Scalars['String']; + /** + * The maximum allowed per withdrawal + * Note: this is a temporary measure for alpha mainnet + */ + withdrawThreshold: Scalars['String']; +}; + +export type Epoch = { + __typename?: 'Epoch'; + /** @deprecated Use delegationsConnection instead */ + delegations: Array; + delegationsConnection: DelegationsConnection; + /** Presumably this is an integer or something. If there's no such thing, disregard */ + id: Scalars['String']; + /** Timestamps for start and end of epochs */ + timestamps: EpochTimestamps; + /** + * Validators that participated in this epoch + * @deprecated Use validatorsConnection instead + */ + validators: Array; + /** Validators that participated in this epoch */ + validatorsConnection: NodesConnection; +}; + + +export type EpochdelegationsArgs = { + first?: InputMaybe; + last?: InputMaybe; + nodeId?: InputMaybe; + partyId?: InputMaybe; + skip?: InputMaybe; +}; + + +export type EpochdelegationsConnectionArgs = { + nodeId?: InputMaybe; + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + + +export type EpochvalidatorsConnectionArgs = { + pagination?: InputMaybe; +}; + +export type EpochData = { + __typename?: 'EpochData'; + /** Total number of offline epochs since node was created */ + offline: Scalars['Int']; + /** Total number of online epochs since node was created */ + online: Scalars['Int']; + /** Total number of epochs since node was created */ + total: Scalars['Int']; +}; + +export type EpochParticipation = { + __typename?: 'EpochParticipation'; + epoch?: Maybe; + /** RFC3339 timestamp */ + offline?: Maybe; + /** RFC3339 timestamp */ + online?: Maybe; + totalRewards?: Maybe; +}; + +export type EpochTimestamps = { + __typename?: 'EpochTimestamps'; + /** RFC3339 timestamp - Vega time of epoch end, null if not ended */ + end?: Maybe; + /** RFC3339 timestamp - Vega time of epoch expiry */ + expiry?: Maybe; + /** RFC3339 timestamp - Vega time of epoch start, null if not started */ + start?: Maybe; +}; + +/** All the data related to the approval of a withdrawal from the network */ +export type Erc20WithdrawalApproval = { + __typename?: 'Erc20WithdrawalApproval'; + /** The amount to be withdrawn */ + amount: Scalars['String']; + /** The source asset in the ethereum network */ + assetSource: Scalars['String']; + /** Timestamp at which the withdrawal was created */ + creation: Scalars['String']; + /** Timestamp in seconds for expiry of the approval */ + expiry: Scalars['String']; + /** The nonce to be used in the request */ + nonce: Scalars['String']; + /** + * Signature aggregate from the nodes, in the following format: + * 0x + sig1 + sig2 + ... + sigN + */ + signatures: Scalars['String']; + /** The target address which will receive the funds */ + targetAddress: Scalars['String']; +}; + +/** Specific details for an erc20 withdrawal */ +export type Erc20WithdrawalDetails = { + __typename?: 'Erc20WithdrawalDetails'; + /** The ethereum address of the receiver of the asset funds */ + receiverAddress: Scalars['String']; +}; + +/** An Ethereum oracle */ +export type EthereumEvent = { + __typename?: 'EthereumEvent'; + /** The ID of the ethereum contract to use (string) */ + contractId: Scalars['String']; + /** Name of the Ethereum event to listen to. (string) */ + event: Scalars['String']; +}; + +export type EthereumKeyRotation = { + __typename?: 'EthereumKeyRotation'; + /** Block height when the rotation took place */ + blockHeight: Scalars['String']; + /** New ethereum address */ + newAddress: Scalars['String']; + /** ID of node where rotation took place */ + nodeId: Scalars['String']; + /** Old ethereum address */ + oldAddress: Scalars['String']; +}; + +export type EthereumKeyRotationEdge = { + __typename?: 'EthereumKeyRotationEdge'; + cursor?: Maybe; + ethereumKeyRotation: EthereumKeyRotation; +}; + +export type EthereumKeyRotationsConnection = { + __typename?: 'EthereumKeyRotationsConnection'; + /** The ethereum key rotations in this connection */ + edges: Array; + /** The pagination information */ + pageInfo?: Maybe; +}; + +/** union type for wrapped events in stream PROPOSAL is mapped to governance data, something to keep in mind */ +export type Event = Account | Asset | AuctionEvent | Deposit | LiquidityProvision | LossSocialization | MarginLevels | Market | MarketData | MarketEvent | MarketTick | NodeSignature | OracleSpec | Order | Party | PositionResolution | Proposal | RiskFactor | SettleDistressed | SettlePosition | TimeUpdate | Trade | TransferResponses | Vote | Withdrawal; + +/** The factors applied to calculate the fees */ +export type FeeFactors = { + __typename?: 'FeeFactors'; + /** The factor applied to calculate InfrastructureFees, a non-negative float */ + infrastructureFee: Scalars['String']; + /** The factor applied to calculate LiquidityFees, a non-negative float */ + liquidityFee: Scalars['String']; + /** The factor applied to calculate MakerFees, a non-negative float */ + makerFee: Scalars['String']; +}; + +/** The fees applicable to a market */ +export type Fees = { + __typename?: 'Fees'; + /** The factors used to calculate the different fees */ + factors: FeeFactors; +}; + +/** + * Filter describes the conditions under which oracle data is considered of + * interest or not. + */ +export type Filter = { + __typename?: 'Filter'; + /** + * conditions are the conditions that should be matched by the data to be + * considered of interest. + */ + conditions?: Maybe>; + /** key is the oracle data property key targeted by the filter. */ + key: PropertyKey; +}; + +/** A Future product */ +export type Future = { + __typename?: 'Future'; + /** The binding between the oracle spec and the settlement price */ + oracleSpecBinding: OracleSpecToFutureBinding; + /** The oracle spec describing the oracle data of interest for settlement price. */ + oracleSpecForSettlementPrice: OracleSpec; + /** The oracle spec describing the oracle data of interest for trading termination. */ + oracleSpecForTradingTermination: OracleSpec; + /** String representing the quote (e.g. BTCUSD -> USD is quote) */ + quoteName: Scalars['String']; + /** The name of the asset (string) */ + settlementAsset: Asset; +}; + +export type FutureProduct = { + __typename?: 'FutureProduct'; + /** + * OracleSpecToFutureBinding tells on which property oracle data should be + * used as settlement price. + */ + oracleSpecBinding: OracleSpecToFutureBinding; + /** Describes the oracle data that an instrument wants to get from the oracle engine for settlement price. */ + oracleSpecForSettlementPrice: OracleSpecConfiguration; + /** Describes the oracle data that an instrument wants to get from the oracle engine for trading termination. */ + oracleSpecForTradingTermination: OracleSpecConfiguration; + /** String representing the quote (e.g. BTCUSD -> USD is quote) */ + quoteName: Scalars['String']; + /** Product asset ID */ + settlementAsset: Asset; +}; + +/** Describes something that can be traded on Vega */ +export type Instrument = { + __typename?: 'Instrument'; + /** A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ + code: Scalars['String']; + /** Uniquely identify an instrument across all instruments available on Vega (string) */ + id: Scalars['String']; + /** Metadata for this instrument */ + metadata: InstrumentMetadata; + /** Full and fairly descriptive name for the instrument */ + name: Scalars['String']; + /** A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) */ + product: Product; +}; + +export type InstrumentConfiguration = { + __typename?: 'InstrumentConfiguration'; + /** A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) */ + code: Scalars['String']; + /** Future product specification */ + futureProduct?: Maybe; + /** Full and fairly descriptive name for the instrument */ + name: Scalars['String']; +}; + +/** A set of metadata to associate to an instrument */ +export type InstrumentMetadata = { + __typename?: 'InstrumentMetadata'; + /** An arbitrary list of tags to associated to associate to the Instrument (string list) */ + tags?: Maybe>; +}; + +/** The interval for trade candles when subscribing via Vega GraphQL, default is I15M */ +export enum Interval { + /** 1 day interval */ + INTERVAL_I1D = 'INTERVAL_I1D', + /** 1 hour interval */ + INTERVAL_I1H = 'INTERVAL_I1H', + /** 1 minute interval */ + INTERVAL_I1M = 'INTERVAL_I1M', + /** 5 minute interval */ + INTERVAL_I5M = 'INTERVAL_I5M', + /** 6 hour interval */ + INTERVAL_I6H = 'INTERVAL_I6H', + /** 15 minute interval (default) */ + INTERVAL_I15M = 'INTERVAL_I15M' +} + +export type KeyRotation = { + __typename?: 'KeyRotation'; + /** Block height when the rotation took place */ + blockHeight: Scalars['String']; + /** New public key rotated to */ + newPubKey: Scalars['String']; + /** ID of node where rotation took place */ + nodeId: Scalars['String']; + /** Old public key rotated from */ + oldPubKey: Scalars['String']; +}; + +export type KeyRotationConnection = { + __typename?: 'KeyRotationConnection'; + /** List of key rotations available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +export type KeyRotationEdge = { + __typename?: 'KeyRotationEdge'; + /** Cursor identifying the key rotation */ + cursor: Scalars['String']; + /** The key rotation */ + node: KeyRotation; +}; + +export type LedgerEntry = { + __typename?: 'LedgerEntry'; + /** The amount transferred */ + amount: Scalars['String']; + /** Account from which the asset was taken */ + fromAccount: Scalars['String']; + /** The transfer reference */ + reference: Scalars['String']; + /** RFC3339Nano time at which the transfer was made */ + timestamp: Scalars['String']; + /** Account to which the balance was transferred */ + toAccount: Scalars['String']; + /** Type of ledger entry */ + type: Scalars['String']; +}; + +/** Configuration of a market liquidity monitoring parameters */ +export type LiquidityMonitoringParameters = { + __typename?: 'LiquidityMonitoringParameters'; + /** Specifies parameters related to target stake calculation */ + targetStakeParameters: TargetStakeParameters; + /** Specifies the triggering ratio for entering liquidity auction */ + triggeringRatio: Scalars['Float']; +}; + +/** A special order type for liquidity providers */ +export type LiquidityOrder = { + __typename?: 'LiquidityOrder'; + /** Offset from the pegged reference */ + offset: Scalars['String']; + /** The proportion of the commitment allocated to this order */ + proportion: Scalars['Int']; + /** The value to which this order is tied */ + reference: PeggedReference; +}; + +export type LiquidityOrderReference = { + __typename?: 'LiquidityOrderReference'; + /** The liquidity order */ + liquidityOrder: LiquidityOrder; + /** The ID of the pegged order generated to fulfill this commitment */ + order?: Maybe; +}; + +/** The equity like share of liquidity fee for each liquidity provider */ +export type LiquidityProviderFeeShare = { + __typename?: 'LiquidityProviderFeeShare'; + /** The average entry valuation of the liquidity provider for the market */ + averageEntryValuation: Scalars['String']; + /** The share owned by this liquidity provider (float) */ + equityLikeShare: Scalars['String']; + /** The liquidity provider party ID */ + party: Party; +}; + +/** The command to be sent to the chain for a liquidity provision submission */ +export type LiquidityProvision = { + __typename?: 'LiquidityProvision'; + /** a set of liquidity buy orders to meet the liquidity provision obligation. */ + buys: Array; + /** Specified as a unit-less number that represents the amount of settlement asset of the market. */ + commitmentAmount: Scalars['String']; + /** When the liquidity provision was initially created (formatted RFC3339) */ + createdAt: Scalars['String']; + /** Nominated liquidity fee factor, which is an input to the calculation of maker fees on the market, as per setting fees and rewarding liquidity providers. */ + fee: Scalars['String']; + /** Unique identifier for the order (set by the system after consensus) */ + id?: Maybe; + /** Market ID for the order */ + market: Market; + /** The Id of the party making this commitment */ + party: Party; + /** A reference for the orders created out of this Liquidity provision */ + reference?: Maybe; + /** a set of liquidity sell orders to meet the liquidity provision obligation. */ + sells: Array; + /** The current status of this liquidity provision */ + status: LiquidityProvisionStatus; + /** RFC3339Nano time of when the liquidity provision was updated */ + updatedAt?: Maybe; + /** The version of this LiquidityProvision */ + version: Scalars['String']; +}; + +/** Status of a liquidity provision order */ +export enum LiquidityProvisionStatus { + /** An active liquidity provision */ + STATUS_ACTIVE = 'STATUS_ACTIVE', + /** A cancelled liquidity provision */ + STATUS_CANCELLED = 'STATUS_CANCELLED', + /** + * The liquidity provision is valid and accepted by the network, but orders aren't deployed and + * have never been deployed. If when it's possible to deploy them for the first time the + * margin check fails, then they will be cancelled without any penalties. + */ + STATUS_PENDING = 'STATUS_PENDING', + /** Liquidity provision was invalid and got rejected */ + STATUS_REJECTED = 'STATUS_REJECTED', + /** A liquidity provision stopped by the network */ + STATUS_STOPPED = 'STATUS_STOPPED', + /** The liquidity provision is valid and accepted by the network, but orders aren't deployed */ + STATUS_UNDEPLOYED = 'STATUS_UNDEPLOYED' +} + +export type LiquidityProvisionsConnection = { + __typename?: 'LiquidityProvisionsConnection'; + edges?: Maybe>>; + pageInfo: PageInfo; +}; + +export type LiquidityProvisionsEdge = { + __typename?: 'LiquidityProvisionsEdge'; + cursor: Scalars['String']; + node: LiquidityProvision; +}; + +/** Parameters for the log normal risk model */ +export type LogNormalModelParams = { + __typename?: 'LogNormalModelParams'; + /** mu parameter, annualised growth rate of the underlying asset */ + mu: Scalars['Float']; + /** r parameter */ + r: Scalars['Float']; + /** sigma parameter, annualised volatility of the underlying asset, must be a strictly non-negative real number */ + sigma: Scalars['Float']; +}; + +/** A type of risk model for futures trading */ +export type LogNormalRiskModel = { + __typename?: 'LogNormalRiskModel'; + /** Parameters for the log normal risk model */ + params: LogNormalModelParams; + /** Lambda parameter of the risk model, probability confidence level used in expected shortfall calculation when obtaining the maintenance margin level, must be strictly greater than 0 and strictly smaller than 1 */ + riskAversionParameter: Scalars['Float']; + /** Tau parameter of the risk model, projection horizon measured as a year fraction used in the expected shortfall calculation to obtain the maintenance margin, must be a strictly non-negative real number */ + tau: Scalars['Float']; +}; + +export type LossSocialization = { + __typename?: 'LossSocialization'; + /** the amount lost */ + amount: Scalars['String']; + /** the market ID where loss socialization happened */ + marketId: Scalars['ID']; + /** the party that was part of the loss socialization */ + partyId: Scalars['ID']; +}; + +export type MarginCalculator = { + __typename?: 'MarginCalculator'; + /** The scaling factors that will be used for margin calculation */ + scalingFactors: ScalingFactors; +}; + +export type MarginConnection = { + __typename?: 'MarginConnection'; + /** The margin levels in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type MarginEdge = { + __typename?: 'MarginEdge'; + cursor?: Maybe; + node: MarginLevels; +}; + +/** Margins for a given a party */ +export type MarginLevels = { + __typename?: 'MarginLevels'; + /** asset for the current margins */ + asset: Asset; + /** + * If the margin of the party is greater than this level, then collateral will be released from the margin account into + * the general account of the party for the given asset. + */ + collateralReleaseLevel: Scalars['String']; + /** this is the minimum margin required for a party to place a new order on the network (unsigned integer) */ + initialLevel: Scalars['String']; + /** minimal margin for the position to be maintained in the network (unsigned integer) */ + maintenanceLevel: Scalars['String']; + /** market in which the margin is required for this party */ + market: Market; + /** ID of the party for this margin */ + party: Party; + /** if the margin is between maintenance and search, the network will initiate a collateral search (unsigned integer) */ + searchLevel: Scalars['String']; + /** RFC3339Nano time from at which this margin level was relevant */ + timestamp: Scalars['String']; +}; + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type Market = { + __typename?: 'Market'; + /** + * Get account for a party or market + * @deprecated Use the accountsConnection instead + */ + accounts?: Maybe>; + /** Get account for a party or market */ + accountsConnection: AccountsConnection; + /** + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters + * @deprecated Use the 'candlesConnection' field instead + */ + candles?: Maybe>>; + /** Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination */ + candlesConnection: CandleDataConnection; + /** marketData for the given market */ + data?: Maybe; + /** + * 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: Scalars['Int']; + /** Current depth on the order book for this market */ + depth: MarketDepth; + /** Fees related data */ + fees: Fees; + /** Market ID */ + id: Scalars['ID']; + /** Liquidity monitoring parameters for the market */ + liquidityMonitoringParameters: LiquidityMonitoringParameters; + /** + * The list of the liquidity provision commitments for this market + * @deprecated Use liquidityProvisionsConnection instead + */ + liquidityProvisions?: Maybe>; + /** The list of the liquidity provision commitments for this market */ + liquidityProvisionsConnection: LiquidityProvisionsConnection; + /** timestamps for state changes in the market */ + marketTimestamps: MarketTimestamps; + /** Market full name */ + name: Scalars['String']; + /** + * Auction duration specifies how long the opening auction will run (minimum + * duration and optionally a minimum traded volume). + */ + openingAuction: AuctionDuration; + /** + * Orders on a market + * @deprecated Use the 'ordersConnection' field instead + */ + orders?: Maybe>; + /** Orders on a market */ + ordersConnection: OrderConnection; + /** + * positionDecimalPlaces indicates 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. + * This sets how big the smallest order / position on the market can be. + */ + positionDecimalPlaces: Scalars['Int']; + /** Price monitoring settings for the market */ + priceMonitoringSettings: PriceMonitoringSettings; + /** The proposal that initiated this market */ + proposal?: Maybe; + /** risk factors for the market */ + riskFactors?: Maybe; + /** Current state of the market */ + state: MarketState; + /** An instance of, or reference to, a tradable instrument. */ + tradableInstrument: TradableInstrument; + /** + * Trades on a market + * @deprecated Use tradesConnection for cursor based pagination instead + */ + trades?: Maybe>; + tradesConnection: TradeConnection; + /** Current mode of execution of the market */ + tradingMode: MarketTradingMode; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketaccountsArgs = { + partyId?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketaccountsConnectionArgs = { + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketcandlesArgs = { + interval: Interval; + since: Scalars['String']; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketcandlesConnectionArgs = { + interval: Interval; + pagination?: InputMaybe; + since: Scalars['String']; + to?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketdepthArgs = { + maxDepth?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketliquidityProvisionsArgs = { + party?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketliquidityProvisionsConnectionArgs = { + pagination?: InputMaybe; + party?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketordersArgs = { + first?: InputMaybe; + last?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarketordersConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarkettradesArgs = { + first?: InputMaybe; + last?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a product & associated parameters that can be traded on Vega, has an associated OrderBook and Trade history */ +export type MarkettradesConnectionArgs = { + pagination?: InputMaybe; +}; + +export type MarketConnection = { + __typename?: 'MarketConnection'; + /** The markets in this connection */ + edges: Array; + /** The pagination information */ + pageInfo: PageInfo; +}; + +/** Live data of a Market */ +export type MarketData = { + __typename?: 'MarketData'; + /** RFC3339Nano time at which the auction will stop (null if not in auction mode) */ + auctionEnd?: Maybe; + /** RFC3339Nano time at which the next auction will start (null if none is scheduled) */ + auctionStart?: Maybe; + /** the highest price level on an order book for buy orders. */ + bestBidPrice: Scalars['String']; + /** the aggregated volume being bid at the best bid price. */ + bestBidVolume: Scalars['String']; + /** the lowest price level on an order book for offer orders. */ + bestOfferPrice: Scalars['String']; + /** the aggregated volume being offered at the best offer price. */ + bestOfferVolume: Scalars['String']; + /** the highest price level on an order book for buy orders not including pegged orders. */ + bestStaticBidPrice: Scalars['String']; + /** the aggregated volume being offered at the best static bid price, excluding pegged orders */ + bestStaticBidVolume: Scalars['String']; + /** the lowest price level on an order book for offer orders not including pegged orders. */ + bestStaticOfferPrice: Scalars['String']; + /** the aggregated volume being offered at the best static offer price, excluding pegged orders. */ + bestStaticOfferVolume: Scalars['String']; + /** the liquidity commitments for a given market */ + commitments: MarketDataCommitments; + /** what extended the ongoing auction (if an auction was extended) */ + extensionTrigger: AuctionTrigger; + /** indicative price if the auction ended now, 0 if not in auction mode */ + indicativePrice: Scalars['String']; + /** indicative volume if the auction ended now, 0 if not in auction mode */ + indicativeVolume: Scalars['String']; + /** the equity like share of liquidity fee for each liquidity provider */ + liquidityProviderFeeShare?: Maybe>; + /** the mark price (an unsigned integer) */ + markPrice: Scalars['String']; + /** market ID of the associated mark price */ + market: Market; + /** what state the market is in (auction, continuous, etc) */ + marketTradingMode: MarketTradingMode; + /** the market value proxy */ + marketValueProxy: Scalars['String']; + /** the arithmetic average of the best bid price and best offer price. */ + midPrice: Scalars['String']; + /** the sum of the size of all positions greater than 0. */ + openInterest: Scalars['String']; + /** a list of valid price ranges per associated trigger */ + priceMonitoringBounds?: Maybe>; + /** the arithmetic average of the best static bid price and best static offer price */ + staticMidPrice: Scalars['String']; + /** the supplied stake for the market */ + suppliedStake?: Maybe; + /** the amount of stake targeted for this market */ + targetStake?: Maybe; + /** RFC3339Nano time at which this market price was relevant */ + timestamp: Scalars['String']; + /** what triggered an auction (if an auction was started) */ + trigger: AuctionTrigger; +}; + +/** The liquidity commitments for this market */ +export type MarketDataCommitments = { + __typename?: 'MarketDataCommitments'; + /** a set of liquidity buy orders to meet the liquidity provision obligation. */ + buys?: Maybe>; + /** a set of liquidity sell orders to meet the liquidity provision obligation. */ + sells?: Maybe>; +}; + +export type MarketDataConnection = { + __typename?: 'MarketDataConnection'; + /** The market data elements for the requested page */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type MarketDataEdge = { + __typename?: 'MarketDataEdge'; + cursor?: Maybe; + node: MarketData; +}; + +/** + * Market Depth is a measure of the number of open buy and sell orders for a security or currency at different prices. + * The depth of market measure provides an indication of the liquidity and depth for the instrument. + */ +export type MarketDepth = { + __typename?: 'MarketDepth'; + /** Buy side price levels (if available) */ + buy?: Maybe>; + /** Last trade for the given market (if available) */ + lastTrade?: Maybe; + /** Market ID */ + market: Market; + /** Sell side price levels (if available) */ + sell?: Maybe>; + /** Sequence number for the current snapshot of the market depth */ + sequenceNumber: Scalars['String']; +}; + +export type MarketDepthTrade = { + __typename?: 'MarketDepthTrade'; + /** ID of the trade for the given market (if available) */ + id: Scalars['String']; + /** Price of the trade */ + price: Scalars['String']; + /** Size of the trade */ + size: Scalars['String']; +}; + +/** + * Market Depth Update is a delta to the current market depth which can be used to update the + * market depth structure to keep it correct + */ +export type MarketDepthUpdate = { + __typename?: 'MarketDepthUpdate'; + /** Buy side price levels (if available) */ + buy?: Maybe>; + /** Market */ + market: Market; + /** Sequence number of the last update sent; useful for checking that no updates were missed. */ + previousSequenceNumber: Scalars['String']; + /** Sell side price levels (if available) */ + sell?: Maybe>; + /** Sequence number for the current snapshot of the market depth. It is always increasing but not monotonic. */ + sequenceNumber: Scalars['String']; +}; + +export type MarketEdge = { + __typename?: 'MarketEdge'; + cursor: Scalars['String']; + node: Market; +}; + +export type MarketEvent = { + __typename?: 'MarketEvent'; + /** the market ID */ + marketId: Scalars['ID']; + /** the message - market events are used for logging */ + payload: Scalars['String']; +}; + +/** The current state of a market */ +export enum MarketState { + /** Enactment date reached and usual auction exit checks pass */ + STATE_ACTIVE = 'STATE_ACTIVE', + /** + * Market triggers cancellation condition or governance + * votes to close before market becomes Active + */ + STATE_CANCELLED = 'STATE_CANCELLED', + /** Governance vote (to close) */ + STATE_CLOSED = 'STATE_CLOSED', + /** Governance vote passes/wins */ + STATE_PENDING = 'STATE_PENDING', + /** The governance proposal valid and accepted */ + STATE_PROPOSED = 'STATE_PROPOSED', + /** Outcome of governance votes is to reject the market */ + STATE_REJECTED = 'STATE_REJECTED', + /** Settlement triggered and completed as defined by product */ + STATE_SETTLED = 'STATE_SETTLED', + /** Price monitoring or liquidity monitoring trigger */ + STATE_SUSPENDED = 'STATE_SUSPENDED', + /** + * Defined by the product (i.e. from a product parameter, + * specified in market definition, giving close date/time) + */ + STATE_TRADING_TERMINATED = 'STATE_TRADING_TERMINATED' +} + +export type MarketTick = { + __typename?: 'MarketTick'; + /** the market ID */ + marketId: Scalars['ID']; + /** the block time */ + time: Scalars['String']; +}; + +/** timestamps for when the market changes state */ +export type MarketTimestamps = { + __typename?: 'MarketTimestamps'; + /** Time when the market is closed */ + close?: Maybe; + /** Time when the market is open and ready to accept trades */ + open?: Maybe; + /** Time when the market has been voted in and waiting to be created */ + pending?: Maybe; + /** Time when the market is first proposed */ + proposed?: Maybe; +}; + +/** What market trading mode is the market in */ +export enum MarketTradingMode { + /** Auction as normal trading mode for the market, where orders are uncrossed periodically */ + TRADING_MODE_BATCH_AUCTION = 'TRADING_MODE_BATCH_AUCTION', + /** Continuous trading where orders are processed and potentially matched on arrival */ + TRADING_MODE_CONTINUOUS = 'TRADING_MODE_CONTINUOUS', + /** Auction triggered by price/liquidity monitoring */ + TRADING_MODE_MONITORING_AUCTION = 'TRADING_MODE_MONITORING_AUCTION', + /** No trading allowed */ + TRADING_MODE_NO_TRADING = 'TRADING_MODE_NO_TRADING', + /** Auction trading where orders are uncrossed at the end of the opening auction period */ + TRADING_MODE_OPENING_AUCTION = 'TRADING_MODE_OPENING_AUCTION' +} + +/** Information about whether proposals are enabled, if the markets are still bootstrapping etc.. */ +export type NetworkLimits = { + __typename?: 'NetworkLimits'; + /** How many blocks before the chain comes out of bootstrap mode */ + bootstrapBlockCount: Scalars['Int']; + /** True once block count > bootstrapBlockCount */ + bootstrapFinished: Scalars['Boolean']; + /** Are asset proposals allowed at this point in time */ + canProposeAsset: Scalars['Boolean']; + /** Are market proposals allowed at this point in time */ + canProposeMarket: Scalars['Boolean']; + /** True once the genesis file is loaded */ + genesisLoaded: Scalars['Boolean']; + /** Are asset proposals enabled on this chain */ + proposeAssetEnabled: Scalars['Boolean']; + /** The date/timestamp in unix nanoseconds at which asset proposals will be enabled (0 indicates not set) */ + proposeAssetEnabledFrom: Scalars['Timestamp']; + /** Are market proposals enabled on this chain */ + proposeMarketEnabled: Scalars['Boolean']; + /** The date/timestamp in unix nanoseconds at which market proposals will be enabled (0 indicates not set) */ + proposeMarketEnabledFrom: Scalars['Timestamp']; +}; + +/** Representation of a network parameter */ +export type NetworkParameter = { + __typename?: 'NetworkParameter'; + /** The name of the network parameter */ + key: Scalars['String']; + /** The value of the network parameter */ + value: Scalars['String']; +}; + +export type NetworkParameterEdge = { + __typename?: 'NetworkParameterEdge'; + /** Cursor identifying the network parameter */ + cursor: Scalars['String']; + /** The network parameter */ + node: NetworkParameter; +}; + +export type NetworkParametersConnection = { + __typename?: 'NetworkParametersConnection'; + /** List of network parameters available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +/** A new asset proposal change */ +export type NewAsset = { + __typename?: 'NewAsset'; + /** The precision of the asset */ + decimals: Scalars['Int']; + /** The full name of the asset (e.g: Great British Pound) */ + name: Scalars['String']; + /** The minimum economically meaningful amount of this specific asset */ + quantum: Scalars['String']; + /** The source of the new asset */ + source: AssetSource; + /** The symbol of the asset (e.g: GBP) */ + symbol: Scalars['String']; +}; + +/** + * A new freeform proposal change. It has no properties on purpose. Use proposal + * rationale, instead. + */ +export type NewFreeform = { + __typename?: 'NewFreeform'; + /** A placeholder to please graphQL */ + _doNotUse?: Maybe; +}; + +export type NewMarket = { + __typename?: 'NewMarket'; + /** The liquidity commitment submitted with the new market */ + commitment?: Maybe; + /** Decimal places used for the new market, sets the smallest price increment on the book */ + decimalPlaces: Scalars['Int']; + /** New market instrument configuration */ + instrument: InstrumentConfiguration; + /** Metadata for this instrument, tags */ + metadata?: Maybe>; + /** New market risk configuration */ + riskParameters: RiskModel; +}; + +/** A commitment of liquidity to be made by the party that proposes a market */ +export type NewMarketCommitment = { + __typename?: 'NewMarketCommitment'; + /** A set of liquidity buy orders to meet the liquidity provision obligation */ + buys?: Maybe>; + /** Specified as a unit-less number that represents the amount of the settlement asset of the market */ + commitmentAmount: Scalars['String']; + /** + * Nominated liquidity fee factor, which is an input to the calculation of + * maker fees on the market, as per setting fees and rewarding liquidity provider + */ + fee: Scalars['String']; + /** A reference to be associated to all orders created from this commitment */ + reference?: Maybe; + /** A set of liquidity sell orders to meet the liquidity provision obligation */ + sells?: Maybe>; +}; + +export type Node = { + __typename?: 'Node'; + avatarUrl?: Maybe; + /** @deprecated Use delegationsConnection instead */ + delegations?: Maybe>; + delegationsConnection: DelegationsConnection; + epochData?: Maybe; + /** Ethereum public key of the node */ + ethereumAddress: Scalars['String']; + /** The node URL eg n01.vega.xyz */ + id: Scalars['String']; + /** URL from which you can get more info about the node. */ + infoUrl: Scalars['String']; + /** Country code for the location of the node */ + location: Scalars['String']; + name: Scalars['String']; + /** Amount of stake on the next epoch */ + pendingStake: Scalars['String']; + /** The pending staked field formatted by the client */ + pendingStakeFormatted: Scalars['String']; + /** Public key of the node operator */ + pubkey: Scalars['String']; + /** Ranking scores and status for the validator for the current epoch */ + rankingScore: RankingScore; + /** Reward scores for the current epoch for the validator */ + rewardScore?: Maybe; + /** The amount of stake that has been delegated by token holders */ + stakedByDelegates: Scalars['String']; + /** The stakes by delegates field formatted by the client */ + stakedByDelegatesFormatted: Scalars['String']; + /** The amount of stake the node has put up themselves */ + stakedByOperator: Scalars['String']; + /** The stakes by operator field formatted by the client */ + stakedByOperatorFormatted: Scalars['String']; + /** Total amount staked on node */ + stakedTotal: Scalars['String']; + /** The total staked field formatted by the client */ + stakedTotalFormatted: Scalars['String']; + status: NodeStatus; + /** Tendermint public key of the node */ + tmPubkey: Scalars['String']; +}; + + +export type NodedelegationsArgs = { + first?: InputMaybe; + last?: InputMaybe; + partyId?: InputMaybe; + skip?: InputMaybe; +}; + + +export type NodedelegationsConnectionArgs = { + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + +export type NodeData = { + __typename?: 'NodeData'; + /** Number of inactive nodes */ + inactiveNodes: Scalars['Int']; + /** Total staked amount across all nodes */ + stakedTotal: Scalars['String']; + /** The total staked field formatted by the client */ + stakedTotalFormatted: Scalars['String']; + /** Total number of nodes */ + totalNodes: Scalars['Int']; + /** Total uptime for all epochs across all nodes. Or specify a number of epochs */ + uptime: Scalars['Float']; + /** Number of nodes validating */ + validatingNodes: Scalars['Int']; +}; + +export type NodeEdge = { + __typename?: 'NodeEdge'; + /** Cursor identifying the node */ + cursor: Scalars['String']; + /** The node */ + node: Node; +}; + +/** Represents a signature for the approval of a resource from a validator */ +export type NodeSignature = { + __typename?: 'NodeSignature'; + /** The ID of the resource being signed for */ + id: Scalars['ID']; + /** The kind of signature this is (e.g: withdrawal, new asset, etc) */ + kind?: Maybe; + /** The signature, as base64 encoding */ + signature?: Maybe; +}; + +export type NodeSignatureEdge = { + __typename?: 'NodeSignatureEdge'; + /** Cursor identifying the node signature */ + cursor: Scalars['String']; + /** The node signature */ + node: NodeSignature; +}; + +/** Represents the type signature provided by a node */ +export enum NodeSignatureKind { + /** A signature for proposing a new asset into the network */ + NODE_SIGNATURE_KIND_ASSET_NEW = 'NODE_SIGNATURE_KIND_ASSET_NEW', + /** A signature to update limits of an ERC20 asset */ + NODE_SIGNATURE_KIND_ASSET_UPDATE = 'NODE_SIGNATURE_KIND_ASSET_UPDATE', + /** A signature for allowing funds withdrawal */ + NODE_SIGNATURE_KIND_ASSET_WITHDRAWAL = 'NODE_SIGNATURE_KIND_ASSET_WITHDRAWAL', + /** A signature to add a new validator to the ERC20 bridge */ + NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_ADDED = 'NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_ADDED', + /** A siganture to remove a validator from the ERC20 bridge */ + NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_REMOVED = 'NODE_SIGNATURE_KIND_ERC20_MULTISIG_SIGNER_REMOVED' +} + +export type NodeSignaturesConnection = { + __typename?: 'NodeSignaturesConnection'; + /** List of node signatures available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +export enum NodeStatus { + /** The node is non-validating */ + NODE_STATUS_NON_VALIDATOR = 'NODE_STATUS_NON_VALIDATOR', + /** The node is validating */ + NODE_STATUS_VALIDATOR = 'NODE_STATUS_VALIDATOR' +} + +export type NodesConnection = { + __typename?: 'NodesConnection'; + /** List of nodes available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +/** The equity like share of liquidity fee for each liquidity provider */ +export type ObservableLiquidityProviderFeeShare = { + __typename?: 'ObservableLiquidityProviderFeeShare'; + /** The average entry valuation of the liquidity provider for the market */ + averageEntryValuation: Scalars['String']; + /** The share owned by this liquidity provider (float) */ + equityLikeShare: Scalars['String']; + /** The liquidity provider party ID */ + partyId: Scalars['String']; +}; + +/** Live data of a Market */ +export type ObservableMarketData = { + __typename?: 'ObservableMarketData'; + /** RFC3339Nano time at which the auction will stop (null if not in auction mode) */ + auctionEnd?: Maybe; + /** RFC3339Nano time at which the next auction will start (null if none is scheduled) */ + auctionStart?: Maybe; + /** the highest price level on an order book for buy orders. */ + bestBidPrice: Scalars['String']; + /** the aggregated volume being bid at the best bid price. */ + bestBidVolume: Scalars['String']; + /** the lowest price level on an order book for offer orders. */ + bestOfferPrice: Scalars['String']; + /** the aggregated volume being offered at the best offer price. */ + bestOfferVolume: Scalars['String']; + /** the highest price level on an order book for buy orders not including pegged orders. */ + bestStaticBidPrice: Scalars['String']; + /** the aggregated volume being offered at the best static bid price, excluding pegged orders */ + bestStaticBidVolume: Scalars['String']; + /** the lowest price level on an order book for offer orders not including pegged orders */ + bestStaticOfferPrice: Scalars['String']; + /** the aggregated volume being offered at the best static offer price, excluding pegged orders */ + bestStaticOfferVolume: Scalars['String']; + /** what extended the ongoing auction (if an auction was extended) */ + extensionTrigger: AuctionTrigger; + /** indicative price if the auction ended now, 0 if not in auction mode */ + indicativePrice: Scalars['String']; + /** indicative volume if the auction ended now, 0 if not in auction mode */ + indicativeVolume: Scalars['String']; + /** the equity like share of liquidity fee for each liquidity provider */ + liquidityProviderFeeShare?: Maybe>; + /** the mark price (an unsigned integer) */ + markPrice: Scalars['String']; + /** market ID of the associated mark price */ + marketId: Scalars['String']; + /** what state the market is in (auction, continuous etc) */ + marketTradingMode: MarketTradingMode; + /** the market value proxy */ + marketValueProxy: Scalars['String']; + /** the arithmetic average of the best bid price and best offer price */ + midPrice: Scalars['String']; + /** the sum of the size of all positions greater than 0 */ + openInterest: Scalars['String']; + /** A list of valid price ranges per associated trigger */ + priceMonitoringBounds?: Maybe>; + /** the arithmetic average of the best static bid price and best static offer price */ + staticMidPrice: Scalars['String']; + /** the supplied stake for the market */ + suppliedStake?: Maybe; + /** the amount of stake targeted for this market */ + targetStake?: Maybe; + /** RFC3339Nano time at which this market price was relevant */ + timestamp: Scalars['String']; + /** what triggered an auction (if an auction was started) */ + trigger: AuctionTrigger; +}; + +/** + * Market Depth is a measure of the number of open buy and sell orders for a security or currency at different prices. + * The depth of market measure provides an indication of the liquidity and depth for the instrument. + */ +export type ObservableMarketDepth = { + __typename?: 'ObservableMarketDepth'; + /** Buy side price levels (if available) */ + buy?: Maybe>; + /** Last trade for the given market (if available) */ + lastTrade: MarketDepthTrade; + /** Market ID */ + marketId: Scalars['String']; + /** Sell side price levels (if available) */ + sell?: Maybe>; + /** Sequence number for the current snapshot of the market depth */ + sequenceNumber: Scalars['String']; +}; + +/** + * Market Depth Update is a delta to the current market depth which can be used to update the + * market depth structure to keep it correct + */ +export type ObservableMarketDepthUpdate = { + __typename?: 'ObservableMarketDepthUpdate'; + /** Buy side price levels (if available) */ + buy?: Maybe>; + /** Market id */ + marketId: Scalars['String']; + /** Sequence number of the last update sent; useful for checking that no updates were missed. */ + previousSequenceNumber: Scalars['String']; + /** Sell side price levels (if available) */ + sell?: Maybe>; + /** Sequence number for the current snapshot of the market depth. It is always increasing but not monotonic. */ + sequenceNumber: Scalars['String']; +}; + +export type OffsetPagination = { + /** + * Descending reverses the order of the records returned + * default is true, if false the results will be returned in ascending order + */ + descending: Scalars['Boolean']; + /** Limit the number of returned records to the value specified, default is 50 */ + limit: Scalars['Int']; + /** Skip the number of records specified, default is 0 */ + skip: Scalars['Int']; +}; + +/** The specific details for a one-off transfer */ +export type OneOffTransfer = { + __typename?: 'OneOffTransfer'; + /** An optional time when the transfer should be delivered */ + deliverOn?: Maybe; +}; + +export type Oracle = EthereumEvent; + +/** An oracle data contains the data sent by an oracle */ +export type OracleData = { + __typename?: 'OracleData'; + /** + * RFC3339Nano formatted date and time for when the data was broadcast to the markets + * with a matching oracle spec. + * It has no value when the oracle date does not match any oracle spec. + */ + broadcastAt: Scalars['String']; + /** data contains all the properties send by an oracle */ + data?: Maybe>; + /** + * lists all the oracle specs that matched this oracle data. + * When the array is empty, it means no oracle spec matched this oracle data. + */ + matchedSpecIds?: Maybe>; + /** pubKeys is the list of public keys that signed the data */ + pubKeys?: Maybe>; +}; + +export type OracleDataConnection = { + __typename?: 'OracleDataConnection'; + /** The oracle data */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo: PageInfo; +}; + +export type OracleDataEdge = { + __typename?: 'OracleDataEdge'; + /** The cursor for the data item */ + cursor: Scalars['String']; + /** The oracle data */ + node: OracleData; +}; + +/** + * An oracle spec describe the oracle data that a product (or a risk model) + * wants to get from the oracle engine. + */ +export type OracleSpec = { + __typename?: 'OracleSpec'; + /** RFC3339Nano creation date time */ + createdAt: Scalars['String']; + /** + * data list all the oracle data broadcast to this spec + * @deprecated Use dataConnection instead + */ + data: Array; + /** data list all the oracle data broadcast to this spec */ + dataConnection: OracleDataConnection; + /** + * filters describes which oracle data are considered of interest or not for + * the product (or the risk model). + */ + filters?: Maybe>; + /** ID is a hash generated from the OracleSpec data. */ + id: Scalars['String']; + /** + * pubKeys is the list of authorized public keys that signed the data for this + * oracle. All the public keys in the oracle data should be contained in these + * public keys. + */ + pubKeys?: Maybe>; + /** status describes the status of the oracle spec */ + status: OracleSpecStatus; + /** RFC3339Nano last updated timestamp */ + updatedAt?: Maybe; +}; + + +/** + * An oracle spec describe the oracle data that a product (or a risk model) + * wants to get from the oracle engine. + */ +export type OracleSpecdataConnectionArgs = { + pagination?: InputMaybe; +}; + +/** + * An oracle spec describe the oracle data that an instrument wants to get from the + * oracle engine. + */ +export type OracleSpecConfiguration = { + __typename?: 'OracleSpecConfiguration'; + /** + * filters describes which oracle data are considered of interest or not for + * the product (or the risk model). + */ + filters?: Maybe>; + /** + * pubKeys is the list of authorised public keys that signed the data for this + * oracle. All the public keys in the oracle data should be contained in these + * public keys. + */ + pubKeys?: Maybe>; +}; + +export type OracleSpecEdge = { + __typename?: 'OracleSpecEdge'; + /** The cursor for the data item */ + cursor: Scalars['String']; + /** The oracle spec */ + node: OracleSpec; +}; + +/** Status describe the status of the oracle spec */ +export enum OracleSpecStatus { + /** describes an active oracle spec. */ + STATUS_ACTIVE = 'STATUS_ACTIVE', + /** + * describes an oracle spec that is not listening to data + * anymore. + */ + STATUS_DEACTIVATED = 'STATUS_DEACTIVATED' +} + +/** + * OracleSpecToFutureBinding tells on which property oracle data should be + * used as settlement price and trading termination. + */ +export type OracleSpecToFutureBinding = { + __typename?: 'OracleSpecToFutureBinding'; + settlementPriceProperty: Scalars['String']; + tradingTerminationProperty: Scalars['String']; +}; + +export type OracleSpecsConnection = { + __typename?: 'OracleSpecsConnection'; + /** The oracle specs */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo: PageInfo; +}; + +/** An order in Vega, if active it will be on the order book for the market */ +export type Order = { + __typename?: 'Order'; + /** RFC3339Nano formatted date and time for when the order was created (timestamp) */ + createdAt: Scalars['String']; + /** Expiration time of this order (ISO-8601 RFC3339+Nano formatted date) */ + expiresAt?: Maybe; + /** Hash of the order data */ + id: Scalars['ID']; + /** The liquidity provision this order was created from */ + liquidityProvision?: Maybe; + /** The market the order is trading on (probably stored internally as a hash of the market details) */ + market: Market; + /** The party who place the order (probably stored internally as the party's public key) */ + party: Party; + /** PeggedOrder contains the details about a pegged order */ + peggedOrder?: Maybe; + /** The worst price the order will trade at (e.g. buy for price or less, sell for price or more) (uint64) */ + price: Scalars['String']; + /** The external reference (if available) for the order */ + reference: Scalars['String']; + /** Reason for the order to be rejected */ + rejectionReason?: Maybe; + /** Number of contracts remaining of the total that have not yet been bought or sold (uint64) */ + remaining: Scalars['String']; + /** Whether the order is to buy or sell */ + side: Side; + /** Total number of contracts that may be bought or sold (immutable) (uint64) */ + size: Scalars['String']; + /** The status of an order, for example 'Active' */ + status: OrderStatus; + /** The timeInForce of order (determines how and if it executes, and whether it persists on the book) */ + timeInForce: OrderTimeInForce; + /** + * Trades relating to this order + * @deprecated Use tradesConnection instead + */ + trades?: Maybe>; + /** Trades relating to this order */ + tradesConnection: TradeConnection; + /** Type the order type (defaults to PARTY) */ + type?: Maybe; + /** RFC3339Nano time the order was altered */ + updatedAt?: Maybe; + /** Version of this order, counts the number of amends */ + version: Scalars['String']; +}; + + +/** An order in Vega, if active it will be on the order book for the market */ +export type OrdertradesConnectionArgs = { + pagination?: InputMaybe; +}; + +export type OrderConnection = { + __typename?: 'OrderConnection'; + /** The orders in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type OrderEdge = { + __typename?: 'OrderEdge'; + cursor?: Maybe; + node: Order; +}; + +/** An estimate of the fee to be paid by the order */ +export type OrderEstimate = { + __typename?: 'OrderEstimate'; + /** The estimated fee if the order was to trade */ + fee: TradeFee; + /** The margin requirement for this order */ + marginLevels: MarginLevels; + /** The total estimated amount of fee if the order was to trade */ + totalFeeAmount: Scalars['String']; +}; + +/** Reason for the order being rejected by the core node */ +export enum OrderRejectionReason { + /** Amending the order failed */ + ORDER_ERROR_AMEND_FAILURE = 'ORDER_ERROR_AMEND_FAILURE', + /** Buy pegged order cannot reference best ask price */ + ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE = 'ORDER_ERROR_BUY_CANNOT_REFERENCE_BEST_ASK_PRICE', + /** Amending from Good for Auction or Good for Normal is invalid */ + ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN = 'ORDER_ERROR_CANNOT_AMEND_FROM_GFA_OR_GFN', + /** Cannot change pegged order fields on a non pegged order */ + ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER = 'ORDER_ERROR_CANNOT_AMEND_PEGGED_ORDER_DETAILS_ON_NON_PEGGED_ORDER', + /** Amending to Fill or Kill, or Immediate or Cancel is invalid */ + ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC = 'ORDER_ERROR_CANNOT_AMEND_TO_FOK_OR_IOC', + /** Amending to Good for Auction or Good for Normal is invalid */ + ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN = 'ORDER_ERROR_CANNOT_AMEND_TO_GFA_OR_GFN', + /** Attempt to amend order to Good til Time without expiry time */ + ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT = 'ORDER_ERROR_CANNOT_AMEND_TO_GTT_WITHOUT_EXPIRYAT', + /** Attempt to amend to Good till Cancelled without an expiry time */ + ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT = 'ORDER_ERROR_CANNOT_HAVE_GTC_AND_EXPIRYAT', + /** Cannot send FOK orders during an auction */ + ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION = 'ORDER_ERROR_CANNOT_SEND_FOK_ORDER_DURING_AUCTION', + /** Cannot send IOC orders during an auction */ + ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION = 'ORDER_ERROR_CANNOT_SEND_IOC_ORDER_DURING_AUCTION', + /** Edit is not allowed */ + ORDER_ERROR_EDIT_NOT_ALLOWED = 'ORDER_ERROR_EDIT_NOT_ALLOWED', + /** Attempt to amend expiry time to a value before time order was created */ + ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT = 'ORDER_ERROR_EXPIRYAT_BEFORE_CREATEDAT', + /** Good for Auction order received during continuous trading */ + ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING = 'ORDER_ERROR_GFA_ORDER_DURING_CONTINUOUS_TRADING', + /** Good for Normal order received during an auction */ + ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION = 'ORDER_ERROR_GFN_ORDER_DURING_AN_AUCTION', + /** Insufficient balance to submit the order (no deposit made) */ + ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE = 'ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE', + /** Insufficient funds to pay fees */ + ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES = 'ORDER_ERROR_INSUFFICIENT_FUNDS_TO_PAY_FEES', + /** An internal error happened */ + ORDER_ERROR_INTERNAL_ERROR = 'ORDER_ERROR_INTERNAL_ERROR', + /** Expiration time is invalid */ + ORDER_ERROR_INVALID_EXPIRATION_DATETIME = 'ORDER_ERROR_INVALID_EXPIRATION_DATETIME', + /** Market ID is invalid */ + ORDER_ERROR_INVALID_MARKET_ID = 'ORDER_ERROR_INVALID_MARKET_ID', + /** Order ID is invalid */ + ORDER_ERROR_INVALID_ORDER_ID = 'ORDER_ERROR_INVALID_ORDER_ID', + /** Order reference is invalid */ + ORDER_ERROR_INVALID_ORDER_REFERENCE = 'ORDER_ERROR_INVALID_ORDER_REFERENCE', + /** Party ID is invalid */ + ORDER_ERROR_INVALID_PARTY_ID = 'ORDER_ERROR_INVALID_PARTY_ID', + /** Invalid persistence */ + ORDER_ERROR_INVALID_PERSISTENCE = 'ORDER_ERROR_INVALID_PERSISTENCE', + /** Remaining size in the order is invalid */ + ORDER_ERROR_INVALID_REMAINING_SIZE = 'ORDER_ERROR_INVALID_REMAINING_SIZE', + /** Invalid size */ + ORDER_ERROR_INVALID_SIZE = 'ORDER_ERROR_INVALID_SIZE', + /** Invalid Time In Force */ + ORDER_ERROR_INVALID_TIME_IN_FORCE = 'ORDER_ERROR_INVALID_TIME_IN_FORCE', + /** Invalid type */ + ORDER_ERROR_INVALID_TYPE = 'ORDER_ERROR_INVALID_TYPE', + /** Margin check failed - not enough available margin */ + ORDER_ERROR_MARGIN_CHECK_FAILED = 'ORDER_ERROR_MARGIN_CHECK_FAILED', + /** Market is closed */ + ORDER_ERROR_MARKET_CLOSED = 'ORDER_ERROR_MARKET_CLOSED', + /** Order missing general account */ + ORDER_ERROR_MISSING_GENERAL_ACCOUNT = 'ORDER_ERROR_MISSING_GENERAL_ACCOUNT', + /** Pegged orders can only have a time in force of Good til Cancelled or Good til Time */ + ORDER_ERROR_MUST_BE_GTT_OR_GTC = 'ORDER_ERROR_MUST_BE_GTT_OR_GTC', + /** Pegged orders must be limit orders */ + ORDER_ERROR_MUST_BE_LIMIT_ORDER = 'ORDER_ERROR_MUST_BE_LIMIT_ORDER', + /** Non-persistent order exceeds price bounds */ + ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS = 'ORDER_ERROR_NON_PERSISTENT_ORDER_OUT_OF_PRICE_BOUNDS', + /** Order does not exist */ + ORDER_ERROR_NOT_FOUND = 'ORDER_ERROR_NOT_FOUND', + /** Pegged order offset must be >= 0 */ + ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO = 'ORDER_ERROR_OFFSET_MUST_BE_GREATER_OR_EQUAL_TO_ZERO', + /** Pegged order offset must be > zero */ + ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO = 'ORDER_ERROR_OFFSET_MUST_BE_GREATER_THAN_ZERO', + /** Order is out of sequence */ + ORDER_ERROR_OUT_OF_SEQUENCE = 'ORDER_ERROR_OUT_OF_SEQUENCE', + /** Unable to remove the order */ + ORDER_ERROR_REMOVAL_FAILURE = 'ORDER_ERROR_REMOVAL_FAILURE', + /** Order cannot be filled because it would require self trading */ + ORDER_ERROR_SELF_TRADING = 'ORDER_ERROR_SELF_TRADING', + /** Sell pegged order cannot reference best bid price */ + ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE = 'ORDER_ERROR_SELL_CANNOT_REFERENCE_BEST_BID_PRICE', + /** Time has failed us */ + ORDER_ERROR_TIME_FAILURE = 'ORDER_ERROR_TIME_FAILURE', + /** Unable to amend pegged order price */ + ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER = 'ORDER_ERROR_UNABLE_TO_AMEND_PRICE_ON_PEGGED_ORDER', + /** Unable to reprice a pegged order */ + ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER = 'ORDER_ERROR_UNABLE_TO_REPRICE_PEGGED_ORDER', + /** Pegged order must have a reference price */ + ORDER_ERROR_WITHOUT_REFERENCE_PRICE = 'ORDER_ERROR_WITHOUT_REFERENCE_PRICE' +} + +/** Valid order statuses, these determine several states for an order that cannot be expressed with other fields in Order. */ +export enum OrderStatus { + /** + * The order is active and not cancelled or expired, it could be unfilled, partially filled or fully filled. + * Active does not necessarily mean it's still on the order book. + */ + STATUS_ACTIVE = 'STATUS_ACTIVE', + /** The order is cancelled, the order could be partially filled or unfilled before it was cancelled. It is not possible to cancel an order with 0 remaining. */ + STATUS_CANCELLED = 'STATUS_CANCELLED', + /** This order trades any amount and as much as possible and remains on the book until it either trades completely or expires. */ + STATUS_EXPIRED = 'STATUS_EXPIRED', + /** This order is fully filled with remaining equalling zero. */ + STATUS_FILLED = 'STATUS_FILLED', + /** This order has been removed from the order book because the market is in auction, the reference price doesn't exist, or the order needs to be repriced and can't. Applies to pegged orders only */ + STATUS_PARKED = 'STATUS_PARKED', + /** This order was partially filled. */ + STATUS_PARTIALLY_FILLED = 'STATUS_PARTIALLY_FILLED', + /** This order was rejected while being processed. */ + STATUS_REJECTED = 'STATUS_REJECTED', + /** This order was of type IOC or FOK and could not be processed by the matching engine due to lack of liquidity. */ + STATUS_STOPPED = 'STATUS_STOPPED' +} + +/** Valid order types, these determine what happens when an order is added to the book */ +export enum OrderTimeInForce { + /** Fill or Kill: The order either trades completely (remainingSize == 0 after adding) or not at all, does not remain on the book if it doesn't trade */ + TIME_IN_FORCE_FOK = 'TIME_IN_FORCE_FOK', + /** Good for Auction: This order is only accepted during an auction period */ + TIME_IN_FORCE_GFA = 'TIME_IN_FORCE_GFA', + /** Good for Normal: This order is only accepted during normal trading (continuous trading or frequent batched auctions) */ + TIME_IN_FORCE_GFN = 'TIME_IN_FORCE_GFN', + /** Good 'til Cancelled: This order trades any amount and as much as possible and remains on the book until it either trades completely or is cancelled */ + TIME_IN_FORCE_GTC = 'TIME_IN_FORCE_GTC', + /** + * Good 'til Time: This order type trades any amount and as much as possible and remains on the book until they either trade completely, are cancelled, or expires at a set time + * NOTE: this may in future be multiple types or have sub types for orders that provide different ways of specifying expiry + */ + TIME_IN_FORCE_GTT = 'TIME_IN_FORCE_GTT', + /** Immediate or Cancel: The order trades any amount and as much as possible but does not remain on the book (whether it trades or not) */ + TIME_IN_FORCE_IOC = 'TIME_IN_FORCE_IOC' +} + +export enum OrderType { + /** Order that uses a pre-specified price to buy or sell */ + TYPE_LIMIT = 'TYPE_LIMIT', + /** An order to buy or sell at the market's current best available price */ + TYPE_MARKET = 'TYPE_MARKET', + /** + * Used for distressed parties, an order placed by the network to close out distressed parties + * similar to Market order, only no party is attached to the order. + */ + TYPE_NETWORK = 'TYPE_NETWORK' +} + +export type PageInfo = { + __typename?: 'PageInfo'; + endCursor: Scalars['String']; + hasNextPage: Scalars['Boolean']; + hasPreviousPage: Scalars['Boolean']; + startCursor: Scalars['String']; +}; + +/** Pagination constructs to support cursor based pagination in the API */ +export type Pagination = { + after?: InputMaybe; + before?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; +}; + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type Party = { + __typename?: 'Party'; + /** + * Collateral accounts relating to a party + * @deprecated Use accountsConnection instead + */ + accounts?: Maybe>; + /** Collateral accounts relating to a party */ + accountsConnection: AccountsConnection; + /** @deprecated Use delegationsConnection instead */ + delegations?: Maybe>; + delegationsConnection: DelegationsConnection; + /** + * The list of all deposits for a party by the party + * @deprecated Use depositsConnection instead + */ + deposits?: Maybe>; + /** The list of all deposits for a party by the party */ + depositsConnection: DepositsConnection; + /** Party identifier */ + id: Scalars['ID']; + /** + * The list of the liquidity provision commitment from this party + * @deprecated Use liquidityProvisionsConnection instead + */ + liquidityProvisions?: Maybe>; + /** The list of the liquidity provision commitment for this party */ + liquidityProvisionsConnection: LiquidityProvisionsConnection; + /** + * marginLevels + * @deprecated Use marginsConnection instead + */ + margins?: Maybe>; + /** Margin levels for a market */ + marginsConnection: MarginConnection; + /** + * Orders relating to a party + * @deprecated Use ordersConnection instead + */ + orders?: Maybe>; + /** Orders relating to a party */ + ordersConnection: OrderConnection; + /** + * Trading positions relating to a party + * @deprecated Use the 'positionsConnection' field instead + */ + positions?: Maybe>; + /** Trading positions relating to a party */ + positionsConnection: PositionConnection; + /** @deprecated Use proposalsConnection instead */ + proposals?: Maybe>>; + /** All governance proposals in the VEGA network */ + proposalsConnection: ProposalsConnection; + /** + * return reward information + * @deprecated Use rewardSummaries or rewards instead. + */ + rewardDetails?: Maybe>>; + /** Return net reward information */ + rewardSummaries?: Maybe>>; + /** + * Return individual reward information + * @deprecated Use rewardsConnection instead + */ + rewards?: Maybe>>; + rewardsConnection?: Maybe; + /** + * The staking information for this Party + * @deprecated Use stakingSummary instead + */ + stake: PartyStake; + /** The staking information for this Party */ + stakingSummary: StakingSummary; + /** + * Trades relating to a party (specifically where party is either buyer OR seller) + * @deprecated Use tradesConnection for cursor based pagination instead + */ + trades?: Maybe>; + tradesConnection: TradeConnection; + /** get a list of all transfers for a public key */ + transfersConnection: TransferConnection; + /** @deprecated Use votesConnection instead */ + votes?: Maybe>>; + votesConnection: ProposalVoteConnection; + /** + * The list of all withdrawals initiated by the party + * @deprecated Use withdrawalsConnection instead + */ + withdrawals?: Maybe>; + /** The list of all withdrawals initiated by the party */ + withdrawalsConnection: WithdrawalsConnection; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyaccountsArgs = { + asset?: InputMaybe; + marketId?: InputMaybe; + type?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyaccountsConnectionArgs = { + asset?: InputMaybe; + marketId?: InputMaybe; + pagination?: InputMaybe; + type?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartydelegationsArgs = { + first?: InputMaybe; + last?: InputMaybe; + nodeId?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartydelegationsConnectionArgs = { + nodeId?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartydepositsConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyliquidityProvisionsArgs = { + market?: InputMaybe; + reference?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyliquidityProvisionsConnectionArgs = { + market?: InputMaybe; + pagination?: InputMaybe; + reference?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartymarginsArgs = { + marketId?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartymarginsConnectionArgs = { + marketId?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyordersArgs = { + first?: InputMaybe; + last?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyordersConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartypositionsConnectionArgs = { + market?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyproposalsArgs = { + inState?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyproposalsConnectionArgs = { + inState?: InputMaybe; + pagination?: InputMaybe; + proposalType?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyrewardSummariesArgs = { + asset?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyrewardsArgs = { + asset?: InputMaybe; + first?: InputMaybe; + last?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyrewardsConnectionArgs = { + asset?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartystakingSummaryArgs = { + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartytradesArgs = { + first?: InputMaybe; + last?: InputMaybe; + marketId?: InputMaybe; + skip?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartytradesConnectionArgs = { + marketId?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartytransfersConnectionArgs = { + direction?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartyvotesConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Represents a party on Vega, could be an ethereum wallet address in the future */ +export type PartywithdrawalsConnectionArgs = { + pagination?: InputMaybe; +}; + +export type PartyConnection = { + __typename?: 'PartyConnection'; + /** The parties in this connection */ + edges: Array; + /** The pagination information */ + pageInfo: PageInfo; +}; + +export type PartyEdge = { + __typename?: 'PartyEdge'; + cursor: Scalars['String']; + node: Party; +}; + +/** + * All staking information related to a Party. + * Contains the current recognised balance by the network and + * all the StakeLink/Unlink seen by the network + */ +export type PartyStake = { + __typename?: 'PartyStake'; + /** The stake currently available for the party */ + currentStakeAvailable: Scalars['String']; + /** The currently available stake formatted by the client */ + currentStakeAvailableFormatted: Scalars['String']; + /** The list of all stake link/unlink for the party */ + linkings?: Maybe>; +}; + +/** Create an order linked to an index rather than a price */ +export type PeggedOrder = { + __typename?: 'PeggedOrder'; + /** Price offset from the peg */ + offset: Scalars['String']; + /** Index to link this order to */ + reference: PeggedReference; +}; + +/** Valid references used for pegged orders. */ +export enum PeggedReference { + /** Peg the order against the best ask price of the order book */ + PEGGED_REFERENCE_BEST_ASK = 'PEGGED_REFERENCE_BEST_ASK', + /** Peg the order against the best bid price of the order book */ + PEGGED_REFERENCE_BEST_BID = 'PEGGED_REFERENCE_BEST_BID', + /** Peg the order against the mid price of the order book */ + PEGGED_REFERENCE_MID = 'PEGGED_REFERENCE_MID' +} + +/** + * An individual party at any point in time is considered net long or net short. This refers to their Open Volume, + * calculated using FIFO. This volume is signed as either negative for LONG positions and positive for SHORT positions. A + * single trade may end up "splitting" with some of its volume matched into closed volume and some of its volume + * remaining as open volume. This is why we don't refer to positions being comprised of trades, rather of volume. + */ +export type Position = { + __typename?: 'Position'; + /** Average entry price for this position */ + averageEntryPrice: Scalars['String']; + /** + * Margins of the party for the given position + * @deprecated Use marginsConnection instead + */ + margins?: Maybe>; + /** Margins of the party for the given position */ + marginsConnection: MarginConnection; + /** Market relating to this position */ + market: Market; + /** Open volume (uint64) */ + openVolume: Scalars['String']; + /** The party holding this position */ + party: Party; + /** Realised Profit and Loss (int64) */ + realisedPNL: Scalars['String']; + /** Unrealised Profit and Loss (int64) */ + unrealisedPNL: Scalars['String']; + /** RFC3339Nano time the position was updated */ + updatedAt?: Maybe; +}; + + +/** + * An individual party at any point in time is considered net long or net short. This refers to their Open Volume, + * calculated using FIFO. This volume is signed as either negative for LONG positions and positive for SHORT positions. A + * single trade may end up "splitting" with some of its volume matched into closed volume and some of its volume + * remaining as open volume. This is why we don't refer to positions being comprised of trades, rather of volume. + */ +export type PositionmarginsConnectionArgs = { + pagination?: InputMaybe; +}; + +export type PositionConnection = { + __typename?: 'PositionConnection'; + /** The positions in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type PositionEdge = { + __typename?: 'PositionEdge'; + cursor?: Maybe; + node: Position; +}; + +export type PositionResolution = { + __typename?: 'PositionResolution'; + /** Number of parties closed out */ + closed: Scalars['Int']; + /** Number of distressed parties on market */ + distressed: Scalars['Int']; + /** The mark price at which parties were distressed/closed out */ + markPrice: Scalars['String']; + /** The market ID where position resolution happened */ + marketId: Scalars['ID']; +}; + +/** Represents a price on either the buy or sell side and all the orders at that price */ +export type PriceLevel = { + __typename?: 'PriceLevel'; + /** The number of orders at this price level (uint64) */ + numberOfOrders: Scalars['String']; + /** The price of all the orders at this level (uint64) */ + price: Scalars['String']; + /** The total remaining size of all orders at this level (uint64) */ + volume: Scalars['String']; +}; + +/** Range of valid prices and the associated price monitoring trigger */ +export type PriceMonitoringBounds = { + __typename?: 'PriceMonitoringBounds'; + /** Maximum price that isn't currently breaching the specified price monitoring trigger */ + maxValidPrice: Scalars['String']; + /** Minimum price that isn't currently breaching the specified price monitoring trigger */ + minValidPrice: Scalars['String']; + /** Reference price used to calculate the valid price range */ + referencePrice: Scalars['String']; + /** Price monitoring trigger associated with the bounds */ + trigger: PriceMonitoringTrigger; +}; + +/** PriceMonitoringParameters holds a list of triggers */ +export type PriceMonitoringParameters = { + __typename?: 'PriceMonitoringParameters'; + /** The list of triggers for this price monitoring */ + triggers?: Maybe>; +}; + +/** Configuration of a market price monitoring auctions triggers */ +export type PriceMonitoringSettings = { + __typename?: 'PriceMonitoringSettings'; + /** Specified a set of PriceMonitoringParameters to be use for price monitoring purposes */ + parameters?: Maybe; +}; + +/** PriceMonitoringParameters holds together price projection horizon τ, probability level p, and auction extension duration */ +export type PriceMonitoringTrigger = { + __typename?: 'PriceMonitoringTrigger'; + /** + * Price monitoring auction extension duration in seconds should the price + * breach its theoretical level over the specified horizon at the specified + * probability level (> 0) + */ + auctionExtensionSecs: Scalars['Int']; + /** Price monitoring projection horizon τ in seconds (> 0). */ + horizonSecs: Scalars['Int']; + /** Price monitoring probability level p. (>0 and < 1) */ + probability: Scalars['Float']; +}; + +export type Product = Future; + +/** A property associates a name to a value */ +export type Property = { + __typename?: 'Property'; + /** name of the property */ + name: Scalars['String']; + /** value of the property */ + value: Scalars['String']; +}; + +/** PropertyKey describes the property key contained in an oracle data. */ +export type PropertyKey = { + __typename?: 'PropertyKey'; + /** name is the name of the property. */ + name?: Maybe; + /** type is the type of the property. */ + type: PropertyKeyType; +}; + +/** + * Type describes the type of properties that are supported by the oracle + * engine. + */ +export enum PropertyKeyType { + /** Boolean type. */ + TYPE_BOOLEAN = 'TYPE_BOOLEAN', + /** Any floating point decimal type. */ + TYPE_DECIMAL = 'TYPE_DECIMAL', + /** Any type. */ + TYPE_EMPTY = 'TYPE_EMPTY', + /** Integer type. */ + TYPE_INTEGER = 'TYPE_INTEGER', + /** String type. */ + TYPE_STRING = 'TYPE_STRING', + /** Timestamp date type. */ + TYPE_TIMESTAMP = 'TYPE_TIMESTAMP' +} + +export type Proposal = { + __typename?: 'Proposal'; + /** RFC3339Nano time and date when the proposal reached Vega network */ + datetime: Scalars['String']; + /** Error details of the rejectionReason */ + errorDetails?: Maybe; + /** Proposal ID that is filled by Vega once proposal reaches the network */ + id?: Maybe; + /** Party that prepared the proposal */ + party: Party; + /** Rationale behind the proposal */ + rationale: ProposalRationale; + /** A UUID reference to aid tracking proposals on Vega */ + reference: Scalars['String']; + /** Reason for the proposal to be rejected by the core */ + rejectionReason?: Maybe; + /** State of the proposal */ + state: ProposalState; + /** Terms of the proposal */ + terms: ProposalTerms; + /** Votes cast for this proposal */ + votes: ProposalVotes; +}; + +export type ProposalChange = NewAsset | NewFreeform | NewMarket | UpdateAsset | UpdateMarket | UpdateNetworkParameter; + +export type ProposalEdge = { + __typename?: 'ProposalEdge'; + /** Cursor identifying the proposal */ + cursor: Scalars['String']; + /** The proposal data */ + node: Proposal; +}; + +export type ProposalRationale = { + __typename?: 'ProposalRationale'; + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: Scalars['String']; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: Scalars['String']; +}; + +/** Reason for the proposal being rejected by the core node */ +export enum ProposalRejectionReason { + /** The specified close time is too late based on network parameters */ + PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE = 'PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE', + /** The specified close time is too early based on network parameters */ + PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON = 'PROPOSAL_ERROR_CLOSE_TIME_TOO_SOON', + /** Market could not be created */ + PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET = 'PROPOSAL_ERROR_COULD_NOT_INSTANTIATE_MARKET', + /** The specified enactment time is too late based on network parameters */ + PROPOSAL_ERROR_ENACT_TIME_TOO_LATE = 'PROPOSAL_ERROR_ENACT_TIME_TOO_LATE', + /** The specified enactment time is too early based on network parameters */ + PROPOSAL_ERROR_ENACT_TIME_TOO_SOON = 'PROPOSAL_ERROR_ENACT_TIME_TOO_SOON', + /** proposal terms timestamps are not compatible (Validation < Closing < Enactment) */ + PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS = 'PROPOSAL_ERROR_INCOMPATIBLE_TIMESTAMPS', + /** The proposal is rejected because the party does not have enough equity like share in the market */ + PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE = 'PROPOSAL_ERROR_INSUFFICIENT_EQUITY_LIKE_SHARE', + /** The proposer for this proposal has insufficient tokens */ + PROPOSAL_ERROR_INSUFFICIENT_TOKENS = 'PROPOSAL_ERROR_INSUFFICIENT_TOKENS', + /** The specified asset for the market proposal is invalid */ + PROPOSAL_ERROR_INVALID_ASSET = 'PROPOSAL_ERROR_INVALID_ASSET', + /** Asset details are invalid */ + PROPOSAL_ERROR_INVALID_ASSET_DETAILS = 'PROPOSAL_ERROR_INVALID_ASSET_DETAILS', + /** Market proposal has invalid fee amount */ + PROPOSAL_ERROR_INVALID_FEE_AMOUNT = 'PROPOSAL_ERROR_INVALID_FEE_AMOUNT', + /** Freeform proposal is invalid */ + PROPOSAL_ERROR_INVALID_FREEFORM = 'PROPOSAL_ERROR_INVALID_FREEFORM', + /** Market proposal market contained invalid product definition */ + PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT = 'PROPOSAL_ERROR_INVALID_FUTURE_PRODUCT', + /** The instrument quote name and base name were the same */ + PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY = 'PROPOSAL_ERROR_INVALID_INSTRUMENT_SECURITY', + /** The market is invalid */ + PROPOSAL_ERROR_INVALID_MARKET = 'PROPOSAL_ERROR_INVALID_MARKET', + /** Market proposal uses an invalid risk parameter */ + PROPOSAL_ERROR_INVALID_RISK_PARAMETER = 'PROPOSAL_ERROR_INVALID_RISK_PARAMETER', + /** Market proposal has one or more invalid liquidity shapes */ + PROPOSAL_ERROR_INVALID_SHAPE = 'PROPOSAL_ERROR_INVALID_SHAPE', + /** Proposal declined because the majority threshold was not reached */ + PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED', + /** Market proposal is missing a liquidity commitment */ + PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT', + /** A builtin asset configuration is missing */ + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD', + /** Market proposal is missing commitment amount */ + PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT', + /** The ERC20 contract address is missing from an ERC20 asset proposal */ + PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS', + /** Invalid key in update network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY', + /** Invalid value in update network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE = 'PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_VALUE', + /** Validation failed for network parameter proposal */ + PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED = 'PROPOSAL_ERROR_NETWORK_PARAMETER_VALIDATION_FAILED', + /** The proposal failed node validation */ + PROPOSAL_ERROR_NODE_VALIDATION_FAILED = 'PROPOSAL_ERROR_NODE_VALIDATION_FAILED', + /** The proposal has no product specified */ + PROPOSAL_ERROR_NO_PRODUCT = 'PROPOSAL_ERROR_NO_PRODUCT', + /** Risk parameters are missing from the market proposal */ + PROPOSAL_ERROR_NO_RISK_PARAMETERS = 'PROPOSAL_ERROR_NO_RISK_PARAMETERS', + /** The proposal has no trading mode */ + PROPOSAL_ERROR_NO_TRADING_MODE = 'PROPOSAL_ERROR_NO_TRADING_MODE', + /** Opening auction duration is more than the network minimum opening auction time */ + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE = 'PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_LARGE', + /** Opening auction duration is less than the network minimum opening auction time */ + PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL = 'PROPOSAL_ERROR_OPENING_AUCTION_DURATION_TOO_SMALL', + /** Proposal declined because the participation threshold was not reached */ + PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED = 'PROPOSAL_ERROR_PARTICIPATION_THRESHOLD_NOT_REACHED', + /** Too many decimal places specified in market */ + PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES = 'PROPOSAL_ERROR_TOO_MANY_MARKET_DECIMAL_PLACES', + /** Too many price monitoring triggers specified in market */ + PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS = 'PROPOSAL_ERROR_TOO_MANY_PRICE_MONITORING_TRIGGERS', + /** Unknow risk paramters */ + PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE = 'PROPOSAL_ERROR_UNKNOWN_RISK_PARAMETER_TYPE', + /** Unknown proposal type */ + PROPOSAL_ERROR_UNKNOWN_TYPE = 'PROPOSAL_ERROR_UNKNOWN_TYPE', + /** The specified product is not supported */ + PROPOSAL_ERROR_UNSUPPORTED_PRODUCT = 'PROPOSAL_ERROR_UNSUPPORTED_PRODUCT', + /** The proposal has an unsupported trading mode */ + PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE = 'PROPOSAL_ERROR_UNSUPPORTED_TRADING_MODE' +} + +/** + * Various states a proposal can transition through: + * Open -> + * - Passed -> Enacted. + * - Rejected. + * Proposal can enter Failed state from any other state. + */ +export enum ProposalState { + /** Proposal didn't get enough votes */ + STATE_DECLINED = 'STATE_DECLINED', + /** Proposal has been executed and the changes under this proposal have now been applied */ + STATE_ENACTED = 'STATE_ENACTED', + /** Proposal became invalid and cannot be processed */ + STATE_FAILED = 'STATE_FAILED', + /** Proposal is open for voting */ + STATE_OPEN = 'STATE_OPEN', + /** Proposal has gained enough support to be executed */ + STATE_PASSED = 'STATE_PASSED', + /** Proposal could not gain enough support to be executed */ + STATE_REJECTED = 'STATE_REJECTED', + /** Proposal is waiting for the node to run validation */ + STATE_WAITING_FOR_NODE_VOTE = 'STATE_WAITING_FOR_NODE_VOTE' +} + +/** The rationale behind the proposal */ +export type ProposalTerms = { + __typename?: 'ProposalTerms'; + /** Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ + change: ProposalChange; + /** + * RFC3339Nano time and date when voting closes for this proposal. + * Constrained by "minClose" and "maxClose" network parameters. + */ + closingDatetime: Scalars['String']; + /** + * RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time. + * Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters. + * Note: Optional as free form proposals do not require it. + */ + enactmentDatetime?: Maybe; + /** RFC3339Nano time and when node validation of the proposal stops, accepted only with new asset proposals */ + validationDatetime?: Maybe; +}; + +/** Various proposal types that are supported by Vega */ +export enum ProposalType { + /** Proposal to change Vega network parameters */ + TYPE_NETWORK_PARAMETERS = 'TYPE_NETWORK_PARAMETERS', + /** Proposal to add a new asset */ + TYPE_NEW_ASSET = 'TYPE_NEW_ASSET', + /** Proposal to create a new freeform proposal */ + TYPE_NEW_FREE_FORM = 'TYPE_NEW_FREE_FORM', + /** Propose a new market */ + TYPE_NEW_MARKET = 'TYPE_NEW_MARKET', + /** Proposal to update an existing asset */ + TYPE_UPDATE_ASSET = 'TYPE_UPDATE_ASSET', + /** Update an existing market */ + TYPE_UPDATE_MARKET = 'TYPE_UPDATE_MARKET' +} + +export type ProposalVote = { + __typename?: 'ProposalVote'; + /** Proposal the vote is cast on */ + proposalId: Scalars['ID']; + /** Cast vote */ + vote: Vote; +}; + +export type ProposalVoteConnection = { + __typename?: 'ProposalVoteConnection'; + /** The proposal votes in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type ProposalVoteEdge = { + __typename?: 'ProposalVoteEdge'; + cursor?: Maybe; + node: ProposalVote; +}; + +export type ProposalVoteSide = { + __typename?: 'ProposalVoteSide'; + /** Total number of votes cast for this side */ + totalNumber: Scalars['String']; + /** Total number of governance tokens from the votes cast for this side */ + totalTokens: Scalars['String']; + /** Total weight of governance token from the votes cast for this side */ + totalWeight: Scalars['String']; + /** All votes cast for this side */ + votes?: Maybe>; +}; + +export type ProposalVotes = { + __typename?: 'ProposalVotes'; + /** No votes cast for this proposal */ + no: ProposalVoteSide; + /** Yes votes cast for this proposal */ + yes: ProposalVoteSide; +}; + +export type ProposalsConnection = { + __typename?: 'ProposalsConnection'; + /** List of proposals available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type Query = { + __typename?: 'Query'; + /** An asset which is used in the vega network */ + asset?: Maybe; + /** + * The list of all assets in use in the Vega network + * @deprecated Use assetsConnection instead + */ + assets?: Maybe>; + /** The list of all assets in use in the Vega network or the specified asset if ID is provided */ + assetsConnection: AssetsConnection; + /** find a deposit using its ID */ + deposit?: Maybe; + /** get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch */ + epoch: Epoch; + /** find an erc20 withdrawal approval using its withdrawal ID */ + erc20WithdrawalApproval?: Maybe; + /** return an estimation of the potential cost for a new order */ + estimateOrder: OrderEstimate; + /** query for historic ethereum key rotations */ + ethereumKeyRotations: EthereumKeyRotationsConnection; + /** + * get market data history for a specific market. If no dates are given, the latest snapshot will be returned. If only the start date is provided, all history from the given date will be provided, and if only the end date is provided, all history from the start up to and including the end date will be provided. + * @deprecated Use getMarketDataHistoryConnectionByID instead + */ + getMarketDataHistoryByID?: Maybe>>; + /** get market data history for a specific market. If no dates are given, the latest snapshot will be returned. If only the start date is provided all history from the given date will be provided, and if only the end date is provided, all history from the start up to and including the end date will be provided. Pagination is provided using a cursor based pagination model */ + getMarketDataHistoryConnectionByID: MarketDataConnection; + historicBalances: Array; + /** + * query for historic key rotations + * @deprecated use keyRotationsConnection instead + */ + keyRotations?: Maybe>; + /** query for historic key rotations */ + keyRotationsConnection: KeyRotationConnection; + /** The last block process by the blockchain */ + lastBlockHeight: Scalars['String']; + /** An instrument that is trading on the Vega network */ + market?: Maybe; + /** + * One or more instruments that are trading on the VEGA network + * @deprecated Use marketsConnection instead + */ + markets?: Maybe>; + marketsConnection: MarketConnection; + /** Current network limits */ + networkLimits?: Maybe; + /** return a single network parameter */ + networkParameter?: Maybe; + /** + * return the full list of network parameters + * @deprecated Use networkParametersConnection instead + */ + networkParameters?: Maybe>; + networkParametersConnection: NetworkParametersConnection; + /** + * Governance proposals that aim to update Vega network parameters + * @deprecated Use proposalsConnection instead + */ + networkParametersProposals?: Maybe>; + /** + * Governance proposals that aim to create new assets in Vega + * @deprecated Use proposalsConnection instead + */ + newAssetProposals?: Maybe>; + /** + * Freeform governance proposals, which can be voted on but do not change the behaviour of the system, and can be used to gauge community sentiment in Vega + * @deprecated Use proposalsConnection instead + */ + newFreeformProposals?: Maybe>; + /** + * Governance proposals that aim to create new markets + * @deprecated Use proposalsConnection instead + */ + newMarketProposals?: Maybe>; + /** specific node in network */ + node?: Maybe; + /** returns information about nodes */ + nodeData?: Maybe; + /** + * Return a list of aggregated node signature for a given resource ID + * @deprecated Use nodeSignaturesConnection instead + */ + nodeSignatures?: Maybe>; + /** Return a list of aggregated node signature for a given resource ID */ + nodeSignaturesConnection: NodeSignaturesConnection; + /** + * all known network nodes + * @deprecated use nodesConnection instead + */ + nodes?: Maybe>; + /** all known network nodes */ + nodesConnection: NodesConnection; + /** + * All registered oracle specs + * @deprecated Use oracleDataConnection instead + */ + oracleData?: Maybe>; + /** + * All oracle data for a given oracle spec ID + * @deprecated Use oracleDataBySpecConnection instead + */ + oracleDataBySpec?: Maybe>; + oracleDataBySpecConnection: OracleDataConnection; + /** All registered oracle specs */ + oracleDataConnection: OracleDataConnection; + /** An oracle spec for a given oracle spec ID */ + oracleSpec?: Maybe; + /** + * All registered oracle specs + * @deprecated Use oracleSpecsConnection instead + */ + oracleSpecs?: Maybe>; + /** All registered oracle specs */ + oracleSpecsConnection: OracleSpecsConnection; + /** An order in the Vega network found by orderID */ + orderByID: Order; + /** An order in the Vega network found by referenceID */ + orderByReference: Order; + /** + * Order versions (created via amendments if any) found by orderID + * @deprecated Use orderVersionsConnection instead + */ + orderVersions?: Maybe>; + /** Order versions (created via amendments if any) found by orderID */ + orderVersionsConnection: OrderConnection; + /** + * One or more entities that are trading on the Vega network + * @deprecated Use partiesConnection instead. + */ + parties?: Maybe>; + partiesConnection: PartyConnection; + /** An entity that is trading on the Vega network */ + party?: Maybe; + /** A governance proposal located by either its ID or reference. If both are set, ID is used. */ + proposal: Proposal; + /** + * All governance proposals in the Vega network + * @deprecated Use proposalsConnection instead + */ + proposals?: Maybe>; + /** All governance proposals in the Vega network */ + proposalsConnection: ProposalsConnection; + /** get statistics about the Vega node */ + statistics: Statistics; + /** + * get a list of all transfers for a public key + * @deprecated Use transfersConnection instead + */ + transfers?: Maybe>; + /** get a list of all transfers for a public key */ + transfersConnection: TransferConnection; + /** + * Governance proposals that aim to update existing markets + * @deprecated Use proposalsConnection instead + */ + updateMarketProposals?: Maybe>; + /** find a withdrawal using its ID */ + withdrawal?: Maybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryassetArgs = { + assetId: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryassetsConnectionArgs = { + id?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerydepositArgs = { + id: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryepochArgs = { + id?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type Queryerc20WithdrawalApprovalArgs = { + withdrawalId: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryestimateOrderArgs = { + expiration?: InputMaybe; + marketId: Scalars['ID']; + partyId: Scalars['ID']; + price?: InputMaybe; + side: Side; + size: Scalars['String']; + timeInForce: OrderTimeInForce; + type: OrderType; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryethereumKeyRotationsArgs = { + nodeId?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerygetMarketDataHistoryByIDArgs = { + end?: InputMaybe; + first?: InputMaybe; + id: Scalars['String']; + last?: InputMaybe; + skip?: InputMaybe; + start?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerygetMarketDataHistoryConnectionByIDArgs = { + end?: InputMaybe; + id: Scalars['String']; + pagination?: InputMaybe; + start?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryhistoricBalancesArgs = { + filter?: InputMaybe; + groupBy?: InputMaybe>>; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerykeyRotationsArgs = { + id?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerykeyRotationsConnectionArgs = { + id?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerymarketArgs = { + id: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerymarketsArgs = { + id?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerymarketsConnectionArgs = { + id?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynetworkParameterArgs = { + key: Scalars['String']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynetworkParametersConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynetworkParametersProposalsArgs = { + inState?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynewAssetProposalsArgs = { + inState?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynewFreeformProposalsArgs = { + inState?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynewMarketProposalsArgs = { + inState?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynodeArgs = { + id: Scalars['String']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynodeSignaturesArgs = { + resourceId: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynodeSignaturesConnectionArgs = { + pagination?: InputMaybe; + resourceId: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerynodesConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleDataArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleDataBySpecArgs = { + oracleSpecID: Scalars['String']; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleDataBySpecConnectionArgs = { + oracleSpecID: Scalars['String']; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleDataConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleSpecArgs = { + oracleSpecID: Scalars['String']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleSpecsArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryoracleSpecsConnectionArgs = { + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryorderByIDArgs = { + orderId: Scalars['ID']; + version?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryorderByReferenceArgs = { + reference: Scalars['String']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryorderVersionsArgs = { + first?: InputMaybe; + last?: InputMaybe; + orderId: Scalars['ID']; + skip?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryorderVersionsConnectionArgs = { + orderId?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerypartiesArgs = { + id?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerypartiesConnectionArgs = { + id?: InputMaybe; + pagination?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerypartyArgs = { + id: Scalars['ID']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryproposalArgs = { + id?: InputMaybe; + reference?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryproposalsArgs = { + inState?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryproposalsConnectionArgs = { + inState?: InputMaybe; + pagination?: InputMaybe; + proposalType?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerytransfersArgs = { + isFrom?: InputMaybe; + isTo?: InputMaybe; + pubkey: Scalars['String']; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerytransfersConnectionArgs = { + direction?: InputMaybe; + pagination?: InputMaybe; + partyId?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryupdateMarketProposalsArgs = { + inState?: InputMaybe; + marketId?: InputMaybe; +}; + + +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QuerywithdrawalArgs = { + id: Scalars['ID']; +}; + +export type RankingScore = { + __typename?: 'RankingScore'; + /** The performance score of the validator */ + performanceScore: Scalars['String']; + /** The former validation status of the validator */ + previousStatus: ValidatorStatus; + /** The ranking score of the validator */ + rankingScore: Scalars['String']; + /** The stake based score of the validator (no anti-whaling) */ + stakeScore: Scalars['String']; + /** The current validation status of the validator */ + status: ValidatorStatus; + /** The Tendermint voting power of the validator (uint32) */ + votingPower: Scalars['String']; +}; + +/** The specific details for a recurring transfer */ +export type RecurringTransfer = { + __typename?: 'RecurringTransfer'; + /** An optional dispatch strategy for the recurring transfer */ + dispatchStrategy?: Maybe; + /** An optional epoch at which this transfer will stop */ + endEpoch?: Maybe; + /** The factor of the initial amount to be distributed */ + factor: Scalars['String']; + /** The epoch at which this recurring transfer will start */ + startEpoch: Scalars['Int']; +}; + +/** Reward information for a single party */ +export type Reward = { + __typename?: 'Reward'; + /** Amount received for this reward */ + amount: Scalars['String']; + /** The amount field formatted by the client */ + amountFormatted: Scalars['String']; + /** The asset this reward is paid in */ + asset: Asset; + /** Epoch for which this reward was distributed */ + epoch: Epoch; + /** The market for which this reward is paid if any */ + marketID: Scalars['String']; + /** Party receiving the reward */ + party: Party; + /** Percentage out of the total distributed reward */ + percentageOfTotal: Scalars['String']; + /** Time at which the rewards was received */ + receivedAt: Scalars['String']; + /** The type of reward */ + rewardType: AccountType; +}; + +export type RewardEdge = { + __typename?: 'RewardEdge'; + cursor: Scalars['String']; + node: Reward; +}; + +/** RewardPerAssetDetail is deprecated, use RewardSummmary instead */ +export type RewardPerAssetDetail = { + __typename?: 'RewardPerAssetDetail'; + /** Asset in which the reward was paid */ + asset: Asset; + /** + * Id of asset in which the reward was paid + * @deprecated Use asset{id} instead + */ + assetId: Scalars['String']; + /** A list of rewards received for this asset */ + rewards?: Maybe>>; + /** The total amount of rewards received for this asset. */ + totalAmount: Scalars['String']; + /** The total amount field formatted by the client */ + totalAmountFormatted: Scalars['String']; +}; + +export type RewardScore = { + __typename?: 'RewardScore'; + /** The multisig score of the validator */ + multisigScore: Scalars['String']; + /** The normalised score of the validator */ + normalisedScore: Scalars['String']; + /** The performance score of the validator */ + performanceScore: Scalars['String']; + /** The stake based validator score with anti-whaling */ + rawValidatorScore: Scalars['String']; + /** The composite score of the validator */ + validatorScore: Scalars['String']; + /** The status of the validator for this score */ + validatorStatus: ValidatorStatus; +}; + +export type RewardSummary = { + __typename?: 'RewardSummary'; + /** Total quantity of rewards awarded in this asset */ + amount: Scalars['String']; + /** The asset for which these rewards are associated */ + asset: Asset; + /** + * List of individual reward payouts, ordered by epoch + * @deprecated Use rewardsConnection instead + */ + rewards?: Maybe>>; + /** List of individual reward payouts, ordered by epoch */ + rewardsConnection?: Maybe; +}; + + +export type RewardSummaryrewardsArgs = { + first?: InputMaybe; + last?: InputMaybe; + skip?: InputMaybe; +}; + + +export type RewardSummaryrewardsConnectionArgs = { + asset?: InputMaybe; + pagination?: InputMaybe; +}; + +export type RewardSummaryConnection = { + __typename?: 'RewardSummaryConnection'; + /** List of reward summaries available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +export type RewardSummaryEdge = { + __typename?: 'RewardSummaryEdge'; + /** Cursor identifying the reward summary */ + cursor: Scalars['String']; + /** The reward summary */ + node: RewardSummary; +}; + +export type RewardsConnection = { + __typename?: 'RewardsConnection'; + /** The rewards */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +/** A risk factor emitted by the risk model for a given market */ +export type RiskFactor = { + __typename?: 'RiskFactor'; + /** long factor */ + long: Scalars['String']; + /** market the risk factor was emitted for */ + market: Scalars['String']; + /** short factor */ + short: Scalars['String']; +}; + +export type RiskModel = LogNormalRiskModel | SimpleRiskModel; + +export type ScalingFactors = { + __typename?: 'ScalingFactors'; + /** the scaling factor that determines the overflow margin level */ + collateralRelease: Scalars['Float']; + /** the scaling factor that determines the optimal margin level */ + initialMargin: Scalars['Float']; + /** the scaling factor that determines the margin level at which Vega has to search for more money */ + searchLevel: Scalars['Float']; +}; + +export type SettleDistressed = { + __typename?: 'SettleDistressed'; + /** the margin taken from distressed party */ + margin: Scalars['String']; + /** the market in which a position was closed out */ + marketId: Scalars['ID']; + /** the party that was closed out */ + partyId: Scalars['ID']; + /** the price at which the position was closed out */ + price: Scalars['String']; +}; + +export type SettlePosition = { + __typename?: 'SettlePosition'; + /** the market in which a position was settled */ + marketId: Scalars['ID']; + /** the party who settled a position */ + partyId: Scalars['ID']; + /** the settle price */ + price: Scalars['String']; + /** the trades that were settled to close the overall position */ + tradeSettlements?: Maybe>; +}; + +/** Whether the placer of an order is aiming to buy or sell on the market */ +export enum Side { + /** The placer of the order is aiming to buy */ + SIDE_BUY = 'SIDE_BUY', + /** The placer of the order is aiming to sell */ + SIDE_SELL = 'SIDE_SELL' +} + +/** A type of simple/dummy risk model where you can specify the risk factor long and short in params */ +export type SimpleRiskModel = { + __typename?: 'SimpleRiskModel'; + /** Params for the simple risk model */ + params: SimpleRiskModelParams; +}; + +/** Parameters for the simple risk model */ +export type SimpleRiskModelParams = { + __typename?: 'SimpleRiskModelParams'; + /** Risk factor for long */ + factorLong: Scalars['Float']; + /** Risk factor for short */ + factorShort: Scalars['Float']; +}; + +/** A stake linking represent the intent from a party to deposit / remove stake on their account */ +export type StakeLinking = { + __typename?: 'StakeLinking'; + /** The amount linked or unlinked */ + amount: Scalars['String']; + /** The time at which the stake linking was fully processed by the Vega network, null until defined */ + finalizedAt?: Maybe; + id: Scalars['ID']; + /** The party initiating the stake linking */ + party: Party; + /** The status of the linking */ + status: StakeLinkingStatus; + /** The time at which the request happened on ethereum */ + timestamp: Scalars['String']; + /** The transaction hash (ethereum) which initiated the link/unlink */ + txHash: Scalars['String']; + /** Type of linking: link|unlink */ + type: StakeLinkingType; +}; + +export type StakeLinkingEdge = { + __typename?: 'StakeLinkingEdge'; + /** Cursor identifying the stake linking */ + cursor: Scalars['String']; + /** The stake linking */ + node: StakeLinking; +}; + +/** The status of the stake linking */ +export enum StakeLinkingStatus { + /** The stake linking has been accepted and processed fully (balance updated) by the network */ + STATUS_ACCEPTED = 'STATUS_ACCEPTED', + /** + * The stake linking is pending in the Vega network. This means that + * the Vega network have seen a stake linking, but is still to confirm + * it's valid on the ethereum chain and accepted by all nodes of the network + */ + STATUS_PENDING = 'STATUS_PENDING', + /** The Vega network has rejected this stake linking */ + STATUS_REJECTED = 'STATUS_REJECTED' +} + +/** The type of stake linking */ +export enum StakeLinkingType { + /** The stake is being linked (deposited) to a Vega stake account */ + TYPE_LINK = 'TYPE_LINK', + /** The stake is being unlinked (removed) from a Vega stake account */ + TYPE_UNLINK = 'TYPE_UNLINK' +} + +export type StakesConnection = { + __typename?: 'StakesConnection'; + /** List of stake links available for the connection */ + edges?: Maybe>>; + /** Page information for the connection */ + pageInfo: PageInfo; +}; + +/** + * All staking information related to a Party. + * Contains the current recognised balance by the network and + * all the StakeLink/Unlink seen by the network + */ +export type StakingSummary = { + __typename?: 'StakingSummary'; + /** The stake currently available for the party */ + currentStakeAvailable: Scalars['String']; + /** The list of all stake link/unlink for the party */ + linkings: StakesConnection; +}; + + +/** + * All staking information related to a Party. + * Contains the current recognised balance by the network and + * all the StakeLink/Unlink seen by the network + */ +export type StakingSummarylinkingsArgs = { + pagination?: InputMaybe; +}; + +/** Statistics about the node */ +export type Statistics = { + __typename?: 'Statistics'; + /** Version of the Vega node (semver) */ + appVersion: Scalars['String']; + /** Version commit hash of the Vega node */ + appVersionHash: Scalars['String']; + /** Average number of orders added per blocks */ + averageOrdersPerBlock: Scalars['String']; + /** Average size of the transactions */ + averageTxBytes: Scalars['String']; + /** Number of items in the backlog */ + backlogLength: Scalars['String']; + /** Duration of the last block, in nanoseconds */ + blockDuration: Scalars['String']; + /** Current block hash */ + blockHash: Scalars['String']; + /** Current block number */ + blockHeight: Scalars['String']; + /** Current chain ID */ + chainId: Scalars['String']; + /** Version of the chain (semver) */ + chainVersion: Scalars['String']; + /** RFC3339Nano current time (real) */ + currentTime: Scalars['String']; + /** RFC3339Nano genesis time of the chain */ + genesisTime: Scalars['String']; + /** Number of orders per seconds */ + ordersPerSecond: Scalars['String']; + /** Status of the Vega application connection with the chain */ + status: Scalars['String']; + /** Total number of amended orders */ + totalAmendOrder: Scalars['String']; + /** Total number of cancelled orders */ + totalCancelOrder: Scalars['String']; + /** Total number of orders created */ + totalCreateOrder: Scalars['String']; + /** Total number of markets */ + totalMarkets: Scalars['String']; + /** Total number of orders */ + totalOrders: Scalars['String']; + /** Total number of peers on the Vega network */ + totalPeers: Scalars['String']; + /** Total number of trades */ + totalTrades: Scalars['String']; + /** Number of the trades per seconds */ + tradesPerSecond: Scalars['String']; + /** Number of transaction processed per block */ + txPerBlock: Scalars['String']; + /** RFC3339Nano uptime of the node */ + upTime: Scalars['String']; + /** RFC3339Nano current time of the chain (decided through consensus) */ + vegaTime: Scalars['String']; +}; + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type Subscription = { + __typename?: 'Subscription'; + /** Subscribe to the accounts updates */ + accounts: Account; + /** Subscribe to event data from the event bus */ + busEvents?: Maybe>; + /** Subscribe to the candles updates */ + candles: Candle; + /** Subscribe to delegation data */ + delegations: Delegation; + /** Subscribe to the margin changes */ + margins: MarginLevels; + /** + * Subscribe to the mark price changes + * @deprecated Use marketsData instead + */ + marketData: MarketData; + /** + * Subscribe to the market depths update + * @deprecated Use marketsDepth instead + */ + marketDepth: MarketDepth; + /** + * Subscribe to price level market depth updates + * @deprecated Use marketsDepthUpdate instead + */ + marketDepthUpdate: MarketDepthUpdate; + /** Subscribe to the mark price changes */ + marketsData: Array; + /** Subscribe to the market depths update */ + marketsDepth: Array; + /** Subscribe to price level market depth updates */ + marketsDepthUpdate: Array; + /** Subscribe to orders updates */ + orders?: Maybe>; + /** Subscribe to the positions updates */ + positions: Position; + /** Subscribe to proposals. Leave out all arguments to receive all proposals */ + proposals: Proposal; + /** Subscribe to reward details data */ + rewards: Reward; + /** Subscribe to the trades updates */ + trades?: Maybe>; + /** Subscribe to votes, either by proposal ID or party ID */ + votes: ProposalVote; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionaccountsArgs = { + asset?: InputMaybe; + marketId?: InputMaybe; + partyId?: InputMaybe; + type?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionbusEventsArgs = { + batchSize: Scalars['Int']; + marketId?: InputMaybe; + partyId?: InputMaybe; + types: Array; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptioncandlesArgs = { + interval: Interval; + marketId: Scalars['ID']; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptiondelegationsArgs = { + nodeID?: InputMaybe; + party?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarginsArgs = { + marketId?: InputMaybe; + partyId: Scalars['ID']; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketDataArgs = { + marketId?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketDepthArgs = { + marketId: Scalars['ID']; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketDepthUpdateArgs = { + marketId: Scalars['ID']; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketsDataArgs = { + marketIds: Array; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketsDepthArgs = { + marketIds: Array; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionmarketsDepthUpdateArgs = { + marketIds: Array; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionordersArgs = { + marketId?: InputMaybe; + partyId?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionpositionsArgs = { + marketId?: InputMaybe; + partyId?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionproposalsArgs = { + partyId?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionrewardsArgs = { + assetId?: InputMaybe; + party?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptiontradesArgs = { + marketId?: InputMaybe; + partyId?: InputMaybe; +}; + + +/** Subscriptions allow a caller to receive new information as it is available from the Vega network. */ +export type SubscriptionvotesArgs = { + partyId?: InputMaybe; + proposalId?: InputMaybe; +}; + +/** TargetStakeParameters contains parameters used in target stake calculation */ +export type TargetStakeParameters = { + __typename?: 'TargetStakeParameters'; + /** Specifies scaling factors used in target stake calculation */ + scalingFactor: Scalars['Float']; + /** Specifies length of time window expressed in seconds for target stake calculation */ + timeWindow: Scalars['Int']; +}; + +export type TimeUpdate = { + __typename?: 'TimeUpdate'; + /** RFC3339Nano time of new block time */ + timestamp: Scalars['String']; +}; + +/** A tradable instrument is a combination of an instrument and a risk model */ +export type TradableInstrument = { + __typename?: 'TradableInstrument'; + /** An instance of, or reference to, a fully specified instrument. */ + instrument: Instrument; + /** Margin calculation info, currently only the scaling factors (search, initial, release) for this tradable instrument */ + marginCalculator?: Maybe; + /** A reference to a risk model that is valid for the instrument */ + riskModel: RiskModel; +}; + +/** A trade on Vega, the result of two orders being 'matched' in the market */ +export type Trade = { + __typename?: 'Trade'; + /** The aggressor indicates whether this trade was related to a BUY or SELL */ + aggressor: Side; + /** The order that bought */ + buyOrder: Scalars['String']; + /** The party that bought */ + buyer: Party; + /** The batch in which the buyer order was submitted (applies only for auction modes) */ + buyerAuctionBatch?: Maybe; + /** The fee paid by the buyer side of the trade */ + buyerFee: TradeFee; + /** RFC3339Nano time for when the trade occurred */ + createdAt: Scalars['String']; + /** The hash of the trade data */ + id: Scalars['ID']; + /** The market the trade occurred on */ + market: Market; + /** The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64) */ + price: Scalars['String']; + /** The order that sold */ + sellOrder: Scalars['String']; + /** The party that sold */ + seller: Party; + /** The batch in which the seller order was submitted (applies only for auction modes) */ + sellerAuctionBatch?: Maybe; + /** The fee paid by the seller side of the trade */ + sellerFee: TradeFee; + /** The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64) */ + size: Scalars['String']; + /** The type of trade */ + type: TradeType; +}; + +export type TradeConnection = { + __typename?: 'TradeConnection'; + /** The trade in this connection */ + edges: Array; + /** The pagination information */ + pageInfo: PageInfo; +}; + +export type TradeEdge = { + __typename?: 'TradeEdge'; + cursor: Scalars['String']; + node: Trade; +}; + +/** The fee paid by the party when a trade occurs */ +export type TradeFee = { + __typename?: 'TradeFee'; + /** The infrastructure fee, a fee paid to the validators to maintain the Vega network */ + infrastructureFee: Scalars['String']; + /** The fee paid to the liquidity providers that committed liquidity to the market */ + liquidityFee: Scalars['String']; + /** The maker fee, paid by the aggressive party to the other party (the one who had an order in the book) */ + makerFee: Scalars['String']; +}; + +export type TradeSettlement = { + __typename?: 'TradeSettlement'; + /** the price of the trade */ + price: Scalars['String']; + /** the size of the trade */ + size: Scalars['Int']; +}; + +/** Valid trade types */ +export enum TradeType { + /** Default trade type */ + TYPE_DEFAULT = 'TYPE_DEFAULT', + /** Network close-out - good */ + TYPE_NETWORK_CLOSE_OUT_BAD = 'TYPE_NETWORK_CLOSE_OUT_BAD', + /** Network close-out - bad */ + TYPE_NETWORK_CLOSE_OUT_GOOD = 'TYPE_NETWORK_CLOSE_OUT_GOOD' +} + +export type TransactionSubmitted = { + __typename?: 'TransactionSubmitted'; + success: Scalars['Boolean']; +}; + +/** A user initiated transfer */ +export type Transfer = { + __typename?: 'Transfer'; + /** The amount sent */ + amount: Scalars['String']; + /** The asset */ + asset?: Maybe; + /** The public key of the sender in this transfer */ + from: Scalars['String']; + /** The account type from which funds have been sent */ + fromAccountType: AccountType; + /** ID of this transfer */ + id: Scalars['ID']; + kind: TransferKind; + /** An optional reference */ + reference?: Maybe; + /** The status of this transfer */ + status: TransferStatus; + /** The time at which the transfer was submitted */ + timestamp: Scalars['String']; + /** The public key of the recipient of the funds */ + to: Scalars['String']; + /** The account type that has received the funds */ + toAccountType: AccountType; +}; + +export type TransferBalance = { + __typename?: 'TransferBalance'; + /** Account involved in transfer */ + account: Account; + /** The new balance of the account */ + balance: Scalars['String']; +}; + +export type TransferConnection = { + __typename?: 'TransferConnection'; + edges?: Maybe>>; + pageInfo: PageInfo; +}; + +export enum TransferDirection { + From = 'From', + To = 'To', + ToOrFrom = 'ToOrFrom' +} + +export type TransferEdge = { + __typename?: 'TransferEdge'; + cursor: Scalars['String']; + node: Transfer; +}; + +export type TransferKind = OneOffTransfer | RecurringTransfer; + +export type TransferResponse = { + __typename?: 'TransferResponse'; + /** The balances of accounts involved in the transfer */ + balances?: Maybe>; + /** The ledger entries and balances resulting from a transfer request */ + transfers?: Maybe>; +}; + +export type TransferResponses = { + __typename?: 'TransferResponses'; + /** A group of transfer responses - events from core */ + responses?: Maybe>; +}; + +export enum TransferStatus { + /** Indication of a transfer cancelled by the user */ + STATUS_CANCELLED = 'STATUS_CANCELLED', + /** Indicates a transfer accepted by the Vega network */ + STATUS_DONE = 'STATUS_DONE', + /** Indicates a transfer still being processed */ + STATUS_PENDING = 'STATUS_PENDING', + /** Indicates a transfer rejected by the Vega network */ + STATUS_REJECTED = 'STATUS_REJECTED', + /** + * Indicates a transfer stopped by the Vega network + * e.g: no funds left to cover the transfer + */ + STATUS_STOPPED = 'STATUS_STOPPED' +} + +/** A proposal to update an asset's details */ +export type UpdateAsset = { + __typename?: 'UpdateAsset'; + /** The full name of the asset (e.g: Great British Pound) */ + name: Scalars['String']; + /** The minimum economically meaningful amount of this specific asset */ + quantum: Scalars['String']; + /** The source of the updated asset */ + source: UpdateAssetSource; + /** The symbol of the asset (e.g: GBP) */ + symbol: Scalars['String']; +}; + +/** One of the possible asset sources for update assets proposals */ +export type UpdateAssetSource = UpdateERC20; + +/** An asset originated from an Ethereum ERC20 Token */ +export type UpdateERC20 = { + __typename?: 'UpdateERC20'; + /** + * The lifetime limits deposit per address + * Note: this is a temporary measure for alpha mainnet + */ + lifetimeLimit: Scalars['String']; + /** + * The maximum allowed per withdrawal + * Note: this is a temporary measure for alpha mainnet + */ + withdrawThreshold: Scalars['String']; +}; + +export type UpdateFutureProduct = { + __typename?: 'UpdateFutureProduct'; + oracleSpecBinding: OracleSpecToFutureBinding; + oracleSpecForSettlementPrice: OracleSpecConfiguration; + oracleSpecForTradingTermination: OracleSpecConfiguration; + quoteName: Scalars['String']; +}; + +export type UpdateInstrumentConfiguration = { + __typename?: 'UpdateInstrumentConfiguration'; + code: Scalars['String']; + product: UpdateFutureProduct; +}; + +/** + * Incomplete change definition for governance proposal terms + * TODO: complete the type + */ +export type UpdateMarket = { + __typename?: 'UpdateMarket'; + marketId: Scalars['ID']; + updateMarketConfiguration: UpdateMarketConfiguration; +}; + +export type UpdateMarketConfiguration = { + __typename?: 'UpdateMarketConfiguration'; + instrument: UpdateInstrumentConfiguration; + liquidityMonitoringParameters: LiquidityMonitoringParameters; + metadata?: Maybe>>; + priceMonitoringParameters: PriceMonitoringParameters; + riskParameters: UpdateMarketRiskParameters; +}; + +export type UpdateMarketLogNormalRiskModel = { + __typename?: 'UpdateMarketLogNormalRiskModel'; + logNormal?: Maybe; +}; + +export type UpdateMarketRiskParameters = UpdateMarketLogNormalRiskModel | UpdateMarketSimpleRiskModel; + +export type UpdateMarketSimpleRiskModel = { + __typename?: 'UpdateMarketSimpleRiskModel'; + simple?: Maybe; +}; + +/** Allows submitting a proposal for changing network parameters */ +export type UpdateNetworkParameter = { + __typename?: 'UpdateNetworkParameter'; + networkParameter: NetworkParameter; +}; + +export enum ValidatorStatus { + /** The node is a candidate to become a Tendermint validator if a slot is made available */ + VALIDATOR_NODE_STATUS_ERSATZ = 'VALIDATOR_NODE_STATUS_ERSATZ', + /** The node is pending to be promoted to Ersatz */ + VALIDATOR_NODE_STATUS_PENDING = 'VALIDATOR_NODE_STATUS_PENDING', + /** The node is taking part in Tendermint consensus */ + VALIDATOR_NODE_STATUS_TENDERMINT = 'VALIDATOR_NODE_STATUS_TENDERMINT' +} + +export type Vote = { + __typename?: 'Vote'; + /** RFC3339Nano time and date when the vote reached Vega network */ + datetime: Scalars['String']; + /** Total number of governance tokens for the party that cast the vote */ + governanceTokenBalance: Scalars['String']; + /** The weight of this vote based on the total of governance token */ + governanceTokenWeight: Scalars['String']; + /** The party casting the vote */ + party: Party; + /** The ID of the proposal this vote applies to */ + proposalId: Scalars['ID']; + /** The vote value cast */ + value: VoteValue; +}; + +export type VoteConnection = { + __typename?: 'VoteConnection'; + /** The votes in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +export type VoteEdge = { + __typename?: 'VoteEdge'; + cursor?: Maybe; + node: Vote; +}; + +export enum VoteValue { + /** No reject a proposal */ + VALUE_NO = 'VALUE_NO', + /** Yes accept a proposal */ + VALUE_YES = 'VALUE_YES' +} + +/** The details of a withdrawal processed by Vega */ +export type Withdrawal = { + __typename?: 'Withdrawal'; + /** The amount to be withdrawn */ + amount: Scalars['String']; + /** The asset to be withdrawn */ + asset: Asset; + /** RFC3339Nano time at which the withdrawal was created */ + createdTimestamp: Scalars['String']; + /** Foreign chain specific details about the withdrawal */ + details?: Maybe; + /** RFC3339Nano time until the withdrawal will be invalid */ + expiry: Scalars['String']; + /** The Vega internal ID of the withdrawal */ + id: Scalars['ID']; + /** The PartyID (public key) initiating the withdrawal */ + party: Party; + /** Whether or the not the withdrawal is being processed on Ethereum */ + pendingOnForeignChain: Scalars['Boolean']; + /** A reference the foreign chain can use to refer to when processing the withdrawal */ + ref: Scalars['String']; + /** The current status of the withdrawal */ + status: WithdrawalStatus; + /** Hash of the transaction on the foreign chain */ + txHash?: Maybe; + /** RFC3339Nano time at which the withdrawal was finalised */ + withdrawnTimestamp?: Maybe; +}; + +export type WithdrawalDetails = Erc20WithdrawalDetails; + +export type WithdrawalEdge = { + __typename?: 'WithdrawalEdge'; + cursor: Scalars['String']; + node: Withdrawal; +}; + +/** The status of a withdrawal */ +export enum WithdrawalStatus { + /** The withdrawal was finalised, it was valid, the foreign chain has executed it and the network updated all accounts */ + STATUS_FINALIZED = 'STATUS_FINALIZED', + /** The withdrawal is open and being processed by the network */ + STATUS_OPEN = 'STATUS_OPEN', + /** The withdrawal have been cancelled by the network, either because it expired, or something went wrong with the foreign chain */ + STATUS_REJECTED = 'STATUS_REJECTED' +} + +export type WithdrawalsConnection = { + __typename?: 'WithdrawalsConnection'; + /** The withdrawals */ + edges?: Maybe>>; + /** The pagination information */ + pageInfo?: Maybe; +}; diff --git a/libs/types/src/index.ts b/libs/types/src/index.ts index a0640b110..92e430b33 100644 --- a/libs/types/src/index.ts +++ b/libs/types/src/index.ts @@ -1,3 +1,6 @@ -export * from './__generated__'; +import * as Schema from './__generated__/types'; + +export * from './__generated__/globalTypes'; export * from './candle'; export * from './global-types-mappings'; +export { Schema }; diff --git a/libs/wallet/.eslintrc.json b/libs/wallet/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/wallet/.eslintrc.json +++ b/libs/wallet/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/web3/.eslintrc.json b/libs/web3/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/web3/.eslintrc.json +++ b/libs/web3/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/web3/src/lib/NetworkParams.graphql b/libs/web3/src/lib/NetworkParams.graphql new file mode 100644 index 000000000..f21986e42 --- /dev/null +++ b/libs/web3/src/lib/NetworkParams.graphql @@ -0,0 +1,6 @@ +query NetworkParamsQuery { + networkParameters { + key + value + } +} diff --git a/libs/web3/src/lib/__generated___/NetworkParams.ts b/libs/web3/src/lib/__generated___/NetworkParams.ts new file mode 100644 index 000000000..1f15fb4cc --- /dev/null +++ b/libs/web3/src/lib/__generated___/NetworkParams.ts @@ -0,0 +1,46 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NetworkParamsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; + + +export type NetworkParamsQueryQuery = { __typename?: 'Query', networkParameters?: Array<{ __typename?: 'NetworkParameter', key: string, value: string }> | null }; + + +export const NetworkParamsQueryDocument = gql` + query NetworkParamsQuery { + networkParameters { + key + value + } +} + `; + +/** + * __useNetworkParamsQueryQuery__ + * + * To run a query within a React component, call `useNetworkParamsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useNetworkParamsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useNetworkParamsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useNetworkParamsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(NetworkParamsQueryDocument, options); + } +export function useNetworkParamsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(NetworkParamsQueryDocument, options); + } +export type NetworkParamsQueryQueryHookResult = ReturnType; +export type NetworkParamsQueryLazyQueryHookResult = ReturnType; +export type NetworkParamsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/.eslintrc.json b/libs/withdraws/.eslintrc.json index db820c5d0..de2a9b877 100644 --- a/libs/withdraws/.eslintrc.json +++ b/libs/withdraws/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*", "__generated__"], + "ignorePatterns": ["!**/*", "__generated__", "__generated___"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/withdraws/src/lib/Erc20Approval.graphql b/libs/withdraws/src/lib/Erc20Approval.graphql new file mode 100644 index 000000000..c9f805034 --- /dev/null +++ b/libs/withdraws/src/lib/Erc20Approval.graphql @@ -0,0 +1,11 @@ +query Erc20Approval($withdrawalId: ID!) { + erc20WithdrawalApproval(withdrawalId: $withdrawalId) { + assetSource + amount + nonce + signatures + targetAddress + expiry + creation + } +} diff --git a/libs/withdraws/src/lib/Withdraw.graphql b/libs/withdraws/src/lib/Withdraw.graphql new file mode 100644 index 000000000..e1702379f --- /dev/null +++ b/libs/withdraws/src/lib/Withdraw.graphql @@ -0,0 +1,32 @@ +query WithdrawPageQuery($partyId: ID!) { + party(id: $partyId) { + id + withdrawals { + id + txHash + } + accounts { + type + balance + asset { + id + symbol + } + } + } + assetsConnection { + edges { + node { + id + symbol + name + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} diff --git a/libs/withdraws/src/lib/Withdrawal.graphql b/libs/withdraws/src/lib/Withdrawal.graphql new file mode 100644 index 000000000..59fc3483d --- /dev/null +++ b/libs/withdraws/src/lib/Withdrawal.graphql @@ -0,0 +1,38 @@ +fragment WithdrawalFields on Withdrawal { + id + status + amount + asset { + id + symbol + decimals + } + createdTimestamp + withdrawnTimestamp + txHash + details { + ... on Erc20WithdrawalDetails { + receiverAddress + } + } + pendingOnForeignChain @client +} + +query Withdrawals($partyId: ID!) { + party(id: $partyId) { + id + withdrawals { + ...WithdrawalFields + } + } +} + +subscription WithdrawalEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Withdrawal]) { + event { + ... on Withdrawal { + ...WithdrawalFields + } + } + } +} diff --git a/libs/withdraws/src/lib/__generated___/Erc20Approval.ts b/libs/withdraws/src/lib/__generated___/Erc20Approval.ts new file mode 100644 index 000000000..9cd9eb0c0 --- /dev/null +++ b/libs/withdraws/src/lib/__generated___/Erc20Approval.ts @@ -0,0 +1,54 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type Erc20ApprovalQueryVariables = Types.Exact<{ + withdrawalId: Types.Scalars['ID']; +}>; + + +export type Erc20ApprovalQuery = { __typename?: 'Query', erc20WithdrawalApproval?: { __typename?: 'Erc20WithdrawalApproval', assetSource: string, amount: string, nonce: string, signatures: string, targetAddress: string, expiry: string, creation: string } | null }; + + +export const Erc20ApprovalDocument = gql` + query Erc20Approval($withdrawalId: ID!) { + erc20WithdrawalApproval(withdrawalId: $withdrawalId) { + assetSource + amount + nonce + signatures + targetAddress + expiry + creation + } +} + `; + +/** + * __useErc20ApprovalQuery__ + * + * To run a query within a React component, call `useErc20ApprovalQuery` and pass it any options that fit your needs. + * When your component renders, `useErc20ApprovalQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useErc20ApprovalQuery({ + * variables: { + * withdrawalId: // value for 'withdrawalId' + * }, + * }); + */ +export function useErc20ApprovalQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(Erc20ApprovalDocument, options); + } +export function useErc20ApprovalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(Erc20ApprovalDocument, options); + } +export type Erc20ApprovalQueryHookResult = ReturnType; +export type Erc20ApprovalLazyQueryHookResult = ReturnType; +export type Erc20ApprovalQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/src/lib/__generated___/Withdraw.ts b/libs/withdraws/src/lib/__generated___/Withdraw.ts new file mode 100644 index 000000000..73ff97211 --- /dev/null +++ b/libs/withdraws/src/lib/__generated___/Withdraw.ts @@ -0,0 +1,75 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type WithdrawPageQueryQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type WithdrawPageQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, txHash?: string | null }> | null, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string } }> | null } | null, assetsConnection: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } }; + + +export const WithdrawPageQueryDocument = gql` + query WithdrawPageQuery($partyId: ID!) { + party(id: $partyId) { + id + withdrawals { + id + txHash + } + accounts { + type + balance + asset { + id + symbol + } + } + } + assetsConnection { + edges { + node { + id + symbol + name + decimals + source { + ... on ERC20 { + contractAddress + } + } + } + } + } +} + `; + +/** + * __useWithdrawPageQueryQuery__ + * + * To run a query within a React component, call `useWithdrawPageQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useWithdrawPageQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useWithdrawPageQueryQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useWithdrawPageQueryQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(WithdrawPageQueryDocument, options); + } +export function useWithdrawPageQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(WithdrawPageQueryDocument, options); + } +export type WithdrawPageQueryQueryHookResult = ReturnType; +export type WithdrawPageQueryLazyQueryHookResult = ReturnType; +export type WithdrawPageQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/src/lib/__generated___/Withdrawal.ts b/libs/withdraws/src/lib/__generated___/Withdrawal.ts new file mode 100644 index 000000000..60c8c3b48 --- /dev/null +++ b/libs/withdraws/src/lib/__generated___/Withdrawal.ts @@ -0,0 +1,114 @@ +import * as Types from '@vegaprotocol/types/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type WithdrawalFieldsFragment = { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }; + +export type WithdrawalsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type WithdrawalsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }> | null } | null }; + +export type WithdrawalEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type WithdrawalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'Account' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } }> | null }; + +export const WithdrawalFieldsFragmentDoc = gql` + fragment WithdrawalFields on Withdrawal { + id + status + amount + asset { + id + symbol + decimals + } + createdTimestamp + withdrawnTimestamp + txHash + details { + ... on Erc20WithdrawalDetails { + receiverAddress + } + } + pendingOnForeignChain @client +} + `; +export const WithdrawalsDocument = gql` + query Withdrawals($partyId: ID!) { + party(id: $partyId) { + id + withdrawals { + ...WithdrawalFields + } + } +} + ${WithdrawalFieldsFragmentDoc}`; + +/** + * __useWithdrawalsQuery__ + * + * To run a query within a React component, call `useWithdrawalsQuery` and pass it any options that fit your needs. + * When your component renders, `useWithdrawalsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useWithdrawalsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useWithdrawalsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(WithdrawalsDocument, options); + } +export function useWithdrawalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(WithdrawalsDocument, options); + } +export type WithdrawalsQueryHookResult = ReturnType; +export type WithdrawalsLazyQueryHookResult = ReturnType; +export type WithdrawalsQueryResult = Apollo.QueryResult; +export const WithdrawalEventDocument = gql` + subscription WithdrawalEvent($partyId: ID!) { + busEvents(partyId: $partyId, batchSize: 0, types: [Withdrawal]) { + event { + ... on Withdrawal { + ...WithdrawalFields + } + } + } +} + ${WithdrawalFieldsFragmentDoc}`; + +/** + * __useWithdrawalEventSubscription__ + * + * To run a query within a React component, call `useWithdrawalEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useWithdrawalEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useWithdrawalEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useWithdrawalEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(WithdrawalEventDocument, options); + } +export type WithdrawalEventSubscriptionHookResult = ReturnType; +export type WithdrawalEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/package.json b/package.json index 03c20000e..f80fc1a1e 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,13 @@ "@commitlint/cli": "^16.2.4", "@commitlint/config-conventional": "^16.2.4", "@ethersproject/experimental": "^5.6.0", + "@graphql-codegen/cli": "^2.11.8", + "@graphql-codegen/near-operation-file-preset": "^2.4.1", + "@graphql-codegen/typescript": "^2.7.3", + "@graphql-codegen/typescript-operations": "^2.5.3", + "@graphql-codegen/typescript-react-apollo": "^3.3.3", + "@graphql-inspector/cli": "^3.3.0", + "@graphql-inspector/validate-command": "^3.3.0", "@nrwl/cli": "14.5.10", "@nrwl/cypress": "14.5.10", "@nrwl/eslint-plugin-nx": "14.5.10", diff --git a/tsconfig.base.json b/tsconfig.base.json index 9424d0d2b..0d4de9e97 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -38,6 +38,7 @@ ], "@vegaprotocol/trades": ["libs/trades/src/index.ts"], "@vegaprotocol/types": ["libs/types/src/index.ts"], + "@vegaprotocol/types/types": ["libs/types/src/__generated__/types.ts"], "@vegaprotocol/ui-toolkit": ["libs/ui-toolkit/src/index.ts"], "@vegaprotocol/wallet": ["libs/wallet/src/index.ts"], "@vegaprotocol/web3": ["libs/web3/src/index.ts"], diff --git a/yarn.lock b/yarn.lock index 1c8e210ed..166fe235d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -94,6 +94,36 @@ dependencies: "@apollographql/graphql-language-service-types" "^2.0.0" +"@ardatan/relay-compiler@12.0.0": + version "12.0.0" + resolved "https://registry.yarnpkg.com/@ardatan/relay-compiler/-/relay-compiler-12.0.0.tgz#2e4cca43088e807adc63450e8cab037020e91106" + integrity sha512-9anThAaj1dQr6IGmzBMcfzOQKTa5artjuPmw8NYK/fiGEMjADbSguBY2FMDykt+QhilR3wc9VA/3yVju7JHg7Q== + dependencies: + "@babel/core" "^7.14.0" + "@babel/generator" "^7.14.0" + "@babel/parser" "^7.14.0" + "@babel/runtime" "^7.0.0" + "@babel/traverse" "^7.14.0" + "@babel/types" "^7.0.0" + babel-preset-fbjs "^3.4.0" + chalk "^4.0.0" + fb-watchman "^2.0.0" + fbjs "^3.0.0" + glob "^7.1.1" + immutable "~3.7.6" + invariant "^2.2.4" + nullthrows "^1.1.1" + relay-runtime "12.0.0" + signedsource "^1.0.0" + yargs "^15.3.1" + +"@ardatan/sync-fetch@0.0.1": + version "0.0.1" + resolved "https://registry.yarnpkg.com/@ardatan/sync-fetch/-/sync-fetch-0.0.1.tgz#3385d3feedceb60a896518a1db857ec1e945348f" + integrity sha512-xhlTqH0m31mnsG0tIP4ETgfSB6gXDaYYsUWTrlUV93fFQPI9dd8hE0Ot6MHLCtqgB32hwJAC3YZMWlXZw7AleA== + dependencies: + node-fetch "^2.6.1" + "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.18.6", "@babel/code-frame@^7.5.5", "@babel/code-frame@^7.8.3": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" @@ -149,7 +179,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.0.1", "@babel/core@^7.1.0", "@babel/core@^7.12.10", "@babel/core@^7.12.3", "@babel/core@^7.15.0", "@babel/core@^7.16.0", "@babel/core@^7.18.5", "@babel/core@^7.7.2", "@babel/core@^7.7.5", "@babel/core@^7.8.0": +"@babel/core@^7.0.1", "@babel/core@^7.1.0", "@babel/core@^7.12.10", "@babel/core@^7.12.3", "@babel/core@^7.14.0", "@babel/core@^7.15.0", "@babel/core@^7.16.0", "@babel/core@^7.18.5", "@babel/core@^7.7.2", "@babel/core@^7.7.5", "@babel/core@^7.8.0": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.18.13.tgz#9be8c44512751b05094a4d3ab05fc53a47ce00ac" integrity sha512-ZisbOvRRusFktksHSG6pjj1CSvkPkcZq/KHD45LAkVP/oiHJkNBZWfpvlLmX8OtHDG8IuzsFlVRWo08w7Qxn0A== @@ -179,7 +209,7 @@ "@jridgewell/gen-mapping" "^0.1.0" jsesc "^2.5.1" -"@babel/generator@^7.12.11", "@babel/generator@^7.12.13", "@babel/generator@^7.12.5", "@babel/generator@^7.18.13", "@babel/generator@^7.7.2": +"@babel/generator@^7.12.11", "@babel/generator@^7.12.13", "@babel/generator@^7.12.5", "@babel/generator@^7.14.0", "@babel/generator@^7.18.13", "@babel/generator@^7.7.2": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.18.13.tgz#59550cbb9ae79b8def15587bdfbaa388c4abf212" integrity sha512-CkPg8ySSPuHTYPJYo7IRALdqyjM9HCbt/3uOBEFbzyGVP6Mn8bwFPB0jX6982JVNBlYzM1nnPkfjuXSOPtQeEQ== @@ -417,7 +447,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.1.3", "@babel/parser@^7.12.11", "@babel/parser@^7.12.13", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.18.10", "@babel/parser@^7.18.13": +"@babel/parser@^7.1.0", "@babel/parser@^7.1.3", "@babel/parser@^7.12.11", "@babel/parser@^7.12.13", "@babel/parser@^7.12.7", "@babel/parser@^7.14.0", "@babel/parser@^7.14.7", "@babel/parser@^7.16.8", "@babel/parser@^7.18.10", "@babel/parser@^7.18.13": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.18.13.tgz#5b2dd21cae4a2c5145f1fbd8ca103f9313d3b7e4" integrity sha512-dgXcIfMuQ0kgzLB2b9tRZs7TTFFaGM2AbtA4fJgUUYukzGH4jwsS7hzQHEGs67jdehpm22vkgKwvbU+aEflgwg== @@ -448,7 +478,7 @@ "@babel/helper-remap-async-to-generator" "^7.18.9" "@babel/plugin-syntax-async-generators" "^7.8.4" -"@babel/plugin-proposal-class-properties@^7.12.1", "@babel/plugin-proposal-class-properties@^7.14.5", "@babel/plugin-proposal-class-properties@^7.16.0", "@babel/plugin-proposal-class-properties@^7.18.6": +"@babel/plugin-proposal-class-properties@^7.0.0", "@babel/plugin-proposal-class-properties@^7.12.1", "@babel/plugin-proposal-class-properties@^7.14.5", "@babel/plugin-proposal-class-properties@^7.16.0", "@babel/plugin-proposal-class-properties@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz#b110f59741895f7ec21a6fff696ec46265c446a3" integrity sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ== @@ -541,7 +571,7 @@ "@babel/plugin-syntax-object-rest-spread" "^7.8.0" "@babel/plugin-transform-parameters" "^7.12.1" -"@babel/plugin-proposal-object-rest-spread@^7.12.1", "@babel/plugin-proposal-object-rest-spread@^7.16.0", "@babel/plugin-proposal-object-rest-spread@^7.18.9": +"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.12.1", "@babel/plugin-proposal-object-rest-spread@^7.16.0", "@babel/plugin-proposal-object-rest-spread@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz#f9434f6beb2c8cae9dfcf97d2a5941bbbf9ad4e7" integrity sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q== @@ -609,7 +639,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3": +"@babel/plugin-syntax-class-properties@^7.0.0", "@babel/plugin-syntax-class-properties@^7.12.13", "@babel/plugin-syntax-class-properties@^7.8.3": version "7.12.13" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz#b5c987274c4a3a82b89714796931a6b53544ae10" integrity sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA== @@ -651,7 +681,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-flow@^7.18.6": +"@babel/plugin-syntax-flow@^7.0.0", "@babel/plugin-syntax-flow@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.18.6.tgz#774d825256f2379d06139be0c723c4dd444f3ca1" integrity sha512-LUbR+KNTBWCUAqRG9ex5Gnzu2IOkt8jRJbHHXFT9q+L9zm7M/QQbEqXyw1n1pohYvOyWC8CjeyjrSaIwiYjK7A== @@ -686,7 +716,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-jsx@^7.17.12", "@babel/plugin-syntax-jsx@^7.18.6": +"@babel/plugin-syntax-jsx@^7.0.0", "@babel/plugin-syntax-jsx@^7.17.12", "@babel/plugin-syntax-jsx@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.18.6.tgz#a8feef63b010150abd97f1649ec296e849943ca0" integrity sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q== @@ -714,7 +744,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.10.4" -"@babel/plugin-syntax-object-rest-spread@7.8.3", "@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": +"@babel/plugin-syntax-object-rest-spread@7.8.3", "@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.8.0", "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== @@ -756,7 +786,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-arrow-functions@^7.12.1", "@babel/plugin-transform-arrow-functions@^7.18.6": +"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.12.1", "@babel/plugin-transform-arrow-functions@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.18.6.tgz#19063fcf8771ec7b31d742339dac62433d0611fe" integrity sha512-9S9X9RUefzrsHZmKMbDXxweEH+YlE8JJEuat9FdvW9Qh1cw7W64jELCtWNkPBPX5En45uy28KGvA/AySqUh8CQ== @@ -772,21 +802,21 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/helper-remap-async-to-generator" "^7.18.6" -"@babel/plugin-transform-block-scoped-functions@^7.18.6": +"@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.18.6.tgz#9187bf4ba302635b9d70d986ad70f038726216a8" integrity sha512-ExUcOqpPWnliRcPqves5HJcJOvHvIIWfuS4sroBUenPuMdmW+SMHDakmtS7qOo13sVppmUijqeTv7qqGsvURpQ== dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-block-scoping@^7.12.12", "@babel/plugin-transform-block-scoping@^7.18.9": +"@babel/plugin-transform-block-scoping@^7.0.0", "@babel/plugin-transform-block-scoping@^7.12.12", "@babel/plugin-transform-block-scoping@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz#f9b7e018ac3f373c81452d6ada8bd5a18928926d" integrity sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw== dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-classes@^7.12.1", "@babel/plugin-transform-classes@^7.18.9": +"@babel/plugin-transform-classes@^7.0.0", "@babel/plugin-transform-classes@^7.12.1", "@babel/plugin-transform-classes@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.18.9.tgz#90818efc5b9746879b869d5ce83eb2aa48bbc3da" integrity sha512-EkRQxsxoytpTlKJmSPYrsOMjCILacAjtSVkd4gChEe2kXjFCun3yohhW5I7plXJhCemM0gKsaGMcO8tinvCA5g== @@ -800,14 +830,14 @@ "@babel/helper-split-export-declaration" "^7.18.6" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.18.9": +"@babel/plugin-transform-computed-properties@^7.0.0", "@babel/plugin-transform-computed-properties@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.18.9.tgz#2357a8224d402dad623caf6259b611e56aec746e" integrity sha512-+i0ZU1bCDymKakLxn5srGHrsAPRELC2WIbzwjLhHW9SIE1cPYkLCL0NlnXMZaM1vhfgA2+M7hySk42VBvrkBRw== dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-destructuring@^7.12.1", "@babel/plugin-transform-destructuring@^7.18.9": +"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.12.1", "@babel/plugin-transform-destructuring@^7.18.9": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz#9e03bc4a94475d62b7f4114938e6c5c33372cbf5" integrity sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow== @@ -837,7 +867,7 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.18.6" "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-flow-strip-types@^7.18.6": +"@babel/plugin-transform-flow-strip-types@^7.0.0", "@babel/plugin-transform-flow-strip-types@^7.18.6": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.18.9.tgz#5b4cc521426263b5ce08893a2db41097ceba35bf" integrity sha512-+G6rp2zRuOAInY5wcggsx4+QVao1qPM0osC9fTUVlAV3zOrzTCnrMAFVnR6+a3T8wz1wFIH7KhYMcMB3u1n80A== @@ -845,14 +875,14 @@ "@babel/helper-plugin-utils" "^7.18.9" "@babel/plugin-syntax-flow" "^7.18.6" -"@babel/plugin-transform-for-of@^7.12.1", "@babel/plugin-transform-for-of@^7.18.8": +"@babel/plugin-transform-for-of@^7.0.0", "@babel/plugin-transform-for-of@^7.12.1", "@babel/plugin-transform-for-of@^7.18.8": version "7.18.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.18.8.tgz#6ef8a50b244eb6a0bdbad0c7c61877e4e30097c1" integrity sha512-yEfTRnjuskWYo0k1mHUqrVWaZwrdq8AYbfrpqULOJOaucGSp4mNMVps+YtA8byoevxS/urwU75vyhQIxcCgiBQ== dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-function-name@^7.18.9": +"@babel/plugin-transform-function-name@^7.0.0", "@babel/plugin-transform-function-name@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.18.9.tgz#cc354f8234e62968946c61a46d6365440fc764e0" integrity sha512-WvIBoRPaJQ5yVHzcnJFor7oS5Ls0PYixlTYE63lCj2RtdQEl15M68FXQlxnG6wdraJIXRdR7KI+hQ7q/9QjrCQ== @@ -861,14 +891,14 @@ "@babel/helper-function-name" "^7.18.9" "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-literals@^7.18.9": +"@babel/plugin-transform-literals@^7.0.0", "@babel/plugin-transform-literals@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.18.9.tgz#72796fdbef80e56fba3c6a699d54f0de557444bc" integrity sha512-IFQDSRoTPnrAIrI5zoZv73IFeZu2dhu6irxQjY9rNjTT53VmKg9fenjvoiOWOkJ6mm4jKVPtdMzBY98Fp4Z4cg== dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-member-expression-literals@^7.18.6": +"@babel/plugin-transform-member-expression-literals@^7.0.0", "@babel/plugin-transform-member-expression-literals@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.18.6.tgz#ac9fdc1a118620ac49b7e7a5d2dc177a1bfee88e" integrity sha512-qSF1ihLGO3q+/g48k85tUjD033C29TNTVB2paCwZPVmOsjn9pClvYYrM2VeJpBY2bcNkuny0YUyTNRyRxJ54KA== @@ -884,7 +914,7 @@ "@babel/helper-plugin-utils" "^7.18.6" babel-plugin-dynamic-import-node "^2.3.3" -"@babel/plugin-transform-modules-commonjs@^7.18.6": +"@babel/plugin-transform-modules-commonjs@^7.0.0", "@babel/plugin-transform-modules-commonjs@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz#afd243afba166cca69892e24a8fd8c9f2ca87883" integrity sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q== @@ -928,7 +958,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-object-super@^7.18.6": +"@babel/plugin-transform-object-super@^7.0.0", "@babel/plugin-transform-object-super@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.18.6.tgz#fb3c6ccdd15939b6ff7939944b51971ddc35912c" integrity sha512-uvGz6zk+pZoS1aTZrOvrbj6Pp/kK2mp45t2B+bTDre2UgsZZ8EZLSJtUg7m/no0zOJUWgFONpB7Zv9W2tSaFlA== @@ -936,14 +966,14 @@ "@babel/helper-plugin-utils" "^7.18.6" "@babel/helper-replace-supers" "^7.18.6" -"@babel/plugin-transform-parameters@^7.12.1", "@babel/plugin-transform-parameters@^7.18.8": +"@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.12.1", "@babel/plugin-transform-parameters@^7.18.8": version "7.18.8" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz#ee9f1a0ce6d78af58d0956a9378ea3427cccb48a" integrity sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg== dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-property-literals@^7.18.6": +"@babel/plugin-transform-property-literals@^7.0.0", "@babel/plugin-transform-property-literals@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.18.6.tgz#e22498903a483448e94e032e9bbb9c5ccbfc93a3" integrity sha512-cYcs6qlgafTud3PAzrrRNbQtfpQ8+y/+M5tKmksS9+M1ckbH6kzY8MrexEM9mcA6JDsukE19iIRvAyYl463sMg== @@ -957,7 +987,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.9" -"@babel/plugin-transform-react-display-name@^7.18.6": +"@babel/plugin-transform-react-display-name@^7.0.0", "@babel/plugin-transform-react-display-name@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.18.6.tgz#8b1125f919ef36ebdfff061d664e266c666b9415" integrity sha512-TV4sQ+T013n61uMoygyMRm+xf04Bd5oqFpv2jAEQwSZ8NwQA7zeRPg1LMVg2PWi3zWBz+CLKD+v5bcpZ/BS0aA== @@ -971,7 +1001,7 @@ dependencies: "@babel/plugin-transform-react-jsx" "^7.18.6" -"@babel/plugin-transform-react-jsx@^7.12.12", "@babel/plugin-transform-react-jsx@^7.18.6": +"@babel/plugin-transform-react-jsx@^7.0.0", "@babel/plugin-transform-react-jsx@^7.12.12", "@babel/plugin-transform-react-jsx@^7.18.6": version "7.18.10" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.18.10.tgz#ea47b2c4197102c196cbd10db9b3bb20daa820f1" integrity sha512-gCy7Iikrpu3IZjYZolFE4M1Sm+nrh1/6za2Ewj77Z+XirT4TsbJcvOFOyF+fRPwU6AKKK136CZxx6L8AbSFG6A== @@ -1017,14 +1047,14 @@ babel-plugin-polyfill-regenerator "^0.4.0" semver "^6.3.0" -"@babel/plugin-transform-shorthand-properties@^7.12.1", "@babel/plugin-transform-shorthand-properties@^7.18.6": +"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.12.1", "@babel/plugin-transform-shorthand-properties@^7.18.6": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.18.6.tgz#6d6df7983d67b195289be24909e3f12a8f664dc9" integrity sha512-eCLXXJqv8okzg86ywZJbRn19YJHU4XUa55oz2wbHhaQVn/MM+XhukiT7SYqp/7o00dg52Rj51Ny+Ecw4oyoygw== dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-spread@^7.12.1", "@babel/plugin-transform-spread@^7.18.9": +"@babel/plugin-transform-spread@^7.0.0", "@babel/plugin-transform-spread@^7.12.1", "@babel/plugin-transform-spread@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.18.9.tgz#6ea7a6297740f381c540ac56caf75b05b74fb664" integrity sha512-39Q814wyoOPtIB/qGopNIL9xDChOE1pNU0ZY5dO0owhiVt/5kFm4li+/bBtwc7QotG0u5EPzqhZdjMtmqBqyQA== @@ -1039,7 +1069,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.18.6" -"@babel/plugin-transform-template-literals@^7.12.1", "@babel/plugin-transform-template-literals@^7.18.9": +"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.12.1", "@babel/plugin-transform-template-literals@^7.18.9": version "7.18.9" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.18.9.tgz#04ec6f10acdaa81846689d63fae117dd9c243a5e" integrity sha512-S8cOWfT82gTezpYOiVaGHrCbhlHgKhQt8XH5ES46P2XWmX92yisoZywf5km75wv5sYcXDUCLMmMxOLCtthDgMA== @@ -1243,7 +1273,7 @@ "@babel/parser" "^7.18.10" "@babel/types" "^7.18.10" -"@babel/traverse@^7.1.6", "@babel/traverse@^7.12.11", "@babel/traverse@^7.12.13", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.0", "@babel/traverse@^7.18.11", "@babel/traverse@^7.18.13", "@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.1.6", "@babel/traverse@^7.12.11", "@babel/traverse@^7.12.13", "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.14.0", "@babel/traverse@^7.16.0", "@babel/traverse@^7.16.8", "@babel/traverse@^7.18.11", "@babel/traverse@^7.18.13", "@babel/traverse@^7.18.9", "@babel/traverse@^7.7.2": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.18.13.tgz#5ab59ef51a997b3f10c4587d648b9696b6cb1a68" integrity sha512-N6kt9X1jRMLPxxxPYWi7tgvJRH/rtoU+dbKAPDM44RFHiMH8igdsaSBgFeskhSl/kLWLDUvIh1RXCrTmg0/zvA== @@ -1267,7 +1297,7 @@ "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" -"@babel/types@^7.0.0", "@babel/types@^7.12.11", "@babel/types@^7.12.13", "@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.17.10", "@babel/types@^7.18.10", "@babel/types@^7.18.13", "@babel/types@^7.18.4", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": +"@babel/types@^7.0.0", "@babel/types@^7.12.11", "@babel/types@^7.12.13", "@babel/types@^7.12.6", "@babel/types@^7.12.7", "@babel/types@^7.16.8", "@babel/types@^7.17.10", "@babel/types@^7.18.10", "@babel/types@^7.18.13", "@babel/types@^7.18.4", "@babel/types@^7.18.6", "@babel/types@^7.18.9", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": version "7.18.13" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.13.tgz#30aeb9e514f4100f7c1cb6e5ba472b30e48f519a" integrity sha512-ePqfTihzW0W6XAU+aMw2ykilisStJfDnsejDCXRchCcMJ4O0+8DhPXf2YUbZ6wjBlsEmZwLK/sPweWtu8hcJYQ== @@ -1659,6 +1689,44 @@ ts-node "^9" tslib "^2" +"@envelop/core@^2.0.0": + version "2.6.0" + resolved "https://registry.yarnpkg.com/@envelop/core/-/core-2.6.0.tgz#1b7a346a37040c217f0f9b60c3358efc6c3b1b94" + integrity sha512-yTptKinJN//i6m1kXUbnLBl/FobzddI4ehURAMS08eRUOQwAuXqJU9r8VdTav8nIZLb4t6cuDWFb3n331LiwLw== + dependencies: + "@envelop/types" "2.4.0" + tslib "2.4.0" + +"@envelop/disable-introspection@^3.0.0": + version "3.6.0" + resolved "https://registry.yarnpkg.com/@envelop/disable-introspection/-/disable-introspection-3.6.0.tgz#04b033389a83b9831442caabcbae30bde89857b9" + integrity sha512-Zf505LqWo2efM0EtTBvXyYPynSTSL2+Ps0X+dCH33vQ3wF6gxMui9g1pGa4MDcGjaXWG67qZcT4eojpGlmmavA== + dependencies: + tslib "^2.4.0" + +"@envelop/parser-cache@^4.0.0": + version "4.7.0" + resolved "https://registry.yarnpkg.com/@envelop/parser-cache/-/parser-cache-4.7.0.tgz#fc438d8ed390c88fa24bf56da3e4da36f088e3fc" + integrity sha512-63NfXDcW/vGn4U6NFxaZ0JbYWAcJb9A6jhTvghsSz1ZS+Dny/ci8bVSgVmM1q+N56hPyGsVPuyI+rIc71mPU5g== + dependencies: + lru-cache "^6.0.0" + tslib "^2.4.0" + +"@envelop/types@2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@envelop/types/-/types-2.4.0.tgz#129163df73503581b68950704f4064a6b0f2c6ed" + integrity sha512-pjxS98cDQBS84X29VcwzH3aJ/KiLCGwyMxuj7/5FkdiaCXAD1JEvKEj9LARWlFYj1bY43uII4+UptFebrhiIaw== + dependencies: + tslib "^2.4.0" + +"@envelop/validation-cache@^4.0.0": + version "4.7.0" + resolved "https://registry.yarnpkg.com/@envelop/validation-cache/-/validation-cache-4.7.0.tgz#6871116c5387cd7c310b9ae9187d29c2793ae33f" + integrity sha512-PzL+GfWJRT+JjsJqZAIxHKEkvkM3hxkeytS5O0QLXT8kURNBV28r+Kdnn2RCF5+6ILhyGpiDb60vaquBi7g4lw== + dependencies: + lru-cache "^6.0.0" + tslib "^2.4.0" + "@eslint/eslintrc@^1.2.3": version "1.3.1" resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-1.3.1.tgz#de0807bfeffc37b964a7d0400e0c348ce5a2543d" @@ -2050,11 +2118,609 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6" integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw== +"@graphql-codegen/add@^3.2.1": + version "3.2.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/add/-/add-3.2.1.tgz#f1109f36f194f88a6abcc51703abee43ebbb50a2" + integrity sha512-w82H/evh8SSGoD3K6K/Oh3kqSdbuU+TgHqMYmmHFxtH692v2xhN/cu1s/TotBQ7r4mO7OQutze7dde2tZEXGEQ== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + tslib "~2.4.0" + +"@graphql-codegen/cli@^2.11.8": + version "2.12.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-2.12.0.tgz#ae57ca66fac7b0b5b8cba5b26ca9ccb5885ae2d4" + integrity sha512-esaMiiuypAtJNiZUhGdFmG0gTMEF5dYkqP/7I04egxSragwbIETU8gOl6/gHdLSAV5su7dgfIEZNdWmGCOWAbg== + dependencies: + "@graphql-codegen/core" "2.6.2" + "@graphql-codegen/plugin-helpers" "^2.7.0" + "@graphql-tools/apollo-engine-loader" "^7.3.6" + "@graphql-tools/code-file-loader" "^7.3.1" + "@graphql-tools/git-loader" "^7.2.1" + "@graphql-tools/github-loader" "^7.3.6" + "@graphql-tools/graphql-file-loader" "^7.5.0" + "@graphql-tools/json-file-loader" "^7.4.1" + "@graphql-tools/load" "^7.7.1" + "@graphql-tools/prisma-loader" "^7.2.7" + "@graphql-tools/url-loader" "^7.13.2" + "@graphql-tools/utils" "^8.9.0" + "@whatwg-node/fetch" "^0.3.0" + ansi-escapes "^4.3.1" + chalk "^4.1.0" + chokidar "^3.5.2" + cosmiconfig "^7.0.0" + cosmiconfig-typescript-loader "^4.0.0" + debounce "^1.2.0" + detect-indent "^6.0.0" + graphql-config "^4.3.5" + inquirer "^8.0.0" + is-glob "^4.0.1" + json-to-pretty-yaml "^1.2.2" + listr2 "^4.0.5" + log-symbols "^4.0.0" + mkdirp "^1.0.4" + string-env-interpolation "^1.0.1" + ts-log "^2.2.3" + tslib "^2.4.0" + yaml "^1.10.0" + yargs "^17.0.0" + +"@graphql-codegen/core@2.6.2": + version "2.6.2" + resolved "https://registry.yarnpkg.com/@graphql-codegen/core/-/core-2.6.2.tgz#29c766d2e9e5a3deeeb4f1728c1f7b1aca054a22" + integrity sha512-58T5yf9nEfAhDwN1Vz1hImqpdJ/gGpCGUaroQ5tqskZPf7eZYYVkEXbtqRZZLx1MCCKwjWX4hMtTPpHhwKCkng== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-tools/schema" "^9.0.0" + "@graphql-tools/utils" "^8.8.0" + tslib "~2.4.0" + +"@graphql-codegen/near-operation-file-preset@^2.4.1": + version "2.4.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/near-operation-file-preset/-/near-operation-file-preset-2.4.1.tgz#38277816239506335c2f843c92cd70b403a0a3ad" + integrity sha512-es3XeVbD8sraEJRXcnhWjrpLUXTiA2Hgfmbt/P4HPBPmMw6NQKL2p2EqK2fd5KEohij3qykUXp+7GffOx8CtAg== + dependencies: + "@graphql-codegen/add" "^3.2.1" + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-codegen/visitor-plugin-common" "2.12.1" + "@graphql-tools/utils" "^8.8.0" + parse-filepath "^1.0.2" + tslib "~2.4.0" + +"@graphql-codegen/plugin-helpers@^2.6.2", "@graphql-codegen/plugin-helpers@^2.7.0": + version "2.7.0" + resolved "https://registry.yarnpkg.com/@graphql-codegen/plugin-helpers/-/plugin-helpers-2.7.0.tgz#54ba1d5fb3ddad8a3634bc2e09b023eb183e574c" + integrity sha512-+a2VP/4Ob0fwP8YLrQ/hhYlAA9UZUdDFNqwS543DmyiGFUkNIsa7TnTsE/mBDKJSMsCVWLw78949fCpzjyw/9Q== + dependencies: + "@graphql-tools/utils" "^8.8.0" + change-case-all "1.0.14" + common-tags "1.8.2" + import-from "4.0.0" + lodash "~4.17.0" + tslib "~2.4.0" + +"@graphql-codegen/schema-ast@^2.5.1": + version "2.5.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/schema-ast/-/schema-ast-2.5.1.tgz#ce030ae6de5dacd745848009ba0ca18c9c30910c" + integrity sha512-tewa5DEKbglWn7kYyVBkh3J8YQ5ALqAMVmZwiVFIGOao5u66nd+e4HuFqp0u+Jpz4SJGGi0ap/oFrEvlqLjd2A== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-tools/utils" "^8.8.0" + tslib "~2.4.0" + +"@graphql-codegen/typescript-operations@^2.5.3": + version "2.5.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-operations/-/typescript-operations-2.5.3.tgz#c6fd3f209e3482b86b08050685af8fa45ab14297" + integrity sha512-s+pA+Erm0HeBb/D5cNrflwRM5KWhkiA5cbz4uA99l3fzFPveoQBPfRCBu0XAlJLP/kBDy64+o4B8Nfc7wdRtmA== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-codegen/typescript" "^2.7.3" + "@graphql-codegen/visitor-plugin-common" "2.12.1" + auto-bind "~4.0.0" + tslib "~2.4.0" + +"@graphql-codegen/typescript-react-apollo@^3.3.3": + version "3.3.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript-react-apollo/-/typescript-react-apollo-3.3.3.tgz#93cb189904a9eacc61bb18b9e69b3d0efded2726" + integrity sha512-FixkcfEfChA1+VPkvdcK+JYnBfqhT+Nz7WJFJ3ZKVsHjwJbTWKu19cKn2nkd3EVgdhJXlNsE8DgenVMqi5X5Ug== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-codegen/visitor-plugin-common" "2.12.1" + auto-bind "~4.0.0" + change-case-all "1.0.14" + tslib "~2.4.0" + +"@graphql-codegen/typescript@^2.7.3": + version "2.7.3" + resolved "https://registry.yarnpkg.com/@graphql-codegen/typescript/-/typescript-2.7.3.tgz#ad786a1c74e16eca8e01e7a8f28078e1c24eeb61" + integrity sha512-EzX/acijXtbG/AwPzho2ZZWaNo00+xAbsRDP+vnT2PwQV3AYq3/5bFvjq1XfAGWbTntdmlYlIwC9hf5bI85WVA== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-codegen/schema-ast" "^2.5.1" + "@graphql-codegen/visitor-plugin-common" "2.12.1" + auto-bind "~4.0.0" + tslib "~2.4.0" + +"@graphql-codegen/visitor-plugin-common@2.12.1": + version "2.12.1" + resolved "https://registry.yarnpkg.com/@graphql-codegen/visitor-plugin-common/-/visitor-plugin-common-2.12.1.tgz#8d2d24b572afd396381dddef7e2032b0f73c05cc" + integrity sha512-dIUrX4+i/uazyPQqXyQ8cqykgNFe1lknjnfDWFo0gnk2W8+ruuL2JpSrj/7efzFHxbYGMQrCABDCUTVLi3DcVA== + dependencies: + "@graphql-codegen/plugin-helpers" "^2.6.2" + "@graphql-tools/optimize" "^1.3.0" + "@graphql-tools/relay-operation-optimizer" "^6.5.0" + "@graphql-tools/utils" "^8.8.0" + auto-bind "~4.0.0" + change-case-all "1.0.14" + dependency-graph "^0.11.0" + graphql-tag "^2.11.0" + parse-filepath "^1.0.2" + tslib "~2.4.0" + +"@graphql-inspector/cli@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/cli/-/cli-3.3.0.tgz#7199f427c41325de4f9b5cfbd0a8d3a5e5f56abb" + integrity sha512-r5rPL2H/0uZukhH4Iik+Yg5i7heBwGG5q3Ac4XbUVNqp0EYRLflz2bd2GZ0kGomHbRqL7yHep+9Aaye5UUmOww== + dependencies: + "@graphql-inspector/code-loader" "3.3.0" + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/coverage-command" "3.3.0" + "@graphql-inspector/diff-command" "3.3.0" + "@graphql-inspector/docs-command" "3.3.0" + "@graphql-inspector/git-loader" "3.3.0" + "@graphql-inspector/github-loader" "3.3.0" + "@graphql-inspector/graphql-loader" "3.3.0" + "@graphql-inspector/introspect-command" "3.3.0" + "@graphql-inspector/json-loader" "3.3.0" + "@graphql-inspector/loaders" "3.3.0" + "@graphql-inspector/serve-command" "3.3.0" + "@graphql-inspector/similar-command" "3.3.0" + "@graphql-inspector/url-loader" "3.3.0" + "@graphql-inspector/validate-command" "3.3.0" + tslib "^2.0.0" + yargs "17.2.1" + +"@graphql-inspector/code-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/code-loader/-/code-loader-3.3.0.tgz#14a9bb3f422791344ce0a4806f22f75d27594895" + integrity sha512-QrG3jwjpU33t2IhRNkFI2py5CxCFtj1inNRlwTzdSk4ApSnH8PaSc0O2MLRSuKaXpBiaEeeJO7iCErYioBSuTQ== + dependencies: + "@graphql-tools/code-file-loader" "^7.2.2" + tslib "^2.0.0" + +"@graphql-inspector/commands@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/commands/-/commands-3.3.0.tgz#3e39b74556293de0682b6d1deccecf1290624537" + integrity sha512-jwLzDPnOiIGgttpIjUqpg4CtIIFfK6r7NyWm/No2pNofL5XHIB+6IC7kqRVXbMZyXTp49nrh/doZA5mvdPkWdA== + dependencies: + tslib "^2.0.0" + +"@graphql-inspector/core@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/core/-/core-3.3.0.tgz#3982909cec46a5b3050a8265569503f20a3b5742" + integrity sha512-LRtk9sHgj9qqVPIkkThAVq3iZ7QxgHCx6elEwd0eesZBCmaIYQxD/BFu+VT8jr10YfOURBZuAnVdyGu64vYpBg== + dependencies: + dependency-graph "0.11.0" + object-inspect "1.10.3" + tslib "^2.0.0" + +"@graphql-inspector/coverage-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/coverage-command/-/coverage-command-3.3.0.tgz#8038b9fca4e4b26f840036e6139859376dd249b5" + integrity sha512-zaELKUl5SDiDSXGluCHJ/vQ8+Iojir+qmNrYIA7kOkZv9Z+WspOjLXt/lApklLjhoVMaErObHSgwac3VHVnTIg== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/core" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + tslib "^2.0.0" + +"@graphql-inspector/diff-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/diff-command/-/diff-command-3.3.0.tgz#ca111eb116316aebe5e2506ad8ac263d6f033990" + integrity sha512-Ju9lMehOWLx79oAy3lQNl9cdOVwOf917PUkk1+t+gpOnx1jQqQ9Je87/TASl44gsOQg8a7nQ9iYRO56/3wCRaA== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/core" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + tslib "^2.0.0" + +"@graphql-inspector/docs-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/docs-command/-/docs-command-3.3.0.tgz#137767731131101974c367dee119c9bd4f3b8068" + integrity sha512-gxXtxpbTLTjuQ+LSvCFltcf3/HpAIqfXr7YNzN4bGaws81DCM96S5hPCIATe0w2GTzHaPp5hRx9tRsI4Dt8wEA== + dependencies: + "@graphql-inspector/commands" "3.3.0" + open "8.2.1" + tslib "^2.0.0" + +"@graphql-inspector/git-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/git-loader/-/git-loader-3.3.0.tgz#bff50caf9e6debedc1e3df2bdf032bb8f2a5cf79" + integrity sha512-jSw08/0jvrI0ue92BMot2ZY8SeNIkuXinHUl67al0OIUUr+O6ZpNgf5POyEDZkbDj3t7dwQcgAP1kS3rUd2Z7w== + dependencies: + "@graphql-tools/git-loader" "^7.1.2" + tslib "^2.0.0" + +"@graphql-inspector/github-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/github-loader/-/github-loader-3.3.0.tgz#3160d8659ce5a438b5020022e4a13953392920ff" + integrity sha512-EgFZARLe5ChbBHeFPOBq3ApMDIQRqq8+WtSc6Jjn3L6E8rP5MlCdiUi5JHZpYiSh2Z8uj+6M+jq9A4Kj8aoMow== + dependencies: + "@graphql-tools/github-loader" "^7.1.1" + tslib "^2.0.0" + +"@graphql-inspector/graphql-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/graphql-loader/-/graphql-loader-3.3.0.tgz#df63180918c48fc00b0108eb9ec89c050109ea80" + integrity sha512-hYTbtP53Vzmnb2Il40GOWLIXLaPB1myfVvkOG2J6cTVywDpv+89YCwvDWH/25LiJPvZNU1xgE9iA4A/yceD+BQ== + dependencies: + "@graphql-tools/graphql-file-loader" "^7.3.2" + tslib "^2.0.0" + +"@graphql-inspector/introspect-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/introspect-command/-/introspect-command-3.3.0.tgz#8f17381d54ee5c101b3c20572daecc206e8d8ae9" + integrity sha512-kgTPw8ESRFXKcH3aPJhIjHXywOimX6mqS5x1uY4fohthYbRuLYFAw1lTLXXzGza+KpXvkue32y/gaGnXDIn6CA== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/core" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + tslib "^2.0.0" + +"@graphql-inspector/json-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/json-loader/-/json-loader-3.3.0.tgz#83e901f325302b33b473d4919f9a346b47335916" + integrity sha512-AF33c3v+DQKQDZ7siuqUINTXojW1Udd2OePVzqczSkE218qxX1Glvu0ugjmlIeqm9/GHKMSMLo1Mkcze9yeF3A== + dependencies: + "@graphql-tools/json-file-loader" "^7.3.2" + tslib "^2.0.0" + +"@graphql-inspector/loaders@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/loaders/-/loaders-3.3.0.tgz#a77f4a4142538a3d1251b790ab8e8f512c3baecf" + integrity sha512-t0FRxNwjZOnNRf8w6R5GVLw9VZ991tVM8LeWDV4U9q5T2Nf/DXHkZk2PtM4mQ6pGz7k2/dl4tUw2LspnPVSUJw== + dependencies: + "@graphql-tools/load" "^7.4.1" + tslib "^2.0.0" + +"@graphql-inspector/logger@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/logger/-/logger-3.3.0.tgz#2d44048df211ca302f39b94273a4124ab62a5cad" + integrity sha512-myyIrPDQYAvXZt/apyG8JERKqsYEn1gTGgU+sdTjPyAPqZ4DcHOyoQH4OPHu2f393pOQNNjET4jO7lBhfON3iA== + dependencies: + chalk "4.1.2" + figures "3.2.0" + log-symbols "^4.1.0" + std-env "2.3.0" + tslib "^2.0.0" + +"@graphql-inspector/serve-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/serve-command/-/serve-command-3.3.0.tgz#4ec08a480e17c136b79e9792f7b175c3647db51f" + integrity sha512-QymPwIRpcM35QnZok6eFDUn7hGnb99ydeUh+4TgCQ/3eHVtDa+qesRQc28MgrijYCXqIyaOsImVzuyZXjgw4LQ== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + "@graphql-yoga/node" "2.0.0" + open "8.2.1" + tslib "^2.0.0" + +"@graphql-inspector/similar-command@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/similar-command/-/similar-command-3.3.0.tgz#1623effe417cbf845ffa7b660fca0ce2cd331e6f" + integrity sha512-TEJpTzLPB0ZshQGbFM7JMjXukDhEwJf5y8EoPWTgxvj8t0rMVeZz5d1PYhDBnM25bI/y+HDssnyanp9wBD8UDg== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/core" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + tslib "^2.0.0" + +"@graphql-inspector/url-loader@3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/url-loader/-/url-loader-3.3.0.tgz#9a324ee8be1b68af50e5acbaea574297f4644644" + integrity sha512-JIGo+EbmYRfgcm8gT+UmxxGJDI/VK1un9cPRv2T/T8s5vZN0mn1WUD9q6YLE/De73HXHvJbYrcuqD4x29rH9Cg== + dependencies: + "@graphql-tools/url-loader" "^7.4.2" + tslib "^2.0.0" + +"@graphql-inspector/validate-command@3.3.0", "@graphql-inspector/validate-command@^3.3.0": + version "3.3.0" + resolved "https://registry.yarnpkg.com/@graphql-inspector/validate-command/-/validate-command-3.3.0.tgz#c70e42579f4980ad4754fa550b922e1435ba7563" + integrity sha512-fcEMXtpshUAQTsMfdqy5OFf9rb8/Lj3OhSMq2ipuNIyrz2yIaTyu8Lb2GAcdJm2Ykspt/tlC/hShK7q7Pro/qg== + dependencies: + "@graphql-inspector/commands" "3.3.0" + "@graphql-inspector/core" "3.3.0" + "@graphql-inspector/logger" "3.3.0" + tslib "^2.0.0" + +"@graphql-tools/apollo-engine-loader@^7.3.6": + version "7.3.10" + resolved "https://registry.yarnpkg.com/@graphql-tools/apollo-engine-loader/-/apollo-engine-loader-7.3.10.tgz#57790bcb1696e551e266f90443092048c12e95d8" + integrity sha512-JqUqKBo/DsZA7QxaJIV3mho0j3xAcxG/InIvAn39zqfzUEt3DO4l1VEKwqqNLXgWstmhHaW6tY64EDE+txtFEg== + dependencies: + "@ardatan/sync-fetch" "0.0.1" + "@graphql-tools/utils" "8.10.1" + "@whatwg-node/fetch" "^0.3.0" + tslib "^2.4.0" + +"@graphql-tools/batch-execute@8.5.4": + version "8.5.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/batch-execute/-/batch-execute-8.5.4.tgz#a9a577d346c707b0878fae32337b47072a03c479" + integrity sha512-PzFRyCTVao2AGiXx971f3TWJQro7xhtSi3gDTWiMC8aOMiT/FEHcYpNymwc52JJ2ZN6EiiLV/e2acO4qHb64uw== + dependencies: + "@graphql-tools/utils" "8.10.1" + dataloader "2.1.0" + tslib "^2.4.0" + value-or-promise "1.0.11" + +"@graphql-tools/code-file-loader@^7.2.2", "@graphql-tools/code-file-loader@^7.3.1": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/code-file-loader/-/code-file-loader-7.3.4.tgz#8fee66b72cb77fa4b3ae145df74a9f5c8739c063" + integrity sha512-t8AKQQPfThNv61PouxKmWVIbsdHh0Ek93stgKqLsG4S8fNfRKtUBYX0oqIWoikeccnHXExkDxwbLBBf9H+SLWA== + dependencies: + "@graphql-tools/graphql-tag-pluck" "7.3.4" + "@graphql-tools/utils" "8.10.1" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/delegate@9.0.4": + version "9.0.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/delegate/-/delegate-9.0.4.tgz#b9cf81a431c097a4377fe6d8921a6754308e5d87" + integrity sha512-W58ZHBR7Rawxa/FqyezdcCyj21f15sid7IaAFon7PRIIaIFJMIZrodKeaclTd34skGguLvuloeYIny6vXNA3tg== + dependencies: + "@graphql-tools/batch-execute" "8.5.4" + "@graphql-tools/schema" "9.0.2" + "@graphql-tools/utils" "8.10.1" + dataloader "2.1.0" + tslib "~2.4.0" + value-or-promise "1.0.11" + +"@graphql-tools/git-loader@^7.1.2", "@graphql-tools/git-loader@^7.2.1": + version "7.2.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/git-loader/-/git-loader-7.2.4.tgz#b0b14516608d2f5f81acfd4c9a0645223991240a" + integrity sha512-2xdJh9eVGDfTuBnHwAJHJKFBZeP4k0WKYTydhA0ZMWGPkfWdig3iEmvf78rUwCS+7TcToANeHhR7y3rkVhNVPg== + dependencies: + "@graphql-tools/graphql-tag-pluck" "7.3.4" + "@graphql-tools/utils" "8.10.1" + is-glob "4.0.3" + micromatch "^4.0.4" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/github-loader@^7.1.1", "@graphql-tools/github-loader@^7.3.6": + version "7.3.10" + resolved "https://registry.yarnpkg.com/@graphql-tools/github-loader/-/github-loader-7.3.10.tgz#5d4a768257c5872cf9b1b8740bbfd862efb8415f" + integrity sha512-gtMzkRZwwg8HGNe5OPzVc6K6fF8oyf1y6m6SIdnj0d80qVdjXQOG/5answlb27zKc/rCDPv+KKnpXtbKXs4tHg== + dependencies: + "@ardatan/sync-fetch" "0.0.1" + "@graphql-tools/graphql-tag-pluck" "7.3.4" + "@graphql-tools/utils" "8.10.1" + "@whatwg-node/fetch" "^0.3.0" + tslib "^2.4.0" + +"@graphql-tools/graphql-file-loader@^7.3.2", "@graphql-tools/graphql-file-loader@^7.3.7", "@graphql-tools/graphql-file-loader@^7.5.0": + version "7.5.3" + resolved "https://registry.yarnpkg.com/@graphql-tools/graphql-file-loader/-/graphql-file-loader-7.5.3.tgz#83f874d7ea9e0c1a6fa9c7ea377df9662183fb59" + integrity sha512-KM2Rg5jWCYH91Vfc3L9bWk0uW7JDeC9+QUTaqY+yUQbjT3RckYOdjPdiLtNMgkJA8r432RM5/Ns/gO8QScOkmQ== + dependencies: + "@graphql-tools/import" "6.7.4" + "@graphql-tools/utils" "8.10.1" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/graphql-tag-pluck@7.3.4": + version "7.3.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/graphql-tag-pluck/-/graphql-tag-pluck-7.3.4.tgz#211fd645fcd9e5a0f994aa440d6c495ed88770ea" + integrity sha512-vPCUuxUV+/vK2hDidzWvaqgGifQriwmDJUUlp5Js1CEIUKm3dFI4V1bCos2r25lQ6NbH9WSJt2cZTACnaH939g== + dependencies: + "@babel/parser" "^7.16.8" + "@babel/traverse" "^7.16.8" + "@babel/types" "^7.16.8" + "@graphql-tools/utils" "8.10.1" + tslib "^2.4.0" + +"@graphql-tools/import@6.7.4": + version "6.7.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/import/-/import-6.7.4.tgz#7ad77a543d770dffea327078fe91986ab1cec7d7" + integrity sha512-fUlX+pVF2X6IiRFE9vUb8/Qiwm2WHadSN5i3YHjtFJ71nUyMeyfbcd6xYAHEpR1mwRCC+8US+JsMlo/KxT4TEA== + dependencies: + "@graphql-tools/utils" "8.10.1" + resolve-from "5.0.0" + tslib "^2.4.0" + +"@graphql-tools/json-file-loader@^7.3.2", "@graphql-tools/json-file-loader@^7.3.7", "@graphql-tools/json-file-loader@^7.4.1": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/json-file-loader/-/json-file-loader-7.4.4.tgz#834e730c23619732404a3834d8248316038c51cc" + integrity sha512-hQP3+S+59sJQXvP4FW0IUMAVWZtGhHcssoS44tn/fNGJgFeaeRSoDPi2om/NL3RhsgAaQYU8xbscGp2sOwIdFg== + dependencies: + "@graphql-tools/utils" "8.10.1" + globby "^11.0.3" + tslib "^2.4.0" + unixify "^1.0.0" + +"@graphql-tools/load@^7.4.1", "@graphql-tools/load@^7.5.5", "@graphql-tools/load@^7.7.1": + version "7.7.5" + resolved "https://registry.yarnpkg.com/@graphql-tools/load/-/load-7.7.5.tgz#a3e3115f98186911f6867523ca5301b6680dfa90" + integrity sha512-7AnT87hNG37gE8677D9/1P6yaRLKCxi52Ipr1YFN3vSIIARA692nv5/k9PkksHVmJitbvjPu4BxvnVcDOMtMSw== + dependencies: + "@graphql-tools/schema" "9.0.2" + "@graphql-tools/utils" "8.10.1" + p-limit "3.1.0" + tslib "^2.4.0" + +"@graphql-tools/merge@8.3.1": + version "8.3.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.3.1.tgz#06121942ad28982a14635dbc87b5d488a041d722" + integrity sha512-BMm99mqdNZbEYeTPK3it9r9S6rsZsQKtlqJsSBknAclXq2pGEfOxjcIZi+kBSkHZKPKCRrYDd5vY0+rUmIHVLg== + dependencies: + "@graphql-tools/utils" "8.9.0" + tslib "^2.4.0" + +"@graphql-tools/merge@8.3.4", "@graphql-tools/merge@^8.2.6": + version "8.3.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/merge/-/merge-8.3.4.tgz#749f710d3a930512e6ca36e3bb053c12e22ef332" + integrity sha512-2z1UpHvvI52nQZIYArU+rPq1lOENWetsdb+6vu8yLGyCRP4CpKMBvtmiHkbrlPBO8dItpZ08szXEoaStfJHBxQ== + dependencies: + "@graphql-tools/utils" "8.10.1" + tslib "^2.4.0" + +"@graphql-tools/optimize@^1.3.0": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/optimize/-/optimize-1.3.1.tgz#29407991478dbbedc3e7deb8c44f46acb4e9278b" + integrity sha512-5j5CZSRGWVobt4bgRRg7zhjPiSimk+/zIuColih8E8DxuFOaJ+t0qu7eZS5KXWBkjcd4BPNuhUPpNlEmHPqVRQ== + dependencies: + tslib "^2.4.0" + +"@graphql-tools/prisma-loader@^7.2.7": + version "7.2.16" + resolved "https://registry.yarnpkg.com/@graphql-tools/prisma-loader/-/prisma-loader-7.2.16.tgz#f87175ee86794816727748e06b64ca9a76d0a0da" + integrity sha512-F49OXWZuTQAYaa5t6u1TQEMO/pkrH+76Ek/UOtzusKzjKTCIgkoZj97dOYZ3uTqR9XRt1bw6cqojnH7u9lAExg== + dependencies: + "@graphql-tools/url-loader" "7.14.1" + "@graphql-tools/utils" "8.10.1" + "@types/js-yaml" "^4.0.0" + "@types/json-stable-stringify" "^1.0.32" + "@types/jsonwebtoken" "^8.5.0" + chalk "^4.1.0" + debug "^4.3.1" + dotenv "^16.0.0" + graphql-request "^4.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.0" + isomorphic-fetch "^3.0.0" + js-yaml "^4.0.0" + json-stable-stringify "^1.0.1" + jsonwebtoken "^8.5.1" + lodash "^4.17.20" + scuid "^1.1.0" + tslib "^2.4.0" + yaml-ast-parser "^0.0.43" + +"@graphql-tools/relay-operation-optimizer@^6.5.0": + version "6.5.4" + resolved "https://registry.yarnpkg.com/@graphql-tools/relay-operation-optimizer/-/relay-operation-optimizer-6.5.4.tgz#0667e4fd62bccc8e5966784ae6a61c3f538eca4b" + integrity sha512-1epuPdtz14233EjrWs4n2UQxoqRHhb6OKIltiJvNR1L/67ZtB02RxESV2PFGqGphdBUZHL7zKdBIUGIaF8sJ5g== + dependencies: + "@ardatan/relay-compiler" "12.0.0" + "@graphql-tools/utils" "8.10.1" + tslib "^2.4.0" + +"@graphql-tools/schema@9.0.2", "@graphql-tools/schema@^9.0.0": + version "9.0.2" + resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-9.0.2.tgz#f00dcd2600c25a2e8d69e3a4ab279ea150aab0c4" + integrity sha512-FnBM1PMKQ6y8KlzeFocnEwcGA/IT++z4v+hvvwwXL+IUYDNqmrp9XYNklpQRb/KKSbTtKnQapCWNiVNex7jl+Q== + dependencies: + "@graphql-tools/merge" "8.3.4" + "@graphql-tools/utils" "8.10.1" + tslib "^2.4.0" + value-or-promise "1.0.11" + +"@graphql-tools/schema@^8.3.1": + version "8.5.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/schema/-/schema-8.5.1.tgz#c2f2ff1448380919a330312399c9471db2580b58" + integrity sha512-0Esilsh0P/qYcB5DKQpiKeQs/jevzIadNTaT0jeWklPMwNbT7yMX4EqZany7mbeRRlSRwMzNzL5olyFdffHBZg== + dependencies: + "@graphql-tools/merge" "8.3.1" + "@graphql-tools/utils" "8.9.0" + tslib "^2.4.0" + value-or-promise "1.0.11" + +"@graphql-tools/url-loader@7.14.1", "@graphql-tools/url-loader@^7.13.2", "@graphql-tools/url-loader@^7.4.2", "@graphql-tools/url-loader@^7.9.7": + version "7.14.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/url-loader/-/url-loader-7.14.1.tgz#090558c47f801f0ab6a50bdaf01f184216700679" + integrity sha512-PMxPjzPDkKc1hg8CiTnxchz7pbxbiH4riDk9822eDJLye7SBHzRTeBkJTrytDAQDvtRcDaDvoLugVUStluCuzQ== + dependencies: + "@ardatan/sync-fetch" "0.0.1" + "@graphql-tools/delegate" "9.0.4" + "@graphql-tools/utils" "8.10.1" + "@graphql-tools/wrap" "9.0.5" + "@n1ru4l/graphql-live-query" "^0.10.0" + "@types/ws" "^8.0.0" + "@whatwg-node/fetch" "^0.3.0" + dset "^3.1.2" + extract-files "^11.0.0" + graphql-ws "^5.4.1" + isomorphic-ws "^5.0.0" + meros "^1.1.4" + tslib "^2.4.0" + value-or-promise "^1.0.11" + ws "^8.3.0" + +"@graphql-tools/utils@8.10.1", "@graphql-tools/utils@^8.6.0", "@graphql-tools/utils@^8.6.5", "@graphql-tools/utils@^8.8.0", "@graphql-tools/utils@^8.9.0": + version "8.10.1" + resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.10.1.tgz#3224fe0611c9bb51e6a5c16472ae17afbd6c5465" + integrity sha512-UYi/afPvxZ8mz0LjplMxOSmGDPenVS/Q0zJ/6LOyF9yZdJYIDe+J+Qr/I9+rCYQmgBW4BJeRUUc7VoUzZPfZDA== + dependencies: + tslib "^2.4.0" + +"@graphql-tools/utils@8.9.0": + version "8.9.0" + resolved "https://registry.yarnpkg.com/@graphql-tools/utils/-/utils-8.9.0.tgz#c6aa5f651c9c99e1aca55510af21b56ec296cdb7" + integrity sha512-pjJIWH0XOVnYGXCqej8g/u/tsfV4LvLlj0eATKQu5zwnxd/TiTHq7Cg313qUPTFFHZ3PP5wJ15chYVtLDwaymg== + dependencies: + tslib "^2.4.0" + +"@graphql-tools/wrap@9.0.5": + version "9.0.5" + resolved "https://registry.yarnpkg.com/@graphql-tools/wrap/-/wrap-9.0.5.tgz#7dfd0ad15659fc527a6a1eaa8c4a0fc479916bfb" + integrity sha512-EkPBEHV4547Tjrbea6Oz/eCtTgJo8unNUB7BiYDPWb1XcRUg9wIgy7JgfKO3KR/NgVBsh2Zu1107zeYhAvOuQw== + dependencies: + "@graphql-tools/delegate" "9.0.4" + "@graphql-tools/schema" "9.0.2" + "@graphql-tools/utils" "8.10.1" + tslib "^2.4.0" + value-or-promise "1.0.11" + "@graphql-typed-document-node/core@^3.1.1": version "3.1.1" resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== +"@graphql-yoga/common@2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/common/-/common-2.0.0.tgz#b36563021b81bbe0a2b686ff82290a9ad792c997" + integrity sha512-nSENt7yANcnAIHdjTWOeTz4feXnGkgiShUU9MzukFbETWL7pwaK6fjgghUCDVuL2axm155Z3lAhG4sLA4MgvlQ== + dependencies: + "@envelop/core" "^2.0.0" + "@envelop/disable-introspection" "^3.0.0" + "@envelop/parser-cache" "^4.0.0" + "@envelop/validation-cache" "^4.0.0" + "@graphql-tools/schema" "^8.3.1" + "@graphql-tools/utils" "^8.6.0" + "@graphql-typed-document-node/core" "^3.1.1" + "@graphql-yoga/render-graphiql" "2.0.0" + "@graphql-yoga/subscription" "2.0.0" + chalk "4.1.2" + cross-undici-fetch "^0.1.25" + dset "^3.1.1" + tslib "^2.3.1" + +"@graphql-yoga/node@2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/node/-/node-2.0.0.tgz#c643ceec04feb991c096df89ade8ddd14125fed2" + integrity sha512-fjKHT8UR1DcOgvUfrnVhM7Ggj5vnxVUwlUbkY7NZC8vZiXfVbA9UfLYUYl+hXFmOCDK+S19kszLp7rw0s0LdWg== + dependencies: + "@envelop/core" "^2.0.0" + "@graphql-tools/utils" "^8.6.0" + "@graphql-yoga/common" "2.0.0" + "@graphql-yoga/subscription" "2.0.0" + cross-undici-fetch "^0.1.25" + tslib "^2.3.1" + +"@graphql-yoga/render-graphiql@2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/render-graphiql/-/render-graphiql-2.0.0.tgz#662df90bd4af0a996be6d9a743fabed6b0497e9d" + integrity sha512-GZuZPCVBpYI0MwaE6nBtrzMoSFyBtiWOUm7i9jbRxu5Sqxuj3Zc0zTaD7V0UQzuPZKzytmMWq2+nbWPIu5FWtg== + +"@graphql-yoga/subscription@2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@graphql-yoga/subscription/-/subscription-2.0.0.tgz#8c6d3d78b2938a554efced7fd6c80cfaa80f7b8f" + integrity sha512-HlG+gIddjIP3/BDrMZymdzmzDjNdYuSGMxx6+1JA83gAEVRDR4yOoT4QeNKYqRhLK9xca/Hxp1PfBpquSa244Q== + dependencies: + "@repeaterjs/repeater" "^3.0.4" + tslib "^2.3.1" + "@humanwhocodes/config-array@^0.9.2": version "0.9.5" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.9.5.tgz#2cbaf9a89460da24b5ca6531b8bbfc23e1df50c7" @@ -2069,6 +2735,11 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== +"@iarna/toml@^2.2.5": + version "2.2.5" + resolved "https://registry.yarnpkg.com/@iarna/toml/-/toml-2.2.5.tgz#b32366c89b43c6f8cefbdefac778b9c828e3ba8c" + integrity sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg== + "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz#fd3db1d59ecf7cf121e80650bb86712f9b55eced" @@ -2458,6 +3129,11 @@ call-me-maybe "^1.0.1" glob-to-regexp "^0.3.0" +"@n1ru4l/graphql-live-query@^0.10.0": + version "0.10.0" + resolved "https://registry.yarnpkg.com/@n1ru4l/graphql-live-query/-/graphql-live-query-0.10.0.tgz#2306151630b0e74b017cc1067ebbea351acf56f8" + integrity sha512-qZ7OHH/NB0NcG/Xa7irzgjE63UH0CkofZT0Bw4Ko6iRFagPRHBM8RgFXwTt/6JbFGIEUS4STRtaFoc/Eq/ZtzQ== + "@next/env@12.2.3": version "12.2.3" resolved "https://registry.yarnpkg.com/@next/env/-/env-12.2.3.tgz#64f210e74c137d3d9feea738795b055a7f8aebe2" @@ -3090,6 +3766,33 @@ node-addon-api "^3.2.1" node-gyp-build "^4.3.0" +"@peculiar/asn1-schema@^2.1.6": + version "2.3.0" + resolved "https://registry.yarnpkg.com/@peculiar/asn1-schema/-/asn1-schema-2.3.0.tgz#5368416eb336138770c692ffc2bab119ee3ae917" + integrity sha512-DtNLAG4vmDrdSJFPe7rypkcj597chNQL7u+2dBtYo5mh7VW2+im6ke+O0NVr8W1f4re4C3F71LhoMb0Yxqa48Q== + dependencies: + asn1js "^3.0.5" + pvtsutils "^1.3.2" + tslib "^2.4.0" + +"@peculiar/json-schema@^1.1.12": + version "1.1.12" + resolved "https://registry.yarnpkg.com/@peculiar/json-schema/-/json-schema-1.1.12.tgz#fe61e85259e3b5ba5ad566cb62ca75b3d3cd5339" + integrity sha512-coUfuoMeIB7B8/NMekxaDzLhaYmp0HZNPEjYRm9goRou8UZIC3z21s0sL9AWoCw4EG876QyO3kYrc61WNF9B/w== + dependencies: + tslib "^2.0.0" + +"@peculiar/webcrypto@^1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@peculiar/webcrypto/-/webcrypto-1.4.0.tgz#f941bd95285a0f8a3d2af39ccda5197b80cd32bf" + integrity sha512-U58N44b2m3OuTgpmKgf0LPDOmP3bhwNz01vAnj1mBwxBASRhptWYK+M3zG+HBkDqGQM+bFsoIihTW8MdmPXEqg== + dependencies: + "@peculiar/asn1-schema" "^2.1.6" + "@peculiar/json-schema" "^1.1.12" + pvtsutils "^1.3.2" + tslib "^2.4.0" + webcrypto-core "^1.7.4" + "@pedrouid/environment@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@pedrouid/environment/-/environment-1.0.1.tgz#858f0f8a057340e0b250398b75ead77d6f4342ec" @@ -3810,6 +4513,11 @@ dependencies: "@babel/runtime" "^7.13.10" +"@repeaterjs/repeater@^3.0.4": + version "3.0.4" + resolved "https://registry.yarnpkg.com/@repeaterjs/repeater/-/repeater-3.0.4.tgz#a04d63f4d1bf5540a41b01a921c9a7fddc3bd1ca" + integrity sha512-AW8PKd6iX3vAZ0vA43nOUOnbq/X5ihgU+mSXXqunMkeQADGiqw/PY0JNeYtD5sr0PAy51YPgAPbDoeapv9r8WA== + "@rollup/plugin-babel@^5.3.0": version "5.3.1" resolved "https://registry.yarnpkg.com/@rollup/plugin-babel/-/plugin-babel-5.3.1.tgz#04bc0608f4aa4b2e4b1aebf284344d0f68fda283" @@ -5208,6 +5916,11 @@ resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-1.1.2.tgz#ccb91445360179a04e7fe6aff78c00ffc1eeaf82" integrity sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw== +"@tootallnate/once@2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@tootallnate/once/-/once-2.0.0.tgz#f544a148d3ab35801c1f633a7441fd87c2e484bf" + integrity sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A== + "@trysound/sax@0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad" @@ -5560,16 +6273,33 @@ jest-matcher-utils "^27.0.0" pretty-format "^27.0.0" +"@types/js-yaml@^4.0.0": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138" + integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA== + "@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" integrity sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ== +"@types/json-stable-stringify@^1.0.32": + version "1.0.34" + resolved "https://registry.yarnpkg.com/@types/json-stable-stringify/-/json-stable-stringify-1.0.34.tgz#c0fb25e4d957e0ee2e497c1f553d7f8bb668fd75" + integrity sha512-s2cfwagOQAS8o06TcwKfr9Wx11dNGbH2E9vJz1cqV+a/LOyhWNLUNd6JSRYNzvB4d29UuJX2M0Dj9vE1T8fRXw== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/jsonwebtoken@^8.5.0": + version "8.5.9" + resolved "https://registry.yarnpkg.com/@types/jsonwebtoken/-/jsonwebtoken-8.5.9.tgz#2c064ecb0b3128d837d2764aa0b117b0ff6e4586" + integrity sha512-272FMnFGzAVMGtu9tkr29hRL6bZj4Zs1KZNeHLnKqAvp06tAIcarTMwOh8/8bz4FmKRcMxZhZNeUAQsNLoiPhg== + dependencies: + "@types/node" "*" + "@types/lodash@^4.14.167", "@types/lodash@^4.14.168", "@types/lodash@^4.14.171": version "4.14.184" resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.184.tgz#23f96cd2a21a28e106dc24d825d4aa966de7a9fe" @@ -5872,7 +6602,7 @@ anymatch "^3.0.0" source-map "^0.6.0" -"@types/ws@^8.5.1": +"@types/ws@^8.0.0", "@types/ws@^8.5.1": version "8.5.3" resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.3.tgz#7d25a1ffbecd3c4f2d35068d0b283c037003274d" integrity sha512-6YOoWjruKj1uLf3INHH7D3qTXwFfEsg1kf3c0uDdSBJwfa/llkwIjrAGV7j7mVgGNbzTQ3HiHKKDXl6bJPD97w== @@ -6548,6 +7278,21 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" +"@whatwg-node/fetch@^0.3.0": + version "0.3.2" + resolved "https://registry.yarnpkg.com/@whatwg-node/fetch/-/fetch-0.3.2.tgz#da4323795c26c135563ba01d49dc16037bec4287" + integrity sha512-Bs5zAWQs0tXsLa4mRmLw7Psps1EN78vPtgcLpw3qPY8s6UYPUM67zFZ9cy+7tZ64PXhfwzxJn+m7RH2Lq48RNQ== + dependencies: + "@peculiar/webcrypto" "^1.4.0" + abort-controller "^3.0.0" + busboy "^1.6.0" + event-target-polyfill "^0.0.3" + form-data-encoder "^1.7.1" + formdata-node "^4.3.1" + node-fetch "^2.6.7" + undici "^5.8.0" + web-streams-polyfill "^3.2.0" + "@wry/context@^0.6.0": version "0.6.1" resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.6.1.tgz#c3c29c0ad622adb00f6a53303c4f965ee06ebeb2" @@ -6608,6 +7353,13 @@ abab@^2.0.3, abab@^2.0.5: resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== +abort-controller@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" + integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== + dependencies: + event-target-shim "^5.0.0" + accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: version "1.3.8" resolved "https://registry.yarnpkg.com/accepts/-/accepts-1.3.8.tgz#0bf0be125b67014adcb0b0921e62db7bffe16b2e" @@ -6827,7 +7579,7 @@ ansi-escapes@^3.0.0, ansi-escapes@^3.1.0: resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== -ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.2: +ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.1, ansi-escapes@^4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e" integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ== @@ -7368,6 +8120,11 @@ arrify@^2.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa" integrity sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug== +asap@~2.0.3: + version "2.0.6" + resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" + integrity sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA== + asn1.js@^5.2.0: version "5.4.1" resolved "https://registry.yarnpkg.com/asn1.js/-/asn1.js-5.4.1.tgz#11a980b84ebb91781ce35b0fdc2ee294e3783f07" @@ -7385,6 +8142,15 @@ asn1@~0.2.3: dependencies: safer-buffer "~2.1.0" +asn1js@^3.0.1, asn1js@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/asn1js/-/asn1js-3.0.5.tgz#5ea36820443dbefb51cc7f88a2ebb5b462114f38" + integrity sha512-FVnvrKJwpt9LP2lAMl8qZswRNm3T4q9CON+bxldk2iwk3FFpuwhx2FfinyitizWHsVYyaY+y5JzDR0rCMV5yTQ== + dependencies: + pvtsutils "^1.3.2" + pvutils "^1.1.3" + tslib "^2.4.0" + assert-plus@1.0.0, assert-plus@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/assert-plus/-/assert-plus-1.0.0.tgz#f12e0f3c5d77b0b1cdd9146942e4e96c1e4dd525" @@ -7473,6 +8239,11 @@ atob@^2.1.2: resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== +auto-bind@~4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/auto-bind/-/auto-bind-4.0.0.tgz#e3589fc6c2da8f7ca43ba9f84fa52a744fc997fb" + integrity sha512-Hdw8qdNiqdJ8LqT0iK0sVzkFbzg6fhnQqqfWhBDxcHZvU75+B+ayzTy8x+k5Ix0Y92XOhOUlx74ps+bA6BeYMQ== + autoprefixer@10.4.8, autoprefixer@^10.4.7: version "10.4.8" resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-10.4.8.tgz#92c7a0199e1cfb2ad5d9427bd585a3d75895b9e5" @@ -7696,6 +8467,11 @@ babel-plugin-react-docgen@^4.2.1: lodash "^4.17.15" react-docgen "^5.0.0" +babel-plugin-syntax-trailing-function-commas@^7.0.0-beta.0: + version "7.0.0-beta.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz#aa213c1435e2bffeb6fca842287ef534ad05d5cf" + integrity sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ== + babel-plugin-transform-async-to-promises@^0.8.15: version "0.8.18" resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-promises/-/babel-plugin-transform-async-to-promises-0.8.18.tgz#f4dc5980b8afa0fc9c784b8d931afde913413e39" @@ -7726,6 +8502,39 @@ babel-preset-current-node-syntax@^1.0.0: "@babel/plugin-syntax-optional-chaining" "^7.8.3" "@babel/plugin-syntax-top-level-await" "^7.8.3" +babel-preset-fbjs@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/babel-preset-fbjs/-/babel-preset-fbjs-3.4.0.tgz#38a14e5a7a3b285a3f3a86552d650dca5cf6111c" + integrity sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow== + dependencies: + "@babel/plugin-proposal-class-properties" "^7.0.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/plugin-syntax-class-properties" "^7.0.0" + "@babel/plugin-syntax-flow" "^7.0.0" + "@babel/plugin-syntax-jsx" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.0.0" + "@babel/plugin-transform-arrow-functions" "^7.0.0" + "@babel/plugin-transform-block-scoped-functions" "^7.0.0" + "@babel/plugin-transform-block-scoping" "^7.0.0" + "@babel/plugin-transform-classes" "^7.0.0" + "@babel/plugin-transform-computed-properties" "^7.0.0" + "@babel/plugin-transform-destructuring" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/plugin-transform-for-of" "^7.0.0" + "@babel/plugin-transform-function-name" "^7.0.0" + "@babel/plugin-transform-literals" "^7.0.0" + "@babel/plugin-transform-member-expression-literals" "^7.0.0" + "@babel/plugin-transform-modules-commonjs" "^7.0.0" + "@babel/plugin-transform-object-super" "^7.0.0" + "@babel/plugin-transform-parameters" "^7.0.0" + "@babel/plugin-transform-property-literals" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-shorthand-properties" "^7.0.0" + "@babel/plugin-transform-spread" "^7.0.0" + "@babel/plugin-transform-template-literals" "^7.0.0" + babel-plugin-syntax-trailing-function-commas "^7.0.0-beta.0" + babel-preset-jest@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-27.5.1.tgz#91f10f58034cb7989cb4f962b69fa6eef6a6bc81" @@ -7848,7 +8657,7 @@ bindings@^1.5.0: dependencies: file-uri-to-path "1.0.0" -bl@^4.0.3: +bl@^4.0.3, bl@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" integrity sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w== @@ -8229,6 +9038,11 @@ buffer-crc32@~0.2.3: resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242" integrity sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ== +buffer-equal-constant-time@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz#f8e71132f7ffe6e01a5c9697a4c6f3e48d5cc819" + integrity sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA== + buffer-fill@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c" @@ -8287,6 +9101,13 @@ builtin-status-codes@^3.0.0: resolved "https://registry.yarnpkg.com/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz#85982878e21b98e1c66425e03d0174788f569ee8" integrity sha512-HpGFw18DgFWlncDfjTa2rcQ4W88O1mC8e8yZ2AvQY5KDaktSTwo+KRf6nHK6FRI5FyRyb/5T6+TSxfP7QyGsmQ== +busboy@^1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" + integrity sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA== + dependencies: + streamsearch "^1.1.0" + byline@5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/byline/-/byline-5.0.0.tgz#741c5216468eadc457b03410118ad77de8c1ddb1" @@ -8528,7 +9349,7 @@ chalk@4.1.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -chalk@4.1.2, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.2: +chalk@4.1.2, chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0, chalk@^4.1.1, chalk@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -8564,7 +9385,23 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" -change-case@^4.0.0: +change-case-all@1.0.14: + version "1.0.14" + resolved "https://registry.yarnpkg.com/change-case-all/-/change-case-all-1.0.14.tgz#bac04da08ad143278d0ac3dda7eccd39280bfba1" + integrity sha512-CWVm2uT7dmSHdO/z1CXT/n47mWonyypzBbuCy5tN7uMg22BsfkhwT6oHmFCAk+gL1LOOxhdbB9SZz3J1KTY3gA== + dependencies: + change-case "^4.1.2" + is-lower-case "^2.0.2" + is-upper-case "^2.0.2" + lower-case "^2.0.2" + lower-case-first "^2.0.2" + sponge-case "^1.0.1" + swap-case "^2.0.2" + title-case "^3.0.3" + upper-case "^2.0.2" + upper-case-first "^2.0.2" + +change-case@^4.0.0, change-case@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/change-case/-/change-case-4.1.2.tgz#fedfc5f136045e2398c0410ee441f95704641e12" integrity sha512-bSxY2ws9OtviILG1EiY5K7NNxkqg/JnRnFxLtKQ96JaviiIxi7djMrSd0ECT9AC+lttClmYwKw53BWpOMblo7A== @@ -8602,6 +9439,11 @@ character-reference-invalid@^1.0.0: resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560" integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg== +chardet@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" + integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA== + check-error@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.2.tgz#574d312edd88bb5dd8912e9286dd6c0aed4aac82" @@ -8627,7 +9469,7 @@ chokidar@3.5.2: optionalDependencies: fsevents "~2.3.2" -"chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.0, chokidar@^3.4.1, chokidar@^3.4.2, chokidar@^3.5.1, chokidar@^3.5.3: +"chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.0, chokidar@^3.4.1, chokidar@^3.4.2, chokidar@^3.5.1, chokidar@^3.5.2, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -8681,7 +9523,7 @@ ci-info@^2.0.0: resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46" integrity sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ== -ci-info@^3.2.0, ci-info@^3.3.0: +ci-info@^3.0.0, ci-info@^3.2.0, ci-info@^3.3.0: version "3.3.2" resolved "https://registry.yarnpkg.com/ci-info/-/ci-info-3.3.2.tgz#6d2967ffa407466481c6c90b6e16b3098f080128" integrity sha512-xmDt/QIAdeZ9+nfdPsaBCpMvHNLFiLdjj59qjqn+6iPe6YmHGQ35sBnQ8uslRBXFmXkiZQOJRjvQeoGppoTjjg== @@ -8778,6 +9620,11 @@ cli-spinners@2.6.1: resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.6.1.tgz#adc954ebe281c37a6319bfa401e6dd2488ffb70d" integrity sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g== +cli-spinners@^2.5.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/cli-spinners/-/cli-spinners-2.7.0.tgz#f815fd30b5f9eaac02db604c7a231ed7cb2f797a" + integrity sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw== + cli-table3@^0.6.1, cli-table3@~0.6.1: version "0.6.2" resolved "https://registry.yarnpkg.com/cli-table3/-/cli-table3-0.6.2.tgz#aaf5df9d8b5bf12634dc8b3040806a0c07120d2a" @@ -8849,6 +9696,11 @@ cli-ux@6.0.9: supports-hyperlinks "^2.1.0" tslib "^2.0.0" +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== + cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -8858,6 +9710,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + cliui@^7.0.2: version "7.0.4" resolved "https://registry.yarnpkg.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" @@ -8876,6 +9737,11 @@ clone-deep@^4.0.1: kind-of "^6.0.2" shallow-clone "^3.0.0" +clone@^1.0.2: + version "1.0.4" + resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" + integrity sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg== + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -9042,7 +9908,7 @@ common-path-prefix@^3.0.0: resolved "https://registry.yarnpkg.com/common-path-prefix/-/common-path-prefix-3.0.0.tgz#7d007a7e07c58c4b4d5f433131a19141b29f11e0" integrity sha512-QE33hToZseCH3jS0qN96O/bSh3kaw/h+Tq7ngyY9eWDUnTlTNUyqfqvCXioLe5Na5jFsL78ra/wuBU4iuEgd4w== -common-tags@^1.5.1, common-tags@^1.8.0: +common-tags@1.8.2, common-tags@^1.5.1, common-tags@^1.8.0: version "1.8.2" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.2.tgz#94ebb3c076d26032745fd54face7f688ef5ac9c6" integrity sha512-gk/Z852D2Wtb//0I+kRFNKKE9dIIVirjoqPoA1wJU+XePVXZfGeBpk45+A1rKO4Q43prqWBNY/MiIeRLbPWUaA== @@ -9283,6 +10149,13 @@ corser@^2.0.1: resolved "https://registry.yarnpkg.com/corser/-/corser-2.0.1.tgz#8eda252ecaab5840dcd975ceb90d9370c819ff87" integrity sha512-utCYNzRSQIZNPIcGZdQc92UVJYAhtGAteCFg0yRaFm8f0P+CPtyGyHXJcGXnffjCybUCEx3FQ2G7U3/o9eIkVQ== +cosmiconfig-toml-loader@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig-toml-loader/-/cosmiconfig-toml-loader-1.0.0.tgz#0681383651cceff918177debe9084c0d3769509b" + integrity sha512-H/2gurFWVi7xXvCyvsWRLCMekl4tITJcX0QEsDMpzxtuxDyM59xLatYNg4s/k9AA/HdtCYfj2su8mgA0GSDLDA== + dependencies: + "@iarna/toml" "^2.2.5" + cosmiconfig-typescript-loader@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-2.0.2.tgz#7e7ce6064af041c910e1e43fb0fd9625cee56e93" @@ -9291,6 +10164,22 @@ cosmiconfig-typescript-loader@^2.0.0: cosmiconfig "^7" ts-node "^10.8.1" +cosmiconfig-typescript-loader@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/cosmiconfig-typescript-loader/-/cosmiconfig-typescript-loader-4.0.0.tgz#4a6d856c1281135197346a6f64dfa73a9cd9fefa" + integrity sha512-cVpucSc2Tf+VPwCCR7SZzmQTQkPbkk4O01yXsYqXBIbjE1bhwqSyAgYQkRK1un4i0OPziTleqFhdkmOc4RQ/9g== + +cosmiconfig@7.0.1, cosmiconfig@^7, cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" + integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== + dependencies: + "@types/parse-json" "^4.0.0" + import-fresh "^3.2.1" + parse-json "^5.0.0" + path-type "^4.0.0" + yaml "^1.10.0" + cosmiconfig@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-4.0.0.tgz#760391549580bbd2df1e562bc177b13c290972dc" @@ -9312,17 +10201,6 @@ cosmiconfig@^6.0.0: path-type "^4.0.0" yaml "^1.7.2" -cosmiconfig@^7, cosmiconfig@^7.0.0, cosmiconfig@^7.0.1: - version "7.0.1" - resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d" - integrity sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ== - dependencies: - "@types/parse-json" "^4.0.0" - import-fresh "^3.2.1" - parse-json "^5.0.0" - path-type "^4.0.0" - yaml "^1.10.0" - cp-file@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cp-file/-/cp-file-7.0.0.tgz#b9454cfd07fe3b974ab9ea0e5f29655791a9b8cd" @@ -9384,7 +10262,7 @@ create-require@^1.1.0: resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== -cross-fetch@^3.1.4: +cross-fetch@^3.1.4, cross-fetch@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== @@ -9411,6 +10289,18 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" +cross-undici-fetch@^0.1.25: + version "0.1.33" + resolved "https://registry.yarnpkg.com/cross-undici-fetch/-/cross-undici-fetch-0.1.33.tgz#17639a2ba78bce4fd332ccb44d7a039d66d072ac" + integrity sha512-2IljikrWuhEroSlidX0i/TXjL01IIQUigWC/9tq7U3C/GoQQBqc02xNIVTqoZG6nPn/P9C9YMH78A4aTLUticQ== + dependencies: + abort-controller "^3.0.0" + form-data-encoder "^1.7.1" + formdata-node "^4.3.1" + node-fetch "^2.6.7" + undici "^5.0.0" + web-streams-polyfill "^3.2.0" + crypto-browserify@^3.0.0, crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -10014,6 +10904,11 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" +dataloader@2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/dataloader/-/dataloader-2.1.0.tgz#c69c538235e85e7ac6c6c444bae8ecabf5de9df7" + integrity sha512-qTcEYLen3r7ojZNgVUaRggOI+KM7jrKxXeSHhogh/TWxYMeONEMqY+hmkobiYQozsGIyg9OYVzO4ZIfoB4I0pQ== + date-fns@^1.27.2: version "1.30.1" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c" @@ -10029,6 +10924,11 @@ dayjs@^1.10.4: resolved "https://registry.yarnpkg.com/dayjs/-/dayjs-1.11.5.tgz#00e8cc627f231f9499c19b38af49f56dc0ac5e93" integrity sha512-CAdX5Q3YW3Gclyo5Vpqkgpj8fSdLQcRuzfX6mC6Phy0nfJ0eGYOeS7m4mt2plDWLAtA4TqTakvbboHvUxfe4iA== +debounce@^1.2.0: + version "1.2.1" + resolved "https://registry.yarnpkg.com/debounce/-/debounce-1.2.1.tgz#38881d8f4166a5c5848020c11827b834bcb3e0a5" + integrity sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug== + debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: version "2.6.9" resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" @@ -10036,7 +10936,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -10123,6 +11023,13 @@ default-gateway@^6.0.3: dependencies: execa "^5.0.0" +defaults@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/defaults/-/defaults-1.0.3.tgz#c656051e9817d9ff08ed881477f3fe4019f3ef7d" + integrity sha512-s82itHOnYrN0Ib8r+z7laQz3sdE+4FP3d9Q7VLO7U+KRT+CR0GsWuyHxzdAY82I7cXv0G/twrqomTJLOssO5HA== + dependencies: + clone "^1.0.2" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz#3f7ae421129bcaaac9bc74905c98a0009ec9ee7f" @@ -10190,6 +11097,11 @@ depd@~1.1.2: resolved "https://registry.yarnpkg.com/depd/-/depd-1.1.2.tgz#9bcd52e14c097763e749b274c4346ed2e560b5a9" integrity sha512-7emPTl6Dpo6JRXOXjLRxck+FlLRX5847cLKEn00PLAgc3g2hTZZgr+e4c2v6QpSmLeFP3n5yUo7ft6avBK/5jQ== +dependency-graph@0.11.0, dependency-graph@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/dependency-graph/-/dependency-graph-0.11.0.tgz#ac0ce7ed68a54da22165a85e97a01d53f5eb2e27" + integrity sha512-JeMq7fEshyepOWDfcfHK06N3MhyPhz++vtqWhMT5O9A3K42rdsEDpfdVqjaqaAhsw6a+ZqeDvQVtD0hFHQWrzg== + deps-sort@^2.0.0, deps-sort@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/deps-sort/-/deps-sort-2.0.1.tgz#9dfdc876d2bcec3386b6829ac52162cda9fa208d" @@ -10225,6 +11137,11 @@ detect-browser@5.2.0: resolved "https://registry.yarnpkg.com/detect-browser/-/detect-browser-5.2.0.tgz#c9cd5afa96a6a19fda0bbe9e9be48a6b6e1e9c97" integrity sha512-tr7XntDAu50BVENgQfajMLzacmSe34D+qZc4zjnniz0ZVuw/TZcLcyxHQjYpJTM36sGEkZZlYLnIM1hH7alTMA== +detect-indent@^6.0.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/detect-indent/-/detect-indent-6.1.0.tgz#592485ebbbf6b3b1ab2be175c8393d04ca0d57e6" + integrity sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA== + detect-newline@^3.0.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" @@ -10475,6 +11392,11 @@ dotenv@~10.0.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81" integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q== +dset@^3.1.1, dset@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/dset/-/dset-3.1.2.tgz#89c436ca6450398396dc6538ea00abc0c54cd45a" + integrity sha512-g/M9sqy3oHe477Ar4voQxWtaPIFw1jTdKZuomOjhCcBx9nHUNn0pu6NopuFFrTh/TRZIKEj+76vLWFu9BNKk+Q== + duplexer2@^0.1.2, duplexer2@~0.1.0, duplexer2@~0.1.2: version "0.1.4" resolved "https://registry.yarnpkg.com/duplexer2/-/duplexer2-0.1.4.tgz#8b12dab878c0d69e3e7891051662a32fc6bddcc1" @@ -10518,6 +11440,13 @@ ecc-jsbn@~0.1.1: jsbn "~0.1.0" safer-buffer "^2.1.0" +ecdsa-sig-formatter@1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz#ae0f0fa2d85045ef14a817daa3ce9acd0489e5bf" + integrity sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ== + dependencies: + safe-buffer "^5.0.1" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -11244,6 +12173,16 @@ ethers@^5.6.0, ethers@^5.7.0: "@ethersproject/web" "5.7.0" "@ethersproject/wordlists" "5.7.0" +event-target-polyfill@^0.0.3: + version "0.0.3" + resolved "https://registry.yarnpkg.com/event-target-polyfill/-/event-target-polyfill-0.0.3.tgz#ed373295f3b257774b5d75afb2599331d9f3406c" + integrity sha512-ZMc6UuvmbinrCk4RzGyVmRyIsAyxMRlp4CqSrcQRO8Dy0A9ldbiRy5kdtBj4OtP7EClGdqGfIqo9JmOClMsGLQ== + +event-target-shim@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" + integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== + eventemitter2@^6.4.3: version "6.4.7" resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d" @@ -11430,6 +12369,15 @@ extend@^3.0.0, extend@~3.0.2: resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.2.tgz#f8b1136b4071fbd8eb140aff858b1019ec2915fa" integrity sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g== +external-editor@^3.0.3: + version "3.1.0" + resolved "https://registry.yarnpkg.com/external-editor/-/external-editor-3.1.0.tgz#cb03f740befae03ea4d283caed2741a83f335495" + integrity sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew== + dependencies: + chardet "^0.7.0" + iconv-lite "^0.4.24" + tmp "^0.0.33" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -11444,6 +12392,16 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" +extract-files@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-11.0.0.tgz#b72d428712f787eef1f5193aff8ab5351ca8469a" + integrity sha512-FuoE1qtbJ4bBVvv94CC7s0oTnKUGvQs+Rjf1L2SJFfS+HTVVjhPFtehPdQ0JiGPqVNfSSZvL5yzHHQq2Z4WNhQ== + +extract-files@^9.0.0: + version "9.0.0" + resolved "https://registry.yarnpkg.com/extract-files/-/extract-files-9.0.0.tgz#8a7744f2437f81f5ed3250ed9f1550de902fe54a" + integrity sha512-CvdFfHkC95B4bBBk36hcEmvdR2awOdhhVUYH6S/zrVj3477zven/fJMYg7121h4T1xHZC+tetUpubpAhxwI7hQ== + extract-stack@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/extract-stack/-/extract-stack-2.0.0.tgz#11367bc865bfcd9bc0db3123e5edb57786f11f9b" @@ -11579,6 +12537,24 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +fbjs-css-vars@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/fbjs-css-vars/-/fbjs-css-vars-1.0.2.tgz#216551136ae02fe255932c3ec8775f18e2c078b8" + integrity sha512-b2XGFAFdWZWg0phtAWLHCk836A1Xann+I+Dgd3Gk64MHKZO44FfoD1KxyvbSh0qZsIoXQGGlVztIY+oitJPpRQ== + +fbjs@^3.0.0: + version "3.0.4" + resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-3.0.4.tgz#e1871c6bd3083bac71ff2da868ad5067d37716c6" + integrity sha512-ucV0tDODnGV3JCnnkmoszb5lf4bNpzjv80K41wd4k798Etq+UYD0y0TIfalLjZoKgjive6/adkRnszwapiDgBQ== + dependencies: + cross-fetch "^3.1.5" + fbjs-css-vars "^1.0.0" + loose-envify "^1.0.0" + object-assign "^4.1.0" + promise "^7.1.1" + setimmediate "^1.0.5" + ua-parser-js "^0.7.30" + fd-slicer@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/fd-slicer/-/fd-slicer-1.1.0.tgz#25c7c89cb1f9077f8891bbe61d8f390eae256f1e" @@ -11603,7 +12579,7 @@ figures@2.0.0, figures@^2.0.0: dependencies: escape-string-regexp "^1.0.5" -figures@3.2.0, figures@^3.2.0: +figures@3.2.0, figures@^3.0.0, figures@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== @@ -11848,6 +12824,11 @@ fork-ts-checker-webpack-plugin@^6.0.4: semver "^7.3.2" tapable "^1.0.0" +form-data-encoder@^1.7.1: + version "1.7.2" + resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.2.tgz#1f1ae3dccf58ed4690b86d87e4f57c654fbab040" + integrity sha512-qfqtYan3rxrnCk1VYaA4H+Ms9xdpPqvLZa6xmMgFvhO32x7/3J/ExcTd6qpxM0vH2GdMI+poehyBZvqfMTto8A== + form-data@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" @@ -11871,6 +12852,14 @@ format@^0.2.0: resolved "https://registry.yarnpkg.com/format/-/format-0.2.2.tgz#d6170107e9efdc4ed30c9dc39016df942b5cb58b" integrity sha512-wzsgA6WOq+09wrU1tsJ09udeR/YZRaeArL9e1wPbFg3GG2yDnC2ldKpxs4xunpFF9DgqCqOIra3bc1HWrJ37Ww== +formdata-node@^4.3.1: + version "4.4.1" + resolved "https://registry.yarnpkg.com/formdata-node/-/formdata-node-4.4.1.tgz#23f6a5cb9cb55315912cbec4ff7b0f59bbd191e2" + integrity sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ== + dependencies: + node-domexception "1.0.0" + web-streams-polyfill "4.0.0-beta.3" + forwarded@0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.2.0.tgz#2269936428aad4c15c7ebe9779a84bf0b2a81811" @@ -12369,7 +13358,7 @@ globby@10.0.1: merge2 "^1.2.3" slash "^3.0.0" -globby@^11.0.1, globby@^11.0.2, globby@^11.1.0: +globby@^11.0.1, globby@^11.0.2, globby@^11.0.3, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -12426,14 +13415,42 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== -graphql-tag@2.12.6, graphql-tag@^2.10.1, graphql-tag@^2.12.6: +graphql-config@^4.3.5: + version "4.3.5" + resolved "https://registry.yarnpkg.com/graphql-config/-/graphql-config-4.3.5.tgz#bd197ec9c1e86d2696c61332be35b920ba7be700" + integrity sha512-B4jXhHL7j3llCem+ACeo48wvVYhtJxRyt5SfSnvywbRlVYyUzt5ibZV6WJU2Yii2/rcVRIGi7BHDgcAPWdWdJg== + dependencies: + "@graphql-tools/graphql-file-loader" "^7.3.7" + "@graphql-tools/json-file-loader" "^7.3.7" + "@graphql-tools/load" "^7.5.5" + "@graphql-tools/merge" "^8.2.6" + "@graphql-tools/url-loader" "^7.9.7" + "@graphql-tools/utils" "^8.6.5" + cosmiconfig "7.0.1" + cosmiconfig-toml-loader "1.0.0" + cosmiconfig-typescript-loader "^4.0.0" + minimatch "4.2.1" + string-env-interpolation "1.0.1" + ts-node "^10.8.1" + tslib "^2.4.0" + +graphql-request@^4.0.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/graphql-request/-/graphql-request-4.3.0.tgz#b934e08fcae764aa2cdc697d3c821f046cb5dbf2" + integrity sha512-2v6hQViJvSsifK606AliqiNiijb1uwWp6Re7o0RTyH+uRTv/u7Uqm2g4Fjq/LgZIzARB38RZEvVBFOQOVdlBow== + dependencies: + cross-fetch "^3.1.5" + extract-files "^9.0.0" + form-data "^3.0.0" + +graphql-tag@2.12.6, graphql-tag@^2.10.1, graphql-tag@^2.11.0, graphql-tag@^2.12.6: version "2.12.6" resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== dependencies: tslib "^2.1.0" -graphql-ws@^5.6.3: +graphql-ws@^5.4.1, graphql-ws@^5.6.3: version "5.10.1" resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.10.1.tgz#c5402a62f1be13e244ab90a6306b94f643577312" integrity sha512-MKm/3SRd1vj5Km8NaujsgeGRTKZQjUN5HRnIMJ8dL2UznKoxvrtQyJqTmqJt0f6vQd9AooDg/+baXo3huiY4Ew== @@ -12869,6 +13886,15 @@ http-proxy-agent@^4.0.1: agent-base "6" debug "4" +http-proxy-agent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" + integrity sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w== + dependencies: + "@tootallnate/once" "2" + agent-base "6" + debug "4" + http-proxy-middleware@^2.0.3: version "2.0.6" resolved "https://registry.yarnpkg.com/http-proxy-middleware/-/http-proxy-middleware-2.0.6.tgz#e1a4dd6979572c7ab5a4e4b55095d1f32a74963f" @@ -12964,7 +13990,7 @@ i18next@^20.3.5: dependencies: "@babel/runtime" "^7.12.0" -iconv-lite@0.4.24: +iconv-lite@0.4.24, iconv-lite@^0.4.24: version "0.4.24" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== @@ -13042,6 +14068,11 @@ immutable@^4.0.0: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef" integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ== +immutable@~3.7.6: + version "3.7.6" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" + integrity sha512-AizQPcaofEtO11RZhPPHBOJRdo/20MKQF9mBLnVkBoyHi1/zXK8fzVdnEpSV9gxqtnh6Qomfp3F0xT5qP/vThw== + import-cwd@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/import-cwd/-/import-cwd-3.0.0.tgz#20845547718015126ea9b3676b7592fb8bd4cf92" @@ -13057,6 +14088,11 @@ import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" +import-from@4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/import-from/-/import-from-4.0.0.tgz#2710b8d66817d232e16f4166e319248d3d5492e2" + integrity sha512-P9J71vT5nLlDeV8FHs5nNxaLbrpfAV5cF5srvbZfpwpcJoM/xZR3hiv+q+SAnuSmuGbXMWud063iIMx/V/EWZQ== + import-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/import-from/-/import-from-3.0.0.tgz#055cfec38cd5a27d8057ca51376d7d3bf0891966" @@ -13149,6 +14185,27 @@ inline-style-parser@0.1.1: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== +inquirer@^8.0.0: + version "8.2.4" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.4.tgz#ddbfe86ca2f67649a67daa6f1051c128f684f0b4" + integrity sha512-nn4F01dxU8VeKfq192IjLsxu0/OmMZ4Lg3xKAns148rCaXP6ntAoEkVYZThWjwON8AlzdZZi6oqnhNbxUG9hVg== + dependencies: + ansi-escapes "^4.2.1" + chalk "^4.1.1" + cli-cursor "^3.1.0" + cli-width "^3.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.21" + mute-stream "0.0.8" + ora "^5.4.1" + run-async "^2.4.0" + rxjs "^7.5.5" + string-width "^4.1.0" + strip-ansi "^6.0.0" + through "^2.3.6" + wrap-ansi "^7.0.0" + insert-module-globals@^7.0.0, insert-module-globals@^7.2.1: version "7.2.1" resolved "https://registry.yarnpkg.com/insert-module-globals/-/insert-module-globals-7.2.1.tgz#d5e33185181a4e1f33b15f7bf100ee91890d5cb3" @@ -13221,6 +14278,14 @@ is-absolute-url@^3.0.0: resolved "https://registry.yarnpkg.com/is-absolute-url/-/is-absolute-url-3.0.3.tgz#96c6a22b6a23929b11ea0afb1836c36ad4a5d698" integrity sha512-opmNIX7uFnS96NtPmhWQgQx6/NYFgsUXYMllcfzwWKUMwfo8kku1TvE6hkNcH+Q1ts5cMVrsY7j0bxXQDciu9Q== +is-absolute@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-absolute/-/is-absolute-1.0.0.tgz#395e1ae84b11f26ad1795e73c17378e48a301576" + integrity sha512-dOWoqflvcydARa360Gvv18DZ/gRuHKi2NU/wU5X1ZFzdYfH29nkiNZsF3mp4OJ3H4yo9Mx8A/uAGNzpzPN3yBA== + dependencies: + is-relative "^1.0.0" + is-windows "^1.0.1" + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -13461,6 +14526,13 @@ is-generator@^1.0.2: resolved "https://registry.yarnpkg.com/is-generator/-/is-generator-1.0.3.tgz#c14c21057ed36e328db80347966c693f886389f3" integrity sha512-G56jBpbJeg7ds83HW1LuShNs8J73Fv3CPz/bmROHOHlnKkN8sWb9ujiagjmxxMUywftgq48HlBZELKKqFLk0oA== +is-glob@4.0.3, is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: + version "4.0.3" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" + integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== + dependencies: + is-extglob "^2.1.1" + is-glob@^3.0.0, is-glob@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -13468,13 +14540,6 @@ is-glob@^3.0.0, is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: - version "4.0.3" - resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" - integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== - dependencies: - is-extglob "^2.1.1" - is-hexadecimal@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-1.0.4.tgz#cc35c97588da4bd49a8eedd6bc4082d44dcb23a7" @@ -13488,6 +14553,18 @@ is-installed-globally@~0.4.0: global-dirs "^3.0.0" is-path-inside "^3.0.2" +is-interactive@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-interactive/-/is-interactive-1.0.0.tgz#cea6e6ae5c870a7b0a0004070b7b587e0252912e" + integrity sha512-2HvIEKRoqS62guEC+qBjpvRubdX910WCMuJTZ+I9yvqKU2/12eSL549HMwtabb4oupdj2sMP50k+XJfB/8JE6w== + +is-lower-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-lower-case/-/is-lower-case-2.0.2.tgz#1c0884d3012c841556243483aa5d522f47396d2a" + integrity sha512-bVcMJy4X5Og6VZfdOZstSexlEy20Sr0k/p/b2IlQJlfdKAQuMpiv5w2Ccxb8sKdRUNAG1PnHVHjFSdRDVS6NlQ== + dependencies: + tslib "^2.0.3" + is-map@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" @@ -13601,6 +14678,13 @@ is-regex@^1.1.2, is-regex@^1.1.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" +is-relative@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-relative/-/is-relative-1.0.0.tgz#a1bb6935ce8c5dba1e8b9754b9b2dcc020e2260d" + integrity sha512-Kw/ReK0iqwKeu0MITLFuj0jbPAmEiOsIwyIXvvbfa6QfmN9pkD1M+8pdk7Rl/dTKbH34/XBFMbgD4iMJhLQbGA== + dependencies: + is-unc-path "^1.0.0" + is-retry-allowed@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz#d778488bd0a4666a3be8a1482b9f2baafedea8b4" @@ -13672,11 +14756,25 @@ is-typedarray@1.0.0, is-typedarray@^1.0.0, is-typedarray@~1.0.0: resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA== +is-unc-path@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-unc-path/-/is-unc-path-1.0.0.tgz#d731e8898ed090a12c352ad2eaed5095ad322c9d" + integrity sha512-mrGpVd0fs7WWLfVsStvgF6iEJnbjDFZh9/emhRDcGWTduTfNHd9CHeUwH3gYIjdbwo4On6hunkztwOaAw0yllQ== + dependencies: + unc-path-regex "^0.1.2" + is-unicode-supported@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7" integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw== +is-upper-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-upper-case/-/is-upper-case-2.0.2.tgz#f1105ced1fe4de906a5f39553e7d3803fd804649" + integrity sha512-44pxmxAvnnAOwBg4tHPnkfvgjPwbc5QIsSstNU+YcJ1ovxVzCWpSGosPJOZh/a1tdl81fbgnLc9LLv+x2ywbPQ== + dependencies: + tslib "^2.0.3" + is-utf8@^0.2.0: version "0.2.1" resolved "https://registry.yarnpkg.com/is-utf8/-/is-utf8-0.2.1.tgz#4b0da1442104d1b336340e80797e865cf39f7d72" @@ -13699,7 +14797,7 @@ is-window@^1.0.2: resolved "https://registry.yarnpkg.com/is-window/-/is-window-1.0.2.tgz#2c896ca53db97de45d3c33133a65d8c9f563480d" integrity sha512-uj00kdXyZb9t9RcAUAwMZAnkBUwdYGhYlt7djMXhfyhUCzwNba50tIiBKR7q0l7tdoBtFVw/3JmLY6fI3rmZmg== -is-windows@^1.0.2: +is-windows@^1.0.1, is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== @@ -13753,6 +14851,14 @@ isobject@^4.0.0: resolved "https://registry.yarnpkg.com/isobject/-/isobject-4.0.0.tgz#3f1c9155e73b192022a80819bacd0343711697b0" integrity sha512-S/2fF5wH8SJA/kmwr6HYhK/RI/OkhD84k8ntalo0iJjZikgq1XFvR5M8NPT1x5F7fBwCG3qHfnzeP/Vh/ZxCUA== +isomorphic-fetch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz#0267b005049046d2421207215d45d6a262b8b8b4" + integrity sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA== + dependencies: + node-fetch "^2.6.1" + whatwg-fetch "^3.4.1" + isomorphic-unfetch@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/isomorphic-unfetch/-/isomorphic-unfetch-3.1.0.tgz#87341d5f4f7b63843d468438128cb087b7c3e98f" @@ -13761,6 +14867,11 @@ isomorphic-unfetch@^3.1.0: node-fetch "^2.6.1" unfetch "^4.2.0" +isomorphic-ws@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" + integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== + isstream@~0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" @@ -14394,7 +15505,7 @@ js-string-escape@^1.0.1: resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== -js-yaml@4.1.0, js-yaml@^4.1.0: +js-yaml@4.1.0, js-yaml@^4.0.0, js-yaml@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602" integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA== @@ -14487,6 +15598,13 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== +json-stable-stringify@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz#9a759d39c5f2ff503fd5300646ed445f88c4f9af" + integrity sha512-i/J297TW6xyj7sDFa7AmBPkQvLIxWr2kKPWI26tXydnZrzVAocNqn5DMNT1Mzk0vit1V5UkRM7C1KdVNp7Lmcg== + dependencies: + jsonify "~0.0.0" + json-stable-stringify@~0.0.0: version "0.0.1" resolved "https://registry.yarnpkg.com/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz#611c23e814db375527df851193db59dd2af27f45" @@ -14499,6 +15617,14 @@ json-stringify-safe@^5.0.1, json-stringify-safe@~5.0.1: resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== +json-to-pretty-yaml@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz#f4cd0bd0a5e8fe1df25aaf5ba118b099fd992d5b" + integrity sha512-rvm6hunfCcqegwYaG5T4yKJWxc9FXFgBVrcTZ4XfSVRwa5HA/Xs+vB/Eo9treYYHCeNM0nrSUr82V/M31Urc7A== + dependencies: + remedial "^1.0.7" + remove-trailing-spaces "^1.0.6" + json5@2.x, json5@^2.1.2, json5@^2.1.3, json5@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" @@ -14542,6 +15668,22 @@ jsonparse@^1.2.0: resolved "https://registry.yarnpkg.com/jsonparse/-/jsonparse-1.3.1.tgz#3f4dae4a91fac315f71062f8521cc239f1366280" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== +jsonwebtoken@^8.5.1: + version "8.5.1" + resolved "https://registry.yarnpkg.com/jsonwebtoken/-/jsonwebtoken-8.5.1.tgz#00e71e0b8df54c2121a1f26137df2280673bcc0d" + integrity sha512-XjwVfRS6jTMsqYs0EsuJ4LGxXV14zQybNd4L2r0UvbVnSF9Af8x7p5MzbJ90Ioz/9TI41/hTCvznF/loiSzn8w== + dependencies: + jws "^3.2.2" + lodash.includes "^4.3.0" + lodash.isboolean "^3.0.3" + lodash.isinteger "^4.0.4" + lodash.isnumber "^3.0.3" + lodash.isplainobject "^4.0.6" + lodash.isstring "^4.0.1" + lodash.once "^4.0.0" + ms "^2.1.1" + semver "^5.6.0" + jsprim@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/jsprim/-/jsprim-2.0.2.tgz#77ca23dbcd4135cd364800d22ff82c2185803d4d" @@ -14565,6 +15707,23 @@ junk@^3.1.0: resolved "https://registry.yarnpkg.com/junk/-/junk-3.1.0.tgz#31499098d902b7e98c5d9b9c80f43457a88abfa1" integrity sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ== +jwa@^1.4.1: + version "1.4.1" + resolved "https://registry.yarnpkg.com/jwa/-/jwa-1.4.1.tgz#743c32985cb9e98655530d53641b66c8645b039a" + integrity sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA== + dependencies: + buffer-equal-constant-time "1.0.1" + ecdsa-sig-formatter "1.0.11" + safe-buffer "^5.0.1" + +jws@^3.2.2: + version "3.2.2" + resolved "https://registry.yarnpkg.com/jws/-/jws-3.2.2.tgz#001099f3639468c9414000e99995fa52fb478304" + integrity sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA== + dependencies: + jwa "^1.4.1" + safe-buffer "^5.0.1" + keyvaluestorage-interface@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/keyvaluestorage-interface/-/keyvaluestorage-interface-1.0.0.tgz#13ebdf71f5284ad54be94bd1ad9ed79adad515ff" @@ -14934,11 +16093,41 @@ lodash.identity@3.0.0: resolved "https://registry.yarnpkg.com/lodash.identity/-/lodash.identity-3.0.0.tgz#ad7bc6a4e647d79c972e1b80feef7af156267876" integrity sha512-AupTIzdLQxJS5wIYUQlgGyk2XRTfGXA+MCghDHqZk0pzUNYvd3EESS6dkChNauNYVIutcb0dfHw1ri9Q1yPV8Q== +lodash.includes@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/lodash.includes/-/lodash.includes-4.3.0.tgz#60bb98a87cb923c68ca1e51325483314849f553f" + integrity sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w== + +lodash.isboolean@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6" + integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg== + lodash.isequal@^4.5.0: version "4.5.0" resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== +lodash.isinteger@^4.0.4: + version "4.0.4" + resolved "https://registry.yarnpkg.com/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz#619c0af3d03f8b04c31f5882840b77b11cd68343" + integrity sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA== + +lodash.isnumber@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz#3ce76810c5928d03352301ac287317f11c0b1ffc" + integrity sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw== + +lodash.isplainobject@^4.0.6: + version "4.0.6" + resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" + integrity sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA== + +lodash.isstring@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.isstring/-/lodash.isstring-4.0.1.tgz#d527dfb5456eca7cc9bb95d5daeaf88ba54a5451" + integrity sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw== + lodash.memoize@4.x, lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" @@ -14954,7 +16143,7 @@ lodash.merge@^4.6.1, lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash.once@^4.1.1: +lodash.once@^4.0.0, lodash.once@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg== @@ -14984,7 +16173,7 @@ lodash.xorby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.xorby/-/lodash.xorby-4.7.0.tgz#9c19a6f9f063a6eb53dd03c1b6871799801463d7" integrity sha512-gYiD6nvuQy0AEkMoUju+t4f4Rn18fjsLB/7x7YZFqtFT9kmegRLrj/uGEQVyVDy7otTmSrIMXNOk2wwuLcfHCQ== -lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0: +lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.7.0, lodash@~4.17.0: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -14996,7 +16185,7 @@ log-symbols@^1.0.2: dependencies: chalk "^1.0.0" -log-symbols@^4.0.0: +log-symbols@^4.0.0, log-symbols@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503" integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg== @@ -15045,6 +16234,13 @@ loupe@^2.3.1: dependencies: get-func-name "^2.0.0" +lower-case-first@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lower-case-first/-/lower-case-first-2.0.2.tgz#64c2324a2250bf7c37c5901e76a5b5309301160b" + integrity sha512-EVm/rR94FJTZi3zefZ82fLWab+GX14LJN4HrWBcuo6Evmsl9hEfnqxgcHCKb9q+mNf6EVdsjx/qucYFIIB84pg== + dependencies: + tslib "^2.0.3" + lower-case@^1.1.1: version "1.1.4" resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" @@ -15135,7 +16331,7 @@ map-age-cleaner@^0.1.3: dependencies: p-defer "^1.0.0" -map-cache@^0.2.2: +map-cache@^0.2.0, map-cache@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/map-cache/-/map-cache-0.2.2.tgz#c32abd0bd6525d9b051645bb4f26ac5dc98a0dbf" integrity sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg== @@ -15327,6 +16523,11 @@ merge2@^1.2.3, merge2@^1.3.0, merge2@^1.4.1: resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae" integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg== +meros@^1.1.4: + version "1.2.0" + resolved "https://registry.yarnpkg.com/meros/-/meros-1.2.0.tgz#096cdede2eb0b1610b219b1031b935260de1ad08" + integrity sha512-3QRZIS707pZQnijHdhbttXRWwrHhZJ/gzolneoxKVz9N/xmsvY/7Ls8lpnI9gxbgxjcHsAVEW3mgwiZCo6kkJQ== + methods@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee" @@ -15450,6 +16651,13 @@ minimatch@3.0.5: dependencies: brace-expansion "^1.1.7" +minimatch@4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-4.2.1.tgz#40d9d511a46bdc4e563c22c3080cde9c0d8299b4" + integrity sha512-9Uq1ChtSZO+Mxa/CL1eGizn2vRn3MlLgzhT0Iz8zaY8NdvxvB0d5QdPFmCKf7JKA9Lerx5vRrnwO03jsSfGG9g== + dependencies: + brace-expansion "^1.1.7" + minimatch@^3.0.2, minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" @@ -15645,6 +16853,11 @@ multicast-dns@^7.2.5: dns-packet "^5.2.2" thunky "^1.0.2" +mute-stream@0.0.8: + version "0.0.8" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" + integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== + mz@^2.4.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -15779,6 +16992,11 @@ node-dir@^0.1.10: dependencies: minimatch "^3.0.2" +node-domexception@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5" + integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ== + node-fetch@2.6.7, node-fetch@^2.6.1, node-fetch@^2.6.7: version "2.6.7" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.7.tgz#24de9fba827e3b4ae44dc8b20256a379160052ad" @@ -15940,6 +17158,11 @@ nth-check@^2.0.1: dependencies: boolbase "^1.0.0" +nullthrows@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/nullthrows/-/nullthrows-1.1.1.tgz#7818258843856ae971eae4208ad7d7eb19a431b1" + integrity sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw== + num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -16010,6 +17233,11 @@ object-hash@^3.0.0: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-3.0.0.tgz#73f97f753e7baffc0e2cc9d6e079079744ac82e9" integrity sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw== +object-inspect@1.10.3: + version "1.10.3" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.10.3.tgz#c2aa7d2d09f50c99375704f7a0adf24c5782d369" + integrity sha512-e5mCJlSH7poANfC8z8S9s9S2IN5/4Zb3aZ33f5s8YqoazCFzNLloLU8r5VCG+G7WoqLvAAZoVMcy3tp/3X0Plw== + object-inspect@^1.12.0, object-inspect@^1.12.2, object-inspect@^1.9.0: version "1.12.2" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea" @@ -16137,6 +17365,15 @@ onetime@^5.1.0, onetime@^5.1.2: dependencies: mimic-fn "^2.1.0" +open@8.2.1: + version "8.2.1" + resolved "https://registry.yarnpkg.com/open/-/open-8.2.1.tgz#82de42da0ccbf429bc12d099dad2e0975e14e8af" + integrity sha512-rXILpcQlkF/QuFez2BJDf3GsqpjGKbkUUToAIGo9A0Q6ZkoSGogZJulrUdwRkrAsoQvoZsrjCYt8+zblOk7JQQ== + dependencies: + define-lazy-prop "^2.0.0" + is-docker "^2.1.1" + is-wsl "^2.2.0" + open@^7.0.3: version "7.4.2" resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321" @@ -16191,6 +17428,21 @@ optionator@^0.9.1: type-check "^0.4.0" word-wrap "^1.2.3" +ora@^5.4.1: + version "5.4.1" + resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" + integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== + dependencies: + bl "^4.1.0" + chalk "^4.1.0" + cli-cursor "^3.1.0" + cli-spinners "^2.5.0" + is-interactive "^1.0.0" + is-unicode-supported "^0.1.0" + log-symbols "^4.1.0" + strip-ansi "^6.0.0" + wcwidth "^1.0.1" + os-browserify@^0.3.0, os-browserify@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27" @@ -16201,6 +17453,11 @@ os-homedir@^1.0.0: resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3" integrity sha512-B5JU3cabzk8c67mRRd3ECmROafjYMXbuzlwtqdM8IbS8ktlTix8aFGb2bAGKrSRIlnfKwovGUUr72JUPyOb6kQ== +os-tmpdir@~1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/os-tmpdir/-/os-tmpdir-1.0.2.tgz#bbe67406c79aa85c5cfec766fe5734555dfa1274" + integrity sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g== + ospath@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/ospath/-/ospath-1.2.2.tgz#1276639774a3f8ef2572f7fe4280e0ea4550c07b" @@ -16244,6 +17501,13 @@ p-finally@^1.0.0: resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow== +p-limit@3.1.0, p-limit@^3.0.2: + version "3.1.0" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" + integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== + dependencies: + yocto-queue "^0.1.0" + p-limit@^2.0.0, p-limit@^2.2.0: version "2.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1" @@ -16251,13 +17515,6 @@ p-limit@^2.0.0, p-limit@^2.2.0: dependencies: p-try "^2.0.0" -p-limit@^3.0.2: - version "3.1.0" - resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.1.0.tgz#e1daccbe78d0d1388ca18c64fea38e3e57e3706b" - integrity sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ== - dependencies: - yocto-queue "^0.1.0" - p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" @@ -16392,6 +17649,15 @@ parse-entities@^2.0.0: is-decimal "^1.0.0" is-hexadecimal "^1.0.0" +parse-filepath@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/parse-filepath/-/parse-filepath-1.0.2.tgz#a632127f53aaf3d15876f5872f3ffac763d6c891" + integrity sha512-FwdRXKCohSVeXqwtYonZTXtbGJKrn+HNyWDYVcp5yuJlesTwNH4rsmRZ+GrKAPJ5bLpRxESMeS+Rl0VCHRvB2Q== + dependencies: + is-absolute "^1.0.0" + map-cache "^0.2.0" + path-root "^0.1.1" + parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -16560,6 +17826,18 @@ path-platform@~0.11.15: resolved "https://registry.yarnpkg.com/path-platform/-/path-platform-0.11.15.tgz#e864217f74c36850f0852b78dc7bf7d4a5721bf2" integrity sha512-Y30dB6rab1A/nfEKsZxmr01nUotHX0c/ZiIAsCTatEe1CmS5Pm5He7fZ195bPT7RdquoaL8lLxFCMQi/bS7IJg== +path-root-regex@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/path-root-regex/-/path-root-regex-0.1.2.tgz#bfccdc8df5b12dc52c8b43ec38d18d72c04ba96d" + integrity sha512-4GlJ6rZDhQZFE0DPVKh0e9jmZ5egZfxTkp7bcRDuPlJXbAwhxcl2dINPUAsjLdejqaLsCeg8axcLjIbvBjN4pQ== + +path-root@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/path-root/-/path-root-0.1.1.tgz#9a4a6814cac1c0cd73360a95f32083c8ea4745b7" + integrity sha512-QLcPegTHF11axjfojBIoDygmS2E3Lf+8+jI6wOVmNVenrKSo3mFdSGiIgdSHenczw3wPtlVMQaFVwGmM7BJdtg== + dependencies: + path-root-regex "^0.1.0" + path-strip-sep@^1.0.13: version "1.0.13" resolved "https://registry.yarnpkg.com/path-strip-sep/-/path-strip-sep-1.0.13.tgz#c692da0ab2fca42e76b7f985be2129eb4b648bb1" @@ -17290,6 +18568,13 @@ promise.series@^0.2.0: resolved "https://registry.yarnpkg.com/promise.series/-/promise.series-0.2.0.tgz#2cc7ebe959fc3a6619c04ab4dbdc9e452d864bbd" integrity sha512-VWQJyU2bcDTgZw8kpfBpB/ejZASlCrzwz5f2hjb/zlujOEB4oeiAhHygAWq8ubsX2GVkD4kCU5V2dwOTaCY5EQ== +promise@^7.1.1: + version "7.3.1" + resolved "https://registry.yarnpkg.com/promise/-/promise-7.3.1.tgz#064b72602b18f90f29192b8b1bc418ffd1ebd3bf" + integrity sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg== + dependencies: + asap "~2.0.3" + prompts@^2.0.1, prompts@^2.4.0: version "2.4.2" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.4.2.tgz#7b57e73b3a48029ad10ebd44f74b01722a4cb069" @@ -17404,6 +18689,18 @@ punycode@^2.1.0, punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== +pvtsutils@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/pvtsutils/-/pvtsutils-1.3.2.tgz#9f8570d132cdd3c27ab7d51a2799239bf8d8d5de" + integrity sha512-+Ipe2iNUyrZz+8K/2IOo+kKikdtfhRKzNpQbruF2URmqPtoqAs8g3xS7TJvFF2GcPXjh7DkqMnpVveRFq4PgEQ== + dependencies: + tslib "^2.4.0" + +pvutils@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/pvutils/-/pvutils-1.1.3.tgz#f35fc1d27e7cd3dfbd39c0826d173e806a03f5a3" + integrity sha512-pMpnA0qRdFp32b1sJl1wOJNxZLQ2cbQx+k6tjNtZ8CpvVhNqEPRgivZ2WOUev2YMajecdH7ctUPDvEe87nariQ== + q@^1.1.2, q@^1.5.1: version "1.5.1" resolved "https://registry.yarnpkg.com/q/-/q-1.5.1.tgz#7e32f75b41381291d04611f1bf14109ac00651d7" @@ -18042,6 +19339,15 @@ relateurl@^0.2.7: resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog== +relay-runtime@12.0.0: + version "12.0.0" + resolved "https://registry.yarnpkg.com/relay-runtime/-/relay-runtime-12.0.0.tgz#1e039282bdb5e0c1b9a7dc7f6b9a09d4f4ff8237" + integrity sha512-QU6JKr1tMsry22DXNy9Whsq5rmvwr3LSZiiWV/9+DFpuTWvp+WFhobWMc8TC4OjKFfNhEZy7mOiqUAn5atQtug== + dependencies: + "@babel/runtime" "^7.0.0" + fbjs "^3.0.0" + invariant "^2.2.4" + remark-external-links@^8.0.0: version "8.0.0" resolved "https://registry.yarnpkg.com/remark-external-links/-/remark-external-links-8.0.0.tgz#308de69482958b5d1cd3692bc9b725ce0240f345" @@ -18110,11 +19416,21 @@ remark-squeeze-paragraphs@4.0.0: dependencies: mdast-squeeze-paragraphs "^4.0.0" +remedial@^1.0.7: + version "1.0.8" + resolved "https://registry.yarnpkg.com/remedial/-/remedial-1.0.8.tgz#a5e4fd52a0e4956adbaf62da63a5a46a78c578a0" + integrity sha512-/62tYiOe6DzS5BqVsNpH/nkGlX45C/Sp6V+NtiN6JQNS1Viay7cWkazmRkrQrdFj2eshDe96SIQNIoMxqhzBOg== + remove-trailing-separator@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz#c24bce2a283adad5bc3f58e0d48249b92379d8ef" integrity sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw== +remove-trailing-spaces@^1.0.6: + version "1.0.8" + resolved "https://registry.yarnpkg.com/remove-trailing-spaces/-/remove-trailing-spaces-1.0.8.tgz#4354d22f3236374702f58ee373168f6d6887ada7" + integrity sha512-O3vsMYfWighyFbTd8hk8VaSj9UAGENxAtX+//ugIst2RMk5e03h6RoIS+0ylsFxY1gvmPuAY/PO4It+gPEeySA== + renderkid@^2.0.4: version "2.0.7" resolved "https://registry.yarnpkg.com/renderkid/-/renderkid-2.0.7.tgz#464f276a6bdcee606f4a15993f9b29fc74ca8609" @@ -18388,6 +19704,11 @@ rsvp@^4.8.4: resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== +run-async@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" + integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== + run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -18571,6 +19892,11 @@ scrypt-js@3.0.1: resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== +scuid@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/scuid/-/scuid-1.1.0.tgz#d3f9f920956e737a60f72d0e4ad280bf324d5dab" + integrity sha512-MuCAyrGZcTLfQoH2XoBlQ8C6bzwN88XT/0slOGz0pn8+gIP85BOAfYa44ZXQUTOwRwPU0QvgU+V+OSajl/59Xg== + secure-compare@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" @@ -18737,7 +20063,7 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" -setimmediate@^1.0.4: +setimmediate@^1.0.4, setimmediate@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" integrity sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA== @@ -18839,6 +20165,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== +signedsource@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a" + integrity sha512-6+eerH9fEnNmi/hyM1DXcRK3pWdoMQtlkQ+ns0ntzunjKqp5i3sKCc80ym8Fib3iaYhdJUOPdhlJWj1tvge2Ww== + simple-concat@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/simple-concat/-/simple-concat-1.0.1.tgz#f46976082ba35c2263f1c8ab5edfe26c41c9552f" @@ -19104,6 +20435,13 @@ split2@^3.0.0: dependencies: readable-stream "^3.0.0" +sponge-case@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/sponge-case/-/sponge-case-1.0.1.tgz#260833b86453883d974f84854cdb63aecc5aef4c" + integrity sha512-dblb9Et4DAtiZ5YSUZHLl4XhH4uK80GhAZrVXdN4O2P4gQ40Wa5UIOPUHlA/nFd2PLblBZWUioLMMAVrgpoYcA== + dependencies: + tslib "^2.0.3" + sprintf-js@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.1.2.tgz#da1765262bf8c0f571749f2ad6c26300207ae673" @@ -19212,6 +20550,13 @@ statuses@2.0.1: resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.5.0.tgz#161c7dac177659fd9811f43771fa99381478628c" integrity sha512-OpZ3zP+jT1PI7I8nemJX4AKmAX070ZkYPVWV/AaKTJl+tXCTGyVdC1a4SL8RUQYEwk/f34ZX8UTykN68FwrqAA== +std-env@2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/std-env/-/std-env-2.3.0.tgz#66d4a4a4d5224242ed8e43f5d65cfa9095216eee" + integrity sha512-4qT5B45+Kjef2Z6pE0BkskzsH0GO7GrND0wGlTM1ioUe3v0dGYx9ZJH0Aro/YyA8fqQ5EyIKDRjZojJYMFTflw== + dependencies: + ci-info "^3.0.0" + store2@^2.12.0: version "2.14.2" resolved "https://registry.yarnpkg.com/store2/-/store2-2.14.2.tgz#56138d200f9fe5f582ad63bc2704dbc0e4a45068" @@ -19297,6 +20642,11 @@ stream-splicer@^2.0.0: inherits "^2.0.1" readable-stream "^2.0.2" +streamsearch@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/streamsearch/-/streamsearch-1.1.0.tgz#404dd1e2247ca94af554e841a8ef0eaa238da764" + integrity sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg== + strict-uri-encode@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" @@ -19312,6 +20662,11 @@ string-argv@^0.3.1: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== +string-env-interpolation@1.0.1, string-env-interpolation@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" + integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== + string-hash@^1.1.1: version "1.1.3" resolved "https://registry.yarnpkg.com/string-hash/-/string-hash-1.1.3.tgz#e8aafc0ac1855b4666929ed7dd1275df5d6c811b" @@ -19676,6 +21031,13 @@ svgo@^2.7.0, svgo@^2.8.0: picocolors "^1.0.0" stable "^0.1.8" +swap-case@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/swap-case/-/swap-case-2.0.2.tgz#671aedb3c9c137e2985ef51c51f9e98445bf70d9" + integrity sha512-kc6S2YS/2yXbtkSMunBtKdah4VFETZ8Oh6ONSmSd9bRxhqTrtARUCBUiWXH3xVPpvR7tz2CSnkuXVE42EcGnMw== + dependencies: + tslib "^2.0.3" + symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" @@ -19930,7 +21292,7 @@ through2@^4.0.0, through2@^4.0.2: dependencies: readable-stream "3" -"through@>=2.2.7 <3", through@^2.3.8: +"through@>=2.2.7 <3", through@^2.3.6, through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== @@ -19962,6 +21324,20 @@ title-case@^2.1.1: no-case "^2.2.0" upper-case "^1.0.3" +title-case@^3.0.3: + version "3.0.3" + resolved "https://registry.yarnpkg.com/title-case/-/title-case-3.0.3.tgz#bc689b46f02e411f1d1e1d081f7c3deca0489982" + integrity sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA== + dependencies: + tslib "^2.0.3" + +tmp@^0.0.33: + version "0.0.33" + resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.0.33.tgz#6d34335889768d21b2bcda0aa277ced3b1bfadf9" + integrity sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw== + dependencies: + os-tmpdir "~1.0.2" + tmp@~0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/tmp/-/tmp-0.2.1.tgz#8457fc3037dcf4719c251367a1af6500ee1ccf14" @@ -20129,6 +21505,11 @@ ts-loader@^9.3.1: micromatch "^4.0.0" semver "^7.3.4" +ts-log@^2.2.3: + version "2.2.4" + resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.2.4.tgz#d672cf904b33735eaba67a7395c93d45fba475b3" + integrity sha512-DEQrfv6l7IvN2jlzc/VTdZJYsWUnQNCsueYjMkC/iXoEoi5fNan6MjeDqkvhfzbmHgdz9UxDUluX3V5HdjTydQ== + ts-node@10.9.1, ts-node@^10.8.1: version "10.9.1" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.1.tgz#e73de9102958af9e1f0b168a6ff320e25adcff4b" @@ -20184,16 +21565,16 @@ tsconfig-paths@^3.11.0, tsconfig-paths@^3.14.1, tsconfig-paths@^3.9.0: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.4.0, tslib@^2, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0, tslib@~2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.3.1, tslib@^2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - tslib@~2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" @@ -20337,6 +21718,11 @@ typescript@^4.1.2, typescript@^4.4.3: resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.8.2.tgz#e3b33d5ccfb5914e4eeab6699cf208adee3fd790" integrity sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw== +ua-parser-js@^0.7.30: + version "0.7.31" + resolved "https://registry.yarnpkg.com/ua-parser-js/-/ua-parser-js-0.7.31.tgz#649a656b191dffab4f21d5e053e27ca17cbff5c6" + integrity sha512-qLK/Xe9E2uzmYI3qLeOmI0tEOt+TBBQyUIAh4aAgU05FVYzeZrKUdkAZfBNVGRaHVgV0TDkdEngJSw/SyQchkQ== + uglify-js@^3.1.4: version "3.17.0" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.0.tgz#55bd6e9d19ce5eef0d5ad17cd1f587d85b180a85" @@ -20357,6 +21743,11 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" +unc-path-regex@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/unc-path-regex/-/unc-path-regex-0.1.2.tgz#e73dd3d7b0d7c5ed86fbac6b0ae7d8c6a69d50fa" + integrity sha512-eXL4nmJT7oCpkZsHZUOJo8hcX3GbsiDOa0Qu9F646fi8dT3XuSVopVqAcEiVzSKKH7UoDti23wNX3qGFxcW5Qg== + undeclared-identifiers@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/undeclared-identifiers/-/undeclared-identifiers-1.1.3.tgz#9254c1d37bdac0ac2b52de4b6722792d2a91e30f" @@ -20368,6 +21759,11 @@ undeclared-identifiers@^1.1.2: simple-concat "^1.0.0" xtend "^4.0.1" +undici@^5.0.0, undici@^5.8.0: + version "5.10.0" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.10.0.tgz#dd9391087a90ccfbd007568db458674232ebf014" + integrity sha512-c8HsD3IbwmjjbLvoZuRI26TZic+TSEe8FPMLLOkN1AfYRhdjnKBU6yL+IwcSCbdZiX4e5t0lfMDLDCqj4Sq70g== + unfetch@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/unfetch/-/unfetch-4.2.0.tgz#7e21b0ef7d363d8d9af0fb929a5555f6ef97a3be" @@ -20520,6 +21916,13 @@ universalify@^2.0.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-2.0.0.tgz#75a4984efedc4b08975c5aeb73f530d02df25717" integrity sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ== +unixify@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unixify/-/unixify-1.0.0.tgz#3a641c8c2ffbce4da683a5c70f03a462940c2090" + integrity sha512-6bc58dPYhCMHHuwxldQxO3RRNZ4eCogZ/st++0+fcC1nr0jiGUtAdBJ2qzmLQWSxbtz42pWt4QQMiZ9HvZf5cg== + dependencies: + normalize-path "^2.1.1" + unpipe@1.0.0, unpipe@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" @@ -20813,6 +22216,11 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +value-or-promise@1.0.11, value-or-promise@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/value-or-promise/-/value-or-promise-1.0.11.tgz#3e90299af31dd014fe843fe309cefa7c1d94b140" + integrity sha512-41BrgH+dIbCFXClcSapVs5M6GkENd3gQOJpEfPDNa71LsUGMXDL0jMWpI/Rh7WhX+Aalfz2TTS3Zt5pUsbnhLg== + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -20971,16 +22379,44 @@ wbuf@^1.1.0, wbuf@^1.7.3: dependencies: minimalistic-assert "^1.0.0" +wcwidth@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/wcwidth/-/wcwidth-1.0.1.tgz#f0b0dcf915bc5ff1528afadb2c0e17b532da2fe8" + integrity sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg== + dependencies: + defaults "^1.0.3" + web-namespaces@^1.0.0: version "1.1.4" resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec" integrity sha512-wYxSGajtmoP4WxfejAPIr4l0fVh+jeMXZb08wNc0tMg6xsfZXj3cECqIK0G7ZAqUq0PP8WlMDtaOGVBTAWztNw== +web-streams-polyfill@4.0.0-beta.3: + version "4.0.0-beta.3" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-4.0.0-beta.3.tgz#2898486b74f5156095e473efe989dcf185047a38" + integrity sha512-QW95TCTaHmsYfHDybGMwO5IJIM93I/6vTRk+daHTWFPhwh+C8Cg7j7XyKrwrj8Ib6vYXe0ocYNrmzY4xAAN6ug== + +web-streams-polyfill@^3.2.0: + version "3.2.1" + resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.2.1.tgz#71c2718c52b45fd49dbeee88634b3a60ceab42a6" + integrity sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q== + web-vitals@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/web-vitals/-/web-vitals-2.1.4.tgz#76563175a475a5e835264d373704f9dde718290c" integrity sha512-sVWcwhU5mX6crfI5Vd2dC4qchyTqxV8URinzt25XqVh+bHEPGH4C3NPrNionCP7Obx59wrYEbNlw4Z8sjALzZg== +webcrypto-core@^1.7.4: + version "1.7.5" + resolved "https://registry.yarnpkg.com/webcrypto-core/-/webcrypto-core-1.7.5.tgz#c02104c953ca7107557f9c165d194c6316587ca4" + integrity sha512-gaExY2/3EHQlRNNNVSrbG2Cg94Rutl7fAaKILS1w8ZDhGxdFOaw6EbCfHIxPy9vt/xwp5o0VQAx9aySPF6hU1A== + dependencies: + "@peculiar/asn1-schema" "^2.1.6" + "@peculiar/json-schema" "^1.1.12" + asn1js "^3.0.1" + pvtsutils "^1.3.2" + tslib "^2.4.0" + webidl-conversions@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" @@ -21219,6 +22655,11 @@ whatwg-encoding@^2.0.0: dependencies: iconv-lite "0.6.3" +whatwg-fetch@^3.4.1: + version "3.6.2" + resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.2.tgz#dced24f37f2624ed0281725d51d0e2e3fe677f8c" + integrity sha512-bJlen0FcuU/0EMLrdbJ7zOnW6ITZLrZMIarMUVmdKtsGvZna8vxKYaexICWPfZ8qwf9fzNq+UEIZrnSaApt6RA== + whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" @@ -21391,7 +22832,7 @@ ws@^7.4.0, ws@^7.4.6: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -ws@^8.2.3, ws@^8.4.2: +ws@^8.2.3, ws@^8.3.0, ws@^8.4.2: version "8.8.1" resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.1.tgz#5dbad0feb7ade8ecc99b830c1d77c913d4955ff0" integrity sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA== @@ -21438,6 +22879,11 @@ yallist@^4.0.0: resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A== +yaml-ast-parser@^0.0.43: + version "0.0.43" + resolved "https://registry.yarnpkg.com/yaml-ast-parser/-/yaml-ast-parser-0.0.43.tgz#e8a23e6fb4c38076ab92995c5dca33f3d3d7c9bb" + integrity sha512-2PTINUwsRqSd+s8XxKaJWQlUuEMHJQyEuh2edBbW8KNJz0SJPwUSD2zRWqezFEdN7IzAgeuYHFUCF7o8zRdZ0A== + yaml@^1.10.0, yaml@^1.10.2, yaml@^1.7.2: version "1.10.2" resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" @@ -21466,6 +22912,27 @@ yargs-parser@^13.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^18.1.2: + version "18.1.3" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" + integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + +yargs@17.2.1: + version "17.2.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.2.1.tgz#e2c95b9796a0e1f7f3bf4427863b42e0418191ea" + integrity sha512-XfR8du6ua4K6uLGm5S6fA+FIJom/MdJcFNVY8geLlp2v8GYbOXD4EB1tPNZsRn4vBzKGMgb5DRZMeWuFc2GO8Q== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2" + yargs@^13.2.4: version "13.3.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.2.tgz#ad7ffefec1aa59565ac915f82dccb38a9c31a2dd" @@ -21482,6 +22949,23 @@ yargs@^13.2.4: y18n "^4.0.0" yargs-parser "^13.1.2" +yargs@^15.3.1: + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== + dependencies: + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" + get-caller-file "^2.0.1" + require-directory "^2.1.1" + require-main-filename "^2.0.0" + set-blocking "^2.0.0" + string-width "^4.2.0" + which-module "^2.0.0" + y18n "^4.0.0" + yargs-parser "^18.1.2" + yargs@^16.2.0: version "16.2.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" From a5f21ed1f8fd8df52ce94c569139d0969d43e9a5 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 6 Sep 2022 02:10:31 -0700 Subject: [PATCH 06/66] fix: styles on staking and nodes page (#1252) --- .../components/token-input/token-input.tsx | 20 +++++++++---------- .../staking/associate/associate-page.tsx | 2 +- .../token/src/routes/staking/staking-node.tsx | 6 +++--- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/apps/token/src/components/token-input/token-input.tsx b/apps/token/src/components/token-input/token-input.tsx index 0a22d703a..d8c8c9f31 100644 --- a/apps/token/src/components/token-input/token-input.tsx +++ b/apps/token/src/components/token-input/token-input.tsx @@ -37,7 +37,7 @@ export const AmountInput = ({ }) => { const { t } = useTranslation(); return ( -
    +
    {maximum && ( -
    - setAmount(maximum.toString())} - data-testid="token-amount-use-maximum" - > - {t('Use maximum')} - -
    + setAmount(maximum.toString())} + data-testid="token-amount-use-maximum" + > + {t('Use maximum')} + )}
    ); @@ -169,7 +167,7 @@ export const TokenInput = ({ } else if (requireApproval) { approveContent = ( -

    {`${currency} are approved for staking`}

    +

    {`${currency} are approved for staking`}

    ); } @@ -188,7 +186,7 @@ export const TokenInput = ({ currency={currency} /> - {approveContent ?
    {approveContent}
    : null} + {approveContent ?
    {approveContent}
    : null} ); diff --git a/libs/positions/src/lib/positions.tsx b/libs/positions/src/lib/positions.tsx index 4b5d19146..d1e140dd4 100644 --- a/libs/positions/src/lib/positions.tsx +++ b/libs/positions/src/lib/positions.tsx @@ -88,7 +88,7 @@ export const Positions = memo(

    {assetSymbol} {t('balance')}: - +

    From bc1324aafe25cd890a26bbd7b8afacc71d0bd8d4 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 6 Sep 2022 18:04:20 +0000 Subject: [PATCH 11/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 67 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 2503d77c5..7ba783fd0 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -212,7 +212,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107817.991820832061674255", + "locked_amount": "107758.86946181505231363", "deposits": [ { "amount": "129999.45", @@ -278,7 +278,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "52095.07269152714454", + "locked_amount": "52059.1570459157799", "deposits": [ { "amount": "2600", @@ -662,7 +662,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48981.607898902819430088", + "locked_amount": "48923.614372203986931468", "deposits": [ { "amount": "97499.58", @@ -695,7 +695,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66949.401675974450950079446404", + "locked_amount": "66870.13453714186899087668292", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +728,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20605.716575944055104636", + "locked_amount": "20581.319700756496647374", "deposits": [ { "amount": "32499.86", @@ -761,7 +761,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6706.960792329111631629", + "locked_amount": "6699.019846197235048115", "deposits": [ { "amount": "10833.29", @@ -869,7 +869,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "6786.22339221014475", + "locked_amount": "6755.7475656702909", "deposits": [ { "amount": "15000", @@ -955,7 +955,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1427023.151761165503924288", + "locked_amount": "1425698.555179273897239094", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1241,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "34068.42196306360675", + "locked_amount": "34010.85651293277", "deposits": [ { "amount": "12500", @@ -2108,7 +2108,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3670.0303052584902947077793541919", + "locked_amount": "3631.1022846232192662012305942152", "deposits": [ { "amount": "2833.333333", @@ -22226,7 +22226,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2217339.07229426721080078036", + "locked_amount": "2215303.62852344718856886384", "deposits": [ { "amount": "1998.95815", @@ -23083,7 +23083,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "189007.2794439529561444", - "locked_amount": "13094843.3295161746424161375371859067369559", + "locked_amount": "13087662.7280643716906036642895798674357934", "deposits": [ { "amount": "16249.93", @@ -26090,7 +26090,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2723934.159961250204160197", - "locked_amount": "6429841.070384883391980254121700335", + "locked_amount": "6423177.87161056078238550768788919", "deposits": [ { "amount": "129284.449", @@ -31161,8 +31161,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1733643.914423703455421207", - "locked_amount": "2223565.56846180038594373872394057", + "total_removed": "1738566.199331512609572207", + "locked_amount": "2220933.02058948993232856996014257", "deposits": [ { "amount": "552496.6455", @@ -31326,6 +31326,11 @@ "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", "tx": "0xfb1b77baaf2cbb53d3bf17c91c3dd1da059cd4b99413598693606a4f1a2d4199" }, + { + "amount": "4922.284907809154151", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tx": "0xb34ad795d45f3428f8447ab1573fe696a946897cc7a6f5e2e2c17441821ad8d0" + }, { "amount": "1729.052213861087673", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -32348,6 +32353,12 @@ "tranche_id": 4, "tx": "0xf5651536b3fb0d1978a524b696a0fc8ce860afae23b42e7bc2a9601816c5c24b" }, + { + "amount": "4922.284907809154151", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tranche_id": 4, + "tx": "0xb34ad795d45f3428f8447ab1573fe696a946897cc7a6f5e2e2c17441821ad8d0" + }, { "amount": "1729.052213861087673", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -32470,8 +32481,8 @@ } ], "total_tokens": "331498.5873", - "withdrawn_tokens": "199075.693782538816896", - "remaining_tokens": "132422.893517461183104" + "withdrawn_tokens": "203997.978690347971047", + "remaining_tokens": "127500.608609652028953" }, { "address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77", @@ -32560,7 +32571,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "351350.03587722759780088906544904", + "locked_amount": "351027.5231549470388454711618468", "deposits": [ { "amount": "3000", @@ -59043,7 +59054,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "51854.1080369557989", + "total_removed": "52104.1080369557989", "locked_amount": "0", "deposits": [ { @@ -63323,6 +63334,11 @@ "user": "0x962b86Bd4F921187F730457FE2F8335e263e6B2F", "tx": "0xd8aa0f4a543639c76c1e72d550d83c1bdb628058901938b39b24a5b967f89cee" }, + { + "amount": "250", + "user": "0x7E9bA4D3654ae2a8C4B15AAdee8f144Ba7eD68c4", + "tx": "0x66f286158f3b5ba4b16688b1841ebde4060fc14ce3b5c163b5c58c1806b1f221" + }, { "amount": "250", "user": "0x9A453696D38e0e42b11AC30Be8C3A100eDDA5f53", @@ -77794,10 +77810,17 @@ "tx": "0x3a0390dffa4280c286016566b29c62e4cec36c6504f7ac3d1de80d22b2903008" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x7E9bA4D3654ae2a8C4B15AAdee8f144Ba7eD68c4", + "tranche_id": 6, + "tx": "0x66f286158f3b5ba4b16688b1841ebde4060fc14ce3b5c163b5c58c1806b1f221" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x57972Ce9730F16a9ef636fD34429f69Bc0F353De", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index a00cc1151..effa63fd9 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "98.32505010147130990009735153475393199", + "locked_amount": "97.6353510273973170000966686643835617", "deposits": [ { "amount": "1000", From 002b11eb4a7dee2d1ec3d80ea31409a9db383bca Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 7 Sep 2022 00:08:41 +0000 Subject: [PATCH 12/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 84 ++++++++++++++------ apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 7ba783fd0..06f3308b4 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -212,7 +212,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107758.86946181505231363", + "locked_amount": "107698.843779707140660455", "deposits": [ { "amount": "129999.45", @@ -278,7 +278,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "52059.1570459157799", + "locked_amount": "52022.69264967021724", "deposits": [ { "amount": "2600", @@ -662,7 +662,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48923.614372203986931468", + "locked_amount": "48864.734769701339049258", "deposits": [ { "amount": "97499.58", @@ -695,7 +695,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66870.13453714186899087668292", + "locked_amount": "66789.6562856600460968493066", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +728,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20581.319700756496647374", + "locked_amount": "20556.55006877998265952", "deposits": [ { "amount": "32499.86", @@ -761,7 +761,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6699.019846197235048115", + "locked_amount": "6690.957571347698693174", "deposits": [ { "amount": "10833.29", @@ -869,7 +869,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "6755.7475656702909", + "locked_amount": "6724.80610280797275", "deposits": [ { "amount": "15000", @@ -955,7 +955,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1425698.555179273897239094", + "locked_amount": "1424353.720252727652881636", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1241,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "34010.85651293277", + "locked_amount": "33952.4115275261665", "deposits": [ { "amount": "12500", @@ -2108,7 +2108,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3631.1022846232192662012305942152", + "locked_amount": "3591.57948765445755651007041928775", "deposits": [ { "amount": "2833.333333", @@ -5831,7 +5831,7 @@ "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "35910.000000000000000003", - "total_removed": "16746.59106856284", + "total_removed": "16791.59106856284", "locked_amount": "0", "deposits": [ { @@ -11906,6 +11906,11 @@ "user": "0x78F9D0EcdDE97c1cAa507E49a3B5b22d1b60a674", "tx": "0x7aa284f9f9772a9fd308d4d1208dd02228428dfe8630020b8e841131b8647a46" }, + { + "amount": "45", + "user": "0x5CB43a4d38714B23112F884D6c8B4725c6fc4534", + "tx": "0x0430c0285ab80a4afe7d9ec9c5f6d744fca47ffb40da848a6a1313ac70d6023a" + }, { "amount": "3.678519786", "user": "0xc5467213593778E528f0eB8117cc7AFBC5b7491b", @@ -16320,10 +16325,17 @@ "tx": "0x998b804da42b26f962aea89fe7e7545a3b12c2ea33620f015d6af7baa00eca43" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "45", + "user": "0x5CB43a4d38714B23112F884D6c8B4725c6fc4534", + "tranche_id": 11, + "tx": "0x0430c0285ab80a4afe7d9ec9c5f6d744fca47ffb40da848a6a1313ac70d6023a" + } + ], "total_tokens": "45", - "withdrawn_tokens": "0", - "remaining_tokens": "45" + "withdrawn_tokens": "45", + "remaining_tokens": "0" }, { "address": "0xb99dE8d636Be333Ec5C8Ce1476e9b6FE7877F02a", @@ -22226,7 +22238,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2215303.62852344718856886384", + "locked_amount": "2213237.08546313728141497711", "deposits": [ { "amount": "1998.95815", @@ -23082,8 +23094,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "189007.2794439529561444", - "locked_amount": "13087662.7280643716906036642895798674357934", + "total_removed": "189184.1028716497150444", + "locked_amount": "13080372.4151056900296870493535345794660719", "deposits": [ { "amount": "16249.93", @@ -23667,6 +23679,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x60b78351e0667b1c1cff667a84e4b0b1cd29b1c5ecee8e3de592ea81166958fe" }, + { + "amount": "176.8234276967589", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xf37aa848c357e251da436706cf8976171a8141e31fe3d2b6b90c519fb5e28c6e" + }, { "amount": "253.966945001875125", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24175,6 +24192,12 @@ "tranche_id": 2, "tx": "0x60b78351e0667b1c1cff667a84e4b0b1cd29b1c5ecee8e3de592ea81166958fe" }, + { + "amount": "176.8234276967589", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xf37aa848c357e251da436706cf8976171a8141e31fe3d2b6b90c519fb5e28c6e" + }, { "amount": "253.966945001875125", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24549,8 +24572,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "33217.6983109748484", - "remaining_tokens": "161781.4691890251516" + "withdrawn_tokens": "33394.5217386716073", + "remaining_tokens": "161604.6457613283927" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26089,8 +26112,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2723934.159961250204160197", - "locked_amount": "6423177.87161056078238550768788919", + "total_removed": "2724259.594291574628633947", + "locked_amount": "6416412.86665982287988434672884879", "deposits": [ { "amount": "129284.449", @@ -26369,6 +26392,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x5afda258c29ba6cd1e54d2b04fe6ebadc2a5d7650dd477b25291bdeeea468c8b" }, + { + "amount": "325.43433032442447375", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x453738b2f8fbd7d2c25f32200d27bbd13c15bb92a38879cd6ea854805a5b38bd" + }, { "amount": "469.2149598263806575", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28439,6 +28467,12 @@ "tranche_id": 3, "tx": "0x5afda258c29ba6cd1e54d2b04fe6ebadc2a5d7650dd477b25291bdeeea468c8b" }, + { + "amount": "325.43433032442447375", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x453738b2f8fbd7d2c25f32200d27bbd13c15bb92a38879cd6ea854805a5b38bd" + }, { "amount": "469.2149598263806575", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30079,8 +30113,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "200840.963575101642208", - "remaining_tokens": "158282.505999898357792" + "withdrawn_tokens": "201166.39790542606668175", + "remaining_tokens": "157957.07166957393331825" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31162,7 +31196,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2220933.02058948993232856996014257", + "locked_amount": "2218260.1262190444228969246950345", "deposits": [ { "amount": "552496.6455", @@ -32571,7 +32605,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "351027.5231549470388454711618468", + "locked_amount": "350700.0675941771543713869507864", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index effa63fd9..134d16954 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "97.6353510273973170000966686643835617", + "locked_amount": "96.93517916032470580009597542491121258", "deposits": [ { "amount": "1000", From 925c1721aacdc1427b4f659bc4ee7eb6a9b0d1b6 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 7 Sep 2022 06:26:40 +0000 Subject: [PATCH 13/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 06f3308b4..8d016d0bc 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -212,7 +212,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107698.843779707140660455", + "locked_amount": "107636.57489101783054236", "deposits": [ { "amount": "129999.45", @@ -278,7 +278,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "52022.69264967021724", + "locked_amount": "51984.86555048198776", "deposits": [ { "amount": "2600", @@ -662,7 +662,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48864.734769701339049258", + "locked_amount": "48803.65479050649299889", "deposits": [ { "amount": "97499.58", @@ -695,7 +695,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66789.6562856600460968493066", + "locked_amount": "66706.170499119191297676703152", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +728,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20556.55006877998265952", + "locked_amount": "20530.85477632753436021", "deposits": [ { "amount": "32499.86", @@ -761,7 +761,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6690.957571347698693174", + "locked_amount": "6682.594002995642335695", "deposits": [ { "amount": "10833.29", @@ -869,7 +869,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "6724.80610280797275", + "locked_amount": "6692.70833333333325", "deposits": [ { "amount": "15000", @@ -955,7 +955,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1424353.720252727652881636", + "locked_amount": "1422958.627795535038162474", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1241,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33952.4115275261665", + "locked_amount": "33891.78240740740725", "deposits": [ { "amount": "12500", @@ -2108,7 +2108,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3591.57948765445755651007041928775", + "locked_amount": "3550.5796929213776221636593856094", "deposits": [ { "amount": "2833.333333", @@ -22238,7 +22238,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2213237.08546313728141497711", + "locked_amount": "2211093.31407603733441220146", "deposits": [ { "amount": "1998.95815", @@ -23095,7 +23095,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", "total_removed": "189184.1028716497150444", - "locked_amount": "13080372.4151056900296870493535345794660719", + "locked_amount": "13072809.6574627485670984633923457159881048", "deposits": [ { "amount": "16249.93", @@ -26113,7 +26113,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2724259.594291574628633947", - "locked_amount": "6416412.86665982287988434672884879", + "locked_amount": "6409395.04819500765351778816691193", "deposits": [ { "amount": "129284.449", @@ -31196,7 +31196,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2218260.1262190444228969246950345", + "locked_amount": "2215487.343700183750010612117323019", "deposits": [ { "amount": "552496.6455", @@ -32605,7 +32605,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "350700.0675941771543713869507864", + "locked_amount": "350360.37476357149624216949974632", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 134d16954..9c70f0d6e 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "96.93517916032470580009597542491121258", + "locked_amount": "96.2088413242009280000952562785388128", "deposits": [ { "amount": "1000", From e06b5e741cadffa868bc72bdd8c2e3d23f6713f7 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 7 Sep 2022 09:05:02 +0100 Subject: [PATCH 14/66] chore: fix test manual and nightly workflows (#1264) --- .github/workflows/capsule-cypress-manual-trigger.yml | 2 ++ .github/workflows/capsule-cypress-night-run.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 663b92098..b83ea9466 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -130,9 +130,11 @@ jobs: - name: Install root dependencies run: yarn install + working-directory: frontend-monorepo - name: Run Cypress tests run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome + working-directory: frontend-monorepo env: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index af018168d..846558238 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -114,9 +114,11 @@ jobs: - name: Install root dependencies run: yarn install + working-directory: frontend-monorepo - name: Run Cypress tests run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome + working-directory: frontend-monorepo env: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} From fa6ddcfdf15f8114f3841f8a69e98aa4f2affdc1 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:26:26 +0100 Subject: [PATCH 15/66] Chore/use vega 0.54.0 (#1268) * chore: change vega version to use 0.54.0 * chore: update remaining workflows --- .github/workflows/capsule-cypress-manual-trigger.yml | 2 +- .github/workflows/capsule-cypress-night-run.yml | 2 +- .github/workflows/capsule-cypress.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index b83ea9466..05c9377a2 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -78,7 +78,7 @@ jobs: uses: actions/checkout@v2 with: repository: vegaprotocol/vega - ref: develop + ref: v0.54.0 token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 846558238..769062af2 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -62,7 +62,7 @@ jobs: uses: actions/checkout@v2 with: repository: vegaprotocol/vega - ref: develop + ref: v0.54.0 token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index 0414d9258..74bbe04d6 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -69,7 +69,7 @@ jobs: uses: actions/checkout@v2 with: repository: vegaprotocol/vega - ref: develop + ref: v0.54.0 token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' From cae6162a7f9592bb9f87438d368c5089cfde8ed0 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Wed, 7 Sep 2022 12:05:28 +0100 Subject: [PATCH 16/66] feat: liquidity provisions view (#1133) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(#473): add positions metrics data provider * feat(#473) add positions stats * feat(#473) add positions stats * feat(#473): add positions stats * feat(#473): add positions stats * feat(#473): position metrics, test and refactoring * feat(#473): add unit tests to positions table * feat(#473): fix spelling, order positions by updated at desc * feat(#473): protect from division by 0 * feat(#473): fix trading positions e2e tests * feat(#473): fix e2e data mocks * feat(#473): post code review clean up * feat(#993): dependencies handling in data provider * feat(#993): fix e2e tests data mocks * feat(#993): remove position metrics mocks, add market data market id * feat: #994 add price monitoring bounds and candles update interface * fix: move best bid price to diff section * feat(#993): add missing mocks, fix combine function * fix: add insurance pool and calc volume 24h * feat: display some oracle min info, asset id, insurance pool, move open interest and 24hVol * fix: add market-info.cy.ts case * fix: remove # from numbered price monitoring settings * fix: add insurance pool test * fix: format 24hvol * feat(#993): set loading initially to true, add unit tests * feat(#993): cleanup, add comments * feat(#993): remove undefined from client type * fix: remove indicativeVolume and oracleSpecBinding from market info * feat(#993): cosmetic changes * fix: add oracleSpecBinding back * Update libs/deal-ticket/src/components/info-market.tsx Co-authored-by: botond <105208209+notbot00@users.noreply.github.com> * feat: add initial queries * fix: memo yesterday's timestamp * fix: add back info * fix: update query * fix: add view full oracle details link and update mappings * fix: regen code, make link reactnode, fix index.ts * feat: add liquidity lib, refactor info market * fix: remove liquidity query from deal-ticket * feat:(#993): pass informaton about update callback cause * fix: small ui tweaks * fix: display in grid * feat: navigate to oracle by termination id * feat: #491 add use liquidity provision merging * fix: remove logs, add extra check on my liquidity provision * fix: type number trivially inferred from a number literal, remove type annotation * fix: cypress tests and formatting for market info * Update libs/deal-ticket/src/components/market-info/info-market.tsx * fix: use position decimal places for stake and market value proxy * fix: #491 use size/position decimal places for obligation, supplied and commitment amount * fix: add size component and use decimal places * fix: update readme liquidity * fix: #491 add correct asset decimal formatters * Update libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com> * fix: make link instead of button to open liquidity * fix: #491 add liquidity page, link to trading mode tooltip, tabs hidden or choose active * fix: remove LP dialog, use only link to page * fix: add market id in LP view * fix: follow trade grid design * fix: add one line tabs , remove link styling, remove any, add value formatters * fix: remove falsy check LP undefined * fix: keep date formatter in LP table * fix: add generic type market info, hooks in body function * fix: revert number formatters * fix: use one param only in network params query * fix: use network param in web3 lib * fix: move lp container to trading app * fix: remove resizable panel * feat: add header component, remove isEstimate * chore: remove unnecessary type cast * fix: fix build with children map clone element * chore: lint * fix: move use network params to react helpers * fix: add const for LP tabs * fix: fix formatting on LP page * fix: only show tilde for liquidity monitoring auction end date * fix: market id being rendered twice in market info * chore: fix lint * fix: types for generate withdraw form query * chore: fix intermittent failing withdrawal test * Update libs/deal-ticket/src/components/market-info/info-market.tsx * chore: add another wait for market Co-authored-by: Bartłomiej Głownia Co-authored-by: botond <105208209+notbot00@users.noreply.github.com> Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com> Co-authored-by: Matthew Russell Co-authored-by: Joe --- apps/token/src/hooks/use-network-param.tsx | 27 -- .../governance/hooks/use-vote-information.ts | 4 +- apps/token/src/routes/rewards/home/index.tsx | 6 +- .../token/src/routes/staking/staking-form.tsx | 8 +- .../src/integration/market-info.cy.ts | 14 +- .../trading-e2e/src/integration/markets.cy.ts | 1 + .../src/integration/withdraw.cy.ts | 2 + .../src/support/mocks/generate-accounts.ts | 12 + .../mocks/generate-market-info-query.ts | 5 +- .../mocks/generate-withdraw-page-query.ts | 107 ++++--- apps/trading/components/header/header.tsx | 53 +++ apps/trading/components/header/index.ts | 1 + .../trading-mode-tooltip.tsx | 49 +-- .../pages/liquidity/[marketId].page.tsx | 103 ++++++ apps/trading/pages/liquidity/index.ts | 1 + .../trading/pages/markets/[marketId].page.tsx | 21 +- apps/trading/pages/markets/trade-grid.tsx | 41 ++- .../__generated__/DealTicketQuery.ts | 0 .../__generated__/MarketNames.ts | 0 .../deal-ticket/__generated__/index.ts | 2 + .../{ => deal-ticket}/deal-ticket-amount.tsx | 0 .../deal-ticket-container.tsx | 0 .../deal-ticket-limit-amount.tsx | 5 +- .../{ => deal-ticket}/deal-ticket-manager.tsx | 0 .../deal-ticket-market-amount.tsx | 0 .../{ => deal-ticket}/deal-ticket.spec.tsx | 0 .../{ => deal-ticket}/deal-ticket.tsx | 0 .../{ => deal-ticket}/expiry-selector.tsx | 0 .../src/components/deal-ticket/index.ts | 12 + .../{ => deal-ticket}/market-selector.tsx | 0 .../{ => deal-ticket}/side-selector.tsx | 0 .../time-in-force-selector.tsx | 0 .../{ => deal-ticket}/type-selector.tsx | 0 libs/deal-ticket/src/components/index.ts | 15 +- .../__generated__/MarketInfoQuery.ts | 42 ++- .../market-info/__generated__/index.ts | 1 + .../src/components/market-info/index.ts | 3 + .../market-info/info-key-value-table.tsx | 110 +++++++ .../{ => market-info}/info-market-query.ts | 9 +- .../{ => market-info}/info-market.tsx | 301 +++++------------- .../market-info/tooltip-mapping.tsx | 103 ++++++ libs/liquidity/.babelrc | 4 + libs/liquidity/.eslintrc.json | 18 ++ libs/liquidity/README.md | 7 + libs/liquidity/jest.config.js | 15 + libs/liquidity/package.json | 4 + libs/liquidity/project.json | 43 +++ libs/liquidity/src/index.ts | 1 + .../src/lib/__generated__/MarketLiquidity.ts | 252 +++++++++++++++ libs/liquidity/src/lib/__generated__/index.ts | 1 + libs/liquidity/src/lib/index.ts | 3 + .../src/lib/liquidity-data-provider.ts | 172 ++++++++++ .../src/lib/liquidity-table.spec.tsx | 53 +++ libs/liquidity/src/lib/liquidity-table.tsx | 117 +++++++ libs/liquidity/src/setup-tests.ts | 1 + libs/liquidity/tsconfig.json | 25 ++ libs/liquidity/tsconfig.lib.json | 22 ++ libs/liquidity/tsconfig.spec.json | 20 ++ .../src/lib/components/select-market.tsx | 3 +- .../order-feedback/order-feedback.spec.tsx | 2 +- .../order-feedback/order-feedback.tsx | 34 +- .../order-list/order-edit-dialog.tsx | 20 +- libs/react-helpers/.eslintrc.json | 2 +- .../src/hooks/__generated__/NetworkParams.ts | 27 ++ .../src/hooks/__generated__/index.ts | 1 + libs/react-helpers/src/hooks/index.ts | 5 +- .../src/hooks/use-network-params.ts | 37 +++ libs/react-helpers/src/lib/format/index.ts | 2 +- .../src/lib/grid/{index.tsx => index.ts} | 1 + libs/react-helpers/src/lib/grid/size.tsx | 47 +++ libs/react-helpers/src/lib/index.ts | 12 + libs/types/src/__generated__/globalTypes.ts | 12 + libs/types/src/global-types-mappings.ts | 25 +- libs/ui-toolkit/src/components/tabs/tabs.tsx | 10 +- libs/withdraws/src/index.ts | 1 + tsconfig.base.json | 1 + workspace.json | 1 + 77 files changed, 1612 insertions(+), 447 deletions(-) delete mode 100644 apps/token/src/hooks/use-network-param.tsx create mode 100644 apps/trading/components/header/header.tsx create mode 100644 apps/trading/components/header/index.ts create mode 100644 apps/trading/pages/liquidity/[marketId].page.tsx create mode 100644 apps/trading/pages/liquidity/index.ts rename libs/deal-ticket/src/components/{ => deal-ticket}/__generated__/DealTicketQuery.ts (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/__generated__/MarketNames.ts (100%) create mode 100644 libs/deal-ticket/src/components/deal-ticket/__generated__/index.ts rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket-amount.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket-container.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket-limit-amount.tsx (93%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket-manager.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket-market-amount.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket.spec.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/deal-ticket.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/expiry-selector.tsx (100%) create mode 100644 libs/deal-ticket/src/components/deal-ticket/index.ts rename libs/deal-ticket/src/components/{ => deal-ticket}/market-selector.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/side-selector.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/time-in-force-selector.tsx (100%) rename libs/deal-ticket/src/components/{ => deal-ticket}/type-selector.tsx (100%) rename libs/deal-ticket/src/components/{ => market-info}/__generated__/MarketInfoQuery.ts (97%) create mode 100644 libs/deal-ticket/src/components/market-info/__generated__/index.ts create mode 100644 libs/deal-ticket/src/components/market-info/index.ts create mode 100644 libs/deal-ticket/src/components/market-info/info-key-value-table.tsx rename libs/deal-ticket/src/components/{ => market-info}/info-market-query.ts (95%) rename libs/deal-ticket/src/components/{ => market-info}/info-market.tsx (52%) create mode 100644 libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx create mode 100644 libs/liquidity/.babelrc create mode 100644 libs/liquidity/.eslintrc.json create mode 100644 libs/liquidity/README.md create mode 100644 libs/liquidity/jest.config.js create mode 100644 libs/liquidity/package.json create mode 100644 libs/liquidity/project.json create mode 100644 libs/liquidity/src/index.ts create mode 100644 libs/liquidity/src/lib/__generated__/MarketLiquidity.ts create mode 100644 libs/liquidity/src/lib/__generated__/index.ts create mode 100644 libs/liquidity/src/lib/index.ts create mode 100644 libs/liquidity/src/lib/liquidity-data-provider.ts create mode 100644 libs/liquidity/src/lib/liquidity-table.spec.tsx create mode 100644 libs/liquidity/src/lib/liquidity-table.tsx create mode 100644 libs/liquidity/src/setup-tests.ts create mode 100644 libs/liquidity/tsconfig.json create mode 100644 libs/liquidity/tsconfig.lib.json create mode 100644 libs/liquidity/tsconfig.spec.json create mode 100644 libs/react-helpers/src/hooks/__generated__/NetworkParams.ts create mode 100644 libs/react-helpers/src/hooks/__generated__/index.ts create mode 100644 libs/react-helpers/src/hooks/use-network-params.ts rename libs/react-helpers/src/lib/grid/{index.tsx => index.ts} (90%) create mode 100644 libs/react-helpers/src/lib/grid/size.tsx create mode 100644 libs/react-helpers/src/lib/index.ts diff --git a/apps/token/src/hooks/use-network-param.tsx b/apps/token/src/hooks/use-network-param.tsx deleted file mode 100644 index a8536ccdb..000000000 --- a/apps/token/src/hooks/use-network-param.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useQuery } from '@apollo/client'; -import { gql } from '@apollo/client'; - -import type { NetworkParams } from './__generated__/NetworkParams'; - -export const NETWORK_PARAMS_QUERY = gql` - query NetworkParams { - networkParameters { - key - value - } - } -`; - -export function useNetworkParam(params: string[]) { - const { data, loading, error } = useQuery( - NETWORK_PARAMS_QUERY - ); - const foundParams = data?.networkParameters - ?.filter((p) => params.includes(p.key)) - .sort((a, b) => params.indexOf(a.key) - params.indexOf(b.key)); - return { - data: foundParams ? foundParams.map((f) => f.value) : null, - loading, - error, - }; -} diff --git a/apps/token/src/routes/governance/hooks/use-vote-information.ts b/apps/token/src/routes/governance/hooks/use-vote-information.ts index a62860f7d..634c2b4ca 100644 --- a/apps/token/src/routes/governance/hooks/use-vote-information.ts +++ b/apps/token/src/routes/governance/hooks/use-vote-information.ts @@ -1,8 +1,8 @@ +import { useNetworkParams } from '@vegaprotocol/react-helpers'; import React from 'react'; import { NetworkParams } from '../../../config'; import { useAppState } from '../../../contexts/app-state/app-state-context'; -import { useNetworkParam } from '../../../hooks/use-network-param'; import { BigNumber } from '../../../lib/bignumber'; import { addDecimal } from '../../../lib/decimals'; import type { @@ -16,7 +16,7 @@ const useProposalNetworkParams = ({ }: { proposal: Proposals_proposals; }) => { - const { data, loading } = useNetworkParam([ + const { data, loading } = useNetworkParams([ NetworkParams.GOV_UPDATE_MARKET_REQUIRED_MAJORITY, NetworkParams.GOV_UPDATE_MARKET_REQUIRED_PARTICIPATION, NetworkParams.GOV_NEW_MARKET_REQUIRED_MAJORITY, diff --git a/apps/token/src/routes/rewards/home/index.tsx b/apps/token/src/routes/rewards/home/index.tsx index d3a2368cc..aa6beb2aa 100644 --- a/apps/token/src/routes/rewards/home/index.tsx +++ b/apps/token/src/routes/rewards/home/index.tsx @@ -1,7 +1,7 @@ import { useQuery } from '@apollo/client'; import { Button, Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; import { formatDistance } from 'date-fns'; -// @ts-ignore No types availabel for duration-js +// @ts-ignore No types available for duration-js import Duration from 'duration-js'; import gql from 'graphql-tag'; import React from 'react'; @@ -15,10 +15,10 @@ import { AppStateActionType, useAppState, } from '../../../contexts/app-state/app-state-context'; -import { useNetworkParam } from '../../../hooks/use-network-param'; import type { Rewards } from './__generated__/Rewards'; import { RewardInfo } from './reward-info'; import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useNetworkParams } from '@vegaprotocol/react-helpers'; export const REWARDS_QUERY = gql` query Rewards($partyId: ID!) { @@ -77,7 +77,7 @@ export const RewardsIndex = () => { data: rewardAssetData, loading: rewardAssetLoading, error: rewardAssetError, - } = useNetworkParam([ + } = useNetworkParams([ NetworkParams.REWARD_ASSET, NetworkParams.REWARD_PAYOUT_DURATION, ]); diff --git a/apps/token/src/routes/staking/staking-form.tsx b/apps/token/src/routes/staking/staking-form.tsx index 21e7fd7ed..666639328 100644 --- a/apps/token/src/routes/staking/staking-form.tsx +++ b/apps/token/src/routes/staking/staking-form.tsx @@ -7,7 +7,6 @@ import { useNavigate } from 'react-router-dom'; import { TokenInput } from '../../components/token-input'; import { NetworkParams } from '../../config'; import { useAppState } from '../../contexts/app-state/app-state-context'; -import { useNetworkParam } from '../../hooks/use-network-param'; import { useSearchParams } from '../../hooks/use-search-params'; import { BigNumber } from '../../lib/bignumber'; import { addDecimal, removeDecimal } from '../../lib/decimals'; @@ -31,6 +30,7 @@ import type { UndelegateSubmissionBody, } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet'; +import { useNetworkParam } from '@vegaprotocol/react-helpers'; export const PARTY_DELEGATIONS_QUERY = gql` query PartyDelegations($partyId: ID!) { @@ -103,9 +103,9 @@ export const StakingForm = ({ setAmount(''); }, [action, setAmount]); - const { data } = useNetworkParam([ - NetworkParams.VALIDATOR_DELEGATION_MIN_AMOUNT, - ]); + const { data } = useNetworkParam( + NetworkParams.VALIDATOR_DELEGATION_MIN_AMOUNT + ); const minTokensWithDecimals = React.useMemo(() => { const minTokens = new BigNumber(data && data.length === 1 ? data[0] : ''); diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index fafa62721..c02477b1f 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -1,4 +1,8 @@ -import { MarketState } from '@vegaprotocol/types'; +import { + MarketState, + MarketStateMapping, + MarketTradingModeMapping, +} from '@vegaprotocol/types'; import { mockTradingPage } from '../support/trading'; const marketInfoBtn = 'Info'; @@ -51,8 +55,12 @@ describe('market info is displayed', () => { validateMarketDataRow(0, 'Name', 'ETHBTC Quarterly (30 Jun 2022)'); validateMarketDataRow(1, 'Decimal Places', '2'); validateMarketDataRow(2, 'Position Decimal Places', '0'); - validateMarketDataRow(3, 'Trading Mode', 'Trading mode continuous'); - validateMarketDataRow(4, 'State', 'STATE_ACTIVE'); + validateMarketDataRow( + 3, + 'Trading Mode', + MarketTradingModeMapping.TRADING_MODE_CONTINUOUS + ); + validateMarketDataRow(4, 'State', MarketStateMapping.STATE_ACTIVE); validateMarketDataRow(5, 'Market ID', 'market-0'); }); diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index a8c811745..a4736732b 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -10,6 +10,7 @@ describe('markets table', () => { it('renders markets correctly', () => { cy.visit('/'); + cy.wait('@Market'); cy.wait('@MarketList'); cy.get('[data-testid^="market-link-"]') .should('not.be.empty') diff --git a/apps/trading-e2e/src/integration/withdraw.cy.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts index b13b78e74..895a1171d 100644 --- a/apps/trading-e2e/src/integration/withdraw.cy.ts +++ b/apps/trading-e2e/src/integration/withdraw.cy.ts @@ -1,5 +1,6 @@ import { aliasQuery } from '@vegaprotocol/cypress'; import { connectEthereumWallet } from '../support/ethereum-wallet'; +import { generateAccounts } from '../support/mocks/generate-accounts'; import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; import { generateWithdrawFormQuery } from '../support/mocks/generate-withdraw-page-query'; import { generateWithdrawals } from '../support/mocks/generate-withdrawals'; @@ -20,6 +21,7 @@ describe('withdraw', () => { aliasQuery(req, 'Withdrawals', generateWithdrawals()); aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); aliasQuery(req, 'WithdrawFormQuery', generateWithdrawFormQuery()); + aliasQuery(req, 'Accounts', generateAccounts()); }); cy.visit('/portfolio'); diff --git a/apps/trading-e2e/src/support/mocks/generate-accounts.ts b/apps/trading-e2e/src/support/mocks/generate-accounts.ts index 3c6d4e36e..4639708a1 100644 --- a/apps/trading-e2e/src/support/mocks/generate-accounts.ts +++ b/apps/trading-e2e/src/support/mocks/generate-accounts.ts @@ -71,6 +71,18 @@ export const generateAccounts = ( decimals: 5, }, }, + { + __typename: 'Account', + type: AccountType.ACCOUNT_TYPE_GENERAL, + balance: '100000000', + market: null, + asset: { + __typename: 'Asset', + id: 'asset-0', + symbol: 'AST0', + decimals: 5, + }, + }, ], }, }; diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index 39238e0b0..709075397 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -86,7 +86,9 @@ export const generateMarketInfoQuery = ( id: '54b78c1b877e106842ae156332ccec740ad98d6bad43143ac6a029501dd7c6e0', }, markPrice: '5749', - indicativeVolume: '0', + suppliedStake: '56767', + marketValueProxy: '677678', + targetStake: '56789', bestBidVolume: '5', bestOfferVolume: '1', bestStaticBidVolume: '5', @@ -146,6 +148,7 @@ export const generateMarketInfoQuery = ( id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', symbol: 'tBTC', name: 'tBTC TEST', + decimals: 1, }, oracleSpecForSettlementPrice: { __typename: 'OracleSpec', diff --git a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts index 510ec1ae4..d97801af2 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts @@ -1,66 +1,69 @@ import { AccountType } from '@vegaprotocol/types'; +import type { + WithdrawFormQuery, + WithdrawFormQuery_assetsConnection_edges, + WithdrawFormQuery_party_accounts, + WithdrawFormQuery_party_withdrawals, +} from '@vegaprotocol/withdraws'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; export const generateWithdrawFormQuery = ( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - override?: PartialDeep -) => { + override?: PartialDeep +): WithdrawFormQuery => { + const withdrawal: WithdrawFormQuery_party_withdrawals = { + id: 'withdrawal-0', + txHash: null, + __typename: 'Withdrawal', + }; + const account: WithdrawFormQuery_party_accounts = { + type: AccountType.ACCOUNT_TYPE_GENERAL, + balance: '100000000', + asset: { + __typename: 'Asset', + id: 'asset-0', + symbol: 'AST0', + }, + __typename: 'Account', + }; + const assetEdge1: WithdrawFormQuery_assetsConnection_edges = { + node: { + id: 'asset-0', + symbol: 'AST0', + name: 'Asset 0', + decimals: 5, + source: { + __typename: 'ERC20', + contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81', + }, + __typename: 'Asset', + }, + __typename: 'AssetEdge', + }; + const assetEdge2: WithdrawFormQuery_assetsConnection_edges = { + node: { + id: 'asset-1', + symbol: 'AST1', + name: 'Asset 1', + decimals: 5, + source: { + __typename: 'ERC20', + contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81', + }, + __typename: 'Asset', + }, + __typename: 'AssetEdge', + }; const defaultResult = { party: { id: 'party-0', - withdrawals: [ - { - id: 'withdrawal-0', - txHash: null, - __typename: 'Withdrawal', - }, - ], - accounts: [ - { - type: AccountType.ACCOUNT_TYPE_GENERAL, - balance: '100000000', - asset: { - __typename: 'Asset', - id: 'asset-0', - symbol: 'AST0', - }, - __typename: 'Account', - }, - ], + withdrawals: [withdrawal], + accounts: [account], __typename: 'Party', }, assetsConnection: { - edges: [ - { - node: { - id: 'asset-0', - symbol: 'AST0', - name: 'Asset 0', - decimals: 5, - source: { - __typename: 'ERC20', - contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81', - }, - __typename: 'Asset', - }, - __typename: 'AssetEdge', - }, - { - node: { - id: 'asset-1', - symbol: 'AST1', - name: 'Asset 1', - decimals: 5, - source: { - __typename: 'ERC20', - contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81', - }, - __typename: 'Asset', - }, - __typename: 'AssetEdge', - }, - ], + __typename: 'AssetsConnection', + edges: [assetEdge1, assetEdge2], }, }; diff --git a/apps/trading/components/header/header.tsx b/apps/trading/components/header/header.tsx new file mode 100644 index 000000000..7eaaa0d6e --- /dev/null +++ b/apps/trading/components/header/header.tsx @@ -0,0 +1,53 @@ +import type { ReactElement, ReactNode } from 'react'; +import { Children } from 'react'; +import { cloneElement } from 'react'; + +interface TradeMarketHeaderProps { + title: ReactNode; + children: ReactElement[]; +} + +export const Header = ({ title, children }: TradeMarketHeaderProps) => { + return ( +
    +
    +
    + {title} +
    +
    + {Children.map(children, (child, index) => { + return cloneElement(child, { + id: `header-stat-${index}`, + }); + })} +
    +
    +
    + ); +}; + +export const HeaderStat = ({ + children, + heading, + id, +}: { + children: ReactNode; + heading: string; + id?: string; +}) => { + const itemClass = + 'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-neutral-300 dark:border-neutral-700'; + const itemHeading = 'text-neutral-400'; + + return ( +
    +
    + {heading} +
    +
    {children}
    +
    + ); +}; diff --git a/apps/trading/components/header/index.ts b/apps/trading/components/header/index.ts new file mode 100644 index 000000000..677ca79d4 --- /dev/null +++ b/apps/trading/components/header/index.ts @@ -0,0 +1 @@ +export * from './header'; diff --git a/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx b/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx index e06923785..414a158dc 100644 --- a/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx +++ b/apps/trading/components/trading-mode-tooltip/trading-mode-tooltip.tsx @@ -10,9 +10,8 @@ import type { Market_market } from '../../pages/markets/__generated__/Market'; type MarketDataGridProps = { grid: { - label: string; + label: string | ReactNode; value?: ReactNode; - isEstimate?: boolean; }[]; }; @@ -20,12 +19,11 @@ const MarketDataGrid = ({ grid }: MarketDataGridProps) => { return ( <> {grid.map( - ({ label, value, isEstimate }, index) => + ({ label, value }, index) => value && (
    {label} - - {isEstimate && {'~'}} + {value}
    @@ -61,12 +59,14 @@ const compileGridData = (market: Market_market) => { } if (market.data?.auctionEnd) { + const endDate = getDateTimeFormat().format( + new Date(market.data.auctionEnd) + ); grid.push({ label: isLiquidityMonitoringAuction ? t('Est auction end') : t('Auction end'), - value: getDateTimeFormat().format(new Date(market.data.auctionEnd)), - isEstimate: isLiquidityMonitoringAuction ? true : false, + value: isLiquidityMonitoringAuction ? `~${endDate}` : endDate, }); } @@ -79,8 +79,11 @@ const compileGridData = (market: Market_market) => { if (isLiquidityMonitoringAuction && market.data?.suppliedStake) { grid.push({ - label: t('Current liquidity'), - // @TODO: link this to liquidity view when https://github.com/vegaprotocol/frontend-monorepo/issues/491 is done + label: ( + + {t('Current liquidity')} + + ), value: formatStake(market.data.suppliedStake, market), }); } @@ -88,22 +91,24 @@ const compileGridData = (market: Market_market) => { if (market.data?.indicativePrice) { grid.push({ label: t('Est uncrossing price'), - value: addDecimalsFormatNumber( - market.data.indicativePrice, - market.positionDecimalPlaces - ), - isEstimate: true, + value: + '~' + + addDecimalsFormatNumber( + market.data.indicativePrice, + market.positionDecimalPlaces + ), }); } if (market.data?.indicativeVolume) { grid.push({ label: t('Est uncrossing vol'), - value: addDecimalsFormatNumber( - market.data.indicativeVolume, - market.positionDecimalPlaces - ), - isEstimate: true, + value: + '~' + + addDecimalsFormatNumber( + market.data.indicativeVolume, + market.positionDecimalPlaces + ), }); } @@ -128,7 +133,7 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { case MarketTradingMode.TRADING_MODE_OPENING_AUCTION: { return ( <> -

    +

    {t( 'This new market is in an opening auction to determine a fair mid-price before starting continuous trading.' @@ -150,7 +155,7 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { case AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY: { return ( <> -

    +

    {t( 'This market is in auction until it reaches sufficient liquidity.' @@ -170,7 +175,7 @@ export const TradingModeTooltip = ({ market }: TradingModeTooltipProps) => { case AuctionTrigger.AUCTION_TRIGGER_PRICE: { return ( <> -

    +

    {t('This market is in auction due to high price volatility.')} {' '} diff --git a/apps/trading/pages/liquidity/[marketId].page.tsx b/apps/trading/pages/liquidity/[marketId].page.tsx new file mode 100644 index 000000000..a79f9e383 --- /dev/null +++ b/apps/trading/pages/liquidity/[marketId].page.tsx @@ -0,0 +1,103 @@ +import { LiquidityTable, useLiquidityProvision } from '@vegaprotocol/liquidity'; +import { t } from '@vegaprotocol/react-helpers'; +import { LiquidityProvisionStatus } from '@vegaprotocol/types'; +import { AsyncRenderer, Tab, Tabs } from '@vegaprotocol/ui-toolkit'; +import { useVegaWallet } from '@vegaprotocol/wallet'; +import type { AgGridReact } from 'ag-grid-react'; +import { Header, HeaderStat } from '../../components/header'; +import Link from 'next/link'; +import { useRouter } from 'next/router'; +import { useRef, useMemo } from 'react'; + +const LiquidityPage = ({ id }: { id?: string }) => { + const { query } = useRouter(); + const { keypair } = useVegaWallet(); + const gridRef = useRef(null); + + const partyId = keypair?.pub; + // Default to first marketId query item if found + const marketId = + id || (Array.isArray(query.marketId) ? query.marketId[0] : query.marketId); + + const { + data: { liquidityProviders, suppliedStake, targetStake, code, symbol }, + loading, + error, + } = useLiquidityProvision({ marketId }); + + const myLpEdges = useMemo( + () => liquidityProviders.filter((e) => e.party === partyId), + [liquidityProviders, partyId] + ); + const activeEdges = useMemo( + () => + liquidityProviders.filter( + (e) => e.status === LiquidityProvisionStatus.STATUS_ACTIVE + ), + [liquidityProviders] + ); + const inactiveEdges = useMemo( + () => + liquidityProviders.filter( + (e) => e.status !== LiquidityProvisionStatus.STATUS_ACTIVE + ), + [liquidityProviders] + ); + + const enum LiquidityTabs { + Active = 'active', + Inactive = 'inactive', + MyLiquidityProvision = 'myLP', + } + + const getActiveDefaultId = () => { + if (myLpEdges?.length > 0) return LiquidityTabs.MyLiquidityProvision; + if (activeEdges?.length) return LiquidityTabs.Active; + else if (inactiveEdges?.length > 0) return LiquidityTabs.Inactive; + return LiquidityTabs.Active; + }; + + return ( + +

    +
    + {`${code} ${t('liquidity provision')}`} + + } + > + +
    {`${targetStake} ${symbol}`}
    +
    + +
    {`${suppliedStake} ${symbol}`}
    +
    + +
    {marketId}
    +
    +
    + + + + + + + + + +
    + + ); +}; +LiquidityPage.getInitialProps = () => ({ + page: 'liquidity', +}); + +export default LiquidityPage; diff --git a/apps/trading/pages/liquidity/index.ts b/apps/trading/pages/liquidity/index.ts new file mode 100644 index 000000000..e02f4d096 --- /dev/null +++ b/apps/trading/pages/liquidity/index.ts @@ -0,0 +1 @@ +export * from './[marketId].page'; diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 0bdbbd385..50b36ef2a 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -5,7 +5,7 @@ import { Interval } from '@vegaprotocol/types'; import { Splash } from '@vegaprotocol/ui-toolkit'; import debounce from 'lodash/debounce'; import { useRouter } from 'next/router'; -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useMemo, useState } from 'react'; import { PageQueryContainer } from '../../components/page-query-container'; import { useGlobalStore } from '../../stores'; import { TradeGrid, TradePanels } from './trade-grid'; @@ -91,10 +91,19 @@ const MarketPage = ({ id }: { id?: string }) => { // Cache timestamp for yesterday to prevent full unmount of market page when // a rerender occurs - const [yTimestamp] = useState(() => { + const yTimestamp = useMemo(() => { const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; return new Date(yesterday * 1000).toISOString(); - }); + }, []); + + const variables = useMemo( + () => ({ + marketId: marketId || '', + interval: Interval.INTERVAL_I1H, + since: yTimestamp, + }), + [marketId, yTimestamp] + ); if (!marketId) { return ( @@ -109,11 +118,7 @@ const MarketPage = ({ id }: { id?: string }) => { query={MARKET_QUERY} data-testid="market" options={{ - variables: { - marketId, - interval: Interval.INTERVAL_I1H, - since: yTimestamp, - }, + variables, fetchPolicy: 'network-only', }} render={({ market }) => { diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index c8d8ec216..60a5d88f6 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -1,48 +1,47 @@ -import 'allotment/dist/style.css'; import { DealTicketContainer, MarketInfoContainer, } from '@vegaprotocol/deal-ticket'; import { OrderbookContainer } from '@vegaprotocol/market-depth'; -import { SelectMarketPopover } from '@vegaprotocol/market-list'; import { OrderListContainer } from '@vegaprotocol/orders'; import { FillsContainer } from '@vegaprotocol/fills'; import { PositionsContainer } from '@vegaprotocol/positions'; -import { - addDecimalsFormatNumber, - getDateFormat, - t, -} from '@vegaprotocol/react-helpers'; import { TradesContainer } from '@vegaprotocol/trades'; -import { - AuctionTrigger, - AuctionTriggerMapping, - MarketTradingMode, - MarketTradingModeMapping, -} from '@vegaprotocol/types'; import { LayoutPriority } from 'allotment'; import classNames from 'classnames'; import AutoSizer from 'react-virtualized-auto-sizer'; import { useState } from 'react'; import type { ReactNode } from 'react'; import type { Market_market } from './__generated__/Market'; -import type { CandleClose } from '@vegaprotocol/types'; -import { useGlobalStore } from '../../stores'; import { AccountsContainer } from '@vegaprotocol/accounts'; import { DepthChartContainer } from '@vegaprotocol/market-depth'; import { CandlesChartContainer } from '@vegaprotocol/candles-chart'; -import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; -import { useEnvironment } from '@vegaprotocol/environment'; import { Tab, Tabs, + ResizableGrid, + ResizableGridPanel, + ButtonLink, + Tooltip, PriceCellChange, Link, - Tooltip, - ResizableGrid, - ButtonLink, - ResizableGridPanel, } from '@vegaprotocol/ui-toolkit'; +import { + addDecimalsFormatNumber, + getDateFormat, + t, +} from '@vegaprotocol/react-helpers'; +import { SelectMarketPopover } from '@vegaprotocol/market-list'; +import { useGlobalStore } from '../../stores'; +import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; +import { useEnvironment } from '@vegaprotocol/environment'; +import type { CandleClose } from '@vegaprotocol/types'; +import { + AuctionTrigger, + AuctionTriggerMapping, + MarketTradingMode, + MarketTradingModeMapping, +} from '@vegaprotocol/types'; import { TradingModeTooltip } from '../../components/trading-mode-tooltip'; const TradingViews = { diff --git a/libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts similarity index 100% rename from libs/deal-ticket/src/components/__generated__/DealTicketQuery.ts rename to libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts diff --git a/libs/deal-ticket/src/components/__generated__/MarketNames.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts similarity index 100% rename from libs/deal-ticket/src/components/__generated__/MarketNames.ts rename to libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated__/index.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/index.ts new file mode 100644 index 000000000..1a861aa78 --- /dev/null +++ b/libs/deal-ticket/src/components/deal-ticket/__generated__/index.ts @@ -0,0 +1,2 @@ +export * from './DealTicketQuery'; +export * from './MarketNames'; diff --git a/libs/deal-ticket/src/components/deal-ticket-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket-amount.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket-container.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx similarity index 93% rename from libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx index 2d5ba1cde..4d5e169ea 100644 --- a/libs/deal-ticket/src/components/deal-ticket-limit-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx @@ -48,7 +48,10 @@ export const DealTicketLimitAmount = ({ type="number" step={priceStep} data-testid="order-price" - {...register('price', { required: true, min: 0 })} + {...register('price', { + required: true, + min: 0, + })} />
    diff --git a/libs/deal-ticket/src/components/deal-ticket-manager.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket-manager.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket-market-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket-market-amount.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket.spec.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket.tsx rename to libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx diff --git a/libs/deal-ticket/src/components/expiry-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx similarity index 100% rename from libs/deal-ticket/src/components/expiry-selector.tsx rename to libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx diff --git a/libs/deal-ticket/src/components/deal-ticket/index.ts b/libs/deal-ticket/src/components/deal-ticket/index.ts new file mode 100644 index 000000000..97827ec50 --- /dev/null +++ b/libs/deal-ticket/src/components/deal-ticket/index.ts @@ -0,0 +1,12 @@ +export * from './__generated__'; +export * from './deal-ticket-amount'; +export * from './deal-ticket-container'; +export * from './deal-ticket-limit-amount'; +export * from './deal-ticket-manager'; +export * from './deal-ticket-market-amount'; +export * from './deal-ticket'; +export * from './expiry-selector'; +export * from './market-selector'; +export * from './side-selector'; +export * from './time-in-force-selector'; +export * from './type-selector'; diff --git a/libs/deal-ticket/src/components/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx similarity index 100% rename from libs/deal-ticket/src/components/market-selector.tsx rename to libs/deal-ticket/src/components/deal-ticket/market-selector.tsx diff --git a/libs/deal-ticket/src/components/side-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx similarity index 100% rename from libs/deal-ticket/src/components/side-selector.tsx rename to libs/deal-ticket/src/components/deal-ticket/side-selector.tsx diff --git a/libs/deal-ticket/src/components/time-in-force-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx similarity index 100% rename from libs/deal-ticket/src/components/time-in-force-selector.tsx rename to libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx diff --git a/libs/deal-ticket/src/components/type-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx similarity index 100% rename from libs/deal-ticket/src/components/type-selector.tsx rename to libs/deal-ticket/src/components/deal-ticket/type-selector.tsx diff --git a/libs/deal-ticket/src/components/index.ts b/libs/deal-ticket/src/components/index.ts index 740de3af5..93c181307 100644 --- a/libs/deal-ticket/src/components/index.ts +++ b/libs/deal-ticket/src/components/index.ts @@ -1,15 +1,2 @@ -export * from './__generated__/DealTicketQuery'; -export * from './__generated__/MarketInfoQuery'; -export * from './__generated__/MarketNames'; -export * from './deal-ticket-amount'; -export * from './deal-ticket-container'; -export * from './deal-ticket-limit-amount'; -export * from './deal-ticket-manager'; -export * from './deal-ticket-market-amount'; export * from './deal-ticket'; -export * from './expiry-selector'; -export * from './info-market'; -export * from './side-selector'; -export * from './time-in-force-selector'; -export * from './type-selector'; -export * from './market-selector'; +export * from './market-info'; diff --git a/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts similarity index 97% rename from libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts rename to libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts index 0193664e7..529fc790d 100644 --- a/libs/deal-ticket/src/components/__generated__/MarketInfoQuery.ts +++ b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { Interval, MarketState, AccountType, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/types"; +import { Interval, MarketState, MarketTradingMode, AccountType, AuctionTrigger } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: MarketInfoQuery @@ -191,10 +191,6 @@ export interface MarketInfoQuery_market_data { * the mark price (an unsigned integer) */ markPrice: string; - /** - * indicative volume if the auction ended now, 0 if not in auction mode - */ - indicativeVolume: string; /** * the aggregated volume being bid at the best bid price. */ @@ -211,10 +207,6 @@ export interface MarketInfoQuery_market_data { * the aggregated volume being offered at the best static offer price, excluding pegged orders. */ bestStaticOfferVolume: string; - /** - * the sum of the size of all positions greater than 0. - */ - openInterest: string; /** * the highest price level on an order book for buy orders. */ @@ -227,6 +219,22 @@ export interface MarketInfoQuery_market_data { * what triggered an auction (if an auction was started) */ trigger: AuctionTrigger; + /** + * the sum of the size of all positions greater than 0. + */ + openInterest: string; + /** + * the supplied stake for the market + */ + suppliedStake: string | null; + /** + * the amount of stake targeted for this market + */ + targetStake: string | null; + /** + * the market value proxy + */ + marketValueProxy: string; /** * a list of valid price ranges per associated trigger */ @@ -287,6 +295,10 @@ export interface MarketInfoQuery_market_tradableInstrument_instrument_product_se * The full name of the asset (e.g: Great British Pound) */ name: string; + /** + * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; } export interface MarketInfoQuery_market_tradableInstrument_instrument_product_oracleSpecForSettlementPrice { @@ -454,14 +466,14 @@ export interface MarketInfoQuery_market { /** * 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 ) @@ -479,6 +491,10 @@ export interface MarketInfoQuery_market { * Current state of the market */ state: MarketState; + /** + * Current mode of execution of the market + */ + tradingMode: MarketTradingMode; /** * The proposal that initiated this market */ @@ -487,10 +503,6 @@ export interface MarketInfoQuery_market { * Get account for a party or market */ accounts: MarketInfoQuery_market_accounts[] | null; - /** - * Current mode of execution of the market - */ - tradingMode: MarketTradingMode; /** * Fees related data */ diff --git a/libs/deal-ticket/src/components/market-info/__generated__/index.ts b/libs/deal-ticket/src/components/market-info/__generated__/index.ts new file mode 100644 index 000000000..9807aed20 --- /dev/null +++ b/libs/deal-ticket/src/components/market-info/__generated__/index.ts @@ -0,0 +1 @@ +export * from './MarketInfoQuery'; diff --git a/libs/deal-ticket/src/components/market-info/index.ts b/libs/deal-ticket/src/components/market-info/index.ts new file mode 100644 index 000000000..0ffe69ca7 --- /dev/null +++ b/libs/deal-ticket/src/components/market-info/index.ts @@ -0,0 +1,3 @@ +export * from './__generated__'; +export * from './info-market-query'; +export * from './info-market'; diff --git a/libs/deal-ticket/src/components/market-info/info-key-value-table.tsx b/libs/deal-ticket/src/components/market-info/info-key-value-table.tsx new file mode 100644 index 000000000..52c9f9410 --- /dev/null +++ b/libs/deal-ticket/src/components/market-info/info-key-value-table.tsx @@ -0,0 +1,110 @@ +import { + t, + addDecimalsFormatNumber, + formatNumberPercentage, + formatNumber, +} from '@vegaprotocol/react-helpers'; +import { + KeyValueTableRow, + KeyValueTable, + Tooltip, +} from '@vegaprotocol/ui-toolkit'; +import BigNumber from 'bignumber.js'; +import startCase from 'lodash/startCase'; +import type { ReactNode } from 'react'; +import { tooltipMapping } from './tooltip-mapping'; + +interface RowProps { + field: string; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value: any; + decimalPlaces?: number; + asPercentage?: boolean; + unformatted?: boolean; + assetSymbol?: string; +} + +const Row = ({ + field, + value, + decimalPlaces, + asPercentage, + unformatted, + assetSymbol = '', +}: RowProps) => { + const isNumber = typeof value === 'number' || !isNaN(Number(value)); + const isPrimitive = typeof value === 'string' || isNumber; + const className = 'text-black dark:text-white text-ui !px-0 !font-normal'; + let formattedValue = value; + if (isNumber && !unformatted) { + if (decimalPlaces) { + formattedValue = `${addDecimalsFormatNumber( + value, + decimalPlaces + )} ${assetSymbol}`; + } else if (asPercentage && value) { + formattedValue = formatNumberPercentage(new BigNumber(value).times(100)); + } else { + formattedValue = `${formatNumber(Number(value))} ${assetSymbol}`; + } + } + if (isPrimitive) { + return ( + + +
    {startCase(t(field))}
    +
    + {formattedValue} +
    + ); + } + return null; +}; + +export interface MarketInfoTableProps { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + data: any; + decimalPlaces?: number; + asPercentage?: boolean; + unformatted?: boolean; + omits?: string[]; + link?: ReactNode; + assetSymbol?: string; +} + +export const MarketInfoTable = ({ + data, + decimalPlaces, + asPercentage, + unformatted, + omits = ['__typename'], + link, + assetSymbol, +}: MarketInfoTableProps) => { + return ( + <> + + {Object.entries(data) + .filter(([key]) => !omits.includes(key)) + .map(([key, value]) => ( + + ))} + + {link} + + ); +}; diff --git a/libs/deal-ticket/src/components/info-market-query.ts b/libs/deal-ticket/src/components/market-info/info-market-query.ts similarity index 95% rename from libs/deal-ticket/src/components/info-market-query.ts rename to libs/deal-ticket/src/components/market-info/info-market-query.ts index 6c197b93a..35f9d63d0 100644 --- a/libs/deal-ticket/src/components/info-market-query.ts +++ b/libs/deal-ticket/src/components/market-info/info-market-query.ts @@ -8,6 +8,7 @@ export const MARKET_INFO_QUERY = gql` decimalPlaces positionDecimalPlaces state + tradingMode proposal { id rationale { @@ -49,15 +50,18 @@ export const MARKET_INFO_QUERY = gql` id } markPrice - indicativeVolume bestBidVolume bestOfferVolume bestStaticBidVolume bestStaticOfferVolume - openInterest bestBidPrice bestOfferPrice trigger + openInterest + suppliedStake + openInterest + targetStake + marketValueProxy priceMonitoringBounds { minValidPrice maxValidPrice @@ -94,6 +98,7 @@ export const MARKET_INFO_QUERY = gql` id symbol name + decimals } oracleSpecForSettlementPrice { id diff --git a/libs/deal-ticket/src/components/info-market.tsx b/libs/deal-ticket/src/components/market-info/info-market.tsx similarity index 52% rename from libs/deal-ticket/src/components/info-market.tsx rename to libs/deal-ticket/src/components/market-info/info-market.tsx index 074c2a385..89e65f22d 100644 --- a/libs/deal-ticket/src/components/info-market.tsx +++ b/libs/deal-ticket/src/components/market-info/info-market.tsx @@ -1,31 +1,23 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ -import type { ReactNode } from 'react'; import { useMemo } from 'react'; -import { - addDecimalsFormatNumber, - formatLabel, - formatNumber, - formatNumberPercentage, - t, -} from '@vegaprotocol/react-helpers'; -import { - KeyValueTable, - KeyValueTableRow, - AsyncRenderer, - Splash, - Accordion, - Tooltip, - Link, -} from '@vegaprotocol/ui-toolkit'; -import startCase from 'lodash/startCase'; +import { formatNumber, t } from '@vegaprotocol/react-helpers'; +import { AsyncRenderer, Splash, Accordion } from '@vegaprotocol/ui-toolkit'; import pick from 'lodash/pick'; -import omit from 'lodash/omit'; -import type { MarketInfoQuery, MarketInfoQuery_market } from './'; import BigNumber from 'bignumber.js'; import { useQuery } from '@apollo/client'; import { totalFees } from '@vegaprotocol/market-list'; -import { AccountType, Interval } from '@vegaprotocol/types'; +import { + AccountType, + Interval, + MarketStateMapping, + MarketTradingModeMapping, +} from '@vegaprotocol/types'; import { MARKET_INFO_QUERY } from './info-market-query'; +import type { + MarketInfoQuery, + MarketInfoQuery_market, + MarketInfoQuery_market_candles, +} from './__generated__/MarketInfoQuery'; +import { MarketInfoTable } from './info-key-value-table'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { generatePath } from 'react-router-dom'; @@ -42,11 +34,11 @@ export interface InfoProps { export const calcCandleVolume = ( m: MarketInfoQuery_market ): string | undefined => { - return m?.candles - ?.reduce((acc, c) => { + return m.candles + ?.reduce((acc: BigNumber, c: MarketInfoQuery_market_candles | null) => { return acc.plus(new BigNumber(c?.volume ?? 0)); - }, new BigNumber(0)) - .toString(); + }, new BigNumber(m.candles?.[0]?.volume ?? 0)) + ?.toString(); }; export interface MarketInfoContainerProps { @@ -57,10 +49,16 @@ export const MarketInfoContainer = ({ marketId }: MarketInfoContainerProps) => { const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; return new Date(yesterday * 1000).toISOString(); }, []); - - const { data, loading, error } = useQuery(MARKET_INFO_QUERY, { - variables: { marketId, interval: Interval.INTERVAL_I1H, since: yTimestamp }, - }); + const variables = useMemo( + () => ({ marketId, since: yTimestamp, interval: Interval.INTERVAL_I1H }), + [marketId, yTimestamp] + ); + const { data, loading, error } = useQuery( + MARKET_INFO_QUERY, + { + variables, + } + ); return ( data={data} loading={loading} error={error}> @@ -79,6 +77,8 @@ export const Info = ({ market }: InfoProps) => { const { VEGA_TOKEN_URL } = useEnvironment(); const headerClassName = 'uppercase text-lg'; const dayVolume = calcCandleVolume(market); + const assetSymbol = + market.tradableInstrument.instrument.product?.settlementAsset.symbol; const marketDataPanels = [ { title: t('Current fees'), @@ -137,28 +137,33 @@ export const Info = ({ market }: InfoProps) => { }, ...(market.accounts || []) .filter((a) => a.type === AccountType.ACCOUNT_TYPE_INSURANCE) - .map((a, i) => ({ + .map((a) => ({ title: t(`Insurance pool`), content: ( ), })), ]; - - const keyDetails = pick( - market, - 'name', - 'decimalPlaces', - 'positionDecimalPlaces', - 'tradingMode', - 'state', - 'id' as 'marketId' - ); + const { VEGA_EXPLORER_URL } = useEnvironment(); + const keyDetails = { + ...pick( + market, + 'name', + 'decimalPlaces', + 'positionDecimalPlaces', + 'tradingMode' + ), + state: MarketStateMapping[market.state], + }; const marketSpecPanels = [ { title: t('Key details'), @@ -166,10 +171,10 @@ export const Info = ({ market }: InfoProps) => { ), @@ -251,6 +256,12 @@ export const Info = ({ market }: InfoProps) => { ), })), + ...(market.data?.priceMonitoringBounds || []).map((trigger, i) => ({ + title: t(`Price monitoring bound ${i + 1}`), + content: ( + + ), + })), { title: t('Liquidity monitoring parameters'), content: ( @@ -263,6 +274,28 @@ export const Info = ({ market }: InfoProps) => { /> ), }, + { + title: t('Liquidity'), + content: ( + + {t('View liquidity provision table')} + + } + /> + ), + }, { title: t('Oracle'), content: ( @@ -276,6 +309,13 @@ export const Info = ({ market }: InfoProps) => { market.tradableInstrument.instrument.product .oracleSpecForTradingTermination.id, }} + link={ + + {t('View full oracle details')} + + } /> ), }, @@ -323,172 +363,3 @@ export const Info = ({ market }: InfoProps) => {
    ); }; - -const tooltipMapping: Record = { - makerFee: t( - 'Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).' - ), - liquidityFee: t( - 'Liquidity portion of the fee is paid to market makers for providing liquidity, and is transferred to the market-maker fee pool for the market.' - ), - infrastructureFee: t( - 'Fees paid to validators as a reward for running the infrastructure of the network.' - ), - - markPrice: t( - 'A concept derived from traditional markets. It is a calculated value for the ‘current market price’ on a market.' - ), - openInterest: t( - 'The volume of all open positions in a given market (the sum of the size of all positions greater than 0).' - ), - indicativeVolume: t( - 'The volume at which all trades would occur if the auction was uncrossed now (when in auction mode).' - ), - bestBidVolume: t( - 'The aggregated volume being bid at the best bid price on the market.' - ), - bestOfferVolume: t( - 'The aggregated volume being offered at the best offer price on the market.' - ), - bestStaticBidVolume: t( - 'The aggregated volume being bid at the best static bid price on the market.' - ), - bestStaticOfferVolume: t( - 'The aggregated volume being offered at the best static offer price on the market.' - ), - - decimalPlaces: t('The smallest price increment on the book.'), - positionDecimalPlaces: t( - 'How big the smallest order / position on the market can be.' - ), - tradingMode: t('The trading mode the market is currently running.'), - state: t('The current state of the market'), - - base: t( - 'The first currency in a pair for a currency-based derivatives market.' - ), - quote: t( - 'The second currency in a pair for a currency-based derivatives market.' - ), - class: t( - 'The classification of the product. Examples: shares, commodities, crypto, FX.' - ), - sector: t( - 'Data about the sector. Example: "automotive" for a market based on value of Tesla shares.' - ), - - short: t( - 'A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.' - ), - long: t( - 'A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.' - ), - - tau: ( - - {t('Projection horizon measured as a year fraction used in ')} - - {t('Expected Shortfall')} - - {t(' calculation when obtaining Risk Factor Long and Risk Factor Short')} - - ), - riskAversionParameter: ( - - {t('Probability level used in ')} - - {t('Expected Shortfall')} - - {t(' calculation when obtaining Risk Factor Long and Risk Factor Short')} - - ), - - horizonSecs: t('Time horizon of the price projection in seconds.'), - probability: t( - 'Probability level for price projection, e.g. value of 0.95 will result in a price range such that over the specified projection horizon, the prices observed in the market should be in that range 95% of the time.' - ), - auctionExtensionSecs: t( - 'Auction extension duration in seconds, should the price breach its theoretical level over the specified horizon at the specified probability level.' - ), - - triggeringRatio: t('The triggering ratio for entering liquidity auction.'), - timeWindow: t('The length of time over which open interest is measured.'), - scalingFactor: t( - 'The scaling between the liquidity demand estimate, based on open interest and target stake.' - ), -}; - -interface RowProps { - field: string; - value: any; - decimalPlaces?: number; - asPercentage?: boolean; - unformatted?: boolean; -} - -const Row = ({ - field, - value, - decimalPlaces, - asPercentage, - unformatted, -}: RowProps) => { - const isNumber = typeof value === 'number' || !isNaN(Number(value)); - const isPrimitive = typeof value === 'string' || isNumber; - if (isPrimitive) { - return ( - - -
    {startCase(t(field))}
    -
    - - {isNumber && !unformatted - ? decimalPlaces - ? addDecimalsFormatNumber(value, decimalPlaces) - : asPercentage - ? formatNumberPercentage(new BigNumber(value * 100)) - : formatNumber(Number(value)) - : value} - -
    - ); - } - return null; -}; - -export interface MarketInfoTableProps { - data: any; - decimalPlaces?: number; - asPercentage?: boolean; - unformatted?: boolean; - omits?: string[]; -} - -export const MarketInfoTable = ({ - data, - decimalPlaces, - asPercentage, - unformatted, - omits = ['__typename'], -}: MarketInfoTableProps) => { - return ( - - {Object.entries(omit(data, ...omits) || []).map(([key, value]) => ( - - ))} - - ); -}; diff --git a/libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx b/libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx new file mode 100644 index 000000000..ef78bac6e --- /dev/null +++ b/libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx @@ -0,0 +1,103 @@ +import { t } from '@vegaprotocol/react-helpers'; +import { Link } from '@vegaprotocol/ui-toolkit'; +import type { ReactNode } from 'react'; + +export const tooltipMapping: Record = { + makerFee: t( + 'Maker portion of the fee is transferred to the non-aggressive, or passive party in the trade (the maker, as opposed to the taker).' + ), + liquidityFee: t( + 'Liquidity portion of the fee is paid to market makers for providing liquidity, and is transferred to the liquidity fee pool for the market.' + ), + infrastructureFee: t( + 'Fees paid to validators as a reward for running the infrastructure of the network.' + ), + + markPrice: t( + 'A concept derived from traditional markets. It is a calculated value for the ‘current market price’ on a market.' + ), + openInterest: t( + 'The volume of all open positions in a given market (the sum of the size of all positions greater than 0).' + ), + indicativeVolume: t( + 'The volume at which all trades would occur if the auction was uncrossed now (when in auction mode).' + ), + bestBidVolume: t( + 'The aggregated volume being bid at the best bid price on the market.' + ), + bestOfferVolume: t( + 'The aggregated volume being offered at the best offer price on the market.' + ), + bestStaticBidVolume: t( + 'The aggregated volume being bid at the best static bid price on the market.' + ), + bestStaticOfferVolume: t( + 'The aggregated volume being offered at the best static offer price on the market.' + ), + + decimalPlaces: t('The smallest price increment on the book.'), + positionDecimalPlaces: t( + 'How big the smallest order / position on the market can be.' + ), + tradingMode: t('The trading mode the market is currently running.'), + state: t('The current state of the market'), + + base: t( + 'The first currency in a pair for a currency-based derivatives market.' + ), + quote: t( + 'The second currency in a pair for a currency-based derivatives market.' + ), + class: t( + 'The classification of the product. Examples: shares, commodities, crypto, FX.' + ), + sector: t( + 'Data about the sector. Example: "automotive" for a market based on value of Tesla shares.' + ), + + short: t( + 'A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.' + ), + long: t( + 'A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.' + ), + + tau: ( + + {t('Projection horizon measured as a year fraction used in ')} + + {t('Expected Shortfall')} + + {t(' calculation when obtaining Risk Factor Long and Risk Factor Short')} + + ), + riskAversionParameter: ( + + {t('Probability level used in ')} + + {t('Expected Shortfall')} + + {t(' calculation when obtaining Risk Factor Long and Risk Factor Short')} + + ), + + horizonSecs: t('Time horizon of the price projection in seconds.'), + probability: t( + 'Probability level for price projection, e.g. value of 0.95 will result in a price range such that over the specified projection horizon, the prices observed in the market should be in that range 95% of the time.' + ), + auctionExtensionSecs: t( + 'Auction extension duration in seconds, should the price breach its theoretical level over the specified horizon at the specified probability level.' + ), + + triggeringRatio: t('The triggering ratio for entering liquidity auction.'), + timeWindow: t('The length of time over which open interest is measured.'), + scalingFactor: t( + 'The scaling between the liquidity demand estimate, based on open interest and target stake.' + ), +}; diff --git a/libs/liquidity/.babelrc b/libs/liquidity/.babelrc new file mode 100644 index 000000000..c7d82affe --- /dev/null +++ b/libs/liquidity/.babelrc @@ -0,0 +1,4 @@ +{ + "presets": ["@nrwl/next/babel"], + "plugins": [] +} diff --git a/libs/liquidity/.eslintrc.json b/libs/liquidity/.eslintrc.json new file mode 100644 index 000000000..db820c5d0 --- /dev/null +++ b/libs/liquidity/.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/liquidity/README.md b/libs/liquidity/README.md new file mode 100644 index 000000000..112274811 --- /dev/null +++ b/libs/liquidity/README.md @@ -0,0 +1,7 @@ +# Liquidity + +This library contains liquidity provision data providers and view containers. + +## Running unit tests + +Run `nx test liquidity` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/liquidity/jest.config.js b/libs/liquidity/jest.config.js new file mode 100644 index 000000000..fd4b91f52 --- /dev/null +++ b/libs/liquidity/jest.config.js @@ -0,0 +1,15 @@ +module.exports = { + displayName: 'positions', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/positions', + setupFilesAfterEnv: ['./src/setup-tests.ts'], +}; diff --git a/libs/liquidity/package.json b/libs/liquidity/package.json new file mode 100644 index 000000000..b301271be --- /dev/null +++ b/libs/liquidity/package.json @@ -0,0 +1,4 @@ +{ + "name": "@vegaprotocol/liquidity", + "version": "0.0.1" +} diff --git a/libs/liquidity/project.json b/libs/liquidity/project.json new file mode 100644 index 000000000..f1b81c3c4 --- /dev/null +++ b/libs/liquidity/project.json @@ -0,0 +1,43 @@ +{ + "root": "libs/liquidity", + "sourceRoot": "libs/liquidity/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/web:rollup", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/liquidity", + "tsConfig": "libs/liquidity/tsconfig.lib.json", + "project": "libs/liquidity/package.json", + "entryFile": "libs/liquidity/src/index.ts", + "external": ["react/jsx-runtime"], + "rollupConfig": "@nrwl/react/plugins/bundle-rollup", + "compiler": "babel", + "assets": [ + { + "glob": "libs/liquidity/README.md", + "input": ".", + "output": "." + } + ] + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/liquidity/**/*.{ts,tsx,js,jsx}"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/liquidity"], + "options": { + "jestConfig": "libs/liquidity/jest.config.js", + "passWithNoTests": true + } + } + } +} diff --git a/libs/liquidity/src/index.ts b/libs/liquidity/src/index.ts new file mode 100644 index 000000000..f41a696fd --- /dev/null +++ b/libs/liquidity/src/index.ts @@ -0,0 +1 @@ +export * from './lib'; diff --git a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts new file mode 100644 index 000000000..194f3f2fe --- /dev/null +++ b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts @@ -0,0 +1,252 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { AccountType, LiquidityProvisionStatus } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: MarketLiquidity +// ==================================================== + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection_edges_node { + __typename: "Account"; + /** + * Account type (General, Margin, etc) + */ + type: AccountType; + /** + * Balance as string - current account balance (approx. as balances can be updated several times per second) + */ + balance: string; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection_edges { + __typename: "AccountEdge"; + /** + * The account + */ + node: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection_edges_node; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection { + __typename: "AccountsConnection"; + /** + * List of accounts available for the connection + */ + edges: (MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection_edges | null)[] | null; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; + /** + * Collateral accounts relating to a party + */ + accountsConnection: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party_accountsConnection; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges_node { + __typename: "LiquidityProvision"; + /** + * Unique identifier for the order (set by the system after consensus) + */ + id: string | null; + /** + * The Id of the party making this commitment + */ + party: MarketLiquidity_market_liquidityProvisionsConnection_edges_node_party; + /** + * When the liquidity provision was initially created (formatted RFC3339) + */ + createdAt: string; + /** + * RFC3339Nano time of when the liquidity provision was updated + */ + updatedAt: string | null; + /** + * Specified as a unit-less number that represents the amount of settlement asset of the market. + */ + commitmentAmount: string; + /** + * Nominated liquidity fee factor, which is an input to the calculation of maker fees on the market, as per setting fees and rewarding liquidity providers. + */ + fee: string; + /** + * The current status of this liquidity provision + */ + status: LiquidityProvisionStatus; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection_edges { + __typename: "LiquidityProvisionsEdge"; + node: MarketLiquidity_market_liquidityProvisionsConnection_edges_node; +} + +export interface MarketLiquidity_market_liquidityProvisionsConnection { + __typename: "LiquidityProvisionsConnection"; + edges: (MarketLiquidity_market_liquidityProvisionsConnection_edges | null)[] | null; +} + +export interface MarketLiquidity_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. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 + */ + decimals: number; +} + +export interface MarketLiquidity_market_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * The name of the asset (string) + */ + settlementAsset: MarketLiquidity_market_tradableInstrument_instrument_product_settlementAsset; +} + +export interface MarketLiquidity_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * 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: MarketLiquidity_market_tradableInstrument_instrument_product; +} + +export interface MarketLiquidity_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of, or reference to, a fully specified instrument. + */ + instrument: MarketLiquidity_market_tradableInstrument_instrument; +} + +export interface MarketLiquidity_market_data_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; +} + +export interface MarketLiquidity_market_data_liquidityProviderFeeShare_party { + __typename: "Party"; + /** + * Party identifier + */ + id: string; +} + +export interface MarketLiquidity_market_data_liquidityProviderFeeShare { + __typename: "LiquidityProviderFeeShare"; + /** + * The liquidity provider party ID + */ + party: MarketLiquidity_market_data_liquidityProviderFeeShare_party; + /** + * The share owned by this liquidity provider (float) + */ + equityLikeShare: string; + /** + * The average entry valuation of the liquidity provider for the market + */ + averageEntryValuation: string; +} + +export interface MarketLiquidity_market_data { + __typename: "MarketData"; + /** + * market ID of the associated mark price + */ + market: MarketLiquidity_market_data_market; + /** + * the supplied stake for the market + */ + suppliedStake: string | null; + /** + * the sum of the size of all positions greater than 0. + */ + openInterest: string; + /** + * the amount of stake targeted for this market + */ + targetStake: string | null; + /** + * the market value proxy + */ + marketValueProxy: string; + /** + * the equity like share of liquidity fee for each liquidity provider + */ + liquidityProviderFeeShare: MarketLiquidity_market_data_liquidityProviderFeeShare[] | null; +} + +export interface MarketLiquidity_market { + __typename: "Market"; + /** + * Market ID + */ + id: 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 indicates 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. + * This sets how big the smallest order / position on the market can be. + */ + positionDecimalPlaces: number; + /** + * The list of the liquidity provision commitments for this market + */ + liquidityProvisionsConnection: MarketLiquidity_market_liquidityProvisionsConnection; + /** + * An instance of, or reference to, a tradable instrument. + */ + tradableInstrument: MarketLiquidity_market_tradableInstrument; + /** + * marketData for the given market + */ + data: MarketLiquidity_market_data | null; +} + +export interface MarketLiquidity { + /** + * An instrument that is trading on the Vega network + */ + market: MarketLiquidity_market | null; +} + +export interface MarketLiquidityVariables { + marketId: string; + partyId?: string | null; +} diff --git a/libs/liquidity/src/lib/__generated__/index.ts b/libs/liquidity/src/lib/__generated__/index.ts new file mode 100644 index 000000000..ac85c1929 --- /dev/null +++ b/libs/liquidity/src/lib/__generated__/index.ts @@ -0,0 +1 @@ +export * from './MarketLiquidity'; diff --git a/libs/liquidity/src/lib/index.ts b/libs/liquidity/src/lib/index.ts new file mode 100644 index 000000000..adca1cf63 --- /dev/null +++ b/libs/liquidity/src/lib/index.ts @@ -0,0 +1,3 @@ +export * from './__generated__'; +export * from './liquidity-data-provider'; +export * from './liquidity-table'; diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts new file mode 100644 index 000000000..c96eb285b --- /dev/null +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -0,0 +1,172 @@ +import { gql, useQuery } from '@apollo/client'; +import type { LiquidityProvisionStatus } from '@vegaprotocol/types'; +import { AccountType } from '@vegaprotocol/types'; +import { useNetworkParam } from '@vegaprotocol/react-helpers'; +import BigNumber from 'bignumber.js'; +import type { + MarketLiquidity, + MarketLiquidity_market_data_liquidityProviderFeeShare, +} from './__generated__'; + +const SISKA_NETWORK_PARAMETER = 'market.liquidity.stakeToCcySiskas'; + +const MARKET_LIQUIDITY_QUERY = gql` + query MarketLiquidity($marketId: ID!, $partyId: String) { + market(id: $marketId) { + id + decimalPlaces + positionDecimalPlaces + liquidityProvisionsConnection(party: $partyId) { + edges { + node { + id + party { + id + accountsConnection(marketId: $marketId, type: ACCOUNT_TYPE_BOND) { + edges { + node { + type + balance + } + } + } + } + createdAt + updatedAt + commitmentAmount + fee + status + } + } + } + tradableInstrument { + instrument { + code + product { + ... on Future { + settlementAsset { + id + symbol + decimals + } + } + } + } + } + data { + market { + id + } + suppliedStake + openInterest + targetStake + marketValueProxy + liquidityProviderFeeShare { + party { + id + } + equityLikeShare + averageEntryValuation + } + } + } + } +`; + +export interface LiquidityProvision { + party: string; + commitmentAmount: string | undefined; + fee: string | undefined; + equityLikeShare: string; + averageEntryValuation: string; + obligation: string | null; + supplied: string | null; + status?: LiquidityProvisionStatus; + createdAt: string | undefined; + updatedAt: string | null | undefined; +} + +export interface LiquidityData { + liquidityProviders: LiquidityProvision[]; + suppliedStake?: string | null; + targetStake?: string | null; + code?: string; + symbol?: string; + decimalPlaces?: number; + positionDecimalPlaces?: number; + assetDecimalPlaces?: number; +} + +export const useLiquidityProvision = ({ + marketId, + partyId, +}: { + partyId?: string; + marketId?: string; +}) => { + const { data: stakeToCcySiskas } = useNetworkParam(SISKA_NETWORK_PARAMETER); + const stakeToCcySiska = stakeToCcySiskas && stakeToCcySiskas[0]; + const { data, loading, error } = useQuery( + MARKET_LIQUIDITY_QUERY, + { + variables: { marketId }, + } + ); + const liquidityProviders = ( + data?.market?.data?.liquidityProviderFeeShare || [] + ) + ?.filter( + (p: MarketLiquidity_market_data_liquidityProviderFeeShare) => + !partyId || p.party.id === partyId + ) // if partyId is provided, filter out other parties + .map((provider: MarketLiquidity_market_data_liquidityProviderFeeShare) => { + const liquidityProvisionConnection = + data?.market?.liquidityProvisionsConnection.edges?.find( + (e) => e?.node.party.id === provider.party.id + ); + const balance = + liquidityProvisionConnection?.node?.party.accountsConnection.edges?.reduce( + (acc, e) => { + return e?.node.type === AccountType.ACCOUNT_TYPE_BOND // just an extra check to make sure we only use bond accounts + ? acc.plus(new BigNumber(e?.node.balance ?? 0)) + : acc; + }, + new BigNumber(0) + ); + const obligation = + stakeToCcySiska && + new BigNumber(stakeToCcySiska) + .times(liquidityProvisionConnection?.node?.commitmentAmount ?? 1) + .toString(); + const supplied = + stakeToCcySiska && + new BigNumber(stakeToCcySiska).times(balance ?? 1).toString(); + return { + party: provider.party.id, + createdAt: liquidityProvisionConnection?.node?.createdAt, + updatedAt: liquidityProvisionConnection?.node?.updatedAt, + commitmentAmount: liquidityProvisionConnection?.node?.commitmentAmount, + fee: liquidityProvisionConnection?.node?.fee, + status: liquidityProvisionConnection?.node?.status, + equityLikeShare: provider.equityLikeShare, + averageEntryValuation: provider.averageEntryValuation, + obligation, + supplied, + }; + }); + const liquidityData: LiquidityData = { + liquidityProviders, + suppliedStake: data?.market?.data?.suppliedStake, + targetStake: data?.market?.data?.targetStake, + decimalPlaces: data?.market?.decimalPlaces, + positionDecimalPlaces: data?.market?.positionDecimalPlaces, + code: data?.market?.tradableInstrument.instrument.code, + assetDecimalPlaces: + data?.market?.tradableInstrument.instrument.product.settlementAsset + .decimals, + symbol: + data?.market?.tradableInstrument.instrument.product.settlementAsset + .symbol, + }; + return { data: liquidityData, loading, error }; +}; diff --git a/libs/liquidity/src/lib/liquidity-table.spec.tsx b/libs/liquidity/src/lib/liquidity-table.spec.tsx new file mode 100644 index 000000000..f96ef2e3e --- /dev/null +++ b/libs/liquidity/src/lib/liquidity-table.spec.tsx @@ -0,0 +1,53 @@ +import LiquidityTable from './liquidity-table'; +import { act, render, screen, waitFor } from '@testing-library/react'; +import { LiquidityProvisionStatus } from '@vegaprotocol/types'; +import type { LiquidityProvision } from './liquidity-data-provider'; + +const singleRow: LiquidityProvision = { + party: 'a3f762f0a6e998e1d0c6e73017a13ec8a22386c30f7f64a1bdca47330bc592dd', + createdAt: '2022-08-19T17:18:36.257028Z', + updatedAt: '2022-08-19T17:18:36.257028Z', + commitmentAmount: '56298653179', + fee: '0.001', + status: LiquidityProvisionStatus.STATUS_ACTIVE, + equityLikeShare: '0.5', + averageEntryValuation: '0.5', + supplied: '67895', + obligation: '56785', +}; + +const singleRowData = [singleRow]; + +describe('LiquidityTable', () => { + it('should render successfully', async () => { + await act(async () => { + const { baseElement } = render(); + expect(baseElement).toBeTruthy(); + }); + }); + + it('should render correct columns', async () => { + act(async () => { + render(); + await waitFor(async () => { + const headers = await screen.getAllByRole('columnheader'); + expect(headers).toHaveLength(9); + expect( + headers.map((h) => + h.querySelector('[ref="eText"]')?.textContent?.trim() + ) + ).toEqual([ + 'Party', + 'Average entry valuation', + 'Updated', + 'Created', + 'Supplied (siskas)', + 'Obligation (siskas)', + 'Share', + 'Fee', + 'Status', + ]); + }); + }); + }); +}); diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx new file mode 100644 index 000000000..a40e6c49f --- /dev/null +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -0,0 +1,117 @@ +import { forwardRef } from 'react'; +import { + addDecimalsFormatNumber, + formatNumberPercentage, + getDateTimeFormat, + t, +} from '@vegaprotocol/react-helpers'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import type { AgGridReact } from 'ag-grid-react'; +import { AgGridColumn } from 'ag-grid-react'; +import type { LiquidityProvision } from './liquidity-data-provider'; +import type { ValueFormatterParams } from 'ag-grid-community'; +import BigNumber from 'bignumber.js'; +import type { LiquidityProvisionStatus } from '@vegaprotocol/types'; +import { LiquidityProvisionStatusMapping } from '@vegaprotocol/types'; + +const assetDecimalsFormatter = ({ value, data }: ValueFormatterParams) => { + if (!value) return '-'; + return addDecimalsFormatNumber(value, data.assetDecimalPlaces); +}; + +const percentageFormatter = ({ value }: ValueFormatterParams) => { + if (!value) return '-'; + return formatNumberPercentage(new BigNumber(value).times(100), 4) || '-'; +}; + +const dateValueFormatter = ({ value }: { value?: string | null }) => { + if (!value) { + return '-'; + } + return getDateTimeFormat().format(new Date(value)); +}; + +export interface LiquidityTableProps { + data: LiquidityProvision[]; +} + +export const LiquidityTable = forwardRef( + (props, ref) => { + return ( + data.party} + rowHeight={34} + ref={ref} + defaultColDef={{ + flex: 1, + resizable: true, + minWidth: 100, + }} + rowData={props.data} + {...props} + > + + + + + + + + { + if (!value) return value; + return LiquidityProvisionStatusMapping[value]; + }} + /> + + + + ); + } +); + +export default LiquidityTable; diff --git a/libs/liquidity/src/setup-tests.ts b/libs/liquidity/src/setup-tests.ts new file mode 100644 index 000000000..7b0828bfa --- /dev/null +++ b/libs/liquidity/src/setup-tests.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom'; diff --git a/libs/liquidity/tsconfig.json b/libs/liquidity/tsconfig.json new file mode 100644 index 000000000..1eabf319c --- /dev/null +++ b/libs/liquidity/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/liquidity/tsconfig.lib.json b/libs/liquidity/tsconfig.lib.json new file mode 100644 index 000000000..de828a9a8 --- /dev/null +++ b/libs/liquidity/tsconfig.lib.json @@ -0,0 +1,22 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/next/typings/image.d.ts" + ], + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/libs/liquidity/tsconfig.spec.json b/libs/liquidity/tsconfig.spec.json new file mode 100644 index 000000000..0659641ca --- /dev/null +++ b/libs/liquidity/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "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", + "../react-helpers/src/lib/grid-cells/summary-row.spec.ts" + ] +} diff --git a/libs/market-list/src/lib/components/select-market.tsx b/libs/market-list/src/lib/components/select-market.tsx index 130742d2b..bd56d3445 100644 --- a/libs/market-list/src/lib/components/select-market.tsx +++ b/libs/market-list/src/lib/components/select-market.tsx @@ -100,8 +100,7 @@ export const SelectMarketPopover = ({ marketName: string; onSelect: (id: string) => void; }) => { - const triggerClasses = - 'sm:text-lg md:text-xl lg:text-2xl flex items-center gap-4 whitespace-nowrap'; + const triggerClasses = 'flex items-center gap-4 whitespace-nowrap'; const { keypair } = useVegaWallet(); const [open, setOpen] = useState(false); const { data, loading: marketsLoading } = useMarketList(); diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx index 4b2ab1201..0cfaeb302 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx @@ -83,7 +83,7 @@ describe('OrderFeedback', () => { '1.00' ); expect(screen.getByText('Size').nextElementSibling).toHaveTextContent( - `+ 200` + `+200` ); }); }); diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index 7f8981033..484f1e7aa 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -1,20 +1,15 @@ import { useEnvironment } from '@vegaprotocol/environment'; import type { OrderEvent_busEvents_event_Order } from '../../order-hooks/__generated__/OrderEvent'; -import { - addDecimalsFormatNumber, - t, - positiveClassNames, - negativeClassNames, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers'; import { OrderRejectionReasonMapping, OrderStatus, OrderStatusMapping, OrderTimeInForceMapping, OrderType, - Side, } from '@vegaprotocol/types'; import type { VegaTxState } from '@vegaprotocol/wallet'; +import { Link } from '@vegaprotocol/ui-toolkit'; export interface OrderFeedbackProps { transaction: VegaTxState; @@ -51,20 +46,12 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => { )}

    {t(`Size`)}

    -

    - {`${ - order.side === Side.SIDE_BUY ? '+' : '-' - } ${addDecimalsFormatNumber( - order.size, - order.market?.positionDecimalPlaces ?? 0 - )} - `} +

    +

@@ -72,8 +59,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => { {transaction.txHash && ( )} diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index fc1a155dc..4d397d6c1 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -2,8 +2,9 @@ import { t, addDecimalsFormatNumber, toDecimal, + Size, } from '@vegaprotocol/react-helpers'; -import { OrderType, Side } from '@vegaprotocol/types'; +import { OrderType } from '@vegaprotocol/types'; import { FormGroup, Input, @@ -64,16 +65,15 @@ export const OrderEditDialog = ({
)}
-

{t(`Remaining size`)}

-

{t(`Size`)}

+

+ { + } - > - {order.side === Side.SIDE_BUY ? '+' : '-'} - {order.size}

diff --git a/libs/react-helpers/.eslintrc.json b/libs/react-helpers/.eslintrc.json index 734ddacee..db820c5d0 100644 --- a/libs/react-helpers/.eslintrc.json +++ b/libs/react-helpers/.eslintrc.json @@ -1,6 +1,6 @@ { "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "ignorePatterns": ["!**/*", "__generated__"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], diff --git a/libs/react-helpers/src/hooks/__generated__/NetworkParams.ts b/libs/react-helpers/src/hooks/__generated__/NetworkParams.ts new file mode 100644 index 000000000..493e5eaf1 --- /dev/null +++ b/libs/react-helpers/src/hooks/__generated__/NetworkParams.ts @@ -0,0 +1,27 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: NetworkParams +// ==================================================== + +export interface NetworkParams_networkParameters { + __typename: "NetworkParameter"; + /** + * The name of the network parameter + */ + key: string; + /** + * The value of the network parameter + */ + value: string; +} + +export interface NetworkParams { + /** + * return the full list of network parameters + */ + networkParameters: NetworkParams_networkParameters[] | null; +} diff --git a/libs/react-helpers/src/hooks/__generated__/index.ts b/libs/react-helpers/src/hooks/__generated__/index.ts new file mode 100644 index 000000000..3c5207c0e --- /dev/null +++ b/libs/react-helpers/src/hooks/__generated__/index.ts @@ -0,0 +1 @@ +export * from './NetworkParams'; diff --git a/libs/react-helpers/src/hooks/index.ts b/libs/react-helpers/src/hooks/index.ts index 77aeb7866..387bfe3ed 100644 --- a/libs/react-helpers/src/hooks/index.ts +++ b/libs/react-helpers/src/hooks/index.ts @@ -1,7 +1,8 @@ export * from './use-apply-grid-transaction'; export * from './use-data-provider'; -export * from './use-theme-switcher'; export * from './use-fetch'; -export * from './use-resize'; +export * from './use-network-params'; export * from './use-outside-click'; +export * from './use-resize'; export * from './use-screen-dimensions'; +export * from './use-theme-switcher'; diff --git a/libs/react-helpers/src/hooks/use-network-params.ts b/libs/react-helpers/src/hooks/use-network-params.ts new file mode 100644 index 000000000..c8c16cb3d --- /dev/null +++ b/libs/react-helpers/src/hooks/use-network-params.ts @@ -0,0 +1,37 @@ +import { gql, useQuery } from '@apollo/client'; +import type { NetworkParams } from './__generated__/NetworkParams'; + +export const NETWORK_PARAMETERS_QUERY = gql` + query NetworkParams { + networkParameters { + key + value + } + } +`; + +export const useNetworkParam = (param: string) => { + const { data, loading, error } = useQuery( + NETWORK_PARAMETERS_QUERY + ); + const foundParams = data?.networkParameters?.filter((p) => param === p.key); + return { + data: foundParams ? foundParams.map((f) => f.value) : null, + loading, + error, + }; +}; + +export const useNetworkParams = (params: string[]) => { + const { data, loading, error } = useQuery( + NETWORK_PARAMETERS_QUERY + ); + const foundParams = data?.networkParameters + ?.filter((p) => params.includes(p.key)) + .sort((a, b) => params.indexOf(a.key) - params.indexOf(b.key)); + return { + data: foundParams ? foundParams.map((f) => f.value) : null, + loading, + error, + }; +}; diff --git a/libs/react-helpers/src/lib/format/index.ts b/libs/react-helpers/src/lib/format/index.ts index 608da22cb..8aff8a189 100644 --- a/libs/react-helpers/src/lib/format/index.ts +++ b/libs/react-helpers/src/lib/format/index.ts @@ -1,5 +1,5 @@ export * from './date'; export * from './number'; -export * from './truncate'; export * from './size'; +export * from './truncate'; export * from './utils'; diff --git a/libs/react-helpers/src/lib/grid/index.tsx b/libs/react-helpers/src/lib/grid/index.ts similarity index 90% rename from libs/react-helpers/src/lib/grid/index.tsx rename to libs/react-helpers/src/lib/grid/index.ts index 1f96724a5..c71250dbb 100644 --- a/libs/react-helpers/src/lib/grid/index.tsx +++ b/libs/react-helpers/src/lib/grid/index.ts @@ -3,5 +3,6 @@ export * from './cumulative-vol-cell'; export * from './flash-cell'; export * from './price-cell'; export * from './price-flash-cell'; +export * from './size'; export * from './summary-rows'; export * from './vol-cell'; diff --git a/libs/react-helpers/src/lib/grid/size.tsx b/libs/react-helpers/src/lib/grid/size.tsx new file mode 100644 index 000000000..acd38c67b --- /dev/null +++ b/libs/react-helpers/src/lib/grid/size.tsx @@ -0,0 +1,47 @@ +import { Side } from '@vegaprotocol/types'; +import type { ICellRendererParams } from 'ag-grid-community'; +import classNames from 'classnames'; +import { addDecimalsFormatNumber } from '../format'; +import { negativeClassNames, positiveClassNames } from './cell-class-rules'; + +export const Size = ({ + value, + side, + positionDecimalPlaces = 0, +}: { + value: string; + side: Side; + positionDecimalPlaces?: number; +}) => { + return ( + + {side === Side.SIDE_BUY ? '+' : side === Side.SIDE_SELL ? '-' : ''} + {addDecimalsFormatNumber(value, positionDecimalPlaces)} + + ); +}; + +export interface ISizeCellProps extends ICellRendererParams { + value: number | string; +} + +export const SizeCell = ({ value, data }: ISizeCellProps) => { + if ((!value && value !== 0) || isNaN(Number(value))) { + return -; + } + return ( + + ); +}; + +SizeCell.displayName = 'SizeCell'; diff --git a/libs/react-helpers/src/lib/index.ts b/libs/react-helpers/src/lib/index.ts new file mode 100644 index 000000000..a380ae3dc --- /dev/null +++ b/libs/react-helpers/src/lib/index.ts @@ -0,0 +1,12 @@ +export * from './context'; +export * from './format'; +export * from './grid'; +export * from './storage'; +export * from './validate'; +export * from './assets'; +export * from './determine-id'; +export * from './generic-data-provider'; +export * from './i18n'; +export * from './pagination'; +export * from './remove-0x'; +export * from './time'; diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index cfc805369..44908cee9 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -98,6 +98,18 @@ export enum Interval { INTERVAL_I6H = "INTERVAL_I6H", } +/** + * Status of a liquidity provision order + */ +export enum LiquidityProvisionStatus { + STATUS_ACTIVE = "STATUS_ACTIVE", + STATUS_CANCELLED = "STATUS_CANCELLED", + STATUS_PENDING = "STATUS_PENDING", + STATUS_REJECTED = "STATUS_REJECTED", + STATUS_STOPPED = "STATUS_STOPPED", + STATUS_UNDEPLOYED = "STATUS_UNDEPLOYED", +} + /** * The current state of a market */ diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts index ba453c2fc..281649e01 100644 --- a/libs/types/src/global-types-mappings.ts +++ b/libs/types/src/global-types-mappings.ts @@ -17,6 +17,18 @@ export enum AccountTypeMapping { ACCOUNT_TYPE_SETTLEMENT = 'Settlement', } +/** + * Status of a liquidity provision order + */ +export enum LiquidityProvisionStatusMapping { + STATUS_ACTIVE = 'Active', + STATUS_CANCELLED = 'Cancelled', + STATUS_PENDING = 'Pending', + STATUS_REJECTED = 'Rejected', + STATUS_STOPPED = 'Stopped', + STATUS_UNDEPLOYED = 'Undeployed', +} + export enum AuctionTriggerMapping { AUCTION_TRIGGER_BATCH = 'batch', AUCTION_TRIGGER_LIQUIDITY = 'liquidity', @@ -25,17 +37,6 @@ export enum AuctionTriggerMapping { AUCTION_TRIGGER_UNSPECIFIED = 'unspecified', } -/** - * Comparator describes the type of comparison. - */ -export enum ConditionOperatorMapping { - OPERATOR_EQUALS = 'EQUALS', - OPERATOR_GREATER_THAN = 'GREATER_THAN', - OPERATOR_GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL', - OPERATOR_LESS_THAN = 'LESS_THAN', - OPERATOR_LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL', -} - /** * The status of a deposit */ @@ -201,7 +202,7 @@ export enum ProposalRejectionReasonMapping { PROPOSAL_ERROR_INVALID_SHAPE = 'Invalid shape', PROPOSAL_ERROR_MAJORITY_THRESHOLD_NOT_REACHED = 'Majority threshold not reached', PROPOSAL_ERROR_MARKET_MISSING_LIQUIDITY_COMMITMENT = 'Market missing liquidity commitment', - PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'Missing builtin asset field', + PROPOSAL_ERROR_MISSING_BUILTIN_ASSET_FIELD = 'Missing built-in asset field', PROPOSAL_ERROR_MISSING_COMMITMENT_AMOUNT = 'Missing commitment amount', PROPOSAL_ERROR_MISSING_ERC20_CONTRACT_ADDRESS = 'Missing ERC20 contract address', PROPOSAL_ERROR_NETWORK_PARAMETER_INVALID_KEY = 'Network parameter invalid key', diff --git a/libs/ui-toolkit/src/components/tabs/tabs.tsx b/libs/ui-toolkit/src/components/tabs/tabs.tsx index 01f6cb41e..9efd08e1a 100644 --- a/libs/ui-toolkit/src/components/tabs/tabs.tsx +++ b/libs/ui-toolkit/src/components/tabs/tabs.tsx @@ -5,11 +5,12 @@ import { Children, isValidElement, useState } from 'react'; interface TabsProps { children: ReactElement[]; + active?: string; } -export const Tabs = ({ children }: TabsProps) => { +export const Tabs = ({ children, active: activeDefaultId }: TabsProps) => { const [activeTab, setActiveTab] = useState(() => { - return children[0].props.id; + return activeDefaultId ?? children[0].props.id; }); return ( @@ -24,7 +25,7 @@ export const Tabs = ({ children }: TabsProps) => { role="tablist" > {Children.map(children, (child) => { - if (!isValidElement(child)) return null; + if (!isValidElement(child) || child.props.hidden) return null; const isActive = child.props.id === activeTab; const triggerClass = classNames( 'relative px-4 py-2 border-r border-neutral-300 dark:border-neutral-700', @@ -51,7 +52,7 @@ export const Tabs = ({ children }: TabsProps) => {
{Children.map(children, (child) => { - if (!isValidElement(child)) return null; + if (!isValidElement(child) || child.props.hidden) return null; return ( { diff --git a/libs/withdraws/src/index.ts b/libs/withdraws/src/index.ts index 329c09dd4..75697296d 100644 --- a/libs/withdraws/src/index.ts +++ b/libs/withdraws/src/index.ts @@ -10,3 +10,4 @@ export * from './lib/use-verify-withdrawal'; export * from './lib/use-withdrawals'; export * from './lib/__generated__/Withdrawals'; export * from './lib/__generated__/WithdrawalFields'; +export * from './lib/__generated__/WithdrawFormQuery'; diff --git a/tsconfig.base.json b/tsconfig.base.json index 0d4de9e97..860b2e449 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -25,6 +25,7 @@ "@vegaprotocol/environment": ["libs/environment/src/index.ts"], "@vegaprotocol/fills": ["libs/fills/src/index.ts"], "@vegaprotocol/governance": ["libs/governance/src/index.ts"], + "@vegaprotocol/liquidity": ["libs/liquidity/src/index.ts"], "@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"], "@vegaprotocol/market-list": ["libs/market-list/src/index.ts"], "@vegaprotocol/network-info": ["libs/network-info/src/index.ts"], diff --git a/workspace.json b/workspace.json index 9b16e4d92..0034a59e4 100644 --- a/workspace.json +++ b/workspace.json @@ -14,6 +14,7 @@ "explorer-e2e": "apps/explorer-e2e", "fills": "libs/fills", "governance": "libs/governance", + "liquidity": "libs/liquidity", "market-depth": "libs/market-depth", "market-list": "libs/market-list", "network-info": "libs/network-info", From beeb1db1e1fa462262210644a5eab32f14b5bb78 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 7 Sep 2022 12:04:38 +0000 Subject: [PATCH 17/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 186 +++++++++++++++---- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 146 insertions(+), 42 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 8d016d0bc..b56774652 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -177,10 +177,15 @@ "tranche_id": 34, "tranche_start": "2023-02-01T00:00:00.000Z", "tranche_end": "2023-08-01T00:00:00.000Z", - "total_added": "30000", + "total_added": "37500", "total_removed": "0", - "locked_amount": "30000", + "locked_amount": "37500", "deposits": [ + { + "amount": "7500", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x1a8578ff6c2531d666b92690b7fc02e0512588dae82a44a163f25010224b6272" + }, { "amount": "30000", "user": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", @@ -189,6 +194,21 @@ ], "withdrawals": [], "users": [ + { + "address": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "deposits": [ + { + "amount": "7500", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 34, + "tx": "0x1a8578ff6c2531d666b92690b7fc02e0512588dae82a44a163f25010224b6272" + } + ], + "withdrawals": [], + "total_tokens": "7500", + "withdrawn_tokens": "0", + "remaining_tokens": "7500" + }, { "address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600", "deposits": [ @@ -212,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107636.57489101783054236", + "locked_amount": "107580.90108459106026495", "deposits": [ { "amount": "129999.45", @@ -278,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51984.86555048198776", + "locked_amount": "51951.04483130390528", "deposits": [ { "amount": "2600", @@ -662,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48803.65479050649299889", + "locked_amount": "48749.0439726514802140488", "deposits": [ { "amount": "97499.58", @@ -695,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66706.170499119191297676703152", + "locked_amount": "66631.5269392757717508219078", "deposits": [ { "amount": "135173.4239508", @@ -728,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20530.85477632753436021", + "locked_amount": "20507.88094833431029395", "deposits": [ { "amount": "32499.86", @@ -761,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6682.594002995642335695", + "locked_amount": "6675.116244916599046476", "deposits": [ { "amount": "10833.29", @@ -867,10 +887,15 @@ "tranche_id": 32, "tranche_start": "2022-05-01T00:00:00.000Z", "tranche_end": "2022-11-01T00:00:00.000Z", - "total_added": "22500", + "total_added": "30000", "total_removed": "0", - "locked_amount": "6692.70833333333325", + "locked_amount": "8885.3468448067629", "deposits": [ + { + "amount": "7500", + "user": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", + "tx": "0xef4f76136a4f364a8f6f6a66bbbf905542bdc8c988f54628df9d408a06c290b1" + }, { "amount": "15000", "user": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1", @@ -884,6 +909,27 @@ ], "withdrawals": [], "users": [ + { + "address": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", + "deposits": [ + { + "amount": "7500", + "user": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", + "tranche_id": 32, + "tx": "0xef4f76136a4f364a8f6f6a66bbbf905542bdc8c988f54628df9d408a06c290b1" + }, + { + "amount": "7500", + "user": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", + "tranche_id": 32, + "tx": "0x72aca81fa924e10e855192abff443242225b9853f730feee595acdc1f500b139" + } + ], + "withdrawals": [], + "total_tokens": "15000", + "withdrawn_tokens": "0", + "remaining_tokens": "15000" + }, { "address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1", "deposits": [ @@ -898,21 +944,6 @@ "total_tokens": "15000", "withdrawn_tokens": "0", "remaining_tokens": "15000" - }, - { - "address": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", - "deposits": [ - { - "amount": "7500", - "user": "0xd481bCC42265089abEA41Efdb655EDCF8fF9068c", - "tranche_id": 32, - "tx": "0x72aca81fa924e10e855192abff443242225b9853f730feee595acdc1f500b139" - } - ], - "withdrawals": [], - "total_tokens": "7500", - "withdrawn_tokens": "0", - "remaining_tokens": "7500" } ] }, @@ -920,10 +951,15 @@ "tranche_id": 33, "tranche_start": "2022-11-01T00:00:00.000Z", "tranche_end": "2023-05-01T00:00:00.000Z", - "total_added": "15000", + "total_added": "22500", "total_removed": "0", - "locked_amount": "15000", + "locked_amount": "22500", "deposits": [ + { + "amount": "7500", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x1a8578ff6c2531d666b92690b7fc02e0512588dae82a44a163f25010224b6272" + }, { "amount": "15000", "user": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1", @@ -932,6 +968,21 @@ ], "withdrawals": [], "users": [ + { + "address": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "deposits": [ + { + "amount": "7500", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 33, + "tx": "0x1a8578ff6c2531d666b92690b7fc02e0512588dae82a44a163f25010224b6272" + } + ], + "withdrawals": [], + "total_tokens": "7500", + "withdrawn_tokens": "0", + "remaining_tokens": "7500" + }, { "address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1", "deposits": [ @@ -955,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1422958.627795535038162474", + "locked_amount": "1421711.293708737276320088", "deposits": [ { "amount": "1852091.69", @@ -1241,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33891.78240740740725", + "locked_amount": "33837.5746968095795", "deposits": [ { "amount": "12500", @@ -2108,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3550.5796929213776221636593856094", + "locked_amount": "3513.9223077720049602058602434723", "deposits": [ { "amount": "2833.333333", @@ -5830,7 +5881,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35910.000000000000000003", + "total_added": "35917.000000000000000003", "total_removed": "16791.59106856284", "locked_amount": "0", "deposits": [ @@ -7354,6 +7405,16 @@ "user": "0xaaaaFd67947Ef241D8C24C863893800083855Ed6", "tx": "0xd5947eb1f6aca62cd34eaee000f7b0508530096a2aaf6b1b83a78485b8600aeb" }, + { + "amount": "5", + "user": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", + "tx": "0x5526139947d7ddefa84e8ec476916c897754efb459d268e27086d8a6f0aeebf9" + }, + { + "amount": "2", + "user": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", + "tx": "0xbdbedb936d857d6897aeb89be44c8dbfdc87993d69b0e9a3cf6aa6fed0fb9e2b" + }, { "amount": "30", "user": "0x9646850641B15535e9e46646fbb98907eba83c6c", @@ -15816,6 +15877,27 @@ "withdrawn_tokens": "3467", "remaining_tokens": "0" }, + { + "address": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", + "deposits": [ + { + "amount": "5", + "user": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", + "tranche_id": 11, + "tx": "0x5526139947d7ddefa84e8ec476916c897754efb459d268e27086d8a6f0aeebf9" + }, + { + "amount": "2", + "user": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", + "tranche_id": 11, + "tx": "0xbdbedb936d857d6897aeb89be44c8dbfdc87993d69b0e9a3cf6aa6fed0fb9e2b" + } + ], + "withdrawals": [], + "total_tokens": "7", + "withdrawn_tokens": "0", + "remaining_tokens": "7" + }, { "address": "0x9646850641B15535e9e46646fbb98907eba83c6c", "deposits": [ @@ -22238,7 +22320,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2211093.31407603733441220146", + "locked_amount": "2209176.50133351736505168046", "deposits": [ { "amount": "1998.95815", @@ -23093,10 +23175,20 @@ "tranche_id": 2, "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", - "total_added": "15788853.065470999700000001", + "total_added": "15870102.715470999700000001", "total_removed": "189184.1028716497150444", - "locked_amount": "13072809.6574627485670984633923457159881048", + "locked_amount": "13133285.6166809441775928660565835030062179", "deposits": [ + { + "amount": "16249.93", + "user": "0x2c49f0C25B9195254eEE5d055F07E3bb96c4408a", + "tx": "0x584b243629e46fc25f8cb79481a2cdcc5cf06eabe498fee89910367b6ff88c47" + }, + { + "amount": "64999.72", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xd69f6d2ce85154dc321c43f1eb099f9eee07c1ecfd59142d40ea2ed42f90f75a" + }, { "amount": "16249.93", "user": "0x2c49f0C25B9195254eEE5d055F07E3bb96c4408a", @@ -24079,6 +24171,12 @@ { "address": "0x2c49f0C25B9195254eEE5d055F07E3bb96c4408a", "deposits": [ + { + "amount": "16249.93", + "user": "0x2c49f0C25B9195254eEE5d055F07E3bb96c4408a", + "tranche_id": 2, + "tx": "0x584b243629e46fc25f8cb79481a2cdcc5cf06eabe498fee89910367b6ff88c47" + }, { "amount": "16249.93", "user": "0x2c49f0C25B9195254eEE5d055F07E3bb96c4408a", @@ -24099,13 +24197,19 @@ } ], "withdrawals": [], - "total_tokens": "81249.65", + "total_tokens": "97499.58", "withdrawn_tokens": "0", - "remaining_tokens": "81249.65" + "remaining_tokens": "97499.58" }, { "address": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "deposits": [ + { + "amount": "64999.72", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xd69f6d2ce85154dc321c43f1eb099f9eee07c1ecfd59142d40ea2ed42f90f75a" + }, { "amount": "64999.7225", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24571,9 +24675,9 @@ "tx": "0x42428fc448690e236a517d10ecc478b21a8519a8305c56a04c76ddbafe5764f8" } ], - "total_tokens": "194999.1675", + "total_tokens": "259998.8875", "withdrawn_tokens": "33394.5217386716073", - "remaining_tokens": "161604.6457613283927" + "remaining_tokens": "226604.3657613283927" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26113,7 +26217,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2724259.594291574628633947", - "locked_amount": "6409395.04819500765351778816691193", + "locked_amount": "6403120.198209139246305526849101774", "deposits": [ { "amount": "129284.449", @@ -31196,7 +31300,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2215487.343700183750010612117323019", + "locked_amount": "2213008.11252078968651101922726495", "deposits": [ { "amount": "552496.6455", @@ -32605,7 +32709,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "350360.37476357149624216949974632", + "locked_amount": "350056.644827550478175919964485", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 9c70f0d6e..756066daa 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "96.2088413242009280000952562785388128", + "locked_amount": "95.55940005073561960009461326737696596", "deposits": [ { "amount": "1000", From 293e2ffbc3d97b3364b29463646fd29dc1490793 Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Wed, 7 Sep 2022 14:02:23 +0100 Subject: [PATCH 18/66] Fix/UI dialog overflows (#1276) * fix: dialog overflows * fix: hide close icon when no change function passed in --- .../src/components/dialog/dialog.tsx | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index 82a1d43e1..2d1e861b8 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -1,3 +1,4 @@ +import { useEffect } from 'react'; import * as DialogPrimitives from '@radix-ui/react-dialog'; import classNames from 'classnames'; @@ -26,12 +27,12 @@ export function Dialog({ size = 'small', }: DialogProps) { const contentClasses = classNames( - 'fixed relative top-0 left-0 z-20 flex items-center justify-center', + 'fixed top-0 left-0 z-20 flex items-center justify-center overflow-scroll', 'w-full h-full' ); const wrapperClasses = classNames( // Positions the modal in the center of screen - 'z-20 fixed rounded top-[10vh] max-w-[90vw]', + 'z-20 relative rounded top-[10vh] max-w-[90vw]', // Dimensions 'max-w-[90vw] p-4 md:p-8', // Need to apply background and text colors again as content is rendered in a portal @@ -43,6 +44,14 @@ export function Dialog({ } ); + useEffect(() => { + if (open) { + document.body.classList.add('overflow-hidden'); + } else { + document.body.classList.remove('overflow-hidden'); + } + }, [open]); + return ( onChange?.(x)}> @@ -52,12 +61,14 @@ export function Dialog({ />
- - - + {onChange && ( + + + + )}
{icon &&
{icon}
}
From 9de3683bf3b7b4700df586ca1a9edcbb7c8df74b Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Sep 2022 18:01:16 +0200 Subject: [PATCH 19/66] chore: filter assets by status (1108) (#1192) * chore: filter assets by status (1108) * chore: moved asset status * chore: re-adding filterin after merge (changed upstream) * chore: filter assets by status (1108) * chore: moved asset status * types * fixed deposit cypress tests --- .../deposits/__generated__/Deposits.ts | 6 +++ .../src/app/components/deposits/deposits.tsx | 6 +-- apps/explorer/src/app/routes/assets/index.tsx | 4 +- .../trading-e2e/src/integration/deposit.cy.ts | 5 ++- .../support/mocks/generate-deposit-page.ts | 3 ++ .../mocks/generate-withdraw-page-query.ts | 4 +- .../src/support/mocks/generate-withdrawals.ts | 4 +- apps/trading/lib/__generated__/AssetFields.ts | 6 +++ apps/trading/lib/query-fragments.ts | 1 + .../deposit/__generated__/DepositPage.ts | 6 +++ .../portfolio/deposit/deposit-container.tsx | 4 +- libs/react-helpers/src/lib/assets.ts | 42 +++++++++++++------ libs/types/src/__generated__/globalTypes.ts | 7 ++++ .../src/lib/__generated__/AssetFields.ts | 6 +++ .../lib/__generated__/WithdrawFormQuery.ts | 6 ++- .../src/lib/__generated__/WithdrawalEvent.ts | 6 ++- .../src/lib/__generated__/WithdrawalFields.ts | 6 ++- .../src/lib/__generated__/Withdrawals.ts | 6 ++- libs/withdraws/src/lib/test-helpers.ts | 12 ++++-- .../src/lib/use-create-withdraw.spec.tsx | 2 + libs/withdraws/src/lib/use-withdrawals.ts | 1 + .../src/lib/withdraw-form-container.tsx | 6 +-- libs/withdraws/src/lib/withdraw-manager.tsx | 4 +- 23 files changed, 117 insertions(+), 36 deletions(-) diff --git a/apps/console-lite/src/app/components/deposits/__generated__/Deposits.ts b/apps/console-lite/src/app/components/deposits/__generated__/Deposits.ts index f0b897c64..030cca1b1 100644 --- a/apps/console-lite/src/app/components/deposits/__generated__/Deposits.ts +++ b/apps/console-lite/src/app/components/deposits/__generated__/Deposits.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { AssetStatus } from "@vegaprotocol/types"; + // ==================================================== // GraphQL query operation: Deposits // ==================================================== @@ -39,6 +41,10 @@ export interface Deposits_assetsConnection_edges_node { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/apps/console-lite/src/app/components/deposits/deposits.tsx b/apps/console-lite/src/app/components/deposits/deposits.tsx index c71f49d0f..ad2ed2d09 100644 --- a/apps/console-lite/src/app/components/deposits/deposits.tsx +++ b/apps/console-lite/src/app/components/deposits/deposits.tsx @@ -1,11 +1,10 @@ import { gql, useQuery } from '@apollo/client'; import { DepositManager } from '@vegaprotocol/deposits'; -import { t } from '@vegaprotocol/react-helpers'; +import { getEnabledAssets, t } from '@vegaprotocol/react-helpers'; import { Networks, useEnvironment } from '@vegaprotocol/environment'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { Web3Container } from '@vegaprotocol/web3'; -import { assetsConnectionToAssets } from '@vegaprotocol/react-helpers'; import type { Deposits } from './__generated__/Deposits'; const DEPOSITS_QUERY = gql` @@ -17,6 +16,7 @@ const DEPOSITS_QUERY = gql` name symbol decimals + status source { ... on ERC20 { contractAddress @@ -40,7 +40,7 @@ export const DepositContainer = () => { skip: !keypair?.pub, }); - const assets = assetsConnectionToAssets(data?.assetsConnection); + const assets = getEnabledAssets(data); return ( data={data} loading={loading} error={error}> diff --git a/apps/explorer/src/app/routes/assets/index.tsx b/apps/explorer/src/app/routes/assets/index.tsx index 326a4fb97..4243644fe 100644 --- a/apps/explorer/src/app/routes/assets/index.tsx +++ b/apps/explorer/src/app/routes/assets/index.tsx @@ -1,5 +1,5 @@ import { gql, useQuery } from '@apollo/client'; -import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers'; +import { getAssets, t } from '@vegaprotocol/react-helpers'; import React from 'react'; import { RouteTitle } from '../../components/route-title'; import { SubHeading } from '../../components/sub-heading'; @@ -39,7 +39,7 @@ export const ASSETS_QUERY = gql` const Assets = () => { const { data } = useQuery(ASSETS_QUERY); - const assets = assetsConnectionToAssets(data?.assetsConnection); + const assets = getAssets(data); return (
diff --git a/apps/trading-e2e/src/integration/deposit.cy.ts b/apps/trading-e2e/src/integration/deposit.cy.ts index ccf606e54..a0e29c6d8 100644 --- a/apps/trading-e2e/src/integration/deposit.cy.ts +++ b/apps/trading-e2e/src/integration/deposit.cy.ts @@ -9,14 +9,15 @@ describe('deposit form validation', () => { cy.mockWeb3Provider(); cy.mockGQL((req) => { aliasQuery(req, 'NetworkParamsQuery', generateNetworkParameters()); - aliasQuery(req, 'AssetsConnection', generateDepositPage()); + aliasQuery(req, 'DepositPage', generateDepositPage()); }); cy.visit('/portfolio/deposit'); - cy.wait('@AssetsConnection'); // Deposit page requires connection Ethereum wallet first cy.getByTestId(connectEthWalletBtn).click(); cy.getByTestId('web3-connector-MetaMask').click(); + + cy.wait('@DepositPage'); }); it('handles empty fields', () => { diff --git a/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts b/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts index 6ca1997c5..9bf0e8554 100644 --- a/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts +++ b/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts @@ -1,3 +1,4 @@ +import { AssetStatus } from '@vegaprotocol/types'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; @@ -14,6 +15,7 @@ export const generateDepositPage = ( symbol: 'AST0', name: 'Asset 0', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81', @@ -28,6 +30,7 @@ export const generateDepositPage = ( symbol: 'AST1', name: 'Asset 1', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81', diff --git a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts index d97801af2..01c57a4cf 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdraw-page-query.ts @@ -1,4 +1,4 @@ -import { AccountType } from '@vegaprotocol/types'; +import { AccountType, AssetStatus } from '@vegaprotocol/types'; import type { WithdrawFormQuery, WithdrawFormQuery_assetsConnection_edges, @@ -32,6 +32,7 @@ export const generateWithdrawFormQuery = ( symbol: 'AST0', name: 'Asset 0', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x5E4b9aDA947130Fc320a144cd22bC1641e5c9d81', @@ -46,6 +47,7 @@ export const generateWithdrawFormQuery = ( symbol: 'AST1', name: 'Asset 1', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d81', diff --git a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts index 87b61c911..206e16a97 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts @@ -1,4 +1,4 @@ -import { WithdrawalStatus } from '@vegaprotocol/types'; +import { AssetStatus, WithdrawalStatus } from '@vegaprotocol/types'; import type { Withdrawals } from '@vegaprotocol/withdraws'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; @@ -30,6 +30,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { name: 'asset-0 name', symbol: 'AST0', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', @@ -59,6 +60,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { name: 'asset-0 name', symbol: 'AST0', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', diff --git a/apps/trading/lib/__generated__/AssetFields.ts b/apps/trading/lib/__generated__/AssetFields.ts index 8a0b8f28b..e3a9bd4a6 100644 --- a/apps/trading/lib/__generated__/AssetFields.ts +++ b/apps/trading/lib/__generated__/AssetFields.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { AssetStatus } from "@vegaprotocol/types"; + // ==================================================== // GraphQL fragment: AssetFields // ==================================================== @@ -39,6 +41,10 @@ export interface AssetFields { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/apps/trading/lib/query-fragments.ts b/apps/trading/lib/query-fragments.ts index e35d4d9fd..b1dd2ed11 100644 --- a/apps/trading/lib/query-fragments.ts +++ b/apps/trading/lib/query-fragments.ts @@ -6,6 +6,7 @@ export const ASSET_FRAGMENT = gql` symbol name decimals + status source { ... on ERC20 { contractAddress diff --git a/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts b/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts index 38052162a..104fcddf9 100644 --- a/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts +++ b/apps/trading/pages/portfolio/deposit/__generated__/DepositPage.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { AssetStatus } from "@vegaprotocol/types"; + // ==================================================== // GraphQL query operation: DepositPage // ==================================================== @@ -39,6 +41,10 @@ export interface DepositPage_assetsConnection_edges_node { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/apps/trading/pages/portfolio/deposit/deposit-container.tsx b/apps/trading/pages/portfolio/deposit/deposit-container.tsx index 11d88721d..cf609c592 100644 --- a/apps/trading/pages/portfolio/deposit/deposit-container.tsx +++ b/apps/trading/pages/portfolio/deposit/deposit-container.tsx @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'; import { PageQueryContainer } from '../../../components/page-query-container'; import type { DepositPage } from './__generated__/DepositPage'; import { DepositManager } from '@vegaprotocol/deposits'; -import { assetsConnectionToAssets, t } from '@vegaprotocol/react-helpers'; +import { getEnabledAssets, t } from '@vegaprotocol/react-helpers'; import { useEnvironment } from '@vegaprotocol/environment'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { ASSET_FRAGMENT } from '../../../lib/query-fragments'; @@ -30,7 +30,7 @@ export const DepositContainer = () => { query={DEPOSIT_PAGE_QUERY} render={(data) => { - const assets = assetsConnectionToAssets(data.assetsConnection); + const assets = getEnabledAssets(data); if (!assets.length) { return ( diff --git a/libs/react-helpers/src/lib/assets.ts b/libs/react-helpers/src/lib/assets.ts index f275dc375..c734aca92 100644 --- a/libs/react-helpers/src/lib/assets.ts +++ b/libs/react-helpers/src/lib/assets.ts @@ -16,14 +16,15 @@ export interface Asset { source: ERC20AssetSource | BuiltinAssetSource; } -interface AssetEdge { - __typename: 'AssetEdge'; - node: Asset; +export enum AssetStatus { + STATUS_ENABLED = 'STATUS_ENABLED', + STATUS_PENDING_LISTING = 'STATUS_PENDING_LISTING', + STATUS_PROPOSED = 'STATUS_PROPOSED', + STATUS_REJECTED = 'STATUS_REJECTED', } -interface AssetsConnection { - __typename: 'AssetsConnection'; - edges: (AssetEdge | null)[] | null; +export interface AssetWithStatus extends Asset { + status: AssetStatus; } export type ERC20Asset = Omit & { @@ -39,11 +40,26 @@ export const isAssetTypeERC20 = (asset?: Asset): asset is ERC20Asset => { return asset.source.__typename === 'ERC20'; }; -export const assetsConnectionToAssets = ( - assetsConnection: AssetsConnection | undefined | null -): Asset[] => { - const edges = assetsConnection?.edges?.filter((e) => e && e?.node); - if (!edges) return []; - - return (edges as AssetEdge[]).map((e) => e.node); +type AssetEdge = { + __typename: 'AssetEdge'; + node: T; }; + +type AssetsConnection = { + assetsConnection: { + edges: (AssetEdge | null)[] | null; + }; +}; + +export const getAssets = (data?: AssetsConnection): Asset[] => + data?.assetsConnection?.edges + ?.filter((e) => e && e?.node) + .map((e) => (e as AssetEdge).node as Asset) || []; + +export const getEnabledAssets = ( + data?: AssetsConnection +): Asset[] => + data?.assetsConnection?.edges + ?.filter((e) => e && e?.node) + .map((e) => (e as AssetEdge).node) + .filter((a) => a.status === AssetStatus.STATUS_ENABLED) || []; diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 44908cee9..25e42c03f 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -29,6 +29,13 @@ export enum AccountType { ACCOUNT_TYPE_SETTLEMENT = "ACCOUNT_TYPE_SETTLEMENT", } +export enum AssetStatus { + STATUS_ENABLED = "STATUS_ENABLED", + STATUS_PENDING_LISTING = "STATUS_PENDING_LISTING", + STATUS_PROPOSED = "STATUS_PROPOSED", + STATUS_REJECTED = "STATUS_REJECTED", +} + export enum AuctionTrigger { AUCTION_TRIGGER_BATCH = "AUCTION_TRIGGER_BATCH", AUCTION_TRIGGER_LIQUIDITY = "AUCTION_TRIGGER_LIQUIDITY", diff --git a/libs/withdraws/src/lib/__generated__/AssetFields.ts b/libs/withdraws/src/lib/__generated__/AssetFields.ts index 8a0b8f28b..e3a9bd4a6 100644 --- a/libs/withdraws/src/lib/__generated__/AssetFields.ts +++ b/libs/withdraws/src/lib/__generated__/AssetFields.ts @@ -3,6 +3,8 @@ // @generated // This file was automatically generated and should not be edited. +import { AssetStatus } from "@vegaprotocol/types"; + // ==================================================== // GraphQL fragment: AssetFields // ==================================================== @@ -39,6 +41,10 @@ export interface AssetFields { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts b/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts index 1e3e504d5..db49ae5af 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawFormQuery.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { AccountType } from "@vegaprotocol/types"; +import { AccountType, AssetStatus } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: WithdrawFormQuery @@ -97,6 +97,10 @@ export interface WithdrawFormQuery_assetsConnection_edges_node { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts index 9eb0a2b40..6260ecf3f 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { WithdrawalStatus } from "@vegaprotocol/types"; +import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; // ==================================================== // GraphQL subscription operation: WithdrawalEvent @@ -45,6 +45,10 @@ export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts index aabde6ee1..8fe4e6bcb 100644 --- a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts +++ b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { WithdrawalStatus } from "@vegaprotocol/types"; +import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; // ==================================================== // GraphQL fragment: WithdrawalFields @@ -41,6 +41,10 @@ export interface WithdrawalFields_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/libs/withdraws/src/lib/__generated__/Withdrawals.ts b/libs/withdraws/src/lib/__generated__/Withdrawals.ts index a10d6bf9c..e7caab1d6 100644 --- a/libs/withdraws/src/lib/__generated__/Withdrawals.ts +++ b/libs/withdraws/src/lib/__generated__/Withdrawals.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { WithdrawalStatus } from "@vegaprotocol/types"; +import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: Withdrawals @@ -41,6 +41,10 @@ export interface Withdrawals_party_withdrawalsConnection_edges_node_asset { * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 */ decimals: number; + /** + * The status of the asset in the Vega network + */ + status: AssetStatus; /** * The origin source of the asset (e.g: an ERC20 asset) */ diff --git a/libs/withdraws/src/lib/test-helpers.ts b/libs/withdraws/src/lib/test-helpers.ts index a9d1d4694..218d0a8ca 100644 --- a/libs/withdraws/src/lib/test-helpers.ts +++ b/libs/withdraws/src/lib/test-helpers.ts @@ -1,17 +1,22 @@ -import type { Asset } from '@vegaprotocol/react-helpers'; -import { AccountType, WithdrawalStatus } from '@vegaprotocol/types'; +import type { Asset, AssetWithStatus } from '@vegaprotocol/react-helpers'; +import { + AccountType, + AssetStatus, + WithdrawalStatus, +} from '@vegaprotocol/types'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; import type { Account } from './types'; import type { Withdrawals_party_withdrawalsConnection_edges_node } from './__generated__/Withdrawals'; export const generateAsset = (override?: PartialDeep) => { - const defaultAsset: Asset = { + const defaultAsset: AssetWithStatus = { __typename: 'Asset', id: 'asset-id', symbol: 'asset-symbol', name: 'asset-name', decimals: 5, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: 'contract-address', @@ -47,6 +52,7 @@ export const generateWithdrawal = ( id: 'asset-id', symbol: 'asset-symbol', decimals: 2, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', diff --git a/libs/withdraws/src/lib/use-create-withdraw.spec.tsx b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx index 3c937f09b..94f1c5101 100644 --- a/libs/withdraws/src/lib/use-create-withdraw.spec.tsx +++ b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx @@ -20,6 +20,7 @@ import type { } from './__generated__/WithdrawalEvent'; import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals'; import { WithdrawalStatus } from '@vegaprotocol/types'; +import { AssetStatus } from '@vegaprotocol/types/types'; function setup( vegaWalletContext: Partial, @@ -73,6 +74,7 @@ beforeEach(() => { name: 'asset-name', symbol: 'asset-symbol', decimals: 2, + status: AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', diff --git a/libs/withdraws/src/lib/use-withdrawals.ts b/libs/withdraws/src/lib/use-withdrawals.ts index 37c8977c8..55bfdc8fc 100644 --- a/libs/withdraws/src/lib/use-withdrawals.ts +++ b/libs/withdraws/src/lib/use-withdrawals.ts @@ -27,6 +27,7 @@ const WITHDRAWAL_FRAGMENT = gql` name symbol decimals + status source { ... on ERC20 { contractAddress diff --git a/libs/withdraws/src/lib/withdraw-form-container.tsx b/libs/withdraws/src/lib/withdraw-form-container.tsx index c237f6761..96167950d 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.tsx @@ -1,6 +1,5 @@ -import compact from 'lodash/compact'; import { gql, useQuery } from '@apollo/client'; -import { t } from '@vegaprotocol/react-helpers'; +import { getEnabledAssets, t } from '@vegaprotocol/react-helpers'; import { useMemo } from 'react'; import type { WithdrawalArgs } from './use-create-withdraw'; import { WithdrawManager } from './withdraw-manager'; @@ -12,6 +11,7 @@ export const ASSET_FRAGMENT = gql` symbol name decimals + status source { ... on ERC20 { contractAddress @@ -69,7 +69,7 @@ export const WithdrawFormContainer = ({ return []; } - return compact(data.assetsConnection.edges).map((e) => e.node); + return getEnabledAssets(data); }, [data]); if (loading || !data) { diff --git a/libs/withdraws/src/lib/withdraw-manager.tsx b/libs/withdraws/src/lib/withdraw-manager.tsx index 563379203..18d06282c 100644 --- a/libs/withdraws/src/lib/withdraw-manager.tsx +++ b/libs/withdraws/src/lib/withdraw-manager.tsx @@ -2,6 +2,7 @@ import { useCallback } from 'react'; import sortBy from 'lodash/sortBy'; import { WithdrawForm } from './withdraw-form'; import type { WithdrawalArgs } from './use-create-withdraw'; +import type { Asset } from '@vegaprotocol/react-helpers'; import { addDecimal } from '@vegaprotocol/react-helpers'; import { AccountType } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; @@ -10,10 +11,9 @@ import { useGetWithdrawThreshold } from './use-get-withdraw-threshold'; import { captureException } from '@sentry/react'; import { useGetWithdrawDelay } from './use-get-withdraw-delay'; import { useWithdrawStore } from './withdraw-store'; -import type { AssetFields } from './__generated__/AssetFields'; export interface WithdrawManagerProps { - assets: AssetFields[]; + assets: Asset[]; accounts: Account[]; submit: (args: WithdrawalArgs) => void; } From d2791f2e59852cd96ead76d162a066ce134bf9ce Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Sep 2022 18:35:29 +0200 Subject: [PATCH 20/66] chore: proposal schema change (1057) (#1169) * chore: moved proposal queries to lib/governance * chore: used new rationale title and description * chore: addressed PR comments, refactored * chore: moved proposal queries to lib/governance * chore: used new rationale title and description * chore: addressed PR comments, refactored * fix: dropped s after merge * fix: fixed lodash imports --- .../__generated__/ProposalsQuery.ts | 118 +++++++++----- .../src/app/routes/governance/index.tsx | 152 +++++++++--------- .../__generated__/ProposalFields.ts | 48 +++--- .../current-proposal-state.tsx | 4 +- .../current-proposal-status.tsx | 4 +- .../proposal-change-table.tsx | 4 +- .../proposal-header.spec.tsx | 142 ++++++++-------- .../proposal-header.tsx | 84 +++++----- .../proposal-terms-json.tsx | 4 +- .../proposal-votes-table.tsx | 4 +- .../proposals-list-item-details.spec.tsx | 12 +- .../proposals-list-item-details.tsx | 4 +- .../proposals-list-item.tsx | 4 +- .../proposals-list/proposals-list.spec.tsx | 4 +- .../proposals-list/proposals-list.tsx | 10 +- .../rejected-proposals-list.spec.tsx | 8 +- .../rejected-proposals-list.tsx | 6 +- .../components/vote-details/vote-details.tsx | 2 +- .../governance/hooks/use-vote-information.ts | 28 ++-- .../routes/governance/proposal-fragment.ts | 16 +- .../proposal/__generated__/Proposal.ts | 48 +++--- .../src/routes/governance/proposal/index.tsx | 1 - .../proposal/proposal-container.tsx | 4 +- .../proposals/__generated__/Proposals.ts | 140 +++++++++------- .../src/routes/governance/proposals/index.tsx | 2 +- .../proposals/proposals-container.tsx | 46 ++---- .../rejected/rejected-proposals-container.tsx | 37 +---- .../test-helpers/generate-proposals.ts | 13 +- libs/governance/src/lib/index.ts | 1 + .../src/lib/proposals-queries/index.ts | 1 + .../proposals-queries/proposals-queries.ts | 61 +++++++ libs/react-helpers/src/lib/format/index.ts | 2 +- .../src/lib/format/strings.spec.ts | 29 ++++ libs/react-helpers/src/lib/format/strings.ts | 19 +++ libs/react-helpers/src/lib/format/truncate.ts | 14 -- 35 files changed, 610 insertions(+), 466 deletions(-) create mode 100644 libs/governance/src/lib/proposals-queries/index.ts create mode 100644 libs/governance/src/lib/proposals-queries/proposals-queries.ts create mode 100644 libs/react-helpers/src/lib/format/strings.spec.ts create mode 100644 libs/react-helpers/src/lib/format/strings.ts delete mode 100644 libs/react-helpers/src/lib/format/truncate.ts diff --git a/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts b/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts index 7e6d2b10b..249072d50 100644 --- a/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts +++ b/apps/explorer/src/app/routes/governance/__generated__/ProposalsQuery.ts @@ -9,7 +9,23 @@ import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol // GraphQL query operation: ProposalsQuery // ==================================================== -export interface ProposalsQuery_proposals_party { +export interface ProposalsQuery_proposalsConnection_edges_node_rationale { + __typename: "ProposalRationale"; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: string; + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: string; +} + +export interface ProposalsQuery_proposalsConnection_edges_node_party { __typename: "Party"; /** * Party identifier @@ -17,11 +33,11 @@ export interface ProposalsQuery_proposals_party { id: string; } -export interface ProposalsQuery_proposals_terms_change_UpdateAsset { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateAsset { __typename: "UpdateAsset" | "NewFreeform"; } -export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_NewMarket_instrument { __typename: "InstrumentConfiguration"; /** * Full and fairly descriptive name for the instrument @@ -29,20 +45,20 @@ export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { name: string; } -export interface ProposalsQuery_proposals_terms_change_NewMarket { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_NewMarket { __typename: "NewMarket"; /** * New market instrument configuration */ - instrument: ProposalsQuery_proposals_terms_change_NewMarket_instrument; + instrument: ProposalsQuery_proposalsConnection_edges_node_terms_change_NewMarket_instrument; } -export interface ProposalsQuery_proposals_terms_change_UpdateMarket { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateMarket { __typename: "UpdateMarket"; marketId: string; } -export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAsset { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset { __typename: "BuiltinAsset"; /** * Maximum amount that can be requested by a party through the built-in asset faucet at a time @@ -50,7 +66,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAs maxFaucetAmountMint: string; } -export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** * The address of the ERC20 contract @@ -58,9 +74,9 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 { contractAddress: string; } -export type ProposalsQuery_proposals_terms_change_NewAsset_source = ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAsset | ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20; +export type ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source = ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset | ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20; -export interface ProposalsQuery_proposals_terms_change_NewAsset { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset { __typename: "NewAsset"; /** * The symbol of the asset (e.g: GBP) @@ -69,10 +85,10 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset { /** * The source of the new asset */ - source: ProposalsQuery_proposals_terms_change_NewAsset_source; + source: ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset_source; } -export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter { __typename: "NetworkParameter"; /** * The name of the network parameter @@ -84,14 +100,14 @@ export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_ne value: string; } -export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter { +export interface ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter { __typename: "UpdateNetworkParameter"; - networkParameter: ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter; + networkParameter: ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter; } -export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_UpdateAsset | ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter; +export type ProposalsQuery_proposalsConnection_edges_node_terms_change = ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateAsset | ProposalsQuery_proposalsConnection_edges_node_terms_change_NewMarket | ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateMarket | ProposalsQuery_proposalsConnection_edges_node_terms_change_NewAsset | ProposalsQuery_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter; -export interface ProposalsQuery_proposals_terms { +export interface ProposalsQuery_proposalsConnection_edges_node_terms { __typename: "ProposalTerms"; /** * RFC3339Nano time and date when voting closes for this proposal. @@ -107,18 +123,18 @@ export interface ProposalsQuery_proposals_terms { /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ - change: ProposalsQuery_proposals_terms_change; + change: ProposalsQuery_proposalsConnection_edges_node_terms_change; } -export interface ProposalsQuery_proposals_votes_yes_votes_party_stake { - __typename: "PartyStake"; +export interface ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ currentStakeAvailable: string; } -export interface ProposalsQuery_proposals_votes_yes_votes_party { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes_party { __typename: "Party"; /** * Party identifier @@ -127,10 +143,10 @@ export interface ProposalsQuery_proposals_votes_yes_votes_party { /** * The staking information for this Party */ - stake: ProposalsQuery_proposals_votes_yes_votes_party_stake; + stakingSummary: ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary; } -export interface ProposalsQuery_proposals_votes_yes_votes { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes { __typename: "Vote"; /** * The vote value cast @@ -139,14 +155,14 @@ export interface ProposalsQuery_proposals_votes_yes_votes { /** * The party casting the vote */ - party: ProposalsQuery_proposals_votes_yes_votes_party; + party: ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes_party; /** * RFC3339Nano time and date when the vote reached Vega network */ datetime: string; } -export interface ProposalsQuery_proposals_votes_yes { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_yes { __typename: "ProposalVoteSide"; /** * Total number of governance tokens from the votes cast for this side @@ -159,18 +175,18 @@ export interface ProposalsQuery_proposals_votes_yes { /** * All votes cast for this side */ - votes: ProposalsQuery_proposals_votes_yes_votes[] | null; + votes: ProposalsQuery_proposalsConnection_edges_node_votes_yes_votes[] | null; } -export interface ProposalsQuery_proposals_votes_no_votes_party_stake { - __typename: "PartyStake"; +export interface ProposalsQuery_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ currentStakeAvailable: string; } -export interface ProposalsQuery_proposals_votes_no_votes_party { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_no_votes_party { __typename: "Party"; /** * Party identifier @@ -179,10 +195,10 @@ export interface ProposalsQuery_proposals_votes_no_votes_party { /** * The staking information for this Party */ - stake: ProposalsQuery_proposals_votes_no_votes_party_stake; + stakingSummary: ProposalsQuery_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary; } -export interface ProposalsQuery_proposals_votes_no_votes { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_no_votes { __typename: "Vote"; /** * The vote value cast @@ -191,14 +207,14 @@ export interface ProposalsQuery_proposals_votes_no_votes { /** * The party casting the vote */ - party: ProposalsQuery_proposals_votes_no_votes_party; + party: ProposalsQuery_proposalsConnection_edges_node_votes_no_votes_party; /** * RFC3339Nano time and date when the vote reached Vega network */ datetime: string; } -export interface ProposalsQuery_proposals_votes_no { +export interface ProposalsQuery_proposalsConnection_edges_node_votes_no { __typename: "ProposalVoteSide"; /** * Total number of governance tokens from the votes cast for this side @@ -211,27 +227,31 @@ export interface ProposalsQuery_proposals_votes_no { /** * All votes cast for this side */ - votes: ProposalsQuery_proposals_votes_no_votes[] | null; + votes: ProposalsQuery_proposalsConnection_edges_node_votes_no_votes[] | null; } -export interface ProposalsQuery_proposals_votes { +export interface ProposalsQuery_proposalsConnection_edges_node_votes { __typename: "ProposalVotes"; /** * Yes votes cast for this proposal */ - yes: ProposalsQuery_proposals_votes_yes; + yes: ProposalsQuery_proposalsConnection_edges_node_votes_yes; /** * No votes cast for this proposal */ - no: ProposalsQuery_proposals_votes_no; + no: ProposalsQuery_proposalsConnection_edges_node_votes_no; } -export interface ProposalsQuery_proposals { +export interface ProposalsQuery_proposalsConnection_edges_node { __typename: "Proposal"; /** * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; + /** + * Rationale behind the proposal + */ + rationale: ProposalsQuery_proposalsConnection_edges_node_rationale; /** * A UUID reference to aid tracking proposals on Vega */ @@ -251,20 +271,36 @@ export interface ProposalsQuery_proposals { /** * Party that prepared the proposal */ - party: ProposalsQuery_proposals_party; + party: ProposalsQuery_proposalsConnection_edges_node_party; /** * Terms of the proposal */ - terms: ProposalsQuery_proposals_terms; + terms: ProposalsQuery_proposalsConnection_edges_node_terms; /** * Votes cast for this proposal */ - votes: ProposalsQuery_proposals_votes; + votes: ProposalsQuery_proposalsConnection_edges_node_votes; +} + +export interface ProposalsQuery_proposalsConnection_edges { + __typename: "ProposalEdge"; + /** + * The proposal data + */ + node: ProposalsQuery_proposalsConnection_edges_node; +} + +export interface ProposalsQuery_proposalsConnection { + __typename: "ProposalsConnection"; + /** + * List of proposals available for the connection + */ + edges: (ProposalsQuery_proposalsConnection_edges | null)[] | null; } export interface ProposalsQuery { /** * All governance proposals in the Vega network */ - proposals: ProposalsQuery_proposals[] | null; + proposalsConnection: ProposalsQuery_proposalsConnection; } diff --git a/apps/explorer/src/app/routes/governance/index.tsx b/apps/explorer/src/app/routes/governance/index.tsx index b64bed16f..561bc6849 100644 --- a/apps/explorer/src/app/routes/governance/index.tsx +++ b/apps/explorer/src/app/routes/governance/index.tsx @@ -4,95 +4,90 @@ import React from 'react'; import { RouteTitle } from '../../components/route-title'; import { SubHeading } from '../../components/sub-heading'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; +import { getProposals } from '@vegaprotocol/governance'; import type { ProposalsQuery, - ProposalsQuery_proposals_terms_change, + ProposalsQuery_proposalsConnection_edges_node, } from './__generated__/ProposalsQuery'; -export function getProposalName(change: ProposalsQuery_proposals_terms_change) { - if (change.__typename === 'NewAsset') { - return t(`New asset: ${change.symbol}`); - } else if (change.__typename === 'NewMarket') { - return t(`New market: ${change.instrument.name}`); - } else if (change.__typename === 'UpdateMarket') { - return t(`Update market: ${change.marketId}`); - } else if (change.__typename === 'UpdateNetworkParameter') { - return t(`Update network: ${change.networkParameter.key}`); - } - - return t('Unknown proposal'); -} - -const PROPOSAL_QUERY = gql` +const PROPOSALS_QUERY = gql` query ProposalsQuery { - proposals { - id - reference - state - datetime - rejectionReason - party { - id - } - terms { - closingDatetime - enactmentDatetime - change { - ... on NewMarket { - instrument { - name - } + proposalsConnection { + edges { + node { + id + rationale { + title + description } - ... on UpdateMarket { - marketId + reference + state + datetime + rejectionReason + party { + id } - ... on NewAsset { - __typename - symbol - source { - ... on BuiltinAsset { - maxFaucetAmountMint + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + instrument { + name + } } - ... on ERC20 { - contractAddress + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + symbol + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } } } } - ... on UpdateNetworkParameter { - networkParameter { - key - value - } - } - } - } - votes { - yes { - totalTokens - totalNumber votes { - value - party { - id - stake { - currentStakeAvailable + yes { + totalTokens + totalNumber + votes { + value + party { + id + stakingSummary { + currentStakeAvailable + } + } + datetime } } - datetime - } - } - no { - totalTokens - totalNumber - votes { - value - party { - id - stake { - currentStakeAvailable + no { + totalTokens + totalNumber + votes { + value + party { + id + stakingSummary { + currentStakeAvailable + } + } + datetime } } - datetime } } } @@ -101,9 +96,12 @@ const PROPOSAL_QUERY = gql` `; const Governance = () => { - const { data } = useQuery(PROPOSAL_QUERY, { + const { data } = useQuery(PROPOSALS_QUERY, { errorPolicy: 'ignore', }); + const proposals = getProposals( + data + ) as ProposalsQuery_proposalsConnection_edges_node[]; if (!data) return null; return ( @@ -111,9 +109,11 @@ const Governance = () => { {t('Governance Proposals')} - {data.proposals?.map((p) => ( + {proposals.map((p) => ( - {getProposalName(p.terms.change)} + + {p.rationale.title || p.rationale.description} + ))} diff --git a/apps/token/src/routes/governance/__generated__/ProposalFields.ts b/apps/token/src/routes/governance/__generated__/ProposalFields.ts index bf2740a4d..c9a97b8d2 100644 --- a/apps/token/src/routes/governance/__generated__/ProposalFields.ts +++ b/apps/token/src/routes/governance/__generated__/ProposalFields.ts @@ -9,6 +9,22 @@ import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol // GraphQL fragment: ProposalFields // ==================================================== +export interface ProposalFields_rationale { + __typename: "ProposalRationale"; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: string; + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: string; +} + export interface ProposalFields_party { __typename: "Party"; /** @@ -55,14 +71,6 @@ export interface ProposalFields_terms_change_NewMarket_instrument { export interface ProposalFields_terms_change_NewMarket { __typename: "NewMarket"; - /** - * Decimal places used for the new market, sets the smallest price increment on the book - */ - decimalPlaces: number; - /** - * Metadata for this instrument, tags - */ - metadata: string[] | null; /** * New market instrument configuration */ @@ -146,8 +154,8 @@ export interface ProposalFields_terms { change: ProposalFields_terms_change; } -export interface ProposalFields_votes_yes_votes_party_stake { - __typename: "PartyStake"; +export interface ProposalFields_votes_yes_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ @@ -163,7 +171,7 @@ export interface ProposalFields_votes_yes_votes_party { /** * The staking information for this Party */ - stake: ProposalFields_votes_yes_votes_party_stake; + stakingSummary: ProposalFields_votes_yes_votes_party_stakingSummary; } export interface ProposalFields_votes_yes_votes { @@ -198,8 +206,8 @@ export interface ProposalFields_votes_yes { votes: ProposalFields_votes_yes_votes[] | null; } -export interface ProposalFields_votes_no_votes_party_stake { - __typename: "PartyStake"; +export interface ProposalFields_votes_no_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ @@ -215,7 +223,7 @@ export interface ProposalFields_votes_no_votes_party { /** * The staking information for this Party */ - stake: ProposalFields_votes_no_votes_party_stake; + stakingSummary: ProposalFields_votes_no_votes_party_stakingSummary; } export interface ProposalFields_votes_no_votes { @@ -268,6 +276,10 @@ export interface ProposalFields { * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; + /** + * Rationale behind the proposal + */ + rationale: ProposalFields_rationale; /** * A UUID reference to aid tracking proposals on Vega */ @@ -284,14 +296,14 @@ export interface ProposalFields { * Reason for the proposal to be rejected by the core */ rejectionReason: ProposalRejectionReason | null; - /** - * Error details of the rejectionReason - */ - errorDetails: string | null; /** * Party that prepared the proposal */ party: ProposalFields_party; + /** + * Error details of the rejectionReason + */ + errorDetails: string | null; /** * Terms of the proposal */ diff --git a/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx b/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx index 09fe38921..e59eb2edd 100644 --- a/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx +++ b/apps/token/src/routes/governance/components/current-proposal-state/current-proposal-state.tsx @@ -1,10 +1,10 @@ import { ProposalState } from '@vegaprotocol/types'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; export const CurrentProposalState = ({ proposal, }: { - proposal: Proposals_proposals; + proposal: ProposalFields; }) => { const { state } = proposal; let className = 'text-white'; diff --git a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx index 6a6fcba27..c2b17dd15 100644 --- a/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx +++ b/apps/token/src/routes/governance/components/current-proposal-status/current-proposal-status.tsx @@ -4,7 +4,7 @@ import { useTranslation } from 'react-i18next'; import { ProposalState } from '@vegaprotocol/types'; import { useVoteInformation } from '../../hooks'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; export const StatusPass = ({ children }: { children: React.ReactNode }) => ( {children} @@ -17,7 +17,7 @@ export const StatusFail = ({ children }: { children: React.ReactNode }) => ( export const CurrentProposalStatus = ({ proposal, }: { - proposal: Proposals_proposals; + proposal: ProposalFields; }) => { const { willPass, majorityMet, participationMet } = useVoteInformation({ proposal, diff --git a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx index 0bff1a864..558b1596b 100644 --- a/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx +++ b/apps/token/src/routes/governance/components/proposal-change-table/proposal-change-table.tsx @@ -3,11 +3,11 @@ import { useTranslation } from 'react-i18next'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import { CurrentProposalState } from '../current-proposal-state'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; interface ProposalChangeTableProps { - proposal: Proposals_proposals; + proposal: ProposalFields; } export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => { diff --git a/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.spec.tsx b/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.spec.tsx index 1c3e18b17..5c74bc83d 100644 --- a/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.spec.tsx +++ b/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.spec.tsx @@ -1,9 +1,9 @@ import { render, screen } from '@testing-library/react'; import { generateProposal } from '../../test-helpers/generate-proposals'; import { ProposalHeader } from './proposal-header'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { Proposal_proposal } from '@vegaprotocol/governance'; -const renderComponent = (proposal: Proposals_proposals) => ( +const renderComponent = (proposal: Proposal_proposal) => ( ); @@ -12,10 +12,13 @@ describe('Proposal header', () => { render( renderComponent( generateProposal({ + rationale: { + title: 'New some market', + description: 'A new some market', + }, terms: { change: { __typename: 'NewMarket', - decimalPlaces: 1, instrument: { __typename: 'InstrumentConfiguration', name: 'Some market', @@ -28,16 +31,18 @@ describe('Proposal header', () => { }, }, }, - metadata: [], }, }, }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( - 'New market: Some market' + expect(screen.getByTestId('proposal-title')).toHaveTextContent( + 'New some market' ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( + expect(screen.getByTestId('proposal-description')).toHaveTextContent( + 'A new some market' + ); + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'tGBP settled future.' ); }); @@ -46,6 +51,9 @@ describe('Proposal header', () => { render( renderComponent( generateProposal({ + rationale: { + title: 'New market id', + }, terms: { change: { __typename: 'UpdateMarket', @@ -55,7 +63,13 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( + expect(screen.getByTestId('proposal-title')).toHaveTextContent( + 'New market id' + ); + expect( + screen.queryByTestId('proposal-description') + ).not.toBeInTheDocument(); + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'Market change: MarketId' ); }); @@ -64,6 +78,10 @@ describe('Proposal header', () => { render( renderComponent( generateProposal({ + rationale: { + title: 'New asset: Fake currency', + description: '', + }, terms: { change: { __typename: 'NewAsset', @@ -78,10 +96,10 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( + expect(screen.getByTestId('proposal-title')).toHaveTextContent( 'New asset: Fake currency' ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'Symbol: FAKE. ERC20 0x0' ); }); @@ -104,10 +122,10 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( - 'New asset: Fake currency' + expect(screen.getByTestId('proposal-title')).toHaveTextContent( + 'Unknown proposal' ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'Symbol: BIA. Max faucet amount mint: 300' ); }); @@ -116,6 +134,9 @@ describe('Proposal header', () => { render( renderComponent( generateProposal({ + rationale: { + title: 'Network parameter', + }, terms: { change: { __typename: 'UpdateNetworkParameter', @@ -129,25 +150,22 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( + expect(screen.getByTestId('proposal-title')).toHaveTextContent( 'Network parameter' ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'Network key to Network value' ); }); - // Skipped until proposals have rationale - https://github.com/vegaprotocol/frontend-monorepo/issues/824 - // eslint-disable-next-line jest/no-disabled-tests - it.skip('Renders Freeform network - short rationale', () => { + it('Renders Freeform network - short rationale', () => { render( renderComponent( generateProposal({ id: 'short', - // rationale: { - // hash: '0x0', - // description: 'freeform description', - // }, + rationale: { + title: '0x0', + }, terms: { change: { __typename: 'NewFreeform', @@ -156,27 +174,23 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( - 'freeform description' - ); - expect(screen.getByTestId('proposal-details-one')).toBeEmptyDOMElement(); - expect(screen.getByTestId('proposal-details-two')).toHaveTextContent( - 'short' - ); + expect(screen.getByTestId('proposal-title')).toHaveTextContent('0x0'); + expect( + screen.queryByTestId('proposal-description') + ).not.toBeInTheDocument(); + expect(screen.getByTestId('proposal-details')).toHaveTextContent('short'); }); - // Skipped until proposals have rationale - // eslint-disable-next-line jest/no-disabled-tests - it.skip('Renders Freeform proposal - long rationale (105 chars)', () => { + it('Renders Freeform proposal - long rationale (105 chars)', () => { render( renderComponent( generateProposal({ id: 'long', - // rationale: { - // hash: '0x0', - // description: - // 'Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean dolor.', - // }, + rationale: { + title: '0x0', + description: + 'Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean dolor.', + }, terms: { change: { __typename: 'NewFreeform', @@ -187,29 +201,24 @@ describe('Proposal header', () => { ); // For a rationale over 100 chars, we expect the header to be truncated at // 100 chars with ellipsis and the details-one element to contain the rest. - expect(screen.getByTestId('proposal-header')).toHaveTextContent( - 'Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Aenean…' - ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( - 'dolor' - ); - expect(screen.getByTestId('proposal-details-two')).toHaveTextContent( - 'long' + expect(screen.getByTestId('proposal-title')).toHaveTextContent('0x0'); + expect(screen.getByTestId('proposal-description')).toHaveTextContent( + 'Class aptent taciti sociosqu ad litora torquent per conubia' ); + expect(screen.getByTestId('proposal-details')).toHaveTextContent('long'); }); - // Skipped until proposals have rationale - // eslint-disable-next-line jest/no-disabled-tests - it.skip('Renders Freeform proposal - extra long rationale (165 chars)', () => { + it('Renders Freeform proposal - extra long rationale (165 chars)', () => { render( renderComponent( generateProposal({ id: 'extraLong', - // rationale: { - // hash: '0x0', - // description: - // 'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra libero quis risus lobortis, sed ornare leo efficitur turpis duis.', - // }, + rationale: { + title: + 'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra libero quis risus lobortis, sed ornare leo efficitur turpis duis.', + description: + 'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra libero quis risus lobortis, sed ornare leo efficitur turpis duis.', + }, terms: { change: { __typename: 'NewFreeform', @@ -221,13 +230,13 @@ describe('Proposal header', () => { // For a rationale over 160 chars, we expect the header to be truncated at 100 // chars with ellipsis and the details-one element to contain 60 chars and also // be truncated with an ellipsis. - expect(screen.getByTestId('proposal-header')).toHaveTextContent( + expect(screen.getByTestId('proposal-title')).toHaveTextContent( 'Aenean sem odio, eleifend non sodales vitae, porttitor eu ex. Aliquam erat volutpat. Fusce pharetra…' ); - expect(screen.getByTestId('proposal-details-one')).toHaveTextContent( - 'libero quis risus lobortis, sed ornare leo efficitur turpis…' + expect(screen.getByTestId('proposal-description')).toHaveTextContent( + 'Aenean sem odio, eleifend non sodales vitae, porttitor eu e…' ); - expect(screen.getByTestId('proposal-details-two')).toHaveTextContent( + expect(screen.getByTestId('proposal-details')).toHaveTextContent( 'extraLong' ); }); @@ -238,6 +247,9 @@ describe('Proposal header', () => { renderComponent( generateProposal({ id: 'freeform id', + rationale: { + title: 'freeform', + }, terms: { change: { __typename: 'NewFreeform', @@ -246,15 +258,13 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( - 'Freeform proposal: freeform id' + expect(screen.getByTestId('proposal-title')).toHaveTextContent('freeform'); + expect( + screen.queryByTestId('proposal-description') + ).not.toBeInTheDocument(); + expect(screen.queryByTestId('proposal-details')).toHaveTextContent( + 'freeform id' ); - expect( - screen.queryByTestId('proposal-details-one') - ).not.toBeInTheDocument(); - expect( - screen.queryByTestId('proposal-details-two') - ).not.toBeInTheDocument(); }); it("Renders unknown proposal if it's a different proposal type", () => { @@ -270,7 +280,7 @@ describe('Proposal header', () => { }) ) ); - expect(screen.getByTestId('proposal-header')).toHaveTextContent( + expect(screen.getByTestId('proposal-title')).toHaveTextContent( 'Unknown proposal' ); }); diff --git a/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.tsx b/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.tsx index 201ef10ec..87780ee51 100644 --- a/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.tsx +++ b/apps/token/src/routes/governance/components/proposal-detail-header/proposal-header.tsx @@ -1,24 +1,28 @@ import { useTranslation } from 'react-i18next'; import { Lozenge } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import { shorten } from '@vegaprotocol/react-helpers'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; -export const ProposalHeader = ({ - proposal, -}: { - proposal: Proposals_proposals; -}) => { +export const ProposalHeader = ({ proposal }: { proposal: ProposalFields }) => { const { t } = useTranslation(); const { change } = proposal.terms; - let headerText: string; - let detailsOne: ReactNode; - let detailsTwo: ReactNode; + let details: ReactNode; + + let title = proposal.rationale.title.trim(); + let description = proposal.rationale.description.trim(); + if (title.length === 0 && description.length > 0) { + title = description; + description = ''; + } + + const titleContent = shorten(title, 100); + const descriptionContent = shorten(description, 60); switch (change.__typename) { case 'NewMarket': { - headerText = `${t('New market')}: ${change.instrument.name}`; - detailsOne = ( + details = ( <> {t('Code')}: {change.instrument.code}.{' '} {change.instrument.futureProduct?.settlementAsset.symbol ? ( @@ -36,12 +40,11 @@ export const ProposalHeader = ({ break; } case 'UpdateMarket': { - headerText = `${t('Market change')}: ${change.marketId}`; + details = `${t('Market change')}: ${change.marketId}`; break; } case 'NewAsset': { - headerText = `${t('New asset')}: ${change.name}`; - detailsOne = ( + details = ( <> {t('Symbol')}: {change.symbol}.{' '} @@ -57,8 +60,7 @@ export const ProposalHeader = ({ } case 'UpdateNetworkParameter': { const parametersClasses = 'font-mono leading-none'; - headerText = `${t('Network parameter')}`; - detailsOne = ( + details = ( <> {change.networkParameter.key} @@ -72,44 +74,34 @@ export const ProposalHeader = ({ break; } case 'NewFreeform': { - // When rationale exists (https://github.com/vegaprotocol/frontend-monorepo/issues/824): - // const description = proposal.rationale.description.trim(); - // const headerMaxLength = 100; - // const descriptionOneMaxLength = 60; - // const headerOverflow = description.length > headerMaxLength; - // const descriptionOneOverflow = - // description.length > headerMaxLength + descriptionOneMaxLength; - // - // headerText = `${description.substring(0, headerMaxLength - 1).trim()}${ - // headerOverflow ? '…' : '' - // }`; - // detailsOne = headerOverflow - // ? `${description - // .substring( - // headerMaxLength - 1, - // headerMaxLength + descriptionOneMaxLength - 1 - // ) - // .trim()}${descriptionOneOverflow ? '…' : ''}` - // : ''; - // detailsTwo = `${proposal.id}`; - headerText = proposal.id - ? `${t('Freeform proposal')}: ${proposal.id.trim()}` - : `${t('Unknown proposal')}`; + details = `${proposal.id}`; break; } - default: { - headerText = `${t('Unknown proposal')}`; - } } return (
-
-

{headerText}

+
+

titleContent.length && { title: title })} + className="text-lg mx-0 mt-0 mb-1 font-semibold" + > + {titleContent || t('Unknown proposal')} +

- {detailsOne &&
{detailsOne}
} - {detailsTwo &&
{detailsTwo}
} + {descriptionContent && ( +
descriptionContent.length && { + title: description, + })} + data-testid="proposal-description" + > + {descriptionContent} +
+ )} + {details &&
{details}
}
); }; diff --git a/apps/token/src/routes/governance/components/proposal-terms-json/proposal-terms-json.tsx b/apps/token/src/routes/governance/components/proposal-terms-json/proposal-terms-json.tsx index 76eaa1f65..46b0edf30 100644 --- a/apps/token/src/routes/governance/components/proposal-terms-json/proposal-terms-json.tsx +++ b/apps/token/src/routes/governance/components/proposal-terms-json/proposal-terms-json.tsx @@ -1,11 +1,11 @@ import { useTranslation } from 'react-i18next'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; -import type { Proposal_proposal_terms } from '../../proposal/__generated__/Proposal'; +import type { ProposalFields_terms } from '../../__generated__/ProposalFields'; export const ProposalTermsJson = ({ terms, }: { - terms: Proposal_proposal_terms; + terms: ProposalFields_terms; }) => { const { t } = useTranslation(); return ( diff --git a/apps/token/src/routes/governance/components/proposal-votes-table/proposal-votes-table.tsx b/apps/token/src/routes/governance/components/proposal-votes-table/proposal-votes-table.tsx index 41d071363..a0771a09c 100644 --- a/apps/token/src/routes/governance/components/proposal-votes-table/proposal-votes-table.tsx +++ b/apps/token/src/routes/governance/components/proposal-votes-table/proposal-votes-table.tsx @@ -6,11 +6,11 @@ import { formatNumberPercentage, } from '@vegaprotocol/react-helpers'; import { useVoteInformation } from '../../hooks'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; interface ProposalVotesTableProps { - proposal: Proposals_proposals; + proposal: ProposalFields; } export const ProposalVotesTable = ({ proposal }: ProposalVotesTableProps) => { diff --git a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx index 9249ad30e..c5e5545dd 100644 --- a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx +++ b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.spec.tsx @@ -26,10 +26,10 @@ import { lastWeek, nextWeek, } from '../../test-helpers/mocks'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance'; const renderComponent = ( - proposal: Proposals_proposals, + proposal: ProposalNode, mock = networkParamsQueryMock ) => ( @@ -173,8 +173,8 @@ describe('Proposals list item details', () => { party: { __typename: 'Party', id: mockPubkey, - stake: { - __typename: 'PartyStake', + stakingSummary: { + __typename: 'StakingSummary', currentStakeAvailable: '1000', }, }, @@ -211,8 +211,8 @@ describe('Proposals list item details', () => { party: { __typename: 'Party', id: mockPubkey, - stake: { - __typename: 'PartyStake', + stakingSummary: { + __typename: 'StakingSummary', currentStakeAvailable: '1000', }, }, diff --git a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx index 802ac3760..7fb3a04f5 100644 --- a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx +++ b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item-details.tsx @@ -10,12 +10,12 @@ import { format, formatDistanceToNowStrict } from 'date-fns'; import { useTranslation } from 'react-i18next'; import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats'; import type { ReactNode } from 'react'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import { ProposalRejectionReasonMapping, ProposalState, } from '@vegaprotocol/types'; import Routes from '../../../routes'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; const MajorityNotReached = () => { const { t } = useTranslation(); @@ -37,7 +37,7 @@ const ParticipationNotReached = () => { export const ProposalsListItemDetails = ({ proposal, }: { - proposal: Proposals_proposals; + proposal: ProposalFields; }) => { const { state } = proposal; const { willPass, majorityMet, participationMet } = useVoteInformation({ diff --git a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item.tsx b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item.tsx index 89fee97a5..d09bc4281 100644 --- a/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item.tsx +++ b/apps/token/src/routes/governance/components/proposals-list-item/proposals-list-item.tsx @@ -1,9 +1,9 @@ +import type { ProposalFields } from '../../__generated__/ProposalFields'; import { ProposalHeader } from '../proposal-detail-header/proposal-header'; import { ProposalsListItemDetails } from './proposals-list-item-details'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; interface ProposalsListItemProps { - proposal: Proposals_proposals; + proposal: ProposalFields; } export const ProposalsListItem = ({ proposal }: ProposalsListItemProps) => { diff --git a/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx b/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx index 5a8e779cb..ab1bd7159 100644 --- a/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/proposals-list.spec.tsx @@ -14,7 +14,7 @@ import { lastMonth, nextMonth, } from '../../test-helpers/mocks'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance'; const openProposalClosesNextMonth = generateProposal({ id: 'proposal1', @@ -58,7 +58,7 @@ const failedProposalClosedLastMonth = generateProposal({ }, }); -const renderComponent = (proposals: Proposals_proposals[]) => ( +const renderComponent = (proposals: ProposalNode[]) => ( diff --git a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx index 63d5c05c2..10a264121 100644 --- a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx @@ -4,20 +4,20 @@ import { useTranslation } from 'react-i18next'; import { Heading } from '../../../../components/heading'; import { ProposalsListItem } from '../proposals-list-item'; import { ProposalsListFilter } from '../proposals-list-filter'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; import Routes from '../../../routes'; import { Button } from '@vegaprotocol/ui-toolkit'; import { Link } from 'react-router-dom'; +import type { ProposalFields } from '../../__generated__/ProposalFields'; import { Links } from '../../../../config'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; interface ProposalsListProps { - proposals: Proposals_proposals[]; + proposals: ProposalFields[]; } interface SortedProposalsProps { - open: Proposals_proposals[]; - closed: Proposals_proposals[]; + open: ProposalFields[]; + closed: ProposalFields[]; } export const ProposalsList = ({ proposals }: ProposalsListProps) => { @@ -39,7 +39,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => { } ); - const filterPredicate = (p: Proposals_proposals) => + const filterPredicate = (p: ProposalFields) => p.id?.includes(filterString) || p.party?.id?.toString().includes(filterString); diff --git a/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.spec.tsx b/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.spec.tsx index ec221b84e..8c1826926 100644 --- a/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.spec.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.spec.tsx @@ -12,11 +12,11 @@ import { nextWeek, lastMonth, } from '../../test-helpers/mocks'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { ProposalsConnection_proposalsConnection_edges_node as ProposalNode } from '@vegaprotocol/governance'; const rejectedProposalClosesNextWeek = generateProposal({ id: 'rejected1', - state: ProposalState.Open, + state: ProposalState.STATE_OPEN, party: { id: 'bvcx', }, @@ -28,14 +28,14 @@ const rejectedProposalClosesNextWeek = generateProposal({ const rejectedProposalClosedLastMonth = generateProposal({ id: 'rejected2', - state: ProposalState.Rejected, + state: ProposalState.STATE_REJECTED, terms: { closingDatetime: lastMonth.toString(), enactmentDatetime: lastMonth.toString(), }, }); -const renderComponent = (proposals: Proposals_proposals[]) => ( +const renderComponent = (proposals: ProposalNode[]) => ( diff --git a/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.tsx b/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.tsx index 3458a49bc..4cc27c682 100644 --- a/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/rejected-proposals-list.tsx @@ -3,17 +3,17 @@ import { useTranslation } from 'react-i18next'; import { Heading } from '../../../../components/heading'; import { ProposalsListItem } from '../proposals-list-item'; import { ProposalsListFilter } from '../proposals-list-filter'; -import type { Proposals_proposals } from '../../proposals/__generated__/Proposals'; +import type { Proposals_proposalsConnection_edges_node } from '../../proposals/__generated__/Proposals'; interface ProposalsListProps { - proposals: Proposals_proposals[]; + proposals: Proposals_proposalsConnection_edges_node[]; } export const RejectedProposalsList = ({ proposals }: ProposalsListProps) => { const { t } = useTranslation(); const [filterString, setFilterString] = useState(''); - const filterPredicate = (p: Proposals_proposals) => + const filterPredicate = (p: Proposals_proposalsConnection_edges_node) => p.id?.includes(filterString) || p.party?.id?.toString().includes(filterString); diff --git a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx index 13240db44..b103ee7c3 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx @@ -4,13 +4,13 @@ import { useTranslation } from 'react-i18next'; import { formatNumber } from '../../../../lib/format-number'; import { ConnectToVega } from '../../../staking/connect-to-vega'; import { useVoteInformation } from '../../hooks'; -import type { Proposal_proposal } from '../../proposal/__generated__/Proposal'; import { CurrentProposalStatus } from '../current-proposal-status'; import { useUserVote } from './use-user-vote'; import { VoteButtonsContainer } from './vote-buttons'; import { VoteProgress } from './vote-progress'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { ProposalState } from '@vegaprotocol/types'; +import type { Proposal_proposal } from '../../proposal/__generated__/Proposal'; interface VoteDetailsProps { proposal: Proposal_proposal; diff --git a/apps/token/src/routes/governance/hooks/use-vote-information.ts b/apps/token/src/routes/governance/hooks/use-vote-information.ts index 634c2b4ca..2bfc74852 100644 --- a/apps/token/src/routes/governance/hooks/use-vote-information.ts +++ b/apps/token/src/routes/governance/hooks/use-vote-information.ts @@ -6,15 +6,15 @@ import { useAppState } from '../../../contexts/app-state/app-state-context'; import { BigNumber } from '../../../lib/bignumber'; import { addDecimal } from '../../../lib/decimals'; import type { - Proposal_proposal_votes_no_votes, - Proposal_proposal_votes_yes_votes, -} from '../proposal/__generated__/Proposal'; -import type { Proposals_proposals } from '../proposals/__generated__/Proposals'; + ProposalFields, + ProposalFields_votes_no_votes, + ProposalFields_votes_yes_votes, +} from '../__generated__/ProposalFields'; const useProposalNetworkParams = ({ proposal, }: { - proposal: Proposals_proposals; + proposal: ProposalFields; }) => { const { data, loading } = useNetworkParams([ NetworkParams.GOV_UPDATE_MARKET_REQUIRED_MAJORITY, @@ -82,7 +82,7 @@ const useProposalNetworkParams = ({ export const useVoteInformation = ({ proposal, }: { - proposal: Proposals_proposals; + proposal: ProposalFields; }) => { const { appState: { totalSupply }, @@ -105,10 +105,10 @@ export const useVoteInformation = ({ return new BigNumber(0); } const totalNoVotes = proposal.votes.no.votes.reduce( - (prevValue: BigNumber, newValue: Proposal_proposal_votes_no_votes) => { - return new BigNumber(newValue.party.stake.currentStakeAvailable).plus( - prevValue - ); + (prevValue: BigNumber, newValue: ProposalFields_votes_no_votes) => { + return new BigNumber( + newValue.party.stakingSummary.currentStakeAvailable + ).plus(prevValue); }, new BigNumber(0) ); @@ -120,10 +120,10 @@ export const useVoteInformation = ({ return new BigNumber(0); } const totalYesVotes = proposal.votes.yes.votes.reduce( - (prevValue: BigNumber, newValue: Proposal_proposal_votes_yes_votes) => { - return new BigNumber(newValue.party.stake.currentStakeAvailable).plus( - prevValue - ); + (prevValue: BigNumber, newValue: ProposalFields_votes_yes_votes) => { + return new BigNumber( + newValue.party.stakingSummary.currentStakeAvailable + ).plus(prevValue); }, new BigNumber(0) ); diff --git a/apps/token/src/routes/governance/proposal-fragment.ts b/apps/token/src/routes/governance/proposal-fragment.ts index 05ed9b0e5..a0e44ef87 100644 --- a/apps/token/src/routes/governance/proposal-fragment.ts +++ b/apps/token/src/routes/governance/proposal-fragment.ts @@ -1,23 +1,25 @@ import { gql } from '@apollo/client'; -export const PROPOSALS_FRAGMENT = gql` +export const PROPOSAL_FRAGMENT = gql` fragment ProposalFields on Proposal { id + rationale { + title + description + } reference state datetime rejectionReason - errorDetails party { id } + errorDetails terms { closingDatetime enactmentDatetime change { ... on NewMarket { - decimalPlaces - metadata instrument { name code @@ -37,11 +39,9 @@ export const PROPOSALS_FRAGMENT = gql` symbol source { ... on BuiltinAsset { - __typename maxFaucetAmountMint } ... on ERC20 { - __typename contractAddress } } @@ -62,7 +62,7 @@ export const PROPOSALS_FRAGMENT = gql` value party { id - stake { + stakingSummary { currentStakeAvailable } } @@ -76,7 +76,7 @@ export const PROPOSALS_FRAGMENT = gql` value party { id - stake { + stakingSummary { currentStakeAvailable } } diff --git a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts index b882b7854..a26d3c4b1 100644 --- a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts +++ b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts @@ -9,6 +9,22 @@ import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol // GraphQL query operation: Proposal // ==================================================== +export interface Proposal_proposal_rationale { + __typename: "ProposalRationale"; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: string; + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: string; +} + export interface Proposal_proposal_party { __typename: "Party"; /** @@ -55,14 +71,6 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument { export interface Proposal_proposal_terms_change_NewMarket { __typename: "NewMarket"; - /** - * Decimal places used for the new market, sets the smallest price increment on the book - */ - decimalPlaces: number; - /** - * Metadata for this instrument, tags - */ - metadata: string[] | null; /** * New market instrument configuration */ @@ -146,8 +154,8 @@ export interface Proposal_proposal_terms { change: Proposal_proposal_terms_change; } -export interface Proposal_proposal_votes_yes_votes_party_stake { - __typename: "PartyStake"; +export interface Proposal_proposal_votes_yes_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ @@ -163,7 +171,7 @@ export interface Proposal_proposal_votes_yes_votes_party { /** * The staking information for this Party */ - stake: Proposal_proposal_votes_yes_votes_party_stake; + stakingSummary: Proposal_proposal_votes_yes_votes_party_stakingSummary; } export interface Proposal_proposal_votes_yes_votes { @@ -198,8 +206,8 @@ export interface Proposal_proposal_votes_yes { votes: Proposal_proposal_votes_yes_votes[] | null; } -export interface Proposal_proposal_votes_no_votes_party_stake { - __typename: "PartyStake"; +export interface Proposal_proposal_votes_no_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ @@ -215,7 +223,7 @@ export interface Proposal_proposal_votes_no_votes_party { /** * The staking information for this Party */ - stake: Proposal_proposal_votes_no_votes_party_stake; + stakingSummary: Proposal_proposal_votes_no_votes_party_stakingSummary; } export interface Proposal_proposal_votes_no_votes { @@ -268,6 +276,10 @@ export interface Proposal_proposal { * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; + /** + * Rationale behind the proposal + */ + rationale: Proposal_proposal_rationale; /** * A UUID reference to aid tracking proposals on Vega */ @@ -284,14 +296,14 @@ export interface Proposal_proposal { * Reason for the proposal to be rejected by the core */ rejectionReason: ProposalRejectionReason | null; - /** - * Error details of the rejectionReason - */ - errorDetails: string | null; /** * Party that prepared the proposal */ party: Proposal_proposal_party; + /** + * Error details of the rejectionReason + */ + errorDetails: string | null; /** * Terms of the proposal */ diff --git a/apps/token/src/routes/governance/proposal/index.tsx b/apps/token/src/routes/governance/proposal/index.tsx index 873999b3f..e4b11198e 100644 --- a/apps/token/src/routes/governance/proposal/index.tsx +++ b/apps/token/src/routes/governance/proposal/index.tsx @@ -1,5 +1,4 @@ export { ProposalContainer, - PROPOSAL_QUERY, ProposalContainer as default, } from './proposal-container'; diff --git a/apps/token/src/routes/governance/proposal/proposal-container.tsx b/apps/token/src/routes/governance/proposal/proposal-container.tsx index e799c0ab6..8a524092b 100644 --- a/apps/token/src/routes/governance/proposal/proposal-container.tsx +++ b/apps/token/src/routes/governance/proposal/proposal-container.tsx @@ -4,14 +4,14 @@ import { useEffect } from 'react'; import { useParams } from 'react-router-dom'; import { Proposal } from '../components/proposal'; -import { PROPOSALS_FRAGMENT } from '../proposal-fragment'; +import { PROPOSAL_FRAGMENT } from '../proposal-fragment'; import type { Proposal as ProposalQueryResult, ProposalVariables, } from './__generated__/Proposal'; export const PROPOSAL_QUERY = gql` - ${PROPOSALS_FRAGMENT} + ${PROPOSAL_FRAGMENT} query Proposal($proposalId: ID!) { proposal(id: $proposalId) { ...ProposalFields diff --git a/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts b/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts index 892f399c5..9e78befc2 100644 --- a/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts +++ b/apps/token/src/routes/governance/proposals/__generated__/Proposals.ts @@ -9,7 +9,23 @@ import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol // GraphQL query operation: Proposals // ==================================================== -export interface Proposals_proposals_party { +export interface Proposals_proposalsConnection_edges_node_rationale { + __typename: "ProposalRationale"; + /** + * Title to be used to give a short description of the proposal in lists. + * This is to be between 0 and 100 unicode characters. + * This is mandatory for all proposals. + */ + title: string; + /** + * Description to show a short title / something in case the link goes offline. + * This is to be between 0 and 20k unicode characters. + * This is mandatory for all proposals. + */ + description: string; +} + +export interface Proposals_proposalsConnection_edges_node_party { __typename: "Party"; /** * Party identifier @@ -17,11 +33,11 @@ export interface Proposals_proposals_party { id: string; } -export interface Proposals_proposals_terms_change_UpdateAsset { +export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset { __typename: "UpdateAsset" | "NewFreeform"; } -export interface Proposals_proposals_terms_change_NewMarket_instrument_futureProduct_settlementAsset { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct_settlementAsset { __typename: "Asset"; /** * The symbol of the asset (e.g: GBP) @@ -29,15 +45,15 @@ export interface Proposals_proposals_terms_change_NewMarket_instrument_futurePro symbol: string; } -export interface Proposals_proposals_terms_change_NewMarket_instrument_futureProduct { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct { __typename: "FutureProduct"; /** * Product asset ID */ - settlementAsset: Proposals_proposals_terms_change_NewMarket_instrument_futureProduct_settlementAsset; + settlementAsset: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct_settlementAsset; } -export interface Proposals_proposals_terms_change_NewMarket_instrument { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument { __typename: "InstrumentConfiguration"; /** * Full and fairly descriptive name for the instrument @@ -50,31 +66,23 @@ export interface Proposals_proposals_terms_change_NewMarket_instrument { /** * Future product specification */ - futureProduct: Proposals_proposals_terms_change_NewMarket_instrument_futureProduct | null; + futureProduct: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct | null; } -export interface Proposals_proposals_terms_change_NewMarket { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket { __typename: "NewMarket"; - /** - * Decimal places used for the new market, sets the smallest price increment on the book - */ - decimalPlaces: number; - /** - * Metadata for this instrument, tags - */ - metadata: string[] | null; /** * New market instrument configuration */ - instrument: Proposals_proposals_terms_change_NewMarket_instrument; + instrument: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument; } -export interface Proposals_proposals_terms_change_UpdateMarket { +export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateMarket { __typename: "UpdateMarket"; marketId: string; } -export interface Proposals_proposals_terms_change_NewAsset_source_BuiltinAsset { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset { __typename: "BuiltinAsset"; /** * Maximum amount that can be requested by a party through the built-in asset faucet at a time @@ -82,7 +90,7 @@ export interface Proposals_proposals_terms_change_NewAsset_source_BuiltinAsset { maxFaucetAmountMint: string; } -export interface Proposals_proposals_terms_change_NewAsset_source_ERC20 { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20 { __typename: "ERC20"; /** * The address of the ERC20 contract @@ -90,9 +98,9 @@ export interface Proposals_proposals_terms_change_NewAsset_source_ERC20 { contractAddress: string; } -export type Proposals_proposals_terms_change_NewAsset_source = Proposals_proposals_terms_change_NewAsset_source_BuiltinAsset | Proposals_proposals_terms_change_NewAsset_source_ERC20; +export type Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source = Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset | Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20; -export interface Proposals_proposals_terms_change_NewAsset { +export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset { __typename: "NewAsset"; /** * The full name of the asset (e.g: Great British Pound) @@ -105,10 +113,10 @@ export interface Proposals_proposals_terms_change_NewAsset { /** * The source of the new asset */ - source: Proposals_proposals_terms_change_NewAsset_source; + source: Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source; } -export interface Proposals_proposals_terms_change_UpdateNetworkParameter_networkParameter { +export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter { __typename: "NetworkParameter"; /** * The name of the network parameter @@ -120,14 +128,14 @@ export interface Proposals_proposals_terms_change_UpdateNetworkParameter_network value: string; } -export interface Proposals_proposals_terms_change_UpdateNetworkParameter { +export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter { __typename: "UpdateNetworkParameter"; - networkParameter: Proposals_proposals_terms_change_UpdateNetworkParameter_networkParameter; + networkParameter: Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter; } -export type Proposals_proposals_terms_change = Proposals_proposals_terms_change_UpdateAsset | Proposals_proposals_terms_change_NewMarket | Proposals_proposals_terms_change_UpdateMarket | Proposals_proposals_terms_change_NewAsset | Proposals_proposals_terms_change_UpdateNetworkParameter; +export type Proposals_proposalsConnection_edges_node_terms_change = Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset | Proposals_proposalsConnection_edges_node_terms_change_NewMarket | Proposals_proposalsConnection_edges_node_terms_change_UpdateMarket | Proposals_proposalsConnection_edges_node_terms_change_NewAsset | Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter; -export interface Proposals_proposals_terms { +export interface Proposals_proposalsConnection_edges_node_terms { __typename: "ProposalTerms"; /** * RFC3339Nano time and date when voting closes for this proposal. @@ -143,18 +151,18 @@ export interface Proposals_proposals_terms { /** * Actual change being introduced by the proposal - action the proposal triggers if passed and enacted. */ - change: Proposals_proposals_terms_change; + change: Proposals_proposalsConnection_edges_node_terms_change; } -export interface Proposals_proposals_votes_yes_votes_party_stake { - __typename: "PartyStake"; +export interface Proposals_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ currentStakeAvailable: string; } -export interface Proposals_proposals_votes_yes_votes_party { +export interface Proposals_proposalsConnection_edges_node_votes_yes_votes_party { __typename: "Party"; /** * Party identifier @@ -163,10 +171,10 @@ export interface Proposals_proposals_votes_yes_votes_party { /** * The staking information for this Party */ - stake: Proposals_proposals_votes_yes_votes_party_stake; + stakingSummary: Proposals_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary; } -export interface Proposals_proposals_votes_yes_votes { +export interface Proposals_proposalsConnection_edges_node_votes_yes_votes { __typename: "Vote"; /** * The vote value cast @@ -175,14 +183,14 @@ export interface Proposals_proposals_votes_yes_votes { /** * The party casting the vote */ - party: Proposals_proposals_votes_yes_votes_party; + party: Proposals_proposalsConnection_edges_node_votes_yes_votes_party; /** * RFC3339Nano time and date when the vote reached Vega network */ datetime: string; } -export interface Proposals_proposals_votes_yes { +export interface Proposals_proposalsConnection_edges_node_votes_yes { __typename: "ProposalVoteSide"; /** * Total number of governance tokens from the votes cast for this side @@ -195,18 +203,18 @@ export interface Proposals_proposals_votes_yes { /** * All votes cast for this side */ - votes: Proposals_proposals_votes_yes_votes[] | null; + votes: Proposals_proposalsConnection_edges_node_votes_yes_votes[] | null; } -export interface Proposals_proposals_votes_no_votes_party_stake { - __typename: "PartyStake"; +export interface Proposals_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary { + __typename: "StakingSummary"; /** * The stake currently available for the party */ currentStakeAvailable: string; } -export interface Proposals_proposals_votes_no_votes_party { +export interface Proposals_proposalsConnection_edges_node_votes_no_votes_party { __typename: "Party"; /** * Party identifier @@ -215,10 +223,10 @@ export interface Proposals_proposals_votes_no_votes_party { /** * The staking information for this Party */ - stake: Proposals_proposals_votes_no_votes_party_stake; + stakingSummary: Proposals_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary; } -export interface Proposals_proposals_votes_no_votes { +export interface Proposals_proposalsConnection_edges_node_votes_no_votes { __typename: "Vote"; /** * The vote value cast @@ -227,14 +235,14 @@ export interface Proposals_proposals_votes_no_votes { /** * The party casting the vote */ - party: Proposals_proposals_votes_no_votes_party; + party: Proposals_proposalsConnection_edges_node_votes_no_votes_party; /** * RFC3339Nano time and date when the vote reached Vega network */ datetime: string; } -export interface Proposals_proposals_votes_no { +export interface Proposals_proposalsConnection_edges_node_votes_no { __typename: "ProposalVoteSide"; /** * Total number of governance tokens from the votes cast for this side @@ -247,27 +255,31 @@ export interface Proposals_proposals_votes_no { /** * All votes cast for this side */ - votes: Proposals_proposals_votes_no_votes[] | null; + votes: Proposals_proposalsConnection_edges_node_votes_no_votes[] | null; } -export interface Proposals_proposals_votes { +export interface Proposals_proposalsConnection_edges_node_votes { __typename: "ProposalVotes"; /** * Yes votes cast for this proposal */ - yes: Proposals_proposals_votes_yes; + yes: Proposals_proposalsConnection_edges_node_votes_yes; /** * No votes cast for this proposal */ - no: Proposals_proposals_votes_no; + no: Proposals_proposalsConnection_edges_node_votes_no; } -export interface Proposals_proposals { +export interface Proposals_proposalsConnection_edges_node { __typename: "Proposal"; /** * Proposal ID that is filled by Vega once proposal reaches the network */ id: string | null; + /** + * Rationale behind the proposal + */ + rationale: Proposals_proposalsConnection_edges_node_rationale; /** * A UUID reference to aid tracking proposals on Vega */ @@ -284,27 +296,43 @@ export interface Proposals_proposals { * Reason for the proposal to be rejected by the core */ rejectionReason: ProposalRejectionReason | null; + /** + * Party that prepared the proposal + */ + party: Proposals_proposalsConnection_edges_node_party; /** * Error details of the rejectionReason */ errorDetails: string | null; - /** - * Party that prepared the proposal - */ - party: Proposals_proposals_party; /** * Terms of the proposal */ - terms: Proposals_proposals_terms; + terms: Proposals_proposalsConnection_edges_node_terms; /** * Votes cast for this proposal */ - votes: Proposals_proposals_votes; + votes: Proposals_proposalsConnection_edges_node_votes; +} + +export interface Proposals_proposalsConnection_edges { + __typename: "ProposalEdge"; + /** + * The proposal data + */ + node: Proposals_proposalsConnection_edges_node; +} + +export interface Proposals_proposalsConnection { + __typename: "ProposalsConnection"; + /** + * List of proposals available for the connection + */ + edges: (Proposals_proposalsConnection_edges | null)[] | null; } export interface Proposals { /** * All governance proposals in the Vega network */ - proposals: Proposals_proposals[] | null; + proposalsConnection: Proposals_proposalsConnection; } diff --git a/apps/token/src/routes/governance/proposals/index.tsx b/apps/token/src/routes/governance/proposals/index.tsx index b3eea15fe..d91d347ed 100644 --- a/apps/token/src/routes/governance/proposals/index.tsx +++ b/apps/token/src/routes/governance/proposals/index.tsx @@ -1,5 +1,5 @@ export { ProposalsContainer, - PROPOSALS_QUERY, ProposalsContainer as default, + PROPOSALS_QUERY, } from './proposals-container'; diff --git a/apps/token/src/routes/governance/proposals/proposals-container.tsx b/apps/token/src/routes/governance/proposals/proposals-container.tsx index fc4bc574e..1bdba8b54 100644 --- a/apps/token/src/routes/governance/proposals/proposals-container.tsx +++ b/apps/token/src/routes/governance/proposals/proposals-container.tsx @@ -1,56 +1,36 @@ import { gql, useQuery } from '@apollo/client'; -import { ProposalState } from '@vegaprotocol/types'; +import { getNotRejectedProposals } from '@vegaprotocol/governance'; import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; -import compact from 'lodash/compact'; -import filter from 'lodash/filter'; -import flow from 'lodash/flow'; -import orderBy from 'lodash/orderBy'; -import React from 'react'; +import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { SplashLoader } from '../../../components/splash-loader'; import { ProposalsList } from '../components/proposals-list'; -import { PROPOSALS_FRAGMENT } from '../proposal-fragment'; +import { PROPOSAL_FRAGMENT } from '../proposal-fragment'; import type { Proposals } from './__generated__/Proposals'; export const PROPOSALS_QUERY = gql` - ${PROPOSALS_FRAGMENT} + ${PROPOSAL_FRAGMENT} query Proposals { - proposals { - ...ProposalFields + proposalsConnection { + edges { + node { + ...ProposalFields + } + } } } `; export const ProposalsContainer = () => { const { t } = useTranslation(); - const { data, loading, error } = useQuery(PROPOSALS_QUERY, { + const { data, loading, error } = useQuery(PROPOSALS_QUERY, { pollInterval: 5000, fetchPolicy: 'network-only', - errorPolicy: 'ignore', // this is to get around some backend issues and should be removed in future + errorPolicy: 'ignore', }); - const proposals = React.useMemo(() => { - if (!data?.proposals?.length) { - return []; - } - - return flow([ - compact, - (arr) => - filter(arr, ({ state }) => state !== ProposalState.STATE_REJECTED), - (arr) => - orderBy( - arr, - [ - (p) => new Date(p.terms.enactmentDatetime).getTime(), - (p) => new Date(p.terms.closingDatetime).getTime(), - (p) => p.id, - ], - ['desc', 'desc', 'desc'] - ), - ])(data.proposals); - }, [data]); + const proposals = useMemo(() => getNotRejectedProposals(data), [data]); if (error) { return ( diff --git a/apps/token/src/routes/governance/rejected/rejected-proposals-container.tsx b/apps/token/src/routes/governance/rejected/rejected-proposals-container.tsx index 0e5a96e6a..3ec686c49 100644 --- a/apps/token/src/routes/governance/rejected/rejected-proposals-container.tsx +++ b/apps/token/src/routes/governance/rejected/rejected-proposals-container.tsx @@ -1,46 +1,19 @@ import { useQuery } from '@apollo/client'; import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit'; -import compact from 'lodash/compact'; -import filter from 'lodash/filter'; -import flow from 'lodash/flow'; -import orderBy from 'lodash/orderBy'; -import React from 'react'; +import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; -import { PROPOSALS_QUERY } from '../proposals'; import { SplashLoader } from '../../../components/splash-loader'; import { RejectedProposalsList } from '../components/proposals-list'; +import { getRejectedProposals } from '@vegaprotocol/governance'; +import { PROPOSALS_QUERY } from '../proposals'; import type { Proposals } from '../proposals/__generated__/Proposals'; -import { ProposalState } from '@vegaprotocol/types'; export const RejectedProposalsContainer = () => { const { t } = useTranslation(); - const { data, loading, error } = useQuery(PROPOSALS_QUERY, { - pollInterval: 5000, - errorPolicy: 'ignore', // this is to get around some backend issues and should be removed in future - }); + const { data, loading, error } = useQuery(PROPOSALS_QUERY); - const proposals = React.useMemo(() => { - if (!data?.proposals?.length) { - return []; - } - - return flow([ - compact, - (arr) => - filter(arr, ({ state }) => state === ProposalState.STATE_REJECTED), - (arr) => - orderBy( - arr, - [ - (p) => new Date(p.terms.enactmentDatetime).getTime(), - (p) => new Date(p.terms.closingDatetime).getTime(), - (p) => p.id, - ], - ['desc', 'desc', 'desc'] - ), - ])(data.proposals); - }, [data]); + const proposals = useMemo(() => getRejectedProposals(data), [data]); if (error) { return ( diff --git a/apps/token/src/routes/governance/test-helpers/generate-proposals.ts b/apps/token/src/routes/governance/test-helpers/generate-proposals.ts index fd8dcaff2..eb2a47542 100644 --- a/apps/token/src/routes/governance/test-helpers/generate-proposals.ts +++ b/apps/token/src/routes/governance/test-helpers/generate-proposals.ts @@ -16,6 +16,11 @@ export function generateProposal( const defaultProposal: ProposalFields = { __typename: 'Proposal', id: faker.datatype.uuid(), + rationale: { + __typename: 'ProposalRationale', + title: '', + description: '', + }, reference: 'ref' + faker.datatype.uuid(), state: ProposalState.STATE_OPEN, datetime: faker.date.past().toISOString(), @@ -84,8 +89,8 @@ export const generateYesVotes = ( party: { id: faker.datatype.uuid(), __typename: 'Party', - stake: { - __typename: 'PartyStake', + stakingSummary: { + __typename: 'StakingSummary', currentStakeAvailable: fixedTokenValue ? fixedTokenValue.toString() : faker.datatype @@ -119,8 +124,8 @@ export const generateNoVotes = ( party: { id: faker.datatype.uuid(), __typename: 'Party', - stake: { - __typename: 'PartyStake', + stakingSummary: { + __typename: 'StakingSummary', currentStakeAvailable: fixedTokenValue ? fixedTokenValue.toString() : faker.datatype diff --git a/libs/governance/src/lib/index.ts b/libs/governance/src/lib/index.ts index e6f6ab975..3990e39c6 100644 --- a/libs/governance/src/lib/index.ts +++ b/libs/governance/src/lib/index.ts @@ -1,2 +1,3 @@ export * from './proposals-hooks'; export * from './proposal-form'; +export * from './proposals-queries'; diff --git a/libs/governance/src/lib/proposals-queries/index.ts b/libs/governance/src/lib/proposals-queries/index.ts new file mode 100644 index 000000000..1fdda9ca8 --- /dev/null +++ b/libs/governance/src/lib/proposals-queries/index.ts @@ -0,0 +1 @@ +export * from './proposals-queries'; diff --git a/libs/governance/src/lib/proposals-queries/proposals-queries.ts b/libs/governance/src/lib/proposals-queries/proposals-queries.ts new file mode 100644 index 000000000..99be43018 --- /dev/null +++ b/libs/governance/src/lib/proposals-queries/proposals-queries.ts @@ -0,0 +1,61 @@ +import compact from 'lodash/compact'; +import filter from 'lodash/filter'; +import flow from 'lodash/flow'; +import orderBy from 'lodash/orderBy'; +import { ProposalState } from '@vegaprotocol/types'; + +type Proposal = { + __typename: 'Proposal'; + id: string | null; + state: ProposalState; + terms: { + enactmentDatetime: string | null; + closingDatetime: string; + }; +}; +type ProposalEdge = { + node: Proposal; +}; +type ProposalsConnection = { + proposalsConnection: { + edges: (ProposalEdge | null)[] | null; + }; +}; + +export const getProposals = (data?: ProposalsConnection) => { + const proposals = data?.proposalsConnection.edges + ?.filter((e) => e?.node) + .map((e) => e?.node); + return proposals ? (proposals as Proposal[]) : []; +}; + +const orderByDate = (arr: Proposal[]) => + orderBy( + arr, + [ + (p) => new Date(p.terms.enactmentDatetime || 0).getTime(), // has to be defaulted to 0 because new Date(null).getTime() -> NaN which is first when ordered. + (p) => new Date(p.terms.closingDatetime).getTime(), + (p) => p.id, + ], + ['desc', 'desc', 'desc'] + ); + +export const getNotRejectedProposals = (data?: ProposalsConnection) => { + const proposals = getProposals(data); + return flow([ + compact, + (arr: Proposal[]) => + filter(arr, ({ state }) => state !== ProposalState.STATE_REJECTED), + orderByDate, + ])(proposals); +}; + +export const getRejectedProposals = (data?: ProposalsConnection) => { + const proposals = getProposals(data); + return flow([ + compact, + (arr: Proposal[]) => + filter(arr, ({ state }) => state === ProposalState.STATE_REJECTED), + orderByDate, + ])(proposals); +}; diff --git a/libs/react-helpers/src/lib/format/index.ts b/libs/react-helpers/src/lib/format/index.ts index 8aff8a189..0aca8c478 100644 --- a/libs/react-helpers/src/lib/format/index.ts +++ b/libs/react-helpers/src/lib/format/index.ts @@ -1,5 +1,5 @@ export * from './date'; export * from './number'; export * from './size'; -export * from './truncate'; +export * from './strings'; export * from './utils'; diff --git a/libs/react-helpers/src/lib/format/strings.spec.ts b/libs/react-helpers/src/lib/format/strings.spec.ts new file mode 100644 index 000000000..9a3bc1c19 --- /dev/null +++ b/libs/react-helpers/src/lib/format/strings.spec.ts @@ -0,0 +1,29 @@ +import { truncateByChars, ELLIPSIS, shorten } from './strings'; + +describe('truncateByChars', () => { + it.each([ + { + i: '12345678901234567890', + s: undefined, + e: undefined, + o: `123456${ELLIPSIS}567890`, + }, + { i: '12345678901234567890', s: 0, e: 10, o: `${ELLIPSIS}1234567890` }, + { i: '123', s: 0, e: 4, o: '123' }, + ])('should truncate given string by specific chars', ({ i, s, e, o }) => { + expect(truncateByChars(i, s, e)).toStrictEqual(o); + }); +}); + +describe('shorten', () => { + it.each([ + { i: '12345678901234567890', l: undefined, o: '12345678901234567890' }, + { i: '12345678901234567890', l: 0, o: `12345678901234567890` }, + { i: '12345678901234567890', l: 10, o: `123456789${ELLIPSIS}` }, + { i: '12345678901234567890', l: 20, o: `1234567890123456789${ELLIPSIS}` }, + { i: '12345678901234567890', l: 30, o: `12345678901234567890` }, + ])('should shorten given string by specific limit', ({ i, l, o }) => { + const output = shorten(i, l); + expect(output).toStrictEqual(o); + }); +}); diff --git a/libs/react-helpers/src/lib/format/strings.ts b/libs/react-helpers/src/lib/format/strings.ts new file mode 100644 index 000000000..975c15286 --- /dev/null +++ b/libs/react-helpers/src/lib/format/strings.ts @@ -0,0 +1,19 @@ +export const ELLIPSIS = '\u2026'; + +export function truncateByChars(input: string, start = 6, end = 6) { + // if the text is shorted than the total number of chars to show + // no truncation is needed. Plus one is to account for the ellipsis + if (input.length <= start + end + 1) { + return input; + } + return input.slice(0, start) + ELLIPSIS + input.slice(-end); +} + +export function shorten(input: string, limit?: number) { + if (!input || !limit || input.length < limit || limit <= 0) { + return input; + } + const output = input.substring(0, limit - 1); + const suffix = output.length < limit ? ELLIPSIS : ''; + return input.substring(0, limit - 1) + suffix; +} diff --git a/libs/react-helpers/src/lib/format/truncate.ts b/libs/react-helpers/src/lib/format/truncate.ts deleted file mode 100644 index bdaebd78f..000000000 --- a/libs/react-helpers/src/lib/format/truncate.ts +++ /dev/null @@ -1,14 +0,0 @@ -export function truncateByChars(s: string, startChars = 6, endChars = 6) { - const ELLIPSIS = '\u2026'; - - // if the text is shorted than the total number of chars to show - // no truncation is needed. Plus one is to account for the ellipsis - if (s.length <= startChars + endChars + 1) { - return s; - } - - const start = s.slice(0, startChars); - const end = s.slice(-endChars); - - return start + ELLIPSIS + end; -} From 6ddf706cf2b545e9869019aefbc778a573bea3e3 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 7 Sep 2022 18:04:21 +0000 Subject: [PATCH 21/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b56774652..59f4bdbb1 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107580.90108459106026495", + "locked_amount": "107521.63869676664798055", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51951.04483130390528", + "locked_amount": "51915.04412100456352", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48749.0439726514802140488", + "locked_amount": "48690.913090736869420662", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66631.5269392757717508219078", + "locked_amount": "66552.072059576589956358878196", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20507.88094833431029395", + "locked_amount": "20483.42629017946565262", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6675.116244916599046476", + "locked_amount": "6667.156490989583694443", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8885.3468448067629", + "locked_amount": "8844.616168478262", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1421711.293708737276320088", + "locked_amount": "1420383.559875850562032638", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33837.5746968095795", + "locked_amount": "33779.8729053442045", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20356.27207904634556896", - "locked_amount": "3513.9223077720049602058602434723", + "locked_amount": "3474.90208776588726823806980383155", "deposits": [ { "amount": "2833.333333", @@ -22320,7 +22320,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2209176.50133351736505168046", + "locked_amount": "2207136.33122690869386273867", "deposits": [ { "amount": "1998.95815", @@ -23177,7 +23177,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "189184.1028716497150444", - "locked_amount": "13133285.6166809441775928660565835030062179", + "locked_amount": "13126051.304474350479230961453173327676399", "deposits": [ { "amount": "16249.93", @@ -26217,7 +26217,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2724259.594291574628633947", - "locked_amount": "6403120.198209139246305526849101774", + "locked_amount": "6396441.527371531484268884850727953", "deposits": [ { "amount": "129284.449", @@ -31300,7 +31300,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2213008.11252078968651101922726495", + "locked_amount": "2210369.329280586458068073568629082", "deposits": [ { "amount": "552496.6455", @@ -32709,7 +32709,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "350056.644827550478175919964485", + "locked_amount": "349733.36821204877808704294063928", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 756066daa..3859ab0db 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "95.55940005073561960009461326737696596", + "locked_amount": "94.86816368594622420009392887493658042", "deposits": [ { "amount": "1000", From b5271d07e46682d7899d862869b91c26f9ced6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Wed, 7 Sep 2022 20:14:52 +0200 Subject: [PATCH 22/66] chore: use bigger runners for capusle (#1248) --- .github/workflows/capsule-cypress-manual-trigger.yml | 2 +- .github/workflows/capsule-cypress-night-run.yml | 2 +- .github/workflows/capsule-cypress.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 05c9377a2..84e6091e5 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -24,7 +24,7 @@ on: jobs: manual: name: Run capsule tests -- manual trigger - runs-on: ubuntu-latest + runs-on: ubuntu-20.04-16core env: GO111MODULE: 'on' GOPROXY: ${{ secrets.GO_PROXY }} diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 769062af2..98900d492 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -9,7 +9,7 @@ on: jobs: nightly: name: Run capsule tests -- nightly - runs-on: ubuntu-latest + runs-on: ubuntu-20.04-16core env: GO111MODULE: 'on' steps: diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index 74bbe04d6..68ea78f5a 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -15,7 +15,7 @@ on: jobs: pr: name: Run capsule tests - PR - runs-on: ubuntu-latest + runs-on: ubuntu-20.04-16core if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} env: GO111MODULE: 'on' From 9f6376c1b2cc183d954ab043a93e5a3cd8594810 Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Wed, 7 Sep 2022 19:35:48 +0100 Subject: [PATCH 23/66] fix: dialog alignment (#1281) --- libs/ui-toolkit/src/components/dialog/dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index 2d1e861b8..b148dee6f 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -27,7 +27,7 @@ export function Dialog({ size = 'small', }: DialogProps) { const contentClasses = classNames( - 'fixed top-0 left-0 z-20 flex items-center justify-center overflow-scroll', + 'fixed top-0 left-0 z-20 flex justify-center items-start overflow-scroll', 'w-full h-full' ); const wrapperClasses = classNames( From c83b5bf93c860d00cec93efa567fe443757ac939 Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 7 Sep 2022 20:37:39 +0200 Subject: [PATCH 24/66] chore(#1259): replaced market name with tradable instrument name (#1269) * chore: replaced market name with tradable instrument name (1259) * removed lodash import that must have added itself magically * =aligned cypress tests with code changed * =aligned console lite cypress mocks to the code changes * changed cypress market info key details test * changed cypress market info key details test * generate markets for console lite --- .../src/integration/market-selector.test.ts | 12 +++--- .../src/support/mocks/commons.ts | 2 +- .../src/support/mocks/generate-deal-ticket.ts | 2 +- .../support/mocks/generate-market-names.ts | 10 ++--- .../src/support/mocks/generate-markets.ts | 39 +++++++++++-------- .../deal-ticket/deal-ticket-steps.tsx | 2 +- .../__generated__/SimpleMarkets.ts | 8 ++-- .../simple-market-list/data-provider.ts | 2 +- .../simple-market-renderer.tsx | 4 +- .../src/app/hooks/use-column-definitions.tsx | 2 +- .../markets/__generated__/MarketsQuery.ts | 4 -- .../explorer/src/app/routes/markets/index.tsx | 5 ++- .../src/integration/market-info.cy.ts | 15 ++----- .../src/integration/trading-accounts.cy.ts | 2 +- .../src/integration/trading-collateral.cy.ts | 3 +- .../src/integration/trading-fills.cy.ts | 16 ++++++-- .../src/support/mocks/generate-accounts.ts | 24 ++++++++++-- .../mocks/generate-deal-ticket-query.ts | 4 +- .../src/support/mocks/generate-fills.ts | 14 +++++-- .../mocks/generate-market-info-query.ts | 1 - .../src/support/mocks/generate-market.ts | 3 +- .../src/support/mocks/generate-markets.ts | 8 +--- .../src/support/mocks/generate-orders.ts | 11 +++--- .../src/support/mocks/generate-positions.ts | 3 -- apps/trading-e2e/src/support/trading.ts | 6 ++- .../trading/pages/markets/[marketId].page.tsx | 1 - .../pages/markets/__generated__/Market.ts | 4 -- apps/trading/pages/markets/trade-grid.tsx | 5 ++- .../src/lib/__generated__/AccountFields.ts | 20 +++++++++- .../src/lib/__generated__/AccountSubscribe.ts | 20 +++++++++- .../src/lib/__generated__/Accounts.ts | 20 +++++++++- .../src/lib/accounts-data-provider.ts | 6 ++- libs/accounts/src/lib/accounts-table.spec.tsx | 8 +++- libs/accounts/src/lib/accounts-table.tsx | 2 +- .../src/components/DealTicket.graphql | 1 + .../src/components/MarketInfo.graphql | 1 - .../src/components/MarketNames.graphql | 2 +- .../components/__generated___/DealTicket.ts | 3 +- .../components/__generated___/MarketInfo.ts | 3 +- .../components/__generated___/MarketNames.ts | 4 +- .../__generated__/DealTicketQuery.ts | 8 ++-- .../deal-ticket/__generated__/MarketNames.ts | 8 ++-- .../deal-ticket/deal-ticket-container.tsx | 2 +- .../deal-ticket/market-selector.tsx | 39 +++++++++++++------ .../__generated__/MarketInfoQuery.ts | 4 -- .../market-info/info-market-query.ts | 1 - .../components/market-info/info-market.tsx | 10 +---- .../fills/src/lib/__generated__/FillFields.ts | 8 ++-- libs/fills/src/lib/__generated__/Fills.ts | 8 ++-- libs/fills/src/lib/__generated__/FillsSub.ts | 8 ++-- libs/fills/src/lib/fills-data-provider.ts | 2 +- libs/fills/src/lib/fills-table.spec.tsx | 8 ++-- libs/fills/src/lib/fills-table.tsx | 5 ++- libs/fills/src/lib/test-helpers.ts | 14 +++++-- .../src/lib/__generated__/MarketList.ts | 4 -- .../lib/components/select-market-columns.tsx | 2 +- .../src/lib/markets-data-provider.ts | 1 - .../lib/components/mocks/generate-orders.ts | 8 ++-- .../__generated__/OrderFields.ts | 8 ++-- .../__generated__/OrderSub.ts | 8 ++-- .../__generated__/Orders.ts | 8 ++-- .../order-data-provider.ts | 2 +- .../order-feedback/order-feedback.spec.tsx | 2 +- .../order-feedback/order-feedback.tsx | 2 +- .../order-list/order-edit-dialog.tsx | 2 +- .../order-hooks/__generated__/OrderEvent.ts | 20 +++++++++- .../src/lib/order-hooks/order-event-query.ts | 6 ++- .../src/lib/__generated__/PositionFields.ts | 4 -- .../src/lib/__generated__/Positions.ts | 4 -- .../__generated__/PositionsSubscription.ts | 4 -- .../src/lib/positions-data-providers.spec.ts | 18 +++++++-- .../src/lib/positions-data-providers.ts | 3 +- 72 files changed, 325 insertions(+), 208 deletions(-) diff --git a/apps/console-lite-e2e/src/integration/market-selector.test.ts b/apps/console-lite-e2e/src/integration/market-selector.test.ts index fef2122c8..be2502964 100644 --- a/apps/console-lite-e2e/src/integration/market-selector.test.ts +++ b/apps/console-lite-e2e/src/integration/market-selector.test.ts @@ -39,7 +39,7 @@ describe('market selector', () => { connectVegaWallet(); cy.get('input[placeholder="Search"]').should( 'have.value', - markets[0].name + markets[0].tradableInstrument.instrument.name ); cy.getByTestId('arrow-button').click(); cy.getByTestId('market-pane').should('be.visible'); @@ -47,7 +47,7 @@ describe('market selector', () => { .children() .find('[role="button"]') .first() - .should('contain.text', markets[0].name); + .should('contain.text', markets[0].tradableInstrument.instrument.name); cy.getByTestId('market-pane') .children() .find('[role="button"]') @@ -69,7 +69,9 @@ describe('market selector', () => { cy.get('input[placeholder="Search"]').clear(); cy.get('input[placeholder="Search"]').type('aa'); const filtered = markets.filter( - (market) => market.state === 'STATE_ACTIVE' && market.name.match(/aa/i) + (market) => + market.state === 'STATE_ACTIVE' && + market.tradableInstrument.instrument.name.match(/aa/i) ); cy.getByTestId('market-pane') .children() @@ -86,7 +88,7 @@ describe('market selector', () => { ); cy.get('input[placeholder="Search"]').should( 'have.value', - filtered[filtered.length - 1].name + filtered[filtered.length - 1].tradableInstrument.instrument.name ); } }); @@ -129,7 +131,7 @@ describe('market selector', () => { cy.getByTestId('dialog-close').click(); cy.get('input[placeholder="Search"]').should( 'have.value', - markets[0].name + markets[0].tradableInstrument.instrument.name ); } }); diff --git a/apps/console-lite-e2e/src/support/mocks/commons.ts b/apps/console-lite-e2e/src/support/mocks/commons.ts index e0f67fb75..a80b9e4fe 100644 --- a/apps/console-lite-e2e/src/support/mocks/commons.ts +++ b/apps/console-lite-e2e/src/support/mocks/commons.ts @@ -75,11 +75,11 @@ const protoCandles = [ export const protoMarket = { id: 'first-btcusd-id', - name: 'AAVEDAI Monthly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:2839D9B2329C9E70', diff --git a/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts b/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts index e74c726e8..a99bd4603 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-deal-ticket.ts @@ -2,13 +2,13 @@ export const generateDealTicket = () => { return { market: { id: 'first-btcusd-id', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, state: 'STATE_ACTIVE', tradingMode: 'Continuous', tradableInstrument: { instrument: { + name: 'AAVEDAI Monthly (30 Jun 2022)', product: { quoteName: 'DAI', settlementAsset: { diff --git a/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts b/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts index 9fd098070..07ad3bf48 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-market-names.ts @@ -6,11 +6,11 @@ export const generateMarketNames = () => { { ...protoMarket }, { id: '1d7ddf67dac4924db03f5bf58571a7bcb1908d70c66580467717aabc5345b68a', - name: 'Apple Monthly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'AAPL.MF21', + name: 'Apple Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:4899E01009F1A721', @@ -32,11 +32,11 @@ export const generateMarketNames = () => { }, { id: '87ae87cd3244fc1fab4b0e2dad2437879864192bb969f3109b69293421644c8b', - name: 'Tesla Quarterly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:5A86B190C384997F', @@ -58,11 +58,11 @@ export const generateMarketNames = () => { }, { id: '69205712a854f1bbfb69fa3d11b60e01a1e249bafb5ece88115e7451e8ef07b3', - name: 'BTCUSD Monthly (30 Jun 2022)', state: 'STATE_SUSPENDED', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -83,11 +83,11 @@ export const generateMarketNames = () => { }, { id: 'ethbtc-quaterly', - name: 'ETHBTC Quarterly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'ETHBTC.QM21', + name: 'ETHBTC Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:1F0BB6EB5703B099', @@ -108,11 +108,11 @@ export const generateMarketNames = () => { }, { id: '3c62b2714c4332d1a689a5352bff090e6aabccfd6bd87ce018936b38372530c9', - name: 'UNIDAI Monthly (30 Jun 2022)', state: 'STATE_ACTIVE', tradableInstrument: { instrument: { code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:3C58ED2A4A6C5D7E', diff --git a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts index 114af877a..18a3cdc42 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts @@ -6,11 +6,11 @@ export const generateSimpleMarkets = () => { { ...protoMarket }, { id: '57fbaa322e97cfc8bb5f1de048c37e033c41b1ac1906d3aed9960912a067ef5a', - name: 'CELUSD (June 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'CELUSD', + name: 'CELUSD (June 2022)', metadata: { tags: [ 'base:CEL', @@ -35,11 +35,11 @@ export const generateSimpleMarkets = () => { }, { id: 'ccf2f04865e5951ac3405da6e16b7cbdb535a0ad32df4df2dbed4262cf473255', - name: 'XMRUSD market', state: 'Suspended', tradableInstrument: { instrument: { code: 'XMRUSD', + name: 'XMRUSD market', metadata: { tags: [ 'base:monero', @@ -64,11 +64,11 @@ export const generateSimpleMarkets = () => { }, { id: '6030e5b4e0ca3297a26081e5af4d453f97f96baab2d74bf56f84efcffc4c382f', - name: 'UNIDAI Monthly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:3C58ED2A4A6C5D7E', @@ -167,11 +167,11 @@ export const generateSimpleMarkets = () => { }, { id: 'de74a5572045b300e8ec50d136896912ec76e7d7ec135bc305dfd4854d9363a4', - name: 'XMRUSD market', state: 'Pending', tradableInstrument: { instrument: { code: 'XMRUSD', + name: 'XMRUSD market', metadata: { tags: [ 'base:monero', @@ -269,11 +269,11 @@ export const generateSimpleMarkets = () => { }, { id: '31ea96284611771e486c820acb26a325a99664f9854b5a7e7ad99023efa8f9e6', - name: 'ApeCoin (18 Jul 2022)', state: 'Closed', tradableInstrument: { instrument: { code: 'APE/USD', + name: 'ApeCoin (18 Jul 2022)', metadata: { tags: [ 'quote:USD', @@ -297,11 +297,11 @@ export const generateSimpleMarkets = () => { }, { id: '34cff959cdc2ffdb0f167820d701fe8b51cc6b8588e650d93369aaa22d6f8b74', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Settled', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -327,11 +327,11 @@ export const generateSimpleMarkets = () => { }, { id: '87b0bbb3c171baa5d97dfc3852332829c91e5c5dc9f7c8fb584c6d8ac75aaaf2', - name: 'Builders Club x ETHcc', state: 'Settled', tradableInstrument: { instrument: { code: 'LTCUSD', + name: 'Builders Club x ETHcc', metadata: { tags: [ 'base:litecoin', @@ -417,11 +417,11 @@ export const generateSimpleMarkets = () => { }, { id: '45266143c6e9b58f4cff9b8906e971c531bb29ea7af01066973f9b77e8134823', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Pending', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -447,11 +447,11 @@ export const generateSimpleMarkets = () => { }, { id: '65663ebdc96161162769c4d5c5508137416748178d7cb28e2cb0d07a151a2bc6', - name: 'ETHBTC Quarterly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'ETHBTC.QM21', + name: 'ETHBTC Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:1F0BB6EB5703B099', @@ -550,11 +550,11 @@ export const generateSimpleMarkets = () => { }, { id: '234afabd27e3bce1a879039c041f9f00f915d98459935ddafd0169d38dd13850', - name: 'Apple Monthly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'AAPL.MF21', + name: 'Apple Monthly (30 Jun 2022)', metadata: { tags: [ 'formerly:4899E01009F1A721', @@ -654,11 +654,11 @@ export const generateSimpleMarkets = () => { }, { id: '9f2a3c1caa67bb0773ec18d908d32b55b129b9ec2d106a8e9a87f6aa5c0375a6', - name: 'Tesla Quarterly (30 Jun 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', metadata: { tags: [ 'formerly:5A86B190C384997F', @@ -758,11 +758,11 @@ export const generateSimpleMarkets = () => { }, { id: '8a45ee934d3ddac4b036f9884df1064a5353c620a56f775ba36597d0edef9a7a', - name: 'Go big or Go home', state: 'Active', tradableInstrument: { instrument: { code: 'LTCUSD', + name: 'Go big or Go home', metadata: { tags: [ 'base:litecoin', @@ -801,11 +801,11 @@ export const generateSimpleMarkets = () => { }, { id: 'aede7b9ac0c3b225004929c5455160a00f59864aad32ec366e8a2bff1b30fd0f', - name: 'BTCUSD Monthly (08 Jul 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (08 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -831,11 +831,11 @@ export const generateSimpleMarkets = () => { }, { id: '9398707e01daa1a1f1ca6ff87cf8d6c03fe7373ce31121ce81b99a129e6bda47', - name: 'BTCUSD Monthly (18 Jul 2022)', state: 'Active', tradableInstrument: { instrument: { code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (18 Jul 2022)', metadata: { tags: [ 'formerly:076BB86A5AA41E3E', @@ -866,11 +866,16 @@ export const generateSimpleMarkets = () => { export const generateLongListMarkets = (count: number) => { const markets = []; for (let i = 0; i < count; i++) { - const { id, name } = protoMarket; markets.push({ ...protoMarket, - id: id + i, - name: name + i, + id: protoMarket.id + i, + tradableInstrument: { + ...protoMarket.tradableInstrument, + instrument: { + ...protoMarket.tradableInstrument.instrument, + name: protoMarket.tradableInstrument.instrument.name + i, + }, + }, }); } return { markets }; diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx index adeafd80b..18b6f7c97 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx @@ -179,7 +179,7 @@ export const DealTicketSteps = ({ ItemRenderer={MarketNameRenderer} /> ), - value: market.name, + value: market.tradableInstrument.instrument.name, }, { label: t('Select Direction'), diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts index ac8761d5a..97dc42767 100644 --- a/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts +++ b/apps/console-lite/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts @@ -43,6 +43,10 @@ export interface SimpleMarkets_markets_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * Metadata for this instrument */ @@ -79,10 +83,6 @@ export interface SimpleMarkets_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current state of the market */ diff --git a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts index 2032149a1..5be5b70fe 100644 --- a/apps/console-lite/src/app/components/simple-market-list/data-provider.ts +++ b/apps/console-lite/src/app/components/simple-market-list/data-provider.ts @@ -14,11 +14,11 @@ export const MARKETS_QUERY = gql` query SimpleMarkets($CandleSince: String!) { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx index 0b68f24ea..9283f2972 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.tsx @@ -17,7 +17,9 @@ const MarketNameRenderer = ({ market, isMobile }: Props) => { )} />
- {isMobile ? market.tradableInstrument.instrument.code : market.name}{' '} + {isMobile + ? market.tradableInstrument.instrument.code + : market.tradableInstrument.instrument.name}{' '} diff --git a/apps/console-lite/src/app/hooks/use-column-definitions.tsx b/apps/console-lite/src/app/hooks/use-column-definitions.tsx index 647b0e427..f5bbf8fcf 100644 --- a/apps/console-lite/src/app/hooks/use-column-definitions.tsx +++ b/apps/console-lite/src/app/hooks/use-column-definitions.tsx @@ -22,7 +22,7 @@ const useColumnDefinitions = ({ isMobile }: Props) => { headerName: t('Markets'), headerClass: 'uppercase', minWidth: isMobile ? 160 : 350, - field: 'name', + field: 'tradableInstrument.instrument.name', cellClass: 'overflow-visible', cellRenderer: ({ data }: { data: SimpleMarketsType }) => ( diff --git a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts index 8d6afc124..9896efed9 100644 --- a/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts +++ b/apps/explorer/src/app/routes/markets/__generated__/MarketsQuery.ts @@ -465,10 +465,6 @@ export interface MarketsQuery_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Fees related data */ diff --git a/apps/explorer/src/app/routes/markets/index.tsx b/apps/explorer/src/app/routes/markets/index.tsx index 5f8fe8f4d..22b7ad466 100644 --- a/apps/explorer/src/app/routes/markets/index.tsx +++ b/apps/explorer/src/app/routes/markets/index.tsx @@ -11,7 +11,6 @@ const MARKETS_QUERY = gql` query MarketsQuery { markets { id - name fees { factors { makerFee @@ -154,7 +153,9 @@ const Markets = () => { {data?.markets ? data.markets.map((m) => ( - {m.name} + + {m.tradableInstrument.instrument.name} + )) diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index c02477b1f..0cc3bda16 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -1,8 +1,4 @@ -import { - MarketState, - MarketStateMapping, - MarketTradingModeMapping, -} from '@vegaprotocol/types'; +import { MarketState, MarketTradingModeMapping } from '@vegaprotocol/types'; import { mockTradingPage } from '../support/trading'; const marketInfoBtn = 'Info'; @@ -52,16 +48,13 @@ describe('market info is displayed', () => { it('key details displayed', () => { cy.getByTestId(marketTitle).contains('Key details').click(); - validateMarketDataRow(0, 'Name', 'ETHBTC Quarterly (30 Jun 2022)'); - validateMarketDataRow(1, 'Decimal Places', '2'); - validateMarketDataRow(2, 'Position Decimal Places', '0'); + validateMarketDataRow(0, 'Name', 'BTCUSD Monthly (30 Jun 2022)'); + validateMarketDataRow(1, 'Market ID', 'market-0'); validateMarketDataRow( - 3, + 2, 'Trading Mode', MarketTradingModeMapping.TRADING_MODE_CONTINUOUS ); - validateMarketDataRow(4, 'State', MarketStateMapping.STATE_ACTIVE); - validateMarketDataRow(5, 'Market ID', 'market-0'); }); it('instrument displayed', () => { diff --git a/apps/trading-e2e/src/integration/trading-accounts.cy.ts b/apps/trading-e2e/src/integration/trading-accounts.cy.ts index 13a525745..727410080 100644 --- a/apps/trading-e2e/src/integration/trading-accounts.cy.ts +++ b/apps/trading-e2e/src/integration/trading-accounts.cy.ts @@ -33,7 +33,7 @@ describe('accounts', () => { cy.getByTestId('tab-accounts') .should('be.visible') .get(tradingAccountRowId) - .find('[col-id="market.name"]') + .find('[col-id="market.tradableInstrument.instrument.name"]') .should('have.text', '—'); cy.getByTestId('tab-accounts') diff --git a/apps/trading-e2e/src/integration/trading-collateral.cy.ts b/apps/trading-e2e/src/integration/trading-collateral.cy.ts index 229046660..292b3db8f 100644 --- a/apps/trading-e2e/src/integration/trading-collateral.cy.ts +++ b/apps/trading-e2e/src/integration/trading-collateral.cy.ts @@ -13,7 +13,8 @@ describe('collateral', () => { const collateralTab = 'Collateral'; const assetSymbolColumn = "[col-id='asset.symbol']"; const assetTypeColumn = "[col-id='type']"; - const assetMarketName = "[col-id='market.name']"; + const assetMarketName = + "[col-id='market.tradableInstrument.instrument.name']"; it('renders collateral', () => { connectVegaWallet(); cy.getByTestId(collateralTab).click(); diff --git a/apps/trading-e2e/src/integration/trading-fills.cy.ts b/apps/trading-e2e/src/integration/trading-fills.cy.ts index 9c78895e6..4467621c3 100644 --- a/apps/trading-e2e/src/integration/trading-fills.cy.ts +++ b/apps/trading-e2e/src/integration/trading-fills.cy.ts @@ -22,7 +22,11 @@ const fills = [ infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -37,7 +41,11 @@ const fills = [ id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: Cypress.env('VEGA_PUBLIC_KEY'), @@ -90,7 +98,9 @@ describe('fills', () => { cy.getByTestId('tab-fills').should('be.visible'); cy.getByTestId('tab-fills') - .get('[role="gridcell"][col-id="market.name"]') + .get( + '[role="gridcell"][col-id="market.tradableInstrument.instrument.name"]' + ) .each(($marketSymbol) => { cy.wrap($marketSymbol).invoke('text').should('not.be.empty'); }); diff --git a/apps/trading-e2e/src/support/mocks/generate-accounts.ts b/apps/trading-e2e/src/support/mocks/generate-accounts.ts index 4639708a1..91b40d0cd 100644 --- a/apps/trading-e2e/src/support/mocks/generate-accounts.ts +++ b/apps/trading-e2e/src/support/mocks/generate-accounts.ts @@ -29,7 +29,13 @@ export const generateAccounts = ( balance: '100000000', market: { id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13', - name: 'AAVEDAI Monthly (30 Jun 2022)', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'AAVEDAI Monthly (30 Jun 2022)', + }, + }, __typename: 'Market', }, asset: { @@ -45,7 +51,13 @@ export const generateAccounts = ( balance: '1000', market: { __typename: 'Market', - name: '', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: '', + }, + }, id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', }, asset: { @@ -61,7 +73,13 @@ export const generateAccounts = ( balance: '1000', market: { __typename: 'Market', - name: '', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: '', + }, + }, id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', }, asset: { diff --git a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts index 55c162232..faa6ff55e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-deal-ticket-query.ts @@ -10,7 +10,6 @@ export const generateDealTicketQuery = ( market: { __typename: 'Market', id: 'market-0', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, state: MarketState.STATE_ACTIVE, @@ -18,8 +17,9 @@ export const generateDealTicketQuery = ( tradableInstrument: { __typename: 'TradableInstrument', instrument: { - id: 'tBTC TEST', __typename: 'Instrument', + id: 'tBTC TEST', + name: 'ETHBTC Quarterly (30 Jun 2022)', product: { __typename: 'Future', quoteName: 'BTC', diff --git a/apps/trading-e2e/src/support/mocks/generate-fills.ts b/apps/trading-e2e/src/support/mocks/generate-fills.ts index 987e50653..192982fbc 100644 --- a/apps/trading-e2e/src/support/mocks/generate-fills.ts +++ b/apps/trading-e2e/src/support/mocks/generate-fills.ts @@ -23,7 +23,11 @@ export const generateFills = (override?: PartialDeep): Fills => { infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -38,7 +42,11 @@ export const generateFills = (override?: PartialDeep): Fills => { id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: Cypress.env('VEGA_PUBLIC_KEY'), @@ -108,7 +116,6 @@ export const generateFill = ( market: { __typename: 'Market', id: 'market-id', - name: 'UNIDAI Monthly (30 Jun 2022)', positionDecimalPlaces: 0, decimalPlaces: 5, tradableInstrument: { @@ -117,6 +124,7 @@ export const generateFill = ( __typename: 'Instrument', id: 'instrument-id', code: 'instrument-code', + name: 'UNIDAI Monthly (30 Jun 2022)', product: { __typename: 'Future', settlementAsset: { diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index 709075397..f11f8867e 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -15,7 +15,6 @@ export const generateMarketInfoQuery = ( market: { __typename: 'Market', id: 'market-0', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 2, positionDecimalPlaces: 0, state: MarketState.STATE_ACTIVE, diff --git a/apps/trading-e2e/src/support/mocks/generate-market.ts b/apps/trading-e2e/src/support/mocks/generate-market.ts index 322bd3be4..06fb8abda 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market.ts @@ -12,7 +12,6 @@ export const generateMarket = (override?: PartialDeep): Market => { const defaultResult: Market = { market: { id: 'market-0', - name: 'ACTIVE MARKET', tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, state: MarketState.STATE_ACTIVE, decimalPlaces: 5, @@ -39,7 +38,7 @@ export const generateMarket = (override?: PartialDeep): Market => { tradableInstrument: { instrument: { id: 'BTCUSD.MF21', - name: 'BTCUSD Monthly', + name: 'ACTIVE MARKET', code: 'BTCUSD.MF21', metadata: { tags: [ diff --git a/apps/trading-e2e/src/support/mocks/generate-markets.ts b/apps/trading-e2e/src/support/mocks/generate-markets.ts index 4aa54b5fe..c4724aa7a 100644 --- a/apps/trading-e2e/src/support/mocks/generate-markets.ts +++ b/apps/trading-e2e/src/support/mocks/generate-markets.ts @@ -13,7 +13,6 @@ export const generateMarkets = ( const markets: MarketList_markets[] = [ { id: 'market-0', - name: 'ACTIVE MARKET', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -59,7 +58,7 @@ export const generateMarkets = ( instrument: { id: '', code: 'BTCUSD.MF21', - name: '', + name: 'ACTIVE MARKET', metadata: { __typename: 'InstrumentMetadata', tags: [], @@ -79,7 +78,6 @@ export const generateMarkets = ( }, { id: 'market-1', - name: 'SUSPENDED MARKET', decimalPlaces: 2, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -124,7 +122,7 @@ export const generateMarkets = ( tradableInstrument: { instrument: { id: 'SOLUSD', - name: 'SOL/USD', + name: 'SUSPENDED MARKET', code: 'SOLUSD', metadata: { __typename: 'InstrumentMetadata', @@ -145,7 +143,6 @@ export const generateMarkets = ( }, { id: 'market-2', - name: 'Apple Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, @@ -211,7 +208,6 @@ export const generateMarkets = ( }, { id: 'market-3', - name: 'ETHBTC Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, diff --git a/apps/trading-e2e/src/support/mocks/generate-orders.ts b/apps/trading-e2e/src/support/mocks/generate-orders.ts index b466ffb3e..ca65d3061 100644 --- a/apps/trading-e2e/src/support/mocks/generate-orders.ts +++ b/apps/trading-e2e/src/support/mocks/generate-orders.ts @@ -19,7 +19,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -28,6 +27,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', }, }, }, @@ -49,7 +49,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -58,6 +57,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', }, }, }, @@ -79,7 +79,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'c6f4337b31ed57a961969c3ba10297b369d01b9e75a4cbb96db4fc62886444e6', - name: 'BTCUSD Monthly (30 Jun 2022)', + decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -88,6 +88,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', }, }, }, @@ -109,7 +110,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'a316fa51dab97d76a1472c2f22906f4e461728e04355096788165d5b13999ed5', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -118,6 +118,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', }, }, }, @@ -139,7 +140,6 @@ export const generateOrders = (override?: PartialDeep): Orders => { market: { __typename: 'Market', id: 'a316fa51dab97d76a1472c2f22906f4e461728e04355096788165d5b13999ed5', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -148,6 +148,7 @@ export const generateOrders = (override?: PartialDeep): Orders => { id: '', __typename: 'Instrument', code: 'UNIDAI.MF21', + name: 'UNIDAI Monthly (30 Jun 2022)', }, }, }, diff --git a/apps/trading-e2e/src/support/mocks/generate-positions.ts b/apps/trading-e2e/src/support/mocks/generate-positions.ts index 5eca42b3f..cbe5665a0 100644 --- a/apps/trading-e2e/src/support/mocks/generate-positions.ts +++ b/apps/trading-e2e/src/support/mocks/generate-positions.ts @@ -42,7 +42,6 @@ export const generatePositions = ( }, market: { id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'UNIDAI Monthly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '17588787', @@ -96,7 +95,6 @@ export const generatePositions = ( }, market: { id: '0604e8c918655474525e1a95367902266ade70d318c2c908f0cca6e3d11dcb13', - name: 'AAVEDAI Monthly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '8649338', @@ -149,7 +147,6 @@ export const generatePositions = ( }, market: { id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, data: { markPrice: '84377569', diff --git a/apps/trading-e2e/src/support/trading.ts b/apps/trading-e2e/src/support/trading.ts index 43f90041f..0b11bfeb1 100644 --- a/apps/trading-e2e/src/support/trading.ts +++ b/apps/trading-e2e/src/support/trading.ts @@ -22,7 +22,11 @@ export const mockTradingPage = ( 'Market', generateMarket({ market: { - name: `${state.toUpperCase()} MARKET`, + tradableInstrument: { + instrument: { + name: `${state.toUpperCase()} MARKET`, + }, + }, state: state, }, }) diff --git a/apps/trading/pages/markets/[marketId].page.tsx b/apps/trading/pages/markets/[marketId].page.tsx index 50b36ef2a..2ec8f1d35 100644 --- a/apps/trading/pages/markets/[marketId].page.tsx +++ b/apps/trading/pages/markets/[marketId].page.tsx @@ -16,7 +16,6 @@ const MARKET_QUERY = gql` query Market($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name tradingMode state decimalPlaces diff --git a/apps/trading/pages/markets/__generated__/Market.ts b/apps/trading/pages/markets/__generated__/Market.ts index eb66c911f..ff2b98e79 100644 --- a/apps/trading/pages/markets/__generated__/Market.ts +++ b/apps/trading/pages/markets/__generated__/Market.ts @@ -187,10 +187,6 @@ export interface Market_market { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current mode of execution of the market */ diff --git a/apps/trading/pages/markets/trade-grid.tsx b/apps/trading/pages/markets/trade-grid.tsx index 60a5d88f6..ccd0df1fd 100644 --- a/apps/trading/pages/markets/trade-grid.tsx +++ b/apps/trading/pages/markets/trade-grid.tsx @@ -141,7 +141,10 @@ export const TradeMarketHeader = ({ market }: TradeMarketHeaderProps) => {
- +
( /> ; -export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; +export type DealTicketQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string } } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; export const DealTicketQueryDocument = gql` @@ -23,6 +23,7 @@ export const DealTicketQueryDocument = gql` tradableInstrument { instrument { id + name product { ... on Future { quoteName diff --git a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts index 54dd4244d..db4847f58 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts @@ -10,14 +10,13 @@ export type MarketInfoQueryQueryVariables = Types.Exact<{ }>; -export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, name: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; +export type MarketInfoQueryQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, indicativeVolume: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, openInterest: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candles?: Array<{ __typename?: 'Candle', volume: string } | null> | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string }, oracleSpecForSettlementPrice: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementPriceProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; export const MarketInfoQueryDocument = gql` query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/deal-ticket/src/components/__generated___/MarketNames.ts b/libs/deal-ticket/src/components/__generated___/MarketNames.ts index 2e9f19474..edd97bfea 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketNames.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketNames.ts @@ -6,18 +6,18 @@ const defaultOptions = {} as const; export type MarketNamesQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, name: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null }; +export type MarketNamesQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, state: Types.MarketState, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string } } } }> | null }; export const MarketNamesDocument = gql` query MarketNames { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts index 283cdaa4d..a1a6bf1d9 100644 --- a/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts +++ b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicketQuery.ts @@ -43,6 +43,10 @@ export interface DealTicketQuery_market_tradableInstrument_instrument { * Uniquely identify an instrument across all instruments available on Vega (string) */ id: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) */ @@ -79,10 +83,6 @@ export interface DealTicketQuery_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) diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts index 2247947f9..c91ec7e1f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts +++ b/libs/deal-ticket/src/components/deal-ticket/__generated__/MarketNames.ts @@ -31,6 +31,10 @@ export interface MarketNames_markets_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; /** * Metadata for this instrument */ @@ -55,10 +59,6 @@ export interface MarketNames_markets { * Market ID */ id: string; - /** - * Market full name - */ - name: string; /** * Current state of the market */ diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx index 085481e7f..62682822f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx @@ -8,7 +8,6 @@ const DEAL_TICKET_QUERY = gql` query DealTicketQuery($marketId: ID!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state @@ -16,6 +15,7 @@ const DEAL_TICKET_QUERY = gql` tradableInstrument { instrument { id + name product { ... on Future { quoteName diff --git a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx index eef06a9d2..86aa8ecdc 100644 --- a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx @@ -33,11 +33,11 @@ export const MARKET_NAMES_QUERY = gql` query MarketNames { markets { id - name state tradableInstrument { instrument { code + name metadata { tags } @@ -70,7 +70,9 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { const [skip, setSkip] = useState(true); const [results, setResults] = useState([]); const [showPane, setShowPane] = useState(false); - const [lookup, setLookup] = useState(market.name || ''); + const [lookup, setLookup] = useState( + market.tradableInstrument.instrument.name || '' + ); const [dialogContent, setDialogContent] = useState( null ); @@ -102,10 +104,13 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { ); const handleMarketSelect = useCallback( - ({ id, name }: { id: string; name: string }) => { - setLookup(name); + (market: { + id: string; + tradableInstrument: { instrument: { name: string } }; + }) => { + setLookup(market.tradableInstrument.instrument.name); setShowPane(false); - setMarket(id); + setMarket(market.id); inputRef.current?.focus(); }, [setLookup, setShowPane, setMarket, inputRef] @@ -142,7 +147,7 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { break; default: setShowPane(false); - setLookup(market.name); + setLookup(market.tradableInstrument.instrument.name); } }, [results, handleMarketSelect] @@ -159,7 +164,7 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { const handleOnBlur = useCallback(() => { if (!lookup && !showPane) { - setLookup(market.name); + setLookup(market.tradableInstrument.instrument.name); } }, [market, lookup, showPane, setLookup]); @@ -173,11 +178,17 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { (isOpen: boolean) => { setShowPane(isOpen); if (!isOpen) { - setLookup(lookup || market.name); + setLookup(lookup || market.tradableInstrument.instrument.name); inputRef.current?.focus(); } }, - [setShowPane, lookup, setLookup, market.name, inputRef] + [ + setShowPane, + lookup, + setLookup, + market.tradableInstrument.instrument.name, + inputRef, + ] ); const selectorContent = useMemo(() => { @@ -235,7 +246,11 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { onClick={() => handleMarketSelect(market)} onKeyDown={(e) => handleItemKeyDown(e, market, i)} > - {ItemRenderer ? : market.name} + {ItemRenderer ? ( + + ) : ( + market.tradableInstrument.instrument.name + )}
))}
@@ -262,7 +277,9 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => { data?.markets?.filter( (item: MarketNames_markets) => item.state === MarketState.STATE_ACTIVE && - item.name.match(new RegExp(escapeRegExp(lookup), 'i')) + item.tradableInstrument.instrument.name.match( + new RegExp(escapeRegExp(lookup), 'i') + ) ) || [] ); }, [data, lookup]); diff --git a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts index 529fc790d..b564c331d 100644 --- a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts +++ b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts @@ -459,10 +459,6 @@ export interface MarketInfoQuery_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) diff --git a/libs/deal-ticket/src/components/market-info/info-market-query.ts b/libs/deal-ticket/src/components/market-info/info-market-query.ts index 35f9d63d0..98afe6ef9 100644 --- a/libs/deal-ticket/src/components/market-info/info-market-query.ts +++ b/libs/deal-ticket/src/components/market-info/info-market-query.ts @@ -4,7 +4,6 @@ export const MARKET_INFO_QUERY = gql` query MarketInfoQuery($marketId: ID!, $interval: Interval!, $since: String!) { market(id: $marketId) { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/deal-ticket/src/components/market-info/info-market.tsx b/libs/deal-ticket/src/components/market-info/info-market.tsx index 89e65f22d..89e6711ae 100644 --- a/libs/deal-ticket/src/components/market-info/info-market.tsx +++ b/libs/deal-ticket/src/components/market-info/info-market.tsx @@ -155,13 +155,7 @@ export const Info = ({ market }: InfoProps) => { ]; const { VEGA_EXPLORER_URL } = useEnvironment(); const keyDetails = { - ...pick( - market, - 'name', - 'decimalPlaces', - 'positionDecimalPlaces', - 'tradingMode' - ), + ...pick(market, 'decimalPlaces', 'positionDecimalPlaces', 'tradingMode'), state: MarketStateMapping[market.state], }; const marketSpecPanels = [ @@ -170,7 +164,7 @@ export const Info = ({ market }: InfoProps) => { content: ( { price: '100', size: '300000', market: { - name: 'test market', decimalPlaces: 2, positionDecimalPlaces: 5, tradableInstrument: { instrument: { + name: 'test market', product: { settlementAsset: { decimals: 2, @@ -87,7 +87,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '+3.00000', '1.00 BTC', '3.00 BTC', @@ -124,7 +124,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '+3.00000', '1.00 BTC', '3.00 BTC', @@ -161,7 +161,7 @@ describe('FillsTable', () => { const cells = screen.getAllByRole('gridcell'); const expectedValues = [ - buyerFill.market.name, + buyerFill.market.tradableInstrument.instrument.name, '-3.00000', '1.00 BTC', '3.00 BTC', diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 966d95c4f..70ada7875 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -44,7 +44,10 @@ export const FillsTable = forwardRef( getRowId={({ data }) => data?.id} {...props} > - + ): Fills => { infrastructureFee: '5000', }, market: { - name: 'Apples Daily v3', + tradableInstrument: { + instrument: { + name: 'Apples Daily v3', + }, + }, positionDecimalPlaces: 2, }, }), @@ -38,7 +42,11 @@ export const generateFills = (override?: PartialDeep): Fills => { id: '3', aggressor: Side.SIDE_SELL, market: { - name: 'ETHBTC Quarterly (30 Jun 2022)', + tradableInstrument: { + instrument: { + name: 'ETHBTC Quarterly (30 Jun 2022)', + }, + }, }, buyer: { id: 'party-id', @@ -108,7 +116,6 @@ export const generateFill = ( market: { __typename: 'Market', id: 'market-id', - name: 'UNIDAI Monthly (30 Jun 2022)', positionDecimalPlaces: 0, decimalPlaces: 5, tradableInstrument: { @@ -117,6 +124,7 @@ export const generateFill = ( __typename: 'Instrument', id: 'instrument-id', code: 'instrument-code', + name: 'UNIDAI Monthly (30 Jun 2022)', product: { __typename: 'Future', settlementAsset: { diff --git a/libs/market-list/src/lib/__generated__/MarketList.ts b/libs/market-list/src/lib/__generated__/MarketList.ts index 5f56d3975..f147b3498 100644 --- a/libs/market-list/src/lib/__generated__/MarketList.ts +++ b/libs/market-list/src/lib/__generated__/MarketList.ts @@ -171,10 +171,6 @@ export interface MarketList_markets { * 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) diff --git a/libs/market-list/src/lib/components/select-market-columns.tsx b/libs/market-list/src/lib/components/select-market-columns.tsx index 7ae6cbf51..955a7bce6 100644 --- a/libs/market-list/src/lib/components/select-market-columns.tsx +++ b/libs/market-list/src/lib/components/select-market-columns.tsx @@ -315,7 +315,7 @@ export const columns = ( dataTestId: 'taker-fee', }, { - value: market.name, + value: market.tradableInstrument.instrument.name, className: `${cellClassNames} hidden xxl:block`, onlyOnDetailed: true, dataTestId: 'market-name', diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 4eff74ada..049521253 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -46,7 +46,6 @@ export const MARKET_LIST_QUERY = gql` query MarketList($interval: Interval!, $since: String!) { markets { id - name decimalPlaces positionDecimalPlaces state diff --git a/libs/orders/src/lib/components/mocks/generate-orders.ts b/libs/orders/src/lib/components/mocks/generate-orders.ts index 732cf4c00..e29e2614f 100644 --- a/libs/orders/src/lib/components/mocks/generate-orders.ts +++ b/libs/orders/src/lib/components/mocks/generate-orders.ts @@ -17,7 +17,6 @@ export const generateOrder = ( market: { __typename: 'Market', id: 'market-id', - name: 'market-name', decimalPlaces: 2, positionDecimalPlaces: 2, tradableInstrument: { @@ -26,6 +25,7 @@ export const generateOrder = ( id: 'instrument-id', __typename: 'Instrument', code: 'instrument-code', + name: 'instrument-market-name', }, }, }, @@ -67,7 +67,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: 'c9f5acd348796011c075077e4d58d9b7f1689b7c1c8e030a5e886b83aa96923d', - name: 'AAVEDAI Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -75,6 +74,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'AAVEDAI.MF21', + name: 'AAVEDAI Monthly (30 Jun 2022)', }, }, }, @@ -92,7 +92,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: '5a4b0b9e9c0629f0315ec56fcb7bd444b0c6e4da5ec7677719d502626658a376', - name: 'Tesla Quarterly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -100,6 +99,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'TSLA.QM21', + name: 'Tesla Quarterly (30 Jun 2022)', }, }, }, @@ -117,7 +117,6 @@ export const generateMockOrders = market: { __typename: 'Market', id: 'c6f4337b31ed57a961969c3ba10297b369d01b9e75a4cbb96db4fc62886444e6', - name: 'BTCUSD Monthly (30 Jun 2022)', decimalPlaces: 5, positionDecimalPlaces: 0, tradableInstrument: { @@ -125,6 +124,7 @@ export const generateMockOrders = instrument: { __typename: 'Instrument', code: 'BTCUSD.MF21', + name: 'BTCUSD Monthly (30 Jun 2022)', }, }, }, diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts index 664b1cc48..ebfd1865a 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderFields.ts @@ -19,6 +19,10 @@ export interface OrderFields_market_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface OrderFields_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface OrderFields_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) diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts index 421f926b2..d1d3128ea 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/OrderSub.ts @@ -19,6 +19,10 @@ export interface OrderSub_orders_market_tradableInstrument_instrument { * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface OrderSub_orders_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface OrderSub_orders_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) diff --git a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts index 78f1f1084..e1cde6308 100644 --- a/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts +++ b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts @@ -19,6 +19,10 @@ export interface Orders_party_ordersConnection_edges_node_market_tradableInstrum * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) */ code: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; } export interface Orders_party_ordersConnection_edges_node_market_tradableInstrument { @@ -35,10 +39,6 @@ export interface Orders_party_ordersConnection_edges_node_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) diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts index fe4fbaebe..d9bd169b2 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts @@ -19,13 +19,13 @@ const ORDER_FRAGMENT = gql` id market { id - name decimalPlaces positionDecimalPlaces tradableInstrument { instrument { id code + name } } } diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx index 0cfaeb302..75fa521e9 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.spec.tsx @@ -74,7 +74,7 @@ describe('OrderFeedback', () => { ); expect(screen.getByText('Market').nextElementSibling).toHaveTextContent( // eslint-disable-next-line - order.market!.name + order.market!.tradableInstrument.instrument.name ); expect(screen.getByText('Status').nextElementSibling).toHaveTextContent( OrderStatusMapping[order.status] diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index 484f1e7aa..fc80c6b4d 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -29,7 +29,7 @@ export const OrderFeedback = ({ transaction, order }: OrderFeedbackProps) => { {order.market && (

{t(`Market`)}

-

{t(`${order.market.name}`)}

+

{t(`${order.market.tradableInstrument.instrument.name}`)}

)}
diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index 4d397d6c1..70f07e3e2 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -53,7 +53,7 @@ export const OrderEditDialog = ({ {order.market && (

{t(`Market`)}

-

{t(`${order.market.name}`)}

+

{t(`${order.market.tradableInstrument.instrument.name}`)}

)} {order.type === OrderType.TYPE_LIMIT && order.market && ( diff --git a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts index df959703d..5226464bf 100644 --- a/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts +++ b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts @@ -13,6 +13,22 @@ export interface OrderEvent_busEvents_event_TimeUpdate { __typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Trade" | "Account" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "Withdrawal" | "OracleSpec" | "LiquidityProvision"; } +export interface OrderEvent_busEvents_event_Order_market_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; +} + +export interface OrderEvent_busEvents_event_Order_market_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of, or reference to, a fully specified instrument. + */ + instrument: OrderEvent_busEvents_event_Order_market_tradableInstrument_instrument; +} + export interface OrderEvent_busEvents_event_Order_market { __typename: "Market"; /** @@ -20,9 +36,9 @@ export interface OrderEvent_busEvents_event_Order_market { */ id: string; /** - * Market full name + * An instance of, or reference to, a tradable instrument. */ - name: string; + tradableInstrument: OrderEvent_busEvents_event_Order_market_tradableInstrument; /** * 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) diff --git a/libs/orders/src/lib/order-hooks/order-event-query.ts b/libs/orders/src/lib/order-hooks/order-event-query.ts index 33059f125..32b38193e 100644 --- a/libs/orders/src/lib/order-hooks/order-event-query.ts +++ b/libs/orders/src/lib/order-hooks/order-event-query.ts @@ -18,7 +18,11 @@ export const ORDER_EVENT_SUB = gql` side market { id - name + tradableInstrument { + instrument { + name + } + } decimalPlaces positionDecimalPlaces } diff --git a/libs/positions/src/lib/__generated__/PositionFields.ts b/libs/positions/src/lib/__generated__/PositionFields.ts index a5f25b523..7575fb799 100644 --- a/libs/positions/src/lib/__generated__/PositionFields.ts +++ b/libs/positions/src/lib/__generated__/PositionFields.ts @@ -109,10 +109,6 @@ export interface PositionFields_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) diff --git a/libs/positions/src/lib/__generated__/Positions.ts b/libs/positions/src/lib/__generated__/Positions.ts index 69cc82a81..7dbb01dbf 100644 --- a/libs/positions/src/lib/__generated__/Positions.ts +++ b/libs/positions/src/lib/__generated__/Positions.ts @@ -109,10 +109,6 @@ export interface Positions_party_positionsConnection_edges_node_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) diff --git a/libs/positions/src/lib/__generated__/PositionsSubscription.ts b/libs/positions/src/lib/__generated__/PositionsSubscription.ts index 93a61b32b..9fbfe6a9d 100644 --- a/libs/positions/src/lib/__generated__/PositionsSubscription.ts +++ b/libs/positions/src/lib/__generated__/PositionsSubscription.ts @@ -109,10 +109,6 @@ export interface PositionsSubscription_positions_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) diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index b4b2b9d5d..67efe22d3 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -32,8 +32,14 @@ const accounts: Accounts = { balance: '33353727', market: { __typename: 'Market', - name: 'AAVEDAI Monthly (30 Jun 2022)', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'AAVEDAI Monthly (30 Jun 2022)', + }, + }, }, }, { @@ -48,8 +54,14 @@ const accounts: Accounts = { balance: '3274050', market: { __typename: 'Market', - name: 'UNIDAI Monthly (30 Jun 2022)', id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + name: 'UNIDAI Monthly (30 Jun 2022)', + }, + }, }, }, ], @@ -97,7 +109,6 @@ const data: Positions = { }, market: { __typename: 'Market', - name: 'AAVEDAI Monthly (30 Jun 2022)', id: '5e6035fe6a6df78c9ec44b333c231e63d357acef0a0620d2c243f5865d1dc0d8', decimalPlaces: 5, tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, @@ -155,7 +166,6 @@ const data: Positions = { market: { __typename: 'Market', id: '10c4b1114d2f6fda239b73d018bca55888b6018f0ac70029972a17fea0a6a56e', - name: 'UNIDAI Monthly (30 Jun 2022)', decimalPlaces: 5, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, positionDecimalPlaces: 0, diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index bfaec808e..513423482 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -72,7 +72,6 @@ const POSITION_FIELDS = gql` } market { id - name decimalPlaces positionDecimalPlaces tradingMode @@ -202,7 +201,7 @@ export const getMetrics = ( ) && generalAccountBalance.isLessThan(marginInitial.minus(marginSearch)); metrics.push({ - marketName: market.name, + marketName: market.tradableInstrument.instrument.name, averageEntryPrice: position.node.averageEntryPrice, capitalUtilisation: Math.round(capitalUtilisation.toNumber()), currentLeverage: currentLeverage.toNumber(), From 19e12145cb317990fe545b4986ae4475e487f7c1 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 8 Sep 2022 00:11:15 +0000 Subject: [PATCH 25/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 67 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 59f4bdbb1..3c70d8d6a 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107521.63869676664798055", + "locked_amount": "107461.198419562287925695", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51915.04412100456352", + "locked_amount": "51878.32786656519316", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48690.913090736869420662", + "locked_amount": "48631.626809065899809988", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66552.072059576589956358878196", + "locked_amount": "66471.037947881900170021898808", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20483.42629017946565262", + "locked_amount": "20458.48557529981034527", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6667.156490989583694443", + "locked_amount": "6659.03853031522286311", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8844.616168478262", + "locked_amount": "8803.075935990339", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1420383.559875850562032638", + "locked_amount": "1419029.436225769844262332", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33779.8729053442045", + "locked_amount": "33721.02424265298025", "deposits": [ { "amount": "12500", @@ -2158,8 +2158,8 @@ "tranche_start": "2021-09-05T00:00:00.000Z", "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", - "total_removed": "20356.27207904634556896", - "locked_amount": "3474.90208776588726823806980383155", + "total_removed": "20696.25757434884556896", + "locked_amount": "3435.1063083461918354639522132021", "deposits": [ { "amount": "2833.333333", @@ -2263,6 +2263,11 @@ "user": "0x5D39036947e83862cE5f3DB351cC64E3D4592cD5", "tx": "0xf2b3af016afc01b1c8b2a3a5199c9c0cd24253fa77dbf68463cd28eeeb8d9464" }, + { + "amount": "339.9854953025", + "user": "0x1887D97F9C875108Aa6bE109B282f87A666472f2", + "tx": "0xc9a2adf607544c56be07d99cd336298e81f16220a3cac0d25f9b606c54cd9169" + }, { "amount": "279.862130034666196311", "user": "0x832cfD8fD4a1791b5eF5BD18a677beb7731Aa18E", @@ -2949,6 +2954,12 @@ } ], "withdrawals": [ + { + "amount": "339.9854953025", + "user": "0x1887D97F9C875108Aa6bE109B282f87A666472f2", + "tranche_id": 13, + "tx": "0xc9a2adf607544c56be07d99cd336298e81f16220a3cac0d25f9b606c54cd9169" + }, { "amount": "326.9768073225", "user": "0x1887D97F9C875108Aa6bE109B282f87A666472f2", @@ -3029,8 +3040,8 @@ } ], "total_tokens": "4250", - "withdrawn_tokens": "3668.79837368", - "remaining_tokens": "581.20162632" + "withdrawn_tokens": "4008.7838689825", + "remaining_tokens": "241.2161310175" }, { "address": "0x9fd50776F133751E8Ae6abE1Be124638Bb917E05", @@ -22320,7 +22331,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2207136.33122690869386273867", + "locked_amount": "2205055.51463251622334336206", "deposits": [ { "amount": "1998.95815", @@ -23177,7 +23188,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "189184.1028716497150444", - "locked_amount": "13126051.304474350479230961453173327676399", + "locked_amount": "13118672.8624318284957239308086875705001351", "deposits": [ { "amount": "16249.93", @@ -26217,7 +26228,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2724259.594291574628633947", - "locked_amount": "6396441.527371531484268884850727953", + "locked_amount": "6389629.796789673513301611426326304", "deposits": [ { "amount": "129284.449", @@ -31300,7 +31311,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2210369.329280586458068073568629082", + "locked_amount": "2207677.97333069075854641038132532", "deposits": [ { "amount": "552496.6455", @@ -32709,7 +32720,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "349733.36821204877808704294063928", + "locked_amount": "349403.65092821257961688400101468", "deposits": [ { "amount": "3000", @@ -59192,7 +59203,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "52104.1080369557989", + "total_removed": "52853.8180369557989", "locked_amount": "0", "deposits": [ { @@ -63477,6 +63488,11 @@ "user": "0x7E9bA4D3654ae2a8C4B15AAdee8f144Ba7eD68c4", "tx": "0x66f286158f3b5ba4b16688b1841ebde4060fc14ce3b5c163b5c58c1806b1f221" }, + { + "amount": "749.71", + "user": "0x389f68402c3355Af05566faC84914f8E7caabc52", + "tx": "0xc50cc4a5edea8eb1aa5ba128913f946b2d549e22fda7923f7d99d2f5250abb5d" + }, { "amount": "250", "user": "0x9A453696D38e0e42b11AC30Be8C3A100eDDA5f53", @@ -66125,10 +66141,17 @@ "tx": "0x23a584d4881de8a7fdac91afaf0fd834e84ddcad95a0bc420020032bbeae8f50" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "749.71", + "user": "0x389f68402c3355Af05566faC84914f8E7caabc52", + "tranche_id": 6, + "tx": "0xc50cc4a5edea8eb1aa5ba128913f946b2d549e22fda7923f7d99d2f5250abb5d" + } + ], "total_tokens": "749.71", - "withdrawn_tokens": "0", - "remaining_tokens": "749.71" + "withdrawn_tokens": "749.71", + "remaining_tokens": "0" }, { "address": "0x6470BcDf3c0e99362003BEE5BC356Aa10b45e9c6", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 3859ab0db..dd043272e 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "94.86816368594622420009392887493658042", + "locked_amount": "94.16325183916790730009323094241501773", "deposits": [ { "amount": "1000", From 760be23c2774fd1d612380bc33474f87de43513c Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 8 Sep 2022 06:18:41 +0000 Subject: [PATCH 26/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 3c70d8d6a..47c4df063 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107461.198419562287925695", + "locked_amount": "107400.667535482563273045", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51878.32786656519316", + "locked_amount": "51841.55657026890076", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48631.626809065899809988", + "locked_amount": "48572.251650490581330735", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66471.037947881900170021898808", + "locked_amount": "66389.88235680293513121919602", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20458.48557529981034527", + "locked_amount": "20433.507471441323948224", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6659.03853031522286311", + "locked_amount": "6650.908399891068142336", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8803.075935990339", + "locked_amount": "8761.47342995169", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1419029.436225769844262332", + "locked_amount": "1417673.282589751275449374", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33721.02424265298025", + "locked_amount": "33662.0873590982275", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3435.1063083461918354639522132021", + "locked_amount": "3395.2508705100692903521684208311", "deposits": [ { "amount": "2833.333333", @@ -22331,7 +22331,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2205055.51463251622334336206", + "locked_amount": "2202971.57865650302803497768", "deposits": [ { "amount": "1998.95815", @@ -23188,7 +23188,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "189184.1028716497150444", - "locked_amount": "13118672.8624318284957239308086875705001351", + "locked_amount": "13111283.3592623650978809746877750463449581", "deposits": [ { "amount": "16249.93", @@ -26228,7 +26228,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2724259.594291574628633947", - "locked_amount": "6389629.796789673513301611426326304", + "locked_amount": "6382807.854646048048251659490242604", "deposits": [ { "amount": "129284.449", @@ -31311,7 +31311,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2207677.97333069075854641038132532", + "locked_amount": "2204982.46046886546387455623715599", "deposits": [ { "amount": "552496.6455", @@ -32720,7 +32720,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "349403.65092821257961688400101468", + "locked_amount": "349073.42438222892223404431456112", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index dd043272e..e52b841d3 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "94.16325183916790730009323094241501773", + "locked_amount": "93.45709094368336690009253177321156769", "deposits": [ { "amount": "1000", From bb81c1786c7e466212e6fb3a7ba3f3c664b5e6db Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Thu, 8 Sep 2022 10:24:11 +0100 Subject: [PATCH 27/66] chore: remove build and test precommit checks (#1285) --- .husky/commit-msg | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.husky/commit-msg b/.husky/commit-msg index 725ca26d0..b0dca9dee 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -6,7 +6,3 @@ yarn commitlint --edit "${1}" # Lint all staged files yarn lint-staged - -# Build & test affected apps -yarn nx affected:build --uncommitted -yarn nx affected:test --uncommitted From 621feada26bb0c1d1ce794df487a58655e44770c Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Thu, 8 Sep 2022 10:37:11 +0100 Subject: [PATCH 28/66] chore: revert back to using previous ubuntu runners (#1286) --- .github/workflows/capsule-cypress-manual-trigger.yml | 2 +- .github/workflows/capsule-cypress-night-run.yml | 2 +- .github/workflows/capsule-cypress.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 84e6091e5..05c9377a2 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -24,7 +24,7 @@ on: jobs: manual: name: Run capsule tests -- manual trigger - runs-on: ubuntu-20.04-16core + runs-on: ubuntu-latest env: GO111MODULE: 'on' GOPROXY: ${{ secrets.GO_PROXY }} diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 98900d492..769062af2 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -9,7 +9,7 @@ on: jobs: nightly: name: Run capsule tests -- nightly - runs-on: ubuntu-20.04-16core + runs-on: ubuntu-latest env: GO111MODULE: 'on' steps: diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index 68ea78f5a..74bbe04d6 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -15,7 +15,7 @@ on: jobs: pr: name: Run capsule tests - PR - runs-on: ubuntu-20.04-16core + runs-on: ubuntu-latest if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }} env: GO111MODULE: 'on' From dc598599642593f6a3ac5b972a2cace5c7db76a0 Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Thu, 8 Sep 2022 11:07:08 +0100 Subject: [PATCH 29/66] fix: readme with new env var for type gen (#1288) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e22e0863e..f0b231109 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ Run `nx serve my-app` for a dev server. Navigate to the port specified in `app/< In order to generate the schemas for your GraphQL queries, you can run `GRAPHQL_SCHEMA_PATH=[YOUR SCHEMA FILE / API URL HERE] nx run types:generate`. ```bash -export NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql +export GRAPHQL_SCHEMA_PATH=https://api.n11.testnet.vega.xyz/graphql yarn nx run types:generate ``` From 87ae478b9c6f3a277a6aa47836a947e272494f6b Mon Sep 17 00:00:00 2001 From: Edd Date: Thu, 8 Sep 2022 10:12:01 +0000 Subject: [PATCH 30/66] fix(positions): split market name more defensively (#1265) --- libs/positions/src/lib/positions-table.spec.tsx | 12 ++++++++++++ libs/positions/src/lib/positions-table.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libs/positions/src/lib/positions-table.spec.tsx b/libs/positions/src/lib/positions-table.spec.tsx index 0df7fc177..3b0128c38 100644 --- a/libs/positions/src/lib/positions-table.spec.tsx +++ b/libs/positions/src/lib/positions-table.spec.tsx @@ -66,6 +66,18 @@ it('Splits market name', async () => { expect(screen.getByText('31 july 2022')).toBeTruthy(); }); +it('Does not fail if the market name does not match the split pattern', async () => { + const breakingMarketName = 'OP/USD AUG-SEP22 - Incentive'; + const row = [ + Object.assign({}, singleRow, { marketName: breakingMarketName }), + ]; + await act(async () => { + render(); + }); + + expect(screen.getByText(breakingMarketName)).toBeTruthy(); +}); + it('add color and sign to amount, displays positive notional value', async () => { let result: RenderResult; await act(async () => { diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 9b45b366d..fa2ca2abf 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -172,7 +172,7 @@ export const PositionsTable = forwardRef( } // split market name into two parts, 'Part1 (Part2)' or 'Part1 - Part2' const matches = value.match(/^(.*)(\((.*)\)| - (.*))\s*$/); - if (matches) { + if (matches && matches[1] && matches[3]) { return [matches[1].trim(), matches[3].trim()]; } return [value]; From 65528a8007afae7b996888e8b8dc5468d8632b0c Mon Sep 17 00:00:00 2001 From: macqbat Date: Thu, 8 Sep 2022 13:18:32 +0200 Subject: [PATCH 31/66] feat: [console-lite] - additional unit tests (#1273) * feat: [console-lite] - additional unit tests * feat: [console-lite] - additional unit tests * feat: [console-lite] - additional unit tests * feat: [console-lite] - additional unit tests - fixes after feedback Co-authored-by: maciek --- apps/console-lite/setup-tests.ts | 22 ++ .../simple-market-list.spec.tsx | 232 ++++++++++++------ .../simple-market-renderer.spec.tsx | 36 +++ .../simple-market-toolbar.spec.tsx | 119 ++++++++- .../simple-market-toolbar.tsx | 3 +- 5 files changed, 329 insertions(+), 83 deletions(-) create mode 100644 apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.spec.tsx diff --git a/apps/console-lite/setup-tests.ts b/apps/console-lite/setup-tests.ts index adff1f883..9009d7b8c 100644 --- a/apps/console-lite/setup-tests.ts +++ b/apps/console-lite/setup-tests.ts @@ -1,7 +1,29 @@ import '@testing-library/jest-dom'; import { defaultFallbackInView } from 'react-intersection-observer'; +import ResizeObserver from 'resize-observer-polyfill'; defaultFallbackInView(true); +global.ResizeObserver = ResizeObserver; + +global.DOMRect = class DOMRect { + bottom = 0; + left = 0; + right = 0; + top = 0; + + constructor( + public x = 0, + public y = 0, + public width = 0, + public height = 0 + ) {} + static fromRect(other?: DOMRectInit): DOMRect { + return new DOMRect(other?.x, other?.y, other?.width, other?.height); + } + toJSON() { + return JSON.stringify(this); + } +}; Object.defineProperty(window, 'matchMedia', { writable: true, diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx index 3fe962126..ff4ce6cc7 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-list.spec.tsx @@ -6,17 +6,19 @@ import { waitFor, cleanup, getAllByRole, + fireEvent, } from '@testing-library/react'; import { MockedProvider } from '@apollo/client/testing'; import type { MockedResponse } from '@apollo/client/testing'; import { BrowserRouter } from 'react-router-dom'; +import { MarketState } from '@vegaprotocol/types'; import SimpleMarketList from './simple-market-list'; import { MARKETS_QUERY } from './data-provider'; import type { SimpleMarkets_markets, SimpleMarkets, } from './__generated__/SimpleMarkets'; -import { MarketState } from '@vegaprotocol/types'; +import type { SimpleMarketDataSub_marketData } from './__generated__/SimpleMarketDataSub'; const mockedNavigate = jest.fn(); @@ -30,85 +32,85 @@ jest.mock('date-fns', () => ({ subDays: () => new Date('2022-06-02T11:11:21.721Z'), })); +let updateMock: ({ + delta, +}: { + delta: SimpleMarketDataSub_marketData; +}) => boolean; + +let mockData = [ + { + id: '1', + name: 'Market 1', + state: MarketState.STATE_ACTIVE, + tradableInstrument: { + instrument: { + product: { + settlementAsset: { + symbol: 'tUSD', + }, + }, + metadata: { + tags: [], + }, + }, + }, + }, + { + id: '2', + name: 'Market 2', + state: MarketState.STATE_ACTIVE, + tradableInstrument: { + instrument: { + product: { + settlementAsset: { + symbol: 'ETH', + }, + }, + metadata: { + tags: [], + }, + }, + }, + }, +] as unknown as SimpleMarkets_markets[]; + +const mockUseDataProvider = ({ update }: { update: () => boolean }) => { + updateMock = update; + return { data: mockData, loading: false, error: false }; +}; + +jest.mock('@vegaprotocol/react-helpers', () => ({ + ...jest.requireActual('@vegaprotocol/react-helpers'), + useDataProvider: jest.fn((args) => mockUseDataProvider(args)), +})); + +const mockIsTradable = jest.fn((_arg) => true); + +jest.mock('../../constants', () => ({ + ...jest.requireActual('../../constants'), + IS_MARKET_TRADABLE: jest.fn((arg) => mockIsTradable(arg)), +})); + describe('SimpleMarketList', () => { afterEach(() => { jest.clearAllMocks(); cleanup(); }); - it('should be properly renderer as empty', async () => { - const mocks: MockedResponse = { - request: { - query: MARKETS_QUERY, - variables: { - CandleSince: '2022-06-02T11:11:21.721Z', - }, + const mocks: MockedResponse = { + request: { + query: MARKETS_QUERY, + variables: { + CandleSince: '2022-06-02T11:11:21.721Z', }, - result: { - data: { markets: [] }, - }, - }; - await act(async () => { - render( - - - , - { wrapper: BrowserRouter } - ); - await new Promise((resolve) => setTimeout(resolve, 0)); - }); - await waitFor(() => { - expect(screen.getByText('No data to display')).toBeInTheDocument(); - }); - }); + }, + result: { + data: { markets: mockData }, + }, + }; it('should be properly rendered with some data', async () => { - const data = [ - { - id: '1', - state: MarketState.STATE_ACTIVE, - tradableInstrument: { - instrument: { - product: { - settlementAsset: { - symbol: 'tUSD', - }, - }, - metadata: { - tags: [], - }, - }, - }, - }, - { - id: '2', - state: MarketState.STATE_ACTIVE, - tradableInstrument: { - instrument: { - product: { - settlementAsset: { - symbol: 'ETH', - }, - }, - metadata: { - tags: [], - }, - }, - }, - }, - ] as unknown as SimpleMarkets_markets[]; - - const mocks: MockedResponse = { - request: { - query: MARKETS_QUERY, - variables: { - CandleSince: '2022-06-02T11:11:21.721Z', - }, - }, - result: { - data: { markets: data }, - }, - }; await act(async () => { render( @@ -128,4 +130,92 @@ describe('SimpleMarketList', () => { expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2); }); }); + + it('update should return proper boolean value', async () => { + await act(async () => { + render( + + + , + { wrapper: BrowserRouter } + ); + await new Promise((resolve) => setTimeout(resolve, 0)); + }); + await waitFor(() => { + expect( + document.querySelector('.ag-center-cols-container') + ).toBeInTheDocument(); + }); + + await expect( + updateMock({ + delta: { + __typename: 'MarketData', + market: { + __typename: 'Market', + id: '2', + state: MarketState.STATE_ACTIVE, + }, + }, + }) + ).toEqual(true); + + await expect( + updateMock({ + delta: { + __typename: 'MarketData', + market: { + __typename: 'Market', + id: '2', + state: MarketState.STATE_SUSPENDED, + }, + }, + }) + ).toEqual(false); + }); + + it('click on row should be properly handled', async () => { + await act(async () => { + render( + + + , + { wrapper: BrowserRouter } + ); + await new Promise((resolve) => setTimeout(resolve, 0)); + }); + await waitFor(() => { + expect( + document.querySelector('.ag-center-cols-container') + ).toBeInTheDocument(); + }); + mockIsTradable.mockClear(); + const container = document.querySelector('.ag-center-cols-container'); + const firstRow = getAllByRole(container as HTMLDivElement, 'row')[0]; + expect(firstRow).toHaveAttribute('row-id', '1'); + fireEvent.click(firstRow); + await waitFor(() => { + expect(mockIsTradable).toHaveBeenCalledWith({ + ...mockData[0], + percentChange: '-', + }); + expect(mockedNavigate).toHaveBeenCalledWith(`/trading/${mockData[0].id}`); + }); + }); + + it('should be properly renderer as empty', async () => { + mockData = []; + await act(async () => { + render( + + + , + { wrapper: BrowserRouter } + ); + await new Promise((resolve) => setTimeout(resolve, 0)); + }); + await waitFor(() => { + expect(screen.getByText('No data to display')).toBeInTheDocument(); + }); + }); }); diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.spec.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.spec.tsx new file mode 100644 index 000000000..e880de146 --- /dev/null +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-renderer.spec.tsx @@ -0,0 +1,36 @@ +import React from 'react'; +import { render, screen } from '@testing-library/react'; +import type { MarketNames_markets } from '@vegaprotocol/deal-ticket'; +import { MarketState } from '@vegaprotocol/types'; +import MarketNameRenderer from './simple-market-renderer'; + +describe('SimpleMarketRenderer', () => { + const market = { + id: 'marketId', + state: MarketState.STATE_ACTIVE, + tradableInstrument: { + instrument: { + code: 'Market code', + name: 'Market Name', + product: { + quoteName: 'Quote name', + }, + metadata: { + tags: null, + }, + }, + }, + } as MarketNames_markets; + + it('should properly render not mobile', () => { + render(); + expect(screen.getByText('Market Name')).toBeInTheDocument(); + expect(screen.getByText('Quote name')).toBeInTheDocument(); + }); + + it('should properly render mobile', () => { + render(); + expect(screen.getByText('Market code')).toBeInTheDocument(); + expect(screen.getByText('Quote name')).toBeInTheDocument(); + }); +}); diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.spec.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.spec.tsx index 301fad0f9..f3a35acf5 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.spec.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.spec.tsx @@ -1,11 +1,35 @@ import React from 'react'; -import { useLocation, useRoutes, BrowserRouter } from 'react-router-dom'; -import { render, screen, fireEvent, waitFor } from '@testing-library/react'; +import { + useLocation, + useRoutes, + BrowserRouter, + useParams, +} from 'react-router-dom'; +import { + render, + screen, + fireEvent, + waitFor, + act, + getAllByText, +} from '@testing-library/react'; import { MockedProvider } from '@apollo/react-testing'; +import { MarketState } from '@vegaprotocol/types'; import SimpleMarketToolbar from './simple-market-toolbar'; import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets'; import { markets as filterData } from './mocks/market-filters.json'; +const mockedNavigate = jest.fn(); + +jest.mock('react-router-dom', () => { + const actualRouter = jest.requireActual('react-router-dom'); + return { + ...actualRouter, + useNavigate: () => mockedNavigate, + useParams: jest.fn(() => actualRouter.useParams()), + }; +}); + describe('SimpleMarketToolbar', () => { const WrappedCompForTest = () => { const routes = useRoutes([ @@ -60,9 +84,8 @@ describe('SimpleMarketToolbar', () => { ); }; - afterEach(() => { - jest.resetAllMocks(); + jest.clearAllMocks(); }); it('should be properly rendered', async () => { @@ -83,7 +106,7 @@ describe('SimpleMarketToolbar', () => { expect(screen.getByTestId('market-assets-menu').children).toHaveLength(6); }); fireEvent.click(screen.getByTestId('state-trigger')); - waitFor(() => { + await waitFor(() => { expect(screen.getByRole('menu')).toBeInTheDocument(); expect(screen.getByRole('menu').children).toHaveLength(10); }); @@ -104,7 +127,7 @@ describe('SimpleMarketToolbar', () => { await waitFor(() => { expect(screen.getByTestId('location-display')).toHaveTextContent( - '/markets/STATE_ACTIVE/Future' + `/markets/${MarketState.STATE_ACTIVE}/Future` ); }); @@ -115,17 +138,91 @@ describe('SimpleMarketToolbar', () => { ); await waitFor(() => { expect(screen.getByTestId('location-display')).toHaveTextContent( - '/markets/STATE_ACTIVE/Future/tEURO' + `/markets/${MarketState.STATE_ACTIVE}/Future/tEURO` ); }); fireEvent.click(screen.getByTestId('state-trigger')); - waitFor(() => { + await waitFor(() => { expect(screen.getByRole('menu')).toBeInTheDocument(); - fireEvent.click(screen.getByText('Pending')); - expect(screen.getByTestId('location-display')).toHaveTextContent( - '/markets/Pending/Future/tEURO' + }); + const menu = screen.getByRole('menu'); + const pending = getAllByText(menu, 'Pending')[0]; + await act(() => { + fireEvent.click(pending); + }); + await waitFor(() => { + expect(mockedNavigate).toHaveBeenCalledWith( + `/markets/${MarketState.STATE_PENDING}/Future/tEURO` ); }); }); + + it('stateChange callback should work well', async () => { + (useParams as jest.Mock).mockImplementation(() => ({ + asset: 'asset1', + product: 'product1', + state: 'state1', + })); + render( + + + , + { wrapper: BrowserRouter } + ); + fireEvent.click(screen.getByTestId('state-trigger')); + await waitFor(() => { + expect(screen.getByRole('menu')).toBeInTheDocument(); + }); + const menu = screen.getByRole('menu'); + const suspended = getAllByText(menu, 'Suspended')[0]; + fireEvent.click(suspended); + + expect(mockedNavigate).toHaveBeenCalledWith( + `/markets/${MarketState.STATE_SUSPENDED}/product1/asset1` + ); + }); + + it('stateChange callback should call navigate with url with state only', async () => { + (useParams as jest.Mock).mockImplementation(() => ({})); + render( + + + , + { wrapper: BrowserRouter } + ); + fireEvent.click(screen.getByTestId('state-trigger')); + await waitFor(() => { + expect(screen.getByRole('menu')).toBeInTheDocument(); + }); + const menu = screen.getByRole('menu'); + const closed = getAllByText(menu, 'Closed')[0]; + fireEvent.click(closed); + + expect(mockedNavigate).toHaveBeenCalledWith( + `/markets/${MarketState.STATE_CLOSED}` + ); + }); + + it('stateChange callback should call navigate with no asset', async () => { + (useParams as jest.Mock).mockImplementation(() => ({ + asset: 'all', + state: 'state1', + })); + render( + + + , + { wrapper: BrowserRouter } + ); + fireEvent.click(screen.getByTestId('state-trigger')); + await waitFor(() => { + expect(screen.getByRole('menu')).toBeInTheDocument(); + }); + + const menu = screen.getByRole('menu'); + const active = getAllByText(menu, 'Active')[0]; + fireEvent.click(active); + expect(mockedNavigate).toHaveBeenCalledWith('/markets'); + }); }); diff --git a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx index 0896095f9..8b04978c7 100644 --- a/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx +++ b/apps/console-lite/src/app/components/simple-market-list/simple-market-toolbar.tsx @@ -123,10 +123,11 @@ const SimpleMarketToolbar = ({ data }: Props) => {
- setOpen(open)}> + setOpen(open)}> setOpen(!isOpen)} >
{STATES_FILTER.find( From 37aa5be725df3b477812f01790f68fb444a021b2 Mon Sep 17 00:00:00 2001 From: Elmar <102954831+elmar-vega@users.noreply.github.com> Date: Thu, 8 Sep 2022 13:04:17 +0100 Subject: [PATCH 32/66] Feat/1089 override slippage (#1283) * feat(console-lite): add traffic light component * fix(console-lite): add slippage to deal ticket estimates * feat(console-lite): refactor deal ticket steps and add slippage dialog * feat(console-lite): add e2e tests for slippage and fix broken ones * fix(console-lite): fix styling issue after theme update --- .../src/integration/market-trade.test.ts | 53 ++++- .../deal-ticket/deal-ticket-estimates.tsx | 37 +++- .../deal-ticket/deal-ticket-size-input.tsx | 149 +++++++++++++ .../deal-ticket/deal-ticket-size.tsx | 176 +-------------- .../deal-ticket/deal-ticket-slippage.tsx | 104 +++++++++ .../deal-ticket/deal-ticket-steps.tsx | 204 +++++++++++------- .../components/deal-ticket/review-trade.tsx | 3 + .../components/input-setter/input-setter.tsx | 13 +- .../src/app/components/stepper/stepper.tsx | 2 +- .../src/app/components/traffic-light/index.ts | 1 + .../traffic-light/traffic-light.tsx | 25 +++ 11 files changed, 505 insertions(+), 262 deletions(-) create mode 100644 apps/console-lite/src/app/components/deal-ticket/deal-ticket-size-input.tsx create mode 100644 apps/console-lite/src/app/components/deal-ticket/deal-ticket-slippage.tsx create mode 100644 apps/console-lite/src/app/components/traffic-light/index.ts create mode 100644 apps/console-lite/src/app/components/traffic-light/traffic-light.tsx diff --git a/apps/console-lite-e2e/src/integration/market-trade.test.ts b/apps/console-lite-e2e/src/integration/market-trade.test.ts index f4dc1dbb1..6665940bd 100644 --- a/apps/console-lite-e2e/src/integration/market-trade.test.ts +++ b/apps/console-lite-e2e/src/integration/market-trade.test.ts @@ -170,7 +170,50 @@ describe('Market trade', () => { .find('button') .should('have.text', '2'); cy.get('button').contains('Max').click(); - cy.getByTestId('price-slippage-value').should('have.text', '0.02%'); + } + }); + + it('slippage value should be displayed', () => { + if (markets?.length) { + cy.visit(`/trading/${markets[1].id}`); + connectVegaWallet(); + cy.get('#step-1-control [aria-label^="Selected value"]').click(); + cy.get('button[aria-label="Open short position"]').click(); + cy.get('#step-2-control').click(); + cy.get('button').contains('Max').click(); + cy.get('#step-2-panel') + .find('dl') + .eq(2) + .find('dd') + .should('have.text', '0.02%'); + } + }); + + it('allow slippage value to be adjusted', () => { + if (markets?.length) { + cy.visit(`/trading/${markets[1].id}`); + connectVegaWallet(); + cy.get('#step-1-control [aria-label^="Selected value"]').click(); + cy.get('button[aria-label="Open short position"]').click(); + cy.get('#step-2-control').click(); + cy.get('button').contains('Max').click(); + cy.get('#step-2-panel') + .find('dl') + .eq(2) + .find('dd') + .should('have.text', '0.02%'); + cy.get('#step-2-panel').find('dl').eq(2).find('button').click(); + cy.get('#input-order-slippage') + .focus() + .type('{backspace}{backspace}{backspace}1'); + + cy.getByTestId('slippage-dialog').find('button').click(); + + cy.get('#step-2-panel') + .find('dl') + .eq(2) + .find('dd') + .should('have.text', '1%'); } }); @@ -195,9 +238,9 @@ describe('Market trade', () => { cy.get('#step-2-panel').find('dd').eq(0).find('button').click(); cy.get('#step-2-panel') .find('dt') - .eq(3) + .eq(2) .should('have.text', 'Est. Position Size (tDAI)'); - cy.get('#step-2-panel').find('dd').eq(3).should('have.text', '197.86012'); + cy.get('#step-2-panel').find('dd').eq(2).should('have.text', '197.86012'); } }); @@ -210,11 +253,11 @@ describe('Market trade', () => { cy.get('#step-2-control').click(); cy.get('#step-2-panel') .find('dt') - .eq(4) + .eq(3) .should('have.text', 'Est. Fees (tDAI)'); cy.get('#step-2-panel') .find('dd') - .eq(4) + .eq(3) .should('have.text', '3.00000 (3.03%)'); } }); diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-estimates.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-estimates.tsx index 97c450d29..21a842ffb 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-estimates.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-estimates.tsx @@ -4,6 +4,7 @@ import { t } from '@vegaprotocol/react-helpers'; import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit'; import { IconNames } from '@blueprintjs/icons'; import * as constants from './constants'; +import { TrafficLight } from '../traffic-light'; interface DealTicketEstimatesProps { quoteName?: string; @@ -13,6 +14,7 @@ interface DealTicketEstimatesProps { fees?: string; notionalSize?: string; size?: string; + slippage?: string; } interface DataTitleProps { @@ -20,7 +22,7 @@ interface DataTitleProps { quoteName?: string; } -const DataTitle = ({ children, quoteName = '' }: DataTitleProps) => ( +export const DataTitle = ({ children, quoteName = '' }: DataTitleProps) => (
{children} {quoteName && ({quoteName})} @@ -28,14 +30,20 @@ const DataTitle = ({ children, quoteName = '' }: DataTitleProps) => ( ); interface ValueTooltipProps { - value: string; + value?: string; + children?: ReactNode; description: string; id?: string; } -const ValueTooltipRow = ({ value, description, id }: ValueTooltipProps) => ( +export const ValueTooltipRow = ({ + value, + children, + description, + id, +}: ValueTooltipProps) => (
- {value} + {value || children}
(
{size && ( @@ -93,7 +102,7 @@ export const DealTicketEstimates = ({
)} {estMargin && ( -
+
{t('Est. Margin')} )} {estCloseOut && ( -
-
- {t('Est. Close out')} -   - ({quoteName}) -
+
+ {t('Est. Close out')}
)} + {slippage && ( +
+ {t('Est. Price Impact / Slippage')} + + + {slippage}% + + +
+ )} ); diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size-input.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size-input.tsx new file mode 100644 index 000000000..d3b594f38 --- /dev/null +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size-input.tsx @@ -0,0 +1,149 @@ +import React, { useCallback, useState } from 'react'; +import { BigNumber } from 'bignumber.js'; +import { t } from '@vegaprotocol/react-helpers'; +import { + SliderRoot, + SliderThumb, + SliderTrack, + SliderRange, + FormGroup, +} from '@vegaprotocol/ui-toolkit'; +import { InputSetter } from '../input-setter'; + +interface DealTicketSizeInputProps { + step: number; + min: number; + max: number; + value: number; + onValueChange: (value: number) => void; + positionDecimalPlaces: number; +} + +const getSizeLabel = (value: number): string => { + const MIN_LABEL = 'Min'; + const MAX_LABEL = 'Max'; + if (value === 0) { + return MIN_LABEL; + } else if (value === 100) { + return MAX_LABEL; + } + + return `${value}%`; +}; + +export const DealTicketSizeInput = ({ + value, + step, + min, + max, + onValueChange, + positionDecimalPlaces, +}: DealTicketSizeInputProps) => { + const sizeRatios = [0, 25, 50, 75, 100]; + const [inputValue, setInputValue] = useState(value); + + const onInputValueChange = useCallback( + (event: React.ChangeEvent) => { + let value = parseFloat(event.target.value); + const isLessThanMin = value < min; + const isMoreThanMax = value > max; + if (isLessThanMin) { + value = min; + } else if (isMoreThanMax) { + value = max; + } + + if (value) { + onValueChange(value); + } + + setInputValue(value); + }, + [min, max, onValueChange, setInputValue] + ); + + const onButtonValueChange = (size: number) => { + const newVal = new BigNumber(size) + .decimalPlaces(positionDecimalPlaces) + .toNumber(); + onValueChange(newVal); + setInputValue(newVal); + }; + + const onSliderValueChange = useCallback( + (value: number[]) => { + const val = value[0]; + setInputValue(val); + onValueChange(val); + }, + [onValueChange] + ); + + return ( +
+
+ {min} + {max} +
+ + + + + + + +
+ {sizeRatios.map((size, index) => { + const proportionalSize = size ? (size / 100) * max : min; + return ( + + ); + })} +
+ +
+
+
{t('Contracts')}
+
+ + + {inputValue} + + +
+
+
+
+ ); +}; diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size.tsx index 7ad66a31c..b95500df0 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-size.tsx @@ -1,27 +1,13 @@ -import React, { useCallback, useState } from 'react'; -import classNames from 'classnames'; -import { IconNames } from '@blueprintjs/icons'; -import { t } from '@vegaprotocol/react-helpers'; -import { - SliderRoot, - SliderThumb, - SliderTrack, - SliderRange, - FormGroup, - Icon, - Tooltip, -} from '@vegaprotocol/ui-toolkit'; -import { BigNumber } from 'bignumber.js'; +import React from 'react'; import { DealTicketEstimates } from './deal-ticket-estimates'; -import { InputSetter } from '../input-setter'; -import * as constants from './constants'; +import { DealTicketSizeInput } from './deal-ticket-size-input'; interface DealTicketSizeProps { step: number; min: number; max: number; - value: number; - onValueChange: (value: number[]) => void; + size: number; + onSizeChange: (value: number) => void; name: string; quoteName: string; price: string; @@ -30,173 +16,33 @@ interface DealTicketSizeProps { fees: string; positionDecimalPlaces: number; notionalSize: string; - slippage: string | null; } -const getSizeLabel = (value: number): string => { - const MIN_LABEL = 'Min'; - const MAX_LABEL = 'Max'; - if (value === 0) { - return MIN_LABEL; - } else if (value === 100) { - return MAX_LABEL; - } - - return `${value}%`; -}; - export const DealTicketSize = ({ - value, step, min, max, price, quoteName, - onValueChange, + size, + onSizeChange, estCloseOut, positionDecimalPlaces, fees, notionalSize, - slippage, }: DealTicketSizeProps) => { - const sizeRatios = [0, 25, 50, 75, 100]; - const [inputValue, setInputValue] = useState(value); - - const onInputValueChange = useCallback( - (event: React.ChangeEvent) => { - const value = parseFloat(event.target.value); - const isLessThanMin = value < min; - const isMoreThanMax = value > max; - if (value) { - if (isLessThanMin) { - onValueChange([min]); - } else if (isMoreThanMax) { - onValueChange([max]); - } else { - onValueChange([value]); - } - } - setInputValue(value); - }, - [min, max, onValueChange, setInputValue] - ); - - const onButtonValueChange = useCallback( - (size: number) => { - const newVal = new BigNumber(size) - .decimalPlaces(positionDecimalPlaces) - .toNumber(); - onValueChange([newVal]); - setInputValue(newVal); - }, - [onValueChange, positionDecimalPlaces] - ); - - const onSliderValueChange = useCallback( - (value: number[]) => { - setInputValue(value[0]); - onValueChange(value); - }, - [onValueChange] - ); - return max === 0 ? (

Not enough balance to trade

) : (
-
- {min} - {max} -
- - - - - - - -
- {sizeRatios.map((size, index) => { - const proportionalSize = size ? (size / 100) * max : min; - return ( - - ); - })} -
- -
-
-
{t('Contracts')}
-
- - - -
-
-
- {slippage && ( -
-
-
{t('Est. Price Impact / Slippage')}
-
- = 1 && parseFloat(slippage) < 5, - 'text-vega-red': parseFloat(slippage) >= 5, - })} - > - {slippage}% - - -
- -
-
-
-
-
- )} + value={size} + onValueChange={onSizeChange} + positionDecimalPlaces={positionDecimalPlaces} + /> { + const [isDialogVisible, setIsDialogVisible] = useState(false); + + const onChange = useCallback( + (event: React.ChangeEvent) => { + const value = event.target.value; + const numericValue = parseFloat(value); + onValueChange(numericValue); + }, + [onValueChange] + ); + + const toggleDialog = useCallback(() => { + setIsDialogVisible(!isDialogVisible); + }, [isDialogVisible]); + + const formLabel = ( + + ); + + return ( + <> + +
+ {formLabel} + + {value}% + +
+
+
+
+ {t('Est. Price Impact / Slippage')} +
+
+ + + {value}% + + +
+ +
+
+
+ + ); +}; diff --git a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx index 18b6f7c97..078a50d76 100644 --- a/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx +++ b/apps/console-lite/src/app/components/deal-ticket/deal-ticket-steps.tsx @@ -1,4 +1,4 @@ -import React, { useCallback, useEffect, useState } from 'react'; +import React, { useCallback, useEffect, useMemo, useState } from 'react'; import { useNavigate } from 'react-router-dom'; import { useForm, Controller } from 'react-hook-form'; import { Stepper } from '../stepper'; @@ -10,7 +10,7 @@ import type { Order } from '@vegaprotocol/orders'; import { useVegaWallet, VegaTxStatus } from '@vegaprotocol/wallet'; import { t, - addDecimal, + addDecimalsFormatNumber, toDecimal, removeDecimal, } from '@vegaprotocol/react-helpers'; @@ -33,6 +33,8 @@ import useOrderCloseOut from '../../hooks/use-order-closeout'; import useOrderMargin from '../../hooks/use-order-margin'; import useMaximumPositionSize from '../../hooks/use-maximum-position-size'; import useCalculateSlippage from '../../hooks/use-calculate-slippage'; +import { Side, OrderType } from '@vegaprotocol/types'; +import { DealTicketSlippage } from './deal-ticket-slippage'; interface DealTicketMarketProps { market: DealTicketQuery_market; @@ -62,28 +64,26 @@ export const DealTicketSteps = ({ defaultValues: getDefaultOrder(market), }); - const [max, setMax] = useState(null); + const emptyString = ' - '; const step = toDecimal(market.positionDecimalPlaces); const orderType = watch('type'); const orderTimeInForce = watch('timeInForce'); const orderSide = watch('side'); const orderSize = watch('size'); const order = watch(); - const estCloseOut = useOrderCloseOut({ order, market, partyData }); + const { message: invalidText, isDisabled } = useOrderValidation({ + market, + orderType, + orderTimeInForce, + fieldErrors: errors, + }); + const { submit, transaction, finalizedOrder, Dialog } = useOrderSubmit(); const { keypair } = useVegaWallet(); const estMargin = useOrderMargin({ order, market, partyId: keypair?.pub || '', }); - const value = new BigNumber(orderSize).toNumber(); - const price = - market.depth.lastTrade && - addDecimal(market.depth.lastTrade.price, market.decimalPlaces); - const emptyString = ' - '; - - const [notionalSize, setNotionalSize] = useState(null); - const [fees, setFees] = useState(null); const maxTrade = useMaximumPositionSize({ partyId: keypair?.pub || '', @@ -94,45 +94,48 @@ export const DealTicketSteps = ({ price: market?.depth?.lastTrade?.price, order, }); + + const estCloseOut = useOrderCloseOut({ order, market, partyData }); const slippage = useCalculateSlippage({ marketId: market.id, order }); - useEffect(() => { - setMax( - new BigNumber(maxTrade) - .decimalPlaces(market.positionDecimalPlaces) - .toNumber() - ); - }, [maxTrade, market.positionDecimalPlaces]); - - const { message: invalidText, isDisabled } = useOrderValidation({ - market, - orderType, - orderTimeInForce, - fieldErrors: errors, - }); - - const { submit, transaction, finalizedOrder, Dialog } = useOrderSubmit(); - - const onSizeChange = (value: number[]) => { - const newVal = new BigNumber(value[0]) - .decimalPlaces(market.positionDecimalPlaces) - .toString(); - const isValid = validateSize(step)(newVal); - if (isValid !== 'step') { - setValue('size', newVal); - } - }; + const [slippageValue, setSlippageValue] = useState( + slippage ? parseFloat(slippage) : 0 + ); + const transactionStatus = + transaction.status === VegaTxStatus.Requested || + transaction.status === VegaTxStatus.Pending + ? 'pending' + : 'default'; useEffect(() => { - if (market?.depth?.lastTrade?.price) { - const size = new BigNumber(market.depth.lastTrade.price) - .multipliedBy(value) + setSlippageValue(slippage ? parseFloat(slippage) : 0); + }, [slippage]); + + const price = useMemo(() => { + if (slippage && market?.depth?.lastTrade?.price) { + const isLong = order.side === Side.SIDE_BUY; + const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus']( + parseFloat(slippage) / 100 + ); + return new BigNumber(market?.depth?.lastTrade?.price) + .multipliedBy(multiplier) .toNumber(); - - setNotionalSize(addDecimal(size, market.decimalPlaces)); } - }, [market, value]); + return null; + }, [market?.depth?.lastTrade?.price, order.side, slippage]); - useEffect(() => { + const formattedPrice = + price && addDecimalsFormatNumber(price, market.decimalPlaces); + + const notionalSize = useMemo(() => { + if (price) { + const size = new BigNumber(price).multipliedBy(orderSize).toNumber(); + + return addDecimalsFormatNumber(size, market.decimalPlaces); + } + return null; + }, [market.decimalPlaces, orderSize, price]); + + const fees = useMemo(() => { if (estMargin?.fees && notionalSize) { const percentage = new BigNumber(estMargin?.fees) .dividedBy(notionalSize) @@ -140,17 +143,66 @@ export const DealTicketSteps = ({ .decimalPlaces(2) .toString(); - setFees(`${estMargin.fees} (${percentage}%)`); + return `${estMargin.fees} (${percentage}%)`; } - }, [estMargin, notionalSize]); - const transactionStatus = - transaction.status === VegaTxStatus.Requested || - transaction.status === VegaTxStatus.Pending - ? 'pending' - : 'default'; + return null; + }, [estMargin?.fees, notionalSize]); - const onSubmit = React.useCallback( + const max = useMemo(() => { + return new BigNumber(maxTrade) + .decimalPlaces(market.positionDecimalPlaces) + .toNumber(); + }, [market.positionDecimalPlaces, maxTrade]); + + const onSizeChange = useCallback( + (value: number) => { + const newVal = new BigNumber(value) + .decimalPlaces(market.positionDecimalPlaces) + .toString(); + const isValid = validateSize(step)(newVal); + if (isValid !== 'step') { + setValue('size', newVal); + } + }, + [market.positionDecimalPlaces, setValue, step] + ); + + const onSlippageChange = useCallback( + (value: number) => { + if (market?.depth?.lastTrade?.price) { + if (value) { + const isLong = order.side === Side.SIDE_BUY; + const multiplier = new BigNumber(1)[isLong ? 'plus' : 'minus']( + value / 100 + ); + const bestAskPrice = new BigNumber(market?.depth?.lastTrade?.price) + .multipliedBy(multiplier) + .decimalPlaces(market.decimalPlaces) + .toString(); + + setValue('price', bestAskPrice); + + if (orderType === OrderType.TYPE_MARKET) { + setValue('type', OrderType.TYPE_LIMIT); + } + } else { + setValue('type', OrderType.TYPE_MARKET); + setValue('price', market?.depth?.lastTrade?.price); + } + } + setSlippageValue(value); + }, + [ + market.decimalPlaces, + market?.depth?.lastTrade?.price, + order.side, + orderType, + setValue, + ] + ); + + const onSubmit = useCallback( (order: Order) => { if (transactionStatus !== 'pending') { submit({ @@ -198,25 +250,30 @@ export const DealTicketSteps = ({ label: t('Choose Position Size'), component: max !== null ? ( - + <> + + + ) : ( 'loading...' ), @@ -240,13 +297,14 @@ export const DealTicketSteps = ({ order={order} estCloseOut={estCloseOut} estMargin={estMargin?.margin || emptyString} - price={price || emptyString} + price={formattedPrice || emptyString} quoteName={ market.tradableInstrument.instrument.product.settlementAsset .symbol } notionalSize={notionalSize || emptyString} fees={fees || emptyString} + slippage={slippageValue} /> { const { data: tagsData } = useQuery( MARKET_TAGS_QUERY, @@ -105,6 +107,7 @@ export default ({ fees={fees} estCloseOut={estCloseOut} notionalSize={notionalSize} + slippage={slippage.toString()} />
diff --git a/apps/console-lite/src/app/components/input-setter/input-setter.tsx b/apps/console-lite/src/app/components/input-setter/input-setter.tsx index 9e58f3f44..93a229d79 100644 --- a/apps/console-lite/src/app/components/input-setter/input-setter.tsx +++ b/apps/console-lite/src/app/components/input-setter/input-setter.tsx @@ -1,20 +1,19 @@ import React, { useCallback, useState } from 'react'; +import type { ReactNode } from 'react'; import { t } from '@vegaprotocol/react-helpers'; import { Input } from '@vegaprotocol/ui-toolkit'; import type { InputProps } from '@vegaprotocol/ui-toolkit'; interface InputSetterProps { buttonLabel?: string; - value: string | number; isInputVisible?: boolean; - onValueChange?: () => string; + children?: ReactNode; } export const InputSetter = ({ buttonLabel = t('set'), - value = '', isInputVisible = false, - onValueChange, + children, ...props }: InputSetterProps & InputProps) => { const [isInputToggled, setIsInputToggled] = useState(isInputVisible); @@ -35,7 +34,7 @@ export const InputSetter = ({ return isInputToggled ? (
- + ); }; diff --git a/apps/console-lite/src/app/components/stepper/stepper.tsx b/apps/console-lite/src/app/components/stepper/stepper.tsx index 1cdfd35c8..91909d616 100644 --- a/apps/console-lite/src/app/components/stepper/stepper.tsx +++ b/apps/console-lite/src/app/components/stepper/stepper.tsx @@ -88,7 +88,7 @@ export const Stepper = ({ steps }: StepperProps) => { 'md:mt-0 font-alpha uppercase text-black dark:text-white', { 'mt-2 text-md md:text-2xl': isActive, - 'mt-4 text-sm md:text-lg md:ml-8': !isActive, + 'mt-4 text-sm md:text-lg md:ml-2': !isActive, } )} > diff --git a/apps/console-lite/src/app/components/traffic-light/index.ts b/apps/console-lite/src/app/components/traffic-light/index.ts new file mode 100644 index 000000000..f3a7e5c0c --- /dev/null +++ b/apps/console-lite/src/app/components/traffic-light/index.ts @@ -0,0 +1 @@ +export * from './traffic-light'; diff --git a/apps/console-lite/src/app/components/traffic-light/traffic-light.tsx b/apps/console-lite/src/app/components/traffic-light/traffic-light.tsx new file mode 100644 index 000000000..6d2e199bc --- /dev/null +++ b/apps/console-lite/src/app/components/traffic-light/traffic-light.tsx @@ -0,0 +1,25 @@ +import React from 'react'; +import type { ReactNode } from 'react'; +import classNames from 'classnames'; + +interface TrafficLightProps { + value: number; + q1: number; + q2: number; + children: ReactNode; +} + +export const TrafficLight = ({ + value, + q1, + q2, + children, +}: TrafficLightProps) => { + const slippageClassName = classNames({ + 'text-darkerGreen dark:text-lightGreen': value < q1, + 'text-amber': value >= q1 && value < q2, + 'text-vega-red': value >= q2, + }); + + return
{children || value}
; +}; From 93f41d429f420facc3063b0db802b66f15d8a5d6 Mon Sep 17 00:00:00 2001 From: macqbat Date: Thu, 8 Sep 2022 15:55:17 +0200 Subject: [PATCH 33/66] feat: [console-lite] - fast fix small css on market selector (#1290) Co-authored-by: maciek --- .../src/components/deal-ticket/market-selector.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx index 86aa8ecdc..312f6df9f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx @@ -196,7 +196,7 @@ export const MarketSelector = ({ market, setMarket, ItemRenderer }: Props) => {
{ onKeyDown={handleInputKeyDown} onBlur={handleOnBlur} /> - + {
-
+
Date: Thu, 8 Sep 2022 18:04:18 +0000 Subject: [PATCH 34/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 129 +++++++++++++++---- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 103 insertions(+), 28 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 47c4df063..f1287e349 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107400.667535482563273045", + "locked_amount": "107284.42166003269007139", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51841.55657026890076", + "locked_amount": "51770.93953576864314", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48572.251650490581330735", + "locked_amount": "48458.225275467387174006", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66389.88235680293513121919602", + "locked_amount": "66234.02798797861339323291228", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20433.507471441323948224", + "locked_amount": "20385.538544599230989622", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6650.908399891068142336", + "locked_amount": "6635.294979683415705335", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8761.47342995169", + "locked_amount": "8681.5783514492751", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1417673.282589751275449374", + "locked_amount": "1415068.872146053962325306", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33662.0873590982275", + "locked_amount": "33548.902664553141", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3395.2508705100692903521684208311", + "locked_amount": "3318.7109300625668266518280941708", "deposits": [ { "amount": "2833.333333", @@ -5892,7 +5892,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35917.000000000000000003", + "total_added": "35924.000000000000000003", "total_removed": "16791.59106856284", "locked_amount": "0", "deposits": [ @@ -7426,6 +7426,16 @@ "user": "0xd7F6bad6Fc716b889F84a94fEE046188f08988ce", "tx": "0xbdbedb936d857d6897aeb89be44c8dbfdc87993d69b0e9a3cf6aa6fed0fb9e2b" }, + { + "amount": "5", + "user": "0x5c95482329D44397d88AC5e1AcE402cFA56837bD", + "tx": "0x51ee75107b429e4b28d03503d87dfb8b5989118c14496e2ead9639eccc35a871" + }, + { + "amount": "2", + "user": "0x5c95482329D44397d88AC5e1AcE402cFA56837bD", + "tx": "0x6a2277eca905e60445ee11479edfe603a63c86d2fadb8aae244b314f40986e6a" + }, { "amount": "30", "user": "0x9646850641B15535e9e46646fbb98907eba83c6c", @@ -15909,6 +15919,27 @@ "withdrawn_tokens": "0", "remaining_tokens": "7" }, + { + "address": "0x5c95482329D44397d88AC5e1AcE402cFA56837bD", + "deposits": [ + { + "amount": "5", + "user": "0x5c95482329D44397d88AC5e1AcE402cFA56837bD", + "tranche_id": 11, + "tx": "0x51ee75107b429e4b28d03503d87dfb8b5989118c14496e2ead9639eccc35a871" + }, + { + "amount": "2", + "user": "0x5c95482329D44397d88AC5e1AcE402cFA56837bD", + "tranche_id": 11, + "tx": "0x6a2277eca905e60445ee11479edfe603a63c86d2fadb8aae244b314f40986e6a" + } + ], + "withdrawals": [], + "total_tokens": "7", + "withdrawn_tokens": "0", + "remaining_tokens": "7" + }, { "address": "0x9646850641B15535e9e46646fbb98907eba83c6c", "deposits": [ @@ -22331,7 +22362,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "202112.7281627920977", - "locked_amount": "2202971.57865650302803497768", + "locked_amount": "2198969.50656394880278652333", "deposits": [ { "amount": "1998.95815", @@ -23187,8 +23218,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "189184.1028716497150444", - "locked_amount": "13111283.3592623650978809746877750463449581", + "total_removed": "201080.6007556437762444", + "locked_amount": "13097092.2685797557767149706335072135198702", "deposits": [ { "amount": "16249.93", @@ -23787,6 +23818,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xf37aa848c357e251da436706cf8976171a8141e31fe3d2b6b90c519fb5e28c6e" }, + { + "amount": "11896.4978839940612", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xf59861d62aa335573fa03b596b554b43fd958e759ad23301f7cffffb52945c0d" + }, { "amount": "253.966945001875125", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24313,6 +24349,12 @@ "tranche_id": 2, "tx": "0xf37aa848c357e251da436706cf8976171a8141e31fe3d2b6b90c519fb5e28c6e" }, + { + "amount": "11896.4978839940612", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xf59861d62aa335573fa03b596b554b43fd958e759ad23301f7cffffb52945c0d" + }, { "amount": "253.966945001875125", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24687,8 +24729,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "33394.5217386716073", - "remaining_tokens": "226604.3657613283927" + "withdrawn_tokens": "45291.0196226656685", + "remaining_tokens": "214707.8678773343315" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26227,8 +26269,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2724259.594291574628633947", - "locked_amount": "6382807.854646048048251659490242604", + "total_removed": "2762126.087814295642620897", + "locked_amount": "6369706.73033883268668447364205577", "deposits": [ { "amount": "129284.449", @@ -26512,6 +26554,16 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x453738b2f8fbd7d2c25f32200d27bbd13c15bb92a38879cd6ea854805a5b38bd" }, + { + "amount": "36806.4510907456099182", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tx": "0x812fe72d2aa855b5035e0a691d365682ccab0e0160d77e6405f4481841ac70cb" + }, + { + "amount": "1060.04243197540406875", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x98bccb30eb3a5a92c35444e40f36bc89cdbf17b9508fa05845a8ca9478aacd9a" + }, { "amount": "469.2149598263806575", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28588,6 +28640,12 @@ "tranche_id": 3, "tx": "0x453738b2f8fbd7d2c25f32200d27bbd13c15bb92a38879cd6ea854805a5b38bd" }, + { + "amount": "1060.04243197540406875", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x98bccb30eb3a5a92c35444e40f36bc89cdbf17b9508fa05845a8ca9478aacd9a" + }, { "amount": "469.2149598263806575", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30228,8 +30286,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "201166.39790542606668175", - "remaining_tokens": "157957.07166957393331825" + "withdrawn_tokens": "202226.4403374014707505", + "remaining_tokens": "156897.0292375985292495" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -30428,6 +30486,12 @@ } ], "withdrawals": [ + { + "amount": "36806.4510907456099182", + "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", + "tranche_id": 3, + "tx": "0x812fe72d2aa855b5035e0a691d365682ccab0e0160d77e6405f4481841ac70cb" + }, { "amount": "137101.36006182319864782", "user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", @@ -30646,8 +30710,8 @@ } ], "total_tokens": "1266324.603486", - "withdrawn_tokens": "675973.69081026210943794", - "remaining_tokens": "590350.91267573789056206" + "withdrawn_tokens": "712780.14190100771935614", + "remaining_tokens": "553544.46158499228064386" }, { "address": "0xC5d9221EB9c28A69859264c0A2Fe0d3272228296", @@ -31311,7 +31375,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2204982.46046886546387455623715599", + "locked_amount": "2199806.249282260715893759839301158", "deposits": [ { "amount": "552496.6455", @@ -32720,7 +32784,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "349073.42438222892223404431456112", + "locked_amount": "348439.2881606427712481892998478", "deposits": [ { "amount": "3000", @@ -59203,7 +59267,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "52853.8180369557989", + "total_removed": "52919.8425587307989", "locked_amount": "0", "deposits": [ { @@ -63493,6 +63557,11 @@ "user": "0x389f68402c3355Af05566faC84914f8E7caabc52", "tx": "0xc50cc4a5edea8eb1aa5ba128913f946b2d549e22fda7923f7d99d2f5250abb5d" }, + { + "amount": "66.024521775", + "user": "0x94FB32e3D5b9DDc3DDcaf6F174CAEeF2BCc6a83d", + "tx": "0x743ce7162e9552d56cdafbde274472b2165b38b89e356e17df8c68ececa980ba" + }, { "amount": "250", "user": "0x9A453696D38e0e42b11AC30Be8C3A100eDDA5f53", @@ -69275,6 +69344,12 @@ } ], "withdrawals": [ + { + "amount": "66.024521775", + "user": "0x94FB32e3D5b9DDc3DDcaf6F174CAEeF2BCc6a83d", + "tranche_id": 6, + "tx": "0x743ce7162e9552d56cdafbde274472b2165b38b89e356e17df8c68ececa980ba" + }, { "amount": "33.975478225", "user": "0x94FB32e3D5b9DDc3DDcaf6F174CAEeF2BCc6a83d", @@ -69283,8 +69358,8 @@ } ], "total_tokens": "100", - "withdrawn_tokens": "33.975478225", - "remaining_tokens": "66.024521775" + "withdrawn_tokens": "100", + "remaining_tokens": "0" }, { "address": "0x66014aEc97135793135FDEE169Ed826Ef421d81f", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index e52b841d3..76c37cd92 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "93.45709094368336690009253177321156769", + "locked_amount": "92.10116850583463120009118927574835112", "deposits": [ { "amount": "1000", From 097cf5da94544a1ed8bd9455e5246d31afc09ca7 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 9 Sep 2022 00:10:31 +0000 Subject: [PATCH 35/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 64 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index f1287e349..51a6cc681 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107284.42166003269007139", + "locked_amount": "107224.093955006853092415", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51770.93953576864314", + "locked_amount": "51734.29166666666316", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48458.225275467387174006", + "locked_amount": "48399.049416616948729698", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66234.02798797861339323291228", + "locked_amount": "66153.144805215903630295886808", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20385.538544599230989622", + "locked_amount": "20360.644282693272452814", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6635.294979683415705335", + "locked_amount": "6627.192139001225830064", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8681.5783514492751", + "locked_amount": "8640.115489130433", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1415068.872146053962325306", + "locked_amount": "1413717.270599714493173332", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33548.902664553141", + "locked_amount": "33490.16360960144675", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3318.7109300625668266518280941708", + "locked_amount": "3278.989271705708346251780615101", "deposits": [ { "amount": "2833.333333", @@ -22361,8 +22361,8 @@ "tranche_start": "2022-03-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", - "total_removed": "202112.7281627920977", - "locked_amount": "2198969.50656394880278652333", + "total_removed": "204390.7646836173642", + "locked_amount": "2196892.56556490327074822627", "deposits": [ { "amount": "1998.95815", @@ -22551,6 +22551,11 @@ "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", "tx": "0x8d749e9b03d9656e6bb458d20f0ef55b1778785744415241b12f4875b1dc4749" }, + { + "amount": "2278.0365208252665", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tx": "0x6c2bbcd7abbfd0627b6dc419214ae9d52c3f6755ed5b2ab867ff0aa504ebe70a" + }, { "amount": "10764.1909763241854", "user": "0xf110D577F07ED846D2308050cc0D6CCC2bf9fb2C", @@ -22704,6 +22709,12 @@ "tranche_id": 1, "tx": "0x8d749e9b03d9656e6bb458d20f0ef55b1778785744415241b12f4875b1dc4749" }, + { + "amount": "2278.0365208252665", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tranche_id": 1, + "tx": "0x6c2bbcd7abbfd0627b6dc419214ae9d52c3f6755ed5b2ab867ff0aa504ebe70a" + }, { "amount": "9453.4744822303375", "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", @@ -22736,8 +22747,8 @@ } ], "total_tokens": "187637.95", - "withdrawn_tokens": "74870.259332725684", - "remaining_tokens": "112767.690667274316" + "withdrawn_tokens": "77148.2958535509505", + "remaining_tokens": "110489.6541464490495" }, { "address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", @@ -23218,8 +23229,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "201080.6007556437762444", - "locked_amount": "13097092.2685797557767149706335072135198702", + "total_removed": "201205.7651020019737444", + "locked_amount": "13089727.5691494991955052239523728022871047", "deposits": [ { "amount": "16249.93", @@ -23823,6 +23834,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xf59861d62aa335573fa03b596b554b43fd958e759ad23301f7cffffb52945c0d" }, + { + "amount": "125.1643463581975", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tx": "0x87eaac3c9200157a9a8af51edba2a22a199a057e57c7a22c8af0909d5a608f6d" + }, { "amount": "253.966945001875125", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -25624,6 +25640,12 @@ "tranche_id": 2, "tx": "0x512e9f05b8acfc34d562ab3fa128a36e4f212b3c53bbcfb8bd0270bc81800da0" }, + { + "amount": "125.1643463581975", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tranche_id": 2, + "tx": "0x87eaac3c9200157a9a8af51edba2a22a199a057e57c7a22c8af0909d5a608f6d" + }, { "amount": "519.4281860825575", "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", @@ -25644,8 +25666,8 @@ } ], "total_tokens": "12362.05", - "withdrawn_tokens": "2038.1690775099675", - "remaining_tokens": "10323.8809224900325" + "withdrawn_tokens": "2163.333423868165", + "remaining_tokens": "10198.716576131835" }, { "address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC", @@ -26270,7 +26292,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2762126.087814295642620897", - "locked_amount": "6369706.73033883268668447364205577", + "locked_amount": "6362907.68684886785754691169110188", "deposits": [ { "amount": "129284.449", @@ -31375,7 +31397,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2199806.249282260715893759839301158", + "locked_amount": "2197119.90607910278928393951973856", "deposits": [ { "amount": "552496.6455", @@ -32784,7 +32806,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3136.87798919126", - "locked_amount": "348439.2881606427712481892998478", + "locked_amount": "348110.18498704306436565431963472", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 76c37cd92..8f4c0b4a5 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "92.10116850583463120009118927574835112", + "locked_amount": "91.39766584221207720009049273845763572", "deposits": [ { "amount": "1000", From 4db77a8e8a9fc70dc9f547013e0268bde886b7b8 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 9 Sep 2022 06:13:33 +0000 Subject: [PATCH 36/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 67 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 51a6cc681..e69484201 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107224.093955006853092415", + "locked_amount": "107164.285180267249536945", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51734.29166666666316", + "locked_amount": "51697.95903729071418", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48399.049416616948729698", + "locked_amount": "48340.382580036791771688", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66153.144805215903630295886808", + "locked_amount": "66072.95736801763983526026612", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20360.644282693272452814", + "locked_amount": "20335.964157666079406968", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6627.192139001225830064", + "locked_amount": "6619.158997795138768519", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8640.115489130433", + "locked_amount": "8599.009284420291", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1413717.270599714493173332", + "locked_amount": "1412377.295336474471961658", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33490.16360960144675", + "locked_amount": "33431.92981959541225", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3278.989271705708346251780615101", + "locked_amount": "3239.6092933702158613992758691938", "deposits": [ { "amount": "2833.333333", @@ -5893,7 +5893,7 @@ "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "35924.000000000000000003", - "total_removed": "16791.59106856284", + "total_removed": "16836.50659367884", "locked_amount": "0", "deposits": [ { @@ -11843,6 +11843,11 @@ } ], "withdrawals": [ + { + "amount": "44.915525116", + "user": "0x3f626D48C2a6104976A03009cFDB4A48F32fd282", + "tx": "0x2d81729f37b9abefd460e8439566e1afd19b395ae58102a523dc192a4d57666a" + }, { "amount": "13.82033422112", "user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F", @@ -22121,6 +22126,12 @@ } ], "withdrawals": [ + { + "amount": "44.915525116", + "user": "0x3f626D48C2a6104976A03009cFDB4A48F32fd282", + "tranche_id": 11, + "tx": "0x2d81729f37b9abefd460e8439566e1afd19b395ae58102a523dc192a4d57666a" + }, { "amount": "36.75952562", "user": "0x3f626D48C2a6104976A03009cFDB4A48F32fd282", @@ -22147,8 +22158,8 @@ } ], "total_tokens": "200", - "withdrawn_tokens": "155.084474884", - "remaining_tokens": "44.915525116" + "withdrawn_tokens": "200", + "remaining_tokens": "0" }, { "address": "0x6f5EBA1eCc26B8f1203a1D32116f286fAd383a2d", @@ -22362,7 +22373,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2196892.56556490327074822627", + "locked_amount": "2194833.49011513925725748998", "deposits": [ { "amount": "1998.95815", @@ -23230,7 +23241,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "201205.7651020019737444", - "locked_amount": "13089727.5691494991955052239523728022871047", + "locked_amount": "13082426.2198099137148078223786461128426601", "deposits": [ { "amount": "16249.93", @@ -26292,7 +26303,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2762126.087814295642620897", - "locked_amount": "6362907.68684886785754691169110188", + "locked_amount": "6356167.12775812021562798966684235", "deposits": [ { "amount": "129284.449", @@ -31397,7 +31408,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2197119.90607910278928393951973856", + "locked_amount": "2194456.670415786405996075259006831", "deposits": [ { "amount": "552496.6455", @@ -32805,8 +32816,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "3136.87798919126", - "locked_amount": "348110.18498704306436565431963472", + "total_removed": "3189.60912820526", + "locked_amount": "347783.91271185092408042207914764", "deposits": [ { "amount": "3000", @@ -39425,6 +39436,11 @@ } ], "withdrawals": [ + { + "amount": "52.731139014", + "user": "0x28FC83947F02f59Cb36b40f97f2D32BBC5D00585", + "tx": "0xea18c5a1b637f62c07a366ee4622d008e932fdc1cbd0dc2283dc6e623f063381" + }, { "amount": "44.069926432", "user": "0xfb393Ad714e8014947d9887912DfFB921E8aE74a", @@ -58215,10 +58231,17 @@ "tx": "0xb59405747c8088945a412703637a7b422f3639439ec2ee15e180c0a2a0d71ee4" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "52.731139014", + "user": "0x28FC83947F02f59Cb36b40f97f2D32BBC5D00585", + "tranche_id": 5, + "tx": "0xea18c5a1b637f62c07a366ee4622d008e932fdc1cbd0dc2283dc6e623f063381" + } + ], "total_tokens": "200", - "withdrawn_tokens": "0", - "remaining_tokens": "200" + "withdrawn_tokens": "52.731139014", + "remaining_tokens": "147.268860986" }, { "address": "0xBef628af8547cE5264835F32487055a7e3dF393D", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 8f4c0b4a5..be4fb1562 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "91.39766584221207720009049273845763572", + "locked_amount": "90.69983193810245440008980181380010144", "deposits": [ { "amount": "1000", From 8958db061286afbb08cbb50982e1572424665e4f Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Fri, 9 Sep 2022 10:36:53 +0100 Subject: [PATCH 37/66] Test/626 oracle info (#1294) * test: update market info tests * test: update withdrawal test to include new info * chore: re add withdrawal mock * chore: wait for mock * chore: change cypress browser to electron * chore: resolved pr comments --- .../capsule-cypress-manual-trigger.yml | 2 +- .../workflows/capsule-cypress-night-run.yml | 2 +- .github/workflows/capsule-cypress.yml | 2 +- apps/trading-e2e/src/integration/home.cy.ts | 2 + .../src/integration/market-info.cy.ts | 46 ++++++++++++++----- .../src/integration/withdraw.cy.ts | 12 +++++ .../mocks/generate-market-info-query.ts | 6 +-- libs/withdraws/src/lib/withdraw-limits.tsx | 6 +-- 8 files changed, 58 insertions(+), 20 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 05c9377a2..98339188d 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -133,7 +133,7 @@ jobs: working-directory: frontend-monorepo - name: Run Cypress tests - run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome + run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} working-directory: frontend-monorepo env: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 769062af2..befc1ce14 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -117,7 +117,7 @@ jobs: working-directory: frontend-monorepo - name: Run Cypress tests - run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome + run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }} working-directory: frontend-monorepo env: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index 74bbe04d6..a2eb2a4d1 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -130,7 +130,7 @@ jobs: working-directory: frontend-monorepo - name: Run Cypress tests - run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --browser chrome + run: npx nx affected:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} working-directory: frontend-monorepo env: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index daf1724ad..fad513963 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -12,6 +12,8 @@ describe('home', () => { mockTradingPage(req, MarketState.STATE_ACTIVE); }); cy.visit('/'); + cy.wait('@Market'); + cy.get('main[data-testid="market"]', { timeout: 20000 }).should('exist'); // Wait for page to be rendered to before checking url // Overlay should be shown diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index 0cc3bda16..c6672e1ed 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -4,6 +4,7 @@ import { mockTradingPage } from '../support/trading'; const marketInfoBtn = 'Info'; const row = 'key-value-table-row'; const marketTitle = 'accordion-title'; +const externalLink = 'external-link'; describe('market info is displayed', () => { before(() => { @@ -25,9 +26,9 @@ describe('market info is displayed', () => { it('market price', () => { cy.getByTestId(marketTitle).contains('Market price').click(); - validateMarketDataRow(0, 'Mark Price', '57.49'); - validateMarketDataRow(1, 'Best Bid Price', '6,817.65'); - validateMarketDataRow(2, 'Best Offer Price', '6,817.69'); + validateMarketDataRow(0, 'Mark Price', '0.05749'); + validateMarketDataRow(1, 'Best Bid Price', '6.81765 '); + validateMarketDataRow(2, 'Best Offer Price', '6.81769 '); }); it('market volume displayed', () => { @@ -71,11 +72,7 @@ describe('market info is displayed', () => { validateMarketDataRow(0, 'Name', 'tBTC TEST'); validateMarketDataRow(1, 'Symbol', 'tBTC'); - validateMarketDataRow( - 2, - 'Asset ID', - '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c' - ); + validateMarketDataRow(2, 'Asset ID', 'market-0'); }); it('metadata displayed', () => { @@ -114,9 +111,9 @@ describe('market info is displayed', () => { it('price monitoring bound displayed', () => { cy.getByTestId(marketTitle).contains('Price monitoring bound 1').click(); - validateMarketDataRow(0, 'Min Valid Price', '6,547.01'); - validateMarketDataRow(1, 'Max Valid Price', '7,973.23'); - validateMarketDataRow(2, 'Reference Price', '7,226.25'); + validateMarketDataRow(0, 'Min Valid Price', '6.54701 '); + validateMarketDataRow(1, 'Max Valid Price', '7.97323 '); + validateMarketDataRow(2, 'Reference Price', '7.22625 '); }); it('liquidity monitoring parameters displayed', () => { @@ -129,6 +126,20 @@ describe('market info is displayed', () => { validateMarketDataRow(2, 'Scaling Factor', '10'); }); + it('liquidity displayed', () => { + cy.getByTestId('accordion-toggle').eq(14).click(); + + validateMarketDataRow(0, 'Target Stake', '0.56789 tBTC'); + validateMarketDataRow(1, 'Supplied Stake', '0.56767 tBTC'); + validateMarketDataRow(2, 'Market Value Proxy', '6.77678 tBTC'); + + cy.getByTestId(externalLink).should( + 'have.attr', + 'href', + '/liquidity/market-0' + ); + }); + it('oracle displayed', () => { cy.getByTestId(marketTitle).contains('Oracle').click(); @@ -148,6 +159,19 @@ describe('market info is displayed', () => { 'Termination Oracle', 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f' ); + + cy.getByTestId(externalLink) + .should('have.attr', 'href') + .and('contain', '/oracles'); + }); + + it('proposal displayed', () => { + cy.getByTestId(marketTitle).contains('Proposal').click(); + + cy.getByTestId(externalLink) + .should('have.text', 'View governance proposal') + .and('have.attr', 'href') + .and('contain', '/governance/market-0'); }); afterEach('close toggle', () => { diff --git a/apps/trading-e2e/src/integration/withdraw.cy.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts index 895a1171d..d78adade8 100644 --- a/apps/trading-e2e/src/integration/withdraw.cy.ts +++ b/apps/trading-e2e/src/integration/withdraw.cy.ts @@ -83,6 +83,18 @@ describe('withdraw', () => { }, }); cy.get(assetSelectField).select('Asset 0'); + cy.getByTestId('balance-available') + .should('contain.text', 'Balance available') + .find('td') + .should('have.text', '1000'); + cy.getByTestId('withdrawal-threshold') + .should('contain.text', 'Delayed withdrawal threshold') + .find('td') + .should('contain.text', '1m+'); + cy.getByTestId('delay-time') + .should('contain.text', 'Delay time') + .find('td') + .should('have.text', 'None'); cy.get(amountField).clear().type('10'); cy.getByTestId(submitWithdrawBtn).click(); cy.getByTestId('dialog-title').should( diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index f11f8867e..f17bafb53 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -15,7 +15,7 @@ export const generateMarketInfoQuery = ( market: { __typename: 'Market', id: 'market-0', - decimalPlaces: 2, + decimalPlaces: 5, positionDecimalPlaces: 0, state: MarketState.STATE_ACTIVE, tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, @@ -144,10 +144,10 @@ export const generateMarketInfoQuery = ( quoteName: 'BTC', settlementAsset: { __typename: 'Asset', - id: '5cfa87844724df6069b94e4c8a6f03af21907d7bc251593d08e4251043ee9f7c', + id: 'market-0', symbol: 'tBTC', name: 'tBTC TEST', - decimals: 1, + decimals: 5, }, oracleSpecForSettlementPrice: { __typename: 'OracleSpec', diff --git a/libs/withdraws/src/lib/withdraw-limits.tsx b/libs/withdraws/src/lib/withdraw-limits.tsx index ebb2141c2..16c006b52 100644 --- a/libs/withdraws/src/lib/withdraw-limits.tsx +++ b/libs/withdraws/src/lib/withdraw-limits.tsx @@ -33,17 +33,17 @@ export const WithdrawLimits = ({ return ( - + - + - + From 1beaad57595e416b108d7b9accb98ec31dcbcc5e Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 9 Sep 2022 12:04:51 +0000 Subject: [PATCH 38/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 52 ++++++++++++++------ apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index e69484201..2e88a6bcc 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107164.285180267249536945", + "locked_amount": "107106.412097865345751005", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51697.95903729071418", + "locked_amount": "51662.8023021308963", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48340.382580036791771688", + "locked_amount": "48283.6144773219922140612", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "66072.95736801763983526026612", + "locked_amount": "65995.36517221057900084935156", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20335.964157666079406968", + "locked_amount": "20312.082797186662140902", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6619.158997795138768519", + "locked_amount": "6611.385846698325276688", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8599.009284420291", + "locked_amount": "8559.2334692028972", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1412377.295336474471961658", + "locked_amount": "1411080.687954636552930414", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33431.92981959541225", + "locked_amount": "33375.58074803744025", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3239.6092933702158613992758691938", + "locked_amount": "3201.503835749338563192367054605", "deposits": [ { "amount": "2833.333333", @@ -5892,10 +5892,15 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35924.000000000000000003", + "total_added": "35944.000000000000000003", "total_removed": "16836.50659367884", "locked_amount": "0", "deposits": [ + { + "amount": "20", + "user": "0x9e02d57941833BB800cF0343b65A3D9dCa935b91", + "tx": "0xff09c5e98e22a7b1d26e68f44124c6bfca8c49fb0a7c704ba309def7ac50f4be" + }, { "amount": "15", "user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -12460,6 +12465,21 @@ } ], "users": [ + { + "address": "0x9e02d57941833BB800cF0343b65A3D9dCa935b91", + "deposits": [ + { + "amount": "20", + "user": "0x9e02d57941833BB800cF0343b65A3D9dCa935b91", + "tranche_id": 11, + "tx": "0xff09c5e98e22a7b1d26e68f44124c6bfca8c49fb0a7c704ba309def7ac50f4be" + } + ], + "withdrawals": [], + "total_tokens": "20", + "withdrawn_tokens": "0", + "remaining_tokens": "20" + }, { "address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", "deposits": [ @@ -22373,7 +22393,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2194833.49011513925725748998", + "locked_amount": "2192841.05599999791868979098", "deposits": [ { "amount": "1998.95815", @@ -23241,7 +23261,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "201205.7651020019737444", - "locked_amount": "13082426.2198099137148078223786461128426601", + "locked_amount": "13075361.1763641212118482748971176934022709", "deposits": [ { "amount": "16249.93", @@ -26303,7 +26323,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2762126.087814295642620897", - "locked_amount": "6356167.12775812021562798966684235", + "locked_amount": "6349644.724759691267047185120178365", "deposits": [ { "amount": "129284.449", @@ -31408,7 +31428,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1738566.199331512609572207", - "locked_amount": "2194456.670415786405996075259006831", + "locked_amount": "2191879.62954394284334771921716768", "deposits": [ { "amount": "552496.6455", @@ -32817,7 +32837,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3189.60912820526", - "locked_amount": "347783.91271185092408042207914764", + "locked_amount": "347468.20013706781457981767732116", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index be4fb1562..8e38b942f 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "90.69983193810245440008980181380010144", + "locked_amount": "90.02473712582447720008913340309487572", "deposits": [ { "amount": "1000", From 7613a9fa9f29313384beccaf662a767dff796986 Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Fri, 9 Sep 2022 16:14:48 +0100 Subject: [PATCH 39/66] Feat/migrate libs (#1266) * feat: add new generator with config * feat: split off gql queries to separate files for the new generator * fix: delete dummy schema * feat: add generated queries with new codegen * fix: regenerate from scratch and remove duplicates * fix: libs and app gen folders * fix: remove more duplicate queries * fix: add generated files to be ignored by the formatter * fix: format * feat: migrate assets to use new code generator * fix: generated imports * fix: lint * fix: accounts export * fix: more imports * fix: add type alias for new type system and regenerate * fix: format * fix: export * fix: format * fix: delete leftover file from merge * chore: migrate candles-chart lib * fix: remove redundant asset files * chore: migrate accounts * chore: update glob * chore: add cleanup to fix-imports to support type migrations for now * fix: imports * fix: update market types * fix: type import paths * fix: format * fix: import * fix: types in e2e tests * fix: format * fix: lint --- .../deal-ticket/__generated___/MarketTags.ts | 2 +- .../__generated___/PartyBalance.ts | 2 +- .../deposits/__generated___/Deposits.ts | 2 +- .../__generated___/Candles.ts | 2 +- .../__generated___/SimpleMarkets.ts | 2 +- .../app/hooks/__generated___/EstimateOrder.ts | 2 +- .../hooks/__generated___/MarketMarkPrice.ts | 2 +- .../hooks/__generated___/MarketPositions.ts | 2 +- .../hooks/__generated___/PartyMarketData.ts | 2 +- .../routes/assets/__generated___/Assets.ts | 2 +- .../governance/__generated___/Proposals.ts | 2 +- .../routes/markets/__generated___/Markets.ts | 2 +- .../__generated___/NetworkParameters.ts | 2 +- .../oracles/__generated___/OracleSpecs.ts | 2 +- .../parties/__generated___/PartyAssets.ts | 2 +- .../routes/validators/__generated___/Nodes.ts | 2 +- .../vega-wallet/__generated___/Delegations.ts | 2 +- .../src/hooks/__generated___/NetworkParams.ts | 2 +- .../governance/__generated___/Proposal.ts | 2 +- .../vote-details/__generated___/Stake.ts | 2 +- .../routes/home/__generated___/NodeData.ts | 2 +- .../rewards/home/__generated___/Rewards.ts | 2 +- .../routes/staking/__generated___/Nodes.ts | 2 +- .../__generated___/PartyDelegations.ts | 2 +- .../routes/staking/__generated___/Staking.ts | 2 +- .../__generated___/PartyStakeLinkings.ts | 2 +- .../src/support/mocks/generate-accounts.ts | 8 +- .../src/support/mocks/generate-candles.ts | 10 +- .../src/support/mocks/generate-chart.ts | 18 +- .../pages/markets/__generated___/Market.ts | 2 +- .../deposit/__generated___/Deposit.ts | 2 +- libs/accounts/src/lib/Accounts.graphql | 20 +- .../src/lib/__generated__/AccountFields.ts | 74 ------- .../src/lib/__generated__/AccountSubscribe.ts | 85 -------- .../src/lib/__generated__/Accounts.ts | 189 ++++++++-------- .../src/lib/__generated___/Accounts.ts | 110 ---------- .../src/lib/accounts-data-provider.ts | 89 +++----- libs/accounts/src/lib/accounts-manager.tsx | 17 +- libs/accounts/src/lib/accounts-table.spec.tsx | 4 +- libs/accounts/src/lib/accounts-table.tsx | 16 +- libs/accounts/src/lib/asset-balance.tsx | 7 +- libs/accounts/src/lib/index.ts | 2 - .../Assets.ts | 2 +- .../src/lib/__generated__/AssetsConnection.ts | 80 ------- .../src/lib/asset-details-dialog.spec.tsx | 8 +- libs/assets/src/lib/asset-details-dialog.tsx | 47 +--- libs/assets/src/lib/index.ts | 2 +- libs/candles-chart/src/lib/Candles.graphql | 2 +- .../src/lib/__generated__/CandleFields.ts | 36 --- .../src/lib/__generated__/Candles.ts | 205 +++++++++--------- .../src/lib/__generated__/CandlesSub.ts | 50 ----- .../src/lib/__generated__/Chart.ts | 115 +++++----- .../src/lib/__generated___/Candles.ts | 113 ---------- .../src/lib/__generated___/Chart.ts | 55 ----- libs/candles-chart/src/lib/data-source.ts | 111 +++------- libs/candles-chart/src/lib/index.ts | 2 - .../components/__generated___/DealTicket.ts | 2 +- .../components/__generated___/MarketInfo.ts | 2 +- .../components/__generated___/MarketNames.ts | 2 +- .../__generated__/MarketInfoQuery.ts | 4 +- .../src/lib/__generated___/Deposit.ts | 2 +- libs/fills/src/lib/__generated___/Fills.ts | 2 +- .../__generated___/Proposal.ts | 2 +- .../src/lib/__generated___/MarketDepth.ts | 2 +- .../src/lib/__generated___/MarketData.ts | 2 +- .../stats-manager/__generated___/Stats.ts | 2 +- .../lib/order-hooks/__generated___/Orders.ts | 2 +- .../src/lib/__generated___/Positions.ts | 2 +- .../src/lib/positions-data-providers.spec.ts | 4 +- .../src/lib/positions-data-providers.ts | 6 +- libs/trades/src/lib/__generated___/Trades.ts | 2 +- libs/types/apollo.config.js | 8 +- libs/types/codegen.yml | 8 +- libs/types/fix-imports.js | 68 +++++- .../src/lib/__generated___/NetworkParams.ts | 2 +- .../src/lib/__generated___/Erc20Approval.ts | 2 +- .../src/lib/__generated___/Withdraw.ts | 2 +- .../src/lib/__generated___/Withdrawal.ts | 2 +- .../src/lib/use-create-withdraw.spec.tsx | 4 +- package.json | 2 +- tsconfig.base.json | 1 - yarn.lock | 2 +- 82 files changed, 511 insertions(+), 1161 deletions(-) delete mode 100644 libs/accounts/src/lib/__generated__/AccountFields.ts delete mode 100644 libs/accounts/src/lib/__generated__/AccountSubscribe.ts delete mode 100644 libs/accounts/src/lib/__generated___/Accounts.ts rename libs/assets/src/lib/{__generated___ => __generated__}/Assets.ts (97%) delete mode 100644 libs/assets/src/lib/__generated__/AssetsConnection.ts delete mode 100644 libs/candles-chart/src/lib/__generated__/CandleFields.ts delete mode 100644 libs/candles-chart/src/lib/__generated__/CandlesSub.ts delete mode 100644 libs/candles-chart/src/lib/__generated___/Candles.ts delete mode 100644 libs/candles-chart/src/lib/__generated___/Chart.ts diff --git a/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts b/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts index 99e0ebbc4..d6b879f57 100644 --- a/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts +++ b/apps/console-lite/src/app/components/deal-ticket/__generated___/MarketTags.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts b/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts index 37892e30e..60fd8862f 100644 --- a/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts +++ b/apps/console-lite/src/app/components/deal-ticket/__generated___/PartyBalance.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts b/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts index 8e8972412..11720a480 100644 --- a/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts +++ b/apps/console-lite/src/app/components/deposits/__generated___/Deposits.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts b/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts index 10852a97c..a69c128f3 100644 --- a/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts +++ b/apps/console-lite/src/app/components/simple-market-list/__generated___/Candles.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts b/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts index ee1e0743e..fa5e240ac 100644 --- a/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts +++ b/apps/console-lite/src/app/components/simple-market-list/__generated___/SimpleMarkets.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts b/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts index a9584623d..8a51585dc 100644 --- a/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts +++ b/apps/console-lite/src/app/hooks/__generated___/EstimateOrder.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts b/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts index c229f45ac..666870091 100644 --- a/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts +++ b/apps/console-lite/src/app/hooks/__generated___/MarketMarkPrice.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts b/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts index 090290948..e6dc12487 100644 --- a/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts +++ b/apps/console-lite/src/app/hooks/__generated___/MarketPositions.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts b/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts index b4e7f2c8c..516fc6126 100644 --- a/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts +++ b/apps/console-lite/src/app/hooks/__generated___/PartyMarketData.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/assets/__generated___/Assets.ts b/apps/explorer/src/app/routes/assets/__generated___/Assets.ts index 2d89adea5..a7507a109 100644 --- a/apps/explorer/src/app/routes/assets/__generated___/Assets.ts +++ b/apps/explorer/src/app/routes/assets/__generated___/Assets.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts b/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts index b807b5e9d..7a9394f8f 100644 --- a/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts +++ b/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/markets/__generated___/Markets.ts b/apps/explorer/src/app/routes/markets/__generated___/Markets.ts index deb1d2bdd..e5e1c1a43 100644 --- a/apps/explorer/src/app/routes/markets/__generated___/Markets.ts +++ b/apps/explorer/src/app/routes/markets/__generated___/Markets.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts b/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts index d40f46c02..dd1045c07 100644 --- a/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts +++ b/apps/explorer/src/app/routes/network-parameters/__generated___/NetworkParameters.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts index 9f53d037c..f146c789a 100644 --- a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts +++ b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts b/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts index 9c10bbff9..c3b1c42f0 100644 --- a/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts +++ b/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts b/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts index bf86e7858..ddcb8e34f 100644 --- a/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts +++ b/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/components/vega-wallet/__generated___/Delegations.ts b/apps/token/src/components/vega-wallet/__generated___/Delegations.ts index 5d6610ba9..521d0282f 100644 --- a/apps/token/src/components/vega-wallet/__generated___/Delegations.ts +++ b/apps/token/src/components/vega-wallet/__generated___/Delegations.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/hooks/__generated___/NetworkParams.ts b/apps/token/src/hooks/__generated___/NetworkParams.ts index 1208760a1..d63723105 100644 --- a/apps/token/src/hooks/__generated___/NetworkParams.ts +++ b/apps/token/src/hooks/__generated___/NetworkParams.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/governance/__generated___/Proposal.ts b/apps/token/src/routes/governance/__generated___/Proposal.ts index 29e37bd12..9bffdd389 100644 --- a/apps/token/src/routes/governance/__generated___/Proposal.ts +++ b/apps/token/src/routes/governance/__generated___/Proposal.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts b/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts index aa930de95..0c3473d7b 100644 --- a/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts +++ b/apps/token/src/routes/governance/components/vote-details/__generated___/Stake.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/home/__generated___/NodeData.ts b/apps/token/src/routes/home/__generated___/NodeData.ts index b2bc06f54..3713ca816 100644 --- a/apps/token/src/routes/home/__generated___/NodeData.ts +++ b/apps/token/src/routes/home/__generated___/NodeData.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/rewards/home/__generated___/Rewards.ts b/apps/token/src/routes/rewards/home/__generated___/Rewards.ts index c39358064..49ca05f70 100644 --- a/apps/token/src/routes/rewards/home/__generated___/Rewards.ts +++ b/apps/token/src/routes/rewards/home/__generated___/Rewards.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/staking/__generated___/Nodes.ts b/apps/token/src/routes/staking/__generated___/Nodes.ts index c51582125..94f58eb5a 100644 --- a/apps/token/src/routes/staking/__generated___/Nodes.ts +++ b/apps/token/src/routes/staking/__generated___/Nodes.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/staking/__generated___/PartyDelegations.ts b/apps/token/src/routes/staking/__generated___/PartyDelegations.ts index 71ee9e4f9..0914c78b1 100644 --- a/apps/token/src/routes/staking/__generated___/PartyDelegations.ts +++ b/apps/token/src/routes/staking/__generated___/PartyDelegations.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/staking/__generated___/Staking.ts b/apps/token/src/routes/staking/__generated___/Staking.ts index af5b483fc..864f2ab32 100644 --- a/apps/token/src/routes/staking/__generated___/Staking.ts +++ b/apps/token/src/routes/staking/__generated___/Staking.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts b/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts index 48dd96edc..53e018802 100644 --- a/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts +++ b/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/trading-e2e/src/support/mocks/generate-accounts.ts b/apps/trading-e2e/src/support/mocks/generate-accounts.ts index 91b40d0cd..f0e322bb5 100644 --- a/apps/trading-e2e/src/support/mocks/generate-accounts.ts +++ b/apps/trading-e2e/src/support/mocks/generate-accounts.ts @@ -1,12 +1,12 @@ import merge from 'lodash/merge'; -import type { Accounts } from '@vegaprotocol/accounts'; +import type { AccountsQuery } from '@vegaprotocol/accounts'; import { AccountType } from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; export const generateAccounts = ( - override?: PartialDeep -): Accounts => { - const defaultAccounts: Accounts = { + override?: PartialDeep +): AccountsQuery => { + const defaultAccounts: AccountsQuery = { party: { __typename: 'Party', id: Cypress.env('VEGA_PUBLIC_KEY'), diff --git a/apps/trading-e2e/src/support/mocks/generate-candles.ts b/apps/trading-e2e/src/support/mocks/generate-candles.ts index 2ce58d860..3ac1912f3 100644 --- a/apps/trading-e2e/src/support/mocks/generate-candles.ts +++ b/apps/trading-e2e/src/support/mocks/generate-candles.ts @@ -1,12 +1,14 @@ import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; import type { - Candles, - Candles_market_candles, + CandlesQuery, + CandleFieldsFragment, } from '@vegaprotocol/candles-chart'; -export const generateCandles = (override?: PartialDeep): Candles => { - const candles: Candles_market_candles[] = [ +export const generateCandles = ( + override?: PartialDeep +): CandlesQuery => { + const candles: CandleFieldsFragment[] = [ { datetime: '2022-04-06T09:15:00Z', high: '17481092', diff --git a/apps/trading-e2e/src/support/mocks/generate-chart.ts b/apps/trading-e2e/src/support/mocks/generate-chart.ts index f80db6353..91819aedd 100644 --- a/apps/trading-e2e/src/support/mocks/generate-chart.ts +++ b/apps/trading-e2e/src/support/mocks/generate-chart.ts @@ -1,15 +1,21 @@ import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; -import type { - Chart, - Chart_market_data_priceMonitoringBounds, -} from '@vegaprotocol/candles-chart'; +import type { ChartQuery } from '@vegaprotocol/candles-chart'; +import type { Schema } from '@vegaprotocol/types'; -export const generateChart = (override?: PartialDeep): Chart => { - const priceMonitoringBound: Chart_market_data_priceMonitoringBounds = { +export const generateChart = ( + override?: PartialDeep +): ChartQuery => { + const priceMonitoringBound: Schema.PriceMonitoringBounds = { minValidPrice: '16256291', maxValidPrice: '18296869', referencePrice: '17247489', + trigger: { + __typename: 'PriceMonitoringTrigger', + auctionExtensionSecs: 1, + horizonSecs: 0, + probability: 0, + }, __typename: 'PriceMonitoringBounds', }; const defaultResult = { diff --git a/apps/trading/pages/markets/__generated___/Market.ts b/apps/trading/pages/markets/__generated___/Market.ts index dc98077fa..879fc9520 100644 --- a/apps/trading/pages/markets/__generated___/Market.ts +++ b/apps/trading/pages/markets/__generated___/Market.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts b/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts index 7157ef251..18b76fd9b 100644 --- a/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts +++ b/apps/trading/pages/portfolio/deposit/__generated___/Deposit.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/accounts/src/lib/Accounts.graphql b/libs/accounts/src/lib/Accounts.graphql index c2b7da82c..b4029a499 100644 --- a/libs/accounts/src/lib/Accounts.graphql +++ b/libs/accounts/src/lib/Accounts.graphql @@ -3,7 +3,11 @@ fragment AccountFields on Account { balance market { id - name + tradableInstrument { + instrument { + name + } + } } asset { id @@ -15,20 +19,14 @@ fragment AccountFields on Account { query Accounts($partyId: ID!) { party(id: $partyId) { id - accountsConnection { - edges { - node { - type - balance - } - } + accounts { + ...AccountFields } } } -subscription AccountSubscribe($partyId: ID!) { +subscription AccountEvents($partyId: ID!) { accounts(partyId: $partyId) { - type - balance + ...AccountFields } } diff --git a/libs/accounts/src/lib/__generated__/AccountFields.ts b/libs/accounts/src/lib/__generated__/AccountFields.ts deleted file mode 100644 index b2286b2b1..000000000 --- a/libs/accounts/src/lib/__generated__/AccountFields.ts +++ /dev/null @@ -1,74 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { AccountType } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL fragment: AccountFields -// ==================================================== - -export interface AccountFields_market_tradableInstrument_instrument { - __typename: "Instrument"; - /** - * Full and fairly descriptive name for the instrument - */ - name: string; -} - -export interface AccountFields_market_tradableInstrument { - __typename: "TradableInstrument"; - /** - * An instance of, or reference to, a fully specified instrument. - */ - instrument: AccountFields_market_tradableInstrument_instrument; -} - -export interface AccountFields_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * An instance of, or reference to, a tradable instrument. - */ - tradableInstrument: AccountFields_market_tradableInstrument; -} - -export interface AccountFields_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; -} - -export interface AccountFields { - __typename: "Account"; - /** - * Account type (General, Margin, etc) - */ - type: AccountType; - /** - * Balance as string - current account balance (approx. as balances can be updated several times per second) - */ - balance: string; - /** - * Market (only relevant to margin accounts) - */ - market: AccountFields_market | null; - /** - * Asset, the 'currency' - */ - asset: AccountFields_asset; -} diff --git a/libs/accounts/src/lib/__generated__/AccountSubscribe.ts b/libs/accounts/src/lib/__generated__/AccountSubscribe.ts deleted file mode 100644 index 94a5e17bf..000000000 --- a/libs/accounts/src/lib/__generated__/AccountSubscribe.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { AccountType } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL subscription operation: AccountSubscribe -// ==================================================== - -export interface AccountSubscribe_accounts_market_tradableInstrument_instrument { - __typename: "Instrument"; - /** - * Full and fairly descriptive name for the instrument - */ - name: string; -} - -export interface AccountSubscribe_accounts_market_tradableInstrument { - __typename: "TradableInstrument"; - /** - * An instance of, or reference to, a fully specified instrument. - */ - instrument: AccountSubscribe_accounts_market_tradableInstrument_instrument; -} - -export interface AccountSubscribe_accounts_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * An instance of, or reference to, a tradable instrument. - */ - tradableInstrument: AccountSubscribe_accounts_market_tradableInstrument; -} - -export interface AccountSubscribe_accounts_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; -} - -export interface AccountSubscribe_accounts { - __typename: "Account"; - /** - * Account type (General, Margin, etc) - */ - type: AccountType; - /** - * Balance as string - current account balance (approx. as balances can be updated several times per second) - */ - balance: string; - /** - * Market (only relevant to margin accounts) - */ - market: AccountSubscribe_accounts_market | null; - /** - * Asset, the 'currency' - */ - asset: AccountSubscribe_accounts_asset; -} - -export interface AccountSubscribe { - /** - * Subscribe to the accounts updates - */ - accounts: AccountSubscribe_accounts; -} - -export interface AccountSubscribeVariables { - partyId: string; -} diff --git a/libs/accounts/src/lib/__generated__/Accounts.ts b/libs/accounts/src/lib/__generated__/Accounts.ts index 42ff085ed..9ed0ec048 100644 --- a/libs/accounts/src/lib/__generated__/Accounts.ts +++ b/libs/accounts/src/lib/__generated__/Accounts.ts @@ -1,97 +1,108 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. +import { Schema as Types } from '@vegaprotocol/types'; -import { AccountType } from "@vegaprotocol/types"; +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; -// ==================================================== -// GraphQL query operation: Accounts -// ==================================================== +export type AccountsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; -export interface Accounts_party_accounts_market_tradableInstrument_instrument { - __typename: "Instrument"; - /** - * Full and fairly descriptive name for the instrument - */ - name: string; + +export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accounts?: Array<{ __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }> | null } | null }; + +export type AccountEventsSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + + +export type AccountEventsSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string } } } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } }; + +export const AccountFieldsFragmentDoc = gql` + fragment AccountFields on Account { + type + balance + market { + id + tradableInstrument { + instrument { + name + } + } + } + asset { + id + symbol + decimals + } } - -export interface Accounts_party_accounts_market_tradableInstrument { - __typename: "TradableInstrument"; - /** - * An instance of, or reference to, a fully specified instrument. - */ - instrument: Accounts_party_accounts_market_tradableInstrument_instrument; + `; +export const AccountsDocument = gql` + query Accounts($partyId: ID!) { + party(id: $partyId) { + id + accounts { + ...AccountFields + } + } } + ${AccountFieldsFragmentDoc}`; -export interface Accounts_party_accounts_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * An instance of, or reference to, a tradable instrument. - */ - tradableInstrument: Accounts_party_accounts_market_tradableInstrument; +/** + * __useAccountsQuery__ + * + * To run a query within a React component, call `useAccountsQuery` and pass it any options that fit your needs. + * When your component renders, `useAccountsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAccountsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useAccountsQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(AccountsDocument, options); + } +export function useAccountsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(AccountsDocument, options); + } +export type AccountsQueryHookResult = ReturnType; +export type AccountsLazyQueryHookResult = ReturnType; +export type AccountsQueryResult = Apollo.QueryResult; +export const AccountEventsDocument = gql` + subscription AccountEvents($partyId: ID!) { + accounts(partyId: $partyId) { + ...AccountFields + } } + ${AccountFieldsFragmentDoc}`; -export interface Accounts_party_accounts_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; -} - -export interface Accounts_party_accounts { - __typename: "Account"; - /** - * Account type (General, Margin, etc) - */ - type: AccountType; - /** - * Balance as string - current account balance (approx. as balances can be updated several times per second) - */ - balance: string; - /** - * Market (only relevant to margin accounts) - */ - market: Accounts_party_accounts_market | null; - /** - * Asset, the 'currency' - */ - asset: Accounts_party_accounts_asset; -} - -export interface Accounts_party { - __typename: "Party"; - /** - * Party identifier - */ - id: string; - /** - * Collateral accounts relating to a party - */ - accounts: Accounts_party_accounts[] | null; -} - -export interface Accounts { - /** - * An entity that is trading on the Vega network - */ - party: Accounts_party | null; -} - -export interface AccountsVariables { - partyId: string; -} +/** + * __useAccountEventsSubscription__ + * + * To run a query within a React component, call `useAccountEventsSubscription` and pass it any options that fit your needs. + * When your component renders, `useAccountEventsSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAccountEventsSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useAccountEventsSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(AccountEventsDocument, options); + } +export type AccountEventsSubscriptionHookResult = ReturnType; +export type AccountEventsSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/accounts/src/lib/__generated___/Accounts.ts b/libs/accounts/src/lib/__generated___/Accounts.ts deleted file mode 100644 index 92e6e678f..000000000 --- a/libs/accounts/src/lib/__generated___/Accounts.ts +++ /dev/null @@ -1,110 +0,0 @@ -import * as Types from '@vegaprotocol/types/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type AccountFieldsFragment = { __typename?: 'Account', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string, name: string } | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; - -export type AccountsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type AccountsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, accountsConnection: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'Account', type: Types.AccountType, balance: string } } | null> | null } } | null }; - -export type AccountSubscribeSubscriptionVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type AccountSubscribeSubscription = { __typename?: 'Subscription', accounts: { __typename?: 'Account', type: Types.AccountType, balance: string } }; - -export const AccountFieldsFragmentDoc = gql` - fragment AccountFields on Account { - type - balance - market { - id - name - } - asset { - id - symbol - decimals - } -} - `; -export const AccountsDocument = gql` - query Accounts($partyId: ID!) { - party(id: $partyId) { - id - accountsConnection { - edges { - node { - type - balance - } - } - } - } -} - `; - -/** - * __useAccountsQuery__ - * - * To run a query within a React component, call `useAccountsQuery` and pass it any options that fit your needs. - * When your component renders, `useAccountsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAccountsQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useAccountsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AccountsDocument, options); - } -export function useAccountsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AccountsDocument, options); - } -export type AccountsQueryHookResult = ReturnType; -export type AccountsLazyQueryHookResult = ReturnType; -export type AccountsQueryResult = Apollo.QueryResult; -export const AccountSubscribeDocument = gql` - subscription AccountSubscribe($partyId: ID!) { - accounts(partyId: $partyId) { - type - balance - } -} - `; - -/** - * __useAccountSubscribeSubscription__ - * - * To run a query within a React component, call `useAccountSubscribeSubscription` and pass it any options that fit your needs. - * When your component renders, `useAccountSubscribeSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAccountSubscribeSubscription({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useAccountSubscribeSubscription(baseOptions: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(AccountSubscribeDocument, options); - } -export type AccountSubscribeSubscriptionHookResult = ReturnType; -export type AccountSubscribeSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/accounts/src/lib/accounts-data-provider.ts b/libs/accounts/src/lib/accounts-data-provider.ts index 6882ec5b7..47f685168 100644 --- a/libs/accounts/src/lib/accounts-data-provider.ts +++ b/libs/accounts/src/lib/accounts-data-provider.ts @@ -1,64 +1,21 @@ import produce from 'immer'; -import { gql } from '@apollo/client'; +import { + AccountsDocument, + AccountEventsDocument, +} from './__generated__/Accounts'; import type { - Accounts, - Accounts_party_accounts, + AccountFieldsFragment, + AccountsQuery, + AccountEventsSubscription, } from './__generated__/Accounts'; import { makeDataProvider } from '@vegaprotocol/react-helpers'; -import type { - AccountSubscribe, - AccountSubscribe_accounts, -} from './__generated__/AccountSubscribe'; - -const ACCOUNTS_FRAGMENT = gql` - fragment AccountFields on Account { - type - balance - market { - id - tradableInstrument { - instrument { - name - } - } - } - asset { - id - symbol - decimals - } - } -`; - -const ACCOUNTS_QUERY = gql` - ${ACCOUNTS_FRAGMENT} - query Accounts($partyId: ID!) { - party(id: $partyId) { - id - accounts { - ...AccountFields - } - } - } -`; - -export const ACCOUNTS_SUB = gql` - ${ACCOUNTS_FRAGMENT} - subscription AccountSubscribe($partyId: ID!) { - accounts(partyId: $partyId) { - ...AccountFields - } - } -`; - -export const getId = ( - data: Accounts_party_accounts | AccountSubscribe_accounts -) => `${data.type}-${data.asset.symbol}-${data.market?.id ?? 'null'}`; +export const getId = (data: AccountFieldsFragment) => + `${data.type}-${data.asset.symbol}-${data.market?.id ?? 'null'}`; const update = ( - data: Accounts_party_accounts[], - delta: AccountSubscribe_accounts + data: AccountFieldsFragment[], + delta: AccountFieldsFragment ) => { return produce(data, (draft) => { const id = getId(delta); @@ -71,20 +28,24 @@ const update = ( }); }; -const getData = (responseData: Accounts): Accounts_party_accounts[] | null => - responseData.party ? responseData.party.accounts : null; +const getData = ( + responseData: AccountsQuery +): AccountFieldsFragment[] | null => { + return responseData.party?.accounts ?? null; +}; + const getDelta = ( - subscriptionData: AccountSubscribe -): AccountSubscribe_accounts => subscriptionData.accounts; + subscriptionData: AccountEventsSubscription +): AccountFieldsFragment => subscriptionData.accounts; export const accountsDataProvider = makeDataProvider< - Accounts, - Accounts_party_accounts[], - AccountSubscribe, - AccountSubscribe_accounts + AccountsQuery, + AccountFieldsFragment[], + AccountEventsSubscription, + AccountFieldsFragment >({ - query: ACCOUNTS_QUERY, - subscriptionQuery: ACCOUNTS_SUB, + query: AccountsDocument, + subscriptionQuery: AccountEventsDocument, update, getData, getDelta, diff --git a/libs/accounts/src/lib/accounts-manager.tsx b/libs/accounts/src/lib/accounts-manager.tsx index 2e06b2daa..bc1d4955a 100644 --- a/libs/accounts/src/lib/accounts-manager.tsx +++ b/libs/accounts/src/lib/accounts-manager.tsx @@ -3,8 +3,7 @@ import { produce } from 'immer'; import merge from 'lodash/merge'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { useDataProvider, addSummaryRows } from '@vegaprotocol/react-helpers'; -import type { AccountSubscribe_accounts } from './__generated__/AccountSubscribe'; -import type { Accounts_party_accounts } from './__generated__/Accounts'; +import type { AccountFieldsFragment } from './__generated__/Accounts'; import type { AgGridReact } from 'ag-grid-react'; import { @@ -22,17 +21,17 @@ export const AccountsManager = ({ partyId }: AccountsManagerProps) => { const gridRef = useRef(null); const variables = useMemo(() => ({ partyId }), [partyId]); const update = useCallback( - ({ delta }: { delta: AccountSubscribe_accounts }) => { - const update: Accounts_party_accounts[] = []; - const add: Accounts_party_accounts[] = []; + ({ delta }: { delta: AccountFieldsFragment }) => { + const update: AccountFieldsFragment[] = []; + const add: AccountFieldsFragment[] = []; if (!gridRef.current?.api) { return false; } const rowNode = gridRef.current.api.getRowNode(getId(delta)); if (rowNode) { - const updatedData = produce( + const updatedData = produce( rowNode.data, - (draft: Accounts_party_accounts) => { + (draft: AccountFieldsFragment) => { merge(draft, delta); } ); @@ -62,8 +61,8 @@ export const AccountsManager = ({ partyId }: AccountsManagerProps) => { [gridRef] ); const { data, error, loading } = useDataProvider< - Accounts_party_accounts[], - AccountSubscribe_accounts + AccountFieldsFragment[], + AccountFieldsFragment >({ dataProvider: accountsDataProvider, update, variables }); return ( diff --git a/libs/accounts/src/lib/accounts-table.spec.tsx b/libs/accounts/src/lib/accounts-table.spec.tsx index 6e10b163f..9db752249 100644 --- a/libs/accounts/src/lib/accounts-table.spec.tsx +++ b/libs/accounts/src/lib/accounts-table.spec.tsx @@ -1,9 +1,9 @@ import AccountsTable from './accounts-table'; import { act, render, screen, waitFor } from '@testing-library/react'; -import type { Accounts_party_accounts } from './__generated__/Accounts'; +import type { AccountFieldsFragment } from './__generated__/Accounts'; import { AccountType } from '@vegaprotocol/types'; -const singleRow: Accounts_party_accounts = { +const singleRow: AccountFieldsFragment = { __typename: 'Account', type: AccountType.ACCOUNT_TYPE_MARGIN, balance: '125600000', diff --git a/libs/accounts/src/lib/accounts-table.tsx b/libs/accounts/src/lib/accounts-table.tsx index 552f9bfde..451b8ec4d 100644 --- a/libs/accounts/src/lib/accounts-table.tsx +++ b/libs/accounts/src/lib/accounts-table.tsx @@ -14,22 +14,22 @@ import type { SummaryRow } from '@vegaprotocol/react-helpers'; import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact } from 'ag-grid-react'; -import type { Accounts_party_accounts } from './__generated__/Accounts'; +import type { AccountFieldsFragment } from './__generated__/Accounts'; import { getId } from './accounts-data-provider'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import type { AccountType } from '@vegaprotocol/types'; import { AccountTypeMapping } from '@vegaprotocol/types'; interface AccountsTableProps { - data: Accounts_party_accounts[] | null; + data: AccountFieldsFragment[] | null; } interface AccountsTableValueFormatterParams extends ValueFormatterParams { - data: Accounts_party_accounts; + data: AccountFieldsFragment; } export const getGroupId = ( - data: Accounts_party_accounts & SummaryRow, + data: AccountFieldsFragment & SummaryRow, columnApi: ColumnApi ) => { if (data.__summaryRow) { @@ -44,9 +44,9 @@ export const getGroupId = ( }; export const getGroupSummaryRow = ( - data: Accounts_party_accounts[], + data: AccountFieldsFragment[], columnApi: ColumnApi -): Partial | null => { +): Partial | null => { if (!data.length) { return null; } @@ -67,8 +67,8 @@ export const getGroupSummaryRow = ( const comparator = ( valueA: string, valueB: string, - nodeA: { data: Accounts_party_accounts & SummaryRow }, - nodeB: { data: Accounts_party_accounts & SummaryRow }, + nodeA: { data: AccountFieldsFragment & SummaryRow }, + nodeB: { data: AccountFieldsFragment & SummaryRow }, isInverted: boolean ) => { if (valueA < valueB) { diff --git a/libs/accounts/src/lib/asset-balance.tsx b/libs/accounts/src/lib/asset-balance.tsx index 9b3c9b53d..6e3ad4e50 100644 --- a/libs/accounts/src/lib/asset-balance.tsx +++ b/libs/accounts/src/lib/asset-balance.tsx @@ -3,8 +3,7 @@ import { addDecimalsFormatNumber, useDataProvider, } from '@vegaprotocol/react-helpers'; -import type { AccountSubscribe_accounts } from './__generated__/AccountSubscribe'; -import type { Accounts_party_accounts } from './__generated__/Accounts'; +import type { AccountFieldsFragment } from './__generated__/Accounts'; import { accountsDataProvider } from './accounts-data-provider'; @@ -16,8 +15,8 @@ interface AssetBalanceProps { export const AssetBalance = ({ partyId, assetSymbol }: AssetBalanceProps) => { const variables = useMemo(() => ({ partyId }), [partyId]); const { data } = useDataProvider< - Accounts_party_accounts[], - AccountSubscribe_accounts + AccountFieldsFragment[], + AccountFieldsFragment >({ dataProvider: accountsDataProvider, variables, diff --git a/libs/accounts/src/lib/index.ts b/libs/accounts/src/lib/index.ts index 867400896..0ace69825 100644 --- a/libs/accounts/src/lib/index.ts +++ b/libs/accounts/src/lib/index.ts @@ -1,6 +1,4 @@ export * from './__generated__/Accounts'; -export * from './__generated__/AccountFields'; -export * from './__generated__/AccountSubscribe'; export * from './accounts-container'; export * from './accounts-data-provider'; export * from './accounts-manager'; diff --git a/libs/assets/src/lib/__generated___/Assets.ts b/libs/assets/src/lib/__generated__/Assets.ts similarity index 97% rename from libs/assets/src/lib/__generated___/Assets.ts rename to libs/assets/src/lib/__generated__/Assets.ts index a59ce11a4..caf19cc76 100644 --- a/libs/assets/src/lib/__generated___/Assets.ts +++ b/libs/assets/src/lib/__generated__/Assets.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/assets/src/lib/__generated__/AssetsConnection.ts b/libs/assets/src/lib/__generated__/AssetsConnection.ts deleted file mode 100644 index 47a34d4c6..000000000 --- a/libs/assets/src/lib/__generated__/AssetsConnection.ts +++ /dev/null @@ -1,80 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL query operation: AssetsConnection -// ==================================================== - -export interface AssetsConnection_assetsConnection_edges_node_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface AssetsConnection_assetsConnection_edges_node_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; - /** - * The lifetime limits deposit per address - * Note: this is a temporary measure for alpha mainnet - */ - lifetimeLimit: string; - /** - * The maximum allowed per withdrawal - * Note: this is a temporary measure for alpha mainnet - */ - withdrawThreshold: string; -} - -export type AssetsConnection_assetsConnection_edges_node_source = AssetsConnection_assetsConnection_edges_node_source_BuiltinAsset | AssetsConnection_assetsConnection_edges_node_source_ERC20; - -export interface AssetsConnection_assetsConnection_edges_node { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The minimum economically meaningful amount in the asset - */ - quantum: string; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: AssetsConnection_assetsConnection_edges_node_source; -} - -export interface AssetsConnection_assetsConnection_edges { - __typename: "AssetEdge"; - node: AssetsConnection_assetsConnection_edges_node; -} - -export interface AssetsConnection_assetsConnection { - __typename: "AssetsConnection"; - /** - * The assets - */ - edges: (AssetsConnection_assetsConnection_edges | null)[] | null; -} - -export interface AssetsConnection { - /** - * The list of all assets in use in the Vega network or the specified asset if ID is provided - */ - assetsConnection: AssetsConnection_assetsConnection; -} diff --git a/libs/assets/src/lib/asset-details-dialog.spec.tsx b/libs/assets/src/lib/asset-details-dialog.spec.tsx index 574e65ccd..a060d9fa6 100644 --- a/libs/assets/src/lib/asset-details-dialog.spec.tsx +++ b/libs/assets/src/lib/asset-details-dialog.spec.tsx @@ -1,9 +1,7 @@ import { MockedProvider } from '@apollo/react-testing'; import { render, screen } from '@testing-library/react'; -import { - AssetDetailsDialog, - ASSETS_CONNECTION_QUERY, -} from './asset-details-dialog'; +import { AssetDetailsDialog } from './asset-details-dialog'; +import { AssetsConnectionDocument } from './__generated__/Assets'; const mockedData = { data: { @@ -275,7 +273,7 @@ const mockedData = { const mocks = [ { request: { - query: ASSETS_CONNECTION_QUERY, + query: AssetsConnectionDocument, variables: {}, }, result: mockedData, diff --git a/libs/assets/src/lib/asset-details-dialog.tsx b/libs/assets/src/lib/asset-details-dialog.tsx index 3650fd0ab..1bb4143b9 100644 --- a/libs/assets/src/lib/asset-details-dialog.tsx +++ b/libs/assets/src/lib/asset-details-dialog.tsx @@ -1,4 +1,3 @@ -import { gql, useQuery } from '@apollo/client'; import { t } from '@vegaprotocol/react-helpers'; import type { Asset } from '@vegaprotocol/react-helpers'; import { @@ -10,10 +9,8 @@ import { Splash, Tooltip, } from '@vegaprotocol/ui-toolkit'; -import type { - AssetsConnection, - AssetsConnection_assetsConnection_edges_node_source_ERC20, -} from './__generated__/AssetsConnection'; +import { useAssetsConnectionQuery } from './__generated__/Assets'; +import type { Schema } from '@vegaprotocol/types'; import create from 'zustand'; export type AssetDetailsDialogStore = { @@ -43,29 +40,6 @@ type AssetDetails = { tooltip: string; }[]; -export const ASSETS_CONNECTION_QUERY = gql` - query AssetsConnection { - assetsConnection { - edges { - node { - id - name - symbol - decimals - quantum - source { - ... on ERC20 { - contractAddress - lifetimeLimit - withdrawThreshold - } - } - } - } - } - } -`; - export interface AssetDetailsDialogProps { assetSymbol: string | Asset; open: boolean; @@ -77,7 +51,7 @@ export const AssetDetailsDialog = ({ open, onChange, }: AssetDetailsDialogProps) => { - const { data } = useQuery(ASSETS_CONNECTION_QUERY); + const { data } = useAssetsConnectionQuery(); const symbol = typeof assetSymbol === 'string' ? assetSymbol : assetSymbol.symbol; const asset = data?.assetsConnection.edges?.find( @@ -114,10 +88,7 @@ export const AssetDetailsDialog = ({ { key: 'contractaddress', label: t('Contract address'), - value: ( - asset.node - .source as AssetsConnection_assetsConnection_edges_node_source_ERC20 - ).contractAddress, + value: (asset.node.source as Schema.ERC20).contractAddress, tooltip: t( 'The address of the contract for the token, on the ethereum network' ), @@ -125,10 +96,7 @@ export const AssetDetailsDialog = ({ { key: 'withdrawalthreshold', label: t('Withdrawal threshold'), - value: ( - asset.node - .source as AssetsConnection_assetsConnection_edges_node_source_ERC20 - ).withdrawThreshold, + value: (asset.node.source as Schema.ERC20).withdrawThreshold, tooltip: t( 'The maximum allowed per withdraw note: this is a temporary measure for restricted mainnet' ), @@ -136,10 +104,7 @@ export const AssetDetailsDialog = ({ { key: 'lifetimelimit', label: t('Lifetime limit'), - value: ( - asset.node - .source as AssetsConnection_assetsConnection_edges_node_source_ERC20 - ).lifetimeLimit, + value: (asset.node.source as Schema.ERC20).lifetimeLimit, tooltip: t( 'The lifetime limits deposit per address note: this is a temporary measure for restricted mainnet' ), diff --git a/libs/assets/src/lib/index.ts b/libs/assets/src/lib/index.ts index 513d2726b..e2f715fbc 100644 --- a/libs/assets/src/lib/index.ts +++ b/libs/assets/src/lib/index.ts @@ -1,2 +1,2 @@ -export * from './__generated__/AssetsConnection'; +export * from './__generated__/Assets'; export * from './asset-details-dialog'; diff --git a/libs/candles-chart/src/lib/Candles.graphql b/libs/candles-chart/src/lib/Candles.graphql index 931453460..a53432b74 100644 --- a/libs/candles-chart/src/lib/Candles.graphql +++ b/libs/candles-chart/src/lib/Candles.graphql @@ -24,7 +24,7 @@ query Candles($marketId: ID!, $interval: Interval!, $since: String!) { } } -subscription CandlesSub($marketId: ID!, $interval: Interval!) { +subscription CandlesEvents($marketId: ID!, $interval: Interval!) { candles(marketId: $marketId, interval: $interval) { ...CandleFields } diff --git a/libs/candles-chart/src/lib/__generated__/CandleFields.ts b/libs/candles-chart/src/lib/__generated__/CandleFields.ts deleted file mode 100644 index 9e22fdcdc..000000000 --- a/libs/candles-chart/src/lib/__generated__/CandleFields.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL fragment: CandleFields -// ==================================================== - -export interface CandleFields { - __typename: "Candle"; - /** - * RFC3339Nano formatted date and time for the candle - */ - datetime: string; - /** - * High price (uint64) - */ - high: string; - /** - * Low price (uint64) - */ - low: string; - /** - * Open price (uint64) - */ - open: string; - /** - * Close price (uint64) - */ - close: string; - /** - * Volume price (uint64) - */ - volume: string; -} diff --git a/libs/candles-chart/src/lib/__generated__/Candles.ts b/libs/candles-chart/src/lib/__generated__/Candles.ts index 21f13dcbc..6762edcd5 100644 --- a/libs/candles-chart/src/lib/__generated__/Candles.ts +++ b/libs/candles-chart/src/lib/__generated__/Candles.ts @@ -1,108 +1,113 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. +import { Schema as Types } from '@vegaprotocol/types'; -import { Interval } from "@vegaprotocol/types"; +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string }; -// ==================================================== -// GraphQL query operation: Candles -// ==================================================== +export type CandlesQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; + since: Types.Scalars['String']; +}>; -export interface Candles_market_tradableInstrument_instrument { - __typename: "Instrument"; - /** - * Uniquely identify an instrument across all instruments available on Vega (string) - */ - id: string; - /** - * Full and fairly descriptive name for the instrument - */ - name: string; - /** - * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) - */ - code: string; + +export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null }; + +export type CandlesEventsSubscriptionVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; + interval: Types.Interval; +}>; + + +export type CandlesEventsSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } }; + +export const CandleFieldsFragmentDoc = gql` + fragment CandleFields on Candle { + datetime + high + low + open + close + volume } - -export interface Candles_market_tradableInstrument { - __typename: "TradableInstrument"; - /** - * An instance of, or reference to, a fully specified instrument. - */ - instrument: Candles_market_tradableInstrument_instrument; + `; +export const CandlesDocument = gql` + query Candles($marketId: ID!, $interval: Interval!, $since: String!) { + market(id: $marketId) { + id + decimalPlaces + tradableInstrument { + instrument { + id + name + code + } + } + candles(interval: $interval, since: $since) { + ...CandleFields + } + } } + ${CandleFieldsFragmentDoc}`; -export interface Candles_market_candles { - __typename: "Candle"; - /** - * RFC3339Nano formatted date and time for the candle - */ - datetime: string; - /** - * High price (uint64) - */ - high: string; - /** - * Low price (uint64) - */ - low: string; - /** - * Open price (uint64) - */ - open: string; - /** - * Close price (uint64) - */ - close: string; - /** - * Volume price (uint64) - */ - volume: string; +/** + * __useCandlesQuery__ + * + * To run a query within a React component, call `useCandlesQuery` and pass it any options that fit your needs. + * When your component renders, `useCandlesQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useCandlesQuery({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * since: // value for 'since' + * }, + * }); + */ +export function useCandlesQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(CandlesDocument, options); + } +export function useCandlesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(CandlesDocument, options); + } +export type CandlesQueryHookResult = ReturnType; +export type CandlesLazyQueryHookResult = ReturnType; +export type CandlesQueryResult = Apollo.QueryResult; +export const CandlesEventsDocument = gql` + subscription CandlesEvents($marketId: ID!, $interval: Interval!) { + candles(marketId: $marketId, interval: $interval) { + ...CandleFields + } } + ${CandleFieldsFragmentDoc}`; -export interface Candles_market { - __typename: "Market"; - /** - * Market ID - */ - id: 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; - /** - * An instance of, or reference to, a tradable instrument. - */ - tradableInstrument: Candles_market_tradableInstrument; - /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters - */ - candles: (Candles_market_candles | null)[] | null; -} - -export interface Candles { - /** - * An instrument that is trading on the Vega network - */ - market: Candles_market | null; -} - -export interface CandlesVariables { - marketId: string; - interval: Interval; - since: string; -} +/** + * __useCandlesEventsSubscription__ + * + * To run a query within a React component, call `useCandlesEventsSubscription` and pass it any options that fit your needs. + * When your component renders, `useCandlesEventsSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useCandlesEventsSubscription({ + * variables: { + * marketId: // value for 'marketId' + * interval: // value for 'interval' + * }, + * }); + */ +export function useCandlesEventsSubscription(baseOptions: Apollo.SubscriptionHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useSubscription(CandlesEventsDocument, options); + } +export type CandlesEventsSubscriptionHookResult = ReturnType; +export type CandlesEventsSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/__generated__/CandlesSub.ts b/libs/candles-chart/src/lib/__generated__/CandlesSub.ts deleted file mode 100644 index e81470f4c..000000000 --- a/libs/candles-chart/src/lib/__generated__/CandlesSub.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { Interval } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL subscription operation: CandlesSub -// ==================================================== - -export interface CandlesSub_candles { - __typename: "Candle"; - /** - * RFC3339Nano formatted date and time for the candle - */ - datetime: string; - /** - * High price (uint64) - */ - high: string; - /** - * Low price (uint64) - */ - low: string; - /** - * Open price (uint64) - */ - open: string; - /** - * Close price (uint64) - */ - close: string; - /** - * Volume price (uint64) - */ - volume: string; -} - -export interface CandlesSub { - /** - * Subscribe to the candles updates - */ - candles: CandlesSub_candles; -} - -export interface CandlesSubVariables { - marketId: string; - interval: Interval; -} diff --git a/libs/candles-chart/src/lib/__generated__/Chart.ts b/libs/candles-chart/src/lib/__generated__/Chart.ts index e7dbd0c80..fec36dd6f 100644 --- a/libs/candles-chart/src/lib/__generated__/Chart.ts +++ b/libs/candles-chart/src/lib/__generated__/Chart.ts @@ -1,68 +1,55 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. +import { Schema as Types } from '@vegaprotocol/types'; -// ==================================================== -// GraphQL query operation: Chart -// ==================================================== +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ChartQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; -export interface Chart_market_data_priceMonitoringBounds { - __typename: "PriceMonitoringBounds"; - /** - * Minimum price that isn't currently breaching the specified price monitoring trigger - */ - minValidPrice: string; - /** - * Maximum price that isn't currently breaching the specified price monitoring trigger - */ - maxValidPrice: string; - /** - * Reference price used to calculate the valid price range - */ - referencePrice: string; + +export type ChartQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string }> | null } | null } | null }; + + +export const ChartDocument = gql` + query Chart($marketId: ID!) { + market(id: $marketId) { + decimalPlaces + data { + priceMonitoringBounds { + minValidPrice + maxValidPrice + referencePrice + } + } + } } + `; -export interface Chart_market_data { - __typename: "MarketData"; - /** - * a list of valid price ranges per associated trigger - */ - priceMonitoringBounds: Chart_market_data_priceMonitoringBounds[] | null; -} - -export interface Chart_market { - __typename: "Market"; - /** - * 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; - /** - * marketData for the given market - */ - data: Chart_market_data | null; -} - -export interface Chart { - /** - * An instrument that is trading on the Vega network - */ - market: Chart_market | null; -} - -export interface ChartVariables { - marketId: string; -} +/** + * __useChartQuery__ + * + * To run a query within a React component, call `useChartQuery` and pass it any options that fit your needs. + * When your component renders, `useChartQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useChartQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useChartQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(ChartDocument, options); + } +export function useChartLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(ChartDocument, options); + } +export type ChartQueryHookResult = ReturnType; +export type ChartLazyQueryHookResult = ReturnType; +export type ChartQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/__generated___/Candles.ts b/libs/candles-chart/src/lib/__generated___/Candles.ts deleted file mode 100644 index bceb3114d..000000000 --- a/libs/candles-chart/src/lib/__generated___/Candles.ts +++ /dev/null @@ -1,113 +0,0 @@ -import * as Types from '@vegaprotocol/types/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type CandleFieldsFragment = { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string }; - -export type CandlesQueryVariables = Types.Exact<{ - marketId: Types.Scalars['ID']; - interval: Types.Interval; - since: Types.Scalars['String']; -}>; - - -export type CandlesQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string } }, candles?: Array<{ __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } | null> | null } | null }; - -export type CandlesSubSubscriptionVariables = Types.Exact<{ - marketId: Types.Scalars['ID']; - interval: Types.Interval; -}>; - - -export type CandlesSubSubscription = { __typename?: 'Subscription', candles: { __typename?: 'Candle', datetime: string, high: string, low: string, open: string, close: string, volume: string } }; - -export const CandleFieldsFragmentDoc = gql` - fragment CandleFields on Candle { - datetime - high - low - open - close - volume -} - `; -export const CandlesDocument = gql` - query Candles($marketId: ID!, $interval: Interval!, $since: String!) { - market(id: $marketId) { - id - decimalPlaces - tradableInstrument { - instrument { - id - name - code - } - } - candles(interval: $interval, since: $since) { - ...CandleFields - } - } -} - ${CandleFieldsFragmentDoc}`; - -/** - * __useCandlesQuery__ - * - * To run a query within a React component, call `useCandlesQuery` and pass it any options that fit your needs. - * When your component renders, `useCandlesQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useCandlesQuery({ - * variables: { - * marketId: // value for 'marketId' - * interval: // value for 'interval' - * since: // value for 'since' - * }, - * }); - */ -export function useCandlesQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(CandlesDocument, options); - } -export function useCandlesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(CandlesDocument, options); - } -export type CandlesQueryHookResult = ReturnType; -export type CandlesLazyQueryHookResult = ReturnType; -export type CandlesQueryResult = Apollo.QueryResult; -export const CandlesSubDocument = gql` - subscription CandlesSub($marketId: ID!, $interval: Interval!) { - candles(marketId: $marketId, interval: $interval) { - ...CandleFields - } -} - ${CandleFieldsFragmentDoc}`; - -/** - * __useCandlesSubSubscription__ - * - * To run a query within a React component, call `useCandlesSubSubscription` and pass it any options that fit your needs. - * When your component renders, `useCandlesSubSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useCandlesSubSubscription({ - * variables: { - * marketId: // value for 'marketId' - * interval: // value for 'interval' - * }, - * }); - */ -export function useCandlesSubSubscription(baseOptions: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(CandlesSubDocument, options); - } -export type CandlesSubSubscriptionHookResult = ReturnType; -export type CandlesSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/__generated___/Chart.ts b/libs/candles-chart/src/lib/__generated___/Chart.ts deleted file mode 100644 index 4e1b09874..000000000 --- a/libs/candles-chart/src/lib/__generated___/Chart.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as Types from '@vegaprotocol/types/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ChartQueryVariables = Types.Exact<{ - marketId: Types.Scalars['ID']; -}>; - - -export type ChartQuery = { __typename?: 'Query', market?: { __typename?: 'Market', decimalPlaces: number, data?: { __typename?: 'MarketData', priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string }> | null } | null } | null }; - - -export const ChartDocument = gql` - query Chart($marketId: ID!) { - market(id: $marketId) { - decimalPlaces - data { - priceMonitoringBounds { - minValidPrice - maxValidPrice - referencePrice - } - } - } -} - `; - -/** - * __useChartQuery__ - * - * To run a query within a React component, call `useChartQuery` and pass it any options that fit your needs. - * When your component renders, `useChartQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useChartQuery({ - * variables: { - * marketId: // value for 'marketId' - * }, - * }); - */ -export function useChartQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ChartDocument, options); - } -export function useChartLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ChartDocument, options); - } -export type ChartQueryHookResult = ReturnType; -export type ChartLazyQueryHookResult = ReturnType; -export type ChartQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/candles-chart/src/lib/data-source.ts b/libs/candles-chart/src/lib/data-source.ts index 84095bd56..df3d7bec6 100644 --- a/libs/candles-chart/src/lib/data-source.ts +++ b/libs/candles-chart/src/lib/data-source.ts @@ -1,16 +1,21 @@ import type { ApolloClient } from '@apollo/client'; -import { gql } from '@apollo/client'; import type { Candle, DataSource } from 'pennant'; import { Interval as PennantInterval } from 'pennant'; import { addDecimal } from '@vegaprotocol/react-helpers'; -import type { Chart, ChartVariables } from './__generated__/Chart'; -import type { Candles, CandlesVariables } from './__generated__/Candles'; -import type { CandleFields } from './__generated__/CandleFields'; +import { ChartDocument } from './__generated__/Chart'; +import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart'; +import { + CandlesDocument, + CandlesEventsDocument, +} from './__generated__/Candles'; import type { - CandlesSub, - CandlesSubVariables, -} from './__generated__/CandlesSub'; + CandlesQuery, + CandlesQueryVariables, + CandleFieldsFragment, + CandlesEventsSubscription, + CandlesEventsSubscriptionVariables, +} from './__generated__/Candles'; import type { Subscription } from 'zen-observable-ts'; import { Interval } from '@vegaprotocol/types'; @@ -23,61 +28,6 @@ const INTERVAL_TO_PENNANT_MAP = { [PennantInterval.I1D]: Interval.INTERVAL_I1D, }; -export const CANDLE_FRAGMENT = gql` - fragment CandleFields on Candle { - datetime - high - low - open - close - volume - } -`; - -export const CANDLES_QUERY = gql` - ${CANDLE_FRAGMENT} - query Candles($marketId: ID!, $interval: Interval!, $since: String!) { - market(id: $marketId) { - id - decimalPlaces - tradableInstrument { - instrument { - id - name - code - } - } - candles(interval: $interval, since: $since) { - ...CandleFields - } - } - } -`; - -export const CANDLES_SUB = gql` - ${CANDLE_FRAGMENT} - subscription CandlesSub($marketId: ID!, $interval: Interval!) { - candles(marketId: $marketId, interval: $interval) { - ...CandleFields - } - } -`; - -const CHART_QUERY = gql` - query Chart($marketId: ID!) { - market(id: $marketId) { - decimalPlaces - data { - priceMonitoringBounds { - minValidPrice - maxValidPrice - referencePrice - } - } - } - } -`; - const defaultConfig = { decimalPlaces: 5, supportedIntervals: [ @@ -131,13 +81,15 @@ export class VegaDataSource implements DataSource { */ async onReady() { try { - const { data } = await this.client.query({ - query: CHART_QUERY, - variables: { - marketId: this.marketId, - }, - fetchPolicy: 'no-cache', - }); + const { data } = await this.client.query( + { + query: ChartDocument, + variables: { + marketId: this.marketId, + }, + fetchPolicy: 'no-cache', + } + ); if (data && data.market && data.market.data) { this._decimalPlaces = data.market.decimalPlaces; @@ -178,8 +130,11 @@ export class VegaDataSource implements DataSource { */ async query(interval: PennantInterval, from: string) { try { - const { data } = await this.client.query({ - query: CANDLES_QUERY, + const { data } = await this.client.query< + CandlesQuery, + CandlesQueryVariables + >({ + query: CandlesDocument, variables: { marketId: this.marketId, interval: INTERVAL_TO_PENNANT_MAP[interval], @@ -192,7 +147,7 @@ export class VegaDataSource implements DataSource { const decimalPlaces = data.market.decimalPlaces; const candles = data.market.candles - .filter((d): d is CandleFields => d !== null) + .filter((d): d is CandleFieldsFragment => d !== null) .map((d) => parseCandle(d, decimalPlaces)); return candles; @@ -211,8 +166,11 @@ export class VegaDataSource implements DataSource { interval: PennantInterval, onSubscriptionData: (data: Candle) => void ) { - const res = this.client.subscribe({ - query: CANDLES_SUB, + const res = this.client.subscribe< + CandlesEventsSubscription, + CandlesEventsSubscriptionVariables + >({ + query: CandlesEventsDocument, variables: { marketId: this.marketId, interval: INTERVAL_TO_PENNANT_MAP[interval], @@ -236,7 +194,10 @@ export class VegaDataSource implements DataSource { } } -function parseCandle(candle: CandleFields, decimalPlaces: number): Candle { +function parseCandle( + candle: CandleFieldsFragment, + decimalPlaces: number +): Candle { return { date: new Date(candle.datetime), high: Number(addDecimal(candle.high, decimalPlaces)), diff --git a/libs/candles-chart/src/lib/index.ts b/libs/candles-chart/src/lib/index.ts index 97c2a33d3..fec9df1f3 100644 --- a/libs/candles-chart/src/lib/index.ts +++ b/libs/candles-chart/src/lib/index.ts @@ -1,6 +1,4 @@ -export * from './__generated__/CandleFields'; export * from './__generated__/Candles'; -export * from './__generated__/CandlesSub'; export * from './__generated__/Chart'; export * from './candles-chart'; export * from './data-source'; diff --git a/libs/deal-ticket/src/components/__generated___/DealTicket.ts b/libs/deal-ticket/src/components/__generated___/DealTicket.ts index 72baee372..42c386716 100644 --- a/libs/deal-ticket/src/components/__generated___/DealTicket.ts +++ b/libs/deal-ticket/src/components/__generated___/DealTicket.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts index db4847f58..03a931d63 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketInfo.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketInfo.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/deal-ticket/src/components/__generated___/MarketNames.ts b/libs/deal-ticket/src/components/__generated___/MarketNames.ts index edd97bfea..99a191096 100644 --- a/libs/deal-ticket/src/components/__generated___/MarketNames.ts +++ b/libs/deal-ticket/src/components/__generated___/MarketNames.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts index b564c331d..ad7030fd3 100644 --- a/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts +++ b/libs/deal-ticket/src/components/market-info/__generated__/MarketInfoQuery.ts @@ -462,14 +462,14 @@ export interface MarketInfoQuery_market { /** * 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 ) diff --git a/libs/deposits/src/lib/__generated___/Deposit.ts b/libs/deposits/src/lib/__generated___/Deposit.ts index ab1a3f633..dce3d6cb8 100644 --- a/libs/deposits/src/lib/__generated___/Deposit.ts +++ b/libs/deposits/src/lib/__generated___/Deposit.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/fills/src/lib/__generated___/Fills.ts b/libs/fills/src/lib/__generated___/Fills.ts index abceb245c..b0011f312 100644 --- a/libs/fills/src/lib/__generated___/Fills.ts +++ b/libs/fills/src/lib/__generated___/Fills.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts b/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts index b13a16f80..c44106b99 100644 --- a/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts +++ b/libs/governance/src/lib/proposals-hooks/__generated___/Proposal.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/market-depth/src/lib/__generated___/MarketDepth.ts b/libs/market-depth/src/lib/__generated___/MarketDepth.ts index 48a8e2f14..3882a9523 100644 --- a/libs/market-depth/src/lib/__generated___/MarketDepth.ts +++ b/libs/market-depth/src/lib/__generated___/MarketDepth.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/market-list/src/lib/__generated___/MarketData.ts b/libs/market-list/src/lib/__generated___/MarketData.ts index 21a5964ac..6a5677a0a 100644 --- a/libs/market-list/src/lib/__generated___/MarketData.ts +++ b/libs/market-list/src/lib/__generated___/MarketData.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts b/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts index a629ad1c3..2d8764e28 100644 --- a/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts +++ b/libs/network-stats/src/components/stats-manager/__generated___/Stats.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/orders/src/lib/order-hooks/__generated___/Orders.ts b/libs/orders/src/lib/order-hooks/__generated___/Orders.ts index 37417d7a9..a332890b3 100644 --- a/libs/orders/src/lib/order-hooks/__generated___/Orders.ts +++ b/libs/orders/src/lib/order-hooks/__generated___/Orders.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/positions/src/lib/__generated___/Positions.ts b/libs/positions/src/lib/__generated___/Positions.ts index 402816484..c950d3307 100644 --- a/libs/positions/src/lib/__generated___/Positions.ts +++ b/libs/positions/src/lib/__generated___/Positions.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index 67efe22d3..79f40919e 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -1,9 +1,9 @@ import { AccountType, MarketTradingMode } from '@vegaprotocol/types'; -import type { Accounts } from '@vegaprotocol/accounts'; +import type { AccountsQuery } from '@vegaprotocol/accounts'; import type { Positions } from './__generated__/Positions'; import { getMetrics } from './positions-data-providers'; -const accounts: Accounts = { +const accounts: AccountsQuery = { party: { __typename: 'Party', id: '02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65', diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index 513423482..8a93880cd 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -2,7 +2,7 @@ import { gql } from '@apollo/client'; import produce from 'immer'; import BigNumber from 'bignumber.js'; import sortBy from 'lodash/sortBy'; -import type { Accounts_party_accounts } from '@vegaprotocol/accounts'; +import type { AccountFieldsFragment } from '@vegaprotocol/accounts'; import { accountsDataProvider } from '@vegaprotocol/accounts'; import { toBigNum } from '@vegaprotocol/react-helpers'; import type { Positions, Positions_party } from './__generated__/Positions'; @@ -117,7 +117,7 @@ export const POSITIONS_SUBSCRIPTION = gql` export const getMetrics = ( data: Positions_party | null, - accounts: Accounts_party_accounts[] | null + accounts: AccountFieldsFragment[] | null ): Position[] => { if (!data || !data?.positionsConnection.edges) { return []; @@ -272,7 +272,7 @@ export const positionsMetricsDataProvider = makeDerivedDataProvider( return sortBy( getMetrics( positions as Positions_party | null, - accounts as Accounts_party_accounts[] | null + accounts as AccountFieldsFragment[] | null ), 'updatedAt' ).reverse(); diff --git a/libs/trades/src/lib/__generated___/Trades.ts b/libs/trades/src/lib/__generated___/Trades.ts index 9bc466259..c6fcca571 100644 --- a/libs/trades/src/lib/__generated___/Trades.ts +++ b/libs/trades/src/lib/__generated___/Trades.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/types/apollo.config.js b/libs/types/apollo.config.js index 7f306cb72..92fa4866a 100644 --- a/libs/types/apollo.config.js +++ b/libs/types/apollo.config.js @@ -11,6 +11,12 @@ module.exports = { '../../apps/token/client.graphql', '../../apps/trading/client.graphql', ], - excludes: ['**/generic-data-provider.ts', '**/__generated___/*'], + excludes: [ + '**/generic-data-provider.ts', + '**/__generated___/*', + '../../libs/accounts/**', + '../../libs/assets/**', + '../../libs/candles-chart/**', + ], }, }; diff --git a/libs/types/codegen.yml b/libs/types/codegen.yml index 527db3252..851a6b7db 100644 --- a/libs/types/codegen.yml +++ b/libs/types/codegen.yml @@ -9,21 +9,21 @@ config: generates: libs/types/src/__generated__/types.ts: - typescript - libs/**/__generated__: + libs/**: preset: near-operation-file presetConfig: folder: __generated___ extension: .ts - baseTypesPath: ~@vegaprotocol/types/types + baseTypesPath: ~@vegaprotocol/types plugins: - typescript-operations - typescript-react-apollo - apps/**/__generated__: + apps/**: preset: near-operation-file presetConfig: folder: __generated___ extension: .ts - baseTypesPath: ~@vegaprotocol/types/types + baseTypesPath: ~@vegaprotocol/types plugins: - typescript-operations - typescript-react-apollo diff --git a/libs/types/fix-imports.js b/libs/types/fix-imports.js index fa62b5517..1daea5b2e 100644 --- a/libs/types/fix-imports.js +++ b/libs/types/fix-imports.js @@ -1,6 +1,66 @@ +const fs = require('fs'); +const path = require('path'); +const glob = require('glob'); const replace = require('replace-in-file'); -replace({ - files: '{apps,libs}/**/__generated__/*.ts', - from: /"[^"]*\/types\/src\/__generated__\/globalTypes"/g, - to: '"@vegaprotocol/types"', +const apolloConfig = require('./apollo.config'); + +Promise.all([ + replace({ + files: '{apps,libs}/**/__generated__/*.ts', + from: /"[^"]*\/types\/src\/__generated__\/globalTypes"/g, + to: '"@vegaprotocol/types"', + }), + replace({ + files: '{apps,libs}/**/__generated___/*.ts', + from: 'import * as Types', + to: 'import { Schema as Types }', + }), + replace({ + files: '{apps,libs}/**/__generated__/*.ts', + from: 'import * as Types', + to: 'import { Schema as Types }', + }), +]).then(() => { + // @TODO: remove this temporary cleanup ugliness below once all libs and apps are migrated from the old apollo codegen + const MIGRATED_TO_NEW_CODEGEN = apolloConfig.client.excludes.reduce( + (acc, ignoredPath) => { + if ( + ignoredPath.startsWith('../../libs/') || + ignoredPath.startsWith('../../apps/') + ) { + acc.push(path.join(__dirname, ignoredPath.replace('/**', ''))); + } + return acc; + }, + [] + ); + + // @TODO: remove also + MIGRATED_TO_NEW_CODEGEN.forEach((packagePath) => { + glob(path.join(packagePath, '**', '__generated___'), (err, matches) => { + matches.forEach((match) => { + console.log(`Handling ${match}...`); + const oldTypesFolder = match.replace('__generated___', '__generated__'); + if (fs.existsSync(oldTypesFolder)) { + console.log(`Found ${oldTypesFolder}...`); + try { + fs.rmSync(oldTypesFolder, { + force: true, + recursive: true, + }); + console.log(`Removed ${oldTypesFolder}...`); + } catch (err) { + console.error(`Error removing ${oldTypesFolder}.`); + } + + try { + fs.renameSync(match, oldTypesFolder); + console.log(`Renamed ${match} to ${oldTypesFolder}...`); + } catch (err) { + console.error(`Error renaming ${match} to ${oldTypesFolder}.`); + } + } + }); + }); + }); }); diff --git a/libs/web3/src/lib/__generated___/NetworkParams.ts b/libs/web3/src/lib/__generated___/NetworkParams.ts index 1f15fb4cc..bf9bbd4dd 100644 --- a/libs/web3/src/lib/__generated___/NetworkParams.ts +++ b/libs/web3/src/lib/__generated___/NetworkParams.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/withdraws/src/lib/__generated___/Erc20Approval.ts b/libs/withdraws/src/lib/__generated___/Erc20Approval.ts index 9cd9eb0c0..f919d989a 100644 --- a/libs/withdraws/src/lib/__generated___/Erc20Approval.ts +++ b/libs/withdraws/src/lib/__generated___/Erc20Approval.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/withdraws/src/lib/__generated___/Withdraw.ts b/libs/withdraws/src/lib/__generated___/Withdraw.ts index 73ff97211..8d9c1be3a 100644 --- a/libs/withdraws/src/lib/__generated___/Withdraw.ts +++ b/libs/withdraws/src/lib/__generated___/Withdraw.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/withdraws/src/lib/__generated___/Withdrawal.ts b/libs/withdraws/src/lib/__generated___/Withdrawal.ts index 60c8c3b48..584b15205 100644 --- a/libs/withdraws/src/lib/__generated___/Withdrawal.ts +++ b/libs/withdraws/src/lib/__generated___/Withdrawal.ts @@ -1,4 +1,4 @@ -import * as Types from '@vegaprotocol/types/types'; +import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; diff --git a/libs/withdraws/src/lib/use-create-withdraw.spec.tsx b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx index 94f1c5101..cb2db36e1 100644 --- a/libs/withdraws/src/lib/use-create-withdraw.spec.tsx +++ b/libs/withdraws/src/lib/use-create-withdraw.spec.tsx @@ -20,7 +20,7 @@ import type { } from './__generated__/WithdrawalEvent'; import { WITHDRAWAL_BUS_EVENT_SUB } from './use-withdrawals'; import { WithdrawalStatus } from '@vegaprotocol/types'; -import { AssetStatus } from '@vegaprotocol/types/types'; +import { Schema } from '@vegaprotocol/types'; function setup( vegaWalletContext: Partial, @@ -74,7 +74,7 @@ beforeEach(() => { name: 'asset-name', symbol: 'asset-symbol', decimals: 2, - status: AssetStatus.STATUS_ENABLED, + status: Schema.AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', diff --git a/package.json b/package.json index f80fc1a1e..30e2bc36e 100644 --- a/package.json +++ b/package.json @@ -153,7 +153,7 @@ "eslint-plugin-react-hooks": "4.6.0", "eslint-plugin-unicorn": "^41.0.0", "faker": "^5.5.3", - "glob": "^8.0.1", + "glob": "^8.0.3", "husky": "^7.0.4", "jest": "27.5.1", "jest-canvas-mock": "^2.3.1", diff --git a/tsconfig.base.json b/tsconfig.base.json index 860b2e449..395b4e40f 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -39,7 +39,6 @@ ], "@vegaprotocol/trades": ["libs/trades/src/index.ts"], "@vegaprotocol/types": ["libs/types/src/index.ts"], - "@vegaprotocol/types/types": ["libs/types/src/__generated__/types.ts"], "@vegaprotocol/ui-toolkit": ["libs/ui-toolkit/src/index.ts"], "@vegaprotocol/wallet": ["libs/wallet/src/index.ts"], "@vegaprotocol/web3": ["libs/web3/src/index.ts"], diff --git a/yarn.lock b/yarn.lock index 166fe235d..4660c6250 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13280,7 +13280,7 @@ glob@^7.0.0, glob@^7.1.0, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, gl once "^1.3.0" path-is-absolute "^1.0.0" -glob@^8.0.0, glob@^8.0.1: +glob@^8.0.0, glob@^8.0.3: version "8.0.3" resolved "https://registry.yarnpkg.com/glob/-/glob-8.0.3.tgz#415c6eb2deed9e502c68fa44a272e6da6eeca42e" integrity sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ== From 179d34ff4015b9b7e3a23f0931f740c3ae37f91e Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 9 Sep 2022 18:04:28 +0000 Subject: [PATCH 40/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 96 ++++++++++++++------ apps/static/src/assets/testnet-tranches.json | 2 +- 2 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 2e88a6bcc..8870c3109 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107106.412097865345751005", + "locked_amount": "107047.171675344052944855", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51662.8023021308963", + "locked_amount": "51626.81493531202814", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48283.6144773219922140612", + "locked_amount": "48225.5051413235871183606", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65995.36517221057900084935156", + "locked_amount": "65915.93974205910332905479198", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20312.082797186662140902", + "locked_amount": "20287.63720302668968039", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6611.385846698325276688", + "locked_amount": "6603.429043013683741289", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8559.2334692028972", + "locked_amount": "8518.5178894927548", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1411080.687954636552930414", + "locked_amount": "1409753.446239552848232968", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33375.58074803744025", + "locked_amount": "33317.9003434480625", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3201.503835749338563192367054605", + "locked_amount": "3162.4980783896310158443138564492", "deposits": [ { "amount": "2833.333333", @@ -22393,7 +22393,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2192841.05599999791868979098", + "locked_amount": "2190801.54758039959117220032", "deposits": [ { "amount": "1998.95815", @@ -23260,8 +23260,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "201205.7651020019737444", - "locked_amount": "13075361.1763641212118482748971176934022709", + "total_removed": "201710.4179168609783694", + "locked_amount": "13068129.2104571822338031640454040959164639", "deposits": [ { "amount": "16249.93", @@ -23765,6 +23765,11 @@ } ], "withdrawals": [ + { + "amount": "504.652814859004625", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xaa8f8f3648686e5e54cd714feec5dcbafd6c41cb2bc6fd62ef19466a74b11ab4" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24318,6 +24323,12 @@ } ], "withdrawals": [ + { + "amount": "504.652814859004625", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xaa8f8f3648686e5e54cd714feec5dcbafd6c41cb2bc6fd62ef19466a74b11ab4" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24776,8 +24787,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "45291.0196226656685", - "remaining_tokens": "214707.8678773343315" + "withdrawn_tokens": "45795.672437524673125", + "remaining_tokens": "214203.215062475326875" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26322,8 +26333,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2762126.087814295642620897", - "locked_amount": "6349644.724759691267047185120178365", + "total_removed": "2762827.055498977163929897", + "locked_amount": "6342968.22001094468759421075837003", "deposits": [ { "amount": "129284.449", @@ -26532,6 +26543,11 @@ } ], "withdrawals": [ + { + "amount": "700.967684681521309", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x90b39e5e04dcd5d2462bebe30b4439f85471a37ca0ee2f8f9b38662544591604" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28603,6 +28619,12 @@ } ], "withdrawals": [ + { + "amount": "700.967684681521309", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x90b39e5e04dcd5d2462bebe30b4439f85471a37ca0ee2f8f9b38662544591604" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30339,8 +30361,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "202226.4403374014707505", - "remaining_tokens": "156897.0292375985292495" + "withdrawn_tokens": "202927.4080220829920595", + "remaining_tokens": "156196.0615529170079405" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31427,8 +31449,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1738566.199331512609572207", - "locked_amount": "2191879.62954394284334771921716768", + "total_removed": "1751129.686339809105860354", + "locked_amount": "2189241.702138547850448479381566711", "deposits": [ { "amount": "552496.6455", @@ -31572,6 +31594,16 @@ } ], "withdrawals": [ + { + "amount": "6706.456487239706063047", + "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", + "tx": "0x16d7023014cfb5e7562d6f583c5354dd9f2988ca3a5766539acb3fa0652828bd" + }, + { + "amount": "5857.0305210567902251", + "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", + "tx": "0xb2b7e68756635897d3d0cc97221a6c9abedce9da7a431baeee6620f15125a7ae" + }, { "amount": "8456.402651116281081", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -32317,6 +32349,12 @@ } ], "withdrawals": [ + { + "amount": "5857.0305210567902251", + "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", + "tranche_id": 4, + "tx": "0xb2b7e68756635897d3d0cc97221a6c9abedce9da7a431baeee6620f15125a7ae" + }, { "amount": "3732.88753415684792995", "user": "0x6ae83EAB68b7112BaD5AfD72d6B24546AbFF137D", @@ -32361,8 +32399,8 @@ } ], "total_tokens": "92082.572555", - "withdrawn_tokens": "51310.4888289328312056", - "remaining_tokens": "40772.0837260671687944" + "withdrawn_tokens": "57167.5193499896214307", + "remaining_tokens": "34915.0532050103785693" }, { "address": "0x1dC9B91DE003fd503F25cB5d114cf0fc68F7aFe6", @@ -32390,6 +32428,12 @@ } ], "withdrawals": [ + { + "amount": "6706.456487239706063047", + "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", + "tranche_id": 4, + "tx": "0x16d7023014cfb5e7562d6f583c5354dd9f2988ca3a5766539acb3fa0652828bd" + }, { "amount": "22577.531268180478865098", "user": "0xC24da173A250e9Ca5c54870639EbE5f88be5102d", @@ -32452,8 +32496,8 @@ } ], "total_tokens": "460415.072915097", - "withdrawn_tokens": "279128.566868329684778032", - "remaining_tokens": "181286.506046767315221968" + "withdrawn_tokens": "285835.023355569390841079", + "remaining_tokens": "174580.049559527609158921" }, { "address": "0xd66e4853c0880df150e7329974715BFC8d2da47D", @@ -32837,7 +32881,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3189.60912820526", - "locked_amount": "347468.20013706781457981767732116", + "locked_amount": "347145.02836965533610813186605784", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 8e38b942f..7b5c7edfc 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "90.02473712582447720008913340309487572", + "locked_amount": "89.33369292237446040008844920091324204", "deposits": [ { "amount": "1000", From e3aa1e40c8f6f6892f7234f6953cf454245f76e8 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sat, 10 Sep 2022 00:11:11 +0000 Subject: [PATCH 41/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 47 ++++++++++++-------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 8870c3109..5272edba3 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "107047.171675344052944855", + "locked_amount": "106986.758854768598737785", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51626.81493531202814", + "locked_amount": "51590.115360223234", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48225.5051413235871183606", + "locked_amount": "48166.245792047871461058", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65915.93974205910332905479198", + "locked_amount": "65834.9424422990509271232384", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20287.63720302668968039", + "locked_amount": "20262.707818140617286594", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6603.429043013683741289", + "locked_amount": "6595.314770142292889071", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8518.5178894927548", + "locked_amount": "8476.99652777778", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1409753.446239552848232968", + "locked_amount": "1408399.937736726183439424", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33317.9003434480625", + "locked_amount": "33259.07841435185075", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3162.4980783896310158443138564492", + "locked_amount": "3122.7203772779449895740345022573", "deposits": [ { "amount": "2833.333333", @@ -22393,7 +22393,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2190801.54758039959117220032", + "locked_amount": "2188721.67625316507438633679", "deposits": [ { "amount": "1998.95815", @@ -23261,7 +23261,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "201710.4179168609783694", - "locked_amount": "13068129.2104571822338031640454040959164639", + "locked_amount": "13060754.1202713100774644489814991599459313", "deposits": [ { "amount": "16249.93", @@ -26334,7 +26334,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2762827.055498977163929897", - "locked_amount": "6342968.22001094468759421075837003", + "locked_amount": "6336159.58384174319240248675028352", "deposits": [ { "amount": "129284.449", @@ -31450,7 +31450,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2189241.702138547850448479381566711", + "locked_amount": "2186551.568809807904009451079430592", "deposits": [ { "amount": "552496.6455", @@ -32880,8 +32880,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "3189.60912820526", - "locked_amount": "347145.02836965533610813186605784", + "total_removed": "3216.01601557326", + "locked_amount": "346815.46086880359824156008726536", "deposits": [ { "amount": "3000", @@ -39505,6 +39505,11 @@ "user": "0x28FC83947F02f59Cb36b40f97f2D32BBC5D00585", "tx": "0xea18c5a1b637f62c07a366ee4622d008e932fdc1cbd0dc2283dc6e623f063381" }, + { + "amount": "26.406887368", + "user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A", + "tx": "0x4b4681ea3dedccd5e579f8f32e4d1a35456a1c354f6767d2528edc558034b29a" + }, { "amount": "44.069926432", "user": "0xfb393Ad714e8014947d9887912DfFB921E8aE74a", @@ -51691,6 +51696,12 @@ } ], "withdrawals": [ + { + "amount": "26.406887368", + "user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A", + "tranche_id": 5, + "tx": "0x4b4681ea3dedccd5e579f8f32e4d1a35456a1c354f6767d2528edc558034b29a" + }, { "amount": "19.736364788", "user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A", @@ -51711,8 +51722,8 @@ } ], "total_tokens": "400", - "withdrawn_tokens": "79.770915776", - "remaining_tokens": "320.229084224" + "withdrawn_tokens": "106.177803144", + "remaining_tokens": "293.822196856" }, { "address": "0x5c90765F50629570738fEe7b7FA82ae118f81Ed1", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 7b5c7edfc..4f8f5c2f9 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "89.33369292237446040008844920091324204", + "locked_amount": "88.62926147894471120008775174403855912", "deposits": [ { "amount": "1000", From 946ee9423b904f27ca937ebc21f03d504b8732ec Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sat, 10 Sep 2022 06:08:32 +0000 Subject: [PATCH 42/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 5272edba3..a6c5005b3 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106986.758854768598737785", + "locked_amount": "106927.886351074615692075", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51590.115360223234", + "locked_amount": "51554.35149670218292", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48166.245792047871461058", + "locked_amount": "48108.4973501458506206148", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65834.9424422990509271232384", + "locked_amount": "65756.010292071557512761666408", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20262.707818140617286594", + "locked_amount": "20238.41404589468966756", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6595.314770142292889071", + "locked_amount": "6587.407383017428490562", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8476.99652777778", + "locked_amount": "8436.5338164251202", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1408399.937736726183439424", + "locked_amount": "1407080.93899484531428502", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33259.07841435185075", + "locked_amount": "33201.75623993558525", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3122.7203772779449895740345022573", + "locked_amount": "3083.95686924555100146074707402382", "deposits": [ { "amount": "2833.333333", @@ -22393,7 +22393,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2188721.67625316507438633679", + "locked_amount": "2186694.8344134810128293718", "deposits": [ { "amount": "1998.95815", @@ -23261,7 +23261,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "201710.4179168609783694", - "locked_amount": "13060754.1202713100774644489814991599459313", + "locked_amount": "13053567.0692434752920521695059486326169235", "deposits": [ { "amount": "16249.93", @@ -26334,7 +26334,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2762827.055498977163929897", - "locked_amount": "6336159.58384174319240248675028352", + "locked_amount": "6329524.54422259887707934735448281", "deposits": [ { "amount": "129284.449", @@ -31450,7 +31450,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2186551.568809807904009451079430592", + "locked_amount": "2183930.024527898708099511072707652", "deposits": [ { "amount": "552496.6455", @@ -32881,7 +32881,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "346815.46086880359824156008726536", + "locked_amount": "346494.29619338375154517063115172", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 4f8f5c2f9..a4083ed5c 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "88.62926147894471120008775174403855912", + "locked_amount": "87.94241279807208330008707169583967533", "deposits": [ { "amount": "1000", From 85636250791ff08d8aa3d587dfd881043c81683d Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sat, 10 Sep 2022 12:05:08 +0000 Subject: [PATCH 43/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 64 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index a6c5005b3..754e740ac 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106927.886351074615692075", + "locked_amount": "106869.14289353646283107", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51554.35149670218292", + "locked_amount": "51518.6660261288669", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48108.4973501458506206148", + "locked_amount": "48050.8754905015242385134", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65756.010292071557512761666408", + "locked_amount": "65677.25115793682033446580208", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20238.41404589468966756", + "locked_amount": "20214.173524618613767178", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6587.407383017428490562", + "locked_amount": "6579.517328566517035584", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8436.5338164251202", + "locked_amount": "8396.1597977053125", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1407080.93899484531428502", + "locked_amount": "1405764.831445057659952194", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33201.75623993558525", + "locked_amount": "33144.55971341586575", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3083.95686924555100146074707402382", + "locked_amount": "3045.2783292607986349571660378786", "deposits": [ { "amount": "2833.333333", @@ -22393,7 +22393,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2186694.8344134810128293718", + "locked_amount": "2184672.43532943836340411684", "deposits": [ { "amount": "1998.95815", @@ -23260,8 +23260,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "201710.4179168609783694", - "locked_amount": "13053567.0692434752920521695059486326169235", + "total_removed": "202135.5618317277896194", + "locked_amount": "13046395.7719418913616094030102180279548526", "deposits": [ { "amount": "16249.93", @@ -23770,6 +23770,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xaa8f8f3648686e5e54cd714feec5dcbafd6c41cb2bc6fd62ef19466a74b11ab4" }, + { + "amount": "425.14391486681125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xc2f65321097ea346926566cb1b8dc49ecc68fd085a86316d5a6bb96408c21332" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24329,6 +24334,12 @@ "tranche_id": 2, "tx": "0xaa8f8f3648686e5e54cd714feec5dcbafd6c41cb2bc6fd62ef19466a74b11ab4" }, + { + "amount": "425.14391486681125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xc2f65321097ea346926566cb1b8dc49ecc68fd085a86316d5a6bb96408c21332" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24787,8 +24798,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "45795.672437524673125", - "remaining_tokens": "214203.215062475326875" + "withdrawn_tokens": "46220.816352391484375", + "remaining_tokens": "213778.071147608515625" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26333,8 +26344,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2762827.055498977163929897", - "locked_amount": "6329524.54422259887707934735448281", + "total_removed": "2763415.279437300044159397", + "locked_amount": "6322904.04834294339916679861818413", "deposits": [ { "amount": "129284.449", @@ -26548,6 +26559,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x90b39e5e04dcd5d2462bebe30b4439f85471a37ca0ee2f8f9b38662544591604" }, + { + "amount": "588.2239383228802295", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x774bb17750d10bb5c5222b6546f8d2cf224accd19753cb62fecbc74eba2221f7" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28625,6 +28641,12 @@ "tranche_id": 3, "tx": "0x90b39e5e04dcd5d2462bebe30b4439f85471a37ca0ee2f8f9b38662544591604" }, + { + "amount": "588.2239383228802295", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x774bb17750d10bb5c5222b6546f8d2cf224accd19753cb62fecbc74eba2221f7" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30361,8 +30383,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "202927.4080220829920595", - "remaining_tokens": "156196.0615529170079405" + "withdrawn_tokens": "203515.631960405872289", + "remaining_tokens": "155607.837614594127711" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31450,7 +31472,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2183930.024527898708099511072707652", + "locked_amount": "2181314.22656542070228176251753088", "deposits": [ { "amount": "552496.6455", @@ -32881,7 +32903,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "346494.29619338375154517063115172", + "locked_amount": "346173.83549799125229369303094872", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index a4083ed5c..6a66c8128 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "87.94241279807208330008707169583967533", + "locked_amount": "87.25716546169461710008639323313039071", "deposits": [ { "amount": "1000", From 8a9372c88a5cc6643a6cd3c859f90df19efa49b4 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sat, 10 Sep 2022 18:05:25 +0000 Subject: [PATCH 44/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 92 +++++++++++++++----- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 73 insertions(+), 21 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 754e740ac..7a0368366 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106869.14289353646283107", + "locked_amount": "106809.787153173786264135", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51518.6660261288669", + "locked_amount": "51482.60860603754916", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "48050.8754905015242385134", + "locked_amount": "47992.6530384430511736588", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65677.25115793682033446580208", + "locked_amount": "65597.67111765990711880824774", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20214.173524618613767178", + "locked_amount": "20189.680344485582669784", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6579.517328566517035584", + "locked_amount": "6571.545036109408087876", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8396.1597977053125", + "locked_amount": "8355.3649607487912", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1405764.831445057659952194", + "locked_amount": "1404435.006111507475932294", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33144.55971341586575", + "locked_amount": "33086.7670277274525", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3045.2783292607986349571660378786", + "locked_amount": "3006.19664300745419970965889902", "deposits": [ { "amount": "2833.333333", @@ -5892,7 +5892,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35944.000000000000000003", + "total_added": "35958.000000000000000003", "total_removed": "16836.50659367884", "locked_amount": "0", "deposits": [ @@ -5901,6 +5901,16 @@ "user": "0x9e02d57941833BB800cF0343b65A3D9dCa935b91", "tx": "0xff09c5e98e22a7b1d26e68f44124c6bfca8c49fb0a7c704ba309def7ac50f4be" }, + { + "amount": "12", + "user": "0xBdEF6D978a33cC8E7cf06E659dEd1487953355D2", + "tx": "0xf4cf2b397b085b21cbb4bc9213de71bb6fe310704e39e61b9bcb7b2b0602f2f4" + }, + { + "amount": "2", + "user": "0xEED071df0b6f8C4088b9CfD9f2ADE131C8591613", + "tx": "0x0d569e9b901099d43f017945635ad8c2b566ce2290abb2583b018e83df34642b" + }, { "amount": "15", "user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -12480,6 +12490,36 @@ "withdrawn_tokens": "0", "remaining_tokens": "20" }, + { + "address": "0xBdEF6D978a33cC8E7cf06E659dEd1487953355D2", + "deposits": [ + { + "amount": "12", + "user": "0xBdEF6D978a33cC8E7cf06E659dEd1487953355D2", + "tranche_id": 11, + "tx": "0xf4cf2b397b085b21cbb4bc9213de71bb6fe310704e39e61b9bcb7b2b0602f2f4" + } + ], + "withdrawals": [], + "total_tokens": "12", + "withdrawn_tokens": "0", + "remaining_tokens": "12" + }, + { + "address": "0xEED071df0b6f8C4088b9CfD9f2ADE131C8591613", + "deposits": [ + { + "amount": "2", + "user": "0xEED071df0b6f8C4088b9CfD9f2ADE131C8591613", + "tranche_id": 11, + "tx": "0x0d569e9b901099d43f017945635ad8c2b566ce2290abb2583b018e83df34642b" + } + ], + "withdrawals": [], + "total_tokens": "2", + "withdrawn_tokens": "0", + "remaining_tokens": "2" + }, { "address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", "deposits": [ @@ -22393,7 +22433,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2184672.43532943836340411684", + "locked_amount": "2182628.95678777722738472598", "deposits": [ { "amount": "1998.95815", @@ -23261,7 +23301,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "202135.5618317277896194", - "locked_amount": "13046395.7719418913616094030102180279548526", + "locked_amount": "13039149.7282370256486738011954249334049743", "deposits": [ { "amount": "16249.93", @@ -26345,7 +26385,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2763415.279437300044159397", - "locked_amount": "6322904.04834294339916679861818413", + "locked_amount": "6316214.547061037460996022100051826", "deposits": [ { "amount": "129284.449", @@ -31472,7 +31512,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2181314.22656542070228176251753088", + "locked_amount": "2178671.164151172540286783453365822", "deposits": [ { "amount": "552496.6455", @@ -32903,7 +32943,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "346173.83549799125229369303094872", + "locked_amount": "345850.0346420436802966699441908", "deposits": [ { "amount": "3000", @@ -59409,7 +59449,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "52919.8425587307989", + "total_removed": "53169.8425587307989", "locked_amount": "0", "deposits": [ { @@ -63634,6 +63674,11 @@ } ], "withdrawals": [ + { + "amount": "250", + "user": "0x1f2c5E955082614F062b5BaC23DB5C2d345A4701", + "tx": "0x25132ae8c2d9315e5810b2fb8fba4de7538d946a71f215e66ba0c6e8fbdbbeab" + }, { "amount": "50", "user": "0xd69d5334Ec0f1B762e869a42f6C2634238B3BE6A", @@ -73695,10 +73740,17 @@ "tx": "0x06dfa508f6d82e3ebfc0ff5f3deeab5e36f69c3258e2264b29d3bad4d075c808" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x1f2c5E955082614F062b5BaC23DB5C2d345A4701", + "tranche_id": 6, + "tx": "0x25132ae8c2d9315e5810b2fb8fba4de7538d946a71f215e66ba0c6e8fbdbbeab" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x40447e8eDee2F8D0088844E35Ff7aD2Bb5fCabfb", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 6a66c8128..86a12ab76 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "87.25716546169461710008639323313039071", + "locked_amount": "86.56500031709790530008570792110603753", "deposits": [ { "amount": "1000", From dc59f56a6f305693ce8f261b645a8dbb17f274da Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 11 Sep 2022 00:10:25 +0000 Subject: [PATCH 45/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 7a0368366..510767afc 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106809.787153173786264135", + "locked_amount": "106749.65988153892427415", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51482.60860603754916", + "locked_amount": "51446.0824961948224", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47992.6530384430511736588", + "locked_amount": "47933.6737860779686364532", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65597.67111765990711880824774", + "locked_amount": "65517.056662019966724854829072", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20189.680344485582669784", + "locked_amount": "20164.868791532796626846", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6571.545036109408087876", + "locked_amount": "6563.469116388889851848", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8355.3649607487912", + "locked_amount": "8314.0398550724625", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1404435.006111507475932294", + "locked_amount": "1403087.895140121875737182", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33086.7670277274525", + "locked_amount": "33028.223128019324", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "3006.19664300745419970965889902", + "locked_amount": "2966.6069562990607622459638991088", "deposits": [ { "amount": "2833.333333", @@ -22433,7 +22433,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2182628.95678777722738472598", + "locked_amount": "2180558.82171226724533822823", "deposits": [ { "amount": "1998.95815", @@ -23301,7 +23301,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "202135.5618317277896194", - "locked_amount": "13039149.7282370256486738011954249334049743", + "locked_amount": "13031809.1621746436968492206720125128534739", "deposits": [ { "amount": "16249.93", @@ -26385,7 +26385,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2763415.279437300044159397", - "locked_amount": "6316214.547061037460996022100051826", + "locked_amount": "6309437.78334220316962763591204331", "deposits": [ { "amount": "129284.449", @@ -31512,7 +31512,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2178671.164151172540286783453365822", + "locked_amount": "2175993.62382033538871293049082606", "deposits": [ { "amount": "552496.6455", @@ -32943,7 +32943,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "345850.0346420436802966699441908", + "locked_amount": "345522.00990593263769248172196852", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 86a12ab76..d033de7ec 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "86.56500031709790530008570792110603753", + "locked_amount": "85.86361142820902090008501347666159309", "deposits": [ { "amount": "1000", From 9f4bf97465da73fa0e52db232bf22cb49c3d1885 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 11 Sep 2022 06:06:37 +0000 Subject: [PATCH 46/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 510767afc..1fc6d5533 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106749.65988153892427415", + "locked_amount": "106690.979574247256163045", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51446.0824961948224", + "locked_amount": "51410.43538812785746", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47933.6737860779686364532", + "locked_amount": "47876.113870942714744656", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65517.056662019966724854829072", + "locked_amount": "65438.382195334887690632854956", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20164.868791532796626846", + "locked_amount": "20140.654329241968902606", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6563.469116388889851848", + "locked_amount": "6555.587543884803390525", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8314.0398550724625", + "locked_amount": "8273.7092391304335", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1403087.895140121875737182", + "locked_amount": "1401773.202429018213463084", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "33028.223128019324", + "locked_amount": "32971.088088768112", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2966.6069562990607622459638991088", + "locked_amount": "2927.9699964227258579095441629341", "deposits": [ { "amount": "2833.333333", @@ -22433,7 +22433,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2180558.82171226724533822823", + "locked_amount": "2178538.69126940361022603532", "deposits": [ { "amount": "1998.95815", @@ -23301,7 +23301,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "202135.5618317277896194", - "locked_amount": "13031809.1621746436968492206720125128534739", + "locked_amount": "13024645.9093290190342083572602558850851581", "deposits": [ { "amount": "16249.93", @@ -26385,7 +26385,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2763415.279437300044159397", - "locked_amount": "6309437.78334220316962763591204331", + "locked_amount": "6302824.71405292375909382338220376", "deposits": [ { "amount": "129284.449", @@ -31512,7 +31512,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2175993.62382033538871293049082606", + "locked_amount": "2173380.760148630993834522358710001", "deposits": [ { "amount": "552496.6455", @@ -32943,7 +32943,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "345522.00990593263769248172196852", + "locked_amount": "345201.89371140444034126039167936", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index d033de7ec..44934a1a1 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "85.86361142820902090008501347666159309", + "locked_amount": "85.17913273718920040008433577498731604", "deposits": [ { "amount": "1000", From e50afc64ffdfc17e222bce209d7ffbd5298e9f9a Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 11 Sep 2022 12:04:30 +0000 Subject: [PATCH 47/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 101 ++++++++++++++----- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 74 insertions(+), 29 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 1fc6d5533..3f464eae0 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106690.979574247256163045", + "locked_amount": "106632.01920934078220439", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51410.43538812785746", + "locked_amount": "51374.61815068493302", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47876.113870942714744656", + "locked_amount": "47818.279245375890613384", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65438.382195334887690632854956", + "locked_amount": "65359.33224691659546854795352", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20140.654329241968902606", + "locked_amount": "20116.32430101656881023", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6555.587543884803390525", + "locked_amount": "6547.668355790441558822", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8273.7092391304335", + "locked_amount": "8233.186141304349", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1401773.202429018213463084", + "locked_amount": "1400452.23521592472397015", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32971.088088768112", + "locked_amount": "32913.68036684782775", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2927.9699964227258579095441629341", + "locked_amount": "2889.1486378047049366506410274357", "deposits": [ { "amount": "2833.333333", @@ -5893,7 +5893,7 @@ "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", "total_added": "35958.000000000000000003", - "total_removed": "16836.50659367884", + "total_removed": "16846.07240291284", "locked_amount": "0", "deposits": [ { @@ -11863,6 +11863,11 @@ "user": "0x3f626D48C2a6104976A03009cFDB4A48F32fd282", "tx": "0x2d81729f37b9abefd460e8439566e1afd19b395ae58102a523dc192a4d57666a" }, + { + "amount": "9.565809234", + "user": "0x9a563fbC59C9058414f89172DA667B2b337215B1", + "tx": "0xb25834209752fdf0186cc3d71002fb315cf8dc16f70aad0efe6185d5d6f400b7" + }, { "amount": "13.82033422112", "user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F", @@ -19279,6 +19284,12 @@ } ], "withdrawals": [ + { + "amount": "9.565809234", + "user": "0x9a563fbC59C9058414f89172DA667B2b337215B1", + "tranche_id": 11, + "tx": "0xb25834209752fdf0186cc3d71002fb315cf8dc16f70aad0efe6185d5d6f400b7" + }, { "amount": "5.1102869736", "user": "0x9a563fbC59C9058414f89172DA667B2b337215B1", @@ -19293,8 +19304,8 @@ } ], "total_tokens": "20", - "withdrawn_tokens": "10.434190766", - "remaining_tokens": "9.565809234" + "withdrawn_tokens": "20", + "remaining_tokens": "0" }, { "address": "0xF1bfCb79a510faC196c4Da74009Ea67e0926b25f", @@ -22433,7 +22444,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2178538.69126940361022603532", + "locked_amount": "2176508.82457481506713762992", "deposits": [ { "amount": "1998.95815", @@ -23300,8 +23311,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "202135.5618317277896194", - "locked_amount": "13024645.9093290190342083572602558850851581", + "total_removed": "202560.7496734066439944", + "locked_amount": "13017448.1323599057540636308551067118978102", "deposits": [ { "amount": "16249.93", @@ -23815,6 +23826,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xc2f65321097ea346926566cb1b8dc49ecc68fd085a86316d5a6bb96408c21332" }, + { + "amount": "425.187841678854375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xa75ec8ccff824d09c109e9fdcd99aac9a0eb34562500cd450ed205d57ac8ae45" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24380,6 +24396,12 @@ "tranche_id": 2, "tx": "0xc2f65321097ea346926566cb1b8dc49ecc68fd085a86316d5a6bb96408c21332" }, + { + "amount": "425.187841678854375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xa75ec8ccff824d09c109e9fdcd99aac9a0eb34562500cd450ed205d57ac8ae45" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24838,8 +24860,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "46220.816352391484375", - "remaining_tokens": "213778.071147608515625" + "withdrawn_tokens": "46646.00419407033875", + "remaining_tokens": "213352.88330592966125" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26384,8 +26406,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2763415.279437300044159397", - "locked_amount": "6302824.71405292375909382338220376", + "total_removed": "2764004.789917496503347647", + "locked_amount": "6296179.772313277582667854371705213", "deposits": [ { "amount": "129284.449", @@ -26604,6 +26626,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x774bb17750d10bb5c5222b6546f8d2cf224accd19753cb62fecbc74eba2221f7" }, + { + "amount": "589.51048019645918825", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x6516c57ea0a2048d0ca87cbc0bee8a7a4fd0ec7a58bc7fbc33bf56e8fe02593d" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28687,6 +28714,12 @@ "tranche_id": 3, "tx": "0x774bb17750d10bb5c5222b6546f8d2cf224accd19753cb62fecbc74eba2221f7" }, + { + "amount": "589.51048019645918825", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x6516c57ea0a2048d0ca87cbc0bee8a7a4fd0ec7a58bc7fbc33bf56e8fe02593d" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30423,8 +30456,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "203515.631960405872289", - "remaining_tokens": "155607.837614594127711" + "withdrawn_tokens": "204105.14244060233147725", + "remaining_tokens": "155018.32713439766852275" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31512,7 +31545,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2173380.760148630993834522358710001", + "locked_amount": "2170755.303479024266347370184272009", "deposits": [ { "amount": "552496.6455", @@ -32943,7 +32976,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "345201.89371140444034126039167936", + "locked_amount": "344880.26470873256266083413698632", "deposits": [ { "amount": "3000", @@ -59449,7 +59482,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "53169.8425587307989", + "total_removed": "53419.8425587307989", "locked_amount": "0", "deposits": [ { @@ -63679,6 +63712,11 @@ "user": "0x1f2c5E955082614F062b5BaC23DB5C2d345A4701", "tx": "0x25132ae8c2d9315e5810b2fb8fba4de7538d946a71f215e66ba0c6e8fbdbbeab" }, + { + "amount": "250", + "user": "0x15908B3180e311a9499CeA6a72961FdAB10B0fAC", + "tx": "0x9e63b6aa30c9ba99f6baed25ebda205734c77f687426385a6ab51ddac5861bb2" + }, { "amount": "50", "user": "0xd69d5334Ec0f1B762e869a42f6C2634238B3BE6A", @@ -79946,10 +79984,17 @@ "tx": "0xe32a466fc780a0fb3fd84a804f622931ebfaf3f428bff0dc6d141270410e75f8" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0x15908B3180e311a9499CeA6a72961FdAB10B0fAC", + "tranche_id": 6, + "tx": "0x9e63b6aa30c9ba99f6baed25ebda205734c77f687426385a6ab51ddac5861bb2" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x48e589D7B3088E571c8D17C03736f482747AD1Ff", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 44934a1a1..4f10fdcbf 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "85.17913273718920040008433577498731604", + "locked_amount": "84.49119514205991870008365464865550487", "deposits": [ { "amount": "1000", From a34ea774884f8b14721f4d17606a7ef4c49d011d Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Sun, 11 Sep 2022 18:04:08 +0000 Subject: [PATCH 48/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 3f464eae0..0b2f90d88 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106632.01920934078220439", + "locked_amount": "106572.77329549371602865", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51374.61815068493302", + "locked_amount": "51338.6274479959412", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47818.279245375890613384", + "locked_amount": "47760.164522898438236994", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65359.33224691659546854795352", + "locked_amount": "65279.899454378187183282198648", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20116.32430101656881023", + "locked_amount": "20091.876440857875867024", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6547.668355790441558822", + "locked_amount": "6539.7108145452060276", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8233.186141304349", + "locked_amount": "8192.4667874396151", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1400452.23521592472397015", + "locked_amount": "1399124.870471390169878784", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32913.68036684782775", + "locked_amount": "32855.99461553945175", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2889.1486378047049366506410274357", + "locked_amount": "2850.1392647833914265851535376566", "deposits": [ { "amount": "2833.333333", @@ -22444,7 +22444,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2176508.82457481506713762992", + "locked_amount": "2174469.12710178462634175125", "deposits": [ { "amount": "1998.95815", @@ -23312,7 +23312,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "202560.7496734066439944", - "locked_amount": "13017448.1323599057540636308551067118978102", + "locked_amount": "13010215.496081637762791019815536932170857", "deposits": [ { "amount": "16249.93", @@ -26407,7 +26407,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2764004.789917496503347647", - "locked_amount": "6296179.772313277582667854371705213", + "locked_amount": "6289502.648681998861392819537090456", "deposits": [ { "amount": "129284.449", @@ -31545,7 +31545,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2170755.303479024266347370184272009", + "locked_amount": "2168117.131549398134388014154069372", "deposits": [ { "amount": "552496.6455", @@ -32976,7 +32976,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "344880.26470873256266083413698632", + "locked_amount": "344557.06298472321096265569355656", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 4f10fdcbf..24cd3e5c9 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "84.49119514205991870008365464865550487", + "locked_amount": "83.80021499238966110008297050989345511", "deposits": [ { "amount": "1000", From fac08bc8316d28998eee722ee6de11ca1401d323 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 12 Sep 2022 00:10:11 +0000 Subject: [PATCH 49/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 64 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 0b2f90d88..f7820bc77 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106572.77329549371602865", + "locked_amount": "106512.473047096771897515", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51338.6274479959412", + "locked_amount": "51301.9962582445427", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47760.164522898438236994", + "locked_amount": "47701.01559644325082107", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65279.899454378187183282198648", + "locked_amount": "65199.053083550095880471245872", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20091.876440857875867024", + "locked_amount": "20066.993508945503493756", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6539.7108145452060276", + "locked_amount": "6531.611661665986131444", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8192.4667874396151", + "locked_amount": "8151.0227958937209", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1399124.870471390169878784", + "locked_amount": "1397773.884072304753703572", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32855.99461553945175", + "locked_amount": "32797.28229418277", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2850.1392647833914265851535376566", + "locked_amount": "2810.43568473454235268894429502435", "deposits": [ { "amount": "2833.333333", @@ -22444,7 +22444,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2174469.12710178462634175125", + "locked_amount": "2172393.13136989704803696727", "deposits": [ { "amount": "1998.95815", @@ -23311,8 +23311,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "202560.7496734066439944", - "locked_amount": "13010215.496081637762791019815536932170857", + "total_removed": "202823.4656688805072444", + "locked_amount": "13002854.1485080294217393171678833721438227", "deposits": [ { "amount": "16249.93", @@ -23831,6 +23831,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xa75ec8ccff824d09c109e9fdcd99aac9a0eb34562500cd450ed205d57ac8ae45" }, + { + "amount": "262.71599547386325", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xb4d350dd5fcd3f1617fb1eaac7f77fd973f0275bcc35003934ccc9a4e6140cdb" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24402,6 +24407,12 @@ "tranche_id": 2, "tx": "0xa75ec8ccff824d09c109e9fdcd99aac9a0eb34562500cd450ed205d57ac8ae45" }, + { + "amount": "262.71599547386325", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xb4d350dd5fcd3f1617fb1eaac7f77fd973f0275bcc35003934ccc9a4e6140cdb" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24860,8 +24871,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "46646.00419407033875", - "remaining_tokens": "213352.88330592966125" + "withdrawn_tokens": "46908.720189544202", + "remaining_tokens": "213090.167310455798" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26406,8 +26417,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2764004.789917496503347647", - "locked_amount": "6289502.648681998861392819537090456", + "total_removed": "2764369.825392547157261647", + "locked_amount": "6282706.6996046912379161092348167", "deposits": [ { "amount": "129284.449", @@ -26631,6 +26642,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x6516c57ea0a2048d0ca87cbc0bee8a7a4fd0ec7a58bc7fbc33bf56e8fe02593d" }, + { + "amount": "365.035475050653914", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x3f54acc3bba8d596eea3553509f34983148ff873565c53d993b2248a89d8c057" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28720,6 +28736,12 @@ "tranche_id": 3, "tx": "0x6516c57ea0a2048d0ca87cbc0bee8a7a4fd0ec7a58bc7fbc33bf56e8fe02593d" }, + { + "amount": "365.035475050653914", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x3f54acc3bba8d596eea3553509f34983148ff873565c53d993b2248a89d8c057" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30456,8 +30478,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "204105.14244060233147725", - "remaining_tokens": "155018.32713439766852275" + "withdrawn_tokens": "204470.17791565298539125", + "remaining_tokens": "154653.29165934701460875" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31545,7 +31567,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2168117.131549398134388014154069372", + "locked_amount": "2165432.01096739601864288263183372", "deposits": [ { "amount": "552496.6455", @@ -32976,7 +32998,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "344557.06298472321096265569355656", + "locked_amount": "344228.10959410801191926987417556", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 24cd3e5c9..c9a96c1bb 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "83.80021499238966110008297050989345511", + "locked_amount": "83.0969365169964360000822741945712836", "deposits": [ { "amount": "1000", From bd515642077aaaf103612d53f2407ffad83355c6 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 12 Sep 2022 06:28:44 +0000 Subject: [PATCH 50/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index f7820bc77..f60ca0d7c 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106512.473047096771897515", + "locked_amount": "106450.110805869197496885", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51301.9962582445427", + "locked_amount": "51264.11244926433724", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47701.01559644325082107", + "locked_amount": "47639.844047104553224188", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65199.053083550095880471245872", + "locked_amount": "65115.442136431506956635638672", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20066.993508945503493756", + "locked_amount": "20041.259694514865488396", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6531.611661665986131444", + "locked_amount": "6523.235554783837261619", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8151.0227958937209", + "locked_amount": "8108.161609299516", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1397773.884072304753703572", + "locked_amount": "1396376.700114448863244798", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32797.28229418277", + "locked_amount": "32736.562279840981", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2810.43568473454235268894429502435", + "locked_amount": "2769.374423754235979646149893795", "deposits": [ { "amount": "2833.333333", @@ -22444,7 +22444,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2172393.13136989704803696727", + "locked_amount": "2170246.1460744605062244632", "deposits": [ { "amount": "1998.95815", @@ -23312,7 +23312,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "202823.4656688805072444", - "locked_amount": "13002854.1485080294217393171678833721438227", + "locked_amount": "12995241.0765000433416042690892396805663693", "deposits": [ { "amount": "16249.93", @@ -26418,7 +26418,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2764369.825392547157261647", - "locked_amount": "6282706.6996046912379161092348167", + "locked_amount": "6275678.36013684215460172103184858", "deposits": [ { "amount": "129284.449", @@ -31567,7 +31567,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1751129.686339809105860354", - "locked_amount": "2165432.01096739601864288263183372", + "locked_amount": "2162655.071536606212862810394531095", "deposits": [ { "amount": "552496.6455", @@ -32998,7 +32998,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "344228.10959410801191926987417556", + "locked_amount": "343887.9075013550365840576763064", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index c9a96c1bb..19ec45745 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "83.0969365169964360000822741945712836", + "locked_amount": "82.36947773972606420008155393835616442", "deposits": [ { "amount": "1000", From 7675fe0ab0281d77f62cb316e9fbb9d664925e88 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Mon, 12 Sep 2022 08:22:34 +0100 Subject: [PATCH 51/66] test: add test for filtering assets not enabled (#1303) * test: add test for filtering assets not enabled * chore: fix lint * chore: load homepage before test --- .../trading-e2e/src/integration/deposit.cy.ts | 17 ++++--- apps/trading-e2e/src/integration/home.cy.ts | 4 ++ .../support/mocks/generate-deposit-page.ts | 45 +++++++++++++++++++ 3 files changed, 61 insertions(+), 5 deletions(-) diff --git a/apps/trading-e2e/src/integration/deposit.cy.ts b/apps/trading-e2e/src/integration/deposit.cy.ts index a0e29c6d8..11295146c 100644 --- a/apps/trading-e2e/src/integration/deposit.cy.ts +++ b/apps/trading-e2e/src/integration/deposit.cy.ts @@ -3,6 +3,10 @@ import { generateDepositPage } from '../support/mocks/generate-deposit-page'; import { generateNetworkParameters } from '../support/mocks/generate-network-parameters'; const connectEthWalletBtn = 'connect-eth-wallet-btn'; +const assetSelectField = 'select[name="asset"]'; +const toAddressField = 'input[name="to"]'; +const amountField = 'input[name="amount"]'; +const formFieldError = 'input-error-text'; describe('deposit form validation', () => { beforeEach(() => { @@ -21,11 +25,6 @@ describe('deposit form validation', () => { }); it('handles empty fields', () => { - const assetSelectField = 'select[name="asset"]'; - const toAddressField = 'input[name="to"]'; - const amountField = 'input[name="amount"]'; - const formFieldError = 'input-error-text'; - // Submit form to trigger any empty validaion messages cy.getByTestId('deposit-submit').click(); @@ -57,6 +56,14 @@ describe('deposit form validation', () => { .should('have.text', 'Insufficient amount in Ethereum wallet'); }); + it('unable to select assets not enabled', () => { + cy.getByTestId('deposit-submit').click(); + // Assets not enabled in mocks + cy.get(assetSelectField + ' option:contains(Asset 2)').should('not.exist'); + cy.get(assetSelectField + ' option:contains(Asset 3)').should('not.exist'); + cy.get(assetSelectField + ' option:contains(Asset 4)').should('not.exist'); + }); + it('able to disconnect eth wallet', () => { const ethWalletAddress = Cypress.env('ETHEREUM_WALLET_ADDRESS'); diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index fad513963..8c7f35190 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -5,6 +5,10 @@ import { mockTradingPage } from '../support/trading'; describe('home', () => { const selectMarketOverlay = 'select-market-list'; + beforeEach('load homepage', () => { + cy.visit('/'); + }); + describe('default market found', () => { it('redirects to a default market with the landing dialog open', () => { cy.mockGQL((req) => { diff --git a/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts b/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts index 9bf0e8554..105e41d07 100644 --- a/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts +++ b/apps/trading-e2e/src/support/mocks/generate-deposit-page.ts @@ -39,6 +39,51 @@ export const generateDepositPage = ( }, __typename: 'AssetEdge', }, + { + node: { + id: 'asset-2', + symbol: 'AST2', + name: 'Asset 2', + decimals: 5, + status: AssetStatus.STATUS_PENDING_LISTING, + source: { + __typename: 'ERC20', + contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d82', + }, + __typename: 'Asset', + }, + __typename: 'AssetEdge', + }, + { + node: { + id: 'asset-3', + symbol: 'AST3', + name: 'Asset 3', + decimals: 5, + status: AssetStatus.STATUS_PROPOSED, + source: { + __typename: 'ERC20', + contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d83', + }, + __typename: 'Asset', + }, + __typename: 'AssetEdge', + }, + { + node: { + id: 'asset-4', + symbol: 'AST4', + name: 'Asset 4', + decimals: 5, + status: AssetStatus.STATUS_REJECTED, + source: { + __typename: 'ERC20', + contractAddress: '0x444b9aDA947130Fc320a144cd22bC1641e5c9d84', + }, + __typename: 'Asset', + }, + __typename: 'AssetEdge', + }, ], __typename: 'AssetsConnection', }, From d85c5d7c1f6273fc888321ecc57b4d87f38b4014 Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 12 Sep 2022 10:07:29 +0100 Subject: [PATCH 52/66] chore: LP tooltips & move market-info lib (#1267) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat(#473): add positions metrics data provider * feat(#473) add positions stats * feat(#473) add positions stats * feat(#473): add positions stats * feat(#473): add positions stats * feat(#473): position metrics, test and refactoring * feat(#473): add unit tests to positions table * feat(#473): fix spelling, order positions by updated at desc * feat(#473): protect from division by 0 * feat(#473): fix trading positions e2e tests * feat(#473): fix e2e data mocks * feat(#473): post code review clean up * feat(#993): dependencies handling in data provider * feat(#993): fix e2e tests data mocks * feat(#993): remove position metrics mocks, add market data market id * feat: #994 add price monitoring bounds and candles update interface * fix: move best bid price to diff section * feat(#993): add missing mocks, fix combine function * fix: add insurance pool and calc volume 24h * feat: display some oracle min info, asset id, insurance pool, move open interest and 24hVol * fix: add market-info.cy.ts case * fix: remove # from numbered price monitoring settings * fix: add insurance pool test * fix: format 24hvol * feat(#993): set loading initially to true, add unit tests * feat(#993): cleanup, add comments * feat(#993): remove undefined from client type * fix: remove indicativeVolume and oracleSpecBinding from market info * feat(#993): cosmetic changes * fix: add oracleSpecBinding back * Update libs/deal-ticket/src/components/info-market.tsx Co-authored-by: botond <105208209+notbot00@users.noreply.github.com> * feat: add initial queries * fix: memo yesterday's timestamp * fix: add back info * fix: update query * fix: add view full oracle details link and update mappings * fix: regen code, make link reactnode, fix index.ts * feat: add liquidity lib, refactor info market * fix: remove liquidity query from deal-ticket * feat:(#993): pass informaton about update callback cause * fix: small ui tweaks * fix: display in grid * feat: navigate to oracle by termination id * feat: #491 add use liquidity provision merging * fix: remove logs, add extra check on my liquidity provision * fix: type number trivially inferred from a number literal, remove type annotation * fix: cypress tests and formatting for market info * Update libs/deal-ticket/src/components/market-info/info-market.tsx * fix: use position decimal places for stake and market value proxy * fix: #491 use size/position decimal places for obligation, supplied and commitment amount * fix: add size component and use decimal places * fix: update readme liquidity * fix: #491 add correct asset decimal formatters * Update libs/deal-ticket/src/components/market-info/tooltip-mapping.tsx Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com> * fix: make link instead of button to open liquidity * fix: #491 add liquidity page, link to trading mode tooltip, tabs hidden or choose active * fix: remove LP dialog, use only link to page * fix: add market id in LP view * fix: follow trade grid design * fix: add one line tabs , remove link styling, remove any, add value formatters * fix: remove falsy check LP undefined * fix: keep date formatter in LP table * fix: add generic type market info, hooks in body function * fix: revert number formatters * fix: use one param only in network params query * fix: use network param in web3 lib * fix: move lp container to trading app * fix: remove resizable panel * feat: add header component, remove isEstimate * chore: remove unnecessary type cast * fix: fix build with children map clone element * chore: lint * fix: move use network params to react helpers * fix: add const for LP tabs * fix: fix formatting on LP page * fix: only show tilde for liquidity monitoring auction end date * fix: market id being rendered twice in market info * chore: fix lint * fix: types for generate withdraw form query * chore: fix intermittent failing withdrawal test * Update libs/deal-ticket/src/components/market-info/info-market.tsx * fix: route to LP and update selected market * fix: add market-info lib * fix: add tooltips to header stat * fix: add overflow-y on div within auto sizer * fix: fix merge conflicts * fix: size and dialog * fix: format target stake and supplied stake * fix: add tooltips ag-grid and fix decimals * fix: overflow on both axes auto-sizer * fix: remove symbol, add to commitment * fix: update tooltips and headers after demo * fix: network switcher background * fix: remove any from market info * fix: integration test * fix: remove e2e test for risk factors for now until grpc error sorted * fix: get liquidity panel by test-id * fix: fix market-info.cy.ts test * fix: liquidity test * f ix: fix link data test id Co-authored-by: Bartłomiej Głownia Co-authored-by: botond <105208209+notbot00@users.noreply.github.com> Co-authored-by: candida-d <62548908+candida-d@users.noreply.github.com> Co-authored-by: Matthew Russell Co-authored-by: Joe --- .../src/integration/market-info.cy.ts | 26 +---- .../mocks/generate-market-info-query.ts | 2 +- .../src/support/mocks/generate-market.ts | 1 + apps/trading/components/header/header.tsx | 15 +-- apps/trading/components/navbar/navbar.tsx | 2 +- .../trading-mode-tooltip.tsx | 17 ++- apps/trading/pages/index.page.tsx | 1 + .../pages/liquidity/[marketId].page.tsx | 70 +++++++++--- apps/trading/pages/markets/Market.graphql | 1 + .../trading/pages/markets/[marketId].page.tsx | 20 ++-- .../pages/markets/__generated__/Market.ts | 8 +- apps/trading/pages/markets/trade-grid.tsx | 68 ++++++++---- libs/deal-ticket/src/components/index.ts | 1 - .../network-switcher/network-switcher.tsx | 15 ++- .../liquidity/src/lib/MarketLiquidity.graphql | 61 +++++++++++ .../src/lib/__generated__/MarketLiquidity.ts | 8 +- .../src/lib/liquidity-data-provider.ts | 3 + libs/liquidity/src/lib/liquidity-table.tsx | 65 ++++++++--- libs/market-info/.babelrc | 12 +++ libs/market-info/.eslintrc.json | 18 ++++ libs/market-info/README.md | 7 ++ libs/market-info/jest.config.ts | 11 ++ libs/market-info/package.json | 4 + libs/market-info/project.json | 43 ++++++++ .../src/components/MarketInfo.graphql | 0 .../src/components/MarketNames.graphql | 20 ++++ libs/market-info/src/components/index.ts | 1 + .../__generated__/MarketInfoQuery.ts | 0 .../market-info/__generated__/index.ts | 0 .../src/components/market-info/index.ts | 2 + .../market-info/info-key-value-table.tsx | 77 ++++++------- .../market-info/info-market-query.ts | 5 - .../components/market-info/info-market.tsx | 101 ++++++++---------- .../market-info/tooltip-mapping.tsx | 6 +- libs/market-info/src/index.ts | 1 + libs/market-info/src/setup-tests.ts | 1 + libs/market-info/tsconfig.json | 25 +++++ libs/market-info/tsconfig.lib.json | 23 ++++ libs/market-info/tsconfig.spec.json | 20 ++++ libs/positions/src/lib/positions-table.tsx | 4 +- libs/react-helpers/src/lib/grid/size.tsx | 5 +- .../src/components/tooltip/index.ts | 2 +- .../src/components/tooltip/tooltip.tsx | 9 ++ tsconfig.base.json | 1 + workspace.json | 1 + 45 files changed, 578 insertions(+), 205 deletions(-) create mode 100644 libs/liquidity/src/lib/MarketLiquidity.graphql create mode 100644 libs/market-info/.babelrc create mode 100644 libs/market-info/.eslintrc.json create mode 100644 libs/market-info/README.md create mode 100644 libs/market-info/jest.config.ts create mode 100644 libs/market-info/package.json create mode 100644 libs/market-info/project.json rename libs/{deal-ticket => market-info}/src/components/MarketInfo.graphql (100%) create mode 100644 libs/market-info/src/components/MarketNames.graphql create mode 100644 libs/market-info/src/components/index.ts rename libs/{deal-ticket => market-info}/src/components/market-info/__generated__/MarketInfoQuery.ts (100%) rename libs/{deal-ticket => market-info}/src/components/market-info/__generated__/index.ts (100%) rename libs/{deal-ticket => market-info}/src/components/market-info/index.ts (57%) rename libs/{deal-ticket => market-info}/src/components/market-info/info-key-value-table.tsx (57%) rename libs/{deal-ticket => market-info}/src/components/market-info/info-market-query.ts (97%) rename libs/{deal-ticket => market-info}/src/components/market-info/info-market.tsx (82%) rename libs/{deal-ticket => market-info}/src/components/market-info/tooltip-mapping.tsx (91%) create mode 100644 libs/market-info/src/index.ts create mode 100644 libs/market-info/src/setup-tests.ts create mode 100644 libs/market-info/tsconfig.json create mode 100644 libs/market-info/tsconfig.lib.json create mode 100644 libs/market-info/tsconfig.spec.json diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index c6672e1ed..86deed88c 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -4,6 +4,7 @@ import { mockTradingPage } from '../support/trading'; const marketInfoBtn = 'Info'; const row = 'key-value-table-row'; const marketTitle = 'accordion-title'; +const link = 'link'; const externalLink = 'external-link'; describe('market info is displayed', () => { @@ -85,13 +86,6 @@ describe('market info is displayed', () => { validateMarketDataRow(4, 'Sector', 'crypto'); }); - it('risk factors displayed', () => { - cy.getByTestId(marketTitle).contains('Risk factors').click(); - - validateMarketDataRow(0, 'Short', '0.008571790367285281'); - validateMarketDataRow(1, 'Long', '0.008508132993273576'); - }); - it('risk model displayed', () => { cy.getByTestId(marketTitle).contains('Risk model').click(); @@ -127,17 +121,13 @@ describe('market info is displayed', () => { }); it('liquidity displayed', () => { - cy.getByTestId('accordion-toggle').eq(14).click(); + cy.getByTestId('accordion-toggle').eq(13).click(); validateMarketDataRow(0, 'Target Stake', '0.56789 tBTC'); validateMarketDataRow(1, 'Supplied Stake', '0.56767 tBTC'); validateMarketDataRow(2, 'Market Value Proxy', '6.77678 tBTC'); - cy.getByTestId(externalLink).should( - 'have.attr', - 'href', - '/liquidity/market-0' - ); + cy.getByTestId(link).should('have.text', 'View liquidity provision table'); }); it('oracle displayed', () => { @@ -149,16 +139,6 @@ describe('market info is displayed', () => { 'Trading Termination Property', 'termination.BTC.value' ); - validateMarketDataRow( - 2, - 'Price Oracle', - 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f' - ); - validateMarketDataRow( - 3, - 'Termination Oracle', - 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f' - ); cy.getByTestId(externalLink) .should('have.attr', 'href') diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index f17bafb53..9bd9a56c6 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -1,4 +1,4 @@ -import type { MarketInfoQuery } from '@vegaprotocol/deal-ticket'; +import type { MarketInfoQuery } from '@vegaprotocol/market-info'; import { AccountType, AuctionTrigger, diff --git a/apps/trading-e2e/src/support/mocks/generate-market.ts b/apps/trading-e2e/src/support/mocks/generate-market.ts index 06fb8abda..7ac21d0ce 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market.ts @@ -58,6 +58,7 @@ export const generateMarket = (override?: PartialDeep): Market => { }, quoteName: 'BTCUSD Monthly', settlementAsset: { + decimals: 0, id: '000', symbol: 'USD', name: 'United States Dollar', diff --git a/apps/trading/components/header/header.tsx b/apps/trading/components/header/header.tsx index 7eaaa0d6e..6b2abee46 100644 --- a/apps/trading/components/header/header.tsx +++ b/apps/trading/components/header/header.tsx @@ -1,3 +1,4 @@ +import { Tooltip } from '@vegaprotocol/ui-toolkit'; import type { ReactElement, ReactNode } from 'react'; import { Children } from 'react'; import { cloneElement } from 'react'; @@ -11,9 +12,7 @@ export const Header = ({ title, children }: TradeMarketHeaderProps) => { return (
-
- {title} -
+
{title}
{ const itemClass = 'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-neutral-300 dark:border-neutral-700'; @@ -44,9 +45,11 @@ export const HeaderStat = ({ return (
-
- {heading} -
+ +
+ {heading} +
+
{children}
); diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index 57d748361..824663079 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -27,7 +27,7 @@ export const Navbar = ({ theme, toggleTheme }: NavbarProps) => { - +
+ {headers.map(({ value, className, onlyOnDetailed }, i) => { const thClass = classNames( 'font-normal text-neutral-500 dark:text-neutral-400', @@ -37,7 +37,7 @@ export const SelectMarketTableRow = ({ }) => { return ( {columns.map(({ value, className, dataTestId, onlyOnDetailed }, i) => { if (!onlyOnDetailed || detailed === onlyOnDetailed) { diff --git a/libs/market-list/src/lib/components/select-market.tsx b/libs/market-list/src/lib/components/select-market.tsx index bd56d3445..bbfc0b778 100644 --- a/libs/market-list/src/lib/components/select-market.tsx +++ b/libs/market-list/src/lib/components/select-market.tsx @@ -76,7 +76,7 @@ export const SelectAllMarketsTableBody = ({ if (!data) return null; return ( <> - + {/* Border styles required to create space between tbody elements margin/padding dont work */} @@ -100,7 +100,8 @@ export const SelectMarketPopover = ({ marketName: string; onSelect: (id: string) => void; }) => { - const triggerClasses = 'flex items-center gap-4 whitespace-nowrap'; + const triggerClasses = + 'sm:text-lg md:text-xl lg:text-2xl font-medium flex items-center gap-4 whitespace-nowrap my-3 hover:text-neutral-500 dark:hover:text-neutral-300'; const { keypair } = useVegaWallet(); const [open, setOpen] = useState(false); const { data, loading: marketsLoading } = useMarketList(); @@ -149,7 +150,7 @@ export const SelectMarketPopover = ({ trigger={ {marketName} - + } > @@ -167,7 +168,7 @@ export const SelectMarketPopover = ({ {keypair && positionMarkets?.markets && positionMarkets.markets.length > 0 && ( -
{t('Balance available')} {balance.toString()}
{t('Delayed withdrawal threshold')} {text}
{t('Delay time')} {delayTime}
+
{t('My markets')}
)} - +
{t('All markets')} { return ( - diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index 70f07e3e2..16eb1f998 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -78,7 +78,7 @@ export const OrderEditDialog = ({ -
+
( onClick={() => { setEditOrder(data); }} - size="sm" + size="xs" > {t('Edit')} @@ -306,7 +306,7 @@ export const OrderListTable = forwardRef( if (isOrderActive(data.status)) { return ( @@ -181,7 +181,7 @@ export const PositionsTable = forwardRef( }} /> { return node?.rowPinned ? data?.notional : data?.openVolume; diff --git a/libs/positions/src/lib/positions.tsx b/libs/positions/src/lib/positions.tsx index d1e140dd4..97e2a2ea8 100644 --- a/libs/positions/src/lib/positions.tsx +++ b/libs/positions/src/lib/positions.tsx @@ -82,16 +82,16 @@ export const Positions = memo( }; return ( -
-

+
+

{assetSymbol} {t('markets')}

-

+

{assetSymbol} {t('balance')}: -

+
{valueSplit[1]} + {valueSplit[1]} ) : null} ); diff --git a/libs/trades/src/lib/trades-table.tsx b/libs/trades/src/lib/trades-table.tsx index 8560e050f..45a17a723 100644 --- a/libs/trades/src/lib/trades-table.tsx +++ b/libs/trades/src/lib/trades-table.tsx @@ -13,8 +13,8 @@ import type { AgGridReactProps, AgReactUiProps } from 'ag-grid-react'; import type { Trades_market_tradesConnection_edges_node } from './__generated__/Trades'; import BigNumber from 'bignumber.js'; -export const UP_CLASS = 'text-vega-green'; -export const DOWN_CLASS = 'text-vega-red'; +export const UP_CLASS = 'text-vega-green-dark dark:text-vega-green'; +export const DOWN_CLASS = 'text-vega-red-dark dark:text-vega-red'; const changeCellClass = (dataKey: string) => diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx b/libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx index e1d7c5a8d..6b20758b3 100644 --- a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx +++ b/libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx @@ -8,8 +8,9 @@ const agGridDarkVariables = ` --ag-border-color: ${colors.neutral[700]}; --ag-header-background-color: ${colors.black}; --ag-odd-row-background-color: ${colors.black}; + --ag-header-column-separator-color: ${colors.neutral[600]}; --ag-row-border-color:${colors.black}; - --ag-row-hover-color: ${colors.neutral[700]}; + --ag-row-hover-color: ${colors.neutral[800]}; --ag-font-size: 12px; } @@ -21,10 +22,6 @@ const agGridDarkVariables = ` overflow: hidden; text-overflow: ellipsis; } - - .ag-theme-balham-dark .ag-header-row { - font-weight: 400; - } `; export const AgGrid = ({ diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx b/libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx index 412037cea..7d8ef784e 100644 --- a/libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx +++ b/libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx @@ -8,8 +8,9 @@ const agGridLightVariables = ` --ag-border-color: ${colors.neutral[300]}; --ag-header-background-color: ${colors.white}; --ag-odd-row-background-color: ${colors.white}; + --ag-header-column-separator-color: ${colors.neutral[300]}; --ag-row-border-color: ${colors.white}; - --ag-row-hover-color: ${colors.neutral[300]}; + --ag-row-hover-color: ${colors.neutral[100]}; --ag-font-size: 12px; } @@ -21,10 +22,6 @@ const agGridLightVariables = ` overflow: hidden; text-overflow: ellipsis; } - - .ag-theme-balham-dark .ag-header-row { - font-weight: 400; - } `; export const AgGrid = ({ diff --git a/libs/ui-toolkit/src/components/button/button.tsx b/libs/ui-toolkit/src/components/button/button.tsx index 0efff9988..126107a4f 100644 --- a/libs/ui-toolkit/src/components/button/button.tsx +++ b/libs/ui-toolkit/src/components/button/button.tsx @@ -9,10 +9,10 @@ import { Icon } from '../icon'; import classnames from 'classnames'; type ButtonVariant = 'default' | 'primary' | 'secondary'; -type ButtonSize = 'lg' | 'md' | 'sm'; +type ButtonSize = 'lg' | 'md' | 'sm' | 'xs'; -const base = - 'inline-block uppercase border rounded-md disabled:opacity-40 transition-colors'; +const base = 'inline-block uppercase border rounded-md disabled:opacity-60'; +const xs = 'px-2 py-0 text-sm'; const sm = 'px-2 py-1 text-sm'; const md = 'px-10 py-2 text-base'; const lg = 'px-14 py-4'; @@ -21,8 +21,8 @@ const defaultClasses = [ 'text-black dark:text-white', 'border-black dark:border-white', 'bg-white dark:bg-black', - 'enabled:hover:bg-neutral-200 dark:enabled:hover:bg-neutral-800', - 'enabled:active:bg-neutral-200 dark:enabled:active:bg-neutral-500', + 'enabled:hover:bg-neutral-200 dark:enabled:hover:bg-neutral-700', + 'enabled:active:bg-neutral-200 dark:enabled:active:bg-neutral-700 enabled:active:border-neutral-400 dark:enabled:active:border-neutral-400', ]; const primary = [ 'text-black', @@ -54,9 +54,11 @@ const getClassname = ({ [defaultClasses.join(' ')]: variant === 'default', [primary.join(' ')]: variant === 'primary', [secondary.join(' ')]: variant === 'secondary', + [lg]: size === 'lg', [md]: size === 'md', [sm]: size === 'sm', + [xs]: size === 'xs', [fillClasses]: fill, }); }; diff --git a/libs/ui-toolkit/src/components/dialog/dialog.tsx b/libs/ui-toolkit/src/components/dialog/dialog.tsx index b148dee6f..1818906cf 100644 --- a/libs/ui-toolkit/src/components/dialog/dialog.tsx +++ b/libs/ui-toolkit/src/components/dialog/dialog.tsx @@ -70,7 +70,7 @@ export function Dialog({ )}
- {icon &&
{icon}
} + {icon &&
{icon}
}
{title && (

>(({ className, children, ...props }, forwardedRef) => { const triggerClasses = classNames( + className, 'text-sm py-1 px-2 rounded bg-transparent border border-neutral-500', 'focus:border-black dark:focus:border-white whitespace-nowrap', - className + 'hover:bg-neutral-100 dark:hover:bg-neutral-700' ); return ( { const effectiveClassName = classNames( - 'text-sm text-vega-pink flex items-center', + 'text-sm text-vega-red flex items-center', 'mt-2', { 'border-danger': intent === 'danger', diff --git a/libs/ui-toolkit/src/components/key-value-table/key-value-table.tsx b/libs/ui-toolkit/src/components/key-value-table/key-value-table.tsx index 9c7a9a200..8906d6a58 100644 --- a/libs/ui-toolkit/src/components/key-value-table/key-value-table.tsx +++ b/libs/ui-toolkit/src/components/key-value-table/key-value-table.tsx @@ -72,9 +72,9 @@ export const KeyValueTableRow = ({ { 'flex-row items-center': inline }, className ); - const dtClassNames = `break-words capitalize ${dtClassName}`; + const dtClassNames = `break-words ${dtClassName}`; const ddClassNames = classNames( - 'break-words text-neutral-500', + 'break-words text-neutral-500 dark:text-neutral-300', { 'font-mono': numerical, }, diff --git a/libs/ui-toolkit/src/components/popover/popover.tsx b/libs/ui-toolkit/src/components/popover/popover.tsx index dea8f9eb4..ea6453374 100644 --- a/libs/ui-toolkit/src/components/popover/popover.tsx +++ b/libs/ui-toolkit/src/components/popover/popover.tsx @@ -23,11 +23,11 @@ export const Popover = ({ diff --git a/libs/ui-toolkit/src/components/tabs/tabs.tsx b/libs/ui-toolkit/src/components/tabs/tabs.tsx index 9efd08e1a..448d6c5b3 100644 --- a/libs/ui-toolkit/src/components/tabs/tabs.tsx +++ b/libs/ui-toolkit/src/components/tabs/tabs.tsx @@ -19,7 +19,7 @@ export const Tabs = ({ children, active: activeDefaultId }: TabsProps) => { className="h-full grid grid-rows-[min-content_1fr]" onValueChange={(value) => setActiveTab(value)} > -
+
{ if (!isValidElement(child) || child.props.hidden) return null; const isActive = child.props.id === activeTab; const triggerClass = classNames( - 'relative px-4 py-2 border-r border-neutral-300 dark:border-neutral-700', - 'text-black dark:text-white', - 'uppercase' + 'relative px-4 py-2 border-r border-neutral-300 dark:border-neutral-600', + 'uppercase', + 'inline-block after:content-[attr(data-testid)] after:block after:invisible after:overflow-hidden after:h-0 after:tracking-wider', + { + 'text-neutral-400 dark:text-neutral-400 hover:text-neutral-500 dark:hover:text-neutral-300': + !isActive, + } ); const borderClass = classNames( 'absolute bottom-[-1px] left-0 w-full h-0 border-b', diff --git a/libs/ui-toolkit/src/utils/shared.ts b/libs/ui-toolkit/src/utils/shared.ts index c25215e2a..e1dd19165 100644 --- a/libs/ui-toolkit/src/utils/shared.ts +++ b/libs/ui-toolkit/src/utils/shared.ts @@ -9,7 +9,7 @@ export const defaultFormElement = (hasError?: boolean) => 'p-2 border-2 rounded-none', 'bg-transparent', 'border border-neutral-500 focus:border-black dark:focus:border-white', - 'disabled:opacity-40', + 'disabled:opacity-60', { 'border-vega-pink': hasError, } From d8512afb2b03762c4a24e28870d6a5006886545b Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 12 Sep 2022 14:28:07 +0100 Subject: [PATCH 57/66] fix: #1297 Order submission expiresAt is only available when the time in force is of type GTT (#1308) * fix: #1297 Order submission expires at is only available when the time in force is of type GTT * fix: add expires at visible in edit dialog * fix:#1297 add GTC and GTT tests for expires at --- .../components/deal-ticket/deal-ticket.tsx | 4 ++ .../order-list/order-edit-dialog.tsx | 9 ++++ .../lib/order-hooks/use-order-submit.spec.tsx | 42 ++++++++++++++++++- .../src/lib/order-hooks/use-order-submit.tsx | 11 +++-- 4 files changed, 60 insertions(+), 6 deletions(-) diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx index e0cb6ab4c..c1ed43607 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -60,6 +60,10 @@ export const DealTicket = ({ price: order.price && removeDecimal(order.price, market.decimalPlaces), size: removeDecimal(order.size, market.positionDecimalPlaces), + expiresAt: + order.timeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT + ? order.expiresAt + : undefined, }); } }, diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index 16eb1f998..0fb03e705 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -3,6 +3,7 @@ import { addDecimalsFormatNumber, toDecimal, Size, + getDateTimeFormat, } from '@vegaprotocol/react-helpers'; import { OrderType } from '@vegaprotocol/types'; import { @@ -13,6 +14,7 @@ import { Dialog, Icon, } from '@vegaprotocol/ui-toolkit'; +import { OrderTimeInForce } from '@vegaprotocol/types'; import { useForm } from 'react-hook-form'; import type { OrderFields } from '../order-data-provider'; @@ -77,6 +79,13 @@ export const OrderEditDialog = ({

+ {order.timeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT && + order.expiresAt && ( +
+

{t(`Expires at`)}

+

{getDateTimeFormat().format(new Date(order.expiresAt))}

+
+ )}
diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx index 1410a7a6f..04fb24207 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.spec.tsx @@ -142,7 +142,7 @@ function setup(context?: Partial) { } describe('useOrderSubmit', () => { - it('should submit a correctly formatted order', async () => { + it('should submit a correctly formatted order on GTT', async () => { const mockSendTx = jest.fn().mockReturnValue(Promise.resolve({})); const keypair = { pub: '0x123', @@ -175,7 +175,45 @@ describe('useOrderSubmit', () => { side: Side.SIDE_BUY, timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTT, price: '123456789', - expiresAt: order.expiresAt ? toNanoSeconds(order.expiresAt) : undefined, + expiresAt: toNanoSeconds(order.expiresAt), + }, + }); + }); + + it('should submit a correctly formatted order on GTC', async () => { + const mockSendTx = jest.fn().mockReturnValue(Promise.resolve({})); + const keypair = { + pub: '0x123', + } as VegaKeyExtended; + const { result } = setup({ + sendTx: mockSendTx, + keypairs: [keypair], + keypair, + }); + + const order = { + type: OrderType.TYPE_LIMIT, + size: '10', + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, + side: Side.SIDE_BUY, + price: '123456789', + expiresAt: new Date('2022-01-01'), + }; + await act(async () => { + result.current.submit({ ...order, marketId: defaultMarket.id }); + }); + + expect(mockSendTx).toHaveBeenCalledWith({ + pubKey: keypair.pub, + propagate: true, + orderSubmission: { + type: OrderType.TYPE_LIMIT, + marketId: defaultMarket.id, + size: '10', + side: Side.SIDE_BUY, + timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC, + price: '123456789', + expiresAt: undefined, }, }); }); diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.tsx index b36f0beee..47507131c 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -6,7 +6,8 @@ import { determineId, toNanoSeconds } from '@vegaprotocol/react-helpers'; import { useVegaTransaction } from '@vegaprotocol/wallet'; import * as Sentry from '@sentry/react'; import { useOrderEvent } from './use-order-event'; -import type { OrderTimeInForce, Side } from '@vegaprotocol/types'; +import type { Side } from '@vegaprotocol/types'; +import { OrderTimeInForce } from '@vegaprotocol/types'; import { OrderType, OrderStatus } from '@vegaprotocol/types'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; import { t } from '@vegaprotocol/react-helpers'; @@ -131,9 +132,11 @@ export const useOrderSubmit = () => { order.type === OrderType.TYPE_LIMIT && order.price ? order.price : undefined, - expiresAt: order.expiresAt - ? toNanoSeconds(order.expiresAt) // Wallet expects timestamp in nanoseconds - : undefined, + expiresAt: + order.expiresAt && + order.timeInForce === OrderTimeInForce.TIME_IN_FORCE_GTT + ? toNanoSeconds(order.expiresAt) // Wallet expects timestamp in nanoseconds + : undefined, }, }); From f34edf1862800990daf2fe03e352db7cfb56a6f5 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Mon, 12 Sep 2022 18:04:57 +0000 Subject: [PATCH 58/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 47 ++++++++++++-------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index b84e1853d..19e404cb2 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106394.66488946230805625", + "locked_amount": "106335.413484289455510975", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51230.43016869609472", + "locked_amount": "51194.43613013698976", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47585.4567681301376248752", + "locked_amount": "47527.3366591736311428252", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "65041.104115645490107967157408", + "locked_amount": "64961.663960720168133509560356", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "20018.379905468400079546", + "locked_amount": "19993.929779310993153618", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6515.788405469431257442", + "locked_amount": "6507.830126663603897055", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8070.053970410628", + "locked_amount": "8029.330842391305", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1395134.471749858441357522", + "locked_amount": "1393806.983975873425857912", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32682.576458081723", + "locked_amount": "32624.88536005434875", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2732.8670885613374625452081355872", + "locked_amount": "2693.8540998784246905956196508555", "deposits": [ { "amount": "2833.333333", @@ -22455,7 +22455,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2168337.2735760661538675426", + "locked_amount": "2166297.38704960471950391605", "deposits": [ { "amount": "1998.95815", @@ -23323,7 +23323,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "203050.3452740934272444", - "locked_amount": "12988472.337182063502716333679636461712625", + "locked_amount": "12981239.0305324649112059509051105297445255", "deposits": [ { "amount": "16249.93", @@ -26440,7 +26440,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2764683.361107610704396897", - "locked_amount": "6269429.503217293486664487151997355", + "locked_amount": "6262751.76070348203965915005868418", "deposits": [ { "amount": "129284.449", @@ -31599,8 +31599,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1769795.462408277490426354", - "locked_amount": "2160186.110374920105452205502061688", + "total_removed": "1773434.744647395163801354", + "locked_amount": "2157547.69392106277665067936509808", "deposits": [ { "amount": "552496.6455", @@ -31759,6 +31759,11 @@ "user": "0x5565d64f29Ea17355106DF3bA5903Eb793B3e139", "tx": "0x0954f744fc48cdb36187ba72505a5ca1c053d05da816b41230b35d86069fdcb0" }, + { + "amount": "3639.282239117673375", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tx": "0x2a7ebd8748742d3bf0ce4f1ee46c575aa744f0d83915583bbd262f504044d462" + }, { "amount": "8456.402651116281081", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -32818,6 +32823,12 @@ } ], "withdrawals": [ + { + "amount": "3639.282239117673375", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tranche_id": 4, + "tx": "0x2a7ebd8748742d3bf0ce4f1ee46c575aa744f0d83915583bbd262f504044d462" + }, { "amount": "8456.402651116281081", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -32952,8 +32963,8 @@ } ], "total_tokens": "331498.5873", - "withdrawn_tokens": "203997.978690347971047", - "remaining_tokens": "127500.608609652028953" + "withdrawn_tokens": "207637.260929465644422", + "remaining_tokens": "123861.326370534355578" }, { "address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77", @@ -33042,7 +33053,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "343585.43574240396939067269203448", + "locked_amount": "343262.2040617976027593156164384", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 38d7d4b69..1d706e101 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "81.72253456367329370008091340055809237", + "locked_amount": "81.0314903602232870000802291983764587", "deposits": [ { "amount": "1000", From 7b2e86f32e75f983844acc6bf1e4f1c6fdd12846 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 13 Sep 2022 00:12:14 +0000 Subject: [PATCH 59/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 64 +++++++++++++------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 19e404cb2..a9fdbbaba 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106335.413484289455510975", + "locked_amount": "106274.90731117573702137", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51194.43613013698976", + "locked_amount": "51157.67984525621438", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47527.3366591736311428252", + "locked_amount": "47467.985739754037614122", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "64961.663960720168133509560356", + "locked_amount": "64880.541500382365386104128928", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "19993.929779310993153618", + "locked_amount": "19968.961872446731053772", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6507.830126663603897055", + "locked_amount": "6499.703315262119449162", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "8029.330842391305", + "locked_amount": "7987.745320048308", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1393806.983975873425857912", + "locked_amount": "1392451.383972383291331918", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32624.88536005434875", + "locked_amount": "32565.972536735103", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2693.8540998784246905956196508555", + "locked_amount": "2654.01493251951192104562359744575", "deposits": [ { "amount": "2833.333333", @@ -22455,7 +22455,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2166297.38704960471950391605", + "locked_amount": "2164214.3018140336079083241", "deposits": [ { "amount": "1998.95815", @@ -23322,8 +23322,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "203050.3452740934272444", - "locked_amount": "12981239.0305324649112059509051105297445255", + "total_removed": "203258.7850094080512444", + "locked_amount": "12973852.5440339852469072887237507656745066", "deposits": [ { "amount": "16249.93", @@ -23852,6 +23852,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xe0040011ab92c3d951d3449fa6159e095b1893639c47fdb1a72aa87c741bdf56" }, + { + "amount": "208.439735314624", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xa2cf8d5f7caa97b4c6804c0bce8003115d61772edf6ab6f8c9b3de503eafd2f5" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24435,6 +24440,12 @@ "tranche_id": 2, "tx": "0xe0040011ab92c3d951d3449fa6159e095b1893639c47fdb1a72aa87c741bdf56" }, + { + "amount": "208.439735314624", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xa2cf8d5f7caa97b4c6804c0bce8003115d61772edf6ab6f8c9b3de503eafd2f5" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24893,8 +24904,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "47135.599794757122", - "remaining_tokens": "212863.287705242878" + "withdrawn_tokens": "47344.039530071746", + "remaining_tokens": "212654.847969928254" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26439,8 +26450,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2764683.361107610704396897", - "locked_amount": "6262751.76070348203965915005868418", + "total_removed": "2764972.018594596729147647", + "locked_amount": "6255932.6035312481472902008742964", "deposits": [ { "amount": "129284.449", @@ -26674,6 +26685,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x5940c1d1266c4aee837eb2a10ea1a42f52182c5fb2d9f4ca10752ec099ddc239" }, + { + "amount": "288.65748698602475075", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x0fb5472a41850ad312926ca6a39df1901579d075b0b8836459e2cd7f96353a8b" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28775,6 +28791,12 @@ "tranche_id": 3, "tx": "0x5940c1d1266c4aee837eb2a10ea1a42f52182c5fb2d9f4ca10752ec099ddc239" }, + { + "amount": "288.65748698602475075", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x0fb5472a41850ad312926ca6a39df1901579d075b0b8836459e2cd7f96353a8b" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30511,8 +30533,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "204783.7136307165325265", - "remaining_tokens": "154339.7559442834674735" + "withdrawn_tokens": "205072.37111770255727725", + "remaining_tokens": "154051.09845729744272275" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31600,7 +31622,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1773434.744647395163801354", - "locked_amount": "2157547.69392106277665067936509808", + "locked_amount": "2154853.403680393350625567930414999", "deposits": [ { "amount": "552496.6455", @@ -33053,7 +33075,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "343262.2040617976027593156164384", + "locked_amount": "342932.12729879854768674909081684", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 1d706e101..4b062d8c3 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "81.0314903602232870000802291983764587", + "locked_amount": "80.3257137874175240000795304096905124", "deposits": [ { "amount": "1000", From 4505e863634457c2eba6bf42915232e566032737 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 13 Sep 2022 06:26:28 +0000 Subject: [PATCH 60/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 52 ++++++++++++++------ apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index a9fdbbaba..6d9246351 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106274.90731117573702137", + "locked_amount": "106213.256196636749978685", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51157.67984525621438", + "locked_amount": "51120.22803145611028", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47467.985739754037614122", + "locked_amount": "47407.5117394524021021252", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "64880.541500382365386104128928", + "locked_amount": "64797.883982370617886030171276", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "19968.961872446731053772", + "locked_amount": "19943.521504849955184182", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6499.703315262119449162", + "locked_amount": "6491.422722476852413578", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "7987.745320048308", + "locked_amount": "7945.3728864734298", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1392451.383972383291331918", + "locked_amount": "1391070.132328404443679426", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32565.972536735103", + "locked_amount": "32505.94492250402725", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2654.01493251951192104562359744575", + "locked_amount": "2613.42189971663007907723962443745", "deposits": [ { "amount": "2833.333333", @@ -5892,7 +5892,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35958.000000000000000003", + "total_added": "35960.000000000000000003", "total_removed": "17098.49537348884", "locked_amount": "0", "deposits": [ @@ -5911,6 +5911,11 @@ "user": "0xEED071df0b6f8C4088b9CfD9f2ADE131C8591613", "tx": "0x0d569e9b901099d43f017945635ad8c2b566ce2290abb2583b018e83df34642b" }, + { + "amount": "2", + "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", + "tx": "0xa87cd2caf4f27d7a60443ec952b831b005a809803fc899c4bcc3ca12016299eb" + }, { "amount": "15", "user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -12530,6 +12535,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "2" }, + { + "address": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", + "deposits": [ + { + "amount": "2", + "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", + "tranche_id": 11, + "tx": "0xa87cd2caf4f27d7a60443ec952b831b005a809803fc899c4bcc3ca12016299eb" + } + ], + "withdrawals": [], + "total_tokens": "2", + "withdrawn_tokens": "0", + "remaining_tokens": "2" + }, { "address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", "deposits": [ @@ -22455,7 +22475,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2164214.3018140336079083241", + "locked_amount": "2162091.79893798351430427894", "deposits": [ { "amount": "1998.95815", @@ -23323,7 +23343,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "203258.7850094080512444", - "locked_amount": "12973852.5440339852469072887237507656745066", + "locked_amount": "12966326.2851132206444730663636805143254933", "deposits": [ { "amount": "16249.93", @@ -26451,7 +26471,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2764972.018594596729147647", - "locked_amount": "6255932.6035312481472902008742964", + "locked_amount": "6248984.409351215960935111906418583", "deposits": [ { "amount": "129284.449", @@ -31622,7 +31642,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1773434.744647395163801354", - "locked_amount": "2154853.403680393350625567930414999", + "locked_amount": "2152108.130137534146322763792771381", "deposits": [ { "amount": "552496.6455", @@ -33075,7 +33095,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "342932.12729879854768674909081684", + "locked_amount": "342595.80458534469382288375849824", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 4b062d8c3..ccce8c31d 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "80.3257137874175240000795304096905124", + "locked_amount": "79.60645389396243020007881827118214102", "deposits": [ { "amount": "1000", From 535bdb51837e24aa7434e9035899992cde318749 Mon Sep 17 00:00:00 2001 From: AndyWhiteVega <106072061+AndyWhiteVega@users.noreply.github.com> Date: Tue, 13 Sep 2022 08:43:40 +0100 Subject: [PATCH 61/66] Test/governance and wallet tweaks (#1309) * test: tweaks * test: lint * test: lint * test: remove unnessecary timeouts * test: lint * test: syntax tweak --- .../token-e2e/src/fixtures/proposals/freeform.json | 2 +- .../src/integration/flow/governance-flow.cy.js | 14 +++----------- .../token-e2e/src/support/wallet-vega.functions.js | 8 +++++++- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/apps/token-e2e/src/fixtures/proposals/freeform.json b/apps/token-e2e/src/fixtures/proposals/freeform.json index e3726769f..8643b7649 100644 --- a/apps/token-e2e/src/fixtures/proposals/freeform.json +++ b/apps/token-e2e/src/fixtures/proposals/freeform.json @@ -1,6 +1,6 @@ { "rationale": { - "title": "An example freeform proposal", + "title": "An example freeform proposal with unique number of: ", "description": "I propose that everyone evaluate the following IPFS document and vote Yes if they agree. [bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si](https://dweb.link/ipfs/bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si)" }, "terms": { diff --git a/apps/token-e2e/src/integration/flow/governance-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-flow.cy.js index 37319f0ac..644f493d3 100644 --- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js @@ -196,11 +196,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .then((proposalId) => { cy.get('[data-testid="set-proposals-filter-visible"]').click(); cy.get('[data-testid="filter-input"]').type(proposalId); - cy.get(`#${proposalId}`).should( - 'contain', - `Freeform proposal: ${proposalId}`, - txTimeout - ); + cy.get(`#${proposalId}`).should('contain', proposalId); }); }); @@ -230,11 +226,7 @@ context('Governance flow - with eth and vega wallets connected', function () { let proposalId = proposal.response.body.data.busEvents[0].event.id; cy.get('[data-testid="set-proposals-filter-visible"]').click(); cy.get('[data-testid="filter-input"]').type(proposerId); - cy.get(`#${proposalId}`).should( - 'contain', - `Freeform proposal: ${proposalId}`, - txTimeout - ); + cy.get(`#${proposalId}`).should('contain', proposalId); }); }); @@ -264,7 +256,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .then((proposalId) => { cy.get(openProposals).within(() => { cy.get(`#${proposalId}`) - .should('contain', `Freeform proposal: ${proposalId}`, txTimeout) + .should('contain', proposalId) .and('contain', 'Open') .and('be.visible') .within(() => { diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js index f77a2759d..883358645 100644 --- a/apps/token-e2e/src/support/wallet-vega.functions.js +++ b/apps/token-e2e/src/support/wallet-vega.functions.js @@ -1,5 +1,6 @@ const vegaWalletContainer = '[data-testid="vega-wallet"]'; const restConnectorForm = '[data-testid="rest-connector-form"]'; +const vegaWalletNameElement = '[data-testid="wallet-name"]'; const vegaWalletName = Cypress.env('vegaWalletName'); const vegaWalletLocation = Cypress.env('vegaWalletLocation'); const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase'); @@ -14,6 +15,11 @@ Cypress.Commands.add('vega_wallet_import', () => { cy.exec( `vegawallet service run --network DV --automatic-consent --home ${vegaWalletLocation}` ); + cy.exec(`vegawallet version`) + .its('stdout') + .then((output) => { + cy.log(output); + }); }); Cypress.Commands.add('vega_wallet_connect', () => { @@ -31,5 +37,5 @@ Cypress.Commands.add('vega_wallet_connect', () => { cy.get('#passphrase').click().type(vegaWalletPassphrase); cy.get('button').contains('Connect').click(); }); - cy.contains(`${vegaWalletName} key`, { timeout: 20000 }).should('be.visible'); + cy.get(vegaWalletNameElement).should('be.visible'); }); From 3ff5bbb5a77d46d51ea6c6523d159c00b1ae50ef Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 13 Sep 2022 01:19:41 -0700 Subject: [PATCH 62/66] chore: use trading header and tidy tailwind usage (#1313) * fix: border too thick, use grid head component * fix: unused and superfluous classes, define border color in one place * fix: tooltip should be on data not label --- .../trading-e2e/src/integration/markets.cy.ts | 2 +- apps/trading/.env | 2 +- apps/trading/components/footer/footer.tsx | 2 +- apps/trading/components/header/header.tsx | 19 +- apps/trading/components/icons/vega.tsx | 2 +- apps/trading/components/navbar/navbar.tsx | 4 +- .../vega-wallet-connect-button.tsx | 1 - apps/trading/pages/markets/trade-grid.tsx | 216 ++++++++---------- apps/trading/pages/styles.css | 4 + .../network-switcher/network-switcher.tsx | 13 +- libs/market-depth/src/lib/orderbook.tsx | 11 +- .../components/market-info/info-market.tsx | 2 +- .../lib/components/select-market-columns.tsx | 2 +- .../lib/components/select-market-table.tsx | 2 +- .../src/lib/components/select-market.tsx | 4 +- .../order-list/order-edit-dialog.tsx | 54 +++-- libs/positions/src/lib/positions.tsx | 4 +- .../src/components/button/button.tsx | 3 +- .../dropdown-menu/dropdown-menu.tsx | 2 +- .../src/components/popover/popover.tsx | 2 +- libs/ui-toolkit/src/components/tabs/tabs.tsx | 8 +- 21 files changed, 161 insertions(+), 198 deletions(-) diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index a4736732b..afc4ea06f 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -127,7 +127,7 @@ describe('markets table', () => { } function verifyMarketSummaryDisplayed() { - const marketSummaryBlock = 'market-summary'; + const marketSummaryBlock = 'header-summary'; const percentageValue = 'price-change-percentage'; const priceChangeValue = 'price-change'; const tradingVolume = 'trading-volume'; diff --git a/apps/trading/.env b/apps/trading/.env index 7bbc2ccfd..3fc6aca19 100644 --- a/apps/trading/.env +++ b/apps/trading/.env @@ -1,6 +1,6 @@ # App configuration variables NX_VEGA_ENV=TESTNET -NX_VEGA_URL=https://api.n09.testnet.vega.xyz/graphql +NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql NX_ETHEREUM_PROVIDER_URL=https://ropsten.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://ropsten.etherscan.io NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\"} diff --git a/apps/trading/components/footer/footer.tsx b/apps/trading/components/footer/footer.tsx index 5d1b668f1..ad35d6906 100644 --- a/apps/trading/components/footer/footer.tsx +++ b/apps/trading/components/footer/footer.tsx @@ -1,6 +1,6 @@ export const Footer = () => { return ( -
+
Status
diff --git a/apps/trading/components/header/header.tsx b/apps/trading/components/header/header.tsx index bc98f13ef..07442bb5a 100644 --- a/apps/trading/components/header/header.tsx +++ b/apps/trading/components/header/header.tsx @@ -5,19 +5,20 @@ import { cloneElement } from 'react'; interface TradeMarketHeaderProps { title: ReactNode; - children: ReactElement[]; + children: Array; } export const Header = ({ title, children }: TradeMarketHeaderProps) => { return ( -
+
-
{title}
+
{title}
{Children.map(children, (child, index) => { + if (!child) return null; return cloneElement(child, { id: `header-stat-${index}`, }); @@ -40,17 +41,17 @@ export const HeaderStat = ({ description?: string | ReactNode; }) => { const itemClass = - 'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-neutral-300 dark:border-neutral-600'; - const itemHeading = 'text-neutral-400'; + 'min-w-min w-[120px] whitespace-nowrap pb-3 px-4 border-l border-default'; + const itemHeading = 'text-neutral-500 dark:text-neutral-400'; return (
+
{heading}
-
- {heading} +
+ {children}
-
{children}
); }; diff --git a/apps/trading/components/icons/vega.tsx b/apps/trading/components/icons/vega.tsx index f8426c2f1..3ddb4140e 100644 --- a/apps/trading/components/icons/vega.tsx +++ b/apps/trading/components/icons/vega.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames'; export function Vega({ className }: { className?: string }) { - const svgClasses = classNames(className, 'fill-white'); + const svgClasses = classNames(className, 'fill-current'); return ( { })); const tradingPath = marketId ? `/markets/${marketId}` : '/markets'; return ( -
+
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} @@ -28,7 +28,7 @@ export const Navbar = ({ theme, toggleTheme }: NavbarProps) => { - +
); }; @@ -346,14 +317,7 @@ const TradeGridChild = ({ children }: TradeGridChildProps) => { return (
- {({ width, height }) => ( -
- {children} -
- )} + {({ width, height }) =>
{children}
}
); @@ -398,7 +362,7 @@ export const TradePanels = ({ market, onSelect }: TradePanelsProps) => { )}
-
+
{Object.keys(TradingViews).map((key) => { const isActive = view === key; const className = classNames('p-4 min-w-[100px] capitalize', { diff --git a/apps/trading/pages/styles.css b/apps/trading/pages/styles.css index 1fd222076..70459910c 100644 --- a/apps/trading/pages/styles.css +++ b/apps/trading/pages/styles.css @@ -18,3 +18,7 @@ html.dark { --focus-border: theme('colors.vega.yellow'); --separator-border: theme('colors.neutral.600'); } + +.border-default { + @apply border-neutral-300 dark:border-neutral-600; +} diff --git a/libs/environment/src/components/network-switcher/network-switcher.tsx b/libs/environment/src/components/network-switcher/network-switcher.tsx index bff6817a6..f933af496 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.tsx @@ -69,11 +69,7 @@ const NetworkLabel = ({ ); -export const NetworkSwitcher = ({ - fixedBg, -}: { - fixedBg?: 'dark' | 'light'; -}) => { +export const NetworkSwitcher = ({ theme }: { theme?: 'dark' | 'light' }) => { const { VEGA_ENV, VEGA_NETWORKS } = useEnvironment(); const [isOpen, setOpen] = useState(false); const [isAdvancedView, setAdvancedView] = useState(false); @@ -88,10 +84,9 @@ export const NetworkSwitcher = ({ [setOpen, setAdvancedView] ); - const dropdownTriggerClasses = classNames('hover:!bg-neutral-700', { - 'dark:text-white dark:bg-black text-black bg-white': !fixedBg, - 'text-black bg-white': fixedBg === 'light', - 'text-white bg-black': fixedBg === 'dark', + const dropdownTriggerClasses = classNames({ + 'text-black hover:!bg-neutral-300': theme === 'light', + 'text-white hover:!bg-neutral-700': theme === 'dark', }); return ( diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 01c48c081..809b77293 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -8,10 +8,11 @@ import { useState, useMemo, useCallback, + useContext, } from 'react'; import classNames from 'classnames'; -import { formatNumber, t, useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { formatNumber, t, ThemeContext } from '@vegaprotocol/react-helpers'; import { MarketTradingMode } from '@vegaprotocol/types'; import { OrderbookRow } from './orderbook-row'; import { createRow, getPriceLevel } from './orderbook-data'; @@ -27,7 +28,7 @@ interface OrderbookProps extends OrderbookData { const HorizontalLine = ({ top, testId }: { top: string; testId: string }) => (
@@ -106,7 +107,7 @@ export const Orderbook = ({ resolution, onResolutionChange, }: OrderbookProps) => { - const [theme] = useThemeSwitcher(); + const theme = useContext(ThemeContext); const scrollElement = useRef(null); // scroll offset for which rendered rows are selected, will change after user will scroll to margin of rendered data const [scrollOffset, setScrollOffset] = useState(0); @@ -320,7 +321,7 @@ export const Orderbook = ({ data-testid="scroll" >
{t('Bid vol')}
@@ -344,7 +345,7 @@ export const Orderbook = ({ )}
diff --git a/libs/market-info/src/components/market-info/info-market.tsx b/libs/market-info/src/components/market-info/info-market.tsx index c9ae55fd9..4f73571ee 100644 --- a/libs/market-info/src/components/market-info/info-market.tsx +++ b/libs/market-info/src/components/market-info/info-market.tsx @@ -335,7 +335,7 @@ export const Info = ({ market, onSelect }: InfoProps) => {

{t('Market data')}

-
+

{t('Market specification')}

diff --git a/libs/market-list/src/lib/components/select-market-columns.tsx b/libs/market-list/src/lib/components/select-market-columns.tsx index 89bb684d4..1db863775 100644 --- a/libs/market-list/src/lib/components/select-market-columns.tsx +++ b/libs/market-list/src/lib/components/select-market-columns.tsx @@ -24,7 +24,7 @@ import type { } from '../__generated__/MarketList'; import isNil from 'lodash/isNil'; -export const cellClassNames = 'px-0 py-1 first:text-left text-right'; +export const cellClassNames = 'py-1 first:text-left text-right'; const FeesInfo = () => { return ( diff --git a/libs/market-list/src/lib/components/select-market-table.tsx b/libs/market-list/src/lib/components/select-market-table.tsx index faa2991cd..3539d754f 100644 --- a/libs/market-list/src/lib/components/select-market-table.tsx +++ b/libs/market-list/src/lib/components/select-market-table.tsx @@ -7,7 +7,7 @@ export const SelectMarketTableHeader = ({ headers = columnHeaders, }) => { return ( -

+ {headers.map(({ value, className, onlyOnDetailed }, i) => { const thClass = classNames( 'font-normal text-neutral-500 dark:text-neutral-400', diff --git a/libs/market-list/src/lib/components/select-market.tsx b/libs/market-list/src/lib/components/select-market.tsx index bbfc0b778..33ebf1df5 100644 --- a/libs/market-list/src/lib/components/select-market.tsx +++ b/libs/market-list/src/lib/components/select-market.tsx @@ -76,7 +76,7 @@ export const SelectAllMarketsTableBody = ({ if (!data) return null; return ( <> - + {/* Border styles required to create space between tbody elements margin/padding dont work */} @@ -101,7 +101,7 @@ export const SelectMarketPopover = ({ onSelect: (id: string) => void; }) => { const triggerClasses = - 'sm:text-lg md:text-xl lg:text-2xl font-medium flex items-center gap-4 whitespace-nowrap my-3 hover:text-neutral-500 dark:hover:text-neutral-300'; + 'sm:text-lg md:text-xl lg:text-2xl flex items-center gap-2 whitespace-nowrap hover:text-neutral-500 dark:hover:text-neutral-300'; const { keypair } = useVegaWallet(); const [open, setOpen] = useState(false); const { data, loading: marketsLoading } = useMarketList(); diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index 0fb03e705..8419e5faf 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -87,34 +87,32 @@ export const OrderEditDialog = ({ )} -
- - - - Number(value) > 0 - ? true - : t('The price cannot be negative'), - }, - })} - id="entryPrice" - /> - {errors.entryPrice?.message && ( - - {errors.entryPrice.message} - - )} - - - -
+ + + + Number(value) > 0 ? true : t('The price cannot be negative'), + }, + })} + id="entryPrice" + /> + {errors.entryPrice?.message && ( + {errors.entryPrice.message} + )} + + + ); }; diff --git a/libs/positions/src/lib/positions.tsx b/libs/positions/src/lib/positions.tsx index 97e2a2ea8..0377e79ee 100644 --- a/libs/positions/src/lib/positions.tsx +++ b/libs/positions/src/lib/positions.tsx @@ -82,8 +82,8 @@ export const Positions = memo( }; return ( -
-

+
+

{assetSymbol} {t('markets')}

diff --git a/libs/ui-toolkit/src/components/button/button.tsx b/libs/ui-toolkit/src/components/button/button.tsx index 126107a4f..7a7ba1e22 100644 --- a/libs/ui-toolkit/src/components/button/button.tsx +++ b/libs/ui-toolkit/src/components/button/button.tsx @@ -22,7 +22,8 @@ const defaultClasses = [ 'border-black dark:border-white', 'bg-white dark:bg-black', 'enabled:hover:bg-neutral-200 dark:enabled:hover:bg-neutral-700', - 'enabled:active:bg-neutral-200 dark:enabled:active:bg-neutral-700 enabled:active:border-neutral-400 dark:enabled:active:border-neutral-400', + 'enabled:active:bg-neutral-200 dark:enabled:active:bg-neutral-700', + 'enabled:active:border-neutral-400', ]; const primary = [ 'text-black', diff --git a/libs/ui-toolkit/src/components/dropdown-menu/dropdown-menu.tsx b/libs/ui-toolkit/src/components/dropdown-menu/dropdown-menu.tsx index 305158a22..845fd0e39 100644 --- a/libs/ui-toolkit/src/components/dropdown-menu/dropdown-menu.tsx +++ b/libs/ui-toolkit/src/components/dropdown-menu/dropdown-menu.tsx @@ -29,7 +29,7 @@ export const DropdownMenuTrigger = forwardRef< className, 'text-sm py-1 px-2 rounded bg-transparent border border-neutral-500', 'focus:border-black dark:focus:border-white whitespace-nowrap', - 'hover:bg-neutral-100 dark:hover:bg-neutral-700' + 'hover:bg-neutral-200 dark:hover:bg-neutral-700' ); return ( { className="h-full grid grid-rows-[min-content_1fr]" onValueChange={(value) => setActiveTab(value)} > -
+
{ if (!isValidElement(child) || child.props.hidden) return null; const isActive = child.props.id === activeTab; const triggerClass = classNames( - 'relative px-4 py-2 border-r border-neutral-300 dark:border-neutral-600', + 'relative px-4 py-2 border-r border-default', 'uppercase', - 'inline-block after:content-[attr(data-testid)] after:block after:invisible after:overflow-hidden after:h-0 after:tracking-wider', { - 'text-neutral-400 dark:text-neutral-400 hover:text-neutral-500 dark:hover:text-neutral-300': + 'cursor-default': isActive, + 'text-neutral-400 hover:text-neutral-500 dark:hover:text-neutral-300': !isActive, } ); From a08f63c7d89e1125785fd5a1df8bb578d42ac70f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Tue, 13 Sep 2022 12:14:06 +0200 Subject: [PATCH 63/66] Feature/1243 market data providers refactoring (#1254) * feat(#1243): Market data providers * feat(#1243): Market data providers * feat(#1243): Market data providers * feat(#1243): refactor market lists * feat(#1243): refactor market lists * feat(#1243): refactor market lists * feat(#1243): refactor orderbook data providers * feat(#1243): refactor orderbook data providers * feat(#1243): refactor depth chart data layer * feat(#1243): fix market depth typing * fixed unit tests * feat(#1243): e2e test fixes * feat(#1243): code style fixes * feat(#1243): post merge fixes * feat(#1243): fix lint issues * feat(#1243): post merge fixes * feat(#1243): remove market name from market * feat(#1243): fix console lite e2e data depth mocks * feat(#1243): fix console lite e2e market trade test * feat(#1243): fix lint issues * feat(#1243): fix trading e2e home test Co-authored-by: asiaznik --- .../src/integration/market-selector.test.ts | 2 + .../src/integration/market-trade.test.ts | 6 +- .../support/mocks/generate-market-depth.ts | 28 +- .../src/support/mocks/generate-markets.ts | 40 +++ .../app/hooks/use-calculate-slippage.spec.tsx | 9 + .../src/app/hooks/use-calculate-slippage.ts | 19 +- apps/trading-e2e/src/integration/home.cy.ts | 11 +- .../trading-e2e/src/integration/markets.cy.ts | 16 +- .../support/mocks/generate-market-depth.ts | 17 - .../src/support/mocks/generate-markets.ts | 315 +++++++++++------ .../src/support/mocks/generate-order-book.ts | 20 -- apps/trading-e2e/src/support/trading.ts | 11 +- apps/trading/pages/index.page.tsx | 8 +- .../deal-ticket/deal-ticket-container.tsx | 1 + .../src/lib/__generated__/MarketDepth.ts | 82 ----- .../__generated__/MarketDepthSubscription.ts | 85 +---- libs/market-depth/src/lib/depth-chart.tsx | 145 ++++++-- libs/market-depth/src/lib/index.ts | 2 +- .../src/lib/market-depth-data-provider.ts | 138 -------- .../src/lib/market-depth-provider.ts | 111 ++++++ libs/market-depth/src/lib/orderbook-data.ts | 94 ++--- .../src/lib/orderbook-manager.tsx | 124 ++++--- .../src/lib/use-orderbook-data.ts | 4 +- libs/market-list/src/lib/MarketData.graphql | 75 ---- .../lib/__generated__/MarketCandlesQuery.ts | 78 +++++ .../src/lib/__generated__/MarketCandlesSub.ts | 46 +++ .../src/lib/__generated__/MarketDataFields.ts | 32 +- .../src/lib/__generated__/MarketDataQuery.ts | 95 ++++++ .../src/lib/__generated__/MarketDataSub.ts | 50 +-- .../src/lib/__generated__/MarketFields.ts | 154 +++++++++ .../{MarketList.ts => Markets.ts} | 131 ++----- .../lib/__generated__/MarketsCandlesQuery.ts | 81 +++++ .../src/lib/__generated__/MarketsDataQuery.ts | 91 +++++ .../src/lib/__generated__/index.ts | 9 + .../markets-container/market-list-table.tsx | 24 +- .../markets-container/markets-container.tsx | 78 +---- .../lib/components/select-market-columns.tsx | 79 ++--- .../src/lib/components/select-market.spec.tsx | 321 +++++++++--------- .../src/lib/components/select-market.tsx | 175 ++++++---- libs/market-list/src/lib/index.ts | 9 +- .../src/lib/market-candles-provider.ts | 83 +++++ .../src/lib/market-data-provider.ts | 81 +++++ libs/market-list/src/lib/market-provider.ts | 19 ++ .../src/lib/markets-candles-provider.ts | 53 +++ .../src/lib/markets-data-provider.ts | 156 ++------- libs/market-list/src/lib/markets-provider.ts | 144 ++++++++ .../src/lib/utils/market-utils.spec.tsx | 257 +++----------- .../market-list/src/lib/utils/market-utils.ts | 44 +-- libs/positions/src/index.ts | 1 + .../src/lib/positions-data-providers.ts | 4 +- .../src/hooks/use-data-provider.ts | 20 +- .../src/lib/generic-data-provider.ts | 65 ++-- libs/types/src/__generated__/globalTypes.ts | 4 +- 53 files changed, 2201 insertions(+), 1546 deletions(-) delete mode 100644 libs/market-depth/src/lib/market-depth-data-provider.ts create mode 100644 libs/market-depth/src/lib/market-depth-provider.ts delete mode 100644 libs/market-list/src/lib/MarketData.graphql create mode 100644 libs/market-list/src/lib/__generated__/MarketCandlesQuery.ts create mode 100644 libs/market-list/src/lib/__generated__/MarketCandlesSub.ts create mode 100644 libs/market-list/src/lib/__generated__/MarketDataQuery.ts create mode 100644 libs/market-list/src/lib/__generated__/MarketFields.ts rename libs/market-list/src/lib/__generated__/{MarketList.ts => Markets.ts} (55%) create mode 100644 libs/market-list/src/lib/__generated__/MarketsCandlesQuery.ts create mode 100644 libs/market-list/src/lib/__generated__/MarketsDataQuery.ts create mode 100644 libs/market-list/src/lib/__generated__/index.ts create mode 100644 libs/market-list/src/lib/market-candles-provider.ts create mode 100644 libs/market-list/src/lib/market-data-provider.ts create mode 100644 libs/market-list/src/lib/market-provider.ts create mode 100644 libs/market-list/src/lib/markets-candles-provider.ts create mode 100644 libs/market-list/src/lib/markets-provider.ts diff --git a/apps/console-lite-e2e/src/integration/market-selector.test.ts b/apps/console-lite-e2e/src/integration/market-selector.test.ts index be2502964..7b94eacb6 100644 --- a/apps/console-lite-e2e/src/integration/market-selector.test.ts +++ b/apps/console-lite-e2e/src/integration/market-selector.test.ts @@ -9,6 +9,7 @@ import { generatePartyBalance } from '../support/mocks/generate-party-balance'; import { generatePartyMarketData } from '../support/mocks/generate-party-market-data'; import { generateMarketMarkPrice } from '../support/mocks/generate-market-mark-price'; import { generateMarketNames } from '../support/mocks/generate-market-names'; +import { generateMarketDepth } from '../support/mocks/generate-market-depth'; describe('market selector', () => { let markets; @@ -23,6 +24,7 @@ describe('market selector', () => { aliasQuery(req, 'PartyMarketData', generatePartyMarketData()); aliasQuery(req, 'MarketMarkPrice', generateMarketMarkPrice()); aliasQuery(req, 'MarketNames', generateMarketNames()); + aliasQuery(req, 'MarketDepth', generateMarketDepth()); }); cy.visit('/markets'); diff --git a/apps/console-lite-e2e/src/integration/market-trade.test.ts b/apps/console-lite-e2e/src/integration/market-trade.test.ts index 6665940bd..0e7cf03a7 100644 --- a/apps/console-lite-e2e/src/integration/market-trade.test.ts +++ b/apps/console-lite-e2e/src/integration/market-trade.test.ts @@ -1,5 +1,8 @@ import { aliasQuery } from '@vegaprotocol/cypress'; -import { generateSimpleMarkets } from '../support/mocks/generate-markets'; +import { + generateSimpleMarkets, + generateMarkets, +} from '../support/mocks/generate-markets'; import { generateDealTicket } from '../support/mocks/generate-deal-ticket'; import { generateMarketTags } from '../support/mocks/generate-market-tags'; import { generateMarketPositions } from '../support/mocks/generate-market-positions'; @@ -14,6 +17,7 @@ describe('Market trade', () => { let markets; beforeEach(() => { cy.mockGQL((req) => { + aliasQuery(req, 'Markets', generateMarkets()); aliasQuery(req, 'SimpleMarkets', generateSimpleMarkets()); aliasQuery(req, 'DealTicketQuery', generateDealTicket()); aliasQuery(req, 'MarketTags', generateMarketTags()); diff --git a/apps/console-lite-e2e/src/support/mocks/generate-market-depth.ts b/apps/console-lite-e2e/src/support/mocks/generate-market-depth.ts index f8c60fead..d0342a6ea 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-market-depth.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-market-depth.ts @@ -1,24 +1,15 @@ -export const generateMarketDepth = () => { - return { +import merge from 'lodash/merge'; +import type { PartialDeep } from 'type-fest'; +// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries +import type { MarketDepth } from '../../../../../libs/market-depth/src/lib/__generated__/MarketDepth'; + +export const generateMarketDepth = ( + override?: PartialDeep +): MarketDepth => { + const defaultResult: MarketDepth = { market: { id: 'a46bd7e5277087723b7ab835844dec3cef8b4445738101269624bf5537d5d423', - decimalPlaces: 5, - positionDecimalPlaces: 0, - data: { - staticMidPrice: '9893006', - marketTradingMode: 'TRADING_MODE_CONTINUOUS', - indicativeVolume: '0', - indicativePrice: '0', - bestStaticBidPrice: '9893006', - bestStaticOfferPrice: '9893006', - market: { - id: 'a46bd7e5277087723b7ab835844dec3cef8b4445738101269624bf5537d5d423', - __typename: 'Market', - }, - __typename: 'MarketData', - }, depth: { - lastTrade: { price: '9893006', __typename: 'Trade' }, sell: [ { price: '9893007', @@ -215,4 +206,5 @@ export const generateMarketDepth = () => { __typename: 'Market', }, }; + return merge(defaultResult, override); }; diff --git a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts index 18a3cdc42..16d39a83a 100644 --- a/apps/console-lite-e2e/src/support/mocks/generate-markets.ts +++ b/apps/console-lite-e2e/src/support/mocks/generate-markets.ts @@ -1,3 +1,5 @@ +import merge from 'lodash/merge'; +import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; import { protoMarket } from './commons'; export const generateSimpleMarkets = () => { @@ -880,3 +882,41 @@ export const generateLongListMarkets = (count: number) => { } return { markets }; }; + +export const generateMarkets = (override?) => { + const markets = [ + { + ...protoMarket, + decimalPlaces: 5, + positionDecimalPlaces: 0, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + state: MarketState.STATE_ACTIVE, + marketTimestamps: { + __typename: 'MarketTimestamps', + close: '', + open: '', + }, + fees: { + __typename: 'Fees', + factors: { + __typename: 'FeeFactors', + makerFee: '', + infrastructureFee: '', + liquidityFee: '', + }, + }, + }, + ]; + + const defaultResult = { + marketsConnection: { + __typename: 'MarketConnection', + edges: markets.map((node) => ({ + __typename: 'MarketEdge', + node, + })), + }, + }; + + return merge(defaultResult, override); +}; diff --git a/apps/console-lite/src/app/hooks/use-calculate-slippage.spec.tsx b/apps/console-lite/src/app/hooks/use-calculate-slippage.spec.tsx index 49b58dfd5..b5706cb88 100644 --- a/apps/console-lite/src/app/hooks/use-calculate-slippage.spec.tsx +++ b/apps/console-lite/src/app/hooks/use-calculate-slippage.spec.tsx @@ -64,6 +64,15 @@ jest.mock('@vegaprotocol/market-depth', () => ({ useOrderBookData: jest.fn(() => mockOrderBookData), })); +jest.mock('@vegaprotocol/react-helpers', () => ({ + ...jest.requireActual('@vegaprotocol/react-helpers'), + useDataProvider: jest.fn(() => ({ + data: { + marketsConnection: [], + }, + })), +})); + describe('useCalculateSlippage Hook', () => { describe('calculate proper result', () => { afterEach(() => { diff --git a/apps/console-lite/src/app/hooks/use-calculate-slippage.ts b/apps/console-lite/src/app/hooks/use-calculate-slippage.ts index 13520587a..ccf937a66 100644 --- a/apps/console-lite/src/app/hooks/use-calculate-slippage.ts +++ b/apps/console-lite/src/app/hooks/use-calculate-slippage.ts @@ -1,9 +1,15 @@ import { useMemo } from 'react'; import { Side } from '@vegaprotocol/types'; import { useOrderBookData } from '@vegaprotocol/market-depth'; +import { marketProvider } from '@vegaprotocol/market-list'; +import type { Market } from '@vegaprotocol/market-list'; import type { Order } from '@vegaprotocol/orders'; import { BigNumber } from 'bignumber.js'; -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { + formatNumber, + toBigNum, + useDataProvider, +} from '@vegaprotocol/react-helpers'; interface Props { marketId: string; @@ -16,11 +22,16 @@ const useCalculateSlippage = ({ marketId, order }: Props) => { variables, throttleMilliseconds: 5000, }); + const { data: market } = useDataProvider({ + dataProvider: marketProvider, + noUpdate: true, + variables, + }); const volPriceArr = data?.depth[order.side === Side.SIDE_BUY ? 'sell' : 'buy'] || []; - if (volPriceArr.length) { - const decimals = data?.decimalPlaces ?? 0; - const positionDecimals = data?.positionDecimalPlaces ?? 0; + if (volPriceArr.length && market) { + const decimals = market.decimalPlaces ?? 0; + const positionDecimals = market.positionDecimalPlaces ?? 0; const bestPrice = toBigNum(volPriceArr[0].price, decimals); const { size } = order; let descSize = new BigNumber(size); diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index 996050767..509b020bf 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -55,11 +55,16 @@ describe('home', () => { it('redirects to a the market list page if no sensible default is found', () => { // Mock markets query that is triggered by home page to find default market cy.mockGQL((req) => { - aliasQuery(req, 'MarketList', { markets: [] }); + const data = { + marketsConnection: { + __typename: 'MarketConnection', + edges: [], + }, + }; + aliasQuery(req, 'Markets', data); }); - cy.visit('/'); - cy.wait('@MarketList'); + cy.wait('@Markets'); cy.url().should('eq', Cypress.config().baseUrl + '/markets'); }); }); diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index afc4ea06f..fada777dc 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -11,7 +11,9 @@ describe('markets table', () => { it('renders markets correctly', () => { cy.visit('/'); cy.wait('@Market'); - cy.wait('@MarketList'); + cy.wait('@Markets'); + cy.wait('@MarketsDataQuery'); + cy.wait('@MarketsCandlesQuery'); cy.get('[data-testid^="market-link-"]') .should('not.be.empty') .and('have.attr', 'href'); @@ -24,7 +26,9 @@ describe('markets table', () => { it('renders market list drop down', () => { cy.visit('/'); - cy.wait('@MarketList'); + cy.wait('@Markets'); + cy.wait('@MarketsDataQuery'); + cy.wait('@MarketsCandlesQuery'); openMarketDropDown(); cy.getByTestId('price').invoke('text').should('not.be.empty'); cy.getByTestId('trading-mode').should('not.be.empty'); @@ -35,7 +39,9 @@ describe('markets table', () => { it('Able to select market from dropdown', () => { cy.visit('/'); - cy.wait('@MarketList'); + cy.wait('@Markets'); + cy.wait('@MarketsDataQuery'); + cy.wait('@MarketsCandlesQuery'); openMarketDropDown(); cy.getByTestId('market-link-market-0').should('be.visible').click(); @@ -53,7 +59,9 @@ describe('markets table', () => { 'SOLUSD', ]; cy.visit('/'); - cy.wait('@MarketList'); + cy.wait('@Markets'); + cy.wait('@MarketsDataQuery'); + cy.wait('@MarketsCandlesQuery'); cy.getByTestId('link').should('have.attr', 'href', '/markets').click(); cy.url().should('eq', Cypress.config('baseUrl') + '/markets'); cy.contains('AAPL.MF21').should('be.visible'); diff --git a/apps/trading-e2e/src/support/mocks/generate-market-depth.ts b/apps/trading-e2e/src/support/mocks/generate-market-depth.ts index d7016fc1c..74012beb1 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-depth.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-depth.ts @@ -1,5 +1,4 @@ import merge from 'lodash/merge'; -import { MarketTradingMode } from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries import type { MarketDepth } from '../../../../../libs/market-depth/src/lib/__generated__/MarketDepth'; @@ -10,26 +9,10 @@ export const generateMarketDepth = ( const defaultResult: MarketDepth = { market: { id: 'market-0', - decimalPlaces: 5, - positionDecimalPlaces: 0, - data: { - marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, - staticMidPrice: '0', - indicativePrice: '0', - bestStaticBidPrice: '0', - bestStaticOfferPrice: '0', - indicativeVolume: '0', - market: { - id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35', - __typename: 'Market', - }, - __typename: 'MarketData', - }, depth: { __typename: 'MarketDepth', buy: [], sell: [], - lastTrade: null, sequenceNumber: '', }, __typename: 'Market', diff --git a/apps/trading-e2e/src/support/mocks/generate-markets.ts b/apps/trading-e2e/src/support/mocks/generate-markets.ts index c4724aa7a..f40925d47 100644 --- a/apps/trading-e2e/src/support/mocks/generate-markets.ts +++ b/apps/trading-e2e/src/support/mocks/generate-markets.ts @@ -5,12 +5,17 @@ import { MarketTradingMode, } from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; -import type { MarketList, MarketList_markets } from '@vegaprotocol/market-list'; +import type { + Markets, + Markets_marketsConnection_edges_node, + MarketsCandlesQuery, + MarketsCandlesQuery_marketsConnection_edges_node, + MarketsDataQuery, + MarketsDataQuery_marketsConnection_edges_node, +} from '@vegaprotocol/market-list'; -export const generateMarkets = ( - override?: PartialDeep -): MarketList => { - const markets: MarketList_markets[] = [ +export const generateMarkets = (override?: PartialDeep): Markets => { + const markets: Markets_marketsConnection_edges_node[] = [ { id: 'market-0', decimalPlaces: 5, @@ -22,15 +27,6 @@ export const generateMarkets = ( close: '', open: '', }, - candles: [ - { - __typename: 'Candle', - open: '100', - close: '100', - high: '110', - low: '90', - }, - ], fees: { __typename: 'Fees', factors: { @@ -40,20 +36,6 @@ export const generateMarkets = ( liquidityFee: '', }, }, - data: { - market: { - id: '10cd0a793ad2887b340940337fa6d97a212e0e517fe8e9eab2b5ef3a38633f35', - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, - __typename: 'Market', - }, - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', - markPrice: '4612690058', - trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { id: '', @@ -87,15 +69,6 @@ export const generateMarkets = ( close: '', open: '', }, - candles: [ - { - __typename: 'Candle', - open: '100', - close: '100', - high: '110', - low: '90', - }, - ], fees: { __typename: 'Fees', factors: { @@ -105,20 +78,6 @@ export const generateMarkets = ( liquidityFee: '', }, }, - data: { - market: { - id: '34d95e10faa00c21d19d382d6d7e6fc9722a96985369f0caec041b0f44b775ed', - state: MarketState.STATE_SUSPENDED, - tradingMode: MarketTradingMode.TRADING_MODE_NO_TRADING, - __typename: 'Market', - }, - bestBidPrice: '0', - bestOfferPrice: '0', - indicativeVolume: '0', - markPrice: '8441', - trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { id: 'SOLUSD', @@ -152,15 +111,6 @@ export const generateMarkets = ( close: '2022-08-26T11:36:32.252490405Z', open: null, }, - candles: [ - { - __typename: 'Candle', - open: '100', - close: '100', - high: '110', - low: '90', - }, - ], fees: { __typename: 'Fees', factors: { @@ -170,20 +120,6 @@ export const generateMarkets = ( liquidityFee: '0.001', }, }, - data: { - market: { - id: 'a1c731af07570ca49b22a3cd253cc143dc14068edbec918e1087e69db934af5f', - state: MarketState.STATE_SUSPENDED, - tradingMode: MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, - __typename: 'Market', - }, - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', - markPrice: '4612690058', - trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { id: '', @@ -217,15 +153,6 @@ export const generateMarkets = ( close: '2022-08-26T11:36:32.252490405Z', open: null, }, - candles: [ - { - __typename: 'Candle', - open: '100', - close: '100', - high: '110', - low: '90', - }, - ], fees: { __typename: 'Fees', factors: { @@ -235,20 +162,6 @@ export const generateMarkets = ( liquidityFee: '0.001', }, }, - data: { - market: { - id: 'bebea8ec669b913a7d6a704a6d8cede164bc1376229e0d472bc6fdaa976629b2', - state: MarketState.STATE_ACTIVE, - tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, - __typename: 'Market', - }, - indicativeVolume: '0', - bestBidPrice: '0', - bestOfferPrice: '0', - markPrice: '4612690058', - trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY, - __typename: 'MarketData', - }, tradableInstrument: { instrument: { id: '', @@ -272,8 +185,212 @@ export const generateMarkets = ( __typename: 'Market', }, ]; - const defaultResult = { - markets, + + const defaultResult: Markets = { + marketsConnection: { + __typename: 'MarketConnection', + edges: markets.map((node) => ({ + __typename: 'MarketEdge', + node, + })), + }, + }; + + return merge(defaultResult, override); +}; + +export const generateMarketsData = ( + override?: PartialDeep +): MarketsDataQuery => { + const markets: MarketsDataQuery_marketsConnection_edges_node[] = [ + { + data: { + market: { + id: 'market-0', + __typename: 'Market', + }, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + staticMidPrice: '0', + indicativePrice: '0', + bestStaticBidPrice: '0', + bestStaticOfferPrice: '0', + indicativeVolume: '0', + bestBidPrice: '0', + bestOfferPrice: '0', + markPrice: '4612690058', + trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, + __typename: 'MarketData', + }, + __typename: 'Market', + }, + { + data: { + market: { + id: 'market-1', + __typename: 'Market', + }, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + staticMidPrice: '0', + indicativePrice: '0', + bestStaticBidPrice: '0', + bestStaticOfferPrice: '0', + indicativeVolume: '0', + bestBidPrice: '0', + bestOfferPrice: '0', + markPrice: '8441', + trigger: AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED, + __typename: 'MarketData', + }, + __typename: 'Market', + }, + { + data: { + market: { + id: 'market-2', + __typename: 'Market', + }, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + staticMidPrice: '0', + indicativePrice: '0', + bestStaticBidPrice: '0', + bestStaticOfferPrice: '0', + indicativeVolume: '0', + bestBidPrice: '0', + bestOfferPrice: '0', + markPrice: '4612690058', + trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY, + __typename: 'MarketData', + }, + __typename: 'Market', + }, + { + data: { + market: { + id: 'market-3', + __typename: 'Market', + }, + marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, + staticMidPrice: '0', + indicativePrice: '0', + bestStaticBidPrice: '0', + bestStaticOfferPrice: '0', + indicativeVolume: '0', + bestBidPrice: '0', + bestOfferPrice: '0', + markPrice: '4612690058', + trigger: AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY, + __typename: 'MarketData', + }, + __typename: 'Market', + }, + ]; + + const defaultResult: MarketsDataQuery = { + marketsConnection: { + __typename: 'MarketConnection', + edges: markets.map((node) => ({ + __typename: 'MarketEdge', + node, + })), + }, + }; + + return merge(defaultResult, override); +}; + +export const generateMarketsCandles = ( + override?: PartialDeep +): MarketsCandlesQuery => { + const markets: MarketsCandlesQuery_marketsConnection_edges_node[] = [ + { + __typename: 'Market', + id: 'market-0', + candlesConnection: { + __typename: 'CandleDataConnection', + edges: [ + { + __typename: 'CandleEdge', + node: { + __typename: 'CandleNode', + open: '100', + close: '100', + high: '110', + low: '90', + volume: '1', + }, + }, + ], + }, + }, + { + __typename: 'Market', + id: 'market-1', + candlesConnection: { + __typename: 'CandleDataConnection', + edges: [ + { + __typename: 'CandleEdge', + node: { + __typename: 'CandleNode', + open: '100', + close: '100', + high: '110', + low: '90', + volume: '1', + }, + }, + ], + }, + }, + { + __typename: 'Market', + id: 'market-2', + candlesConnection: { + __typename: 'CandleDataConnection', + edges: [ + { + __typename: 'CandleEdge', + node: { + __typename: 'CandleNode', + open: '100', + close: '100', + high: '110', + low: '90', + volume: '1', + }, + }, + ], + }, + }, + { + __typename: 'Market', + id: 'market-3', + candlesConnection: { + __typename: 'CandleDataConnection', + edges: [ + { + __typename: 'CandleEdge', + node: { + __typename: 'CandleNode', + open: '100', + close: '100', + high: '110', + low: '90', + volume: '1', + }, + }, + ], + }, + }, + ]; + const defaultResult: MarketsCandlesQuery = { + marketsConnection: { + __typename: 'MarketConnection', + edges: markets.map((node) => ({ + __typename: 'MarketEdge', + node, + })), + }, }; return merge(defaultResult, override); diff --git a/apps/trading-e2e/src/support/mocks/generate-order-book.ts b/apps/trading-e2e/src/support/mocks/generate-order-book.ts index 763072179..1529083e2 100644 --- a/apps/trading-e2e/src/support/mocks/generate-order-book.ts +++ b/apps/trading-e2e/src/support/mocks/generate-order-book.ts @@ -4,33 +4,13 @@ import type { MarketDepth, MarketDepth_market, } from '@vegaprotocol/market-depth'; -import { MarketTradingMode } from '@vegaprotocol/types'; export const generateOrderBook = ( override?: PartialDeep ): MarketDepth => { const marketDepth: MarketDepth_market = { id: 'b2426f67b085ba8fb429f1b529d49372b2d096c6fb6f509f76c5863abb6d969e', - decimalPlaces: 5, - positionDecimalPlaces: 0, - data: { - staticMidPrice: '826337', - marketTradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, - indicativeVolume: '0', - indicativePrice: '0', - bestStaticBidPrice: '826336', - bestStaticOfferPrice: '826338', - market: { - id: 'b2426f67b085ba8fb429f1b529d49372b2d096c6fb6f509f76c5863abb6d969e', - __typename: 'Market', - }, - __typename: 'MarketData', - }, depth: { - lastTrade: { - price: '826338', - __typename: 'Trade', - }, sell: [ { price: '826338', diff --git a/apps/trading-e2e/src/support/trading.ts b/apps/trading-e2e/src/support/trading.ts index 0b11bfeb1..a63074c0f 100644 --- a/apps/trading-e2e/src/support/trading.ts +++ b/apps/trading-e2e/src/support/trading.ts @@ -8,7 +8,11 @@ import { generateDealTicketQuery } from './mocks/generate-deal-ticket-query'; import { generateMarket } from './mocks/generate-market'; import { generateMarketDepth } from './mocks/generate-market-depth'; import { generateMarketInfoQuery } from './mocks/generate-market-info-query'; -import { generateMarkets } from './mocks/generate-markets'; +import { + generateMarkets, + generateMarketsData, + generateMarketsCandles, +} from './mocks/generate-markets'; import { generateOrders } from './mocks/generate-orders'; import { generatePositions } from './mocks/generate-positions'; import { generateTrades } from './mocks/generate-trades'; @@ -31,7 +35,10 @@ export const mockTradingPage = ( }, }) ); - aliasQuery(req, 'MarketList', generateMarkets()); + aliasQuery(req, 'Markets', generateMarkets()); + aliasQuery(req, 'MarketsDataQuery', generateMarketsData()); + aliasQuery(req, 'MarketsCandlesQuery', generateMarketsCandles()); + aliasQuery(req, 'MarketDepth', generateMarketDepth()); aliasQuery(req, 'Orders', generateOrders()); aliasQuery(req, 'Accounts', generateAccounts()); diff --git a/apps/trading/pages/index.page.tsx b/apps/trading/pages/index.page.tsx index 542344bc8..347e2b8ff 100644 --- a/apps/trading/pages/index.page.tsx +++ b/apps/trading/pages/index.page.tsx @@ -1,4 +1,5 @@ -import { useMarketList } from '@vegaprotocol/market-list'; +import { activeMarketsProvider } from '@vegaprotocol/market-list'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { useRouter } from 'next/router'; import { useEffect } from 'react'; @@ -8,7 +9,10 @@ export function Index() { const { replace } = useRouter(); // The default market selected in the platform behind the overlay // should be the oldest market that is currently trading in continuous mode(i.e. not in auction). - const { data, error, loading } = useMarketList(); + const { data, error, loading } = useDataProvider({ + dataProvider: activeMarketsProvider, + noUpdate: true, + }); const { riskNoticeDialog, update } = useGlobalStore((store) => ({ riskNoticeDialog: store.riskNoticeDialog, update: store.update, diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx index 62682822f..3282ac731 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx @@ -64,6 +64,7 @@ export const DealTicketContainer = ({ ) ) : ( + {JSON.stringify(data)}

{t('Could not load market')}

)} diff --git a/libs/market-depth/src/lib/__generated__/MarketDepth.ts b/libs/market-depth/src/lib/__generated__/MarketDepth.ts index 7b043223b..7de7f05b6 100644 --- a/libs/market-depth/src/lib/__generated__/MarketDepth.ts +++ b/libs/market-depth/src/lib/__generated__/MarketDepth.ts @@ -3,60 +3,10 @@ // @generated // This file was automatically generated and should not be edited. -import { MarketTradingMode } from "@vegaprotocol/types"; - // ==================================================== // GraphQL query operation: MarketDepth // ==================================================== -export interface MarketDepth_market_data_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; -} - -export interface MarketDepth_market_data { - __typename: "MarketData"; - /** - * the arithmetic average of the best static bid price and best static offer price - */ - staticMidPrice: string; - /** - * what state the market is in (auction, continuous, etc) - */ - marketTradingMode: MarketTradingMode; - /** - * indicative volume if the auction ended now, 0 if not in auction mode - */ - indicativeVolume: string; - /** - * indicative price if the auction ended now, 0 if not in auction mode - */ - indicativePrice: string; - /** - * the highest price level on an order book for buy orders not including pegged orders. - */ - bestStaticBidPrice: string; - /** - * the lowest price level on an order book for offer orders not including pegged orders. - */ - bestStaticOfferPrice: string; - /** - * market ID of the associated mark price - */ - market: MarketDepth_market_data_market; -} - -export interface MarketDepth_market_depth_lastTrade { - __typename: "Trade"; - /** - * The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64) - */ - price: string; -} - export interface MarketDepth_market_depth_sell { __typename: "PriceLevel"; /** @@ -91,10 +41,6 @@ export interface MarketDepth_market_depth_buy { export interface MarketDepth_market_depth { __typename: "MarketDepth"; - /** - * Last trade for the given market (if available) - */ - lastTrade: MarketDepth_market_depth_lastTrade | null; /** * Sell side price levels (if available) */ @@ -115,34 +61,6 @@ export interface MarketDepth_market { * Market ID */ id: 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 indicates 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. - * This sets how big the smallest order / position on the market can be. - */ - positionDecimalPlaces: number; - /** - * marketData for the given market - */ - data: MarketDepth_market_data | null; /** * Current depth on the order book for this market */ diff --git a/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts b/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts index 456b6cc8c..03de5c765 100644 --- a/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts +++ b/libs/market-depth/src/lib/__generated__/MarketDepthSubscription.ts @@ -3,72 +3,11 @@ // @generated // This file was automatically generated and should not be edited. -import { MarketTradingMode } from "@vegaprotocol/types"; - // ==================================================== // GraphQL subscription operation: MarketDepthSubscription // ==================================================== -export interface MarketDepthSubscription_marketDepthUpdate_market_data_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; -} - -export interface MarketDepthSubscription_marketDepthUpdate_market_data { - __typename: "MarketData"; - /** - * the arithmetic average of the best static bid price and best static offer price - */ - staticMidPrice: string; - /** - * what state the market is in (auction, continuous, etc) - */ - marketTradingMode: MarketTradingMode; - /** - * indicative volume if the auction ended now, 0 if not in auction mode - */ - indicativeVolume: string; - /** - * indicative price if the auction ended now, 0 if not in auction mode - */ - indicativePrice: string; - /** - * the highest price level on an order book for buy orders not including pegged orders. - */ - bestStaticBidPrice: string; - /** - * the lowest price level on an order book for offer orders not including pegged orders. - */ - bestStaticOfferPrice: string; - /** - * market ID of the associated mark price - */ - market: MarketDepthSubscription_marketDepthUpdate_market_data_market; -} - -export interface MarketDepthSubscription_marketDepthUpdate_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * positionDecimalPlaces indicates 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. - * This sets how big the smallest order / position on the market can be. - */ - positionDecimalPlaces: number; - /** - * marketData for the given market - */ - data: MarketDepthSubscription_marketDepthUpdate_market_data | null; -} - -export interface MarketDepthSubscription_marketDepthUpdate_sell { +export interface MarketDepthSubscription_marketsDepthUpdate_sell { __typename: "PriceLevel"; /** * The price of all the orders at this level (uint64) @@ -84,7 +23,7 @@ export interface MarketDepthSubscription_marketDepthUpdate_sell { numberOfOrders: string; } -export interface MarketDepthSubscription_marketDepthUpdate_buy { +export interface MarketDepthSubscription_marketsDepthUpdate_buy { __typename: "PriceLevel"; /** * The price of all the orders at this level (uint64) @@ -100,33 +39,37 @@ export interface MarketDepthSubscription_marketDepthUpdate_buy { numberOfOrders: string; } -export interface MarketDepthSubscription_marketDepthUpdate { - __typename: "MarketDepthUpdate"; +export interface MarketDepthSubscription_marketsDepthUpdate { + __typename: "ObservableMarketDepthUpdate"; /** - * Market + * Market ID */ - market: MarketDepthSubscription_marketDepthUpdate_market; + marketId: string; /** * Sell side price levels (if available) */ - sell: MarketDepthSubscription_marketDepthUpdate_sell[] | null; + sell: MarketDepthSubscription_marketsDepthUpdate_sell[] | null; /** * Buy side price levels (if available) */ - buy: MarketDepthSubscription_marketDepthUpdate_buy[] | null; + buy: MarketDepthSubscription_marketsDepthUpdate_buy[] | null; /** * Sequence number for the current snapshot of the market depth. It is always increasing but not monotonic. */ sequenceNumber: string; + /** + * Sequence number of the last update sent; useful for checking that no updates were missed. + */ + previousSequenceNumber: string; } export interface MarketDepthSubscription { /** * Subscribe to price level market depth updates */ - marketDepthUpdate: MarketDepthSubscription_marketDepthUpdate; + marketsDepthUpdate: MarketDepthSubscription_marketsDepthUpdate[]; } export interface MarketDepthSubscriptionVariables { - marketId: string; + id: string; } diff --git a/libs/market-depth/src/lib/depth-chart.tsx b/libs/market-depth/src/lib/depth-chart.tsx index 8b830b49b..87cd59550 100644 --- a/libs/market-depth/src/lib/depth-chart.tsx +++ b/libs/market-depth/src/lib/depth-chart.tsx @@ -7,7 +7,7 @@ import { ThemeContext, getNumberFormat, } from '@vegaprotocol/react-helpers'; -import dataProvider from './market-depth-data-provider'; +import dataProvider from './market-depth-provider'; import { useCallback, useEffect, @@ -16,7 +16,13 @@ import { useState, useContext, } from 'react'; -import type { MarketDepthSubscription_marketDepthUpdate } from './__generated__/MarketDepthSubscription'; +import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; +import type { MarketData } from '@vegaprotocol/market-list'; +import type { + MarketDepthSubscription_marketsDepthUpdate, + MarketDepthSubscription_marketsDepthUpdate_sell, + MarketDepthSubscription_marketsDepthUpdate_buy, +} from './__generated__/MarketDepthSubscription'; import type { DepthChartProps } from 'pennant'; import { parseLevel, updateLevels } from './depth-chart-utils'; @@ -33,46 +39,80 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => { const theme = useContext(ThemeContext); const variables = useMemo(() => ({ marketId }), [marketId]); const [depthData, setDepthData] = useState(null); - const [decimalPlaces, setDecimalPlaces] = useState(0); - const [positionDecimalPlaces, setPositionDecimalPlaces] = useState(0); const dataRef = useRef(null); - const setDepthDataThrottledRef = useRef(throttle(setDepthData, 1000)); + const marketDataRef = useRef(null); + const deltaRef = useRef<{ + sell: MarketDepthSubscription_marketsDepthUpdate_sell[]; + buy: MarketDepthSubscription_marketsDepthUpdate_buy[]; + }>({ + sell: [], + buy: [], + }); - // Apply updates to the table - const update = useCallback( - ({ delta }: { delta: MarketDepthSubscription_marketDepthUpdate }) => { - if (!dataRef.current) { - return false; + const updateDepthData = useRef( + throttle(() => { + if (!dataRef.current || !marketDataRef.current || !market) { + return; } dataRef.current = { ...dataRef.current, - midPrice: delta.market.data?.staticMidPrice - ? formatMidPrice(delta.market.data?.staticMidPrice, decimalPlaces) + midPrice: marketDataRef.current?.staticMidPrice + ? formatMidPrice( + marketDataRef.current?.staticMidPrice, + market.decimalPlaces + ) : undefined, data: { - buy: delta.buy + buy: deltaRef.current.buy ? updateLevels( dataRef.current.data.buy, - delta.buy, - decimalPlaces, - positionDecimalPlaces, + deltaRef.current.buy, + market.decimalPlaces, + market.positionDecimalPlaces, true ) : dataRef.current.data.buy, - sell: delta.sell + sell: deltaRef.current.sell ? updateLevels( dataRef.current.data.sell, - delta.sell, - decimalPlaces, - positionDecimalPlaces + deltaRef.current.sell, + market.decimalPlaces, + market.positionDecimalPlaces ) : dataRef.current.data.sell, }, }; - setDepthDataThrottledRef.current(dataRef.current); + deltaRef.current.buy = []; + deltaRef.current.sell = []; + setDepthData(dataRef.current); + }, 1000) + ); + + // Apply updates to the table + const update = useCallback( + ({ + delta: deltas, + }: { + delta: MarketDepthSubscription_marketsDepthUpdate[]; + }) => { + if (!dataRef.current) { + return false; + } + for (const delta of deltas) { + if (delta.marketId !== marketId) { + continue; + } + if (delta.sell) { + deltaRef.current.sell.push(...delta.sell); + } + if (delta.buy) { + deltaRef.current.buy.push(...delta.buy); + } + updateDepthData.current(); + } return true; }, - [decimalPlaces, positionDecimalPlaces] + [marketId, updateDepthData] ); const { data, error, loading } = useDataProvider({ @@ -81,53 +121,86 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => { variables, }); + const { + data: market, + error: marketError, + loading: marketLoading, + } = useDataProvider({ + dataProvider: marketProvider, + noUpdate: true, + variables, + }); + + const marketDataUpdate = useCallback(({ data }: { data: MarketData }) => { + marketDataRef.current = data; + return true; + }, []); + + const { + data: marketData, + error: marketDataError, + loading: marketDataLoading, + } = useDataProvider({ + dataProvider: marketDataProvider, + update: marketDataUpdate, + variables, + }); + + marketDataRef.current = marketData; + useEffect(() => { + if (!marketData || !market || !data) { + return; + } if (!data) { dataRef.current = null; setDepthData(dataRef.current); return; } dataRef.current = { - midPrice: data.data?.staticMidPrice - ? formatMidPrice(data.data?.staticMidPrice, data.decimalPlaces) + midPrice: marketData.staticMidPrice + ? formatMidPrice(marketData.staticMidPrice, market.decimalPlaces) : undefined, data: { buy: data.depth.buy?.map((priceLevel) => parseLevel( priceLevel, - data.decimalPlaces, - data.positionDecimalPlaces + market.decimalPlaces, + market.positionDecimalPlaces ) ) ?? [], sell: data.depth.sell?.map((priceLevel) => parseLevel( priceLevel, - data.decimalPlaces, - data.positionDecimalPlaces + market.decimalPlaces, + market.positionDecimalPlaces ) ) ?? [], }, }; setDepthData(dataRef.current); - setDecimalPlaces(data.decimalPlaces); - setPositionDecimalPlaces(data.positionDecimalPlaces); - }, [data]); + }, [data, marketData, market]); const volumeFormat = useCallback( (volume: number) => - getNumberFormat(data?.positionDecimalPlaces || 0).format(volume), - [data?.positionDecimalPlaces] + getNumberFormat(market?.positionDecimalPlaces || 0).format(volume), + [market?.positionDecimalPlaces] ); const priceFormat = useCallback( - (price: number) => getNumberFormat(data?.decimalPlaces || 0).format(price), - [data?.decimalPlaces] + (price: number) => + getNumberFormat(market?.decimalPlaces || 0).format(price), + [market?.decimalPlaces] ); return ( - + {depthData && ( = {}; - -const update: Update< - MarketDepth_market, - MarketDepthSubscription_marketDepthUpdate -> = (data, delta, reload) => { - if (delta.market.id !== data.id) { - return data; - } - const sequenceNumber = Number(delta.sequenceNumber); - if (sequenceNumber <= sequenceNumbers[delta.market.id]) { - return data; - } - /* - if (sequenceNumber - 1 !== sequenceNumbers[delta.market.id]) { - sequenceNumbers[delta.market.id] = 0; - reload(); - return; - } - */ - sequenceNumbers[delta.market.id] = sequenceNumber; - const updatedData = { - ...data, - data: delta.market.data, - depth: { ...data.depth }, - }; - if (delta.buy) { - updatedData.depth.buy = updateLevels(data.depth.buy ?? [], delta.buy); - } - if (delta.sell) { - updatedData.depth.sell = updateLevels(data.depth.sell ?? [], delta.sell); - } - return updatedData; -}; - -const getData = (responseData: MarketDepth) => { - if (responseData.market?.id) { - sequenceNumbers[responseData.market.id] = Number( - responseData.market.depth.sequenceNumber - ); - } - return responseData.market; -}; -const getDelta = (subscriptionData: MarketDepthSubscription) => - subscriptionData.marketDepthUpdate; - -export const marketDepthDataProvider = makeDataProvider({ - query: MARKET_DEPTH_QUERY, - subscriptionQuery: MARKET_DEPTH_SUBSCRIPTION_QUERY, - update, - getData, - getDelta, -}); - -export default marketDepthDataProvider; diff --git a/libs/market-depth/src/lib/market-depth-provider.ts b/libs/market-depth/src/lib/market-depth-provider.ts new file mode 100644 index 000000000..2a5c1dcee --- /dev/null +++ b/libs/market-depth/src/lib/market-depth-provider.ts @@ -0,0 +1,111 @@ +import { gql } from '@apollo/client'; +import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { updateLevels } from './orderbook-data'; +import type { Update } from '@vegaprotocol/react-helpers'; +import type { + MarketDepth, + MarketDepth_market, +} from './__generated__/MarketDepth'; +import type { + MarketDepthSubscription, + MarketDepthSubscription_marketsDepthUpdate, +} from './__generated__/MarketDepthSubscription'; + +const MARKET_DEPTH_QUERY = gql` + query MarketDepth($marketId: ID!) { + market(id: $marketId) { + id + depth { + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + } + } + } +`; + +export const MARKET_DEPTH_SUBSCRIPTION_QUERY = gql` + subscription MarketDepthSubscription($marketId: ID!) { + marketsDepthUpdate(marketIds: [$marketId]) { + marketId + sell { + price + volume + numberOfOrders + } + buy { + price + volume + numberOfOrders + } + sequenceNumber + previousSequenceNumber + } + } +`; + +const sequenceNumbers: Record = {}; + +const update: Update< + MarketDepth_market, + MarketDepthSubscription_marketsDepthUpdate[] +> = (data, deltas, reload) => { + for (const delta of deltas) { + if (delta.marketId !== data.id) { + continue; + } + const sequenceNumber = Number(delta.sequenceNumber); + if (sequenceNumber <= sequenceNumbers[delta.marketId]) { + return data; + } + /* + if (sequenceNumber - 1 !== sequenceNumbers[delta.market.id]) { + sequenceNumbers[delta.market.id] = 0; + reload(); + return; + } + */ + sequenceNumbers[delta.marketId] = sequenceNumber; + const updatedData = { + ...data, + depth: { ...data.depth }, + }; + if (delta.buy) { + updatedData.depth.buy = updateLevels(data.depth.buy ?? [], delta.buy); + } + if (delta.sell) { + updatedData.depth.sell = updateLevels(data.depth.sell ?? [], delta.sell); + } + return updatedData; + } + return data; +}; + +const getData = (responseData: MarketDepth) => { + if (responseData.market?.id) { + sequenceNumbers[responseData.market.id] = Number( + responseData.market.depth.sequenceNumber + ); + } + return responseData.market; +}; +const getDelta = (subscriptionData: MarketDepthSubscription) => + subscriptionData.marketsDepthUpdate; + +export const marketDepthProvider = makeDataProvider({ + query: MARKET_DEPTH_QUERY, + subscriptionQuery: MARKET_DEPTH_SUBSCRIPTION_QUERY, + update, + getData, + getDelta, +}); + +export default marketDepthProvider; diff --git a/libs/market-depth/src/lib/orderbook-data.ts b/libs/market-depth/src/lib/orderbook-data.ts index fa515a464..1bb1341e3 100644 --- a/libs/market-depth/src/lib/orderbook-data.ts +++ b/libs/market-depth/src/lib/orderbook-data.ts @@ -1,15 +1,14 @@ import groupBy from 'lodash/groupBy'; import { VolumeType } from '@vegaprotocol/react-helpers'; import { MarketTradingMode } from '@vegaprotocol/types'; +import type { MarketData } from '@vegaprotocol/market-list'; import type { MarketDepth_market_depth_sell, MarketDepth_market_depth_buy, - MarketDepth_market_data, } from './__generated__/MarketDepth'; import type { - MarketDepthSubscription_marketDepthUpdate_sell, - MarketDepthSubscription_marketDepthUpdate_buy, - MarketDepthSubscription_marketDepthUpdate_market_data, + MarketDepthSubscription_marketsDepthUpdate_sell, + MarketDepthSubscription_marketsDepthUpdate_buy, } from './__generated__/MarketDepthSubscription'; export interface CumulativeVol { @@ -33,7 +32,7 @@ export interface OrderbookRowData { type PartialOrderbookRowData = Pick; export type OrderbookData = Partial< - Omit + Omit > & { rows: OrderbookRowData[] | null }; export const getPriceLevel = (price: string | bigint, resolution: number) => { @@ -105,11 +104,13 @@ export const createRow = ( const mapRawData = (dataType: VolumeType.ask | VolumeType.bid) => ( - data: + data: Omit< | MarketDepth_market_depth_sell - | MarketDepthSubscription_marketDepthUpdate_sell + | MarketDepthSubscription_marketsDepthUpdate_sell | MarketDepth_market_depth_buy - | MarketDepthSubscription_marketDepthUpdate_buy + | MarketDepthSubscription_marketsDepthUpdate_buy, + '__typename' + > ): PartialOrderbookRowData => createPartialRow(data.price, Number(data.volume), dataType); @@ -118,16 +119,18 @@ const mapRawData = */ export const compactRows = ( sell: - | ( + | Omit< | MarketDepth_market_depth_sell - | MarketDepthSubscription_marketDepthUpdate_sell - )[] + | MarketDepthSubscription_marketsDepthUpdate_sell, + '__typename' + >[] | null, buy: - | ( + | Omit< | MarketDepth_market_depth_buy - | MarketDepthSubscription_marketDepthUpdate_buy - )[] + | MarketDepthSubscription_marketsDepthUpdate_buy, + '__typename' + >[] | null, resolution: number ) => { @@ -199,8 +202,8 @@ const partiallyUpdateCompactedRows = ( dataType: VolumeType, data: OrderbookRowData[], delta: - | MarketDepthSubscription_marketDepthUpdate_sell - | MarketDepthSubscription_marketDepthUpdate_buy, + | MarketDepthSubscription_marketsDepthUpdate_sell + | MarketDepthSubscription_marketsDepthUpdate_buy, resolution: number, modifiedIndex: number ): [number, OrderbookRowData[]] => { @@ -255,8 +258,8 @@ const partiallyUpdateCompactedRows = ( */ export const updateCompactedRows = ( rows: OrderbookRowData[], - sell: MarketDepthSubscription_marketDepthUpdate_sell[] | null, - buy: MarketDepthSubscription_marketDepthUpdate_buy[] | null, + sell: MarketDepthSubscription_marketsDepthUpdate_sell[] | null, + buy: MarketDepthSubscription_marketsDepthUpdate_buy[] | null, resolution: number ) => { let sellModifiedIndex = -1; @@ -320,10 +323,13 @@ export const updateCompactedRows = ( }; export const mapMarketData = ( - data: - | MarketDepth_market_data - | MarketDepthSubscription_marketDepthUpdate_market_data - | null, + data: Pick< + MarketData, + | 'staticMidPrice' + | 'bestStaticBidPrice' + | 'bestStaticOfferPrice' + | 'indicativePrice' + > | null, resolution: number ) => ({ staticMidPrice: @@ -347,8 +353,8 @@ export const mapMarketData = ( export const updateLevels = ( draft: (MarketDepth_market_depth_buy | MarketDepth_market_depth_sell)[], updates: ( - | MarketDepthSubscription_marketDepthUpdate_buy - | MarketDepthSubscription_marketDepthUpdate_sell + | MarketDepthSubscription_marketsDepthUpdate_buy + | MarketDepthSubscription_marketsDepthUpdate_sell )[] ) => { const levels = [...draft]; @@ -399,41 +405,37 @@ export const generateMockData = ({ }: MockDataGeneratorParams) => { let matrix = new Array(numberOfSellRows).fill(undefined); let price = midPrice + (numberOfSellRows - Math.ceil(overlap / 2) + 1); - const sell: MarketDepth_market_depth_sell[] = matrix.map((row, i) => ({ - __typename: 'PriceLevel', - price: (price -= 1).toString(), - volume: (numberOfSellRows - i + 1).toString(), - numberOfOrders: '', - })); + const sell: Omit[] = matrix.map( + (row, i) => ({ + price: (price -= 1).toString(), + volume: (numberOfSellRows - i + 1).toString(), + numberOfOrders: '', + }) + ); price += overlap; matrix = new Array(numberOfBuyRows).fill(undefined); - const buy: MarketDepth_market_depth_buy[] = matrix.map((row, i) => ({ - __typename: 'PriceLevel', - price: (price -= 1).toString(), - volume: (i + 2).toString(), - numberOfOrders: '', - })); + const buy: Omit[] = matrix.map( + (row, i) => ({ + price: (price -= 1).toString(), + volume: (i + 2).toString(), + numberOfOrders: '', + }) + ); const rows = compactRows(sell, buy, resolution); return { rows, resolution, indicativeVolume: indicativeVolume?.toString(), + marketTradingMode: + overlap > 0 + ? MarketTradingMode.TRADING_MODE_BATCH_AUCTION + : MarketTradingMode.TRADING_MODE_CONTINUOUS, ...mapMarketData( { - __typename: 'MarketData', staticMidPrice: '', - marketTradingMode: - overlap > 0 - ? MarketTradingMode.TRADING_MODE_BATCH_AUCTION - : MarketTradingMode.TRADING_MODE_CONTINUOUS, bestStaticBidPrice: bestStaticBidPrice.toString(), bestStaticOfferPrice: bestStaticOfferPrice.toString(), indicativePrice: indicativePrice?.toString() ?? '', - indicativeVolume: indicativeVolume?.toString() ?? '', - market: { - __typename: 'Market', - id: '', - }, }, resolution ), diff --git a/libs/market-depth/src/lib/orderbook-manager.tsx b/libs/market-depth/src/lib/orderbook-manager.tsx index 0772401cd..e43bd559c 100644 --- a/libs/market-depth/src/lib/orderbook-manager.tsx +++ b/libs/market-depth/src/lib/orderbook-manager.tsx @@ -2,9 +2,15 @@ import throttle from 'lodash/throttle'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { Orderbook } from './orderbook'; import { useDataProvider } from '@vegaprotocol/react-helpers'; -import dataProvider from './market-depth-data-provider'; +import marketDepthProvider from './market-depth-provider'; +import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; +import type { MarketData } from '@vegaprotocol/market-list'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; -import type { MarketDepthSubscription_marketDepthUpdate } from './__generated__/MarketDepthSubscription'; +import type { + MarketDepthSubscription_marketsDepthUpdate, + MarketDepthSubscription_marketsDepthUpdate_sell, + MarketDepthSubscription_marketsDepthUpdate_buy, +} from './__generated__/MarketDepthSubscription'; import { compactRows, updateCompactedRows, @@ -24,82 +30,116 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => { rows: null, }); const dataRef = useRef({ rows: null }); - const deltaRef = useRef(); + const marketDataRef = useRef(null); + const deltaRef = useRef<{ + sell: MarketDepthSubscription_marketsDepthUpdate_sell[]; + buy: MarketDepthSubscription_marketsDepthUpdate_buy[]; + }>({ + sell: [], + buy: [], + }); const updateOrderbookData = useRef( throttle(() => { - if (!deltaRef.current) { - return; - } dataRef.current = { - ...deltaRef.current.market.data, - ...mapMarketData(deltaRef.current.market.data, resolutionRef.current), - rows: updateCompactedRows( - dataRef.current.rows ?? [], - deltaRef.current.sell, - deltaRef.current.buy, - resolutionRef.current - ), + ...marketDataRef.current, + ...mapMarketData(marketDataRef.current, resolutionRef.current), + rows: + deltaRef.current.buy.length || deltaRef.current.sell.length + ? updateCompactedRows( + dataRef.current.rows ?? [], + deltaRef.current.sell, + deltaRef.current.buy, + resolutionRef.current + ) + : dataRef.current.rows, }; - deltaRef.current = undefined; + deltaRef.current.buy = []; + deltaRef.current.sell = []; setOrderbookData(dataRef.current); }, 1000) ); const update = useCallback( - ({ delta }: { delta: MarketDepthSubscription_marketDepthUpdate }) => { + ({ + delta: deltas, + }: { + delta: MarketDepthSubscription_marketsDepthUpdate[]; + }) => { if (!dataRef.current.rows) { return false; } - if (deltaRef.current) { - deltaRef.current.market = delta.market; + for (const delta of deltas) { + if (delta.marketId !== marketId) { + continue; + } if (delta.sell) { - if (deltaRef.current.sell) { - deltaRef.current.sell.push(...delta.sell); - } else { - deltaRef.current.sell = delta.sell; - } + deltaRef.current.sell.push(...delta.sell); } if (delta.buy) { - if (deltaRef.current.buy) { - deltaRef.current.buy.push(...delta.buy); - } else { - deltaRef.current.buy = delta.buy; - } + deltaRef.current.buy.push(...delta.buy); } - } else { - deltaRef.current = delta; + updateOrderbookData.current(); } - updateOrderbookData.current(); return true; }, - // using resolutionRef.current to avoid using resolution as a dependency - it will cause data provider restart on resolution change - [] + [marketId, updateOrderbookData] ); const { data, error, loading, flush } = useDataProvider({ - dataProvider, + dataProvider: marketDepthProvider, update, variables, }); + const { + data: market, + error: marketError, + loading: marketLoading, + } = useDataProvider({ + dataProvider: marketProvider, + noUpdate: true, + variables, + }); + + const marketDataUpdate = useCallback(({ data }: { data: MarketData }) => { + marketDataRef.current = data; + updateOrderbookData.current(); + return true; + }, []); + + const { + data: marketData, + error: marketDataError, + loading: marketDataLoading, + } = useDataProvider({ + dataProvider: marketDataProvider, + update: marketDataUpdate, + variables, + }); + + marketDataRef.current = marketData; + useEffect(() => { const throttleRunnner = updateOrderbookData.current; + if (!marketDataRef.current) { + return; + } if (!data) { dataRef.current = { rows: null }; setOrderbookData(dataRef.current); return; } dataRef.current = { - ...data.data, + ...marketDataRef.current, + ...mapMarketData(marketDataRef.current, resolution), rows: compactRows(data.depth.sell, data.depth.buy, resolution), - ...mapMarketData(data.data, resolution), }; setOrderbookData(dataRef.current); return () => { throttleRunnner.cancel(); }; - }, [data, resolution]); + }, [data, marketData, resolution]); useEffect(() => { resolutionRef.current = resolution; @@ -107,11 +147,15 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => { }, [resolution, flush]); return ( - + setResolution(resolution)} /> diff --git a/libs/market-depth/src/lib/use-orderbook-data.ts b/libs/market-depth/src/lib/use-orderbook-data.ts index ace259830..c4a007f59 100644 --- a/libs/market-depth/src/lib/use-orderbook-data.ts +++ b/libs/market-depth/src/lib/use-orderbook-data.ts @@ -1,8 +1,8 @@ import { useCallback, useEffect, useRef, useState } from 'react'; import throttle from 'lodash/throttle'; import { useDataProvider } from '@vegaprotocol/react-helpers'; -import dataProvider from './market-depth-data-provider'; -import type { MarketDepth_market } from './'; +import dataProvider from './market-depth-provider'; +import type { MarketDepth_market } from './__generated__/MarketDepth'; interface Props { variables: { marketId: string }; diff --git a/libs/market-list/src/lib/MarketData.graphql b/libs/market-list/src/lib/MarketData.graphql deleted file mode 100644 index 5bc5f9906..000000000 --- a/libs/market-list/src/lib/MarketData.graphql +++ /dev/null @@ -1,75 +0,0 @@ -fragment MarketDataFields on MarketData { - market { - id - state - tradingMode - } - bestBidPrice - bestOfferPrice - markPrice - trigger - indicativeVolume -} - -query MarketList($interval: Interval!, $since: String!) { - markets { - id - name - decimalPlaces - positionDecimalPlaces - state - tradingMode - fees { - factors { - makerFee - infrastructureFee - liquidityFee - } - } - data { - market { - id - state - tradingMode - } - bestBidPrice - bestOfferPrice - markPrice - trigger - indicativeVolume - } - tradableInstrument { - instrument { - id - name - code - metadata { - tags - } - product { - ... on Future { - settlementAsset { - symbol - } - } - } - } - } - marketTimestamps { - open - close - } - candles(interval: $interval, since: $since) { - open - close - high - low - } - } -} - -subscription MarketDataSub { - marketData { - ...MarketDataFields - } -} diff --git a/libs/market-list/src/lib/__generated__/MarketCandlesQuery.ts b/libs/market-list/src/lib/__generated__/MarketCandlesQuery.ts new file mode 100644 index 000000000..070d3e591 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketCandlesQuery.ts @@ -0,0 +1,78 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Interval } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: MarketCandlesQuery +// ==================================================== + +export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node { + __typename: "CandleNode"; + /** + * High price (uint64) + */ + high: string; + /** + * Low price (uint64) + */ + low: string; + /** + * Open price (uint64) + */ + open: string; + /** + * Close price (uint64) + */ + close: string; + /** + * Volume price (uint64) + */ + volume: string; +} + +export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges { + __typename: "CandleEdge"; + node: MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node; +} + +export interface MarketCandlesQuery_marketsConnection_edges_node_candlesConnection { + __typename: "CandleDataConnection"; + /** + * The candles + */ + edges: (MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges | null)[] | null; +} + +export interface MarketCandlesQuery_marketsConnection_edges_node { + __typename: "Market"; + /** + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination + */ + candlesConnection: MarketCandlesQuery_marketsConnection_edges_node_candlesConnection; +} + +export interface MarketCandlesQuery_marketsConnection_edges { + __typename: "MarketEdge"; + node: MarketCandlesQuery_marketsConnection_edges_node; +} + +export interface MarketCandlesQuery_marketsConnection { + __typename: "MarketConnection"; + /** + * The markets in this connection + */ + edges: MarketCandlesQuery_marketsConnection_edges[]; +} + +export interface MarketCandlesQuery { + marketsConnection: MarketCandlesQuery_marketsConnection; +} + +export interface MarketCandlesQueryVariables { + interval: Interval; + since: string; + marketId: string; +} diff --git a/libs/market-list/src/lib/__generated__/MarketCandlesSub.ts b/libs/market-list/src/lib/__generated__/MarketCandlesSub.ts new file mode 100644 index 000000000..c5a5a4738 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketCandlesSub.ts @@ -0,0 +1,46 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Interval } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL subscription operation: MarketCandlesSub +// ==================================================== + +export interface MarketCandlesSub_candles { + __typename: "Candle"; + /** + * High price (uint64) + */ + high: string; + /** + * Low price (uint64) + */ + low: string; + /** + * Open price (uint64) + */ + open: string; + /** + * Close price (uint64) + */ + close: string; + /** + * Volume price (uint64) + */ + volume: string; +} + +export interface MarketCandlesSub { + /** + * Subscribe to the candles updates + */ + candles: MarketCandlesSub_candles; +} + +export interface MarketCandlesSubVariables { + marketId: string; + interval: Interval; +} diff --git a/libs/market-list/src/lib/__generated__/MarketDataFields.ts b/libs/market-list/src/lib/__generated__/MarketDataFields.ts index 44cdd10ac..d31d4b3c2 100644 --- a/libs/market-list/src/lib/__generated__/MarketDataFields.ts +++ b/libs/market-list/src/lib/__generated__/MarketDataFields.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { MarketState, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/types"; +import { AuctionTrigger, MarketTradingMode } from "@vegaprotocol/types"; // ==================================================== // GraphQL fragment: MarketDataFields @@ -15,20 +15,12 @@ export interface MarketDataFields_market { * Market ID */ id: string; - /** - * Current state of the market - */ - state: MarketState; - /** - * Current mode of execution of the market - */ - tradingMode: MarketTradingMode; } export interface MarketDataFields { __typename: "MarketData"; /** - * market ID of the associated mark price + * market of the associated mark price */ market: MarketDataFields_market; /** @@ -47,8 +39,28 @@ export interface MarketDataFields { * what triggered an auction (if an auction was started) */ trigger: AuctionTrigger; + /** + * the arithmetic average of the best static bid price and best static offer price + */ + staticMidPrice: string; + /** + * what state the market is in (auction, continuous, etc) + */ + marketTradingMode: MarketTradingMode; /** * indicative volume if the auction ended now, 0 if not in auction mode */ indicativeVolume: string; + /** + * indicative price if the auction ended now, 0 if not in auction mode + */ + indicativePrice: string; + /** + * the highest price level on an order book for buy orders not including pegged orders. + */ + bestStaticBidPrice: string; + /** + * the lowest price level on an order book for offer orders not including pegged orders. + */ + bestStaticOfferPrice: string; } diff --git a/libs/market-list/src/lib/__generated__/MarketDataQuery.ts b/libs/market-list/src/lib/__generated__/MarketDataQuery.ts new file mode 100644 index 000000000..67b13d022 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketDataQuery.ts @@ -0,0 +1,95 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { AuctionTrigger, MarketTradingMode } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: MarketDataQuery +// ==================================================== + +export interface MarketDataQuery_marketsConnection_edges_node_data_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; +} + +export interface MarketDataQuery_marketsConnection_edges_node_data { + __typename: "MarketData"; + /** + * market of the associated mark price + */ + market: MarketDataQuery_marketsConnection_edges_node_data_market; + /** + * the highest price level on an order book for buy orders. + */ + bestBidPrice: string; + /** + * the lowest price level on an order book for offer orders. + */ + bestOfferPrice: string; + /** + * the mark price (an unsigned integer) + */ + markPrice: string; + /** + * what triggered an auction (if an auction was started) + */ + trigger: AuctionTrigger; + /** + * the arithmetic average of the best static bid price and best static offer price + */ + staticMidPrice: string; + /** + * what state the market is in (auction, continuous, etc) + */ + marketTradingMode: MarketTradingMode; + /** + * indicative volume if the auction ended now, 0 if not in auction mode + */ + indicativeVolume: string; + /** + * indicative price if the auction ended now, 0 if not in auction mode + */ + indicativePrice: string; + /** + * the highest price level on an order book for buy orders not including pegged orders. + */ + bestStaticBidPrice: string; + /** + * the lowest price level on an order book for offer orders not including pegged orders. + */ + bestStaticOfferPrice: string; +} + +export interface MarketDataQuery_marketsConnection_edges_node { + __typename: "Market"; + /** + * marketData for the given market + */ + data: MarketDataQuery_marketsConnection_edges_node_data | null; +} + +export interface MarketDataQuery_marketsConnection_edges { + __typename: "MarketEdge"; + node: MarketDataQuery_marketsConnection_edges_node; +} + +export interface MarketDataQuery_marketsConnection { + __typename: "MarketConnection"; + /** + * The markets in this connection + */ + edges: MarketDataQuery_marketsConnection_edges[]; +} + +export interface MarketDataQuery { + marketsConnection: MarketDataQuery_marketsConnection; +} + +export interface MarketDataQueryVariables { + id: string; +} diff --git a/libs/market-list/src/lib/__generated__/MarketDataSub.ts b/libs/market-list/src/lib/__generated__/MarketDataSub.ts index c77181ea3..bb78f4ae2 100644 --- a/libs/market-list/src/lib/__generated__/MarketDataSub.ts +++ b/libs/market-list/src/lib/__generated__/MarketDataSub.ts @@ -3,34 +3,18 @@ // @generated // This file was automatically generated and should not be edited. -import { MarketState, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/types"; +import { AuctionTrigger, MarketTradingMode } from "@vegaprotocol/types"; // ==================================================== // GraphQL subscription operation: MarketDataSub // ==================================================== -export interface MarketDataSub_marketData_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * Current state of the market - */ - state: MarketState; - /** - * Current mode of execution of the market - */ - tradingMode: MarketTradingMode; -} - -export interface MarketDataSub_marketData { - __typename: "MarketData"; +export interface MarketDataSub_marketsData { + __typename: "ObservableMarketData"; /** * market ID of the associated mark price */ - market: MarketDataSub_marketData_market; + marketId: string; /** * the highest price level on an order book for buy orders. */ @@ -47,15 +31,39 @@ export interface MarketDataSub_marketData { * what triggered an auction (if an auction was started) */ trigger: AuctionTrigger; + /** + * the arithmetic average of the best static bid price and best static offer price + */ + staticMidPrice: string; + /** + * what state the market is in (auction, continuous etc) + */ + marketTradingMode: MarketTradingMode; /** * indicative volume if the auction ended now, 0 if not in auction mode */ indicativeVolume: string; + /** + * indicative price if the auction ended now, 0 if not in auction mode + */ + indicativePrice: string; + /** + * the highest price level on an order book for buy orders not including pegged orders. + */ + bestStaticBidPrice: string; + /** + * the lowest price level on an order book for offer orders not including pegged orders + */ + bestStaticOfferPrice: string; } export interface MarketDataSub { /** * Subscribe to the mark price changes */ - marketData: MarketDataSub_marketData; + marketsData: MarketDataSub_marketsData[]; +} + +export interface MarketDataSubVariables { + id: string; } diff --git a/libs/market-list/src/lib/__generated__/MarketFields.ts b/libs/market-list/src/lib/__generated__/MarketFields.ts new file mode 100644 index 000000000..29c9cca7e --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketFields.ts @@ -0,0 +1,154 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { MarketState, MarketTradingMode } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL fragment: MarketFields +// ==================================================== + +export interface MarketFields_fees_factors { + __typename: "FeeFactors"; + /** + * The factor applied to calculate MakerFees, a non-negative float + */ + makerFee: string; + /** + * The factor applied to calculate InfrastructureFees, a non-negative float + */ + infrastructureFee: string; + /** + * The factor applied to calculate LiquidityFees, a non-negative float + */ + liquidityFee: string; +} + +export interface MarketFields_fees { + __typename: "Fees"; + /** + * The factors used to calculate the different fees + */ + factors: MarketFields_fees_factors; +} + +export interface MarketFields_tradableInstrument_instrument_metadata { + __typename: "InstrumentMetadata"; + /** + * An arbitrary list of tags to associated to associate to the Instrument (string list) + */ + tags: string[] | null; +} + +export interface MarketFields_tradableInstrument_instrument_product_settlementAsset { + __typename: "Asset"; + /** + * The symbol of the asset (e.g: GBP) + */ + symbol: string; +} + +export interface MarketFields_tradableInstrument_instrument_product { + __typename: "Future"; + /** + * The name of the asset (string) + */ + settlementAsset: MarketFields_tradableInstrument_instrument_product_settlementAsset; +} + +export interface MarketFields_tradableInstrument_instrument { + __typename: "Instrument"; + /** + * Uniquely identify an instrument across all instruments available on Vega (string) + */ + id: string; + /** + * Full and fairly descriptive name for the instrument + */ + name: string; + /** + * A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string) + */ + code: string; + /** + * Metadata for this instrument + */ + metadata: MarketFields_tradableInstrument_instrument_metadata; + /** + * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) + */ + product: MarketFields_tradableInstrument_instrument_product; +} + +export interface MarketFields_tradableInstrument { + __typename: "TradableInstrument"; + /** + * An instance of, or reference to, a fully specified instrument. + */ + instrument: MarketFields_tradableInstrument_instrument; +} + +export interface MarketFields_marketTimestamps { + __typename: "MarketTimestamps"; + /** + * Time when the market is open and ready to accept trades + */ + open: string | null; + /** + * Time when the market is closed + */ + close: string | null; +} + +export interface MarketFields { + __typename: "Market"; + /** + * Market ID + */ + id: 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 indicates 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. + * This sets how big the smallest order / position on the market can be. + */ + positionDecimalPlaces: number; + /** + * Current state of the market + */ + state: MarketState; + /** + * Current mode of execution of the market + */ + tradingMode: MarketTradingMode; + /** + * Fees related data + */ + fees: MarketFields_fees; + /** + * An instance of, or reference to, a tradable instrument. + */ + tradableInstrument: MarketFields_tradableInstrument; + /** + * timestamps for state changes in the market + */ + marketTimestamps: MarketFields_marketTimestamps; +} diff --git a/libs/market-list/src/lib/__generated__/MarketList.ts b/libs/market-list/src/lib/__generated__/Markets.ts similarity index 55% rename from libs/market-list/src/lib/__generated__/MarketList.ts rename to libs/market-list/src/lib/__generated__/Markets.ts index f147b3498..c155703fa 100644 --- a/libs/market-list/src/lib/__generated__/MarketList.ts +++ b/libs/market-list/src/lib/__generated__/Markets.ts @@ -3,13 +3,13 @@ // @generated // This file was automatically generated and should not be edited. -import { Interval, MarketState, MarketTradingMode, AuctionTrigger } from "@vegaprotocol/types"; +import { MarketState, MarketTradingMode } from "@vegaprotocol/types"; // ==================================================== -// GraphQL query operation: MarketList +// GraphQL query operation: Markets // ==================================================== -export interface MarketList_markets_fees_factors { +export interface Markets_marketsConnection_edges_node_fees_factors { __typename: "FeeFactors"; /** * The factor applied to calculate MakerFees, a non-negative float @@ -25,59 +25,15 @@ export interface MarketList_markets_fees_factors { liquidityFee: string; } -export interface MarketList_markets_fees { +export interface Markets_marketsConnection_edges_node_fees { __typename: "Fees"; /** * The factors used to calculate the different fees */ - factors: MarketList_markets_fees_factors; + factors: Markets_marketsConnection_edges_node_fees_factors; } -export interface MarketList_markets_data_market { - __typename: "Market"; - /** - * Market ID - */ - id: string; - /** - * Current state of the market - */ - state: MarketState; - /** - * Current mode of execution of the market - */ - tradingMode: MarketTradingMode; -} - -export interface MarketList_markets_data { - __typename: "MarketData"; - /** - * market ID of the associated mark price - */ - market: MarketList_markets_data_market; - /** - * the highest price level on an order book for buy orders. - */ - bestBidPrice: string; - /** - * the lowest price level on an order book for offer orders. - */ - bestOfferPrice: string; - /** - * the mark price (an unsigned integer) - */ - markPrice: string; - /** - * what triggered an auction (if an auction was started) - */ - trigger: AuctionTrigger; - /** - * indicative volume if the auction ended now, 0 if not in auction mode - */ - indicativeVolume: string; -} - -export interface MarketList_markets_tradableInstrument_instrument_metadata { +export interface Markets_marketsConnection_edges_node_tradableInstrument_instrument_metadata { __typename: "InstrumentMetadata"; /** * An arbitrary list of tags to associated to associate to the Instrument (string list) @@ -85,7 +41,7 @@ export interface MarketList_markets_tradableInstrument_instrument_metadata { tags: string[] | null; } -export interface MarketList_markets_tradableInstrument_instrument_product_settlementAsset { +export interface Markets_marketsConnection_edges_node_tradableInstrument_instrument_product_settlementAsset { __typename: "Asset"; /** * The symbol of the asset (e.g: GBP) @@ -93,15 +49,15 @@ export interface MarketList_markets_tradableInstrument_instrument_product_settle symbol: string; } -export interface MarketList_markets_tradableInstrument_instrument_product { +export interface Markets_marketsConnection_edges_node_tradableInstrument_instrument_product { __typename: "Future"; /** * The name of the asset (string) */ - settlementAsset: MarketList_markets_tradableInstrument_instrument_product_settlementAsset; + settlementAsset: Markets_marketsConnection_edges_node_tradableInstrument_instrument_product_settlementAsset; } -export interface MarketList_markets_tradableInstrument_instrument { +export interface Markets_marketsConnection_edges_node_tradableInstrument_instrument { __typename: "Instrument"; /** * Uniquely identify an instrument across all instruments available on Vega (string) @@ -118,22 +74,22 @@ export interface MarketList_markets_tradableInstrument_instrument { /** * Metadata for this instrument */ - metadata: MarketList_markets_tradableInstrument_instrument_metadata; + metadata: Markets_marketsConnection_edges_node_tradableInstrument_instrument_metadata; /** * A reference to or instance of a fully specified product, including all required product parameters for that product (Product union) */ - product: MarketList_markets_tradableInstrument_instrument_product; + product: Markets_marketsConnection_edges_node_tradableInstrument_instrument_product; } -export interface MarketList_markets_tradableInstrument { +export interface Markets_marketsConnection_edges_node_tradableInstrument { __typename: "TradableInstrument"; /** * An instance of, or reference to, a fully specified instrument. */ - instrument: MarketList_markets_tradableInstrument_instrument; + instrument: Markets_marketsConnection_edges_node_tradableInstrument_instrument; } -export interface MarketList_markets_marketTimestamps { +export interface Markets_marketsConnection_edges_node_marketTimestamps { __typename: "MarketTimestamps"; /** * Time when the market is open and ready to accept trades @@ -145,27 +101,7 @@ export interface MarketList_markets_marketTimestamps { close: string | null; } -export interface MarketList_markets_candles { - __typename: "Candle"; - /** - * Open price (uint64) - */ - open: string; - /** - * Close price (uint64) - */ - close: string; - /** - * High price (uint64) - */ - high: string; - /** - * Low price (uint64) - */ - low: string; -} - -export interface MarketList_markets { +export interface Markets_marketsConnection_edges_node { __typename: "Market"; /** * Market ID @@ -206,33 +142,30 @@ export interface MarketList_markets { /** * Fees related data */ - fees: MarketList_markets_fees; - /** - * marketData for the given market - */ - data: MarketList_markets_data | null; + fees: Markets_marketsConnection_edges_node_fees; /** * An instance of, or reference to, a tradable instrument. */ - tradableInstrument: MarketList_markets_tradableInstrument; + tradableInstrument: Markets_marketsConnection_edges_node_tradableInstrument; /** * timestamps for state changes in the market */ - marketTimestamps: MarketList_markets_marketTimestamps; - /** - * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters - */ - candles: (MarketList_markets_candles | null)[] | null; + marketTimestamps: Markets_marketsConnection_edges_node_marketTimestamps; } -export interface MarketList { - /** - * One or more instruments that are trading on the VEGA network - */ - markets: MarketList_markets[] | null; +export interface Markets_marketsConnection_edges { + __typename: "MarketEdge"; + node: Markets_marketsConnection_edges_node; } -export interface MarketListVariables { - interval: Interval; - since: string; +export interface Markets_marketsConnection { + __typename: "MarketConnection"; + /** + * The markets in this connection + */ + edges: Markets_marketsConnection_edges[]; +} + +export interface Markets { + marketsConnection: Markets_marketsConnection; } diff --git a/libs/market-list/src/lib/__generated__/MarketsCandlesQuery.ts b/libs/market-list/src/lib/__generated__/MarketsCandlesQuery.ts new file mode 100644 index 000000000..03eb6cc86 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketsCandlesQuery.ts @@ -0,0 +1,81 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { Interval } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: MarketsCandlesQuery +// ==================================================== + +export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node { + __typename: "CandleNode"; + /** + * High price (uint64) + */ + high: string; + /** + * Low price (uint64) + */ + low: string; + /** + * Open price (uint64) + */ + open: string; + /** + * Close price (uint64) + */ + close: string; + /** + * Volume price (uint64) + */ + volume: string; +} + +export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges { + __typename: "CandleEdge"; + node: MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node; +} + +export interface MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection { + __typename: "CandleDataConnection"; + /** + * The candles + */ + edges: (MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges | null)[] | null; +} + +export interface MarketsCandlesQuery_marketsConnection_edges_node { + __typename: "Market"; + /** + * Market ID + */ + id: string; + /** + * Candles on a market, for the 'last' n candles, at 'interval' seconds as specified by parameters using cursor based pagination + */ + candlesConnection: MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection; +} + +export interface MarketsCandlesQuery_marketsConnection_edges { + __typename: "MarketEdge"; + node: MarketsCandlesQuery_marketsConnection_edges_node; +} + +export interface MarketsCandlesQuery_marketsConnection { + __typename: "MarketConnection"; + /** + * The markets in this connection + */ + edges: MarketsCandlesQuery_marketsConnection_edges[]; +} + +export interface MarketsCandlesQuery { + marketsConnection: MarketsCandlesQuery_marketsConnection; +} + +export interface MarketsCandlesQueryVariables { + interval: Interval; + since: string; +} diff --git a/libs/market-list/src/lib/__generated__/MarketsDataQuery.ts b/libs/market-list/src/lib/__generated__/MarketsDataQuery.ts new file mode 100644 index 000000000..8a69a3b44 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/MarketsDataQuery.ts @@ -0,0 +1,91 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +import { AuctionTrigger, MarketTradingMode } from "@vegaprotocol/types"; + +// ==================================================== +// GraphQL query operation: MarketsDataQuery +// ==================================================== + +export interface MarketsDataQuery_marketsConnection_edges_node_data_market { + __typename: "Market"; + /** + * Market ID + */ + id: string; +} + +export interface MarketsDataQuery_marketsConnection_edges_node_data { + __typename: "MarketData"; + /** + * market of the associated mark price + */ + market: MarketsDataQuery_marketsConnection_edges_node_data_market; + /** + * the highest price level on an order book for buy orders. + */ + bestBidPrice: string; + /** + * the lowest price level on an order book for offer orders. + */ + bestOfferPrice: string; + /** + * the mark price (an unsigned integer) + */ + markPrice: string; + /** + * what triggered an auction (if an auction was started) + */ + trigger: AuctionTrigger; + /** + * the arithmetic average of the best static bid price and best static offer price + */ + staticMidPrice: string; + /** + * what state the market is in (auction, continuous, etc) + */ + marketTradingMode: MarketTradingMode; + /** + * indicative volume if the auction ended now, 0 if not in auction mode + */ + indicativeVolume: string; + /** + * indicative price if the auction ended now, 0 if not in auction mode + */ + indicativePrice: string; + /** + * the highest price level on an order book for buy orders not including pegged orders. + */ + bestStaticBidPrice: string; + /** + * the lowest price level on an order book for offer orders not including pegged orders. + */ + bestStaticOfferPrice: string; +} + +export interface MarketsDataQuery_marketsConnection_edges_node { + __typename: "Market"; + /** + * marketData for the given market + */ + data: MarketsDataQuery_marketsConnection_edges_node_data | null; +} + +export interface MarketsDataQuery_marketsConnection_edges { + __typename: "MarketEdge"; + node: MarketsDataQuery_marketsConnection_edges_node; +} + +export interface MarketsDataQuery_marketsConnection { + __typename: "MarketConnection"; + /** + * The markets in this connection + */ + edges: MarketsDataQuery_marketsConnection_edges[]; +} + +export interface MarketsDataQuery { + marketsConnection: MarketsDataQuery_marketsConnection; +} diff --git a/libs/market-list/src/lib/__generated__/index.ts b/libs/market-list/src/lib/__generated__/index.ts new file mode 100644 index 000000000..c60e2b138 --- /dev/null +++ b/libs/market-list/src/lib/__generated__/index.ts @@ -0,0 +1,9 @@ +export * from './MarketCandlesQuery'; +export * from './MarketCandlesSub'; +export * from './MarketDataFields'; +export * from './MarketDataQuery'; +export * from './MarketDataSub'; +export * from './MarketFields'; +export * from './Markets'; +export * from './MarketsCandlesQuery'; +export * from './MarketsDataQuery'; diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index e19f2dfdd..9c44b0c92 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -22,7 +22,7 @@ import { MarketTradingModeMapping, AuctionTriggerMapping, } from '@vegaprotocol/types'; -import type { MarketList_markets } from '../../'; +import type { MarketWithData } from '../../'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; type Props = AgGridReactProps | AgReactUiProps; @@ -31,7 +31,7 @@ type MarketListTableValueFormatterParams = Omit< ValueFormatterParams, 'data' | 'value' > & { - data: MarketList_markets; + data: MarketWithData; }; export const getRowId = ({ data }: { data: { id: string } }) => data.id; @@ -83,17 +83,17 @@ export const MarketListTable = forwardRef((props, ref) => { headerName={t('Trading mode')} field="data" minWidth={170} - valueGetter={({ data }: { data?: MarketList_markets }) => { + valueGetter={({ data }: { data?: MarketWithData }) => { if (!data?.data) return undefined; - const { market, trigger } = data.data; - return market && - market.tradingMode === - MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && + const { trigger } = data.data; + const { tradingMode } = data; + return tradingMode === + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && trigger && trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED - ? `${MarketTradingModeMapping[market.tradingMode]} + ? `${MarketTradingModeMapping[tradingMode]} - ${AuctionTriggerMapping[trigger]}` - : MarketTradingModeMapping[market.tradingMode]; + : MarketTradingModeMapping[tradingMode]; }} /> ((props, ref) => { type="rightAligned" cellRenderer="PriceFlashCell" filter="agNumberColumnFilter" - valueGetter={({ data }: { data?: MarketList_markets }) => { + valueGetter={({ data }: { data?: MarketWithData }) => { return data?.data?.bestBidPrice === undefined ? undefined : toBigNum(data?.data?.bestBidPrice, data.decimalPlaces).toNumber(); @@ -122,7 +122,7 @@ export const MarketListTable = forwardRef((props, ref) => { type="rightAligned" cellRenderer="PriceFlashCell" filter="agNumberColumnFilter" - valueGetter={({ data }: { data?: MarketList_markets }) => { + valueGetter={({ data }: { data?: MarketWithData }) => { return data?.data?.bestOfferPrice === undefined ? undefined : toBigNum( @@ -145,7 +145,7 @@ export const MarketListTable = forwardRef((props, ref) => { type="rightAligned" cellRenderer="PriceFlashCell" filter="agNumberColumnFilter" - valueGetter={({ data }: { data?: MarketList_markets }) => { + valueGetter={({ data }: { data?: MarketWithData }) => { return data?.data?.markPrice === undefined ? undefined : toBigNum(data?.data?.markPrice, data.decimalPlaces).toNumber(); diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index 98c8e3508..bcbbdc9ab 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -1,89 +1,29 @@ -import { useRef, useCallback, useMemo } from 'react'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { MarketListTable, getRowId } from './market-list-table'; +import { MarketListTable } from './market-list-table'; import { useDataProvider } from '@vegaprotocol/react-helpers'; -import type { AgGridReact } from 'ag-grid-react'; import type { RowClickedEvent } from 'ag-grid-community'; -import { produce } from 'immer'; -import merge from 'lodash/merge'; -import type { - MarketList_markets, - MarketList_markets_data, - MarketDataSub_marketData, -} from '../../'; -import { marketsDataProvider as dataProvider } from '../../markets-data-provider'; -import { Interval, MarketState } from '@vegaprotocol/types'; - +import { marketsWithDataProvider as dataProvider } from '../../markets-provider'; +import type { MarketWithData } from '../../markets-provider'; interface MarketsContainerProps { onSelect: (marketId: string) => void; } export const MarketsContainer = ({ onSelect }: MarketsContainerProps) => { - const gridRef = useRef(null); - - const yTimestamp = useMemo(() => { - const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; - return new Date(yesterday * 1000).toISOString(); - }, []); - const variables = useMemo( - () => ({ interval: Interval.INTERVAL_I1H, since: yTimestamp }), - [yTimestamp] - ); - - const update = useCallback( - ({ delta }: { delta: MarketDataSub_marketData }) => { - const update: MarketList_markets[] = []; - const add: MarketList_markets[] = []; - const remove: MarketList_markets[] = []; - if (!gridRef.current?.api) { - return false; - } - const rowNode = gridRef.current.api.getRowNode( - getRowId({ data: delta.market }) - ); - if (rowNode) { - const updatedData = produce( - rowNode.data.data, - (draft: MarketList_markets) => merge(draft, delta) - ); - if (updatedData !== rowNode.data.data) { - update.push({ ...rowNode.data, data: updatedData }); - } - } - // @TODO - else add new market - if (update.length || add.length || remove.length) { - gridRef.current.api.applyTransactionAsync({ - update, - add, - addIndex: 0, - }); - } - return true; - }, - [gridRef] - ); - - const { data, error, loading } = useDataProvider< - MarketList_markets[], - MarketList_markets_data - >({ dataProvider, update, variables }); + const { data, error, loading } = useDataProvider({ + dataProvider, + noUpdate: true, + }); return ( m.data?.market.state !== MarketState.STATE_REJECTED - ) - } - ref={gridRef} + rowData={data} onRowClicked={(rowEvent: RowClickedEvent) => { const { data, event } = rowEvent; // filters out clicks on the symbol column because it should display asset details if ((event?.target as HTMLElement).tagName.toUpperCase() === 'BUTTON') return; - onSelect((data as MarketList_markets).id); + onSelect((data as MarketWithData).id); }} /> diff --git a/libs/market-list/src/lib/components/select-market-columns.tsx b/libs/market-list/src/lib/components/select-market-columns.tsx index 1db863775..130c0f2bb 100644 --- a/libs/market-list/src/lib/components/select-market-columns.tsx +++ b/libs/market-list/src/lib/components/select-market-columns.tsx @@ -3,6 +3,7 @@ import { addDecimalsFormatNumber, formatNumberPercentage, PriceCell, + signedNumberCssClass, t, } from '@vegaprotocol/react-helpers'; import { @@ -18,10 +19,7 @@ import Link from 'next/link'; import { calcCandleHigh, calcCandleLow, totalFees } from '../utils'; import type { CandleClose } from '@vegaprotocol/types'; -import type { - MarketList_markets, - MarketList_markets_fees_factors, -} from '../__generated__/MarketList'; +import type { Market, MarketData, Candle } from '../'; import isNil from 'lodash/isNil'; export const cellClassNames = 'py-1 first:text-left text-right'; @@ -171,10 +169,12 @@ export const columnHeaders: Column[] = [ ]; export const columns = ( - market: MarketList_markets, + market: Market, + marketData: MarketData | undefined, + candles: Candle[] | undefined, onSelect: (id: string) => void ) => { - const candlesClose = market.candles + const candlesClose = candles ?.map((candle) => candle?.close) .filter((c: string | undefined): c is CandleClose => !isNil(c)); const handleKeyPress = ( @@ -185,8 +185,8 @@ export const columns = ( return onSelect(id); } }; - const candleLow = calcCandleLow(market); - const candleHigh = calcCandleHigh(market); + const candleLow = candles && calcCandleLow(candles); + const candleHigh = candles && calcCandleHigh(candles); const selectMarketColumns: Column[] = [ { value: ( @@ -207,11 +207,11 @@ export const columns = ( onlyOnDetailed: false, }, { - value: market.data?.markPrice ? ( + value: marketData?.markPrice ? (

- {data?.map((market, i) => ( + {markets?.map((market, i) => ( marketData.market.id === market.id + ), + marketsCandles?.find( + (marketCandles) => marketCandles.marketId === market.id + )?.candles, + onSelect + )} /> ))} @@ -61,31 +78,52 @@ export const SelectMarketLandingTable = ({ }; export const SelectAllMarketsTableBody = ({ - data, + markets, + marketsData, + marketsCandles, + positions, onSelect, headers = columnHeaders, - tableColumns = (market) => columns(market, onSelect), + tableColumns = (market, marketData, candles) => + columns(market, marketData, candles, onSelect), }: { - data?: MarketList_markets[]; + markets: Market[] | undefined; + marketsData: MarketData[] | undefined; + marketsCandles: MarketCandles[] | undefined; + positions?: Positions_party_positionsConnection_edges_node[]; title?: string; onSelect: (id: string) => void; headers?: Column[]; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - tableColumns?: (market: any) => Column[]; + tableColumns?: ( + market: Market, + marketData: MarketData | undefined, + candles: Candle[] | undefined, + openVolume?: string + ) => Column[]; }) => { - if (!data) return null; + if (!markets) return null; return ( <> - {/* Border styles required to create space between tbody elements margin/padding dont work */} + {/* Border styles required to create space between tbody elements margin/padding don't work */} - {data?.map((market, i) => ( + {markets?.map((market, i) => ( marketData.market.id === market.id + ), + marketsCandles?.find( + (marketCandles) => marketCandles.marketId === market.id + )?.candles, + positions && + positions.find((p) => p.market.id === market.id)?.openVolume + )} /> ))} @@ -106,35 +144,15 @@ export const SelectMarketPopover = ({ const [open, setOpen] = useState(false); const { data, loading: marketsLoading } = useMarketList(); const variables = useMemo(() => ({ partyId: keypair?.pub }), [keypair?.pub]); - const { data: marketDataPositions, loading: positionsLoading } = - useQuery(POSITIONS_QUERY, { - variables, - skip: !keypair?.pub, - }); - - const positionMarkets = useMemo( - () => ({ - markets: - data - ?.filter((market) => - marketDataPositions?.party?.positionsConnection.edges?.find( - (edge) => edge.node.market.id === market.id - ) - ) - .map((market) => { - const position = - marketDataPositions?.party?.positionsConnection.edges?.find( - (edge) => edge.node.market.id === market.id - )?.node; - return { - ...market, - openVolume: - position?.openVolume && volumePrefix(position.openVolume), - }; - }) || null, - }), - [data, marketDataPositions] - ); + const { data: party, loading: positionsLoading } = useDataProvider< + Positions_party, + PositionsSubscription_positions + >({ + dataProvider: positionsDataProvider, + update: () => false, + variables, + skip: !keypair, + }); const onSelectMarket = (marketId: string) => { onSelect(marketId); @@ -142,6 +160,15 @@ export const SelectMarketPopover = ({ }; const iconClass = open ? 'rotate-180' : ''; + const markets = useMemo( + () => + data?.markets?.filter((market) => + party?.positionsConnection.edges?.find( + (edge) => edge.node.market.id === market.id + ) + ), + [data, party] + ); return ( ) : ( <> - {keypair && - positionMarkets?.markets && - positionMarkets.markets.length > 0 && ( -
+

{children}

- {t('My markets')} - - columnsPositionMarkets(market, onSelectMarket) - } - /> -
- )} + {keypair && (party?.positionsConnection.edges?.length ?? 0) > 0 ? ( + + {t('My markets')} + edge.node) + .map((edge) => edge.node)} + onSelect={onSelectMarket} + headers={columnHeadersPositionMarkets} + tableColumns={(market, marketData, candles, openVolume) => + columnsPositionMarkets( + market, + marketData, + candles, + onSelectMarket, + openVolume + ) + } + /> +
+ ) : null} {t('All markets')}
@@ -256,5 +294,12 @@ const LandingDialogContainer = ({ onSelect }: LandingDialogContainerProps) => { ); } - return ; + return ( + + ); }; diff --git a/libs/market-list/src/lib/index.ts b/libs/market-list/src/lib/index.ts index 8030e9e48..cc85bd38e 100644 --- a/libs/market-list/src/lib/index.ts +++ b/libs/market-list/src/lib/index.ts @@ -1,6 +1,9 @@ -export * from './__generated__/MarketDataFields'; -export * from './__generated__/MarketList'; -export * from './__generated__/MarketDataSub'; +export * from './__generated__'; export * from './components'; export * from './utils'; +export * from './market-candles-provider'; +export * from './market-data-provider'; +export * from './market-provider'; +export * from './markets-candles-provider'; export * from './markets-data-provider'; +export * from './markets-provider'; diff --git a/libs/market-list/src/lib/market-candles-provider.ts b/libs/market-list/src/lib/market-candles-provider.ts new file mode 100644 index 000000000..a67f975a0 --- /dev/null +++ b/libs/market-list/src/lib/market-candles-provider.ts @@ -0,0 +1,83 @@ +import { gql } from '@apollo/client'; +import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import type { + MarketCandlesQuery, + MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node, + MarketCandlesSub, + MarketCandlesSub_candles, +} from './__generated__'; + +export const MARKET_CANDLES_QUERY = gql` + query MarketCandlesQuery( + $interval: Interval! + $since: String! + $marketId: ID! + ) { + marketsConnection(id: $marketId) { + edges { + node { + candlesConnection(interval: $interval, since: $since) { + edges { + node { + high + low + open + close + volume + } + } + } + } + } + } + } +`; + +const MARKET_CANDLES_SUB = gql` + subscription MarketCandlesSub($marketId: ID!, $interval: Interval!) { + candles(interval: $interval, marketId: $marketId) { + high + low + open + close + volume + } + } +`; + +export type Candle = + MarketCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node; + +const update = (data: Candle[], delta: MarketCandlesSub_candles) => { + return data && delta + ? [ + ...data, + { + ...delta, + __typename: 'CandleNode', + } as Candle, + ] + : data; +}; + +const getData = (responseData: MarketCandlesQuery): Candle[] | null => + responseData.marketsConnection.edges[0].node.candlesConnection.edges + ?.filter((edge) => edge?.node) + .map((edge) => edge?.node as Candle) || null; + +const getDelta = ( + subscriptionData: MarketCandlesSub +): MarketCandlesSub_candles => subscriptionData.candles; + +export const marketCandlesProvider = makeDataProvider< + MarketCandlesQuery, + Candle[], + MarketCandlesSub, + MarketCandlesSub_candles +>({ + query: MARKET_CANDLES_QUERY, + subscriptionQuery: MARKET_CANDLES_SUB, + update, + getData, + getDelta, +}); diff --git a/libs/market-list/src/lib/market-data-provider.ts b/libs/market-list/src/lib/market-data-provider.ts new file mode 100644 index 000000000..ea0f42e00 --- /dev/null +++ b/libs/market-list/src/lib/market-data-provider.ts @@ -0,0 +1,81 @@ +import produce from 'immer'; +import { gql } from '@apollo/client'; +import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import type { + MarketDataSub, + MarketDataSub_marketsData, + MarketDataQuery, + MarketDataQuery_marketsConnection_edges_node_data, +} from './__generated__'; + +export const MARKET_DATA_QUERY = gql` + query MarketDataQuery($marketId: ID!) { + marketsConnection(id: $marketId) { + edges { + node { + data { + market { + id + } + bestBidPrice + bestOfferPrice + markPrice + trigger + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + } + } + } + } + } +`; + +const MARKET_DATA_SUB = gql` + subscription MarketDataSub($marketId: ID!) { + marketsData(marketIds: [$marketId]) { + marketId + bestBidPrice + bestOfferPrice + markPrice + trigger + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice + } + } +`; + +export type MarketData = MarketDataQuery_marketsConnection_edges_node_data; + +const update = (data: MarketData, delta: MarketDataSub_marketsData) => { + return produce(data, (draft) => { + const { marketId, __typename, ...marketData } = delta; + Object.assign(draft, marketData); + }); +}; + +const getData = (responseData: MarketDataQuery): MarketData | null => + responseData.marketsConnection.edges[0].node.data || null; + +const getDelta = (subscriptionData: MarketDataSub): MarketDataSub_marketsData => + subscriptionData.marketsData[0]; + +export const marketDataProvider = makeDataProvider< + MarketDataQuery, + MarketData, + MarketDataSub, + MarketDataSub_marketsData +>({ + query: MARKET_DATA_QUERY, + subscriptionQuery: MARKET_DATA_SUB, + update, + getData, + getDelta, +}); diff --git a/libs/market-list/src/lib/market-provider.ts b/libs/market-list/src/lib/market-provider.ts new file mode 100644 index 000000000..16f878782 --- /dev/null +++ b/libs/market-list/src/lib/market-provider.ts @@ -0,0 +1,19 @@ +import { makeDerivedDataProvider } from '@vegaprotocol/react-helpers'; + +import type { Market } from './markets-provider'; +import { marketsProvider } from './markets-provider'; + +export const marketProvider = makeDerivedDataProvider( + [(callback, client) => marketsProvider(callback, client)], // omit variables param + ([markets], variables) => { + if (markets) { + const market = (markets as Market[]).find( + (market) => market.id === variables?.marketId + ); + if (market) { + return market; + } + } + return null; + } +); diff --git a/libs/market-list/src/lib/markets-candles-provider.ts b/libs/market-list/src/lib/markets-candles-provider.ts new file mode 100644 index 000000000..22c3db986 --- /dev/null +++ b/libs/market-list/src/lib/markets-candles-provider.ts @@ -0,0 +1,53 @@ +import { gql } from '@apollo/client'; +import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import type { + MarketsCandlesQuery, + MarketsCandlesQuery_marketsConnection_edges_node as Market, + MarketsCandlesQuery_marketsConnection_edges_node_candlesConnection_edges_node as Candle, +} from './__generated__'; + +export const MARKETS_CANDLES_QUERY = gql` + query MarketsCandlesQuery($interval: Interval!, $since: String!) { + marketsConnection { + edges { + node { + id + candlesConnection(interval: $interval, since: $since) { + edges { + node { + high + low + open + close + volume + } + } + } + } + } + } + } +`; + +export interface MarketCandles { + marketId: Market['id']; + candles: Candle[] | undefined; +} + +const getData = (responseData: MarketsCandlesQuery): MarketCandles[] | null => + responseData.marketsConnection.edges.map((edge) => ({ + marketId: edge.node.id, + candles: edge.node.candlesConnection.edges + ?.filter((edge) => edge?.node) + .map((edge) => edge?.node as Candle), + })) || null; + +export const marketsCandlesProvider = makeDataProvider< + MarketsCandlesQuery, + MarketCandles[], + never, + never +>({ + query: MARKETS_CANDLES_QUERY, + getData, +}); diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 049521253..0d6602765 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -1,141 +1,45 @@ -import produce from 'immer'; -import { gql, useQuery } from '@apollo/client'; +import { gql } from '@apollo/client'; import { makeDataProvider } from '@vegaprotocol/react-helpers'; -import type { - MarketDataSub, - MarketDataSub_marketData, - MarketList, - MarketList_markets, -} from './'; -import { useMemo } from 'react'; -import { Interval } from '@vegaprotocol/types'; -import { mapDataToMarketList } from './utils'; +import type { MarketsDataQuery } from './__generated__/MarketsDataQuery'; +import type { MarketData } from './market-data-provider'; -export const useMarketList = () => { - const since = useMemo(() => { - const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; - return new Date(yesterday * 1000).toISOString(); - }, []); - const { data, loading, error } = useQuery(MARKET_LIST_QUERY, { - variables: { interval: Interval.INTERVAL_I1H, since }, - }); - - return { - data: useMemo(() => data && mapDataToMarketList(data), [data]), - loading, - error, - }; -}; - -const MARKET_DATA_FRAGMENT = gql` - fragment MarketDataFields on MarketData { - market { - id - state - tradingMode - } - bestBidPrice - bestOfferPrice - markPrice - trigger - indicativeVolume - } -`; - -export const MARKET_LIST_QUERY = gql` - query MarketList($interval: Interval!, $since: String!) { - markets { - id - decimalPlaces - positionDecimalPlaces - state - tradingMode - fees { - factors { - makerFee - infrastructureFee - liquidityFee - } - } - data { - market { - id - state - tradingMode - } - bestBidPrice - bestOfferPrice - markPrice - trigger - indicativeVolume - } - tradableInstrument { - instrument { - id - name - code - metadata { - tags - } - product { - ... on Future { - settlementAsset { - symbol - } +export const MARKETS_DATA_QUERY = gql` + query MarketsDataQuery { + marketsConnection { + edges { + node { + data { + market { + id } + bestBidPrice + bestOfferPrice + markPrice + trigger + staticMidPrice + marketTradingMode + indicativeVolume + indicativePrice + bestStaticBidPrice + bestStaticOfferPrice } } } - marketTimestamps { - open - close - } - candles(interval: $interval, since: $since) { - open - close - high - low - } } } `; -const MARKET_DATA_SUB = gql` - ${MARKET_DATA_FRAGMENT} - subscription MarketDataSub { - marketData { - ...MarketDataFields - } - } -`; - -const update = ( - data: MarketList_markets[], - delta: MarketDataSub_marketData -) => { - return produce(data, (draft) => { - const index = draft.findIndex((m) => m.id === delta.market.id); - if (index !== -1) { - draft[index].data = delta; - } - // @TODO - else push new market to draft - }); -}; - -const getData = (responseData: MarketList): MarketList_markets[] | null => - responseData.markets; -const getDelta = (subscriptionData: MarketDataSub): MarketDataSub_marketData => - subscriptionData.marketData; +const getData = (responseData: MarketsDataQuery): MarketData[] | null => + responseData.marketsConnection.edges + .filter((edge) => edge.node.data) + .map((edge) => edge.node.data as MarketData) || null; export const marketsDataProvider = makeDataProvider< - MarketList, - MarketList_markets[], - MarketDataSub, - MarketDataSub_marketData + MarketsDataQuery, + MarketData[], + never, + never >({ - query: MARKET_LIST_QUERY, - subscriptionQuery: MARKET_DATA_SUB, - update, + query: MARKETS_DATA_QUERY, getData, - getDelta, }); diff --git a/libs/market-list/src/lib/markets-provider.ts b/libs/market-list/src/lib/markets-provider.ts new file mode 100644 index 000000000..4f6d4ac7e --- /dev/null +++ b/libs/market-list/src/lib/markets-provider.ts @@ -0,0 +1,144 @@ +import { gql } from '@apollo/client'; +import { + makeDataProvider, + makeDerivedDataProvider, + useDataProvider, +} from '@vegaprotocol/react-helpers'; +import type { + Markets, + Markets_marketsConnection_edges_node, +} from './__generated__'; +import { marketsDataProvider } from './markets-data-provider'; +import { marketsCandlesProvider } from './markets-candles-provider'; +import type { MarketData } from './market-data-provider'; +import type { MarketCandles } from './markets-candles-provider'; +import { useMemo } from 'react'; +import { Interval } from '@vegaprotocol/types'; +import { mapDataToMarketList } from './utils'; + +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export type Market = Markets_marketsConnection_edges_node; + +const MARKET_DATA_FRAGMENT = gql` + fragment MarketFields on Market { + id + decimalPlaces + positionDecimalPlaces + state + tradingMode + fees { + factors { + makerFee + infrastructureFee + liquidityFee + } + } + tradableInstrument { + instrument { + id + name + code + metadata { + tags + } + product { + ... on Future { + settlementAsset { + symbol + } + } + } + } + } + marketTimestamps { + open + close + } + } +`; + +export const MARKET_LIST_QUERY = gql` + ${MARKET_DATA_FRAGMENT} + query Markets { + marketsConnection { + edges { + node { + ...MarketFields + } + } + } + } +`; + +const getData = (responseData: Markets): Market[] | null => + responseData.marketsConnection.edges.map((edge) => edge.node); + +export const marketsProvider = makeDataProvider< + Markets, + Market[], + never, + never +>({ + query: MARKET_LIST_QUERY, + getData, +}); + +export const activeMarketsProvider = makeDerivedDataProvider( + [marketsProvider], + ([markets]) => mapDataToMarketList(markets) +); + +interface MarketsListData { + markets: Market[]; + marketsData: MarketData[]; + marketsCandles: MarketCandles[]; +} + +export const marketListProvider = makeDerivedDataProvider( + [ + (callback, client) => activeMarketsProvider(callback, client), + (callback, client) => marketsDataProvider(callback, client), + marketsCandlesProvider, + ], + (parts) => { + return { + markets: parts[0] as Market[], + marketsData: parts[1] as MarketData[], + marketsCandles: parts[2] as MarketCandles[], + }; + } +); + +export type MarketWithData = Market & { data?: MarketData }; + +export const marketsWithDataProvider = makeDerivedDataProvider< + MarketWithData[] +>([activeMarketsProvider, marketsDataProvider], (parts) => + (parts[0] as Market[]).map((market) => ({ + ...market, + data: (parts[1] as MarketData[]).find( + (data) => data.market.id === market.id + ), + })) +); + +export const useMarketList = () => { + const variables = useMemo(() => { + const yesterday = Math.round(new Date().getTime() / 1000) - 24 * 3600; + return { + since: new Date(yesterday * 1000).toISOString(), + interval: Interval.INTERVAL_I1H, + }; + }, []); + const { data, loading, error } = useDataProvider({ + dataProvider: marketListProvider, + variables, + noUpdate: true, + }); + + return { + data, + loading, + error, + }; +}; diff --git a/libs/market-list/src/lib/utils/market-utils.spec.tsx b/libs/market-list/src/lib/utils/market-utils.spec.tsx index 9dc46f140..ade2bc74d 100644 --- a/libs/market-list/src/lib/utils/market-utils.spec.tsx +++ b/libs/market-list/src/lib/utils/market-utils.spec.tsx @@ -1,210 +1,59 @@ -import type { MarketList } from '../__generated__/MarketList'; +import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; +import type { Market } from '../markets-provider'; import { mapDataToMarketList } from './market-utils'; +const MARKET_A: Partial = { + id: '1', + marketTimestamps: { + __typename: 'MarketTimestamps', + open: '2022-05-18T13:08:27.693537312Z', + close: null, + }, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, +}; + +const MARKET_B: Partial = { + id: '2', + marketTimestamps: { + __typename: 'MarketTimestamps', + open: '2022-05-18T13:00:39.328347732Z', + close: null, + }, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, +}; + +const MARKET_C: Partial = { + id: '3', + marketTimestamps: { + __typename: 'MarketTimestamps', + open: '2022-05-17T13:00:39.328347732Z', + close: null, + }, + state: MarketState.STATE_REJECTED, + tradingMode: MarketTradingMode.TRADING_MODE_CONTINUOUS, +}; + +const MARKET_D: Partial = { + id: '4', + marketTimestamps: { + __typename: 'MarketTimestamps', + open: '2022-05-16T13:00:39.328347732Z', + close: null, + }, + state: MarketState.STATE_ACTIVE, + tradingMode: MarketTradingMode.TRADING_MODE_NO_TRADING, +}; + describe('mapDataToMarketList', () => { it('should map queried data to market list format', () => { - const result = mapDataToMarketList(mockData.data as unknown as MarketList); - expect(result).toEqual(mockList); + const result = mapDataToMarketList([ + MARKET_A, + MARKET_B, + MARKET_C, + MARKET_D, + ] as unknown as Market[]); + expect(result).toEqual([MARKET_B, MARKET_A]); }); }); - -const mockList = [ - { - __typename: 'Market', - id: '3e6671566ccf5c33702e955fe8b018683fcdb812bfe3ed283fc250bb4f798ff3', - decimalPlaces: 5, - candles: [ - { - open: '16141155', - close: '16293551', - high: '16320190', - low: '16023805', - __typename: 'Candle', - }, - { - open: '16293548', - close: '16322118', - high: '16365861', - low: '16192970', - __typename: 'Candle', - }, - ], - fees: { - factors: { - makerFee: 0.0002, - infrastructureFee: 0.0005, - liquidityFee: 0.001, - }, - }, - tradableInstrument: { - __typename: 'TradableInstrument', - instrument: { - __typename: 'Instrument', - name: 'Apple Monthly (30 Jun 2022)', - code: 'AAPL.MF21', - product: { - settlementAsset: { symbol: 'AAPL.MF21', __typename: 'Asset' }, - __typename: 'Future', - }, - }, - }, - marketTimestamps: { - __typename: 'MarketTimestamps', - open: '2022-05-18T13:00:39.328347732Z', - close: null, - }, - open: 1652878839328, - close: null, - }, - { - __typename: 'Market', - id: '062ddcb97beae5b7cc4fa20621fe0c83b2a6f7e76cf5b129c6bd3dc14e8111ef', - decimalPlaces: 2, - fees: { - factors: { - makerFee: 0.0002, - infrastructureFee: 0.0005, - liquidityFee: 0.001, - }, - }, - tradableInstrument: { - __typename: 'TradableInstrument', - instrument: { - __typename: 'Instrument', - name: 'APEUSD (May 2022)', - code: 'APEUSD', - product: { - settlementAsset: { symbol: 'APEUSD', __typename: 'Asset' }, - __typename: 'Future', - }, - }, - }, - marketTimestamps: { - __typename: 'MarketTimestamps', - open: '2022-05-18T13:08:27.693537312Z', - close: null, - }, - candles: [ - { - open: '16141155', - close: '16293551', - high: '16320190', - low: '16023805', - __typename: 'Candle', - }, - { - open: '16293548', - close: '16322118', - high: '16365861', - low: '16192970', - __typename: 'Candle', - }, - ], - open: 1652879307693, - close: null, - }, -]; - -const mockData = { - data: { - markets: [ - { - __typename: 'Market', - id: '062ddcb97beae5b7cc4fa20621fe0c83b2a6f7e76cf5b129c6bd3dc14e8111ef', - decimalPlaces: 2, - fees: { - factors: { - makerFee: 0.0002, - infrastructureFee: 0.0005, - liquidityFee: 0.001, - }, - }, - tradableInstrument: { - __typename: 'TradableInstrument', - instrument: { - __typename: 'Instrument', - name: 'APEUSD (May 2022)', - code: 'APEUSD', - product: { - settlementAsset: { - symbol: 'APEUSD', - __typename: 'Asset', - }, - __typename: 'Future', - }, - }, - }, - - marketTimestamps: { - __typename: 'MarketTimestamps', - open: '2022-05-18T13:08:27.693537312Z', - close: null, - }, - candles: [ - { - open: '16141155', - close: '16293551', - high: '16320190', - low: '16023805', - __typename: 'Candle', - }, - { - open: '16293548', - close: '16322118', - high: '16365861', - low: '16192970', - __typename: 'Candle', - }, - ], - }, - { - __typename: 'Market', - id: '3e6671566ccf5c33702e955fe8b018683fcdb812bfe3ed283fc250bb4f798ff3', - decimalPlaces: 5, - candles: [ - { - open: '16141155', - close: '16293551', - high: '16320190', - low: '16023805', - __typename: 'Candle', - }, - { - open: '16293548', - close: '16322118', - high: '16365861', - low: '16192970', - __typename: 'Candle', - }, - ], - fees: { - factors: { - makerFee: 0.0002, - infrastructureFee: 0.0005, - liquidityFee: 0.001, - }, - }, - tradableInstrument: { - __typename: 'TradableInstrument', - instrument: { - __typename: 'Instrument', - name: 'Apple Monthly (30 Jun 2022)', - code: 'AAPL.MF21', - product: { - settlementAsset: { - symbol: 'AAPL.MF21', - __typename: 'Asset', - }, - __typename: 'Future', - }, - }, - }, - marketTimestamps: { - __typename: 'MarketTimestamps', - open: '2022-05-18T13:00:39.328347732Z', - close: null, - }, - }, - ], - }, -}; diff --git a/libs/market-list/src/lib/utils/market-utils.ts b/libs/market-list/src/lib/utils/market-utils.ts index 0c5b52f8a..0fdd62839 100644 --- a/libs/market-list/src/lib/utils/market-utils.ts +++ b/libs/market-list/src/lib/utils/market-utils.ts @@ -2,13 +2,9 @@ import { formatNumberPercentage } from '@vegaprotocol/react-helpers'; import { MarketState, MarketTradingMode } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import orderBy from 'lodash/orderBy'; -import type { - MarketList, - MarketList_markets, - MarketList_markets_fees_factors, -} from '../__generated__/MarketList'; +import type { Market, Candle } from '../'; -export const totalFees = (fees: MarketList_markets_fees_factors) => { +export const totalFees = (fees: Market['fees']['factors']) => { if (!fees) { return undefined; } @@ -20,7 +16,7 @@ export const totalFees = (fees: MarketList_markets_fees_factors) => { ); }; -export const mapDataToMarketList = ({ markets }: MarketList) => { +export const mapDataToMarketList = (markets: Market[]) => { const tradingModesOrdering = [ MarketTradingMode.TRADING_MODE_CONTINUOUS, MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, @@ -29,24 +25,12 @@ export const mapDataToMarketList = ({ markets }: MarketList) => { MarketTradingMode.TRADING_MODE_NO_TRADING, ]; const orderedMarkets = orderBy( - markets - ?.filter( - (m) => - m.state !== MarketState.STATE_REJECTED && - m.tradingMode !== MarketTradingMode.TRADING_MODE_NO_TRADING - ) - .map((m) => { - return { - ...m, - open: m.marketTimestamps.open - ? new Date(m.marketTimestamps.open).getTime() - : null, - close: m.marketTimestamps.close - ? new Date(m.marketTimestamps.close).getTime() - : null, - }; - }) || [], - ['open', 'id'], + markets?.filter( + (m) => + m.state !== MarketState.STATE_REJECTED && + m.tradingMode !== MarketTradingMode.TRADING_MODE_NO_TRADING + ) || [], + ['marketTimestamps.open', 'id'], ['asc', 'asc'] ); return orderedMarkets.sort( @@ -56,8 +40,8 @@ export const mapDataToMarketList = ({ markets }: MarketList) => { ); }; -export const calcCandleLow = (m: MarketList_markets): string | undefined => { - return m.candles +export const calcCandleLow = (candles: Candle[]): string | undefined => { + return candles ?.reduce((acc: BigNumber, c) => { if (c?.low) { if (acc.isLessThan(new BigNumber(c.low))) { @@ -66,12 +50,12 @@ export const calcCandleLow = (m: MarketList_markets): string | undefined => { return new BigNumber(c.low); } return acc; - }, new BigNumber(m.candles?.[0]?.high ?? 0)) + }, new BigNumber(candles?.[0]?.high ?? 0)) .toString(); }; -export const calcCandleHigh = (m: MarketList_markets): string | undefined => { - return m.candles +export const calcCandleHigh = (candles: Candle[]): string | undefined => { + return candles ?.reduce((acc: BigNumber, c) => { if (c?.high) { if (acc.isGreaterThan(new BigNumber(c.high))) { diff --git a/libs/positions/src/index.ts b/libs/positions/src/index.ts index 99df7895b..89483782f 100644 --- a/libs/positions/src/index.ts +++ b/libs/positions/src/index.ts @@ -1,4 +1,5 @@ export * from './lib/__generated__/Positions'; +export * from './lib/__generated__/PositionsSubscription'; export * from './lib/positions-container'; export * from './lib/positions-data-providers'; export * from './lib/positions-table'; diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index 8a93880cd..bcca252e7 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -252,7 +252,7 @@ export const update = ( }); }; -export const positionDataProvider = makeDataProvider< +export const positionsDataProvider = makeDataProvider< Positions, Positions_party, PositionsSubscription, @@ -267,7 +267,7 @@ export const positionDataProvider = makeDataProvider< }); export const positionsMetricsDataProvider = makeDerivedDataProvider( - [positionDataProvider, accountsDataProvider], + [positionsDataProvider, accountsDataProvider], ([positions, accounts]) => { return sortBy( getMetrics( diff --git a/libs/react-helpers/src/hooks/use-data-provider.ts b/libs/react-helpers/src/hooks/use-data-provider.ts index 105fed608..486098f18 100644 --- a/libs/react-helpers/src/hooks/use-data-provider.ts +++ b/libs/react-helpers/src/hooks/use-data-provider.ts @@ -19,6 +19,8 @@ export function useDataProvider({ update, insert, variables, + noUpdate, + skip, }: { dataProvider: Subscribe; update?: ({ delta, data }: { delta: Delta; data: Data }) => boolean; @@ -32,11 +34,13 @@ export function useDataProvider({ totalCount?: number; }) => boolean; variables?: OperationVariables; + noUpdate?: boolean; + skip?: boolean; }) { const client = useApolloClient(); const [data, setData] = useState(null); const [totalCount, setTotalCount] = useState(); - const [loading, setLoading] = useState(true); + const [loading, setLoading] = useState(!skip); const [error, setError] = useState(undefined); const flushRef = useRef<(() => void) | undefined>(undefined); const reloadRef = useRef<((force?: boolean) => void) | undefined>(undefined); @@ -75,7 +79,12 @@ export function useDataProvider({ // if update or insert function returns true it means that component handles updates // component can use flush() which will call callback without delta and cause data state update if (initialized.current && data) { - if (isUpdate && update && (!delta || update({ delta, data }))) { + if ( + isUpdate && + !noUpdate && + update && + (!delta || update({ delta, data })) + ) { return; } if ( @@ -91,9 +100,12 @@ export function useDataProvider({ setData(data); } }, - [update, insert] + [update, insert, noUpdate] ); useEffect(() => { + if (skip) { + return; + } const { unsubscribe, flush, reload, load } = dataProvider( callback, client, @@ -103,6 +115,6 @@ export function useDataProvider({ reloadRef.current = reload; loadRef.current = load; return unsubscribe; - }, [client, initialized, dataProvider, callback, variables]); + }, [client, initialized, dataProvider, callback, variables, skip]); return { data, loading, error, flush, reload, load, totalCount }; } diff --git a/libs/react-helpers/src/lib/generic-data-provider.ts b/libs/react-helpers/src/lib/generic-data-provider.ts index 94b8427e4..f1789c4d7 100644 --- a/libs/react-helpers/src/lib/generic-data-provider.ts +++ b/libs/react-helpers/src/lib/generic-data-provider.ts @@ -133,10 +133,10 @@ export function defaultAppend( interface DataProviderParams { query: Query; - subscriptionQuery: Query; - update: Update; + subscriptionQuery?: Query; + update?: Update; getData: GetData; - getDelta: GetDelta; + getDelta?: GetDelta; pagination?: { getPageInfo: GetPageInfo; getTotalCount?: GetTotalCount; @@ -270,6 +270,7 @@ function makeDataProviderInternal({ ? { ...variables, pagination: { first: pagination.first } } : variables, fetchPolicy, + errorPolicy: 'ignore', }); data = getData(res.data); if (data && pagination) { @@ -291,7 +292,7 @@ function makeDataProviderInternal({ } } // if there was some updates received from subscription during initial query loading apply them on just received data - if (data && updateQueue && updateQueue.length > 0) { + if (update && data && updateQueue && updateQueue.length > 0) { while (updateQueue.length) { const delta = updateQueue.shift(); if (delta) { @@ -339,31 +340,33 @@ function makeDataProviderInternal({ if (!client) { return; } - subscription = client - .subscribe({ - query: subscriptionQuery, - variables, - fetchPolicy, - }) - .subscribe( - ({ data: subscriptionData }) => { - if (!subscriptionData) { - return; - } - const delta = getDelta(subscriptionData); - if (loading || !data) { - updateQueue.push(delta); - } else { - const updatedData = update(data, delta, reload); - if (updatedData === data) { + if (subscriptionQuery && getDelta && update) { + subscription = client + .subscribe({ + query: subscriptionQuery, + variables, + fetchPolicy, + }) + .subscribe( + ({ data: subscriptionData }) => { + if (!subscriptionData) { return; } - data = updatedData; - notifyAll({ delta, isUpdate: true }); - } - }, - () => reload() - ); + const delta = getDelta(subscriptionData); + if (loading || !data) { + updateQueue.push(delta); + } else { + const updatedData = update(data, delta, reload); + if (updatedData === data) { + return; + } + data = updatedData; + notifyAll({ delta, isUpdate: true }); + } + }, + () => reload() + ); + } await initialFetch(); }; @@ -470,7 +473,8 @@ export function makeDataProvider( type DependencySubscribe = Subscribe; // eslint-disable-line @typescript-eslint/no-explicit-any type DependencyUpdateCallback = Parameters['0']; export type CombineDerivedData = ( - parts: Parameters['0']['data'][] + parts: Parameters['0']['data'][], + variables?: OperationVariables ) => Data | null; function makeDerivedDataProviderInternal( @@ -521,7 +525,10 @@ function makeDerivedDataProviderInternal( }); const newData = newLoaded - ? combineData(parts.map((part) => part.data)) + ? combineData( + parts.map((part) => part.data), + variables + ) : data; if ( newLoading !== loading || diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 25e42c03f..df425d0ab 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -10,7 +10,7 @@ /** * The various account types in Vega (used by collateral) */ -export enum AccountType { + export enum AccountType { ACCOUNT_TYPE_BOND = "ACCOUNT_TYPE_BOND", ACCOUNT_TYPE_EXTERNAL = "ACCOUNT_TYPE_EXTERNAL", ACCOUNT_TYPE_FEES_INFRASTRUCTURE = "ACCOUNT_TYPE_FEES_INFRASTRUCTURE", @@ -361,4 +361,4 @@ export interface Pagination { //============================================================== // END Enums and Input Objects -//============================================================== +//============================================================== \ No newline at end of file From 9d2f2fe3aab697e86bf734669e92f0153c33db0e Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 13 Sep 2022 12:05:22 +0000 Subject: [PATCH 64/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 81 ++++++++++++++------ apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 6d9246351..e6d2c4442 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106213.256196636749978685", + "locked_amount": "106157.42863308813035358", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51120.22803145611028", + "locked_amount": "51086.3139079147652", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47407.5117394524021021252", + "locked_amount": "47352.750100183962108426", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "64797.883982370617886030171276", + "locked_amount": "64723.03427569330008772598952", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "19943.521504849955184182", + "locked_amount": "19920.484228892651852084", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6491.422722476852413578", + "locked_amount": "6483.924312701184824618", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "7945.3728864734298", + "locked_amount": "7907.00294384058", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1391070.132328404443679426", + "locked_amount": "1389819.353416984256757146", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32505.94492250402725", + "locked_amount": "32451.587503774155", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2613.42189971663007907723962443745", + "locked_amount": "2576.66327604240614178127968391758", "deposits": [ { "amount": "2833.333333", @@ -5892,7 +5892,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "35960.000000000000000003", + "total_added": "35972.000000000000000003", "total_removed": "17098.49537348884", "locked_amount": "0", "deposits": [ @@ -5916,6 +5916,11 @@ "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", "tx": "0xa87cd2caf4f27d7a60443ec952b831b005a809803fc899c4bcc3ca12016299eb" }, + { + "amount": "12", + "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", + "tx": "0x056bbadf095fbbee4dc0ccac4431c998c65ad3e714a76844c71bdb0509b0ced5" + }, { "amount": "15", "user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -12543,12 +12548,18 @@ "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", "tranche_id": 11, "tx": "0xa87cd2caf4f27d7a60443ec952b831b005a809803fc899c4bcc3ca12016299eb" + }, + { + "amount": "12", + "user": "0x60901F5a6a66BCaD910A97e85373A00996B361f5", + "tranche_id": 11, + "tx": "0x056bbadf095fbbee4dc0ccac4431c998c65ad3e714a76844c71bdb0509b0ced5" } ], "withdrawals": [], - "total_tokens": "2", + "total_tokens": "14", "withdrawn_tokens": "0", - "remaining_tokens": "2" + "remaining_tokens": "14" }, { "address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -22475,7 +22486,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2162091.79893798351430427894", + "locked_amount": "2160169.78722609591911997613", "deposits": [ { "amount": "1998.95815", @@ -23342,8 +23353,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "203258.7850094080512444", - "locked_amount": "12966326.2851132206444730663636805143254933", + "total_removed": "203595.9963255265343694", + "locked_amount": "12959510.9549878156668938206553737397120844", "deposits": [ { "amount": "16249.93", @@ -23877,6 +23888,11 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xa2cf8d5f7caa97b4c6804c0bce8003115d61772edf6ab6f8c9b3de503eafd2f5" }, + { + "amount": "337.211316118483125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x1e6bd91941381b74b4bec158b2366838830987396925340281bce36d0a75a514" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24466,6 +24482,12 @@ "tranche_id": 2, "tx": "0xa2cf8d5f7caa97b4c6804c0bce8003115d61772edf6ab6f8c9b3de503eafd2f5" }, + { + "amount": "337.211316118483125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x1e6bd91941381b74b4bec158b2366838830987396925340281bce36d0a75a514" + }, { "amount": "305.8599694076328", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -24924,8 +24946,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "47344.039530071746", - "remaining_tokens": "212654.847969928254" + "withdrawn_tokens": "47681.250846190229125", + "remaining_tokens": "212317.636653809770875" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -26470,8 +26492,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2764972.018594596729147647", - "locked_amount": "6248984.409351215960935111906418583", + "total_removed": "2765441.081300436948788147", + "locked_amount": "6242692.54009573292258816652086769", "deposits": [ { "amount": "129284.449", @@ -26710,6 +26732,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0x0fb5472a41850ad312926ca6a39df1901579d075b0b8836459e2cd7f96353a8b" }, + { + "amount": "469.0627058402196405", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x6e6546452d57d7d58c5fd0671b8a43c2c6024bf845d085fc3133c6851ab18620" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -28817,6 +28844,12 @@ "tranche_id": 3, "tx": "0x0fb5472a41850ad312926ca6a39df1901579d075b0b8836459e2cd7f96353a8b" }, + { + "amount": "469.0627058402196405", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x6e6546452d57d7d58c5fd0671b8a43c2c6024bf845d085fc3133c6851ab18620" + }, { "amount": "551.363354573845008", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -30553,8 +30586,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "205072.37111770255727725", - "remaining_tokens": "154051.09845729744272275" + "withdrawn_tokens": "205541.43382354277691775", + "remaining_tokens": "153582.03575145722308225" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -31642,7 +31675,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1773434.744647395163801354", - "locked_amount": "2152108.130137534146322763792771381", + "locked_amount": "2149622.17454178526100337726730932", "deposits": [ { "amount": "552496.6455", @@ -33095,7 +33128,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "342595.80458534469382288375849824", + "locked_amount": "342291.23586461032793916252257736", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index ccce8c31d..cef26ae2d 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "79.60645389396243020007881827118214102", + "locked_amount": "78.95550735667177060007817376966007106", "deposits": [ { "amount": "1000", From 040cf0b83bbc43adf797fd2572316df2b56c61e4 Mon Sep 17 00:00:00 2001 From: AndyWhiteVega <106072061+AndyWhiteVega@users.noreply.github.com> Date: Tue, 13 Sep 2022 13:28:48 +0100 Subject: [PATCH 65/66] Test/governance suite expansion (#1317) * test: initial commit * test: commit * test: extra tests and references added also new tag 0.55.0 for builds * test: lint * test: back to 0.54 for capsule cypress until tests fixed * test: skip two tests since wallet name no longer shown soon to be fixed --- .../capsule-cypress-manual-trigger.yml | 2 +- .../workflows/capsule-cypress-night-run.yml | 2 +- .../integration/flow/governance-flow.cy.js | 228 ++++++++++++++++-- .../src/integration/view/governance.cy.js | 23 +- .../src/integration/view/wallet-vega.cy.js | 4 +- .../src/support/wallet-vega.functions.js | 9 +- .../proposals-list/proposals-list.tsx | 6 +- 7 files changed, 250 insertions(+), 24 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 98339188d..6cb2b810d 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -78,7 +78,7 @@ jobs: uses: actions/checkout@v2 with: repository: vegaprotocol/vega - ref: v0.54.0 + ref: v0.55.0 token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index befc1ce14..b0ea14659 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -62,7 +62,7 @@ jobs: uses: actions/checkout@v2 with: repository: vegaprotocol/vega - ref: v0.54.0 + ref: v0.55.0 token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} path: './vega' diff --git a/apps/token-e2e/src/integration/flow/governance-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-flow.cy.js index 644f493d3..1f17cfbfc 100644 --- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js @@ -23,6 +23,8 @@ const proposalVoteProgressForTokens = const proposalVoteProgressAgainstTokens = '[data-testid="vote-progress-indicator-tokens-against"]'; const changeVoteButton = '[data-testid="change-vote-button"]'; +const proposalDetailsTitle = '[data-testid="proposal-title"]'; +const proposalDetailsDescription = '[data-testid="proposal-description"]'; const voteButtons = '[data-testid="vote-buttons"]'; const rejectProposalsLink = '[href="/governance/rejected"]'; const feedbackError = '[data-testid="Error"]'; @@ -170,7 +172,7 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get(dialogCloseButton).click(); }); - it('Newly created freeform proposal - able to filter by proposalID to show it in list', function () { + it('Newly created freeform proposals list - able to filter by proposalID to show it in list', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -200,7 +202,7 @@ context('Governance flow - with eth and vega wallets connected', function () { }); }); - it('Newly created freeform proposal - able to filter by proposerID to show it in list', function () { + it('Newly created freeform proposals list - able to filter by proposerID to show it in list', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -230,7 +232,53 @@ context('Governance flow - with eth and vega wallets connected', function () { }); }); - it('Newly created freeform proposal - shows in an open state', function () { + it('Newly created freeform proposals list - shows title and portion of summary', function () { + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance + ); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.get(newProposalButton).should('be.visible').click(); + cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( + (closingDateTimestamp) => { + cy.enter_unique_freeform_proposal_body(closingDateTimestamp).as( + 'freeformProposal' + ); + } + ); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.contains('Awaiting network confirmation', epochTimeout).should( + 'be.visible' + ); + cy.contains('Proposal submitted', epochTimeout).should('be.visible'); + cy.get(dialogCloseButton).click(); + cy.wait_for_proposal_sync(); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.wait('@proposalSubmissionCompletion') + .its(proposalResponseProposalIdPath) + .then((proposalId) => { + cy.get(openProposals).within(() => { + cy.get('@freeformProposal').then((freeformProposal) => { + // 1004-VOTE-008 + // 1004-VOTE-034 + cy.get(`#${proposalId}`) + .should('contain', freeformProposal.rationale.title) + .and('be.visible'); + cy.get(`#${proposalId}`) + .should( + 'contain', + freeformProposal.rationale.description.substring(0, 59) + ) + .and('be.visible'); + }); + }); + }); + }); + + it('Newly created freeform proposals list - shows open proposals in an open state', function () { + // 1004-VOTE-004 + // 1004-VOTE-035 cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -255,13 +303,131 @@ context('Governance flow - with eth and vega wallets connected', function () { .its(proposalResponseProposalIdPath) .then((proposalId) => { cy.get(openProposals).within(() => { + // 1004-VOTE-035 cy.get(`#${proposalId}`) .should('contain', proposalId) .and('contain', 'Open') - .and('be.visible') - .within(() => { - cy.get(viewProposalButton).should('be.visible').click(); - }); + .and('be.visible'); + }); + }); + }); + + it('Newly created freeform proposal details - shows proposal title and full description', function () { + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance + ); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.get(newProposalButton).should('be.visible').click(); + cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( + (closingDateTimestamp) => { + cy.enter_unique_freeform_proposal_body(closingDateTimestamp).as( + 'freeformProposal' + ); + } + ); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.contains('Awaiting network confirmation', epochTimeout).should( + 'be.visible' + ); + cy.contains('Proposal submitted', epochTimeout).should('be.visible'); + cy.get(dialogCloseButton).click(); + cy.wait_for_proposal_sync(); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.wait('@proposalSubmissionCompletion') + .its(proposalResponseProposalIdPath) + .then((proposalId) => { + cy.get(openProposals).within(() => { + cy.get(`#${proposalId}`).within(() => { + cy.get(viewProposalButton).should('be.visible').click(); + }); + }); + cy.get('@freeformProposal').then((freeformProposal) => { + // 1004-VOTE-054 + cy.get(proposalDetailsTitle) + .should('contain', freeformProposal.rationale.title) + .and('be.visible'); + cy.get(proposalDetailsDescription) + .should('contain', freeformProposal.rationale.description) + .and('be.visible'); + }); + }); + }); + + it('Newly created freeform proposal details - shows full link included in description', function () { + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance + ); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.get(newProposalButton).should('be.visible').click(); + cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( + (closingDateTimestamp) => { + cy.enter_unique_freeform_proposal_body(closingDateTimestamp).as( + 'freeformProposal' + ); + } + ); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.contains('Awaiting network confirmation', epochTimeout).should( + 'be.visible' + ); + cy.contains('Proposal submitted', epochTimeout).should('be.visible'); + cy.get(dialogCloseButton).click(); + cy.wait_for_proposal_sync(); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.wait('@proposalSubmissionCompletion') + .its(proposalResponseProposalIdPath) + .then((proposalId) => { + cy.get(openProposals).within(() => { + cy.get(`#${proposalId}`).within(() => { + cy.get(viewProposalButton).should('be.visible').click(); + }); + }); + cy.get('@freeformProposal').then((freeformProposal) => { + // 1004-VOTE-055 + cy.get(proposalDetailsDescription) + .should('contain', freeformProposal.rationale.description) + .and('have.attr', 'href') + .and( + 'equal', + 'https://dweb.link/ipfs/bafybeigwwctpv37xdcwacqxvekr6e4kaemqsrv34em6glkbiceo3fcy4si' + ) + .and('be.visible'); + }); + }); + }); + + it('Newly created freeform proposal details - shows open proposal in an open state', function () { + cy.ensure_specified_unstaked_tokens_are_associated( + this.minProposerBalance + ); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.get(newProposalButton).should('be.visible').click(); + cy.create_ten_digit_unix_timestamp_for_specified_days('8').then( + (closingDateTimestamp) => { + cy.enter_unique_freeform_proposal_body(closingDateTimestamp); + } + ); + cy.get(newProposalSubmitButton).should('be.visible').click(); + cy.contains('Awaiting network confirmation', epochTimeout).should( + 'be.visible' + ); + cy.contains('Proposal submitted', epochTimeout).should('be.visible'); + cy.get(dialogCloseButton).click(); + cy.wait_for_proposal_sync(); + cy.navigate_to('governance'); + cy.wait_for_spinner(); + cy.wait('@proposalSubmissionCompletion') + .its(proposalResponseProposalIdPath) + .then((proposalId) => { + cy.get(openProposals).within(() => { + cy.get(`#${proposalId}`).within(() => { + cy.get(viewProposalButton).should('be.visible').click(); + }); }); cy.get_proposal_information_from_table('ID') .contains(proposalId) @@ -275,7 +441,7 @@ context('Governance flow - with eth and vega wallets connected', function () { }); }); - it('Newly created freeform proposal - shows proposed and closing dates', function () { + it('Newly created freeform proposal details - shows proposed and closing dates', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -314,10 +480,14 @@ context('Governance flow - with eth and vega wallets connected', function () { .should('be.visible'); } ); + // 1004-VOTE-043 cy.contains('9 days left to vote').should('be.visible'); }); - it('Newly created freeform proposal - shows default status set to fail', function () { + it('Newly created freeform proposal details - shows default status set to fail', function () { + // 1004-VOTE-037 + // 1004-VOTE-039 + // 1004-VOTE-040 cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -348,6 +518,7 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get_proposal_information_from_table('Will pass') .contains('👎') .should('be.visible'); + // 1004-VOTE-062 cy.get_proposal_information_from_table('Majority met') .contains('👎') .should('be.visible'); @@ -356,7 +527,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .should('be.visible'); }); - it('Newly created freeform proposal - ability to vote for proposal - with minimum required tokens associated', function () { + it('Newly created freeform proposal details - ability to vote for proposal - with minimum required tokens associated', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -385,6 +556,8 @@ context('Governance flow - with eth and vega wallets connected', function () { '0', 'shortMonth' ).then((votedDate) => { + // 1004-VOTE-051 + // 1004-VOTE-093 cy.contains('You voted:') .siblings() .contains('For') @@ -408,9 +581,11 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get_proposal_information_from_table('Tokens against proposal') .should('have.text', '0.00') .and('be.visible'); + // 1004-VOTE-061 cy.get_proposal_information_from_table('Participation required') .contains(`${this.requiredParticipation}%`) .should('be.visible'); + // 1004-VOTE-066 cy.get_proposal_information_from_table('Majority Required') .contains(`${parseFloat(this.requiredMajority).toFixed(2)}%`) .should('be.visible'); @@ -419,7 +594,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .and('be.visible'); }); - it('Newly created freeform proposal - ability to vote against proposal - with minimum required tokens associated', function () { + it('Newly created freeform proposal details - ability to vote against proposal - with minimum required tokens associated', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -448,6 +623,7 @@ context('Governance flow - with eth and vega wallets connected', function () { '0', 'shortMonth' ).then((votedDate) => { + // 1004-VOTE-051 cy.contains('You voted:') .siblings() .contains('Against') @@ -482,7 +658,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .and('be.visible'); }); - it('Newly created freeform proposal - ability to change vote from against to for - with minimum required tokens associated', function () { + it('Newly created freeform proposal details - ability to change vote from against to for - with minimum required tokens associated', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -507,6 +683,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .as('submittedProposal') .within(() => cy.get(viewProposalButton).click()); cy.vote_for_proposal('against'); + // 1004-VOTE-090 cy.get(changeVoteButton).should('be.visible').click(); cy.wait_for_spinner(); cy.vote_for_proposal('for'); @@ -520,6 +697,7 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get(proposalVoteProgressAgainstTokens) .contains('0.00') .and('be.visible'); + // 1004-VOTE-064 cy.get_proposal_information_from_table('Tokens for proposal') .should('have.text', parseFloat(this.minProposerBalance).toFixed(2)) .and('be.visible'); @@ -537,7 +715,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .and('be.visible'); }); - it('Newly created freeform proposal - ability to change vote from for to against - with minimum required tokens associated', function () { + it('Newly created freeform proposal details - ability to change vote from for to against - with minimum required tokens associated', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -564,6 +742,7 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.vote_for_proposal('for'); cy.get(changeVoteButton).should('be.visible').click(); cy.wait_for_spinner(); + // 1004-VOTE-080 cy.vote_for_proposal('against'); cy.get(proposalVoteProgressForPercentage) .contains('0.00%') @@ -592,7 +771,7 @@ context('Governance flow - with eth and vega wallets connected', function () { .and('be.visible'); }); - it('Newly created freeform proposal - ability to increase associated tokens - so that vote sways result', function () { + it('Newly created freeform proposal details - ability to increase associated tokens - so that vote sways result', function () { cy.ensure_specified_unstaked_tokens_are_associated( this.minProposerBalance ); @@ -616,6 +795,7 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get_submitted_proposal_from_proposal_list() .as('submittedProposal') .within(() => cy.get(viewProposalButton).click()); + // 1004-VOTE-080 cy.vote_for_proposal('for'); cy.get_proposal_information_from_table('Total Supply') .invoke('text') @@ -637,6 +817,8 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get(proposalVoteProgressAgainstPercentage) .contains('0.00%') .and('be.visible'); + // 1004-VOTE-065 + // 1004-VOTE-079 cy.get(proposalVoteProgressForTokens) .contains(tokensRequiredToAcheiveResult) .and('be.visible'); @@ -652,6 +834,22 @@ context('Governance flow - with eth and vega wallets connected', function () { cy.get_proposal_information_from_table('Number of voting parties') .should('have.text', '1') .and('be.visible'); + cy.get_proposal_information_from_table('Will pass') + .contains('👍') + .should('be.visible'); + // 1004-VOTE-062 + cy.get_proposal_information_from_table('Majority met') + .contains('👍') + .should('be.visible'); + cy.get_proposal_information_from_table('Participation met') + .contains('👍') + .should('be.visible'); + // 1004-VOTE-042 + // 1004-VOTE-057 + // 1004-VOTE-058 + // 1004-VOTE-059 + // 1004-VOTE-060 + cy.contains('Currently set to pass').should('be.visible'); }); }); @@ -844,6 +1042,8 @@ context('Governance flow - with eth and vega wallets connected', function () { parseSpecialCharSequences: false, delay: 2, }); + + cy.wrap(freeformProposal); }); }); diff --git a/apps/token-e2e/src/integration/view/governance.cy.js b/apps/token-e2e/src/integration/view/governance.cy.js index 33f3b94ab..a646d9225 100644 --- a/apps/token-e2e/src/integration/view/governance.cy.js +++ b/apps/token-e2e/src/integration/view/governance.cy.js @@ -1,5 +1,7 @@ const noOpenProposals = '[data-testid="no-open-proposals"]'; const noClosedProposals = '[data-testid="no-closed-proposals"]'; +const proposalDocumentationLink = '[data-testid="external-link"]'; +const newProposalLink = '[data-testid="new-proposal-link"]'; context('Governance Page - verify elements on page', function () { before('navigate to governance page', function () { @@ -15,7 +17,26 @@ context('Governance Page - verify elements on page', function () { cy.verify_page_header('Governance'); }); - it('should have information visible', function () { + it('should be able to see link for - Find out more about Vega governance', function () { + // 1004-VOTE-001 + cy.get(proposalDocumentationLink) + .should('be.visible') + .and('have.text', 'Find out more about Vega governance') + .and('have.attr', 'href') + .and('equal', 'https://vega.xyz/governance'); + }); + + it('should be able to see button for - new proposal', function () { + // 1004-VOTE-002 + cy.get(newProposalLink) + .should('be.visible') + .and('have.text', 'New proposal') + .and('have.attr', 'href') + .and('equal', '/governance/propose'); + }); + + it('should be able to see that no proposals exist', function () { + // 1004-VOTE-003 cy.get(noOpenProposals) .should('be.visible') .and('have.text', 'There are no open or yet to enact proposals'); diff --git a/apps/token-e2e/src/integration/view/wallet-vega.cy.js b/apps/token-e2e/src/integration/view/wallet-vega.cy.js index 871bef646..bc6394fee 100644 --- a/apps/token-e2e/src/integration/view/wallet-vega.cy.js +++ b/apps/token-e2e/src/integration/view/wallet-vega.cy.js @@ -170,7 +170,7 @@ context('Vega Wallet - verify elements on widget', function () { }); }); - it('should have wallet name visible', function () { + it.skip('should have wallet name visible', function () { cy.get(walletContainer).within(() => { cy.get(walletName) .should('be.visible') @@ -238,7 +238,7 @@ context('Vega Wallet - verify elements on widget', function () { }); }); - it('should have vega wallet public key and name visible', function () { + it.skip('should have vega wallet public key and name visible', function () { cy.get(dialog).within(() => { cy.get(dialogVegaKey) .should('be.visible') diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/token-e2e/src/support/wallet-vega.functions.js index 883358645..c25826df1 100644 --- a/apps/token-e2e/src/support/wallet-vega.functions.js +++ b/apps/token-e2e/src/support/wallet-vega.functions.js @@ -7,15 +7,16 @@ const vegaWalletPassphrase = Cypress.env('vegaWalletPassphrase'); Cypress.Commands.add('vega_wallet_import', () => { cy.highlight(`Importing Vega Wallet ${vegaWalletName}`); - cy.exec(`vegawallet init -f --home ${vegaWalletLocation}`); + cy.exec(`vega wallet init -f --home ${vegaWalletLocation}`); cy.exec( - `vegawallet import -w ${vegaWalletName} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet`, + `vega wallet import -w ${vegaWalletName} --recovery-phrase-file ./src/fixtures/wallet/recovery -p ./src/fixtures/wallet/passphrase --home ~/.vegacapsule/testnet/wallet`, { failOnNonZeroExit: false } ); cy.exec( - `vegawallet service run --network DV --automatic-consent --home ${vegaWalletLocation}` + `vega wallet service run --network DV --automatic-consent --home ${vegaWalletLocation}` ); - cy.exec(`vegawallet version`) + + cy.exec(`vega wallet version`) .its('stdout') .then((output) => { cy.log(output); diff --git a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx index 10a264121..7336c3df3 100644 --- a/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx +++ b/apps/token/src/routes/governance/components/proposals-list/proposals-list.tsx @@ -66,7 +66,11 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => { {t( `The Vega network is governed by the community. View active proposals, vote on them or propose changes to the network.` )}{' '} - + {t(`Find out more about Vega governance`)}

From 2eea3e2e34d7a2d38081f3f32cf9cc8344f1868f Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 13 Sep 2022 18:05:16 +0000 Subject: [PATCH 66/66] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 30 ++++++++++---------- apps/static/src/assets/testnet-tranches.json | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index e6d2c4442..94c81a870 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -232,7 +232,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "106157.42863308813035358", + "locked_amount": "106098.1360429719255366", "deposits": [ { "amount": "129999.45", @@ -298,7 +298,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "51086.3139079147652", + "locked_amount": "51050.29485032978276", "deposits": [ { "amount": "2600", @@ -682,7 +682,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "47352.750100183962108426", + "locked_amount": "47294.5895926345761588126", "deposits": [ { "amount": "97499.58", @@ -715,7 +715,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "64723.03427569330008772598952", + "locked_amount": "64643.53890286602609186297228", "deposits": [ { "amount": "135173.4239508", @@ -748,7 +748,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "19920.484228892651852084", + "locked_amount": "19896.017107744868930832", "deposits": [ { "amount": "32499.86", @@ -781,7 +781,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "6483.924312701184824618", + "locked_amount": "6475.960502190905203881", "deposits": [ { "amount": "10833.29", @@ -889,7 +889,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "30000", "total_removed": "0", - "locked_amount": "7907.00294384058", + "locked_amount": "7866.2515096618368", "deposits": [ { "amount": "7500", @@ -1006,7 +1006,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "479504.6187210477481", - "locked_amount": "1389819.353416984256757146", + "locked_amount": "1388490.942922118064795974", "deposits": [ { "amount": "1852091.69", @@ -1292,7 +1292,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "32451.587503774155", + "locked_amount": "32393.8563053542705", "deposits": [ { "amount": "12500", @@ -2159,7 +2159,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "20696.25757434884556896", - "locked_amount": "2576.66327604240614178127968391758", + "locked_amount": "2537.6231698974791687009338450295", "deposits": [ { "amount": "2833.333333", @@ -22486,7 +22486,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "204390.7646836173642", - "locked_amount": "2160169.78722609591911997613", + "locked_amount": "2158128.48279889755415607996", "deposits": [ { "amount": "1998.95815", @@ -23354,7 +23354,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "203595.9963255265343694", - "locked_amount": "12959510.9549878156668938206553737397120844", + "locked_amount": "12952272.620553243128136100283526560935388", "deposits": [ { "amount": "16249.93", @@ -26493,7 +26493,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "2765441.081300436948788147", - "locked_amount": "6242692.54009573292258816652086769", + "locked_amount": "6236010.1559629377107703982051563", "deposits": [ { "amount": "129284.449", @@ -31675,7 +31675,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "1773434.744647395163801354", - "locked_amount": "2149622.17454178526100337726730932", + "locked_amount": "2146981.92415619473594330314378902", "deposits": [ { "amount": "552496.6455", @@ -33128,7 +33128,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "3216.01601557326", - "locked_amount": "342291.23586461032793916252257736", + "locked_amount": "341967.79448782570701567102181632", "deposits": [ { "amount": "3000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index cef26ae2d..2268420b7 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -89,7 +89,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "78.95550735667177060007817376966007106", + "locked_amount": "78.26388666920349680007748899670218168", "deposits": [ { "amount": "1000",