@haneullabs/dapp-kit 1.0.3 → 1.0.5

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/components/connect-modal/wallet-list/WalletList.tsx", "../../../../src/utils/walletUtils.ts", "../../../../src/components/connect-modal/wallet-list/WalletList.css.ts", "../../../../src/components/connect-modal/wallet-list/WalletListItem.tsx", "../../../../src/components/ui/Heading.tsx", "../../../../src/components/ui/Heading.css.ts", "../../../../src/components/connect-modal/wallet-list/WalletListItem.css.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletWithRequiredFeatures } from '@haneullabs/wallet-standard';\nimport { SLUSH_WALLET_NAME, SLUSH_WALLET_ICON } from '@haneullabs/slush-wallet';\n\nimport { getWalletUniqueIdentifier } from '../../../utils/walletUtils.js';\nimport * as styles from './WalletList.css.js';\nimport { WalletListItem } from './WalletListItem.js';\n\ntype WalletListProps = {\n\tselectedWalletName?: string;\n\tonPlaceholderClick: () => void;\n\tonSelect: (wallet: WalletWithRequiredFeatures) => void;\n\twallets: WalletWithRequiredFeatures[];\n};\n\nexport function WalletList({\n\tselectedWalletName,\n\tonPlaceholderClick,\n\tonSelect,\n\twallets,\n}: WalletListProps) {\n\treturn (\n\t\t<ul className={styles.container}>\n\t\t\t{wallets.length > 0 ? (\n\t\t\t\twallets.map((wallet) => (\n\t\t\t\t\t<WalletListItem\n\t\t\t\t\t\tkey={getWalletUniqueIdentifier(wallet)}\n\t\t\t\t\t\tname={wallet.name}\n\t\t\t\t\t\ticon={wallet.icon}\n\t\t\t\t\t\tisSelected={getWalletUniqueIdentifier(wallet) === selectedWalletName}\n\t\t\t\t\t\tonClick={() => onSelect(wallet)}\n\t\t\t\t\t/>\n\t\t\t\t))\n\t\t\t) : (\n\t\t\t\t<WalletListItem\n\t\t\t\t\tname={SLUSH_WALLET_NAME}\n\t\t\t\t\ticon={SLUSH_WALLET_ICON}\n\t\t\t\t\tonClick={onPlaceholderClick}\n\t\t\t\t\tisSelected\n\t\t\t\t/>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst suiWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => suiWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...suiWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\n}\n", "import 'src/components/connect-modal/wallet-list/WalletList.css.ts.vanilla.css?source=LldhbGxldExpc3RfY29udGFpbmVyX182ZTlrN2swIHsKICBkaXNwbGF5OiBmbGV4OwogIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgZ2FwOiA0cHg7Cn0';\nexport var container = 'WalletList_container__6e9k7k0';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { clsx } from 'clsx';\nimport type { ReactNode } from 'react';\n\nimport { Heading } from '../../ui/Heading.js';\nimport * as styles from './WalletListItem.css.js';\n\ntype WalletListItemProps = {\n\tname: string;\n\ticon: ReactNode;\n\tisSelected?: boolean;\n\tonClick: () => void;\n};\n\nexport function WalletListItem({ name, icon, onClick, isSelected = false }: WalletListItemProps) {\n\treturn (\n\t\t<li className={styles.container}>\n\t\t\t<button\n\t\t\t\tclassName={clsx(styles.walletItem, { [styles.selectedWalletItem]: isSelected })}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onClick}\n\t\t\t>\n\t\t\t\t{icon && typeof icon === 'string' ? (\n\t\t\t\t\t<img className={styles.walletIcon} src={icon} alt={`${name} logo`} />\n\t\t\t\t) : (\n\t\t\t\t\ticon\n\t\t\t\t)}\n\t\t\t\t<Heading size=\"md\" truncate asChild>\n\t\t\t\t\t<div>{name}</div>\n\t\t\t\t</Heading>\n\t\t\t</button>\n\t\t</li>\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 clsx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { headingVariants } from './Heading.css.js';\nimport type { HeadingVariants } from './Heading.css.js';\n\ntype HeadingAsChildProps = {\n\tasChild?: boolean;\n\tas?: never;\n};\n\ntype HeadingAsProps = {\n\tas?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\tasChild?: never;\n};\n\ntype HeadingProps = (HeadingAsChildProps | HeadingAsProps) &\n\tReact.HTMLAttributes<HTMLHeadingElement> &\n\tHeadingVariants;\n\nconst Heading = forwardRef<HTMLHeadingElement, HeadingProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tasChild = false,\n\t\t\tas: Tag = 'h1',\n\t\t\tsize,\n\t\t\tweight,\n\t\t\ttruncate,\n\t\t\t...headingProps\n\t\t},\n\t\tforwardedRef,\n\t) => {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\t{...headingProps}\n\t\t\t\tref={forwardedRef}\n\t\t\t\tclassName={clsx(headingVariants({ size, weight, truncate }), 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);\nHeading.displayName = 'Heading';\n\nexport { Heading };\n", "import 'src/components/ui/Heading.css.ts.vanilla.css?source=LkhlYWRpbmdfaGVhZGluZ1ZhcmlhbnRzX3NpemVfc21fX3J5cTg1czEgewogIGZvbnQtc2l6ZTogdmFyKC0tZGFwcC1raXQtZm9udFNpemVzLXNtYWxsKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfc2l6ZV9tZF9fcnlxODVzMiB7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250U2l6ZXMtbWVkaXVtKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfc2l6ZV9sZ19fcnlxODVzMyB7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250U2l6ZXMtbGFyZ2UpOwp9Ci5IZWFkaW5nX2hlYWRpbmdWYXJpYW50c19zaXplX3hsX19yeXE4NXM0IHsKICBmb250LXNpemU6IHZhcigtLWRhcHAta2l0LWZvbnRTaXplcy14bGFyZ2UpOwp9Ci5IZWFkaW5nX2hlYWRpbmdWYXJpYW50c193ZWlnaHRfbm9ybWFsX19yeXE4NXM1IHsKICBmb250LXdlaWdodDogdmFyKC0tZGFwcC1raXQtZm9udFdlaWdodHMtbm9ybWFsKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfd2VpZ2h0X2JvbGRfX3J5cTg1czYgewogIGZvbnQtd2VpZ2h0OiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1ib2xkKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfdHJ1bmNhdGVfdHJ1ZV9fcnlxODVzNyB7CiAgb3ZlcmZsb3c6IGhpZGRlbjsKICB0ZXh0LW92ZXJmbG93OiBlbGxpcHNpczsKICB3aGl0ZS1zcGFjZTogbm93cmFwOwp9';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var headingVariants = _7a468({defaultClassName:'Heading__ryq85s0',variantClassNames:{size:{sm:'Heading_headingVariants_size_sm__ryq85s1',md:'Heading_headingVariants_size_md__ryq85s2',lg:'Heading_headingVariants_size_lg__ryq85s3',xl:'Heading_headingVariants_size_xl__ryq85s4'},weight:{normal:'Heading_headingVariants_weight_normal__ryq85s5',bold:'Heading_headingVariants_weight_bold__ryq85s6'},truncate:{true:'Heading_headingVariants_truncate_true__ryq85s7'}},defaultVariants:{size:'lg',weight:'bold'},compoundVariants:[]});", "import 'src/components/connect-modal/wallet-list/WalletListItem.css.ts.vanilla.css?source=LldhbGxldExpc3RJdGVtX2NvbnRhaW5lcl9fMWs5c2ZlOTAgewogIGRpc3BsYXk6IGZsZXg7Cn0KLldhbGxldExpc3RJdGVtX3dhbGxldEl0ZW1fXzFrOXNmZTkxIHsKICBkaXNwbGF5OiBmbGV4OwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleC1ncm93OiAxOwogIHBhZGRpbmc6IDhweDsKICBnYXA6IDhweDsKICBib3JkZXItcmFkaXVzOiB2YXIoLS1kYXBwLWtpdC1yYWRpaS1sYXJnZSk7Cn0KLldhbGxldExpc3RJdGVtX3dhbGxldEl0ZW1fXzFrOXNmZTkxOmhvdmVyIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1kYXBwLWtpdC1iYWNrZ3JvdW5kQ29sb3JzLXdhbGxldEl0ZW1Ib3Zlcik7Cn0KLldhbGxldExpc3RJdGVtX3NlbGVjdGVkV2FsbGV0SXRlbV9fMWs5c2ZlOTIgewogIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWRhcHAta2l0LWJhY2tncm91bmRDb2xvcnMtd2FsbGV0SXRlbVNlbGVjdGVkKTsKICBib3gtc2hhZG93OiAwcHggMnB4IDZweCByZ2JhKDAsIDAsIDAsIDAuMDUpOwp9Ci5XYWxsZXRMaXN0SXRlbV93YWxsZXRJY29uX18xazlzZmU5MyB7CiAgd2lkdGg6IDI4cHg7CiAgaGVpZ2h0OiAyOHB4OwogIGZsZXgtc2hyaW5rOiAwOwogIG9iamVjdC1maXQ6IGNvdmVyOwogIGJvcmRlci1yYWRpdXM6IHZhcigtLWRhcHAta2l0LXJhZGlpLXNtYWxsKTsKfQ';\nexport var container = 'WalletListItem_container__1k9sfe90';\nexport var selectedWalletItem = 'WalletListItem_selectedWalletItem__1k9sfe92';\nexport var walletIcon = 'WalletListItem_walletIcon__1k9sfe93';\nexport var walletItem = 'WalletListItem_walletItem__1k9sfe91';"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletWithRequiredFeatures } from '@haneullabs/wallet-standard';\nimport { SLUSH_WALLET_NAME, SLUSH_WALLET_ICON } from '@haneullabs/slush-wallet';\n\nimport { getWalletUniqueIdentifier } from '../../../utils/walletUtils.js';\nimport * as styles from './WalletList.css.js';\nimport { WalletListItem } from './WalletListItem.js';\n\ntype WalletListProps = {\n\tselectedWalletName?: string;\n\tonPlaceholderClick: () => void;\n\tonSelect: (wallet: WalletWithRequiredFeatures) => void;\n\twallets: WalletWithRequiredFeatures[];\n};\n\nexport function WalletList({\n\tselectedWalletName,\n\tonPlaceholderClick,\n\tonSelect,\n\twallets,\n}: WalletListProps) {\n\treturn (\n\t\t<ul className={styles.container}>\n\t\t\t{wallets.length > 0 ? (\n\t\t\t\twallets.map((wallet) => (\n\t\t\t\t\t<WalletListItem\n\t\t\t\t\t\tkey={getWalletUniqueIdentifier(wallet)}\n\t\t\t\t\t\tname={wallet.name}\n\t\t\t\t\t\ticon={wallet.icon}\n\t\t\t\t\t\tisSelected={getWalletUniqueIdentifier(wallet) === selectedWalletName}\n\t\t\t\t\t\tonClick={() => onSelect(wallet)}\n\t\t\t\t\t/>\n\t\t\t\t))\n\t\t\t) : (\n\t\t\t\t<WalletListItem\n\t\t\t\t\tname={SLUSH_WALLET_NAME}\n\t\t\t\t\ticon={SLUSH_WALLET_ICON}\n\t\t\t\t\tonClick={onPlaceholderClick}\n\t\t\t\t\tisSelected\n\t\t\t\t/>\n\t\t\t)}\n\t\t</ul>\n\t);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst haneulWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => haneulWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...haneulWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\n}\n", "import 'src/components/connect-modal/wallet-list/WalletList.css.ts.vanilla.css?source=LldhbGxldExpc3RfY29udGFpbmVyX182ZTlrN2swIHsKICBkaXNwbGF5OiBmbGV4OwogIGZsZXgtZGlyZWN0aW9uOiBjb2x1bW47CiAgZ2FwOiA0cHg7Cn0';\nexport var container = 'WalletList_container__6e9k7k0';", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { clsx } from 'clsx';\nimport type { ReactNode } from 'react';\n\nimport { Heading } from '../../ui/Heading.js';\nimport * as styles from './WalletListItem.css.js';\n\ntype WalletListItemProps = {\n\tname: string;\n\ticon: ReactNode;\n\tisSelected?: boolean;\n\tonClick: () => void;\n};\n\nexport function WalletListItem({ name, icon, onClick, isSelected = false }: WalletListItemProps) {\n\treturn (\n\t\t<li className={styles.container}>\n\t\t\t<button\n\t\t\t\tclassName={clsx(styles.walletItem, { [styles.selectedWalletItem]: isSelected })}\n\t\t\t\ttype=\"button\"\n\t\t\t\tonClick={onClick}\n\t\t\t>\n\t\t\t\t{icon && typeof icon === 'string' ? (\n\t\t\t\t\t<img className={styles.walletIcon} src={icon} alt={`${name} logo`} />\n\t\t\t\t) : (\n\t\t\t\t\ticon\n\t\t\t\t)}\n\t\t\t\t<Heading size=\"md\" truncate asChild>\n\t\t\t\t\t<div>{name}</div>\n\t\t\t\t</Heading>\n\t\t\t</button>\n\t\t</li>\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 clsx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport { headingVariants } from './Heading.css.js';\nimport type { HeadingVariants } from './Heading.css.js';\n\ntype HeadingAsChildProps = {\n\tasChild?: boolean;\n\tas?: never;\n};\n\ntype HeadingAsProps = {\n\tas?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';\n\tasChild?: never;\n};\n\ntype HeadingProps = (HeadingAsChildProps | HeadingAsProps) &\n\tReact.HTMLAttributes<HTMLHeadingElement> &\n\tHeadingVariants;\n\nconst Heading = forwardRef<HTMLHeadingElement, HeadingProps>(\n\t(\n\t\t{\n\t\t\tchildren,\n\t\t\tclassName,\n\t\t\tasChild = false,\n\t\t\tas: Tag = 'h1',\n\t\t\tsize,\n\t\t\tweight,\n\t\t\ttruncate,\n\t\t\t...headingProps\n\t\t},\n\t\tforwardedRef,\n\t) => {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\t{...headingProps}\n\t\t\t\tref={forwardedRef}\n\t\t\t\tclassName={clsx(headingVariants({ size, weight, truncate }), 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);\nHeading.displayName = 'Heading';\n\nexport { Heading };\n", "import 'src/components/ui/Heading.css.ts.vanilla.css?source=LkhlYWRpbmdfaGVhZGluZ1ZhcmlhbnRzX3NpemVfc21fX3J5cTg1czEgewogIGZvbnQtc2l6ZTogdmFyKC0tZGFwcC1raXQtZm9udFNpemVzLXNtYWxsKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfc2l6ZV9tZF9fcnlxODVzMiB7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250U2l6ZXMtbWVkaXVtKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfc2l6ZV9sZ19fcnlxODVzMyB7CiAgZm9udC1zaXplOiB2YXIoLS1kYXBwLWtpdC1mb250U2l6ZXMtbGFyZ2UpOwp9Ci5IZWFkaW5nX2hlYWRpbmdWYXJpYW50c19zaXplX3hsX19yeXE4NXM0IHsKICBmb250LXNpemU6IHZhcigtLWRhcHAta2l0LWZvbnRTaXplcy14bGFyZ2UpOwp9Ci5IZWFkaW5nX2hlYWRpbmdWYXJpYW50c193ZWlnaHRfbm9ybWFsX19yeXE4NXM1IHsKICBmb250LXdlaWdodDogdmFyKC0tZGFwcC1raXQtZm9udFdlaWdodHMtbm9ybWFsKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfd2VpZ2h0X2JvbGRfX3J5cTg1czYgewogIGZvbnQtd2VpZ2h0OiB2YXIoLS1kYXBwLWtpdC1mb250V2VpZ2h0cy1ib2xkKTsKfQouSGVhZGluZ19oZWFkaW5nVmFyaWFudHNfdHJ1bmNhdGVfdHJ1ZV9fcnlxODVzNyB7CiAgb3ZlcmZsb3c6IGhpZGRlbjsKICB0ZXh0LW92ZXJmbG93OiBlbGxpcHNpczsKICB3aGl0ZS1zcGFjZTogbm93cmFwOwp9';\nimport { createRuntimeFn as _7a468 } from '@vanilla-extract/recipes/createRuntimeFn';\nexport var headingVariants = _7a468({defaultClassName:'Heading__ryq85s0',variantClassNames:{size:{sm:'Heading_headingVariants_size_sm__ryq85s1',md:'Heading_headingVariants_size_md__ryq85s2',lg:'Heading_headingVariants_size_lg__ryq85s3',xl:'Heading_headingVariants_size_xl__ryq85s4'},weight:{normal:'Heading_headingVariants_weight_normal__ryq85s5',bold:'Heading_headingVariants_weight_bold__ryq85s6'},truncate:{true:'Heading_headingVariants_truncate_true__ryq85s7'}},defaultVariants:{size:'lg',weight:'bold'},compoundVariants:[]});", "import 'src/components/connect-modal/wallet-list/WalletListItem.css.ts.vanilla.css?source=LldhbGxldExpc3RJdGVtX2NvbnRhaW5lcl9fMWs5c2ZlOTAgewogIGRpc3BsYXk6IGZsZXg7Cn0KLldhbGxldExpc3RJdGVtX3dhbGxldEl0ZW1fXzFrOXNmZTkxIHsKICBkaXNwbGF5OiBmbGV4OwogIGFsaWduLWl0ZW1zOiBjZW50ZXI7CiAgZmxleC1ncm93OiAxOwogIHBhZGRpbmc6IDhweDsKICBnYXA6IDhweDsKICBib3JkZXItcmFkaXVzOiB2YXIoLS1kYXBwLWtpdC1yYWRpaS1sYXJnZSk7Cn0KLldhbGxldExpc3RJdGVtX3dhbGxldEl0ZW1fXzFrOXNmZTkxOmhvdmVyIHsKICBiYWNrZ3JvdW5kLWNvbG9yOiB2YXIoLS1kYXBwLWtpdC1iYWNrZ3JvdW5kQ29sb3JzLXdhbGxldEl0ZW1Ib3Zlcik7Cn0KLldhbGxldExpc3RJdGVtX3NlbGVjdGVkV2FsbGV0SXRlbV9fMWs5c2ZlOTIgewogIGJhY2tncm91bmQtY29sb3I6IHZhcigtLWRhcHAta2l0LWJhY2tncm91bmRDb2xvcnMtd2FsbGV0SXRlbVNlbGVjdGVkKTsKICBib3gtc2hhZG93OiAwcHggMnB4IDZweCByZ2JhKDAsIDAsIDAsIDAuMDUpOwp9Ci5XYWxsZXRMaXN0SXRlbV93YWxsZXRJY29uX18xazlzZmU5MyB7CiAgd2lkdGg6IDI4cHg7CiAgaGVpZ2h0OiAyOHB4OwogIGZsZXgtc2hyaW5rOiAwOwogIG9iamVjdC1maXQ6IGNvdmVyOwogIGJvcmRlci1yYWRpdXM6IHZhcigtLWRhcHAta2l0LXJhZGlpLXNtYWxsKTsKfQ';\nexport var container = 'WalletListItem_container__1k9sfe90';\nexport var selectedWalletItem = 'WalletListItem_selectedWalletItem__1k9sfe92';\nexport var walletIcon = 'WalletListItem_walletIcon__1k9sfe93';\nexport var walletItem = 'WalletListItem_walletItem__1k9sfe91';"],
5
5
  "mappings": ";AAIA,SAAS,mBAAmB,yBAAyB;;;ACKrD,SAAS,YAAY,sCAAsC;AAyBpD,SAAS,0BAA0B,QAAiB;AAC1D,SAAO,QAAQ,MAAM,QAAQ;AAC9B;;;ACnCO,IAAI,YAAY;;;ACEvB,SAAS,QAAAA,aAAY;;;ACArB,SAAS,YAAY;AACrB,OAAO,UAAU;AACjB,SAAS,kBAAkB;;;ACJ3B,SAAS,mBAAmB,cAAc;AACnC,IAAI,kBAAkB,OAAO,EAAC,kBAAiB,oBAAmB,mBAAkB,EAAC,MAAK,EAAC,IAAG,4CAA2C,IAAG,4CAA2C,IAAG,4CAA2C,IAAG,2CAA0C,GAAE,QAAO,EAAC,QAAO,kDAAiD,MAAK,+CAA8C,GAAE,UAAS,EAAC,MAAK,iDAAgD,EAAC,GAAE,iBAAgB,EAAC,MAAK,MAAK,QAAO,OAAM,GAAE,kBAAiB,CAAC,EAAC,CAAC;;;AD0Ctf;AApB1B,IAAM,UAAU;AAA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AAAA,MACb,YAAY,0BAA0B,MAAM,MAAM;AAAA,MAClD,SAAS,MAAM,SAAS,MAAM;AAAA;AAAA,IAJzB,0BAA0B,MAAM;AAAA,EAKtC,CACA,IAED,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACA,MAAM;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,MACT,YAAU;AAAA;AAAA,EACX,GAEF;AAEF;",
6
6
  "names": ["clsx", "container", "jsx", "container", "clsx", "jsx"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/wallet/useAutoConnectWallet.ts", "../../../src/utils/walletUtils.ts", "../../../src/hooks/wallet/useConnectWallet.ts", "../../../src/constants/walletMutationKeys.ts", "../../../src/hooks/wallet/useWalletStore.ts", "../../../src/contexts/walletContext.ts", "../../../src/hooks/wallet/useCurrentWallet.ts", "../../../src/hooks/wallet/useWallets.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useQuery } from '@tanstack/react-query';\nimport { useEffect, useLayoutEffect, useState } from 'react';\n\nimport { getWalletUniqueIdentifier } from '../../utils/walletUtils.js';\nimport { useConnectWallet } from './useConnectWallet.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWallets } from './useWallets.js';\nimport { useWalletStore } from './useWalletStore.js';\n\nexport function useAutoConnectWallet(): 'disabled' | 'idle' | 'attempted' {\n\tconst { mutateAsync: connectWallet } = useConnectWallet();\n\tconst autoConnectEnabled = useWalletStore((state) => state.autoConnectEnabled);\n\tconst lastConnectedWalletName = useWalletStore((state) => state.lastConnectedWalletName);\n\tconst lastConnectedAccountAddress = useWalletStore((state) => state.lastConnectedAccountAddress);\n\tconst wallets = useWallets();\n\tconst { isConnected } = useCurrentWallet();\n\n\tconst [clientOnly, setClientOnly] = useState(false);\n\tconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\tuseIsomorphicLayoutEffect(() => {\n\t\tsetClientOnly(true);\n\t}, []);\n\n\tconst { data, isError } = useQuery({\n\t\tqueryKey: [\n\t\t\t'@haneullabs/dapp-kit',\n\t\t\t'autoconnect',\n\t\t\t{\n\t\t\t\tisConnected,\n\t\t\t\tautoConnectEnabled,\n\t\t\t\tlastConnectedWalletName,\n\t\t\t\tlastConnectedAccountAddress,\n\t\t\t\twalletCount: wallets.length,\n\t\t\t},\n\t\t],\n\t\tqueryFn: async () => {\n\t\t\tif (!autoConnectEnabled) {\n\t\t\t\treturn 'disabled';\n\t\t\t}\n\n\t\t\tif (!lastConnectedWalletName || !lastConnectedAccountAddress || isConnected) {\n\t\t\t\treturn 'attempted';\n\t\t\t}\n\n\t\t\tconst wallet = wallets.find(\n\t\t\t\t(wallet) => getWalletUniqueIdentifier(wallet) === lastConnectedWalletName,\n\t\t\t);\n\t\t\tif (wallet) {\n\t\t\t\tawait connectWallet({\n\t\t\t\t\twallet,\n\t\t\t\t\taccountAddress: lastConnectedAccountAddress,\n\t\t\t\t\tsilent: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn 'attempted';\n\t\t},\n\t\tenabled: autoConnectEnabled,\n\t\tpersister: undefined,\n\t\tgcTime: 0,\n\t\tstaleTime: 0,\n\t\tnetworkMode: 'always',\n\t\tretry: false,\n\t\tretryOnMount: false,\n\t\trefetchInterval: false,\n\t\trefetchIntervalInBackground: false,\n\t\trefetchOnMount: false,\n\t\trefetchOnReconnect: false,\n\t\trefetchOnWindowFocus: false,\n\t});\n\n\tif (!autoConnectEnabled) {\n\t\treturn 'disabled';\n\t}\n\n\t// We always initialize with \"idle\" so that in SSR environments, we guarantee that the initial render states always agree:\n\tif (!clientOnly) {\n\t\treturn 'idle';\n\t}\n\n\tif (isConnected) {\n\t\treturn 'attempted';\n\t}\n\n\tif (!lastConnectedWalletName) {\n\t\treturn 'attempted';\n\t}\n\n\treturn isError ? 'attempted' : (data ?? 'idle');\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst suiWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => suiWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...suiWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tStandardConnectInput,\n\tStandardConnectOutput,\n\tWalletAccount,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype ConnectWalletArgs = {\n\t/** The wallet to connect to. */\n\twallet: WalletWithRequiredFeatures;\n\n\t/** An optional account address to connect to. Defaults to the first authorized account. */\n\taccountAddress?: string;\n} & StandardConnectInput;\n\ntype ConnectWalletResult = StandardConnectOutput;\n\ntype UseConnectWalletMutationOptions = Omit<\n\tUseMutationOptions<ConnectWalletResult, Error, ConnectWalletArgs, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for establishing a connection to a specific wallet.\n */\nexport function useConnectWallet({\n\tmutationKey,\n\t...mutationOptions\n}: UseConnectWalletMutationOptions = {}): UseMutationResult<\n\tConnectWalletResult,\n\tError,\n\tConnectWalletArgs,\n\tunknown\n> {\n\tconst setWalletConnected = useWalletStore((state) => state.setWalletConnected);\n\tconst setConnectionStatus = useWalletStore((state) => state.setConnectionStatus);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.connectWallet(mutationKey),\n\t\tmutationFn: async ({ wallet, accountAddress, ...connectArgs }) => {\n\t\t\ttry {\n\t\t\t\tsetConnectionStatus('connecting');\n\n\t\t\t\tconst connectResult = await wallet.features['standard:connect'].connect(connectArgs);\n\t\t\t\tlet supportedIntents = connectResult.supportedIntents;\n\t\t\t\tif (!supportedIntents && wallet.features['haneul:getCapabilities']) {\n\t\t\t\t\tsupportedIntents =\n\t\t\t\t\t\t(await wallet.features['haneul:getCapabilities'].getCapabilities()).supportedIntents ?? [];\n\t\t\t\t}\n\t\t\t\tconst connectedSuiAccounts = connectResult.accounts.filter((account) =>\n\t\t\t\t\taccount.chains.some((chain) => chain.split(':')[0] === 'haneul'),\n\t\t\t\t);\n\t\t\t\tconst selectedAccount = getSelectedAccount(connectedSuiAccounts, accountAddress);\n\n\t\t\t\tsetWalletConnected(wallet, connectedSuiAccounts, selectedAccount, supportedIntents);\n\n\t\t\t\treturn { accounts: connectedSuiAccounts };\n\t\t\t} catch (error) {\n\t\t\t\tsetConnectionStatus('disconnected');\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n\nfunction getSelectedAccount(connectedAccounts: readonly WalletAccount[], accountAddress?: string) {\n\tif (connectedAccounts.length === 0) {\n\t\treturn null;\n\t}\n\n\tif (accountAddress) {\n\t\tconst selectedAccount = connectedAccounts.find((account) => account.address === accountAddress);\n\t\treturn selectedAccount ?? connectedAccounts[0];\n\t}\n\n\treturn connectedAccounts[0];\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\tautoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n\tdisconnectWallet: formMutationKeyFn('disconnect-wallet'),\n\tsignPersonalMessage: formMutationKeyFn('sign-personal-message'),\n\tsignTransaction: formMutationKeyFn('sign-transaction'),\n\tsignAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\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\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 the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n\tconst currentWallet = useWalletStore((state) => state.currentWallet);\n\tconst connectionStatus = useWalletStore((state) => state.connectionStatus);\n\tconst supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n\tswitch (connectionStatus) {\n\t\tcase 'connecting':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: true,\n\t\t\t\tisConnected: false,\n\t\t\t\tsupportedIntents: [],\n\t\t\t} as const;\n\t\tcase 'disconnected':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: true,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: false,\n\t\t\t\tsupportedIntents: [],\n\t\t\t} as const;\n\t\tcase 'connected': {\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: currentWallet!,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: true,\n\t\t\t\tsupportedIntents,\n\t\t\t} as const;\n\t\t}\n\t}\n}\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 registered wallets available to the dApp sorted by preference.\n */\nexport function useWallets() {\n\treturn useWalletStore((state) => state.wallets);\n}\n"],
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useQuery } from '@tanstack/react-query';\nimport { useEffect, useLayoutEffect, useState } from 'react';\n\nimport { getWalletUniqueIdentifier } from '../../utils/walletUtils.js';\nimport { useConnectWallet } from './useConnectWallet.js';\nimport { useCurrentWallet } from './useCurrentWallet.js';\nimport { useWallets } from './useWallets.js';\nimport { useWalletStore } from './useWalletStore.js';\n\nexport function useAutoConnectWallet(): 'disabled' | 'idle' | 'attempted' {\n\tconst { mutateAsync: connectWallet } = useConnectWallet();\n\tconst autoConnectEnabled = useWalletStore((state) => state.autoConnectEnabled);\n\tconst lastConnectedWalletName = useWalletStore((state) => state.lastConnectedWalletName);\n\tconst lastConnectedAccountAddress = useWalletStore((state) => state.lastConnectedAccountAddress);\n\tconst wallets = useWallets();\n\tconst { isConnected } = useCurrentWallet();\n\n\tconst [clientOnly, setClientOnly] = useState(false);\n\tconst useIsomorphicLayoutEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;\n\tuseIsomorphicLayoutEffect(() => {\n\t\tsetClientOnly(true);\n\t}, []);\n\n\tconst { data, isError } = useQuery({\n\t\tqueryKey: [\n\t\t\t'@haneullabs/dapp-kit',\n\t\t\t'autoconnect',\n\t\t\t{\n\t\t\t\tisConnected,\n\t\t\t\tautoConnectEnabled,\n\t\t\t\tlastConnectedWalletName,\n\t\t\t\tlastConnectedAccountAddress,\n\t\t\t\twalletCount: wallets.length,\n\t\t\t},\n\t\t],\n\t\tqueryFn: async () => {\n\t\t\tif (!autoConnectEnabled) {\n\t\t\t\treturn 'disabled';\n\t\t\t}\n\n\t\t\tif (!lastConnectedWalletName || !lastConnectedAccountAddress || isConnected) {\n\t\t\t\treturn 'attempted';\n\t\t\t}\n\n\t\t\tconst wallet = wallets.find(\n\t\t\t\t(wallet) => getWalletUniqueIdentifier(wallet) === lastConnectedWalletName,\n\t\t\t);\n\t\t\tif (wallet) {\n\t\t\t\tawait connectWallet({\n\t\t\t\t\twallet,\n\t\t\t\t\taccountAddress: lastConnectedAccountAddress,\n\t\t\t\t\tsilent: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn 'attempted';\n\t\t},\n\t\tenabled: autoConnectEnabled,\n\t\tpersister: undefined,\n\t\tgcTime: 0,\n\t\tstaleTime: 0,\n\t\tnetworkMode: 'always',\n\t\tretry: false,\n\t\tretryOnMount: false,\n\t\trefetchInterval: false,\n\t\trefetchIntervalInBackground: false,\n\t\trefetchOnMount: false,\n\t\trefetchOnReconnect: false,\n\t\trefetchOnWindowFocus: false,\n\t});\n\n\tif (!autoConnectEnabled) {\n\t\treturn 'disabled';\n\t}\n\n\t// We always initialize with \"idle\" so that in SSR environments, we guarantee that the initial render states always agree:\n\tif (!clientOnly) {\n\t\treturn 'idle';\n\t}\n\n\tif (isConnected) {\n\t\treturn 'attempted';\n\t}\n\n\tif (!lastConnectedWalletName) {\n\t\treturn 'attempted';\n\t}\n\n\treturn isError ? 'attempted' : (data ?? 'idle');\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst haneulWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => haneulWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...haneulWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tStandardConnectInput,\n\tStandardConnectOutput,\n\tWalletAccount,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport type { UseMutationOptions, UseMutationResult } from '@tanstack/react-query';\nimport { useMutation } from '@tanstack/react-query';\n\nimport { walletMutationKeys } from '../../constants/walletMutationKeys.js';\nimport { useWalletStore } from './useWalletStore.js';\n\ntype ConnectWalletArgs = {\n\t/** The wallet to connect to. */\n\twallet: WalletWithRequiredFeatures;\n\n\t/** An optional account address to connect to. Defaults to the first authorized account. */\n\taccountAddress?: string;\n} & StandardConnectInput;\n\ntype ConnectWalletResult = StandardConnectOutput;\n\ntype UseConnectWalletMutationOptions = Omit<\n\tUseMutationOptions<ConnectWalletResult, Error, ConnectWalletArgs, unknown>,\n\t'mutationFn'\n>;\n\n/**\n * Mutation hook for establishing a connection to a specific wallet.\n */\nexport function useConnectWallet({\n\tmutationKey,\n\t...mutationOptions\n}: UseConnectWalletMutationOptions = {}): UseMutationResult<\n\tConnectWalletResult,\n\tError,\n\tConnectWalletArgs,\n\tunknown\n> {\n\tconst setWalletConnected = useWalletStore((state) => state.setWalletConnected);\n\tconst setConnectionStatus = useWalletStore((state) => state.setConnectionStatus);\n\n\treturn useMutation({\n\t\tmutationKey: walletMutationKeys.connectWallet(mutationKey),\n\t\tmutationFn: async ({ wallet, accountAddress, ...connectArgs }) => {\n\t\t\ttry {\n\t\t\t\tsetConnectionStatus('connecting');\n\n\t\t\t\tconst connectResult = await wallet.features['standard:connect'].connect(connectArgs);\n\t\t\t\tlet supportedIntents = connectResult.supportedIntents;\n\t\t\t\tif (!supportedIntents && wallet.features['haneul:getCapabilities']) {\n\t\t\t\t\tsupportedIntents =\n\t\t\t\t\t\t(await wallet.features['haneul:getCapabilities'].getCapabilities()).supportedIntents ?? [];\n\t\t\t\t}\n\t\t\t\tconst connectedSuiAccounts = connectResult.accounts.filter((account) =>\n\t\t\t\t\taccount.chains.some((chain) => chain.split(':')[0] === 'haneul'),\n\t\t\t\t);\n\t\t\t\tconst selectedAccount = getSelectedAccount(connectedSuiAccounts, accountAddress);\n\n\t\t\t\tsetWalletConnected(wallet, connectedSuiAccounts, selectedAccount, supportedIntents);\n\n\t\t\t\treturn { accounts: connectedSuiAccounts };\n\t\t\t} catch (error) {\n\t\t\t\tsetConnectionStatus('disconnected');\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t},\n\t\t...mutationOptions,\n\t});\n}\n\nfunction getSelectedAccount(connectedAccounts: readonly WalletAccount[], accountAddress?: string) {\n\tif (connectedAccounts.length === 0) {\n\t\treturn null;\n\t}\n\n\tif (accountAddress) {\n\t\tconst selectedAccount = connectedAccounts.find((account) => account.address === accountAddress);\n\t\treturn selectedAccount ?? connectedAccounts[0];\n\t}\n\n\treturn connectedAccounts[0];\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\tautoconnectWallet: formMutationKeyFn('autoconnect-wallet'),\n\tdisconnectWallet: formMutationKeyFn('disconnect-wallet'),\n\tsignPersonalMessage: formMutationKeyFn('sign-personal-message'),\n\tsignTransaction: formMutationKeyFn('sign-transaction'),\n\tsignAndExecuteTransaction: formMutationKeyFn('sign-and-execute-transaction'),\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\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 the wallet that is currently connected to the dApp, if one exists.\n */\nexport function useCurrentWallet() {\n\tconst currentWallet = useWalletStore((state) => state.currentWallet);\n\tconst connectionStatus = useWalletStore((state) => state.connectionStatus);\n\tconst supportedIntents = useWalletStore((state) => state.supportedIntents);\n\n\tswitch (connectionStatus) {\n\t\tcase 'connecting':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: true,\n\t\t\t\tisConnected: false,\n\t\t\t\tsupportedIntents: [],\n\t\t\t} as const;\n\t\tcase 'disconnected':\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: null,\n\t\t\t\tisDisconnected: true,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: false,\n\t\t\t\tsupportedIntents: [],\n\t\t\t} as const;\n\t\tcase 'connected': {\n\t\t\treturn {\n\t\t\t\tconnectionStatus,\n\t\t\t\tcurrentWallet: currentWallet!,\n\t\t\t\tisDisconnected: false,\n\t\t\t\tisConnecting: false,\n\t\t\t\tisConnected: true,\n\t\t\t\tsupportedIntents,\n\t\t\t} as const;\n\t\t}\n\t}\n}\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 registered wallets available to the dApp sorted by preference.\n */\nexport function useWallets() {\n\treturn useWalletStore((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AO;AAAA,MACR;AAEA,YAAM,SAAS,QAAQ;AAAA,QACtB,CAACA,YAAW,0BAA0BA,OAAM,MAAM;AAAA,MACnD;AACA,UAAI,QAAQ;AACX,cAAM,cAAc;AAAA,UACnB;AAAA,UACA,gBAAgB;AAAA,UAChB,QAAQ;AAAA,QACT,CAAC;AAAA,MACF;AAEA,aAAO;AAAA,IACR;AAAA,IACA,SAAS;AAAA,IACT,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,aAAa;AAAA,IACb,OAAO;AAAA,IACP,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,6BAA6B;AAAA,IAC7B,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,sBAAsB;AAAA,EACvB,CAAC;AAED,MAAI,CAAC,oBAAoB;AACxB,WAAO;AAAA,EACR;AAGA,MAAI,CAAC,YAAY;AAChB,WAAO;AAAA,EACR;AAEA,MAAI,aAAa;AAChB,WAAO;AAAA,EACR;AAEA,MAAI,CAAC,yBAAyB;AAC7B,WAAO;AAAA,EACR;AAEA,SAAO,UAAU,cAAe,QAAQ;AACzC;",
6
6
  "names": ["wallet"]
7
7
  }
@@ -7,14 +7,14 @@ import { getWallets, isWalletWithRequiredFeatureSet } from "@haneullabs/wallet-s
7
7
  function getRegisteredWallets(preferredWallets, walletFilter) {
8
8
  const walletsApi = getWallets();
9
9
  const wallets = walletsApi.get();
10
- const suiWallets = wallets.filter(
10
+ const haneulWallets = wallets.filter(
11
11
  (wallet) => isWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet))
12
12
  );
13
13
  return [
14
14
  // Preferred wallets, in order:
15
- ...preferredWallets.map((name) => suiWallets.find((wallet) => wallet.name === name)).filter(Boolean),
15
+ ...preferredWallets.map((name) => haneulWallets.find((wallet) => wallet.name === name)).filter(Boolean),
16
16
  // Wallets in default order:
17
- ...suiWallets.filter((wallet) => !preferredWallets.includes(wallet.name))
17
+ ...haneulWallets.filter((wallet) => !preferredWallets.includes(wallet.name))
18
18
  ];
19
19
  }
20
20
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/hooks/wallet/useWalletsChanged.ts", "../../../src/utils/walletUtils.ts", "../../../src/hooks/wallet/useWalletStore.ts", "../../../src/contexts/walletContext.ts"],
4
- "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletWithRequiredFeatures } from '@haneullabs/wallet-standard';\nimport { getWallets } from '@haneullabs/wallet-standard';\nimport { useEffect } from 'react';\n\nimport { getRegisteredWallets } from '../../utils/walletUtils.js';\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Internal hook for easily handling the addition and removal of new wallets.\n */\nexport function useWalletsChanged(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst setWalletRegistered = useWalletStore((state) => state.setWalletRegistered);\n\tconst setWalletUnregistered = useWalletStore((state) => state.setWalletUnregistered);\n\n\tuseEffect(() => {\n\t\tconst walletsApi = getWallets();\n\t\tsetWalletRegistered(getRegisteredWallets(preferredWallets, walletFilter));\n\n\t\tconst unsubscribeFromRegister = walletsApi.on('register', () => {\n\t\t\tsetWalletRegistered(getRegisteredWallets(preferredWallets, walletFilter));\n\t\t});\n\n\t\tconst unsubscribeFromUnregister = walletsApi.on('unregister', (unregisteredWallet) => {\n\t\t\tsetWalletUnregistered(\n\t\t\t\tgetRegisteredWallets(preferredWallets, walletFilter),\n\t\t\t\tunregisteredWallet,\n\t\t\t);\n\t\t});\n\n\t\treturn () => {\n\t\t\tunsubscribeFromRegister();\n\t\t\tunsubscribeFromUnregister();\n\t\t};\n\t}, [preferredWallets, walletFilter, setWalletRegistered, setWalletUnregistered]);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst suiWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => suiWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...suiWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\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"],
5
- "mappings": ";AAIA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,iBAAiB;;;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AA0B;AAAA,IAC3B;AAAA,EACD,GAAG,CAAC,kBAAkB,cAAc,qBAAqB,qBAAqB,CAAC;AAChF;",
4
+ "sourcesContent": ["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { WalletWithRequiredFeatures } from '@haneullabs/wallet-standard';\nimport { getWallets } from '@haneullabs/wallet-standard';\nimport { useEffect } from 'react';\n\nimport { getRegisteredWallets } from '../../utils/walletUtils.js';\nimport { useWalletStore } from './useWalletStore.js';\n\n/**\n * Internal hook for easily handling the addition and removal of new wallets.\n */\nexport function useWalletsChanged(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst setWalletRegistered = useWalletStore((state) => state.setWalletRegistered);\n\tconst setWalletUnregistered = useWalletStore((state) => state.setWalletUnregistered);\n\n\tuseEffect(() => {\n\t\tconst walletsApi = getWallets();\n\t\tsetWalletRegistered(getRegisteredWallets(preferredWallets, walletFilter));\n\n\t\tconst unsubscribeFromRegister = walletsApi.on('register', () => {\n\t\t\tsetWalletRegistered(getRegisteredWallets(preferredWallets, walletFilter));\n\t\t});\n\n\t\tconst unsubscribeFromUnregister = walletsApi.on('unregister', (unregisteredWallet) => {\n\t\t\tsetWalletUnregistered(\n\t\t\t\tgetRegisteredWallets(preferredWallets, walletFilter),\n\t\t\t\tunregisteredWallet,\n\t\t\t);\n\t\t});\n\n\t\treturn () => {\n\t\t\tunsubscribeFromRegister();\n\t\t\tunsubscribeFromUnregister();\n\t\t};\n\t}, [preferredWallets, walletFilter, setWalletRegistered, setWalletUnregistered]);\n}\n", "// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n\tMinimallyRequiredFeatures,\n\tWallet,\n\tWalletWithFeatures,\n\tWalletWithRequiredFeatures,\n} from '@haneullabs/wallet-standard';\nimport { getWallets, isWalletWithRequiredFeatureSet } from '@haneullabs/wallet-standard';\n\nexport function getRegisteredWallets<AdditionalFeatures extends Wallet['features']>(\n\tpreferredWallets: string[],\n\twalletFilter?: (wallet: WalletWithRequiredFeatures) => boolean,\n) {\n\tconst walletsApi = getWallets();\n\tconst wallets = walletsApi.get();\n\n\tconst haneulWallets = wallets.filter(\n\t\t(wallet): wallet is WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures> =>\n\t\t\tisWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet)),\n\t);\n\n\treturn [\n\t\t// Preferred wallets, in order:\n\t\t...(preferredWallets\n\t\t\t.map((name) => haneulWallets.find((wallet) => wallet.name === name))\n\t\t\t.filter(Boolean) as WalletWithFeatures<MinimallyRequiredFeatures & AdditionalFeatures>[]),\n\n\t\t// Wallets in default order:\n\t\t...haneulWallets.filter((wallet) => !preferredWallets.includes(wallet.name)),\n\t];\n}\n\nexport function getWalletUniqueIdentifier(wallet?: Wallet) {\n\treturn wallet?.id ?? wallet?.name;\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"],
5
+ "mappings": ";AAIA,SAAS,cAAAA,mBAAkB;AAC3B,SAAS,iBAAiB;;;ACI1B,SAAS,YAAY,sCAAsC;AAEpD,SAAS,qBACf,kBACA,cACC;AACD,QAAM,aAAa,WAAW;AAC9B,QAAM,UAAU,WAAW,IAA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getWallets"]
7
7
  }
package/dist/index.mjs CHANGED
@@ -131,14 +131,14 @@ import { getWallets, isWalletWithRequiredFeatureSet } from "@haneullabs/wallet-s
131
131
  function getRegisteredWallets(preferredWallets, walletFilter) {
132
132
  const walletsApi = getWallets();
133
133
  const wallets = walletsApi.get();
134
- const suiWallets = wallets.filter(
134
+ const haneulWallets = wallets.filter(
135
135
  (wallet) => isWalletWithRequiredFeatureSet(wallet) && (!walletFilter || walletFilter(wallet))
136
136
  );
137
137
  return [
138
138
  // Preferred wallets, in order:
139
- ...preferredWallets.map((name) => suiWallets.find((wallet) => wallet.name === name)).filter(Boolean),
139
+ ...preferredWallets.map((name) => haneulWallets.find((wallet) => wallet.name === name)).filter(Boolean),
140
140
  // Wallets in default order:
141
- ...suiWallets.filter((wallet) => !preferredWallets.includes(wallet.name))
141
+ ...haneulWallets.filter((wallet) => !preferredWallets.includes(wallet.name))
142
142
  ];
143
143
  }
144
144
  function getWalletUniqueIdentifier(wallet) {