@ledgerhq/live-common 34.47.0-nightly.6 → 34.47.0-nightly.8
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/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/buildSubAccounts.js +1 -2
- package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +0 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +21 -5
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +2 -4
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/generic-alpaca/utils.test.js +37 -0
- package/lib/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib/e2e/enum/DeviceLabels.d.ts +2 -1
- package/lib/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib/e2e/enum/DeviceLabels.js +1 -0
- package/lib/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib/e2e/index.d.ts +0 -2
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/e2e/speculos.d.ts +1 -0
- package/lib/e2e/speculos.d.ts.map +1 -1
- package/lib/e2e/speculos.js +10 -2
- package/lib/e2e/speculos.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +0 -1
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
- package/lib/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.js +15 -0
- package/lib/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts +6 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js +19 -0
- package/lib/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
- package/lib/modularDrawer/hooks/useLeftApy.d.ts +54 -0
- package/lib/modularDrawer/hooks/useLeftApy.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useLeftApy.js +15 -0
- package/lib/modularDrawer/hooks/useLeftApy.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js +87 -0
- package/lib/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js +66 -0
- package/lib/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js +41 -0
- package/lib/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.js +56 -0
- package/lib/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js +17 -0
- package/lib/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib/modularDrawer/utils/sortByBalance.d.ts +6 -0
- package/lib/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
- package/lib/modularDrawer/utils/sortByBalance.js +32 -0
- package/lib/modularDrawer/utils/sortByBalance.js.map +1 -0
- package/lib/modularDrawer/utils/type.d.ts +89 -1
- package/lib/modularDrawer/utils/type.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +2 -3
- package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +0 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +14 -3
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +21 -5
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +2 -4
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.test.js +37 -0
- package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts +2 -1
- package/lib-es/e2e/enum/DeviceLabels.d.ts.map +1 -1
- package/lib-es/e2e/enum/DeviceLabels.js +1 -0
- package/lib-es/e2e/enum/DeviceLabels.js.map +1 -1
- package/lib-es/e2e/index.d.ts +0 -2
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/e2e/speculos.d.ts +1 -0
- package/lib-es/e2e/speculos.d.ts.map +1 -1
- package/lib-es/e2e/speculos.js +8 -1
- package/lib-es/e2e/speculos.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +0 -1
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.d.ts.map +1 -1
- package/lib-es/modularDrawer/hooks/modules/useLeftApyModule.js.map +1 -1
- package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts} +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js} +1 -1
- package/lib-es/modularDrawer/hooks/useAssetAccountCounts.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts +13 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.js +11 -0
- package/lib-es/modularDrawer/hooks/useLeftAccounts.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts +6 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js +15 -0
- package/lib-es/modularDrawer/hooks/useLeftAccountsApy.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftApy.d.ts +54 -0
- package/lib-es/modularDrawer/hooks/useLeftApy.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useLeftApy.js +11 -0
- package/lib-es/modularDrawer/hooks/useLeftApy.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts +57 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js +83 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceAsset.js.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts +63 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.d.ts.map +1 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js +62 -0
- package/lib-es/modularDrawer/hooks/useRightBalanceNetwork.js.map +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts +4 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js +39 -0
- package/lib-es/modularDrawer/modules/createAssetConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts +6 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.d.ts.map +1 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js +50 -0
- package/lib-es/modularDrawer/modules/createNetworkConfiguration.js.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts +9 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js +13 -0
- package/lib-es/modularDrawer/utils/buildProviderCurrenciesMap.js.map +1 -0
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts +6 -0
- package/lib-es/modularDrawer/utils/sortByBalance.d.ts.map +1 -0
- package/lib-es/modularDrawer/utils/sortByBalance.js +25 -0
- package/lib-es/modularDrawer/utils/sortByBalance.js.map +1 -0
- package/lib-es/modularDrawer/utils/type.d.ts +89 -1
- package/lib-es/modularDrawer/utils/type.d.ts.map +1 -1
- package/package.json +40 -40
- package/src/bridge/generic-alpaca/buildSubAccounts.ts +2 -3
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +0 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +44 -17
- package/src/bridge/generic-alpaca/utils.test.ts +40 -0
- package/src/bridge/generic-alpaca/utils.ts +5 -6
- package/src/e2e/enum/DeviceLabels.ts +1 -0
- package/src/e2e/speculos.ts +9 -1
- package/src/featureFlags/defaultFeatures.ts +0 -1
- package/src/modularDrawer/hooks/modules/useLeftApyModule.tsx +1 -1
- package/src/modularDrawer/hooks/{modules/useAssetAccountCounts.tsx → useAssetAccountCounts.tsx} +2 -2
- package/src/modularDrawer/hooks/useLeftAccounts.tsx +23 -0
- package/src/modularDrawer/hooks/useLeftAccountsApy.tsx +28 -0
- package/src/modularDrawer/hooks/useLeftApy.tsx +19 -0
- package/src/modularDrawer/hooks/useRightBalanceAsset.tsx +140 -0
- package/src/modularDrawer/hooks/useRightBalanceNetwork.tsx +116 -0
- package/src/modularDrawer/modules/createAssetConfiguration.ts +61 -0
- package/src/modularDrawer/modules/createNetworkConfiguration.ts +79 -0
- package/src/modularDrawer/utils/buildProviderCurrenciesMap.tsx +25 -0
- package/src/modularDrawer/utils/sortByBalance.tsx +32 -0
- package/src/modularDrawer/utils/type.ts +97 -0
- package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
- package/lib/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
- package/lib/modularDrawer/types.d.ts +0 -2
- package/lib/modularDrawer/types.d.ts.map +0 -1
- package/lib/modularDrawer/types.js +0 -3
- package/lib/modularDrawer/types.js.map +0 -1
- package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.d.ts.map +0 -1
- package/lib-es/modularDrawer/hooks/modules/useAssetAccountCounts.js.map +0 -1
- package/lib-es/modularDrawer/types.d.ts +0 -2
- package/lib-es/modularDrawer/types.d.ts.map +0 -1
- package/lib-es/modularDrawer/types.js +0 -2
- package/lib-es/modularDrawer/types.js.map +0 -1
- package/src/modularDrawer/types.ts +0 -1
@@ -1,6 +1,6 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
|
-
import { ApyType } from "../../
|
3
|
+
import { ApyType } from "../../utils/type";
|
4
4
|
export declare const useLeftApyModule: (currencies: CryptoOrTokenCurrency[], ApyIndicator: React.ComponentType<{
|
5
5
|
value: number;
|
6
6
|
type: ApyType;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useLeftApyModule.d.ts","sourceRoot":"","sources":["../../../../src/modularDrawer/hooks/modules/useLeftApyModule.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;
|
1
|
+
{"version":3,"file":"useLeftApyModule.d.ts","sourceRoot":"","sources":["../../../../src/modularDrawer/hooks/modules/useLeftApyModule.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAe3C,eAAO,MAAM,gBAAgB,eACf,qBAAqB,EAAE,gBACrB,MAAM,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqCpE,CAAC"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"useLeftApyModule.js","sourceRoot":"","sources":["../../../../src/modularDrawer/hooks/modules/useLeftApyModule.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,6CAA0C;
|
1
|
+
{"version":3,"file":"useLeftApyModule.js","sourceRoot":"","sources":["../../../../src/modularDrawer/hooks/modules/useLeftApyModule.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAuC;AACvC,6CAA0C;AAE1C,qFAAyF;AAGzF,MAAM,cAAc,GAAG,CAAC,IAAY,EAAmB,EAAE,CACvD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,CAAC;AAErD,MAAM,aAAa,GAAG,CAAC,EACrB,KAAK,EACL,IAAI,EACJ,YAAY,GAKb,EAAE,EAAE,CAAC,8BAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AAE1C,MAAM,gBAAgB,GAAG,CAC9B,UAAmC,EACnC,YAAmE,EACnE,EAAE;IACF,MAAM,aAAa,GAAG,IAAA,yBAAW,EAAC,KAAK,CAAC,EAAE;QACxC,MAAM,KAAK,GAAiE,EAAE,CAAC;QAC/E,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YAC5B,MAAM,OAAO,GAAG,IAAA,oDAA4B,EAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;YACjE,IAAI,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBAC3C,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG;oBACnB,KAAK,EAAE,OAAO,CAAC,IAAI;oBACnB,IAAI,EAAE,OAAO,CAAC,IAAI;iBACnB,CAAC;aACH;QACH,CAAC,CAAC,CAAC;QACH,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,OAAO,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC/B,MAAM,YAAY,GAAG,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;YAChD,MAAM,6BAA6B,GAAG,YAAY;gBAChD,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG;gBAClD,CAAC,CAAC,CAAC,CAAC;YAEN,IAAI,CAAC,YAAY,IAAI,6BAA6B,IAAI,CAAC,EAAE;gBACvD,OAAO,QAAQ,CAAC;aACjB;YAED,OAAO;gBACL,GAAG,QAAQ;gBACX,WAAW,EAAE,aAAa,CAAC;oBACzB,KAAK,EAAE,6BAA6B;oBACpC,IAAI,EAAE,YAAY,CAAC,IAAI;oBACvB,YAAY;iBACb,CAAC;aACH,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAvCW,QAAA,gBAAgB,oBAuC3B"}
|
package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.d.ts → useAssetAccountCounts.d.ts}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Observable } from "rxjs";
|
2
2
|
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
3
|
import type { Account } from "@ledgerhq/types-live";
|
4
|
-
import { WalletAPIAccount } from "
|
4
|
+
import { WalletAPIAccount } from "../../wallet-api/types";
|
5
5
|
type AccountModuleParams = {
|
6
6
|
assets: CryptoOrTokenCurrency[];
|
7
7
|
nestedAccounts: Account[];
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useAssetAccountCounts.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useAssetAccountCounts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,cAAc,EAAE,OAAO,EAAE,CAAC;IAC1B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAC;IAC7C,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,SAAS,CAAC,EAAE,UAAU,CAAC,gBAAgB,EAAE,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,qBAAqB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,qBAAqB,yDAK/B,mBAAmB,KAAG,cAAc,EAUD,CAAC"}
|
package/lib/modularDrawer/hooks/{modules/useAssetAccountCounts.js → useAssetAccountCounts.js}
RENAMED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.useAssetAccountCounts = void 0;
|
4
|
-
const getAccountTuplesForCurrency_1 = require("
|
4
|
+
const getAccountTuplesForCurrency_1 = require("../../utils/getAccountTuplesForCurrency");
|
5
5
|
const useAssetAccountCounts = ({ assets, nestedAccounts, accountIds, formatLabel, }) => assets
|
6
6
|
.map(asset => {
|
7
7
|
const { length } = (0, getAccountTuplesForCurrency_1.getAccountTuplesForCurrency)(asset, nestedAccounts, accountIds);
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useAssetAccountCounts.js","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useAssetAccountCounts.tsx"],"names":[],"mappings":";;;AAEA,yFAAsF;AAkB/E,MAAM,qBAAqB,GAAG,CAAC,EACpC,MAAM,EACN,cAAc,EACd,UAAU,EACV,WAAW,GACS,EAAoB,EAAE,CAC1C,MAAM;KACH,GAAG,CAAC,KAAK,CAAC,EAAE;IACX,MAAM,EAAE,MAAM,EAAE,GAAG,IAAA,yDAA2B,EAAC,KAAK,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IAClF,OAAO;QACL,KAAK;QACL,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC;QAC1B,KAAK,EAAE,MAAM;KACd,CAAC;AACJ,CAAC,CAAC;KACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAf1B,QAAA,qBAAqB,yBAeK"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
+
import { ReactNode } from "react";
|
3
|
+
import { AccountModuleParams, AccountDataItem } from "../utils/type";
|
4
|
+
export declare const createUseLeftAccountsModule: ({ useAccountData, accountsCount, }: {
|
5
|
+
useAccountData: (params: AccountModuleParams) => AccountDataItem[];
|
6
|
+
accountsCount: (args: {
|
7
|
+
label: string;
|
8
|
+
}) => ReactNode;
|
9
|
+
}) => (params: AccountModuleParams) => Array<CryptoOrTokenCurrency & {
|
10
|
+
leftElement?: ReactNode;
|
11
|
+
count: number;
|
12
|
+
}>;
|
13
|
+
//# sourceMappingURL=useLeftAccounts.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftAccounts.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftAccounts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErE,eAAO,MAAM,2BAA2B;6BAIb,mBAAmB,KAAK,eAAe,EAAE;0BAC5C;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS;eAG3C,mBAAmB,KAC1B,MAAM,qBAAqB,GAAG;IAAE,WAAW,CAAC,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAS5E,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseLeftAccountsModule = void 0;
|
4
|
+
const createUseLeftAccountsModule = ({ useAccountData, accountsCount, }) => {
|
5
|
+
return function useLeftAccountsModule(params) {
|
6
|
+
const accountData = useAccountData(params);
|
7
|
+
return accountData.map(({ asset, label, count }) => ({
|
8
|
+
...asset,
|
9
|
+
leftElement: count > 0 ? accountsCount({ label }) : undefined,
|
10
|
+
count,
|
11
|
+
}));
|
12
|
+
};
|
13
|
+
};
|
14
|
+
exports.createUseLeftAccountsModule = createUseLeftAccountsModule;
|
15
|
+
//# sourceMappingURL=useLeftAccounts.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftAccounts.js","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftAccounts.tsx"],"names":[],"mappings":";;;AAIO,MAAM,2BAA2B,GAAG,CAAC,EAC1C,cAAc,EACd,aAAa,GAId,EAAE,EAAE;IACH,OAAO,SAAS,qBAAqB,CACnC,MAA2B;QAE3B,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAE3C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YACnD,GAAG,KAAK;YACR,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;YAC7D,KAAK;SACN,CAAC,CAAC,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAlBW,QAAA,2BAA2B,+BAkBtC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { AccountDataItem, AccountModuleParams, CreateAccountsCountAndApy, NetworkWithCount } from "../utils/type";
|
2
|
+
export declare const createUseLeftAccountsApyModule: ({ useAccountData, accountsCountAndApy, }: {
|
3
|
+
useAccountData: (params: AccountModuleParams) => AccountDataItem[];
|
4
|
+
accountsCountAndApy: CreateAccountsCountAndApy;
|
5
|
+
}) => (params: AccountModuleParams) => NetworkWithCount[];
|
6
|
+
//# sourceMappingURL=useLeftAccountsApy.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftAccountsApy.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftAccountsApy.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,8BAA8B;6BAIhB,mBAAmB,KAAK,eAAe,EAAE;yBAC7C,yBAAyB;eAEG,mBAAmB,KAAG,gBAAgB,EAaxF,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseLeftAccountsApyModule = void 0;
|
4
|
+
const createUseLeftAccountsApyModule = ({ useAccountData, accountsCountAndApy, }) => {
|
5
|
+
return function useLeftAccountsApyModule(params) {
|
6
|
+
const accountData = useAccountData(params);
|
7
|
+
return accountData.map(({ asset, label, count }) => {
|
8
|
+
const value = 5.11; // TODO to be retrieved from DADA
|
9
|
+
const type = "APY"; // TODO to be retrieved from DADA
|
10
|
+
return {
|
11
|
+
...asset,
|
12
|
+
leftElement: count > 0 ? accountsCountAndApy({ label, value, type }) : undefined,
|
13
|
+
count,
|
14
|
+
};
|
15
|
+
});
|
16
|
+
};
|
17
|
+
};
|
18
|
+
exports.createUseLeftAccountsApyModule = createUseLeftAccountsApyModule;
|
19
|
+
//# sourceMappingURL=useLeftAccountsApy.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftAccountsApy.js","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftAccountsApy.tsx"],"names":[],"mappings":";;;AAOO,MAAM,8BAA8B,GAAG,CAAC,EAC7C,cAAc,EACd,mBAAmB,GAIpB,EAAE,EAAE;IACH,OAAO,SAAS,wBAAwB,CAAC,MAA2B;QAClE,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;QAE3C,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;YACjD,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,iCAAiC;YACrD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,iCAAiC;YACrD,OAAO;gBACL,GAAG,KAAK;gBACR,WAAW,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;gBAChF,KAAK;aACN,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,8BAA8B,kCAoBzC"}
|
@@ -0,0 +1,54 @@
|
|
1
|
+
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
+
import { ReactNode } from "react";
|
3
|
+
import { ApyType } from "../utils/type";
|
4
|
+
export declare const createUseLeftApyModule: ({ ApyIndicator, }: {
|
5
|
+
ApyIndicator: (args: {
|
6
|
+
value: number;
|
7
|
+
type: ApyType;
|
8
|
+
}) => ReactNode;
|
9
|
+
}) => (assets: CryptoOrTokenCurrency[]) => ({
|
10
|
+
leftElement: ReactNode;
|
11
|
+
name: string;
|
12
|
+
ticker: string;
|
13
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
14
|
+
symbol?: string | undefined;
|
15
|
+
disableCountervalue?: boolean | undefined;
|
16
|
+
delisted?: boolean | undefined;
|
17
|
+
keywords?: string[] | undefined;
|
18
|
+
type: "CryptoCurrency";
|
19
|
+
id: import("@ledgerhq/types-cryptoassets").CryptoCurrencyId | "LBRY" | "groestcoin" | "osmo";
|
20
|
+
forkedFrom?: string | undefined;
|
21
|
+
managerAppName: string;
|
22
|
+
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
23
|
+
scheme: string;
|
24
|
+
color: string;
|
25
|
+
family: string;
|
26
|
+
blockAvgTime?: number | undefined;
|
27
|
+
supportsSegwit?: boolean | undefined;
|
28
|
+
supportsNativeSegwit?: boolean | undefined;
|
29
|
+
isTestnetFor?: string | undefined;
|
30
|
+
bitcoinLikeInfo?: import("@ledgerhq/types-cryptoassets").BitcoinLikeInfo | undefined;
|
31
|
+
ethereumLikeInfo?: import("@ledgerhq/types-cryptoassets").EthereumLikeInfo | undefined;
|
32
|
+
explorerViews: import("@ledgerhq/types-cryptoassets").ExplorerView[];
|
33
|
+
terminated?: {
|
34
|
+
link: string;
|
35
|
+
} | undefined;
|
36
|
+
deviceTicker?: string | undefined;
|
37
|
+
explorerId?: import("@ledgerhq/types-cryptoassets").LedgerExplorerId | undefined;
|
38
|
+
} | {
|
39
|
+
leftElement: ReactNode;
|
40
|
+
name: string;
|
41
|
+
ticker: string;
|
42
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
43
|
+
symbol?: string | undefined;
|
44
|
+
disableCountervalue?: boolean | undefined;
|
45
|
+
delisted?: boolean | undefined;
|
46
|
+
keywords?: string[] | undefined;
|
47
|
+
type: "TokenCurrency";
|
48
|
+
id: string;
|
49
|
+
ledgerSignature?: string | undefined;
|
50
|
+
contractAddress: string;
|
51
|
+
parentCurrency: import("@ledgerhq/types-cryptoassets").CryptoCurrency;
|
52
|
+
tokenType: string;
|
53
|
+
})[];
|
54
|
+
//# sourceMappingURL=useLeftApy.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftApy.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftApy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,eAAO,MAAM,sBAAsB;yBAGZ;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,KAAK,SAAS;eAEnD,qBAAqB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IASxC,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseLeftApyModule = void 0;
|
4
|
+
const createUseLeftApyModule = ({ ApyIndicator, }) => {
|
5
|
+
return (assets) => {
|
6
|
+
const value = 5.11; // TODO: fetch DADA
|
7
|
+
const type = "APY"; // TODO: fetch DADA
|
8
|
+
return assets.map(asset => ({
|
9
|
+
...asset,
|
10
|
+
leftElement: ApyIndicator({ value, type }),
|
11
|
+
}));
|
12
|
+
};
|
13
|
+
};
|
14
|
+
exports.createUseLeftApyModule = createUseLeftApyModule;
|
15
|
+
//# sourceMappingURL=useLeftApy.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useLeftApy.js","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useLeftApy.tsx"],"names":[],"mappings":";;;AAIO,MAAM,sBAAsB,GAAG,CAAC,EACrC,YAAY,GAGb,EAAE,EAAE;IACH,OAAO,CAAC,MAA+B,EAAE,EAAE;QACzC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,mBAAmB;QACvC,MAAM,IAAI,GAAY,KAAK,CAAC,CAAC,mBAAmB;QAEhD,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAC1B,GAAG,KAAK;YACR,WAAW,EAAE,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;SAC3C,CAAC,CAAC,CAAC;IACN,CAAC,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,sBAAsB,0BAcjC"}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import type { ReactNode } from "react";
|
2
|
+
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
|
+
import { UseBalanceDeps } from "../utils/type";
|
4
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
5
|
+
export type AssetDeps = {
|
6
|
+
useBalanceDeps: UseBalanceDeps;
|
7
|
+
balanceItem: (asset: {
|
8
|
+
fiatValue?: string;
|
9
|
+
balance?: string;
|
10
|
+
}) => ReactNode;
|
11
|
+
};
|
12
|
+
export declare function createUseRightBalanceAsset({ useBalanceDeps, balanceItem }: AssetDeps): (assets: CryptoOrTokenCurrency[], currenciesByProvider: CurrenciesByProviderId[]) => ({
|
13
|
+
rightElement: ReactNode;
|
14
|
+
name: string;
|
15
|
+
ticker: string;
|
16
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
17
|
+
symbol?: string | undefined;
|
18
|
+
disableCountervalue?: boolean | undefined;
|
19
|
+
delisted?: boolean | undefined;
|
20
|
+
keywords?: string[] | undefined;
|
21
|
+
type: "CryptoCurrency";
|
22
|
+
id: import("@ledgerhq/types-cryptoassets").CryptoCurrencyId | "LBRY" | "groestcoin" | "osmo";
|
23
|
+
forkedFrom?: string | undefined;
|
24
|
+
managerAppName: string;
|
25
|
+
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
26
|
+
scheme: string;
|
27
|
+
color: string;
|
28
|
+
family: string;
|
29
|
+
blockAvgTime?: number | undefined;
|
30
|
+
supportsSegwit?: boolean | undefined;
|
31
|
+
supportsNativeSegwit?: boolean | undefined;
|
32
|
+
isTestnetFor?: string | undefined;
|
33
|
+
bitcoinLikeInfo?: import("@ledgerhq/types-cryptoassets").BitcoinLikeInfo | undefined;
|
34
|
+
ethereumLikeInfo?: import("@ledgerhq/types-cryptoassets").EthereumLikeInfo | undefined;
|
35
|
+
explorerViews: import("@ledgerhq/types-cryptoassets").ExplorerView[];
|
36
|
+
terminated?: {
|
37
|
+
link: string;
|
38
|
+
} | undefined;
|
39
|
+
deviceTicker?: string | undefined;
|
40
|
+
explorerId?: import("@ledgerhq/types-cryptoassets").LedgerExplorerId | undefined;
|
41
|
+
} | {
|
42
|
+
rightElement: ReactNode;
|
43
|
+
name: string;
|
44
|
+
ticker: string;
|
45
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
46
|
+
symbol?: string | undefined;
|
47
|
+
disableCountervalue?: boolean | undefined;
|
48
|
+
delisted?: boolean | undefined;
|
49
|
+
keywords?: string[] | undefined;
|
50
|
+
type: "TokenCurrency";
|
51
|
+
id: string;
|
52
|
+
ledgerSignature?: string | undefined;
|
53
|
+
contractAddress: string;
|
54
|
+
parentCurrency: import("@ledgerhq/types-cryptoassets").CryptoCurrency;
|
55
|
+
tokenType: string;
|
56
|
+
})[];
|
57
|
+
//# sourceMappingURL=useRightBalanceAsset.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useRightBalanceAsset.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useRightBalanceAsset.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAY,MAAM,8BAA8B,CAAC;AAKpF,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAM5D,MAAM,MAAM,SAAS,GAAG;IACtB,cAAc,EAAE,cAAc,CAAC;IAC/B,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;CAC7E,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,SAAS,YAuBzE,qBAAqB,EAAE,wBACT,sBAAsB,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+FjD"}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseRightBalanceAsset = void 0;
|
4
|
+
const react_1 = require("react");
|
5
|
+
const formatCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/formatCurrencyUnit");
|
6
|
+
const counterValueFormatter_1 = require("../utils/counterValueFormatter");
|
7
|
+
const sortByBalance_1 = require("../utils/sortByBalance");
|
8
|
+
const buildProviderCurrenciesMap_1 = require("../utils/buildProviderCurrenciesMap");
|
9
|
+
const calculateProviderTotal_1 = require("../utils/calculateProviderTotal");
|
10
|
+
const getProviderCurrency_1 = require("../utils/getProviderCurrency");
|
11
|
+
const getBalanceAndFiatValueByAssets_1 = require("../utils/getBalanceAndFiatValueByAssets");
|
12
|
+
const groupAccountsByAsset_1 = require("../utils/groupAccountsByAsset");
|
13
|
+
function createUseRightBalanceAsset({ useBalanceDeps, balanceItem }) {
|
14
|
+
const formatProviderResult = (providerCurrency, totalBalance, totalFiatValue, counterValueCurrency, locale, discreet) => {
|
15
|
+
const unit = providerCurrency.units?.[0];
|
16
|
+
const balance = unit
|
17
|
+
? (0, formatCurrencyUnit_1.formatCurrencyUnit)(unit, totalBalance, { showCode: true, discreet })
|
18
|
+
: `${totalBalance.toFixed()} ${providerCurrency.ticker ?? providerCurrency.symbol}`;
|
19
|
+
const fiatValue = (0, counterValueFormatter_1.counterValueFormatter)({
|
20
|
+
currency: counterValueCurrency.ticker,
|
21
|
+
value: totalFiatValue.toNumber(),
|
22
|
+
locale,
|
23
|
+
allowZeroValue: true,
|
24
|
+
});
|
25
|
+
return { balance, fiatValue };
|
26
|
+
};
|
27
|
+
return function useRightBalanceAsset(assets, currenciesByProvider) {
|
28
|
+
const { flattenedAccounts, discreet, state, counterValueCurrency, locale } = useBalanceDeps();
|
29
|
+
const grouped = (0, react_1.useMemo)(() => (0, groupAccountsByAsset_1.groupAccountsByAsset)(flattenedAccounts, state, counterValueCurrency, discreet), [flattenedAccounts, state, counterValueCurrency, discreet]);
|
30
|
+
const providerMap = (0, react_1.useMemo)(() => (0, buildProviderCurrenciesMap_1.buildProviderCurrenciesMap)(currenciesByProvider), [currenciesByProvider]);
|
31
|
+
return (0, react_1.useMemo)(() => {
|
32
|
+
if (!providerMap) {
|
33
|
+
const allBalance = (0, getBalanceAndFiatValueByAssets_1.getBalanceAndFiatValueByAssets)(flattenedAccounts, assets, state, counterValueCurrency, discreet, locale);
|
34
|
+
const balanceMap = new Map(allBalance.map(b => [b.id, b]));
|
35
|
+
const assetsWithBalanceData = assets.map(asset => {
|
36
|
+
const balanceData = balanceMap.get(asset.id) || {};
|
37
|
+
return {
|
38
|
+
asset,
|
39
|
+
balanceData,
|
40
|
+
};
|
41
|
+
});
|
42
|
+
assetsWithBalanceData.sort((a, b) => (0, sortByBalance_1.compareByBalanceThenFiat)(a.balanceData, b.balanceData, discreet));
|
43
|
+
return assetsWithBalanceData.map(({ asset, balanceData }) => ({
|
44
|
+
...asset,
|
45
|
+
rightElement: balanceItem(balanceData),
|
46
|
+
}));
|
47
|
+
}
|
48
|
+
const assetsSet = new Set(assets.map(a => a.id));
|
49
|
+
const providerResultsMap = new Map();
|
50
|
+
for (const [, { currencies, mainCurrency }] of providerMap) {
|
51
|
+
if (!assetsSet.has(mainCurrency.id))
|
52
|
+
continue;
|
53
|
+
const providerCurrency = (0, getProviderCurrency_1.getProviderCurrency)(mainCurrency, currencies);
|
54
|
+
if (!providerCurrency)
|
55
|
+
continue;
|
56
|
+
const { totalBalance, totalFiatValue, hasAccounts } = (0, calculateProviderTotal_1.calculateProviderTotals)(currencies, grouped);
|
57
|
+
if (!hasAccounts)
|
58
|
+
continue;
|
59
|
+
const { balance, fiatValue } = formatProviderResult(providerCurrency, totalBalance, totalFiatValue, counterValueCurrency, locale, discreet);
|
60
|
+
providerResultsMap.set(mainCurrency.id, { balance, fiatValue });
|
61
|
+
}
|
62
|
+
const assetsWithBalanceData = assets.map(asset => {
|
63
|
+
const balanceData = providerResultsMap.get(asset.id) || {};
|
64
|
+
return {
|
65
|
+
asset,
|
66
|
+
balanceData,
|
67
|
+
};
|
68
|
+
});
|
69
|
+
assetsWithBalanceData.sort((a, b) => (0, sortByBalance_1.compareByBalanceThenFiat)(a.balanceData, b.balanceData, discreet));
|
70
|
+
return assetsWithBalanceData.map(({ asset, balanceData }) => ({
|
71
|
+
...asset,
|
72
|
+
rightElement: balanceItem(balanceData),
|
73
|
+
}));
|
74
|
+
}, [
|
75
|
+
assets,
|
76
|
+
providerMap,
|
77
|
+
flattenedAccounts,
|
78
|
+
state,
|
79
|
+
counterValueCurrency,
|
80
|
+
discreet,
|
81
|
+
locale,
|
82
|
+
grouped,
|
83
|
+
]);
|
84
|
+
};
|
85
|
+
}
|
86
|
+
exports.createUseRightBalanceAsset = createUseRightBalanceAsset;
|
87
|
+
//# sourceMappingURL=useRightBalanceAsset.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useRightBalanceAsset.js","sourceRoot":"","sources":["../../../src/modularDrawer/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CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC5D,GAAG,KAAK;gBACR,YAAY,EAAE,WAAW,CAAC,WAAW,CAAC;aACvC,CAAC,CAAC,CAAC;QACN,CAAC,EAAE;YACD,MAAM;YACN,WAAW;YACX,iBAAiB;YACjB,KAAK;YACL,oBAAoB;YACpB,QAAQ;YACR,MAAM;YACN,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAvHD,gEAuHC"}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import { type ReactNode } from "react";
|
2
|
+
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
3
|
+
import { UseBalanceDeps } from "../utils/type";
|
4
|
+
import { CurrenciesByProviderId } from "../../deposit/type";
|
5
|
+
export type NetworkDeps = {
|
6
|
+
balanceItem: (asset: {
|
7
|
+
fiatValue?: string;
|
8
|
+
balance?: string;
|
9
|
+
}) => ReactNode;
|
10
|
+
useBalanceDeps: UseBalanceDeps;
|
11
|
+
};
|
12
|
+
type Params = {
|
13
|
+
assets: CryptoOrTokenCurrency[];
|
14
|
+
selectedAssetId: string;
|
15
|
+
currenciesByProvider: CurrenciesByProviderId[];
|
16
|
+
};
|
17
|
+
export declare function createUseRightBalanceNetwork({ useBalanceDeps, balanceItem }: NetworkDeps): ({ assets: networks, selectedAssetId, currenciesByProvider, }: Params) => ({
|
18
|
+
rightElement: ReactNode;
|
19
|
+
name: string;
|
20
|
+
ticker: string;
|
21
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
22
|
+
symbol?: string | undefined;
|
23
|
+
disableCountervalue?: boolean | undefined;
|
24
|
+
delisted?: boolean | undefined;
|
25
|
+
keywords?: string[] | undefined;
|
26
|
+
type: "CryptoCurrency";
|
27
|
+
id: import("@ledgerhq/types-cryptoassets").CryptoCurrencyId | "LBRY" | "groestcoin" | "osmo";
|
28
|
+
forkedFrom?: string | undefined;
|
29
|
+
managerAppName: string;
|
30
|
+
coinType: import("@ledgerhq/types-cryptoassets").CoinType;
|
31
|
+
scheme: string;
|
32
|
+
color: string;
|
33
|
+
family: string;
|
34
|
+
blockAvgTime?: number | undefined;
|
35
|
+
supportsSegwit?: boolean | undefined;
|
36
|
+
supportsNativeSegwit?: boolean | undefined;
|
37
|
+
isTestnetFor?: string | undefined;
|
38
|
+
bitcoinLikeInfo?: import("@ledgerhq/types-cryptoassets").BitcoinLikeInfo | undefined;
|
39
|
+
ethereumLikeInfo?: import("@ledgerhq/types-cryptoassets").EthereumLikeInfo | undefined;
|
40
|
+
explorerViews: import("@ledgerhq/types-cryptoassets").ExplorerView[];
|
41
|
+
terminated?: {
|
42
|
+
link: string;
|
43
|
+
} | undefined;
|
44
|
+
deviceTicker?: string | undefined;
|
45
|
+
explorerId?: import("@ledgerhq/types-cryptoassets").LedgerExplorerId | undefined;
|
46
|
+
} | {
|
47
|
+
rightElement: ReactNode;
|
48
|
+
name: string;
|
49
|
+
ticker: string;
|
50
|
+
units: import("@ledgerhq/types-cryptoassets").Unit[];
|
51
|
+
symbol?: string | undefined;
|
52
|
+
disableCountervalue?: boolean | undefined;
|
53
|
+
delisted?: boolean | undefined;
|
54
|
+
keywords?: string[] | undefined;
|
55
|
+
type: "TokenCurrency";
|
56
|
+
id: string;
|
57
|
+
ledgerSignature?: string | undefined;
|
58
|
+
contractAddress: string;
|
59
|
+
parentCurrency: import("@ledgerhq/types-cryptoassets").CryptoCurrency;
|
60
|
+
tokenType: string;
|
61
|
+
})[];
|
62
|
+
export {};
|
63
|
+
//# sourceMappingURL=useRightBalanceNetwork.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useRightBalanceNetwork.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useRightBalanceNetwork.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAE1E,OAAO,EAAa,cAAc,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC;IAC5E,cAAc,EAAE,cAAc,CAAC;CAChC,CAAC;AAEF,KAAK,MAAM,GAAG;IACZ,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,sBAAsB,EAAE,CAAC;CAChD,CAAC;AAEF,wBAAgB,4BAA4B,CAAC,EAAE,cAAc,EAAE,WAAW,EAAE,EAAE,WAAW,kEAKpF,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4FV"}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createUseRightBalanceNetwork = void 0;
|
4
|
+
const react_1 = require("react");
|
5
|
+
const sortByBalance_1 = require("../utils/sortByBalance");
|
6
|
+
const getBalanceAndFiatValueByAssets_1 = require("../utils/getBalanceAndFiatValueByAssets");
|
7
|
+
function createUseRightBalanceNetwork({ useBalanceDeps, balanceItem }) {
|
8
|
+
return function useRightBalanceNetwork({ assets: networks, selectedAssetId, currenciesByProvider, }) {
|
9
|
+
const { flattenedAccounts, discreet, state, counterValueCurrency, locale } = useBalanceDeps();
|
10
|
+
return (0, react_1.useMemo)(() => {
|
11
|
+
if (currenciesByProvider && currenciesByProvider.length > 0) {
|
12
|
+
const providerOfSelectedAsset = currenciesByProvider.find(provider => provider.currenciesByNetwork.some(currency => currency.id === selectedAssetId));
|
13
|
+
if (providerOfSelectedAsset) {
|
14
|
+
const pairs = networks.map(network => ({
|
15
|
+
network,
|
16
|
+
asset: providerOfSelectedAsset.currenciesByNetwork.find(currency => currency.type === "TokenCurrency"
|
17
|
+
? currency.parentCurrency.id === network.id
|
18
|
+
: currency.id === network.id),
|
19
|
+
}));
|
20
|
+
const validAssets = pairs.filter(p => p.asset).map(p => p.asset);
|
21
|
+
const allBalanceData = validAssets.length > 0
|
22
|
+
? (0, getBalanceAndFiatValueByAssets_1.getBalanceAndFiatValueByAssets)(flattenedAccounts, validAssets, state, counterValueCurrency, discreet, locale)
|
23
|
+
: [];
|
24
|
+
const balanceMap = new Map(allBalanceData.map(b => [b.id, b]));
|
25
|
+
const networkWithBalanceData = pairs.map(({ network, asset }) => {
|
26
|
+
const balanceData = asset ? balanceMap.get(asset.id) || {} : {};
|
27
|
+
return {
|
28
|
+
network,
|
29
|
+
balanceData,
|
30
|
+
};
|
31
|
+
});
|
32
|
+
networkWithBalanceData.sort((a, b) => (0, sortByBalance_1.compareByBalanceThenFiat)(a.balanceData, b.balanceData, discreet));
|
33
|
+
return networkWithBalanceData.map(({ network, balanceData }) => ({
|
34
|
+
...network,
|
35
|
+
rightElement: balanceItem(balanceData),
|
36
|
+
}));
|
37
|
+
}
|
38
|
+
}
|
39
|
+
const networkBalanceData = (0, getBalanceAndFiatValueByAssets_1.getBalanceAndFiatValueByAssets)(flattenedAccounts, networks, state, counterValueCurrency, discreet, locale);
|
40
|
+
const balanceMap = new Map(networkBalanceData.map(b => [b.id, b]));
|
41
|
+
const networksWithBalance = networks.map(network => {
|
42
|
+
const balanceData = balanceMap.get(network.id) || {};
|
43
|
+
return {
|
44
|
+
network,
|
45
|
+
balanceData,
|
46
|
+
};
|
47
|
+
});
|
48
|
+
networksWithBalance.sort((a, b) => (0, sortByBalance_1.compareByBalanceThenFiat)(a.balanceData, b.balanceData, discreet));
|
49
|
+
return networksWithBalance.map(({ network, balanceData }) => ({
|
50
|
+
...network,
|
51
|
+
rightElement: balanceItem(balanceData),
|
52
|
+
}));
|
53
|
+
}, [
|
54
|
+
networks,
|
55
|
+
selectedAssetId,
|
56
|
+
currenciesByProvider,
|
57
|
+
flattenedAccounts,
|
58
|
+
state,
|
59
|
+
counterValueCurrency,
|
60
|
+
discreet,
|
61
|
+
locale,
|
62
|
+
]);
|
63
|
+
};
|
64
|
+
}
|
65
|
+
exports.createUseRightBalanceNetwork = createUseRightBalanceNetwork;
|
66
|
+
//# sourceMappingURL=useRightBalanceNetwork.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"useRightBalanceNetwork.js","sourceRoot":"","sources":["../../../src/modularDrawer/hooks/useRightBalanceNetwork.tsx"],"names":[],"mappings":";;;AAAA,iCAAgD;AAEhD,0DAAkE;AAGlE,4FAAyF;AAazF,SAAgB,4BAA4B,CAAC,EAAE,cAAc,EAAE,WAAW,EAAe;IACvF,OAAO,SAAS,sBAAsB,CAAC,EACrC,MAAM,EAAE,QAAQ,EAChB,eAAe,EACf,oBAAoB,GACb;QACP,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;QAE9F,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;YAClB,IAAI,oBAAoB,IAAI,oBAAoB,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC3D,MAAM,uBAAuB,GAAG,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CACnE,QAAQ,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,eAAe,CAAC,CAC/E,CAAC;gBAEF,IAAI,uBAAuB,EAAE;oBAC3B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;wBACrC,OAAO;wBACP,KAAK,EAAE,uBAAuB,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CACjE,QAAQ,C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+1 @@
|
|
1
|
+
{"version":3,"file":"createAssetConfiguration.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/modules/createAssetConfiguration.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,4BAA4B,EAA0B,MAAM,eAAe,CAAC;AAiChG,QAAA,MAAM,4BAA4B,EAAE,4BAwBjC,CAAC;AAEJ,eAAe,4BAA4B,CAAC"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const composeHooks_1 = require("../../utils/composeHooks");
|
4
|
+
const useLeftApy_1 = require("../hooks/useLeftApy");
|
5
|
+
const useRightBalanceAsset_1 = require("../hooks/useRightBalanceAsset");
|
6
|
+
const getRightElement = (AssetConfigurationDeps) => (rightElement) => {
|
7
|
+
switch (rightElement) {
|
8
|
+
case "balance":
|
9
|
+
return (0, useRightBalanceAsset_1.createUseRightBalanceAsset)({
|
10
|
+
useBalanceDeps: AssetConfigurationDeps.useBalanceDeps,
|
11
|
+
balanceItem: AssetConfigurationDeps.balanceItem,
|
12
|
+
});
|
13
|
+
case "marketTrend":
|
14
|
+
case "undefined":
|
15
|
+
default:
|
16
|
+
return undefined;
|
17
|
+
}
|
18
|
+
};
|
19
|
+
const getLeftElement = (AssetConfigurationDeps) => (leftElement) => {
|
20
|
+
switch (leftElement) {
|
21
|
+
case "apy":
|
22
|
+
return (0, useLeftApy_1.createUseLeftApyModule)({ ApyIndicator: AssetConfigurationDeps.ApyIndicator });
|
23
|
+
case "priceVariation":
|
24
|
+
case "undefined":
|
25
|
+
default:
|
26
|
+
return undefined;
|
27
|
+
}
|
28
|
+
};
|
29
|
+
const createAssetConfigurationHook = deps => ({ assetsConfiguration, currenciesByProvider }) => {
|
30
|
+
const { rightElement = "undefined", leftElement = "undefined" } = assetsConfiguration ?? {};
|
31
|
+
const rightHook = getRightElement(deps)(rightElement);
|
32
|
+
const leftHook = getLeftElement(deps)(leftElement);
|
33
|
+
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
34
|
+
const hooks = [rightHook, leftHook].filter(Boolean);
|
35
|
+
return (assets) => {
|
36
|
+
const composedHook = (0, composeHooks_1.composeHooks)(...hooks.map(hook => (assets) => hook(assets, currenciesByProvider)));
|
37
|
+
return composedHook(assets);
|
38
|
+
};
|
39
|
+
};
|
40
|
+
exports.default = createAssetConfigurationHook;
|
41
|
+
//# sourceMappingURL=createAssetConfiguration.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createAssetConfiguration.js","sourceRoot":"","sources":["../../../src/modularDrawer/modules/createAssetConfiguration.ts"],"names":[],"mappings":";;AAGA,2DAAwD;AACxD,oDAA6D;AAC7D,wEAA2E;AAE3E,MAAM,eAAe,GACnB,CAAC,sBAA8C,EAAE,EAAE,CAAC,CAAC,YAAoB,EAAE,EAAE;IAC3E,QAAQ,YAAY,EAAE;QACpB,KAAK,SAAS;YACZ,OAAO,IAAA,iDAA0B,EAAC;gBAChC,cAAc,EAAE,sBAAsB,CAAC,cAAc;gBACrD,WAAW,EAAE,sBAAsB,CAAC,WAAW;aAChD,CAAC,CAAC;QACL,KAAK,aAAa,CAAC;QACnB,KAAK,WAAW,CAAC;QACjB;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC,CAAC;AAEJ,MAAM,cAAc,GAClB,CAAC,sBAA8C,EAAE,EAAE,CAAC,CAAC,WAAmB,EAAE,EAAE;IAC1E,QAAQ,WAAW,EAAE;QACnB,KAAK,KAAK;YACR,OAAO,IAAA,mCAAsB,EAAC,EAAE,YAAY,EAAE,sBAAsB,CAAC,YAAY,EAAE,CAAC,CAAC;QACvF,KAAK,gBAAgB,CAAC;QACtB,KAAK,WAAW,CAAC;QACjB;YACE,OAAO,SAAS,CAAC;KACpB;AACH,CAAC,CAAC;AAEJ,MAAM,4BAA4B,GAChC,IAAI,CAAC,EAAE,CACP,CAAC,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,EAAE,EAAE;IAChD,MAAM,EAAE,YAAY,GAAG,WAAW,EAAE,WAAW,GAAG,WAAW,EAAE,GAAG,mBAAmB,IAAI,EAAE,CAAC;IAE5F,MAAM,SAAS,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC,CAAC;IAEnD,yEAAyE;IACzE,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,OAAO,CAKjD,CAAC;IAEF,OAAO,CAAC,MAA+B,EAAE,EAAE;QACzC,MAAM,YAAY,GAAG,IAAA,2BAAY,EAC/B,GAAG,KAAK,CAAC,GAAG,CACV,IAAI,CAAC,EAAE,CAAC,CAAC,MAA+B,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAChF,CACF,CAAC;QACF,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC,CAAC;AACJ,CAAC,CAAC;AAEJ,kBAAe,4BAA4B,CAAC"}
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import type { CryptoOrTokenCurrency } from "@ledgerhq/types-cryptoassets";
|
2
|
+
import { CreateNetworkConfigurationHookProps, NetworkConfigurationDeps, LeftElementKind, Network, NetworkHook, RightElementKind } from "../utils/type";
|
3
|
+
export declare const getLeftElement: (NetworkConfigurationDeps: NetworkConfigurationDeps) => (leftElement: LeftElementKind) => NetworkHook | undefined;
|
4
|
+
export declare const getRightElement: (NetworkConfigurationDeps: NetworkConfigurationDeps) => (rightElement: RightElementKind) => NetworkHook | undefined;
|
5
|
+
export declare const createNetworkConfigurationHook: (NetworkConfigurationDeps: NetworkConfigurationDeps) => ({ networksConfig, selectedAssetId, currenciesByProvider, accounts$, }: CreateNetworkConfigurationHookProps) => (assets: CryptoOrTokenCurrency[]) => Array<CryptoOrTokenCurrency & Network>;
|
6
|
+
//# sourceMappingURL=createNetworkConfiguration.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"createNetworkConfiguration.d.ts","sourceRoot":"","sources":["../../../src/modularDrawer/modules/createNetworkConfiguration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAI1E,OAAO,EACL,mCAAmC,EACnC,wBAAwB,EACxB,eAAe,EACf,OAAO,EACP,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AAGvB,eAAO,MAAM,cAAc,wEAEX,eAAe,KAAG,WAAW,GAAG,SAgB7C,CAAC;AAEJ,eAAO,MAAM,eAAe,yEAEX,gBAAgB,KAAG,WAAW,GAAG,SAW/C,CAAC;AAEJ,eAAO,MAAM,8BAA8B,kIAOtC,mCAAmC,cAQpB,qBAAqB,EAAE,KAAG,MAAM,qBAAqB,GAAG,OAAO,CAchF,CAAC"}
|