@mysten/dapp-kit 0.3.0 → 0.5.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/CHANGELOG.md +12 -0
- package/README.md +4 -4
- package/dist/cjs/components/AccountDropdownMenu.d.ts +4 -0
- package/dist/cjs/components/AccountDropdownMenu.js +116 -42
- package/dist/cjs/components/AccountDropdownMenu.js.map +4 -4
- package/dist/cjs/components/ConnectButton.js +183 -110
- package/dist/cjs/components/ConnectButton.js.map +4 -4
- package/dist/cjs/components/SuiClientProvider.d.ts +4 -4
- package/dist/cjs/components/SuiClientProvider.js +1 -0
- package/dist/cjs/components/SuiClientProvider.js.map +2 -2
- package/dist/cjs/components/WalletProvider.js +1 -2
- package/dist/cjs/components/WalletProvider.js.map +2 -2
- package/dist/cjs/hooks/networkConfig.d.ts +10 -0
- package/dist/cjs/hooks/networkConfig.js +74 -0
- package/dist/cjs/hooks/networkConfig.js.map +7 -0
- package/dist/cjs/hooks/useResolveSuiNSNames.d.ts +107 -0
- package/dist/cjs/hooks/useResolveSuiNSNames.js +83 -0
- package/dist/cjs/hooks/useResolveSuiNSNames.js.map +7 -0
- package/dist/cjs/hooks/useSuiClient.js.map +2 -2
- package/dist/cjs/hooks/useSuiClientInfiniteQuery.js.map +2 -2
- package/dist/cjs/hooks/useSuiClientMutation.js.map +2 -2
- package/dist/cjs/hooks/useSuiClientQuery.js.map +2 -2
- package/dist/cjs/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
- package/dist/cjs/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
- package/dist/cjs/index.css +127 -127
- package/dist/cjs/index.css.map +3 -3
- package/dist/cjs/index.d.ts +13 -10
- package/dist/cjs/index.js +594 -529
- package/dist/cjs/index.js.map +4 -4
- package/dist/cjs/walletStore.js +1 -2
- package/dist/cjs/walletStore.js.map +2 -2
- package/dist/esm/components/AccountDropdownMenu.d.ts +4 -0
- package/dist/esm/components/AccountDropdownMenu.js +106 -32
- package/dist/esm/components/AccountDropdownMenu.js.map +4 -4
- package/dist/esm/components/ConnectButton.js +156 -83
- package/dist/esm/components/ConnectButton.js.map +4 -4
- package/dist/esm/components/SuiClientProvider.d.ts +4 -4
- package/dist/esm/components/SuiClientProvider.js +1 -0
- package/dist/esm/components/SuiClientProvider.js.map +2 -2
- package/dist/esm/components/WalletProvider.js +1 -2
- package/dist/esm/components/WalletProvider.js.map +2 -2
- package/dist/esm/hooks/networkConfig.d.ts +10 -0
- package/dist/esm/hooks/networkConfig.js +51 -0
- package/dist/esm/hooks/networkConfig.js.map +7 -0
- package/dist/esm/hooks/useResolveSuiNSNames.d.ts +107 -0
- package/dist/esm/hooks/useResolveSuiNSNames.js +60 -0
- package/dist/esm/hooks/useResolveSuiNSNames.js.map +7 -0
- package/dist/esm/hooks/useSuiClient.js.map +2 -2
- package/dist/esm/hooks/useSuiClientInfiniteQuery.js.map +2 -2
- package/dist/esm/hooks/useSuiClientMutation.js.map +2 -2
- package/dist/esm/hooks/useSuiClientQuery.js.map +2 -2
- package/dist/esm/hooks/wallet/useSignAndExecuteTransactionBlock.js.map +2 -2
- package/dist/esm/hooks/wallet/useUnsafeBurnerWallet.js.map +2 -2
- package/dist/esm/index.css +127 -127
- package/dist/esm/index.css.map +3 -3
- package/dist/esm/index.d.ts +13 -10
- package/dist/esm/index.js +609 -544
- package/dist/esm/index.js.map +4 -4
- package/dist/esm/walletStore.js +1 -2
- package/dist/esm/walletStore.js.map +2 -2
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/AccountDropdownMenu.tsx +31 -9
- package/src/components/SuiClientProvider.tsx +11 -2
- package/src/hooks/networkConfig.ts +45 -0
- package/src/hooks/useResolveSuiNSNames.ts +31 -0
- package/src/index.ts +13 -10
- package/src/walletStore.ts +3 -4
package/dist/cjs/walletStore.js
CHANGED
|
@@ -79,10 +79,9 @@ function createWalletStore({ wallets, storage, storageKey }) {
|
|
|
79
79
|
},
|
|
80
80
|
updateWalletAccounts(accounts) {
|
|
81
81
|
const currentAccount = get().currentAccount;
|
|
82
|
-
const isCurrentAccountStillAuthorized = currentAccount ? accounts.some(({ address }) => address === currentAccount.address) : false;
|
|
83
82
|
set(() => ({
|
|
84
83
|
accounts,
|
|
85
|
-
currentAccount:
|
|
84
|
+
currentAccount: currentAccount ? accounts.find(({ address }) => address === currentAccount.address) : accounts[0]
|
|
86
85
|
}));
|
|
87
86
|
}
|
|
88
87
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/walletStore.ts"],
|
|
4
|
-
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Wallet, WalletAccount, WalletWithRequiredFeatures } from '@mysten/wallet-standard';\nimport { createStore } from 'zustand';\nimport type { StateStorage } from 'zustand/middleware';\nimport { createJSONStorage, persist } from 'zustand/middleware';\n\nexport type WalletActions = {\n\tsetAccountSwitched: (selectedAccount: WalletAccount) => void;\n\tsetWalletConnected: (\n\t\twallet: WalletWithRequiredFeatures,\n\t\tconnectedAccounts: readonly WalletAccount[],\n\t\tselectedAccount: WalletAccount | null,\n\t) => void;\n\tupdateWalletAccounts: (accounts: readonly WalletAccount[]) => void;\n\tsetWalletDisconnected: () => void;\n\tsetWalletRegistered: (updatedWallets: WalletWithRequiredFeatures[]) => void;\n\tsetWalletUnregistered: (\n\t\tupdatedWallets: WalletWithRequiredFeatures[],\n\t\tunregisteredWallet: Wallet,\n\t) => void;\n};\n\nexport type WalletStore = ReturnType<typeof createWalletStore>;\n\nexport type StoreState = {\n\twallets: WalletWithRequiredFeatures[];\n\taccounts: readonly WalletAccount[];\n\tcurrentWallet: WalletWithRequiredFeatures | null;\n\tcurrentAccount: WalletAccount | null;\n\tlastConnectedAccountAddress: string | null;\n\tlastConnectedWalletName: string | null;\n} & WalletActions;\n\nexport type WalletConfiguration = {\n\twallets: WalletWithRequiredFeatures[];\n\tstorage: StateStorage;\n\tstorageKey: string;\n};\n\nexport function createWalletStore({ wallets, storage, storageKey }: WalletConfiguration) {\n\treturn createStore<StoreState>()(\n\t\tpersist(\n\t\t\t(set, get) => ({\n\t\t\t\twallets,\n\t\t\t\taccounts: [],\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tcurrentAccount: null,\n\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\tconnectionStatus: 'disconnected',\n\t\t\t\tsetWalletConnected(wallet, connectedAccounts, selectedAccount) {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\taccounts: connectedAccounts,\n\t\t\t\t\t\tcurrentWallet: wallet,\n\t\t\t\t\t\tcurrentAccount: selectedAccount,\n\t\t\t\t\t\tlastConnectedWalletName: wallet.name,\n\t\t\t\t\t\tlastConnectedAccountAddress: selectedAccount?.address,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetWalletDisconnected() {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\taccounts: [],\n\t\t\t\t\t\tcurrentWallet: null,\n\t\t\t\t\t\tcurrentAccount: null,\n\t\t\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetAccountSwitched(selectedAccount) {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\tcurrentAccount: selectedAccount,\n\t\t\t\t\t\tlastConnectedAccountAddress: selectedAccount.address,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetWalletRegistered(updatedWallets) {\n\t\t\t\t\tset(() => ({ wallets: updatedWallets }));\n\t\t\t\t},\n\t\t\t\tsetWalletUnregistered(updatedWallets, unregisteredWallet) {\n\t\t\t\t\tif (unregisteredWallet === get().currentWallet) {\n\t\t\t\t\t\tset(() => ({\n\t\t\t\t\t\t\twallets: updatedWallets,\n\t\t\t\t\t\t\taccounts: [],\n\t\t\t\t\t\t\tcurrentWallet: null,\n\t\t\t\t\t\t\tcurrentAccount: null,\n\t\t\t\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tset(() => ({ wallets: updatedWallets }));\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateWalletAccounts(accounts) {\n\t\t\t\t\tconst currentAccount = get().currentAccount;\n\t\t\t\t\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAA4B;AAE5B,wBAA2C;AAmCpC,SAAS,kBAAkB,EAAE,SAAS,SAAS,WAAW,GAAwB;AACxF,aAAO,4BAAwB;AAAA,QAC9B;AAAA,MACC,CAAC,KAAK,SAAS;AAAA,QACd;AAAA,QACA,UAAU,CAAC;AAAA,QACX,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,6BAA6B;AAAA,QAC7B,yBAAyB;AAAA,QACzB,kBAAkB;AAAA,QAClB,mBAAmB,QAAQ,mBAAmB,iBAAiB;AAC9D,cAAI,OAAO;AAAA,YACV,UAAU;AAAA,YACV,eAAe;AAAA,YACf,gBAAgB;AAAA,YAChB,yBAAyB,OAAO;AAAA,YAChC,6BAA6B,iBAAiB;AAAA,UAC/C,EAAE;AAAA,QACH;AAAA,QACA,wBAAwB;AACvB,cAAI,OAAO;AAAA,YACV,UAAU,CAAC;AAAA,YACX,eAAe;AAAA,YACf,gBAAgB;AAAA,YAChB,yBAAyB;AAAA,YACzB,6BAA6B;AAAA,UAC9B,EAAE;AAAA,QACH;AAAA,QACA,mBAAmB,iBAAiB;AACnC,cAAI,OAAO;AAAA,YACV,gBAAgB;AAAA,YAChB,6BAA6B,gBAAgB;AAAA,UAC9C,EAAE;AAAA,QACH;AAAA,QACA,oBAAoB,gBAAgB;AACnC,cAAI,OAAO,EAAE,SAAS,eAAe,EAAE;AAAA,QACxC;AAAA,QACA,sBAAsB,gBAAgB,oBAAoB;AACzD,cAAI,uBAAuB,IAAI,EAAE,eAAe;AAC/C,gBAAI,OAAO;AAAA,cACV,SAAS;AAAA,cACT,UAAU,CAAC;AAAA,cACX,eAAe;AAAA,cACf,gBAAgB;AAAA,cAChB,yBAAyB;AAAA,cACzB,6BAA6B;AAAA,YAC9B,EAAE;AAAA,UACH,OAAO;AACN,gBAAI,OAAO,EAAE,SAAS,eAAe,EAAE;AAAA,UACxC;AAAA,QACD;AAAA,QACA,qBAAqB,UAAU;AAC9B,gBAAM,iBAAiB,IAAI,EAAE;
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { Wallet, WalletAccount, WalletWithRequiredFeatures } from '@mysten/wallet-standard';\nimport { createStore } from 'zustand';\nimport type { StateStorage } from 'zustand/middleware';\nimport { createJSONStorage, persist } from 'zustand/middleware';\n\nexport type WalletActions = {\n\tsetAccountSwitched: (selectedAccount: WalletAccount) => void;\n\tsetWalletConnected: (\n\t\twallet: WalletWithRequiredFeatures,\n\t\tconnectedAccounts: readonly WalletAccount[],\n\t\tselectedAccount: WalletAccount | null,\n\t) => void;\n\tupdateWalletAccounts: (accounts: readonly WalletAccount[]) => void;\n\tsetWalletDisconnected: () => void;\n\tsetWalletRegistered: (updatedWallets: WalletWithRequiredFeatures[]) => void;\n\tsetWalletUnregistered: (\n\t\tupdatedWallets: WalletWithRequiredFeatures[],\n\t\tunregisteredWallet: Wallet,\n\t) => void;\n};\n\nexport type WalletStore = ReturnType<typeof createWalletStore>;\n\nexport type StoreState = {\n\twallets: WalletWithRequiredFeatures[];\n\taccounts: readonly WalletAccount[];\n\tcurrentWallet: WalletWithRequiredFeatures | null;\n\tcurrentAccount: WalletAccount | null;\n\tlastConnectedAccountAddress: string | null;\n\tlastConnectedWalletName: string | null;\n} & WalletActions;\n\nexport type WalletConfiguration = {\n\twallets: WalletWithRequiredFeatures[];\n\tstorage: StateStorage;\n\tstorageKey: string;\n};\n\nexport function createWalletStore({ wallets, storage, storageKey }: WalletConfiguration) {\n\treturn createStore<StoreState>()(\n\t\tpersist(\n\t\t\t(set, get) => ({\n\t\t\t\twallets,\n\t\t\t\taccounts: [],\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tcurrentAccount: null,\n\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\tconnectionStatus: 'disconnected',\n\t\t\t\tsetWalletConnected(wallet, connectedAccounts, selectedAccount) {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\taccounts: connectedAccounts,\n\t\t\t\t\t\tcurrentWallet: wallet,\n\t\t\t\t\t\tcurrentAccount: selectedAccount,\n\t\t\t\t\t\tlastConnectedWalletName: wallet.name,\n\t\t\t\t\t\tlastConnectedAccountAddress: selectedAccount?.address,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetWalletDisconnected() {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\taccounts: [],\n\t\t\t\t\t\tcurrentWallet: null,\n\t\t\t\t\t\tcurrentAccount: null,\n\t\t\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetAccountSwitched(selectedAccount) {\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\tcurrentAccount: selectedAccount,\n\t\t\t\t\t\tlastConnectedAccountAddress: selectedAccount.address,\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t\tsetWalletRegistered(updatedWallets) {\n\t\t\t\t\tset(() => ({ wallets: updatedWallets }));\n\t\t\t\t},\n\t\t\t\tsetWalletUnregistered(updatedWallets, unregisteredWallet) {\n\t\t\t\t\tif (unregisteredWallet === get().currentWallet) {\n\t\t\t\t\t\tset(() => ({\n\t\t\t\t\t\t\twallets: updatedWallets,\n\t\t\t\t\t\t\taccounts: [],\n\t\t\t\t\t\t\tcurrentWallet: null,\n\t\t\t\t\t\t\tcurrentAccount: null,\n\t\t\t\t\t\t\tlastConnectedWalletName: null,\n\t\t\t\t\t\t\tlastConnectedAccountAddress: null,\n\t\t\t\t\t\t}));\n\t\t\t\t\t} else {\n\t\t\t\t\t\tset(() => ({ wallets: updatedWallets }));\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tupdateWalletAccounts(accounts) {\n\t\t\t\t\tconst currentAccount = get().currentAccount;\n\n\t\t\t\t\tset(() => ({\n\t\t\t\t\t\taccounts,\n\t\t\t\t\t\tcurrentAccount: currentAccount\n\t\t\t\t\t\t\t? accounts.find(({ address }) => address === currentAccount.address)\n\t\t\t\t\t\t\t: accounts[0],\n\t\t\t\t\t}));\n\t\t\t\t},\n\t\t\t}),\n\t\t\t{\n\t\t\t\tname: storageKey,\n\t\t\t\tstorage: createJSONStorage(() => storage),\n\t\t\t\tpartialize: ({ lastConnectedWalletName, lastConnectedAccountAddress }) => ({\n\t\t\t\t\tlastConnectedWalletName,\n\t\t\t\t\tlastConnectedAccountAddress,\n\t\t\t\t}),\n\t\t\t},\n\t\t),\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,qBAA4B;AAE5B,wBAA2C;AAmCpC,SAAS,kBAAkB,EAAE,SAAS,SAAS,WAAW,GAAwB;AACxF,aAAO,4BAAwB;AAAA,QAC9B;AAAA,MACC,CAAC,KAAK,SAAS;AAAA,QACd;AAAA,QACA,UAAU,CAAC;AAAA,QACX,eAAe;AAAA,QACf,gBAAgB;AAAA,QAChB,6BAA6B;AAAA,QAC7B,yBAAyB;AAAA,QACzB,kBAAkB;AAAA,QAClB,mBAAmB,QAAQ,mBAAmB,iBAAiB;AAC9D,cAAI,OAAO;AAAA,YACV,UAAU;AAAA,YACV,eAAe;AAAA,YACf,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|
|
@@ -3,4 +3,8 @@ type AccountDropdownMenuProps = {
|
|
|
3
3
|
currentAccount: WalletAccount;
|
|
4
4
|
};
|
|
5
5
|
export declare function AccountDropdownMenu({ currentAccount }: AccountDropdownMenuProps): import("react/jsx-runtime.js").JSX.Element;
|
|
6
|
+
export declare function AccountDropdownMenuItem({ account, active, }: {
|
|
7
|
+
account: WalletAccount;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
}): import("react/jsx-runtime.js").JSX.Element;
|
|
6
10
|
export {};
|
|
@@ -46,17 +46,74 @@ import { formatAddress } from "@mysten/sui.js/utils";
|
|
|
46
46
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
47
47
|
import clsx3 from "clsx";
|
|
48
48
|
|
|
49
|
-
// src/hooks/
|
|
49
|
+
// src/hooks/useSuiClientQuery.ts
|
|
50
|
+
import { useQuery } from "@tanstack/react-query";
|
|
51
|
+
|
|
52
|
+
// src/hooks/useSuiClient.ts
|
|
50
53
|
import { useContext } from "react";
|
|
54
|
+
|
|
55
|
+
// src/components/SuiClientProvider.tsx
|
|
56
|
+
import { getFullnodeUrl, isSuiClient, SuiClient } from "@mysten/sui.js/client";
|
|
57
|
+
import { createContext, useMemo, useState } from "react";
|
|
58
|
+
import { jsx } from "react/jsx-runtime";
|
|
59
|
+
var SuiClientContext = createContext(null);
|
|
60
|
+
var DEFAULT_NETWORKS = {
|
|
61
|
+
localnet: { url: getFullnodeUrl("localnet") }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// src/hooks/useSuiClient.ts
|
|
65
|
+
function useSuiClientContext() {
|
|
66
|
+
const suiClient = useContext(SuiClientContext);
|
|
67
|
+
if (!suiClient) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
"Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider"
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return suiClient;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// src/hooks/useSuiClientQuery.ts
|
|
76
|
+
function useSuiClientQuery(...args) {
|
|
77
|
+
const [method, params, { queryKey = [], ...options } = {}] = args;
|
|
78
|
+
const suiContext = useSuiClientContext();
|
|
79
|
+
return useQuery({
|
|
80
|
+
...options,
|
|
81
|
+
queryKey: [suiContext.network, method, params, ...queryKey],
|
|
82
|
+
queryFn: async () => {
|
|
83
|
+
return await suiContext.client[method](params);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/hooks/useResolveSuiNSNames.ts
|
|
89
|
+
function useResolveSuiNSName(address, options) {
|
|
90
|
+
const { data, ...rest } = useSuiClientQuery(
|
|
91
|
+
"resolveNameServiceNames",
|
|
92
|
+
{
|
|
93
|
+
address,
|
|
94
|
+
limit: 1
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
refetchOnWindowFocus: false,
|
|
98
|
+
retry: false,
|
|
99
|
+
...options,
|
|
100
|
+
enabled: !!address && options?.enabled !== false
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
return { data: data?.data?.[0] ?? null, ...rest };
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// src/hooks/wallet/useWalletStore.ts
|
|
107
|
+
import { useContext as useContext2 } from "react";
|
|
51
108
|
import { useStore } from "zustand";
|
|
52
109
|
|
|
53
110
|
// src/contexts/walletContext.ts
|
|
54
|
-
import { createContext } from "react";
|
|
55
|
-
var WalletContext =
|
|
111
|
+
import { createContext as createContext2 } from "react";
|
|
112
|
+
var WalletContext = createContext2(null);
|
|
56
113
|
|
|
57
114
|
// src/hooks/wallet/useWalletStore.ts
|
|
58
115
|
function useWalletStore(selector) {
|
|
59
|
-
const store =
|
|
116
|
+
const store = useContext2(WalletContext);
|
|
60
117
|
if (!store) {
|
|
61
118
|
throw new Error(
|
|
62
119
|
"Could not find WalletContext. Ensure that you have set up the WalletProvider."
|
|
@@ -160,9 +217,9 @@ var separator = "AccountDropdownMenu_separator__div2ql4";
|
|
|
160
217
|
var switchAccountMenuItem = "AccountDropdownMenu_switchAccountMenuItem__div2ql3";
|
|
161
218
|
|
|
162
219
|
// src/components/icons/CheckIcon.tsx
|
|
163
|
-
import { jsx } from "react/jsx-runtime";
|
|
220
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
164
221
|
function CheckIcon(props) {
|
|
165
|
-
return /* @__PURE__ */
|
|
222
|
+
return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx2(
|
|
166
223
|
"path",
|
|
167
224
|
{
|
|
168
225
|
fill: "currentColor",
|
|
@@ -172,9 +229,9 @@ function CheckIcon(props) {
|
|
|
172
229
|
}
|
|
173
230
|
|
|
174
231
|
// src/components/icons/ChevronIcon.tsx
|
|
175
|
-
import { jsx as
|
|
232
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
176
233
|
function ChevronIcon(props) {
|
|
177
|
-
return /* @__PURE__ */
|
|
234
|
+
return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", width: 16, height: 16, fill: "none", ...props, children: /* @__PURE__ */ jsx3(
|
|
178
235
|
"path",
|
|
179
236
|
{
|
|
180
237
|
stroke: "#A0B6C3",
|
|
@@ -197,8 +254,8 @@ var styleDataAttribute = { [styleDataAttributeName]: "" };
|
|
|
197
254
|
|
|
198
255
|
// src/components/styling/StyleMarker.tsx
|
|
199
256
|
var import_StyleMarker_css = __toESM(require_StyleMarker_css());
|
|
200
|
-
import { jsx as
|
|
201
|
-
var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */
|
|
257
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
258
|
+
var StyleMarker = forwardRef(({ children }, forwardedRef) => /* @__PURE__ */ jsx4(Slot, { ref: forwardedRef, ...styleDataAttribute, children }));
|
|
202
259
|
StyleMarker.displayName = "StyleMarker";
|
|
203
260
|
|
|
204
261
|
// src/components/ui/Button.tsx
|
|
@@ -211,11 +268,11 @@ import { createRuntimeFn as _7a468 } from "@vanilla-extract/recipes/createRuntim
|
|
|
211
268
|
var buttonVariants = _7a468({ defaultClassName: "Button_buttonVariants__x1s81q0", variantClassNames: { variant: { primary: "Button_buttonVariants_variant_primary__x1s81q1", outline: "Button_buttonVariants_variant_outline__x1s81q2" }, size: { md: "Button_buttonVariants_size_md__x1s81q3", lg: "Button_buttonVariants_size_lg__x1s81q4" } }, defaultVariants: { variant: "primary", size: "md" }, compoundVariants: [] });
|
|
212
269
|
|
|
213
270
|
// src/components/ui/Button.tsx
|
|
214
|
-
import { jsx as
|
|
271
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
215
272
|
var Button = forwardRef2(
|
|
216
273
|
({ className, variant, size, asChild = false, ...props }, forwardedRef) => {
|
|
217
274
|
const Comp = asChild ? Slot2 : "button";
|
|
218
|
-
return /* @__PURE__ */
|
|
275
|
+
return /* @__PURE__ */ jsx5(
|
|
219
276
|
Comp,
|
|
220
277
|
{
|
|
221
278
|
...props,
|
|
@@ -237,7 +294,7 @@ import { createRuntimeFn as _7a4682 } from "@vanilla-extract/recipes/createRunti
|
|
|
237
294
|
var textVariants = _7a4682({ defaultClassName: "Text__2bv1ur0", variantClassNames: { size: { sm: "Text_textVariants_size_sm__2bv1ur1" }, weight: { normal: "Text_textVariants_weight_normal__2bv1ur2", medium: "Text_textVariants_weight_medium__2bv1ur3", bold: "Text_textVariants_weight_bold__2bv1ur4" }, color: { muted: "Text_textVariants_color_muted__2bv1ur5", danger: "Text_textVariants_color_danger__2bv1ur6" }, mono: { true: "Text_textVariants_mono_true__2bv1ur7" } }, defaultVariants: { size: "sm", weight: "normal" }, compoundVariants: [] });
|
|
238
295
|
|
|
239
296
|
// src/components/ui/Text.tsx
|
|
240
|
-
import { jsx as
|
|
297
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
241
298
|
var Text = forwardRef3(
|
|
242
299
|
({
|
|
243
300
|
children,
|
|
@@ -250,13 +307,13 @@ var Text = forwardRef3(
|
|
|
250
307
|
mono,
|
|
251
308
|
...textProps
|
|
252
309
|
}, forwardedRef) => {
|
|
253
|
-
return /* @__PURE__ */
|
|
310
|
+
return /* @__PURE__ */ jsx6(
|
|
254
311
|
Slot3,
|
|
255
312
|
{
|
|
256
313
|
...textProps,
|
|
257
314
|
ref: forwardedRef,
|
|
258
315
|
className: clsx2(textVariants({ size, weight, color, mono }), className),
|
|
259
|
-
children: asChild ? children : /* @__PURE__ */
|
|
316
|
+
children: asChild ? children : /* @__PURE__ */ jsx6(Tag, { children })
|
|
260
317
|
}
|
|
261
318
|
);
|
|
262
319
|
}
|
|
@@ -264,31 +321,29 @@ var Text = forwardRef3(
|
|
|
264
321
|
Text.displayName = "Text";
|
|
265
322
|
|
|
266
323
|
// src/components/AccountDropdownMenu.tsx
|
|
267
|
-
import { jsx as
|
|
324
|
+
import { jsx as jsx7, jsxs } from "react/jsx-runtime";
|
|
268
325
|
function AccountDropdownMenu({ currentAccount }) {
|
|
269
326
|
const { mutate: disconnectWallet } = useDisconnectWallet();
|
|
270
|
-
const {
|
|
327
|
+
const { data: domain } = useResolveSuiNSName(
|
|
328
|
+
currentAccount.label ? null : currentAccount.address
|
|
329
|
+
);
|
|
271
330
|
const accounts = useAccounts();
|
|
272
331
|
return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, children: [
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
/* @__PURE__ */
|
|
275
|
-
/* @__PURE__ */
|
|
332
|
+
/* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsx7(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button, { size: "lg", className: connectedAccount, children: [
|
|
333
|
+
/* @__PURE__ */ jsx7(Text, { mono: true, weight: "bold", children: currentAccount.label ?? domain ?? formatAddress(currentAccount.address) }),
|
|
334
|
+
/* @__PURE__ */ jsx7(ChevronIcon, {})
|
|
276
335
|
] }) }) }),
|
|
277
|
-
/* @__PURE__ */
|
|
278
|
-
accounts.map((account) => /* @__PURE__ */
|
|
279
|
-
|
|
336
|
+
/* @__PURE__ */ jsx7(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx7(StyleMarker, { children: /* @__PURE__ */ jsxs(DropdownMenu.Content, { className: menuContent, children: [
|
|
337
|
+
accounts.map((account) => /* @__PURE__ */ jsx7(
|
|
338
|
+
AccountDropdownMenuItem,
|
|
280
339
|
{
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
children: [
|
|
284
|
-
/* @__PURE__ */ jsx6(Text, { mono: true, children: formatAddress(account.address) }),
|
|
285
|
-
currentAccount.address === account.address ? /* @__PURE__ */ jsx6(CheckIcon, {}) : null
|
|
286
|
-
]
|
|
340
|
+
account,
|
|
341
|
+
active: currentAccount.address === account.address
|
|
287
342
|
},
|
|
288
343
|
account.address
|
|
289
344
|
)),
|
|
290
|
-
/* @__PURE__ */
|
|
291
|
-
/* @__PURE__ */
|
|
345
|
+
/* @__PURE__ */ jsx7(DropdownMenu.Separator, { className: separator }),
|
|
346
|
+
/* @__PURE__ */ jsx7(
|
|
292
347
|
DropdownMenu.Item,
|
|
293
348
|
{
|
|
294
349
|
className: clsx3(menuItem),
|
|
@@ -299,7 +354,26 @@ function AccountDropdownMenu({ currentAccount }) {
|
|
|
299
354
|
] }) }) })
|
|
300
355
|
] });
|
|
301
356
|
}
|
|
357
|
+
function AccountDropdownMenuItem({
|
|
358
|
+
account,
|
|
359
|
+
active
|
|
360
|
+
}) {
|
|
361
|
+
const { mutate: switchAccount } = useSwitchAccount();
|
|
362
|
+
const { data: domain } = useResolveSuiNSName(account.label ? null : account.address);
|
|
363
|
+
return /* @__PURE__ */ jsxs(
|
|
364
|
+
DropdownMenu.Item,
|
|
365
|
+
{
|
|
366
|
+
className: clsx3(menuItem, switchAccountMenuItem),
|
|
367
|
+
onSelect: () => switchAccount({ account }),
|
|
368
|
+
children: [
|
|
369
|
+
/* @__PURE__ */ jsx7(Text, { mono: true, children: account.label ?? domain ?? formatAddress(account.address) }),
|
|
370
|
+
active ? /* @__PURE__ */ jsx7(CheckIcon, {}) : null
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
);
|
|
374
|
+
}
|
|
302
375
|
export {
|
|
303
|
-
AccountDropdownMenu
|
|
376
|
+
AccountDropdownMenu,
|
|
377
|
+
AccountDropdownMenuItem
|
|
304
378
|
};
|
|
305
379
|
//# sourceMappingURL=AccountDropdownMenu.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/styling/StyleMarker.css.ts", "../../../src/components/AccountDropdownMenu.tsx", "../../../src/hooks/wallet/useWalletStore.ts", "../../../src/contexts/walletContext.ts", "../../../src/hooks/wallet/useAccounts.ts", "../../../src/hooks/wallet/useDisconnectWallet.ts", "../../../src/constants/walletMutationKeys.ts", "../../../src/errors/walletErrors.ts", "../../../src/hooks/wallet/useCurrentWallet.ts", "../../../src/hooks/wallet/useSwitchAccount.ts", "../../../src/components/AccountDropdownMenu.css.ts", "../../../src/components/icons/CheckIcon.tsx", "../../../src/components/icons/ChevronIcon.tsx", "../../../src/components/styling/StyleMarker.tsx", "../../../src/constants/styleDataAttribute.ts", "../../../src/components/ui/Button.tsx", "../../../src/components/ui/Button.css.ts", "../../../src/components/ui/Text.tsx", "../../../src/components/ui/Text.css.ts"],
|
|
4
|
-
"sourcesContent": ["import 'src/components/styling/StyleMarker.css.ts.vanilla.css?source=OndoZXJlKCopIHsKICBib3gtc2l6aW5nOiBib3JkZXItYm94OwogIGNvbG9yOiB2YXIoLS1kYXBwLWtpdC1jb2xvcnMtYm9keSk7CiAgZm9udC1mYW1pbHk6IHZhcigtLWRhcHAta2l0LXR5cG9ncmFwaHktZm9udEZhbWlseSk7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1ub3JtYWwpOwogIGZvbnQtc3R5bGU6IHZhcigtLWRhcHAta2l0LXR5cG9ncmFwaHktZm9udFN0eWxlKTsKICBmb250LXdlaWdodDogdmFyKC0tZGFwcC1raXQtZm9udFdlaWdodHMtbm9ybWFsKTsKICBsaW5lLWhlaWdodDogdmFyKC0tZGFwcC1raXQtdHlwb2dyYXBoeS1saW5lSGVpZ2h0KTsKICBsZXR0ZXItc3BhY2luZzogdmFyKC0tZGFwcC1raXQtdHlwb2dyYXBoeS1sZXR0ZXJTcGFjaW5nKTsKfQo6d2hlcmUoYnV0dG9uKSB7CiAgYXBwZWFyYW5jZTogbm9uZTsKICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDsKICBmb250LXNpemU6IGluaGVyaXQ7CiAgZm9udC1mYW1pbHk6IGluaGVyaXQ7CiAgbGluZS1oZWlnaHQ6IGluaGVyaXQ7CiAgbGV0dGVyLXNwYWNpbmc6IGluaGVyaXQ7CiAgY29sb3I6IGluaGVyaXQ7CiAgYm9yZGVyOiAwOwogIHBhZGRpbmc6IDA7CiAgbWFyZ2luOiAwOwp9Cjp3aGVyZShhKSB7CiAgdGV4dC1kZWNvcmF0aW9uOiBub25lOwogIGNvbG9yOiBpbmhlcml0OwogIG91dGxpbmU6IG5vbmU7Cn0KOndoZXJlKG9sLCB1bCkgewogIGxpc3Qtc3R5bGU6IG5vbmU7CiAgbWFyZ2luOiAwOwogIHBhZGRpbmc6IDA7Cn0KOndoZXJlKGgxLCBoMiwgaDMsIGg0LCBoNSwgaDYpIHsKICBmb250LXNpemU6IGluaGVyaXQ7CiAgZm9udC13ZWlnaHQ6IGluaGVyaXQ7CiAgbWFyZ2luOiAwOwp9';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { formatAddress } from '@mysten/sui.js/utils';\nimport type { WalletAccount } from '@mysten/wallet-standard';\nimport * as DropdownMenu from '@radix-ui/react-dropdown-menu';\nimport clsx from 'clsx';\n\nimport { useAccounts } from '../hooks/wallet/useAccounts.js';\nimport { useDisconnectWallet } from '../hooks/wallet/useDisconnectWallet.js';\nimport { useSwitchAccount } from '../hooks/wallet/useSwitchAccount.js';\nimport * as styles from './AccountDropdownMenu.css.js';\nimport { CheckIcon } from './icons/CheckIcon.js';\nimport { ChevronIcon } from './icons/ChevronIcon.js';\nimport { StyleMarker } from './styling/StyleMarker.js';\nimport { Button } from './ui/Button.js';\nimport { Text } from './ui/Text.js';\n\ntype AccountDropdownMenuProps = {\n\tcurrentAccount: WalletAccount;\n};\n\nexport function AccountDropdownMenu({ currentAccount }: AccountDropdownMenuProps) {\n\tconst { mutate: disconnectWallet } = useDisconnectWallet();\n\tconst { mutate: switchAccount } = useSwitchAccount();\n\tconst accounts = useAccounts();\n\n\treturn (\n\t\t<DropdownMenu.Root modal={false}>\n\t\t\t<StyleMarker>\n\t\t\t\t<DropdownMenu.Trigger asChild>\n\t\t\t\t\t<Button size=\"lg\" className={styles.connectedAccount}>\n\t\t\t\t\t\t<Text mono weight=\"bold\">\n\t\t\t\t\t\t\t{formatAddress(currentAccount.address)}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<ChevronIcon />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenu.Trigger>\n\t\t\t</StyleMarker>\n\t\t\t<DropdownMenu.Portal>\n\t\t\t\t<StyleMarker>\n\t\t\t\t\t<DropdownMenu.Content className={styles.menuContent}>\n\t\t\t\t\t\t{accounts.map((account) => (\n\t\t\t\t\t\t\t<DropdownMenu.Item\n\t\t\t\t\t\t\t\tkey={account.address}\n\t\t\t\t\t\t\t\tclassName={clsx(styles.menuItem, styles.switchAccountMenuItem)}\n\t\t\t\t\t\t\t\tonSelect={() => switchAccount({ account })}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Text mono>{formatAddress(account.address)}</Text>\n\t\t\t\t\t\t\t\t{currentAccount.address === account.address ? <CheckIcon /> : null}\n\t\t\t\t\t\t\t</DropdownMenu.Item>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t<DropdownMenu.Separator className={styles.separator} />\n\t\t\t\t\t\t<DropdownMenu.Item\n\t\t\t\t\t\t\tclassName={clsx(styles.menuItem)}\n\t\t\t\t\t\t\tonSelect={() => disconnectWallet()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDisconnect\n\t\t\t\t\t\t</DropdownMenu.Item>\n\t\t\t\t\t</DropdownMenu.Content>\n\t\t\t\t</StyleMarker>\n\t\t\t</DropdownMenu.Portal>\n\t\t</DropdownMenu.Root>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n\tconst store = useContext(WalletContext);\n\tif (!store) {\n\t\tthrow new Error(\n\t\t\t'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n\t\t);\n\t}\n\treturn useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves a list of connected accounts authorized by the dApp.\n */\nexport function useAccounts() {\n\treturn useWalletStore((state) => state.accounts);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMutationOptions } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { WalletNotConnectedError } from '../../errors/walletErrors.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype UseDisconnectWalletError = WalletNotConnectedError | Error;\n\ntype UseDisconnectWalletMutationOptions = Omit<\n\tUseMutationOptions<void, UseDisconnectWalletError, void, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for disconnecting from an active wallet connection, if currently connected.\n */\nexport function useDisconnectWallet({\n\tmutationKey,\n\t...mutationOptions\n}: UseDisconnectWalletMutationOptions = {}) {\n\tconst currentWallet = useCurrentWallet();\n\tconst setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.disconnectWallet(mutationKey),\n\t\tmutationFn: async () => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// Wallets aren't required to implement the disconnect feature, so we'll\n\t\t\t\t// optionally call the disconnect feature if it exists and reset the UI\n\t\t\t\t// state on the frontend at a minimum.\n\t\t\t\tawait currentWallet.features['standard:disconnect']?.disconnect();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to disconnect the application from the current wallet.', error);\n\t\t\t}\n\n\t\t\tsetWalletDisconnected();\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n\tall: { baseScope: 'wallet' },\n\tconnectWallet: formMutationKeyFn('connect-wallet'),\n\tdisconnectWallet: formMutationKeyFn('disconnect-wallet'),\n\tsignPersonalMessage: formMutationKeyFn('sign-personal-message'),\n\tsignTransactionBlock: formMutationKeyFn('sign-transaction-block'),\n\tsignAndExecuteTransactionBlock: formMutationKeyFn('sign-and-execute-transaction-block'),\n\tswitchAccount: formMutationKeyFn('switch-account'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n\treturn function mutationKeyFn(additionalKeys: MutationKey = []) {\n\t\treturn [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n\t};\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n\treturn useWalletStore((state) => state.currentWallet);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@mysten/wallet-standard';\nimport type { UseMutationOptions } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { WalletAccountNotFoundError, WalletNotConnectedError } from '../../errors/walletErrors.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype SwitchAccountArgs = {\n\taccount: WalletAccount;\n};\n\ntype SwitchAccountResult = void;\n\ntype UseSwitchAccountError = WalletNotConnectedError | WalletAccountNotFoundError | Error;\n\ntype UseSwitchAccountMutationOptions = Omit<\n\tUseMutationOptions<SwitchAccountResult, UseSwitchAccountError, SwitchAccountArgs, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for switching to a specific wallet account.\n */\nexport function useSwitchAccount({\n\tmutationKey,\n\t...mutationOptions\n}: UseSwitchAccountMutationOptions = {}) {\n\tconst currentWallet = useCurrentWallet();\n\tconst setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.switchAccount(mutationKey),\n\t\tmutationFn: async ({ account }) => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\tconst accountToSelect = currentWallet.accounts.find(\n\t\t\t\t(walletAccount) => walletAccount.address === account.address,\n\t\t\t);\n\t\t\tif (!accountToSelect) {\n\t\t\t\tthrow new WalletAccountNotFoundError(\n\t\t\t\t\t`No account with address ${account.address} is connected to ${currentWallet.name}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsetAccountSwitched(accountToSelect);\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n", "import 'src/components/AccountDropdownMenu.css.ts.vanilla.css?source=LkFjY291bnREcm9wZG93bk1lbnVfY29ubmVjdGVkQWNjb3VudF9fZGl2MnFsMCB7CiAgZ2FwOiA4cHg7Cn0KLkFjY291bnREcm9wZG93bk1lbnVfbWVudUNvbnRlbnRfX2RpdjJxbDEgewogIGRpc3BsYXk6IGZsZXg7CiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICB3aWR0aDogMTgwcHg7CiAgbWF4LWhlaWdodDogMjAwcHg7CiAgbWFyZ2luLXRvcDogNHB4OwogIHBhZGRpbmc6IDhweDsKICBnYXA6IDhweDsKICBib3JkZXItcmFkaXVzOiB2YXIoLS1kYXBwLWtpdC1yYWRpaS1sYXJnZSk7CiAgYmFja2dyb3VuZC1jb2xvcjogdmFyKC0tZGFwcC1raXQtYmFja2dyb3VuZENvbG9ycy1kcm9wZG93bk1lbnUpOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X21lbnVJdGVtX19kaXYycWwyIHsKICBwYWRkaW5nOiA4cHg7CiAgdXNlci1zZWxlY3Q6IG5vbmU7CiAgb3V0bGluZTogbm9uZTsKICBkaXNwbGF5OiBmbGV4OwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgYm9yZGVyLXJhZGl1czogdmFyKC0tZGFwcC1raXQtcmFkaWktbGFyZ2UpOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X21lbnVJdGVtX19kaXYycWwyW2RhdGEtaGlnaGxpZ2h0ZWRdIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1kYXBwLWtpdC1iYWNrZ3JvdW5kQ29sb3JzLXByaW1hcnlCdXR0b24pOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X3N3aXRjaEFjY291bnRNZW51SXRlbV9fZGl2MnFsMyB7CiAgZGlzcGxheTogZmxleDsKICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47CiAgYWxpZ24taXRlbXM6IGNlbnRlcjsKfQouQWNjb3VudERyb3Bkb3duTWVudV9zZXBhcmF0b3JfX2RpdjJxbDQgewogIGhlaWdodDogMXB4OwogIGZsZXgtc2hyaW5rOiAwOwogIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWRhcHAta2l0LWJhY2tncm91bmRDb2xvcnMtZHJvcGRvd25NZW51U2VwYXJhdG9yKTsKfQ==';\nexport var connectedAccount = 'AccountDropdownMenu_connectedAccount__div2ql0';\nexport var menuContent = 'AccountDropdownMenu_menuContent__div2ql1';\nexport var menuItem = 'AccountDropdownMenu_menuItem__div2ql2';\nexport var separator = 'AccountDropdownMenu_separator__div2ql4';\nexport var switchAccountMenuItem = 'AccountDropdownMenu_switchAccountMenuItem__div2ql3';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentProps } from 'react';\n\nexport function CheckIcon(props: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width={16} height={16} fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"m11.726 5.048-4.73 5.156-1.722-1.879a.72.72 0 0 0-.529-.23.722.722 0 0 0-.525.24.858.858 0 0 0-.22.573.86.86 0 0 0 .211.576l2.255 2.458c.14.153.332.24.53.24.2 0 .391-.087.532-.24l5.261-5.735A.86.86 0 0 0 13 5.63a.858.858 0 0 0-.22-.572.722.722 0 0 0-.525-.24.72.72 0 0 0-.529.23Z\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentProps } from 'react';\n\nexport function ChevronIcon(props: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width={16} height={16} fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tstroke=\"#A0B6C3\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth={1.5}\n\t\t\t\td=\"m4 6 4 4 4-4\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { styleDataAttribute } from '../../constants/styleDataAttribute.js';\n\nimport './StyleMarker.css.js';\n\ntype StyleMarker = {\n\tchildren: ReactNode;\n};\n\nexport const StyleMarker = forwardRef<\n\tElementRef<typeof Slot>,\n\tComponentPropsWithoutRef<typeof Slot>\n>(({ children }, forwardedRef) => (\n\t<Slot ref={forwardedRef} {...styleDataAttribute}>\n\t\t{children}\n\t</Slot>\n));\nStyleMarker.displayName = 'StyleMarker';\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport const styleDataAttributeName = 'data-dapp-kit';\n\nexport const styleDataAttributeSelector = `[${styleDataAttributeName}]`;\n\nexport const styleDataAttribute = { [styleDataAttributeName]: '' };\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport clsx from 'clsx';\nimport type { ButtonHTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { buttonVariants } from './Button.css.js';\nimport type { ButtonVariants } from './Button.css.js';\n\ntype ButtonProps = {\n\tasChild?: boolean;\n} & ButtonHTMLAttributes<HTMLButtonElement> &\n\tButtonVariants;\n\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t({ className, variant, size, asChild = false, ...props }, forwardedRef) => {\n\t\tconst Comp = asChild ? Slot : 'button';\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\t{...props}\n\t\t\t\tclassName={clsx(buttonVariants({ variant, size }), className)}\n\t\t\t\tref={forwardedRef}\n\t\t\t/>\n\t\t);\n\t},\n);\nButton.displayName = 'Button';\n\nexport { Button };\n", "import 'src/components/ui/Button.css.ts.vanilla.css?source=#H4sIAAAAAAAAA62Tz1LCMBDG7zxFjnIIQxEdptz04hPosbNtQruSJjFJodXx3U1aOoAVhNFL0/n2z+/bbTN5qJxTMknb4xkMgnQ2SerILqK3KfkYEcLQagFNTFAKlJyuBK+XXgeBuaToeGljknHpuAnya2UdrhqaKa9IdxhaeYluOeaFlzdgbihloDVdo6Mh9tKGLC05w6ocL0efo8l5g7E3B6ngrHWqNGTovNPp5O5M8aZ7SbTBEkzTN4vaHilk69yoSjI/gVBmYHSf8Bjilu7adKxxmPPnwuxUeqpqagtgajuo6eRh0dWzxYXacPMfEz6FRpdYUJUL/0tvYdbBlWHc0C0yV8Qk0vVyL1rXCB4TqwSyA/mEyTa4M7hDXfoJvqdfPcqftnlE/3WbFt95UrIefXu4RQP+ntgBMci4v0SEaGAMZR6Tha5JdB+Wfp4n8p43v5gnwOT8GBdQZDb3Dw/8AmeLhNtrBAAA';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var buttonVariants = _7a468({defaultClassName:'Button_buttonVariants__x1s81q0',variantClassNames:{variant:{primary:'Button_buttonVariants_variant_primary__x1s81q1',outline:'Button_buttonVariants_variant_outline__x1s81q2'},size:{md:'Button_buttonVariants_size_md__x1s81q3',lg:'Button_buttonVariants_size_lg__x1s81q4'}},defaultVariants:{variant:'primary',size:'md'},compoundVariants:[]});", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport clsx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { textVariants } from './Text.css.js';\nimport type { TextVariants } from './Text.css.js';\n\ntype TextAsChildProps = {\n\tasChild?: boolean;\n\tas?: never;\n};\n\ntype TextDivProps = { as: 'div'; asChild?: never };\n\ntype TextProps = (TextAsChildProps | TextDivProps) &\n\tReact.HTMLAttributes<HTMLDivElement> &\n\tTextVariants;\n\nconst Text = forwardRef<HTMLDivElement, TextProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tasChild = false,\n\t\t\tas: Tag = 'div',\n\t\t\tsize,\n\t\t\tweight,\n\t\t\tcolor,\n\t\t\tmono,\n\t\t\t...textProps\n\t\t},\n\t\tforwardedRef,\n\t) => {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\t{...textProps}\n\t\t\t\tref={forwardedRef}\n\t\t\t\tclassName={clsx(textVariants({ size, weight, color, mono }), className)}\n\t\t\t>\n\t\t\t\t{asChild ? children : <Tag>{children}</Tag>}\n\t\t\t</Slot>\n\t\t);\n\t},\n);\nText.displayName = 'Text';\n\nexport { Text };\n", "import 'src/components/ui/Text.css.ts.vanilla.css?source=LlRleHRfdGV4dFZhcmlhbnRzX3NpemVfc21fXzJidjF1cjEgewogIGZvbnQtc2l6ZTogdmFyKC0tZGFwcC1raXQtZm9udFNpemVzLXNtYWxsKTsKfQouVGV4dF90ZXh0VmFyaWFudHNfd2VpZ2h0X25vcm1hbF9fMmJ2MXVyMiB7CiAgZm9udC13ZWlnaHQ6IHZhcigtLWRhcHAta2l0LWZvbnRXZWlnaHRzLW5vcm1hbCk7Cn0KLlRleHRfdGV4dFZhcmlhbnRzX3dlaWdodF9tZWRpdW1fXzJidjF1cjMgewogIGZvbnQtd2VpZ2h0OiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1tZWRpdW0pOwp9Ci5UZXh0X3RleHRWYXJpYW50c193ZWlnaHRfYm9sZF9fMmJ2MXVyNCB7CiAgZm9udC13ZWlnaHQ6IHZhcigtLWRhcHAta2l0LWZvbnRXZWlnaHRzLWJvbGQpOwp9Ci5UZXh0X3RleHRWYXJpYW50c19jb2xvcl9tdXRlZF9fMmJ2MXVyNSB7CiAgY29sb3I6IHZhcigtLWRhcHAta2l0LWNvbG9ycy1ib2R5TXV0ZWQpOwp9Ci5UZXh0X3RleHRWYXJpYW50c19jb2xvcl9kYW5nZXJfXzJidjF1cjYgewogIGNvbG9yOiB2YXIoLS1kYXBwLWtpdC1jb2xvcnMtYm9keURhbmdlcik7Cn0KLlRleHRfdGV4dFZhcmlhbnRzX21vbm9fdHJ1ZV9fMmJ2MXVyNyB7CiAgZm9udC1mYW1pbHk6IHVpLW1vbm9zcGFjZSwgU0ZNb25vLVJlZ3VsYXIsIE1lbmxvLCBNb25hY28sIENvbnNvbGFzLCAiTGliZXJhdGlvbiBNb25vIiwgIkNvdXJpZXIgTmV3IiwgbW9ub3NwYWNlOwp9';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textVariants = _7a468({defaultClassName:'Text__2bv1ur0',variantClassNames:{size:{sm:'Text_textVariants_size_sm__2bv1ur1'},weight:{normal:'Text_textVariants_weight_normal__2bv1ur2',medium:'Text_textVariants_weight_medium__2bv1ur3',bold:'Text_textVariants_weight_bold__2bv1ur4'},color:{muted:'Text_textVariants_color_muted__2bv1ur5',danger:'Text_textVariants_color_danger__2bv1ur6'},mono:{true:'Text_textVariants_mono_true__2bv1ur7'}},defaultVariants:{size:'sm',weight:'normal'},compoundVariants:[]});"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,SAAS,qBAAqB;AAE9B,YAAY,kBAAkB;AAC9B,OAAOA,WAAU;;;
|
|
6
|
-
"names": ["clsx", "useMutation", "useMutation", "jsx", "jsx", "Slot", "forwardRef", "jsx", "forwardRef", "Slot", "Slot", "clsx", "forwardRef", "_7a468", "jsx", "forwardRef", "Slot", "clsx", "jsx", "clsx"]
|
|
3
|
+
"sources": ["../../../src/components/styling/StyleMarker.css.ts", "../../../src/components/AccountDropdownMenu.tsx", "../../../src/hooks/useSuiClientQuery.ts", "../../../src/hooks/useSuiClient.ts", "../../../src/components/SuiClientProvider.tsx", "../../../src/hooks/useResolveSuiNSNames.ts", "../../../src/hooks/wallet/useWalletStore.ts", "../../../src/contexts/walletContext.ts", "../../../src/hooks/wallet/useAccounts.ts", "../../../src/hooks/wallet/useDisconnectWallet.ts", "../../../src/constants/walletMutationKeys.ts", "../../../src/errors/walletErrors.ts", "../../../src/hooks/wallet/useCurrentWallet.ts", "../../../src/hooks/wallet/useSwitchAccount.ts", "../../../src/components/AccountDropdownMenu.css.ts", "../../../src/components/icons/CheckIcon.tsx", "../../../src/components/icons/ChevronIcon.tsx", "../../../src/components/styling/StyleMarker.tsx", "../../../src/constants/styleDataAttribute.ts", "../../../src/components/ui/Button.tsx", "../../../src/components/ui/Button.css.ts", "../../../src/components/ui/Text.tsx", "../../../src/components/ui/Text.css.ts"],
|
|
4
|
+
"sourcesContent": ["import 'src/components/styling/StyleMarker.css.ts.vanilla.css?source=OndoZXJlKCopIHsKICBib3gtc2l6aW5nOiBib3JkZXItYm94OwogIGNvbG9yOiB2YXIoLS1kYXBwLWtpdC1jb2xvcnMtYm9keSk7CiAgZm9udC1mYW1pbHk6IHZhcigtLWRhcHAta2l0LXR5cG9ncmFwaHktZm9udEZhbWlseSk7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1ub3JtYWwpOwogIGZvbnQtc3R5bGU6IHZhcigtLWRhcHAta2l0LXR5cG9ncmFwaHktZm9udFN0eWxlKTsKICBmb250LXdlaWdodDogdmFyKC0tZGFwcC1raXQtZm9udFdlaWdodHMtbm9ybWFsKTsKICBsaW5lLWhlaWdodDogdmFyKC0tZGFwcC1raXQtdHlwb2dyYXBoeS1saW5lSGVpZ2h0KTsKICBsZXR0ZXItc3BhY2luZzogdmFyKC0tZGFwcC1raXQtdHlwb2dyYXBoeS1sZXR0ZXJTcGFjaW5nKTsKfQo6d2hlcmUoYnV0dG9uKSB7CiAgYXBwZWFyYW5jZTogbm9uZTsKICBiYWNrZ3JvdW5kLWNvbG9yOiB0cmFuc3BhcmVudDsKICBmb250LXNpemU6IGluaGVyaXQ7CiAgZm9udC1mYW1pbHk6IGluaGVyaXQ7CiAgbGluZS1oZWlnaHQ6IGluaGVyaXQ7CiAgbGV0dGVyLXNwYWNpbmc6IGluaGVyaXQ7CiAgY29sb3I6IGluaGVyaXQ7CiAgYm9yZGVyOiAwOwogIHBhZGRpbmc6IDA7CiAgbWFyZ2luOiAwOwp9Cjp3aGVyZShhKSB7CiAgdGV4dC1kZWNvcmF0aW9uOiBub25lOwogIGNvbG9yOiBpbmhlcml0OwogIG91dGxpbmU6IG5vbmU7Cn0KOndoZXJlKG9sLCB1bCkgewogIGxpc3Qtc3R5bGU6IG5vbmU7CiAgbWFyZ2luOiAwOwogIHBhZGRpbmc6IDA7Cn0KOndoZXJlKGgxLCBoMiwgaDMsIGg0LCBoNSwgaDYpIHsKICBmb250LXNpemU6IGluaGVyaXQ7CiAgZm9udC13ZWlnaHQ6IGluaGVyaXQ7CiAgbWFyZ2luOiAwOwp9';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { formatAddress } from '@mysten/sui.js/utils';\nimport type { WalletAccount } from '@mysten/wallet-standard';\nimport * as DropdownMenu from '@radix-ui/react-dropdown-menu';\nimport clsx from 'clsx';\n\nimport { useResolveSuiNSName } from '../hooks/useResolveSuiNSNames.js';\nimport { useAccounts } from '../hooks/wallet/useAccounts.js';\nimport { useDisconnectWallet } from '../hooks/wallet/useDisconnectWallet.js';\nimport { useSwitchAccount } from '../hooks/wallet/useSwitchAccount.js';\nimport * as styles from './AccountDropdownMenu.css.js';\nimport { CheckIcon } from './icons/CheckIcon.js';\nimport { ChevronIcon } from './icons/ChevronIcon.js';\nimport { StyleMarker } from './styling/StyleMarker.js';\nimport { Button } from './ui/Button.js';\nimport { Text } from './ui/Text.js';\n\ntype AccountDropdownMenuProps = {\n\tcurrentAccount: WalletAccount;\n};\n\nexport function AccountDropdownMenu({ currentAccount }: AccountDropdownMenuProps) {\n\tconst { mutate: disconnectWallet } = useDisconnectWallet();\n\n\tconst { data: domain } = useResolveSuiNSName(\n\t\tcurrentAccount.label ? null : currentAccount.address,\n\t);\n\tconst accounts = useAccounts();\n\n\treturn (\n\t\t<DropdownMenu.Root modal={false}>\n\t\t\t<StyleMarker>\n\t\t\t\t<DropdownMenu.Trigger asChild>\n\t\t\t\t\t<Button size=\"lg\" className={styles.connectedAccount}>\n\t\t\t\t\t\t<Text mono weight=\"bold\">\n\t\t\t\t\t\t\t{currentAccount.label ?? domain ?? formatAddress(currentAccount.address)}\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t\t<ChevronIcon />\n\t\t\t\t\t</Button>\n\t\t\t\t</DropdownMenu.Trigger>\n\t\t\t</StyleMarker>\n\t\t\t<DropdownMenu.Portal>\n\t\t\t\t<StyleMarker>\n\t\t\t\t\t<DropdownMenu.Content className={styles.menuContent}>\n\t\t\t\t\t\t{accounts.map((account) => (\n\t\t\t\t\t\t\t<AccountDropdownMenuItem\n\t\t\t\t\t\t\t\tkey={account.address}\n\t\t\t\t\t\t\t\taccount={account}\n\t\t\t\t\t\t\t\tactive={currentAccount.address === account.address}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t))}\n\t\t\t\t\t\t<DropdownMenu.Separator className={styles.separator} />\n\t\t\t\t\t\t<DropdownMenu.Item\n\t\t\t\t\t\t\tclassName={clsx(styles.menuItem)}\n\t\t\t\t\t\t\tonSelect={() => disconnectWallet()}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\tDisconnect\n\t\t\t\t\t\t</DropdownMenu.Item>\n\t\t\t\t\t</DropdownMenu.Content>\n\t\t\t\t</StyleMarker>\n\t\t\t</DropdownMenu.Portal>\n\t\t</DropdownMenu.Root>\n\t);\n}\n\nexport function AccountDropdownMenuItem({\n\taccount,\n\tactive,\n}: {\n\taccount: WalletAccount;\n\tactive?: boolean;\n}) {\n\tconst { mutate: switchAccount } = useSwitchAccount();\n\tconst { data: domain } = useResolveSuiNSName(account.label ? null : account.address);\n\n\treturn (\n\t\t<DropdownMenu.Item\n\t\t\tclassName={clsx(styles.menuItem, styles.switchAccountMenuItem)}\n\t\t\tonSelect={() => switchAccount({ account })}\n\t\t>\n\t\t\t<Text mono>{account.label ?? domain ?? formatAddress(account.address)}</Text>\n\t\t\t{active ? <CheckIcon /> : null}\n\t\t</DropdownMenu.Item>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { SuiClient } from '@mysten/sui.js/client';\nimport type { UseQueryOptions } from '@tanstack/react-query';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useSuiClientContext } from './useSuiClient.js';\n\nexport type SuiRpcMethodName = {\n\t[K in keyof SuiClient]: SuiClient[K] extends ((input: any) => Promise<any>) | (() => Promise<any>)\n\t\t? K\n\t\t: never;\n}[keyof SuiClient];\n\nexport type SuiRpcMethods = {\n\t[K in SuiRpcMethodName]: SuiClient[K] extends (input: infer P) => Promise<infer R>\n\t\t? {\n\t\t\t\tname: K;\n\t\t\t\tresult: R;\n\t\t\t\tparams: P;\n\t\t }\n\t\t: SuiClient[K] extends () => Promise<infer R>\n\t\t? {\n\t\t\t\tname: K;\n\t\t\t\tresult: R;\n\t\t\t\tparams: undefined | object;\n\t\t }\n\t\t: never;\n};\n\nexport type UseSuiClientQueryOptions<T extends keyof SuiRpcMethods> = Omit<\n\tUseQueryOptions<SuiRpcMethods[T]['result'], Error, SuiRpcMethods[T]['result'], unknown[]>,\n\t'queryFn'\n>;\n\nexport function useSuiClientQuery<T extends keyof SuiRpcMethods>(\n\t...args: undefined extends SuiRpcMethods[T]['params']\n\t\t? [method: T, params?: SuiRpcMethods[T]['params'], options?: UseSuiClientQueryOptions<T>]\n\t\t: [method: T, params: SuiRpcMethods[T]['params'], options?: UseSuiClientQueryOptions<T>]\n) {\n\tconst [method, params, { queryKey = [], ...options } = {}] = args as [\n\t\tmethod: T,\n\t\tparams?: SuiRpcMethods[T]['params'],\n\t\toptions?: UseSuiClientQueryOptions<T>,\n\t];\n\n\tconst suiContext = useSuiClientContext();\n\n\treturn useQuery({\n\t\t...options,\n\t\tqueryKey: [suiContext.network, method, params, ...queryKey],\n\t\tqueryFn: async () => {\n\t\t\treturn await suiContext.client[method](params as never);\n\t\t},\n\t});\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { SuiClient } from '@mysten/sui.js/client';\nimport { useContext } from 'react';\n\nimport { SuiClientContext } from '../components/SuiClientProvider.js';\n\nexport function useSuiClientContext() {\n\tconst suiClient = useContext(SuiClientContext);\n\n\tif (!suiClient) {\n\t\tthrow new Error(\n\t\t\t'Could not find SuiClientContext. Ensure that you have set up the SuiClientProvider',\n\t\t);\n\t}\n\n\treturn suiClient;\n}\n\nexport function useSuiClient(): SuiClient {\n\treturn useSuiClientContext().client;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { getFullnodeUrl, isSuiClient, SuiClient } from '@mysten/sui.js/client';\nimport type { SuiClientOptions } from '@mysten/sui.js/client';\nimport { createContext, useMemo, useState } from 'react';\n\nimport type { NetworkConfig } from '../hooks/networkConfig.js';\n\ntype NetworkConfigs<T extends NetworkConfig | SuiClient = NetworkConfig | SuiClient> = Record<\n\tstring,\n\tT\n>;\n\nexport interface SuiClientProviderContext {\n\tclient: SuiClient;\n\tnetworks: NetworkConfigs;\n\tnetwork: string;\n\tconfig: NetworkConfig | null;\n\tselectNetwork: (network: string) => void;\n}\n\nexport const SuiClientContext = createContext<SuiClientProviderContext | null>(null);\n\nexport type SuiClientProviderProps<T extends NetworkConfigs> = {\n\tcreateClient?: (name: keyof T, config: T[keyof T]) => SuiClient;\n\tchildren: React.ReactNode;\n\tnetworks?: T;\n\tonNetworkChange?: (network: keyof T & string) => void;\n} & (\n\t| {\n\t\t\tdefaultNetwork?: keyof T & string;\n\t\t\tnetwork?: never;\n\t }\n\t| {\n\t\t\tdefaultNetwork?: never;\n\t\t\tnetwork?: keyof T & string;\n\t }\n);\n\nconst DEFAULT_NETWORKS = {\n\tlocalnet: { url: getFullnodeUrl('localnet') },\n};\n\nconst DEFAULT_CREATE_CLIENT = function createClient(\n\t_name: string,\n\tconfig: NetworkConfig | SuiClient,\n) {\n\tif (isSuiClient(config)) {\n\t\treturn config;\n\t}\n\n\treturn new SuiClient(config);\n};\n\nexport function SuiClientProvider<T extends NetworkConfigs>(props: SuiClientProviderProps<T>) {\n\tconst { onNetworkChange, network, children } = props;\n\tconst networks = (props.networks ?? DEFAULT_NETWORKS) as T;\n\tconst createClient =\n\t\t(props.createClient as typeof DEFAULT_CREATE_CLIENT) ?? DEFAULT_CREATE_CLIENT;\n\n\tconst [selectedNetwork, setSelectedNetwork] = useState<keyof T & string>(\n\t\tprops.network ?? props.defaultNetwork ?? (Object.keys(networks)[0] as keyof T & string),\n\t);\n\n\tconst currentNetwork = props.network ?? selectedNetwork;\n\n\tconst client = useMemo(() => {\n\t\treturn createClient(currentNetwork, networks[currentNetwork]);\n\t}, [createClient, currentNetwork, networks]);\n\n\tconst ctx = useMemo((): SuiClientProviderContext => {\n\t\treturn {\n\t\t\tclient,\n\t\t\tnetworks,\n\t\t\tnetwork: currentNetwork,\n\t\t\tconfig:\n\t\t\t\tnetworks[currentNetwork] instanceof SuiClient\n\t\t\t\t\t? null\n\t\t\t\t\t: (networks[currentNetwork] as SuiClientOptions),\n\t\t\tselectNetwork: (newNetwork) => {\n\t\t\t\tif (currentNetwork === newNetwork) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (!network && newNetwork !== selectedNetwork) {\n\t\t\t\t\tsetSelectedNetwork(newNetwork);\n\t\t\t\t}\n\n\t\t\t\tonNetworkChange?.(newNetwork);\n\t\t\t},\n\t\t};\n\t}, [client, networks, selectedNetwork, currentNetwork, network, onNetworkChange]);\n\n\treturn <SuiClientContext.Provider value={ctx}>{children}</SuiClientContext.Provider>;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ResolvedNameServiceNames } from '@mysten/sui.js/client';\nimport type { UseQueryOptions } from '@tanstack/react-query';\n\nimport { useSuiClientQuery } from './useSuiClientQuery.js';\n\nexport function useResolveSuiNSName(\n\taddress?: string | null,\n\toptions?: Omit<\n\t\tUseQueryOptions<ResolvedNameServiceNames, Error, ResolvedNameServiceNames, unknown[]>,\n\t\t'queryFn'\n\t>,\n) {\n\tconst { data, ...rest } = useSuiClientQuery(\n\t\t'resolveNameServiceNames',\n\t\t{\n\t\t\taddress: address!,\n\t\t\tlimit: 1,\n\t\t},\n\t\t{\n\t\t\trefetchOnWindowFocus: false,\n\t\t\tretry: false,\n\t\t\t...options,\n\t\t\tenabled: !!address && options?.enabled !== false,\n\t\t},\n\t);\n\n\treturn { data: data?.data?.[0] ?? null, ...rest };\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useContext } from 'react';\nimport { useStore } from 'zustand';\n\nimport { WalletContext } from '../../contexts/walletContext.js';\nimport type { StoreState } from '../../walletStore.js';\n\nexport function useWalletStore<T>(selector: (state: StoreState) => T): T {\n\tconst store = useContext(WalletContext);\n\tif (!store) {\n\t\tthrow new Error(\n\t\t\t'Could not find WalletContext. Ensure that you have set up the WalletProvider.',\n\t\t);\n\t}\n\treturn useStore(store, selector);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { createContext } from 'react';\n\nimport type { WalletStore } from '../walletStore.js';\n\nexport const WalletContext = createContext<WalletStore | null>(null);\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves a list of connected accounts authorized by the dApp.\n */\nexport function useAccounts() {\n\treturn useWalletStore((state) => state.accounts);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { UseMutationOptions } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { WalletNotConnectedError } from '../../errors/walletErrors.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype UseDisconnectWalletError = WalletNotConnectedError | Error;\n\ntype UseDisconnectWalletMutationOptions = Omit<\n\tUseMutationOptions<void, UseDisconnectWalletError, void, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for disconnecting from an active wallet connection, if currently connected.\n */\nexport function useDisconnectWallet({\n\tmutationKey,\n\t...mutationOptions\n}: UseDisconnectWalletMutationOptions = {}) {\n\tconst currentWallet = useCurrentWallet();\n\tconst setWalletDisconnected = useWalletStore((state) => state.setWalletDisconnected);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.disconnectWallet(mutationKey),\n\t\tmutationFn: async () => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\t// Wallets aren't required to implement the disconnect feature, so we'll\n\t\t\t\t// optionally call the disconnect feature if it exists and reset the UI\n\t\t\t\t// state on the frontend at a minimum.\n\t\t\t\tawait currentWallet.features['standard:disconnect']?.disconnect();\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to disconnect the application from the current wallet.', error);\n\t\t\t}\n\n\t\t\tsetWalletDisconnected();\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { MutationKey } from '@tanstack/react-query';\n\nexport const walletMutationKeys = {\n\tall: { baseScope: 'wallet' },\n\tconnectWallet: formMutationKeyFn('connect-wallet'),\n\tdisconnectWallet: formMutationKeyFn('disconnect-wallet'),\n\tsignPersonalMessage: formMutationKeyFn('sign-personal-message'),\n\tsignTransactionBlock: formMutationKeyFn('sign-transaction-block'),\n\tsignAndExecuteTransactionBlock: formMutationKeyFn('sign-and-execute-transaction-block'),\n\tswitchAccount: formMutationKeyFn('switch-account'),\n};\n\nfunction formMutationKeyFn(baseEntity: string) {\n\treturn function mutationKeyFn(additionalKeys: MutationKey = []) {\n\t\treturn [{ ...walletMutationKeys.all, baseEntity }, ...additionalKeys];\n\t};\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires an active wallet connection.\n */\nexport class WalletNotConnectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that requires a selected wallet account.\n * This is more of an edge case stemming from the fact that wallets don't technically require you to authorize any\n * accounts when connecting a wallet.\n */\nexport class WalletNoAccountSelectedError extends Error {}\n\n/**\n * An error that is instantiated when someone attempts to perform an action that isn't supported by a wallet.\n */\nexport class WalletFeatureNotSupportedError extends Error {}\n\n/**\n * An error that is instantiated when a wallet account can't be found for a specific wallet.\n */\nexport class WalletAccountNotFoundError extends Error {}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Retrieves the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n\treturn useWalletStore((state) => state.currentWallet);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletAccount } from '@mysten/wallet-standard';\nimport type { UseMutationOptions } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { WalletAccountNotFoundError, WalletNotConnectedError } from '../../errors/walletErrors.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype SwitchAccountArgs = {\n\taccount: WalletAccount;\n};\n\ntype SwitchAccountResult = void;\n\ntype UseSwitchAccountError = WalletNotConnectedError | WalletAccountNotFoundError | Error;\n\ntype UseSwitchAccountMutationOptions = Omit<\n\tUseMutationOptions<SwitchAccountResult, UseSwitchAccountError, SwitchAccountArgs, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for switching to a specific wallet account.\n */\nexport function useSwitchAccount({\n\tmutationKey,\n\t...mutationOptions\n}: UseSwitchAccountMutationOptions = {}) {\n\tconst currentWallet = useCurrentWallet();\n\tconst setAccountSwitched = useWalletStore((state) => state.setAccountSwitched);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.switchAccount(mutationKey),\n\t\tmutationFn: async ({ account }) => {\n\t\t\tif (!currentWallet) {\n\t\t\t\tthrow new WalletNotConnectedError('No wallet is connected.');\n\t\t\t}\n\n\t\t\tconst accountToSelect = currentWallet.accounts.find(\n\t\t\t\t(walletAccount) => walletAccount.address === account.address,\n\t\t\t);\n\t\t\tif (!accountToSelect) {\n\t\t\t\tthrow new WalletAccountNotFoundError(\n\t\t\t\t\t`No account with address ${account.address} is connected to ${currentWallet.name}.`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tsetAccountSwitched(accountToSelect);\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n", "import 'src/components/AccountDropdownMenu.css.ts.vanilla.css?source=LkFjY291bnREcm9wZG93bk1lbnVfY29ubmVjdGVkQWNjb3VudF9fZGl2MnFsMCB7CiAgZ2FwOiA4cHg7Cn0KLkFjY291bnREcm9wZG93bk1lbnVfbWVudUNvbnRlbnRfX2RpdjJxbDEgewogIGRpc3BsYXk6IGZsZXg7CiAgZmxleC1kaXJlY3Rpb246IGNvbHVtbjsKICB3aWR0aDogMTgwcHg7CiAgbWF4LWhlaWdodDogMjAwcHg7CiAgbWFyZ2luLXRvcDogNHB4OwogIHBhZGRpbmc6IDhweDsKICBnYXA6IDhweDsKICBib3JkZXItcmFkaXVzOiB2YXIoLS1kYXBwLWtpdC1yYWRpaS1sYXJnZSk7CiAgYmFja2dyb3VuZC1jb2xvcjogdmFyKC0tZGFwcC1raXQtYmFja2dyb3VuZENvbG9ycy1kcm9wZG93bk1lbnUpOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X21lbnVJdGVtX19kaXYycWwyIHsKICBwYWRkaW5nOiA4cHg7CiAgdXNlci1zZWxlY3Q6IG5vbmU7CiAgb3V0bGluZTogbm9uZTsKICBkaXNwbGF5OiBmbGV4OwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgYm9yZGVyLXJhZGl1czogdmFyKC0tZGFwcC1raXQtcmFkaWktbGFyZ2UpOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X21lbnVJdGVtX19kaXYycWwyW2RhdGEtaGlnaGxpZ2h0ZWRdIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1kYXBwLWtpdC1iYWNrZ3JvdW5kQ29sb3JzLXByaW1hcnlCdXR0b24pOwp9Ci5BY2NvdW50RHJvcGRvd25NZW51X3N3aXRjaEFjY291bnRNZW51SXRlbV9fZGl2MnFsMyB7CiAgZGlzcGxheTogZmxleDsKICBqdXN0aWZ5LWNvbnRlbnQ6IHNwYWNlLWJldHdlZW47CiAgYWxpZ24taXRlbXM6IGNlbnRlcjsKfQouQWNjb3VudERyb3Bkb3duTWVudV9zZXBhcmF0b3JfX2RpdjJxbDQgewogIGhlaWdodDogMXB4OwogIGZsZXgtc2hyaW5rOiAwOwogIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWRhcHAta2l0LWJhY2tncm91bmRDb2xvcnMtZHJvcGRvd25NZW51U2VwYXJhdG9yKTsKfQ==';\nexport var connectedAccount = 'AccountDropdownMenu_connectedAccount__div2ql0';\nexport var menuContent = 'AccountDropdownMenu_menuContent__div2ql1';\nexport var menuItem = 'AccountDropdownMenu_menuItem__div2ql2';\nexport var separator = 'AccountDropdownMenu_separator__div2ql4';\nexport var switchAccountMenuItem = 'AccountDropdownMenu_switchAccountMenuItem__div2ql3';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentProps } from 'react';\n\nexport function CheckIcon(props: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width={16} height={16} fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\td=\"m11.726 5.048-4.73 5.156-1.722-1.879a.72.72 0 0 0-.529-.23.722.722 0 0 0-.525.24.858.858 0 0 0-.22.573.86.86 0 0 0 .211.576l2.255 2.458c.14.153.332.24.53.24.2 0 .391-.087.532-.24l5.261-5.735A.86.86 0 0 0 13 5.63a.858.858 0 0 0-.22-.572.722.722 0 0 0-.525-.24.72.72 0 0 0-.529.23Z\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentProps } from 'react';\n\nexport function ChevronIcon(props: ComponentProps<'svg'>) {\n\treturn (\n\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" width={16} height={16} fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tstroke=\"#A0B6C3\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth={1.5}\n\t\t\t\td=\"m4 6 4 4 4-4\"\n\t\t\t/>\n\t\t</svg>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport type { ComponentPropsWithoutRef, ElementRef, ReactNode } from 'react';\nimport { forwardRef } from 'react';\n\nimport { styleDataAttribute } from '../../constants/styleDataAttribute.js';\n\nimport './StyleMarker.css.js';\n\ntype StyleMarker = {\n\tchildren: ReactNode;\n};\n\nexport const StyleMarker = forwardRef<\n\tElementRef<typeof Slot>,\n\tComponentPropsWithoutRef<typeof Slot>\n>(({ children }, forwardedRef) => (\n\t<Slot ref={forwardedRef} {...styleDataAttribute}>\n\t\t{children}\n\t</Slot>\n));\nStyleMarker.displayName = 'StyleMarker';\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nexport const styleDataAttributeName = 'data-dapp-kit';\n\nexport const styleDataAttributeSelector = `[${styleDataAttributeName}]`;\n\nexport const styleDataAttribute = { [styleDataAttributeName]: '' };\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport clsx from 'clsx';\nimport type { ButtonHTMLAttributes } from 'react';\nimport { forwardRef } from 'react';\n\nimport { buttonVariants } from './Button.css.js';\nimport type { ButtonVariants } from './Button.css.js';\n\ntype ButtonProps = {\n\tasChild?: boolean;\n} & ButtonHTMLAttributes<HTMLButtonElement> &\n\tButtonVariants;\n\nconst Button = forwardRef<HTMLButtonElement, ButtonProps>(\n\t({ className, variant, size, asChild = false, ...props }, forwardedRef) => {\n\t\tconst Comp = asChild ? Slot : 'button';\n\t\treturn (\n\t\t\t<Comp\n\t\t\t\t{...props}\n\t\t\t\tclassName={clsx(buttonVariants({ variant, size }), className)}\n\t\t\t\tref={forwardedRef}\n\t\t\t/>\n\t\t);\n\t},\n);\nButton.displayName = 'Button';\n\nexport { Button };\n", "import 'src/components/ui/Button.css.ts.vanilla.css?source=#H4sIAAAAAAAAA62Tz1LCMBDG7zxFjnIIQxEdptz04hPosbNtQruSJjFJodXx3U1aOoAVhNFL0/n2z+/bbTN5qJxTMknb4xkMgnQ2SerILqK3KfkYEcLQagFNTFAKlJyuBK+XXgeBuaToeGljknHpuAnya2UdrhqaKa9IdxhaeYluOeaFlzdgbihloDVdo6Mh9tKGLC05w6ocL0efo8l5g7E3B6ngrHWqNGTovNPp5O5M8aZ7SbTBEkzTN4vaHilk69yoSjI/gVBmYHSf8Bjilu7adKxxmPPnwuxUeqpqagtgajuo6eRh0dWzxYXacPMfEz6FRpdYUJUL/0tvYdbBlWHc0C0yV8Qk0vVyL1rXCB4TqwSyA/mEyTa4M7hDXfoJvqdfPcqftnlE/3WbFt95UrIefXu4RQP+ntgBMci4v0SEaGAMZR6Tha5JdB+Wfp4n8p43v5gnwOT8GBdQZDb3Dw/8AmeLhNtrBAAA';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var buttonVariants = _7a468({defaultClassName:'Button_buttonVariants__x1s81q0',variantClassNames:{variant:{primary:'Button_buttonVariants_variant_primary__x1s81q1',outline:'Button_buttonVariants_variant_outline__x1s81q2'},size:{md:'Button_buttonVariants_size_md__x1s81q3',lg:'Button_buttonVariants_size_lg__x1s81q4'}},defaultVariants:{variant:'primary',size:'md'},compoundVariants:[]});", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Slot } from '@radix-ui/react-slot';\nimport clsx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { textVariants } from './Text.css.js';\nimport type { TextVariants } from './Text.css.js';\n\ntype TextAsChildProps = {\n\tasChild?: boolean;\n\tas?: never;\n};\n\ntype TextDivProps = { as: 'div'; asChild?: never };\n\ntype TextProps = (TextAsChildProps | TextDivProps) &\n\tReact.HTMLAttributes<HTMLDivElement> &\n\tTextVariants;\n\nconst Text = forwardRef<HTMLDivElement, TextProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tasChild = false,\n\t\t\tas: Tag = 'div',\n\t\t\tsize,\n\t\t\tweight,\n\t\t\tcolor,\n\t\t\tmono,\n\t\t\t...textProps\n\t\t},\n\t\tforwardedRef,\n\t) => {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\t{...textProps}\n\t\t\t\tref={forwardedRef}\n\t\t\t\tclassName={clsx(textVariants({ size, weight, color, mono }), className)}\n\t\t\t>\n\t\t\t\t{asChild ? children : <Tag>{children}</Tag>}\n\t\t\t</Slot>\n\t\t);\n\t},\n);\nText.displayName = 'Text';\n\nexport { Text };\n", "import 'src/components/ui/Text.css.ts.vanilla.css?source=LlRleHRfdGV4dFZhcmlhbnRzX3NpemVfc21fXzJidjF1cjEgewogIGZvbnQtc2l6ZTogdmFyKC0tZGFwcC1raXQtZm9udFNpemVzLXNtYWxsKTsKfQouVGV4dF90ZXh0VmFyaWFudHNfd2VpZ2h0X25vcm1hbF9fMmJ2MXVyMiB7CiAgZm9udC13ZWlnaHQ6IHZhcigtLWRhcHAta2l0LWZvbnRXZWlnaHRzLW5vcm1hbCk7Cn0KLlRleHRfdGV4dFZhcmlhbnRzX3dlaWdodF9tZWRpdW1fXzJidjF1cjMgewogIGZvbnQtd2VpZ2h0OiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1tZWRpdW0pOwp9Ci5UZXh0X3RleHRWYXJpYW50c193ZWlnaHRfYm9sZF9fMmJ2MXVyNCB7CiAgZm9udC13ZWlnaHQ6IHZhcigtLWRhcHAta2l0LWZvbnRXZWlnaHRzLWJvbGQpOwp9Ci5UZXh0X3RleHRWYXJpYW50c19jb2xvcl9tdXRlZF9fMmJ2MXVyNSB7CiAgY29sb3I6IHZhcigtLWRhcHAta2l0LWNvbG9ycy1ib2R5TXV0ZWQpOwp9Ci5UZXh0X3RleHRWYXJpYW50c19jb2xvcl9kYW5nZXJfXzJidjF1cjYgewogIGNvbG9yOiB2YXIoLS1kYXBwLWtpdC1jb2xvcnMtYm9keURhbmdlcik7Cn0KLlRleHRfdGV4dFZhcmlhbnRzX21vbm9fdHJ1ZV9fMmJ2MXVyNyB7CiAgZm9udC1mYW1pbHk6IHVpLW1vbm9zcGFjZSwgU0ZNb25vLVJlZ3VsYXIsIE1lbmxvLCBNb25hY28sIENvbnNvbGFzLCAiTGliZXJhdGlvbiBNb25vIiwgIkNvdXJpZXIgTmV3IiwgbW9ub3NwYWNlOwp9';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var textVariants = _7a468({defaultClassName:'Text__2bv1ur0',variantClassNames:{size:{sm:'Text_textVariants_size_sm__2bv1ur1'},weight:{normal:'Text_textVariants_weight_normal__2bv1ur2',medium:'Text_textVariants_weight_medium__2bv1ur3',bold:'Text_textVariants_weight_bold__2bv1ur4'},color:{muted:'Text_textVariants_color_muted__2bv1ur5',danger:'Text_textVariants_color_danger__2bv1ur6'},mono:{true:'Text_textVariants_mono_true__2bv1ur7'}},defaultVariants:{size:'sm',weight:'normal'},compoundVariants:[]});"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,SAAS,qBAAqB;AAE9B,YAAY,kBAAkB;AAC9B,OAAOA,WAAU;;;ACDjB,SAAS,gBAAgB;;;ACDzB,SAAS,kBAAkB;;;ACD3B,SAAS,gBAAgB,aAAa,iBAAiB;AAEvD,SAAS,eAAe,SAAS,gBAAgB;AAyFzC;AAxED,IAAM,mBAAmB,cAA+C,IAAI;AAkBnF,IAAM,mBAAmB;AAAA,EACxB,UAAU,EAAE,KAAK,eAAe,UAAU,EAAE;AAC7C;;;ADlCO,SAAS,sBAAsB;AACrC,QAAM,YAAY,WAAW,g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Q;AAAA;AAAA,QAFtC,QAAQ;AAAA,MAGd,CACA;AAAA,MACD,gBAAAA,KAAc,wBAAb,EAAuB,WAAkB,WAAW;AAAA,MACrD,gBAAAA;AAAA,QAAc;AAAA,QAAb;AAAA,UACA,WAAWC,MAAY,QAAQ;AAAA,UAC/B,UAAU,MAAM,iBAAiB;AAAA,UACjC;AAAA;AAAA,MAED;AAAA,OACD,GACD,GACD;AAAA,KACD;AAEF;AAEO,SAAS,wBAAwB;AAAA,EACvC;AAAA,EACA;AACD,GAGG;AACF,QAAM,EAAE,QAAQ,cAAc,IAAI,iBAAiB;AACnD,QAAM,EAAE,MAAM,OAAO,IAAI,oBAAoB,QAAQ,QAAQ,OAAO,QAAQ,OAAO;AAEnF,SACC;AAAA,IAAc;AAAA,IAAb;AAAA,MACA,WAAWA,MAAY,UAAiB,qBAAqB;AAAA,MAC7D,UAAU,MAAM,cAAc,EAAE,QAAQ,CAAC;AAAA,MAEzC;AAAA,wBAAAD,KAAC,QAAK,MAAI,MAAE,kBAAQ,SAAS,UAAU,cAAc,QAAQ,OAAO,GAAE;AAAA,QACrE,SAAS,gBAAAA,KAAC,aAAU,IAAK;AAAA;AAAA;AAAA,EAC3B;AAEF;",
|
|
6
|
+
"names": ["clsx", "useContext", "createContext", "useContext", "useMutation", "useMutation", "jsx", "jsx", "jsx", "Slot", "forwardRef", "jsx", "forwardRef", "Slot", "Slot", "clsx", "forwardRef", "_7a468", "jsx", "forwardRef", "Slot", "clsx", "jsx", "clsx"]
|
|
7
7
|
}
|