Merge branch 'master' of github.com:vegaprotocol/frontend-monorepo
This commit is contained in:
commit
b62d06d8d4
@ -28,9 +28,10 @@ export const Nav = ({ menuOpen }: NavProps) => {
|
|||||||
className={({ isActive }) =>
|
className={({ isActive }) =>
|
||||||
classnames(
|
classnames(
|
||||||
'block mb-8 px-8',
|
'block mb-8 px-8',
|
||||||
'text-h5 hover:bg-vega-yellow hover:text-black',
|
'text-h5 hover:bg-vega-pink dark:hover:bg-vega-yellow hover:text-white dark:hover:text-black',
|
||||||
{
|
{
|
||||||
'bg-vega-yellow text-black': isActive,
|
'bg-vega-pink text-white dark:bg-vega-yellow dark:text-black':
|
||||||
|
isActive,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -56,14 +56,14 @@ export const TxsInfiniteListItem = ({
|
|||||||
data-testid="command-details"
|
data-testid="command-details"
|
||||||
>
|
>
|
||||||
<Icon name="search-template" />
|
<Icon name="search-template" />
|
||||||
|
</button>
|
||||||
<Dialog
|
<Dialog
|
||||||
open={open}
|
open={open}
|
||||||
onChange={(isOpen) => setOpen(isOpen)}
|
onChange={(isOpen) => setOpen(false)}
|
||||||
intent={Intent.None}
|
intent={Intent.None}
|
||||||
>
|
>
|
||||||
<SyntaxHighlighter data={JSON.parse(Command)} />
|
<SyntaxHighlighter data={JSON.parse(Command)} />
|
||||||
</Dialog>
|
</Dialog>
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||||
"total_added": "129999.45",
|
"total_added": "129999.45",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "124186.56041865939631899",
|
"locked_amount": "123949.3351449367653555",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "129999.45",
|
"amount": "129999.45",
|
||||||
@ -488,7 +488,7 @@
|
|||||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||||
"total_added": "97499.58",
|
"total_added": "97499.58",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "65037.648892235152359708",
|
"locked_amount": "64804.952997247079204604",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "97499.58",
|
"amount": "97499.58",
|
||||||
@ -521,7 +521,7 @@
|
|||||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||||
"total_added": "135173.4239508",
|
"total_added": "135173.4239508",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "88895.23775402196371772604572",
|
"locked_amount": "88577.18263884362270361639432",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "135173.4239508",
|
"amount": "135173.4239508",
|
||||||
@ -554,7 +554,7 @@
|
|||||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||||
"total_added": "32499.86",
|
"total_added": "32499.86",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "27360.21574884189648315",
|
"locked_amount": "27262.324604263582721104",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "32499.86",
|
"amount": "32499.86",
|
||||||
@ -587,7 +587,7 @@
|
|||||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||||
"total_added": "10833.29",
|
"total_added": "10833.29",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "8905.484728998842512346",
|
"locked_amount": "8873.622111351784071168",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "10833.29",
|
"amount": "10833.29",
|
||||||
@ -675,7 +675,7 @@
|
|||||||
"tranche_end": "2022-11-01T00:00:00.000Z",
|
"tranche_end": "2022-11-01T00:00:00.000Z",
|
||||||
"total_added": "22500",
|
"total_added": "22500",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "15223.73612998188375",
|
"locked_amount": "15101.45352128623275",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "15000",
|
"amount": "15000",
|
||||||
@ -761,7 +761,7 @@
|
|||||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||||
"total_added": "1939928.38",
|
"total_added": "1939928.38",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "1793749.89229780380096827",
|
"locked_amount": "1788435.020023831121162896",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "1852091.69",
|
"amount": "1852091.69",
|
||||||
@ -1777,7 +1777,7 @@
|
|||||||
"tranche_end": "2022-09-30T00:00:00.000Z",
|
"tranche_end": "2022-09-30T00:00:00.000Z",
|
||||||
"total_added": "60916.66666633337",
|
"total_added": "60916.66666633337",
|
||||||
"total_removed": "18705.279504739679372649",
|
"total_removed": "18705.279504739679372649",
|
||||||
"locked_amount": "14447.6106782408306155580286543045",
|
"locked_amount": "14291.414097045104884895635487211",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "2833.333333",
|
"amount": "2833.333333",
|
||||||
@ -5228,7 +5228,7 @@
|
|||||||
"tranche_end": "2022-09-03T00:00:00.000Z",
|
"tranche_end": "2022-09-03T00:00:00.000Z",
|
||||||
"total_added": "19457.000000000000000003",
|
"total_added": "19457.000000000000000003",
|
||||||
"total_removed": "5056.88782409978",
|
"total_removed": "5056.88782409978",
|
||||||
"locked_amount": "3491.40304829401407518053832600837138522",
|
"locked_amount": "3438.09619897894364166053010683028919314",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "75",
|
"amount": "75",
|
||||||
@ -14143,7 +14143,7 @@
|
|||||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||||
"total_added": "3732368.4671",
|
"total_added": "3732368.4671",
|
||||||
"total_removed": "74162.9780761646031",
|
"total_removed": "74162.9780761646031",
|
||||||
"locked_amount": "2780870.39180910746474557688",
|
"locked_amount": "2772703.2835660003368440463",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "1998.95815",
|
"amount": "1998.95815",
|
||||||
@ -14855,8 +14855,8 @@
|
|||||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||||
"total_added": "15788853.065470999700000001",
|
"total_added": "15788853.065470999700000001",
|
||||||
"total_removed": "8648.631845187181275",
|
"total_removed": "8977.81072959055965",
|
||||||
"locked_amount": "15082858.8517601414887782644731138155812382",
|
"locked_amount": "15054047.07609322321427388182456345806299",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "16249.93",
|
"amount": "16249.93",
|
||||||
@ -15395,6 +15395,11 @@
|
|||||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||||
"tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28"
|
"tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "329.178884403378375",
|
||||||
|
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||||
|
"tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "2446.31552516990115",
|
"amount": "2446.31552516990115",
|
||||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||||
@ -15535,6 +15540,12 @@
|
|||||||
"tranche_id": 2,
|
"tranche_id": 2,
|
||||||
"tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28"
|
"tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "329.178884403378375",
|
||||||
|
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||||
|
"tranche_id": 2,
|
||||||
|
"tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "2446.31552516990115",
|
"amount": "2446.31552516990115",
|
||||||
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
"user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b",
|
||||||
@ -15579,8 +15590,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "194999.1675",
|
"total_tokens": "194999.1675",
|
||||||
"withdrawn_tokens": "8648.631845187181275",
|
"withdrawn_tokens": "8977.81072959055965",
|
||||||
"remaining_tokens": "186350.535654812818725"
|
"remaining_tokens": "186021.35677040944035"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
"address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c",
|
||||||
@ -16984,8 +16995,8 @@
|
|||||||
"tranche_start": "2021-11-05T00:00:00.000Z",
|
"tranche_start": "2021-11-05T00:00:00.000Z",
|
||||||
"tranche_end": "2023-05-05T00:00:00.000Z",
|
"tranche_end": "2023-05-05T00:00:00.000Z",
|
||||||
"total_added": "14597706.0446472999",
|
"total_added": "14597706.0446472999",
|
||||||
"total_removed": "2114974.470447369009412382",
|
"total_removed": "2158746.556523576443330677",
|
||||||
"locked_amount": "8274608.90495455977196820197238862",
|
"locked_amount": "8247873.1795980633455589418403988",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "129284.449",
|
"amount": "129284.449",
|
||||||
@ -17249,6 +17260,26 @@
|
|||||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||||
"tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60"
|
"tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "614.746506577953841",
|
||||||
|
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||||
|
"tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": "17701.463096745440206695",
|
||||||
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
|
"tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": "20364.3503859717532968",
|
||||||
|
"user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d",
|
||||||
|
"tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": "5091.5260869122865738",
|
||||||
|
"user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694",
|
||||||
|
"tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "652.48254356494551875",
|
"amount": "652.48254356494551875",
|
||||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||||
@ -18885,6 +18916,12 @@
|
|||||||
"tranche_id": 3,
|
"tranche_id": 3,
|
||||||
"tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60"
|
"tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "614.746506577953841",
|
||||||
|
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||||
|
"tranche_id": 3,
|
||||||
|
"tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "652.48254356494551875",
|
"amount": "652.48254356494551875",
|
||||||
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
"user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b",
|
||||||
@ -20123,8 +20160,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "359123.469575",
|
"total_tokens": "359123.469575",
|
||||||
"withdrawn_tokens": "155425.60534790600061725",
|
"withdrawn_tokens": "156040.35185448395445825",
|
||||||
"remaining_tokens": "203697.86422709399938275"
|
"remaining_tokens": "203083.11772051604554175"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
"address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB",
|
||||||
@ -20271,6 +20308,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "5091.5260869122865738",
|
||||||
|
"user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694",
|
||||||
|
"tranche_id": 3,
|
||||||
|
"tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "6310.1901227904940866",
|
"amount": "6310.1901227904940866",
|
||||||
"user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694",
|
"user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694",
|
||||||
@ -20297,8 +20340,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "66299.71746",
|
"total_tokens": "66299.71746",
|
||||||
"withdrawn_tokens": "23745.761900811119424",
|
"withdrawn_tokens": "28837.2879877234059978",
|
||||||
"remaining_tokens": "42553.955559188880576"
|
"remaining_tokens": "37462.4294722765940022"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
"address": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8",
|
||||||
@ -20615,6 +20658,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "20364.3503859717532968",
|
||||||
|
"user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d",
|
||||||
|
"tranche_id": 3,
|
||||||
|
"tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "25242.3008271937471296",
|
"amount": "25242.3008271937471296",
|
||||||
"user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d",
|
"user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d",
|
||||||
@ -20641,8 +20690,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "265198.86984",
|
"total_tokens": "265198.86984",
|
||||||
"withdrawn_tokens": "94983.1600369573350624",
|
"withdrawn_tokens": "115347.5104229290883592",
|
||||||
"remaining_tokens": "170215.7098030426649376"
|
"remaining_tokens": "149851.3594170709116408"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0x35022e6c85B50F4904C7BC7e692A9F3bbEE8D2CE",
|
"address": "0x35022e6c85B50F4904C7BC7e692A9F3bbEE8D2CE",
|
||||||
@ -20812,6 +20861,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "17701.463096745440206695",
|
||||||
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
|
"tranche_id": 3,
|
||||||
|
"tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "45513.77740810577941926",
|
"amount": "45513.77740810577941926",
|
||||||
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
@ -20832,8 +20887,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "230391.5181735",
|
"total_tokens": "230391.5181735",
|
||||||
"withdrawn_tokens": "82506.25192192818881679",
|
"withdrawn_tokens": "100207.715018673629023485",
|
||||||
"remaining_tokens": "147885.26625157181118321"
|
"remaining_tokens": "130183.803154826370976515"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0xC6b2864fbCD2A8dEC8DEfD1D421bC1E450C370AD",
|
"address": "0xC6b2864fbCD2A8dEC8DEfD1D421bC1E450C370AD",
|
||||||
@ -21120,8 +21175,8 @@
|
|||||||
"tranche_start": "2021-10-05T00:00:00.000Z",
|
"tranche_start": "2021-10-05T00:00:00.000Z",
|
||||||
"tranche_end": "2023-04-05T00:00:00.000Z",
|
"tranche_end": "2023-04-05T00:00:00.000Z",
|
||||||
"total_added": "5778205.3912159303",
|
"total_added": "5778205.3912159303",
|
||||||
"total_removed": "1404291.506600519461757227",
|
"total_removed": "1417003.438054406291892727",
|
||||||
"locked_amount": "2952444.61922536743378942253962054",
|
"locked_amount": "2941881.17244069509858904234270872",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "552496.6455",
|
"amount": "552496.6455",
|
||||||
@ -21280,6 +21335,11 @@
|
|||||||
"user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75",
|
"user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75",
|
||||||
"tx": "0xc695996be3df837d7040aec8c5532965ac6554d5615575ee46fc87d604e2ebc0"
|
"tx": "0xc695996be3df837d7040aec8c5532965ac6554d5615575ee46fc87d604e2ebc0"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "12711.9314538868301355",
|
||||||
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
|
"tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "13341.31568777778021",
|
"amount": "13341.31568777778021",
|
||||||
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
"user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90",
|
||||||
@ -21648,6 +21708,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "12711.9314538868301355",
|
||||||
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
|
"tranche_id": 4,
|
||||||
|
"tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "32683.576612762644585",
|
"amount": "32683.576612762644585",
|
||||||
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
"user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E",
|
||||||
@ -21668,8 +21734,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "165749.29365",
|
"total_tokens": "165749.29365",
|
||||||
"withdrawn_tokens": "68641.624849504055385",
|
"withdrawn_tokens": "81353.5563033908855205",
|
||||||
"remaining_tokens": "97107.668800495944615"
|
"remaining_tokens": "84395.7373466091144795"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0x72e7BB93E73b2885a22CA29c34759361399a5C0e",
|
"address": "0x72e7BB93E73b2885a22CA29c34759361399a5C0e",
|
||||||
@ -22265,8 +22331,8 @@
|
|||||||
"tranche_start": "2022-06-05T00:00:00.000Z",
|
"tranche_start": "2022-06-05T00:00:00.000Z",
|
||||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||||
"total_added": "472355.6199999996",
|
"total_added": "472355.6199999996",
|
||||||
"total_removed": "34.173053016",
|
"total_removed": "75.634316334",
|
||||||
"locked_amount": "440644.80971500656998341987011672",
|
"locked_amount": "439350.6847287052296870462810756",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "3000",
|
"amount": "3000",
|
||||||
@ -28894,6 +28960,11 @@
|
|||||||
"amount": "23.010020292",
|
"amount": "23.010020292",
|
||||||
"user": "0xD27929d68ac0E5fd5C919A5eb5968C1D06D3Fb83",
|
"user": "0xD27929d68ac0E5fd5C919A5eb5968C1D06D3Fb83",
|
||||||
"tx": "0x8daf320262d0384cf5f9c290cc33721587beabd5e93026b3e9b76dc3fcd6659c"
|
"tx": "0x8daf320262d0384cf5f9c290cc33721587beabd5e93026b3e9b76dc3fcd6659c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"amount": "41.461263318",
|
||||||
|
"user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19",
|
||||||
|
"tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"users": [
|
"users": [
|
||||||
@ -43808,10 +43879,17 @@
|
|||||||
"tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82"
|
"tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [],
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "41.461263318",
|
||||||
|
"user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19",
|
||||||
|
"tranche_id": 5,
|
||||||
|
"tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c"
|
||||||
|
}
|
||||||
|
],
|
||||||
"total_tokens": "600",
|
"total_tokens": "600",
|
||||||
"withdrawn_tokens": "0",
|
"withdrawn_tokens": "41.461263318",
|
||||||
"remaining_tokens": "600"
|
"remaining_tokens": "558.538736682"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0xa37d20cd446898508Ab961c6Be8d3fe1c15413fA",
|
"address": "0xa37d20cd446898508Ab961c6Be8d3fe1c15413fA",
|
||||||
@ -47944,7 +48022,7 @@
|
|||||||
"tranche_start": "2021-12-05T00:00:00.000Z",
|
"tranche_start": "2021-12-05T00:00:00.000Z",
|
||||||
"tranche_end": "2022-06-05T00:00:00.000Z",
|
"tranche_end": "2022-06-05T00:00:00.000Z",
|
||||||
"total_added": "171288.42",
|
"total_added": "171288.42",
|
||||||
"total_removed": "32508.6592656906377",
|
"total_removed": "32535.6624708206377",
|
||||||
"locked_amount": "0",
|
"locked_amount": "0",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
@ -52259,6 +52337,11 @@
|
|||||||
"user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D",
|
"user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D",
|
||||||
"tx": "0x901a76735076a5058146ce6fc79628d78d71e8d2b3161459c2daf64ae043f1d5"
|
"tx": "0x901a76735076a5058146ce6fc79628d78d71e8d2b3161459c2daf64ae043f1d5"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"amount": "27.00320513",
|
||||||
|
"user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540",
|
||||||
|
"tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "183.6335597275",
|
"amount": "183.6335597275",
|
||||||
"user": "0x690Fc36d52eD3f198F0eBDea1557333a1766f786",
|
"user": "0x690Fc36d52eD3f198F0eBDea1557333a1766f786",
|
||||||
@ -64718,6 +64801,12 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"withdrawals": [
|
"withdrawals": [
|
||||||
|
{
|
||||||
|
"amount": "27.00320513",
|
||||||
|
"user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540",
|
||||||
|
"tranche_id": 6,
|
||||||
|
"tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"amount": "129.597196785",
|
"amount": "129.597196785",
|
||||||
"user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540",
|
"user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540",
|
||||||
@ -64738,8 +64827,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"total_tokens": "500",
|
"total_tokens": "500",
|
||||||
"withdrawn_tokens": "472.99679487",
|
"withdrawn_tokens": "500",
|
||||||
"remaining_tokens": "27.00320513"
|
"remaining_tokens": "0"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"address": "0x45564345F125F78d3C3894A2C5226C673F8eB0Ae",
|
"address": "0x45564345F125F78d3C3894A2C5226C673F8eB0Ae",
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
"tranche_end": "2022-11-26T13:48:10.000Z",
|
"tranche_end": "2022-11-26T13:48:10.000Z",
|
||||||
"total_added": "100",
|
"total_added": "100",
|
||||||
"total_removed": "0",
|
"total_removed": "0",
|
||||||
"locked_amount": "41.115480720446473",
|
"locked_amount": "40.84151128868595",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "100",
|
"amount": "100",
|
||||||
@ -242,7 +242,7 @@
|
|||||||
"tranche_end": "2022-10-12T00:53:20.000Z",
|
"tranche_end": "2022-10-12T00:53:20.000Z",
|
||||||
"total_added": "1100",
|
"total_added": "1100",
|
||||||
"total_removed": "673.04388635",
|
"total_removed": "673.04388635",
|
||||||
"locked_amount": "315.032242516489036",
|
"locked_amount": "312.01857876712325",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "1000",
|
"amount": "1000",
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
"tranche_end": "2022-10-12T00:53:20.000Z",
|
"tranche_end": "2022-10-12T00:53:20.000Z",
|
||||||
"total_added": "1010.000000000000000001",
|
"total_added": "1010.000000000000000001",
|
||||||
"total_removed": "668.4622323651",
|
"total_removed": "668.4622323651",
|
||||||
"locked_amount": "289.25687721968538760028639294774226276",
|
"locked_amount": "286.4897859589040750002836532534246575",
|
||||||
"deposits": [
|
"deposits": [
|
||||||
{
|
{
|
||||||
"amount": "1000",
|
"amount": "1000",
|
||||||
|
34
apps/token-e2e/src/integration/vesting.cy.js
Normal file
34
apps/token-e2e/src/integration/vesting.cy.js
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
import navigation from '../locators/navigation.locators';
|
||||||
|
import vesting from '../locators/vesting.locators';
|
||||||
|
|
||||||
|
context('Vesting Page - verify elements on page', function () {
|
||||||
|
before('navigate to vesting page', function () {
|
||||||
|
cy.visit('/')
|
||||||
|
.get(navigation.section)
|
||||||
|
.within(() => {
|
||||||
|
cy.get(navigation.vesting).click();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('with wallets disconnected', function () {
|
||||||
|
it('should have vesting tab highlighted', function () {
|
||||||
|
cy.get(navigation.section).within(() => {
|
||||||
|
cy.get(navigation.vesting).should('have.attr', 'aria-current');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have VESTING header visible', function () {
|
||||||
|
cy.get(vesting.header).should('be.visible').and('have.text', 'Vesting');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have connect Eth wallet info', function () {
|
||||||
|
cy.get(vesting.connectPrompt).should('be.visible');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should have connect Eth wallet button', function () {
|
||||||
|
cy.get(vesting.connectButton)
|
||||||
|
.should('be.visible')
|
||||||
|
.and('have.text', 'Connect Ethereum wallet');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
5
apps/token-e2e/src/locators/vesting.locators.js
Normal file
5
apps/token-e2e/src/locators/vesting.locators.js
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
header: 'header h1',
|
||||||
|
connectPrompt: '[data-testid="eth-connect-prompt"]',
|
||||||
|
connectButton: '[data-testid="connect-to-eth-btn"]',
|
||||||
|
};
|
@ -10,6 +10,7 @@ describe('vega wallet', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
// Using portfolio page as it requires vega wallet connection
|
// Using portfolio page as it requires vega wallet connection
|
||||||
cy.visit('/portfolio');
|
cy.visit('/portfolio');
|
||||||
|
cy.get('main[data-testid="portfolio"]').should('exist');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can connect', () => {
|
it('can connect', () => {
|
||||||
@ -64,8 +65,10 @@ describe('vega wallet', () => {
|
|||||||
describe('ethereum wallet', () => {
|
describe('ethereum wallet', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.mockWeb3Provider();
|
cy.mockWeb3Provider();
|
||||||
// Using portfolio is it requires Ethereum wallet connection
|
// Using portfolio withdrawals tab is it requires Ethereum wallet connection
|
||||||
cy.visit('/portfolio');
|
cy.visit('/portfolio');
|
||||||
|
cy.get('main[data-testid="portfolio"]').should('exist');
|
||||||
|
cy.getByTestId('Withdrawals').click();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can connect', () => {
|
it('can connect', () => {
|
||||||
@ -73,6 +76,6 @@ describe('ethereum wallet', () => {
|
|||||||
cy.getByTestId('web3-connector-list').should('exist');
|
cy.getByTestId('web3-connector-list').should('exist');
|
||||||
cy.getByTestId('web3-connector-MetaMask').click();
|
cy.getByTestId('web3-connector-MetaMask').click();
|
||||||
cy.getByTestId('web3-connector-list').should('not.exist');
|
cy.getByTestId('web3-connector-list').should('not.exist');
|
||||||
cy.getByTestId('portfolio-grid').should('exist');
|
cy.getByTestId('tab-withdrawals').should('not.be.empty');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
120
apps/trading-e2e/src/integration/portfolio-fills.cy.ts
Normal file
120
apps/trading-e2e/src/integration/portfolio-fills.cy.ts
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
import { aliasQuery } from '@vegaprotocol/cypress';
|
||||||
|
import { generateFill, generateFills } from '../support/mocks/generate-fills';
|
||||||
|
import { Side } from '@vegaprotocol/types';
|
||||||
|
import { connectVegaWallet } from '../support/vega-wallet';
|
||||||
|
|
||||||
|
describe('fills', () => {
|
||||||
|
before(() => {
|
||||||
|
const fills = [
|
||||||
|
generateFill({
|
||||||
|
buyer: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '1',
|
||||||
|
seller: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
buyerFee: {
|
||||||
|
infrastructureFee: '5000',
|
||||||
|
},
|
||||||
|
market: {
|
||||||
|
name: 'Apples Daily v3',
|
||||||
|
positionDecimalPlaces: 2,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '2',
|
||||||
|
seller: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '3',
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
market: {
|
||||||
|
name: 'ETHBTC Quarterly (30 Jun 2022)',
|
||||||
|
},
|
||||||
|
buyer: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
const result = generateFills({
|
||||||
|
party: {
|
||||||
|
tradesPaged: {
|
||||||
|
edges: fills.map((f, i) => {
|
||||||
|
return {
|
||||||
|
__typename: 'TradeEdge',
|
||||||
|
node: f,
|
||||||
|
cursor: i.toString(),
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
cy.mockGQL((req) => {
|
||||||
|
aliasQuery(req, 'Fills', result);
|
||||||
|
});
|
||||||
|
cy.visit('/portfolio');
|
||||||
|
cy.get('main[data-testid="portfolio"]').should('exist');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders fills', () => {
|
||||||
|
cy.getByTestId('Fills').click();
|
||||||
|
cy.getByTestId('tab-fills').contains('Please connect Vega wallet');
|
||||||
|
|
||||||
|
connectVegaWallet();
|
||||||
|
|
||||||
|
cy.getByTestId('tab-fills').should('be.visible');
|
||||||
|
|
||||||
|
cy.getByTestId('tab-fills')
|
||||||
|
.get('[role="gridcell"][col-id="market.name"]')
|
||||||
|
.each(($marketSymbol) => {
|
||||||
|
cy.wrap($marketSymbol).invoke('text').should('not.be.empty');
|
||||||
|
});
|
||||||
|
cy.getByTestId('tab-fills')
|
||||||
|
.get('[role="gridcell"][col-id="size"]')
|
||||||
|
.each(($amount) => {
|
||||||
|
cy.wrap($amount).invoke('text').should('not.be.empty');
|
||||||
|
});
|
||||||
|
cy.getByTestId('tab-positions')
|
||||||
|
.get('[role="gridcell"][col-id="price"]')
|
||||||
|
.each(($prices) => {
|
||||||
|
cy.wrap($prices).invoke('text').should('not.be.empty');
|
||||||
|
});
|
||||||
|
cy.getByTestId('tab-positions')
|
||||||
|
.get('[role="gridcell"][col-id="price_1"]')
|
||||||
|
.each(($total) => {
|
||||||
|
cy.wrap($total).invoke('text').should('not.be.empty');
|
||||||
|
});
|
||||||
|
cy.getByTestId('tab-positions')
|
||||||
|
.get('[role="gridcell"][col-id="aggressor"]')
|
||||||
|
.each(($role) => {
|
||||||
|
cy.wrap($role)
|
||||||
|
.invoke('text')
|
||||||
|
.then((text) => {
|
||||||
|
const roles = ['Maker', 'Taker'];
|
||||||
|
expect(roles.indexOf(text.trim())).to.be.greaterThan(-1);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
cy.getByTestId('tab-positions')
|
||||||
|
.get(
|
||||||
|
'[role="gridcell"][col-id="market.tradableInstrument.instrument.product"]'
|
||||||
|
)
|
||||||
|
.each(($fees) => {
|
||||||
|
cy.wrap($fees).invoke('text').should('not.be.empty');
|
||||||
|
});
|
||||||
|
const dateTimeRegex =
|
||||||
|
/(\d{1,2})\/(\d{1,2})\/(\d{4}), (\d{1,2}):(\d{1,2}):(\d{1,2})/gm;
|
||||||
|
cy.get('[col-id="createdAt"]').each(($tradeDateTime, index) => {
|
||||||
|
if (index != 0) {
|
||||||
|
//ignore header
|
||||||
|
cy.wrap($tradeDateTime).invoke('text').should('match', dateTimeRegex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -1,6 +0,0 @@
|
|||||||
describe('portfolio', () => {
|
|
||||||
it('requires connecting', () => {
|
|
||||||
cy.visit('/portfolio');
|
|
||||||
cy.get('main[data-testid="portfolio"]').should('exist');
|
|
||||||
});
|
|
||||||
});
|
|
134
apps/trading-e2e/src/support/mocks/generate-fills.ts
Normal file
134
apps/trading-e2e/src/support/mocks/generate-fills.ts
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
import type {
|
||||||
|
Fills,
|
||||||
|
Fills_party_tradesPaged_edges_node,
|
||||||
|
} from '@vegaprotocol/fills';
|
||||||
|
import { Side } from '@vegaprotocol/types';
|
||||||
|
import merge from 'lodash/merge';
|
||||||
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
|
export const generateFills = (override?: PartialDeep<Fills>): Fills => {
|
||||||
|
const fills: Fills_party_tradesPaged_edges_node[] = [
|
||||||
|
generateFill({
|
||||||
|
buyer: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '1',
|
||||||
|
seller: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
buyerFee: {
|
||||||
|
infrastructureFee: '5000',
|
||||||
|
},
|
||||||
|
market: {
|
||||||
|
name: 'Apples Daily v3',
|
||||||
|
positionDecimalPlaces: 2,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '2',
|
||||||
|
seller: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '3',
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
market: {
|
||||||
|
name: 'ETHBTC Quarterly (30 Jun 2022)',
|
||||||
|
},
|
||||||
|
buyer: {
|
||||||
|
id: Cypress.env('VEGA_PUBLIC_KEY'),
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
const defaultResult: Fills = {
|
||||||
|
party: {
|
||||||
|
id: 'buyer-id',
|
||||||
|
tradesPaged: {
|
||||||
|
__typename: 'TradeConnection',
|
||||||
|
totalCount: 1,
|
||||||
|
edges: fills.map((f) => {
|
||||||
|
return {
|
||||||
|
__typename: 'TradeEdge',
|
||||||
|
node: f,
|
||||||
|
cursor: '3',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
pageInfo: {
|
||||||
|
__typename: 'PageInfo',
|
||||||
|
startCursor: '1',
|
||||||
|
endCursor: '2',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__typename: 'Party',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return merge(defaultResult, override);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateFill = (
|
||||||
|
override?: PartialDeep<Fills_party_tradesPaged_edges_node>
|
||||||
|
) => {
|
||||||
|
const defaultFill: Fills_party_tradesPaged_edges_node = {
|
||||||
|
__typename: 'Trade',
|
||||||
|
id: '0',
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
price: '10000000',
|
||||||
|
size: '50000',
|
||||||
|
buyOrder: 'buy-order',
|
||||||
|
sellOrder: 'sell-order',
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
buyer: {
|
||||||
|
__typename: 'Party',
|
||||||
|
id: 'buyer-id',
|
||||||
|
},
|
||||||
|
seller: {
|
||||||
|
__typename: 'Party',
|
||||||
|
id: 'seller-id',
|
||||||
|
},
|
||||||
|
buyerFee: {
|
||||||
|
__typename: 'TradeFee',
|
||||||
|
makerFee: '100',
|
||||||
|
infrastructureFee: '100',
|
||||||
|
liquidityFee: '100',
|
||||||
|
},
|
||||||
|
sellerFee: {
|
||||||
|
__typename: 'TradeFee',
|
||||||
|
makerFee: '200',
|
||||||
|
infrastructureFee: '200',
|
||||||
|
liquidityFee: '200',
|
||||||
|
},
|
||||||
|
market: {
|
||||||
|
__typename: 'Market',
|
||||||
|
id: 'market-id',
|
||||||
|
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||||
|
positionDecimalPlaces: 0,
|
||||||
|
decimalPlaces: 5,
|
||||||
|
tradableInstrument: {
|
||||||
|
__typename: 'TradableInstrument',
|
||||||
|
instrument: {
|
||||||
|
__typename: 'Instrument',
|
||||||
|
id: 'instrument-id',
|
||||||
|
code: 'instrument-code',
|
||||||
|
product: {
|
||||||
|
__typename: 'Future',
|
||||||
|
settlementAsset: {
|
||||||
|
__typename: 'Asset',
|
||||||
|
id: 'asset-id',
|
||||||
|
symbol: 'SYM',
|
||||||
|
decimals: 18,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return merge(defaultFill, override);
|
||||||
|
};
|
@ -5,71 +5,76 @@ import { OrderListContainer } from '@vegaprotocol/order-list';
|
|||||||
import { AccountsContainer } from '@vegaprotocol/accounts';
|
import { AccountsContainer } from '@vegaprotocol/accounts';
|
||||||
import { AnchorButton, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
|
import { AnchorButton, Tab, Tabs } from '@vegaprotocol/ui-toolkit';
|
||||||
import { WithdrawalsContainer } from './withdrawals/withdrawals-container';
|
import { WithdrawalsContainer } from './withdrawals/withdrawals-container';
|
||||||
|
import { FillsContainer } from '@vegaprotocol/fills';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
import type { ReactNode } from 'react';
|
||||||
|
|
||||||
const Portfolio = () => {
|
const Portfolio = () => {
|
||||||
const tabClassName = 'p-[16px] pl-[316px]';
|
const wrapperClasses = classNames(
|
||||||
|
'h-full max-h-full',
|
||||||
|
'grid gap-4 grid-rows-[1fr_300px]',
|
||||||
|
'bg-black-10 dark:bg-white-10',
|
||||||
|
'text-ui'
|
||||||
|
);
|
||||||
|
const tabContentClassName = 'h-full grid gap-4 grid-rows-[min-content_1fr]';
|
||||||
return (
|
return (
|
||||||
<Web3Container>
|
<div className={wrapperClasses}>
|
||||||
<div className="h-full text-ui">
|
<PortfolioGridChild>
|
||||||
<main className="relative h-[calc(100%-200px)]">
|
|
||||||
<aside className="absolute px-[8px] py-[16px] w-[300px] mt-[28px] h-[calc(100%-28px)] w-[300px] overflow-auto">
|
|
||||||
<h2 className="text-h4 text-black dark:text-white">
|
|
||||||
{t('Filters')}
|
|
||||||
</h2>
|
|
||||||
</aside>
|
|
||||||
<section data-testid="portfolio-grid">
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab id="positions" name={t('Positions')}>
|
<Tab id="positions" name={t('Positions')}>
|
||||||
<div className={tabClassName}>
|
<div className={tabContentClassName}>
|
||||||
<h4 className="text-h4 text-black dark:text-white">
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
||||||
{t('Positions')}
|
{t('Positions')}
|
||||||
</h4>
|
</h4>
|
||||||
|
<div>
|
||||||
<PositionsContainer />
|
<PositionsContainer />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab id="orders" name={t('Orders')}>
|
<Tab id="orders" name={t('Orders')}>
|
||||||
<div className={tabClassName}>
|
<div className={tabContentClassName}>
|
||||||
<h4 className="text-h4 text-black dark:text-white">
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
||||||
{t('Orders')}
|
{t('Orders')}
|
||||||
</h4>
|
</h4>
|
||||||
|
<div>
|
||||||
<OrderListContainer />
|
<OrderListContainer />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab id="fills" name={t('Fills')}>
|
<Tab id="fills" name={t('Fills')}>
|
||||||
<div className={tabClassName}>
|
<div className={tabContentClassName}>
|
||||||
<h4 className="text-h4 text-black dark:text-white">
|
<h4 className="text-h4 text-black dark:text-white p-8">
|
||||||
{t('Fills')}
|
{t('Fills')}
|
||||||
</h4>
|
</h4>
|
||||||
|
<div>
|
||||||
|
<FillsContainer />
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
|
||||||
<Tab id="history" name={t('History')}>
|
|
||||||
<div className={tabClassName}>
|
|
||||||
<h4 className="text-h4 text-black dark:text-white">
|
|
||||||
{t('History')}
|
|
||||||
</h4>
|
|
||||||
</div>
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</section>
|
</PortfolioGridChild>
|
||||||
</main>
|
<PortfolioGridChild>
|
||||||
<section className="fixed bottom-0 left-0 w-full h-[200px]">
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab id="collateral" name={t('Collateral')}>
|
<Tab id="collateral" name={t('Collateral')}>
|
||||||
<AccountsContainer />
|
<AccountsContainer />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab id="deposits" name={t('Deposits')}>
|
<Tab id="deposits" name={t('Deposits')}>
|
||||||
|
<div className={tabContentClassName}>
|
||||||
|
<div className="p-8">
|
||||||
<AnchorButton data-testid="deposit" href="/portfolio/deposit">
|
<AnchorButton data-testid="deposit" href="/portfolio/deposit">
|
||||||
{t('Deposit')}
|
{t('Deposit')}
|
||||||
</AnchorButton>
|
</AnchorButton>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab id="withdrawals" name={t('Withdrawals')}>
|
<Tab id="withdrawals" name={t('Withdrawals')}>
|
||||||
|
<Web3Container>
|
||||||
<WithdrawalsContainer />
|
<WithdrawalsContainer />
|
||||||
|
</Web3Container>
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</section>
|
</PortfolioGridChild>
|
||||||
</div>
|
</div>
|
||||||
</Web3Container>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -78,3 +83,16 @@ Portfolio.getInitialProps = () => ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
export default Portfolio;
|
export default Portfolio;
|
||||||
|
|
||||||
|
interface PortfolioGridChildProps {
|
||||||
|
children: ReactNode;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PortfolioGridChild = ({
|
||||||
|
children,
|
||||||
|
className,
|
||||||
|
}: PortfolioGridChildProps) => {
|
||||||
|
const gridChildClasses = classNames('bg-white dark:bg-black', className);
|
||||||
|
return <section className={gridChildClasses}>{children}</section>;
|
||||||
|
};
|
||||||
|
12
libs/fills/.babelrc
Normal file
12
libs/fills/.babelrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"presets": [
|
||||||
|
[
|
||||||
|
"@nrwl/react/babel",
|
||||||
|
{
|
||||||
|
"runtime": "automatic",
|
||||||
|
"useBuiltIns": "usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"plugins": []
|
||||||
|
}
|
18
libs/fills/.eslintrc.json
Normal file
18
libs/fills/.eslintrc.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"],
|
||||||
|
"ignorePatterns": ["!**/*", "__generated__"],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.ts", "*.tsx"],
|
||||||
|
"rules": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["*.js", "*.jsx"],
|
||||||
|
"rules": {}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
28
libs/fills/.storybook/main.js
Normal file
28
libs/fills/.storybook/main.js
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
const rootMain = require('../../../.storybook/main');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
...rootMain,
|
||||||
|
|
||||||
|
core: { ...rootMain.core, builder: 'webpack5' },
|
||||||
|
|
||||||
|
stories: [
|
||||||
|
...rootMain.stories,
|
||||||
|
'../src/lib/**/*.stories.mdx',
|
||||||
|
'../src/lib/**/*.stories.@(js|jsx|ts|tsx)',
|
||||||
|
],
|
||||||
|
addons: [
|
||||||
|
...rootMain.addons,
|
||||||
|
'@nrwl/react/plugins/storybook',
|
||||||
|
'storybook-addon-themes',
|
||||||
|
],
|
||||||
|
webpackFinal: async (config, { configType }) => {
|
||||||
|
// apply any global webpack configs that might have been specified in .storybook/main.js
|
||||||
|
if (rootMain.webpackFinal) {
|
||||||
|
config = await rootMain.webpackFinal(config, { configType });
|
||||||
|
}
|
||||||
|
|
||||||
|
// add your own webpack tweaks if needed
|
||||||
|
|
||||||
|
return config;
|
||||||
|
},
|
||||||
|
};
|
1
libs/fills/.storybook/preview-head.html
Normal file
1
libs/fills/.storybook/preview-head.html
Normal file
@ -0,0 +1 @@
|
|||||||
|
<link rel="stylesheet" href="https://static.vega.xyz/fonts.css" />
|
51
libs/fills/.storybook/preview.js
Normal file
51
libs/fills/.storybook/preview.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import './styles.css';
|
||||||
|
import { ThemeContext } from '@vegaprotocol/react-helpers';
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
|
export const parameters = {
|
||||||
|
actions: { argTypesRegex: '^on[A-Z].*' },
|
||||||
|
backgrounds: { disable: true },
|
||||||
|
themes: {
|
||||||
|
default: 'dark',
|
||||||
|
list: [
|
||||||
|
{ name: 'dark', class: ['dark', 'bg-black'], color: '#000' },
|
||||||
|
{ name: 'light', class: '', color: '#FFF' },
|
||||||
|
],
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const decorators = [
|
||||||
|
(Story, context) => {
|
||||||
|
// storybook-addon-themes doesnt seem to provide the current selected
|
||||||
|
// theme in context, we need to provid it in JS as some components
|
||||||
|
// rely on it for rendering
|
||||||
|
const [theme, setTheme] = useState(context.parameters.themes.default);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const observer = new MutationObserver((mutationList) => {
|
||||||
|
if (mutationList.length) {
|
||||||
|
const body = mutationList[0].target;
|
||||||
|
if (body.classList.contains('dark')) {
|
||||||
|
setTheme('dark');
|
||||||
|
} else {
|
||||||
|
setTheme('light');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
observer.observe(document.body, { attributes: true });
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
observer.disconnect();
|
||||||
|
};
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ width: '100%', height: 500 }}>
|
||||||
|
<ThemeContext.Provider value={theme}>
|
||||||
|
<Story />
|
||||||
|
</ThemeContext.Provider>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
];
|
3
libs/fills/.storybook/styles.css
Normal file
3
libs/fills/.storybook/styles.css
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
19
libs/fills/.storybook/tsconfig.json
Normal file
19
libs/fills/.storybook/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"outDir": ""
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"../../../node_modules/@nrwl/react/typings/styled-jsx.d.ts",
|
||||||
|
"../../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
||||||
|
"../../../node_modules/@nrwl/react/typings/image.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"../**/*.spec.ts",
|
||||||
|
"../**/*.spec.js",
|
||||||
|
"../**/*.spec.tsx",
|
||||||
|
"../**/*.spec.jsx"
|
||||||
|
],
|
||||||
|
"include": ["../src/**/*", "*.js"]
|
||||||
|
}
|
7
libs/fills/README.md
Normal file
7
libs/fills/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# fills
|
||||||
|
|
||||||
|
This library was generated with [Nx](https://nx.dev).
|
||||||
|
|
||||||
|
## Running unit tests
|
||||||
|
|
||||||
|
Run `nx test fills` to execute the unit tests via [Jest](https://jestjs.io).
|
15
libs/fills/jest.config.js
Normal file
15
libs/fills/jest.config.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
displayName: 'fills',
|
||||||
|
preset: '../../jest.preset.js',
|
||||||
|
globals: {
|
||||||
|
'ts-jest': {
|
||||||
|
tsconfig: '<rootDir>/tsconfig.spec.json',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
'^.+\\.[tj]sx?$': 'ts-jest',
|
||||||
|
},
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
||||||
|
coverageDirectory: '../../coverage/libs/fills',
|
||||||
|
setupFilesAfterEnv: ['./src/setup-tests.ts'],
|
||||||
|
};
|
4
libs/fills/package.json
Normal file
4
libs/fills/package.json
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"name": "@vegaprotocol/fills",
|
||||||
|
"version": "0.0.1"
|
||||||
|
}
|
10
libs/fills/postcss.config.js
Normal file
10
libs/fills/postcss.config.js
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
const { join } = require('path');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {
|
||||||
|
config: join(__dirname, 'tailwind.config.js'),
|
||||||
|
},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
};
|
74
libs/fills/project.json
Normal file
74
libs/fills/project.json
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"root": "libs/fills",
|
||||||
|
"sourceRoot": "libs/fills/src",
|
||||||
|
"projectType": "library",
|
||||||
|
"tags": [],
|
||||||
|
"targets": {
|
||||||
|
"build": {
|
||||||
|
"executor": "@nrwl/web:rollup",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"outputPath": "dist/libs/fills",
|
||||||
|
"tsConfig": "libs/fills/tsconfig.lib.json",
|
||||||
|
"project": "libs/fills/package.json",
|
||||||
|
"entryFile": "libs/fills/src/index.ts",
|
||||||
|
"external": ["react/jsx-runtime"],
|
||||||
|
"rollupConfig": "@nrwl/react/plugins/bundle-rollup",
|
||||||
|
"compiler": "babel",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"glob": "libs/fills/README.md",
|
||||||
|
"input": ".",
|
||||||
|
"output": "."
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lint": {
|
||||||
|
"executor": "@nrwl/linter:eslint",
|
||||||
|
"outputs": ["{options.outputFile}"],
|
||||||
|
"options": {
|
||||||
|
"lintFilePatterns": ["libs/fills/**/*.{ts,tsx,js,jsx}"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"test": {
|
||||||
|
"executor": "@nrwl/jest:jest",
|
||||||
|
"outputs": ["coverage/libs/fills"],
|
||||||
|
"options": {
|
||||||
|
"jestConfig": "libs/fills/jest.config.js",
|
||||||
|
"passWithNoTests": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"storybook": {
|
||||||
|
"executor": "@nrwl/storybook:storybook",
|
||||||
|
"options": {
|
||||||
|
"uiFramework": "@storybook/react",
|
||||||
|
"port": 4400,
|
||||||
|
"config": {
|
||||||
|
"configFolder": "libs/fills/.storybook"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"quiet": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"build-storybook": {
|
||||||
|
"executor": "@nrwl/storybook:build",
|
||||||
|
"outputs": ["{options.outputPath}"],
|
||||||
|
"options": {
|
||||||
|
"uiFramework": "@storybook/react",
|
||||||
|
"outputPath": "dist/storybook/fills",
|
||||||
|
"config": {
|
||||||
|
"configFolder": "libs/fills/.storybook"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"configurations": {
|
||||||
|
"ci": {
|
||||||
|
"quiet": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
4
libs/fills/src/index.ts
Normal file
4
libs/fills/src/index.ts
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
export * from './lib/fills-container';
|
||||||
|
export * from './lib/__generated__/FillFields';
|
||||||
|
export * from './lib/__generated__/Fills';
|
||||||
|
export * from './lib/__generated__/FillsSub';
|
197
libs/fills/src/lib/__generated__/FillFields.ts
generated
Normal file
197
libs/fills/src/lib/__generated__/FillFields.ts
generated
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @generated
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { Side } from "@vegaprotocol/types";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL fragment: FillFields
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface FillFields_buyer {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_seller {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_buyerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_sellerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_market_tradableInstrument_instrument_product_settlementAsset {
|
||||||
|
__typename: "Asset";
|
||||||
|
/**
|
||||||
|
* The id of the asset
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* The symbol of the asset (e.g: GBP)
|
||||||
|
*/
|
||||||
|
symbol: string;
|
||||||
|
/**
|
||||||
|
* The precision of the asset
|
||||||
|
*/
|
||||||
|
decimals: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_market_tradableInstrument_instrument_product {
|
||||||
|
__typename: "Future";
|
||||||
|
/**
|
||||||
|
* The name of the asset (string)
|
||||||
|
*/
|
||||||
|
settlementAsset: FillFields_market_tradableInstrument_instrument_product_settlementAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_market_tradableInstrument_instrument {
|
||||||
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
|
*/
|
||||||
|
code: string;
|
||||||
|
/**
|
||||||
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
|
*/
|
||||||
|
product: FillFields_market_tradableInstrument_instrument_product;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_market_tradableInstrument {
|
||||||
|
__typename: "TradableInstrument";
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a fully specified instrument.
|
||||||
|
*/
|
||||||
|
instrument: FillFields_market_tradableInstrument_instrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields_market {
|
||||||
|
__typename: "Market";
|
||||||
|
/**
|
||||||
|
* Market ID
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Market full name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||||
|
* number denominated in the currency of the Market. (uint64)
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* Currency Balance decimalPlaces Real Balance
|
||||||
|
* GBP 100 0 GBP 100
|
||||||
|
* GBP 100 2 GBP 1.00
|
||||||
|
* GBP 100 4 GBP 0.01
|
||||||
|
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||||
|
*
|
||||||
|
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||||
|
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||||
|
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||||
|
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||||
|
*/
|
||||||
|
decimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||||
|
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||||
|
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||||
|
*/
|
||||||
|
positionDecimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a tradable instrument.
|
||||||
|
*/
|
||||||
|
tradableInstrument: FillFields_market_tradableInstrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillFields {
|
||||||
|
__typename: "Trade";
|
||||||
|
/**
|
||||||
|
* The hash of the trade data
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* RFC3339Nano time for when the trade occurred
|
||||||
|
*/
|
||||||
|
createdAt: string;
|
||||||
|
/**
|
||||||
|
* The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64)
|
||||||
|
*/
|
||||||
|
price: string;
|
||||||
|
/**
|
||||||
|
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||||
|
*/
|
||||||
|
size: string;
|
||||||
|
/**
|
||||||
|
* The order that bought
|
||||||
|
*/
|
||||||
|
buyOrder: string;
|
||||||
|
/**
|
||||||
|
* The order that sold
|
||||||
|
*/
|
||||||
|
sellOrder: string;
|
||||||
|
/**
|
||||||
|
* The aggressor indicates whether this trade was related to a BUY or SELL
|
||||||
|
*/
|
||||||
|
aggressor: Side;
|
||||||
|
/**
|
||||||
|
* The party that bought
|
||||||
|
*/
|
||||||
|
buyer: FillFields_buyer;
|
||||||
|
/**
|
||||||
|
* The party that sold
|
||||||
|
*/
|
||||||
|
seller: FillFields_seller;
|
||||||
|
/**
|
||||||
|
* The fee paid by the buyer side of the trade
|
||||||
|
*/
|
||||||
|
buyerFee: FillFields_buyerFee;
|
||||||
|
/**
|
||||||
|
* The fee paid by the seller side of the trade
|
||||||
|
*/
|
||||||
|
sellerFee: FillFields_sellerFee;
|
||||||
|
/**
|
||||||
|
* The market the trade occurred on
|
||||||
|
*/
|
||||||
|
market: FillFields_market;
|
||||||
|
}
|
247
libs/fills/src/lib/__generated__/Fills.ts
generated
Normal file
247
libs/fills/src/lib/__generated__/Fills.ts
generated
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @generated
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { Pagination, Side } from "@vegaprotocol/types";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL query operation: Fills
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_buyer {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_seller {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_buyerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_sellerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset {
|
||||||
|
__typename: "Asset";
|
||||||
|
/**
|
||||||
|
* The id of the asset
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* The symbol of the asset (e.g: GBP)
|
||||||
|
*/
|
||||||
|
symbol: string;
|
||||||
|
/**
|
||||||
|
* The precision of the asset
|
||||||
|
*/
|
||||||
|
decimals: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product {
|
||||||
|
__typename: "Future";
|
||||||
|
/**
|
||||||
|
* The name of the asset (string)
|
||||||
|
*/
|
||||||
|
settlementAsset: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product_settlementAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument {
|
||||||
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
|
*/
|
||||||
|
code: string;
|
||||||
|
/**
|
||||||
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
|
*/
|
||||||
|
product: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument_product;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_market_tradableInstrument {
|
||||||
|
__typename: "TradableInstrument";
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a fully specified instrument.
|
||||||
|
*/
|
||||||
|
instrument: Fills_party_tradesPaged_edges_node_market_tradableInstrument_instrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node_market {
|
||||||
|
__typename: "Market";
|
||||||
|
/**
|
||||||
|
* Market ID
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Market full name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||||
|
* number denominated in the currency of the Market. (uint64)
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* Currency Balance decimalPlaces Real Balance
|
||||||
|
* GBP 100 0 GBP 100
|
||||||
|
* GBP 100 2 GBP 1.00
|
||||||
|
* GBP 100 4 GBP 0.01
|
||||||
|
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||||
|
*
|
||||||
|
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||||
|
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||||
|
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||||
|
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||||
|
*/
|
||||||
|
decimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||||
|
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||||
|
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||||
|
*/
|
||||||
|
positionDecimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a tradable instrument.
|
||||||
|
*/
|
||||||
|
tradableInstrument: Fills_party_tradesPaged_edges_node_market_tradableInstrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges_node {
|
||||||
|
__typename: "Trade";
|
||||||
|
/**
|
||||||
|
* The hash of the trade data
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* RFC3339Nano time for when the trade occurred
|
||||||
|
*/
|
||||||
|
createdAt: string;
|
||||||
|
/**
|
||||||
|
* The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64)
|
||||||
|
*/
|
||||||
|
price: string;
|
||||||
|
/**
|
||||||
|
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||||
|
*/
|
||||||
|
size: string;
|
||||||
|
/**
|
||||||
|
* The order that bought
|
||||||
|
*/
|
||||||
|
buyOrder: string;
|
||||||
|
/**
|
||||||
|
* The order that sold
|
||||||
|
*/
|
||||||
|
sellOrder: string;
|
||||||
|
/**
|
||||||
|
* The aggressor indicates whether this trade was related to a BUY or SELL
|
||||||
|
*/
|
||||||
|
aggressor: Side;
|
||||||
|
/**
|
||||||
|
* The party that bought
|
||||||
|
*/
|
||||||
|
buyer: Fills_party_tradesPaged_edges_node_buyer;
|
||||||
|
/**
|
||||||
|
* The party that sold
|
||||||
|
*/
|
||||||
|
seller: Fills_party_tradesPaged_edges_node_seller;
|
||||||
|
/**
|
||||||
|
* The fee paid by the buyer side of the trade
|
||||||
|
*/
|
||||||
|
buyerFee: Fills_party_tradesPaged_edges_node_buyerFee;
|
||||||
|
/**
|
||||||
|
* The fee paid by the seller side of the trade
|
||||||
|
*/
|
||||||
|
sellerFee: Fills_party_tradesPaged_edges_node_sellerFee;
|
||||||
|
/**
|
||||||
|
* The market the trade occurred on
|
||||||
|
*/
|
||||||
|
market: Fills_party_tradesPaged_edges_node_market;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_edges {
|
||||||
|
__typename: "TradeEdge";
|
||||||
|
node: Fills_party_tradesPaged_edges_node;
|
||||||
|
cursor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged_pageInfo {
|
||||||
|
__typename: "PageInfo";
|
||||||
|
startCursor: string;
|
||||||
|
endCursor: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party_tradesPaged {
|
||||||
|
__typename: "TradeConnection";
|
||||||
|
/**
|
||||||
|
* The total number of trades in this connection
|
||||||
|
*/
|
||||||
|
totalCount: number;
|
||||||
|
/**
|
||||||
|
* The trade in this connection
|
||||||
|
*/
|
||||||
|
edges: Fills_party_tradesPaged_edges[];
|
||||||
|
/**
|
||||||
|
* The pagination information
|
||||||
|
*/
|
||||||
|
pageInfo: Fills_party_tradesPaged_pageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills_party {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
tradesPaged: Fills_party_tradesPaged;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Fills {
|
||||||
|
/**
|
||||||
|
* An entity that is trading on the VEGA network
|
||||||
|
*/
|
||||||
|
party: Fills_party | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsVariables {
|
||||||
|
partyId: string;
|
||||||
|
marketId?: string | null;
|
||||||
|
pagination?: Pagination | null;
|
||||||
|
}
|
208
libs/fills/src/lib/__generated__/FillsSub.ts
generated
Normal file
208
libs/fills/src/lib/__generated__/FillsSub.ts
generated
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// @generated
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
import { Side } from "@vegaprotocol/types";
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL subscription operation: FillsSub
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface FillsSub_trades_buyer {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_seller {
|
||||||
|
__typename: "Party";
|
||||||
|
/**
|
||||||
|
* Party identifier
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_buyerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_sellerFee {
|
||||||
|
__typename: "TradeFee";
|
||||||
|
/**
|
||||||
|
* The maker fee, aggressive party to the other party (the one who had an order in the book)
|
||||||
|
*/
|
||||||
|
makerFee: string;
|
||||||
|
/**
|
||||||
|
* The infrastructure fee, a fee paid to the node runner to maintain the vega network
|
||||||
|
*/
|
||||||
|
infrastructureFee: string;
|
||||||
|
/**
|
||||||
|
* The fee paid to the market makers to provide liquidity in the market
|
||||||
|
*/
|
||||||
|
liquidityFee: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset {
|
||||||
|
__typename: "Asset";
|
||||||
|
/**
|
||||||
|
* The id of the asset
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* The symbol of the asset (e.g: GBP)
|
||||||
|
*/
|
||||||
|
symbol: string;
|
||||||
|
/**
|
||||||
|
* The precision of the asset
|
||||||
|
*/
|
||||||
|
decimals: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_market_tradableInstrument_instrument_product {
|
||||||
|
__typename: "Future";
|
||||||
|
/**
|
||||||
|
* The name of the asset (string)
|
||||||
|
*/
|
||||||
|
settlementAsset: FillsSub_trades_market_tradableInstrument_instrument_product_settlementAsset;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_market_tradableInstrument_instrument {
|
||||||
|
__typename: "Instrument";
|
||||||
|
/**
|
||||||
|
* Uniquely identify an instrument across all instruments available on Vega (string)
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18) (string)
|
||||||
|
*/
|
||||||
|
code: string;
|
||||||
|
/**
|
||||||
|
* A reference to or instance of a fully specified product, including all required product parameters for that product (Product union)
|
||||||
|
*/
|
||||||
|
product: FillsSub_trades_market_tradableInstrument_instrument_product;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_market_tradableInstrument {
|
||||||
|
__typename: "TradableInstrument";
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a fully specified instrument.
|
||||||
|
*/
|
||||||
|
instrument: FillsSub_trades_market_tradableInstrument_instrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades_market {
|
||||||
|
__typename: "Market";
|
||||||
|
/**
|
||||||
|
* Market ID
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* Market full name
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct
|
||||||
|
* number denominated in the currency of the Market. (uint64)
|
||||||
|
*
|
||||||
|
* Examples:
|
||||||
|
* Currency Balance decimalPlaces Real Balance
|
||||||
|
* GBP 100 0 GBP 100
|
||||||
|
* GBP 100 2 GBP 1.00
|
||||||
|
* GBP 100 4 GBP 0.01
|
||||||
|
* GBP 1 4 GBP 0.0001 ( 0.01p )
|
||||||
|
*
|
||||||
|
* GBX (pence) 100 0 GBP 1.00 (100p )
|
||||||
|
* GBX (pence) 100 2 GBP 0.01 ( 1p )
|
||||||
|
* GBX (pence) 100 4 GBP 0.0001 ( 0.01p )
|
||||||
|
* GBX (pence) 1 4 GBP 0.000001 ( 0.0001p)
|
||||||
|
*/
|
||||||
|
decimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* positionDecimalPlaces indicated the number of decimal places that an integer must be shifted in order to get a correct size (uint64).
|
||||||
|
* i.e. 0 means there are no fractional orders for the market, and order sizes are always whole sizes.
|
||||||
|
* 2 means sizes given as 10^2 * desired size, e.g. a desired size of 1.23 is represented as 123 in this market.
|
||||||
|
*/
|
||||||
|
positionDecimalPlaces: number;
|
||||||
|
/**
|
||||||
|
* An instance of or reference to a tradable instrument.
|
||||||
|
*/
|
||||||
|
tradableInstrument: FillsSub_trades_market_tradableInstrument;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub_trades {
|
||||||
|
__typename: "Trade";
|
||||||
|
/**
|
||||||
|
* The hash of the trade data
|
||||||
|
*/
|
||||||
|
id: string;
|
||||||
|
/**
|
||||||
|
* RFC3339Nano time for when the trade occurred
|
||||||
|
*/
|
||||||
|
createdAt: string;
|
||||||
|
/**
|
||||||
|
* The price of the trade (probably initially the passive order price, other determination algorithms are possible though) (uint64)
|
||||||
|
*/
|
||||||
|
price: string;
|
||||||
|
/**
|
||||||
|
* The number of contracts trades, will always be <= the remaining size of both orders immediately before the trade (uint64)
|
||||||
|
*/
|
||||||
|
size: string;
|
||||||
|
/**
|
||||||
|
* The order that bought
|
||||||
|
*/
|
||||||
|
buyOrder: string;
|
||||||
|
/**
|
||||||
|
* The order that sold
|
||||||
|
*/
|
||||||
|
sellOrder: string;
|
||||||
|
/**
|
||||||
|
* The aggressor indicates whether this trade was related to a BUY or SELL
|
||||||
|
*/
|
||||||
|
aggressor: Side;
|
||||||
|
/**
|
||||||
|
* The party that bought
|
||||||
|
*/
|
||||||
|
buyer: FillsSub_trades_buyer;
|
||||||
|
/**
|
||||||
|
* The party that sold
|
||||||
|
*/
|
||||||
|
seller: FillsSub_trades_seller;
|
||||||
|
/**
|
||||||
|
* The fee paid by the buyer side of the trade
|
||||||
|
*/
|
||||||
|
buyerFee: FillsSub_trades_buyerFee;
|
||||||
|
/**
|
||||||
|
* The fee paid by the seller side of the trade
|
||||||
|
*/
|
||||||
|
sellerFee: FillsSub_trades_sellerFee;
|
||||||
|
/**
|
||||||
|
* The market the trade occurred on
|
||||||
|
*/
|
||||||
|
market: FillsSub_trades_market;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSub {
|
||||||
|
/**
|
||||||
|
* Subscribe to the trades updates
|
||||||
|
*/
|
||||||
|
trades: FillsSub_trades[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface FillsSubVariables {
|
||||||
|
partyId: string;
|
||||||
|
}
|
18
libs/fills/src/lib/fills-container.tsx
Normal file
18
libs/fills/src/lib/fills-container.tsx
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
|
import { FillsManager } from './fills-manager';
|
||||||
|
|
||||||
|
export const FillsContainer = () => {
|
||||||
|
const { keypair } = useVegaWallet();
|
||||||
|
|
||||||
|
if (!keypair) {
|
||||||
|
return (
|
||||||
|
<Splash>
|
||||||
|
<p>{t('Please connect Vega wallet')}</p>
|
||||||
|
</Splash>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return <FillsManager partyId={keypair.pub} />;
|
||||||
|
};
|
117
libs/fills/src/lib/fills-data-provider.ts
Normal file
117
libs/fills/src/lib/fills-data-provider.ts
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import { makeDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
|
import produce from 'immer';
|
||||||
|
import type { FillFields } from './__generated__/FillFields';
|
||||||
|
import type {
|
||||||
|
Fills,
|
||||||
|
Fills_party_tradesPaged_edges_node,
|
||||||
|
} from './__generated__/Fills';
|
||||||
|
import type { FillsSub } from './__generated__/FillsSub';
|
||||||
|
|
||||||
|
const FILL_FRAGMENT = gql`
|
||||||
|
fragment FillFields on Trade {
|
||||||
|
id
|
||||||
|
createdAt
|
||||||
|
price
|
||||||
|
size
|
||||||
|
buyOrder
|
||||||
|
sellOrder
|
||||||
|
aggressor
|
||||||
|
buyer {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
seller {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
buyerFee {
|
||||||
|
makerFee
|
||||||
|
infrastructureFee
|
||||||
|
liquidityFee
|
||||||
|
}
|
||||||
|
sellerFee {
|
||||||
|
makerFee
|
||||||
|
infrastructureFee
|
||||||
|
liquidityFee
|
||||||
|
}
|
||||||
|
market {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
decimalPlaces
|
||||||
|
positionDecimalPlaces
|
||||||
|
tradableInstrument {
|
||||||
|
instrument {
|
||||||
|
id
|
||||||
|
code
|
||||||
|
product {
|
||||||
|
... on Future {
|
||||||
|
settlementAsset {
|
||||||
|
id
|
||||||
|
symbol
|
||||||
|
decimals
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const FILLS_QUERY = gql`
|
||||||
|
${FILL_FRAGMENT}
|
||||||
|
query Fills($partyId: ID!, $marketId: ID, $pagination: Pagination) {
|
||||||
|
party(id: $partyId) {
|
||||||
|
id
|
||||||
|
tradesPaged(marketId: $marketId, pagination: $pagination) {
|
||||||
|
totalCount
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
...FillFields
|
||||||
|
}
|
||||||
|
cursor
|
||||||
|
}
|
||||||
|
pageInfo {
|
||||||
|
startCursor
|
||||||
|
endCursor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const FILLS_SUB = gql`
|
||||||
|
${FILL_FRAGMENT}
|
||||||
|
subscription FillsSub($partyId: ID!) {
|
||||||
|
trades(partyId: $partyId) {
|
||||||
|
...FillFields
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const update = (data: FillFields[], delta: FillFields[]) => {
|
||||||
|
// Add or update incoming trades
|
||||||
|
return produce(data, (draft) => {
|
||||||
|
delta.forEach((trade) => {
|
||||||
|
const index = draft.findIndex((t) => t.id === trade.id);
|
||||||
|
if (index === -1) {
|
||||||
|
draft.unshift(trade);
|
||||||
|
} else {
|
||||||
|
draft[index] = trade;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const getData = (
|
||||||
|
responseData: Fills
|
||||||
|
): Fills_party_tradesPaged_edges_node[] | null =>
|
||||||
|
responseData.party?.tradesPaged.edges.map((e) => e.node) || null;
|
||||||
|
const getDelta = (subscriptionData: FillsSub) => subscriptionData.trades || [];
|
||||||
|
|
||||||
|
export const fillsDataProvider = makeDataProvider(
|
||||||
|
FILLS_QUERY,
|
||||||
|
FILLS_SUB,
|
||||||
|
update,
|
||||||
|
getData,
|
||||||
|
getDelta
|
||||||
|
);
|
80
libs/fills/src/lib/fills-manager.tsx
Normal file
80
libs/fills/src/lib/fills-manager.tsx
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
|
import { useCallback, useMemo, useRef } from 'react';
|
||||||
|
import { FillsTable } from './fills-table';
|
||||||
|
import { fillsDataProvider } from './fills-data-provider';
|
||||||
|
import { useDataProvider } from '@vegaprotocol/react-helpers';
|
||||||
|
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import type { FillsVariables } from './__generated__/Fills';
|
||||||
|
import type { FillFields } from './__generated__/FillFields';
|
||||||
|
import type { FillsSub_trades } from './__generated__/FillsSub';
|
||||||
|
import isEqual from 'lodash/isEqual';
|
||||||
|
|
||||||
|
interface FillsManagerProps {
|
||||||
|
partyId: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FillsManager = ({ partyId }: FillsManagerProps) => {
|
||||||
|
const gridRef = useRef<AgGridReact | null>(null);
|
||||||
|
const variables = useMemo<FillsVariables>(
|
||||||
|
() => ({
|
||||||
|
partyId,
|
||||||
|
pagination: {
|
||||||
|
last: 300,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
[partyId]
|
||||||
|
);
|
||||||
|
const update = useCallback((delta: FillsSub_trades[]) => {
|
||||||
|
if (!gridRef.current) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const updateRows: FillFields[] = [];
|
||||||
|
const add: FillFields[] = [];
|
||||||
|
|
||||||
|
delta.forEach((d) => {
|
||||||
|
if (!gridRef.current?.api) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const rowNode = gridRef.current.api.getRowNode(d.id);
|
||||||
|
|
||||||
|
if (rowNode) {
|
||||||
|
if (!isEqual(d, rowNode.data)) {
|
||||||
|
updateRows.push(d);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
add.push(d);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (updateRows.length || add.length) {
|
||||||
|
gridRef.current.api.applyTransactionAsync({
|
||||||
|
update: updateRows,
|
||||||
|
add,
|
||||||
|
addIndex: 0,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const { data, loading, error } = useDataProvider(
|
||||||
|
fillsDataProvider,
|
||||||
|
update,
|
||||||
|
variables
|
||||||
|
);
|
||||||
|
|
||||||
|
const fills = useMemo(() => {
|
||||||
|
if (!data?.length) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}, [data]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<AsyncRenderer data={fills} loading={loading} error={error}>
|
||||||
|
<FillsTable ref={gridRef} partyId={partyId} fills={fills} />
|
||||||
|
</AsyncRenderer>
|
||||||
|
);
|
||||||
|
};
|
177
libs/fills/src/lib/fills-table.spec.tsx
Normal file
177
libs/fills/src/lib/fills-table.spec.tsx
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
import { render, act, screen, waitFor } from '@testing-library/react';
|
||||||
|
import { getDateTimeFormat } from '@vegaprotocol/react-helpers';
|
||||||
|
import { Side } from '@vegaprotocol/types';
|
||||||
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
|
import { FillsTable } from './fills-table';
|
||||||
|
import { generateFill } from './test-helpers';
|
||||||
|
import type { FillFields } from './__generated__/FillFields';
|
||||||
|
|
||||||
|
describe('FillsTable', () => {
|
||||||
|
let defaultFill: PartialDeep<FillFields>;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
defaultFill = {
|
||||||
|
price: '100',
|
||||||
|
size: '300000',
|
||||||
|
market: {
|
||||||
|
name: 'test market',
|
||||||
|
decimalPlaces: 2,
|
||||||
|
positionDecimalPlaces: 5,
|
||||||
|
tradableInstrument: {
|
||||||
|
instrument: {
|
||||||
|
product: {
|
||||||
|
settlementAsset: {
|
||||||
|
decimals: 2,
|
||||||
|
symbol: 'BTC',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
createdAt: new Date('2022-02-02T14:00:00').toISOString(),
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
it('correct columns are rendered', async () => {
|
||||||
|
await act(async () => {
|
||||||
|
render(<FillsTable partyId="party-id" fills={[generateFill()]} />);
|
||||||
|
});
|
||||||
|
|
||||||
|
const headers = screen.getAllByRole('columnheader');
|
||||||
|
expect(headers).toHaveLength(7);
|
||||||
|
expect(headers.map((h) => h.textContent?.trim())).toEqual([
|
||||||
|
'Market',
|
||||||
|
'Amount',
|
||||||
|
'Value',
|
||||||
|
'Filled value',
|
||||||
|
'Role',
|
||||||
|
'Fee',
|
||||||
|
'Date',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('formats cells correctly for buyer fill', async () => {
|
||||||
|
const partyId = 'party-id';
|
||||||
|
const buyerFill = generateFill({
|
||||||
|
...defaultFill,
|
||||||
|
buyer: {
|
||||||
|
id: partyId,
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
buyerFee: {
|
||||||
|
makerFee: '2',
|
||||||
|
infrastructureFee: '2',
|
||||||
|
liquidityFee: '2',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { container } = render(
|
||||||
|
<FillsTable partyId={partyId} fills={[buyerFill]} />
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check grid has been rendered
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
const cells = screen.getAllByRole('gridcell');
|
||||||
|
const expectedValues = [
|
||||||
|
buyerFill.market.name,
|
||||||
|
'+3.00000',
|
||||||
|
'1.00 BTC',
|
||||||
|
'3.00 BTC',
|
||||||
|
'Maker',
|
||||||
|
'0.06 BTC',
|
||||||
|
getDateTimeFormat().format(new Date(buyerFill.createdAt)),
|
||||||
|
];
|
||||||
|
cells.forEach((cell, i) => {
|
||||||
|
expect(cell).toHaveTextContent(expectedValues[i]);
|
||||||
|
});
|
||||||
|
|
||||||
|
const amountCell = cells.find((c) => c.getAttribute('col-id') === 'size');
|
||||||
|
expect(amountCell).toHaveClass('text-vega-green');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('formats cells correctly for seller fill', async () => {
|
||||||
|
const partyId = 'party-id';
|
||||||
|
const buyerFill = generateFill({
|
||||||
|
...defaultFill,
|
||||||
|
seller: {
|
||||||
|
id: partyId,
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
sellerFee: {
|
||||||
|
makerFee: '1',
|
||||||
|
infrastructureFee: '1',
|
||||||
|
liquidityFee: '1',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const { container } = render(
|
||||||
|
<FillsTable partyId={partyId} fills={[buyerFill]} />
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check grid has been rendered
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
const cells = screen.getAllByRole('gridcell');
|
||||||
|
const expectedValues = [
|
||||||
|
buyerFill.market.name,
|
||||||
|
'-3.00000',
|
||||||
|
'1.00 BTC',
|
||||||
|
'3.00 BTC',
|
||||||
|
'Taker',
|
||||||
|
'0.03 BTC',
|
||||||
|
getDateTimeFormat().format(new Date(buyerFill.createdAt)),
|
||||||
|
];
|
||||||
|
cells.forEach((cell, i) => {
|
||||||
|
expect(cell).toHaveTextContent(expectedValues[i]);
|
||||||
|
});
|
||||||
|
|
||||||
|
const amountCell = cells.find((c) => c.getAttribute('col-id') === 'size');
|
||||||
|
expect(amountCell).toHaveClass('text-vega-red');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders correct maker or taker role', async () => {
|
||||||
|
const partyId = 'party-id';
|
||||||
|
const takerFill = generateFill({
|
||||||
|
seller: {
|
||||||
|
id: partyId,
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
});
|
||||||
|
|
||||||
|
const { container, rerender } = render(
|
||||||
|
<FillsTable partyId={partyId} fills={[takerFill]} />
|
||||||
|
);
|
||||||
|
|
||||||
|
// Check grid has been rendered
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(container.querySelector('.ag-root-wrapper')).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen
|
||||||
|
.getAllByRole('gridcell')
|
||||||
|
.find((c) => c.getAttribute('col-id') === 'aggressor')
|
||||||
|
).toHaveTextContent('Taker');
|
||||||
|
|
||||||
|
const makerFill = generateFill({
|
||||||
|
seller: {
|
||||||
|
id: partyId,
|
||||||
|
},
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
});
|
||||||
|
|
||||||
|
rerender(<FillsTable partyId={partyId} fills={[makerFill]} />);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
screen
|
||||||
|
.getAllByRole('gridcell')
|
||||||
|
.find((c) => c.getAttribute('col-id') === 'aggressor')
|
||||||
|
).toHaveTextContent('Maker');
|
||||||
|
});
|
||||||
|
});
|
18
libs/fills/src/lib/fills-table.stories.tsx
Normal file
18
libs/fills/src/lib/fills-table.stories.tsx
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import type { Story, Meta } from '@storybook/react';
|
||||||
|
import type { FillsTableProps } from './fills-table';
|
||||||
|
import { FillsTable } from './fills-table';
|
||||||
|
import { generateFills } from './test-helpers';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
component: FillsTable,
|
||||||
|
title: 'FillsTable',
|
||||||
|
} as Meta;
|
||||||
|
|
||||||
|
const Template: Story<FillsTableProps> = (args) => <FillsTable {...args} />;
|
||||||
|
|
||||||
|
export const Default = Template.bind({});
|
||||||
|
const fills = generateFills();
|
||||||
|
Default.args = {
|
||||||
|
partyId: 'party-id',
|
||||||
|
fills: fills.party?.tradesPaged.edges.map((e) => e.node),
|
||||||
|
};
|
160
libs/fills/src/lib/fills-table.tsx
Normal file
160
libs/fills/src/lib/fills-table.tsx
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
|
import {
|
||||||
|
addDecimal,
|
||||||
|
addDecimalsFormatNumber,
|
||||||
|
formatNumber,
|
||||||
|
getDateTimeFormat,
|
||||||
|
t,
|
||||||
|
} from '@vegaprotocol/react-helpers';
|
||||||
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { forwardRef } from 'react';
|
||||||
|
import type { FillFields } from './__generated__/FillFields';
|
||||||
|
import type { ValueFormatterParams } from 'ag-grid-community';
|
||||||
|
import BigNumber from 'bignumber.js';
|
||||||
|
import { Side } from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
export interface FillsTableProps {
|
||||||
|
partyId: string;
|
||||||
|
fills: FillFields[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export const FillsTable = forwardRef<AgGridReact, FillsTableProps>(
|
||||||
|
({ partyId, fills }, ref) => {
|
||||||
|
return (
|
||||||
|
<AgGrid
|
||||||
|
ref={ref}
|
||||||
|
rowData={fills}
|
||||||
|
overlayNoRowsTemplate={t('No fills')}
|
||||||
|
defaultColDef={{ flex: 1, resizable: true }}
|
||||||
|
style={{ width: '100%', height: '100%' }}
|
||||||
|
getRowId={({ data }) => data.id}
|
||||||
|
>
|
||||||
|
<AgGridColumn headerName={t('Market')} field="market.name" />
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Amount')}
|
||||||
|
field="size"
|
||||||
|
cellClass={({ data }: { data: FillFields }) => {
|
||||||
|
let className = '';
|
||||||
|
if (data.buyer.id === partyId) {
|
||||||
|
className = 'text-vega-green';
|
||||||
|
} else if (data.seller.id) {
|
||||||
|
className = 'text-vega-red';
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}}
|
||||||
|
valueFormatter={formatSize(partyId)}
|
||||||
|
/>
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Value')}
|
||||||
|
field="price"
|
||||||
|
valueFormatter={formatPrice}
|
||||||
|
/>
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Filled value')}
|
||||||
|
field="price"
|
||||||
|
valueFormatter={formatTotal}
|
||||||
|
/>
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Role')}
|
||||||
|
field="aggressor"
|
||||||
|
valueFormatter={formatRole(partyId)}
|
||||||
|
/>
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Fee')}
|
||||||
|
field="market.tradableInstrument.instrument.product"
|
||||||
|
valueFormatter={formatFee(partyId)}
|
||||||
|
/>
|
||||||
|
<AgGridColumn
|
||||||
|
headerName={t('Date')}
|
||||||
|
field="createdAt"
|
||||||
|
valueFormatter={({ value }: ValueFormatterParams) => {
|
||||||
|
return getDateTimeFormat().format(new Date(value));
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</AgGrid>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const formatPrice = ({ value, data }: ValueFormatterParams) => {
|
||||||
|
const asset =
|
||||||
|
data.market.tradableInstrument.instrument.product.settlementAsset.symbol;
|
||||||
|
const valueFormatted = addDecimalsFormatNumber(
|
||||||
|
value,
|
||||||
|
data.market.decimalPlaces
|
||||||
|
);
|
||||||
|
return `${valueFormatted} ${asset}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatSize = (partyId: string) => {
|
||||||
|
return ({ value, data }: ValueFormatterParams) => {
|
||||||
|
let prefix;
|
||||||
|
if (data.buyer.id === partyId) {
|
||||||
|
prefix = '+';
|
||||||
|
} else if (data.seller.id) {
|
||||||
|
prefix = '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
const size = addDecimalsFormatNumber(
|
||||||
|
value,
|
||||||
|
data.market.positionDecimalPlaces
|
||||||
|
);
|
||||||
|
return `${prefix}${size}`;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatTotal = ({ value, data }: ValueFormatterParams) => {
|
||||||
|
const asset =
|
||||||
|
data.market.tradableInstrument.instrument.product.settlementAsset.symbol;
|
||||||
|
const size = new BigNumber(
|
||||||
|
addDecimal(data.size, data.market.positionDecimalPlaces)
|
||||||
|
);
|
||||||
|
const price = new BigNumber(addDecimal(value, data.market.decimalPlaces));
|
||||||
|
|
||||||
|
const total = size.times(price).toString();
|
||||||
|
const valueFormatted = formatNumber(total, data.market.decimalPlaces);
|
||||||
|
return `${valueFormatted} ${asset}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatRole = (partyId: string) => {
|
||||||
|
return ({ value, data }: ValueFormatterParams) => {
|
||||||
|
const taker = t('Taker');
|
||||||
|
const maker = t('Maker');
|
||||||
|
if (data.buyer.id === partyId) {
|
||||||
|
if (value === Side.Buy) {
|
||||||
|
return taker;
|
||||||
|
} else {
|
||||||
|
return maker;
|
||||||
|
}
|
||||||
|
} else if (data.seller.id === partyId) {
|
||||||
|
if (value === Side.Sell) {
|
||||||
|
return taker;
|
||||||
|
} else {
|
||||||
|
return maker;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatFee = (partyId: string) => {
|
||||||
|
return ({ value, data }: ValueFormatterParams) => {
|
||||||
|
const asset = value.settlementAsset;
|
||||||
|
let feesObj;
|
||||||
|
if (data.buyer.id === partyId) {
|
||||||
|
feesObj = data.buyerFee;
|
||||||
|
} else if (data.seller.id === partyId) {
|
||||||
|
feesObj = data.sellerFee;
|
||||||
|
} else {
|
||||||
|
return '-';
|
||||||
|
}
|
||||||
|
|
||||||
|
const fee = new BigNumber(feesObj.makerFee)
|
||||||
|
.plus(feesObj.infrastructureFee)
|
||||||
|
.plus(feesObj.liquidityFee);
|
||||||
|
const totalFees = addDecimalsFormatNumber(fee.toString(), asset.decimals);
|
||||||
|
return `${totalFees} ${asset.symbol}`;
|
||||||
|
};
|
||||||
|
};
|
134
libs/fills/src/lib/test-helpers.ts
Normal file
134
libs/fills/src/lib/test-helpers.ts
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
import { Side } from '@vegaprotocol/types';
|
||||||
|
import merge from 'lodash/merge';
|
||||||
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
import type {
|
||||||
|
Fills,
|
||||||
|
Fills_party_tradesPaged_edges_node,
|
||||||
|
} from './__generated__/Fills';
|
||||||
|
|
||||||
|
export const generateFills = (override?: PartialDeep<Fills>): Fills => {
|
||||||
|
const fills: Fills_party_tradesPaged_edges_node[] = [
|
||||||
|
generateFill({
|
||||||
|
buyer: {
|
||||||
|
id: 'party-id',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '1',
|
||||||
|
seller: {
|
||||||
|
id: 'party-id',
|
||||||
|
},
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
buyerFee: {
|
||||||
|
infrastructureFee: '5000',
|
||||||
|
},
|
||||||
|
market: {
|
||||||
|
name: 'Apples Daily v3',
|
||||||
|
positionDecimalPlaces: 2,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '2',
|
||||||
|
seller: {
|
||||||
|
id: 'party-id',
|
||||||
|
},
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
}),
|
||||||
|
generateFill({
|
||||||
|
id: '3',
|
||||||
|
aggressor: Side.Sell,
|
||||||
|
market: {
|
||||||
|
name: 'ETHBTC Quarterly (30 Jun 2022)',
|
||||||
|
},
|
||||||
|
buyer: {
|
||||||
|
id: 'party-id',
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
];
|
||||||
|
|
||||||
|
const defaultResult: Fills = {
|
||||||
|
party: {
|
||||||
|
id: 'buyer-id',
|
||||||
|
tradesPaged: {
|
||||||
|
__typename: 'TradeConnection',
|
||||||
|
totalCount: 1,
|
||||||
|
edges: fills.map((f) => {
|
||||||
|
return {
|
||||||
|
__typename: 'TradeEdge',
|
||||||
|
node: f,
|
||||||
|
cursor: '3',
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
pageInfo: {
|
||||||
|
__typename: 'PageInfo',
|
||||||
|
startCursor: '1',
|
||||||
|
endCursor: '2',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
__typename: 'Party',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return merge(defaultResult, override);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const generateFill = (
|
||||||
|
override?: PartialDeep<Fills_party_tradesPaged_edges_node>
|
||||||
|
) => {
|
||||||
|
const defaultFill: Fills_party_tradesPaged_edges_node = {
|
||||||
|
__typename: 'Trade',
|
||||||
|
id: '0',
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
price: '10000000',
|
||||||
|
size: '50000',
|
||||||
|
buyOrder: 'buy-order',
|
||||||
|
sellOrder: 'sell-order',
|
||||||
|
aggressor: Side.Buy,
|
||||||
|
buyer: {
|
||||||
|
__typename: 'Party',
|
||||||
|
id: 'buyer-id',
|
||||||
|
},
|
||||||
|
seller: {
|
||||||
|
__typename: 'Party',
|
||||||
|
id: 'seller-id',
|
||||||
|
},
|
||||||
|
buyerFee: {
|
||||||
|
__typename: 'TradeFee',
|
||||||
|
makerFee: '100',
|
||||||
|
infrastructureFee: '100',
|
||||||
|
liquidityFee: '100',
|
||||||
|
},
|
||||||
|
sellerFee: {
|
||||||
|
__typename: 'TradeFee',
|
||||||
|
makerFee: '200',
|
||||||
|
infrastructureFee: '200',
|
||||||
|
liquidityFee: '200',
|
||||||
|
},
|
||||||
|
market: {
|
||||||
|
__typename: 'Market',
|
||||||
|
id: 'market-id',
|
||||||
|
name: 'UNIDAI Monthly (30 Jun 2022)',
|
||||||
|
positionDecimalPlaces: 0,
|
||||||
|
decimalPlaces: 5,
|
||||||
|
tradableInstrument: {
|
||||||
|
__typename: 'TradableInstrument',
|
||||||
|
instrument: {
|
||||||
|
__typename: 'Instrument',
|
||||||
|
id: 'instrument-id',
|
||||||
|
code: 'instrument-code',
|
||||||
|
product: {
|
||||||
|
__typename: 'Future',
|
||||||
|
settlementAsset: {
|
||||||
|
__typename: 'Asset',
|
||||||
|
id: 'asset-id',
|
||||||
|
symbol: 'SYM',
|
||||||
|
decimals: 18,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return merge(defaultFill, override);
|
||||||
|
};
|
1
libs/fills/src/setup-tests.ts
Normal file
1
libs/fills/src/setup-tests.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import '@testing-library/jest-dom';
|
17
libs/fills/tailwind.config.js
Normal file
17
libs/fills/tailwind.config.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const { join } = require('path');
|
||||||
|
const { createGlobPatternsForDependencies } = require('@nrwl/next/tailwind');
|
||||||
|
const theme = require('../tailwindcss-config/src/theme');
|
||||||
|
const vegaCustomClasses = require('../tailwindcss-config/src/vega-custom-classes');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
content: [
|
||||||
|
join(__dirname, 'src/**/*.{ts,tsx,html,mdx}'),
|
||||||
|
join(__dirname, '.storybook/preview.js'),
|
||||||
|
...createGlobPatternsForDependencies(__dirname),
|
||||||
|
],
|
||||||
|
darkMode: 'class',
|
||||||
|
theme: {
|
||||||
|
extend: theme,
|
||||||
|
},
|
||||||
|
plugins: [vegaCustomClasses],
|
||||||
|
};
|
28
libs/fills/tsconfig.json
Normal file
28
libs/fills/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "react-jsx",
|
||||||
|
"allowJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noPropertyAccessFromIndexSignature": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"files": [],
|
||||||
|
"include": [],
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.lib.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./tsconfig.spec.json"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "./.storybook/tsconfig.json"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
26
libs/fills/tsconfig.lib.json
Normal file
26
libs/fills/tsconfig.lib.json
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"../../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
||||||
|
"../../node_modules/@nrwl/react/typings/image.d.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.test.jsx",
|
||||||
|
"**/*.stories.ts",
|
||||||
|
"**/*.stories.js",
|
||||||
|
"**/*.stories.jsx",
|
||||||
|
"**/*.stories.tsx"
|
||||||
|
],
|
||||||
|
"include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"]
|
||||||
|
}
|
19
libs/fills/tsconfig.spec.json
Normal file
19
libs/fills/tsconfig.spec.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "../../dist/out-tsc",
|
||||||
|
"module": "commonjs",
|
||||||
|
"types": ["jest", "node", "@testing-library/jest-dom"]
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"**/*.test.ts",
|
||||||
|
"**/*.spec.ts",
|
||||||
|
"**/*.test.tsx",
|
||||||
|
"**/*.spec.tsx",
|
||||||
|
"**/*.test.js",
|
||||||
|
"**/*.spec.js",
|
||||||
|
"**/*.test.jsx",
|
||||||
|
"**/*.spec.jsx",
|
||||||
|
"**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
@ -13,7 +13,7 @@ const vegaCustomClasses = plugin(function ({ addUtilities }) {
|
|||||||
overflowX: 'auto',
|
overflowX: 'auto',
|
||||||
padding: '1em',
|
padding: '1em',
|
||||||
background: theme.colors.white.DEFAULT,
|
background: theme.colors.white.DEFAULT,
|
||||||
color: theme.colors.black[25],
|
color: theme.colors.black[70],
|
||||||
border: `1px solid #${theme.colors.black[40]}`,
|
border: `1px solid #${theme.colors.black[40]}`,
|
||||||
},
|
},
|
||||||
'.dark .syntax-highlighter-wrapper .hljs': {
|
'.dark .syntax-highlighter-wrapper .hljs': {
|
||||||
|
10
libs/types/src/__generated__/globalTypes.ts
generated
10
libs/types/src/__generated__/globalTypes.ts
generated
@ -288,6 +288,16 @@ export enum WithdrawalStatus {
|
|||||||
Rejected = "Rejected",
|
Rejected = "Rejected",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pagination constructs to support cursor based pagination in the API
|
||||||
|
*/
|
||||||
|
export interface Pagination {
|
||||||
|
first?: number | null;
|
||||||
|
after?: string | null;
|
||||||
|
last?: number | null;
|
||||||
|
before?: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
//==============================================================
|
//==============================================================
|
||||||
// END Enums and Input Objects
|
// END Enums and Input Objects
|
||||||
//==============================================================
|
//==============================================================
|
||||||
|
@ -33,6 +33,8 @@ beforeEach(() => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const DEFAULT_URL = 'http://localhost:1789/api/v1';
|
||||||
|
|
||||||
function generateJSX(
|
function generateJSX(
|
||||||
props?: Partial<VegaConnectDialogProps>,
|
props?: Partial<VegaConnectDialogProps>,
|
||||||
contextValue?: Partial<VegaWalletContextShape>
|
contextValue?: Partial<VegaWalletContextShape>
|
||||||
@ -92,7 +94,7 @@ it('Successful connection using rest auth form', async () => {
|
|||||||
fireEvent.submit(screen.getByTestId('rest-connector-form'));
|
fireEvent.submit(screen.getByTestId('rest-connector-form'));
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalledWith('http://localhost:1789/api/v1', fields);
|
expect(spy).toHaveBeenCalledWith(DEFAULT_URL, fields);
|
||||||
|
|
||||||
expect(defaultProps.setDialogOpen).toHaveBeenCalledWith(false);
|
expect(defaultProps.setDialogOpen).toHaveBeenCalledWith(false);
|
||||||
});
|
});
|
||||||
@ -150,7 +152,7 @@ it('Unsuccessful connection using rest auth form', async () => {
|
|||||||
fireEvent.submit(screen.getByTestId('rest-connector-form'));
|
fireEvent.submit(screen.getByTestId('rest-connector-form'));
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(spy).toHaveBeenCalledWith('http://localhost:1789/api/v1', fields);
|
expect(spy).toHaveBeenCalledWith(DEFAULT_URL, fields);
|
||||||
|
|
||||||
expect(screen.getByTestId('form-error')).toHaveTextContent(
|
expect(screen.getByTestId('form-error')).toHaveTextContent(
|
||||||
'Something went wrong'
|
'Something went wrong'
|
||||||
@ -168,7 +170,7 @@ it('Unsuccessful connection using rest auth form', async () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(screen.getByTestId('form-error')).toHaveTextContent(
|
expect(screen.getByTestId('form-error')).toHaveTextContent(
|
||||||
'Wallet not running at http://localhost:1789/api/v1'
|
`Wallet not running at ${DEFAULT_URL}`
|
||||||
);
|
);
|
||||||
|
|
||||||
// Reject eg non 200 results
|
// Reject eg non 200 results
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
"@vegaprotocol/deal-ticket": ["libs/deal-ticket/src/index.ts"],
|
"@vegaprotocol/deal-ticket": ["libs/deal-ticket/src/index.ts"],
|
||||||
"@vegaprotocol/deposits": ["libs/deposits/src/index.ts"],
|
"@vegaprotocol/deposits": ["libs/deposits/src/index.ts"],
|
||||||
"@vegaprotocol/environment": ["libs/environment/src/index.ts"],
|
"@vegaprotocol/environment": ["libs/environment/src/index.ts"],
|
||||||
|
"@vegaprotocol/fills": ["libs/fills/src/index.ts"],
|
||||||
"@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"],
|
"@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"],
|
||||||
"@vegaprotocol/market-list": ["libs/market-list/src/index.ts"],
|
"@vegaprotocol/market-list": ["libs/market-list/src/index.ts"],
|
||||||
"@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"],
|
"@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"],
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
"environment": "libs/environment",
|
"environment": "libs/environment",
|
||||||
"explorer": "apps/explorer",
|
"explorer": "apps/explorer",
|
||||||
"explorer-e2e": "apps/explorer-e2e",
|
"explorer-e2e": "apps/explorer-e2e",
|
||||||
|
"fills": "libs/fills",
|
||||||
"market-depth": "libs/market-depth",
|
"market-depth": "libs/market-depth",
|
||||||
"market-list": "libs/market-list",
|
"market-list": "libs/market-list",
|
||||||
"network-stats": "libs/network-stats",
|
"network-stats": "libs/network-stats",
|
||||||
|
Loading…
Reference in New Issue
Block a user