Compare commits
44
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec12c7ecfd | ||
|
|
045dace274 | ||
|
|
2346b2f1a0 | ||
|
|
31859cb779 | ||
|
|
20507ecdd1 | ||
|
|
13ba661ea0 | ||
|
|
03f5b9fc7b | ||
|
|
b9fed65615 | ||
|
|
d671e51edf | ||
|
|
4f3295d3fc | ||
|
|
7be7bab1ca | ||
|
|
61380f06b9 | ||
|
|
c113856d63 | ||
|
|
90884beee8 | ||
|
|
d9d2e428f4 | ||
|
|
ba8d54b761 | ||
|
|
dce4edb943 | ||
|
|
b468a0fd84 | ||
|
|
c98fbe7453 | ||
|
|
d20928ec06 | ||
|
|
289559fe4f | ||
|
|
071fd6128c | ||
|
|
554d07a31b | ||
|
|
48b62380b0 | ||
|
|
a9f4604bad | ||
|
|
54f2519a62 | ||
|
|
260e7bf9cf | ||
|
|
83db796cdb | ||
|
|
2f6800212e | ||
|
|
77e16ad1b7 | ||
|
|
dcce983842 | ||
|
|
53ce9bfaa2 | ||
|
|
6ae34d296f | ||
|
|
ee2aafb99c | ||
|
|
e8fdb63323 | ||
|
|
3df9270b57 | ||
|
|
ab26667265 | ||
|
|
9fc6b255c8 | ||
|
|
91f61d8bb5 | ||
|
|
bbfda65bcc | ||
|
|
45f2e926c3 | ||
|
|
ccadbc2cb6 | ||
|
|
7128acb7b8 | ||
|
|
357bdaa4f3 |
@@ -4,14 +4,54 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- release/*
|
||||
- develop
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- synchronize
|
||||
- ready_for_review
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
jobs:
|
||||
node-modules:
|
||||
runs-on: ubuntu-22.04
|
||||
name: 'Cache yarn modules'
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Cache node modules
|
||||
id: cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
||||
# comment out "resotre-keys" if you need to rebuild yarn from 0
|
||||
restore-keys: |
|
||||
${{ runner.os }}-cache-node-modules-
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
||||
cache: yarn
|
||||
|
||||
- name: yarn install
|
||||
if: steps.cache.outputs.cache-hit != 'true'
|
||||
run: yarn install --pure-lockfile
|
||||
|
||||
lint-pr-title:
|
||||
needs: node-modules
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
name: Verify PR title
|
||||
uses: ./.github/workflows/lint-pr.yml
|
||||
secrets: inherit
|
||||
|
||||
lint-test-build:
|
||||
timeout-minutes: 20
|
||||
needs: node-modules
|
||||
runs-on: ubuntu-22.04
|
||||
name: '(CI) lint + unit test + build'
|
||||
steps:
|
||||
@@ -27,8 +67,11 @@ jobs:
|
||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
||||
cache: yarn
|
||||
|
||||
- name: Install root dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||
uses: nrwl/nx-set-shas@v3
|
||||
@@ -48,7 +91,7 @@ jobs:
|
||||
run: yarn nx affected:test
|
||||
|
||||
- name: Build affected
|
||||
run: yarn nx affected:build
|
||||
run: yarn nx affected:build || (yarn install && yarn nx affected:build)
|
||||
|
||||
# See affected apps
|
||||
- name: See affected apps
|
||||
@@ -95,6 +138,43 @@ jobs:
|
||||
with:
|
||||
projects: ${{ needs.lint-test-build.outputs.projects }}
|
||||
|
||||
dist-check:
|
||||
runs-on: ubuntu-latest
|
||||
needs: publish-dist
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
name: '(CD) comment preview links'
|
||||
steps:
|
||||
- name: Find Comment
|
||||
uses: peter-evans/find-comment@v2
|
||||
id: fc
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body-includes: Previews
|
||||
|
||||
- name: Inject slug/short variables
|
||||
if: ${{ steps.fc.outputs.comment-id == 0 }}
|
||||
uses: rlespinasse/github-slug-action@v4
|
||||
with:
|
||||
prefix: CI_
|
||||
|
||||
- name: Create comment
|
||||
if: ${{ steps.fc.outputs.comment-id == 0 }}
|
||||
uses: peter-evans/create-or-update-comment@v3
|
||||
with:
|
||||
issue-number: ${{ github.event.pull_request.number }}
|
||||
body: |
|
||||
Previews
|
||||
- explorer https://explorer.${{ env.CI_GITHUB_REF_NAME }}.vega.rocks
|
||||
- trading https://trading.${{ env.CI_GITHUB_REF_NAME }}.vega.rocks
|
||||
- governance https://governance.${{ env.CI_GITHUB_REF_NAME }}.vega.rocks
|
||||
|
||||
cypress-check:
|
||||
name: '(CI) cypress - check'
|
||||
runs-on: ubuntu-latest
|
||||
needs: cypress
|
||||
steps:
|
||||
- run: echo Done!
|
||||
|
||||
# Report single result at the end, to avoid mess with required checks in PR
|
||||
cypress-result:
|
||||
if: ${{ always() }}
|
||||
|
||||
@@ -2,15 +2,11 @@
|
||||
name: Verify PR title
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- ready_for_review
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
workflow_call:
|
||||
|
||||
jobs:
|
||||
lint_pr:
|
||||
timeout-minutes: 10
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -23,8 +19,11 @@ jobs:
|
||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
||||
cache: yarn
|
||||
|
||||
- name: Install root dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
- name: Check PR title
|
||||
run: echo "${{ github.event.pull_request.title }}" | npx commitlint --config ./commitlint.config-ci.js
|
||||
@@ -15,6 +15,7 @@ jobs:
|
||||
app: ${{ fromJSON(inputs.projects) }}
|
||||
name: ${{ matrix.app }}
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
@@ -36,66 +37,131 @@ jobs:
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
||||
- name: Check node version
|
||||
id: tags
|
||||
run: |
|
||||
nodeVersion=$(cat .nvmrc | head -n 1)
|
||||
echo ::set-output name=nodeVersion::${nodeVersion}
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
# https://stackoverflow.com/questions/61010294/how-to-cache-yarn-packages-in-github-actions
|
||||
cache: yarn
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: node_modules
|
||||
key: ${{ runner.os }}-cache-node-modules-${{ hashFiles('yarn.lock') }}
|
||||
|
||||
# https://docs.github.com/en/actions/learn-github-actions/contexts
|
||||
- name: Define variables
|
||||
run: |
|
||||
envName=''
|
||||
dockerfile="dist.Dockerfile"
|
||||
if [[ "${{ github.event_name }}" = "push" ]]; then
|
||||
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
|
||||
bucketName="${{ github.event.repository.name }}-$envName"
|
||||
echo ::set-output name=bucketName::${bucketName}
|
||||
echo ::set-output name=envName::${envName}
|
||||
domain="vega.rocks"
|
||||
if [[ "${{ github.ref }}" =~ .*release/.* ]]; then
|
||||
envName="$(echo ${{ github.ref }} | rev | cut -d '/' -f 1 | rev)"
|
||||
if [[ "${{ github.ref }}" =~ .*mainnet.* ]]; then
|
||||
domain="vega.community"
|
||||
if [[ "${{ matrix.app }}" = "trading" ]]; then
|
||||
dockerfile="ipfs.Dockerfile"
|
||||
fi
|
||||
fi
|
||||
elif [[ "${{ github.ref }}" =~ .*develop$ ]]; then
|
||||
envName="stagnet3"
|
||||
fi
|
||||
bucketName="${{ matrix.app }}.${envName}.${domain}"
|
||||
echo BUCKET_NAME=${bucketName} >> $GITHUB_ENV
|
||||
fi
|
||||
nodeVersion=$(cat .nvmrc | head -n 1)
|
||||
echo ENV_NAME=${envName} >> $GITHUB_ENV
|
||||
echo NODE_VERSION=${nodeVersion} >> $GITHUB_ENV
|
||||
echo DOCKERFILE=docker/${dockerfile} >> $GITHUB_ENV
|
||||
|
||||
- name: Build local dist
|
||||
if: ${{ env.DOCKERFILE != 'docker/ipfs.Dockerfile' }}
|
||||
run: |
|
||||
flags=""
|
||||
if [[ ! -z "${{ env.ENV_NAME }}" ]]; then
|
||||
if [[ "${{ env.ENV_NAME }}" != "ops-vega" ]]; then
|
||||
flags="--env=${{ env.ENV_NAME }}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${{ matrix.app }}" = "trading" ]; then
|
||||
yarn nx export trading $flags || (yarn install && yarn nx export trading $flags)
|
||||
DIST_LOCATION=dist/apps/trading/exported
|
||||
else
|
||||
yarn nx build ${{ matrix.app }} $flags || (yarn install && yarn nx build ${{ matrix.app }} $flags)
|
||||
DIST_LOCATION=dist/apps/${{ matrix.app }}
|
||||
fi
|
||||
mv $DIST_LOCATION dist-result
|
||||
tree dist-result
|
||||
|
||||
- name: Build and export to local Docker
|
||||
id: docker_build
|
||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
file: ${{ env.DOCKERFILE }}
|
||||
load: true
|
||||
build-args: |
|
||||
APP=${{ matrix.app }}
|
||||
NODE_VERSION=${{ steps.tags.outputs.nodeVersion }}
|
||||
ENV_NAME=${{ steps.tags.outputs.envName || '' }}
|
||||
NODE_VERSION=${{ env.NODE_VERSION }}
|
||||
ENV_NAME=${{ env.ENV_NAME }}
|
||||
tags: |
|
||||
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
||||
|
||||
- name: Image digest
|
||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
- name: Sanity check docker image
|
||||
if: ${{ github.event_name == 'pull_request' || ( env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' ) }}
|
||||
run: |
|
||||
echo "Check ipfs-hash"
|
||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat ipfs-hash
|
||||
if [[ "${{ env.DOCKERFILE }}" = "docker/ipfs.Dockerfile" ]]; then
|
||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local cat /ipfs-hash
|
||||
fi
|
||||
|
||||
echo "List html directory"
|
||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local ls -lah
|
||||
docker run --rm ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local sh -c 'apk add --update tree; tree .'
|
||||
|
||||
echo "Copy dist to local filesystem"
|
||||
- name: Copy dist to local filesystem
|
||||
if: ${{ env.DOCKERFILE == 'docker/ipfs.Dockerfile' && github.event_name == 'push' }}
|
||||
run: |
|
||||
docker create --name=dist ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:local
|
||||
docker cp dist:/usr/share/nginx/html dist
|
||||
|
||||
echo "Check local dist"
|
||||
ls -al dist
|
||||
echo "check local dist files"
|
||||
tree dist/html
|
||||
mv dist/html dist-result
|
||||
|
||||
- name: Publish dist as docker image
|
||||
uses: docker/build-push-action@v3
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
with:
|
||||
context: .
|
||||
file: ${{ env.DOCKERFILE }}
|
||||
push: true
|
||||
build-args: |
|
||||
APP=${{ matrix.app }}
|
||||
NODE_VERSION=${{ steps.tags.outputs.nodeVersion }}
|
||||
NODE_VERSION=${{ env.NODE_VERSION }}
|
||||
ENV_NAME=${{ env.ENV_NAME }}
|
||||
tags: |
|
||||
ghcr.io/vegaprotocol/frontend/${{ matrix.app }}:${{ github.event.pull_request.head.sha || github.sha }}
|
||||
|
||||
# - uses: shallwefootball/s3-upload-action@master
|
||||
# if: ${{ github.event_name == 'push' }}
|
||||
# name: Upload dist S3
|
||||
# with:
|
||||
# aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
||||
# aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
# aws_bucket: ${{ steps.tags.outputs.bucketName }}
|
||||
# source_dir: 'dist'
|
||||
# bucket creation in github.com/vegaprotocol/terraform//frontend
|
||||
- name: Publish dist to s3
|
||||
uses: jakejarvis/s3-sync-action@master
|
||||
if: ${{ github.event_name == 'push' }}
|
||||
with:
|
||||
args: --acl private --follow-symlinks --delete
|
||||
env:
|
||||
AWS_S3_BUCKET: ${{ env.BUCKET_NAME }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: 'eu-west-1'
|
||||
SOURCE_DIR: 'dist-result'
|
||||
|
||||
- name: Add preview label
|
||||
uses: actions-ecosystem/action-add-labels@v1
|
||||
@@ -103,6 +169,3 @@ jobs:
|
||||
with:
|
||||
labels: ${{ matrix.app }}-preview
|
||||
number: ${{ github.event.number }}
|
||||
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
@@ -10,7 +10,7 @@ export const Footer = () => {
|
||||
const [nodeSwitcherOpen, setNodeSwitcherOpen] = useState(false);
|
||||
const { screenSize } = useScreenDimensions();
|
||||
const showFullFeedbackLabel = useMemo(
|
||||
() => ['lg', 'xl', 'xxl', 'xxxl'].includes(screenSize),
|
||||
() => ['md', 'lg', 'xl', 'xxl', 'xxxl'].includes(screenSize),
|
||||
[screenSize]
|
||||
);
|
||||
|
||||
|
||||
@@ -38,14 +38,16 @@ const DialogsContainer = () => {
|
||||
export const Layout = () => {
|
||||
const isHome = Boolean(useMatch(Routes.HOME));
|
||||
const { ANNOUNCEMENTS_CONFIG_URL } = useEnvironment();
|
||||
const fixedWidthClasses = 'w-full max-w-[1500px] mx-auto';
|
||||
|
||||
return (
|
||||
<>
|
||||
<div
|
||||
className={classNames(
|
||||
'max-w-[1500px] min-h-[100vh]',
|
||||
'min-h-screen',
|
||||
'mx-auto my-0',
|
||||
'grid grid-rows-[auto_1fr_auto] grid-cols-1',
|
||||
'border-vega-light-200 dark:border-vega-dark-200 lg:border-l lg:border-r',
|
||||
'border-vega-light-200 dark:border-vega-dark-200',
|
||||
'antialiased text-black dark:text-white',
|
||||
'overflow-hidden relative'
|
||||
)}
|
||||
@@ -59,13 +61,13 @@ export const Layout = () => {
|
||||
)}
|
||||
<Header />
|
||||
</div>
|
||||
<div>
|
||||
<div className={fixedWidthClasses}>
|
||||
<main className="p-4">
|
||||
{!isHome && <BreadcrumbsContainer className="mb-4" />}
|
||||
<Outlet />
|
||||
</main>
|
||||
</div>
|
||||
<div>
|
||||
<div className={fixedWidthClasses}>
|
||||
<Footer />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -44,7 +44,8 @@ describe(
|
||||
function () {
|
||||
before('connect wallets and set approval limit', function () {
|
||||
cy.visit('/');
|
||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||
ethereumWalletConnect();
|
||||
cy.associateTokensToVegaWallet('1');
|
||||
});
|
||||
|
||||
beforeEach('visit proposals tab', function () {
|
||||
@@ -213,6 +214,7 @@ describe(
|
||||
|
||||
// 3001-VOTE-042, 3001-VOTE-057, 3001-VOTE-058, 3001-VOTE-059, 3001-VOTE-060
|
||||
it('Newly created proposal details - ability to increase associated tokens - by voting again after association', function () {
|
||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||
createRawProposal();
|
||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||
getSubmittedProposalFromProposalList(rawProposal.rationale.title)
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
createUpdateNetworkProposalTxBody,
|
||||
createFreeFormProposalTxBody,
|
||||
} from '../../support/proposal.functions';
|
||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../support/staking.functions';
|
||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../support/wallet-teardown.functions';
|
||||
|
||||
@@ -33,10 +32,6 @@ context(
|
||||
before('Connect wallets and set approval', function () {
|
||||
cy.visit('/');
|
||||
vegaWalletSetSpecifiedApprovalAmount('1000');
|
||||
cy.connectVegaWallet();
|
||||
ethereumWalletConnect();
|
||||
ensureSpecifiedUnstakedTokensAreAssociated('1');
|
||||
cy.clearLocalStorage();
|
||||
});
|
||||
|
||||
beforeEach('visit proposals', function () {
|
||||
@@ -114,7 +109,7 @@ context(
|
||||
navigateTo(navigation.proposals);
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.get(openProposals).within(() => {
|
||||
cy.get(openProposals, { timeout: 6000 }).within(() => {
|
||||
cy.contains(proposalTitle)
|
||||
.parentsUntil('[data-testid="proposals-list-item"]')
|
||||
.within(() => cy.get(viewProposalButton).click());
|
||||
|
||||
@@ -232,7 +232,7 @@ context(
|
||||
|
||||
it('Unable to create a freeform proposal - when json parent section contains unexpected field', function () {
|
||||
const errorMsg =
|
||||
'Invalid params: the transaction does not use a valid Vega command: unknown field unexpected" in vega.commands.v1.ProposalSubmission';
|
||||
'Invalid params: the transaction does not use a valid Vega command: unknown field "unexpected" in vega.commands.v1.ProposalSubmission';
|
||||
|
||||
// 3001-VOTE-038 3002-PROP-013 3002-PROP-014
|
||||
goToMakeNewProposal(governanceProposalType.RAW);
|
||||
@@ -313,7 +313,7 @@ context(
|
||||
|
||||
it('Unable to vote on a proposal - when vega wallet disconnected - option to connect from within', function () {
|
||||
createRawProposal();
|
||||
cy.get('[data-testid="manage-vega-wallet"]').click();
|
||||
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||
cy.get('[data-testid="disconnect"]').click();
|
||||
cy.get<testFreeformProposal>('@rawProposal').then((rawProposal) => {
|
||||
getSubmittedProposalFromProposalList(
|
||||
|
||||
@@ -218,7 +218,7 @@ context(
|
||||
|
||||
it('Unable to submit new market proposal with missing/invalid fields', function () {
|
||||
const errorMsg =
|
||||
'Invalid params: the transaction is not a valid Vega command: unknown field "filters" in vega.DataSourceDefinition';
|
||||
'Invalid params: the transaction does not use a valid Vega command: unknown field "invalid" in vega.NewMarket';
|
||||
|
||||
goToMakeNewProposal(governanceProposalType.NEW_MARKET);
|
||||
cy.get(newProposalSubmitButton).should('be.visible').click();
|
||||
@@ -436,7 +436,7 @@ context(
|
||||
});
|
||||
});
|
||||
|
||||
it.only('Able to submit update asset proposal using max deadline', function () {
|
||||
it('Able to submit update asset proposal using max deadline', function () {
|
||||
goToMakeNewProposal(governanceProposalType.UPDATE_ASSET);
|
||||
enterUpdateAssetProposalDetails();
|
||||
cy.get(maxVoteDeadline).click();
|
||||
|
||||
@@ -25,11 +25,11 @@ const vegaWalletUnstakedBalance =
|
||||
'[data-testid="vega-wallet-balance-unstaked"]';
|
||||
const txTimeout = Cypress.env('txTimeout');
|
||||
const vegaWalletPublicKeyShort = Cypress.env('vegaWalletPublicKeyShort');
|
||||
const ethWalletAssociateButton = '[data-testid="associate-btn"]';
|
||||
const ethWalletAssociateButton = '[data-testid="associate-btn"]:visible';
|
||||
const associateWalletRadioButton = '[data-testid="associate-radio-wallet"]';
|
||||
const tokenAmountInputBox = '[data-testid="token-amount-input"]';
|
||||
const tokenSubmitButton = '[data-testid="token-input-submit-button"]';
|
||||
const ethWalletDissociateButton = '[href="/token/disassociate"]';
|
||||
const ethWalletDissociateButton = '[href="/token/disassociate"]:visible';
|
||||
const vestingContractSection = '[data-testid="vega-in-vesting-contract"]';
|
||||
const vegaInWalletSection = '[data-testid="vega-in-wallet"]';
|
||||
const connectedVegaKey = '[data-testid="connected-vega-key"]';
|
||||
@@ -78,12 +78,12 @@ context(
|
||||
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '0.00');
|
||||
validateWalletCurrency('Pending association', '2.00');
|
||||
validateWalletCurrency('Total associated after pending', '2.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
|
||||
// 0005-ETXN-002
|
||||
verifyEthWalletAssociatedBalance('2.0');
|
||||
@@ -111,12 +111,12 @@ context(
|
||||
stakingPageDisassociateTokens('2');
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '2.00');
|
||||
validateWalletCurrency('Pending association', '2.00');
|
||||
validateWalletCurrency('Total associated after pending', '0.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
cy.getByTestId('eth-wallet-associated-balances', txTimeout).should(
|
||||
'not.exist'
|
||||
);
|
||||
@@ -192,12 +192,12 @@ context(
|
||||
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '0.00');
|
||||
validateWalletCurrency('Pending association', '2.00');
|
||||
validateWalletCurrency('Total associated after pending', '2.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
verifyEthWalletAssociatedBalance('2.0');
|
||||
verifyEthWalletTotalAssociatedBalance('2.0');
|
||||
cy.get(vegaWallet).within(() => {
|
||||
@@ -210,12 +210,12 @@ context(
|
||||
});
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '2.00');
|
||||
validateWalletCurrency('Pending association', '1.00');
|
||||
validateWalletCurrency('Total associated after pending', '1.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
verifyEthWalletAssociatedBalance('1.0');
|
||||
verifyEthWalletTotalAssociatedBalance('1.0');
|
||||
});
|
||||
@@ -266,7 +266,7 @@ context(
|
||||
// 1004-ASSO-008
|
||||
// 1004-ASSO-010
|
||||
// No warning visible as described in AC, but the button is disabled
|
||||
cy.get(ethWalletAssociateButton).first().click();
|
||||
cy.get(ethWalletAssociateButton).click();
|
||||
cy.get(associateWalletRadioButton, { timeout: 30000 }).click();
|
||||
cy.get(tokenSubmitButton, txTimeout).should('be.disabled'); // button disabled with no input
|
||||
cy.get(tokenAmountInputBox, { timeout: 10000 }).type('6500000');
|
||||
@@ -278,12 +278,12 @@ context(
|
||||
vegaWalletAssociate('2');
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '0.00');
|
||||
validateWalletCurrency('Pending association', '2.00');
|
||||
validateWalletCurrency('Total associated after pending', '2.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
validateWalletCurrency('Associated', '2.00');
|
||||
});
|
||||
|
||||
@@ -294,24 +294,24 @@ context(
|
||||
});
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'have.length.above',
|
||||
3
|
||||
6
|
||||
);
|
||||
validateWalletCurrency('Associated', '2.00');
|
||||
validateWalletCurrency('Pending association', '2.00');
|
||||
validateWalletCurrency('Total associated after pending', '0.00');
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 3);
|
||||
cy.getByTestId('currency-title', txTimeout).should('have.length', 6);
|
||||
validateWalletCurrency('Associated', '0.00');
|
||||
});
|
||||
|
||||
it('Able to associate tokens to different public key of connected vega wallet', function () {
|
||||
cy.get(ethWalletAssociateButton).first().click();
|
||||
cy.get(ethWalletAssociateButton).click();
|
||||
cy.get(associateWalletRadioButton).click();
|
||||
cy.get(connectedVegaKey).should(
|
||||
'have.text',
|
||||
Cypress.env('vegaWalletPublicKey')
|
||||
);
|
||||
|
||||
cy.get('[data-testid="manage-vega-wallet"]').click();
|
||||
cy.get('[data-testid="manage-vega-wallet"]:visible').click();
|
||||
cy.get('[data-testid="select-keypair-button"]').eq(0).click();
|
||||
cy.get(connectedVegaKey).should(
|
||||
'have.text',
|
||||
|
||||
@@ -166,6 +166,7 @@ export function goToMakeNewProposal(proposalType: string) {
|
||||
navigateTo(navigation.proposals);
|
||||
cy.get(newProposalButton).should('be.visible').click();
|
||||
cy.url().should('include', '/proposals/propose');
|
||||
cy.get(navigation.pageSpinner, { timeout: 20000 }).should('not.exist');
|
||||
cy.get('li').should('contain.text', proposalType).and('be.visible');
|
||||
cy.get('li').contains(proposalType).click();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
} from '@vegaprotocol/smart-contracts';
|
||||
import { ethers, Wallet } from 'ethers';
|
||||
|
||||
const associatedAmountInWallet = '[data-testid="associated-amount"]:visible';
|
||||
const vegaWalletContainer = 'aside [data-testid="vega-wallet"]';
|
||||
const vegaWalletMnemonic = Cypress.env('vegaWalletMnemonic');
|
||||
const vegaWalletPubKey = Cypress.env('vegaWalletPublicKey');
|
||||
@@ -59,7 +60,7 @@ export async function faucetAsset(assetEthAddress: string) {
|
||||
}
|
||||
|
||||
export async function vegaWalletTeardown() {
|
||||
cy.get('[data-testid="associated-amount"]')
|
||||
cy.get(associatedAmountInWallet)
|
||||
.should('be.visible')
|
||||
.invoke('text')
|
||||
.then((associatedAmount) => {
|
||||
@@ -68,12 +69,12 @@ export async function vegaWalletTeardown() {
|
||||
$body.find('[data-testid="eth-wallet-associated-balances"]').length ||
|
||||
associatedAmount != '0.00'
|
||||
) {
|
||||
vegaWalletTeardownVesting(vestingContract);
|
||||
vegaWalletTeardownStaking(stakingBridgeContract);
|
||||
vegaWalletTeardownVesting(vestingContract);
|
||||
}
|
||||
});
|
||||
cy.get(vegaWalletContainer).within(() => {
|
||||
cy.getByTestId('associated-amount', {
|
||||
cy.get(associatedAmountInWallet, {
|
||||
timeout: transactionTimeout,
|
||||
}).contains('0.00', {
|
||||
timeout: transactionTimeout,
|
||||
@@ -90,7 +91,7 @@ export async function vegaWalletSetSpecifiedApprovalAmount(
|
||||
await promiseWithTimeout(
|
||||
token.approve(
|
||||
ethStakingBridgeContractAddress,
|
||||
resetAmount.concat('000000000000000000')
|
||||
resetAmount + '0'.repeat(18)
|
||||
),
|
||||
10 * 60 * 1000,
|
||||
'set approval amount'
|
||||
@@ -104,12 +105,23 @@ async function vegaWalletTeardownStaking(stakingBridgeContract: StakingBridge) {
|
||||
{ timeout: transactionTimeout, log: false }
|
||||
).then((stakeBalance) => {
|
||||
if (Number(stakeBalance) != 0) {
|
||||
cy.wrap(
|
||||
stakingBridgeContract.remove_stake(
|
||||
String(stakeBalance),
|
||||
vegaWalletPubKey
|
||||
),
|
||||
{ timeout: transactionTimeout, log: false }
|
||||
cy.get('[data-testid="vega-wallet-balance-unstaked"]:visible').within(
|
||||
() => {
|
||||
cy.get(associatedAmountInWallet)
|
||||
.invoke('text')
|
||||
.then(($walletAmount) => {
|
||||
cy.wrap(
|
||||
stakingBridgeContract.remove_stake(
|
||||
String(stakeBalance),
|
||||
vegaWalletPubKey
|
||||
),
|
||||
{ timeout: transactionTimeout, log: false }
|
||||
);
|
||||
cy.get(associatedAmountInWallet, {
|
||||
timeout: transactionTimeout,
|
||||
}).should('not.have.text', $walletAmount);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
});
|
||||
@@ -124,7 +136,6 @@ async function vegaWalletTeardownVesting(vestingContract: TokenVesting) {
|
||||
if (Number(vestingAmount) != 0) {
|
||||
// Wait needed to allow time for ganache to process tx for stakingBridgeContract.remove_stake
|
||||
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
||||
cy.wait(1000);
|
||||
cy.wrap(
|
||||
vestingContract.remove_stake(String(vestingAmount), vegaWalletPubKey),
|
||||
{ timeout: transactionTimeout, log: false }
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
import classNames from 'classnames';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import type { ReactNode } from 'react';
|
||||
import { AnnouncementBanner } from '@vegaprotocol/announcements';
|
||||
import { Nav } from '../nav';
|
||||
import { Networks, useEnvironment } from '@vegaprotocol/environment';
|
||||
import React from 'react';
|
||||
|
||||
interface AppLayoutProps {
|
||||
children: ReactNode;
|
||||
}
|
||||
export const AppLayout = ({ children }: AppLayoutProps) => {
|
||||
const { VEGA_ENV, ANNOUNCEMENTS_CONFIG_URL } = useEnvironment();
|
||||
const { isReadOnly } = useVegaWallet();
|
||||
const AppLayoutClasses = classNames(
|
||||
'app w-full max-w-[1500px] mx-auto grid min-h-full',
|
||||
'border-neutral-700 lg:border-l lg:border-r',
|
||||
'app w-full max-w-[1500px] mx-auto grid',
|
||||
'lg:text-body-large',
|
||||
{
|
||||
'grid-rows-[repeat(2,min-content)_1fr_min-content]': !isReadOnly,
|
||||
@@ -17,5 +21,18 @@ export const AppLayout = ({ children }: AppLayoutProps) => {
|
||||
}
|
||||
);
|
||||
|
||||
return <div className={AppLayoutClasses}>{children}</div>;
|
||||
return (
|
||||
<div className="min-h-full">
|
||||
<div className="lg:text-body-large">
|
||||
{ANNOUNCEMENTS_CONFIG_URL && (
|
||||
<AnnouncementBanner
|
||||
app="governance"
|
||||
configUrl={ANNOUNCEMENTS_CONFIG_URL}
|
||||
/>
|
||||
)}
|
||||
<Nav theme={VEGA_ENV === Networks.TESTNET ? 'yellow' : 'dark'} />
|
||||
</div>
|
||||
<div className={AppLayoutClasses}>{children}</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
import { Networks, useEnvironment } from '@vegaprotocol/environment';
|
||||
import { ViewingAsBanner } from '@vegaprotocol/ui-toolkit';
|
||||
import { AnnouncementBanner } from '@vegaprotocol/announcements';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import React from 'react';
|
||||
|
||||
import { Nav } from '../nav';
|
||||
|
||||
export interface TemplateSidebarProps {
|
||||
children: React.ReactNode;
|
||||
sidebar: React.ReactNode[];
|
||||
}
|
||||
|
||||
export function TemplateSidebar({ children, sidebar }: TemplateSidebarProps) {
|
||||
const { VEGA_ENV, ANNOUNCEMENTS_CONFIG_URL } = useEnvironment();
|
||||
const { isReadOnly, pubKey, disconnect } = useVegaWallet();
|
||||
return (
|
||||
<>
|
||||
{ANNOUNCEMENTS_CONFIG_URL && (
|
||||
<AnnouncementBanner
|
||||
app="governance"
|
||||
configUrl={ANNOUNCEMENTS_CONFIG_URL}
|
||||
/>
|
||||
)}
|
||||
<Nav theme={VEGA_ENV === Networks.TESTNET ? 'yellow' : 'dark'} />
|
||||
{isReadOnly ? (
|
||||
<ViewingAsBanner pubKey={pubKey} disconnect={disconnect} />
|
||||
) : null}
|
||||
|
||||
@@ -443,8 +443,8 @@
|
||||
"rewardType": "Reward type",
|
||||
"rewardsAndFeesReceived": "Rewards and fees received",
|
||||
"ThisDoesNotIncludeFeesReceivedForMakersOrLiquidityProviders": "This does not include fees received for makers or liquidity providers",
|
||||
"totalDistributed": "TOTAL DISTRIBUTED",
|
||||
"earnedByMe": "EARNED BY ME",
|
||||
"totalDistributed": "Total distributed",
|
||||
"earnedByMe": "Earned by me",
|
||||
"noRewardsHaveBeenDistributedYet": "NO REWARDS HAVE BEEN DISTRIBUTED YET",
|
||||
"rewardsColAssetHeader": "ASSET",
|
||||
"rewardsColStakingHeader": "STAKING",
|
||||
|
||||
@@ -114,7 +114,7 @@ export const RewardsPage = () => {
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="w-[440px]">
|
||||
<div className="w-[360px]">
|
||||
<Toggle
|
||||
name="epoch-reward-view-toggle"
|
||||
toggles={[
|
||||
|
||||
@@ -155,16 +155,16 @@ export const ValidatorTables = ({
|
||||
return (
|
||||
<section data-testid="validator-tables">
|
||||
<div className="grid w-full justify-end">
|
||||
<div className="w-[400px]">
|
||||
<div className="w-[340px]">
|
||||
<Toggle
|
||||
name="validators-view-toggle"
|
||||
toggles={[
|
||||
{
|
||||
label: t('ALL VALIDATORS'),
|
||||
label: t('All validators'),
|
||||
value: 'all',
|
||||
},
|
||||
{
|
||||
label: t('STAKED BY ME'),
|
||||
label: t('Staked by me'),
|
||||
value: 'myStake',
|
||||
},
|
||||
]}
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
"tranche_id": 56,
|
||||
"tranche_start": "2023-04-20T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-20T00:00:00.000Z",
|
||||
"total_added": "13843",
|
||||
"total_added": "15711.125",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "13843",
|
||||
"locked_amount": "15711.125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "241.5",
|
||||
@@ -67,6 +67,26 @@
|
||||
"user": "0xdC483901425B2EA6494EaE01ADB6565936E25124",
|
||||
"tx": "0x14ca69443a14b0f35538856a4fdda6a2b287d7ac6e7c4e600fb797c4c6d44098"
|
||||
},
|
||||
{
|
||||
"amount": "1542.125",
|
||||
"user": "0xE9F41a0090fcc7eaf626037003AAD44B17098E7C",
|
||||
"tx": "0x34cc25a41e2bf106663fa4cf9880227b0823cf53e1e6069d4b7c526a1b6c6d21"
|
||||
},
|
||||
{
|
||||
"amount": "84.5",
|
||||
"user": "0x6A228Fffda4D1B3C773b9ce38DA43592581b36FC",
|
||||
"tx": "0x687fa99f98028fc31d979c3cc72dec17f95d1e6afa305dec9d89632699a24e77"
|
||||
},
|
||||
{
|
||||
"amount": "138",
|
||||
"user": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D",
|
||||
"tx": "0x7543f201673298844d68e4dd15222ab85bdd2796b5b95c739d1a1d5c198806e8"
|
||||
},
|
||||
{
|
||||
"amount": "103.5",
|
||||
"user": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
|
||||
"tx": "0xc7483de16af39896b3ae052dd8a6e01fb3dc3794ceb9d2a76d81436992af320e"
|
||||
},
|
||||
{
|
||||
"amount": "50",
|
||||
"user": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
|
||||
@@ -296,6 +316,66 @@
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "94.875"
|
||||
},
|
||||
{
|
||||
"address": "0xE9F41a0090fcc7eaf626037003AAD44B17098E7C",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1542.125",
|
||||
"user": "0xE9F41a0090fcc7eaf626037003AAD44B17098E7C",
|
||||
"tranche_id": 56,
|
||||
"tx": "0x34cc25a41e2bf106663fa4cf9880227b0823cf53e1e6069d4b7c526a1b6c6d21"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "1542.125",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "1542.125"
|
||||
},
|
||||
{
|
||||
"address": "0x6A228Fffda4D1B3C773b9ce38DA43592581b36FC",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "84.5",
|
||||
"user": "0x6A228Fffda4D1B3C773b9ce38DA43592581b36FC",
|
||||
"tranche_id": 56,
|
||||
"tx": "0x687fa99f98028fc31d979c3cc72dec17f95d1e6afa305dec9d89632699a24e77"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "84.5",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "84.5"
|
||||
},
|
||||
{
|
||||
"address": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "138",
|
||||
"user": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D",
|
||||
"tranche_id": 56,
|
||||
"tx": "0x7543f201673298844d68e4dd15222ab85bdd2796b5b95c739d1a1d5c198806e8"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "138",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "138"
|
||||
},
|
||||
{
|
||||
"address": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "103.5",
|
||||
"user": "0x697cEF6741F519621fE14c72041e4B8B1f7e2c8A",
|
||||
"tranche_id": 56,
|
||||
"tx": "0xc7483de16af39896b3ae052dd8a6e01fb3dc3794ceb9d2a76d81436992af320e"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "103.5",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "103.5"
|
||||
},
|
||||
{
|
||||
"address": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
|
||||
"deposits": [
|
||||
@@ -520,9 +600,9 @@
|
||||
"tranche_id": 54,
|
||||
"tranche_start": "2023-04-06T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-06T00:00:00.000Z",
|
||||
"total_added": "8727",
|
||||
"total_removed": "57.68717013147",
|
||||
"locked_amount": "7125.3564502314809751",
|
||||
"total_added": "8865",
|
||||
"total_removed": "362.31015740205",
|
||||
"locked_amount": "5243.2918055555557635",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "33",
|
||||
@@ -534,6 +614,16 @@
|
||||
"user": "0xB0Dbf35C0918536B62a2FbcCC852bCffDB41d6aF",
|
||||
"tx": "0x60989e406ce3e35e39f93176a45ff46f7c0a293d538a27a685efa7bd350ad92e"
|
||||
},
|
||||
{
|
||||
"amount": "24",
|
||||
"user": "0xa8bdC133265C7Aab74eA1D00527925e47275D9Ad",
|
||||
"tx": "0x8e2990dd83380f38f32cd3964e720e86b53a7a5d5f45adc4e0c012f5c0022101"
|
||||
},
|
||||
{
|
||||
"amount": "114",
|
||||
"user": "0xfD181C18D0442cBbad1207110D09b5fCa8CC8218",
|
||||
"tx": "0xaa9cfb8f54f0d9066fe0ffaa6742acfb9626485a0497750e61e3d5dc925dfb37"
|
||||
},
|
||||
{
|
||||
"amount": "33",
|
||||
"user": "0xb5e340788922791727C240c33D27060157845291",
|
||||
@@ -656,6 +746,21 @@
|
||||
"user": "0x92A1e98C6f09970e45645Cbe57c6DcaF4547c8FE",
|
||||
"tx": "0xb9b9b6b0882ad6e197e540e034c39e785f8b77372ac03f93d2f8960e8cde658b"
|
||||
},
|
||||
{
|
||||
"amount": "155.03186111556",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
"tx": "0x7da34162df1b167ed5a3de6d98759af7100bcd51ec4e4c55abce2d145c98ba15"
|
||||
},
|
||||
{
|
||||
"amount": "60.16845949026",
|
||||
"user": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
|
||||
"tx": "0x5f8e8e83b18d0bc718c83a9afb0594e95a7b8ea2eea3d83cfbb770be317cfd70"
|
||||
},
|
||||
{
|
||||
"amount": "89.42266666476",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
"tx": "0x05d086879e23724f1397d41adcbe2f3316dd4039c240edbc3cbbcacf1ca1d00e"
|
||||
},
|
||||
{
|
||||
"amount": "52.2185023074",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
@@ -693,6 +798,36 @@
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "33"
|
||||
},
|
||||
{
|
||||
"address": "0xa8bdC133265C7Aab74eA1D00527925e47275D9Ad",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "24",
|
||||
"user": "0xa8bdC133265C7Aab74eA1D00527925e47275D9Ad",
|
||||
"tranche_id": 54,
|
||||
"tx": "0x8e2990dd83380f38f32cd3964e720e86b53a7a5d5f45adc4e0c012f5c0022101"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "24",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "24"
|
||||
},
|
||||
{
|
||||
"address": "0xfD181C18D0442cBbad1207110D09b5fCa8CC8218",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "114",
|
||||
"user": "0xfD181C18D0442cBbad1207110D09b5fCa8CC8218",
|
||||
"tranche_id": 54,
|
||||
"tx": "0xaa9cfb8f54f0d9066fe0ffaa6742acfb9626485a0497750e61e3d5dc925dfb37"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"total_tokens": "114",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "114"
|
||||
},
|
||||
{
|
||||
"address": "0xb5e340788922791727C240c33D27060157845291",
|
||||
"deposits": [
|
||||
@@ -839,6 +974,18 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "155.03186111556",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
"tranche_id": 54,
|
||||
"tx": "0x7da34162df1b167ed5a3de6d98759af7100bcd51ec4e4c55abce2d145c98ba15"
|
||||
},
|
||||
{
|
||||
"amount": "89.42266666476",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
"tranche_id": 54,
|
||||
"tx": "0x05d086879e23724f1397d41adcbe2f3316dd4039c240edbc3cbbcacf1ca1d00e"
|
||||
},
|
||||
{
|
||||
"amount": "52.2185023074",
|
||||
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
|
||||
@@ -847,8 +994,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "858",
|
||||
"withdrawn_tokens": "52.2185023074",
|
||||
"remaining_tokens": "805.7814976926"
|
||||
"withdrawn_tokens": "296.67303008772",
|
||||
"remaining_tokens": "561.32696991228"
|
||||
},
|
||||
{
|
||||
"address": "0x0bBf7580e036eA5D69ABe679CC90117EeC2e3dc1",
|
||||
@@ -875,10 +1022,17 @@
|
||||
"tx": "0x67855754e5b66b548c11d1c5377c8b7786d107d6064902318ba11dd6eb33b8d0"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "60.16845949026",
|
||||
"user": "0x15024E62134A8BFFCce11f5ce58CeCDe853038D7",
|
||||
"tranche_id": 54,
|
||||
"tx": "0x5f8e8e83b18d0bc718c83a9afb0594e95a7b8ea2eea3d83cfbb770be317cfd70"
|
||||
}
|
||||
],
|
||||
"total_tokens": "177",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "177"
|
||||
"withdrawn_tokens": "60.16845949026",
|
||||
"remaining_tokens": "116.83154050974"
|
||||
},
|
||||
{
|
||||
"address": "0xAc1c2783d64c29CDB79608f5B66a37Fd1ea35dD6",
|
||||
@@ -1158,7 +1312,7 @@
|
||||
"tranche_start": "2023-03-06T00:00:00.000Z",
|
||||
"tranche_end": "2023-04-06T00:00:00.000Z",
|
||||
"total_added": "14099",
|
||||
"total_removed": "2337.49002352036",
|
||||
"total_removed": "3112.49002352036",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
@@ -1958,6 +2112,16 @@
|
||||
"user": "0x4081455DB9Ec3B9b66f370Fa12161E6763c40779",
|
||||
"tx": "0xaf39ced29169a9e88e845cb6c069496920a0ad473b5bc4a0896df4154f51de10"
|
||||
},
|
||||
{
|
||||
"amount": "745",
|
||||
"user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730",
|
||||
"tx": "0x2db650d52bf11faa6981f557d876bf65b9a3f28861eec847f5d3aa6ee0089843"
|
||||
},
|
||||
{
|
||||
"amount": "30",
|
||||
"user": "0xd5BF378669d8ff4A3f65f577DDB55f2d7bb6f706",
|
||||
"tx": "0xcb0e4d8bc79d0a6dc08926fdf0fbc791cf78c93e6cfed2fdd7e6e27ffdb8e772"
|
||||
},
|
||||
{
|
||||
"amount": "19.9634296593",
|
||||
"user": "0x47e6217C1667e2B1fD177Ab8fD89037bCEC7dc6C",
|
||||
@@ -2664,10 +2828,17 @@
|
||||
"tx": "0x46d80a145d2f49ef3152cbfaa6d2bb054deabe21396ab43553a3f076e2db62e1"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "745",
|
||||
"user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730",
|
||||
"tranche_id": 53,
|
||||
"tx": "0x2db650d52bf11faa6981f557d876bf65b9a3f28861eec847f5d3aa6ee0089843"
|
||||
}
|
||||
],
|
||||
"total_tokens": "745",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "745"
|
||||
"withdrawn_tokens": "745",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
"address": "0xF3C6c37B9EBB4D21e8bf119841C0e0e296e3EA04",
|
||||
@@ -3865,10 +4036,17 @@
|
||||
"tx": "0x819f57b15fef080ab898405133d798a683e5fd805682901e160f5c0187c5fb16"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "30",
|
||||
"user": "0xd5BF378669d8ff4A3f65f577DDB55f2d7bb6f706",
|
||||
"tranche_id": 53,
|
||||
"tx": "0xcb0e4d8bc79d0a6dc08926fdf0fbc791cf78c93e6cfed2fdd7e6e27ffdb8e772"
|
||||
}
|
||||
],
|
||||
"total_tokens": "30",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "30"
|
||||
"withdrawn_tokens": "30",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
"address": "0xa7B28013389C4E74718Ca9d90fC2644aAf754A0e",
|
||||
@@ -4145,7 +4323,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "86666.297",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "56391.0711977615670123758",
|
||||
"locked_amount": "54788.2476184172999611065",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "86666.297",
|
||||
@@ -4211,7 +4389,7 @@
|
||||
"tranche_end": "2023-06-01T00:00:00.000Z",
|
||||
"total_added": "2500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "693.601349460724325",
|
||||
"locked_amount": "600.8763227513228",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2500",
|
||||
@@ -4332,7 +4510,7 @@
|
||||
"tranche_end": "2023-09-01T00:00:00.000Z",
|
||||
"total_added": "17500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "13552.43543050523525",
|
||||
"locked_amount": "12910.415408615137",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -4598,8 +4776,8 @@
|
||||
"tranche_start": "2023-02-01T00:00:00.000Z",
|
||||
"tranche_end": "2023-08-01T00:00:00.000Z",
|
||||
"total_added": "37500",
|
||||
"total_removed": "12043.9778043",
|
||||
"locked_amount": "23099.62256368938",
|
||||
"total_removed": "12294.731717775",
|
||||
"locked_amount": "21701.062768569675",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -4618,6 +4796,16 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xe12a6d600113d4db203454713340e902cb62aa16534dec0b8d42772868e9cfe7"
|
||||
},
|
||||
{
|
||||
"amount": "107.320442025",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x07414226f479239baa4081a211d749f54d8fe507067b1d3b122eb47bc69ff569"
|
||||
},
|
||||
{
|
||||
"amount": "143.43347145",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x2c8a0681fe27258861489cd7a891cf213c7ab930d86b1bf08cd54f2f3739a8b5"
|
||||
},
|
||||
{
|
||||
"amount": "158.943370125",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -4762,6 +4950,18 @@
|
||||
"tranche_id": 34,
|
||||
"tx": "0xe12a6d600113d4db203454713340e902cb62aa16534dec0b8d42772868e9cfe7"
|
||||
},
|
||||
{
|
||||
"amount": "107.320442025",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 34,
|
||||
"tx": "0x07414226f479239baa4081a211d749f54d8fe507067b1d3b122eb47bc69ff569"
|
||||
},
|
||||
{
|
||||
"amount": "143.43347145",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 34,
|
||||
"tx": "0x2c8a0681fe27258861489cd7a891cf213c7ab930d86b1bf08cd54f2f3739a8b5"
|
||||
},
|
||||
{
|
||||
"amount": "158.943370125",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -4902,8 +5102,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "7500",
|
||||
"withdrawn_tokens": "2808.5285259",
|
||||
"remaining_tokens": "4691.4714741"
|
||||
"withdrawn_tokens": "3059.282439375",
|
||||
"remaining_tokens": "4440.717560625"
|
||||
},
|
||||
{
|
||||
"address": "0x0B4e6fcE839B01ef43DA6F890FAC7B1Afb004600",
|
||||
@@ -4941,7 +5141,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "56339.6214406902552879735",
|
||||
"locked_amount": "54738.260236187147286555",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -4974,7 +5174,7 @@
|
||||
"tranche_end": "2024-04-01T00:00:00.000Z",
|
||||
"total_added": "54144.7663",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "52590.57158976900059334338",
|
||||
"locked_amount": "51591.9435766059257577711",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "54144.7663",
|
||||
@@ -5007,7 +5207,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "62600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "24781.74125443937238",
|
||||
"locked_amount": "23624.00451547437818",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10000",
|
||||
@@ -5200,7 +5400,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "2171.1531265854895",
|
||||
"locked_amount": "2078.6821410451545",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -5740,8 +5940,8 @@
|
||||
"tranche_start": "2022-11-01T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-01T00:00:00.000Z",
|
||||
"total_added": "22500",
|
||||
"total_removed": "6620.677467",
|
||||
"locked_amount": "2423.309449815838125",
|
||||
"total_removed": "6871.43713545",
|
||||
"locked_amount": "1584.173572744015575",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -5760,6 +5960,16 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x86d038a897c455e098af47a53ffd861a150c68058e75d84b9224d08061075cb2"
|
||||
},
|
||||
{
|
||||
"amount": "107.3146869",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xea8772c7ce65ecfdf87e34cf61b2614212c07d195a9e4d6962fcf758ba08c442"
|
||||
},
|
||||
{
|
||||
"amount": "143.44498155",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x15840e283faffb39a5d0e3389137ec92cec3deee7df535a534908ccd7d6b0873"
|
||||
},
|
||||
{
|
||||
"amount": "158.9433702",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -5959,6 +6169,18 @@
|
||||
"tranche_id": 33,
|
||||
"tx": "0x86d038a897c455e098af47a53ffd861a150c68058e75d84b9224d08061075cb2"
|
||||
},
|
||||
{
|
||||
"amount": "107.3146869",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 33,
|
||||
"tx": "0xea8772c7ce65ecfdf87e34cf61b2614212c07d195a9e4d6962fcf758ba08c442"
|
||||
},
|
||||
{
|
||||
"amount": "143.44498155",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 33,
|
||||
"tx": "0x15840e283faffb39a5d0e3389137ec92cec3deee7df535a534908ccd7d6b0873"
|
||||
},
|
||||
{
|
||||
"amount": "158.9433702",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -6177,8 +6399,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "7500",
|
||||
"withdrawn_tokens": "6620.677467",
|
||||
"remaining_tokens": "879.322533"
|
||||
"withdrawn_tokens": "6871.43713545",
|
||||
"remaining_tokens": "628.56286455"
|
||||
},
|
||||
{
|
||||
"address": "0x2539b51EbDE65a75672aBcfE9439a706a99D18D1",
|
||||
@@ -6203,7 +6425,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "928642.9598472029154",
|
||||
"locked_amount": "273684.9802027161627711476",
|
||||
"locked_amount": "237807.5623674632953210932",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -40019,7 +40241,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "715655.108029600523393",
|
||||
"locked_amount": "445059.852311308028722099718",
|
||||
"locked_amount": "389928.657761997798045454489",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -41411,8 +41633,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "831412.54318386417590352",
|
||||
"locked_amount": "6877841.24636301597211672882901606793565823",
|
||||
"total_removed": "834257.00587199386490352",
|
||||
"locked_amount": "6682349.57025217979014250580920627858799674",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -41936,6 +42158,36 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x7ca532bd40420cc601c90df506cc041676efc231f9e5822594d611c53de115d1"
|
||||
},
|
||||
{
|
||||
"amount": "673.3243709362775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x6c9a470f50be5317670260a9d3842614e4dc7f32e9c483582f3d1a8d992864d4"
|
||||
},
|
||||
{
|
||||
"amount": "564.068956625387125",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xb27dbf718e77796051638b35d898c62ffe6bbe0c2aed4e5adaf7cacbcfd1b17a"
|
||||
},
|
||||
{
|
||||
"amount": "404.86444883989775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x07d1c74ebc4f402882d688c06da30455c4890f66792149aa34dd5c5c7f4a5114"
|
||||
},
|
||||
{
|
||||
"amount": "673.58795260844725",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x1283a5378ec8e25b00c1260eae937285858c4f9ba689ac7c133e1a96602be122"
|
||||
},
|
||||
{
|
||||
"amount": "278.739682710677375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xd23bde9b41f3e73644f3e3bf69c25739dc721014516803de4e76724b9ccb6b76"
|
||||
},
|
||||
{
|
||||
"amount": "249.877276409002",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0x94df9afacf00f3d2a01e8856c83050a2737cd31f7736ae472bfbb3f19e66f5e4"
|
||||
},
|
||||
{
|
||||
"amount": "998.454771147362375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -43992,6 +44244,42 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0x7ca532bd40420cc601c90df506cc041676efc231f9e5822594d611c53de115d1"
|
||||
},
|
||||
{
|
||||
"amount": "673.3243709362775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x6c9a470f50be5317670260a9d3842614e4dc7f32e9c483582f3d1a8d992864d4"
|
||||
},
|
||||
{
|
||||
"amount": "564.068956625387125",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xb27dbf718e77796051638b35d898c62ffe6bbe0c2aed4e5adaf7cacbcfd1b17a"
|
||||
},
|
||||
{
|
||||
"amount": "404.86444883989775",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x07d1c74ebc4f402882d688c06da30455c4890f66792149aa34dd5c5c7f4a5114"
|
||||
},
|
||||
{
|
||||
"amount": "673.58795260844725",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x1283a5378ec8e25b00c1260eae937285858c4f9ba689ac7c133e1a96602be122"
|
||||
},
|
||||
{
|
||||
"amount": "278.739682710677375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xd23bde9b41f3e73644f3e3bf69c25739dc721014516803de4e76724b9ccb6b76"
|
||||
},
|
||||
{
|
||||
"amount": "249.877276409002",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x94df9afacf00f3d2a01e8856c83050a2737cd31f7736ae472bfbb3f19e66f5e4"
|
||||
},
|
||||
{
|
||||
"amount": "998.454771147362375",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -45428,8 +45716,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "259998.8875",
|
||||
"withdrawn_tokens": "147055.736929033255125",
|
||||
"remaining_tokens": "112943.150570966744875"
|
||||
"withdrawn_tokens": "149900.199617162944125",
|
||||
"remaining_tokens": "110098.687882837055875"
|
||||
},
|
||||
{
|
||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||
@@ -47780,8 +48068,8 @@
|
||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||
"total_added": "14597706.0446472999",
|
||||
"total_removed": "5824494.904776281619295136",
|
||||
"locked_amount": "628133.8969210297717459520010294846",
|
||||
"total_removed": "5844057.348231362114420626",
|
||||
"locked_amount": "447657.2297616420148104652270758603",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129284.449",
|
||||
@@ -48010,6 +48298,51 @@
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xeb3074f26ba5b01f54b2e34889b4832542b0269fa47fd5874d7f266a435da128"
|
||||
},
|
||||
{
|
||||
"amount": "934.07546498576643775",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x98bfad2d34e3a47b0487e1219456287f109dfb14658df5848c2f801247039314"
|
||||
},
|
||||
{
|
||||
"amount": "771.74274329335158625",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xca63b7531ec4b383cd6a69ed94313e68cac27f5af75b2ba1e6d5607f0f25810a"
|
||||
},
|
||||
{
|
||||
"amount": "570.76807052329924925",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x2825f014fc3902bc2e8f41823cee18aefa209a0763f9a5bafe6b6b5b956bf45a"
|
||||
},
|
||||
{
|
||||
"amount": "14990.57490287555017806",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
"tx": "0x0d970fd46e511e419ec9c040ac873302023b1f14ba66cda4efc9b76439569cba"
|
||||
},
|
||||
{
|
||||
"amount": "155.90688399188605818",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
"tx": "0x2830acf9d15cbaeaec3ad60506f4c6542a63ffbedeab7408f30adb495e8ec7cb"
|
||||
},
|
||||
{
|
||||
"amount": "933.80141068366436375",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x07fdd83f04929f7f0adba54f0af9c1cb4e266e430ed0188ca1f02b7b528f73be"
|
||||
},
|
||||
{
|
||||
"amount": "386.69353993983405875",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x3f8387f07e77c7734dc9fde19c9b0882c9192685f97be72c15f681e4be3f39ca"
|
||||
},
|
||||
{
|
||||
"amount": "346.2245518019684565",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0x467e16d3f10ba66de4ab7452682f50266a731200be9e036c9b35692e0d447572"
|
||||
},
|
||||
{
|
||||
"amount": "472.655886985174737",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xca4c0571969c50f47990b214485913df8e2b7d1d92cdd6ac4c8bcc6ce760ce0b"
|
||||
},
|
||||
{
|
||||
"amount": "37462.74710421168752574",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
@@ -51243,6 +51576,48 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0xeb3074f26ba5b01f54b2e34889b4832542b0269fa47fd5874d7f266a435da128"
|
||||
},
|
||||
{
|
||||
"amount": "934.07546498576643775",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x98bfad2d34e3a47b0487e1219456287f109dfb14658df5848c2f801247039314"
|
||||
},
|
||||
{
|
||||
"amount": "771.74274329335158625",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0xca63b7531ec4b383cd6a69ed94313e68cac27f5af75b2ba1e6d5607f0f25810a"
|
||||
},
|
||||
{
|
||||
"amount": "570.76807052329924925",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x2825f014fc3902bc2e8f41823cee18aefa209a0763f9a5bafe6b6b5b956bf45a"
|
||||
},
|
||||
{
|
||||
"amount": "933.80141068366436375",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x07fdd83f04929f7f0adba54f0af9c1cb4e266e430ed0188ca1f02b7b528f73be"
|
||||
},
|
||||
{
|
||||
"amount": "386.69353993983405875",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x3f8387f07e77c7734dc9fde19c9b0882c9192685f97be72c15f681e4be3f39ca"
|
||||
},
|
||||
{
|
||||
"amount": "346.2245518019684565",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x467e16d3f10ba66de4ab7452682f50266a731200be9e036c9b35692e0d447572"
|
||||
},
|
||||
{
|
||||
"amount": "472.655886985174737",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0xca4c0571969c50f47990b214485913df8e2b7d1d92cdd6ac4c8bcc6ce760ce0b"
|
||||
},
|
||||
{
|
||||
"amount": "1383.345213676043696",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -53981,8 +54356,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "359123.469575",
|
||||
"withdrawn_tokens": "343304.56277369828704375",
|
||||
"remaining_tokens": "15818.90680130171295625"
|
||||
"withdrawn_tokens": "347720.524441911345933",
|
||||
"remaining_tokens": "11402.945133088654067"
|
||||
},
|
||||
{
|
||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||
@@ -54218,6 +54593,18 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0xa22abf6f3db05a14a0c55fc053a05218f412ad15be9a022580b2ca99ed805bf7"
|
||||
},
|
||||
{
|
||||
"amount": "14990.57490287555017806",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x0d970fd46e511e419ec9c040ac873302023b1f14ba66cda4efc9b76439569cba"
|
||||
},
|
||||
{
|
||||
"amount": "155.90688399188605818",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
"tranche_id": 3,
|
||||
"tx": "0x2830acf9d15cbaeaec3ad60506f4c6542a63ffbedeab7408f30adb495e8ec7cb"
|
||||
},
|
||||
{
|
||||
"amount": "37462.74710421168752574",
|
||||
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||
@@ -54592,8 +54979,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "1266324.603486",
|
||||
"withdrawn_tokens": "1205672.9366923092797574",
|
||||
"remaining_tokens": "60651.6667936907202426"
|
||||
"withdrawn_tokens": "1220819.41847917671599364",
|
||||
"remaining_tokens": "45505.18500682328400636"
|
||||
},
|
||||
{
|
||||
"address": "0xC5d9221EB9c28A69859264c0A2Fe0d3272228296",
|
||||
@@ -55421,7 +55808,7 @@
|
||||
"tranche_start": "2021-10-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "5778205.3912159303",
|
||||
"total_removed": "3421590.665302980803025769",
|
||||
"total_removed": "3421810.610823310514313769",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
@@ -55566,6 +55953,11 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "219.945520329711288",
|
||||
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
||||
"tx": "0x4680e076a50f1fde4339e9edacd3bd4cb8fe3ce5a3b0a7cb7917f7ace67b537a"
|
||||
},
|
||||
{
|
||||
"amount": "10509.407528939748325",
|
||||
"user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75",
|
||||
@@ -57224,6 +57616,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "219.945520329711288",
|
||||
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
||||
"tranche_id": 4,
|
||||
"tx": "0x4680e076a50f1fde4339e9edacd3bd4cb8fe3ce5a3b0a7cb7917f7ace67b537a"
|
||||
},
|
||||
{
|
||||
"amount": "13312.213609122936225",
|
||||
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
||||
@@ -57490,8 +57888,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "331498.5873",
|
||||
"withdrawn_tokens": "331278.641779670288712",
|
||||
"remaining_tokens": "219.945520329711288"
|
||||
"withdrawn_tokens": "331498.5873",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
"address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77",
|
||||
@@ -57593,8 +57991,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "42362.8219648421949",
|
||||
"locked_amount": "70522.262691004502909998496803656",
|
||||
"total_removed": "43120.0853616251849",
|
||||
"locked_amount": "61786.424749621320244693540030452",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
@@ -64223,6 +64621,31 @@
|
||||
"user": "0xa9a677b0a3Be231C0654CabB0Eaa0A72E91B3E8d",
|
||||
"tx": "0xc0db5f216679203b937bf90415f24231997ea35bc1d418af30913aa313be498d"
|
||||
},
|
||||
{
|
||||
"amount": "45.503272452",
|
||||
"user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
|
||||
"tx": "0xd1d4724eae5566e3162c1b210a19d73f5a2e4b9b3d52d9d1e77c4b9cb9bdc2e1"
|
||||
},
|
||||
{
|
||||
"amount": "26.662404872",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
"tx": "0x7c02dcf328b3538b3c8cd11d19cb0d21859ebfdda209b30546358092870deb23"
|
||||
},
|
||||
{
|
||||
"amount": "343.420230844",
|
||||
"user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730",
|
||||
"tx": "0x53b7d1e71a9bc909cd594c4d62380ba31cd0d8687a5894ad62bfa48733e73174"
|
||||
},
|
||||
{
|
||||
"amount": "257.36242012299",
|
||||
"user": "0x07d1a589447395fe78bca3627Cb82F7C3310f598",
|
||||
"tx": "0x71bd2cf2152fd2175e3a63a2ba70ffc4db0d8d47c8feb493ae9de59c9164ffcf"
|
||||
},
|
||||
{
|
||||
"amount": "84.315068492",
|
||||
"user": "0x40447e8eDee2F8D0088844E35Ff7aD2Bb5fCabfb",
|
||||
"tx": "0x2aa7bdc96b05e86a7c689062112e932630e7e14b7f05534af1a5d140fc2a88c4"
|
||||
},
|
||||
{
|
||||
"amount": "19.918569252",
|
||||
"user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1",
|
||||
@@ -72969,10 +73392,17 @@
|
||||
"tx": "0x057f65938b1360b6d2c4ebf5e789c67897cf60cb6a13f947004def03891afbd8"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "257.36242012299",
|
||||
"user": "0x07d1a589447395fe78bca3627Cb82F7C3310f598",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x71bd2cf2152fd2175e3a63a2ba70ffc4db0d8d47c8feb493ae9de59c9164ffcf"
|
||||
}
|
||||
],
|
||||
"total_tokens": "299",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "299"
|
||||
"withdrawn_tokens": "257.36242012299",
|
||||
"remaining_tokens": "41.63757987701"
|
||||
},
|
||||
{
|
||||
"address": "0xA257E4Fcf635a1ba1BA32C6f063a3037f1741453",
|
||||
@@ -75813,6 +76243,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "84.315068492",
|
||||
"user": "0x40447e8eDee2F8D0088844E35Ff7aD2Bb5fCabfb",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x2aa7bdc96b05e86a7c689062112e932630e7e14b7f05534af1a5d140fc2a88c4"
|
||||
},
|
||||
{
|
||||
"amount": "89.067954084",
|
||||
"user": "0x40447e8eDee2F8D0088844E35Ff7aD2Bb5fCabfb",
|
||||
@@ -75821,8 +76257,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "200",
|
||||
"withdrawn_tokens": "89.067954084",
|
||||
"remaining_tokens": "110.932045916"
|
||||
"withdrawn_tokens": "173.383022576",
|
||||
"remaining_tokens": "26.616977424"
|
||||
},
|
||||
{
|
||||
"address": "0x1bAc2912394A42Cec87767327FC039f2EfBB95Dd",
|
||||
@@ -78183,6 +78619,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "26.662404872",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x7c02dcf328b3538b3c8cd11d19cb0d21859ebfdda209b30546358092870deb23"
|
||||
},
|
||||
{
|
||||
"amount": "15.02267884",
|
||||
"user": "0x4eD2b3c68BB4fda084ce1591a210F4aC8b71234A",
|
||||
@@ -78281,8 +78723,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "400",
|
||||
"withdrawn_tokens": "316.228754436",
|
||||
"remaining_tokens": "83.771245564"
|
||||
"withdrawn_tokens": "342.891159308",
|
||||
"remaining_tokens": "57.108840692"
|
||||
},
|
||||
{
|
||||
"address": "0x5c90765F50629570738fEe7b7FA82ae118f81Ed1",
|
||||
@@ -79438,10 +79880,17 @@
|
||||
"tx": "0x9f916cf09e8a3c4ade0ffce5190db464d0a2b1dadba78e1ee7ba5d6e751d6148"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "343.420230844",
|
||||
"user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730",
|
||||
"tranche_id": 5,
|
||||
"tx": "0x53b7d1e71a9bc909cd594c4d62380ba31cd0d8687a5894ad62bfa48733e73174"
|
||||
}
|
||||
],
|
||||
"total_tokens": "400",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "400"
|
||||
"withdrawn_tokens": "343.420230844",
|
||||
"remaining_tokens": "56.579769156"
|
||||
},
|
||||
{
|
||||
"address": "0x5f59907Ef66f016aE218Db5CE06917Ed6a87F02D",
|
||||
@@ -81339,6 +81788,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "45.503272452",
|
||||
"user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
|
||||
"tranche_id": 5,
|
||||
"tx": "0xd1d4724eae5566e3162c1b210a19d73f5a2e4b9b3d52d9d1e77c4b9cb9bdc2e1"
|
||||
},
|
||||
{
|
||||
"amount": "47.970776254",
|
||||
"user": "0x9347177014d3fEA775b5B29fFC96bF6B911686F9",
|
||||
@@ -81353,8 +81808,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "200",
|
||||
"withdrawn_tokens": "125.533250886",
|
||||
"remaining_tokens": "74.466749114"
|
||||
"withdrawn_tokens": "171.036523338",
|
||||
"remaining_tokens": "28.963476662"
|
||||
},
|
||||
{
|
||||
"address": "0x1a268a88b586B475FF4bD86882bF2f9D79875964",
|
||||
@@ -87223,7 +87678,7 @@
|
||||
"tranche_start": "2021-12-05T00:00:00.000Z",
|
||||
"tranche_end": "2022-06-05T00:00:00.000Z",
|
||||
"total_added": "171288.42",
|
||||
"total_removed": "69140.5995794947989",
|
||||
"total_removed": "69390.5995794947989",
|
||||
"locked_amount": "0",
|
||||
"deposits": [
|
||||
{
|
||||
@@ -91458,6 +91913,11 @@
|
||||
"user": "0xC1991C8BDA29507991EEB230FF2063C2eA74a34C",
|
||||
"tx": "0x71a163020ce928ca230a50c099b8baaf60af6191d6cbc46edc004239d3ff9901"
|
||||
},
|
||||
{
|
||||
"amount": "250",
|
||||
"user": "0x0715B8bA27dB75F7601A9D8E22c15dcA1487FB70",
|
||||
"tx": "0x11c685c41ff0c2d5f1d7fe3b08dc84a7ddb9160764a45bc61b8f39df94729634"
|
||||
},
|
||||
{
|
||||
"amount": "1250",
|
||||
"user": "0x9405F540EcC1204801De5C4444D06386BD6693F0",
|
||||
@@ -100279,10 +100739,17 @@
|
||||
"tx": "0x057f65938b1360b6d2c4ebf5e789c67897cf60cb6a13f947004def03891afbd8"
|
||||
}
|
||||
],
|
||||
"withdrawals": [],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "250",
|
||||
"user": "0x0715B8bA27dB75F7601A9D8E22c15dcA1487FB70",
|
||||
"tranche_id": 6,
|
||||
"tx": "0x11c685c41ff0c2d5f1d7fe3b08dc84a7ddb9160764a45bc61b8f39df94729634"
|
||||
}
|
||||
],
|
||||
"total_tokens": "250",
|
||||
"withdrawn_tokens": "0",
|
||||
"remaining_tokens": "250"
|
||||
"withdrawn_tokens": "250",
|
||||
"remaining_tokens": "0"
|
||||
},
|
||||
{
|
||||
"address": "0x027306C886Da27fa29Ce9B4DB489C6E44d2ECc55",
|
||||
@@ -142717,6 +143184,21 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tx": "0x882126a437003e60226611d623415bf2e00befa69d76aba57fd4cf1c5b403d1f"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tx": "0xf4cdc0b0f6c24cb52dd0126bc6bff9c75ec715502809f9c80d675327beb4889d"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tx": "0x11aafa8a2fb510a50d52e5d1e149c5c2027ad2c3dc2d9ef67c18d391c0331c49"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
@@ -142987,6 +143469,24 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tranche_id": 9,
|
||||
"tx": "0x882126a437003e60226611d623415bf2e00befa69d76aba57fd4cf1c5b403d1f"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tranche_id": 9,
|
||||
"tx": "0xf4cdc0b0f6c24cb52dd0126bc6bff9c75ec715502809f9c80d675327beb4889d"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
"tranche_id": 9,
|
||||
"tx": "0x11aafa8a2fb510a50d52e5d1e149c5c2027ad2c3dc2d9ef67c18d391c0331c49"
|
||||
},
|
||||
{
|
||||
"amount": "0",
|
||||
"user": "0x759C9ABABA492500c4c730bEB568B5b851Dec2c7",
|
||||
|
||||
@@ -41,6 +41,12 @@ describe('accounts', { tags: '@smoke' }, () => {
|
||||
.should('have.text', '100,001.01');
|
||||
});
|
||||
|
||||
it('asset detail should be properly rendered', () => {
|
||||
cy.getByTestId('Collateral').click();
|
||||
cy.getByTestId('asset').contains('tEURO').click();
|
||||
cy.get('[data-testid$="_label"]').should('have.length', 16);
|
||||
});
|
||||
|
||||
describe('sorting by ag-grid columns should work well', () => {
|
||||
it('sorting by asset', () => {
|
||||
cy.getByTestId('Collateral').click();
|
||||
|
||||
@@ -29,7 +29,10 @@ import { LiquidityContainer } from '../liquidity/liquidity';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import type { PinnedAsset } from '@vegaprotocol/accounts';
|
||||
import { useScreenDimensions } from '@vegaprotocol/react-helpers';
|
||||
import { useMarketClickHandler } from '../../lib/hooks/use-market-click-handler';
|
||||
import {
|
||||
useMarketClickHandler,
|
||||
useMarketLiquidityClickHandler,
|
||||
} from '../../lib/hooks/use-market-click-handler';
|
||||
|
||||
type MarketDependantView =
|
||||
| typeof CandlesChartContainer
|
||||
@@ -79,6 +82,7 @@ const MarketBottomPanel = memo(
|
||||
({ marketId, pinnedAsset }: BottomPanelProps) => {
|
||||
const { screenSize } = useScreenDimensions();
|
||||
const onMarketClick = useMarketClickHandler(true);
|
||||
const onOrderTypeClick = useMarketLiquidityClickHandler(true);
|
||||
|
||||
return 'xxxl' === screenSize ? (
|
||||
<ResizableGrid proportionalLayout minSize={200}>
|
||||
@@ -94,6 +98,7 @@ const MarketBottomPanel = memo(
|
||||
<TradingViews.Orders
|
||||
marketId={marketId}
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
enforceBottomPlaceholder
|
||||
/>
|
||||
</VegaWalletContainer>
|
||||
@@ -150,6 +155,7 @@ const MarketBottomPanel = memo(
|
||||
<TradingViews.Orders
|
||||
marketId={marketId}
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
enforceBottomPlaceholder
|
||||
/>
|
||||
</VegaWalletContainer>
|
||||
@@ -293,6 +299,7 @@ interface TradePanelsProps {
|
||||
market: Market | null;
|
||||
onSelect: (marketId: string, metaKey?: boolean) => void;
|
||||
onMarketClick?: (marketId: string) => void;
|
||||
onOrderTypeClick?: (marketId: string) => void;
|
||||
onClickCollateral: () => void;
|
||||
pinnedAsset?: PinnedAsset;
|
||||
}
|
||||
@@ -303,12 +310,16 @@ export const TradePanels = ({
|
||||
onClickCollateral,
|
||||
pinnedAsset,
|
||||
}: TradePanelsProps) => {
|
||||
const onMarketClick = useMarketClickHandler(true);
|
||||
const onOrderTypeClick = useMarketLiquidityClickHandler(true);
|
||||
|
||||
const [view, setView] = useState<TradingView>('Candles');
|
||||
const renderView = () => {
|
||||
const Component = memo<{
|
||||
marketId: string;
|
||||
onSelect: (marketId: string, metaKey?: boolean) => void;
|
||||
onMarketClick?: (marketId: string) => void;
|
||||
onOrderTypeClick?: (marketId: string) => void;
|
||||
onClickCollateral: () => void;
|
||||
pinnedAsset?: PinnedAsset;
|
||||
}>(TradingViews[view]);
|
||||
@@ -325,6 +336,8 @@ export const TradePanels = ({
|
||||
onSelect={onSelect}
|
||||
onClickCollateral={onClickCollateral}
|
||||
pinnedAsset={pinnedAsset}
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -19,7 +19,10 @@ import { usePageTitleStore } from '../../stores';
|
||||
import { LedgerContainer } from '@vegaprotocol/ledger';
|
||||
import { AccountsContainer } from '../../components/accounts-container';
|
||||
import { AccountHistoryContainer } from './account-history-container';
|
||||
import { useMarketClickHandler } from '../../lib/hooks/use-market-click-handler';
|
||||
import {
|
||||
useMarketClickHandler,
|
||||
useMarketLiquidityClickHandler,
|
||||
} from '../../lib/hooks/use-market-click-handler';
|
||||
|
||||
export const Portfolio = () => {
|
||||
const { updateTitle } = usePageTitleStore((store) => ({
|
||||
@@ -31,6 +34,7 @@ export const Portfolio = () => {
|
||||
}, [updateTitle]);
|
||||
|
||||
const onMarketClick = useMarketClickHandler(true);
|
||||
const onOrderTypeClick = useMarketLiquidityClickHandler(true);
|
||||
|
||||
const wrapperClasses = 'h-full max-h-full flex flex-col';
|
||||
return (
|
||||
@@ -54,7 +58,10 @@ export const Portfolio = () => {
|
||||
</Tab>
|
||||
<Tab id="orders" name={t('Orders')}>
|
||||
<VegaWalletContainer>
|
||||
<OrderListContainer onMarketClick={onMarketClick} />
|
||||
<OrderListContainer
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
/>
|
||||
</VegaWalletContainer>
|
||||
</Tab>
|
||||
<Tab id="fills" name={t('Fills')}>
|
||||
|
||||
@@ -19,3 +19,21 @@ export const useMarketClickHandler = (replace = false) => {
|
||||
[navigate, marketId, replace, isMarketPage]
|
||||
);
|
||||
};
|
||||
|
||||
export const useMarketLiquidityClickHandler = (replace = false) => {
|
||||
const navigate = useNavigate();
|
||||
const { marketId } = useParams();
|
||||
const { pathname } = useLocation();
|
||||
const isLiquidityPage = pathname.match(/^\/liquidity\/(.+)/);
|
||||
return useCallback(
|
||||
(selectedId: string, metaKey?: boolean) => {
|
||||
const link = Links[Routes.LIQUIDITY](selectedId);
|
||||
if (metaKey) {
|
||||
window.open(`/#${link}`, '_blank');
|
||||
} else if (selectedId !== marketId || !isLiquidityPage) {
|
||||
navigate(link, { replace });
|
||||
}
|
||||
},
|
||||
[navigate, marketId, replace, isLiquidityPage]
|
||||
);
|
||||
};
|
||||
|
||||
@@ -7,7 +7,11 @@ import {
|
||||
} from '@vegaprotocol/types';
|
||||
import type { VegaStoredTxState } from '@vegaprotocol/wallet';
|
||||
import { VegaTxStatus } from '@vegaprotocol/wallet';
|
||||
import { VegaTransactionDetails } from './use-vega-transaction-toasts';
|
||||
import {
|
||||
VegaTransactionDetails,
|
||||
getVegaTransactionContentIntent,
|
||||
} from './use-vega-transaction-toasts';
|
||||
import { Intent } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
jest.mock('@vegaprotocol/assets', () => {
|
||||
const A1 = {
|
||||
@@ -278,3 +282,27 @@ describe('VegaTransactionDetails', () => {
|
||||
expect(queryByTestId('toast-panel')?.textContent).toEqual(details);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getVegaTransactionContentIntent', () => {
|
||||
it('returns the correct intent for a transaction', () => {
|
||||
expect(getVegaTransactionContentIntent(withdraw).intent).toBe(
|
||||
Intent.Primary
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(submitOrder).intent).toBe(
|
||||
Intent.Success
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(editOrder).intent).toBe(
|
||||
Intent.Primary
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(cancelOrder).intent).toBe(
|
||||
Intent.Primary
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(cancelAll).intent).toBe(
|
||||
Intent.Primary
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(closePosition).intent).toBe(
|
||||
Intent.Primary
|
||||
);
|
||||
expect(getVegaTransactionContentIntent(batch).intent).toBe(Intent.Primary);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -547,7 +547,11 @@ const VegaTxCompleteToastsContent = ({ tx }: VegaTxToastContentProps) => {
|
||||
|
||||
return (
|
||||
<>
|
||||
<ToastHeading>{t('Confirmed')}</ToastHeading>
|
||||
<ToastHeading>
|
||||
{tx.order?.status
|
||||
? getOrderToastTitle(tx.order.status)
|
||||
: t('Confirmed')}
|
||||
</ToastHeading>
|
||||
<p>{t('Your transaction has been confirmed ')}</p>
|
||||
{tx.txHash && (
|
||||
<p className="break-all">
|
||||
@@ -634,25 +638,8 @@ export const useVegaTransactionToasts = () => {
|
||||
);
|
||||
|
||||
const fromVegaTransaction = (tx: VegaStoredTxState): Toast => {
|
||||
let content: ToastContent;
|
||||
const closeAfter = isFinal(tx) ? CLOSE_AFTER : undefined;
|
||||
if (tx.status === VegaTxStatus.Requested) {
|
||||
content = <VegaTxRequestedToastContent tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Pending) {
|
||||
content = <VegaTxPendingToastContentProps tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Complete) {
|
||||
content = <VegaTxCompleteToastsContent tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Error) {
|
||||
content = <VegaTxErrorToastContent tx={tx} />;
|
||||
}
|
||||
|
||||
// Transaction can be successful but the order can be rejected by the network
|
||||
const intent =
|
||||
(tx.order && getOrderToastIntent(tx.order.status)) ||
|
||||
intentMap[tx.status];
|
||||
const { intent, content } = getVegaTransactionContentIntent(tx);
|
||||
|
||||
return {
|
||||
id: `vega-${tx.id}`,
|
||||
@@ -676,3 +663,27 @@ export const useVegaTransactionToasts = () => {
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
export const getVegaTransactionContentIntent = (tx: VegaStoredTxState) => {
|
||||
let content: ToastContent;
|
||||
if (tx.status === VegaTxStatus.Requested) {
|
||||
content = <VegaTxRequestedToastContent tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Pending) {
|
||||
content = <VegaTxPendingToastContentProps tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Complete) {
|
||||
content = <VegaTxCompleteToastsContent tx={tx} />;
|
||||
}
|
||||
if (tx.status === VegaTxStatus.Error) {
|
||||
content = <VegaTxErrorToastContent tx={tx} />;
|
||||
}
|
||||
|
||||
// Transaction can be successful but the order can be rejected by the network
|
||||
const intent =
|
||||
(tx.order &&
|
||||
!isOrderAmendmentTransaction(tx.body) &&
|
||||
getOrderToastIntent(tx.order.status)) ||
|
||||
intentMap[tx.status];
|
||||
return { intent, content };
|
||||
};
|
||||
|
||||
@@ -33,6 +33,8 @@ import { ViewingBanner } from '../components/viewing-banner';
|
||||
import { Banner } from '../components/banner';
|
||||
import { AppLoader, DynamicLoader } from '../components/app-loader';
|
||||
import { Navbar } from '../components/navbar';
|
||||
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||
import { activeOrdersProvider } from '@vegaprotocol/orders';
|
||||
|
||||
const DEFAULT_TITLE = t('Welcome to Vega trading!');
|
||||
|
||||
@@ -95,6 +97,7 @@ function AppBody({ Component }: AppProps) {
|
||||
<ToastsManager />
|
||||
<InitializeHandlers />
|
||||
<MaybeConnectEagerly />
|
||||
<PartyData />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -127,6 +130,18 @@ function VegaTradingApp(props: AppProps) {
|
||||
|
||||
export default VegaTradingApp;
|
||||
|
||||
const PartyData = () => {
|
||||
const { pubKey } = useVegaWallet();
|
||||
const variables = { partyId: pubKey || '' };
|
||||
const skip = !pubKey;
|
||||
useDataProvider({
|
||||
dataProvider: activeOrdersProvider,
|
||||
variables,
|
||||
skip,
|
||||
});
|
||||
return null;
|
||||
};
|
||||
|
||||
const MaybeConnectEagerly = () => {
|
||||
useVegaEagerConnect(Connectors);
|
||||
useEthereumEagerConnect();
|
||||
|
||||
@@ -31,7 +31,7 @@ export enum Routes {
|
||||
MARKET = '/markets',
|
||||
MARKETS = '/markets/all',
|
||||
PORTFOLIO = '/portfolio',
|
||||
LIQUIDITY = 'liquidity/:marketId',
|
||||
LIQUIDITY = '/liquidity',
|
||||
}
|
||||
|
||||
type ConsoleLinks = { [r in Routes]: (...args: string[]) => string };
|
||||
@@ -41,8 +41,10 @@ export const Links: ConsoleLinks = {
|
||||
marketId ? trimEnd(`${Routes.MARKET}/${marketId}`, '/') : Routes.MARKET,
|
||||
[Routes.MARKETS]: () => Routes.MARKETS,
|
||||
[Routes.PORTFOLIO]: () => Routes.PORTFOLIO,
|
||||
[Routes.LIQUIDITY]: (marketId: string) =>
|
||||
Routes.LIQUIDITY.replace(':marketId', marketId),
|
||||
[Routes.LIQUIDITY]: (marketId: string | null | undefined) =>
|
||||
marketId
|
||||
? trimEnd(`${Routes.LIQUIDITY}/${marketId}`, '/')
|
||||
: Routes.LIQUIDITY,
|
||||
};
|
||||
|
||||
const routerConfig: RouteObject[] = [
|
||||
@@ -70,6 +72,16 @@ const routerConfig: RouteObject[] = [
|
||||
{
|
||||
path: Routes.LIQUIDITY,
|
||||
element: <LazyLiquidity />,
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <LazyLiquidity />,
|
||||
},
|
||||
{
|
||||
path: ':marketId',
|
||||
element: <LazyLiquidity />,
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
path: Routes.PORTFOLIO,
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a116c34cc7241532d0d94198fb2c9629
|
||||
EXPOSE 80
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY ./dist-result/ /usr/share/nginx/html/
|
||||
@@ -5,7 +5,9 @@ export PATH="/app/node_modules/.bin:$PATH"
|
||||
flags="--network-timeout 100000 --pure-lockfile"
|
||||
|
||||
if [[ ! -z "${ENV_NAME}" ]]; then
|
||||
flags="--env=${ENV_NAME} $flags"
|
||||
if [[ "${ENV_NAME}" != "ops-vega" ]]; then
|
||||
flags="--env=${ENV_NAME} $flags"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${APP}" = "trading" ]; then
|
||||
@@ -16,7 +18,3 @@ if [ "${APP}" = "trading" ]; then
|
||||
else
|
||||
yarn nx build ${APP} $flags
|
||||
fi
|
||||
|
||||
env_vars_file="/app/dist/apps/${APP}/.env"
|
||||
# make sure there are no exposed .env files
|
||||
rm $env_vars_file || echo "No env vars file"
|
||||
@@ -13,7 +13,7 @@ RUN apk add --update --no-cache \
|
||||
COPY . ./
|
||||
RUN yarn --network-timeout 100000 --pure-lockfile
|
||||
# work around for different build process in trading
|
||||
RUN sh ./docker-build.sh
|
||||
RUN sh docker/docker-build.sh
|
||||
|
||||
# Server environment
|
||||
# if this fails you need to docker pull nginx:1.23-alpine and pin new SHA
|
||||
@@ -23,6 +23,7 @@ FROM --platform=amd64 nginx:1.23-alpine@sha256:6318314189b40e73145a48060bff4783a
|
||||
EXPOSE 80
|
||||
# Copy dist
|
||||
WORKDIR /usr/share/nginx/html
|
||||
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist/apps/${APP} /usr/share/nginx/html
|
||||
RUN apk add --no-cache go-ipfs; ipfs init && echo "$(ipfs add -rQ .)" > ipfs-hash; apk del go-ipfs
|
||||
COPY docker/nginx.conf /etc/nginx/conf.d/default.conf
|
||||
RUN rm -rf /usr/share/nginx/html/*
|
||||
COPY --from=build /app/dist/apps/${APP}/* /usr/share/nginx/html
|
||||
RUN apk add --no-cache go-ipfs; ipfs init && echo "$(ipfs add -rQ .)" > /ipfs-hash; apk del go-ipfs
|
||||
@@ -1,8 +1,25 @@
|
||||
fragment AssetListFields on Asset {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
decimals
|
||||
quantum
|
||||
source {
|
||||
__typename
|
||||
... on ERC20 {
|
||||
contractAddress
|
||||
lifetimeLimit
|
||||
withdrawThreshold
|
||||
}
|
||||
}
|
||||
status
|
||||
}
|
||||
|
||||
query Assets {
|
||||
assetsConnection {
|
||||
edges {
|
||||
node {
|
||||
...AssetFields
|
||||
...AssetListFields
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-5
@@ -1,26 +1,44 @@
|
||||
import * as Types from '@vegaprotocol/types';
|
||||
|
||||
import { gql } from '@apollo/client';
|
||||
import { AssetFieldsFragmentDoc } from './Asset';
|
||||
import * as Apollo from '@apollo/client';
|
||||
const defaultOptions = {} as const;
|
||||
export type AssetListFieldsFragment = { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } };
|
||||
|
||||
export type AssetsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type AssetsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', balance: string } | null, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null, takerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, makerFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, lpFeeRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null, marketProposerRewardAccount?: { __typename?: 'AccountBalance', balance: string } | null } } | null> | null } | null };
|
||||
|
||||
export type AssetsQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string, status: Types.AssetStatus, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } } | null> | null } | null };
|
||||
|
||||
export const AssetListFieldsFragmentDoc = gql`
|
||||
fragment AssetListFields on Asset {
|
||||
id
|
||||
name
|
||||
symbol
|
||||
decimals
|
||||
quantum
|
||||
source {
|
||||
__typename
|
||||
... on ERC20 {
|
||||
contractAddress
|
||||
lifetimeLimit
|
||||
withdrawThreshold
|
||||
}
|
||||
}
|
||||
status
|
||||
}
|
||||
`;
|
||||
export const AssetsDocument = gql`
|
||||
query Assets {
|
||||
assetsConnection {
|
||||
edges {
|
||||
node {
|
||||
...AssetFields
|
||||
...AssetListFields
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
${AssetFieldsFragmentDoc}`;
|
||||
${AssetListFieldsFragmentDoc}`;
|
||||
|
||||
/**
|
||||
* __useAssetsQuery__
|
||||
|
||||
@@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
import { AssetDetailsDialog } from './asset-details-dialog';
|
||||
import { AssetDetail, testId } from './asset-details-table';
|
||||
import { AssetsDocument } from './__generated__/Assets';
|
||||
import { AssetDocument } from './__generated__/Asset';
|
||||
import { generateBuiltinAsset, generateERC20Asset } from './test-helpers';
|
||||
|
||||
const mockedData = {
|
||||
@@ -39,15 +39,17 @@ const mockedData = {
|
||||
},
|
||||
};
|
||||
|
||||
const mocks = [
|
||||
{
|
||||
request: {
|
||||
query: AssetsDocument,
|
||||
variables: {},
|
||||
},
|
||||
result: mockedData,
|
||||
const mocks = mockedData.data.assetsConnection.edges.map((mock) => ({
|
||||
request: {
|
||||
query: AssetDocument,
|
||||
variables: { assetId: mock.node.id },
|
||||
},
|
||||
];
|
||||
result: {
|
||||
data: {
|
||||
assetsConnection: { edges: [mock] },
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
const WrappedAssetDetailsDialog = ({ assetId }: { assetId: string }) => (
|
||||
<MockedProvider mocks={mocks}>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useAssetsDataProvider } from './assets-data-provider';
|
||||
import {
|
||||
Button,
|
||||
Dialog,
|
||||
@@ -10,6 +9,7 @@ import {
|
||||
import { create } from 'zustand';
|
||||
import { AssetDetailsTable } from './asset-details-table';
|
||||
import { AssetProposalNotification } from '@vegaprotocol/proposals';
|
||||
import { useAssetDataProvider } from './asset-data-provider';
|
||||
|
||||
export type AssetDetailsDialogStore = {
|
||||
isOpen: boolean;
|
||||
@@ -55,9 +55,8 @@ export const AssetDetailsDialog = ({
|
||||
onChange,
|
||||
asJson = false,
|
||||
}: AssetDetailsDialogProps) => {
|
||||
const { data } = useAssetsDataProvider();
|
||||
const { data: asset } = useAssetDataProvider(assetId);
|
||||
|
||||
const asset = data?.find((a) => a.id === assetId);
|
||||
const assetSymbol = asset?.symbol || '';
|
||||
|
||||
const content = asset ? (
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import type { ReactNode } from 'react';
|
||||
import type { Asset } from './asset-data-provider';
|
||||
import { WITHDRAW_THRESHOLD_TOOLTIP_TEXT } from './constants';
|
||||
|
||||
type Rows = {
|
||||
key: AssetDetail;
|
||||
@@ -121,9 +122,7 @@ export const rows: Rows = [
|
||||
{
|
||||
key: AssetDetail.WITHDRAWAL_THRESHOLD,
|
||||
label: t('Withdrawal threshold'),
|
||||
tooltip: t(
|
||||
'The maximum you can withdraw instantly. There’s no limit on the size of a withdrawal, but all withdrawals over the threshold will have a delay time added to them'
|
||||
),
|
||||
tooltip: WITHDRAW_THRESHOLD_TOOLTIP_TEXT,
|
||||
value: (asset) =>
|
||||
num(asset, (asset.source as Schema.ERC20).withdrawThreshold),
|
||||
},
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import merge from 'lodash/merge';
|
||||
import type { AssetsQuery } from './__generated__/Assets';
|
||||
import type {
|
||||
AssetsQuery,
|
||||
AssetListFieldsFragment,
|
||||
} from './__generated__/Assets';
|
||||
import * as Types from '@vegaprotocol/types';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type { AssetFieldsFragment } from './__generated__/Asset';
|
||||
|
||||
export const assetsQuery = (
|
||||
override?: PartialDeep<AssetsQuery>
|
||||
@@ -18,7 +20,7 @@ export const assetsQuery = (
|
||||
return merge(defaultAssets, override);
|
||||
};
|
||||
|
||||
const assetFields: AssetFieldsFragment[] = [
|
||||
const assetFields: AssetListFieldsFragment[] = [
|
||||
{
|
||||
__typename: 'Asset',
|
||||
id: 'asset-id',
|
||||
@@ -33,30 +35,6 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
},
|
||||
quantum: '1',
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Asset',
|
||||
@@ -72,30 +50,6 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
},
|
||||
quantum: '1',
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Asset',
|
||||
@@ -104,20 +58,10 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
decimals: 5,
|
||||
name: 'Asto',
|
||||
source: {
|
||||
maxFaucetAmountMint: '5000000000',
|
||||
__typename: 'BuiltinAsset',
|
||||
},
|
||||
quantum: '1',
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '0',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: null,
|
||||
takerFeeRewardAccount: null,
|
||||
makerFeeRewardAccount: null,
|
||||
lpFeeRewardAccount: null,
|
||||
marketProposerRewardAccount: null,
|
||||
},
|
||||
{
|
||||
__typename: 'Asset',
|
||||
@@ -126,20 +70,10 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
decimals: 5,
|
||||
name: 'tBTC TEST',
|
||||
source: {
|
||||
maxFaucetAmountMint: '5000000000',
|
||||
__typename: 'BuiltinAsset',
|
||||
},
|
||||
quantum: '1',
|
||||
status: Types.AssetStatus.STATUS_ENABLED,
|
||||
infrastructureFeeAccount: {
|
||||
balance: '0',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: null,
|
||||
takerFeeRewardAccount: null,
|
||||
makerFeeRewardAccount: null,
|
||||
lpFeeRewardAccount: null,
|
||||
marketProposerRewardAccount: null,
|
||||
},
|
||||
// NOTE: These assets ids and contract addresses are real assets on Sepolia, this is needed
|
||||
// because we don't currently mock our seplia infura provider. If we change network these will
|
||||
@@ -158,30 +92,6 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
__typename: 'ERC20',
|
||||
},
|
||||
quantum: '1',
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
},
|
||||
{
|
||||
__typename: 'Asset',
|
||||
@@ -197,29 +107,5 @@ const assetFields: AssetFieldsFragment[] = [
|
||||
__typename: 'ERC20',
|
||||
},
|
||||
quantum: '1',
|
||||
infrastructureFeeAccount: {
|
||||
balance: '1',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
globalRewardPoolAccount: {
|
||||
balance: '2',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
takerFeeRewardAccount: {
|
||||
balance: '3',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
makerFeeRewardAccount: {
|
||||
balance: '4',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
lpFeeRewardAccount: {
|
||||
balance: '5',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
marketProposerRewardAccount: {
|
||||
balance: '6',
|
||||
__typename: 'AccountBalance',
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
export const WITHDRAW_THRESHOLD_TOOLTIP_TEXT = t(
|
||||
"The maximum you can withdraw instantly. There's no limit on the size of a withdrawal, but all withdrawals over the threshold will have a delay time added to them"
|
||||
);
|
||||
@@ -5,3 +5,4 @@ export * from './assets-data-provider';
|
||||
export * from './asset-details-dialog';
|
||||
export * from './asset-details-table';
|
||||
export * from './asset-option';
|
||||
export * from './constants';
|
||||
|
||||
@@ -10,6 +10,7 @@ export * from './lib/cells/price-flash-cell';
|
||||
export * from './lib/cells/vol-cell';
|
||||
export * from './lib/cells/centered-grid-cell';
|
||||
export * from './lib/cells/market-name-cell';
|
||||
export * from './lib/cells/order-type-cell';
|
||||
|
||||
export * from './lib/filters/date-range-filter';
|
||||
export * from './lib/filters/set-filter';
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import type { MouseEvent } from 'react';
|
||||
import { useMemo } from 'react';
|
||||
import { useCallback } from 'react';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
|
||||
interface OrderTypeCellProps {
|
||||
value?: Schema.OrderType;
|
||||
data?: Schema.Order;
|
||||
onClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
}
|
||||
|
||||
export const OrderTypeCell = ({
|
||||
value,
|
||||
data: order,
|
||||
onClick,
|
||||
}: OrderTypeCellProps) => {
|
||||
const id = order ? order.market.id : '';
|
||||
|
||||
const label = useMemo(() => {
|
||||
if (!order) {
|
||||
return undefined;
|
||||
}
|
||||
if (!value) return '-';
|
||||
if (order?.peggedOrder) {
|
||||
return t('Pegged');
|
||||
}
|
||||
if (order?.liquidityProvision) {
|
||||
return t('Liquidity provision');
|
||||
}
|
||||
return Schema.OrderTypeMapping[value];
|
||||
}, [order, value]);
|
||||
|
||||
const handleOnClick = useCallback(
|
||||
(ev: MouseEvent<HTMLButtonElement>) => {
|
||||
ev.preventDefault();
|
||||
ev.stopPropagation();
|
||||
if (onClick) {
|
||||
onClick(id, ev.metaKey || ev.ctrlKey);
|
||||
}
|
||||
},
|
||||
[id, onClick]
|
||||
);
|
||||
if (!order) return null;
|
||||
return order?.liquidityProvision ? (
|
||||
<button onClick={handleOnClick} tabIndex={0} className="underline">
|
||||
{label}
|
||||
</button>
|
||||
) : (
|
||||
<span>{label}</span>
|
||||
);
|
||||
};
|
||||
@@ -8,7 +8,7 @@ const commonProps = {
|
||||
|
||||
describe('DateRangeFilter', () => {
|
||||
it('should be properly rendered', async () => {
|
||||
const defaultRangeFilter = {
|
||||
const defaultValue = {
|
||||
start: '2023-02-14T13:53:01+01:00',
|
||||
end: '2023-02-21T13:53:01+01:00',
|
||||
};
|
||||
@@ -17,7 +17,7 @@ describe('DateRangeFilter', () => {
|
||||
render(
|
||||
<DateRangeFilter
|
||||
{...(commonProps as unknown as DateRangeFilterProps)}
|
||||
defaultRangeFilter={defaultRangeFilter}
|
||||
defaultValue={defaultValue}
|
||||
/>
|
||||
);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useEffect, useMemo, useRef } from 'react';
|
||||
import type * as Schema from '@vegaprotocol/types';
|
||||
import { forwardRef, useImperativeHandle, useState } from 'react';
|
||||
import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
|
||||
@@ -17,9 +17,9 @@ import { formatForInput } from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { InputError } from '@vegaprotocol/ui-toolkit';
|
||||
|
||||
const defaultFilterValue: Schema.DateRange = {};
|
||||
const defaultValue: Schema.DateRange = {};
|
||||
export interface DateRangeFilterProps extends IFilterParams {
|
||||
defaultRangeFilter?: Schema.DateRange;
|
||||
defaultValue?: Schema.DateRange;
|
||||
maxSubDays?: number;
|
||||
maxNextDays?: number;
|
||||
maxDaysRange?: number;
|
||||
@@ -27,8 +27,9 @@ export interface DateRangeFilterProps extends IFilterParams {
|
||||
|
||||
export const DateRangeFilter = forwardRef(
|
||||
(props: DateRangeFilterProps, ref) => {
|
||||
const defaultDates = props?.defaultRangeFilter || defaultFilterValue;
|
||||
const defaultDates = props?.defaultValue || defaultValue;
|
||||
const [value, setValue] = useState<Schema.DateRange>(defaultDates);
|
||||
const valueRef = useRef<Schema.DateRange>(value);
|
||||
const [error, setError] = useState<string>('');
|
||||
const [minStartDate, maxStartDate, minEndDate, maxEndDate] = useMemo(() => {
|
||||
const minStartDate =
|
||||
@@ -93,7 +94,7 @@ export const DateRangeFilter = forwardRef(
|
||||
},
|
||||
|
||||
isFilterActive() {
|
||||
return value.start || value.end;
|
||||
return valueRef.current.start || valueRef.current.end;
|
||||
},
|
||||
|
||||
getModel() {
|
||||
@@ -101,13 +102,13 @@ export const DateRangeFilter = forwardRef(
|
||||
return null;
|
||||
}
|
||||
|
||||
return { value };
|
||||
return { value: valueRef.current };
|
||||
},
|
||||
|
||||
setModel(model?: { value: Schema.DateRange } | null) {
|
||||
setValue(
|
||||
model?.value || props?.defaultRangeFilter || defaultFilterValue
|
||||
);
|
||||
valueRef.current =
|
||||
model?.value || props?.defaultValue || defaultValue;
|
||||
setValue(valueRef.current);
|
||||
},
|
||||
};
|
||||
});
|
||||
@@ -185,10 +186,8 @@ export const DateRangeFilter = forwardRef(
|
||||
update = { ...update, end: checkForEndDate(endDate, startDate) };
|
||||
|
||||
if (validate(name, date, update)) {
|
||||
setValue((curr) => ({
|
||||
...curr,
|
||||
...update,
|
||||
}));
|
||||
valueRef.current = { ...valueRef.current, ...update };
|
||||
setValue(valueRef.current);
|
||||
}
|
||||
};
|
||||
useEffect(() => {
|
||||
@@ -241,7 +240,8 @@ export const DateRangeFilter = forwardRef(
|
||||
className="ag-standard-button ag-filter-apply-panel-button"
|
||||
onClick={() => {
|
||||
setError('');
|
||||
setValue(defaultDates);
|
||||
valueRef.current = defaultDates;
|
||||
setValue(valueRef.current);
|
||||
}}
|
||||
>
|
||||
{t('Reset')}
|
||||
|
||||
@@ -1,10 +1,17 @@
|
||||
import type { ChangeEvent } from 'react';
|
||||
import { forwardRef, useEffect, useImperativeHandle, useState } from 'react';
|
||||
import {
|
||||
forwardRef,
|
||||
useEffect,
|
||||
useImperativeHandle,
|
||||
useState,
|
||||
useRef,
|
||||
} from 'react';
|
||||
import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
|
||||
export const SetFilter = forwardRef((props: IFilterParams, ref) => {
|
||||
const [value, setValue] = useState<string[]>([]);
|
||||
const valueRef = useRef(value);
|
||||
|
||||
// expose AG Grid Filter Lifecycle callbacks
|
||||
useImperativeHandle(ref, () => {
|
||||
@@ -28,29 +35,28 @@ export const SetFilter = forwardRef((props: IFilterParams, ref) => {
|
||||
},
|
||||
|
||||
isFilterActive() {
|
||||
return value.length !== 0;
|
||||
return valueRef.current.length !== 0;
|
||||
},
|
||||
|
||||
getModel() {
|
||||
if (!this.isFilterActive()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return { value };
|
||||
return { value: valueRef.current };
|
||||
},
|
||||
|
||||
setModel(model?: { value: string[] } | null) {
|
||||
setValue(!model ? [] : model.value);
|
||||
valueRef.current = !model ? [] : model.value;
|
||||
setValue(valueRef.current);
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
const onChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
setValue(
|
||||
event.target.checked
|
||||
? [...value, event.target.value]
|
||||
: value.filter((v) => v !== event.target.value)
|
||||
);
|
||||
valueRef.current = event.target.checked
|
||||
? [...value, event.target.value]
|
||||
: value.filter((v) => v !== event.target.value);
|
||||
setValue(valueRef.current);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
@@ -77,7 +83,7 @@ export const SetFilter = forwardRef((props: IFilterParams, ref) => {
|
||||
<button
|
||||
type="button"
|
||||
className="ag-standard-button ag-filter-apply-panel-button"
|
||||
onClick={() => setValue([])}
|
||||
onClick={() => setValue((valueRef.current = []))}
|
||||
>
|
||||
{t('Reset')}
|
||||
</button>
|
||||
|
||||
@@ -15,8 +15,8 @@ export const useInitialMargin = (
|
||||
marketId: OrderSubmissionBody['orderSubmission']['marketId'],
|
||||
order?: OrderSubmissionBody['orderSubmission']
|
||||
) => {
|
||||
const { pubKey: partyId } = useVegaWallet();
|
||||
const commonVariables = { marketId, partyId: partyId || '' };
|
||||
const { pubKey } = useVegaWallet();
|
||||
const commonVariables = { marketId, partyId: pubKey || '' };
|
||||
const { data: marketData } = useDataProvider({
|
||||
dataProvider: marketDataProvider,
|
||||
variables: { marketId },
|
||||
@@ -24,7 +24,7 @@ export const useInitialMargin = (
|
||||
const { data: activeVolumeAndMargin } = useDataProvider({
|
||||
dataProvider: volumeAndMarginProvider,
|
||||
variables: commonVariables,
|
||||
skip: !partyId,
|
||||
skip: !pubKey,
|
||||
});
|
||||
const { data: marketInfo } = useDataProvider({
|
||||
dataProvider: marketInfoProvider,
|
||||
|
||||
@@ -38,10 +38,10 @@ export const TransferTooltipCellComponent = ({
|
||||
);
|
||||
};
|
||||
|
||||
const defaultRangeFilter = { start: formatRFC3339(subDays(Date.now(), 7)) };
|
||||
const defaultValue = { start: formatRFC3339(subDays(Date.now(), 7)) };
|
||||
const dateRangeFilterParams = {
|
||||
maxNextDays: 0,
|
||||
defaultRangeFilter,
|
||||
defaultValue,
|
||||
};
|
||||
type LedgerEntryProps = TypedDataAgGrid<LedgerEntry>;
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import type {
|
||||
OrdersQueryVariables,
|
||||
} from './__generated__/Orders';
|
||||
import { OrdersDocument, OrdersUpdateDocument } from './__generated__/Orders';
|
||||
import type { ApolloClient } from '@apollo/client';
|
||||
|
||||
export type Order = Omit<OrderFieldsFragment, 'market'> & {
|
||||
market?: Market;
|
||||
@@ -81,8 +82,31 @@ const getData = (
|
||||
): Edge<OrderFieldsFragment>[] =>
|
||||
responseData?.party?.ordersConnection?.edges || [];
|
||||
|
||||
const getDelta = (subscriptionData: OrdersUpdateSubscription) =>
|
||||
subscriptionData.orders || [];
|
||||
const getDelta = (
|
||||
subscriptionData: OrdersUpdateSubscription,
|
||||
variables: OrdersQueryVariables,
|
||||
client: ApolloClient<object>
|
||||
) => {
|
||||
if (!subscriptionData.orders) {
|
||||
return [];
|
||||
}
|
||||
subscriptionData.orders.forEach((order) => {
|
||||
client.cache.modify({
|
||||
id: client.cache.identify({
|
||||
__typename: 'Order',
|
||||
id: order.id,
|
||||
}),
|
||||
fields: {
|
||||
price: () => order.price,
|
||||
size: () => order.size,
|
||||
remaining: () => order.remaining,
|
||||
updatedAt: () => order.updatedAt,
|
||||
status: () => order.status,
|
||||
},
|
||||
});
|
||||
});
|
||||
return subscriptionData.orders;
|
||||
};
|
||||
|
||||
const getPageInfo = (responseData: OrdersQuery): PageInfo | null =>
|
||||
responseData.party?.ordersConnection?.pageInfo || null;
|
||||
@@ -150,7 +174,7 @@ export const update = (
|
||||
});
|
||||
};
|
||||
|
||||
export const ordersProvider = makeDataProvider<
|
||||
const ordersProvider = makeDataProvider<
|
||||
OrdersQuery,
|
||||
ReturnType<typeof getData>,
|
||||
OrdersUpdateSubscription,
|
||||
@@ -165,11 +189,36 @@ export const ordersProvider = makeDataProvider<
|
||||
pagination: {
|
||||
getPageInfo,
|
||||
append,
|
||||
first: 100,
|
||||
first: 1000,
|
||||
},
|
||||
additionalContext: { isEnlargedTimeout: true },
|
||||
});
|
||||
|
||||
export const activeOrdersProvider = makeDerivedDataProvider<
|
||||
ReturnType<typeof getData>,
|
||||
never,
|
||||
{ partyId: string; marketId?: string }
|
||||
>(
|
||||
[
|
||||
(callback, client, variables) =>
|
||||
ordersProvider(callback, client, {
|
||||
partyId: variables.partyId,
|
||||
filter: {
|
||||
status: [OrderStatus.STATUS_ACTIVE, OrderStatus.STATUS_PARKED],
|
||||
},
|
||||
}),
|
||||
],
|
||||
(partsData, variables, prevData, parts, subscriptions) => {
|
||||
if (!parts[0].isUpdate && subscriptions && subscriptions[0].load) {
|
||||
subscriptions[0].load();
|
||||
}
|
||||
const orders = partsData[0] as ReturnType<typeof getData>;
|
||||
return variables.marketId
|
||||
? orders.filter((edge) => variables.marketId === edge.node.market.id)
|
||||
: orders;
|
||||
}
|
||||
);
|
||||
|
||||
export const ordersWithMarketProvider = makeDerivedDataProvider<
|
||||
(OrderEdge | null)[],
|
||||
Order[],
|
||||
@@ -193,63 +242,20 @@ export const ordersWithMarketProvider = makeDerivedDataProvider<
|
||||
combineInsertionData<Order>
|
||||
);
|
||||
|
||||
const hasActiveOrderProviderInternal = makeDataProvider<
|
||||
OrdersQuery,
|
||||
boolean,
|
||||
OrdersUpdateSubscription,
|
||||
ReturnType<typeof getDelta>,
|
||||
OrdersQueryVariables
|
||||
>({
|
||||
query: OrdersDocument,
|
||||
subscriptionQuery: OrdersUpdateDocument,
|
||||
update: (
|
||||
data: boolean | null,
|
||||
delta: ReturnType<typeof getDelta>,
|
||||
reload: () => void
|
||||
) => {
|
||||
const orders = delta?.filter(
|
||||
(order) => !(order.peggedOrder || order.liquidityProvisionId)
|
||||
);
|
||||
if (!orders?.length) {
|
||||
return data;
|
||||
}
|
||||
const hasActiveOrders = orders.some(
|
||||
(order) => order.status === OrderStatus.STATUS_ACTIVE
|
||||
);
|
||||
if (hasActiveOrders) {
|
||||
return true;
|
||||
} else if (data && !hasActiveOrders) {
|
||||
reload();
|
||||
}
|
||||
return data;
|
||||
},
|
||||
getData: (responseData: OrdersQuery | null) => {
|
||||
const hasActiveOrder = !!responseData?.party?.ordersConnection?.edges?.some(
|
||||
(order) => !(order.node.peggedOrder || order.node.liquidityProvision)
|
||||
);
|
||||
return hasActiveOrder;
|
||||
},
|
||||
getDelta,
|
||||
});
|
||||
|
||||
export const hasActiveOrderProvider = makeDerivedDataProvider<
|
||||
boolean,
|
||||
never,
|
||||
{ partyId: string; marketId?: string }
|
||||
>(
|
||||
[
|
||||
(callback, client, { partyId, marketId }) =>
|
||||
hasActiveOrderProviderInternal(callback, client, {
|
||||
marketIds: marketId ? [marketId] : undefined,
|
||||
filter: {
|
||||
status: [OrderStatus.STATUS_ACTIVE],
|
||||
excludeLiquidity: true,
|
||||
},
|
||||
pagination: {
|
||||
first: 1,
|
||||
},
|
||||
partyId,
|
||||
} as OrdersQueryVariables),
|
||||
],
|
||||
(parts) => parts[0]
|
||||
);
|
||||
>([activeOrdersProvider], (parts) => !!parts[0].length);
|
||||
|
||||
export const hasAmendableOrderProvider = makeDerivedDataProvider<
|
||||
boolean,
|
||||
never,
|
||||
{ partyId: string; marketId?: string }
|
||||
>([activeOrdersProvider], (parts) => {
|
||||
const activeOrders = parts[0] as ReturnType<typeof getData>;
|
||||
const hasAmendableOrder = activeOrders.some(
|
||||
(edge) => !(edge.node.liquidityProvision || edge.node.peggedOrder)
|
||||
);
|
||||
return hasAmendableOrder;
|
||||
});
|
||||
|
||||
@@ -6,10 +6,12 @@ import { OrderListManager } from './order-list-manager';
|
||||
export const OrderListContainer = ({
|
||||
marketId,
|
||||
onMarketClick,
|
||||
onOrderTypeClick,
|
||||
enforceBottomPlaceholder,
|
||||
}: {
|
||||
marketId?: string;
|
||||
onMarketClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
onOrderTypeClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
enforceBottomPlaceholder?: boolean;
|
||||
}) => {
|
||||
const { pubKey, isReadOnly } = useVegaWallet();
|
||||
@@ -23,6 +25,7 @@ export const OrderListContainer = ({
|
||||
partyId={pubKey}
|
||||
marketId={marketId}
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
isReadOnly={isReadOnly}
|
||||
enforceBottomPlaceholder={enforceBottomPlaceholder}
|
||||
/>
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { GridReadyEvent } from 'ag-grid-community';
|
||||
|
||||
import { OrderListTable } from '../order-list/order-list';
|
||||
import { useOrderListData } from './use-order-list-data';
|
||||
import { useHasActiveOrder } from '../../order-hooks/use-has-active-order';
|
||||
import { useHasAmendableOrder } from '../../order-hooks/use-has-amendable-order';
|
||||
import type { Filter, Sort } from './use-order-list-data';
|
||||
import { useBottomPlaceholder } from '@vegaprotocol/react-helpers';
|
||||
import { OrderStatus } from '@vegaprotocol/types';
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
normalizeOrderAmendment,
|
||||
useVegaTransactionStore,
|
||||
} from '@vegaprotocol/wallet';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import type { OrderTxUpdateFieldsFragment } from '@vegaprotocol/wallet';
|
||||
import { OrderEditDialog } from '../order-list/order-edit-dialog';
|
||||
import type { Order, OrderEdge } from '../order-data-provider';
|
||||
@@ -24,31 +25,23 @@ export interface OrderListManagerProps {
|
||||
partyId: string;
|
||||
marketId?: string;
|
||||
onMarketClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
onOrderTypeClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
isReadOnly: boolean;
|
||||
enforceBottomPlaceholder?: boolean;
|
||||
}
|
||||
|
||||
const CancelAllOrdersButton = ({
|
||||
onClick,
|
||||
marketId,
|
||||
}: {
|
||||
onClick: (marketId?: string) => void;
|
||||
marketId?: string;
|
||||
}) => {
|
||||
const hasActiveOrder = useHasActiveOrder(marketId);
|
||||
return hasActiveOrder ? (
|
||||
<div className="dark:bg-black/75 bg-white/75 h-auto flex justify-end px-[11px] py-2 absolute bottom-0 right-3 rounded">
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
onClick={() => onClick(marketId)}
|
||||
data-testid="cancelAll"
|
||||
>
|
||||
{t('Cancel all')}
|
||||
</Button>
|
||||
</div>
|
||||
) : null;
|
||||
};
|
||||
const CancelAllOrdersButton = ({ onClick }: { onClick: () => void }) => (
|
||||
<div className="dark:bg-black/75 bg-white/75 h-auto flex justify-end px-[11px] py-2 absolute bottom-0 right-3 rounded">
|
||||
<Button
|
||||
variant="primary"
|
||||
size="sm"
|
||||
onClick={onClick}
|
||||
data-testid="cancelAll"
|
||||
>
|
||||
{t('Cancel all')}
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
|
||||
const initialFilter: Filter = {
|
||||
status: {
|
||||
@@ -60,6 +53,7 @@ export const OrderListManager = ({
|
||||
partyId,
|
||||
marketId,
|
||||
onMarketClick,
|
||||
onOrderTypeClick,
|
||||
isReadOnly,
|
||||
enforceBottomPlaceholder,
|
||||
}: OrderListManagerProps) => {
|
||||
@@ -68,9 +62,10 @@ export const OrderListManager = ({
|
||||
const scrolledToTop = useRef(false);
|
||||
const [sort, setSort] = useState<Sort[] | undefined>();
|
||||
const [filter, setFilter] = useState<Filter | undefined>(initialFilter);
|
||||
const filterRef = useRef(initialFilter);
|
||||
const [editOrder, setEditOrder] = useState<Order | null>(null);
|
||||
const create = useVegaTransactionStore((state) => state.create);
|
||||
const hasActiveOrder = useHasActiveOrder(marketId);
|
||||
const hasAmendableOrder = useHasAmendableOrder(marketId);
|
||||
|
||||
const { data, error, loading, reload } = useOrderListData({
|
||||
partyId,
|
||||
@@ -86,12 +81,16 @@ export const OrderListManager = ({
|
||||
...bottomPlaceholderProps
|
||||
} = useBottomPlaceholder<Order>({
|
||||
gridRef,
|
||||
disabled: !enforceBottomPlaceholder && !isReadOnly && !hasActiveOrder,
|
||||
disabled: !enforceBottomPlaceholder && !isReadOnly && !hasAmendableOrder,
|
||||
});
|
||||
|
||||
const onFilterChanged = useCallback(
|
||||
(event: FilterChangedEvent) => {
|
||||
const updatedFilter = event.api.getFilterModel();
|
||||
if (isEqual(updatedFilter, filterRef.current)) {
|
||||
return;
|
||||
}
|
||||
filterRef.current = updatedFilter;
|
||||
if (Object.keys(updatedFilter).length) {
|
||||
setFilter(updatedFilter);
|
||||
} else {
|
||||
@@ -142,16 +141,13 @@ export const OrderListManager = ({
|
||||
setDataCount(gridRef.current?.api?.getModel().getRowCount() ?? 0);
|
||||
}, [data]);
|
||||
|
||||
const cancelAll = useCallback(
|
||||
(marketId?: string) => {
|
||||
create({
|
||||
orderCancellation: {
|
||||
marketId,
|
||||
},
|
||||
});
|
||||
},
|
||||
[create]
|
||||
);
|
||||
const cancelAll = useCallback(() => {
|
||||
create({
|
||||
orderCancellation: {
|
||||
marketId,
|
||||
},
|
||||
});
|
||||
}, [create, marketId]);
|
||||
const extractedData =
|
||||
data && !loading
|
||||
? data
|
||||
@@ -171,6 +167,7 @@ export const OrderListManager = ({
|
||||
cancel={cancel}
|
||||
setEditOrder={setEditOrder}
|
||||
onMarketClick={onMarketClick}
|
||||
onOrderTypeClick={onOrderTypeClick}
|
||||
isReadOnly={isReadOnly}
|
||||
blockLoadDebounceMillis={100}
|
||||
suppressLoadingOverlay
|
||||
@@ -188,8 +185,8 @@ export const OrderListManager = ({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{!isReadOnly && (
|
||||
<CancelAllOrdersButton onClick={cancelAll} marketId={marketId} />
|
||||
{!isReadOnly && hasAmendableOrder && (
|
||||
<CancelAllOrdersButton onClick={cancelAll} />
|
||||
)}
|
||||
{editOrder && (
|
||||
<OrderEditDialog
|
||||
|
||||
@@ -71,17 +71,27 @@ export const useOrderListData = ({
|
||||
// define variable as const to get type safety, using generic with useMemo resulted in lost type safety
|
||||
const allVars: OrdersQueryVariables & OrdersUpdateSubscriptionVariables = {
|
||||
partyId,
|
||||
filter: {
|
||||
dateRange: filter?.updatedAt?.value,
|
||||
status: filter?.status?.value,
|
||||
timeInForce: filter?.timeInForce?.value,
|
||||
types: filter?.type?.value,
|
||||
},
|
||||
pagination: {
|
||||
first: 1000,
|
||||
},
|
||||
};
|
||||
|
||||
if (
|
||||
filter?.updatedAt?.value ||
|
||||
filter?.status?.value.length ||
|
||||
filter?.timeInForce?.value.length ||
|
||||
filter?.type?.value.length
|
||||
) {
|
||||
allVars.filter = {};
|
||||
if (filter?.updatedAt?.value) {
|
||||
allVars.filter.dateRange = filter?.updatedAt?.value;
|
||||
}
|
||||
if (filter?.status?.value.length) {
|
||||
allVars.filter.status = filter?.status?.value;
|
||||
}
|
||||
if (filter?.timeInForce?.value.length) {
|
||||
allVars.filter.timeInForce = filter?.timeInForce?.value;
|
||||
}
|
||||
if (filter?.type?.value.length) {
|
||||
allVars.filter.types = filter?.type?.value;
|
||||
}
|
||||
}
|
||||
return allVars;
|
||||
}, [partyId, filter]);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
negativeClassNames,
|
||||
positiveClassNames,
|
||||
MarketNameCell,
|
||||
OrderTypeCell,
|
||||
} from '@vegaprotocol/datagrid';
|
||||
import type {
|
||||
TypedDataAgGrid,
|
||||
@@ -31,12 +32,16 @@ export type OrderListTableProps = OrderListProps & {
|
||||
cancel: (order: Order) => void;
|
||||
setEditOrder: (order: Order) => void;
|
||||
onMarketClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
onOrderTypeClick?: (marketId: string, metaKey?: boolean) => void;
|
||||
isReadOnly: boolean;
|
||||
};
|
||||
|
||||
export const OrderListTable = memo(
|
||||
forwardRef<AgGridReact, OrderListTableProps>(
|
||||
({ cancel, setEditOrder, onMarketClick, ...props }, ref) => {
|
||||
(
|
||||
{ cancel, setEditOrder, onMarketClick, onOrderTypeClick, ...props },
|
||||
ref
|
||||
) => {
|
||||
return (
|
||||
<AgGrid
|
||||
ref={ref}
|
||||
@@ -51,7 +56,7 @@ export const OrderListTable = memo(
|
||||
height: '100%',
|
||||
}}
|
||||
getRowId={({ data }) => data.id}
|
||||
components={{ MarketNameCell }}
|
||||
components={{ MarketNameCell, OrderTypeCell }}
|
||||
{...props}
|
||||
>
|
||||
<AgGridColumn
|
||||
@@ -103,17 +108,9 @@ export const OrderListTable = memo(
|
||||
filterParams={{
|
||||
set: Schema.OrderTypeMapping,
|
||||
}}
|
||||
valueFormatter={({
|
||||
data: order,
|
||||
value,
|
||||
}: VegaValueFormatterParams<Order, 'type'>) => {
|
||||
if (!order) {
|
||||
return undefined;
|
||||
}
|
||||
if (!value) return '-';
|
||||
if (order?.peggedOrder) return t('Pegged');
|
||||
if (order?.liquidityProvision) return t('Liquidity provision');
|
||||
return Schema.OrderTypeMapping[value];
|
||||
cellRenderer="OrderTypeCell"
|
||||
cellRendererParams={{
|
||||
onClick: onOrderTypeClick,
|
||||
}}
|
||||
minWidth={80}
|
||||
/>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from './__generated__/OrdersSubscription';
|
||||
export * from './use-has-active-order';
|
||||
export * from './use-has-amendable-order';
|
||||
export * from './use-order-update';
|
||||
export * from './use-pending-orders-volume';
|
||||
export * from './use-order-store';
|
||||
|
||||
+6
-6
@@ -1,17 +1,17 @@
|
||||
import { useCallback, useState } from 'react';
|
||||
import { hasActiveOrderProvider } from '../components/order-data-provider/';
|
||||
import { hasAmendableOrderProvider } from '../components/order-data-provider';
|
||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||
|
||||
export const useHasActiveOrder = (marketId?: string) => {
|
||||
export const useHasAmendableOrder = (marketId?: string) => {
|
||||
const { pubKey } = useVegaWallet();
|
||||
const [hasActiveOrder, setHasActiveOrder] = useState(false);
|
||||
const [hasAmendableOrder, setHasAmendableOrder] = useState(false);
|
||||
const update = useCallback(({ data }: { data: boolean | null }) => {
|
||||
setHasActiveOrder(Boolean(data));
|
||||
setHasAmendableOrder(Boolean(data));
|
||||
return true;
|
||||
}, []);
|
||||
useDataProvider({
|
||||
dataProvider: hasActiveOrderProvider,
|
||||
dataProvider: hasAmendableOrderProvider,
|
||||
update,
|
||||
variables: {
|
||||
partyId: pubKey || '',
|
||||
@@ -20,5 +20,5 @@ export const useHasActiveOrder = (marketId?: string) => {
|
||||
skip: !pubKey,
|
||||
});
|
||||
|
||||
return hasActiveOrder;
|
||||
return hasAmendableOrder;
|
||||
};
|
||||
@@ -1,74 +0,0 @@
|
||||
import { useState, useCallback } from 'react';
|
||||
import { OrderStatus, Side } from '@vegaprotocol/types';
|
||||
import { ordersProvider } from '../components/order-data-provider/order-data-provider';
|
||||
import type { OrderFieldsFragment } from '../components/order-data-provider/__generated__/Orders';
|
||||
import type { Edge } from '@vegaprotocol/utils';
|
||||
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||
|
||||
const sumVolume = (orders: (Edge<OrderFieldsFragment> | null)[], side: Side) =>
|
||||
orders
|
||||
.reduce(
|
||||
(sum, order) =>
|
||||
order?.node.side === side
|
||||
? sum +
|
||||
BigInt(
|
||||
order?.node.status === OrderStatus.STATUS_PARTIALLY_FILLED
|
||||
? order?.node.remaining
|
||||
: order?.node.size
|
||||
)
|
||||
: sum,
|
||||
BigInt(0)
|
||||
)
|
||||
.toString();
|
||||
|
||||
export const useActiveOrdersVolumeAndMargin = (
|
||||
partyId: string | null | undefined,
|
||||
marketId: string
|
||||
) => {
|
||||
const [buyVolume, setBuyVolume] = useState<string | undefined>();
|
||||
const [sellVolume, setSellVolume] = useState<string | undefined>();
|
||||
const [buyInitialMargin, setBuyInitialMargin] = useState<
|
||||
string | undefined
|
||||
>();
|
||||
const [sellInitialMargin, setSellInitialMargin] = useState<
|
||||
string | undefined
|
||||
>();
|
||||
const update = useCallback(
|
||||
({ data }: { data: (Edge<OrderFieldsFragment> | null)[] | null }) => {
|
||||
if (!data) {
|
||||
setBuyVolume(undefined);
|
||||
setSellVolume(undefined);
|
||||
setBuyInitialMargin(undefined);
|
||||
setSellInitialMargin(undefined);
|
||||
} else {
|
||||
setBuyVolume(sumVolume(data, Side.SIDE_BUY));
|
||||
setSellVolume(sumVolume(data, Side.SIDE_SELL));
|
||||
}
|
||||
return true;
|
||||
},
|
||||
[]
|
||||
);
|
||||
useDataProvider({
|
||||
dataProvider: ordersProvider,
|
||||
update,
|
||||
variables: {
|
||||
partyId: partyId || '',
|
||||
marketIds: [marketId],
|
||||
filter: {
|
||||
status: [
|
||||
OrderStatus.STATUS_ACTIVE,
|
||||
OrderStatus.STATUS_PARTIALLY_FILLED,
|
||||
],
|
||||
},
|
||||
},
|
||||
skip: !partyId,
|
||||
});
|
||||
return buyVolume || sellVolume
|
||||
? {
|
||||
buyVolume,
|
||||
sellVolume,
|
||||
buyInitialMargin,
|
||||
sellInitialMargin,
|
||||
}
|
||||
: undefined;
|
||||
};
|
||||
@@ -0,0 +1,129 @@
|
||||
import { Intent } from '@vegaprotocol/ui-toolkit';
|
||||
import {
|
||||
getOrderToastIntent,
|
||||
getOrderToastTitle,
|
||||
getRejectionReason,
|
||||
timeInForceLabel,
|
||||
} from './utils';
|
||||
import * as Types from '@vegaprotocol/types';
|
||||
|
||||
describe('getOrderToastTitle', () => {
|
||||
it('should return the correct title', () => {
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_ACTIVE)).toBe(
|
||||
'Order submitted'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_FILLED)).toBe(
|
||||
'Order filled'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_PARTIALLY_FILLED)).toBe(
|
||||
'Order partially filled'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_PARKED)).toBe(
|
||||
'Order parked'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_STOPPED)).toBe(
|
||||
'Order stopped'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_CANCELLED)).toBe(
|
||||
'Order cancelled'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_EXPIRED)).toBe(
|
||||
'Order expired'
|
||||
);
|
||||
expect(getOrderToastTitle(Types.OrderStatus.STATUS_REJECTED)).toBe(
|
||||
'Order rejected'
|
||||
);
|
||||
expect(getOrderToastTitle(undefined)).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getOrderToastIntent', () => {
|
||||
it('should return the correct intent', () => {
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_PARKED)).toBe(
|
||||
Intent.Warning
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_EXPIRED)).toBe(
|
||||
Intent.Warning
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_PARTIALLY_FILLED)).toBe(
|
||||
Intent.Warning
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_REJECTED)).toBe(
|
||||
Intent.Danger
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_STOPPED)).toBe(
|
||||
Intent.Danger
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_FILLED)).toBe(
|
||||
Intent.Success
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_ACTIVE)).toBe(
|
||||
Intent.Success
|
||||
);
|
||||
expect(getOrderToastIntent(Types.OrderStatus.STATUS_CANCELLED)).toBe(
|
||||
Intent.Success
|
||||
);
|
||||
expect(getOrderToastIntent(undefined)).toBe(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getRejectionReason', () => {
|
||||
it('should return the correct rejection reason for insufficient asset balance', () => {
|
||||
expect(
|
||||
getRejectionReason({
|
||||
rejectionReason:
|
||||
Types.OrderRejectionReason.ORDER_ERROR_INSUFFICIENT_ASSET_BALANCE,
|
||||
status: Types.OrderStatus.STATUS_REJECTED,
|
||||
id: '',
|
||||
createdAt: undefined,
|
||||
size: '',
|
||||
price: '',
|
||||
timeInForce: Types.OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
side: Types.Side.SIDE_BUY,
|
||||
marketId: '',
|
||||
})
|
||||
).toBe('Insufficient asset balance');
|
||||
});
|
||||
|
||||
it('should return the correct rejection reason when order is stopped', () => {
|
||||
expect(
|
||||
getRejectionReason({
|
||||
rejectionReason: null,
|
||||
status: Types.OrderStatus.STATUS_STOPPED,
|
||||
id: '',
|
||||
createdAt: undefined,
|
||||
size: '',
|
||||
price: '',
|
||||
timeInForce: Types.OrderTimeInForce.TIME_IN_FORCE_FOK,
|
||||
side: Types.Side.SIDE_BUY,
|
||||
marketId: '',
|
||||
})
|
||||
).toBe(
|
||||
'Your Fill or Kill (FOK) order was not filled and it has been stopped'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('timeInForceLabel', () => {
|
||||
it('should return the correct label for time in force', () => {
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_FOK)).toBe(
|
||||
`Fill or Kill (FOK)`
|
||||
);
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GTC)).toBe(
|
||||
`Good 'til Cancelled (GTC)`
|
||||
);
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_IOC)).toBe(
|
||||
`Immediate or Cancel (IOC)`
|
||||
);
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GTT)).toBe(
|
||||
`Good 'til Time (GTT)`
|
||||
);
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GFA)).toBe(
|
||||
`Good for Auction (GFA)`
|
||||
);
|
||||
expect(timeInForceLabel(Types.OrderTimeInForce.TIME_IN_FORCE_GFN)).toBe(
|
||||
`Good for Normal (GFN)`
|
||||
);
|
||||
expect(timeInForceLabel('')).toBe('');
|
||||
});
|
||||
});
|
||||
@@ -82,10 +82,10 @@ export const getOrderToastIntent = (
|
||||
return Intent.Warning;
|
||||
case Schema.OrderStatus.STATUS_REJECTED:
|
||||
case Schema.OrderStatus.STATUS_STOPPED:
|
||||
case Schema.OrderStatus.STATUS_CANCELLED:
|
||||
return Intent.Danger;
|
||||
case Schema.OrderStatus.STATUS_FILLED:
|
||||
case Schema.OrderStatus.STATUS_ACTIVE:
|
||||
case Schema.OrderStatus.STATUS_CANCELLED:
|
||||
return Intent.Success;
|
||||
default:
|
||||
return;
|
||||
|
||||
@@ -30,12 +30,12 @@ import {
|
||||
import { marginsDataProvider } from './margin-data-provider';
|
||||
import { calculateMargins } from './margin-calculator';
|
||||
import type { Edge } from '@vegaprotocol/utils';
|
||||
import { OrderStatus, Side } from '@vegaprotocol/types';
|
||||
import { Side } from '@vegaprotocol/types';
|
||||
import { marketInfoProvider } from '@vegaprotocol/market-info';
|
||||
import type { MarketInfoQuery } from '@vegaprotocol/market-info';
|
||||
import { marketDataProvider } from '@vegaprotocol/market-list';
|
||||
import type { MarketData } from '@vegaprotocol/market-list';
|
||||
import { ordersProvider } from '@vegaprotocol/orders';
|
||||
import { activeOrdersProvider } from '@vegaprotocol/orders';
|
||||
import type { OrderFieldsFragment } from '@vegaprotocol/orders';
|
||||
import type { PositionStatus } from '@vegaprotocol/types';
|
||||
|
||||
@@ -350,12 +350,9 @@ export const volumeAndMarginProvider = makeDerivedDataProvider<
|
||||
>(
|
||||
[
|
||||
(callback, client, { partyId, marketId }) =>
|
||||
ordersProvider(callback, client, {
|
||||
activeOrdersProvider(callback, client, {
|
||||
partyId,
|
||||
marketIds: [marketId],
|
||||
filter: {
|
||||
status: [OrderStatus.STATUS_ACTIVE, OrderStatus.STATUS_PARKED],
|
||||
},
|
||||
marketId,
|
||||
}),
|
||||
(callback, client, variables) =>
|
||||
marketDataProvider(callback, client, { marketId: variables.marketId }),
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { useState, useEffect, useRef, useCallback } from 'react';
|
||||
import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
||||
import throttle from 'lodash/throttle';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import isEqualWith from 'lodash/isEqualWith';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { usePrevious } from './use-previous';
|
||||
import type { OperationVariables } from '@apollo/client';
|
||||
import type { Subscribe, Load, UpdateCallback } from '@vegaprotocol/utils';
|
||||
import { variablesIsEqualCustomizer } from '@vegaprotocol/utils';
|
||||
|
||||
export interface useDataProviderParams<
|
||||
Data,
|
||||
@@ -62,13 +62,19 @@ export const useDataProvider = <
|
||||
const flushRef = useRef<(() => void) | undefined>(undefined);
|
||||
const reloadRef = useRef<((force?: boolean) => void) | undefined>(undefined);
|
||||
const loadRef = useRef<Load<Data> | undefined>(undefined);
|
||||
const prevVariables = usePrevious(props.variables);
|
||||
const [variables, setVariables] = useState(props.variables);
|
||||
useEffect(() => {
|
||||
if (!isEqual(prevVariables, props.variables)) {
|
||||
setVariables(props.variables);
|
||||
const variablesRef = useRef<Variables>(props.variables);
|
||||
const variables = useMemo(() => {
|
||||
if (
|
||||
!isEqualWith(
|
||||
variablesRef.current,
|
||||
props.variables,
|
||||
variablesIsEqualCustomizer
|
||||
)
|
||||
) {
|
||||
variablesRef.current = props.variables;
|
||||
}
|
||||
}, [props.variables, prevVariables]);
|
||||
return variablesRef.current;
|
||||
}, [props.variables]);
|
||||
const flush = useCallback(() => {
|
||||
if (flushRef.current) {
|
||||
flushRef.current();
|
||||
|
||||
@@ -70,6 +70,8 @@ export const Notification = ({
|
||||
'text-vega-green dark:text-vega-green': intent === Intent.Success,
|
||||
'text-yellow-600 dark:text-yellow': intent === Intent.Warning,
|
||||
'text-vega-pink': intent === Intent.Danger,
|
||||
'mt-1': !!title,
|
||||
'mt-[0.125rem]': !title,
|
||||
},
|
||||
'flex items-start mt-1'
|
||||
)}
|
||||
@@ -78,11 +80,16 @@ export const Notification = ({
|
||||
</div>
|
||||
<div className="flex flex-col flex-grow items-start gap-1.5">
|
||||
{title && (
|
||||
<div className="whitespace-nowrap overflow-hidden text-ellipsis uppercase leading-6">
|
||||
<div
|
||||
key="title"
|
||||
className="whitespace-nowrap overflow-hidden text-ellipsis uppercase leading-6"
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
)}
|
||||
<div className="text-sm [word-break:break-word]">{message}</div>
|
||||
<div key="message" className="text-sm [word-break:break-word]">
|
||||
{message}
|
||||
</div>
|
||||
{buttonProps && (
|
||||
<Button
|
||||
size={buttonProps.size || 'sm'}
|
||||
|
||||
@@ -45,7 +45,7 @@ type CombinedData = {
|
||||
|
||||
type SubscriptionData = QueryData;
|
||||
type Delta = Data;
|
||||
type Variables = { var: string };
|
||||
type Variables = { var: string; filter?: string[] };
|
||||
|
||||
const update = jest.fn<
|
||||
ReturnType<Update<Data, Delta, Variables>>,
|
||||
@@ -231,10 +231,14 @@ describe('data provider', () => {
|
||||
clientSubscribeSubscribe.mockClear();
|
||||
});
|
||||
it('memoize instance and unsubscribe if no subscribers', () => {
|
||||
const subscription1 = subscribe(jest.fn(), client, variables);
|
||||
const subscription2 = subscribe(jest.fn(), client, { ...variables });
|
||||
// const subscription1 = subscribe(jest.fn(), client);
|
||||
// const subscription2 = subscribe(jest.fn(), client);
|
||||
const subscription1 = subscribe(jest.fn(), client, {
|
||||
...variables,
|
||||
filter: ['1', '2'],
|
||||
});
|
||||
const subscription2 = subscribe(jest.fn(), client, {
|
||||
...variables,
|
||||
filter: ['2', '1'],
|
||||
});
|
||||
expect(clientSubscribeSubscribe.mock.calls.length).toEqual(1);
|
||||
subscription1.unsubscribe();
|
||||
expect(clientSubscribeUnsubscribe.mock.calls.length).toEqual(0);
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
} from '@apollo/client';
|
||||
import type { GraphQLErrors } from '@apollo/client/errors';
|
||||
import type { Subscription } from 'zen-observable-ts';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import isEqualWith from 'lodash/isEqualWith';
|
||||
import { isNotFoundGraphQLError } from './apollo-client';
|
||||
import type * as Schema from '@vegaprotocol/types';
|
||||
interface UpdateData<Data, Delta> {
|
||||
@@ -104,7 +104,11 @@ interface GetTotalCount<QueryData> {
|
||||
}
|
||||
|
||||
interface GetDelta<SubscriptionData, Delta, Variables> {
|
||||
(subscriptionData: SubscriptionData, variables?: Variables): Delta;
|
||||
(
|
||||
subscriptionData: SubscriptionData,
|
||||
variables: Variables,
|
||||
client: ApolloClient<object>
|
||||
): Delta;
|
||||
}
|
||||
|
||||
export type Node = { id: string };
|
||||
@@ -420,7 +424,7 @@ function makeDataProviderInternal<
|
||||
if (!subscriptionData || !getDelta || !update) {
|
||||
return;
|
||||
}
|
||||
const delta = getDelta(subscriptionData, variables);
|
||||
const delta = getDelta(subscriptionData, variables, client);
|
||||
if (loading) {
|
||||
updateQueue.push(delta);
|
||||
} else {
|
||||
@@ -512,11 +516,26 @@ function makeDataProviderInternal<
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares two arrays assuming that they are sets of primitive values, used to compare gql query variables
|
||||
*/
|
||||
export const variablesIsEqualCustomizer: NonNullable<
|
||||
Parameters<typeof isEqualWith>['2']
|
||||
> = (value, other) => {
|
||||
if (Array.isArray(value) && Array.isArray(other)) {
|
||||
return (
|
||||
value.length === other.length &&
|
||||
new Set([...value, ...other]).size === value.length
|
||||
);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Memoizes data provider instances using query variables as cache key
|
||||
*
|
||||
* @param fn
|
||||
* @returns subscibe function
|
||||
* @returns subscribe function
|
||||
*/
|
||||
const memoize = <
|
||||
Data,
|
||||
@@ -530,7 +549,9 @@ const memoize = <
|
||||
variables?: Variables;
|
||||
}[] = [];
|
||||
return (variables?: Variables) => {
|
||||
const cached = cache.find((c) => isEqual(c.variables, variables));
|
||||
const cached = cache.find((c) =>
|
||||
isEqualWith(c.variables, variables, variablesIsEqualCustomizer)
|
||||
);
|
||||
if (cached) {
|
||||
return cached.subscribe;
|
||||
}
|
||||
@@ -582,8 +603,10 @@ export function makeDataProvider<
|
||||
const getInstance = memoize<Data, Delta, Variables>(() =>
|
||||
makeDataProviderInternal(params)
|
||||
);
|
||||
return (callback, client, variables) =>
|
||||
getInstance(variables)(callback, client, variables);
|
||||
return (callback, client, variables) => {
|
||||
const instance = getInstance(variables)(callback, client, variables);
|
||||
return instance;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -605,7 +628,9 @@ export type CombineDerivedData<
|
||||
> = (
|
||||
data: DerivedPart<Variables>['data'][],
|
||||
variables: Variables,
|
||||
prevData: Data | null
|
||||
prevData: Data | null,
|
||||
parts: DerivedPart<Variables>[],
|
||||
subscriptions?: ReturnType<DependencySubscribe<Variables>>[]
|
||||
) => Data | null;
|
||||
|
||||
export type CombineDerivedDelta<
|
||||
@@ -687,7 +712,9 @@ function makeDerivedDataProviderInternal<
|
||||
? combineData(
|
||||
parts.map((part) => part.data),
|
||||
variables,
|
||||
data
|
||||
data,
|
||||
parts,
|
||||
subscriptions
|
||||
)
|
||||
: data;
|
||||
if (
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
removeDecimal,
|
||||
required,
|
||||
isAssetTypeERC20,
|
||||
formatNumber,
|
||||
} from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useLocalStorage } from '@vegaprotocol/react-helpers';
|
||||
@@ -14,12 +15,16 @@ import {
|
||||
FormGroup,
|
||||
Input,
|
||||
InputError,
|
||||
Notification,
|
||||
RichSelect,
|
||||
ExternalLink,
|
||||
Intent,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { useWeb3React } from '@web3-react/core';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import type { ButtonHTMLAttributes } from 'react';
|
||||
import type { ControllerRenderProps } from 'react-hook-form';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
import { useForm, Controller, useWatch } from 'react-hook-form';
|
||||
import type { WithdrawalArgs } from './use-create-withdraw';
|
||||
import { WithdrawLimits } from './withdraw-limits';
|
||||
@@ -45,6 +50,47 @@ export interface WithdrawFormProps {
|
||||
submitWithdraw: (withdrawal: WithdrawalArgs) => void;
|
||||
}
|
||||
|
||||
const WithdrawDelayNotification = ({
|
||||
threshold,
|
||||
delay,
|
||||
symbol,
|
||||
decimals,
|
||||
}: {
|
||||
threshold: BigNumber;
|
||||
delay: number | undefined;
|
||||
symbol: string;
|
||||
decimals: number;
|
||||
}) => {
|
||||
const replacements = [
|
||||
symbol,
|
||||
delay ? formatDistanceToNow(Date.now() + delay * 1000) : ' ',
|
||||
];
|
||||
return (
|
||||
<Notification
|
||||
intent={Intent.Warning}
|
||||
testId={
|
||||
threshold.isFinite()
|
||||
? 'amount-withdrawal-delay-notification'
|
||||
: 'withdrawals-delay-notification'
|
||||
}
|
||||
message={[
|
||||
!threshold.isFinite()
|
||||
? t('All %s withdrawals are subject to a %s delay.', replacements)
|
||||
: t('Withdrawals of %s %s or more will be delayed for %s.', [
|
||||
formatNumber(threshold, decimals),
|
||||
...replacements,
|
||||
]),
|
||||
<ExternalLink
|
||||
className="ml-1"
|
||||
href="https://docs.vega.xyz/testnet/concepts/deposits-withdrawals#withdrawal-limits"
|
||||
>
|
||||
{t('Read more')}
|
||||
</ExternalLink>,
|
||||
]}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export const WithdrawForm = ({
|
||||
assets,
|
||||
balance,
|
||||
@@ -113,6 +159,12 @@ export const WithdrawForm = ({
|
||||
);
|
||||
};
|
||||
|
||||
const showWithdrawDelayNotification =
|
||||
delay &&
|
||||
selectedAsset &&
|
||||
(!threshold.isFinite() ||
|
||||
new BigNumber(amount).isGreaterThanOrEqualTo(threshold));
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-4 text-sm">
|
||||
@@ -206,6 +258,16 @@ export const WithdrawForm = ({
|
||||
{t('Use maximum')}
|
||||
</UseButton>
|
||||
)}
|
||||
{showWithdrawDelayNotification && (
|
||||
<div className="mt-2">
|
||||
<WithdrawDelayNotification
|
||||
threshold={threshold}
|
||||
symbol={selectedAsset.symbol}
|
||||
decimals={selectedAsset.decimals}
|
||||
delay={delay}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</FormGroup>
|
||||
<Button
|
||||
data-testid="submit-withdrawal"
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import type { Asset } from '@vegaprotocol/assets';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { CompactNumber } from '@vegaprotocol/react-helpers';
|
||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||
import { WITHDRAW_THRESHOLD_TOOLTIP_TEXT } from '@vegaprotocol/assets';
|
||||
import {
|
||||
KeyValueTable,
|
||||
KeyValueTableRow,
|
||||
Tooltip,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import BigNumber from 'bignumber.js';
|
||||
import { formatDistanceToNow } from 'date-fns';
|
||||
|
||||
@@ -25,7 +30,13 @@ export const WithdrawLimits = ({
|
||||
? formatDistanceToNow(Date.now() + delay * 1000)
|
||||
: t('None');
|
||||
|
||||
const limits = [
|
||||
const limits: {
|
||||
key: string;
|
||||
label: string;
|
||||
value: string | JSX.Element;
|
||||
rawValue?: BigNumber;
|
||||
tooltip?: string;
|
||||
}[] = [
|
||||
{
|
||||
key: 'BALANCE_AVAILABLE',
|
||||
label: t('Balance available'),
|
||||
@@ -36,24 +47,35 @@ export const WithdrawLimits = ({
|
||||
'-'
|
||||
),
|
||||
},
|
||||
{
|
||||
];
|
||||
if (threshold.isFinite()) {
|
||||
limits.push({
|
||||
key: 'WITHDRAWAL_THRESHOLD',
|
||||
label: t('Delayed withdrawal threshold'),
|
||||
tooltip: WITHDRAW_THRESHOLD_TOOLTIP_TEXT,
|
||||
rawValue: threshold,
|
||||
value: <CompactNumber number={threshold} decimals={asset.decimals} />,
|
||||
},
|
||||
{
|
||||
key: 'DELAY_TIME',
|
||||
label: t('Delay time'),
|
||||
value: delayTime,
|
||||
},
|
||||
];
|
||||
});
|
||||
}
|
||||
limits.push({
|
||||
key: 'DELAY_TIME',
|
||||
label: t('Delay time'),
|
||||
value: delayTime,
|
||||
});
|
||||
|
||||
return (
|
||||
<KeyValueTable>
|
||||
{limits.map(({ key, label, rawValue, value }) => (
|
||||
{limits.map(({ key, label, rawValue, value, tooltip }) => (
|
||||
<KeyValueTableRow key={key}>
|
||||
<div data-testid={`${key}_label`}>{label}</div>
|
||||
<div data-testid={`${key}_label`}>
|
||||
{tooltip ? (
|
||||
<Tooltip description={tooltip}>
|
||||
<span>{label}</span>
|
||||
</Tooltip>
|
||||
) : (
|
||||
label
|
||||
)}
|
||||
</div>
|
||||
<div
|
||||
data-testid={`${key}_value`}
|
||||
className="truncate"
|
||||
|
||||
@@ -12,15 +12,17 @@ jest.mock('@web3-react/core', () => ({
|
||||
useWeb3React: () => ({ account: ethereumAddress }),
|
||||
}));
|
||||
|
||||
const withdrawAsset = {
|
||||
asset,
|
||||
balance: new BigNumber(1),
|
||||
min: new BigNumber(0.0000001),
|
||||
threshold: new BigNumber(1000),
|
||||
delay: 10,
|
||||
handleSelectAsset: jest.fn(),
|
||||
};
|
||||
|
||||
jest.mock('./use-withdraw-asset', () => ({
|
||||
useWithdrawAsset: () => ({
|
||||
asset,
|
||||
balance: new BigNumber(1),
|
||||
min: new BigNumber(0.0000001),
|
||||
threshold: new BigNumber(1000),
|
||||
delay: 10,
|
||||
handleSelectAsset: jest.fn(),
|
||||
}),
|
||||
useWithdrawAsset: () => withdrawAsset,
|
||||
}));
|
||||
|
||||
jest.mock('@vegaprotocol/web3', () => ({
|
||||
@@ -109,4 +111,25 @@ describe('WithdrawManager', () => {
|
||||
});
|
||||
fireEvent.submit(screen.getByTestId('withdraw-form'));
|
||||
};
|
||||
|
||||
it('shows withdraw delay notification if amount greater than threshold', async () => {
|
||||
render(generateJsx(props));
|
||||
fireEvent.change(screen.getByLabelText('Amount'), {
|
||||
target: { value: '1000' },
|
||||
});
|
||||
expect(
|
||||
await screen.findByTestId('amount-withdrawal-delay-notification')
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows withdraw delay notification if threshold is 0', async () => {
|
||||
withdrawAsset.threshold = new BigNumber(Infinity);
|
||||
render(generateJsx(props));
|
||||
fireEvent.change(screen.getByLabelText('Amount'), {
|
||||
target: { value: '0.01' },
|
||||
});
|
||||
expect(
|
||||
await screen.findByTestId('withdrawals-delay-notification')
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@
|
||||
"react-hook-form": "^7.27.0",
|
||||
"react-i18next": "^11.11.4",
|
||||
"react-intersection-observer": "^9.2.2",
|
||||
"react-markdown": "^8.0.5",
|
||||
"react-markdown": "^8.0.6",
|
||||
"react-router-dom": "^6.9.0",
|
||||
"react-syntax-highlighter": "^15.4.5",
|
||||
"react-use-websocket": "^3.0.0",
|
||||
|
||||
@@ -19541,10 +19541,10 @@ react-lifecycles-compat@^3.0.4:
|
||||
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
|
||||
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
|
||||
|
||||
react-markdown@^8.0.5:
|
||||
version "8.0.5"
|
||||
resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-8.0.5.tgz#c9a70a33ca9aeeafb769c6582e7e38843b9d70ad"
|
||||
integrity sha512-jGJolWWmOWAvzf+xMdB9zwStViODyyFQhNB/bwCerbBKmrTmgmA599CGiOlP58OId1IMoIRsA8UdI1Lod4zb5A==
|
||||
react-markdown@^8.0.6:
|
||||
version "8.0.6"
|
||||
resolved "https://registry.yarnpkg.com/react-markdown/-/react-markdown-8.0.6.tgz#3e939018f8bfce800ffdf22cf50aba3cdded7ad1"
|
||||
integrity sha512-KgPWsYgHuftdx510wwIzpwf+5js/iHqBR+fzxefv8Khk3mFbnioF1bmL2idHN3ler0LMQmICKeDrWnZrX9mtbQ==
|
||||
dependencies:
|
||||
"@types/hast" "^2.0.0"
|
||||
"@types/prop-types" "^15.0.0"
|
||||
|
||||
Reference in New Issue
Block a user