@mezo-org/passport 0.4.0-dev.9 → 0.5.1-dev.0
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 +4 -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 +9 -6
- package/dist/src/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/src/components/Dropdown/Dropdown.js +10 -10
- package/dist/src/components/Dropdown/Dropdown.js.map +1 -1
- package/dist/src/components/Dropdown/ListingItem.d.ts +14 -0
- package/dist/src/components/Dropdown/ListingItem.d.ts.map +1 -0
- package/dist/src/components/Dropdown/ListingItem.js +42 -0
- package/dist/src/components/Dropdown/ListingItem.js.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts +8 -0
- package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +1 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js +32 -0
- package/dist/src/components/Dropdown/NestedViewLayout.js.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts +4 -0
- package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Receive/Receive.js +64 -0
- package/dist/src/components/Dropdown/Receive/Receive.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +4 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js +49 -0
- package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +6 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js +35 -0
- package/dist/src/components/Dropdown/Root/AccountBalance.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +6 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.js +27 -0
- package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountError.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountError.js +17 -0
- package/dist/src/components/Dropdown/Root/AccountError.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +4 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js +21 -0
- package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +43 -0
- package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts +8 -0
- package/dist/src/components/Dropdown/Root/Root.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/Root.js +45 -0
- package/dist/src/components/Dropdown/Root/Root.js.map +1 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +4 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.js +66 -0
- package/dist/src/components/Dropdown/Root/WalletAddress.js.map +1 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +6 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +1 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.js +88 -0
- package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +1 -0
- package/dist/src/components/Dropdown/SlotNumber.d.ts +19 -0
- package/dist/src/components/Dropdown/SlotNumber.d.ts.map +1 -0
- package/dist/src/components/Dropdown/SlotNumber.js +67 -0
- package/dist/src/components/Dropdown/SlotNumber.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 +19 -5
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +58 -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 +18 -0
- package/dist/src/hooks/useAssetsConversionRates.d.ts.map +1 -0
- package/dist/src/hooks/useAssetsConversionRates.js +67 -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 +9 -8
- package/dist/src/hooks/useAuthenticateWithWallet.js.map +1 -1
- package/dist/src/hooks/useBorrowData.d.ts +108 -0
- package/dist/src/hooks/useBorrowData.d.ts.map +1 -0
- package/dist/src/hooks/useBorrowData.js +201 -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/useGetCurrentAccount.d.ts.map +1 -1
- package/dist/src/hooks/useGetCurrentAccount.js +4 -6
- package/dist/src/hooks/useGetCurrentAccount.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 +75 -0
- package/dist/src/hooks/useTokensBalances.d.ts.map +1 -0
- package/dist/src/hooks/useTokensBalances.js +181 -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 +20 -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 +66 -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.d.ts +7 -1
- package/dist/src/provider.d.ts.map +1 -1
- package/dist/src/provider.js +4 -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/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/dist/src/utils/currency.d.ts +13 -2
- package/dist/src/utils/currency.d.ts.map +1 -1
- package/dist/src/utils/currency.js +22 -8
- package/dist/src/utils/currency.js.map +1 -1
- package/dist/src/utils/currency.test.js +44 -1
- 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/number2.d.ts +106 -0
- package/dist/src/utils/number2.d.ts.map +1 -0
- package/dist/src/utils/number2.js +289 -0
- package/dist/src/utils/number2.js.map +1 -0
- package/dist/src/utils/numbers.d.ts +15 -33
- package/dist/src/utils/numbers.d.ts.map +1 -1
- package/dist/src/utils/numbers.js +26 -70
- package/dist/src/utils/numbers.js.map +1 -1
- package/dist/src/utils/numbers.test.js +46 -42
- 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 +11 -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 +26 -121
- package/src/components/Dropdown/DisconnectedTrigger.tsx +2 -1
- package/src/components/Dropdown/Dropdown.tsx +29 -17
- package/src/components/Dropdown/ListingItem.tsx +176 -0
- package/src/components/Dropdown/NestedViewLayout.tsx +87 -0
- package/src/components/Dropdown/README.md +10 -18
- package/src/components/Dropdown/Receive/Receive.tsx +144 -0
- package/src/components/Dropdown/Root/AccountAddressActions.tsx +99 -0
- package/src/components/Dropdown/Root/AccountBalance.tsx +75 -0
- package/src/components/Dropdown/Root/AccountBtcListing.tsx +52 -0
- package/src/components/Dropdown/Root/AccountError.tsx +34 -0
- package/src/components/Dropdown/Root/AccountMusdListing.tsx +45 -0
- package/src/components/Dropdown/Root/AccountOtherAssets.tsx +85 -0
- package/src/components/Dropdown/Root/Root.tsx +77 -0
- package/src/components/Dropdown/Root/WalletAddress.tsx +123 -0
- package/src/components/Dropdown/Root/WelcomeBlock.tsx +173 -0
- package/src/components/Dropdown/SlotNumber.tsx +131 -0
- package/src/components/Dropdown/TestnetTopBanner.tsx +32 -0
- package/src/config.ts +88 -20
- package/src/constants.ts +12 -4
- package/src/hooks/index.ts +7 -0
- package/src/hooks/useAssetsConversionRates.ts +79 -0
- package/src/hooks/useAuthenticateWithWallet.ts +30 -14
- package/src/hooks/useBorrowData.ts +246 -0
- package/src/hooks/useCreateAccount.ts +29 -2
- package/src/hooks/useGetCurrentAccount.ts +5 -7
- package/src/hooks/useLinkAccount.ts +37 -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 +265 -0
- package/src/hooks/useValidateMezoId.ts +31 -0
- package/src/hooks/useWalletAccount.ts +32 -20
- package/src/hooks/useWatchTransferEvents.ts +74 -0
- package/src/index.ts +12 -1
- package/src/lib/contracts/index.ts +99 -0
- package/src/lib/contracts/priceOracle.ts +53 -0
- package/src/provider.ts +11 -3
- 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/assets.test.ts +57 -0
- package/src/utils/assets.ts +103 -0
- package/src/utils/currency.test.ts +77 -1
- package/src/utils/currency.ts +35 -9
- package/src/utils/mezoId.ts +51 -0
- package/src/utils/number2.ts +419 -0
- package/src/utils/numbers.test.ts +49 -42
- package/src/utils/numbers.ts +33 -95
- 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 +0 -58
- 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 +0 -7
- 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 +0 -8
- package/dist/src/components/Dropdown/WelcomeBlock.d.ts.map +0 -1
- package/dist/src/components/Dropdown/WelcomeBlock.js +0 -44
- 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/dist/src/hooks/useDropdownData.d.ts +0 -44
- package/dist/src/hooks/useDropdownData.d.ts.map +0 -1
- package/dist/src/hooks/useDropdownData.js +0 -73
- package/dist/src/hooks/useDropdownData.js.map +0 -1
- package/dist/src/utils/cryptoAssets.d.ts +0 -28
- package/dist/src/utils/cryptoAssets.d.ts.map +0 -1
- package/dist/src/utils/cryptoAssets.js +0 -73
- package/dist/src/utils/cryptoAssets.js.map +0 -1
- package/dist/src/utils/cryptoAssets.test.d.ts +0 -2
- package/dist/src/utils/cryptoAssets.test.d.ts.map +0 -1
- package/dist/src/utils/cryptoAssets.test.js +0 -49
- package/dist/src/utils/cryptoAssets.test.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/components/Dropdown/WelcomeBlock.tsx +0 -92
- package/src/hooks/useAssetsUSDConversion.ts +0 -31
- package/src/hooks/useDropdownData.ts +0 -130
- package/src/utils/cryptoAssets.test.ts +0 -59
- package/src/utils/cryptoAssets.ts +0 -93
package/README.md
CHANGED
|
@@ -96,12 +96,12 @@ Mezo Passport provides a `getConfig` method, which returns a default
|
|
|
96
96
|
configuration for Mezo Matsnet. We just have to pass it further to
|
|
97
97
|
`WagmiProvider`:
|
|
98
98
|
|
|
99
|
-
```
|
|
99
|
+
```tsx
|
|
100
100
|
import { RainbowKitProvider } from "@rainbow-me/rainbowkit"
|
|
101
101
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
|
|
102
102
|
import { WagmiProvider } from "wagmi"
|
|
103
103
|
import "@rainbow-me/rainbowkit/styles.css"
|
|
104
|
-
import { getConfig,
|
|
104
|
+
import { getConfig, mezoTestnet } from "@mezo-org/passport"
|
|
105
105
|
|
|
106
106
|
const queryClient = new QueryClient()
|
|
107
107
|
|
|
@@ -109,7 +109,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
|
109
109
|
<React.StrictMode>
|
|
110
110
|
<WagmiProvider config={getConfig({ appName: "Your app name" })}>
|
|
111
111
|
<QueryClientProvider client={queryClient}>
|
|
112
|
-
<RainbowKitProvider initialChain={
|
|
112
|
+
<RainbowKitProvider initialChain={mezoTestnet}>
|
|
113
113
|
{/* Your App component */}
|
|
114
114
|
</RainbowKitProvider>
|
|
115
115
|
</QueryClientProvider>
|
|
@@ -127,7 +127,7 @@ support. By default, the lib supports Unisat, OKX and Xverse wallets. If you
|
|
|
127
127
|
want to include Unisat wallet only, you can pass it through `bitcoinWallet`
|
|
128
128
|
property to `getConfig` function:
|
|
129
129
|
|
|
130
|
-
```
|
|
130
|
+
```tsx
|
|
131
131
|
import { getConfig, unisatWallet } from "@mezo-org/passport"
|
|
132
132
|
|
|
133
133
|
const customBitcoinWallets = [
|
|
@@ -169,11 +169,8 @@ There are two ways to connect the Mezo Passport wallet:
|
|
|
169
169
|
|
|
170
170
|
We can connect to the specific wallet directly through `wagmi`:
|
|
171
171
|
|
|
172
|
-
```
|
|
173
|
-
import {
|
|
174
|
-
useChainId,
|
|
175
|
-
useConnect,
|
|
176
|
-
} from "wagmi"
|
|
172
|
+
```tsx
|
|
173
|
+
import { useChainId, useConnect } from "wagmi"
|
|
177
174
|
|
|
178
175
|
export const YourApp = () => {
|
|
179
176
|
const chainId = useChainId()
|
|
@@ -194,8 +191,7 @@ export const YourApp = () => {
|
|
|
194
191
|
))}
|
|
195
192
|
</div>
|
|
196
193
|
)
|
|
197
|
-
|
|
198
|
-
};
|
|
194
|
+
}
|
|
199
195
|
```
|
|
200
196
|
|
|
201
197
|
This will render a button for each wallet that we've added to the rainbowKit
|
|
@@ -208,12 +204,12 @@ We can also implement wallet connection through RainbowKit, where we import the
|
|
|
208
204
|
`ConnectButton` component, which will handle the connection process under the
|
|
209
205
|
hood:
|
|
210
206
|
|
|
211
|
-
```
|
|
207
|
+
```tsx
|
|
212
208
|
import { ConnectButton } from "@rainbow-me/rainbowkit"
|
|
213
209
|
|
|
214
210
|
export const YourApp = () => {
|
|
215
|
-
return <ConnectButton label="Connect wallet"
|
|
216
|
-
}
|
|
211
|
+
return <ConnectButton label="Connect wallet" />
|
|
212
|
+
}
|
|
217
213
|
```
|
|
218
214
|
|
|
219
215
|
### Getting addresses and wallet balances
|
|
@@ -224,7 +220,7 @@ For bitcoin account Mezo Passport exports a helper hook -
|
|
|
224
220
|
`useBitcoinAccount()` - which can be used to obtain address and balance of the
|
|
225
221
|
connected bitcoin account:
|
|
226
222
|
|
|
227
|
-
```
|
|
223
|
+
```ts
|
|
228
224
|
import { useBitcoinAccount } from "@mezo-org/passport"
|
|
229
225
|
|
|
230
226
|
const { btcAddress, btcBalance } = useBitcoinAccount()
|
|
@@ -237,7 +233,7 @@ useEffect(() => {
|
|
|
237
233
|
|
|
238
234
|
This hook returns the bitcoin balance in satoshis, in the following format:
|
|
239
235
|
|
|
240
|
-
```
|
|
236
|
+
```ts
|
|
241
237
|
{
|
|
242
238
|
confirmed: number,
|
|
243
239
|
unconfirmed: number,
|
|
@@ -250,7 +246,7 @@ This hook returns the bitcoin balance in satoshis, in the following format:
|
|
|
250
246
|
To get an address and a balance of the underlying Mezo Matsnet account, we can
|
|
251
247
|
use `wagmi` hooks:
|
|
252
248
|
|
|
253
|
-
```
|
|
249
|
+
```ts
|
|
254
250
|
const { address } = useAccount()
|
|
255
251
|
const { data } = useBalance({ address })
|
|
256
252
|
|
|
@@ -265,14 +261,14 @@ useEffect(() => {
|
|
|
265
261
|
The Mezo Passport wallets supports message signing from `wagmi` lib, so signing
|
|
266
262
|
functions the same way as it does in `wagmi`:
|
|
267
263
|
|
|
268
|
-
```
|
|
269
|
-
import { useSignMessage } from
|
|
264
|
+
```tsx
|
|
265
|
+
import { useSignMessage } from "wagmi"
|
|
270
266
|
|
|
271
267
|
function App() {
|
|
272
268
|
const { signMessage } = useSignMessage()
|
|
273
269
|
|
|
274
270
|
return (
|
|
275
|
-
<button onClick={() => signMessage({ message:
|
|
271
|
+
<button onClick={() => signMessage({ message: "hello world" })}>
|
|
276
272
|
Sign message
|
|
277
273
|
</button>
|
|
278
274
|
)
|
|
@@ -286,7 +282,7 @@ Contracts integrations are handled the same way as in RainbowKit and Wagmi.
|
|
|
286
282
|
To send a specific Mezo Matsnet transaction from the underlying Mezo Matsnet
|
|
287
283
|
account, we can use a `useSendTransaction` hook from `@mezo-org/passport`:
|
|
288
284
|
|
|
289
|
-
```
|
|
285
|
+
```ts
|
|
290
286
|
import { useSendTransaction } from "@mezo-org/passport"
|
|
291
287
|
|
|
292
288
|
const { sendTransaction } = useSendTransaction()
|
|
@@ -314,7 +310,7 @@ With `@mezo-org/passport` it's also possible to send BTC transactions from your
|
|
|
314
310
|
original Bitcoin account (not the underlying Mezo Matsnet account). For that, we
|
|
315
311
|
can use `useSendBitcoin` hook:
|
|
316
312
|
|
|
317
|
-
```
|
|
313
|
+
```ts
|
|
318
314
|
import { useSendBitcoin } from "@mezo-org/passport"
|
|
319
315
|
|
|
320
316
|
const { sendBitcoin } = useSendBitcoin()
|
package/dist/src/api/auth.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type Session = {
|
|
|
29
29
|
export type AuthenticationProviderRedirectResponse = {
|
|
30
30
|
redirectTo: string;
|
|
31
31
|
};
|
|
32
|
-
type SignatureData = {
|
|
32
|
+
export type SignatureData = {
|
|
33
33
|
message: string;
|
|
34
34
|
signature: string;
|
|
35
35
|
};
|
|
@@ -52,11 +52,15 @@ export type GetAccountByMezoIdOrAddressResponse = {
|
|
|
52
52
|
type: "wallet";
|
|
53
53
|
}>[];
|
|
54
54
|
};
|
|
55
|
-
export type LinkAccountRequest =
|
|
55
|
+
export type LinkAccountRequest = CreateAccountRequest | {
|
|
56
|
+
type: "discord";
|
|
57
|
+
};
|
|
56
58
|
export type LinkAccountResponse = Account | AuthenticationProviderRedirectResponse;
|
|
57
59
|
export type CreateAccountRequest = {
|
|
58
60
|
type: "wallet";
|
|
59
|
-
} & SignatureData
|
|
61
|
+
} & SignatureData & {
|
|
62
|
+
bitcoinPublicKey?: string;
|
|
63
|
+
};
|
|
60
64
|
export type CreateAccountResponse = Account;
|
|
61
65
|
export type UpdateMezoIdResponse = Account;
|
|
62
66
|
export declare const AUTH_API_ENDPOINTS_BY_ENV: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAGpC,KAAK,YAAY,GAAG,SAAS,CAAA;AAE7B,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,QAAQ,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,YAAY,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,qBAAqB,CAAA;AAEvE,KAAK,OAAO,GAAG;IACb,MAAM,EAAE,MAAM,CAAA;IACd,iBAAiB,EAAE,OAAO,CAAA;IAC1B,cAAc,EAAE,aAAa,EAAE,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,OAAO,GAAG;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE;QACZ,MAAM,EAAE;YACN,OAAO,EAAE,MAAM,CAAA;SAChB,CAAA;KACF,CAAA;CACF,CAAA;AAED,MAAM,MAAM,sCAAsC,GAAG;IACnD,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CA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|
8
8
|
constructor(environment = "mainnet", apiUrl) {
|
|
9
|
-
super(
|
|
9
|
+
super({
|
|
10
|
+
apiUrl: apiUrl ?? AUTH_API_ENDPOINTS_BY_ENV[environment],
|
|
11
|
+
});
|
|
10
12
|
}
|
|
11
13
|
async getSession(code) {
|
|
12
14
|
const data = await this.handleRequest("/session", {
|
package/dist/src/api/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AA2E1C,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,OAAO,EAAE,sBAAsB;IAC/B,OAAO,EAAE,2BAA2B;CACrC,CAAA;AAED,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YACE,cAAsD,SAAS,EAC/D,MAAe;QAEf,KAAK,CAAC;YACJ,MAAM,EAAE,MAAM,IAAI,yBAAyB,CAAC,WAAW,CAAC;SACzD,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAa;QAC5B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAqB,UAAU,EAAE;YACpE,MAAM,EAAE,KAAK;YACb,WAAW,EAAE,EAAE,IAAI,EAAE;SACtB,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,oBAA0C;QAC5D,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAwB,UAAU,EAAE;YACvE,MAAM,EAAE,M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AAoB;SAC3B,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,SAAiB;QAClC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,kBAAkB,EAClB;YACE,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE;SAC5B,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
package/dist/src/api/client.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ type RequestHandlerOptions = Omit<RequestInit, "credentials" | "body"> & {
|
|
|
4
4
|
};
|
|
5
5
|
export declare abstract class ApiClient {
|
|
6
6
|
private apiUrl;
|
|
7
|
-
constructor(
|
|
7
|
+
constructor(opts: {
|
|
8
|
+
apiUrl: string;
|
|
9
|
+
removeVersioning?: boolean;
|
|
10
|
+
});
|
|
8
11
|
/**
|
|
9
12
|
* The request handler for the Passport API. It accepts an API endpoint and
|
|
10
13
|
* request options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,CAAC,GAAG;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjD,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,GAAG,MAAM,CAAC,GAAG;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;CACjD,CAAA;AAKD,8BAAsB,SAAS;IAC7B,OAAO,CAAC,MAAM,CAAQ;gBAEV,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE;IAUhE;;;;;;;;;;;;OAYG;cACa,aAAa,CAAC,CAAC,EAC7B,QAAQ,EAAE,IAAI,MAAM,EAAE,EACtB,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,CAAC,CAAC;CA+Cd"}
|
package/dist/src/api/client.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { FetchError } from "./fetch-error";
|
|
2
|
+
const ENDS_WITH_VERSIONING_REGEX = /\/v\d+(?=\/|$)/;
|
|
3
|
+
const TRAILING_SLASH_REGEX = /\/$/;
|
|
2
4
|
export class ApiClient {
|
|
3
5
|
apiUrl;
|
|
4
|
-
constructor(
|
|
6
|
+
constructor(opts) {
|
|
7
|
+
const { apiUrl, removeVersioning = false } = opts;
|
|
8
|
+
if (removeVersioning) {
|
|
9
|
+
this.apiUrl = apiUrl.replace(ENDS_WITH_VERSIONING_REGEX, "");
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
5
12
|
this.apiUrl = apiUrl;
|
|
6
13
|
}
|
|
7
14
|
/**
|
|
@@ -21,7 +28,7 @@ export class ApiClient {
|
|
|
21
28
|
try {
|
|
22
29
|
const { method, body, queryParams = {}, ...restOptions } = options;
|
|
23
30
|
// If last character in apiUrl is forward slash we are removing it
|
|
24
|
-
const authApiUrlRoute = this.apiUrl.replace(
|
|
31
|
+
const authApiUrlRoute = this.apiUrl.replace(TRAILING_SLASH_REGEX, "");
|
|
25
32
|
const url = new URL(`${authApiUrlRoute}${endpoint}`);
|
|
26
33
|
// Removes falsy values (e.g. null, undefined etc.) from query params and
|
|
27
34
|
// appends remaining ones to the URL
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO1C,MAAM,OAAgB,SAAS;IACrB,MAAM,CAAQ;IAEtB,YAAY,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO1C,MAAM,0BAA0B,GAAG,gBAAgB,CAAA;AACnD,MAAM,oBAAoB,GAAG,KAAK,CAAA;AAElC,MAAM,OAAgB,SAAS;IACrB,MAAM,CAAQ;IAEtB,YAAY,IAAoD;QAC9D,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,KAAK,EAAE,GAAG,IAAI,CAAA;QAEjD,IAAI,gBAAgB,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,0BAA0B,EAAE,EAAE,CAAC,CAAA;YAC5D,OAAM;QACR,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;OAYG;IACO,KAAK,CAAC,aAAa,CAC3B,QAAsB,EACtB,UAAiC,EAAE;QAEnC,IAAI,CAAC;YACH,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,OAAO,CAAA;YAElE,kEAAkE;YAClE,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,oBAAoB,EAAE,EAAE,CAAC,CAAA;YACrE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,eAAe,GAAG,QAAQ,EAAE,CAAC,CAAA;YAEpD,yEAAyE;YACzE,oCAAoC;YACpC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;iBACxB,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CA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tvl: number;
|
|
6
6
|
currentUsdPerBtc: string;
|
|
7
7
|
currentUsdPerEth: string;
|
|
8
|
+
currentUsdPerTToken: string;
|
|
8
9
|
usdPerBtc24hChange: string;
|
|
9
10
|
};
|
|
10
11
|
type PortalMats = {
|
|
11
|
-
address: string;
|
|
12
12
|
totalMats: number;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
matsFromSecondaryReferrals: number;
|
|
16
|
-
netMatsTransferred: number;
|
|
17
|
-
dailyMats: number;
|
|
18
|
-
dailyMatsFromDeposits: number;
|
|
19
|
-
dailyMatsFromReferrals: number;
|
|
20
|
-
dailyMatsFromSecondaryReferrals: number;
|
|
13
|
+
inactiveMats: number;
|
|
14
|
+
matsActivated: boolean;
|
|
21
15
|
};
|
|
22
16
|
export declare const PORTAL_API_ENDPOINTS_BY_ENV: {
|
|
23
17
|
mainnet: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,
|
|
1
|
+
{"version":3,"file":"portal.d.ts","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEpC,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,KAAK,UAAU,GAAG;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,2BAA2B;;;CAGvC,CAAA;AAED,qBAAa,eAAgB,SAAQ,SAAS;gBAE1C,WAAW,GAAE,MAAM,OAAO,2BAAuC,EACjE,MAAM,CAAC,EAAE,MAAM;IAQX,mBAAmB;IAQnB,aAAa,CAAC,OAAO,EAAE,MAAM;CAUpC"}
|
package/dist/src/api/portal.js
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
import { ApiClient } from "./client";
|
|
2
2
|
export const PORTAL_API_ENDPOINTS_BY_ENV = {
|
|
3
|
-
mainnet: "https://api.mezo.org/api/
|
|
4
|
-
testnet: "https://api.test.mezo.org/api/
|
|
3
|
+
mainnet: "https://api.mezo.org/api/",
|
|
4
|
+
testnet: "https://api.test.mezo.org/api/",
|
|
5
5
|
};
|
|
6
6
|
export class PortalApiClient extends ApiClient {
|
|
7
7
|
constructor(environment = "mainnet", apiUrl) {
|
|
8
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
apiUrl: apiUrl ?? PORTAL_API_ENDPOINTS_BY_ENV[environment],
|
|
10
|
+
removeVersioning: true,
|
|
11
|
+
});
|
|
9
12
|
}
|
|
10
13
|
async getPortalStatistics() {
|
|
11
|
-
const data = await this.handleRequest("/statistics", {
|
|
14
|
+
const data = await this.handleRequest("/v1/statistics", {
|
|
12
15
|
method: "GET",
|
|
13
16
|
});
|
|
14
17
|
return data;
|
|
15
18
|
}
|
|
16
19
|
async getPortalMats(address) {
|
|
17
|
-
const data = await this.handleRequest(`/
|
|
20
|
+
const data = await this.handleRequest(`/v2/account/${address}/mats`, {
|
|
18
21
|
method: "GET",
|
|
19
22
|
});
|
|
20
23
|
return data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"portal.js","sourceRoot":"","sources":["../../../src/api/portal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAkBpC,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,OAAO,EAAE,2BAA2B;IACpC,OAAO,EAAE,gCAAgC;CAC1C,CAAA;AAED,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,YACE,cAAwD,SAAS,EACjE,MAAe;QAEf,KAAK,CAAC;YACJ,MAAM,EAAE,MAAM,IAAI,2BAA2B,CAAC,WAAW,CAAC;YAC1D,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CAAmB,gBAAgB,EAAE;YACxE,MAAM,EAAE,KAAK;SACd,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,OAAe;QACjC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,aAAa,CACnC,eAAe,OAAO,OAAO,EAC7B;YACE,MAAM,EAAE,KAAK;SACd,CACF,CAAA;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ButtonProps } from "@mezo-org/mezo-clay";
|
|
2
2
|
import React, { ReactNode } from "react";
|
|
3
|
-
declare const ConnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "children"> & {
|
|
3
|
+
declare const ConnectedTrigger: React.ForwardRefExoticComponent<Omit<ButtonProps, "size" | "children"> & {
|
|
4
4
|
avatar: ReactNode;
|
|
5
|
+
size?: "medium" | "large";
|
|
5
6
|
} & React.RefAttributes<HTMLButtonElement>>;
|
|
6
7
|
export default ConnectedTrigger;
|
|
7
8
|
//# sourceMappingURL=ConnectedTrigger.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAgB,MAAM,qBAAqB,CAAA;AAC9E,OAAO,KAAK,EAAE,EAAc,SAAS,EAAW,MAAM,OAAO,CAAA;AAO7D,QAAA,MAAM,gBAAgB;YAJZ,SAAS;WACV,QAAQ,GAAG,OAAO;2CAoE1B,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,30 +1,39 @@
|
|
|
1
|
-
import { Block, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
-
import React, { forwardRef } from "react";
|
|
1
|
+
import { Block, Button, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { forwardRef, useMemo } from "react";
|
|
3
3
|
const ConnectedTrigger = forwardRef((props, ref) => {
|
|
4
|
-
const { onClick, avatar, ...restProps } = props;
|
|
4
|
+
const { onClick, avatar, size = "medium", ...restProps } = props;
|
|
5
5
|
const [, theme] = useStyletron();
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
const avatarSize = useMemo(() => {
|
|
7
|
+
const sizeMap = {
|
|
8
|
+
medium: theme.sizing.scale950,
|
|
9
|
+
large: theme.sizing.scale1400,
|
|
10
|
+
};
|
|
11
|
+
return sizeMap[size];
|
|
12
|
+
}, [theme, size]);
|
|
13
|
+
const buttonPadding = useMemo(() => {
|
|
14
|
+
const paddingMap = {
|
|
15
|
+
medium: theme.sizing.scale0,
|
|
16
|
+
large: theme.sizing.scale100,
|
|
17
|
+
};
|
|
18
|
+
return paddingMap[size];
|
|
19
|
+
}, [theme, size]);
|
|
20
|
+
return (React.createElement(Button, { overrides: {
|
|
21
|
+
BaseButton: {
|
|
8
22
|
props: { ref, ...restProps },
|
|
9
23
|
style: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
padding:
|
|
13
|
-
margin: 0,
|
|
14
|
-
cursor: "pointer",
|
|
24
|
+
borderRadius: "100%",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
padding: buttonPadding,
|
|
15
27
|
},
|
|
16
28
|
},
|
|
17
|
-
}, onClick: onClick },
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
border: `2px solid ${theme.colors.contentPrimary}`,
|
|
23
|
-
boxSizing: "border-box",
|
|
24
|
-
overflow: "hidden",
|
|
25
|
-
},
|
|
29
|
+
}, onClick: onClick }, typeof avatar === "string" ? (React.createElement(Block, { width: avatarSize, height: avatarSize, as: "img", src: avatar, alt: "" })) : (React.createElement(Block, { width: avatarSize, height: avatarSize, overrides: {
|
|
30
|
+
Block: {
|
|
31
|
+
style: {
|
|
32
|
+
borderRadius: "100%",
|
|
33
|
+
overflow: "hidden",
|
|
26
34
|
},
|
|
27
|
-
}
|
|
35
|
+
},
|
|
36
|
+
} }, avatar))));
|
|
28
37
|
});
|
|
29
38
|
export default ConnectedTrigger;
|
|
30
39
|
//# sourceMappingURL=ConnectedTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAe,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"ConnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/ConnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAe,YAAY,EAAE,MAAM,qBAAqB,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AE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,EAAE,EAAC,KAAK,EACR,GAAG,EAAE,MAAM,EACX,GAAG,EAAC,EAAE,GACN,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,KAAK,IACJ,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,KAAK,EAAE;oBACL,YAAY,EAAE,MAAM;oBACpB,QAAQ,EAAE,QAAQ;iBACnB;aACF;SACF,IAEA,MAAM,CACD,CACT,CACM,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,gBAAgB,CAAA"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
type DropdownContentProps = {
|
|
4
|
-
data: DropdownData;
|
|
2
|
+
type ContentProps = {
|
|
5
3
|
onSignOut?: () => void;
|
|
4
|
+
onOtherAssetsClick?: () => void;
|
|
6
5
|
};
|
|
7
|
-
|
|
8
|
-
export
|
|
6
|
+
declare function Content(props: ContentProps): React.JSX.Element;
|
|
7
|
+
export default Content;
|
|
9
8
|
//# sourceMappingURL=Content.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAMxC,KAAK,YAAY,GAAG;IAClB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAChC,CAAA;AAED,iBAAS,OAAO,CAAC,KAAK,EAAE,YAAY,qBAsCnC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -1,69 +1,27 @@
|
|
|
1
|
-
import { Block,
|
|
2
|
-
import React, {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
} }),
|
|
19
|
-
"Matsnet Assets"));
|
|
20
|
-
}
|
|
21
|
-
export default function DropdownContent(props) {
|
|
22
|
-
const { data, onSignOut } = props;
|
|
23
|
-
const [, theme] = useStyletron();
|
|
24
|
-
const { mezoId, address, walletType, totalBalanceInUsd, formattedNativeAssets, matsnet, } = data;
|
|
25
|
-
const { disconnect } = useDisconnect();
|
|
26
|
-
const { signOut } = useSignOut();
|
|
27
|
-
const handleLogOut = useCallback(() => {
|
|
28
|
-
if (onSignOut) {
|
|
29
|
-
onSignOut();
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
signOut();
|
|
33
|
-
disconnect();
|
|
34
|
-
}, [signOut, disconnect, onSignOut]);
|
|
35
|
-
return (React.createElement(Block, { display: "inline-flex", flexDirection: "column", backgroundColor: theme.colors.backgroundPrimary, padding: theme.sizing.scale500, width: "100%", overrides: {
|
|
1
|
+
import { Block, useStyletron } from "@mezo-org/mezo-clay";
|
|
2
|
+
import React, { useEffect } from "react";
|
|
3
|
+
import useDropdownStore, { DropdownView } from "../../stores/dropdownStore";
|
|
4
|
+
import Root from "./Root/Root";
|
|
5
|
+
import Receive from "./Receive/Receive";
|
|
6
|
+
import TestnetTopBanner from "./TestnetTopBanner";
|
|
7
|
+
function Content(props) {
|
|
8
|
+
const { onSignOut, onOtherAssetsClick } = props;
|
|
9
|
+
const [_, theme] = useStyletron();
|
|
10
|
+
const currentView = useDropdownStore((state) => state.view);
|
|
11
|
+
const setView = useDropdownStore((state) => state.setView);
|
|
12
|
+
useEffect(() => () => {
|
|
13
|
+
setView(DropdownView.ROOT);
|
|
14
|
+
}, [setView]);
|
|
15
|
+
return (React.createElement(Block, { display: "inline-flex", flexDirection: "column", backgroundColor: theme.colors.backgroundPrimary, width: "100%", overrides: {
|
|
36
16
|
Block: {
|
|
37
17
|
style: {
|
|
38
18
|
boxSizing: "border-box",
|
|
39
19
|
},
|
|
40
20
|
},
|
|
41
21
|
} },
|
|
42
|
-
React.createElement(
|
|
43
|
-
React.createElement(
|
|
44
|
-
|
|
45
|
-
} },
|
|
46
|
-
React.createElement(AccountAddress, { address: address, type: walletType }),
|
|
47
|
-
React.createElement(AccountBalance, { amount: totalBalanceInUsd }),
|
|
48
|
-
React.createElement(AccountAssets, { label: "Assets", assets: formattedNativeAssets })),
|
|
49
|
-
matsnet.formattedAssets.length > 0 && (React.createElement(Block, { marginTop: theme.sizing.scale600, backgroundColor: theme.colors.backgroundSecondary, overflow: "hidden", overrides: {
|
|
50
|
-
Block: { style: { borderRadius: theme.borders.radius300 } },
|
|
51
|
-
} },
|
|
52
|
-
React.createElement(AccountAssets, { label: React.createElement(MatsnetLabel, null), assets: matsnet.formattedAssets }))),
|
|
53
|
-
React.createElement(Block, { marginTop: theme.sizing.scale700, padding: `0 ${theme.sizing.scale100}` },
|
|
54
|
-
React.createElement(Button, { size: "small", kind: "tertiary", startEnhancer: React.createElement(LogOut01, { color: "currentColor", size: 12 }), onClick: () => handleLogOut(), overrides: {
|
|
55
|
-
Root: {
|
|
56
|
-
style: {
|
|
57
|
-
":hover": {
|
|
58
|
-
backgroundColor: theme.colors.backgroundSecondary,
|
|
59
|
-
boxShadow: "none",
|
|
60
|
-
},
|
|
61
|
-
":active": {
|
|
62
|
-
backgroundColor: theme.colors.backgroundSecondary,
|
|
63
|
-
color: theme.colors.contentPrimary,
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
} }, "Log out"))));
|
|
22
|
+
React.createElement(TestnetTopBanner, null),
|
|
23
|
+
currentView === DropdownView.ROOT && (React.createElement(Root, { onSignOut: onSignOut, onOtherAssetsClick: onOtherAssetsClick })),
|
|
24
|
+
currentView === DropdownView.RECEIVE && React.createElement(Receive, null)));
|
|
68
25
|
}
|
|
26
|
+
export default Content;
|
|
69
27
|
//# sourceMappingURL=Content.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Content.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/Content.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,gBAAgB,EAAE,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC3E,OAAO,IAAI,MAAM,aAAa,CAAA;AAC9B,OAAO,OAAO,MAAM,mBAAmB,CAAA;AACvC,OAAO,gBAAgB,MAAM,oBAAoB,CAAA;AAOjD,SAAS,OAAO,CAAC,KAAmB;IAClC,MAAM,EAAE,SAAS,EAAE,kBAAkB,EAAE,GAAG,KAAK,CAAA;IAE/C,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEjC,MAAM,WAAW,GAAG,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAC3D,MAAM,OAAO,GAAG,gBAAgB,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;IAE1D,SAAS,CACP,GAAG,EAAE,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC,EACD,CAAC,OAAO,CAAC,CACV,CAAA;IAED,OAAO,CACL,oBAAC,KAAK,IACJ,OAAO,EAAC,aAAa,EACrB,aAAa,EAAC,QAAQ,EACtB,eAAe,EAAE,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAC/C,KAAK,EAAC,MAAM,EACZ,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,KAAK,EAAE;oBACL,SAAS,EAAE,YAAY;iBACxB;aACF;SACF;QAED,oBAAC,gBAAgB,OAAG;QAEnB,WAAW,KAAK,YAAY,CAAC,IAAI,IAAI,CACpC,oBAAC,IAAI,IAAC,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,kBAAkB,GAAI,CACvE;QAEA,WAAW,KAAK,YAAY,CAAC,OAAO,IAAI,oBAAC,OAAO,OAAG,CAC9C,CACT,CAAA;AACH,CAAC;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisconnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAAyB,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,QAAA,MAAM,mBAAmB;cAHb,MAAM;
|
|
1
|
+
{"version":3,"file":"DisconnectedTrigger.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAU,WAAW,EAAyB,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAqB,MAAM,OAAO,CAAA;AAMzC,QAAA,MAAM,mBAAmB;cAHb,MAAM;2CA6BhB,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
|
@@ -5,9 +5,9 @@ const DisconnectedTrigger = forwardRef((props, ref) => {
|
|
|
5
5
|
const [, theme] = useStyletron();
|
|
6
6
|
return (React.createElement(Button, { startEnhancer: React.createElement(LogIn01, { color: "currentColor", size: theme.sizing.scale600 }), overrides: {
|
|
7
7
|
Root: {
|
|
8
|
-
props: { ref
|
|
8
|
+
props: { ref },
|
|
9
9
|
},
|
|
10
|
-
}, size: "small", shape: "pill", onClick: onClick }, children));
|
|
10
|
+
}, size: "small", shape: "pill", onClick: onClick, ...restProps }, children));
|
|
11
11
|
});
|
|
12
12
|
export default DisconnectedTrigger;
|
|
13
13
|
//# sourceMappingURL=DisconnectedTrigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DisconnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAMzC,MAAM,mBAAmB,GAAG,UAAU,CAGpC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAEjD,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,MAAM,IACL,aAAa,EACX,oBAAC,OAAO,IAAC,KAAK,EAAC,cAAc,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAI,EAE/D,SAAS,EAAE;YACT,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE,GAAG,EAAE
|
|
1
|
+
{"version":3,"file":"DisconnectedTrigger.js","sourceRoot":"","sources":["../../../../src/components/Dropdown/DisconnectedTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAChF,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAMzC,MAAM,mBAAmB,GAAG,UAAU,CAGpC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACf,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAA;IAEjD,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,CACL,oBAAC,MAAM,IACL,aAAa,EACX,oBAAC,OAAO,IAAC,KAAK,EAAC,cAAc,EAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,QAAQ,GAAI,EAE/D,SAAS,EAAE;YACT,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE,GAAG,EAAE;aACf;SACF,EACD,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,MAAM,EACZ,OAAO,EAAE,OAAO,KACZ,SAAS,IAEZ,QAAQ,CACF,CACV,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { StatefulPopoverProps } from "@mezo-org/mezo-clay";
|
|
1
|
+
import { ButtonProps, StatefulPopoverProps } from "@mezo-org/mezo-clay";
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { DropdownCryptoAsset } from "../../hooks/useDropdownData";
|
|
4
3
|
export type DropdownProps = {
|
|
5
4
|
/** The callback to be called when the user clicks the sign-out button */
|
|
6
5
|
onSignOut?: () => void;
|
|
7
6
|
/** The callback to be called when the user clicks the button in sign-in state */
|
|
8
7
|
onSignIn?: () => void;
|
|
9
|
-
/** The
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
/** The props to be passed to the trigger button */
|
|
9
|
+
triggerProps?: {
|
|
10
|
+
signedIn?: Omit<ButtonProps, "onClick" | "size"> & {
|
|
11
|
+
size: "medium" | "large";
|
|
12
|
+
};
|
|
13
|
+
signedOut?: Omit<ButtonProps, "onClick">;
|
|
14
|
+
};
|
|
15
|
+
onOtherAssetsClick?: () => void;
|
|
13
16
|
} & Omit<StatefulPopoverProps, "children" | "content">;
|
|
14
17
|
/**
|
|
15
18
|
* Passport Dropdown component that displays user's wallet and assets information.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/Dropdown/Dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,oBAAoB,EAErB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,MAAM,MAAM,aAAa,GAAG;IAC1B,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,mDAAmD;IACnD,YAAY,CAAC,EAAE;QACb,QAAQ,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAAC,GAAG;YACjD,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAA;SACzB,CAAA;QACD,SAAS,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,CAAA;KACzC,CAAA;IACD,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAA;CAChC,GAAG,IAAI,CAAC,oBAAoB,EAAE,UAAU,GAAG,SAAS,CAAC,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,qBAgE5C"}
|