From 74777e54f9d43c5d2212d166076c45205bf9a7ee Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 12 Jul 2023 16:26:52 +0100 Subject: [PATCH 01/16] chore(ci): revert run console-test on CICD (#4303) --- .github/workflows/ci-cd-trigger.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index 935d233d8..fb318b68e 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -277,14 +277,6 @@ jobs: * trading: ${{ needs.lint-test-build.outputs.preview_trading }} * tools: ${{ needs.lint-test-build.outputs.preview_tools }} - console-test: - needs: dist-check - name: '(CI) console-test' - uses: ./.github/workflows/console-test-run.yml - secrets: inherit - with: - github-sha: ${{ github.sha }} - # Report single result at the end, to avoid mess with required checks in PR cypress-check: name: '(CI) cypress - check' From 6aa109131e48ae957d0e0ca788b3bbdff764e639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Wed, 12 Jul 2023 17:37:49 +0200 Subject: [PATCH 02/16] feat(ci): allow individual releases of the applications (#4300) --- .github/workflows/ci-cd-trigger.yml | 18 ++++++++- .github/workflows/publish-dist.yml | 63 ++++++++++++++++++++--------- 2 files changed, 62 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index fb318b68e..5c0dbb5d1 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -5,7 +5,6 @@ on: branches: - release/* - develop - - main # uncomment pull_request and comment pull_request_target to test CI changes against feature branch not target branch (develop) # pull_request: pull_request_target: @@ -180,6 +179,23 @@ jobs: fi fi + # if branch starts with release/ and ends with trading / governance or explorer - overwrite the array of affected projects with fixed single application + if [[ "${{ github.ref }}" == release* ]]; then + case "${{ github.ref }}" in + *trading) + projects_array=(trading) + projects_e2e_array=(trading) + ;; + *governance) + projects_array=(governance) + projects_e2e_array=(governance) + ;; + *explorer) + projects_array=(explorer) + projects_e2e_array=(explorer) + ;; + fi + echo "Projects: ${projects_array[@]}" echo "Projects E2E: ${projects_e2e_array[@]}" projects_json=$(jq -M --compact-output --null-input '$ARGS.positional' --args -- "${projects_array[@]}") diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 61543b693..63b328826 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -22,6 +22,33 @@ jobs: with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Init variables + run: | + echo IS_PR=false >> $GITHUB_ENV + echo IS_MAINNET_RELEASE=false >> $GITHUB_ENV + echo IS_TESTNET_RELEASE=false >> $GITHUB_ENV + echo IS_IPFS_RELEASE=false >> $GITHUB_ENV + + - name: Is PR + if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + run: | + echo IS_PR=true >> $GITHUB_ENV + + - name: Is mainnet release + if: ${{ contains(github.ref, 'release/mainnnet') && !contains(github.ref, 'mirror') }} + run: | + echo IS_MAINNET_RELEASE=true >> $GITHUB_ENV + + - name: Is testnet release + if: ${{ contains(github.ref, 'release/testnet') }} + run: | + echo IS_TESTNET_RELEASE=true >> $GITHUB_ENV + + - name: Is IPFS Release + if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( env.IS_MAINNET_RELEASE == 'true' || env.IS_TESTNET_RELEASE == 'true' ) }} + run: | + echo IS_IPFS_RELEASE=true >> $GITHUB_ENV + - name: Set up QEMU id: quemu uses: docker/setup-qemu-action@v2 @@ -33,7 +60,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Log in to the Container registry (ghcr) - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ env.IS_PR == 'true' }} uses: docker/login-action@v2 with: registry: ghcr.io @@ -42,9 +69,8 @@ jobs: - name: Log in to the Container registry (docker hub) uses: docker/login-action@v2 - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) }} + if: ${{ env.IS_IPFS_RELEASE == 'true' }} with: - # registry: registry.hub.docker.com username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} @@ -70,7 +96,8 @@ jobs: bucketName='' if [[ "${{ github.ref }}" =~ .*release/.* ]]; then - envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)" + # remove prefixing release/ and take the first string limited by / which is supposed to be name of the environment for releasing + envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '/' -f 1 )" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1" if [[ "${{ matrix.app }}" = "multisig-signer" ]]; then @@ -145,7 +172,7 @@ jobs: ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local - name: Image digest - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ env.IS_PR == 'true' }} run: echo ${{ steps.docker_build.outputs.digest }} - name: Sanity check docker image @@ -160,7 +187,7 @@ jobs: uses: docker/build-push-action@v3 continue-on-error: true id: ghcr-push - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ env.IS_PR == 'true' }} with: context: . file: docker/node-outside-docker.Dockerfile @@ -175,7 +202,7 @@ jobs: uses: docker/build-push-action@v3 continue-on-error: true id: dockerhub-push - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) }} + if: ${{ env.IS_IPFS_RELEASE == 'true' }} with: context: . file: docker/node-outside-docker.Dockerfile @@ -185,7 +212,7 @@ jobs: ENV_NAME=${{ env.ENV_NAME }} tags: | vegaprotocol/${{ matrix.app }}:${{ github.sha }} - vegaprotocol/${{ matrix.app }}:${{ endsWith(github.ref, 'main') && 'mainnet' || endsWith(github.ref, 'release/testnet') && 'testnet' || '' }} + vegaprotocol/${{ matrix.app }}:${{ env.IS_MAINNET_RELEASE == 'true' && 'mainnet' || env.IS_TESTNET_RELEASE == 'true' && 'testnet' || '' }} - name: Publish dist as docker image (ghcr - retry) uses: docker/build-push-action@v3 @@ -212,13 +239,13 @@ jobs: ENV_NAME=${{ env.ENV_NAME }} tags: | vegaprotocol/${{ matrix.app }}:${{ github.sha }} - vegaprotocol/${{ matrix.app }}:${{ endsWith(github.ref, 'main') && 'mainnet' || endsWith(github.ref, 'release/testnet') && 'testnet' || '' }} + vegaprotocol/${{ matrix.app }}:${{ env.IS_MAINNET_RELEASE == 'true' && 'mainnet' || env.IS_TESTNET_RELEASE == 'true' && 'testnet' || '' }} # bucket creation in github.com/vegaprotocol/terraform//frontend - name: Publish dist to s3 uses: jakejarvis/s3-sync-action@master # s3 releases are not happening for trading on mainnet - it's IPFS - if: ${{ github.event_name == 'push' && ( matrix.app != 'trading' || (matrix.app == 'trading' && !( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) ) ) }} + if: ${{ env.IS_IPFS_RELEASE == 'false' }} with: args: --acl private --follow-symlinks --delete env: @@ -229,11 +256,11 @@ jobs: SOURCE_DIR: 'dist-result' - name: Install aws CLI - if: ${{ github.event_name == 'push' && ( matrix.app != 'trading' || (matrix.app == 'trading' && !( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) ) ) }} + if: ${{ env.IS_IPFS_RELEASE == 'false' }} uses: unfor19/install-aws-cli-action@master - name: Perform cache invalidation - if: ${{ github.event_name == 'push' && ( matrix.app != 'trading' || (matrix.app == 'trading' && !( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) ) ) }} + if: ${{ env.IS_IPFS_RELEASE == 'false' }} env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -246,14 +273,14 @@ jobs: - name: Add preview label uses: actions-ecosystem/action-add-labels@v1 - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ env.IS_PR == 'true' }} with: labels: ${{ matrix.app }}-preview number: ${{ github.event.number }} - name: Trigger fleek deployment # release to ipfs happens only on mainnet (represented by main branch) for trading - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'release/testnet') ) }} + if: ${{ env.IS_IPFS_RELEASE == 'true' }} run: | if echo ${{ github.ref }} | grep -q main; then # display info about app @@ -283,7 +310,7 @@ jobs: fi - name: Check out ipfs-redirect - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'testnet') ) }} + if: ${{ env.IS_IPFS_RELEASE == 'true' }} uses: actions/checkout@v3 with: repository: 'vegaprotocol/ipfs-redirect' @@ -292,7 +319,7 @@ jobs: token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} - name: Update interstitial page to point to the new console - if: ${{ matrix.app == 'trading' && github.event_name == 'push' && ( endsWith(github.ref, 'main') || endsWith(github.ref, 'testnet') ) }} + if: ${{ env.IS_IPFS_RELEASE == 'true' }} env: GH_TOKEN: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }} run: | @@ -314,11 +341,11 @@ jobs: git config --global user.name "vega-ci-bot" # update CID files - if echo ${{ github.ref }} | grep -q main; then + if [[ "${{ env.IS_MAINNET_RELEASE }}" = "true" ]]; then echo $new_hash > cidv0-mainnet.txt echo $new_cid > cidv1-mainnet.txt git add cidv0-mainnet.txt cidv1-mainnet.txt - elif echo ${{ github.ref }} | grep -q release/testnet; then + elif [[ "${{ env.IS_TESTNET_RELEASE }}" = "true" ]]; then echo $new_hash > cidv0-fairground.txt echo $new_cid > cidv1-fairground.txt git add cidv0-fairground.txt cidv1-fairground.txt From 27cd8086e17c6209af1ad0876bd46a6f1d7aefbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Wed, 12 Jul 2023 17:47:46 +0200 Subject: [PATCH 03/16] fix(ci): syntax on switch case --- .github/workflows/ci-cd-trigger.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index 5c0dbb5d1..a5831f71a 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -182,18 +182,19 @@ jobs: # if branch starts with release/ and ends with trading / governance or explorer - overwrite the array of affected projects with fixed single application if [[ "${{ github.ref }}" == release* ]]; then case "${{ github.ref }}" in - *trading) - projects_array=(trading) - projects_e2e_array=(trading) - ;; - *governance) - projects_array=(governance) - projects_e2e_array=(governance) - ;; - *explorer) - projects_array=(explorer) - projects_e2e_array=(explorer) - ;; + *trading) + projects_array=(trading) + projects_e2e_array=(trading) + ;; + *governance) + projects_array=(governance) + projects_e2e_array=(governance) + ;; + *explorer) + projects_array=(explorer) + projects_e2e_array=(explorer) + ;; + esac fi echo "Projects: ${projects_array[@]}" From 8b6b904cd662678252e590a171c9325bfcf4851e Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Thu, 13 Jul 2023 10:10:48 +0100 Subject: [PATCH 04/16] test(governance): un-skip governance tests (#4292) --- .../src/integration/flow/proposal-flow.cy.ts | 4 ++-- apps/governance-e2e/src/integration/view/home.cy.ts | 2 +- .../src/integration/view/pubkey-view.cy.ts | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts index 8c66f8689..c5f72c211 100644 --- a/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.ts @@ -320,8 +320,8 @@ context( // 3001-VOTE-076 cy.getByTestId(connectToVegaWalletButton) .should('be.visible') - .and('have.text', 'Connect Vega wallet') - .click(); + .and('have.text', 'Connect Vega wallet'); + cy.getByTestId(connectToVegaWalletButton).click(); cy.getByTestId('connector-jsonRpc').click(); cy.getByTestId(vegaWalletNameElement).should('be.visible'); cy.getByTestId(connectToVegaWalletButton).should('not.exist'); diff --git a/apps/governance-e2e/src/integration/view/home.cy.ts b/apps/governance-e2e/src/integration/view/home.cy.ts index 4ceff6fa7..6e2df34fd 100644 --- a/apps/governance-e2e/src/integration/view/home.cy.ts +++ b/apps/governance-e2e/src/integration/view/home.cy.ts @@ -161,7 +161,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () { cy.getByTestId('menu-drawer').should('be.visible'); }); - it.skip('should have link for proposal page', function () { + it('should have link for proposal page', function () { cy.getByTestId('menu-drawer').within(() => { cy.get('[href="/proposals"]') .should('exist') diff --git a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts index 794aeddf7..edd20d669 100644 --- a/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts +++ b/apps/governance-e2e/src/integration/view/pubkey-view.cy.ts @@ -1,13 +1,12 @@ /// import { - navigateTo, - navigation, turnTelemetryOff, waitForSpinner, } from '../../support/common.functions'; import { - enterUniqueFreeFormProposalBody, + createTenDigitUnixTimeStampForSpecifiedDays, + enterRawProposalBody, goToMakeNewProposal, governanceProposalType, } from '../../support/governance.functions'; @@ -47,12 +46,11 @@ context('View functionality with public key', { tags: '@smoke' }, function () { .and('contain.text', 'USDC (fake)'); }); - it.skip('Unable to submit proposal with public key', function () { + it('Unable to submit proposal with public key', function () { const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`; - navigateTo(navigation.proposals); - goToMakeNewProposal(governanceProposalType.FREEFORM); - enterUniqueFreeFormProposalBody('50', 'pub key proposal test'); + goToMakeNewProposal(governanceProposalType.RAW); + enterRawProposalBody(createTenDigitUnixTimeStampForSpecifiedDays(8)); cy.getByTestId('dialog-content') .first() .within(() => { From 94a067e34b2904a2431e5db3d5a2daf37cc1ff54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Thu, 13 Jul 2023 11:19:37 +0200 Subject: [PATCH 05/16] fix(ci): disable pull_request_target (#4315) --- .github/workflows/ci-cd-trigger.yml | 12 +++++------- .github/workflows/publish-dist.yml | 6 +++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index a5831f71a..9842705b5 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -5,9 +5,7 @@ on: branches: - release/* - develop - # uncomment pull_request and comment pull_request_target to test CI changes against feature branch not target branch (develop) - # pull_request: - pull_request_target: + pull_request: types: - opened - ready_for_review @@ -48,7 +46,7 @@ jobs: lint-pr-title: needs: node-modules - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' }} name: Verify PR title uses: ./.github/workflows/lint-pr.yml secrets: inherit @@ -231,7 +229,7 @@ jobs: publish-dist: needs: lint-test-build name: '(CD) publish dist' - # if: ${{ needs.lint-test-build.outputs.projects != '[]' }} + if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'vegaprotocol/frontend-monorepo') || github.event_name == 'push' }} uses: ./.github/workflows/publish-dist.yml secrets: inherit with: @@ -242,7 +240,7 @@ jobs: needs: - publish-dist - lint-test-build - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == 'vegaprotocol/frontend-monorepo' }} timeout-minutes: 60 name: '(CD) comment preview links' steps: @@ -288,7 +286,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} body: | - Previews: + Previews * governance: ${{ needs.lint-test-build.outputs.preview_governance }} * explorer: ${{ needs.lint-test-build.outputs.preview_explorer }} * trading: ${{ needs.lint-test-build.outputs.preview_trading }} diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 63b328826..51c7466de 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -30,7 +30,7 @@ jobs: echo IS_IPFS_RELEASE=false >> $GITHUB_ENV - name: Is PR - if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }} + if: ${{ github.event_name == 'pull_request' }} run: | echo IS_PR=true >> $GITHUB_ENV @@ -96,8 +96,8 @@ jobs: bucketName='' if [[ "${{ github.ref }}" =~ .*release/.* ]]; then - # remove prefixing release/ and take the first string limited by / which is supposed to be name of the environment for releasing - envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '/' -f 1 )" + # remove prefixing release/ and take the first string limited by - which is supposed to be name of the environment for releasing (format: release/testnet-trading) + envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '-' -f 1 )" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1" if [[ "${{ matrix.app }}" = "multisig-signer" ]]; then From edbdbcf38ee50eeb4814418e711a9a4a3ff225ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Thu, 13 Jul 2023 16:10:07 +0200 Subject: [PATCH 06/16] feat(ci): provide fixes for releasing individual apps --- .github/workflows/ci-cd-trigger.yml | 10 +++++++++- .github/workflows/publish-dist.yml | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci-cd-trigger.yml b/.github/workflows/ci-cd-trigger.yml index 9842705b5..851bfcaf6 100644 --- a/.github/workflows/ci-cd-trigger.yml +++ b/.github/workflows/ci-cd-trigger.yml @@ -107,6 +107,7 @@ jobs: echo "NX_HEAD: ${{ env.NX_HEAD }}" echo "Affected: ${affected}" echo "Branch slug: ${branch_slug}" + echo "Current ref: ${{ github.ref }}" echo ">>>> eof debug" projects_array=() @@ -178,20 +179,27 @@ jobs: fi # if branch starts with release/ and ends with trading / governance or explorer - overwrite the array of affected projects with fixed single application - if [[ "${{ github.ref }}" == release* ]]; then + if [[ "${{ github.ref }}" == *release* ]]; then + echo ">> This is a relase branch" case "${{ github.ref }}" in *trading) + echo ">> Only trading will be deployed" projects_array=(trading) projects_e2e_array=(trading) ;; *governance) + echo ">> Only governance will be deployed" projects_array=(governance) projects_e2e_array=(governance) ;; *explorer) + echo ">> Only explorer will be deployed" projects_array=(explorer) projects_e2e_array=(explorer) ;; + *) + echo ">> All apps will be deployed" + ;; esac fi diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index 51c7466de..ef17f00cf 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -97,7 +97,7 @@ jobs: if [[ "${{ github.ref }}" =~ .*release/.* ]]; then # remove prefixing release/ and take the first string limited by - which is supposed to be name of the environment for releasing (format: release/testnet-trading) - envName="$(echo ${{ github.ref }} | sed -e "s|release/||" | cut -d '-' -f 1 )" + envName="$(echo ${{ github.ref }} | sed -e "s|refs/heads/release/||" | cut -d '-' -f 1 )" elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then envName="stagnet1" if [[ "${{ matrix.app }}" = "multisig-signer" ]]; then @@ -112,7 +112,7 @@ jobs: envName="mainnet" bucketName="ui.vega.rocks" fi - elif [[ "${{ github.ref }}" =~ .*main$ ]]; then + elif [[ "${{ github.ref }}" =~ .*mainnet$ ]]; then envName="mainnet" fi @@ -282,7 +282,7 @@ jobs: # release to ipfs happens only on mainnet (represented by main branch) for trading if: ${{ env.IS_IPFS_RELEASE == 'true' }} run: | - if echo ${{ github.ref }} | grep -q main; then + if [[ "${{ env.IS_MAINNET_RELEASE }}" = "true" ]]; then # display info about app curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \ -H "Content-Type: application/json" \ @@ -295,7 +295,7 @@ jobs: -d '{"query": "mutation{triggerDeploy(siteId:\"f8f2e051-f18e-49e6-b876-0a39369dc0d8\"){id status}}"}' \ https://api.fleek.co/graphql - elif echo ${{ github.ref }} | grep -q release/testnet; then + elif [[ "${{ env.IS_TESTNET_RELEASE }}" = "true" ]]; then # display info about app curl --fail -H "Authorization: ${{ secrets.FLEEK_API_KEY }}" \ -H "Content-Type: application/json" \ From f440f57be2a79263e542af5dd93ec027a054e241 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20M=C5=82odzikowski?= Date: Fri, 14 Jul 2023 13:45:06 +0200 Subject: [PATCH 07/16] fix(ci): do not trigger releasing to s3 on pull requests --- .github/workflows/publish-dist.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-dist.yml b/.github/workflows/publish-dist.yml index ef17f00cf..76957ae37 100644 --- a/.github/workflows/publish-dist.yml +++ b/.github/workflows/publish-dist.yml @@ -28,6 +28,7 @@ jobs: echo IS_MAINNET_RELEASE=false >> $GITHUB_ENV echo IS_TESTNET_RELEASE=false >> $GITHUB_ENV echo IS_IPFS_RELEASE=false >> $GITHUB_ENV + echo IS_S3_RELASE=false >> $GITHUB_ENV - name: Is PR if: ${{ github.event_name == 'pull_request' }} @@ -49,6 +50,11 @@ jobs: run: | echo IS_IPFS_RELEASE=true >> $GITHUB_ENV + - name: Is S3 Release + if: ${{ env.IS_IPFS_RELASE == 'false' && github.event_name == 'push' }} + run: | + echo IS_S3_RELASE=true >> $GITHUB_ENV + - name: Set up QEMU id: quemu uses: docker/setup-qemu-action@v2 @@ -245,7 +251,7 @@ jobs: - name: Publish dist to s3 uses: jakejarvis/s3-sync-action@master # s3 releases are not happening for trading on mainnet - it's IPFS - if: ${{ env.IS_IPFS_RELEASE == 'false' }} + if: ${{ env.IS_S3_RELASE == 'true' }} with: args: --acl private --follow-symlinks --delete env: @@ -256,11 +262,11 @@ jobs: SOURCE_DIR: 'dist-result' - name: Install aws CLI - if: ${{ env.IS_IPFS_RELEASE == 'false' }} + if: ${{ env.IS_S3_RELASE == 'true' }} uses: unfor19/install-aws-cli-action@master - name: Perform cache invalidation - if: ${{ env.IS_IPFS_RELEASE == 'false' }} + if: ${{ env.IS_S3_RELASE == 'true' }} env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} From a68b2093e4455e37422180c14b080e7d1f330151 Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Mon, 17 Jul 2023 11:59:22 +0100 Subject: [PATCH 08/16] fix(ui-toolkit): toolkit bugs (#4329) --- libs/ui-toolkit/src/components/button/button.tsx | 4 ++-- .../src/components/checkbox/checkbox.stories.tsx | 7 +++++++ libs/ui-toolkit/src/components/checkbox/checkbox.tsx | 4 ++-- libs/ui-toolkit/src/utils/shared.ts | 5 +++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/libs/ui-toolkit/src/components/button/button.tsx b/libs/ui-toolkit/src/components/button/button.tsx index 73c410a4d..ebc865cd4 100644 --- a/libs/ui-toolkit/src/components/button/button.tsx +++ b/libs/ui-toolkit/src/components/button/button.tsx @@ -30,14 +30,14 @@ const primary = [ 'enabled:active:bg-vega-yellow-550 enabled:active:border-vega-yellow-550', ]; const secondary = [ - 'text-white dark:text-black', + 'text-white', 'border-vega-pink', 'dark:bg-vega-pink bg-vega-pink-550', 'enabled:hover:bg-vega-pink enabled:hover:border-vega-pink', 'enabled:active:bg-vega-pink enabled:active:border-vega-pink', ]; const ternary = [ - 'text-white dark:text-black', + 'text-black', 'border-vega-green', 'dark:bg-vega-green bg-vega-green-550', 'enabled:hover:bg-vega-green enabled:hover:border-vega-green', diff --git a/libs/ui-toolkit/src/components/checkbox/checkbox.stories.tsx b/libs/ui-toolkit/src/components/checkbox/checkbox.stories.tsx index 713960942..0bb14fb65 100644 --- a/libs/ui-toolkit/src/components/checkbox/checkbox.stories.tsx +++ b/libs/ui-toolkit/src/components/checkbox/checkbox.stories.tsx @@ -15,6 +15,13 @@ Default.args = { label: 'Regular checkbox', }; +export const Overflow = Template.bind({}); +Overflow.args = { + name: 'overflow', + label: + 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.', +}; + export const Disabled = Template.bind({}); Disabled.args = { disabled: true, diff --git a/libs/ui-toolkit/src/components/checkbox/checkbox.tsx b/libs/ui-toolkit/src/components/checkbox/checkbox.tsx index f22e99333..a5f13155c 100644 --- a/libs/ui-toolkit/src/components/checkbox/checkbox.tsx +++ b/libs/ui-toolkit/src/components/checkbox/checkbox.tsx @@ -20,7 +20,7 @@ export const Checkbox = ({ disabled = false, }: CheckboxProps) => { const rootClasses = classNames( - 'relative flex justify-center items-center w-[15px] h-[15px]', + 'relative flex justify-center items-center w-[15px] h-[15px] mt-1', 'border rounded-sm overflow-hidden', { 'opacity-40 cursor-default': disabled, @@ -30,7 +30,7 @@ export const Checkbox = ({ ); return ( -
+
'flex items-center w-full text-sm', 'p-2 border-2 rounded', 'bg-transparent', - 'border border-vega-light-200 dark:border-vega-dark-200', + 'border', 'focus:border-vega-light-300 dark:focus:border-vega-dark-300', 'disabled:opacity-60', { - 'border-vega-pink': hasError, + 'border-vega-pink text-vega-pink': hasError, + 'border-vega-light-200 dark:border-vega-dark-200': !hasError, } ); From 056d3215e8108662a1bd78517874e6a02f0b3ccf Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 17 Jul 2023 16:04:03 +0300 Subject: [PATCH 09/16] feat(trading): view iceberg orders (#4207) --- .../proposal/__generated__/Proposal.ts | 2 +- .../proposals/__generated__/Proposals.ts | 4 +-- .../src/integration/trading-portfolio.cy.ts | 2 +- .../src/integration/trading-trades.cy.ts | 2 +- .../src/lib/cells/order-type-cell.tsx | 6 +++++ .../src/lib/__generated__/MarketLiquidity.ts | 6 ++--- .../order-data-provider/Orders.graphql | 13 +++++++++- .../__generated__/Orders.ts | 22 +++++++++++----- .../order-data-provider.ts | 6 +++++ .../__generated__/OrdersSubscription.ts | 2 +- .../__generated__/Proposals.ts | 4 +-- .../proposals-hooks/__generated__/Proposal.ts | 4 +-- libs/types/src/__generated__/types.ts | 4 +++ libs/types/src/global-types-mappings.ts | 25 ++++++++++--------- .../src/__generated__/TransactionResult.ts | 5 ++-- yarn.lock | 13 +++------- 16 files changed, 77 insertions(+), 43 deletions(-) diff --git a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts index d0ceb66d0..2674364a2 100644 --- a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -294,4 +294,4 @@ export function useProposalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions

; export type ProposalLazyQueryHookResult = ReturnType; -export type ProposalQueryResult = Apollo.QueryResult; \ No newline at end of file +export type ProposalQueryResult = Apollo.QueryResult; diff --git a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts index 948495462..90f33b8bf 100644 --- a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts +++ b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts @@ -3,12 +3,12 @@ import * as Types from '@vegaprotocol/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: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } }; +export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } }; export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null }; +export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null }; export const ProposalFieldsFragmentDoc = gql` fragment ProposalFields on Proposal { diff --git a/apps/trading-e2e/src/integration/trading-portfolio.cy.ts b/apps/trading-e2e/src/integration/trading-portfolio.cy.ts index 7ac8c2c90..6a46f35c4 100644 --- a/apps/trading-e2e/src/integration/trading-portfolio.cy.ts +++ b/apps/trading-e2e/src/integration/trading-portfolio.cy.ts @@ -50,7 +50,7 @@ describe('Portfolio page', { tags: '@smoke' }, () => { cy.get('fieldset.ag-simple-filter-body-wrapper') .should('be.visible') .within((fields) => { - cy.wrap(fields).find('label').should('have.length', 16); + cy.wrap(fields).find('label').should('have.length', 17); }); cy.getByTestId('"Ledger entries"').click(); cy.get('fieldset.ag-simple-filter-body-wrapper').should('not.exist'); diff --git a/apps/trading-e2e/src/integration/trading-trades.cy.ts b/apps/trading-e2e/src/integration/trading-trades.cy.ts index 144ac28af..c9aa56d50 100644 --- a/apps/trading-e2e/src/integration/trading-trades.cy.ts +++ b/apps/trading-e2e/src/integration/trading-trades.cy.ts @@ -71,7 +71,7 @@ describe('trades', { tags: '@smoke' }, () => { }); }); - it('copy price to deal ticket form', () => { + it.skip('copy price to deal ticket form', () => { // 6005-THIS-007 cy.get(colIdPrice).last().should('be.visible').click(); cy.getByTestId('order-price').should('have.value', '171.16898'); diff --git a/libs/datagrid/src/lib/cells/order-type-cell.tsx b/libs/datagrid/src/lib/cells/order-type-cell.tsx index 72d155eec..47f462af4 100644 --- a/libs/datagrid/src/lib/cells/order-type-cell.tsx +++ b/libs/datagrid/src/lib/cells/order-type-cell.tsx @@ -23,6 +23,11 @@ export const OrderTypeCell = ({ return undefined; } if (!value) return '-'; + + if (order?.icebergOrder) { + return t('%s (Iceberg)', [Schema.OrderTypeMapping[value]]); + } + if (order?.peggedOrder) { const reference = Schema.PeggedReferenceMapping[order.peggedOrder?.reference]; @@ -34,6 +39,7 @@ export const OrderTypeCell = ({ ); return t('%s %s %s Peg limit', [reference, side, offset]); } + if (order?.liquidityProvision) { return t('Liquidity provision'); } diff --git a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts index 143a5badd..93b777618 100644 --- a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts +++ b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts @@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; -export type LiquidityProvisionFieldsFragment = { __typename?: 'LiquidityProvision', id?: string | null, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } }; +export type LiquidityProvisionFieldsFragment = { __typename?: 'LiquidityProvision', id: string, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } }; export type LiquidityProvisionsQueryVariables = Types.Exact<{ marketId: Types.Scalars['ID']; }>; -export type LiquidityProvisionsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', liquidityProvisionsConnection?: { __typename?: 'LiquidityProvisionsConnection', edges?: Array<{ __typename?: 'LiquidityProvisionsEdge', node: { __typename?: 'LiquidityProvision', id?: string | null, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } } } | null> | null } | null } | null }; +export type LiquidityProvisionsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', liquidityProvisionsConnection?: { __typename?: 'LiquidityProvisionsConnection', edges?: Array<{ __typename?: 'LiquidityProvisionsEdge', node: { __typename?: 'LiquidityProvision', id: string, createdAt: any, updatedAt?: any | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } } } | null> | null } | null } | null }; export type LiquidityProvisionsUpdateSubscriptionVariables = Types.Exact<{ partyId?: Types.InputMaybe; @@ -18,7 +18,7 @@ export type LiquidityProvisionsUpdateSubscriptionVariables = Types.Exact<{ }>; -export type LiquidityProvisionsUpdateSubscription = { __typename?: 'Subscription', liquidityProvisions?: Array<{ __typename?: 'LiquidityProvisionUpdate', id?: string | null, partyID: string, createdAt: any, updatedAt?: any | null, marketID: string, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus }> | null }; +export type LiquidityProvisionsUpdateSubscription = { __typename?: 'Subscription', liquidityProvisions?: Array<{ __typename?: 'LiquidityProvisionUpdate', id: string, partyID: string, createdAt: any, updatedAt?: any | null, marketID: string, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus }> | null }; export type LiquidityProviderFeeShareFieldsFragment = { __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }; diff --git a/libs/orders/src/lib/components/order-data-provider/Orders.graphql b/libs/orders/src/lib/components/order-data-provider/Orders.graphql index e20a69734..89d5611f1 100644 --- a/libs/orders/src/lib/components/order-data-provider/Orders.graphql +++ b/libs/orders/src/lib/components/order-data-provider/Orders.graphql @@ -24,6 +24,12 @@ fragment OrderFields on Order { reference offset } + icebergOrder { + __typename + peakSize + minimumVisibleSize + reservedRemaining + } } query OrderById($orderId: ID!) { @@ -66,7 +72,6 @@ fragment OrderUpdateFields on OrderUpdate { type side size - remaining status rejectionReason price @@ -81,6 +86,12 @@ fragment OrderUpdateFields on OrderUpdate { reference offset } + icebergOrder { + __typename + peakSize + minimumVisibleSize + reservedRemaining + } } subscription OrdersUpdate($partyId: ID!, $marketIds: [ID!]) { 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 4bd8fd010..290dbdbb6 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 @@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null }; +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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }; export type OrderByIdQueryVariables = Types.Exact<{ orderId: Types.Scalars['ID']; }>; -export type OrderByIdQuery = { __typename?: 'Query', orderByID: { __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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null } }; +export type OrderByIdQuery = { __typename?: 'Query', orderByID: { __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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null } }; export type OrdersQueryVariables = Types.Exact<{ partyId: Types.Scalars['ID']; @@ -20,9 +20,9 @@ export type OrdersQueryVariables = Types.Exact<{ }>; -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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null }; +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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null }; -export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, remaining: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null }; +export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }; export type OrdersUpdateSubscriptionVariables = Types.Exact<{ partyId: Types.Scalars['ID']; @@ -30,7 +30,7 @@ export type OrdersUpdateSubscriptionVariables = Types.Exact<{ }>; -export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: string, type?: Types.OrderType | null, side: Types.Side, size: string, remaining: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null }> | null }; +export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }> | null }; export const OrderFieldsFragmentDoc = gql` fragment OrderFields on Order { @@ -59,6 +59,12 @@ export const OrderFieldsFragmentDoc = gql` reference offset } + icebergOrder { + __typename + peakSize + minimumVisibleSize + reservedRemaining + } } `; export const OrderUpdateFieldsFragmentDoc = gql` @@ -68,7 +74,6 @@ export const OrderUpdateFieldsFragmentDoc = gql` type side size - remaining status rejectionReason price @@ -83,6 +88,11 @@ export const OrderUpdateFieldsFragmentDoc = gql` reference offset } + icebergOrder { + peakSize + minimumVisibleSize + reservedRemaining + } } `; export const OrderByIdDocument = gql` 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 cb907869d..846a6aef0 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 @@ -63,6 +63,12 @@ export const mapOrderUpdateToOrder = ( return { ...order, liquidityProvision: liquidityProvision, + icebergOrder: order.icebergOrder + ? { + __typename: 'IcebergOrder', + ...order.icebergOrder, + } + : undefined, market: { __typename: 'Market', id: marketId, diff --git a/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts b/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts index b5d7885c3..98caee3c5 100644 --- a/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts +++ b/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts @@ -56,4 +56,4 @@ export function useOrderSubSubscription(baseOptions: Apollo.SubscriptionHookOpti return Apollo.useSubscription(OrderSubDocument, options); } export type OrderSubSubscriptionHookResult = ReturnType; -export type OrderSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file +export type OrderSubSubscriptionResult = Apollo.SubscriptionResult; diff --git a/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts index d93e49d46..3a84e24f2 100644 --- a/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts +++ b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts @@ -13,7 +13,7 @@ export type UpdateAssetFieldsFragment = { __typename?: 'UpdateAsset', assetId: s export type UpdateNetworkParameterFielsFragment = { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } }; -export type ProposalListFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; +export type ProposalListFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; export type ProposalsListQueryVariables = Types.Exact<{ proposalType?: Types.InputMaybe; @@ -21,7 +21,7 @@ export type ProposalsListQueryVariables = Types.Exact<{ }>; -export type ProposalsListQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } } | null> | null } | null }; +export type ProposalsListQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'NewTransfer' } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } } | null> | null } | null }; export const NewMarketFieldsFragmentDoc = gql` fragment NewMarketFields on NewMarket { diff --git a/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts b/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts index 2c10bb94d..18413086c 100644 --- a/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts +++ b/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts @@ -13,12 +13,12 @@ export type ProposalEventSubscriptionVariables = Types.Exact<{ export type ProposalEventSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null } }; -export type UpdateNetworkParameterProposalFragment = { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; +export type UpdateNetworkParameterProposalFragment = { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; -export type OnUpdateNetworkParametersSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } }; +export type OnUpdateNetworkParametersSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } }; export type ProposalOfMarketQueryVariables = Types.Exact<{ marketId: Types.Scalars['ID']; diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts index 450f81545..0fa801619 100644 --- a/libs/types/src/__generated__/types.ts +++ b/libs/types/src/__generated__/types.ts @@ -92,6 +92,8 @@ export enum AccountType { ACCOUNT_TYPE_GLOBAL_INSURANCE = 'ACCOUNT_TYPE_GLOBAL_INSURANCE', /** GlobalReward - a global account for the reward pool */ ACCOUNT_TYPE_GLOBAL_REWARD = 'ACCOUNT_TYPE_GLOBAL_REWARD', + /** AccountTypeHolding - an account for holding funds covering for active unfilled orders */ + ACCOUNT_TYPE_HOLDING = 'ACCOUNT_TYPE_HOLDING', /** Insurance pool account - only for 'system' party */ ACCOUNT_TYPE_INSURANCE = 'ACCOUNT_TYPE_INSURANCE', /** @@ -3338,6 +3340,8 @@ export enum ProposalRejectionReason { 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', + /** Spot trading is disabled */ + PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED = 'PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED', /** 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 */ diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts index bcd4d441d..1c3187549 100644 --- a/libs/types/src/global-types-mappings.ts +++ b/libs/types/src/global-types-mappings.ts @@ -44,6 +44,7 @@ export const AccountTypeMapping: { ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS: 'Reward Market Proposers', ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: 'Reward Maker paid fees', ACCOUNT_TYPE_SETTLEMENT: 'Settlement', + ACCOUNT_TYPE_HOLDING: 'Holding', }; /** @@ -322,14 +323,14 @@ export const ProposalRejectionReasonMapping: { PROPOSAL_ERROR_ERC20_ADDRESS_ALREADY_IN_USE: 'ERC20 address already in use by an existing asset', PROPOSAL_ERROR_GOVERNANCE_CANCEL_TRANSFER_PROPOSAL_INVALID: - 'PROPOSAL_ERROR_GOVERNANCE_CANCEL_TRANSFER_PROPOSAL_INVALID', + 'Governance cancel transfer proposal invalid', PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_FAILED: - 'PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_FAILED', + 'Governance transfer proposal failed', PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_INVALID: - 'PROPOSAL_ERROR_GOVERNANCE_TRANSFER_PROPOSAL_INVALID', - PROPOSAL_ERROR_INVALID_SPOT: 'PROPOSAL_ERROR_INVALID_SPOT', - PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET: - 'PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET', + 'Governance transfer proposal invalid', + PROPOSAL_ERROR_INVALID_SPOT: 'Invalid spot', + PROPOSAL_ERROR_INVALID_SUCCESSOR_MARKET: 'Invalid successor market', + PROPOSAL_ERROR_SPOT_PRODUCT_DISABLED: 'Spot product disabled', }; /** @@ -428,9 +429,9 @@ export const TransferTypeMapping: TransferTypeMap = { TRANSFER_TYPE_TRANSFER_FUNDS_DISTRIBUTE: 'Transfer received', TRANSFER_TYPE_CLEAR_ACCOUNT: 'Market accounts cleared', TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE: 'Balances restored', - TRANSFER_TYPE_HOLDING_LOCK: 'TRANSFER_TYPE_HOLDING_LOCK', - TRANSFER_TYPE_HOLDING_RELEASE: 'TRANSFER_TYPE_HOLDING_RELEASE', - TRANSFER_TYPE_SPOT: 'TRANSFER_TYPE_SPOT', + TRANSFER_TYPE_HOLDING_LOCK: 'Holding locked', + TRANSFER_TYPE_HOLDING_RELEASE: 'Holding released', + TRANSFER_TYPE_SPOT: 'Spot', }; export const DescriptionTransferTypeMapping: TransferTypeMap = { @@ -458,9 +459,9 @@ export const DescriptionTransferTypeMapping: TransferTypeMap = { TRANSFER_TYPE_CLEAR_ACCOUNT: `Market-related accounts emptied, and balances moved, because the market has closed`, TRANSFER_TYPE_UNSPECIFIED: 'Default value, always invalid', TRANSFER_TYPE_CHECKPOINT_BALANCE_RESTORE: `Balances are being restored to the user's account following a checkpoint restart of the network`, - TRANSFER_TYPE_HOLDING_LOCK: '-', - TRANSFER_TYPE_HOLDING_RELEASE: '-', - TRANSFER_TYPE_SPOT: '-', + TRANSFER_TYPE_HOLDING_LOCK: 'Holdings locked', + TRANSFER_TYPE_HOLDING_RELEASE: 'Holdings released', + TRANSFER_TYPE_SPOT: 'Spot', }; type DispatchMetricLabel = { diff --git a/libs/wallet/src/__generated__/TransactionResult.ts b/libs/wallet/src/__generated__/TransactionResult.ts index 97d4b9449..32187ad9c 100644 --- a/libs/wallet/src/__generated__/TransactionResult.ts +++ b/libs/wallet/src/__generated__/TransactionResult.ts @@ -28,7 +28,7 @@ export type OrderTxUpdateSubscriptionVariables = Types.Exact<{ }>; -export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null }; +export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null }; export type DepositBusEventFieldsFragment = { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: any, creditedTimestamp?: any | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; @@ -88,6 +88,7 @@ export const OrderTxUpdateFieldsFragmentDoc = gql` expiresAt side marketId + remaining } `; export const DepositBusEventFieldsFragmentDoc = gql` @@ -237,4 +238,4 @@ export function useDepositBusEventSubscription(baseOptions: Apollo.SubscriptionH return Apollo.useSubscription(DepositBusEventDocument, options); } export type DepositBusEventSubscriptionHookResult = ReturnType; -export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file +export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult; diff --git a/yarn.lock b/yarn.lock index 3d23a565e..00d05f551 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11167,15 +11167,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001503: - version "1.0.30001508" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001508.tgz#4461bbc895c692a96da399639cc1e146e7302a33" - integrity sha512-sdQZOJdmt3GJs1UMNpCCCyeuS2IEGLXnHyAo9yIO5JJDjbjoVRij4M1qep6P6gFpptD1PqIYgzM+gwJbOi92mw== - -caniuse-lite@^1.0.30001400: - version "1.0.30001431" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001431.tgz#e7c59bd1bc518fae03a4656be442ce6c4887a795" - integrity sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001426, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001503: + version "1.0.30001512" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001512.tgz" + integrity sha512-2S9nK0G/mE+jasCUsMPlARhRCts1ebcp2Ji8Y8PWi4NDE1iRdLCnEPHkEfeBrGC45L4isBx5ur3IQ6yTE2mRZw== capital-case@^1.0.4: version "1.0.4" From 7c0a4f61e93bb9ba3fc83bd7142f2888e7c4e69c Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Mon, 17 Jul 2023 16:33:52 +0300 Subject: [PATCH 10/16] fix(trading): add internal termination oracle (#4208) --- .../lib/components/market-info/MarketInfo.graphql | 10 ++++++++++ .../market-info/__generated__/MarketInfo.ts | 14 ++++++++++++-- .../market-info/market-info-accordion.tsx | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/libs/markets/src/lib/components/market-info/MarketInfo.graphql b/libs/markets/src/lib/components/market-info/MarketInfo.graphql index 4b6c56fb2..aa04b051c 100644 --- a/libs/markets/src/lib/components/market-info/MarketInfo.graphql +++ b/libs/markets/src/lib/components/market-info/MarketInfo.graphql @@ -16,6 +16,16 @@ fragment DataSource on DataSourceDefinition { } } } + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } } } diff --git a/libs/markets/src/lib/components/market-info/__generated__/MarketInfo.ts b/libs/markets/src/lib/components/market-info/__generated__/MarketInfo.ts index 7f7b039c8..6da0c4ef6 100644 --- a/libs/markets/src/lib/components/market-info/__generated__/MarketInfo.ts +++ b/libs/markets/src/lib/components/market-info/__generated__/MarketInfo.ts @@ -3,14 +3,14 @@ import * as Types from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; -export type DataSourceFragment = { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } }; +export type DataSourceFragment = { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }; export type MarketInfoQueryVariables = Types.Exact<{ marketId: Types.Scalars['ID']; }>; -export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, lpPriceRange: string, parentMarketID?: string | null, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } } } | null> | null } | 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, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, 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, decimals: number }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal' } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: 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 } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null } } | null }; +export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, lpPriceRange: string, parentMarketID?: string | null, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open: any, close: any }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } } } | null> | null } | 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, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, 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, decimals: number }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: 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 } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null } } | null }; export const DataSourceFragmentDoc = gql` fragment DataSource on DataSourceDefinition { @@ -31,6 +31,16 @@ export const DataSourceFragmentDoc = gql` } } } + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } } } `; diff --git a/libs/markets/src/lib/components/market-info/market-info-accordion.tsx b/libs/markets/src/lib/components/market-info/market-info-accordion.tsx index da773ee9d..725902fdd 100644 --- a/libs/markets/src/lib/components/market-info/market-info-accordion.tsx +++ b/libs/markets/src/lib/components/market-info/market-info-accordion.tsx @@ -129,6 +129,7 @@ export const MarketInfoAccordion = ({ .filter((a) => a.type === Schema.AccountType.ACCOUNT_TYPE_INSURANCE) .map((a) => ( } @@ -203,6 +204,7 @@ export const MarketInfoAccordion = ({ {(market.priceMonitoringSettings?.parameters?.triggers || []).map( (_, triggerIndex) => ( Date: Mon, 17 Jul 2023 17:24:51 +0300 Subject: [PATCH 11/16] feat(trading): submit iceberg orders (#4230) --- .../proposal/__generated__/Proposal.ts | 4 +- .../src/integration/trading-portfolio.cy.ts | 2 +- .../deal-ticket/deal-ticket-size-iceberg.tsx | 195 ++++++++++++++++++ .../deal-ticket/deal-ticket.spec.tsx | 103 +++++++++ .../components/deal-ticket/deal-ticket.tsx | 62 ++++++ libs/deal-ticket/src/hooks/use-order-form.ts | 9 +- .../src/lib/__generated__/MarketLiquidity.ts | 2 +- .../__generated__/Orders.ts | 5 +- .../order-data-provider.ts | 1 - .../lib/components/order-list/order-list.tsx | 14 +- .../__generated__/OrdersSubscription.ts | 2 +- .../src/lib/order-hooks/use-order-store.ts | 6 + libs/types/src/__generated__/types.ts | 2 + libs/types/src/global-types-mappings.ts | 1 + .../src/components/form-group/form-group.tsx | 2 +- libs/utils/src/lib/format/range.ts | 2 +- .../src/__generated__/TransactionResult.ts | 5 +- libs/wallet/src/connectors/vega-connector.ts | 4 + libs/wallet/src/utils.ts | 7 + 19 files changed, 403 insertions(+), 25 deletions(-) create mode 100644 libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx diff --git a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts index 2674364a2..c734b6605 100644 --- a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -8,7 +8,7 @@ export type ProposalQueryVariables = Types.Exact<{ }>; -export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, positionDecimalPlaces: number, linearSlippageFactor: string, quadraticSlippageFactor: string, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename?: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | null } | { __typename?: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } | null }; +export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, positionDecimalPlaces: number, linearSlippageFactor: string, quadraticSlippageFactor: string, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } } } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename?: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | null } | { __typename?: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } | null }; export const ProposalDocument = gql` @@ -294,4 +294,4 @@ export function useProposalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions

; export type ProposalLazyQueryHookResult = ReturnType; -export type ProposalQueryResult = Apollo.QueryResult; +export type ProposalQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/trading-e2e/src/integration/trading-portfolio.cy.ts b/apps/trading-e2e/src/integration/trading-portfolio.cy.ts index 6a46f35c4..6fe9208c9 100644 --- a/apps/trading-e2e/src/integration/trading-portfolio.cy.ts +++ b/apps/trading-e2e/src/integration/trading-portfolio.cy.ts @@ -50,7 +50,7 @@ describe('Portfolio page', { tags: '@smoke' }, () => { cy.get('fieldset.ag-simple-filter-body-wrapper') .should('be.visible') .within((fields) => { - cy.wrap(fields).find('label').should('have.length', 17); + cy.wrap(fields).find('label').should('have.length', 18); }); cy.getByTestId('"Ledger entries"').click(); cy.get('fieldset.ag-simple-filter-body-wrapper').should('not.exist'); diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx new file mode 100644 index 000000000..a271eb105 --- /dev/null +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-size-iceberg.tsx @@ -0,0 +1,195 @@ +import { Controller, type Control } from 'react-hook-form'; +import type { Market } from '@vegaprotocol/markets'; +import type { OrderObj } from '@vegaprotocol/orders'; +import type { OrderFormFields } from '../../hooks/use-order-form'; +import { toDecimal, validateAmount } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { + FormGroup, + Input, + InputError, + Tooltip, +} from '@vegaprotocol/ui-toolkit'; + +export interface DealTicketSizeIcebergProps { + control: Control; + market: Market; + peakSizeError?: string; + minimumVisibleSizeError?: string; + update: (obj: Partial) => void; + peakSize: string; + minimumVisibleSize: string; + size: string; +} + +export const DealTicketSizeIceberg = ({ + control, + market, + update, + peakSizeError, + minimumVisibleSizeError, + peakSize, + minimumVisibleSize, + size, +}: DealTicketSizeIcebergProps) => { + const sizeStep = toDecimal(market?.positionDecimalPlaces); + + const renderPeakSizeError = () => { + if (peakSizeError) { + return ( + + {peakSizeError} + + ); + } + + return null; + }; + + const renderMinimumSizeError = () => { + if (minimumVisibleSizeError) { + return ( + + {minimumVisibleSizeError} + + ); + } + + return null; + }; + + return ( +

+
+
+ + {t( + 'The maximum volume that can be traded at once. Must be less than the total size of the order.' + )} +
+ } + > + {t('Peak size')} + + } + labelFor="input-order-peak-size" + className="!mb-1" + > + ( + + update({ + icebergOpts: { + peakSize: e.target.value, + minimumVisibleSize, + }, + }) + } + step={sizeStep} + min={sizeStep} + max={size} + data-testid="order-peak-size" + onWheel={(e) => e.currentTarget.blur()} + /> + )} + /> + +
+
+
+
+
+
+ + {t( + 'When the order trades and its size falls below this threshold, it will be reset to the peak size and moved to the back of the priority order. Must be less than or equal to peak size, and greater than 0.' + )} +
+ } + > + {t('Minimum size')} + + } + labelFor="input-order-minimum-size" + className="!mb-1" + > + ( + + update({ + icebergOpts: { + peakSize, + minimumVisibleSize: e.target.value, + }, + }) + } + step={sizeStep} + min={sizeStep} + max={peakSize} + data-testid="order-minimum-size" + onWheel={(e) => e.currentTarget.blur()} + /> + )} + /> + +
+
+ {renderPeakSizeError()} + {renderMinimumSizeError()} +
+ ); +}; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx index 0c91e4592..3afdd2385 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx @@ -224,6 +224,109 @@ describe('DealTicket', () => { expect(screen.getByTestId('reduce-only')).not.toBeChecked(); }); + it('should set values for a persistent post only iceberg order and disable reduce only checkbox', () => { + const expectedOrder = { + marketId: market.id, + type: Schema.OrderType.TYPE_LIMIT, + side: Schema.Side.SIDE_SELL, + size: '10', + price: '300.22', + timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_GTC, + persist: true, + reduceOnly: false, + postOnly: true, + iceberg: true, + icebergOpts: { + peakSize: '5', + minimumVisibleSize: '7', + }, + }; + + useOrderStore.setState({ + orders: { + [expectedOrder.marketId]: expectedOrder, + }, + }); + + render(generateJsx()); + + // Assert correct defaults are used from store + expect( + screen + .getByTestId(`order-type-${Schema.OrderType.TYPE_LIMIT}`) + .querySelector('input') + ).toBeChecked(); + expect( + screen.queryByTestId('order-side-SIDE_SELL')?.querySelector('input') + ).toBeChecked(); + expect( + screen.queryByTestId('order-side-SIDE_BUY')?.querySelector('input') + ).not.toBeChecked(); + expect(screen.getByTestId('order-size')).toHaveDisplayValue( + expectedOrder.size + ); + expect(screen.getByTestId('order-tif')).toHaveValue( + expectedOrder.timeInForce + ); + expect(screen.getByTestId('order-price')).toHaveDisplayValue( + expectedOrder.price + ); + expect(screen.getByTestId('post-only')).toBeEnabled(); + expect(screen.getByTestId('reduce-only')).toBeDisabled(); + expect(screen.getByTestId('post-only')).toBeChecked(); + expect(screen.getByTestId('reduce-only')).not.toBeChecked(); + expect(screen.getByTestId('iceberg')).toBeEnabled(); + expect(screen.getByTestId('iceberg')).toBeChecked(); + }); + + it('should set values for a non-persistent iceberg order and disable post only checkbox', () => { + const expectedOrder = { + marketId: market.id, + type: Schema.OrderType.TYPE_LIMIT, + side: Schema.Side.SIDE_SELL, + size: '0.1', + price: '300.22', + timeInForce: Schema.OrderTimeInForce.TIME_IN_FORCE_IOC, + persist: false, + reduceOnly: false, + postOnly: false, + }; + useOrderStore.setState({ + orders: { + [expectedOrder.marketId]: expectedOrder, + }, + }); + + render(generateJsx()); + + // Assert correct defaults are used from store + expect( + screen + .getByTestId(`order-type-${Schema.OrderType.TYPE_LIMIT}`) + .querySelector('input') + ).toBeChecked(); + expect( + screen.queryByTestId('order-side-SIDE_SELL')?.querySelector('input') + ).toBeChecked(); + expect( + screen.queryByTestId('order-side-SIDE_BUY')?.querySelector('input') + ).not.toBeChecked(); + expect(screen.getByTestId('order-size')).toHaveDisplayValue( + expectedOrder.size + ); + expect(screen.getByTestId('order-tif')).toHaveValue( + expectedOrder.timeInForce + ); + expect(screen.getByTestId('order-price')).toHaveDisplayValue( + expectedOrder.price + ); + expect(screen.getByTestId('post-only')).toBeDisabled(); + expect(screen.getByTestId('reduce-only')).toBeEnabled(); + expect(screen.getByTestId('reduce-only')).not.toBeChecked(); + expect(screen.getByTestId('post-only')).not.toBeChecked(); + expect(screen.getByTestId('iceberg')).not.toBeChecked(); + }); + it('handles TIF select box dependent on order type', async () => { render(generateJsx()); 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 708b11ed6..e8310c260 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -54,6 +54,7 @@ import { import { OrderTimeInForce, OrderType } from '@vegaprotocol/types'; import { useOrderForm } from '../../hooks/use-order-form'; import { useDataProvider } from '@vegaprotocol/data-provider'; +import { DealTicketSizeIceberg } from './deal-ticket-size-iceberg'; export interface DealTicketProps { market: Market; @@ -292,6 +293,22 @@ export const DealTicket = ({ timeInForce: lastTIF[type] || order.timeInForce, postOnly: type === OrderType.TYPE_MARKET ? false : order.postOnly, + iceberg: + type === OrderType.TYPE_MARKET || + [ + OrderTimeInForce.TIME_IN_FORCE_FOK, + OrderTimeInForce.TIME_IN_FORCE_IOC, + ].includes(lastTIF[type] || order.timeInForce) + ? false + : order.iceberg, + icebergOpts: + type === OrderType.TYPE_MARKET || + [ + OrderTimeInForce.TIME_IN_FORCE_FOK, + OrderTimeInForce.TIME_IN_FORCE_IOC, + ].includes(lastTIF[type] || order.timeInForce) + ? undefined + : order.icebergOpts, reduceOnly: type === OrderType.TYPE_LIMIT && ![ @@ -463,6 +480,51 @@ export const DealTicket = ({ )} /> +
+ {order.type === Schema.OrderType.TYPE_LIMIT && ( + ( + { + update({ iceberg: !order.iceberg, icebergOpts: undefined }); + }} + label={ + + {t(`Trade only a fraction of the order size at once. + After the peak size of the order has traded, the size is reset. This is repeated until the order is cancelled, expires, or its full volume trades away. + For example, an iceberg order with a size of 1000 and a peak size of 100 will effectively be split into 10 orders with a size of 100 each. + Note that the full volume of the order is not hidden and is still reflected in the order book.`)} +

+ } + > + {t('Iceberg')} +
+ } + /> + )} + /> + )} +
+ {order.iceberg && ( + + )} { } }, [order, isSubmitted, getValues, setValue]); - const handleSubmitWrapper = ( - cb: (o: Exact) => void - ) => { + const handleSubmitWrapper = (cb: (o: OrderSubmission) => void) => { return handleSubmit(() => { - // remove the persist key from the order in the store, the wallet will reject + // remove the persist and iceberg key from the order in the store, the wallet will reject // an order that contains unrecognized additional keys - cb(omit(order, 'persist')); + cb(omit(order, 'persist', 'iceberg')); }); }; diff --git a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts index 93b777618..efc57fba3 100644 --- a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts +++ b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts @@ -180,4 +180,4 @@ export function useLiquidityProviderFeeShareLazyQuery(baseOptions?: Apollo.LazyQ } export type LiquidityProviderFeeShareQueryHookResult = ReturnType; export type LiquidityProviderFeeShareLazyQueryHookResult = ReturnType; -export type LiquidityProviderFeeShareQueryResult = Apollo.QueryResult; +export type LiquidityProviderFeeShareQueryResult = Apollo.QueryResult; \ No newline at end of file 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 290dbdbb6..4c3071990 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 @@ -22,7 +22,7 @@ export type OrdersQueryVariables = Types.Exact<{ 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?: any | null, createdAt: any, updatedAt?: any | null, postOnly?: boolean | null, reduceOnly?: boolean | null, market: { __typename?: 'Market', id: string }, liquidityProvision?: { __typename: 'LiquidityProvision' } | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null } }> | null, pageInfo?: { __typename?: 'PageInfo', startCursor: string, endCursor: string, hasNextPage: boolean, hasPreviousPage: boolean } | null } | null } | null }; -export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }; +export type OrderUpdateFieldsFragment = { __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }; export type OrdersUpdateSubscriptionVariables = Types.Exact<{ partyId: Types.Scalars['ID']; @@ -30,7 +30,7 @@ export type OrdersUpdateSubscriptionVariables = Types.Exact<{ }>; -export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename?: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }> | null }; +export type OrdersUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', id: string, marketId: 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?: any | null, createdAt: any, updatedAt?: any | null, liquidityProvisionId?: string | null, peggedOrder?: { __typename: 'PeggedOrder', reference: Types.PeggedReference, offset: string } | null, icebergOrder?: { __typename: 'IcebergOrder', peakSize: string, minimumVisibleSize: string, reservedRemaining: string } | null }> | null }; export const OrderFieldsFragmentDoc = gql` fragment OrderFields on Order { @@ -89,6 +89,7 @@ export const OrderUpdateFieldsFragmentDoc = gql` offset } icebergOrder { + __typename peakSize minimumVisibleSize reservedRemaining 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 846a6aef0..d5f68bdb1 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 @@ -65,7 +65,6 @@ export const mapOrderUpdateToOrder = ( liquidityProvision: liquidityProvision, icebergOrder: order.icebergOrder ? { - __typename: 'IcebergOrder', ...order.icebergOrder, } : undefined, 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 b92bee2d0..4e221537b 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -267,12 +267,14 @@ export const OrderListTable = memo<
{isOrderAmendable(data) && !props.isReadOnly && ( <> - onEdit(data)} - > - {t('Edit')} - + {!data.icebergOrder && ( + onEdit(data)} + > + {t('Edit')} + + )} onCancel(data)} diff --git a/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts b/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts index 98caee3c5..b5d7885c3 100644 --- a/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts +++ b/libs/orders/src/lib/order-hooks/__generated__/OrdersSubscription.ts @@ -56,4 +56,4 @@ export function useOrderSubSubscription(baseOptions: Apollo.SubscriptionHookOpti return Apollo.useSubscription(OrderSubDocument, options); } export type OrderSubSubscriptionHookResult = ReturnType; -export type OrderSubSubscriptionResult = Apollo.SubscriptionResult; +export type OrderSubSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/orders/src/lib/order-hooks/use-order-store.ts b/libs/orders/src/lib/order-hooks/use-order-store.ts index 7f5a20d01..dd8ffaba8 100644 --- a/libs/orders/src/lib/order-hooks/use-order-store.ts +++ b/libs/orders/src/lib/order-hooks/use-order-store.ts @@ -16,7 +16,13 @@ export type OrderObj = { persist: boolean; // key used to determine if order should be kept in localStorage postOnly?: boolean; reduceOnly?: boolean; + iceberg?: boolean; + icebergOpts?: { + peakSize: string; + minimumVisibleSize: string; + }; }; + type OrderMap = { [marketId: string]: OrderObj | undefined }; type UpdateOrder = ( diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts index 0fa801619..18605c0bd 100644 --- a/libs/types/src/__generated__/types.ts +++ b/libs/types/src/__generated__/types.ts @@ -96,6 +96,8 @@ export enum AccountType { ACCOUNT_TYPE_HOLDING = 'ACCOUNT_TYPE_HOLDING', /** Insurance pool account - only for 'system' party */ ACCOUNT_TYPE_INSURANCE = 'ACCOUNT_TYPE_INSURANCE', + /** Per liquidity provider, per market account for holding LPs' fees before distribution */ + ACCOUNT_TYPE_LP_LIQUIDITY_FEES = 'ACCOUNT_TYPE_LP_LIQUIDITY_FEES', /** * 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. diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts index 1c3187549..78c033d34 100644 --- a/libs/types/src/global-types-mappings.ts +++ b/libs/types/src/global-types-mappings.ts @@ -45,6 +45,7 @@ export const AccountTypeMapping: { ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: 'Reward Maker paid fees', ACCOUNT_TYPE_SETTLEMENT: 'Settlement', ACCOUNT_TYPE_HOLDING: 'Holding', + ACCOUNT_TYPE_LP_LIQUIDITY_FEES: 'LP Liquidity Fees', }; /** diff --git a/libs/ui-toolkit/src/components/form-group/form-group.tsx b/libs/ui-toolkit/src/components/form-group/form-group.tsx index 91f9d6389..b8864fe01 100644 --- a/libs/ui-toolkit/src/components/form-group/form-group.tsx +++ b/libs/ui-toolkit/src/components/form-group/form-group.tsx @@ -4,7 +4,7 @@ import type { ReactNode } from 'react'; export interface FormGroupProps { children: ReactNode; className?: string; - label: string; // For accessibility reasons this must always be set for screen readers. If you want it to not show, then use the hideLabel prop" + label: string | ReactNode; // For accessibility reasons this must always be set for screen readers. If you want it to not show, then use the hideLabel prop" labelFor: string; // Same as above hideLabel?: boolean; labelDescription?: string; diff --git a/libs/utils/src/lib/format/range.ts b/libs/utils/src/lib/format/range.ts index d5f466aef..f0e033081 100644 --- a/libs/utils/src/lib/format/range.ts +++ b/libs/utils/src/lib/format/range.ts @@ -7,7 +7,7 @@ import { export const formatValue = ( value: string | number | null | undefined, decimalPlaces: number, - quantum?: string, + quantum?: string | number, formatDecimals?: number, emptyValue = '-' ): string => { diff --git a/libs/wallet/src/__generated__/TransactionResult.ts b/libs/wallet/src/__generated__/TransactionResult.ts index 32187ad9c..97d4b9449 100644 --- a/libs/wallet/src/__generated__/TransactionResult.ts +++ b/libs/wallet/src/__generated__/TransactionResult.ts @@ -28,7 +28,7 @@ export type OrderTxUpdateSubscriptionVariables = Types.Exact<{ }>; -export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null }; +export type OrderTxUpdateSubscription = { __typename?: 'Subscription', orders?: Array<{ __typename?: 'OrderUpdate', type?: Types.OrderType | null, id: string, status: Types.OrderStatus, rejectionReason?: Types.OrderRejectionReason | null, createdAt: any, size: string, price: string, timeInForce: Types.OrderTimeInForce, expiresAt?: any | null, side: Types.Side, marketId: string }> | null }; export type DepositBusEventFieldsFragment = { __typename?: 'Deposit', id: string, status: Types.DepositStatus, amount: string, createdTimestamp: any, creditedTimestamp?: any | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } }; @@ -88,7 +88,6 @@ export const OrderTxUpdateFieldsFragmentDoc = gql` expiresAt side marketId - remaining } `; export const DepositBusEventFieldsFragmentDoc = gql` @@ -238,4 +237,4 @@ export function useDepositBusEventSubscription(baseOptions: Apollo.SubscriptionH return Apollo.useSubscription(DepositBusEventDocument, options); } export type DepositBusEventSubscriptionHookResult = ReturnType; -export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult; +export type DepositBusEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/wallet/src/connectors/vega-connector.ts b/libs/wallet/src/connectors/vega-connector.ts index 87e34babb..2d8978cd8 100644 --- a/libs/wallet/src/connectors/vega-connector.ts +++ b/libs/wallet/src/connectors/vega-connector.ts @@ -47,6 +47,10 @@ export interface OrderSubmission { expiresAt?: string; postOnly?: boolean; reduceOnly?: boolean; + icebergOpts?: { + peakSize: string; + minimumVisibleSize: string; + }; } export interface OrderCancellation { diff --git a/libs/wallet/src/utils.ts b/libs/wallet/src/utils.ts index 292a211c1..034741606 100644 --- a/libs/wallet/src/utils.ts +++ b/libs/wallet/src/utils.ts @@ -50,6 +50,13 @@ export const normalizeOrderSubmission = ( : undefined, postOnly: order.postOnly, reduceOnly: order.reduceOnly, + icebergOpts: order.icebergOpts && { + peakSize: removeDecimal(order.icebergOpts.peakSize, positionDecimalPlaces), + minimumVisibleSize: removeDecimal( + order.icebergOpts.minimumVisibleSize, + positionDecimalPlaces + ), + }, }); export const normalizeOrderAmendment = >( From 05ca1a09b9ff51e9ea45b82a6a45768aeb6167ff Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 18 Jul 2023 11:03:48 +0200 Subject: [PATCH 12/16] chore(explorer): align staking terminology (#4290) --- .../app/routes/parties/id/components/party-block-stake.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/explorer/src/app/routes/parties/id/components/party-block-stake.tsx b/apps/explorer/src/app/routes/parties/id/components/party-block-stake.tsx index 1b0638c75..831c15ccc 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-block-stake.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-block-stake.tsx @@ -54,7 +54,7 @@ export const PartyBlockStake = ({ {p?.stakingSummary.currentStakeAvailable ? ( -
{t('Available stake')}
+
{t('Associated to key')}
-
{t('Active stake')}
+
{t('Staked to validator')}
From 53048ac8efa678e06f31b1ea508b5168e6a9d4d9 Mon Sep 17 00:00:00 2001 From: Maciek Date: Tue, 18 Jul 2023 11:37:25 +0200 Subject: [PATCH 13/16] chore(trading): 4134 see if a closed market was succeeded (#4336) --- .../src/integration/closed-markets.cy.ts | 4 + .../client-pages/markets/closed.spec.tsx | 126 +++++++++++++++--- apps/trading/client-pages/markets/closed.tsx | 39 +++++- libs/markets/src/lib/markets.mock.ts | 1 + 4 files changed, 147 insertions(+), 23 deletions(-) diff --git a/apps/trading-e2e/src/integration/closed-markets.cy.ts b/apps/trading-e2e/src/integration/closed-markets.cy.ts index 2778d1845..e0c870671 100644 --- a/apps/trading-e2e/src/integration/closed-markets.cy.ts +++ b/apps/trading-e2e/src/integration/closed-markets.cy.ts @@ -369,6 +369,10 @@ describe('Closed markets', { tags: '@smoke' }, () => { .first() .find('button svg') .should('exist'); + cy.get(rowSelector) + .find('[col-id="successorMarketID"]') + .first() + .should('have.text', ' - '); }); // test market list for market in terminated state diff --git a/apps/trading/client-pages/markets/closed.spec.tsx b/apps/trading/client-pages/markets/closed.spec.tsx index e1b7c87ac..b96a1c3d6 100644 --- a/apps/trading/client-pages/markets/closed.spec.tsx +++ b/apps/trading/client-pages/markets/closed.spec.tsx @@ -1,4 +1,5 @@ -import { act, render, screen, within } from '@testing-library/react'; +import { act, render, screen, within, waitFor } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; import { Closed } from './closed'; import { MarketStateMapping, PropertyKeyType } from '@vegaprotocol/types'; import { PositionStatus } from '@vegaprotocol/types'; @@ -211,15 +212,22 @@ describe('Closed', () => { it('renders correctly formatted and filtered rows', async () => { await act(async () => { render( - - + - - - + + + + + ); }); // screen.debug(document, Infinity); @@ -230,6 +238,7 @@ describe('Closed', () => { 'Description', 'Status', 'Settlement date', + 'Successor market', 'Best bid', 'Best offer', 'Mark price', @@ -247,6 +256,7 @@ describe('Closed', () => { market.tradableInstrument.instrument.name, MarketStateMapping[market.state], '3 days ago', + '-', /* eslint-disable @typescript-eslint/no-non-null-assertion */ addDecimalsFormatNumber(marketsData.bestBidPrice, market.decimalPlaces), addDecimalsFormatNumber( @@ -315,20 +325,22 @@ describe('Closed', () => { }; await act(async () => { render( - - + - - - + + + + + ); }); @@ -359,4 +371,74 @@ describe('Closed', () => { }); expect(cells).toEqual(expectedRows.map((m) => m.node.id)); }); + + it('successor marked should be visible', async () => { + const mixedMarkets = [ + { + __typename: 'MarketEdge' as const, + node: createMarketFragment({ + id: 'include-0', + state: MarketState.STATE_SETTLED, + successorMarketID: 'successorMarketID', + }), + }, + { + __typename: 'MarketEdge' as const, + node: { + ...createMarketFragment({ + id: 'successorMarketID', + state: MarketState.STATE_ACTIVE, + }), + tradableInstrument: { + ...createMarketFragment().tradableInstrument, + instrument: { + ...createMarketFragment().tradableInstrument.instrument, + id: 'successorAssset', + name: 'Successor Market Name', + code: 'SuccessorCode', + }, + }, + }, + }, + ]; + + const mixedMarketsMock: MockedResponse = { + request: { + query: MarketsDocument, + }, + result: { + data: { + marketsConnection: { + __typename: 'MarketConnection', + edges: mixedMarkets, + }, + }, + }, + }; + + render( + + + + + + + + ); + + await waitFor(() => { + expect( + screen.getByRole('button', { name: 'SuccessorCode' }) + ).toBeInTheDocument(); + }); + }); }); diff --git a/apps/trading/client-pages/markets/closed.tsx b/apps/trading/client-pages/markets/closed.tsx index 8c0083046..5cf5c81e7 100644 --- a/apps/trading/client-pages/markets/closed.tsx +++ b/apps/trading/client-pages/markets/closed.tsx @@ -4,7 +4,11 @@ import type { VegaICellRendererParams, VegaValueFormatterParams, } from '@vegaprotocol/datagrid'; -import { AgGridLazy as AgGrid, COL_DEFS } from '@vegaprotocol/datagrid'; +import { + AgGridLazy as AgGrid, + COL_DEFS, + MarketNameCell, +} from '@vegaprotocol/datagrid'; import { useMemo } from 'react'; import { t } from '@vegaprotocol/i18n'; import { MarketState, MarketStateMapping } from '@vegaprotocol/types'; @@ -20,6 +24,7 @@ import type { import { MarketActionsDropdown, closedMarketsWithDataProvider, + marketProvider, } from '@vegaprotocol/markets'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; @@ -27,6 +32,7 @@ import type { ColDef } from 'ag-grid-community'; import { SettlementDateCell } from './settlement-date-cell'; import { SettlementPriceCell } from './settlement-price-cell'; import { useDataProvider } from '@vegaprotocol/data-provider'; +import { useMarketClickHandler } from '../../lib/hooks/use-market-click-handler'; type SettlementAsset = MarketMaybeWithData['tradableInstrument']['instrument']['product']['settlementAsset']; @@ -48,6 +54,7 @@ interface Row { tradingTerminationOracleId: string; settlementAsset: SettlementAsset; realisedPNL: string | undefined; + successorMarketID: string | undefined | null; } export const Closed = () => { @@ -109,6 +116,7 @@ export const Closed = () => { instrument.product.dataSourceSpecForTradingTermination.id, settlementAsset: instrument.product.settlementAsset, realisedPNL: position?.node.realisedPNL, + successorMarketID: market.successorMarketID, }; return row; @@ -120,6 +128,28 @@ export const Closed = () => { ); }; +export const SuccessorMarketRenderer = ({ + value, +}: VegaICellRendererParams) => { + const { data } = useDataProvider({ + dataProvider: marketProvider, + variables: { + marketId: value || '', + }, + skip: !value, + }); + const onMarketClick = useMarketClickHandler(); + return data ? ( + + ) : ( + ' - ' + ); +}; + const ClosedMarketsDataGrid = ({ rowData, error, @@ -199,6 +229,11 @@ const ClosedMarketsDataGrid = ({ }, }, }, + { + headerName: t('Successor market'), + field: 'successorMarketID', + cellRenderer: 'SuccessorMarketRenderer', + }, { headerName: t('Best bid'), field: 'bestBidPrice', @@ -311,7 +346,9 @@ const ClosedMarketsDataGrid = ({ defaultColDef={{ resizable: true, minWidth: 100, + flex: 1, }} + components={{ SuccessorMarketRenderer }} overlayNoRowsTemplate={error ? error.message : t('No markets')} /> ); diff --git a/libs/markets/src/lib/markets.mock.ts b/libs/markets/src/lib/markets.mock.ts index 44ff183fe..fd2e8bb96 100644 --- a/libs/markets/src/lib/markets.mock.ts +++ b/libs/markets/src/lib/markets.mock.ts @@ -141,6 +141,7 @@ export const createMarketFragment = ( }, __typename: 'TradableInstrument', }, + successorMarketID: null, __typename: 'Market', }; From 737ffb4c35985ac030550e567f927f714a05a33e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20G=C5=82ownia?= Date: Tue, 18 Jul 2023 13:16:07 +0200 Subject: [PATCH 14/16] feat(trading): copy order book volume value to deal ticket (#4333) --- .../src/integration/order-book.cy.ts | 13 +++++++ .../src/lib/orderbook-manager.tsx | 5 ++- libs/market-depth/src/lib/orderbook-row.tsx | 34 ++++++++++++++++--- libs/market-depth/src/lib/orderbook.spec.tsx | 4 +-- libs/market-depth/src/lib/orderbook.tsx | 4 +-- 5 files changed, 51 insertions(+), 9 deletions(-) diff --git a/apps/trading-e2e/src/integration/order-book.cy.ts b/apps/trading-e2e/src/integration/order-book.cy.ts index 02c0b735d..776a003ea 100644 --- a/apps/trading-e2e/src/integration/order-book.cy.ts +++ b/apps/trading-e2e/src/integration/order-book.cy.ts @@ -9,6 +9,7 @@ const bidCumulative = 'cumulative-vol-9889001'; const midPrice = 'middle-mark-price-4612690000'; const priceResolution = 'resolution'; const dealTicketPrice = 'order-price'; +const dealTicketSize = 'order-size'; const resPrice = 'price-990'; describe('order book', { tags: '@smoke' }, () => { @@ -74,6 +75,18 @@ describe('order book', { tags: '@smoke' }, () => { cy.getByTestId(dealTicketPrice).should('have.value', '98.94585'); }); + it('copy size to deal ticket form', () => { + // 6003-ORDB-009 + cy.getByTestId(bidCumulative).click(); + cy.getByTestId(dealTicketSize).should('have.value', '7'); + }); + + it('copy size to deal ticket form', () => { + // 6003-ORDB-009 + cy.getByTestId(bidVolume).click(); + cy.getByTestId(dealTicketSize).should('have.value', '1'); + }); + it('change price resolution', () => { // 6003-ORDB-008 const resolutions = [ diff --git a/libs/market-depth/src/lib/orderbook-manager.tsx b/libs/market-depth/src/lib/orderbook-manager.tsx index 78281a21c..4a432e8e4 100644 --- a/libs/market-depth/src/lib/orderbook-manager.tsx +++ b/libs/market-depth/src/lib/orderbook-manager.tsx @@ -66,10 +66,13 @@ export const OrderbookManager = ({ marketId }: OrderbookManagerProps) => { decimalPlaces={market?.decimalPlaces ?? 0} positionDecimalPlaces={market?.positionDecimalPlaces ?? 0} assetSymbol={market?.tradableInstrument.instrument.product.quoteName} - onClick={(price: string) => { + onClick={({ price, size }) => { if (price) { updateOrder(marketId, { price }); } + if (size) { + updateOrder(marketId, { size }); + } }} midPrice={marketData?.midPrice} /> diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx index 0cd191717..2f57c6f18 100644 --- a/libs/market-depth/src/lib/orderbook-row.tsx +++ b/libs/market-depth/src/lib/orderbook-row.tsx @@ -11,7 +11,7 @@ interface OrderbookRowProps { decimalPlaces: number; positionDecimalPlaces: number; price: string; - onClick?: (price: string) => void; + onClick?: (args: { price?: string; size?: string }) => void; type: VolumeType; } @@ -43,6 +43,7 @@ const CumulativeVol = memo( testId, positionDecimalPlaces, cumulativeValue, + onClick, }: { ask?: number; bid?: number; @@ -50,6 +51,7 @@ const CumulativeVol = memo( testId?: string; className?: string; positionDecimalPlaces: number; + onClick?: (size?: string | number) => void; }) => { const volume = cumulativeValue ? ( ) : null; - return ( + return onClick && volume ? ( + + ) : (
{volume}
@@ -89,7 +99,9 @@ export const OrderbookRow = React.memo( onClick && onClick(addDecimal(price, decimalPlaces))} + onClick={() => + onClick && onClick({ price: addDecimal(price, decimalPlaces) }) + } valueFormatted={addDecimalsFixedFormatNumber(price, decimalPlaces)} className={ type === VolumeType.ask @@ -97,8 +109,15 @@ export const OrderbookRow = React.memo( : 'text-market-green-600 dark:text-market-green' } /> - + onClick && + value && + onClick({ + size: addDecimal(value, positionDecimalPlaces), + }) + } value={value} valueFormatted={addDecimalsFixedFormatNumber( value, @@ -107,6 +126,13 @@ export const OrderbookRow = React.memo( /> + onClick && + cumulativeValue && + onClick({ + size: addDecimal(cumulativeValue, positionDecimalPlaces), + }) + } positionDecimalPlaces={positionDecimalPlaces} cumulativeValue={cumulativeValue} /> diff --git a/libs/market-depth/src/lib/orderbook.spec.tsx b/libs/market-depth/src/lib/orderbook.spec.tsx index e609b860a..3fb05bcb8 100644 --- a/libs/market-depth/src/lib/orderbook.spec.tsx +++ b/libs/market-depth/src/lib/orderbook.spec.tsx @@ -70,7 +70,7 @@ describe('Orderbook', () => { ).toBeInTheDocument(); // Before resolution change the price is 122.934 await fireEvent.click(await screen.getByTestId('price-122901')); - expect(onClickSpy).toBeCalledWith('122.901'); + expect(onClickSpy).toBeCalledWith({ price: '122.901' }); const resolutionSelect = screen.getByTestId( 'resolution' ) as HTMLSelectElement; @@ -86,6 +86,6 @@ describe('Orderbook', () => { 10 ); await fireEvent.click(await screen.getByTestId('price-12294')); - expect(onClickSpy).toBeCalledWith('122.94'); + expect(onClickSpy).toBeCalledWith({ price: '122.94' }); }); }); diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index 479f9e25e..90865bf7b 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -32,7 +32,7 @@ const OrderbookTable = ({ decimalPlaces: number; positionDecimalPlaces: number; type: VolumeType; - onClick?: (price: string) => void; + onClick?: (args: { price?: string; size?: string }) => void; }) => { return (
void; + onClick?: (args: { price?: string; size?: string }) => void; midPrice?: string; bids: PriceLevelFieldsFragment[]; asks: PriceLevelFieldsFragment[]; From d0e64364e33e6c0692e6cc49139e5a031681cc76 Mon Sep 17 00:00:00 2001 From: Gordsport <83510148+gordsport@users.noreply.github.com> Date: Tue, 18 Jul 2023 12:16:57 +0100 Subject: [PATCH 15/16] chore: update the PM action secret token (#4325) --- .github/workflows/add_issue_new_projects.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/add_issue_new_projects.yml b/.github/workflows/add_issue_new_projects.yml index 372656ad8..bbf2e6b11 100644 --- a/.github/workflows/add_issue_new_projects.yml +++ b/.github/workflows/add_issue_new_projects.yml @@ -6,7 +6,7 @@ name: 'Add Issues To Project Board' types: - opened env: - GH_TOKEN: ${{ secrets.GH_NEW_CARD_TO_PROJECT }} + GH_TOKEN: ${{ secrets.PROJECT_MANAGE_ACTION }} PROJECT_ID: ${{ secrets.FRONT_END_PROJECT_ID }} ISSUE_ID: ${{ github.event.issue.node_id }} USER: ${{ github.actor }} From ce6873fe54c9f0118e56b7d5d61cbc426c41f0c1 Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 18 Jul 2023 13:23:58 +0200 Subject: [PATCH 16/16] feat(environment): add mainnet mirror config (#4287) --- apps/explorer/.env.mainnet-mirror | 2 +- apps/governance/.env.mainnet-mirror | 4 ++-- apps/governance/src/config/env.ts | 4 ++++ apps/trading/.env.mainnet-mirror | 4 ++-- .../src/components/network-switcher/network-switcher.spec.tsx | 3 +++ .../src/components/network-switcher/network-switcher.tsx | 2 ++ libs/environment/src/hooks/use-links.ts | 4 ++++ libs/environment/src/types.ts | 1 + libs/environment/src/utils/validate-environment.ts | 1 + 9 files changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/explorer/.env.mainnet-mirror b/apps/explorer/.env.mainnet-mirror index 1299cb5cf..2736dc286 100644 --- a/apps/explorer/.env.mainnet-mirror +++ b/apps/explorer/.env.mainnet-mirror @@ -4,7 +4,7 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.rocks/websocket NX_SENTRY_DSN=https://4b8c8a8ba07742648aa4dfe1b8d17e40@o286262.ingest.sentry.io/5882996 NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml NX_VEGA_URL=https://api.mainnet-mirror.vega.rocks/graphql -NX_VEGA_ENV=MAINNET-MIRROR +NX_VEGA_ENV=MAINNET_MIRROR NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.rocks/rest NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_VEGA_GOVERNANCE_URL=https://governance.mainnet-mirror.vega.rocks diff --git a/apps/governance/.env.mainnet-mirror b/apps/governance/.env.mainnet-mirror index 711cfe742..ea22e38a6 100644 --- a/apps/governance/.env.mainnet-mirror +++ b/apps/governance/.env.mainnet-mirror @@ -1,8 +1,8 @@ # App configuration variables -NX_VEGA_ENV=MAINNET-MIRROR +NX_VEGA_ENV=MAINNET_MIRROR NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml NX_VEGA_URL=https://api.mainnet-mirror.vega.rocks/graphql -NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz","MAINNET-MIRROR":"https://governance.mainnet-mirror.vega.rocks","STAGNET1":"https://trading.stagnet1.vega.rocks"}' +NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz","MAINNET_MIRROR":"https://governance.mainnet-mirror.vega.rocks","STAGNET1":"https://trading.stagnet1.vega.rocks"}' NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions diff --git a/apps/governance/src/config/env.ts b/apps/governance/src/config/env.ts index 932163e0d..c716f1063 100644 --- a/apps/governance/src/config/env.ts +++ b/apps/governance/src/config/env.ts @@ -25,6 +25,10 @@ export const ContractAddresses: { claimAddress: customClaimAddress ?? '0x0', lockedAddress: customLockedAddress ?? '0x0', }, + MAINNET_MIRROR: { + claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error + lockedAddress: '0x0', // TODO not deployed to this env + }, DEVNET: { claimAddress: '0x8Cef746ab7C83B61F6461cC92882bD61AB65a994', // TODO not deployed to this env, but random address so app doesn't error lockedAddress: '0x0', // TODO not deployed to this env diff --git a/apps/trading/.env.mainnet-mirror b/apps/trading/.env.mainnet-mirror index cb92b542d..2198709da 100644 --- a/apps/trading/.env.mainnet-mirror +++ b/apps/trading/.env.mainnet-mirror @@ -3,9 +3,9 @@ NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions NX_SENTRY_DSN=https://2ffce43721964aafa78277c50654ece4@o286262.ingest.sentry.io/6300613 NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/mainnet-mirror/vegawallet-mainnet-mirror.toml -NX_VEGA_ENV=MAINNET-MIRROR +NX_VEGA_ENV=MAINNET_MIRROR NX_VEGA_EXPLORER_URL=https://explorer.mainnet-mirror.vega.rocks -NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\",\"MAINNET-MIRROR\":\"https://trading.mainnet-mirror.vega.rocks\"} +NX_VEGA_NETWORKS={\"MAINNET\":\"https://console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://trading.stagnet1.vega.rocks\",\"MAINNET_MIRROR\":\"https://trading.mainnet-mirror.vega.rocks\"} NX_VEGA_TOKEN_URL=https://governance.mainnet-mirror.vega.rocks NX_VEGA_WALLET_URL=http://localhost:1789 NX_VEGA_DOCS_URL=https://docs.vega.xyz/mainnet diff --git a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx index c7014e7db..136b2614b 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx @@ -163,6 +163,7 @@ describe('Network switcher', () => { [Networks.MAINNET]: 'https://main.net', [Networks.TESTNET]: 'https://test.net', [Networks.VALIDATOR_TESTNET]: 'https://validator-test.net', + [Networks.MAINNET_MIRROR]: 'https://mainnet-mirror.net', [Networks.DEVNET]: 'https://dev.net', [Networks.STAGNET1]: 'https://stag1.net', }; @@ -209,6 +210,7 @@ describe('Network switcher', () => { [Networks.CUSTOM]: undefined, [Networks.MAINNET]: 'https://main.net', [Networks.VALIDATOR_TESTNET]: 'https://validator-test.net', + [Networks.MAINNET_MIRROR]: 'https://mainnet-mirror.net', [Networks.TESTNET]: 'https://test.net', [Networks.DEVNET]: 'https://dev.net', [Networks.STAGNET1]: 'https://stag1.net', @@ -240,6 +242,7 @@ describe('Network switcher', () => { [Networks.CUSTOM]: undefined, [Networks.MAINNET]: undefined, [Networks.VALIDATOR_TESTNET]: 'https://validator-test.net', + [Networks.MAINNET_MIRROR]: 'https://mainnet-mirror.net', [Networks.TESTNET]: 'https://test.net', [Networks.DEVNET]: 'https://dev.net', [Networks.STAGNET1]: 'https://stag1.net', diff --git a/libs/environment/src/components/network-switcher/network-switcher.tsx b/libs/environment/src/components/network-switcher/network-switcher.tsx index ee30cf01a..44eee6b28 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.tsx @@ -16,6 +16,7 @@ import classNames from 'classnames'; export const envNameMapping: Record = { [Networks.VALIDATOR_TESTNET]: t('VALIDATOR_TESTNET'), + [Networks.MAINNET_MIRROR]: t('Mainnet-mirror'), [Networks.CUSTOM]: t('Custom'), [Networks.DEVNET]: t('Devnet'), [Networks.STAGNET1]: t('Stagnet'), @@ -31,6 +32,7 @@ export const envTriggerMapping: Record = { export const envDescriptionMapping: Record = { [Networks.CUSTOM]: '', [Networks.VALIDATOR_TESTNET]: t('The validator deployed testnet'), + [Networks.MAINNET_MIRROR]: t('The mainnet-mirror network'), [Networks.DEVNET]: t('The latest Vega code auto-deployed'), [Networks.STAGNET1]: t('A release candidate for the staging environment'), [Networks.TESTNET]: t( diff --git a/libs/environment/src/hooks/use-links.ts b/libs/environment/src/hooks/use-links.ts index 6642a66d1..9995e24f2 100644 --- a/libs/environment/src/hooks/use-links.ts +++ b/libs/environment/src/hooks/use-links.ts @@ -20,6 +20,7 @@ type DAppLinks = { const EmptyLinks: DAppLinks = { [Networks.VALIDATOR_TESTNET]: '', + [Networks.MAINNET_MIRROR]: '', [Networks.DEVNET]: '', [Networks.STAGNET1]: '', [Networks.TESTNET]: '', @@ -31,6 +32,7 @@ const ExplorerLinks = { [Networks.TESTNET]: 'https://explorer.fairground.wtf', [Networks.VALIDATOR_TESTNET]: 'https://explorer.validators-testnet.vega.rocks', + [Networks.MAINNET_MIRROR]: 'https://explorer.mainnet-mirror.vega.rocks/', [Networks.MAINNET]: 'https://explorer.vega.xyz', }; @@ -39,6 +41,7 @@ const ConsoleLinks = { [Networks.STAGNET1]: 'https://trading.stagnet1.vega.rocks', [Networks.TESTNET]: 'https://console.fairground.wtf', [Networks.MAINNET]: 'https://console.vega.xyz', + [Networks.MAINNET_MIRROR]: 'https://console.mainnet-mirror.vega.rocks/', }; const TokenLinks = { @@ -47,6 +50,7 @@ const TokenLinks = { [Networks.TESTNET]: 'https://governance.fairground.wtf', [Networks.VALIDATOR_TESTNET]: 'https://governance.validators-testnet.vega.rocks', + [Networks.MAINNET_MIRROR]: 'https://governance.mainnet-mirror.vega.rocks/', [Networks.MAINNET]: 'https://governance.vega.xyz', }; diff --git a/libs/environment/src/types.ts b/libs/environment/src/types.ts index ebc069c1b..91f0e78ca 100644 --- a/libs/environment/src/types.ts +++ b/libs/environment/src/types.ts @@ -4,6 +4,7 @@ import type { envSchema } from './utils/validate-environment'; export enum Networks { VALIDATOR_TESTNET = 'VALIDATOR_TESTNET', + MAINNET_MIRROR = 'MAINNET_MIRROR', CUSTOM = 'CUSTOM', TESTNET = 'TESTNET', STAGNET1 = 'STAGNET1', diff --git a/libs/environment/src/utils/validate-environment.ts b/libs/environment/src/utils/validate-environment.ts index 8a6412af8..280b4d563 100644 --- a/libs/environment/src/utils/validate-environment.ts +++ b/libs/environment/src/utils/validate-environment.ts @@ -2,6 +2,7 @@ import z from 'zod'; export enum Networks { VALIDATOR_TESTNET = 'VALIDATOR_TESTNET', + MAINNET_MIRROR = 'MAINNET_MIRROR', CUSTOM = 'CUSTOM', TESTNET = 'TESTNET', STAGNET1 = 'STAGNET1',