@ledgerhq/live-common 21.5.1 → 21.7.1-patch.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/env.js +1 -1
- package/lib/env.js.map +1 -1
- package/lib/exchange/swap/getExchangeRates.d.ts.map +1 -1
- package/lib/exchange/swap/getExchangeRates.js +9 -8
- package/lib/exchange/swap/getExchangeRates.js.map +1 -1
- package/lib/exchange/swap/hooks/index.d.ts +11 -0
- package/lib/exchange/swap/hooks/index.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/index.js +23 -0
- package/lib/exchange/swap/hooks/index.js.map +1 -0
- package/lib/exchange/swap/hooks/useFromState.d.ts +15 -0
- package/lib/exchange/swap/hooks/useFromState.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useFromState.js +67 -0
- package/lib/exchange/swap/hooks/useFromState.js.map +1 -0
- package/lib/exchange/swap/hooks/useFromState.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useFromState.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useFromState.test.js +141 -0
- package/lib/exchange/swap/hooks/useFromState.test.js.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.d.ts +5 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.js +37 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.js.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js +185 -0
- package/lib/exchange/swap/hooks/usePickDefaultAccount.test.js.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.d.ts +3 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.js +17 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.js.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.test.js +73 -0
- package/lib/exchange/swap/hooks/usePickDefaultCurrency.test.js.map +1 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.d.ts +12 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.js +105 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.js.map +1 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.js +78 -0
- package/lib/exchange/swap/hooks/usePollKYCStatus.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts +20 -0
- package/lib/exchange/swap/hooks/useProviderRates.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.js +174 -0
- package/lib/exchange/swap/hooks/useProviderRates.js.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.js +261 -0
- package/lib/exchange/swap/hooks/useProviderRates.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.d.ts +15 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.js +35 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.js.map +1 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.test.js +79 -0
- package/lib/exchange/swap/hooks/useReverseAccounts.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.d.ts +5 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js +43 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.js.map +1 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.test.js +32 -0
- package/lib/exchange/swap/hooks/useSelectableCurrencies.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useSwapProviders.d.ts +14 -0
- package/lib/exchange/swap/hooks/useSwapProviders.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSwapProviders.js +104 -0
- package/lib/exchange/swap/hooks/useSwapProviders.js.map +1 -0
- package/lib/exchange/swap/hooks/useSwapProviders.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useSwapProviders.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSwapProviders.test.js +174 -0
- package/lib/exchange/swap/hooks/useSwapProviders.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts +53 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.js +109 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.js.map +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.test.js +50 -0
- package/lib/exchange/swap/hooks/useSwapTransaction.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useToState.d.ts +12 -0
- package/lib/exchange/swap/hooks/useToState.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useToState.js +73 -0
- package/lib/exchange/swap/hooks/useToState.js.map +1 -0
- package/lib/exchange/swap/hooks/useToState.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useToState.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useToState.test.js +107 -0
- package/lib/exchange/swap/hooks/useToState.test.js.map +1 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.d.ts +15 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.js +106 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.js.map +1 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.d.ts +2 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.d.ts.map +1 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js +217 -0
- package/lib/exchange/swap/hooks/useUpdateMaxAmount.test.js.map +1 -0
- package/lib/exchange/swap/mock.d.ts +6 -2
- package/lib/exchange/swap/mock.d.ts.map +1 -1
- package/lib/exchange/swap/mock.js +21 -6
- package/lib/exchange/swap/mock.js.map +1 -1
- package/lib/exchange/swap/types.d.ts +1 -1
- package/lib/exchange/swap/types.d.ts.map +1 -1
- package/lib/exchange/swap/utils/index.d.ts +16 -0
- package/lib/exchange/swap/utils/index.d.ts.map +1 -0
- package/lib/exchange/swap/utils/index.js +49 -0
- package/lib/exchange/swap/utils/index.js.map +1 -0
- package/lib/exchange/swap/utils/index.test.d.ts +2 -0
- package/lib/exchange/swap/utils/index.test.d.ts.map +1 -0
- package/lib/exchange/swap/utils/index.test.js +238 -0
- package/lib/exchange/swap/utils/index.test.js.map +1 -0
- package/lib/families/crypto_org/datasets/croeseid.d.ts.map +1 -1
- package/lib/families/crypto_org/datasets/croeseid.js +2 -6
- package/lib/families/crypto_org/datasets/croeseid.js.map +1 -1
- package/lib/families/elrond/api/apiCalls.d.ts +0 -4
- package/lib/families/elrond/api/apiCalls.d.ts.map +1 -1
- package/lib/families/elrond/api/apiCalls.js +3 -37
- package/lib/families/elrond/api/apiCalls.js.map +1 -1
- package/lib/families/elrond/api/sdk.js +2 -2
- package/lib/families/elrond/api/sdk.js.map +1 -1
- package/lib/families/elrond/js-transaction.d.ts +2 -0
- package/lib/families/elrond/js-transaction.d.ts.map +1 -1
- package/lib/families/elrond/types.d.ts +2 -0
- package/lib/families/elrond/types.d.ts.map +1 -1
- package/lib/families/elrond/types.js.map +1 -1
- package/lib/families/tezos/bridge/js.d.ts.map +1 -1
- package/lib/families/tezos/bridge/js.js +11 -1
- package/lib/families/tezos/bridge/js.js.map +1 -1
- package/lib/mock/account.d.ts +2 -1
- package/lib/mock/account.d.ts.map +1 -1
- package/lib/mock/account.js +4 -2
- package/lib/mock/account.js.map +1 -1
- package/package.json +15 -15
- package/src/__tests__/__snapshots__/all.libcore.ts.snap +10 -10
- package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +30 -15
- package/src/env.ts +1 -1
- package/src/exchange/swap/getExchangeRates.ts +8 -5
- package/src/exchange/swap/hooks/index.ts +10 -0
- package/src/exchange/swap/hooks/useFromState.test.ts +134 -0
- package/src/exchange/swap/hooks/useFromState.ts +84 -0
- package/src/exchange/swap/hooks/usePickDefaultAccount.test.ts +167 -0
- package/src/exchange/swap/hooks/usePickDefaultAccount.ts +47 -0
- package/src/exchange/swap/hooks/usePickDefaultCurrency.test.ts +107 -0
- package/src/exchange/swap/hooks/usePickDefaultCurrency.ts +20 -0
- package/src/exchange/swap/hooks/usePollKYCStatus.test.ts +89 -0
- package/src/exchange/swap/hooks/usePollKYCStatus.ts +43 -0
- package/src/exchange/swap/hooks/useProviderRates.test.ts +200 -0
- package/src/exchange/swap/hooks/useProviderRates.ts +130 -0
- package/src/exchange/swap/hooks/useReverseAccounts.test.ts +83 -0
- package/src/exchange/swap/hooks/useReverseAccounts.ts +56 -0
- package/src/exchange/swap/hooks/useSelectableCurrencies.test.ts +39 -0
- package/src/exchange/swap/hooks/useSelectableCurrencies.ts +26 -0
- package/src/exchange/swap/hooks/useSwapProviders.test.ts +113 -0
- package/src/exchange/swap/hooks/useSwapProviders.ts +57 -0
- package/src/exchange/swap/hooks/useSwapTransaction.test.ts +54 -0
- package/src/exchange/swap/hooks/useSwapTransaction.ts +170 -0
- package/src/exchange/swap/hooks/useToState.test.ts +53 -0
- package/src/exchange/swap/hooks/useToState.ts +86 -0
- package/src/exchange/swap/hooks/useUpdateMaxAmount.test.ts +132 -0
- package/src/exchange/swap/hooks/useUpdateMaxAmount.ts +67 -0
- package/src/exchange/swap/mock.ts +22 -3
- package/src/exchange/swap/types.ts +2 -1
- package/src/exchange/swap/utils/index.test.ts +224 -0
- package/src/exchange/swap/utils/index.ts +67 -0
- package/src/families/crypto_org/datasets/croeseid.ts +7 -9
- package/src/families/elrond/api/apiCalls.ts +3 -31
- package/src/families/elrond/api/sdk.ts +2 -2
- package/src/families/elrond/types.ts +2 -0
- package/src/families/tezos/bridge/js.ts +13 -0
- package/src/mock/account.ts +2 -2
|
@@ -186,10 +186,10 @@ Array [
|
|
|
186
186
|
"ethereum/erc20/dmarket_token",
|
|
187
187
|
"ethereum/erc20/nkn",
|
|
188
188
|
"ethereum/erc20/iot_chain",
|
|
189
|
+
"ethereum/erc20/voyager_token",
|
|
189
190
|
"ethereum/erc20/ptokens_tlos",
|
|
190
191
|
"ethereum/erc20/santiment",
|
|
191
192
|
"ethereum/erc20/mda",
|
|
192
|
-
"ethereum/erc20/libratoken",
|
|
193
193
|
"ethereum/erc20/wabi",
|
|
194
194
|
"ethereum/erc20/peculium",
|
|
195
195
|
"ethereum/erc20/moviebloc",
|
|
@@ -226,7 +226,7 @@ Array [
|
|
|
226
226
|
"ethereum/erc20/tokenomy",
|
|
227
227
|
"ethereum/erc20/raiden_network",
|
|
228
228
|
"ethereum/erc20/cosmocoin",
|
|
229
|
-
"ethereum/erc20/
|
|
229
|
+
"ethereum/erc20/linear_token",
|
|
230
230
|
"ethereum/erc20/firstblood",
|
|
231
231
|
"ethereum/erc20/sentinel_protocol",
|
|
232
232
|
"ethereum/erc20/coinmetro_token",
|
|
@@ -250,7 +250,6 @@ Array [
|
|
|
250
250
|
"ethereum/erc20/egretia_token",
|
|
251
251
|
"ethereum/erc20/metronome",
|
|
252
252
|
"ethereum/erc20/pillar_project",
|
|
253
|
-
"ethereum/erc20/ethfinex_nectar_token",
|
|
254
253
|
"ethereum/erc20/pro",
|
|
255
254
|
"ethereum/erc20/wings",
|
|
256
255
|
"ethereum/erc20/sirin_labs",
|
|
@@ -532,7 +531,6 @@ Array [
|
|
|
532
531
|
"ethereum/erc20/zippie",
|
|
533
532
|
"ethereum/erc20/rfox",
|
|
534
533
|
"ethereum/erc20/aidcoin",
|
|
535
|
-
"ethereum/erc20/pylon_",
|
|
536
534
|
"ethereum/erc20/tv_two__token_for_television",
|
|
537
535
|
"ethereum/erc20/viewly",
|
|
538
536
|
"ethereum/erc20/coincasso_exchange_token",
|
|
@@ -691,7 +689,7 @@ Array [
|
|
|
691
689
|
"ethereum/erc20/prg",
|
|
692
690
|
"ethereum/erc20/beat_token",
|
|
693
691
|
"ethereum/erc20/paymon",
|
|
694
|
-
"ethereum/erc20/
|
|
692
|
+
"ethereum/erc20/inx_token",
|
|
695
693
|
"ethereum/erc20/lala_world_token",
|
|
696
694
|
"ethereum/erc20/superfarm",
|
|
697
695
|
"ethereum/erc20/suretly",
|
|
@@ -731,7 +729,7 @@ Array [
|
|
|
731
729
|
"ethereum/erc20/alx",
|
|
732
730
|
"ethereum/erc20/zeusnetwork",
|
|
733
731
|
"ethereum/erc20/investfeed",
|
|
734
|
-
"ethereum/erc20/
|
|
732
|
+
"ethereum/erc20/cyberfm_radio",
|
|
735
733
|
"ethereum/erc20/connectjob",
|
|
736
734
|
"ethereum/erc20/mithril_ore",
|
|
737
735
|
"ethereum/erc20/open_trading_network",
|
|
@@ -786,7 +784,6 @@ Array [
|
|
|
786
784
|
"ethereum/erc20/rntb_token",
|
|
787
785
|
"ethereum/erc20/xovbank",
|
|
788
786
|
"ethereum/erc20/arbitrage",
|
|
789
|
-
"ethereum/erc20/futurax",
|
|
790
787
|
"ethereum/erc20/rocket_bunny",
|
|
791
788
|
"ethereum/erc20/kora_network_token",
|
|
792
789
|
"ethereum/erc20/rlt",
|
|
@@ -863,6 +860,7 @@ Array [
|
|
|
863
860
|
"ethereum/erc20/smartlands",
|
|
864
861
|
"ethereum/erc20/nam_coin",
|
|
865
862
|
"ethereum/erc20/alphacon",
|
|
863
|
+
"ethereum/erc20/sparkster",
|
|
866
864
|
"ethereum/erc20/blink",
|
|
867
865
|
"ethereum/erc20/xtock",
|
|
868
866
|
"ethereum/erc20/originsport_token",
|
|
@@ -965,6 +963,7 @@ Array [
|
|
|
965
963
|
"ethereum/erc20/alchemist",
|
|
966
964
|
"ethereum/erc20/alchemix",
|
|
967
965
|
"ethereum/erc20/alchemix_usd",
|
|
966
|
+
"ethereum/erc20/alchemy",
|
|
968
967
|
"ethereum/erc20/alco",
|
|
969
968
|
"ethereum/erc20/aleph.im_v2",
|
|
970
969
|
"ethereum/erc20/alexmasmej",
|
|
@@ -1009,6 +1008,7 @@ Array [
|
|
|
1009
1008
|
"ethereum/erc20/argo_token",
|
|
1010
1009
|
"ethereum/erc20/arianee",
|
|
1011
1010
|
"ethereum/erc20/arke",
|
|
1011
|
+
"ethereum/erc20/arma_coin",
|
|
1012
1012
|
"ethereum/erc20/armor",
|
|
1013
1013
|
"ethereum/erc20/armor_nxm",
|
|
1014
1014
|
"ethereum/erc20/artista",
|
|
@@ -1191,7 +1191,6 @@ Array [
|
|
|
1191
1191
|
"ethereum/erc20/ccc__iconomi_",
|
|
1192
1192
|
"ethereum/erc20/cellframe_token",
|
|
1193
1193
|
"ethereum/erc20/centra",
|
|
1194
|
-
"ethereum/erc20/cfi",
|
|
1195
1194
|
"ethereum/erc20/chads.vc",
|
|
1196
1195
|
"ethereum/erc20/chai",
|
|
1197
1196
|
"ethereum/erc20/chainguardians_governance_token",
|
|
@@ -1338,6 +1337,7 @@ Array [
|
|
|
1338
1337
|
"ethereum/erc20/degen_index",
|
|
1339
1338
|
"ethereum/erc20/degenvc",
|
|
1340
1339
|
"ethereum/erc20/dego.finance",
|
|
1340
|
+
"ethereum/erc20/dehive.finance",
|
|
1341
1341
|
"ethereum/erc20/delphi_tech_token",
|
|
1342
1342
|
"ethereum/erc20/delta.financial",
|
|
1343
1343
|
"ethereum/erc20/delta.theta",
|
|
@@ -1358,7 +1358,6 @@ Array [
|
|
|
1358
1358
|
"ethereum/erc20/dexe",
|
|
1359
1359
|
"ethereum/erc20/dexter",
|
|
1360
1360
|
"ethereum/erc20/dextf_token",
|
|
1361
|
-
"ethereum/erc20/dextools",
|
|
1362
1361
|
"ethereum/erc20/dextrust",
|
|
1363
1362
|
"ethereum/erc20/dfinance",
|
|
1364
1363
|
"ethereum/erc20/dfohub",
|
|
@@ -1414,6 +1413,7 @@ Array [
|
|
|
1414
1413
|
"ethereum/erc20/duckdaodime",
|
|
1415
1414
|
"ethereum/erc20/duty_of_care_token",
|
|
1416
1415
|
"ethereum/erc20/dvgtoken",
|
|
1416
|
+
"ethereum/erc20/dydx",
|
|
1417
1417
|
"ethereum/erc20/dynamic_set_dollar",
|
|
1418
1418
|
"ethereum/erc20/e-radix",
|
|
1419
1419
|
"ethereum/erc20/e4row",
|
|
@@ -1468,6 +1468,7 @@ Array [
|
|
|
1468
1468
|
"ethereum/erc20/ethernet_cash",
|
|
1469
1469
|
"ethereum/erc20/ethernitychain_ern_token",
|
|
1470
1470
|
"ethereum/erc20/etheruem_risen",
|
|
1471
|
+
"ethereum/erc20/ethfinex_nectar_token",
|
|
1471
1472
|
"ethereum/erc20/ethos",
|
|
1472
1473
|
"ethereum/erc20/ethpoker_io_epx",
|
|
1473
1474
|
"ethereum/erc20/ethverse_token",
|
|
@@ -1555,6 +1556,7 @@ Array [
|
|
|
1555
1556
|
"ethereum/erc20/furucombo",
|
|
1556
1557
|
"ethereum/erc20/fuse_token",
|
|
1557
1558
|
"ethereum/erc20/futourist_token",
|
|
1559
|
+
"ethereum/erc20/futurax",
|
|
1558
1560
|
"ethereum/erc20/futureswap_token",
|
|
1559
1561
|
"ethereum/erc20/gains",
|
|
1560
1562
|
"ethereum/erc20/gains_v2",
|
|
@@ -1685,6 +1687,7 @@ Array [
|
|
|
1685
1687
|
"ethereum/erc20/infi",
|
|
1686
1688
|
"ethereum/erc20/infinito_token",
|
|
1687
1689
|
"ethereum/erc20/injective_token",
|
|
1690
|
+
"ethereum/erc20/inmax",
|
|
1688
1691
|
"ethereum/erc20/ins",
|
|
1689
1692
|
"ethereum/erc20/insurace",
|
|
1690
1693
|
"ethereum/erc20/insure",
|
|
@@ -1694,8 +1697,8 @@ Array [
|
|
|
1694
1697
|
"ethereum/erc20/invacio_coin",
|
|
1695
1698
|
"ethereum/erc20/inverse",
|
|
1696
1699
|
"ethereum/erc20/inverse_dao",
|
|
1700
|
+
"ethereum/erc20/invictus_margin_lending",
|
|
1697
1701
|
"ethereum/erc20/invox_finance",
|
|
1698
|
-
"ethereum/erc20/inx_token",
|
|
1699
1702
|
"ethereum/erc20/ionia",
|
|
1700
1703
|
"ethereum/erc20/iot___",
|
|
1701
1704
|
"ethereum/erc20/iqoniq",
|
|
@@ -1757,10 +1760,11 @@ Array [
|
|
|
1757
1760
|
"ethereum/erc20/lgcy_network",
|
|
1758
1761
|
"ethereum/erc20/lgo_token",
|
|
1759
1762
|
"ethereum/erc20/libereum",
|
|
1763
|
+
"ethereum/erc20/libratoken",
|
|
1760
1764
|
"ethereum/erc20/lido_dao_token",
|
|
1761
1765
|
"ethereum/erc20/lien",
|
|
1762
1766
|
"ethereum/erc20/liferun_coin",
|
|
1763
|
-
"ethereum/erc20/
|
|
1767
|
+
"ethereum/erc20/lina",
|
|
1764
1768
|
"ethereum/erc20/link_platform",
|
|
1765
1769
|
"ethereum/erc20/linkpool",
|
|
1766
1770
|
"ethereum/erc20/linkusd",
|
|
@@ -1820,13 +1824,13 @@ Array [
|
|
|
1820
1824
|
"ethereum/erc20/micro_launchpad_token",
|
|
1821
1825
|
"ethereum/erc20/micro_licensing_coin",
|
|
1822
1826
|
"ethereum/erc20/mikado",
|
|
1827
|
+
"ethereum/erc20/million",
|
|
1823
1828
|
"ethereum/erc20/mimo_parallel_governance_token",
|
|
1824
1829
|
"ethereum/erc20/minds",
|
|
1825
1830
|
"ethereum/erc20/mis",
|
|
1826
1831
|
"ethereum/erc20/mithril_token",
|
|
1827
1832
|
"ethereum/erc20/mitrav",
|
|
1828
1833
|
"ethereum/erc20/mixin",
|
|
1829
|
-
"ethereum/erc20/mmtoken",
|
|
1830
1834
|
"ethereum/erc20/mnft",
|
|
1831
1835
|
"ethereum/erc20/moar_finance",
|
|
1832
1836
|
"ethereum/erc20/modefi",
|
|
@@ -2029,6 +2033,7 @@ Array [
|
|
|
2029
2033
|
"ethereum/erc20/pussy_token",
|
|
2030
2034
|
"ethereum/erc20/pygoz",
|
|
2031
2035
|
"ethereum/erc20/pylon",
|
|
2036
|
+
"ethereum/erc20/pylon_",
|
|
2032
2037
|
"ethereum/erc20/pyr_token",
|
|
2033
2038
|
"ethereum/erc20/qanx_token",
|
|
2034
2039
|
"ethereum/erc20/qark_token_of_qan_platform",
|
|
@@ -2053,7 +2058,6 @@ Array [
|
|
|
2053
2058
|
"ethereum/erc20/ramp_defi",
|
|
2054
2059
|
"ethereum/erc20/rare",
|
|
2055
2060
|
"ethereum/erc20/rare.unique",
|
|
2056
|
-
"ethereum/erc20/rare_token",
|
|
2057
2061
|
"ethereum/erc20/rari_governance_token",
|
|
2058
2062
|
"ethereum/erc20/raydium",
|
|
2059
2063
|
"ethereum/erc20/raze_network",
|
|
@@ -2101,9 +2105,11 @@ Array [
|
|
|
2101
2105
|
"ethereum/erc20/safeearth",
|
|
2102
2106
|
"ethereum/erc20/safemoon_inu",
|
|
2103
2107
|
"ethereum/erc20/safemusk",
|
|
2108
|
+
"ethereum/erc20/saitama_inu",
|
|
2104
2109
|
"ethereum/erc20/saito",
|
|
2105
2110
|
"ethereum/erc20/saketoken",
|
|
2106
2111
|
"ethereum/erc20/sanshu_inu",
|
|
2112
|
+
"ethereum/erc20/sarcophagus",
|
|
2107
2113
|
"ethereum/erc20/sashimitoken",
|
|
2108
2114
|
"ethereum/erc20/saturn_network",
|
|
2109
2115
|
"ethereum/erc20/scandiweb_coin",
|
|
@@ -2159,6 +2165,7 @@ Array [
|
|
|
2159
2165
|
"ethereum/erc20/smartmesh",
|
|
2160
2166
|
"ethereum/erc20/smartrealty",
|
|
2161
2167
|
"ethereum/erc20/smol",
|
|
2168
|
+
"ethereum/erc20/smooth_love_potion",
|
|
2162
2169
|
"ethereum/erc20/snip",
|
|
2163
2170
|
"ethereum/erc20/snowball",
|
|
2164
2171
|
"ethereum/erc20/snowswap",
|
|
@@ -2166,6 +2173,7 @@ Array [
|
|
|
2166
2173
|
"ethereum/erc20/soarcoin",
|
|
2167
2174
|
"ethereum/erc20/social_media_market",
|
|
2168
2175
|
"ethereum/erc20/solomondefi",
|
|
2176
|
+
"ethereum/erc20/somee.social",
|
|
2169
2177
|
"ethereum/erc20/somnium_space_cubes",
|
|
2170
2178
|
"ethereum/erc20/soniq_token",
|
|
2171
2179
|
"ethereum/erc20/sonm",
|
|
@@ -2187,6 +2195,7 @@ Array [
|
|
|
2187
2195
|
"ethereum/erc20/spice_vc_token",
|
|
2188
2196
|
"ethereum/erc20/spiderdao_token",
|
|
2189
2197
|
"ethereum/erc20/splyt_shopx",
|
|
2198
|
+
"ethereum/erc20/spores",
|
|
2190
2199
|
"ethereum/erc20/sportx",
|
|
2191
2200
|
"ethereum/erc20/squirrel_finance",
|
|
2192
2201
|
"ethereum/erc20/stabilize_token",
|
|
@@ -2224,6 +2233,7 @@ Array [
|
|
|
2224
2233
|
"ethereum/erc20/super_keep_token",
|
|
2225
2234
|
"ethereum/erc20/super_saiya-jin_token",
|
|
2226
2235
|
"ethereum/erc20/superbid",
|
|
2236
|
+
"ethereum/erc20/superrare",
|
|
2227
2237
|
"ethereum/erc20/surf.finance",
|
|
2228
2238
|
"ethereum/erc20/sushi",
|
|
2229
2239
|
"ethereum/erc20/sushibar",
|
|
@@ -2306,6 +2316,7 @@ Array [
|
|
|
2306
2316
|
"ethereum/erc20/tradecloudtoken",
|
|
2307
2317
|
"ethereum/erc20/tranche_finance",
|
|
2308
2318
|
"ethereum/erc20/traxia_membership_token",
|
|
2319
|
+
"ethereum/erc20/trias_token",
|
|
2309
2320
|
"ethereum/erc20/tribe",
|
|
2310
2321
|
"ethereum/erc20/trident_group",
|
|
2311
2322
|
"ethereum/erc20/trilliontoken",
|
|
@@ -2386,6 +2397,7 @@ Array [
|
|
|
2386
2397
|
"ethereum/erc20/virtue_player_points",
|
|
2387
2398
|
"ethereum/erc20/vision_token",
|
|
2388
2399
|
"ethereum/erc20/visor",
|
|
2400
|
+
"ethereum/erc20/vitadao_token",
|
|
2389
2401
|
"ethereum/erc20/viu",
|
|
2390
2402
|
"ethereum/erc20/vlink_pool",
|
|
2391
2403
|
"ethereum/erc20/vormacoin",
|
|
@@ -2407,10 +2419,9 @@ Array [
|
|
|
2407
2419
|
"ethereum/erc20/wi_coin",
|
|
2408
2420
|
"ethereum/erc20/wibson_token",
|
|
2409
2421
|
"ethereum/erc20/wicknote",
|
|
2410
|
-
"ethereum/erc20/
|
|
2422
|
+
"ethereum/erc20/wilder",
|
|
2411
2423
|
"ethereum/erc20/windbellows",
|
|
2412
2424
|
"ethereum/erc20/wise_token",
|
|
2413
|
-
"ethereum/erc20/wolk",
|
|
2414
2425
|
"ethereum/erc20/wolk_token",
|
|
2415
2426
|
"ethereum/erc20/woofy",
|
|
2416
2427
|
"ethereum/erc20/woonk",
|
|
@@ -2419,6 +2430,7 @@ Array [
|
|
|
2419
2430
|
"ethereum/erc20/workcoin",
|
|
2420
2431
|
"ethereum/erc20/world_token",
|
|
2421
2432
|
"ethereum/erc20/wrapped_celo",
|
|
2433
|
+
"ethereum/erc20/wrapped_centrifuge",
|
|
2422
2434
|
"ethereum/erc20/wrapped_chi",
|
|
2423
2435
|
"ethereum/erc20/wrapped_cres",
|
|
2424
2436
|
"ethereum/erc20/wrapped_ilcoin",
|
|
@@ -2443,6 +2455,7 @@ Array [
|
|
|
2443
2455
|
"ethereum/erc20/xenon",
|
|
2444
2456
|
"ethereum/erc20/xensor",
|
|
2445
2457
|
"ethereum/erc20/xfit",
|
|
2458
|
+
"ethereum/erc20/xfund",
|
|
2446
2459
|
"ethereum/erc20/xgt",
|
|
2447
2460
|
"ethereum/erc20/xhdx",
|
|
2448
2461
|
"ethereum/erc20/xid",
|
|
@@ -2452,6 +2465,7 @@ Array [
|
|
|
2452
2465
|
"ethereum/erc20/xmon",
|
|
2453
2466
|
"ethereum/erc20/xnt",
|
|
2454
2467
|
"ethereum/erc20/xrl",
|
|
2468
|
+
"ethereum/erc20/xrune_token",
|
|
2455
2469
|
"ethereum/erc20/xsc",
|
|
2456
2470
|
"ethereum/erc20/xsgd",
|
|
2457
2471
|
"ethereum/erc20/xsigma",
|
|
@@ -2481,6 +2495,7 @@ Array [
|
|
|
2481
2495
|
"ethereum/erc20/yfx",
|
|
2482
2496
|
"ethereum/erc20/yield",
|
|
2483
2497
|
"ethereum/erc20/yield_",
|
|
2498
|
+
"ethereum/erc20/yield_guild_games_token",
|
|
2484
2499
|
"ethereum/erc20/yield_protocol",
|
|
2485
2500
|
"ethereum/erc20/yieldfarming.insure",
|
|
2486
2501
|
"ethereum/erc20/yop",
|
package/src/env.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Exchange, GetExchangeRates } from "./types";
|
|
2
2
|
import type { Transaction } from "../../types";
|
|
3
3
|
import { getAccountCurrency, getAccountUnit } from "../../account";
|
|
4
|
-
import type { Unit } from "../../types";
|
|
4
|
+
import type { Unit, TokenCurrency, CryptoCurrency } from "../../types";
|
|
5
5
|
import { formatCurrencyUnit } from "../../currencies";
|
|
6
6
|
import { mockGetExchangeRates } from "./mock";
|
|
7
7
|
import network from "../../network";
|
|
@@ -16,16 +16,19 @@ import {
|
|
|
16
16
|
const getExchangeRates: GetExchangeRates = async (
|
|
17
17
|
exchange: Exchange,
|
|
18
18
|
transaction: Transaction,
|
|
19
|
-
userId?: string // TODO remove when wyre doesn't require this for rates
|
|
19
|
+
userId?: string, // TODO remove when wyre doesn't require this for rates
|
|
20
|
+
currencyTo?: TokenCurrency | CryptoCurrency | undefined | null
|
|
20
21
|
) => {
|
|
21
|
-
if (getEnv("MOCK"))
|
|
22
|
+
if (getEnv("MOCK"))
|
|
23
|
+
return mockGetExchangeRates(exchange, transaction, currencyTo);
|
|
22
24
|
|
|
23
25
|
// Rely on the api base to determine the version logic
|
|
24
26
|
const usesV3 = getSwapAPIBaseURL().endsWith("v3");
|
|
25
27
|
const from = getAccountCurrency(exchange.fromAccount).id;
|
|
26
28
|
const unitFrom = getAccountUnit(exchange.fromAccount);
|
|
27
|
-
const unitTo =
|
|
28
|
-
|
|
29
|
+
const unitTo =
|
|
30
|
+
(currencyTo && currencyTo.units[0]) ?? getAccountUnit(exchange.toAccount);
|
|
31
|
+
const to = (currencyTo ?? getAccountCurrency(exchange.toAccount)).id;
|
|
29
32
|
const amountFrom = transaction.amount;
|
|
30
33
|
const tenPowMagnitude = new BigNumber(10).pow(unitFrom.magnitude);
|
|
31
34
|
const apiAmount = new BigNumber(amountFrom).div(tenPowMagnitude);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export * from "./usePickDefaultAccount";
|
|
2
|
+
export * from "./usePickDefaultCurrency";
|
|
3
|
+
export * from "./usePollKYCStatus";
|
|
4
|
+
export * from "./useSelectableCurrencies";
|
|
5
|
+
export * from "./useSwapProviders";
|
|
6
|
+
export * from "./useSwapTransaction";
|
|
7
|
+
export * from "./useUpdateMaxAmount";
|
|
8
|
+
export * from "./useProviderRates";
|
|
9
|
+
export * from "./useFromState";
|
|
10
|
+
export * from "./useToState";
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { getCryptoCurrencyById, getTokenById } from "@ledgerhq/cryptoassets";
|
|
2
|
+
import { renderHook, act } from "@testing-library/react-hooks";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
import { selectorStateDefaultValues } from ".";
|
|
5
|
+
import useBridgeTransaction from "../../../bridge/useBridgeTransaction";
|
|
6
|
+
import { genAccount, genTokenAccount } from "../../../mock/account";
|
|
7
|
+
import { Account } from "../../../types";
|
|
8
|
+
import { useFromState } from "./useFromState";
|
|
9
|
+
|
|
10
|
+
const BTC = getCryptoCurrencyById("bitcoin");
|
|
11
|
+
const ETH = getCryptoCurrencyById("ethereum");
|
|
12
|
+
const USDT = getTokenById("ethereum/erc20/usd_tether__erc20_");
|
|
13
|
+
|
|
14
|
+
const mockedAccounts: Account[] = [
|
|
15
|
+
genAccount("mocked-account-1"),
|
|
16
|
+
genAccount("mocked-account-2", {
|
|
17
|
+
currency: ETH,
|
|
18
|
+
}),
|
|
19
|
+
];
|
|
20
|
+
const mockedTokenAccount = genTokenAccount(1, mockedAccounts[1], USDT);
|
|
21
|
+
const allAccounts = [...mockedAccounts, mockedTokenAccount] as Account[];
|
|
22
|
+
|
|
23
|
+
describe("useFromState", () => {
|
|
24
|
+
test("call hook without arguments", () => {
|
|
25
|
+
const { result } = renderHook(() => {
|
|
26
|
+
const bridgeTransaction = useBridgeTransaction();
|
|
27
|
+
return useFromState({
|
|
28
|
+
bridgeTransaction,
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
expect(result.current).toMatchObject({
|
|
32
|
+
fromState: selectorStateDefaultValues,
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
test("call hook with default currency", () => {
|
|
37
|
+
const defaultCurrency = BTC;
|
|
38
|
+
|
|
39
|
+
const { result } = renderHook(() => {
|
|
40
|
+
const bridgeTransaction = useBridgeTransaction();
|
|
41
|
+
return useFromState({
|
|
42
|
+
defaultCurrency,
|
|
43
|
+
bridgeTransaction,
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
expect(result.current).toMatchObject({
|
|
47
|
+
fromState: {
|
|
48
|
+
...selectorStateDefaultValues,
|
|
49
|
+
currency: defaultCurrency,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
test("call hook with default accounts", () => {
|
|
55
|
+
const defaultAccount = mockedTokenAccount;
|
|
56
|
+
const defaultParentAccount = mockedAccounts[1];
|
|
57
|
+
|
|
58
|
+
const { result } = renderHook(() => {
|
|
59
|
+
const bridgeTransaction = useBridgeTransaction();
|
|
60
|
+
return useFromState({
|
|
61
|
+
defaultAccount,
|
|
62
|
+
defaultParentAccount,
|
|
63
|
+
bridgeTransaction,
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
expect(result.current).toMatchObject({
|
|
67
|
+
fromState: {
|
|
68
|
+
...selectorStateDefaultValues,
|
|
69
|
+
account: defaultAccount,
|
|
70
|
+
parentAccount: defaultParentAccount,
|
|
71
|
+
},
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("call hook and set the account and all the related properties", () => {
|
|
76
|
+
const { result } = renderHook(() => {
|
|
77
|
+
const bridgeTransaction = useBridgeTransaction();
|
|
78
|
+
return {
|
|
79
|
+
...useFromState({
|
|
80
|
+
accounts: allAccounts,
|
|
81
|
+
bridgeTransaction,
|
|
82
|
+
}),
|
|
83
|
+
bridgeTransaction,
|
|
84
|
+
};
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
expect(result.current).toMatchObject({
|
|
88
|
+
fromState: selectorStateDefaultValues,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
act(() => {
|
|
92
|
+
result.current.setFromAccount(mockedTokenAccount);
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
expect(result.current).toMatchObject({
|
|
96
|
+
fromState: {
|
|
97
|
+
...selectorStateDefaultValues,
|
|
98
|
+
account: mockedTokenAccount,
|
|
99
|
+
parentAccount: mockedAccounts[1],
|
|
100
|
+
currency: USDT,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
expect(result.current.bridgeTransaction).toMatchObject({
|
|
105
|
+
account: mockedTokenAccount,
|
|
106
|
+
parentAccount: mockedAccounts[1],
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test("call hook and set the amount", () => {
|
|
111
|
+
const { result } = renderHook(() => {
|
|
112
|
+
const bridgeTransaction = useBridgeTransaction();
|
|
113
|
+
return useFromState({
|
|
114
|
+
accounts: allAccounts,
|
|
115
|
+
bridgeTransaction,
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
expect(result.current).toMatchObject({
|
|
120
|
+
fromState: selectorStateDefaultValues,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
act(() => {
|
|
124
|
+
result.current.setFromAmount(new BigNumber(10));
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
expect(result.current).toMatchObject({
|
|
128
|
+
fromState: {
|
|
129
|
+
...selectorStateDefaultValues,
|
|
130
|
+
amount: new BigNumber(10),
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { getAbandonSeedAddress } from "@ledgerhq/cryptoassets";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import {
|
|
4
|
+
selectorStateDefaultValues,
|
|
5
|
+
SwapSelectorStateType,
|
|
6
|
+
SwapTransactionType,
|
|
7
|
+
} from ".";
|
|
8
|
+
import { getAccountCurrency, getMainAccount } from "../../../account";
|
|
9
|
+
import { Account, AccountLike } from "../../../types";
|
|
10
|
+
import { Result as UseBridgeTransactionReturnType } from "../../../bridge/useBridgeTransaction";
|
|
11
|
+
|
|
12
|
+
export const useFromState = ({
|
|
13
|
+
accounts,
|
|
14
|
+
defaultCurrency,
|
|
15
|
+
defaultAccount,
|
|
16
|
+
defaultParentAccount,
|
|
17
|
+
bridgeTransaction,
|
|
18
|
+
}: {
|
|
19
|
+
accounts?: Account[];
|
|
20
|
+
defaultCurrency?: SwapSelectorStateType["currency"];
|
|
21
|
+
defaultAccount?: SwapSelectorStateType["account"];
|
|
22
|
+
defaultParentAccount?: SwapSelectorStateType["parentAccount"];
|
|
23
|
+
bridgeTransaction: UseBridgeTransactionReturnType;
|
|
24
|
+
}): {
|
|
25
|
+
fromState: SwapSelectorStateType;
|
|
26
|
+
setFromAccount: SwapTransactionType["setFromAccount"];
|
|
27
|
+
setFromAmount: SwapTransactionType["setFromAmount"];
|
|
28
|
+
} => {
|
|
29
|
+
const [fromState, setFromState] = useState<SwapSelectorStateType>({
|
|
30
|
+
...selectorStateDefaultValues,
|
|
31
|
+
currency: defaultCurrency ?? selectorStateDefaultValues.currency,
|
|
32
|
+
account: defaultAccount ?? selectorStateDefaultValues.account,
|
|
33
|
+
parentAccount:
|
|
34
|
+
defaultParentAccount ?? selectorStateDefaultValues.parentAccount,
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
/* UPDATE from account */
|
|
38
|
+
const setFromAccount: SwapTransactionType["setFromAccount"] = useCallback(
|
|
39
|
+
(account) => {
|
|
40
|
+
const parentAccount =
|
|
41
|
+
account?.type !== "Account"
|
|
42
|
+
? accounts?.find((a) => a.id === account?.parentId)
|
|
43
|
+
: null;
|
|
44
|
+
const currency = getAccountCurrency(account as AccountLike);
|
|
45
|
+
|
|
46
|
+
bridgeTransaction.setAccount(account as AccountLike, parentAccount);
|
|
47
|
+
setFromState({
|
|
48
|
+
...selectorStateDefaultValues,
|
|
49
|
+
currency,
|
|
50
|
+
account,
|
|
51
|
+
parentAccount,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
/* @DEV: That populates fake seed. This is required to use Transaction object */
|
|
55
|
+
const mainAccount = getMainAccount(account as AccountLike, parentAccount);
|
|
56
|
+
const mainCurrency = getAccountCurrency(mainAccount);
|
|
57
|
+
const recipient = getAbandonSeedAddress(mainCurrency.id);
|
|
58
|
+
bridgeTransaction.updateTransaction((transaction) => ({
|
|
59
|
+
...transaction,
|
|
60
|
+
recipient,
|
|
61
|
+
}));
|
|
62
|
+
},
|
|
63
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
64
|
+
[accounts, bridgeTransaction.updateTransaction]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const setFromAmount: SwapTransactionType["setFromAmount"] = useCallback(
|
|
68
|
+
(amount) => {
|
|
69
|
+
bridgeTransaction.updateTransaction((transaction) => ({
|
|
70
|
+
...transaction,
|
|
71
|
+
amount,
|
|
72
|
+
}));
|
|
73
|
+
setFromState((previousState) => ({ ...previousState, amount: amount }));
|
|
74
|
+
},
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
[bridgeTransaction.updateTransaction]
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
fromState,
|
|
81
|
+
setFromAccount,
|
|
82
|
+
setFromAmount,
|
|
83
|
+
};
|
|
84
|
+
};
|