@mezo-org/passport 0.4.0-dev.7 → 0.4.0-dev.70
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 +18 -5
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +45 -14
- package/dist/src/config.js.map +1 -1
- package/dist/src/constants.d.ts +11 -3
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +12 -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.map +1 -1
- package/dist/src/hooks/useAuthenticateWithWallet.js +9 -9
- 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/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 +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -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 +3 -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 +73 -20
- package/src/constants.ts +12 -4
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useAssetsConversionRates.ts +97 -0
- package/src/hooks/useAuthenticateWithWallet.ts +18 -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/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 +11 -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 +50 -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
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ArrowNarrowLeft,
|
|
3
|
+
Block,
|
|
4
|
+
Button,
|
|
5
|
+
ButtonProps,
|
|
6
|
+
Cube01,
|
|
7
|
+
useStyletron,
|
|
8
|
+
} from "@mezo-org/mezo-clay"
|
|
9
|
+
import React, { useCallback } from "react"
|
|
10
|
+
import { usePassportContext } from "../../../hooks/usePassportContext"
|
|
11
|
+
import { getAddressExplorerUrl } from "../../../utils/address"
|
|
12
|
+
import useDropdownStore, { DropdownView } from "../../../stores/dropdownStore"
|
|
13
|
+
|
|
14
|
+
type AccountAddressActionsProps = {
|
|
15
|
+
address: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const buttonStartEnhancerSize = 12
|
|
19
|
+
|
|
20
|
+
const commonButtonProps: Partial<ButtonProps> = {
|
|
21
|
+
kind: "secondary",
|
|
22
|
+
size: "xsmall",
|
|
23
|
+
overrides: {
|
|
24
|
+
BaseButton: {
|
|
25
|
+
style: {
|
|
26
|
+
flex: 1,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
StartEnhancer: {
|
|
30
|
+
style: {
|
|
31
|
+
stroke: "currentColor",
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default function AccountAddressActions(
|
|
38
|
+
props: AccountAddressActionsProps,
|
|
39
|
+
) {
|
|
40
|
+
const { address } = props
|
|
41
|
+
|
|
42
|
+
const [, theme] = useStyletron()
|
|
43
|
+
|
|
44
|
+
const { environment } = usePassportContext()
|
|
45
|
+
const blockExplorerUrl = getAddressExplorerUrl(
|
|
46
|
+
address,
|
|
47
|
+
"mezo",
|
|
48
|
+
environment === "testnet",
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
const setDropdownView = useDropdownStore((state) => state.setView)
|
|
52
|
+
|
|
53
|
+
const handleReceiveClick = useCallback(() => {
|
|
54
|
+
setDropdownView(DropdownView.RECEIVE)
|
|
55
|
+
}, [setDropdownView])
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<Block
|
|
59
|
+
display="flex"
|
|
60
|
+
alignItems="center"
|
|
61
|
+
backgroundColor="transparent"
|
|
62
|
+
marginBottom={theme.sizing.scale600}
|
|
63
|
+
overrides={{
|
|
64
|
+
Block: {
|
|
65
|
+
style: {
|
|
66
|
+
gap: theme.sizing.scale600,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Button
|
|
72
|
+
startEnhancer={<Cube01 size={buttonStartEnhancerSize} />}
|
|
73
|
+
$as="a"
|
|
74
|
+
href={blockExplorerUrl}
|
|
75
|
+
target="_blank"
|
|
76
|
+
{...commonButtonProps}
|
|
77
|
+
>
|
|
78
|
+
View Mezo Explorer
|
|
79
|
+
</Button>
|
|
80
|
+
|
|
81
|
+
<Button
|
|
82
|
+
onClick={handleReceiveClick}
|
|
83
|
+
startEnhancer={
|
|
84
|
+
<ArrowNarrowLeft
|
|
85
|
+
size={buttonStartEnhancerSize}
|
|
86
|
+
overrides={{
|
|
87
|
+
Svg: {
|
|
88
|
+
style: {
|
|
89
|
+
transform: "rotate(-45deg)",
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
}}
|
|
93
|
+
/>
|
|
94
|
+
}
|
|
95
|
+
{...commonButtonProps}
|
|
96
|
+
>
|
|
97
|
+
Receive
|
|
98
|
+
</Button>
|
|
99
|
+
</Block>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { CryptoAssetKey, getCryptoAsset } from "../../../utils/cryptoAssets"
|
|
3
|
+
import ListingItem from "../ListingItem"
|
|
4
|
+
|
|
5
|
+
type AccountAssetItemProps = {
|
|
6
|
+
type: CryptoAssetKey
|
|
7
|
+
amount: string
|
|
8
|
+
subLabel: string
|
|
9
|
+
subValue: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function AccountAssetItem(props: AccountAssetItemProps) {
|
|
13
|
+
const { type, amount, subLabel, subValue } = props
|
|
14
|
+
|
|
15
|
+
const { icon: Icon, name: label } = getCryptoAsset(type)
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<ListingItem
|
|
19
|
+
icon={Icon}
|
|
20
|
+
label={label}
|
|
21
|
+
subLabel={subLabel}
|
|
22
|
+
value={amount}
|
|
23
|
+
subValue={subValue}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import { useStyletron } from "@mezo-org/mezo-clay"
|
|
3
|
+
import ListingItem from "../ListingItem"
|
|
4
|
+
|
|
5
|
+
type AccountBalanceProps = {
|
|
6
|
+
totalBalance: string
|
|
7
|
+
totalDebt: string
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function AccountBalance(props: AccountBalanceProps) {
|
|
11
|
+
const { totalBalance, totalDebt } = props
|
|
12
|
+
|
|
13
|
+
const [, theme] = useStyletron()
|
|
14
|
+
|
|
15
|
+
return (
|
|
16
|
+
<ListingItem
|
|
17
|
+
label="Total assets"
|
|
18
|
+
value={totalBalance}
|
|
19
|
+
subLabel="Total liabilities"
|
|
20
|
+
subValue={totalDebt}
|
|
21
|
+
overrides={{
|
|
22
|
+
Root: {
|
|
23
|
+
style: {
|
|
24
|
+
borderBottom: `1px solid ${theme.colors.borderInverseSelected}`,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}}
|
|
28
|
+
/>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React, { useMemo } from "react"
|
|
2
|
+
import { Block, useStyletron, CoinsStacked02 } from "@mezo-org/mezo-clay"
|
|
3
|
+
import ListingItem from "../ListingItem"
|
|
4
|
+
import { formatUsd } from "../../../utils/currency"
|
|
5
|
+
|
|
6
|
+
type AccountOtherAssetsProps = {
|
|
7
|
+
assetsCount: number
|
|
8
|
+
assetsUsdTotal: number
|
|
9
|
+
onClick?: () => void
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default function AccountOtherAssets(props: AccountOtherAssetsProps) {
|
|
13
|
+
const { assetsCount, assetsUsdTotal, onClick } = props
|
|
14
|
+
|
|
15
|
+
const [, theme] = useStyletron()
|
|
16
|
+
|
|
17
|
+
const label = useMemo(() => {
|
|
18
|
+
if (assetsCount === 0) return "No other assets"
|
|
19
|
+
if (assetsCount === 1) return "1 more asset"
|
|
20
|
+
return `${assetsCount} more assets`
|
|
21
|
+
}, [assetsCount])
|
|
22
|
+
|
|
23
|
+
const formattedAssetsUsdTotal = formatUsd(assetsUsdTotal)
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Block
|
|
27
|
+
aria-label={label}
|
|
28
|
+
as="li"
|
|
29
|
+
overrides={{
|
|
30
|
+
Block: {
|
|
31
|
+
style: {
|
|
32
|
+
listStyle: "none",
|
|
33
|
+
borderTop: `1px solid ${theme.colors.borderInverseSelected}`,
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
}}
|
|
37
|
+
>
|
|
38
|
+
<ListingItem
|
|
39
|
+
icon={CoinsStacked02}
|
|
40
|
+
label={label}
|
|
41
|
+
value={formattedAssetsUsdTotal}
|
|
42
|
+
overrides={{
|
|
43
|
+
Root: {
|
|
44
|
+
props: {
|
|
45
|
+
$as: "button",
|
|
46
|
+
onClick,
|
|
47
|
+
},
|
|
48
|
+
style: {
|
|
49
|
+
border: 0,
|
|
50
|
+
padding: 0,
|
|
51
|
+
cursor: "pointer",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
ArtworkContainer: {
|
|
55
|
+
style: {
|
|
56
|
+
stroke: theme.colors.contentPrimary,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
Content: {
|
|
60
|
+
style: {
|
|
61
|
+
minHeight: theme.sizing.scale1200,
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}}
|
|
65
|
+
/>
|
|
66
|
+
</Block>
|
|
67
|
+
)
|
|
68
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { Block, Button, LogOut01, useStyletron } from "@mezo-org/mezo-clay"
|
|
2
|
+
import React, { useCallback } from "react"
|
|
3
|
+
import { useDisconnect } from "wagmi"
|
|
4
|
+
import { useSignOut } from "../../../hooks"
|
|
5
|
+
import WalletAddress from "./WalletAddress"
|
|
6
|
+
import AccountBalance from "./AccountBalance"
|
|
7
|
+
import WelcomeBlock from "./WelcomeBlock"
|
|
8
|
+
import AccountAddressActions from "./AccountAddressActions"
|
|
9
|
+
import AccountAssetItem from "./AccountAssetItem"
|
|
10
|
+
import { DetailedCryptoAsset } from "../../../utils/cryptoAssets"
|
|
11
|
+
import { formatNumberToCompactString } from "../../../utils/numbers"
|
|
12
|
+
import { formatUsd } from "../../../utils/currency"
|
|
13
|
+
import AccountOtherAssets from "./AccountOtherAssets"
|
|
14
|
+
|
|
15
|
+
type RootProps = {
|
|
16
|
+
mezoId: string
|
|
17
|
+
matsBalance: number
|
|
18
|
+
accountAddress: string
|
|
19
|
+
walletAddress: string
|
|
20
|
+
walletType: "bitcoin" | "evm"
|
|
21
|
+
usdTotalBalance: number
|
|
22
|
+
usdTroveDebt: number
|
|
23
|
+
usdCollateral: number
|
|
24
|
+
assets: {
|
|
25
|
+
btc: DetailedCryptoAsset
|
|
26
|
+
musd: DetailedCryptoAsset
|
|
27
|
+
}
|
|
28
|
+
otherAssetsCount: number
|
|
29
|
+
otherAssetsUsdTotal: number
|
|
30
|
+
onSignOut?: () => void
|
|
31
|
+
onOtherAssetsClick?: () => void
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default function Root(props: RootProps) {
|
|
35
|
+
const {
|
|
36
|
+
mezoId,
|
|
37
|
+
walletAddress,
|
|
38
|
+
accountAddress,
|
|
39
|
+
walletType,
|
|
40
|
+
usdTotalBalance,
|
|
41
|
+
usdTroveDebt,
|
|
42
|
+
usdCollateral,
|
|
43
|
+
matsBalance,
|
|
44
|
+
assets,
|
|
45
|
+
otherAssetsCount,
|
|
46
|
+
otherAssetsUsdTotal,
|
|
47
|
+
onSignOut,
|
|
48
|
+
onOtherAssetsClick,
|
|
49
|
+
} = props
|
|
50
|
+
|
|
51
|
+
const [, theme] = useStyletron()
|
|
52
|
+
|
|
53
|
+
const { disconnect } = useDisconnect()
|
|
54
|
+
const { signOut } = useSignOut()
|
|
55
|
+
|
|
56
|
+
const handleLogOut = useCallback(() => {
|
|
57
|
+
if (onSignOut) {
|
|
58
|
+
onSignOut()
|
|
59
|
+
return
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
signOut()
|
|
63
|
+
disconnect()
|
|
64
|
+
}, [signOut, disconnect, onSignOut])
|
|
65
|
+
|
|
66
|
+
const formattedMatsBalance = formatNumberToCompactString(matsBalance, 2)
|
|
67
|
+
const formattedUsdTotalBalance = formatUsd(usdTotalBalance)
|
|
68
|
+
const formattedUsdTroveDebt = formatUsd(usdTroveDebt)
|
|
69
|
+
const formattedUsdCollateral = formatUsd(usdCollateral)
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Block
|
|
73
|
+
display="inline-flex"
|
|
74
|
+
flexDirection="column"
|
|
75
|
+
padding={theme.sizing.scale600}
|
|
76
|
+
>
|
|
77
|
+
<WelcomeBlock mezoId={mezoId} matsBalance={formattedMatsBalance} />
|
|
78
|
+
|
|
79
|
+
<AccountAddressActions address={accountAddress} />
|
|
80
|
+
|
|
81
|
+
<Block
|
|
82
|
+
display="flex"
|
|
83
|
+
flexDirection="column"
|
|
84
|
+
backgroundColor={theme.colors.backgroundSecondary}
|
|
85
|
+
overflow="hidden"
|
|
86
|
+
overrides={{
|
|
87
|
+
Block: { style: { borderRadius: theme.borders.radius300 } },
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
<WalletAddress address={walletAddress} type={walletType} />
|
|
91
|
+
|
|
92
|
+
<AccountBalance
|
|
93
|
+
totalBalance={formattedUsdTotalBalance}
|
|
94
|
+
totalDebt={formattedUsdTroveDebt}
|
|
95
|
+
/>
|
|
96
|
+
|
|
97
|
+
<AccountAssetItem
|
|
98
|
+
type="BTC"
|
|
99
|
+
amount={assets.btc.formattedUsdBalance}
|
|
100
|
+
subLabel="Locked collateral"
|
|
101
|
+
subValue={formattedUsdCollateral}
|
|
102
|
+
/>
|
|
103
|
+
|
|
104
|
+
<AccountAssetItem
|
|
105
|
+
type="MUSD"
|
|
106
|
+
amount={assets.musd.formattedUsdBalance}
|
|
107
|
+
subLabel="Borrowed"
|
|
108
|
+
subValue={formattedUsdTroveDebt}
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<AccountOtherAssets
|
|
112
|
+
assetsCount={otherAssetsCount}
|
|
113
|
+
assetsUsdTotal={otherAssetsUsdTotal}
|
|
114
|
+
onClick={onOtherAssetsClick}
|
|
115
|
+
/>
|
|
116
|
+
</Block>
|
|
117
|
+
|
|
118
|
+
<Block
|
|
119
|
+
marginTop={theme.sizing.scale700}
|
|
120
|
+
padding={`0 ${theme.sizing.scale100}`}
|
|
121
|
+
>
|
|
122
|
+
<Button
|
|
123
|
+
size="small"
|
|
124
|
+
kind="tertiary"
|
|
125
|
+
startEnhancer={<LogOut01 color="currentColor" size={12} />}
|
|
126
|
+
onClick={() => handleLogOut()}
|
|
127
|
+
overrides={{
|
|
128
|
+
Root: {
|
|
129
|
+
style: {
|
|
130
|
+
":hover": {
|
|
131
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
132
|
+
boxShadow: "none",
|
|
133
|
+
},
|
|
134
|
+
":active": {
|
|
135
|
+
backgroundColor: theme.colors.backgroundSecondary,
|
|
136
|
+
color: theme.colors.contentPrimary,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
Log out
|
|
143
|
+
</Button>
|
|
144
|
+
</Block>
|
|
145
|
+
</Block>
|
|
146
|
+
)
|
|
147
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Block,
|
|
3
|
+
Copy03 as CopyIcon,
|
|
4
|
+
LinkExternal02 as LinkIcon,
|
|
5
|
+
ParagraphSmall,
|
|
6
|
+
useStyletron,
|
|
7
|
+
} from "@mezo-org/mezo-clay"
|
|
8
|
+
import React, { useCallback, useState } from "react"
|
|
9
|
+
import { useCopyToClipboard } from "usehooks-ts"
|
|
10
|
+
import { usePassportContext } from "../../../hooks/usePassportContext"
|
|
11
|
+
import { getAddressExplorerUrl, trimAddress } from "../../../utils/address"
|
|
12
|
+
import { getCryptoAsset } from "../../../utils/cryptoAssets"
|
|
13
|
+
|
|
14
|
+
type WalletAddressProps = {
|
|
15
|
+
address: string
|
|
16
|
+
type: "bitcoin" | "evm"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default function WalletAddress(props: WalletAddressProps) {
|
|
20
|
+
const { address, type } = props
|
|
21
|
+
|
|
22
|
+
const { environment } = usePassportContext()
|
|
23
|
+
const blockExplorerUrl = getAddressExplorerUrl(
|
|
24
|
+
address,
|
|
25
|
+
type,
|
|
26
|
+
environment === "testnet",
|
|
27
|
+
)
|
|
28
|
+
const trimmedAddress = trimAddress(address)
|
|
29
|
+
const { icon: accountIcon } = getCryptoAsset(
|
|
30
|
+
type === "bitcoin" ? "BTC" : "ETH",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
const [, theme] = useStyletron()
|
|
34
|
+
|
|
35
|
+
const [, copy] = useCopyToClipboard()
|
|
36
|
+
const [isCopiedMessageVisible, setIsCopiedMessageVisible] = useState(false)
|
|
37
|
+
const handleCopyAddress = useCallback(() => {
|
|
38
|
+
copy(address)
|
|
39
|
+
setIsCopiedMessageVisible(true)
|
|
40
|
+
|
|
41
|
+
setTimeout(() => {
|
|
42
|
+
setIsCopiedMessageVisible(false)
|
|
43
|
+
}, 2000)
|
|
44
|
+
}, [copy, address])
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<Block
|
|
48
|
+
as="button"
|
|
49
|
+
onClick={handleCopyAddress}
|
|
50
|
+
display="flex"
|
|
51
|
+
alignItems="center"
|
|
52
|
+
backgroundColor="transparent"
|
|
53
|
+
padding={`${theme.sizing.scale600} ${theme.sizing.scale500}`}
|
|
54
|
+
overrides={{
|
|
55
|
+
Block: {
|
|
56
|
+
style: {
|
|
57
|
+
borderWidth: 0,
|
|
58
|
+
cursor: "pointer",
|
|
59
|
+
":hover": {
|
|
60
|
+
backgroundColor: theme.colors.backgroundTertiary,
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}}
|
|
65
|
+
>
|
|
66
|
+
<Block as={accountIcon} size={theme.sizing.scale600} />
|
|
67
|
+
{isCopiedMessageVisible ? (
|
|
68
|
+
<ParagraphSmall
|
|
69
|
+
margin={0}
|
|
70
|
+
marginLeft={theme.sizing.scale500}
|
|
71
|
+
color={theme.colors.contentPrimary}
|
|
72
|
+
>
|
|
73
|
+
Copied address to clipboard
|
|
74
|
+
</ParagraphSmall>
|
|
75
|
+
) : (
|
|
76
|
+
<Block
|
|
77
|
+
as="a"
|
|
78
|
+
marginLeft={theme.sizing.scale500}
|
|
79
|
+
href={blockExplorerUrl}
|
|
80
|
+
target="_blank"
|
|
81
|
+
overrides={{
|
|
82
|
+
Block: {
|
|
83
|
+
style: {
|
|
84
|
+
color: "inherit",
|
|
85
|
+
textDecoration: "none",
|
|
86
|
+
":hover": {
|
|
87
|
+
textDecoration: "underline",
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
}}
|
|
92
|
+
>
|
|
93
|
+
<ParagraphSmall
|
|
94
|
+
display="flex"
|
|
95
|
+
alignItems="center"
|
|
96
|
+
margin={0}
|
|
97
|
+
color={theme.colors.contentPrimary}
|
|
98
|
+
>
|
|
99
|
+
{trimmedAddress}
|
|
100
|
+
<LinkIcon
|
|
101
|
+
display="inline"
|
|
102
|
+
size={theme.sizing.scale550}
|
|
103
|
+
overrides={{
|
|
104
|
+
Svg: {
|
|
105
|
+
style: {
|
|
106
|
+
stroke: "currentColor",
|
|
107
|
+
marginLeft: theme.sizing.scale300,
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
}}
|
|
111
|
+
/>
|
|
112
|
+
</ParagraphSmall>
|
|
113
|
+
</Block>
|
|
114
|
+
)}
|
|
115
|
+
<CopyIcon
|
|
116
|
+
size={theme.sizing.scale550}
|
|
117
|
+
color={theme.colors.contentPrimary}
|
|
118
|
+
overrides={{
|
|
119
|
+
Svg: {
|
|
120
|
+
style: {
|
|
121
|
+
marginLeft: "auto",
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
}}
|
|
125
|
+
/>
|
|
126
|
+
</Block>
|
|
127
|
+
)
|
|
128
|
+
}
|
|
@@ -6,14 +6,13 @@ import {
|
|
|
6
6
|
useStyletron,
|
|
7
7
|
} from "@mezo-org/mezo-clay"
|
|
8
8
|
import React from "react"
|
|
9
|
-
import DefaultAvatar from "
|
|
10
|
-
import { formatHumanReadableNumber } from "../../utils/numbers"
|
|
9
|
+
import DefaultAvatar from "../../../assets/DefaultAvatar"
|
|
11
10
|
|
|
12
11
|
const DOT_DELIMITER_REGEX = /(?=\.)/
|
|
13
12
|
|
|
14
13
|
type WelcomeBlockProps = {
|
|
15
14
|
mezoId: string
|
|
16
|
-
matsBalance:
|
|
15
|
+
matsBalance: string
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
export default function WelcomeBlock(props: WelcomeBlockProps) {
|
|
@@ -75,16 +74,16 @@ export default function WelcomeBlock(props: WelcomeBlockProps) {
|
|
|
75
74
|
overrides={{
|
|
76
75
|
Block: {
|
|
77
76
|
style: {
|
|
78
|
-
gap: theme.sizing.
|
|
77
|
+
gap: theme.sizing.scale400,
|
|
79
78
|
},
|
|
80
79
|
},
|
|
81
80
|
}}
|
|
82
81
|
>
|
|
83
82
|
<Mats
|
|
84
83
|
color={theme.colors.contentPrimary}
|
|
85
|
-
size={theme.sizing.
|
|
84
|
+
size={theme.sizing.scale500}
|
|
86
85
|
/>
|
|
87
|
-
{
|
|
86
|
+
{matsBalance} mats
|
|
88
87
|
</LabelSmall>
|
|
89
88
|
</Block>
|
|
90
89
|
</Block>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import {
|
|
3
|
+
Block,
|
|
4
|
+
InfoCircle,
|
|
5
|
+
LabelSmall,
|
|
6
|
+
useStyletron,
|
|
7
|
+
} from "@mezo-org/mezo-clay"
|
|
8
|
+
import { usePassportContext } from "../../hooks/usePassportContext"
|
|
9
|
+
|
|
10
|
+
export default function TestnetTopBanner() {
|
|
11
|
+
const [, theme] = useStyletron()
|
|
12
|
+
|
|
13
|
+
const { environment } = usePassportContext()
|
|
14
|
+
|
|
15
|
+
if (environment !== "testnet") {
|
|
16
|
+
return null
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Block
|
|
21
|
+
display="flex"
|
|
22
|
+
alignItems="center"
|
|
23
|
+
padding={`${theme.sizing.scale700} ${theme.sizing.scale600}`}
|
|
24
|
+
backgroundColor={theme.colors.warning}
|
|
25
|
+
>
|
|
26
|
+
<InfoCircle size={theme.sizing.scale550} />
|
|
27
|
+
<LabelSmall marginLeft={theme.sizing.scale500}>
|
|
28
|
+
You are using testnet funds.
|
|
29
|
+
</LabelSmall>
|
|
30
|
+
</Block>
|
|
31
|
+
)
|
|
32
|
+
}
|
package/src/config.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { http } from "viem"
|
|
2
1
|
import { Chain, getDefaultConfig, WalletList } from "@rainbow-me/rainbowkit"
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import {
|
|
3
|
+
Config,
|
|
4
|
+
createConfig,
|
|
5
|
+
CreateConfigParameters,
|
|
6
|
+
http,
|
|
7
|
+
webSocket,
|
|
8
|
+
} from "wagmi"
|
|
9
|
+
import { CHAIN_ID, mezoMainnet, mezoTestnet, RPC_BY_NETWORK } from "./constants"
|
|
5
10
|
import { getOKXWallet, getUnisatWallet, getXverseWallet } from "./wallet"
|
|
6
11
|
|
|
7
12
|
type WagmiConfigParameters = Omit<
|
|
@@ -10,6 +15,7 @@ type WagmiConfigParameters = Omit<
|
|
|
10
15
|
>
|
|
11
16
|
type GetDefaultConfigParameters = WagmiConfigParameters & {
|
|
12
17
|
appName: string
|
|
18
|
+
mezoNetwork?: "mainnet" | "testnet"
|
|
13
19
|
appDescription?: string
|
|
14
20
|
appUrl?: string
|
|
15
21
|
appIcon?: string
|
|
@@ -20,7 +26,8 @@ type GetDefaultConfigParameters = WagmiConfigParameters & {
|
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
const transports = {
|
|
23
|
-
[CHAIN_ID.
|
|
29
|
+
[CHAIN_ID.mainnet]: http(RPC_BY_NETWORK.mainnet.http),
|
|
30
|
+
[CHAIN_ID.testnet]: http(RPC_BY_NETWORK.testnet.http),
|
|
24
31
|
} as Pick<CreateConfigParameters, "transports">
|
|
25
32
|
|
|
26
33
|
export const defaultConfig: Required<
|
|
@@ -34,39 +41,85 @@ export const defaultConfig: Required<
|
|
|
34
41
|
> = {
|
|
35
42
|
transports,
|
|
36
43
|
walletConnectProjectId: "",
|
|
37
|
-
chains: [
|
|
44
|
+
chains: [mezoMainnet, mezoTestnet],
|
|
38
45
|
multiInjectedProviderDiscovery: true,
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
const
|
|
42
|
-
rpcUrl: RPC_BY_NETWORK.testnet,
|
|
48
|
+
const bitcoinWalletTestnetConfig = {
|
|
49
|
+
rpcUrl: RPC_BY_NETWORK.testnet.http,
|
|
43
50
|
chainId: CHAIN_ID.testnet,
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
53
|
+
const bitcoinWalletMainnetConfig = {
|
|
54
|
+
rpcUrl: RPC_BY_NETWORK.mainnet.http,
|
|
55
|
+
chainId: CHAIN_ID.mainnet,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const unisatWalletMezoTestnet = getUnisatWallet(
|
|
59
|
+
bitcoinWalletTestnetConfig,
|
|
60
|
+
)
|
|
61
|
+
export const okxWalletMezoTestnet = getOKXWallet(bitcoinWalletTestnetConfig)
|
|
62
|
+
export const xverseWalletMezoTestnet = getXverseWallet(
|
|
63
|
+
bitcoinWalletTestnetConfig,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
export const unisatWalletMezoMainnet = getUnisatWallet(
|
|
67
|
+
bitcoinWalletMainnetConfig,
|
|
68
|
+
)
|
|
69
|
+
export const okxWalletMezoMainnet = getOKXWallet(bitcoinWalletMainnetConfig)
|
|
70
|
+
export const xverseWalletMezoMainnet = getXverseWallet(
|
|
71
|
+
bitcoinWalletMainnetConfig,
|
|
72
|
+
)
|
|
49
73
|
|
|
50
|
-
export function getDefaultWallets(
|
|
74
|
+
export function getDefaultWallets(
|
|
75
|
+
network: "mainnet" | "testnet" = "mainnet",
|
|
76
|
+
): WalletList {
|
|
51
77
|
return [
|
|
52
78
|
{
|
|
53
79
|
groupName: "Bitcoin",
|
|
54
|
-
wallets:
|
|
80
|
+
wallets:
|
|
81
|
+
network === "mainnet"
|
|
82
|
+
? [
|
|
83
|
+
unisatWalletMezoMainnet,
|
|
84
|
+
okxWalletMezoMainnet,
|
|
85
|
+
xverseWalletMezoMainnet,
|
|
86
|
+
]
|
|
87
|
+
: [
|
|
88
|
+
unisatWalletMezoTestnet,
|
|
89
|
+
okxWalletMezoTestnet,
|
|
90
|
+
xverseWalletMezoTestnet,
|
|
91
|
+
],
|
|
55
92
|
},
|
|
56
93
|
]
|
|
57
94
|
}
|
|
58
95
|
|
|
59
|
-
export function getConfig({
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
96
|
+
export function getConfig(config: GetDefaultConfigParameters): Config {
|
|
97
|
+
const {
|
|
98
|
+
appName,
|
|
99
|
+
mezoNetwork = "mainnet",
|
|
100
|
+
walletConnectProjectId = defaultConfig.walletConnectProjectId,
|
|
101
|
+
...restParameters
|
|
102
|
+
} = config
|
|
103
|
+
|
|
104
|
+
const wallets = config.bitcoinWallets ?? [...getDefaultWallets(mezoNetwork)]
|
|
105
|
+
|
|
65
106
|
return getDefaultConfig({
|
|
66
107
|
...defaultConfig,
|
|
67
108
|
appName,
|
|
68
|
-
wallets
|
|
69
|
-
projectId: walletConnectProjectId
|
|
109
|
+
wallets,
|
|
110
|
+
projectId: walletConnectProjectId,
|
|
70
111
|
...restParameters,
|
|
71
112
|
})
|
|
72
113
|
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* This config is only used to listen for Transfer events on mezo chain.
|
|
117
|
+
* Should not be exported in index for public use.
|
|
118
|
+
*/
|
|
119
|
+
export const simpleWssMezoConfig = createConfig({
|
|
120
|
+
chains: [mezoMainnet, mezoTestnet],
|
|
121
|
+
transports: {
|
|
122
|
+
[mezoMainnet.id]: webSocket(RPC_BY_NETWORK.mainnet.webSocket),
|
|
123
|
+
[mezoTestnet.id]: webSocket(RPC_BY_NETWORK.testnet.webSocket),
|
|
124
|
+
},
|
|
125
|
+
})
|