Compare commits

..
Author SHA1 Message Date
Dariusz Majcherczyk 77ae0408e0 test: reverted assertion 2023-04-22 08:42:51 +02:00
Dariusz Majcherczyk 51f076bca8 test: trigger failure for governance 2023-04-21 22:08:01 +02:00
Dariusz Majcherczyk 22eefb5d0d test: reverted changes 2023-04-21 21:24:37 +02:00
Dariusz Majcherczyk 145bb13848 test: trigger failure 2023-04-21 20:57:56 +02:00
Dariusz Majcherczyk 87000a33d5 test: separated artifacts for logs and html report 2023-04-21 19:31:40 +02:00
Bartłomiej Głownia 6371199537 feat(trading): add negative oracle status banner (#3486) 2023-04-21 18:31:52 +02:00
Dexter Edwards 75cb48a4b9 chore(react-helpers): make log level customisable (#3474) 2023-04-21 16:29:30 +01:00
ArtandJoe 933878acf5 chore(ui-toolkit): leftover dependencies (#3485)
Co-authored-by: Joe <joe@vega.xyz>
2023-04-21 16:16:04 +01:00
Dexter Edwards 5995df8e68 chore(ui-toolkit,react-helpers,utils,tailwindcss-config): add more build targets (#3518) 2023-04-21 14:28:18 +00:00
Bartłomiej Głownia 4d5b7cf5e7 fix(trading): amend market list settlement asset column getter (#3487) 2023-04-21 16:08:41 +02:00
dexturr e1f60446f0 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-21 12:10:50 +00:00
daro-maj 7f271069ab test(trading): mocha reporter for e2e tests (#3465) 2023-04-21 13:36:31 +02:00
dexturr 1ae7af5d59 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-21 06:09:12 +00:00
dexturr b9c5d9ee96 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-21 00:14:39 +00:00
dexturr ae1768a669 chore: update tranches
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-04-20 18:07:37 +00:00
Joe Tsang a1bfe7f1a7 test(governance): e2e network upgrade proposal tests (#3477) 2023-04-20 18:38:09 +01:00
48 changed files with 1149 additions and 187 deletions
+8 -4
View File
@@ -91,7 +91,11 @@ jobs:
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: test-report-and-logs-${{ matrix.project }}
path: |
/home/runner/.vegacapsule/testnet/logs
frontend-monorepo/apps/trading-e2e/cypress/reports
name: logs-${{ matrix.project }}
path: /home/runner/.vegacapsule/testnet/logs
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: test-report-${{ matrix.project }}
path: frontend-monorepo/apps/trading-e2e/cypress/reports
@@ -0,0 +1,38 @@
export const upgradeProposalsData = {
lastBlockHeight: '2014133',
protocolUpgradeProposals: {
edges: [
{
node: {
upgradeBlockHeight: '2015942',
vegaReleaseTag: 'v1',
approvers: [
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
],
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
__typename: 'ProtocolUpgradeProposal',
},
__typename: 'ProtocolUpgradeProposalEdge',
},
{
node: {
upgradeBlockHeight: '1955065',
vegaReleaseTag: 'v0.71.0+dev-12156-bca1d57e',
approvers: [
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
],
status: 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED',
__typename: 'ProtocolUpgradeProposal',
},
__typename: 'ProtocolUpgradeProposalEdge',
},
],
__typename: 'ProtocolUpgradeProposalConnection',
},
};
@@ -0,0 +1,117 @@
export const nodeData = {
epoch: {
id: '204731',
timestamps: {
start: '2023-04-14T09:30:09.452005Z',
end: null,
expiry: '2023-04-14T09:31:09.452005Z',
__typename: 'EpochTimestamps',
},
__typename: 'Epoch',
},
nodesConnection: {
edges: [
{
node: {
avatarUrl:
'https://www.gravatar.com/avatar/y2hwc4xjds7zvlam3y4in94q2rcdimsn?d=identicon',
id: 'f337b5cc50c49a928e49129a2eca62277a81b4b7336b6e4131f8f0431e8db029',
name: 'lovely-fisherman',
pubkey:
'02a6531716b7a6d82779b7793c3ad2fcb47290ea2ff0912c56f61219bd9675ff',
stakedByOperator: '3000000000000000000000',
stakedByDelegates: '0',
stakedTotal: '3000000000000000000000',
pendingStake: '0',
rankingScore: {
rankingScore: '0.4999166805532412',
stakeScore: '0.2499583402766206',
performanceScore: '1',
votingPower: '2499',
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
__typename: 'RankingScore',
},
__typename: 'Node',
},
__typename: 'NodeEdge',
},
{
node: {
avatarUrl:
'https://www.gravatar.com/avatar/g1tw70qnoo0tf8ror30jefwhae92zy16?d=identicon',
id: 'cdadcf885556e372b6b39679d6ad46854d1d9c1e982da7ff2929544df01f9088',
name: 'magnificent-door',
pubkey:
'121934387281812a2d5e6913e5d57c0f85a8f169e2752347ee2e23b52d46623c',
stakedByOperator: '3000000000000000000000',
stakedByDelegates: '0',
stakedTotal: '3000000000000000000000',
pendingStake: '0',
rankingScore: {
rankingScore: '0.4999166805532412',
stakeScore: '0.2499583402766206',
performanceScore: '1',
votingPower: '2499',
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
__typename: 'RankingScore',
},
__typename: 'Node',
},
__typename: 'NodeEdge',
},
{
node: {
avatarUrl:
'https://www.gravatar.com/avatar/s2e7hp7soq5zdhxeap7p21onetsjiy6w?d=identicon',
id: '9a13de2548fef30d928e71e76004c98ec7ad9d8fc3ddcd16ddee210b28ea4cfc',
name: 'helpful-tree',
pubkey:
'bd6339d2428c79ac3bc9011771236d17bac92bcb1806423388d52fb440043aef',
stakedByOperator: '3000000000000000000000',
stakedByDelegates: '2000000000000000000',
stakedTotal: '3002000000000000000000',
pendingStake: '0',
rankingScore: {
rankingScore: '0.5002499583402766',
stakeScore: '0.2501249791701383',
performanceScore: '1',
votingPower: '2501',
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
__typename: 'RankingScore',
},
__typename: 'Node',
},
__typename: 'NodeEdge',
},
{
node: {
avatarUrl:
'https://www.gravatar.com/avatar/3gop683kg2cvd8rpv286hzagqt3yjsdq?d=identicon',
id: '93ac271ab95038333587e47d11461e6edc0126e6e77156281c545f4c5650a6d0',
name: 'easy-cookie',
pubkey:
'65c80e2f5f84e2109eec30810f137ba04cbbecaba8f27706c146cc6c6f90db29',
stakedByOperator: '3000000000000000000000',
stakedByDelegates: '0',
stakedTotal: '3000000000000000000000',
pendingStake: '0',
rankingScore: {
rankingScore: '0.4999166805532412',
stakeScore: '0.2499583402766206',
performanceScore: '1',
votingPower: '2499',
status: 'VALIDATOR_NODE_STATUS_TENDERMINT',
__typename: 'RankingScore',
},
__typename: 'Node',
},
__typename: 'NodeEdge',
},
],
__typename: 'NodesConnection',
},
nodeData: {
stakedTotal: '12002000000000000000000',
__typename: 'NodeData',
},
};
@@ -0,0 +1,325 @@
export const proposalsData = {
proposalsConnection: {
edges: [
{
node: {
id: 'e8ba9d268e12514644fd1fc7ff289292f4ce6489cc32cc73133aea52c04aef89',
rationale: {
title: 'Add asset Wrapped Ether',
description: 'Proposal to add asset WETH to Vega network',
__typename: 'ProposalRationale',
},
reference: '',
state: 'STATE_OPEN',
datetime: '2026-12-01T11:41:28.654288Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2026-12-01T11:45:33Z',
enactmentDatetime: '2026-12-01T11:45:43Z',
change: {
name: 'Wrapped Ether',
symbol: 'WETH',
decimals: 18,
quantum: '0.0008',
source: {
contractAddress: '0x9B18C6CaD886D5653783E2B25759124760F4407F',
withdrawThreshold: '1',
lifetimeLimit: '400000000000000000',
__typename: 'ERC20',
},
__typename: 'NewAsset',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
{
node: {
id: 'd848fc7881f13d366df5f61ab139d5fcfa72bf838151bb51b54381870e357931',
rationale: {
title: 'Add asset Dai Stablecoin',
description: 'Proposal to add asset DAI to Vega network',
__typename: 'ProposalRationale',
},
reference: '',
state: 'STATE_ENACTED',
datetime: '2022-11-29T15:49:57.80978Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2023-04-13T15:52:58Z',
enactmentDatetime: '2023-04-13T15:53:08Z',
change: {
name: 'Dai Stablecoin',
symbol: 'DAI',
decimals: 18,
quantum: '1',
source: {
contractAddress: '0xad018fB8ec00bfd622B91C83E684a6AC7bB8fbA4',
withdrawThreshold: '1',
lifetimeLimit: '500000000000000000000',
__typename: 'ERC20',
},
__typename: 'NewAsset',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
{
node: {
id: 'ccbd651b4a1167fd73c4a0340ac759fa0a31ca487ad46a13254b741ad71947ed',
rationale: {
title: 'New DAI market',
description: 'New DAI market',
__typename: 'ProposalRationale',
},
reference: '0VFQusmmESdrP5GuL8naB6lxfoE3RPGaEeo7abdN',
state: 'STATE_ENACTED',
datetime: '2022-11-26T19:36:19.26034Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2022-11-26T19:36:42Z',
enactmentDatetime: '2023-03-22T13:57:37Z',
change: {
instrument: {
name: 'UNIDAI Monthly (Dec 2022)',
code: 'UNIDAI.MF21',
futureProduct: {
settlementAsset: { symbol: 'tDAI', __typename: 'Asset' },
__typename: 'FutureProduct',
},
__typename: 'InstrumentConfiguration',
},
__typename: 'NewMarket',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
{
node: {
id: 'bc70383f0e9515b15542cf4c63590cd2ca46b3363ba7c4a72af0e62112b3951b',
rationale: {
title: 'USDC-III',
description: 'USDC-III D List test',
__typename: 'ProposalRationale',
},
reference: '',
state: 'STATE_ENACTED',
datetime: '2022-11-22T15:17:28.829605Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2022-11-22T15:18:56Z',
enactmentDatetime: '2022-11-22T15:19:06Z',
change: {
name: 'USDC-III',
symbol: 'USDC-III',
decimals: 18,
quantum: '1',
source: {
contractAddress: '0x1F1A067aEC530b66BA5128C9Db76825eC22c3C6b',
withdrawThreshold: '100000000000000000000000000',
lifetimeLimit: '1000000000000000000000000000',
__typename: 'ERC20',
},
__typename: 'NewAsset',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
{
node: {
id: '9d9b2a9d0179d0e4ccb317f6c4a5db0b905d893190bfb5e5499985ef313281c8',
rationale: {
title: 'New BTC market',
description: 'New BTC market',
__typename: 'ProposalRationale',
},
reference: 'AXeRWS3TvLBFDgWOSHQpKFJf3NTbnWK6310q02fZ',
state: 'STATE_ENACTED',
datetime: '2022-11-26T19:36:19.26034Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2022-11-26T19:36:42Z',
enactmentDatetime: '2023-03-22T13:57:37Z',
change: {
instrument: {
name: 'ETHBTC Quarterly (Feb 2023)',
code: 'ETHBTC.QM21',
futureProduct: {
settlementAsset: { symbol: 'tBTC', __typename: 'Asset' },
__typename: 'FutureProduct',
},
__typename: 'InstrumentConfiguration',
},
__typename: 'NewMarket',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
{
node: {
id: '9c48796e7988769ededc2b2b02220b00e93f65f23e8141bf1fd23a6983d95943',
rationale: {
title: 'Update governance.proposal.asset.requiredMajority',
description:
'Proposal to update governance.proposal.asset.requiredMajority to 300}',
__typename: 'ProposalRationale',
},
reference: '',
state: 'STATE_ENACTED',
datetime: '2022-11-22T13:22:52.370655Z',
rejectionReason: null,
party: {
id: '69464e35bcb8e8a2900ca0f87acaf252d50cf2ab2fc73694845a16b7c8a0dc6f',
__typename: 'Party',
},
errorDetails: null,
terms: {
closingDatetime: '2022-11-22T13:27:13Z',
enactmentDatetime: '2022-11-22T13:27:33Z',
change: {
networkParameter: {
key: 'governance.proposal.asset.requiredParticipation',
value: '0.000001',
__typename: 'NetworkParameter',
},
__typename: 'UpdateNetworkParameter',
},
__typename: 'ProposalTerms',
},
votes: {
yes: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
no: {
totalTokens: '0',
totalNumber: '0',
totalEquityLikeShareWeight: '0',
__typename: 'ProposalVoteSide',
},
__typename: 'ProposalVotes',
},
__typename: 'Proposal',
},
__typename: 'ProposalEdge',
},
],
__typename: 'ProposalsConnection',
},
};
@@ -3,11 +3,14 @@ import {
navigation,
verifyPageHeader,
verifyTabHighlighted,
waitForSpinner,
} from '../../support/common.functions';
import {
goToMakeNewProposal,
governanceProposalType,
} from '../../support/governance.functions';
import { mockNetworkUpgradeProposal } from '../../support/proposal.functions';
const proposalDocumentationLink = '[data-testid="proposal-documentation-link"]';
const newProposalButton = '[data-testid="new-proposal-link"]';
const newProposalLink = '[data-testid="new-proposal-link"]';
const governanceDocsUrl = 'https://vega.xyz/governance';
const connectToVegaWalletButton = '[data-testid="connect-to-vega-wallet-btn"]';
@@ -21,56 +24,140 @@ context(
navigateTo(navigation.proposals);
});
describe('with no network change proposals', function () {
it('should have governance tab highlighted', function () {
verifyTabHighlighted(navigation.proposals);
it('should have governance tab highlighted', function () {
verifyTabHighlighted(navigation.proposals);
});
it('should have GOVERNANCE header visible', function () {
verifyPageHeader('Proposals');
});
it('should be able to see a working link for - find out more about Vega governance', function () {
// 3001-VOTE-001
cy.get(proposalDocumentationLink)
.should('be.visible')
.and('have.text', 'Find out more about Vega governance')
.and('have.attr', 'href')
.and('equal', governanceDocsUrl);
// 3002-PROP-001
cy.request(governanceDocsUrl)
.its('body')
.then((body) => {
if (!body.includes('Govern the network')) {
assert.include(
body,
'Govern the network',
`Checking that governance link destination includes 'Govern the network' text`
);
}
});
});
it('should be able to see button for - new proposal', function () {
// 3001-VOTE-002
cy.get(newProposalLink)
.should('be.visible')
.and('have.text', 'New proposal')
.and('have.attr', 'href')
.and('equal', '/proposals/propose');
});
it('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
});
it('should see open network upgrade proposal on homepage', function () {
mockNetworkUpgradeProposal();
cy.visit('/');
cy.getByTestId('home-proposal-list').within(() => {
cy.getByTestId('protocol-upgrade-proposals-list-item').should('exist');
cy.getByTestId('protocol-upgrade-proposal-title').should(
'have.text',
'Vega release v1'
);
});
});
it('should have GOVERNANCE header visible', function () {
verifyPageHeader('Proposals');
});
it('should be able to see a working link for - find out more about Vega governance', function () {
// 3001-VOTE-001
cy.get(proposalDocumentationLink)
.should('be.visible')
.and('have.text', 'Find out more about Vega governance')
.and('have.attr', 'href')
.and('equal', governanceDocsUrl);
// 3002-PROP-001
cy.request(governanceDocsUrl)
.its('body')
.then((body) => {
if (!body.includes('Govern the network')) {
assert.include(
body,
'Govern the network',
`Checking that governance link destination includes 'Govern the network' text`
);
}
it('should see network upgrade proposals in proposals list', function () {
mockNetworkUpgradeProposal();
navigateTo(navigation.proposals);
cy.getByTestId('open-proposals').within(() => {
cy.get('li')
.eq(0)
.should(
'have.attr',
'data-testid',
'protocol-upgrade-proposals-list-item'
)
.within(() => {
cy.get('h2').should('have.text', 'Vega release v1');
cy.getByTestId('protocol-upgrade-proposal-type').should(
'have.text',
'Network Upgrade'
);
cy.getByTestId('protocol-upgrade-proposal-release-tag').should(
'have.text',
'Vega release tagv1'
);
cy.getByTestId('protocol-upgrade-proposal-block-height').should(
'have.text',
'Upgrade block height2015942'
);
cy.getByTestId('protocol-upgrade-proposal-status').should(
'have.text',
'Approved'
);
});
});
it('should be able to see button for - new proposal', function () {
// 3001-VOTE-002
cy.get(newProposalLink)
.should('be.visible')
.and('have.text', 'New proposal')
.and('have.attr', 'href')
.and('equal', '/proposals/propose');
cy.getByTestId('closed-proposals').within(() => {
cy.getByTestId('protocol-upgrade-proposals-list-item').should(
'have.length',
1
);
});
});
// Skipping this test for now, the new proposal button no longer takes a user directly
// to a proposal form, instead it takes them to a page where they can select a proposal type.
// Keeping this test here for now as it can be repurposed to test the new proposal forms.
it.skip('should be able to see a connect wallet button - if vega wallet disconnected and new proposal button selected', function () {
cy.get(newProposalButton).should('be.visible').click();
cy.get(connectToVegaWalletButton)
.should('be.visible')
.and('have.text', 'Connect Vega wallet');
navigateTo(navigation.proposals);
waitForSpinner();
it('should see details of network upgrade proposal', function () {
mockNetworkUpgradeProposal();
navigateTo(navigation.proposals);
cy.getByTestId('protocol-upgrade-proposals-list-item')
.first()
.find('[data-testid="view-proposal-btn"]')
.click();
cy.getByTestId('protocol-upgrade-proposal').within(() => {
cy.get('h1').should('have.text', 'Vega Release v1');
cy.getByTestId('protocol-upgrade-block-height').should(
'have.text',
'2015942 (currently 2014133)'
);
cy.getByTestId('protocol-upgrade-state').should(
'have.text',
'Approved'
);
cy.getByTestId('protocol-upgrade-release-tag').should(
'have.text',
'v1'
);
cy.getByTestId('protocol-upgrade-approval-status')
.should('contain.text', '99.98% approval (% validator voting power)')
.and('contain.text', '(67% voting power required)');
cy.get('h2').should('contain.text', 'Approvers (4/4 validators)');
cy.getByTestId('validator-name')
.should('have.length', 4)
.each(($validator) => {
cy.wrap($validator).find('a').should('have.attr', 'href');
});
cy.getByTestId('validator-voting-power').each(
($validatorVotingPower) => {
cy.wrap($validatorVotingPower)
.invoke('text')
.should('contain', '%');
}
);
});
});
}
@@ -334,11 +334,8 @@ context(
.parent()
.siblings()
.invoke('text')
.should('have.length.above', 3)
.then((el) => {
const value = parseFloat(el);
cy.wrap(value).should('be.gte', parseFloat(expectedAmount));
});
.then(parseFloat)
.should('be.gte', parseFloat(expectedAmount));
cy.get(vegaWalletCurrencyTitle)
.contains(id)
@@ -12,6 +12,7 @@ context(
{ tags: '@smoke' },
function () {
before('navigate to withdrawals page', function () {
cy.clearAllLocalStorage();
cy.visit('/');
navigateTo(navigation.withdraw);
});
@@ -1,5 +1,9 @@
import { addSeconds, millisecondsToSeconds } from 'date-fns';
import type { ProposalSubmissionBody } from '@vegaprotocol/wallet';
import { aliasGQLQuery } from '@vegaprotocol/cypress';
import { upgradeProposalsData } from '../fixtures/mocks/network-upgrade';
import { proposalsData } from '../fixtures/mocks/proposals';
import { nodeData } from '../fixtures/mocks/nodes';
export function createUpdateNetworkProposalTxBody(): ProposalSubmissionBody {
const MIN_CLOSE_SEC = 5;
@@ -80,3 +84,11 @@ export function createFreeFormProposalTxBody(): ProposalSubmissionBody {
},
};
}
export function mockNetworkUpgradeProposal() {
cy.mockGQL((req) => {
aliasGQLQuery(req, 'Nodes', nodeData);
aliasGQLQuery(req, 'Proposals', proposalsData);
aliasGQLQuery(req, 'ProtocolUpgrades', upgradeProposalsData);
});
}
@@ -57,10 +57,7 @@ export const ProtocolUpdateProposalDetailApprovals = ({
noBorder={index === consensusApprovals?.length - 1}
key={validator.pubkey}
>
<div
className="-mb-3 mt-1"
data-testid={`validator-${validator.id}`}
>
<div className="-mb-3 mt-1" data-testid={'validator-name'}>
<ValidatorDetailsLink
id={validator.id}
avatarUrl={validator.avatarUrl}
@@ -68,7 +65,7 @@ export const ProtocolUpdateProposalDetailApprovals = ({
/>
</div>
<span>
<span data-testid="validator-voting-power">
{getNormalisedVotingPower(
validator.rankingScore.votingPower,
2
@@ -63,7 +63,7 @@ describe('ProtocolUpdateProposalDetailApprovals', () => {
it('renders the correct number of consensus approvers', () => {
renderComponent();
const validators = screen.getAllByTestId(/validator-/i);
const validators = screen.getAllByTestId(/validator-name/);
expect(validators.length).toBe(mockValidators.length);
});
+71 -27
View File
@@ -38,7 +38,7 @@
"tranche_end": "2023-05-20T00:00:00.000Z",
"total_added": "15761.125",
"total_removed": "0",
"locked_amount": "15494.9188690682869786625",
"locked_amount": "14969.1223880690592062625",
"deposits": [
{
"amount": "241.5",
@@ -665,8 +665,8 @@
"tranche_start": "2023-04-06T00:00:00.000Z",
"tranche_end": "2023-05-06T00:00:00.000Z",
"total_added": "8865",
"total_removed": "362.31015740205",
"locked_amount": "4578.269739583333005",
"total_removed": "490.11243517665",
"locked_amount": "4282.530329861111133",
"deposits": [
{
"amount": "33",
@@ -825,6 +825,11 @@
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
"tx": "0x05d086879e23724f1397d41adcbe2f3316dd4039c240edbc3cbbcacf1ca1d00e"
},
{
"amount": "127.8022777746",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
"tx": "0xb67468e99866887e95c5a211fe8611d107b02ef094d9b90343820366a5e8c7a0"
},
{
"amount": "52.2185023074",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
@@ -1050,6 +1055,12 @@
"tranche_id": 54,
"tx": "0x05d086879e23724f1397d41adcbe2f3316dd4039c240edbc3cbbcacf1ca1d00e"
},
{
"amount": "127.8022777746",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
"tranche_id": 54,
"tx": "0xb67468e99866887e95c5a211fe8611d107b02ef094d9b90343820366a5e8c7a0"
},
{
"amount": "52.2185023074",
"user": "0x6F32AA5A6198329c16e438512F992a0548C856f9",
@@ -1058,8 +1069,8 @@
}
],
"total_tokens": "858",
"withdrawn_tokens": "296.67303008772",
"remaining_tokens": "561.32696991228"
"withdrawn_tokens": "424.47530786232",
"remaining_tokens": "433.52469213768"
},
{
"address": "0x0bBf7580e036eA5D69ABe679CC90117EeC2e3dc1",
@@ -4407,7 +4418,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "86666.297",
"total_removed": "0",
"locked_amount": "54253.8851505212161988738",
"locked_amount": "54016.2508690146860439521",
"deposits": [
{
"amount": "86666.297",
@@ -4473,7 +4484,7 @@
"tranche_end": "2023-06-01T00:00:00.000Z",
"total_added": "2500",
"total_removed": "0",
"locked_amount": "569.96289300976805",
"locked_amount": "556.215500356125325",
"deposits": [
{
"amount": "2500",
@@ -4594,7 +4605,7 @@
"tranche_end": "2023-09-01T00:00:00.000Z",
"total_added": "17500",
"total_removed": "0",
"locked_amount": "12696.37350920893675",
"locked_amount": "12601.1877579005635",
"deposits": [
{
"amount": "12500",
@@ -4861,7 +4872,7 @@
"tranche_end": "2023-08-01T00:00:00.000Z",
"total_added": "37500",
"total_removed": "12294.731717775",
"locked_amount": "21234.79943600368125",
"locked_amount": "21027.44925951504",
"deposits": [
{
"amount": "7500",
@@ -5225,7 +5236,7 @@
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "129999.45",
"total_removed": "0",
"locked_amount": "54204.385306806945473172",
"locked_amount": "53966.96783668199177511",
"deposits": [
{
"amount": "129999.45",
@@ -5258,7 +5269,7 @@
"tranche_end": "2024-04-01T00:00:00.000Z",
"total_added": "54144.7663",
"total_removed": "0",
"locked_amount": "51259.01278091454623854912",
"locked_amount": "51110.95640499238994528285",
"deposits": [
{
"amount": "54144.7663",
@@ -5291,7 +5302,7 @@
"tranche_end": "2023-09-03T00:00:00.000Z",
"total_added": "62600",
"total_removed": "0",
"locked_amount": "23238.02874809741452",
"locked_amount": "23066.3829464738684",
"deposits": [
{
"amount": "10000",
@@ -5484,7 +5495,7 @@
"tranche_end": "2023-09-17T00:00:00.000Z",
"total_added": "5000",
"total_removed": "0",
"locked_amount": "2047.85340563165885",
"locked_amount": "2034.14367706747865",
"deposits": [
{
"amount": "5000",
@@ -6025,7 +6036,7 @@
"tranche_end": "2023-05-01T00:00:00.000Z",
"total_added": "22500",
"total_removed": "6871.43713545",
"locked_amount": "1304.415573204420675",
"locked_amount": "1180.005467311232775",
"deposits": [
{
"amount": "7500",
@@ -6509,7 +6520,7 @@
"tranche_end": "2023-06-02T00:00:00.000Z",
"total_added": "1939928.38",
"total_removed": "928642.9598472029154",
"locked_amount": "225846.4546178330654320676",
"locked_amount": "220527.2763130828877571306",
"deposits": [
{
"amount": "1852091.69",
@@ -40325,7 +40336,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "3732368.4671",
"total_removed": "715655.108029600523393",
"locked_amount": "371548.694092943839794156471",
"locked_amount": "363374.968979732192792259132",
"deposits": [
{
"amount": "1998.95815",
@@ -41717,8 +41728,8 @@
"tranche_start": "2022-06-05T00:00:00.000Z",
"tranche_end": "2023-12-05T00:00:00.000Z",
"total_added": "15870102.715470999700000001",
"total_removed": "835090.78677275839915352",
"locked_amount": "6617175.39918817550807202992275848610786696",
"total_removed": "848861.26613772708802852",
"locked_amount": "6588191.8947400391303406883760823381494998",
"deposits": [
{
"amount": "16249.93",
@@ -42277,6 +42288,16 @@
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xa56a064890829624fb37f887adb87987dfafd709ebea2cdf423c91a38e91b82f"
},
{
"amount": "984.287150968688875",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tx": "0xbf3e00aef8ae756fb2f5de5d3eec6f925e9005c7acca1a6c2f88a84ad1e44fba"
},
{
"amount": "12786.192214",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tx": "0x57c9c9396f67fb377f2d7cca30a1a6e6b73267408efde1239cbfdfd99c333345"
},
{
"amount": "998.454771147362375",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -44375,6 +44396,12 @@
"tranche_id": 2,
"tx": "0xa56a064890829624fb37f887adb87987dfafd709ebea2cdf423c91a38e91b82f"
},
{
"amount": "984.287150968688875",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
"tranche_id": 2,
"tx": "0xbf3e00aef8ae756fb2f5de5d3eec6f925e9005c7acca1a6c2f88a84ad1e44fba"
},
{
"amount": "998.454771147362375",
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
@@ -45811,8 +45838,8 @@
}
],
"total_tokens": "259998.8875",
"withdrawn_tokens": "150733.980517927478375",
"remaining_tokens": "109264.906982072521625"
"withdrawn_tokens": "151718.26766889616725",
"remaining_tokens": "108280.61983110383275"
},
{
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
@@ -46532,6 +46559,12 @@
}
],
"withdrawals": [
{
"amount": "12786.192214",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
"tranche_id": 2,
"tx": "0x57c9c9396f67fb377f2d7cca30a1a6e6b73267408efde1239cbfdfd99c333345"
},
{
"amount": "934.96553",
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
@@ -46780,8 +46813,8 @@
}
],
"total_tokens": "200000",
"withdrawn_tokens": "104171.325864",
"remaining_tokens": "95828.674136"
"withdrawn_tokens": "116957.518078",
"remaining_tokens": "83042.481922"
},
{
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
@@ -48163,8 +48196,8 @@
"tranche_start": "2021-11-05T00:00:00.000Z",
"tranche_end": "2023-05-05T00:00:00.000Z",
"total_added": "14597706.0446472999",
"total_removed": "5845111.643096907348272126",
"locked_amount": "387488.8511763643682805777108705054",
"total_removed": "5846105.097444116645943876",
"locked_amount": "360731.4649312677941994769310657454",
"deposits": [
{
"amount": "129284.449",
@@ -48448,6 +48481,11 @@
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0xc4a521e74b6b9c9c01e7fbd950f4096d3e6473a773818b4fdf0c9d974ee5fc7e"
},
{
"amount": "993.45434720929767175",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tx": "0x6b1bd1880e5539566cb7110e80ef3e877e3c46a2fcd88798e82211a962dd2b7b"
},
{
"amount": "37462.74710421168752574",
"user": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
@@ -51735,6 +51773,12 @@
"tranche_id": 3,
"tx": "0xc4a521e74b6b9c9c01e7fbd950f4096d3e6473a773818b4fdf0c9d974ee5fc7e"
},
{
"amount": "993.45434720929767175",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
"tranche_id": 3,
"tx": "0x6b1bd1880e5539566cb7110e80ef3e877e3c46a2fcd88798e82211a962dd2b7b"
},
{
"amount": "1383.345213676043696",
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
@@ -54473,8 +54517,8 @@
}
],
"total_tokens": "359123.469575",
"withdrawn_tokens": "348774.8193074565797845",
"remaining_tokens": "10348.6502675434202155"
"withdrawn_tokens": "349768.27365466587745625",
"remaining_tokens": "9355.19592033412254375"
},
{
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
@@ -58109,7 +58153,7 @@
"tranche_end": "2023-06-05T00:00:00.000Z",
"total_added": "472355.6199999996",
"total_removed": "43120.0853616251849",
"locked_amount": "58874.014441908253564521489193296",
"locked_amount": "57578.840974715197793192974327752",
"deposits": [
{
"amount": "3000",
@@ -7,7 +7,6 @@ import {
useThrottledDataProvider,
} from '@vegaprotocol/react-helpers';
import { AsyncRenderer, ExternalLink, Splash } from '@vegaprotocol/ui-toolkit';
import { marketProvider, marketDataProvider } from '@vegaprotocol/market-list';
import { useGlobalStore, usePageTitleStore } from '../../stores';
import { TradeGrid, TradePanels } from './trade-grid';
@@ -12,11 +12,10 @@ import { memo, useState } from 'react';
import type { ReactNode, ComponentProps } from 'react';
import { DepthChartContainer } from '@vegaprotocol/market-depth';
import { CandlesChartContainer } from '@vegaprotocol/candles-chart';
import { OracleBanner } from '../../components/banner';
import {
Tab,
LocalStoragePersistTabs as Tabs,
ResizableGrid,
ResizableGridPanel,
Splash,
} from '@vegaprotocol/ui-toolkit';
import { t } from '@vegaprotocol/i18n';
@@ -33,6 +32,10 @@ import {
useMarketClickHandler,
useMarketLiquidityClickHandler,
} from '../../lib/hooks/use-market-click-handler';
import {
ResizableGrid,
ResizableGridPanel,
} from '../../components/resizable-grid';
type MarketDependantView =
| typeof CandlesChartContainer
@@ -271,7 +274,10 @@ export const TradeGrid = ({
}: TradeGridProps) => {
return (
<div className="h-full grid grid-rows-[min-content_1fr]">
<TradeMarketHeader market={market} onSelect={onSelect} />
<div>
<TradeMarketHeader market={market} onSelect={onSelect} />
<OracleBanner marketId={market?.id || ''} />
</div>
<MainGrid
marketId={market?.id || ''}
onSelect={onSelect}
@@ -2,18 +2,13 @@ import { titlefy } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import { PositionsContainer } from '@vegaprotocol/positions';
import { OrderListContainer } from '@vegaprotocol/orders';
import {
ResizableGridPanel,
Tab,
LocalStoragePersistTabs as Tabs,
} from '@vegaprotocol/ui-toolkit';
import { Tab, LocalStoragePersistTabs as Tabs } from '@vegaprotocol/ui-toolkit';
import { WithdrawalsContainer } from './withdrawals-container';
import { FillsContainer } from '@vegaprotocol/fills';
import type { ReactNode } from 'react';
import { useEffect } from 'react';
import { VegaWalletContainer } from '../../components/vega-wallet-container';
import { DepositsContainer } from './deposits-container';
import { ResizableGrid } from '@vegaprotocol/ui-toolkit';
import { LayoutPriority } from 'allotment';
import { usePageTitleStore } from '../../stores';
import { LedgerContainer } from '@vegaprotocol/ledger';
@@ -23,6 +18,10 @@ import {
useMarketClickHandler,
useMarketLiquidityClickHandler,
} from '../../lib/hooks/use-market-click-handler';
import {
ResizableGrid,
ResizableGridPanel,
} from '../../components/resizable-grid';
export const Portfolio = () => {
const { updateTitle } = usePageTitleStore((store) => ({
@@ -1,16 +1,13 @@
import { AnnouncementBanner } from '@vegaprotocol/announcements';
import { AnnouncementBanner as Banner } from '@vegaprotocol/announcements';
import { useEnvironment } from '@vegaprotocol/environment';
export const Banner = () => {
export const AnnouncementBanner = () => {
const { ANNOUNCEMENTS_CONFIG_URL } = useEnvironment();
// Return an empty div so that the grid layout in _app.page.ts
// renders correctly
if (!ANNOUNCEMENTS_CONFIG_URL) {
return <div />;
}
return (
<AnnouncementBanner app="console" configUrl={ANNOUNCEMENTS_CONFIG_URL} />
);
return <Banner app="console" configUrl={ANNOUNCEMENTS_CONFIG_URL} />;
};
+2 -1
View File
@@ -1 +1,2 @@
export * from './banner';
export * from './announcement-banner';
export * from './oracle-banner';
@@ -0,0 +1,44 @@
import { t } from '@vegaprotocol/i18n';
import { useMarketOracle } from '@vegaprotocol/market-info';
import ReactMarkdown from 'react-markdown';
import { Intent, NotificationBanner } from '@vegaprotocol/ui-toolkit';
const oracleStatuses = {
UNKNOWN: t(
"This public key's proofs have not been verified yet, or no proofs have been provided yet."
),
GOOD: t("This public key's proofs have been verified."),
SUSPICIOUS: t(
'This public key is suspected to be acting in bad faith, pending investigation.'
),
MALICIOUS: t('This public key has been observed acting in bad faith.'),
RETIRED: t('This public key is no longer in use.'),
COMPROMISED: t(
'This public key is no longer in the control of its original owners.'
),
};
export const OracleBanner = ({ marketId }: { marketId: string }) => {
const oracle = useMarketOracle(marketId);
if (!oracle || oracle.status === 'GOOD') {
return null;
}
return (
<NotificationBanner intent={Intent.Danger}>
<div>
Oracle status for this market is {oracle.status}.{' '}
{oracleStatuses[oracle.status]}
</div>
{oracle.status_reason ? (
<ReactMarkdown
className="react-markdown-container"
skipHtml={true}
disallowedElements={['img']}
linkTarget="_blank"
>
{oracle.status_reason}
</ReactMarkdown>
) : null}
</NotificationBanner>
);
};
+2 -2
View File
@@ -30,7 +30,7 @@ import ToastsManager from './toasts-manager';
import { HashRouter, useLocation, useSearchParams } from 'react-router-dom';
import { Connectors } from '../lib/vega-connectors';
import { ViewingBanner } from '../components/viewing-banner';
import { Banner } from '../components/banner';
import { AnnouncementBanner } from '../components/banner';
import { AppLoader, DynamicLoader } from '../components/app-loader';
import { Navbar } from '../components/navbar';
import { ENV } from '../lib/config';
@@ -86,7 +86,7 @@ function AppBody({ Component }: AppProps) {
</Head>
<Title />
<div className={gridClasses}>
<Banner />
<AnnouncementBanner />
<Navbar theme={VEGA_ENV === Networks.TESTNET ? 'yellow' : 'system'} />
<ViewingBanner />
<main data-testid={location.pathname}>
+6 -6
View File
@@ -1,16 +1,16 @@
import { forwardRef } from 'react';
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import {
Intent,
progressBarCellRendererSelector,
} from '@vegaprotocol/ui-toolkit';
import { Intent } from '@vegaprotocol/ui-toolkit';
import { AgGridColumn } from 'ag-grid-react';
import type { AgGridReact, AgGridReactProps } from 'ag-grid-react';
import type { AccountFields } from './accounts-data-provider';
import { AccountTypeMapping } from '@vegaprotocol/types';
import type { ValueProps } from '@vegaprotocol/ui-toolkit';
import type { VegaValueFormatterParams } from '@vegaprotocol/datagrid';
import type {
ValueProps,
VegaValueFormatterParams,
} from '@vegaprotocol/datagrid';
import { progressBarCellRendererSelector } from '@vegaprotocol/datagrid';
import { AgGridDynamic as AgGrid, PriceCell } from '@vegaprotocol/datagrid';
import type { ValueFormatterParams } from 'ag-grid-community';
import { accountValuesComparator } from './accounts-table';
+2
View File
@@ -17,3 +17,5 @@ export * from './lib/filters/set-filter';
export * from './lib/cell-class-rules';
export * from './lib/type-helpers';
export * from './lib/cells/grid-progress-bar';
@@ -1,9 +1,9 @@
import type { Intent } from '@vegaprotocol/ui-toolkit';
import { ProgressBar } from '@vegaprotocol/ui-toolkit';
import type {
CellRendererSelectorResult,
ICellRendererParams,
} from 'ag-grid-community';
import type { Intent } from '../../utils/intent';
import { ProgressBar } from './progress-bar';
export interface ValueProps {
valueFormatted?: {
+1
View File
@@ -0,0 +1 @@
export * from './use-market-oracle';
@@ -0,0 +1,132 @@
import { renderHook } from '@testing-library/react';
import { useMarketOracle } from './use-market-oracle';
import type { MarketInfoQuery } from '../components/market-info/__generated__/MarketInfo';
import type { Provider } from '@vegaprotocol/oracles';
const ORACLE_PROOFS_URL = 'ORACLE_PROOFS_URL';
const address = 'address';
const key = 'key';
const mockEnvironment = jest.fn(() => ({ ORACLE_PROOFS_URL }));
const mockDataProvider = jest.fn<
{ data: MarketInfoQuery['market'] },
unknown[]
>(() => ({
data: {
tradableInstrument: {
instrument: {
product: {
dataSourceSpecForSettlementData: {
data: {
sourceType: {
__typename: 'DataSourceDefinitionExternal',
sourceType: {
signers: [
{
signer: {
__typename: 'ETHAddress',
address,
},
},
{
signer: {
__typename: 'PubKey',
key,
},
},
],
},
},
},
},
},
},
},
} as MarketInfoQuery['market'],
}));
const mockOracleProofs = jest.fn<{ data?: Provider[] }, unknown[]>(() => ({}));
jest.mock('@vegaprotocol/environment', () => ({
useEnvironment: jest.fn((args) => mockEnvironment()),
}));
jest.mock('@vegaprotocol/react-helpers', () => ({
useDataProvider: jest.fn((args) => mockDataProvider()),
}));
jest.mock('@vegaprotocol/oracles', () => ({
useOracleProofs: jest.fn((args) => mockOracleProofs()),
}));
const marketId = 'marketId';
describe('useMarketOracle', () => {
it('returns undefined if no market info present', () => {
mockDataProvider.mockReturnValueOnce({ data: null });
const { result } = renderHook(() => useMarketOracle(marketId));
expect(result.current).toBeUndefined();
});
it('returns undefined if no oracle proofs present', () => {
mockOracleProofs.mockReturnValueOnce({ data: undefined });
const { result } = renderHook(() => useMarketOracle(marketId));
expect(result.current).toBeUndefined();
});
it('returns oracle matched by eth_address', () => {
const data = [
{
proofs: [
{
eth_address: 'eth_address',
type: 'eth_address',
},
],
oracle: {},
} as Provider,
{
proofs: [
{
eth_address: address,
type: 'eth_address',
},
],
oracle: {},
} as Provider,
];
mockOracleProofs.mockReturnValueOnce({
data,
});
const { result } = renderHook(() => useMarketOracle(marketId));
expect(result.current).toBe(data[1].oracle);
});
it('returns oracle matching by public_key', () => {
const data = [
{
proofs: [
{
public_key: 'public_key',
type: 'public_key',
},
],
oracle: {},
} as Provider,
{
proofs: [
{
public_key: key,
type: 'public_key',
},
],
oracle: {},
} as Provider,
];
mockOracleProofs.mockReturnValueOnce({
data,
});
const { result } = renderHook(() => useMarketOracle(marketId));
expect(result.current).toBe(data[1].oracle);
});
});
@@ -0,0 +1,43 @@
import { useEnvironment } from '@vegaprotocol/environment';
import { useOracleProofs } from '@vegaprotocol/oracles';
import { useDataProvider } from '@vegaprotocol/react-helpers';
import { marketInfoProvider } from '../components/market-info/market-info-data-provider';
import { useMemo } from 'react';
export const useMarketOracle = (marketId: string) => {
const { ORACLE_PROOFS_URL } = useEnvironment();
const { data: marketInfo } = useDataProvider({
dataProvider: marketInfoProvider,
variables: { marketId },
});
const { data } = useOracleProofs(ORACLE_PROOFS_URL);
return useMemo(() => {
if (!data || !marketInfo) {
return undefined;
}
const dataSource =
marketInfo.tradableInstrument.instrument.product
.dataSourceSpecForSettlementData.data;
return data.find((provider) =>
provider.proofs.some(
(proof) =>
(proof.type === 'eth_address' &&
dataSource.sourceType.__typename ===
'DataSourceDefinitionExternal' &&
dataSource.sourceType.sourceType.signers?.some(
(signer) =>
signer.signer.__typename === 'ETHAddress' &&
signer.signer.address === proof.eth_address
)) ||
(proof.type === 'public_key' &&
dataSource.sourceType.__typename ===
'DataSourceDefinitionExternal' &&
dataSource.sourceType.sourceType.signers?.some(
(signer) =>
signer.signer.__typename === 'PubKey' &&
signer.signer.key === proof.public_key
))
)
)?.oracle;
}, [data, marketInfo]);
};
+1
View File
@@ -1 +1,2 @@
export * from './components';
export * from './hooks';
@@ -176,14 +176,16 @@ export const MarketListTable = forwardRef<
/>
<AgGridColumn
headerName={t('Settlement asset')}
field="tradableInstrument.instrument.product.settlementAsset"
field="tradableInstrument.instrument.product.settlementAsset.symbol"
cellRenderer={({
value,
data,
}: VegaICellRendererParams<
MarketMaybeWithData,
'tradableInstrument.instrument.product.settlementAsset'
>) =>
value ? (
'tradableInstrument.instrument.product.settlementAsset.symbol'
>) => {
const value =
data?.tradableInstrument.instrument.product.settlementAsset;
return value ? (
<ButtonLink
onClick={(e) => {
openAssetDetailsDialog(value.id, e.target as HTMLElement);
@@ -193,8 +195,8 @@ export const MarketListTable = forwardRef<
</ButtonLink>
) : (
''
)
}
);
}}
/>
<AgGridColumn headerName={t('Market ID')} field="id" />
</AgGrid>
+1 -1
View File
@@ -8,6 +8,7 @@ import type {
TypedDataAgGrid,
VegaICellRendererParams,
} from '@vegaprotocol/datagrid';
import { ProgressBarCell } from '@vegaprotocol/datagrid';
import {
AgGridDynamic as AgGrid,
DateRangeFilter,
@@ -22,7 +23,6 @@ import {
TooltipCellComponent,
ExternalLink,
Icon,
ProgressBarCell,
} from '@vegaprotocol/ui-toolkit';
import {
volumePrefix,
+1 -1
View File
@@ -1,4 +1,4 @@
{
"name": "@vegaprotocol/react-helpers",
"version": "0.2.0"
"version": "0.2.1"
}
+1
View File
@@ -16,6 +16,7 @@
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "libs/react-helpers/README.md",
+2 -4
View File
@@ -1,13 +1,11 @@
import { useRef } from 'react';
import { BrowserTracing } from '@sentry/tracing';
import * as Sentry from '@sentry/browser';
import type { LocalLogger } from '@vegaprotocol/utils';
import type { LocalLogger, LoggerConf } from '@vegaprotocol/utils';
import { localLoggerFactory } from '@vegaprotocol/utils';
interface Props {
interface Props extends LoggerConf {
dsn?: string;
application?: string;
tags?: string[];
}
export const useLogger = ({ dsn, ...props }: Props) => {
+1 -1
View File
@@ -1,4 +1,4 @@
{
"name": "@vegaprotocol/tailwindcss-config",
"version": "0.0.1"
"version": "0.0.2"
}
+1
View File
@@ -6,6 +6,7 @@
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"format": ["esm", "cjs"],
"options": {
"outputPath": "dist/libs/tailwindcss-config",
"main": "libs/tailwindcss-config/src/index.js",
+1 -1
View File
@@ -1,4 +1,4 @@
{
"name": "@vegaprotocol/ui-toolkit",
"version": "0.11.0"
"version": "0.11.1"
}
+1
View File
@@ -16,6 +16,7 @@
"external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel",
"format": ["esm", "cjs"],
"assets": [
{
"glob": "libs/ui-toolkit/README.md",
@@ -16,7 +16,6 @@ export const Icon = ({ size = 4, name, className, ariaLabel }: IconProps) => {
'inline-block',
'fill-current',
'align-text-bottom',
'fill-current',
'shrink-0',
// Cant just concatenate as TW wont pick up that the class is being used
// so below syntax is required
+2 -2
View File
@@ -12,6 +12,7 @@ export * from './dialog';
export * from './drawer';
export * from './dropdown-menu';
export * from './form-group';
export * from './healthbar';
export * from './icon';
export * from './indicator';
export * from './input-error';
@@ -25,11 +26,11 @@ export * from './nav-dropdown';
export * from './nav';
export * from './navigation';
export * from './notification';
export * from './notification-banner';
export * from './pagination';
export * from './popover';
export * from './progress-bar';
export * from './radio-group';
export * from './resizable-grid';
export * from './rounded-wrapper';
export * from './select';
export * from './simple-grid';
@@ -49,4 +50,3 @@ export * from './traffic-light';
export * from './vega-icons';
export * from './vega-logo';
export * from './viewing-as-user';
export * from './healthbar';
@@ -0,0 +1 @@
export * from './notification-banner';
@@ -0,0 +1,45 @@
/* eslint-disable jsx-a11y/accessible-emoji */
import type { ComponentStory, ComponentMeta } from '@storybook/react';
import { Intent } from '../../utils/intent';
import { NotificationBanner } from './notification-banner';
import { Button } from '../button';
export default {
title: 'NotificationBanner',
component: NotificationBanner,
} as ComponentMeta<typeof NotificationBanner>;
const Template: ComponentStory<typeof NotificationBanner> = (args) => {
return (
<div className="flex flex-col gap-4">
<NotificationBanner
intent={Intent.Warning}
onClose={() => {
return;
}}
>
<div className="uppercase ">
The network will upgrade to v0.68.5 in{' '}
<span className="text-vega-orange-500">9234</span> blocks
</div>
<div>
Trading activity will be interrupted, manage your risk appropriately.
<a href="/">View details</a>
</div>
</NotificationBanner>
<NotificationBanner intent={Intent.Danger}>
The oracle for this market has been flagged as malicious by the
community.
</NotificationBanner>
<NotificationBanner>
Viewing as Vega user 0592X...20CKZ
<Button size="sm" className="ml-2">
Exit view as
</Button>
</NotificationBanner>
</div>
);
};
export const Default = Template.bind({});
Default.args = {};
@@ -0,0 +1,80 @@
import classNames from 'classnames';
import { toastIconMapping } from '../toast';
import { Intent } from '../../utils/intent';
import { Icon } from '../icon';
interface NotificationBannerProps {
intent?: Intent;
children?: React.ReactNode;
onClose?: () => void;
}
export const NotificationBanner = ({
intent = Intent.None,
children,
onClose,
}: NotificationBannerProps) => {
return (
<div
className={classNames(
'flex items-center p-3 border-b min-h-[56px]',
'text-[12px] leading-[16px] font-normal',
{
'bg-vega-light-100 dark:bg-vega-dark-100 ': intent === Intent.None,
'bg-vega-blue-300 dark:bg-vega-blue-700': intent === Intent.Primary,
'bg-vega-green-300 dark:bg-vega-green-700': intent === Intent.Success,
'bg-vega-orange-300 dark:bg-vega-orange-700':
intent === Intent.Warning,
'bg-vega-pink-300 dark:bg-vega-pink-700': intent === Intent.Danger,
},
{
'border-b-vega-light-200 dark:border-b-vega-dark-200 ':
intent === Intent.None,
'border-b-vega-blue-500 dark:border-b-vega-blue-500':
intent === Intent.Primary,
'border-b-vega-green-600 dark:border-b-vega-green-500':
intent === Intent.Success,
'border-b-vega-orange-500 dark:border-b-vega-orange-500':
intent === Intent.Warning,
'border-b-vega-pink-500 dark:border-b-vega-pink-500':
intent === Intent.Danger,
}
)}
>
{intent === Intent.None ? null : (
<Icon
name={toastIconMapping[intent]}
size={4}
className={classNames('mr-2', {
'text-vega-blue-500 dark:text-vega-blue-500':
intent === Intent.Primary,
'text-vega-green-600 dark:text-vega-green-500':
intent === Intent.Success,
'text-vega-orange-500 dark:text-vega-orange-500':
intent === Intent.Warning,
'text-vega-pink-500 dark:text-vega-pink-500':
intent === Intent.Danger,
})}
/>
)}
<div className="grow">{children}</div>
{onClose ? (
<button
type="button"
data-testid="notification-banner-close"
onClick={onClose}
className="ml-2"
>
<Icon name="cross" size={4} className="dark:text-white" />
</button>
) : null}
</div>
);
};
@@ -1,2 +1 @@
export * from './grid-progress-bar';
export * from './progress-bar';
@@ -1,24 +0,0 @@
import type { Story, Meta } from '@storybook/react';
import { ResizableGrid } from './resizable-grid';
import { Allotment } from 'allotment';
import 'allotment/dist/style.css';
export default {
component: ResizableGrid,
title: 'ResizablePanel',
} as Meta;
const Template: Story = (args) => (
<div className="h-48">
<ResizableGrid vertical={true}>
<Allotment.Pane minSize={20}>
<div>Panel 1</div>
</Allotment.Pane>
<Allotment.Pane minSize={20}>
<div>Panel 2</div>
</Allotment.Pane>
</ResizableGrid>
</div>
);
export const Default = Template.bind({});
@@ -30,7 +30,7 @@ type ToastProps = Toast & {
state?: ToastState;
};
const toastIconMapping: { [i in Intent]: IconName } = {
export const toastIconMapping: { [i in Intent]: IconName } = {
[Intent.None]: IconNames.HELP,
[Intent.Primary]: IconNames.INFO_SIGN,
[Intent.Success]: IconNames.TICK_CIRCLE,
+1 -1
View File
@@ -1,5 +1,5 @@
{
"name": "@vegaprotocol/utils",
"version": "0.0.1",
"version": "0.0.2",
"type": "commonjs"
}
+1
View File
@@ -6,6 +6,7 @@
"build": {
"executor": "@nrwl/js:tsc",
"outputs": ["{options.outputPath}"],
"format": ["esm", "cjs"],
"options": {
"outputPath": "dist/libs/utils",
"main": "libs/utils/src/index.ts",
+1 -1
View File
@@ -21,7 +21,7 @@ type ConsoleMethod = {
}[keyof Console] &
string;
interface LoggerConf {
export interface LoggerConf {
application?: string;
tags?: string[];
logLevel?: LogLevelsType;
+37 -26
View File
@@ -17489,6 +17489,11 @@ lodash.isboolean@^3.0.3:
resolved "https://registry.yarnpkg.com/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz#6c2e171db2a257cd96802fd43b01b20d5f5870f6"
integrity sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==
lodash.isempty@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.isempty/-/lodash.isempty-4.4.0.tgz#6f86cbedd8be4ec987be9aaf33c9684db1b31e7e"
integrity sha512-oKMuF3xEeqDltrGMfDxAPGIVMSSRv8tbRSODbrs4KGsRRLEhrW8N8Rd4DRgB2+621hY8A8XwwrTVhXWpxFvMzg==
lodash.isequal@4.5.0, lodash.isequal@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
@@ -18432,6 +18437,33 @@ mkdirp@^0.5.1, mkdirp@^0.5.3, mkdirp@^0.5.5, mkdirp@^0.5.6, mkdirp@~0.5.1:
dependencies:
minimist "^1.2.6"
mocha@^10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8"
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
dependencies:
ansi-colors "4.1.1"
browser-stdout "1.3.1"
chokidar "3.5.3"
debug "4.3.4"
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "5.0.1"
ms "2.1.3"
nanoid "3.3.3"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
workerpool "6.2.1"
yargs "16.2.0"
yargs-parser "20.2.4"
yargs-unparser "2.0.0"
mochawesome-merge@^4.2.1:
version "4.3.0"
resolved "https://registry.yarnpkg.com/mochawesome-merge/-/mochawesome-merge-4.3.0.tgz#7cc5d5730c7d8d1b034c8d8fecf3cd36e0010297"
@@ -18474,32 +18506,6 @@ mochawesome@^7.1.3:
mochawesome-report-generator "^6.2.0"
strip-ansi "^6.0.1"
uuid "^8.3.2"
mocha@^10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.2.0.tgz#1fd4a7c32ba5ac372e03a17eef435bd00e5c68b8"
integrity sha512-IDY7fl/BecMwFHzoqF2sg/SHHANeBoMMXFlS9r0OXKDssYE1M5O43wUY/9BVPeIvfH2zmEbBfseqN9gBQZzXkg==
dependencies:
ansi-colors "4.1.1"
browser-stdout "1.3.1"
chokidar "3.5.3"
debug "4.3.4"
diff "5.0.0"
escape-string-regexp "4.0.0"
find-up "5.0.0"
glob "7.2.0"
he "1.2.0"
js-yaml "4.1.0"
log-symbols "4.1.0"
minimatch "5.0.1"
ms "2.1.3"
nanoid "3.3.3"
serialize-javascript "6.0.0"
strip-json-comments "3.1.1"
supports-color "8.1.1"
workerpool "6.2.1"
yargs "16.2.0"
yargs-parser "20.2.4"
yargs-unparser "2.0.0"
mock-apollo-client@^1.2.0:
version "1.2.1"
@@ -24219,6 +24225,11 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
validator@^13.6.0:
version "13.9.0"
resolved "https://registry.yarnpkg.com/validator/-/validator-13.9.0.tgz#33e7b85b604f3bbce9bb1a05d5c3e22e1c2ff855"
integrity sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==
valtio@1.10.3:
version "1.10.3"
resolved "https://registry.yarnpkg.com/valtio/-/valtio-1.10.3.tgz#273eda9ba6459869798b4f58c84514e18fb80ed8"