@mezo-org/passport 0.4.0-dev.59 → 0.4.0-dev.60
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/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +3 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.js +22 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +3 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js +22 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -0
- package/dist/src/hooks/useAutoConnect.d.ts +10 -0
- package/dist/src/hooks/useAutoConnect.d.ts.map +1 -0
- package/dist/src/hooks/useAutoConnect.js +41 -0
- package/dist/src/hooks/useAutoConnect.js.map +1 -0
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -1
- package/dist/src/hooks/useDropdownData.js +2 -1
- package/dist/src/hooks/useDropdownData.js.map +1 -1
- package/dist/src/stores/connectorStore.d.ts +12 -0
- package/dist/src/stores/connectorStore.d.ts.map +1 -0
- package/dist/src/stores/connectorStore.js +13 -0
- package/dist/src/stores/connectorStore.js.map +1 -0
- package/dist/src/stores/dropdownStore copy.d.ts +12 -0
- package/dist/src/stores/dropdownStore copy.d.ts.map +1 -0
- package/dist/src/stores/dropdownStore copy.js +13 -0
- package/dist/src/stores/dropdownStore copy.js.map +1 -0
- package/dist/src/utils/assets.d.ts +145 -0
- package/dist/src/utils/assets.d.ts.map +1 -0
- package/dist/src/utils/assets.js +100 -0
- package/dist/src/utils/assets.js.map +1 -0
- package/dist/src/utils/assets.test.d.ts +2 -0
- package/dist/src/utils/assets.test.d.ts.map +1 -0
- package/dist/src/utils/assets.test.js +46 -0
- package/dist/src/utils/assets.test.js.map +1 -0
- package/package.json +2 -2
- package/src/hooks/useDropdownData.ts +4 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountBtcListing.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountBtcListing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,CAAC,OAAO,UAAU,iBAAiB,gCAkCxC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BitcoinCircle } from "@mezo-org/mezo-clay";
|
|
3
|
+
import ListingItem from "../ListingItem";
|
|
4
|
+
import { getAsset } from "../../../utils/assets";
|
|
5
|
+
import { useBorrowData } from "../../../hooks/useBorrowData";
|
|
6
|
+
import { formatUsd } from "../../../utils/currency";
|
|
7
|
+
import { useTokensBalances } from "../../../hooks/useTokensBalances";
|
|
8
|
+
export default function AccountBTCListing() {
|
|
9
|
+
const { data: borrowData, isError: isBorrowDataError, isPending: isBorrowDataPending, } = useBorrowData();
|
|
10
|
+
const { data: tokensBalancesData, isError: isTokensBalancesError, isPending: isTokensBalancesPending, } = useTokensBalances();
|
|
11
|
+
if (isTokensBalancesError || isBorrowDataError) {
|
|
12
|
+
return "Error"; // TODO: Render alternative UI
|
|
13
|
+
}
|
|
14
|
+
if (isTokensBalancesPending || isBorrowDataPending) {
|
|
15
|
+
return React.createElement(ListingItem, { isLoading: true });
|
|
16
|
+
}
|
|
17
|
+
const btcBalance = tokensBalancesData.BTC;
|
|
18
|
+
const formattedBtcBalance = formatUsd(btcBalance.usd.formatted);
|
|
19
|
+
const formattedLockedCollateral = formatUsd(borrowData.collateral.formatted);
|
|
20
|
+
return (React.createElement(ListingItem, { icon: BitcoinCircle, label: getAsset("BTC").name, value: formattedBtcBalance, subLabel: "Locked collateral", subValue: formattedLockedCollateral }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=AccountBtcListing.js.map
|
|
@@ -0,0 +1 @@
|
|
|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CAAC,CAAC,IAAI,EAC3B,KAAK,EAAE,mBAAmB,EAC1B,QAAQ,EAAC,mBAAmB,EAC5B,QAAQ,EAAE,yBAAyB,GACnC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountMusdListing.d.ts","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountMusdListing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,CAAC,OAAO,UAAU,kBAAkB,gCAkCzC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { MUsdCircle02 } from "@mezo-org/mezo-clay";
|
|
3
|
+
import ListingItem from "../ListingItem";
|
|
4
|
+
import { getAsset } from "../../../utils/assets";
|
|
5
|
+
import { useBorrowData } from "../../../hooks/useBorrowData";
|
|
6
|
+
import { formatUsd } from "../../../utils/currency";
|
|
7
|
+
import { useTokensBalances } from "../../../hooks/useTokensBalances";
|
|
8
|
+
export default function AccountMusdListing() {
|
|
9
|
+
const { data: borrowData, isError: isBorrowDataError, isPending: isBorrowDataPending, } = useBorrowData();
|
|
10
|
+
const { data: tokensBalancesData, isError: isTokensBalancesError, isPending: isTokensBalancesPending, } = useTokensBalances();
|
|
11
|
+
if (isBorrowDataError || isTokensBalancesError) {
|
|
12
|
+
return "Error"; // TODO: Render alternative UI
|
|
13
|
+
}
|
|
14
|
+
if (isBorrowDataPending || isTokensBalancesPending) {
|
|
15
|
+
return React.createElement(ListingItem, { isLoading: true });
|
|
16
|
+
}
|
|
17
|
+
const musdBalance = tokensBalancesData.MUSD;
|
|
18
|
+
const formattedMusdBalance = formatUsd(musdBalance.usd.formatted);
|
|
19
|
+
const formattedLockedCollateral = formatUsd(borrowData.troveDebt.formatted);
|
|
20
|
+
return (React.createElement(ListingItem, { icon: MUsdCircle02, label: getAsset("MUSD").name, value: formattedMusdBalance, subLabel: "Borrowed", subValue: formattedLockedCollateral }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=AccountMusdListing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AccountMusdListing.js","sourceRoot":"","sources":["../../../../../src/components/Dropdown/Root/AccountMusdListing.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,WAAW,MAAM,gBAAgB,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEpE,MAAM,CAAC,OAAO,UAAU,kBAAkB;IACxC,MAAM,EACJ,IAAI,EAAE,UAAU,EAChB,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,mBAAmB,GAC/B,GAAG,aAAa,EAAE,CAAA;IAEnB,MAAM,EACJ,IAAI,EAAE,kBAAkB,EACxB,OAAO,EAAE,qBAAqB,EAC9B,SAAS,EAAE,uBAAuB,GACnC,GAAG,iBAAiB,EAAE,CAAA;IAEvB,IAAI,iBAAiB,IAAI,qBAAqB,EAAE,CAAC;QAC/C,OAAO,OAAO,CAAA,CAAC,8BAA8B;IAC/C,CAAC;IAED,IAAI,mBAAmB,IAAI,uBAAuB,EAAE,CAAC;QACnD,OAAO,oBAAC,WAAW,IAAC,SAAS,SAAG,CAAA;IAClC,CAAC;IAED,MAAM,WAAW,GAAG,kBAAkB,CAAC,IAAI,CAAA;IAC3C,MAAM,oBAAoB,GAAG,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACjE,MAAM,yBAAyB,GAAG,SAAS,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IAE3E,OAAO,CACL,oBAAC,WAAW,IACV,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,EAC5B,KAAK,EAAE,oBAAoB,EAC3B,QAAQ,EAAC,UAAU,EACnB,QAAQ,EAAE,yBAAyB,GACnC,CACH,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Automatically connects to the most recently used connector when the app loads.
|
|
3
|
+
* This hook checks the storage for a recent connector ID and attempts to reconnect using that connector on mount.
|
|
4
|
+
* It also updates the storage with the connector ID whenever a new connection is made.
|
|
5
|
+
* @dev Wagmi does not support auto-connect out of the box. They recommend using a custom solution.
|
|
6
|
+
* @see https://wagmi.sh/core/guides/migrate-from-v1-to-v2#updated-createconfig-parameters
|
|
7
|
+
*/
|
|
8
|
+
declare function useAutoConnect(): void;
|
|
9
|
+
export default useAutoConnect;
|
|
10
|
+
//# sourceMappingURL=useAutoConnect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoConnect.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAutoConnect.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,iBAAS,cAAc,SAyCtB;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useAccountEffect, useConfig, useReconnect, useWriteContract, } from "wagmi";
|
|
3
|
+
/**
|
|
4
|
+
* Automatically connects to the most recently used connector when the app loads.
|
|
5
|
+
* This hook checks the storage for a recent connector ID and attempts to reconnect using that connector on mount.
|
|
6
|
+
* It also updates the storage with the connector ID whenever a new connection is made.
|
|
7
|
+
* @dev Wagmi does not support auto-connect out of the box. They recommend using a custom solution.
|
|
8
|
+
* @see https://wagmi.sh/core/guides/migrate-from-v1-to-v2#updated-createconfig-parameters
|
|
9
|
+
*/
|
|
10
|
+
function useAutoConnect() {
|
|
11
|
+
const config = useConfig();
|
|
12
|
+
const { reconnectAsync, connectors } = useReconnect({ config });
|
|
13
|
+
useAccountEffect({
|
|
14
|
+
onConnect: ({ connector }) => {
|
|
15
|
+
config.storage?.setItem("recentConnectorId", connector.id);
|
|
16
|
+
console.log("Stored: ", config.storage?.getItem("recentConnectorId"));
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
useWriteContract;
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const handleAutoConnect = async () => {
|
|
22
|
+
// This is a workaround for the wagmi issue with reconnecting of injected connectors
|
|
23
|
+
localStorage.setItem("wagmi.injected.shimDisconnect", "true");
|
|
24
|
+
const recentConnectorId = await config.storage?.getItem("recentConnectorId");
|
|
25
|
+
const recentConnector = connectors.find((connector) => connector.id === recentConnectorId);
|
|
26
|
+
if (!recentConnector)
|
|
27
|
+
return;
|
|
28
|
+
console.log("Found connector. Autoconnecting to: ", recentConnector.id);
|
|
29
|
+
console.log(recentConnector);
|
|
30
|
+
await reconnectAsync({
|
|
31
|
+
connectors: [recentConnector],
|
|
32
|
+
}, {
|
|
33
|
+
onError: (e) => console.log("Failed to reconnect", e),
|
|
34
|
+
onSuccess: (d) => console.log("Reconnected successfully", d),
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
handleAutoConnect();
|
|
38
|
+
}, [config, reconnectAsync, connectors]);
|
|
39
|
+
}
|
|
40
|
+
export default useAutoConnect;
|
|
41
|
+
//# sourceMappingURL=useAutoConnect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAutoConnect.js","sourceRoot":"","sources":["../../../src/hooks/useAutoConnect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,EACL,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,gBAAgB,GACjB,MAAM,OAAO,CAAA;AAEd;;;;;;GAMG;AACH,SAAS,cAAc;IACrB,MAAM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AAC;aAC7D,CACF,CAAA;QACH,CAAC,CAAA;QACD,iBAAiB,EAAE,CAAA;IACrB,CAAC,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,CAAA;AAC1C,CAAC;AAED,eAAe,cAAc,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownData.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDropdownData.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAIf,MAAM,uBAAuB,CAAA;AAW9B,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,cAAc,IAAI;IACpD,IAAI,EAAE,CAAC,CAAA;IACP,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AASD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,0BAAkC,EAClC,4BAAoC,GACrC;;;CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useDropdownData.d.ts","sourceRoot":"","sources":["../../../src/hooks/useDropdownData.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EAIf,MAAM,uBAAuB,CAAA;AAW9B,MAAM,MAAM,mBAAmB,CAAC,CAAC,GAAG,cAAc,IAAI;IACpD,IAAI,EAAE,CAAC,CAAA;IACP,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AASD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,0BAAkC,EAClC,4BAAoC,GACrC;;;CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4GA"}
|
|
@@ -75,10 +75,11 @@ export default function useDropdownData({ accountDataRefetchInterval = 90000, na
|
|
|
75
75
|
},
|
|
76
76
|
};
|
|
77
77
|
const otherAssetsUsdTotal = otherAssetsData.reduce((sum, { usdBalance }) => sum + usdBalance, 0);
|
|
78
|
-
const usdTotalBalance = detailedAssets.reduce((sum, { usdBalance }) => sum + usdBalance, 0);
|
|
79
78
|
const matsBalance = passportAccount?.mats.totalMats || 0;
|
|
80
79
|
const usdCollateral = convertToUsd(debt?.collateral ?? 0n, getCryptoAsset("MUSD").decimals, assetsConversionRates.btc.price, assetsConversionRates.btc.decimals);
|
|
81
80
|
const usdTroveDebt = fromFixedPoint(debt?.troveDebt ?? 0n, 18);
|
|
81
|
+
const usdTotalBalance = detailedAssets.reduce((sum, { usdBalance }) => sum + usdBalance, 0) +
|
|
82
|
+
usdCollateral;
|
|
82
83
|
return {
|
|
83
84
|
mezoId,
|
|
84
85
|
matsBalance,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDropdownData.js","sourceRoot":"","sources":["../../../src/hooks/useDropdownData.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,GAAG,CAAA;AACxC,OAAO,EAEL,cAAc,EACd,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAA;AACrE,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,EAAE,kCAAkC,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAOhD,MAAM,kBAAkB,GAAG;IACzB,UAAU,EAAE,EAAE;IACd,gBAAgB,EAAE,QAAQ;IAC1B,UAAU,EAAE,CAAC;IACb,mBAAmB,EA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,CAChC,IAAI,EAAE,UAAU,IAAI,EAAE,EACtB,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,EAC/B,qBAAqB,CAAC,GAAG,CAAC,KAAK,EAC/B,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CACnC,CAAA;IAED,MAAM,YAAY,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,IAAI,EAAE,EAAE,EAAE,CAAC,CAAA;IAE9D,MAAM,eAAe,GACnB,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,UAAU,EAAE,CAAC,CAAC;QACnE,aAAa,CAAA;IAEf,OAAO;QACL,MAAM;QACN,WAAW;QACX,cAAc;QACd,aAAa;QACb,UAAU;QACV,eAAe;QACf,YAAY;QACZ,aAAa;QACb,MAAM;QACN,gBAAgB;QAChB,mBAAmB;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum DropdownView {
|
|
2
|
+
ROOT = "ROOT",
|
|
3
|
+
RECEIVE = "RECEIVE"
|
|
4
|
+
}
|
|
5
|
+
interface DropdownStore {
|
|
6
|
+
view: DropdownView;
|
|
7
|
+
setView: (view: DropdownView) => void;
|
|
8
|
+
isNestedView: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const useDropdownStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DropdownStore>>;
|
|
11
|
+
export default useDropdownStore;
|
|
12
|
+
//# sourceMappingURL=connectorStore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectorStore.d.ts","sourceRoot":"","sources":["../../../src/stores/connectorStore.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED,QAAA,MAAM,gBAAgB,4EAInB,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
export var DropdownView;
|
|
3
|
+
(function (DropdownView) {
|
|
4
|
+
DropdownView["ROOT"] = "ROOT";
|
|
5
|
+
DropdownView["RECEIVE"] = "RECEIVE";
|
|
6
|
+
})(DropdownView || (DropdownView = {}));
|
|
7
|
+
const useDropdownStore = create((set, get) => ({
|
|
8
|
+
view: DropdownView.ROOT,
|
|
9
|
+
setView: (view) => set({ view }),
|
|
10
|
+
isNestedView: () => get().view !== DropdownView.ROOT,
|
|
11
|
+
}));
|
|
12
|
+
export default useDropdownStore;
|
|
13
|
+
//# sourceMappingURL=connectorStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connectorStore.js","sourceRoot":"","sources":["../../../src/stores/connectorStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAQD,MAAM,gBAAgB,GAAG,MAAM,CAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,OAAO,EAAE,CAAC,IAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI;CACrD,CAAC,CAAC,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare enum DropdownView {
|
|
2
|
+
ROOT = "ROOT",
|
|
3
|
+
RECEIVE = "RECEIVE"
|
|
4
|
+
}
|
|
5
|
+
interface DropdownStore {
|
|
6
|
+
view: DropdownView;
|
|
7
|
+
setView: (view: DropdownView) => void;
|
|
8
|
+
isNestedView: () => boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const useDropdownStore: import("zustand").UseBoundStore<import("zustand").StoreApi<DropdownStore>>;
|
|
11
|
+
export default useDropdownStore;
|
|
12
|
+
//# sourceMappingURL=dropdownStore%20copy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdownStore copy.d.ts","sourceRoot":"","sources":["../../../src/stores/dropdownStore copy.ts"],"names":[],"mappings":"AAEA,oBAAY,YAAY;IACtB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAED,UAAU,aAAa;IACrB,IAAI,EAAE,YAAY,CAAA;IAClB,OAAO,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAA;IACrC,YAAY,EAAE,MAAM,OAAO,CAAA;CAC5B;AAED,QAAA,MAAM,gBAAgB,4EAInB,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { create } from "zustand";
|
|
2
|
+
export var DropdownView;
|
|
3
|
+
(function (DropdownView) {
|
|
4
|
+
DropdownView["ROOT"] = "ROOT";
|
|
5
|
+
DropdownView["RECEIVE"] = "RECEIVE";
|
|
6
|
+
})(DropdownView || (DropdownView = {}));
|
|
7
|
+
const useDropdownStore = create((set, get) => ({
|
|
8
|
+
view: DropdownView.ROOT,
|
|
9
|
+
setView: (view) => set({ view }),
|
|
10
|
+
isNestedView: () => get().view !== DropdownView.ROOT,
|
|
11
|
+
}));
|
|
12
|
+
export default useDropdownStore;
|
|
13
|
+
//# sourceMappingURL=dropdownStore%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdownStore copy.js","sourceRoot":"","sources":["../../../src/stores/dropdownStore copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,6BAAa,CAAA;IACb,mCAAmB,CAAA;AACrB,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAQD,MAAM,gBAAgB,GAAG,MAAM,CAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5D,IAAI,EAAE,YAAY,CAAC,IAAI;IACvB,OAAO,EAAE,CAAC,IAAkB,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC;IAC9C,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,KAAK,YAAY,CAAC,IAAI;CACrD,CAAC,CAAC,CAAA;AAEH,eAAe,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
declare const ASSETS: {
|
|
2
|
+
BTC: {
|
|
3
|
+
name: string;
|
|
4
|
+
symbol: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
};
|
|
7
|
+
ETH: {
|
|
8
|
+
name: string;
|
|
9
|
+
symbol: string;
|
|
10
|
+
decimals: number;
|
|
11
|
+
};
|
|
12
|
+
MUSD: {
|
|
13
|
+
name: string;
|
|
14
|
+
symbol: string;
|
|
15
|
+
decimals: number;
|
|
16
|
+
};
|
|
17
|
+
mDAI: {
|
|
18
|
+
name: string;
|
|
19
|
+
symbol: string;
|
|
20
|
+
decimals: number;
|
|
21
|
+
};
|
|
22
|
+
mFBTC: {
|
|
23
|
+
name: string;
|
|
24
|
+
symbol: string;
|
|
25
|
+
decimals: number;
|
|
26
|
+
};
|
|
27
|
+
mcbBTC: {
|
|
28
|
+
name: string;
|
|
29
|
+
symbol: string;
|
|
30
|
+
decimals: number;
|
|
31
|
+
};
|
|
32
|
+
mSolvBTC: {
|
|
33
|
+
name: string;
|
|
34
|
+
symbol: string;
|
|
35
|
+
decimals: number;
|
|
36
|
+
};
|
|
37
|
+
mswBTC: {
|
|
38
|
+
name: string;
|
|
39
|
+
symbol: string;
|
|
40
|
+
decimals: number;
|
|
41
|
+
};
|
|
42
|
+
mT: {
|
|
43
|
+
name: string;
|
|
44
|
+
symbol: string;
|
|
45
|
+
decimals: number;
|
|
46
|
+
};
|
|
47
|
+
mUSDC: {
|
|
48
|
+
name: string;
|
|
49
|
+
symbol: string;
|
|
50
|
+
decimals: number;
|
|
51
|
+
};
|
|
52
|
+
mUSDe: {
|
|
53
|
+
name: string;
|
|
54
|
+
symbol: string;
|
|
55
|
+
decimals: number;
|
|
56
|
+
};
|
|
57
|
+
mUSDT: {
|
|
58
|
+
name: string;
|
|
59
|
+
symbol: string;
|
|
60
|
+
decimals: number;
|
|
61
|
+
};
|
|
62
|
+
mxSolvBTC: {
|
|
63
|
+
name: string;
|
|
64
|
+
symbol: string;
|
|
65
|
+
decimals: number;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Gets details of given crypto asset
|
|
70
|
+
* @param key The key of crypto asset
|
|
71
|
+
* @returns The crypto asset details
|
|
72
|
+
*/
|
|
73
|
+
export declare function getAsset(key: keyof typeof ASSETS): {
|
|
74
|
+
name: string;
|
|
75
|
+
symbol: string;
|
|
76
|
+
decimals: number;
|
|
77
|
+
} | {
|
|
78
|
+
name: string;
|
|
79
|
+
symbol: string;
|
|
80
|
+
decimals: number;
|
|
81
|
+
} | {
|
|
82
|
+
name: string;
|
|
83
|
+
symbol: string;
|
|
84
|
+
decimals: number;
|
|
85
|
+
} | {
|
|
86
|
+
name: string;
|
|
87
|
+
symbol: string;
|
|
88
|
+
decimals: number;
|
|
89
|
+
} | {
|
|
90
|
+
name: string;
|
|
91
|
+
symbol: string;
|
|
92
|
+
decimals: number;
|
|
93
|
+
} | {
|
|
94
|
+
name: string;
|
|
95
|
+
symbol: string;
|
|
96
|
+
decimals: number;
|
|
97
|
+
} | {
|
|
98
|
+
name: string;
|
|
99
|
+
symbol: string;
|
|
100
|
+
decimals: number;
|
|
101
|
+
} | {
|
|
102
|
+
name: string;
|
|
103
|
+
symbol: string;
|
|
104
|
+
decimals: number;
|
|
105
|
+
} | {
|
|
106
|
+
name: string;
|
|
107
|
+
symbol: string;
|
|
108
|
+
decimals: number;
|
|
109
|
+
} | {
|
|
110
|
+
name: string;
|
|
111
|
+
symbol: string;
|
|
112
|
+
decimals: number;
|
|
113
|
+
} | {
|
|
114
|
+
name: string;
|
|
115
|
+
symbol: string;
|
|
116
|
+
decimals: number;
|
|
117
|
+
} | {
|
|
118
|
+
name: string;
|
|
119
|
+
symbol: string;
|
|
120
|
+
decimals: number;
|
|
121
|
+
} | {
|
|
122
|
+
name: string;
|
|
123
|
+
symbol: string;
|
|
124
|
+
decimals: number;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* Checks if given crypto asset is Bitcoin-like
|
|
128
|
+
* @param key The key of crypto asset
|
|
129
|
+
* @returns True if crypto asset is Bitcoin-like
|
|
130
|
+
*/
|
|
131
|
+
export declare function isBitcoinLikeCryptoAsset(key: string): boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Checks if given crypto asset is USD-like
|
|
134
|
+
* @param key The key of crypto asset
|
|
135
|
+
* @returns True if crypto asset is USD-like
|
|
136
|
+
*/
|
|
137
|
+
export declare function isUsdLikeCryptoAsset(key: string): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Checks if given crypto asset is T token
|
|
140
|
+
* @param key The key of crypto asset
|
|
141
|
+
* @returns True if crypto asset is T token
|
|
142
|
+
*/
|
|
143
|
+
export declare function isTTokenCryptoAsset(key: string): boolean;
|
|
144
|
+
export {};
|
|
145
|
+
//# sourceMappingURL=assets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkEX,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,OAAO,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEhD;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,WAEnD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,WAE/C;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,WAE9C"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
const ASSETS = {
|
|
2
|
+
BTC: {
|
|
3
|
+
name: "Bitcoin",
|
|
4
|
+
symbol: "BTC",
|
|
5
|
+
decimals: 18,
|
|
6
|
+
},
|
|
7
|
+
ETH: {
|
|
8
|
+
name: "Ethereum",
|
|
9
|
+
symbol: "ETH",
|
|
10
|
+
decimals: 18,
|
|
11
|
+
},
|
|
12
|
+
MUSD: {
|
|
13
|
+
name: "MUSD",
|
|
14
|
+
symbol: "MUSD",
|
|
15
|
+
decimals: 18,
|
|
16
|
+
},
|
|
17
|
+
mDAI: {
|
|
18
|
+
name: "Mezo Dai Stablecoin",
|
|
19
|
+
symbol: "mDAI",
|
|
20
|
+
decimals: 18,
|
|
21
|
+
},
|
|
22
|
+
mFBTC: {
|
|
23
|
+
name: "Mezo Fire Bitcoin",
|
|
24
|
+
symbol: "mFBTC",
|
|
25
|
+
decimals: 8,
|
|
26
|
+
},
|
|
27
|
+
mcbBTC: {
|
|
28
|
+
name: "Mezo Coinbase Wrapped BTC",
|
|
29
|
+
symbol: "mcbBTC",
|
|
30
|
+
decimals: 8,
|
|
31
|
+
},
|
|
32
|
+
mSolvBTC: {
|
|
33
|
+
name: "Mezo SolvBTC",
|
|
34
|
+
symbol: "mSolvBTC",
|
|
35
|
+
decimals: 18,
|
|
36
|
+
},
|
|
37
|
+
mswBTC: {
|
|
38
|
+
name: "Mezo swBTC",
|
|
39
|
+
symbol: "mswBTC",
|
|
40
|
+
decimals: 8,
|
|
41
|
+
},
|
|
42
|
+
mT: {
|
|
43
|
+
name: "Mezo Threshold Network Token",
|
|
44
|
+
symbol: "mT",
|
|
45
|
+
decimals: 18,
|
|
46
|
+
},
|
|
47
|
+
mUSDC: {
|
|
48
|
+
name: "Mezo Circle USDC",
|
|
49
|
+
symbol: "mUSDC",
|
|
50
|
+
decimals: 6,
|
|
51
|
+
},
|
|
52
|
+
mUSDe: {
|
|
53
|
+
name: "Mezo Ethena USDe",
|
|
54
|
+
symbol: "mUSDe",
|
|
55
|
+
decimals: 18,
|
|
56
|
+
},
|
|
57
|
+
mUSDT: {
|
|
58
|
+
name: "Mezo Tether USDe",
|
|
59
|
+
symbol: "mUSDT",
|
|
60
|
+
decimals: 6,
|
|
61
|
+
},
|
|
62
|
+
mxSolvBTC: {
|
|
63
|
+
name: "Mezo xSolvBTC",
|
|
64
|
+
symbol: "mxSolvBTC",
|
|
65
|
+
decimals: 18,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Gets details of given crypto asset
|
|
70
|
+
* @param key The key of crypto asset
|
|
71
|
+
* @returns The crypto asset details
|
|
72
|
+
*/
|
|
73
|
+
export function getAsset(key) {
|
|
74
|
+
return ASSETS[key];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Checks if given crypto asset is Bitcoin-like
|
|
78
|
+
* @param key The key of crypto asset
|
|
79
|
+
* @returns True if crypto asset is Bitcoin-like
|
|
80
|
+
*/
|
|
81
|
+
export function isBitcoinLikeCryptoAsset(key) {
|
|
82
|
+
return /(btc)/i.test(key);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Checks if given crypto asset is USD-like
|
|
86
|
+
* @param key The key of crypto asset
|
|
87
|
+
* @returns True if crypto asset is USD-like
|
|
88
|
+
*/
|
|
89
|
+
export function isUsdLikeCryptoAsset(key) {
|
|
90
|
+
return /(usd|dai)/i.test(key);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Checks if given crypto asset is T token
|
|
94
|
+
* @param key The key of crypto asset
|
|
95
|
+
* @returns True if crypto asset is T token
|
|
96
|
+
*/
|
|
97
|
+
export function isTTokenCryptoAsset(key) {
|
|
98
|
+
return /^(mt|t)$/i.test(key);
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=assets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.js","sourceRoot":"","sources":["../../../src/utils/assets.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG;IACb,GAAG,EAAE;QACH,IAAI,EAAE,SAAS;QACf,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;IACD,GAAG,EAAE;QACH,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,EAAE;KACb;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,qBAAqB;QAC3B,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,MAAM,EAAE;QACN,IAAI,EAAE,2BAA2B;QACjC,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC;KACZ;IACD,QAAQ,EAAE;QACR,IAAI,EAAE,cAAc;QACpB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,EAAE;KACb;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,CAAC;KACZ;IACD,EAAE,EAAE;QACF,IAAI,EAAE,8BAA8B;QACpC,MAAM,EAAE,IAAI;QACZ,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,EAAE;KACb;IACD,KAAK,EAAE;QACL,IAAI,EAAE,kBAAkB;QACxB,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC;KACZ;IACD,SAAS,EAAE;QACT,IAAI,EAAE,eAAe;QACrB,MAAM,EAAE,WAAW;QACnB,QAAQ,EAAE,EAAE;KACb;CACF,CAAA;AAED;;;;GAIG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAwB;IAC/C,OAAO,MAAM,CAAC,GAAG,CAAC,CAAA;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAW;IAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,GAAW;IAC9C,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC/B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.test.d.ts","sourceRoot":"","sources":["../../../src/utils/assets.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { getAsset, isBitcoinLikeCryptoAsset, isUsdLikeCryptoAsset, isTTokenCryptoAsset, } from "./assets";
|
|
2
|
+
describe("getAsset", () => {
|
|
3
|
+
it("should return correct asset data", () => {
|
|
4
|
+
const asset = getAsset("BTC");
|
|
5
|
+
expect(asset).toEqual({
|
|
6
|
+
name: "Bitcoin",
|
|
7
|
+
symbol: "BTC",
|
|
8
|
+
decimals: 18,
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
describe("isBitcoinLikeCryptoAsset", () => {
|
|
13
|
+
it('should return true for keys containing "btc"', () => {
|
|
14
|
+
expect(isBitcoinLikeCryptoAsset("BTC")).toBe(true);
|
|
15
|
+
expect(isBitcoinLikeCryptoAsset("mFBTC")).toBe(true);
|
|
16
|
+
expect(isBitcoinLikeCryptoAsset("mcbBTC")).toBe(true);
|
|
17
|
+
expect(isBitcoinLikeCryptoAsset("mxSolvBTC")).toBe(true);
|
|
18
|
+
});
|
|
19
|
+
it("should return false for non-Bitcoin assets", () => {
|
|
20
|
+
expect(isBitcoinLikeCryptoAsset("ETH")).toBe(false);
|
|
21
|
+
expect(isBitcoinLikeCryptoAsset("mUSDC")).toBe(false);
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
describe("isUsdLikeCryptoAsset", () => {
|
|
25
|
+
it('should return true for keys containing "usd" or "dai"', () => {
|
|
26
|
+
expect(isUsdLikeCryptoAsset("mUSDC")).toBe(true);
|
|
27
|
+
expect(isUsdLikeCryptoAsset("mUSDT")).toBe(true);
|
|
28
|
+
expect(isUsdLikeCryptoAsset("mUSDe")).toBe(true);
|
|
29
|
+
expect(isUsdLikeCryptoAsset("mDAI")).toBe(true);
|
|
30
|
+
});
|
|
31
|
+
it("should return false for other tokens", () => {
|
|
32
|
+
expect(isUsdLikeCryptoAsset("BTC")).toBe(false);
|
|
33
|
+
expect(isUsdLikeCryptoAsset("mT")).toBe(false);
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
describe("isTTokenCryptoAsset", () => {
|
|
37
|
+
it('should return true for keys like "mT" or "t"', () => {
|
|
38
|
+
expect(isTTokenCryptoAsset("mT")).toBe(true);
|
|
39
|
+
expect(isTTokenCryptoAsset("T")).toBe(true);
|
|
40
|
+
});
|
|
41
|
+
it("should return false for other tokens", () => {
|
|
42
|
+
expect(isTTokenCryptoAsset("BTC")).toBe(false);
|
|
43
|
+
expect(isTTokenCryptoAsset("mUSDT")).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
//# sourceMappingURL=assets.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assets.test.js","sourceRoot":"","sources":["../../../src/utils/assets.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,UAAU,CAAA;AAEjB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;QAC7B,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;YACpB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,EAAE;SACb,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAClD,MAAM,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACpD,MAAM,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACrD,MAAM,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC1D,CAAC,C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AC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC7C,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC9C,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAClD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mezo-org/passport",
|
|
3
|
-
"version": "0.4.0-dev.
|
|
3
|
+
"version": "0.4.0-dev.60",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"scripts": {
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"@mezo-org/mezo-clay": "0.1.0-dev.27",
|
|
41
41
|
"@mezo-org/mezod-contracts": "^1.0.0",
|
|
42
42
|
"@mezo-org/musd-contracts": "^1.0.1",
|
|
43
|
-
"@mezo-org/orangekit": "1.0.0-beta.40-dev.
|
|
43
|
+
"@mezo-org/orangekit": "1.0.0-beta.40-dev.14",
|
|
44
44
|
"@mezo-org/sign-in-with-wallet": "1.0.0-beta.8",
|
|
45
45
|
"qrcode.react": "^4.2.0",
|
|
46
46
|
"styletron-engine-monolithic": "^1.0.0",
|
|
@@ -121,11 +121,6 @@ export default function useDropdownData({
|
|
|
121
121
|
0,
|
|
122
122
|
)
|
|
123
123
|
|
|
124
|
-
const usdTotalBalance = detailedAssets.reduce(
|
|
125
|
-
(sum, { usdBalance }) => sum + usdBalance,
|
|
126
|
-
0,
|
|
127
|
-
)
|
|
128
|
-
|
|
129
124
|
const matsBalance = passportAccount?.mats.totalMats || 0
|
|
130
125
|
|
|
131
126
|
const usdCollateral = convertToUsd(
|
|
@@ -137,6 +132,10 @@ export default function useDropdownData({
|
|
|
137
132
|
|
|
138
133
|
const usdTroveDebt = fromFixedPoint(debt?.troveDebt ?? 0n, 18)
|
|
139
134
|
|
|
135
|
+
const usdTotalBalance =
|
|
136
|
+
detailedAssets.reduce((sum, { usdBalance }) => sum + usdBalance, 0) +
|
|
137
|
+
usdCollateral
|
|
138
|
+
|
|
140
139
|
return {
|
|
141
140
|
mezoId,
|
|
142
141
|
matsBalance,
|