@mezo-org/passport 0.4.0-dev.8 → 0.4.0-dev.81
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/README.md +18 -22
- package/dist/src/api/auth.d.ts +7 -3
- package/dist/src/api/auth.d.ts.map +1 -1
- package/dist/src/api/auth.js +3 -1
- package/dist/src/api/auth.js.map +1 -1
- package/dist/src/api/client.d.ts +4 -1
- package/dist/src/api/client.d.ts.map +1 -1
- package/dist/src/api/client.js +9 -2
- package/dist/src/api/client.js.map +1 -1
- package/dist/src/api/portal.d.ts +3 -9
- package/dist/src/api/portal.d.ts.map +1 -1
- package/dist/src/api/portal.js +8 -5
- package/dist/src/api/portal.js.map +1 -1
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +2 -1
- package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +1 -1
- package/dist/src/components/Dropdown/ConnectedTrigger.js +29 -20
- package/dist/src/components/Dropdown/ConnectedTrigger.js.map +1 -1
- package/dist/src/components/Dropdown/Content.d.ts +19 -5
- package/dist/src/components/Dropdown/Content.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Content.js +19 -61
- package/dist/src/components/Dropdown/Content.js.map +1 -1
- package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +1 -1
- package/dist/src/components/Dropdown/DisconnectedTrigger.js +2 -2
- package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +13 -6
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.js +32 -9
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/src/components/Dropdown/ListingItem.d.ts +13 -0
- package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -0
- package/dist/src/components/Dropdown/ListingItem.js +34 -0
- package/dist/src/components/Dropdown/ListingItem.js.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts +7 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js +34 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts +7 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.js +53 -0
- package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +7 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js +48 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts +11 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.js +9 -0
- package/dist/src/components/Dropdown/Root/AccountAssetItem.js.map +1 -0
- package/dist/src/components/Dropdown/{AccountBalance.d.ts → Root/AccountBalance.d.ts} +2 -1
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js +15 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +9 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +48 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts +23 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.js +57 -0
- package/dist/src/components/Dropdown/Root/Root.js.map +1 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -0
- package/dist/src/components/Dropdown/{AccountAddress.js → Root/WalletAddress.js} +21 -15
- package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -0
- package/dist/src/components/Dropdown/{WelcomeBlock.d.ts → Root/WelcomeBlock.d.ts} +1 -1
- package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -0
- package/dist/src/components/Dropdown/{WelcomeBlock.js → Root/WelcomeBlock.js} +5 -5
- package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +3 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +1 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.js +14 -0
- package/dist/src/components/Dropdown/TestnetTopBanner.js.map +1 -0
- package/dist/src/config.d.ts +29 -6
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +88 -15
- package/dist/src/config.js.map +1 -1
- package/dist/src/constants.d.ts +13 -3
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +14 -4
- package/dist/src/constants.js.map +1 -1
- package/dist/src/hooks/index.d.ts +4 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +4 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/useAssetsConversionRates.d.ts +23 -0
- package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -0
- package/dist/src/hooks/useAssetsConversionRates.js +90 -0
- package/dist/src/hooks/useAssetsConversionRates.js.map +1 -0
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts +13 -13
- package/dist/src/hooks/useAuthenticateWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useAuthenticateWithWallet.js +8 -7
- package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
- package/dist/src/hooks/useBorrowData.d.ts +82 -0
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
- package/dist/src/hooks/useBorrowData.js +159 -0
- package/dist/src/hooks/useBorrowData.js.map +1 -0
- package/dist/src/hooks/useCreateAccount.d.ts.map +1 -1
- package/dist/src/hooks/useCreateAccount.js +22 -1
- package/dist/src/hooks/useCreateAccount.js.map +1 -1
- package/dist/src/hooks/useDropdownData.d.ts +37 -34
- package/dist/src/hooks/useDropdownData.d.ts.map +1 -1
- package/dist/src/hooks/useDropdownData.js +85 -61
- package/dist/src/hooks/useDropdownData.js.map +1 -1
- package/dist/src/hooks/useLinkAccount.d.ts +19 -13
- package/dist/src/hooks/useLinkAccount.d.ts.map +1 -1
- package/dist/src/hooks/useLinkAccount.js +20 -1
- package/dist/src/hooks/useLinkAccount.js.map +1 -1
- package/dist/src/hooks/useRefreshPassport.d.ts +19 -0
- package/dist/src/hooks/useRefreshPassport.d.ts.map +1 -0
- package/dist/src/hooks/useRefreshPassport.js +44 -0
- package/dist/src/hooks/useRefreshPassport.js.map +1 -0
- package/dist/src/hooks/useSignInWithWallet.d.ts +13 -13
- package/dist/src/hooks/useSignInWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useSignUpWithWallet.d.ts +13 -13
- package/dist/src/hooks/useSignUpWithWallet.d.ts.map +1 -1
- package/dist/src/hooks/useTokensBalances.d.ts +74 -0
- package/dist/src/hooks/useTokensBalances.d.ts.map +1 -0
- package/dist/src/hooks/useTokensBalances.js +140 -0
- package/dist/src/hooks/useTokensBalances.js.map +1 -0
- package/dist/src/hooks/useValidateMezoId.d.ts +8 -0
- package/dist/src/hooks/useValidateMezoId.d.ts.map +1 -0
- package/dist/src/hooks/useValidateMezoId.js +24 -0
- package/dist/src/hooks/useValidateMezoId.js.map +1 -0
- package/dist/src/hooks/useWalletAccount.d.ts +2 -1
- package/dist/src/hooks/useWalletAccount.d.ts.map +1 -1
- package/dist/src/hooks/useWalletAccount.js +19 -15
- package/dist/src/hooks/useWalletAccount.js.map +1 -1
- package/dist/src/hooks/useWatchTransferEvents.d.ts +5 -0
- package/dist/src/hooks/useWatchTransferEvents.d.ts.map +1 -0
- package/dist/src/hooks/useWatchTransferEvents.js +63 -0
- package/dist/src/hooks/useWatchTransferEvents.js.map +1 -0
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +2 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/contracts/index.d.ts +13 -0
- package/dist/src/lib/contracts/index.d.ts.map +1 -0
- package/dist/src/lib/contracts/index.js +62 -0
- package/dist/src/lib/contracts/index.js.map +1 -0
- package/dist/src/lib/contracts/priceOracle.d.ts +43 -0
- package/dist/src/lib/contracts/priceOracle.d.ts.map +1 -0
- package/dist/src/lib/contracts/priceOracle.js +52 -0
- package/dist/src/lib/contracts/priceOracle.js.map +1 -0
- package/dist/src/provider.js +1 -1
- package/dist/src/provider.js.map +1 -1
- package/dist/src/stores/dropdownStore.d.ts +12 -0
- package/dist/src/stores/dropdownStore.d.ts.map +1 -0
- package/dist/src/stores/dropdownStore.js +13 -0
- package/dist/src/stores/dropdownStore.js.map +1 -0
- package/dist/src/utils/address.d.ts +1 -1
- package/dist/src/utils/address.d.ts.map +1 -1
- package/dist/src/utils/address.js +2 -0
- package/dist/src/utils/address.js.map +1 -1
- package/dist/src/utils/address.test.js +8 -5
- package/dist/src/utils/address.test.js.map +1 -1
- package/dist/src/utils/cryptoAssets.d.ts +17 -1
- package/dist/src/utils/cryptoAssets.d.ts.map +1 -1
- package/dist/src/utils/cryptoAssets.js +87 -31
- package/dist/src/utils/cryptoAssets.js.map +1 -1
- package/dist/src/utils/cryptoAssets.test.js +51 -33
- package/dist/src/utils/cryptoAssets.test.js.map +1 -1
- package/dist/src/utils/currency.d.ts +8 -0
- package/dist/src/utils/currency.d.ts.map +1 -1
- package/dist/src/utils/currency.js +11 -0
- package/dist/src/utils/currency.js.map +1 -1
- package/dist/src/utils/currency.test.js +1 -0
- package/dist/src/utils/currency.test.js.map +1 -1
- package/dist/src/utils/mezoId.d.ts +7 -0
- package/dist/src/utils/mezoId.d.ts.map +1 -0
- package/dist/src/utils/mezoId.js +41 -0
- package/dist/src/utils/mezoId.js.map +1 -0
- package/dist/src/utils/numbers.d.ts +39 -17
- package/dist/src/utils/numbers.d.ts.map +1 -1
- package/dist/src/utils/numbers.js +91 -33
- package/dist/src/utils/numbers.js.map +1 -1
- package/dist/src/utils/numbers.test.js +144 -22
- package/dist/src/utils/numbers.test.js.map +1 -1
- package/dist/src/utils/siww.d.ts +1 -0
- package/dist/src/utils/siww.d.ts.map +1 -1
- package/dist/src/utils/siww.js +50 -12
- package/dist/src/utils/siww.js.map +1 -1
- package/dist/src/utils/wagmi.d.ts +3 -0
- package/dist/src/utils/wagmi.d.ts.map +1 -0
- package/dist/src/utils/wagmi.js +7 -0
- package/dist/src/utils/wagmi.js.map +1 -0
- package/dist/src/wallet/index.d.ts +1 -1
- package/dist/src/wallet/index.d.ts.map +1 -1
- package/dist/src/wallet/index.js +1 -1
- package/dist/src/wallet/index.js.map +1 -1
- package/package.json +10 -8
- package/src/api/auth.ts +8 -4
- package/src/api/client.ts +11 -2
- package/src/api/portal.ts +11 -14
- package/src/components/Dropdown/ConnectedTrigger.tsx +52 -32
- package/src/components/Dropdown/Content.tsx +67 -117
- package/src/components/Dropdown/DisconnectedTrigger.tsx +2 -1
- package/src/components/Dropdown/Dropdown.tsx +75 -15
- package/src/components/Dropdown/ListingItem.tsx +80 -0
- package/src/components/Dropdown/NestedViewLayout.tsx +75 -0
- package/src/components/Dropdown/README.md +10 -18
- package/src/components/Dropdown/Receive/Receive.tsx +119 -0
- package/src/components/Dropdown/Root/AccountAddressActions.tsx +101 -0
- package/src/components/Dropdown/Root/AccountAssetItem.tsx +26 -0
- package/src/components/Dropdown/Root/AccountBalance.tsx +30 -0
- package/src/components/Dropdown/Root/AccountOtherAssets.tsx +68 -0
- package/src/components/Dropdown/Root/Root.tsx +147 -0
- package/src/components/Dropdown/Root/WalletAddress.tsx +128 -0
- package/src/components/Dropdown/{WelcomeBlock.tsx → Root/WelcomeBlock.tsx} +5 -6
- package/src/components/Dropdown/TestnetTopBanner.tsx +32 -0
- package/src/config.ts +135 -21
- package/src/constants.ts +18 -4
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useAssetsConversionRates.ts +97 -0
- package/src/hooks/useAuthenticateWithWallet.ts +33 -12
- package/src/hooks/useBorrowData.ts +187 -0
- package/src/hooks/useCreateAccount.ts +28 -2
- package/src/hooks/useDropdownData.ts +119 -97
- package/src/hooks/useLinkAccount.ts +36 -4
- package/src/hooks/useRefreshPassport.ts +56 -0
- package/src/hooks/useSignInWithWallet.ts +2 -2
- package/src/hooks/useSignUpWithWallet.ts +2 -2
- package/src/hooks/useTokensBalances.ts +187 -0
- package/src/hooks/useValidateMezoId.ts +31 -0
- package/src/hooks/useWalletAccount.ts +29 -19
- package/src/hooks/useWatchTransferEvents.ts +74 -0
- package/src/index.ts +13 -1
- package/src/lib/contracts/index.ts +92 -0
- package/src/lib/contracts/priceOracle.ts +53 -0
- package/src/provider.ts +1 -1
- package/src/stores/dropdownStore.ts +20 -0
- package/src/utils/address.test.ts +10 -6
- package/src/utils/address.ts +5 -3
- package/src/utils/cryptoAssets.test.ts +57 -37
- package/src/utils/cryptoAssets.ts +113 -35
- package/src/utils/currency.test.ts +2 -0
- package/src/utils/currency.ts +21 -0
- package/src/utils/mezoId.ts +51 -0
- package/src/utils/numbers.test.ts +181 -23
- package/src/utils/numbers.ts +121 -34
- package/src/utils/siww.ts +71 -16
- package/src/utils/wagmi.ts +12 -0
- package/src/wallet/index.ts +3 -2
- package/dist/src/components/Dropdown/AccountAddress.d.ts +0 -8
- package/dist/src/components/Dropdown/AccountAddress.d.ts.map +0 -1
- package/dist/src/components/Dropdown/AccountAddress.js.map +0 -1
- package/dist/src/components/Dropdown/AccountAssets.d.ts +0 -14
- package/dist/src/components/Dropdown/AccountAssets.d.ts.map +0 -1
- package/dist/src/components/Dropdown/AccountAssets.js +0 -44
- package/dist/src/components/Dropdown/AccountAssets.js.map +0 -1
- package/dist/src/components/Dropdown/AccountBalance.d.ts.map +0 -1
- package/dist/src/components/Dropdown/AccountBalance.js +0 -18
- package/dist/src/components/Dropdown/AccountBalance.js.map +0 -1
- package/dist/src/components/Dropdown/WelcomeBlock.d.ts.map +0 -1
- package/dist/src/components/Dropdown/WelcomeBlock.js.map +0 -1
- package/dist/src/hooks/useAssetsUSDConversion.d.ts +0 -8
- package/dist/src/hooks/useAssetsUSDConversion.d.ts.map +0 -1
- package/dist/src/hooks/useAssetsUSDConversion.js +0 -21
- package/dist/src/hooks/useAssetsUSDConversion.js.map +0 -1
- package/src/components/Dropdown/AccountAddress.tsx +0 -111
- package/src/components/Dropdown/AccountAssets.tsx +0 -110
- package/src/components/Dropdown/AccountBalance.tsx +0 -38
- package/src/hooks/useAssetsUSDConversion.ts +0 -31
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Block,
|
|
3
|
-
LabelSmall,
|
|
4
|
-
ParagraphSmall,
|
|
5
|
-
useStyletron,
|
|
6
|
-
} from "@mezo-org/mezo-clay"
|
|
7
|
-
import React, { useMemo } from "react"
|
|
8
|
-
import { CryptoAssetKey, getCryptoAsset } from "../../utils/cryptoAssets"
|
|
9
|
-
import { formatUsd } from "../../utils/currency"
|
|
10
|
-
|
|
11
|
-
type AccountAssetsProps = {
|
|
12
|
-
label: string | React.ReactNode
|
|
13
|
-
assets: {
|
|
14
|
-
type: CryptoAssetKey
|
|
15
|
-
decimals: number
|
|
16
|
-
balance: number
|
|
17
|
-
balanceInUsd: number
|
|
18
|
-
}[]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default function AccountAssets(props: AccountAssetsProps) {
|
|
22
|
-
const { label, assets } = props
|
|
23
|
-
|
|
24
|
-
const [, theme] = useStyletron()
|
|
25
|
-
|
|
26
|
-
const assetsData = useMemo(
|
|
27
|
-
() =>
|
|
28
|
-
assets.map((token) => {
|
|
29
|
-
const { name, symbol, icon } = getCryptoAsset(token.type)
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
...token,
|
|
33
|
-
icon,
|
|
34
|
-
label: name,
|
|
35
|
-
symbol,
|
|
36
|
-
}
|
|
37
|
-
}),
|
|
38
|
-
[assets],
|
|
39
|
-
)
|
|
40
|
-
|
|
41
|
-
const labelContent =
|
|
42
|
-
typeof label === "string" ? (
|
|
43
|
-
<ParagraphSmall margin={0} color={theme.colors.gray800}>
|
|
44
|
-
{label}
|
|
45
|
-
</ParagraphSmall>
|
|
46
|
-
) : (
|
|
47
|
-
label
|
|
48
|
-
)
|
|
49
|
-
|
|
50
|
-
if (assetsData.length === 0) {
|
|
51
|
-
return null
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<Block padding={`0 ${theme.sizing.scale500}`}>
|
|
56
|
-
<Block margin={`${theme.sizing.scale400} 0`}>{labelContent}</Block>
|
|
57
|
-
|
|
58
|
-
<Block
|
|
59
|
-
as="ul"
|
|
60
|
-
marginBottom={theme.sizing.scale600}
|
|
61
|
-
padding={0}
|
|
62
|
-
display="flex"
|
|
63
|
-
flexDirection="column"
|
|
64
|
-
overrides={{
|
|
65
|
-
Block: {
|
|
66
|
-
style: {
|
|
67
|
-
gap: theme.sizing.scale100,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
}}
|
|
71
|
-
>
|
|
72
|
-
{assetsData.map((asset) => (
|
|
73
|
-
<Block
|
|
74
|
-
as="li"
|
|
75
|
-
key={`${asset.type}-${asset.balance}`}
|
|
76
|
-
display="flex"
|
|
77
|
-
justifyContent="space-between"
|
|
78
|
-
alignItems="center"
|
|
79
|
-
margin={`${theme.sizing.scale100} 0`}
|
|
80
|
-
>
|
|
81
|
-
<asset.icon
|
|
82
|
-
size={theme.sizing.scale800}
|
|
83
|
-
overrides={{
|
|
84
|
-
Svg: {
|
|
85
|
-
style: {
|
|
86
|
-
marginRight: theme.sizing.scale500,
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
}}
|
|
90
|
-
/>
|
|
91
|
-
|
|
92
|
-
<Block flex={1}>
|
|
93
|
-
<LabelSmall margin={0}>{asset.label}</LabelSmall>
|
|
94
|
-
<ParagraphSmall margin={0} color={theme.colors.gray500}>
|
|
95
|
-
{asset.symbol}
|
|
96
|
-
</ParagraphSmall>
|
|
97
|
-
</Block>
|
|
98
|
-
|
|
99
|
-
<Block display="flex" alignItems="end" flexDirection="column">
|
|
100
|
-
<LabelSmall margin={0}>{asset.balance}</LabelSmall>
|
|
101
|
-
<ParagraphSmall margin={0} color={theme.colors.gray500}>
|
|
102
|
-
{formatUsd(asset.balanceInUsd)}
|
|
103
|
-
</ParagraphSmall>
|
|
104
|
-
</Block>
|
|
105
|
-
</Block>
|
|
106
|
-
))}
|
|
107
|
-
</Block>
|
|
108
|
-
</Block>
|
|
109
|
-
)
|
|
110
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Block,
|
|
3
|
-
HeadingSmall,
|
|
4
|
-
ParagraphSmall,
|
|
5
|
-
useStyletron,
|
|
6
|
-
} from "@mezo-org/mezo-clay"
|
|
7
|
-
import React from "react"
|
|
8
|
-
import { formatUsd } from "../../utils/currency"
|
|
9
|
-
|
|
10
|
-
type AccountBalanceProps = {
|
|
11
|
-
amount: number
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function AccountBalance(props: AccountBalanceProps) {
|
|
15
|
-
const { amount } = props
|
|
16
|
-
|
|
17
|
-
const formattedUsdBalance = formatUsd(amount)
|
|
18
|
-
|
|
19
|
-
const [, theme] = useStyletron()
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Block
|
|
23
|
-
padding={theme.sizing.scale500}
|
|
24
|
-
overrides={{
|
|
25
|
-
Block: {
|
|
26
|
-
style: {
|
|
27
|
-
borderBottom: `1px solid ${theme.colors.backgroundPrimary}`,
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
}}
|
|
31
|
-
>
|
|
32
|
-
<ParagraphSmall margin={0} color={theme.colors.gray800}>
|
|
33
|
-
Available balance
|
|
34
|
-
</ParagraphSmall>
|
|
35
|
-
<HeadingSmall margin={0}>{formattedUsdBalance}</HeadingSmall>
|
|
36
|
-
</Block>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { UseBaseQueryOptions, useQuery } from "@tanstack/react-query"
|
|
2
|
-
import { ONE_MINUTE_MS } from "../utils/time"
|
|
3
|
-
import { QUERY_KEYS } from "./constants"
|
|
4
|
-
import { usePortalApiClient } from "./usePortalApiClient"
|
|
5
|
-
|
|
6
|
-
type AssetsUsdConversion = {
|
|
7
|
-
btcUsd: string
|
|
8
|
-
ethUsd: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function useAssetsUsdConversion(
|
|
12
|
-
useQueryOptions: Partial<UseBaseQueryOptions<AssetsUsdConversion>> = {},
|
|
13
|
-
) {
|
|
14
|
-
const portalApiClient = usePortalApiClient()
|
|
15
|
-
|
|
16
|
-
return useQuery({
|
|
17
|
-
queryKey: [QUERY_KEYS.ASSETS_USD_CONVERSION],
|
|
18
|
-
queryFn: async () => {
|
|
19
|
-
const { currentUsdPerBtc, currentUsdPerEth } =
|
|
20
|
-
await portalApiClient.getPortalStatistics()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
btcUsd: currentUsdPerBtc,
|
|
24
|
-
ethUsd: currentUsdPerEth,
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
staleTime: 30 * ONE_MINUTE_MS,
|
|
28
|
-
retry: 1,
|
|
29
|
-
...useQueryOptions,
|
|
30
|
-
})
|
|
31
|
-
}
|