Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
26493ca9d5 | ||
|
|
a8401d4c6f | ||
|
|
c030264211 | ||
|
|
068f7b3fc3 | ||
|
|
4430f0c5f6 | ||
|
|
0a14000708 | ||
|
|
9ca6fe3cbf | ||
|
|
4f96472375 | ||
|
|
cddf2ba00b | ||
|
|
d01d6f5815 |
@@ -12,6 +12,8 @@ on:
|
||||
- react-helpers
|
||||
- tailwindcss-config
|
||||
- types
|
||||
- utils
|
||||
- i18n
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
||||
@@ -2761,7 +2761,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "86666.297",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "66126.2911732114998055325",
|
||||
"locked_amount": "65888.8190337497085175298",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "86666.297",
|
||||
@@ -2827,7 +2827,7 @@
|
||||
"tranche_end": "2023-06-01T00:00:00.000Z",
|
||||
"total_added": "2500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1256.794045075295",
|
||||
"locked_amount": "1243.0560325091575",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2500",
|
||||
@@ -2948,7 +2948,7 @@
|
||||
"tranche_end": "2023-09-01T00:00:00.000Z",
|
||||
"total_added": "17500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "17451.93268166264",
|
||||
"locked_amount": "17356.8118772644925",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -3215,7 +3215,7 @@
|
||||
"tranche_end": "2023-08-01T00:00:00.000Z",
|
||||
"total_added": "37500",
|
||||
"total_removed": "3451.5629793",
|
||||
"locked_amount": "31594.18642572130125",
|
||||
"locked_amount": "31386.97772790055125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -3381,7 +3381,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "66065.95925284494122844",
|
||||
"locked_amount": "65828.703776830530732315",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -3447,7 +3447,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "62600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "31813.59552257737524",
|
||||
"locked_amount": "31642.06683789954558",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10000",
|
||||
@@ -3640,7 +3640,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "2732.8028285134455",
|
||||
"locked_amount": "2719.1024543378995",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -3851,7 +3851,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "97499.58",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "8026.753327469502229788",
|
||||
"locked_amount": "7794.0278068466617184238",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "97499.58",
|
||||
@@ -3884,7 +3884,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "135173.4239508",
|
||||
"total_removed": "98230.390980249184455396",
|
||||
"locked_amount": "10971.186037499547718723312584",
|
||||
"locked_amount": "10653.090429193107744542476008",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "135173.4239508",
|
||||
@@ -3930,7 +3930,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "32499.86",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "3376.7165102507267945488",
|
||||
"locked_amount": "3278.8129026794692276046",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "32499.86",
|
||||
@@ -3963,7 +3963,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "10833.29",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1099.0884572052014268704",
|
||||
"locked_amount": "1067.221782974876983662",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10833.29",
|
||||
@@ -3996,7 +3996,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "22749.93",
|
||||
"total_removed": "4720.860935375",
|
||||
"locked_amount": "4108.63813000654408794",
|
||||
"locked_amount": "3989.5133844404452945716",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "6500",
|
||||
@@ -4148,7 +4148,7 @@
|
||||
"tranche_end": "2023-05-01T00:00:00.000Z",
|
||||
"total_added": "22500",
|
||||
"total_removed": "4988.60449275",
|
||||
"locked_amount": "7520.047767034992",
|
||||
"locked_amount": "7395.722548342542",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -4434,7 +4434,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "928642.9598472029154",
|
||||
"locked_amount": "491597.019480432441937998",
|
||||
"locked_amount": "486281.47054448047845174",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -36813,8 +36813,8 @@
|
||||
"tranche_start": "2022-03-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "615950.831401702010493",
|
||||
"locked_amount": "779914.787767187799364679587",
|
||||
"total_removed": "618385.665327542135993",
|
||||
"locked_amount": "771746.63973020695967996929",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -36983,6 +36983,11 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "2434.8339258401255",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
|
||||
},
|
||||
{
|
||||
"amount": "16659.576193025747093",
|
||||
"user": "0xB523235B6c7C74DDB26b10E78bFb2d0Cb63Ae289",
|
||||
@@ -37357,6 +37362,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "2434.8339258401255",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tranche_id": 1,
|
||||
"tx": "0xcba878ae28c2c84219f8281dc2a57d0d9b6c99b7920900d5344c76aabe8f1e84"
|
||||
},
|
||||
{
|
||||
"amount": "6293.20485405503",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -37641,8 +37652,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "187637.95",
|
||||
"withdrawn_tokens": "146054.503703913043",
|
||||
"remaining_tokens": "41583.446296086957"
|
||||
"withdrawn_tokens": "148489.3376297531685",
|
||||
"remaining_tokens": "39148.6123702468315"
|
||||
},
|
||||
{
|
||||
"address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e",
|
||||
@@ -38162,8 +38173,8 @@
|
||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "585442.32676055889219452",
|
||||
"locked_amount": "8065215.3477477860118006909778900766450392",
|
||||
"total_removed": "586757.93761874998960452",
|
||||
"locked_amount": "8036251.6192538834556613842019307768004867",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -38707,6 +38718,26 @@
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xb54d54fd5a6211e97495020ad17e9f045d032999ed94ea31994958304010aa85"
|
||||
},
|
||||
{
|
||||
"amount": "133.7749515525265",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tx": "0xed77ed534414a1949b1473707782223907e0ac001f899037ff822f10bd4a358a"
|
||||
},
|
||||
{
|
||||
"amount": "261.60674662018875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tx": "0xdbd9367c0d60c1bd9165752d8fab223aa43c7c2e85568a4e98e86ad0e0c97a01"
|
||||
},
|
||||
{
|
||||
"amount": "394.58033601838216",
|
||||
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
|
||||
"tx": "0xe479984e1fc0f4a0040603b528c841013d6da2c890361ce5f4152256ea9dd009"
|
||||
},
|
||||
{
|
||||
"amount": "525.648824",
|
||||
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
|
||||
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
|
||||
},
|
||||
{
|
||||
"amount": "535.4042378778335",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -40500,6 +40531,12 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0xb54d54fd5a6211e97495020ad17e9f045d032999ed94ea31994958304010aa85"
|
||||
},
|
||||
{
|
||||
"amount": "261.60674662018875",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xdbd9367c0d60c1bd9165752d8fab223aa43c7c2e85568a4e98e86ad0e0c97a01"
|
||||
},
|
||||
{
|
||||
"amount": "535.4042378778335",
|
||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||
@@ -41714,8 +41751,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "259998.8875",
|
||||
"withdrawn_tokens": "127812.81440269060675",
|
||||
"remaining_tokens": "132186.07309730939325"
|
||||
"withdrawn_tokens": "128074.4211493107955",
|
||||
"remaining_tokens": "131924.4663506892045"
|
||||
},
|
||||
{
|
||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||
@@ -41948,6 +41985,12 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0x3c76f03b71481a44c6ba2c7cea407f5f1bac60bcaa9242af18de287f94c8ed90"
|
||||
},
|
||||
{
|
||||
"amount": "394.58033601838216",
|
||||
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xe479984e1fc0f4a0040603b528c841013d6da2c890361ce5f4152256ea9dd009"
|
||||
},
|
||||
{
|
||||
"amount": "1640.93679110232897",
|
||||
"user": "0xe3eB4CF43C072658401996b71D43eE26E573562D",
|
||||
@@ -42190,8 +42233,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "150551.801",
|
||||
"withdrawn_tokens": "73885.95651128121547",
|
||||
"remaining_tokens": "76665.84448871878453"
|
||||
"withdrawn_tokens": "74280.53684729959763",
|
||||
"remaining_tokens": "76271.26415270040237"
|
||||
},
|
||||
{
|
||||
"address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148",
|
||||
@@ -42399,6 +42442,12 @@
|
||||
"tranche_id": 2,
|
||||
"tx": "0x1887d1fb77d9fa555dd5b55da307edc91e395f3a7e0ca5f874740f5a10077cdf"
|
||||
},
|
||||
{
|
||||
"amount": "525.648824",
|
||||
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
|
||||
"tranche_id": 2,
|
||||
"tx": "0x132a15c0b5f8c6016ac1a90437b9dca119ebc2479cde9c702327653fa3c11750"
|
||||
},
|
||||
{
|
||||
"amount": "2820.55961",
|
||||
"user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37",
|
||||
@@ -42611,8 +42660,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "200000",
|
||||
"withdrawn_tokens": "98152.824242",
|
||||
"remaining_tokens": "101847.175758"
|
||||
"withdrawn_tokens": "98678.473066",
|
||||
"remaining_tokens": "101321.526934"
|
||||
},
|
||||
{
|
||||
"address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01",
|
||||
@@ -43072,6 +43121,12 @@
|
||||
}
|
||||
],
|
||||
"withdrawals": [
|
||||
{
|
||||
"amount": "133.7749515525265",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
"tranche_id": 2,
|
||||
"tx": "0xed77ed534414a1949b1473707782223907e0ac001f899037ff822f10bd4a358a"
|
||||
},
|
||||
{
|
||||
"amount": "345.7620519411935",
|
||||
"user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0",
|
||||
@@ -43338,8 +43393,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "12362.05",
|
||||
"withdrawn_tokens": "5949.173638923777",
|
||||
"remaining_tokens": "6412.876361076223"
|
||||
"withdrawn_tokens": "6082.9485904763035",
|
||||
"remaining_tokens": "6279.1014095236965"
|
||||
},
|
||||
{
|
||||
"address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC",
|
||||
@@ -43970,8 +44025,8 @@
|
||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||
"total_added": "14597706.0446472999",
|
||||
"total_removed": "5577730.800522677126225156",
|
||||
"locked_amount": "1724310.085864232345131785821604681",
|
||||
"total_removed": "5578092.828988683569444906",
|
||||
"locked_amount": "1697570.95665381351801300648336951",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129284.449",
|
||||
@@ -44205,6 +44260,11 @@
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xcc545119eac3fe838555697dae55ce68273cb4c5f414c8983bac9f7ef8338f2c"
|
||||
},
|
||||
{
|
||||
"amount": "362.02846600644321975",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
|
||||
},
|
||||
{
|
||||
"amount": "800.792718381487871",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -47190,6 +47250,12 @@
|
||||
"tranche_id": 3,
|
||||
"tx": "0xcc545119eac3fe838555697dae55ce68273cb4c5f414c8983bac9f7ef8338f2c"
|
||||
},
|
||||
{
|
||||
"amount": "362.02846600644321975",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
"tranche_id": 3,
|
||||
"tx": "0xbecb2d5ad72cdfe972b450c388f111d9262c39896c71acceecb5f672e50c3ce9"
|
||||
},
|
||||
{
|
||||
"amount": "800.792718381487871",
|
||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||
@@ -49706,8 +49772,8 @@
|
||||
}
|
||||
],
|
||||
"total_tokens": "359123.469575",
|
||||
"withdrawn_tokens": "316627.82419217025121175",
|
||||
"remaining_tokens": "42495.64538282974878825"
|
||||
"withdrawn_tokens": "316989.8526581766944315",
|
||||
"remaining_tokens": "42133.6169168233055685"
|
||||
},
|
||||
{
|
||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||
@@ -51051,7 +51117,7 @@
|
||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||
"total_added": "5778205.3912159303",
|
||||
"total_removed": "3077573.36197477479025324",
|
||||
"locked_amount": "364381.939925353626624604984386745",
|
||||
"locked_amount": "353817.1482574094718858681604364422",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "552496.6455",
|
||||
@@ -53123,7 +53189,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "34992.4553336210685",
|
||||
"locked_amount": "123581.941326403371637891942567224",
|
||||
"locked_amount": "122287.66655711750460814439269404",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
|
||||
@@ -20,46 +20,78 @@ describe('positions', { tags: '@smoke' }, () => {
|
||||
cy.getByTestId('Positions').click();
|
||||
validatePositionsDisplayed();
|
||||
});
|
||||
|
||||
it('renders position among some graphql errors', () => {
|
||||
const errors = [
|
||||
{
|
||||
message: 'no market data for market: market-2',
|
||||
path: ['market', 'data'],
|
||||
extensions: {
|
||||
code: 13,
|
||||
type: 'Internal',
|
||||
describe('renders position among some graphql errors', () => {
|
||||
it('rows should be displayed despite errors', () => {
|
||||
const errors = [
|
||||
{
|
||||
message:
|
||||
'no market data for market: 9c55fb644c6f7de5422d40d691a62bffd5898384c70135bab29ba1e3e2e5280a',
|
||||
path: ['marketsConnection', 'edges'],
|
||||
extensions: {
|
||||
code: 13,
|
||||
type: 'Internal',
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
const marketData = marketsDataQuery();
|
||||
const edges = marketData.marketsConnection?.edges.map((market) => {
|
||||
const replace =
|
||||
market.node.data?.market.id === 'market-2' ? null : market.node.data;
|
||||
return { ...market, node: { ...market.node, data: replace } };
|
||||
});
|
||||
const overrides = {
|
||||
...marketData,
|
||||
marketsConnection: { ...marketData.marketsConnection, edges },
|
||||
};
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'MarketsData', overrides, errors);
|
||||
});
|
||||
cy.visit('/#/markets/market-0');
|
||||
const emptyCells = [
|
||||
'notional',
|
||||
'markPrice',
|
||||
'liquidationPrice',
|
||||
'currentLeverage',
|
||||
'averageEntryPrice',
|
||||
];
|
||||
cy.getByTestId('tab-positions').within(() => {
|
||||
cy.get('[row-id="market-2"]').within(() => {
|
||||
emptyCells.forEach((cell) => {
|
||||
cy.get(`[col-id="${cell}"]`).should('contain.text', '-');
|
||||
];
|
||||
const marketData = marketsDataQuery();
|
||||
const edges = marketData.marketsConnection?.edges.map((market) => {
|
||||
const replace =
|
||||
market.node.data?.market.id === 'market-2' ? null : market.node.data;
|
||||
return { ...market, node: { ...market.node, data: replace } };
|
||||
});
|
||||
const overrides = {
|
||||
...marketData,
|
||||
marketsConnection: { ...marketData.marketsConnection, edges },
|
||||
};
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'MarketsData', overrides, errors);
|
||||
});
|
||||
cy.visit('/#/markets/market-0');
|
||||
const emptyCells = [
|
||||
'notional',
|
||||
'markPrice',
|
||||
'liquidationPrice',
|
||||
'currentLeverage',
|
||||
'averageEntryPrice',
|
||||
];
|
||||
cy.getByTestId('tab-positions').within(() => {
|
||||
cy.get('[row-id="market-2"]').within(() => {
|
||||
emptyCells.forEach((cell) => {
|
||||
cy.get(`[col-id="${cell}"]`).should('contain.text', '-');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
it('error message should be displayed', () => {
|
||||
const errors = [
|
||||
{
|
||||
message:
|
||||
'no market data for asset: 9c55fb644c6f7de5422d40d691a62bffd5898384c70135bab29ba1e3e2e5280a',
|
||||
path: ['assets', 'edges'],
|
||||
extensions: {
|
||||
code: 13,
|
||||
type: 'Internal',
|
||||
},
|
||||
},
|
||||
];
|
||||
const marketData = marketsDataQuery();
|
||||
const edges = marketData.marketsConnection?.edges.map((market) => {
|
||||
const replace =
|
||||
market.node.data?.market.id === 'market-2' ? null : market.node.data;
|
||||
return { ...market, node: { ...market.node, data: replace } };
|
||||
});
|
||||
const overrides = {
|
||||
...marketData,
|
||||
marketsConnection: { ...marketData.marketsConnection, edges },
|
||||
};
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'MarketsData', overrides, errors);
|
||||
});
|
||||
cy.visit('/#/markets/market-0');
|
||||
cy.get('.pointer-events-none.absolute.inset-0').contains(
|
||||
'Something went wrong:'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('sorting by ag-grid columns should work well', () => {
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
|
||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json
|
||||
NX_VEGA_ENV=VALIDATOR_TESTNET
|
||||
NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_VEGA_TOKEN_URL=https://token.fairground.wtf
|
||||
NX_VEGA_EXPLORER_URL=https://validator-testnet.explorer.vega.xyz
|
||||
NX_VEGA_NETWORKS={\"STAGNET3\":\"https://stagnet3.console.vega.xyz\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
|
||||
NX_VEGA_TOKEN_URL=https://validator-testnet.governance.fairground.wtf
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega/releases
|
||||
|
||||
@@ -24,6 +24,7 @@ export const Banner = () => {
|
||||
<AnnouncementBanner>
|
||||
<div className="grid grid-cols-[auto_1fr] gap-4 font-alpha calt uppercase text-center text-lg text-white">
|
||||
<button
|
||||
className="flex items-center"
|
||||
onClick={() => update({ shouldDisplayAnnouncementBanner: false })}
|
||||
>
|
||||
<Icon name="cross" className="w-6 h-6" ariaLabel="dismiss" />
|
||||
|
||||
@@ -37,6 +37,7 @@ import {
|
||||
usePersistedOrderStoreSubscription,
|
||||
} from '@vegaprotocol/orders';
|
||||
import { OrderType } from '@vegaprotocol/types';
|
||||
import isNumber from 'lodash/isNumber';
|
||||
|
||||
export type TransactionStatus = 'default' | 'pending';
|
||||
|
||||
@@ -82,11 +83,17 @@ export const DealTicket = ({
|
||||
|
||||
const order = watch();
|
||||
|
||||
watch((orderData) => {
|
||||
if (orderData.type === OrderType.TYPE_LIMIT && orderData.price === '') {
|
||||
setPersistedOrder(orderData as DealTicketFormFields);
|
||||
}
|
||||
});
|
||||
useEffect(() => {
|
||||
const { unsubscribe } = watch((orderData) => {
|
||||
const persistable = !(
|
||||
orderData.type === OrderType.TYPE_LIMIT && orderData.price === ''
|
||||
);
|
||||
if (persistable) {
|
||||
setPersistedOrder(orderData as DealTicketFormFields);
|
||||
}
|
||||
});
|
||||
return () => unsubscribe();
|
||||
}, [setPersistedOrder, watch]);
|
||||
|
||||
usePersistedOrderStoreSubscription(market.id, (storedOrder) => {
|
||||
if (order.price !== storedOrder.price) {
|
||||
|
||||
@@ -22,7 +22,11 @@ import {
|
||||
normalizeOrderAmendment,
|
||||
useVegaTransactionStore,
|
||||
} from '@vegaprotocol/wallet';
|
||||
import type { VegaTxState, TransactionResult } from '@vegaprotocol/wallet';
|
||||
import type {
|
||||
VegaTxState,
|
||||
TransactionResult,
|
||||
OrderTxUpdateFieldsFragment,
|
||||
} from '@vegaprotocol/wallet';
|
||||
import { OrderEditDialog } from '../order-list/order-edit-dialog';
|
||||
import type { OrderSubFieldsFragment } from '../../order-hooks';
|
||||
import * as Schema from '@vegaprotocol/types';
|
||||
@@ -203,7 +207,19 @@ export const OrderListManager = ({
|
||||
fields.limitPrice,
|
||||
fields.size
|
||||
);
|
||||
create({ orderAmendment });
|
||||
const originalOrder: OrderTxUpdateFieldsFragment = {
|
||||
type: editOrder.type,
|
||||
id: editOrder.id,
|
||||
status: editOrder.status,
|
||||
createdAt: editOrder.createdAt,
|
||||
size: editOrder.size,
|
||||
price: editOrder.price,
|
||||
timeInForce: editOrder.timeInForce,
|
||||
expiresAt: editOrder.expiresAt,
|
||||
side: editOrder.side,
|
||||
marketId: editOrder.market.id,
|
||||
};
|
||||
create({ orderAmendment }, originalOrder);
|
||||
setEditOrder(null);
|
||||
}}
|
||||
/>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { captureException } from '@sentry/react';
|
||||
import debounce from 'lodash/debounce';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { localLoggerFactory } from '@vegaprotocol/utils';
|
||||
|
||||
type ResizeObserverConfiguration = {
|
||||
debounceTime: number;
|
||||
@@ -19,20 +19,26 @@ export function useResizeObserver(
|
||||
callback: ResizeObserverCallback,
|
||||
options: ResizeObserverConfiguration = DEFAULT_OPTIONS
|
||||
) {
|
||||
const wrappedCb = useCallback(
|
||||
(entries: ResizeObserverEntry[], observer: ResizeObserver) =>
|
||||
window.requestAnimationFrame(() => {
|
||||
options.debounceTime > 0
|
||||
? debounce(callback, options.debounceTime)(entries, observer)
|
||||
: callback(entries, observer);
|
||||
}),
|
||||
[callback, options.debounceTime]
|
||||
);
|
||||
|
||||
const observer = useMemo(() => {
|
||||
return new ResizeObserver(
|
||||
options.debounceTime > 0
|
||||
? debounce(callback, options.debounceTime)
|
||||
: callback
|
||||
);
|
||||
}, [callback, options.debounceTime]);
|
||||
return new ResizeObserver(wrappedCb);
|
||||
}, [wrappedCb]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!observer || !target) return;
|
||||
try {
|
||||
observer.observe(target, options.config);
|
||||
} catch (err) {
|
||||
captureException(err);
|
||||
localLoggerFactory({ application: 'react-helpers' }).debug(err as Error);
|
||||
}
|
||||
return () => observer?.disconnect();
|
||||
}, [observer, options.config, target]);
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { ApolloError } from '@apollo/client';
|
||||
import type { GraphQLErrors } from '@apollo/client/errors';
|
||||
|
||||
const NOT_FOUND = 'NotFound';
|
||||
const INTERNAL = 'Internal';
|
||||
|
||||
const isApolloGraphQLError = (
|
||||
error: ApolloError | Error | undefined
|
||||
@@ -29,12 +28,5 @@ export const isNotFoundGraphQLError = (
|
||||
);
|
||||
};
|
||||
|
||||
export const marketDataErrorPolicyGuard = (errors: GraphQLErrors) => {
|
||||
const path = ['market', 'data'];
|
||||
return errors.every(
|
||||
(e) =>
|
||||
e.extensions &&
|
||||
e.extensions['type'] === INTERNAL &&
|
||||
(!path || path.every((item, i) => item === e?.path?.[i]))
|
||||
);
|
||||
};
|
||||
export const marketDataErrorPolicyGuard = (errors: GraphQLErrors) =>
|
||||
errors.every((e) => e.message.match(/no market data for market:/i));
|
||||
|
||||
@@ -49,10 +49,10 @@ export class LocalLogger {
|
||||
return LocalLogger.levelLogMap[this._logLevel];
|
||||
}
|
||||
private tags: string[] = [];
|
||||
private application = 'trading';
|
||||
private _application = 'trading';
|
||||
constructor(conf: LoggerConf) {
|
||||
if (conf.application) {
|
||||
this.application = conf.application;
|
||||
this._application = conf.application;
|
||||
}
|
||||
this.tags = [...(conf.tags || [])];
|
||||
this._logLevel = conf.logLevel || this._logLevel;
|
||||
@@ -85,7 +85,7 @@ export class LocalLogger {
|
||||
) {
|
||||
if (this.numberLogLevel <= LocalLogger.levelLogMap[level]) {
|
||||
console[logMethod].apply(console, [
|
||||
`${this.application}:${level}: `,
|
||||
`${this._application}:${level}: `,
|
||||
...args,
|
||||
]);
|
||||
}
|
||||
@@ -148,13 +148,23 @@ export class LocalLogger {
|
||||
public get logLevel() {
|
||||
return this._logLevel;
|
||||
}
|
||||
public get application() {
|
||||
return this._application;
|
||||
}
|
||||
}
|
||||
|
||||
let singleLoggerInstance: LocalLogger;
|
||||
let singleLoggerInstances: LocalLogger[];
|
||||
|
||||
export const localLoggerFactory = (conf: LoggerConf) => {
|
||||
if (!singleLoggerInstances) {
|
||||
singleLoggerInstances = [];
|
||||
}
|
||||
let singleLoggerInstance = singleLoggerInstances.find(
|
||||
(instance) => instance.application === conf.application
|
||||
);
|
||||
if (!singleLoggerInstance) {
|
||||
singleLoggerInstance = new LocalLogger(conf);
|
||||
singleLoggerInstances.push(singleLoggerInstance);
|
||||
}
|
||||
if (conf.logLevel && singleLoggerInstance.logLevel !== conf.logLevel) {
|
||||
singleLoggerInstance.setLogLevel(conf.logLevel);
|
||||
|
||||
@@ -2,9 +2,16 @@ import { useVegaTransactionStore } from './use-vega-transaction-store';
|
||||
import { VegaTxStatus } from './use-vega-transaction';
|
||||
import type { VegaStoredTxState } from './use-vega-transaction-store';
|
||||
import type {
|
||||
OrderAmendmentBody,
|
||||
OrderCancellationBody,
|
||||
WithdrawSubmissionBody,
|
||||
} from './connectors/vega-connector';
|
||||
import {
|
||||
OrderStatus,
|
||||
OrderTimeInForce,
|
||||
OrderType,
|
||||
Side,
|
||||
} from '@vegaprotocol/types';
|
||||
|
||||
jest.mock('./utils', () => ({
|
||||
...jest.requireActual('./utils'),
|
||||
@@ -24,6 +31,33 @@ describe('useVegaTransactionStore', () => {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const orderAmendment: OrderAmendmentBody = {
|
||||
orderAmendment: {
|
||||
orderId:
|
||||
'6a4fcd0ba478df2f284ef5f6d3c64a478cb8043d3afe36f66f92c0ed92631e64',
|
||||
marketId:
|
||||
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
|
||||
price: '1122',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
sizeDelta: 0,
|
||||
},
|
||||
};
|
||||
|
||||
const originalOrder = {
|
||||
type: OrderType.TYPE_LIMIT,
|
||||
id: '6902dea1fa01f0b98cceb382cb9c95df244747fa27ba591de084cdd876d2f7c2',
|
||||
status: OrderStatus.STATUS_ACTIVE,
|
||||
createdAt: '2023-03-01T14:08:13.48478Z',
|
||||
size: '12',
|
||||
price: '1125',
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
expiresAt: null,
|
||||
side: Side.SIDE_BUY,
|
||||
marketId:
|
||||
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
|
||||
};
|
||||
|
||||
const processedTransactionUpdate = {
|
||||
status: VegaTxStatus.Pending,
|
||||
txHash: 'txHash',
|
||||
@@ -63,6 +97,45 @@ describe('useVegaTransactionStore', () => {
|
||||
VegaTxStatus.Requested,
|
||||
]);
|
||||
});
|
||||
|
||||
it('updates an order with order amendment', () => {
|
||||
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
|
||||
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
|
||||
useVegaTransactionStore.getState().create(orderAmendment, originalOrder);
|
||||
const transaction = useVegaTransactionStore.getState().transactions[1];
|
||||
useVegaTransactionStore
|
||||
.getState()
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
.update(transaction!.id, { status: VegaTxStatus.Pending });
|
||||
expect(
|
||||
useVegaTransactionStore.getState().transactions.map((t) => t?.status)
|
||||
).toEqual([
|
||||
VegaTxStatus.Requested,
|
||||
VegaTxStatus.Pending,
|
||||
VegaTxStatus.Requested,
|
||||
]);
|
||||
expect(
|
||||
useVegaTransactionStore
|
||||
.getState()
|
||||
.transactions.map((t) => t?.order?.price)
|
||||
).toEqual(['1125', '1125', '1125']);
|
||||
|
||||
const result = {
|
||||
orderAmendment: {
|
||||
marketId:
|
||||
'3aa2a828687cc3d59e92445d294891cbbd40e2165bbfb15674158ef5d4e8848d',
|
||||
orderId:
|
||||
'6a4fcd0ba478df2f284ef5f6d3c64a478cb8043d3afe36f66f92c0ed92631e64',
|
||||
price: '1122',
|
||||
sizeDelta: 0,
|
||||
timeInForce: OrderTimeInForce.TIME_IN_FORCE_GTC,
|
||||
},
|
||||
};
|
||||
expect(
|
||||
useVegaTransactionStore.getState().transactions.map((t) => t?.body)
|
||||
).toStrictEqual([result, result, result]);
|
||||
});
|
||||
|
||||
it('sets dialogOpen to false on dismiss', () => {
|
||||
useVegaTransactionStore.getState().create(orderCancellation);
|
||||
useVegaTransactionStore.getState().dismiss(0);
|
||||
@@ -70,6 +143,7 @@ describe('useVegaTransactionStore', () => {
|
||||
useVegaTransactionStore.getState().transactions[0]?.dialogOpen
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
it('updates transaction result', () => {
|
||||
useVegaTransactionStore.getState().create(withdrawSubmission);
|
||||
useVegaTransactionStore.getState().update(0, processedTransactionUpdate);
|
||||
@@ -80,6 +154,7 @@ describe('useVegaTransactionStore', () => {
|
||||
useVegaTransactionStore.getState().transactions[0]?.transactionResult
|
||||
).toEqual(transactionResult);
|
||||
});
|
||||
|
||||
it('updates withdrawal', () => {
|
||||
useVegaTransactionStore.getState().create(withdrawSubmission);
|
||||
useVegaTransactionStore.getState().update(0, processedTransactionUpdate);
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface VegaStoredTxState extends VegaTxState {
|
||||
}
|
||||
export interface VegaTransactionStore {
|
||||
transactions: (VegaStoredTxState | undefined)[];
|
||||
create: (tx: Transaction) => number;
|
||||
create: (tx: Transaction, order?: OrderTxUpdateFieldsFragment) => number;
|
||||
update: (
|
||||
index: number,
|
||||
update: Partial<
|
||||
@@ -55,7 +55,7 @@ export interface VegaTransactionStore {
|
||||
export const useVegaTransactionStore = create(
|
||||
subscribeWithSelector<VegaTransactionStore>((set, get) => ({
|
||||
transactions: [] as VegaStoredTxState[],
|
||||
create: (body: Transaction) => {
|
||||
create: (body: Transaction, order?: OrderTxUpdateFieldsFragment) => {
|
||||
const transactions = get().transactions;
|
||||
const now = new Date();
|
||||
const transaction: VegaStoredTxState = {
|
||||
@@ -68,6 +68,7 @@ export const useVegaTransactionStore = create(
|
||||
signature: null,
|
||||
status: VegaTxStatus.Requested,
|
||||
dialogOpen: true,
|
||||
order,
|
||||
};
|
||||
set({ transactions: transactions.concat(transaction) });
|
||||
return transaction.id;
|
||||
@@ -165,7 +166,11 @@ export const useVegaTransactionStore = create(
|
||||
// TODO: handle multiple orders from batch market instructions
|
||||
// Note: If multiple orders are submitted the first order ID is determined by hashing the signature of the transaction
|
||||
// (see determineId function). For each subsequent order's ID, a hash of the previous orders ID is used
|
||||
transaction.order = order;
|
||||
transaction.order =
|
||||
isOrderAmendmentTransaction(transaction?.body) &&
|
||||
transaction.order
|
||||
? transaction.order // the transaction.order would be the original order amended
|
||||
: order;
|
||||
transaction.status = VegaTxStatus.Complete;
|
||||
transaction.dialogOpen = true;
|
||||
transaction.updatedAt = new Date();
|
||||
|
||||
Reference in New Issue
Block a user