From ce22da1c9adbafb8a36231e3efcabcb71335f8c6 Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 3 May 2023 18:09:05 +0000 Subject: [PATCH 1/5] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 523fcc395..6daac815b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-05-20T00:00:00.000Z", "total_added": "19242.125", "total_removed": "959.3245960538025", - "locked_amount": "10578.4844209587189695125", + "locked_amount": "10418.7792376543211777", "deposits": [ { "amount": "188", @@ -845,7 +845,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "14520", "total_removed": "5079.76864115505", - "locked_amount": "1206.465231481482324", + "locked_amount": "1085.952592592592978", "deposits": [ { "amount": "111", @@ -4715,7 +4715,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "51166.9974210106919556663", + "locked_amount": "51107.876034425155701037", "deposits": [ { "amount": "86666.297", @@ -4781,7 +4781,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "391.38319724257215", + "locked_amount": "387.962962962963", "deposits": [ { "amount": "2500", @@ -4814,7 +4814,7 @@ "tranche_end": "2023-11-01T00:00:00.000Z", "total_added": "15000.000000000000015", "total_removed": "0", - "locked_amount": "14795.60027928744001479560027928744", + "locked_amount": "14775.301932367149014775301932367149", "deposits": [ { "amount": "1.5e-14", @@ -4902,7 +4902,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "11459.903224386071", + "locked_amount": "11436.2218196457315", "deposits": [ { "amount": "12500", @@ -5169,7 +5169,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "17836.1796921", - "locked_amount": "18541.30457719459875", + "locked_amount": "18489.717618170655", "deposits": [ { "amount": "7500", @@ -5577,7 +5577,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "51120.313973942497539045", + "locked_amount": "51061.24652818329987399", "deposits": [ { "amount": "129999.45", @@ -5610,7 +5610,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "49335.74898575644407623565", + "locked_amount": "49298.9138196269965560045", "deposits": [ { "amount": "54144.7663", @@ -5643,7 +5643,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "21008.336485286656638", + "locked_amount": "20965.63247082699134", "deposits": [ { "amount": "10000", @@ -5836,7 +5836,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "1869.76296930492115", + "locked_amount": "1866.352105530188", "deposits": [ { "amount": "5000", @@ -6894,7 +6894,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "1709370.7872515768348", - "locked_amount": "156749.9162904687626235986", + "locked_amount": "155426.5500030847769098336", "deposits": [ { "amount": "1852091.69", @@ -40766,7 +40766,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "715655.108029600523393", - "locked_amount": "265371.371543329369775774863", + "locked_amount": "263337.818306825404305623187", "deposits": [ { "amount": "1998.95815", @@ -42159,7 +42159,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "867610.78878511272497352", - "locked_amount": "6240677.4306629368200704822080834181008381", + "locked_amount": "6233466.5814528903248765151216390212111382", "deposits": [ { "amount": "16249.93", @@ -48748,7 +48748,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "6168897.174282186485373182", - "locked_amount": "39908.33059608817917720398993360406", + "locked_amount": "33251.32064708015607663338925032586", "deposits": [ { "amount": "129284.449", @@ -58847,7 +58847,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "44078.8527972103416", - "locked_amount": "42049.610748470926039581595332312", + "locked_amount": "41727.382613860946149215697311012", "deposits": [ { "amount": "3000", From a9267de6538b50551050c20d0144e75c39d683fd Mon Sep 17 00:00:00 2001 From: Art Date: Wed, 3 May 2023 21:35:05 +0200 Subject: [PATCH 2/5] feat(trading): asset balances inside asset selector (deposit, withdraw form) (#3590) --- libs/assets/src/lib/asset-option.tsx | 45 ++++++++++-- libs/assets/src/lib/index.ts | 3 +- libs/assets/src/lib/use-balances-store.ts | 69 +++++++++++++++++++ libs/deposits/src/lib/asset-balance.tsx | 42 +++++++++++ libs/deposits/src/lib/deposit-form.tsx | 13 +++- libs/deposits/src/lib/index.ts | 5 +- libs/deposits/src/lib/use-submit-faucet.ts | 4 +- libs/utils/src/lib/is-asset-erc20.ts | 2 +- libs/withdraws/src/lib/asset-balance.tsx | 30 ++++++++ .../src/lib/withdraw-form-container.spec.tsx | 6 ++ libs/withdraws/src/lib/withdraw-form.spec.tsx | 5 ++ libs/withdraws/src/lib/withdraw-form.tsx | 7 +- .../src/lib/withdraw-manager.spec.tsx | 5 ++ 13 files changed, 223 insertions(+), 13 deletions(-) create mode 100644 libs/assets/src/lib/use-balances-store.ts create mode 100644 libs/deposits/src/lib/asset-balance.tsx create mode 100644 libs/withdraws/src/lib/asset-balance.tsx diff --git a/libs/assets/src/lib/asset-option.tsx b/libs/assets/src/lib/asset-option.tsx index 0df06a490..2d67c79a8 100644 --- a/libs/assets/src/lib/asset-option.tsx +++ b/libs/assets/src/lib/asset-option.tsx @@ -1,13 +1,50 @@ import { Option } from '@vegaprotocol/ui-toolkit'; import type { AssetFieldsFragment } from './__generated__/Asset'; +import classNames from 'classnames'; +import { t } from '@vegaprotocol/i18n'; +import type { ReactNode } from 'react'; -export const AssetOption = ({ asset }: { asset: AssetFieldsFragment }) => { +type AssetOptionProps = { + asset: AssetFieldsFragment; + balance?: ReactNode; +}; + +export const Balance = ({ + balance, + symbol, +}: { + balance?: string; + symbol: string; +}) => + balance ? ( +
+ {balance} {symbol} +
+ ) : ( +
{t('Fetching balance…')}
+ ); + +export const AssetOption = ({ asset, balance }: AssetOptionProps) => { return (