LedgerHQ / ledger-live-common

⛔️ DEPRECATED - Common ground for the Ledger Wallet apps
http://ledger-live-tools.now.sh
Apache License 2.0
136 stars 171 forks source link

useCurrenciesByMarketcapWithStatus #1963

Open ThomasLaforge opened 2 years ago

ThomasLaforge commented 2 years ago

Context (issues, jira)

Current hook to get data by marketcap was async and missing some info. I created this new one to get loading status and errors to handle those informations on UI. Here is the issue LIVE-1982.

Using this one I will be able to get an empty state until the loading or error state switch.

Description / Usage

const { loading, error, currencies } = useCurrenciesByMarketcapWithStatus(
    cryptoCurrencies,
);

Expectations

vercel[bot] commented 2 years ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
ledger-live-common ✅ Ready (Inspect) Visit Preview May 16, 2022 at 7:51AM (UTC)
codecov[bot] commented 2 years ago

Codecov Report

Merging #1963 (7108d9c) into develop (5b012ce) will increase coverage by 4.12%. The diff coverage is 14.28%.

@@             Coverage Diff             @@
##           develop    #1963      +/-   ##
===========================================
+ Coverage    55.20%   59.33%   +4.12%     
===========================================
  Files          451      511      +60     
  Lines        20443    21029     +586     
  Branches      5255     5669     +414     
===========================================
+ Hits         11286    12477    +1191     
+ Misses        9128     8530     -598     
+ Partials        29       22       -7     
Impacted Files Coverage Δ
src/currencies/sortByMarketcap.ts 76.00% <7.69%> (+58.25%) :arrow_up:
src/currencies/index.ts 94.44% <100.00%> (+0.10%) :arrow_up:
src/families/crypto_org/api/sdk.ts 16.85% <0.00%> (-78.66%) :arrow_down:
src/families/celo/hw-app-celo.ts 3.38% <0.00%> (-77.97%) :arrow_down:
src/families/bitcoin/js-signOperation.ts 21.53% <0.00%> (-75.39%) :arrow_down:
src/families/bitcoin/networks.ts 5.88% <0.00%> (-74.51%) :arrow_down:
src/families/celo/js-getFeesForTransaction.ts 26.66% <0.00%> (-73.34%) :arrow_down:
src/hw/signTransaction/ripple.ts 27.27% <0.00%> (-72.73%) :arrow_down:
src/families/celo/js-buildTransaction.ts 27.27% <0.00%> (-72.73%) :arrow_down:
src/families/elrond/api/sdk.ts 22.64% <0.00%> (-71.70%) :arrow_down:
... and 358 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5b012ce...7108d9c. Read the comment docs.