@naculus/connect-appkit-vue 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/dist/index.cjs +75 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +70 -3
- package/dist/index.d.ts +70 -3
- package/dist/index.js +78 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
# @naculus/connect-appkit-vue
|
|
2
2
|
|
|
3
|
-
**Vue component wrappers for Naculus Connect Web Components** — auto-generated Vue proxies for all
|
|
3
|
+
**Vue component wrappers for Naculus Connect Web Components** — auto-generated Vue proxies for all 28 Stencil components. Use `<connect-button>`, `<wallet-modal>`, etc. directly in Vue templates.
|
|
4
4
|
|
|
5
|
-
> **Components have parity with React. Composables do not.** All
|
|
5
|
+
> **Components have parity with React. Composables do not.** All 28 components
|
|
6
6
|
> are generated from the same Stencil source, so anything visual works the same
|
|
7
|
-
> in both. The logic layer does not: this package exports
|
|
8
|
-
> `useAccounts`, `useChain`, `usePassphraseGate`,
|
|
9
|
-
> React's
|
|
10
|
-
> transaction lifecycle are React-only today.
|
|
7
|
+
> in both. The logic layer does not: this package exports six composables —
|
|
8
|
+
> `useAccounts`, `useCapabilities`, `useChain`, `usePassphraseGate`,
|
|
9
|
+
> `useSolanaBalance`, `useSolanaRoles` — against React's 55, so session keys,
|
|
10
|
+
> simulation and the transaction lifecycle are React-only today.
|
|
11
|
+
>
|
|
12
|
+
> `useCapabilities` (the EIP-5792 query) and `useSolanaRoles` (which of
|
|
13
|
+
> `identity` / `signer` / `payer` the connected Solana wallet can fill) are not
|
|
14
|
+
> reimplementations: both bindings call the same functions in
|
|
15
|
+
> `@naculus/connect-appkit-core`, so "absence is not a denial" cannot mean one
|
|
16
|
+
> thing in React and another here.
|
|
11
17
|
>
|
|
12
18
|
> This is said here rather than discovered later. The table below lists both
|
|
13
19
|
> packages at the same version, which is true of the release and not of the
|
package/dist/index.cjs
CHANGED
|
@@ -49,9 +49,11 @@ __export(index_exports, {
|
|
|
49
49
|
AppkitToggleGroup: () => AppkitToggleGroup,
|
|
50
50
|
AppkitTooltip: () => AppkitTooltip,
|
|
51
51
|
useAccounts: () => useAccounts,
|
|
52
|
+
useCapabilities: () => useCapabilities,
|
|
52
53
|
useChain: () => useChain,
|
|
53
54
|
usePassphraseGate: () => usePassphraseGate,
|
|
54
|
-
useSolanaBalance: () => useSolanaBalance
|
|
55
|
+
useSolanaBalance: () => useSolanaBalance,
|
|
56
|
+
useSolanaRoles: () => useSolanaRoles
|
|
55
57
|
});
|
|
56
58
|
module.exports = __toCommonJS(index_exports);
|
|
57
59
|
|
|
@@ -343,6 +345,75 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
343
345
|
});
|
|
344
346
|
return { balance, isFetching, error, refetch };
|
|
345
347
|
}
|
|
348
|
+
|
|
349
|
+
// src/useCapabilities.ts
|
|
350
|
+
var import_connect_appkit_core2 = require("@naculus/connect-appkit-core");
|
|
351
|
+
var import_vue5 = require("vue");
|
|
352
|
+
function useCapabilities(client, session, chainId) {
|
|
353
|
+
const capabilities = (0, import_vue5.shallowRef)(
|
|
354
|
+
null
|
|
355
|
+
);
|
|
356
|
+
const isFetching = (0, import_vue5.shallowRef)(false);
|
|
357
|
+
const error = (0, import_vue5.shallowRef)(null);
|
|
358
|
+
let generation = 0;
|
|
359
|
+
const refetch = async () => {
|
|
360
|
+
const mine = ++generation;
|
|
361
|
+
const activeClient = (0, import_vue5.toValue)(client);
|
|
362
|
+
const activeSession = (0, import_vue5.toValue)(session);
|
|
363
|
+
if (!activeClient?.getCapabilities || !activeSession) {
|
|
364
|
+
capabilities.value = null;
|
|
365
|
+
isFetching.value = false;
|
|
366
|
+
error.value = null;
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
isFetching.value = true;
|
|
370
|
+
error.value = null;
|
|
371
|
+
try {
|
|
372
|
+
const raw = await activeClient.getCapabilities(activeSession);
|
|
373
|
+
if (mine !== generation) return;
|
|
374
|
+
capabilities.value = (0, import_connect_appkit_core2.normalizeCapabilities)(raw);
|
|
375
|
+
} catch (err) {
|
|
376
|
+
if (mine !== generation) return;
|
|
377
|
+
capabilities.value = null;
|
|
378
|
+
error.value = err instanceof Error ? err : new Error("Capability query failed");
|
|
379
|
+
} finally {
|
|
380
|
+
if (mine === generation) isFetching.value = false;
|
|
381
|
+
}
|
|
382
|
+
};
|
|
383
|
+
(0, import_vue5.watchEffect)(() => {
|
|
384
|
+
void (0, import_vue5.toValue)(client);
|
|
385
|
+
void (0, import_vue5.toValue)(session);
|
|
386
|
+
void refetch();
|
|
387
|
+
});
|
|
388
|
+
return {
|
|
389
|
+
capabilities,
|
|
390
|
+
current: (0, import_vue5.computed)(
|
|
391
|
+
() => (0, import_connect_appkit_core2.selectChainCapabilities)(capabilities.value, (0, import_vue5.toValue)(chainId))
|
|
392
|
+
),
|
|
393
|
+
atomic: (0, import_vue5.computed)(
|
|
394
|
+
() => (0, import_connect_appkit_core2.atomicSupportFor)(capabilities.value, (0, import_vue5.toValue)(chainId))
|
|
395
|
+
),
|
|
396
|
+
isFetching,
|
|
397
|
+
error,
|
|
398
|
+
refetch
|
|
399
|
+
};
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// src/useSolanaRoles.ts
|
|
403
|
+
var import_connect_appkit_core3 = require("@naculus/connect-appkit-core");
|
|
404
|
+
var import_vue6 = require("vue");
|
|
405
|
+
function useSolanaRoles(connector, session) {
|
|
406
|
+
const state = (0, import_vue6.computed)(
|
|
407
|
+
() => (0, import_connect_appkit_core3.readSolanaRoles)((0, import_vue6.toValue)(connector), (0, import_vue6.toValue)(session))
|
|
408
|
+
);
|
|
409
|
+
return {
|
|
410
|
+
roles: (0, import_vue6.computed)(() => state.value.roles),
|
|
411
|
+
absence: (0, import_vue6.computed)(() => state.value.absence),
|
|
412
|
+
identity: (0, import_vue6.computed)(() => state.value.roles?.identity ?? null),
|
|
413
|
+
signer: (0, import_vue6.computed)(() => state.value.roles?.signer ?? null),
|
|
414
|
+
payer: (0, import_vue6.computed)(() => state.value.roles?.payer ?? null)
|
|
415
|
+
};
|
|
416
|
+
}
|
|
346
417
|
// Annotate the CommonJS export names for ESM import in node:
|
|
347
418
|
0 && (module.exports = {
|
|
348
419
|
AppkitAccordion,
|
|
@@ -374,8 +445,10 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
374
445
|
AppkitToggleGroup,
|
|
375
446
|
AppkitTooltip,
|
|
376
447
|
useAccounts,
|
|
448
|
+
useCapabilities,
|
|
377
449
|
useChain,
|
|
378
450
|
usePassphraseGate,
|
|
379
|
-
useSolanaBalance
|
|
451
|
+
useSolanaBalance,
|
|
452
|
+
useSolanaRoles
|
|
380
453
|
});
|
|
381
454
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/wc-generated/proxies.ts","../src/useAccounts.ts","../src/useChain.ts","../src/usePassphraseGate.ts","../src/useSolanaBalance.ts"],"sourcesContent":["export {\n AppkitAccordion,\n AppkitAccountButton,\n AppkitAlertDialog,\n AppkitAvatar,\n AppkitBadge,\n AppkitButton,\n AppkitCard,\n AppkitCardContent,\n AppkitCardDescription,\n AppkitCardFooter,\n AppkitCardHeader,\n AppkitCardTitle,\n AppkitCheckbox,\n AppkitCollapsible,\n AppkitConnectButton,\n AppkitDialog,\n AppkitDropdownMenu,\n AppkitInput,\n AppkitPopover,\n AppkitProgress,\n AppkitScrollArea,\n AppkitSelect,\n AppkitSeparator,\n AppkitSkeleton,\n AppkitSwitch,\n AppkitTabs,\n AppkitToggleGroup,\n AppkitTooltip,\n} from \"./wc-generated/proxies\"\n\n// ── Composables ───────────────────────────────────────────────────\nexport { useAccounts } from \"./useAccounts\";\nexport { useChain } from \"./useChain\";\nexport type { UseChainReturn } from \"./useChain\";\nexport type { AccountEntry, UseAccountsReturn } from \"./useAccounts\";\nexport { usePassphraseGate } from \"./usePassphraseGate\";\nexport { useSolanaBalance } from \"./useSolanaBalance\";\nexport type { UseSolanaBalanceReturn as UseSolanaBalanceVueReturn } from \"./useSolanaBalance\";\nexport type { UsePassphraseGateReturn } from \"./usePassphraseGate\";\n","/* eslint-disable */\n/* tslint:disable */\n/* auto-generated vue proxies */\nimport { defineContainer, type StencilVueComponent } from '@stencil/vue-output-target/runtime';\n\nimport type { JSX } from '@naculus/connect-appkit-wc';\n\n\n\n\n\nexport const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion> = /*@__PURE__*/ defineContainer<JSX.AppkitAccordion>('appkit-accordion', undefined, [\n 'label',\n 'open',\n 'disabled',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitAccountButton: StencilVueComponent<JSX.AppkitAccountButton> = /*@__PURE__*/ defineContainer<JSX.AppkitAccountButton>('appkit-account-button', undefined, [\n 'address',\n 'balance',\n 'balanceSymbol',\n 'showAddress',\n 'showBalance',\n 'disabled'\n]);\n\n\nexport const AppkitAlertDialog: StencilVueComponent<JSX.AppkitAlertDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitAlertDialog>('appkit-alert-dialog', undefined, [\n 'open',\n 'heading',\n 'description',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitAvatar: StencilVueComponent<JSX.AppkitAvatar> = /*@__PURE__*/ defineContainer<JSX.AppkitAvatar>('appkit-avatar', undefined, [\n 'size',\n 'src',\n 'alt',\n 'fallback'\n]);\n\n\nexport const AppkitBadge: StencilVueComponent<JSX.AppkitBadge> = /*@__PURE__*/ defineContainer<JSX.AppkitBadge>('appkit-badge', undefined, [\n 'variant'\n]);\n\n\nexport const AppkitButton: StencilVueComponent<JSX.AppkitButton> = /*@__PURE__*/ defineContainer<JSX.AppkitButton>('appkit-button', undefined, [\n 'variant',\n 'size',\n 'disabled',\n 'type',\n 'locale',\n 'ariaLabel',\n 'eventName'\n]);\n\n\nexport const AppkitCard: StencilVueComponent<JSX.AppkitCard> = /*@__PURE__*/ defineContainer<JSX.AppkitCard>('appkit-card', undefined);\n\n\nexport const AppkitCardContent: StencilVueComponent<JSX.AppkitCardContent> = /*@__PURE__*/ defineContainer<JSX.AppkitCardContent>('appkit-card-content', undefined);\n\n\nexport const AppkitCardDescription: StencilVueComponent<JSX.AppkitCardDescription> = /*@__PURE__*/ defineContainer<JSX.AppkitCardDescription>('appkit-card-description', undefined);\n\n\nexport const AppkitCardFooter: StencilVueComponent<JSX.AppkitCardFooter> = /*@__PURE__*/ defineContainer<JSX.AppkitCardFooter>('appkit-card-footer', undefined);\n\n\nexport const AppkitCardHeader: StencilVueComponent<JSX.AppkitCardHeader> = /*@__PURE__*/ defineContainer<JSX.AppkitCardHeader>('appkit-card-header', undefined);\n\n\nexport const AppkitCardTitle: StencilVueComponent<JSX.AppkitCardTitle> = /*@__PURE__*/ defineContainer<JSX.AppkitCardTitle>('appkit-card-title', undefined);\n\n\nexport const AppkitCheckbox: StencilVueComponent<JSX.AppkitCheckbox> = /*@__PURE__*/ defineContainer<JSX.AppkitCheckbox>('appkit-checkbox', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'name',\n 'value',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitCollapsible: StencilVueComponent<JSX.AppkitCollapsible> = /*@__PURE__*/ defineContainer<JSX.AppkitCollapsible>('appkit-collapsible', undefined, [\n 'open',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitConnectButton: StencilVueComponent<JSX.AppkitConnectButton> = /*@__PURE__*/ defineContainer<JSX.AppkitConnectButton>('appkit-connect-button', undefined, [\n 'connected',\n 'connecting',\n 'address',\n 'balance',\n 'balanceSymbol',\n 'isBalanceLoading',\n 'tokenBalancesJson',\n 'explorerUrl',\n 'explorerLabel',\n 'isMobile',\n 'mobileWalletName',\n 'walletsJson',\n 'qrUri',\n 'qrLoading',\n 'qrError',\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n], [\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n]);\n\n\nexport const AppkitDialog: StencilVueComponent<JSX.AppkitDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitDialog>('appkit-dialog', undefined, [\n 'open',\n 'heading',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitDropdownMenu: StencilVueComponent<JSX.AppkitDropdownMenu> = /*@__PURE__*/ defineContainer<JSX.AppkitDropdownMenu>('appkit-dropdown-menu', undefined, [\n 'itemsJson',\n 'appkitSelect'\n], [\n 'appkitSelect'\n]);\n\n\nexport const AppkitInput: StencilVueComponent<JSX.AppkitInput> = /*@__PURE__*/ defineContainer<JSX.AppkitInput>('appkit-input', undefined, [\n 'type',\n 'placeholder',\n 'value',\n 'disabled',\n 'invalid',\n 'name',\n 'autocomplete',\n 'maxLength',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitPopover: StencilVueComponent<JSX.AppkitPopover> = /*@__PURE__*/ defineContainer<JSX.AppkitPopover>('appkit-popover', undefined, [\n 'open',\n 'placement',\n 'appkitOpenChange'\n], [\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitProgress: StencilVueComponent<JSX.AppkitProgress> = /*@__PURE__*/ defineContainer<JSX.AppkitProgress>('appkit-progress', undefined, [\n 'value',\n 'max',\n 'label'\n]);\n\n\nexport const AppkitScrollArea: StencilVueComponent<JSX.AppkitScrollArea> = /*@__PURE__*/ defineContainer<JSX.AppkitScrollArea>('appkit-scroll-area', undefined);\n\n\nexport const AppkitSelect: StencilVueComponent<JSX.AppkitSelect> = /*@__PURE__*/ defineContainer<JSX.AppkitSelect>('appkit-select', undefined, [\n 'optionsJson',\n 'value',\n 'placeholder',\n 'disabled',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitSeparator: StencilVueComponent<JSX.AppkitSeparator> = /*@__PURE__*/ defineContainer<JSX.AppkitSeparator>('appkit-separator', undefined, [\n 'orientation',\n 'decorative'\n]);\n\n\nexport const AppkitSkeleton: StencilVueComponent<JSX.AppkitSkeleton> = /*@__PURE__*/ defineContainer<JSX.AppkitSkeleton>('appkit-skeleton', undefined);\n\n\nexport const AppkitSwitch: StencilVueComponent<JSX.AppkitSwitch> = /*@__PURE__*/ defineContainer<JSX.AppkitSwitch>('appkit-switch', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTabs: StencilVueComponent<JSX.AppkitTabs> = /*@__PURE__*/ defineContainer<JSX.AppkitTabs>('appkit-tabs', undefined, [\n 'tabsJson',\n 'selected',\n 'appkitTabChange'\n], [\n 'appkitTabChange'\n]);\n\n\nexport const AppkitToggleGroup: StencilVueComponent<JSX.AppkitToggleGroup> = /*@__PURE__*/ defineContainer<JSX.AppkitToggleGroup>('appkit-toggle-group', undefined, [\n 'itemsJson',\n 'selected',\n 'multiple',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTooltip: StencilVueComponent<JSX.AppkitTooltip> = /*@__PURE__*/ defineContainer<JSX.AppkitTooltip>('appkit-tooltip', undefined, [\n 'content',\n 'placement'\n]);\n\n\n","import { isEvmAddress, parseCaip10 } from \"@naculus/connect-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface AccountEntry {\n /** As the session reports it: CAIP-10 for most wallets, bare hex for some. */\n address: string;\n /** The namespace, when the entry was CAIP-10. Null for a bare address. */\n namespace: string | null;\n isEVM: boolean;\n}\n\nexport interface UseAccountsReturn {\n accounts: ComputedRef<AccountEntry[]>;\n evmAccount: ComputedRef<string | null>;\n solanaAccount: ComputedRef<string | null>;\n}\n\n/**\n * Split a session's account list by what each entry actually is.\n *\n * The same reading as the React `useAccount`, because it is the same reading:\n * `parseCaip10` and `isEvmAddress` come from `@naculus/connect-core` and hold\n * every rule about which strings mean what. What differs between the two\n * bindings is `computed` versus `useMemo`, and nothing else.\n */\nexport function useAccounts(\n accounts: MaybeRefOrGetter<string[] | null | undefined>,\n): UseAccountsReturn {\n const parsed = computed<AccountEntry[]>(() =>\n (toValue(accounts) ?? []).map((address) => {\n const caip10 = parseCaip10(address);\n if (caip10) {\n return {\n address,\n namespace: caip10.namespace,\n isEVM:\n caip10.namespace === \"eip155\" && isEvmAddress(caip10.address),\n };\n }\n // A bare 0x-40-hex value is unambiguously EVM. A bare base58 string is\n // not unambiguously anything, so nothing is claimed about it.\n return { address, namespace: null, isEVM: isEvmAddress(address) };\n }),\n );\n\n return {\n accounts: parsed,\n evmAccount: computed(\n () => parsed.value.find((a) => a.isEVM)?.address ?? null,\n ),\n solanaAccount: computed(\n () => parsed.value.find((a) => a.namespace === \"solana\")?.address ?? null,\n ),\n };\n}\n","import {\n chainNamespace,\n chainNumber,\n chainsForNamespace,\n describeChain,\n resolveChain,\n type ChainInfo,\n type WalletChain,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface UseChainReturn {\n /** The configured chain matching the connected CAIP-2 id, or null. */\n currentChain: ComputedRef<WalletChain | null>;\n /** A description of the connected chain, for any namespace. */\n chainInfo: ComputedRef<ChainInfo | null>;\n /** Only the chains the connected wallet could actually switch to. */\n availableChains: ComputedRef<WalletChain[]>;\n /** The EIP-155 number, or null when the connected chain has none. */\n currentChainNumber: ComputedRef<number | null>;\n namespace: ComputedRef<string | null>;\n}\n\n/**\n * The connected chain, and the chains it is possible to switch to.\n *\n * Identical in substance to the React `useChain`, because it is the same five\n * functions from `@naculus/connect-appkit-core`. This file contains no\n * decision at all — which is the point: `availableChains` filtering to the\n * connected namespace, `chainInfo` describing non-EVM chains, and\n * `currentChainNumber` refusing to invent a number for Solana are all\n * properties of the shared core, so both bindings get them or neither does.\n *\n * Takes its chain list and connected id as arguments; Vue has no equivalent of\n * the React provider here.\n */\nexport function useChain(\n chains: MaybeRefOrGetter<WalletChain[] | null | undefined>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseChainReturn {\n const list = computed(() => toValue(chains) ?? []);\n const id = computed(() => toValue(chainId) ?? null);\n\n const currentChain = computed(() => resolveChain(list.value, id.value));\n\n return {\n currentChain,\n chainInfo: computed(() => describeChain(list.value, id.value)),\n availableChains: computed(() => chainsForNamespace(list.value, id.value)),\n currentChainNumber: computed(() =>\n currentChain.value ? chainNumber(currentChain.value) : null,\n ),\n namespace: computed(() =>\n currentChain.value ? chainNamespace(currentChain.value) : null,\n ),\n };\n}\n","import type { PassphraseGate, PassphraseRequest } from \"@naculus/connect-core\";\nimport { onScopeDispose, readonly, shallowRef } from \"vue\";\n\nexport interface UsePassphraseGateReturn {\n /** The open request, or null when nothing is being asked. */\n request: Readonly<ReturnType<typeof shallowRef<PassphraseRequest | null>>>;\n /** Answer the open request. */\n submit: (passphrase: string) => void;\n /** Abandon it, failing the load or save that asked. */\n cancel: (reason?: string) => void;\n /** Drop the held passphrase, so the next operation asks again. */\n forget: (reason?: string) => void;\n}\n\n/**\n * Bind a `PassphraseGate` into Vue reactivity.\n *\n * The gate itself lives in `@naculus/connect-core` rather than in either\n * framework package, because the thing it bridges — an encrypted storage\n * adapter asking for a passphrase from inside code that has never heard of a\n * component — is the same problem in React and in Vue. One implementation,\n * two thin bindings.\n *\n * ```ts\n * const gate = new PassphraseGate()\n * const wallet = new PocketWallet({ encryptionPassphrase: gate.request })\n * const { request, submit, cancel } = usePassphraseGate(gate)\n * ```\n *\n * `shallowRef`, not `ref`: the request is a small immutable snapshot the gate\n * replaces wholesale, and deep reactivity over it would proxy an object that\n * never mutates in place.\n */\nexport function usePassphraseGate(\n gate: PassphraseGate,\n): UsePassphraseGateReturn {\n const request = shallowRef<PassphraseRequest | null>(gate.getSnapshot());\n const unsubscribe = gate.subscribe(() => {\n request.value = gate.getSnapshot();\n });\n // Without this the gate keeps a reference to a listener belonging to a\n // component that is gone, and every later prompt writes into a dead ref.\n onScopeDispose(unsubscribe);\n\n return {\n request: readonly(request) as UsePassphraseGateReturn[\"request\"],\n submit: (passphrase: string) => gate.submit(passphrase),\n cancel: (reason?: string) => gate.cancel(reason),\n forget: (reason?: string) => gate.forget(reason),\n };\n}\n","import {\n getSolanaBalance,\n type SolanaBalance,\n} from \"@naculus/connect-core\";\nimport { onScopeDispose, ref, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\n\nexport interface UseSolanaBalanceReturn {\n balance: ReturnType<typeof shallowRef<SolanaBalance | null>>;\n isFetching: ReturnType<typeof ref<boolean>>;\n error: ReturnType<typeof shallowRef<Error | null>>;\n refetch: () => Promise<void>;\n}\n\n/**\n * The SOL balance of an address.\n *\n * The whole of this file is Vue plumbing. Every decision that took thought —\n * exact lamport arithmetic, distinguishing an unfunded account from an emptied\n * one, refusing to invent a zero — is in `@naculus/connect-core`, shared with\n * the React hook. That is what makes \"author in React, ship to Vue\" true for\n * the logic: what does not translate is only the reactivity.\n *\n * Takes its address and endpoint as arguments because Vue has no equivalent of\n * the React provider here. Refs and getters both work.\n */\nexport function useSolanaBalance(\n address: MaybeRefOrGetter<string | null | undefined>,\n rpcUrl: MaybeRefOrGetter<string | null | undefined>,\n): UseSolanaBalanceReturn {\n const balance = shallowRef<SolanaBalance | null>(null);\n const isFetching = ref(false);\n const error = shallowRef<Error | null>(null);\n // Guards against a slow response for a previous address overwriting the\n // balance of the one now on screen.\n let generation = 0;\n let disposed = false;\n\n const refetch = async () => {\n const addr = toValue(address);\n const url = toValue(rpcUrl);\n if (!addr || !url) {\n balance.value = null;\n return;\n }\n const own = ++generation;\n isFetching.value = true;\n error.value = null;\n try {\n const next = await getSolanaBalance(url, addr);\n if (disposed || own !== generation) return;\n balance.value = next;\n } catch (err) {\n if (disposed || own !== generation) return;\n // Cleared rather than left stale: a balance shown next to an error\n // reads as the current balance, and it is not.\n balance.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Balance read failed\");\n } finally {\n if (!disposed && own === generation) isFetching.value = false;\n }\n };\n\n watchEffect(() => {\n // Touch both so the effect re-runs when either changes.\n toValue(address);\n toValue(rpcUrl);\n void refetch();\n });\n\n onScopeDispose(() => {\n disposed = true;\n });\n\n return { balance, isFetching, error, refetch };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,qBAA0D;AAQnD,IAAM,kBAA0E,oDAAqC,oBAAoB,QAAW;AAAA,EACzJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AAAA,EACD;AACF,CAAC;AAGM,IAAM,sBAAkF,oDAAyC,yBAAyB,QAAW;AAAA,EAC1K;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,oBAA8E,oDAAuC,uBAAuB,QAAW;AAAA,EAClK;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AAAA,EACD;AAAA,EACA;AACF,CAAC;AAGM,IAAM,eAAoE,oDAAkC,iBAAiB,QAAW;AAAA,EAC7I;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,cAAkE,oDAAiC,gBAAgB,QAAW;AAAA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AED,kCAAe,MAAM;AACnB,eAAW;AAAA,EACb,CAAC;AAED,SAAO,EAAE,SAAS,YAAY,OAAO,QAAQ;AAC/C;","names":["import_vue","import_vue","import_connect_core","import_vue"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/wc-generated/proxies.ts","../src/useAccounts.ts","../src/useChain.ts","../src/usePassphraseGate.ts","../src/useSolanaBalance.ts","../src/useCapabilities.ts","../src/useSolanaRoles.ts"],"sourcesContent":["export {\n AppkitAccordion,\n AppkitAccountButton,\n AppkitAlertDialog,\n AppkitAvatar,\n AppkitBadge,\n AppkitButton,\n AppkitCard,\n AppkitCardContent,\n AppkitCardDescription,\n AppkitCardFooter,\n AppkitCardHeader,\n AppkitCardTitle,\n AppkitCheckbox,\n AppkitCollapsible,\n AppkitConnectButton,\n AppkitDialog,\n AppkitDropdownMenu,\n AppkitInput,\n AppkitPopover,\n AppkitProgress,\n AppkitScrollArea,\n AppkitSelect,\n AppkitSeparator,\n AppkitSkeleton,\n AppkitSwitch,\n AppkitTabs,\n AppkitToggleGroup,\n AppkitTooltip,\n} from \"./wc-generated/proxies\"\n\n// ── Composables ───────────────────────────────────────────────────\nexport { useAccounts } from \"./useAccounts\";\nexport { useChain } from \"./useChain\";\nexport type { UseChainReturn } from \"./useChain\";\nexport type { AccountEntry, UseAccountsReturn } from \"./useAccounts\";\nexport { usePassphraseGate } from \"./usePassphraseGate\";\nexport { useSolanaBalance } from \"./useSolanaBalance\";\nexport type { UseSolanaBalanceReturn as UseSolanaBalanceVueReturn } from \"./useSolanaBalance\";\nexport type { UsePassphraseGateReturn } from \"./usePassphraseGate\";\nexport { useCapabilities, type AtomicSupport, type CapabilityClient, type ChainCapabilities, type UseCapabilitiesReturn } from \"./useCapabilities\";\nexport {\n useSolanaRoles,\n type SolanaIdentity,\n type SolanaPayer,\n type SolanaRoles,\n type SolanaRolesAbsence,\n type SolanaRolesSource,\n type SolanaSigner,\n type SolanaWalletFeatures,\n type UseSolanaRolesReturn,\n} from \"./useSolanaRoles\";\n","/* eslint-disable */\n/* tslint:disable */\n/* auto-generated vue proxies */\nimport { defineContainer, type StencilVueComponent } from '@stencil/vue-output-target/runtime';\n\nimport type { JSX } from '@naculus/connect-appkit-wc';\n\n\n\n\n\nexport const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion> = /*@__PURE__*/ defineContainer<JSX.AppkitAccordion>('appkit-accordion', undefined, [\n 'label',\n 'open',\n 'disabled',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitAccountButton: StencilVueComponent<JSX.AppkitAccountButton> = /*@__PURE__*/ defineContainer<JSX.AppkitAccountButton>('appkit-account-button', undefined, [\n 'address',\n 'balance',\n 'balanceSymbol',\n 'showAddress',\n 'showBalance',\n 'disabled'\n]);\n\n\nexport const AppkitAlertDialog: StencilVueComponent<JSX.AppkitAlertDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitAlertDialog>('appkit-alert-dialog', undefined, [\n 'open',\n 'heading',\n 'description',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitAvatar: StencilVueComponent<JSX.AppkitAvatar> = /*@__PURE__*/ defineContainer<JSX.AppkitAvatar>('appkit-avatar', undefined, [\n 'size',\n 'src',\n 'alt',\n 'fallback'\n]);\n\n\nexport const AppkitBadge: StencilVueComponent<JSX.AppkitBadge> = /*@__PURE__*/ defineContainer<JSX.AppkitBadge>('appkit-badge', undefined, [\n 'variant'\n]);\n\n\nexport const AppkitButton: StencilVueComponent<JSX.AppkitButton> = /*@__PURE__*/ defineContainer<JSX.AppkitButton>('appkit-button', undefined, [\n 'variant',\n 'size',\n 'disabled',\n 'type',\n 'locale',\n 'ariaLabel',\n 'eventName'\n]);\n\n\nexport const AppkitCard: StencilVueComponent<JSX.AppkitCard> = /*@__PURE__*/ defineContainer<JSX.AppkitCard>('appkit-card', undefined);\n\n\nexport const AppkitCardContent: StencilVueComponent<JSX.AppkitCardContent> = /*@__PURE__*/ defineContainer<JSX.AppkitCardContent>('appkit-card-content', undefined);\n\n\nexport const AppkitCardDescription: StencilVueComponent<JSX.AppkitCardDescription> = /*@__PURE__*/ defineContainer<JSX.AppkitCardDescription>('appkit-card-description', undefined);\n\n\nexport const AppkitCardFooter: StencilVueComponent<JSX.AppkitCardFooter> = /*@__PURE__*/ defineContainer<JSX.AppkitCardFooter>('appkit-card-footer', undefined);\n\n\nexport const AppkitCardHeader: StencilVueComponent<JSX.AppkitCardHeader> = /*@__PURE__*/ defineContainer<JSX.AppkitCardHeader>('appkit-card-header', undefined);\n\n\nexport const AppkitCardTitle: StencilVueComponent<JSX.AppkitCardTitle> = /*@__PURE__*/ defineContainer<JSX.AppkitCardTitle>('appkit-card-title', undefined);\n\n\nexport const AppkitCheckbox: StencilVueComponent<JSX.AppkitCheckbox> = /*@__PURE__*/ defineContainer<JSX.AppkitCheckbox>('appkit-checkbox', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'name',\n 'value',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitCollapsible: StencilVueComponent<JSX.AppkitCollapsible> = /*@__PURE__*/ defineContainer<JSX.AppkitCollapsible>('appkit-collapsible', undefined, [\n 'open',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitConnectButton: StencilVueComponent<JSX.AppkitConnectButton> = /*@__PURE__*/ defineContainer<JSX.AppkitConnectButton>('appkit-connect-button', undefined, [\n 'connected',\n 'connecting',\n 'address',\n 'balance',\n 'balanceSymbol',\n 'isBalanceLoading',\n 'tokenBalancesJson',\n 'explorerUrl',\n 'explorerLabel',\n 'isMobile',\n 'mobileWalletName',\n 'walletsJson',\n 'qrUri',\n 'qrLoading',\n 'qrError',\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n], [\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n]);\n\n\nexport const AppkitDialog: StencilVueComponent<JSX.AppkitDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitDialog>('appkit-dialog', undefined, [\n 'open',\n 'heading',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitDropdownMenu: StencilVueComponent<JSX.AppkitDropdownMenu> = /*@__PURE__*/ defineContainer<JSX.AppkitDropdownMenu>('appkit-dropdown-menu', undefined, [\n 'itemsJson',\n 'appkitSelect'\n], [\n 'appkitSelect'\n]);\n\n\nexport const AppkitInput: StencilVueComponent<JSX.AppkitInput> = /*@__PURE__*/ defineContainer<JSX.AppkitInput>('appkit-input', undefined, [\n 'type',\n 'placeholder',\n 'value',\n 'disabled',\n 'invalid',\n 'name',\n 'autocomplete',\n 'maxLength',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitPopover: StencilVueComponent<JSX.AppkitPopover> = /*@__PURE__*/ defineContainer<JSX.AppkitPopover>('appkit-popover', undefined, [\n 'open',\n 'placement',\n 'appkitOpenChange'\n], [\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitProgress: StencilVueComponent<JSX.AppkitProgress> = /*@__PURE__*/ defineContainer<JSX.AppkitProgress>('appkit-progress', undefined, [\n 'value',\n 'max',\n 'label'\n]);\n\n\nexport const AppkitScrollArea: StencilVueComponent<JSX.AppkitScrollArea> = /*@__PURE__*/ defineContainer<JSX.AppkitScrollArea>('appkit-scroll-area', undefined);\n\n\nexport const AppkitSelect: StencilVueComponent<JSX.AppkitSelect> = /*@__PURE__*/ defineContainer<JSX.AppkitSelect>('appkit-select', undefined, [\n 'optionsJson',\n 'value',\n 'placeholder',\n 'disabled',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitSeparator: StencilVueComponent<JSX.AppkitSeparator> = /*@__PURE__*/ defineContainer<JSX.AppkitSeparator>('appkit-separator', undefined, [\n 'orientation',\n 'decorative'\n]);\n\n\nexport const AppkitSkeleton: StencilVueComponent<JSX.AppkitSkeleton> = /*@__PURE__*/ defineContainer<JSX.AppkitSkeleton>('appkit-skeleton', undefined);\n\n\nexport const AppkitSwitch: StencilVueComponent<JSX.AppkitSwitch> = /*@__PURE__*/ defineContainer<JSX.AppkitSwitch>('appkit-switch', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTabs: StencilVueComponent<JSX.AppkitTabs> = /*@__PURE__*/ defineContainer<JSX.AppkitTabs>('appkit-tabs', undefined, [\n 'tabsJson',\n 'selected',\n 'appkitTabChange'\n], [\n 'appkitTabChange'\n]);\n\n\nexport const AppkitToggleGroup: StencilVueComponent<JSX.AppkitToggleGroup> = /*@__PURE__*/ defineContainer<JSX.AppkitToggleGroup>('appkit-toggle-group', undefined, [\n 'itemsJson',\n 'selected',\n 'multiple',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTooltip: StencilVueComponent<JSX.AppkitTooltip> = /*@__PURE__*/ defineContainer<JSX.AppkitTooltip>('appkit-tooltip', undefined, [\n 'content',\n 'placement'\n]);\n\n\n","import { isEvmAddress, parseCaip10 } from \"@naculus/connect-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface AccountEntry {\n /** As the session reports it: CAIP-10 for most wallets, bare hex for some. */\n address: string;\n /** The namespace, when the entry was CAIP-10. Null for a bare address. */\n namespace: string | null;\n isEVM: boolean;\n}\n\nexport interface UseAccountsReturn {\n accounts: ComputedRef<AccountEntry[]>;\n evmAccount: ComputedRef<string | null>;\n solanaAccount: ComputedRef<string | null>;\n}\n\n/**\n * Split a session's account list by what each entry actually is.\n *\n * The same reading as the React `useAccount`, because it is the same reading:\n * `parseCaip10` and `isEvmAddress` come from `@naculus/connect-core` and hold\n * every rule about which strings mean what. What differs between the two\n * bindings is `computed` versus `useMemo`, and nothing else.\n */\nexport function useAccounts(\n accounts: MaybeRefOrGetter<string[] | null | undefined>,\n): UseAccountsReturn {\n const parsed = computed<AccountEntry[]>(() =>\n (toValue(accounts) ?? []).map((address) => {\n const caip10 = parseCaip10(address);\n if (caip10) {\n return {\n address,\n namespace: caip10.namespace,\n isEVM:\n caip10.namespace === \"eip155\" && isEvmAddress(caip10.address),\n };\n }\n // A bare 0x-40-hex value is unambiguously EVM. A bare base58 string is\n // not unambiguously anything, so nothing is claimed about it.\n return { address, namespace: null, isEVM: isEvmAddress(address) };\n }),\n );\n\n return {\n accounts: parsed,\n evmAccount: computed(\n () => parsed.value.find((a) => a.isEVM)?.address ?? null,\n ),\n solanaAccount: computed(\n () => parsed.value.find((a) => a.namespace === \"solana\")?.address ?? null,\n ),\n };\n}\n","import {\n chainNamespace,\n chainNumber,\n chainsForNamespace,\n describeChain,\n resolveChain,\n type ChainInfo,\n type WalletChain,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface UseChainReturn {\n /** The configured chain matching the connected CAIP-2 id, or null. */\n currentChain: ComputedRef<WalletChain | null>;\n /** A description of the connected chain, for any namespace. */\n chainInfo: ComputedRef<ChainInfo | null>;\n /** Only the chains the connected wallet could actually switch to. */\n availableChains: ComputedRef<WalletChain[]>;\n /** The EIP-155 number, or null when the connected chain has none. */\n currentChainNumber: ComputedRef<number | null>;\n namespace: ComputedRef<string | null>;\n}\n\n/**\n * The connected chain, and the chains it is possible to switch to.\n *\n * Identical in substance to the React `useChain`, because it is the same five\n * functions from `@naculus/connect-appkit-core`. This file contains no\n * decision at all — which is the point: `availableChains` filtering to the\n * connected namespace, `chainInfo` describing non-EVM chains, and\n * `currentChainNumber` refusing to invent a number for Solana are all\n * properties of the shared core, so both bindings get them or neither does.\n *\n * Takes its chain list and connected id as arguments; Vue has no equivalent of\n * the React provider here.\n */\nexport function useChain(\n chains: MaybeRefOrGetter<WalletChain[] | null | undefined>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseChainReturn {\n const list = computed(() => toValue(chains) ?? []);\n const id = computed(() => toValue(chainId) ?? null);\n\n const currentChain = computed(() => resolveChain(list.value, id.value));\n\n return {\n currentChain,\n chainInfo: computed(() => describeChain(list.value, id.value)),\n availableChains: computed(() => chainsForNamespace(list.value, id.value)),\n currentChainNumber: computed(() =>\n currentChain.value ? chainNumber(currentChain.value) : null,\n ),\n namespace: computed(() =>\n currentChain.value ? chainNamespace(currentChain.value) : null,\n ),\n };\n}\n","import type { PassphraseGate, PassphraseRequest } from \"@naculus/connect-core\";\nimport { onScopeDispose, readonly, shallowRef } from \"vue\";\n\nexport interface UsePassphraseGateReturn {\n /** The open request, or null when nothing is being asked. */\n request: Readonly<ReturnType<typeof shallowRef<PassphraseRequest | null>>>;\n /** Answer the open request. */\n submit: (passphrase: string) => void;\n /** Abandon it, failing the load or save that asked. */\n cancel: (reason?: string) => void;\n /** Drop the held passphrase, so the next operation asks again. */\n forget: (reason?: string) => void;\n}\n\n/**\n * Bind a `PassphraseGate` into Vue reactivity.\n *\n * The gate itself lives in `@naculus/connect-core` rather than in either\n * framework package, because the thing it bridges — an encrypted storage\n * adapter asking for a passphrase from inside code that has never heard of a\n * component — is the same problem in React and in Vue. One implementation,\n * two thin bindings.\n *\n * ```ts\n * const gate = new PassphraseGate()\n * const wallet = new PocketWallet({ encryptionPassphrase: gate.request })\n * const { request, submit, cancel } = usePassphraseGate(gate)\n * ```\n *\n * `shallowRef`, not `ref`: the request is a small immutable snapshot the gate\n * replaces wholesale, and deep reactivity over it would proxy an object that\n * never mutates in place.\n */\nexport function usePassphraseGate(\n gate: PassphraseGate,\n): UsePassphraseGateReturn {\n const request = shallowRef<PassphraseRequest | null>(gate.getSnapshot());\n const unsubscribe = gate.subscribe(() => {\n request.value = gate.getSnapshot();\n });\n // Without this the gate keeps a reference to a listener belonging to a\n // component that is gone, and every later prompt writes into a dead ref.\n onScopeDispose(unsubscribe);\n\n return {\n request: readonly(request) as UsePassphraseGateReturn[\"request\"],\n submit: (passphrase: string) => gate.submit(passphrase),\n cancel: (reason?: string) => gate.cancel(reason),\n forget: (reason?: string) => gate.forget(reason),\n };\n}\n","import {\n getSolanaBalance,\n type SolanaBalance,\n} from \"@naculus/connect-core\";\nimport { onScopeDispose, ref, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\n\nexport interface UseSolanaBalanceReturn {\n balance: ReturnType<typeof shallowRef<SolanaBalance | null>>;\n isFetching: ReturnType<typeof ref<boolean>>;\n error: ReturnType<typeof shallowRef<Error | null>>;\n refetch: () => Promise<void>;\n}\n\n/**\n * The SOL balance of an address.\n *\n * The whole of this file is Vue plumbing. Every decision that took thought —\n * exact lamport arithmetic, distinguishing an unfunded account from an emptied\n * one, refusing to invent a zero — is in `@naculus/connect-core`, shared with\n * the React hook. That is what makes \"author in React, ship to Vue\" true for\n * the logic: what does not translate is only the reactivity.\n *\n * Takes its address and endpoint as arguments because Vue has no equivalent of\n * the React provider here. Refs and getters both work.\n */\nexport function useSolanaBalance(\n address: MaybeRefOrGetter<string | null | undefined>,\n rpcUrl: MaybeRefOrGetter<string | null | undefined>,\n): UseSolanaBalanceReturn {\n const balance = shallowRef<SolanaBalance | null>(null);\n const isFetching = ref(false);\n const error = shallowRef<Error | null>(null);\n // Guards against a slow response for a previous address overwriting the\n // balance of the one now on screen.\n let generation = 0;\n let disposed = false;\n\n const refetch = async () => {\n const addr = toValue(address);\n const url = toValue(rpcUrl);\n if (!addr || !url) {\n balance.value = null;\n return;\n }\n const own = ++generation;\n isFetching.value = true;\n error.value = null;\n try {\n const next = await getSolanaBalance(url, addr);\n if (disposed || own !== generation) return;\n balance.value = next;\n } catch (err) {\n if (disposed || own !== generation) return;\n // Cleared rather than left stale: a balance shown next to an error\n // reads as the current balance, and it is not.\n balance.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Balance read failed\");\n } finally {\n if (!disposed && own === generation) isFetching.value = false;\n }\n };\n\n watchEffect(() => {\n // Touch both so the effect re-runs when either changes.\n toValue(address);\n toValue(rpcUrl);\n void refetch();\n });\n\n onScopeDispose(() => {\n disposed = true;\n });\n\n return { balance, isFetching, error, refetch };\n}\n","import {\n atomicSupportFor,\n type AtomicSupport,\n type ChainCapabilities,\n normalizeCapabilities,\n selectChainCapabilities,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter, ShallowRef } from \"vue\";\n\nexport type { AtomicSupport, ChainCapabilities };\n\n/** The part of a connector this needs. Anything with these two is enough. */\nexport interface CapabilityClient {\n getCapabilities?: (session: unknown) => Promise<Record<string, unknown>>;\n}\n\nexport interface UseCapabilitiesReturn {\n /** Per-chain, keyed by CAIP-2. Null until a query has actually returned. */\n capabilities: ShallowRef<Record<string, ChainCapabilities> | null>;\n /** The connected chain's entry, for the common case. */\n current: ComputedRef<ChainCapabilities | null>;\n /** Atomic support on the connected chain. `\"unknown\"` until told otherwise. */\n atomic: ComputedRef<AtomicSupport>;\n isFetching: ShallowRef<boolean>;\n error: ShallowRef<Error | null>;\n refetch: () => Promise<void>;\n}\n\n/**\n * What the connected wallet says it can do — EIP-5792\n * `wallet_getCapabilities`.\n *\n * The query a dApp makes *before* choosing how to execute: ask whether the\n * wallet batches atomically, then send one batch or a sequence, rather than\n * sending a batch and learning the answer from a rejection.\n *\n * Identical in substance to the React hook, because every decision in it —\n * normalising the raw answer, the CAIP-2/hex lookup, and `\"unknown\"` meaning\n * \"not told\" rather than \"no\" — is in `@naculus/connect-appkit-core` and\n * neither binding gets to disagree about it.\n *\n * Takes its client, session and chain as arguments. Vue has no equivalent of\n * the React provider here, which is the same shape `useChain` uses.\n */\nexport function useCapabilities(\n client: MaybeRefOrGetter<CapabilityClient | null | undefined>,\n session: MaybeRefOrGetter<unknown>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseCapabilitiesReturn {\n const capabilities = shallowRef<Record<string, ChainCapabilities> | null>(\n null,\n );\n const isFetching = shallowRef(false);\n const error = shallowRef<Error | null>(null);\n // Guards a slow answer for a previous session overwriting a newer one.\n let generation = 0;\n\n const refetch = async () => {\n const mine = ++generation;\n const activeClient = toValue(client);\n const activeSession = toValue(session);\n if (!activeClient?.getCapabilities || !activeSession) {\n capabilities.value = null;\n isFetching.value = false;\n error.value = null;\n return;\n }\n isFetching.value = true;\n error.value = null;\n try {\n const raw = await activeClient.getCapabilities(activeSession);\n if (mine !== generation) return;\n capabilities.value = normalizeCapabilities(raw);\n } catch (err) {\n if (mine !== generation) return;\n // Cleared rather than left stale. A capability map from a previous\n // wallet is a worse answer than no answer.\n capabilities.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Capability query failed\");\n } finally {\n if (mine === generation) isFetching.value = false;\n }\n };\n\n // Re-queries when the client or session changes, the way the React effect\n // does. `chainId` is deliberately not a trigger: it selects from an answer\n // already held rather than needing a new one.\n watchEffect(() => {\n void toValue(client);\n void toValue(session);\n void refetch();\n });\n\n return {\n capabilities,\n current: computed(() =>\n selectChainCapabilities(capabilities.value, toValue(chainId)),\n ),\n atomic: computed(() =>\n atomicSupportFor(capabilities.value, toValue(chainId)),\n ),\n isFetching,\n error,\n refetch,\n };\n}\n","import {\n readSolanaRoles,\n type SolanaIdentity,\n type SolanaPayer,\n type SolanaRoles,\n type SolanaRolesAbsence,\n type SolanaRolesSource,\n type SolanaSigner,\n type SolanaWalletFeatures,\n} from \"@naculus/connect-appkit-core\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\nimport { computed, toValue } from \"vue\";\n\nexport type {\n SolanaIdentity,\n SolanaPayer,\n SolanaRoles,\n SolanaRolesAbsence,\n SolanaRolesSource,\n SolanaSigner,\n SolanaWalletFeatures,\n};\n\nexport interface UseSolanaRolesReturn {\n /** The roles the connected account can fill, or null with a reason. */\n roles: ComputedRef<SolanaRoles | null>;\n /** Why `roles` is null. Null when it is not. */\n absence: ComputedRef<SolanaRolesAbsence | null>;\n /** Which account this is. Never null while `roles` is present. */\n identity: ComputedRef<SolanaIdentity | null>;\n /**\n * Signs without submitting. Null when the wallet declared it cannot *and*\n * null when nothing is known; check `absence` to tell those apart.\n */\n signer: ComputedRef<SolanaSigner | null>;\n /** Signs and broadcasts itself. Null under the same two conditions. */\n payer: ComputedRef<SolanaPayer | null>;\n}\n\n/**\n * Which roles the connected Solana account can actually fill.\n *\n * Identical in substance to the React hook: every judgement — that a null\n * `signer` from the connector is an answer while a missing `getRoles` is\n * not, that an EVM session is never asked — is in\n * `@naculus/connect-appkit-core`, and neither binding gets to disagree.\n *\n * Takes the connector and session as arguments, the shape `useCapabilities`\n * uses, because Vue has no provider here. Pass the session as a ref so an\n * account switch that replaces it is noticed; the connector reads the live\n * address either way, so a caller holding a stale snapshot still gets the\n * account the wallet moved to.\n */\nexport function useSolanaRoles(\n connector: MaybeRefOrGetter<SolanaRolesSource | null | undefined>,\n session: MaybeRefOrGetter<{ walletType?: string } | null | undefined>,\n): UseSolanaRolesReturn {\n const state = computed(() =>\n readSolanaRoles(toValue(connector), toValue(session)),\n );\n\n return {\n roles: computed(() => state.value.roles),\n absence: computed(() => state.value.absence),\n identity: computed(() => state.value.roles?.identity ?? null),\n signer: computed(() => state.value.roles?.signer ?? null),\n payer: computed(() => state.value.roles?.payer ?? null),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACGA,qBAA0D;AAQnD,IAAM,kBAA0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,UAAI,SAAS,WAAY;AAGzB,mBAAa,QAAQ;AACrB,YAAM,QACJ,eAAe,QAAQ,MAAM,IAAI,MAAM,yBAAyB;AAAA,IACpE,UAAE;AACA,UAAI,SAAS,WAAY,YAAW,QAAQ;AAAA,IAC9C;AAAA,EACF;AAKA,+BAAY,MAAM;AAChB,aAAK,qBAAQ,MAAM;AACnB,aAAK,qBAAQ,OAAO;AACpB,SAAK,QAAQ;AAAA,EACf,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,aAAS;AAAA,MAAS,UAChB,qDAAwB,aAAa,WAAO,qBAAQ,OAAO,CAAC;AAAA,IAC9D;AAAA,IACA,YAAQ;AAAA,MAAS,UACf,8CAAiB,aAAa,WAAO,qBAAQ,OAAO,CAAC;AAAA,IACvD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;AC3GA,IAAAC,8BASO;AAEP,IAAAC,cAAkC;AA0C3B,SAAS,eACd,WACA,SACsB;AACtB,QAAM,YAAQ;AAAA,IAAS,UACrB,iDAAgB,qBAAQ,SAAS,OAAG,qBAAQ,OAAO,CAAC;AAAA,EACtD;AAEA,SAAO;AAAA,IACL,WAAO,sBAAS,MAAM,MAAM,MAAM,KAAK;AAAA,IACvC,aAAS,sBAAS,MAAM,MAAM,MAAM,OAAO;AAAA,IAC3C,cAAU,sBAAS,MAAM,MAAM,MAAM,OAAO,YAAY,IAAI;AAAA,IAC5D,YAAQ,sBAAS,MAAM,MAAM,MAAM,OAAO,UAAU,IAAI;AAAA,IACxD,WAAO,sBAAS,MAAM,MAAM,MAAM,OAAO,SAAS,IAAI;AAAA,EACxD;AACF;","names":["import_vue","import_vue","import_connect_core","import_vue","import_connect_appkit_core","import_vue","import_connect_appkit_core","import_vue"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { StencilVueComponent } from '@stencil/vue-output-target/runtime';
|
|
2
2
|
import { JSX } from '@naculus/connect-appkit-wc';
|
|
3
|
-
import { ComputedRef, MaybeRefOrGetter, shallowRef, ref } from 'vue';
|
|
4
|
-
import { WalletChain, ChainInfo } from '@naculus/connect-appkit-core';
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter, shallowRef, ref, ShallowRef } from 'vue';
|
|
4
|
+
import { WalletChain, ChainInfo, ChainCapabilities, AtomicSupport, SolanaRoles, SolanaRolesAbsence, SolanaIdentity, SolanaSigner, SolanaPayer, SolanaRolesSource } from '@naculus/connect-appkit-core';
|
|
5
|
+
export { AtomicSupport, ChainCapabilities, SolanaIdentity, SolanaPayer, SolanaRoles, SolanaRolesAbsence, SolanaRolesSource, SolanaSigner, SolanaWalletFeatures } from '@naculus/connect-appkit-core';
|
|
5
6
|
import { PassphraseGate } from '@naculus/connect-core';
|
|
6
7
|
|
|
7
8
|
declare const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion>;
|
|
@@ -132,4 +133,70 @@ interface UseSolanaBalanceReturn {
|
|
|
132
133
|
*/
|
|
133
134
|
declare function useSolanaBalance(address: MaybeRefOrGetter<string | null | undefined>, rpcUrl: MaybeRefOrGetter<string | null | undefined>): UseSolanaBalanceReturn;
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
/** The part of a connector this needs. Anything with these two is enough. */
|
|
137
|
+
interface CapabilityClient {
|
|
138
|
+
getCapabilities?: (session: unknown) => Promise<Record<string, unknown>>;
|
|
139
|
+
}
|
|
140
|
+
interface UseCapabilitiesReturn {
|
|
141
|
+
/** Per-chain, keyed by CAIP-2. Null until a query has actually returned. */
|
|
142
|
+
capabilities: ShallowRef<Record<string, ChainCapabilities> | null>;
|
|
143
|
+
/** The connected chain's entry, for the common case. */
|
|
144
|
+
current: ComputedRef<ChainCapabilities | null>;
|
|
145
|
+
/** Atomic support on the connected chain. `"unknown"` until told otherwise. */
|
|
146
|
+
atomic: ComputedRef<AtomicSupport>;
|
|
147
|
+
isFetching: ShallowRef<boolean>;
|
|
148
|
+
error: ShallowRef<Error | null>;
|
|
149
|
+
refetch: () => Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* What the connected wallet says it can do — EIP-5792
|
|
153
|
+
* `wallet_getCapabilities`.
|
|
154
|
+
*
|
|
155
|
+
* The query a dApp makes *before* choosing how to execute: ask whether the
|
|
156
|
+
* wallet batches atomically, then send one batch or a sequence, rather than
|
|
157
|
+
* sending a batch and learning the answer from a rejection.
|
|
158
|
+
*
|
|
159
|
+
* Identical in substance to the React hook, because every decision in it —
|
|
160
|
+
* normalising the raw answer, the CAIP-2/hex lookup, and `"unknown"` meaning
|
|
161
|
+
* "not told" rather than "no" — is in `@naculus/connect-appkit-core` and
|
|
162
|
+
* neither binding gets to disagree about it.
|
|
163
|
+
*
|
|
164
|
+
* Takes its client, session and chain as arguments. Vue has no equivalent of
|
|
165
|
+
* the React provider here, which is the same shape `useChain` uses.
|
|
166
|
+
*/
|
|
167
|
+
declare function useCapabilities(client: MaybeRefOrGetter<CapabilityClient | null | undefined>, session: MaybeRefOrGetter<unknown>, chainId: MaybeRefOrGetter<string | null | undefined>): UseCapabilitiesReturn;
|
|
168
|
+
|
|
169
|
+
interface UseSolanaRolesReturn {
|
|
170
|
+
/** The roles the connected account can fill, or null with a reason. */
|
|
171
|
+
roles: ComputedRef<SolanaRoles | null>;
|
|
172
|
+
/** Why `roles` is null. Null when it is not. */
|
|
173
|
+
absence: ComputedRef<SolanaRolesAbsence | null>;
|
|
174
|
+
/** Which account this is. Never null while `roles` is present. */
|
|
175
|
+
identity: ComputedRef<SolanaIdentity | null>;
|
|
176
|
+
/**
|
|
177
|
+
* Signs without submitting. Null when the wallet declared it cannot *and*
|
|
178
|
+
* null when nothing is known; check `absence` to tell those apart.
|
|
179
|
+
*/
|
|
180
|
+
signer: ComputedRef<SolanaSigner | null>;
|
|
181
|
+
/** Signs and broadcasts itself. Null under the same two conditions. */
|
|
182
|
+
payer: ComputedRef<SolanaPayer | null>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Which roles the connected Solana account can actually fill.
|
|
186
|
+
*
|
|
187
|
+
* Identical in substance to the React hook: every judgement — that a null
|
|
188
|
+
* `signer` from the connector is an answer while a missing `getRoles` is
|
|
189
|
+
* not, that an EVM session is never asked — is in
|
|
190
|
+
* `@naculus/connect-appkit-core`, and neither binding gets to disagree.
|
|
191
|
+
*
|
|
192
|
+
* Takes the connector and session as arguments, the shape `useCapabilities`
|
|
193
|
+
* uses, because Vue has no provider here. Pass the session as a ref so an
|
|
194
|
+
* account switch that replaces it is noticed; the connector reads the live
|
|
195
|
+
* address either way, so a caller holding a stale snapshot still gets the
|
|
196
|
+
* account the wallet moved to.
|
|
197
|
+
*/
|
|
198
|
+
declare function useSolanaRoles(connector: MaybeRefOrGetter<SolanaRolesSource | null | undefined>, session: MaybeRefOrGetter<{
|
|
199
|
+
walletType?: string;
|
|
200
|
+
} | null | undefined>): UseSolanaRolesReturn;
|
|
201
|
+
|
|
202
|
+
export { type AccountEntry, AppkitAccordion, AppkitAccountButton, AppkitAlertDialog, AppkitAvatar, AppkitBadge, AppkitButton, AppkitCard, AppkitCardContent, AppkitCardDescription, AppkitCardFooter, AppkitCardHeader, AppkitCardTitle, AppkitCheckbox, AppkitCollapsible, AppkitConnectButton, AppkitDialog, AppkitDropdownMenu, AppkitInput, AppkitPopover, AppkitProgress, AppkitScrollArea, AppkitSelect, AppkitSeparator, AppkitSkeleton, AppkitSwitch, AppkitTabs, AppkitToggleGroup, AppkitTooltip, type CapabilityClient, type UseAccountsReturn, type UseCapabilitiesReturn, type UseChainReturn, type UsePassphraseGateReturn, type UseSolanaBalanceReturn as UseSolanaBalanceVueReturn, type UseSolanaRolesReturn, useAccounts, useCapabilities, useChain, usePassphraseGate, useSolanaBalance, useSolanaRoles };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { StencilVueComponent } from '@stencil/vue-output-target/runtime';
|
|
2
2
|
import { JSX } from '@naculus/connect-appkit-wc';
|
|
3
|
-
import { ComputedRef, MaybeRefOrGetter, shallowRef, ref } from 'vue';
|
|
4
|
-
import { WalletChain, ChainInfo } from '@naculus/connect-appkit-core';
|
|
3
|
+
import { ComputedRef, MaybeRefOrGetter, shallowRef, ref, ShallowRef } from 'vue';
|
|
4
|
+
import { WalletChain, ChainInfo, ChainCapabilities, AtomicSupport, SolanaRoles, SolanaRolesAbsence, SolanaIdentity, SolanaSigner, SolanaPayer, SolanaRolesSource } from '@naculus/connect-appkit-core';
|
|
5
|
+
export { AtomicSupport, ChainCapabilities, SolanaIdentity, SolanaPayer, SolanaRoles, SolanaRolesAbsence, SolanaRolesSource, SolanaSigner, SolanaWalletFeatures } from '@naculus/connect-appkit-core';
|
|
5
6
|
import { PassphraseGate } from '@naculus/connect-core';
|
|
6
7
|
|
|
7
8
|
declare const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion>;
|
|
@@ -132,4 +133,70 @@ interface UseSolanaBalanceReturn {
|
|
|
132
133
|
*/
|
|
133
134
|
declare function useSolanaBalance(address: MaybeRefOrGetter<string | null | undefined>, rpcUrl: MaybeRefOrGetter<string | null | undefined>): UseSolanaBalanceReturn;
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
/** The part of a connector this needs. Anything with these two is enough. */
|
|
137
|
+
interface CapabilityClient {
|
|
138
|
+
getCapabilities?: (session: unknown) => Promise<Record<string, unknown>>;
|
|
139
|
+
}
|
|
140
|
+
interface UseCapabilitiesReturn {
|
|
141
|
+
/** Per-chain, keyed by CAIP-2. Null until a query has actually returned. */
|
|
142
|
+
capabilities: ShallowRef<Record<string, ChainCapabilities> | null>;
|
|
143
|
+
/** The connected chain's entry, for the common case. */
|
|
144
|
+
current: ComputedRef<ChainCapabilities | null>;
|
|
145
|
+
/** Atomic support on the connected chain. `"unknown"` until told otherwise. */
|
|
146
|
+
atomic: ComputedRef<AtomicSupport>;
|
|
147
|
+
isFetching: ShallowRef<boolean>;
|
|
148
|
+
error: ShallowRef<Error | null>;
|
|
149
|
+
refetch: () => Promise<void>;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* What the connected wallet says it can do — EIP-5792
|
|
153
|
+
* `wallet_getCapabilities`.
|
|
154
|
+
*
|
|
155
|
+
* The query a dApp makes *before* choosing how to execute: ask whether the
|
|
156
|
+
* wallet batches atomically, then send one batch or a sequence, rather than
|
|
157
|
+
* sending a batch and learning the answer from a rejection.
|
|
158
|
+
*
|
|
159
|
+
* Identical in substance to the React hook, because every decision in it —
|
|
160
|
+
* normalising the raw answer, the CAIP-2/hex lookup, and `"unknown"` meaning
|
|
161
|
+
* "not told" rather than "no" — is in `@naculus/connect-appkit-core` and
|
|
162
|
+
* neither binding gets to disagree about it.
|
|
163
|
+
*
|
|
164
|
+
* Takes its client, session and chain as arguments. Vue has no equivalent of
|
|
165
|
+
* the React provider here, which is the same shape `useChain` uses.
|
|
166
|
+
*/
|
|
167
|
+
declare function useCapabilities(client: MaybeRefOrGetter<CapabilityClient | null | undefined>, session: MaybeRefOrGetter<unknown>, chainId: MaybeRefOrGetter<string | null | undefined>): UseCapabilitiesReturn;
|
|
168
|
+
|
|
169
|
+
interface UseSolanaRolesReturn {
|
|
170
|
+
/** The roles the connected account can fill, or null with a reason. */
|
|
171
|
+
roles: ComputedRef<SolanaRoles | null>;
|
|
172
|
+
/** Why `roles` is null. Null when it is not. */
|
|
173
|
+
absence: ComputedRef<SolanaRolesAbsence | null>;
|
|
174
|
+
/** Which account this is. Never null while `roles` is present. */
|
|
175
|
+
identity: ComputedRef<SolanaIdentity | null>;
|
|
176
|
+
/**
|
|
177
|
+
* Signs without submitting. Null when the wallet declared it cannot *and*
|
|
178
|
+
* null when nothing is known; check `absence` to tell those apart.
|
|
179
|
+
*/
|
|
180
|
+
signer: ComputedRef<SolanaSigner | null>;
|
|
181
|
+
/** Signs and broadcasts itself. Null under the same two conditions. */
|
|
182
|
+
payer: ComputedRef<SolanaPayer | null>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Which roles the connected Solana account can actually fill.
|
|
186
|
+
*
|
|
187
|
+
* Identical in substance to the React hook: every judgement — that a null
|
|
188
|
+
* `signer` from the connector is an answer while a missing `getRoles` is
|
|
189
|
+
* not, that an EVM session is never asked — is in
|
|
190
|
+
* `@naculus/connect-appkit-core`, and neither binding gets to disagree.
|
|
191
|
+
*
|
|
192
|
+
* Takes the connector and session as arguments, the shape `useCapabilities`
|
|
193
|
+
* uses, because Vue has no provider here. Pass the session as a ref so an
|
|
194
|
+
* account switch that replaces it is noticed; the connector reads the live
|
|
195
|
+
* address either way, so a caller holding a stale snapshot still gets the
|
|
196
|
+
* account the wallet moved to.
|
|
197
|
+
*/
|
|
198
|
+
declare function useSolanaRoles(connector: MaybeRefOrGetter<SolanaRolesSource | null | undefined>, session: MaybeRefOrGetter<{
|
|
199
|
+
walletType?: string;
|
|
200
|
+
} | null | undefined>): UseSolanaRolesReturn;
|
|
201
|
+
|
|
202
|
+
export { type AccountEntry, AppkitAccordion, AppkitAccountButton, AppkitAlertDialog, AppkitAvatar, AppkitBadge, AppkitButton, AppkitCard, AppkitCardContent, AppkitCardDescription, AppkitCardFooter, AppkitCardHeader, AppkitCardTitle, AppkitCheckbox, AppkitCollapsible, AppkitConnectButton, AppkitDialog, AppkitDropdownMenu, AppkitInput, AppkitPopover, AppkitProgress, AppkitScrollArea, AppkitSelect, AppkitSeparator, AppkitSkeleton, AppkitSwitch, AppkitTabs, AppkitToggleGroup, AppkitTooltip, type CapabilityClient, type UseAccountsReturn, type UseCapabilitiesReturn, type UseChainReturn, type UsePassphraseGateReturn, type UseSolanaBalanceReturn as UseSolanaBalanceVueReturn, type UseSolanaRolesReturn, useAccounts, useCapabilities, useChain, usePassphraseGate, useSolanaBalance, useSolanaRoles };
|
package/dist/index.js
CHANGED
|
@@ -294,6 +294,81 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
294
294
|
});
|
|
295
295
|
return { balance, isFetching, error, refetch };
|
|
296
296
|
}
|
|
297
|
+
|
|
298
|
+
// src/useCapabilities.ts
|
|
299
|
+
import {
|
|
300
|
+
atomicSupportFor,
|
|
301
|
+
normalizeCapabilities,
|
|
302
|
+
selectChainCapabilities
|
|
303
|
+
} from "@naculus/connect-appkit-core";
|
|
304
|
+
import { computed as computed3, shallowRef as shallowRef3, toValue as toValue4, watchEffect as watchEffect2 } from "vue";
|
|
305
|
+
function useCapabilities(client, session, chainId) {
|
|
306
|
+
const capabilities = shallowRef3(
|
|
307
|
+
null
|
|
308
|
+
);
|
|
309
|
+
const isFetching = shallowRef3(false);
|
|
310
|
+
const error = shallowRef3(null);
|
|
311
|
+
let generation = 0;
|
|
312
|
+
const refetch = async () => {
|
|
313
|
+
const mine = ++generation;
|
|
314
|
+
const activeClient = toValue4(client);
|
|
315
|
+
const activeSession = toValue4(session);
|
|
316
|
+
if (!activeClient?.getCapabilities || !activeSession) {
|
|
317
|
+
capabilities.value = null;
|
|
318
|
+
isFetching.value = false;
|
|
319
|
+
error.value = null;
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
isFetching.value = true;
|
|
323
|
+
error.value = null;
|
|
324
|
+
try {
|
|
325
|
+
const raw = await activeClient.getCapabilities(activeSession);
|
|
326
|
+
if (mine !== generation) return;
|
|
327
|
+
capabilities.value = normalizeCapabilities(raw);
|
|
328
|
+
} catch (err) {
|
|
329
|
+
if (mine !== generation) return;
|
|
330
|
+
capabilities.value = null;
|
|
331
|
+
error.value = err instanceof Error ? err : new Error("Capability query failed");
|
|
332
|
+
} finally {
|
|
333
|
+
if (mine === generation) isFetching.value = false;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
watchEffect2(() => {
|
|
337
|
+
void toValue4(client);
|
|
338
|
+
void toValue4(session);
|
|
339
|
+
void refetch();
|
|
340
|
+
});
|
|
341
|
+
return {
|
|
342
|
+
capabilities,
|
|
343
|
+
current: computed3(
|
|
344
|
+
() => selectChainCapabilities(capabilities.value, toValue4(chainId))
|
|
345
|
+
),
|
|
346
|
+
atomic: computed3(
|
|
347
|
+
() => atomicSupportFor(capabilities.value, toValue4(chainId))
|
|
348
|
+
),
|
|
349
|
+
isFetching,
|
|
350
|
+
error,
|
|
351
|
+
refetch
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
// src/useSolanaRoles.ts
|
|
356
|
+
import {
|
|
357
|
+
readSolanaRoles
|
|
358
|
+
} from "@naculus/connect-appkit-core";
|
|
359
|
+
import { computed as computed4, toValue as toValue5 } from "vue";
|
|
360
|
+
function useSolanaRoles(connector, session) {
|
|
361
|
+
const state = computed4(
|
|
362
|
+
() => readSolanaRoles(toValue5(connector), toValue5(session))
|
|
363
|
+
);
|
|
364
|
+
return {
|
|
365
|
+
roles: computed4(() => state.value.roles),
|
|
366
|
+
absence: computed4(() => state.value.absence),
|
|
367
|
+
identity: computed4(() => state.value.roles?.identity ?? null),
|
|
368
|
+
signer: computed4(() => state.value.roles?.signer ?? null),
|
|
369
|
+
payer: computed4(() => state.value.roles?.payer ?? null)
|
|
370
|
+
};
|
|
371
|
+
}
|
|
297
372
|
export {
|
|
298
373
|
AppkitAccordion,
|
|
299
374
|
AppkitAccountButton,
|
|
@@ -324,8 +399,10 @@ export {
|
|
|
324
399
|
AppkitToggleGroup,
|
|
325
400
|
AppkitTooltip,
|
|
326
401
|
useAccounts,
|
|
402
|
+
useCapabilities,
|
|
327
403
|
useChain,
|
|
328
404
|
usePassphraseGate,
|
|
329
|
-
useSolanaBalance
|
|
405
|
+
useSolanaBalance,
|
|
406
|
+
useSolanaRoles
|
|
330
407
|
};
|
|
331
408
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/wc-generated/proxies.ts","../src/useAccounts.ts","../src/useChain.ts","../src/usePassphraseGate.ts","../src/useSolanaBalance.ts"],"sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n/* auto-generated vue proxies */\nimport { defineContainer, type StencilVueComponent } from '@stencil/vue-output-target/runtime';\n\nimport type { JSX } from '@naculus/connect-appkit-wc';\n\n\n\n\n\nexport const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion> = /*@__PURE__*/ defineContainer<JSX.AppkitAccordion>('appkit-accordion', undefined, [\n 'label',\n 'open',\n 'disabled',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitAccountButton: StencilVueComponent<JSX.AppkitAccountButton> = /*@__PURE__*/ defineContainer<JSX.AppkitAccountButton>('appkit-account-button', undefined, [\n 'address',\n 'balance',\n 'balanceSymbol',\n 'showAddress',\n 'showBalance',\n 'disabled'\n]);\n\n\nexport const AppkitAlertDialog: StencilVueComponent<JSX.AppkitAlertDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitAlertDialog>('appkit-alert-dialog', undefined, [\n 'open',\n 'heading',\n 'description',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitAvatar: StencilVueComponent<JSX.AppkitAvatar> = /*@__PURE__*/ defineContainer<JSX.AppkitAvatar>('appkit-avatar', undefined, [\n 'size',\n 'src',\n 'alt',\n 'fallback'\n]);\n\n\nexport const AppkitBadge: StencilVueComponent<JSX.AppkitBadge> = /*@__PURE__*/ defineContainer<JSX.AppkitBadge>('appkit-badge', undefined, [\n 'variant'\n]);\n\n\nexport const AppkitButton: StencilVueComponent<JSX.AppkitButton> = /*@__PURE__*/ defineContainer<JSX.AppkitButton>('appkit-button', undefined, [\n 'variant',\n 'size',\n 'disabled',\n 'type',\n 'locale',\n 'ariaLabel',\n 'eventName'\n]);\n\n\nexport const AppkitCard: StencilVueComponent<JSX.AppkitCard> = /*@__PURE__*/ defineContainer<JSX.AppkitCard>('appkit-card', undefined);\n\n\nexport const AppkitCardContent: StencilVueComponent<JSX.AppkitCardContent> = /*@__PURE__*/ defineContainer<JSX.AppkitCardContent>('appkit-card-content', undefined);\n\n\nexport const AppkitCardDescription: StencilVueComponent<JSX.AppkitCardDescription> = /*@__PURE__*/ defineContainer<JSX.AppkitCardDescription>('appkit-card-description', undefined);\n\n\nexport const AppkitCardFooter: StencilVueComponent<JSX.AppkitCardFooter> = /*@__PURE__*/ defineContainer<JSX.AppkitCardFooter>('appkit-card-footer', undefined);\n\n\nexport const AppkitCardHeader: StencilVueComponent<JSX.AppkitCardHeader> = /*@__PURE__*/ defineContainer<JSX.AppkitCardHeader>('appkit-card-header', undefined);\n\n\nexport const AppkitCardTitle: StencilVueComponent<JSX.AppkitCardTitle> = /*@__PURE__*/ defineContainer<JSX.AppkitCardTitle>('appkit-card-title', undefined);\n\n\nexport const AppkitCheckbox: StencilVueComponent<JSX.AppkitCheckbox> = /*@__PURE__*/ defineContainer<JSX.AppkitCheckbox>('appkit-checkbox', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'name',\n 'value',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitCollapsible: StencilVueComponent<JSX.AppkitCollapsible> = /*@__PURE__*/ defineContainer<JSX.AppkitCollapsible>('appkit-collapsible', undefined, [\n 'open',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitConnectButton: StencilVueComponent<JSX.AppkitConnectButton> = /*@__PURE__*/ defineContainer<JSX.AppkitConnectButton>('appkit-connect-button', undefined, [\n 'connected',\n 'connecting',\n 'address',\n 'balance',\n 'balanceSymbol',\n 'isBalanceLoading',\n 'tokenBalancesJson',\n 'explorerUrl',\n 'explorerLabel',\n 'isMobile',\n 'mobileWalletName',\n 'walletsJson',\n 'qrUri',\n 'qrLoading',\n 'qrError',\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n], [\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n]);\n\n\nexport const AppkitDialog: StencilVueComponent<JSX.AppkitDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitDialog>('appkit-dialog', undefined, [\n 'open',\n 'heading',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitDropdownMenu: StencilVueComponent<JSX.AppkitDropdownMenu> = /*@__PURE__*/ defineContainer<JSX.AppkitDropdownMenu>('appkit-dropdown-menu', undefined, [\n 'itemsJson',\n 'appkitSelect'\n], [\n 'appkitSelect'\n]);\n\n\nexport const AppkitInput: StencilVueComponent<JSX.AppkitInput> = /*@__PURE__*/ defineContainer<JSX.AppkitInput>('appkit-input', undefined, [\n 'type',\n 'placeholder',\n 'value',\n 'disabled',\n 'invalid',\n 'name',\n 'autocomplete',\n 'maxLength',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitPopover: StencilVueComponent<JSX.AppkitPopover> = /*@__PURE__*/ defineContainer<JSX.AppkitPopover>('appkit-popover', undefined, [\n 'open',\n 'placement',\n 'appkitOpenChange'\n], [\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitProgress: StencilVueComponent<JSX.AppkitProgress> = /*@__PURE__*/ defineContainer<JSX.AppkitProgress>('appkit-progress', undefined, [\n 'value',\n 'max',\n 'label'\n]);\n\n\nexport const AppkitScrollArea: StencilVueComponent<JSX.AppkitScrollArea> = /*@__PURE__*/ defineContainer<JSX.AppkitScrollArea>('appkit-scroll-area', undefined);\n\n\nexport const AppkitSelect: StencilVueComponent<JSX.AppkitSelect> = /*@__PURE__*/ defineContainer<JSX.AppkitSelect>('appkit-select', undefined, [\n 'optionsJson',\n 'value',\n 'placeholder',\n 'disabled',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitSeparator: StencilVueComponent<JSX.AppkitSeparator> = /*@__PURE__*/ defineContainer<JSX.AppkitSeparator>('appkit-separator', undefined, [\n 'orientation',\n 'decorative'\n]);\n\n\nexport const AppkitSkeleton: StencilVueComponent<JSX.AppkitSkeleton> = /*@__PURE__*/ defineContainer<JSX.AppkitSkeleton>('appkit-skeleton', undefined);\n\n\nexport const AppkitSwitch: StencilVueComponent<JSX.AppkitSwitch> = /*@__PURE__*/ defineContainer<JSX.AppkitSwitch>('appkit-switch', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTabs: StencilVueComponent<JSX.AppkitTabs> = /*@__PURE__*/ defineContainer<JSX.AppkitTabs>('appkit-tabs', undefined, [\n 'tabsJson',\n 'selected',\n 'appkitTabChange'\n], [\n 'appkitTabChange'\n]);\n\n\nexport const AppkitToggleGroup: StencilVueComponent<JSX.AppkitToggleGroup> = /*@__PURE__*/ defineContainer<JSX.AppkitToggleGroup>('appkit-toggle-group', undefined, [\n 'itemsJson',\n 'selected',\n 'multiple',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTooltip: StencilVueComponent<JSX.AppkitTooltip> = /*@__PURE__*/ defineContainer<JSX.AppkitTooltip>('appkit-tooltip', undefined, [\n 'content',\n 'placement'\n]);\n\n\n","import { isEvmAddress, parseCaip10 } from \"@naculus/connect-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface AccountEntry {\n /** As the session reports it: CAIP-10 for most wallets, bare hex for some. */\n address: string;\n /** The namespace, when the entry was CAIP-10. Null for a bare address. */\n namespace: string | null;\n isEVM: boolean;\n}\n\nexport interface UseAccountsReturn {\n accounts: ComputedRef<AccountEntry[]>;\n evmAccount: ComputedRef<string | null>;\n solanaAccount: ComputedRef<string | null>;\n}\n\n/**\n * Split a session's account list by what each entry actually is.\n *\n * The same reading as the React `useAccount`, because it is the same reading:\n * `parseCaip10` and `isEvmAddress` come from `@naculus/connect-core` and hold\n * every rule about which strings mean what. What differs between the two\n * bindings is `computed` versus `useMemo`, and nothing else.\n */\nexport function useAccounts(\n accounts: MaybeRefOrGetter<string[] | null | undefined>,\n): UseAccountsReturn {\n const parsed = computed<AccountEntry[]>(() =>\n (toValue(accounts) ?? []).map((address) => {\n const caip10 = parseCaip10(address);\n if (caip10) {\n return {\n address,\n namespace: caip10.namespace,\n isEVM:\n caip10.namespace === \"eip155\" && isEvmAddress(caip10.address),\n };\n }\n // A bare 0x-40-hex value is unambiguously EVM. A bare base58 string is\n // not unambiguously anything, so nothing is claimed about it.\n return { address, namespace: null, isEVM: isEvmAddress(address) };\n }),\n );\n\n return {\n accounts: parsed,\n evmAccount: computed(\n () => parsed.value.find((a) => a.isEVM)?.address ?? null,\n ),\n solanaAccount: computed(\n () => parsed.value.find((a) => a.namespace === \"solana\")?.address ?? null,\n ),\n };\n}\n","import {\n chainNamespace,\n chainNumber,\n chainsForNamespace,\n describeChain,\n resolveChain,\n type ChainInfo,\n type WalletChain,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface UseChainReturn {\n /** The configured chain matching the connected CAIP-2 id, or null. */\n currentChain: ComputedRef<WalletChain | null>;\n /** A description of the connected chain, for any namespace. */\n chainInfo: ComputedRef<ChainInfo | null>;\n /** Only the chains the connected wallet could actually switch to. */\n availableChains: ComputedRef<WalletChain[]>;\n /** The EIP-155 number, or null when the connected chain has none. */\n currentChainNumber: ComputedRef<number | null>;\n namespace: ComputedRef<string | null>;\n}\n\n/**\n * The connected chain, and the chains it is possible to switch to.\n *\n * Identical in substance to the React `useChain`, because it is the same five\n * functions from `@naculus/connect-appkit-core`. This file contains no\n * decision at all — which is the point: `availableChains` filtering to the\n * connected namespace, `chainInfo` describing non-EVM chains, and\n * `currentChainNumber` refusing to invent a number for Solana are all\n * properties of the shared core, so both bindings get them or neither does.\n *\n * Takes its chain list and connected id as arguments; Vue has no equivalent of\n * the React provider here.\n */\nexport function useChain(\n chains: MaybeRefOrGetter<WalletChain[] | null | undefined>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseChainReturn {\n const list = computed(() => toValue(chains) ?? []);\n const id = computed(() => toValue(chainId) ?? null);\n\n const currentChain = computed(() => resolveChain(list.value, id.value));\n\n return {\n currentChain,\n chainInfo: computed(() => describeChain(list.value, id.value)),\n availableChains: computed(() => chainsForNamespace(list.value, id.value)),\n currentChainNumber: computed(() =>\n currentChain.value ? chainNumber(currentChain.value) : null,\n ),\n namespace: computed(() =>\n currentChain.value ? chainNamespace(currentChain.value) : null,\n ),\n };\n}\n","import type { PassphraseGate, PassphraseRequest } from \"@naculus/connect-core\";\nimport { onScopeDispose, readonly, shallowRef } from \"vue\";\n\nexport interface UsePassphraseGateReturn {\n /** The open request, or null when nothing is being asked. */\n request: Readonly<ReturnType<typeof shallowRef<PassphraseRequest | null>>>;\n /** Answer the open request. */\n submit: (passphrase: string) => void;\n /** Abandon it, failing the load or save that asked. */\n cancel: (reason?: string) => void;\n /** Drop the held passphrase, so the next operation asks again. */\n forget: (reason?: string) => void;\n}\n\n/**\n * Bind a `PassphraseGate` into Vue reactivity.\n *\n * The gate itself lives in `@naculus/connect-core` rather than in either\n * framework package, because the thing it bridges — an encrypted storage\n * adapter asking for a passphrase from inside code that has never heard of a\n * component — is the same problem in React and in Vue. One implementation,\n * two thin bindings.\n *\n * ```ts\n * const gate = new PassphraseGate()\n * const wallet = new PocketWallet({ encryptionPassphrase: gate.request })\n * const { request, submit, cancel } = usePassphraseGate(gate)\n * ```\n *\n * `shallowRef`, not `ref`: the request is a small immutable snapshot the gate\n * replaces wholesale, and deep reactivity over it would proxy an object that\n * never mutates in place.\n */\nexport function usePassphraseGate(\n gate: PassphraseGate,\n): UsePassphraseGateReturn {\n const request = shallowRef<PassphraseRequest | null>(gate.getSnapshot());\n const unsubscribe = gate.subscribe(() => {\n request.value = gate.getSnapshot();\n });\n // Without this the gate keeps a reference to a listener belonging to a\n // component that is gone, and every later prompt writes into a dead ref.\n onScopeDispose(unsubscribe);\n\n return {\n request: readonly(request) as UsePassphraseGateReturn[\"request\"],\n submit: (passphrase: string) => gate.submit(passphrase),\n cancel: (reason?: string) => gate.cancel(reason),\n forget: (reason?: string) => gate.forget(reason),\n };\n}\n","import {\n getSolanaBalance,\n type SolanaBalance,\n} from \"@naculus/connect-core\";\nimport { onScopeDispose, ref, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\n\nexport interface UseSolanaBalanceReturn {\n balance: ReturnType<typeof shallowRef<SolanaBalance | null>>;\n isFetching: ReturnType<typeof ref<boolean>>;\n error: ReturnType<typeof shallowRef<Error | null>>;\n refetch: () => Promise<void>;\n}\n\n/**\n * The SOL balance of an address.\n *\n * The whole of this file is Vue plumbing. Every decision that took thought —\n * exact lamport arithmetic, distinguishing an unfunded account from an emptied\n * one, refusing to invent a zero — is in `@naculus/connect-core`, shared with\n * the React hook. That is what makes \"author in React, ship to Vue\" true for\n * the logic: what does not translate is only the reactivity.\n *\n * Takes its address and endpoint as arguments because Vue has no equivalent of\n * the React provider here. Refs and getters both work.\n */\nexport function useSolanaBalance(\n address: MaybeRefOrGetter<string | null | undefined>,\n rpcUrl: MaybeRefOrGetter<string | null | undefined>,\n): UseSolanaBalanceReturn {\n const balance = shallowRef<SolanaBalance | null>(null);\n const isFetching = ref(false);\n const error = shallowRef<Error | null>(null);\n // Guards against a slow response for a previous address overwriting the\n // balance of the one now on screen.\n let generation = 0;\n let disposed = false;\n\n const refetch = async () => {\n const addr = toValue(address);\n const url = toValue(rpcUrl);\n if (!addr || !url) {\n balance.value = null;\n return;\n }\n const own = ++generation;\n isFetching.value = true;\n error.value = null;\n try {\n const next = await getSolanaBalance(url, addr);\n if (disposed || own !== generation) return;\n balance.value = next;\n } catch (err) {\n if (disposed || own !== generation) return;\n // Cleared rather than left stale: a balance shown next to an error\n // reads as the current balance, and it is not.\n balance.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Balance read failed\");\n } finally {\n if (!disposed && own === generation) isFetching.value = false;\n }\n };\n\n watchEffect(() => {\n // Touch both so the effect re-runs when either changes.\n toValue(address);\n toValue(rpcUrl);\n void refetch();\n });\n\n onScopeDispose(() => {\n disposed = true;\n });\n\n return { balance, isFetching, error, refetch };\n}\n"],"mappings":";AAGA,SAAS,uBAAiD;AAQnD,IAAM,kBAA0E,gCAAqC,oBAAoB,QAAW;AAAA,EACzJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AAAA,EACD;AACF,CAAC;AAGM,IAAM,sBAAkF,gCAAyC,yBAAyB,QAAW;AAAA,EAC1K;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,oBAA8E,gCAAuC,uBAAuB,QAAW;AAAA,EAClK;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AAAA,EACD;AAAA,EACA;AACF,CAAC;AAGM,IAAM,eAAoE,gCAAkC,iBAAiB,QAAW;AAAA,EAC7I;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,cAAkE,gCAAiC,gBAAgB,QAAW;AAAA,EACzI;AACF,CAAC;AAGM,IAAM,eAAoE,gCAAkC,iBAAiB,QAAW;AAAA,EAC7I;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,aAAgE,gCAAgC,eAAe,MAAS;AAG9H,IAAM,oBAA8E,gCAAuC,uBAAuB,MAAS;AAG3J,IAAM,wBAAsF,gCAA2C,2BAA2B,MAAS;AAG3K,IAAM,mBAA4E,gCAAsC,sBAAsB,MAAS;AAGvJ,IAAM,mBAA4E,gCAAsC,sBAAsB,MAAS;AAGvJ,IAAM,kBAA0E,gCAAqC,qBAAqB,MAAS;AAGnJ,IAAM,iBAAwE,gCAAoC,mBAAmB,QAAW;AAAA,EACrJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA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iBAAgB,KAAK,cAAAC,aAAY,WAAAC,UAAS,mBAAmB;AAsB/D,SAAS,iBACd,SACA,QACwB;AACxB,QAAM,UAAUD,YAAiC,IAAI;AACrD,QAAM,aAAa,IAAI,KAAK;AAC5B,QAAM,QAAQA,YAAyB,IAAI;AAG3C,MAAI,aAAa;AACjB,MAAI,WAAW;AAEf,QAAM,UAAU,YAAY;AAC1B,UAAM,OAAOC,SAAQ,OAAO;AAC5B,UAAM,MAAMA,SAAQ,MAAM;AAC1B,QAAI,CAAC,QAAQ,CAAC,KAAK;AACjB,cAAQ,QAAQ;AAChB;AAAA,IACF;AACA,UAAM,MAAM,EAAE;AACd,eAAW,QAAQ;AACnB,UAAM,QAAQ;AACd,QAAI;AACF,YAAM,OAAO,MAAM,iBAAiB,KAAK,IAAI;AAC7C,UAAI,YAAY,QAAQ,WAAY;AACpC,cAAQ,QAAQ;AAAA,IAClB,SAAS,KAAK;AACZ,UAAI,YAAY,QAAQ,WAAY;AAGpC,cAAQ,QAAQ;AAChB,YAAM,QACJ,eAAe,QAAQ,MAAM,IAAI,MAAM,qBAAqB;AAAA,IAChE,UAAE;AACA,UAAI,CAAC,YAAY,QAAQ,WAAY,YAAW,QAAQ;AAAA,IAC1D;AAAA,EACF;AAEA,cAAY,MAAM;AAEhB,IAAAA,SAAQ,OAAO;AACf,IAAAA,SAAQ,MAAM;AACd,SAAK,QAAQ;AAAA,EACf,CAAC;AAED,EAAAF,gBAAe,MAAM;AACnB,eAAW;AAAA,EACb,CAAC;AAED,SAAO,EAAE,SAAS,YAAY,OAAO,QAAQ;AAC/C;","names":["computed","toValue","onScopeDispose","shallowRef","toValue"]}
|
|
1
|
+
{"version":3,"sources":["../src/wc-generated/proxies.ts","../src/useAccounts.ts","../src/useChain.ts","../src/usePassphraseGate.ts","../src/useSolanaBalance.ts","../src/useCapabilities.ts","../src/useSolanaRoles.ts"],"sourcesContent":["/* eslint-disable */\n/* tslint:disable */\n/* auto-generated vue proxies */\nimport { defineContainer, type StencilVueComponent } from '@stencil/vue-output-target/runtime';\n\nimport type { JSX } from '@naculus/connect-appkit-wc';\n\n\n\n\n\nexport const AppkitAccordion: StencilVueComponent<JSX.AppkitAccordion> = /*@__PURE__*/ defineContainer<JSX.AppkitAccordion>('appkit-accordion', undefined, [\n 'label',\n 'open',\n 'disabled',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitAccountButton: StencilVueComponent<JSX.AppkitAccountButton> = /*@__PURE__*/ defineContainer<JSX.AppkitAccountButton>('appkit-account-button', undefined, [\n 'address',\n 'balance',\n 'balanceSymbol',\n 'showAddress',\n 'showBalance',\n 'disabled'\n]);\n\n\nexport const AppkitAlertDialog: StencilVueComponent<JSX.AppkitAlertDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitAlertDialog>('appkit-alert-dialog', undefined, [\n 'open',\n 'heading',\n 'description',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitAvatar: StencilVueComponent<JSX.AppkitAvatar> = /*@__PURE__*/ defineContainer<JSX.AppkitAvatar>('appkit-avatar', undefined, [\n 'size',\n 'src',\n 'alt',\n 'fallback'\n]);\n\n\nexport const AppkitBadge: StencilVueComponent<JSX.AppkitBadge> = /*@__PURE__*/ defineContainer<JSX.AppkitBadge>('appkit-badge', undefined, [\n 'variant'\n]);\n\n\nexport const AppkitButton: StencilVueComponent<JSX.AppkitButton> = /*@__PURE__*/ defineContainer<JSX.AppkitButton>('appkit-button', undefined, [\n 'variant',\n 'size',\n 'disabled',\n 'type',\n 'locale',\n 'ariaLabel',\n 'eventName'\n]);\n\n\nexport const AppkitCard: StencilVueComponent<JSX.AppkitCard> = /*@__PURE__*/ defineContainer<JSX.AppkitCard>('appkit-card', undefined);\n\n\nexport const AppkitCardContent: StencilVueComponent<JSX.AppkitCardContent> = /*@__PURE__*/ defineContainer<JSX.AppkitCardContent>('appkit-card-content', undefined);\n\n\nexport const AppkitCardDescription: StencilVueComponent<JSX.AppkitCardDescription> = /*@__PURE__*/ defineContainer<JSX.AppkitCardDescription>('appkit-card-description', undefined);\n\n\nexport const AppkitCardFooter: StencilVueComponent<JSX.AppkitCardFooter> = /*@__PURE__*/ defineContainer<JSX.AppkitCardFooter>('appkit-card-footer', undefined);\n\n\nexport const AppkitCardHeader: StencilVueComponent<JSX.AppkitCardHeader> = /*@__PURE__*/ defineContainer<JSX.AppkitCardHeader>('appkit-card-header', undefined);\n\n\nexport const AppkitCardTitle: StencilVueComponent<JSX.AppkitCardTitle> = /*@__PURE__*/ defineContainer<JSX.AppkitCardTitle>('appkit-card-title', undefined);\n\n\nexport const AppkitCheckbox: StencilVueComponent<JSX.AppkitCheckbox> = /*@__PURE__*/ defineContainer<JSX.AppkitCheckbox>('appkit-checkbox', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'name',\n 'value',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitCollapsible: StencilVueComponent<JSX.AppkitCollapsible> = /*@__PURE__*/ defineContainer<JSX.AppkitCollapsible>('appkit-collapsible', undefined, [\n 'open',\n 'appkitToggle'\n], [\n 'appkitToggle'\n]);\n\n\nexport const AppkitConnectButton: StencilVueComponent<JSX.AppkitConnectButton> = /*@__PURE__*/ defineContainer<JSX.AppkitConnectButton>('appkit-connect-button', undefined, [\n 'connected',\n 'connecting',\n 'address',\n 'balance',\n 'balanceSymbol',\n 'isBalanceLoading',\n 'tokenBalancesJson',\n 'explorerUrl',\n 'explorerLabel',\n 'isMobile',\n 'mobileWalletName',\n 'walletsJson',\n 'qrUri',\n 'qrLoading',\n 'qrError',\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n], [\n 'appkitConnect',\n 'appkitDisconnect',\n 'appkitStartPairing',\n 'appkitRetry',\n 'appkitCancelPairing',\n 'appkitMobileDeepLink',\n 'appkitCopyAddress'\n]);\n\n\nexport const AppkitDialog: StencilVueComponent<JSX.AppkitDialog> = /*@__PURE__*/ defineContainer<JSX.AppkitDialog>('appkit-dialog', undefined, [\n 'open',\n 'heading',\n 'appkitClose',\n 'appkitOpenChange'\n], [\n 'appkitClose',\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitDropdownMenu: StencilVueComponent<JSX.AppkitDropdownMenu> = /*@__PURE__*/ defineContainer<JSX.AppkitDropdownMenu>('appkit-dropdown-menu', undefined, [\n 'itemsJson',\n 'appkitSelect'\n], [\n 'appkitSelect'\n]);\n\n\nexport const AppkitInput: StencilVueComponent<JSX.AppkitInput> = /*@__PURE__*/ defineContainer<JSX.AppkitInput>('appkit-input', undefined, [\n 'type',\n 'placeholder',\n 'value',\n 'disabled',\n 'invalid',\n 'name',\n 'autocomplete',\n 'maxLength',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitPopover: StencilVueComponent<JSX.AppkitPopover> = /*@__PURE__*/ defineContainer<JSX.AppkitPopover>('appkit-popover', undefined, [\n 'open',\n 'placement',\n 'appkitOpenChange'\n], [\n 'appkitOpenChange'\n]);\n\n\nexport const AppkitProgress: StencilVueComponent<JSX.AppkitProgress> = /*@__PURE__*/ defineContainer<JSX.AppkitProgress>('appkit-progress', undefined, [\n 'value',\n 'max',\n 'label'\n]);\n\n\nexport const AppkitScrollArea: StencilVueComponent<JSX.AppkitScrollArea> = /*@__PURE__*/ defineContainer<JSX.AppkitScrollArea>('appkit-scroll-area', undefined);\n\n\nexport const AppkitSelect: StencilVueComponent<JSX.AppkitSelect> = /*@__PURE__*/ defineContainer<JSX.AppkitSelect>('appkit-select', undefined, [\n 'optionsJson',\n 'value',\n 'placeholder',\n 'disabled',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitSeparator: StencilVueComponent<JSX.AppkitSeparator> = /*@__PURE__*/ defineContainer<JSX.AppkitSeparator>('appkit-separator', undefined, [\n 'orientation',\n 'decorative'\n]);\n\n\nexport const AppkitSkeleton: StencilVueComponent<JSX.AppkitSkeleton> = /*@__PURE__*/ defineContainer<JSX.AppkitSkeleton>('appkit-skeleton', undefined);\n\n\nexport const AppkitSwitch: StencilVueComponent<JSX.AppkitSwitch> = /*@__PURE__*/ defineContainer<JSX.AppkitSwitch>('appkit-switch', undefined, [\n 'checked',\n 'disabled',\n 'label',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTabs: StencilVueComponent<JSX.AppkitTabs> = /*@__PURE__*/ defineContainer<JSX.AppkitTabs>('appkit-tabs', undefined, [\n 'tabsJson',\n 'selected',\n 'appkitTabChange'\n], [\n 'appkitTabChange'\n]);\n\n\nexport const AppkitToggleGroup: StencilVueComponent<JSX.AppkitToggleGroup> = /*@__PURE__*/ defineContainer<JSX.AppkitToggleGroup>('appkit-toggle-group', undefined, [\n 'itemsJson',\n 'selected',\n 'multiple',\n 'appkitChange'\n], [\n 'appkitChange'\n]);\n\n\nexport const AppkitTooltip: StencilVueComponent<JSX.AppkitTooltip> = /*@__PURE__*/ defineContainer<JSX.AppkitTooltip>('appkit-tooltip', undefined, [\n 'content',\n 'placement'\n]);\n\n\n","import { isEvmAddress, parseCaip10 } from \"@naculus/connect-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface AccountEntry {\n /** As the session reports it: CAIP-10 for most wallets, bare hex for some. */\n address: string;\n /** The namespace, when the entry was CAIP-10. Null for a bare address. */\n namespace: string | null;\n isEVM: boolean;\n}\n\nexport interface UseAccountsReturn {\n accounts: ComputedRef<AccountEntry[]>;\n evmAccount: ComputedRef<string | null>;\n solanaAccount: ComputedRef<string | null>;\n}\n\n/**\n * Split a session's account list by what each entry actually is.\n *\n * The same reading as the React `useAccount`, because it is the same reading:\n * `parseCaip10` and `isEvmAddress` come from `@naculus/connect-core` and hold\n * every rule about which strings mean what. What differs between the two\n * bindings is `computed` versus `useMemo`, and nothing else.\n */\nexport function useAccounts(\n accounts: MaybeRefOrGetter<string[] | null | undefined>,\n): UseAccountsReturn {\n const parsed = computed<AccountEntry[]>(() =>\n (toValue(accounts) ?? []).map((address) => {\n const caip10 = parseCaip10(address);\n if (caip10) {\n return {\n address,\n namespace: caip10.namespace,\n isEVM:\n caip10.namespace === \"eip155\" && isEvmAddress(caip10.address),\n };\n }\n // A bare 0x-40-hex value is unambiguously EVM. A bare base58 string is\n // not unambiguously anything, so nothing is claimed about it.\n return { address, namespace: null, isEVM: isEvmAddress(address) };\n }),\n );\n\n return {\n accounts: parsed,\n evmAccount: computed(\n () => parsed.value.find((a) => a.isEVM)?.address ?? null,\n ),\n solanaAccount: computed(\n () => parsed.value.find((a) => a.namespace === \"solana\")?.address ?? null,\n ),\n };\n}\n","import {\n chainNamespace,\n chainNumber,\n chainsForNamespace,\n describeChain,\n resolveChain,\n type ChainInfo,\n type WalletChain,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, toValue } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\n\nexport interface UseChainReturn {\n /** The configured chain matching the connected CAIP-2 id, or null. */\n currentChain: ComputedRef<WalletChain | null>;\n /** A description of the connected chain, for any namespace. */\n chainInfo: ComputedRef<ChainInfo | null>;\n /** Only the chains the connected wallet could actually switch to. */\n availableChains: ComputedRef<WalletChain[]>;\n /** The EIP-155 number, or null when the connected chain has none. */\n currentChainNumber: ComputedRef<number | null>;\n namespace: ComputedRef<string | null>;\n}\n\n/**\n * The connected chain, and the chains it is possible to switch to.\n *\n * Identical in substance to the React `useChain`, because it is the same five\n * functions from `@naculus/connect-appkit-core`. This file contains no\n * decision at all — which is the point: `availableChains` filtering to the\n * connected namespace, `chainInfo` describing non-EVM chains, and\n * `currentChainNumber` refusing to invent a number for Solana are all\n * properties of the shared core, so both bindings get them or neither does.\n *\n * Takes its chain list and connected id as arguments; Vue has no equivalent of\n * the React provider here.\n */\nexport function useChain(\n chains: MaybeRefOrGetter<WalletChain[] | null | undefined>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseChainReturn {\n const list = computed(() => toValue(chains) ?? []);\n const id = computed(() => toValue(chainId) ?? null);\n\n const currentChain = computed(() => resolveChain(list.value, id.value));\n\n return {\n currentChain,\n chainInfo: computed(() => describeChain(list.value, id.value)),\n availableChains: computed(() => chainsForNamespace(list.value, id.value)),\n currentChainNumber: computed(() =>\n currentChain.value ? chainNumber(currentChain.value) : null,\n ),\n namespace: computed(() =>\n currentChain.value ? chainNamespace(currentChain.value) : null,\n ),\n };\n}\n","import type { PassphraseGate, PassphraseRequest } from \"@naculus/connect-core\";\nimport { onScopeDispose, readonly, shallowRef } from \"vue\";\n\nexport interface UsePassphraseGateReturn {\n /** The open request, or null when nothing is being asked. */\n request: Readonly<ReturnType<typeof shallowRef<PassphraseRequest | null>>>;\n /** Answer the open request. */\n submit: (passphrase: string) => void;\n /** Abandon it, failing the load or save that asked. */\n cancel: (reason?: string) => void;\n /** Drop the held passphrase, so the next operation asks again. */\n forget: (reason?: string) => void;\n}\n\n/**\n * Bind a `PassphraseGate` into Vue reactivity.\n *\n * The gate itself lives in `@naculus/connect-core` rather than in either\n * framework package, because the thing it bridges — an encrypted storage\n * adapter asking for a passphrase from inside code that has never heard of a\n * component — is the same problem in React and in Vue. One implementation,\n * two thin bindings.\n *\n * ```ts\n * const gate = new PassphraseGate()\n * const wallet = new PocketWallet({ encryptionPassphrase: gate.request })\n * const { request, submit, cancel } = usePassphraseGate(gate)\n * ```\n *\n * `shallowRef`, not `ref`: the request is a small immutable snapshot the gate\n * replaces wholesale, and deep reactivity over it would proxy an object that\n * never mutates in place.\n */\nexport function usePassphraseGate(\n gate: PassphraseGate,\n): UsePassphraseGateReturn {\n const request = shallowRef<PassphraseRequest | null>(gate.getSnapshot());\n const unsubscribe = gate.subscribe(() => {\n request.value = gate.getSnapshot();\n });\n // Without this the gate keeps a reference to a listener belonging to a\n // component that is gone, and every later prompt writes into a dead ref.\n onScopeDispose(unsubscribe);\n\n return {\n request: readonly(request) as UsePassphraseGateReturn[\"request\"],\n submit: (passphrase: string) => gate.submit(passphrase),\n cancel: (reason?: string) => gate.cancel(reason),\n forget: (reason?: string) => gate.forget(reason),\n };\n}\n","import {\n getSolanaBalance,\n type SolanaBalance,\n} from \"@naculus/connect-core\";\nimport { onScopeDispose, ref, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { MaybeRefOrGetter } from \"vue\";\n\nexport interface UseSolanaBalanceReturn {\n balance: ReturnType<typeof shallowRef<SolanaBalance | null>>;\n isFetching: ReturnType<typeof ref<boolean>>;\n error: ReturnType<typeof shallowRef<Error | null>>;\n refetch: () => Promise<void>;\n}\n\n/**\n * The SOL balance of an address.\n *\n * The whole of this file is Vue plumbing. Every decision that took thought —\n * exact lamport arithmetic, distinguishing an unfunded account from an emptied\n * one, refusing to invent a zero — is in `@naculus/connect-core`, shared with\n * the React hook. That is what makes \"author in React, ship to Vue\" true for\n * the logic: what does not translate is only the reactivity.\n *\n * Takes its address and endpoint as arguments because Vue has no equivalent of\n * the React provider here. Refs and getters both work.\n */\nexport function useSolanaBalance(\n address: MaybeRefOrGetter<string | null | undefined>,\n rpcUrl: MaybeRefOrGetter<string | null | undefined>,\n): UseSolanaBalanceReturn {\n const balance = shallowRef<SolanaBalance | null>(null);\n const isFetching = ref(false);\n const error = shallowRef<Error | null>(null);\n // Guards against a slow response for a previous address overwriting the\n // balance of the one now on screen.\n let generation = 0;\n let disposed = false;\n\n const refetch = async () => {\n const addr = toValue(address);\n const url = toValue(rpcUrl);\n if (!addr || !url) {\n balance.value = null;\n return;\n }\n const own = ++generation;\n isFetching.value = true;\n error.value = null;\n try {\n const next = await getSolanaBalance(url, addr);\n if (disposed || own !== generation) return;\n balance.value = next;\n } catch (err) {\n if (disposed || own !== generation) return;\n // Cleared rather than left stale: a balance shown next to an error\n // reads as the current balance, and it is not.\n balance.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Balance read failed\");\n } finally {\n if (!disposed && own === generation) isFetching.value = false;\n }\n };\n\n watchEffect(() => {\n // Touch both so the effect re-runs when either changes.\n toValue(address);\n toValue(rpcUrl);\n void refetch();\n });\n\n onScopeDispose(() => {\n disposed = true;\n });\n\n return { balance, isFetching, error, refetch };\n}\n","import {\n atomicSupportFor,\n type AtomicSupport,\n type ChainCapabilities,\n normalizeCapabilities,\n selectChainCapabilities,\n} from \"@naculus/connect-appkit-core\";\nimport { computed, shallowRef, toValue, watchEffect } from \"vue\";\nimport type { ComputedRef, MaybeRefOrGetter, ShallowRef } from \"vue\";\n\nexport type { AtomicSupport, ChainCapabilities };\n\n/** The part of a connector this needs. Anything with these two is enough. */\nexport interface CapabilityClient {\n getCapabilities?: (session: unknown) => Promise<Record<string, unknown>>;\n}\n\nexport interface UseCapabilitiesReturn {\n /** Per-chain, keyed by CAIP-2. Null until a query has actually returned. */\n capabilities: ShallowRef<Record<string, ChainCapabilities> | null>;\n /** The connected chain's entry, for the common case. */\n current: ComputedRef<ChainCapabilities | null>;\n /** Atomic support on the connected chain. `\"unknown\"` until told otherwise. */\n atomic: ComputedRef<AtomicSupport>;\n isFetching: ShallowRef<boolean>;\n error: ShallowRef<Error | null>;\n refetch: () => Promise<void>;\n}\n\n/**\n * What the connected wallet says it can do — EIP-5792\n * `wallet_getCapabilities`.\n *\n * The query a dApp makes *before* choosing how to execute: ask whether the\n * wallet batches atomically, then send one batch or a sequence, rather than\n * sending a batch and learning the answer from a rejection.\n *\n * Identical in substance to the React hook, because every decision in it —\n * normalising the raw answer, the CAIP-2/hex lookup, and `\"unknown\"` meaning\n * \"not told\" rather than \"no\" — is in `@naculus/connect-appkit-core` and\n * neither binding gets to disagree about it.\n *\n * Takes its client, session and chain as arguments. Vue has no equivalent of\n * the React provider here, which is the same shape `useChain` uses.\n */\nexport function useCapabilities(\n client: MaybeRefOrGetter<CapabilityClient | null | undefined>,\n session: MaybeRefOrGetter<unknown>,\n chainId: MaybeRefOrGetter<string | null | undefined>,\n): UseCapabilitiesReturn {\n const capabilities = shallowRef<Record<string, ChainCapabilities> | null>(\n null,\n );\n const isFetching = shallowRef(false);\n const error = shallowRef<Error | null>(null);\n // Guards a slow answer for a previous session overwriting a newer one.\n let generation = 0;\n\n const refetch = async () => {\n const mine = ++generation;\n const activeClient = toValue(client);\n const activeSession = toValue(session);\n if (!activeClient?.getCapabilities || !activeSession) {\n capabilities.value = null;\n isFetching.value = false;\n error.value = null;\n return;\n }\n isFetching.value = true;\n error.value = null;\n try {\n const raw = await activeClient.getCapabilities(activeSession);\n if (mine !== generation) return;\n capabilities.value = normalizeCapabilities(raw);\n } catch (err) {\n if (mine !== generation) return;\n // Cleared rather than left stale. A capability map from a previous\n // wallet is a worse answer than no answer.\n capabilities.value = null;\n error.value =\n err instanceof Error ? err : new Error(\"Capability query failed\");\n } finally {\n if (mine === generation) isFetching.value = false;\n }\n };\n\n // Re-queries when the client or session changes, the way the React effect\n // does. `chainId` is deliberately not a trigger: it selects from an answer\n // already held rather than needing a new one.\n watchEffect(() => {\n void toValue(client);\n void toValue(session);\n void refetch();\n });\n\n return {\n capabilities,\n current: computed(() =>\n selectChainCapabilities(capabilities.value, toValue(chainId)),\n ),\n atomic: computed(() =>\n atomicSupportFor(capabilities.value, toValue(chainId)),\n ),\n isFetching,\n error,\n refetch,\n };\n}\n","import {\n readSolanaRoles,\n type SolanaIdentity,\n type SolanaPayer,\n type SolanaRoles,\n type SolanaRolesAbsence,\n type SolanaRolesSource,\n type SolanaSigner,\n type SolanaWalletFeatures,\n} from \"@naculus/connect-appkit-core\";\nimport type { ComputedRef, MaybeRefOrGetter } from \"vue\";\nimport { computed, toValue } from \"vue\";\n\nexport type {\n SolanaIdentity,\n SolanaPayer,\n SolanaRoles,\n SolanaRolesAbsence,\n SolanaRolesSource,\n SolanaSigner,\n SolanaWalletFeatures,\n};\n\nexport interface UseSolanaRolesReturn {\n /** The roles the connected account can fill, or null with a reason. */\n roles: ComputedRef<SolanaRoles | null>;\n /** Why `roles` is null. Null when it is not. */\n absence: ComputedRef<SolanaRolesAbsence | null>;\n /** Which account this is. Never null while `roles` is present. */\n identity: ComputedRef<SolanaIdentity | null>;\n /**\n * Signs without submitting. Null when the wallet declared it cannot *and*\n * null when nothing is known; check `absence` to tell those apart.\n */\n signer: ComputedRef<SolanaSigner | null>;\n /** Signs and broadcasts itself. Null under the same two conditions. */\n payer: ComputedRef<SolanaPayer | null>;\n}\n\n/**\n * Which roles the connected Solana account can actually fill.\n *\n * Identical in substance to the React hook: every judgement — that a null\n * `signer` from the connector is an answer while a missing `getRoles` is\n * not, that an EVM session is never asked — is in\n * `@naculus/connect-appkit-core`, and neither binding gets to disagree.\n *\n * Takes the connector and session as arguments, the shape `useCapabilities`\n * uses, because Vue has no provider here. Pass the session as a ref so an\n * account switch that replaces it is noticed; the connector reads the live\n * address either way, so a caller holding a stale snapshot still gets the\n * account the wallet moved to.\n */\nexport function useSolanaRoles(\n connector: MaybeRefOrGetter<SolanaRolesSource | null | undefined>,\n session: MaybeRefOrGetter<{ walletType?: string } | null | undefined>,\n): UseSolanaRolesReturn {\n const state = computed(() =>\n readSolanaRoles(toValue(connector), toValue(session)),\n );\n\n return {\n roles: computed(() => state.value.roles),\n absence: computed(() => state.value.absence),\n identity: computed(() => state.value.roles?.identity ?? null),\n signer: computed(() => state.value.roles?.signer ?? null),\n payer: computed(() => state.value.roles?.payer ?? null),\n };\n}\n"],"mappings":";AAGA,SAAS,uBAAiD;AAQnD,IAAM,kBAA0E,gCAAqC,oBAAoB,QAAW;AAAA,EACzJ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AAAA,EACD;AACF,CAAC;AAGM,IAAM,sBAAkF,gCAAyC,yBAAyB,QAAW;AAAA,EAC1K;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGM,IAAM,oBAA8E,gCAAuC,uBAAuB,QAAW;AAAA,EAClK;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAC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AI,MAAM,yBAAyB;AAAA,IACpE,UAAE;AACA,UAAI,SAAS,WAAY,YAAW,QAAQ;AAAA,IAC9C;AAAA,EACF;AAKA,EAAAC,aAAY,MAAM;AAChB,SAAKD,SAAQ,MAAM;AACnB,SAAKA,SAAQ,OAAO;AACpB,SAAK,QAAQ;AAAA,EACf,CAAC;AAED,SAAO;AAAA,IACL;AAAA,IACA,SAASF;AAAA,MAAS,MAChB,wBAAwB,aAAa,OAAOE,SAAQ,OAAO,CAAC;AAAA,IAC9D;AAAA,IACA,QAAQF;AAAA,MAAS,MACf,iBAAiB,aAAa,OAAOE,SAAQ,OAAO,CAAC;AAAA,IACvD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;AC3GA;AAAA,EACE;AAAA,OAQK;AAEP,SAAS,YAAAE,WAAU,WAAAC,gBAAe;AA0C3B,SAAS,eACd,WACA,SACsB;AACtB,QAAM,QAAQD;AAAA,IAAS,MACrB,gBAAgBC,SAAQ,SAAS,GAAGA,SAAQ,OAAO,CAAC;AAAA,EACtD;AAEA,SAAO;AAAA,IACL,OAAOD,UAAS,MAAM,MAAM,MAAM,KAAK;AAAA,IACvC,SAASA,UAAS,MAAM,MAAM,MAAM,OAAO;AAAA,IAC3C,UAAUA,UAAS,MAAM,MAAM,MAAM,OAAO,YAAY,IAAI;AAAA,IAC5D,QAAQA,UAAS,MAAM,MAAM,MAAM,OAAO,UAAU,IAAI;AAAA,IACxD,OAAOA,UAAS,MAAM,MAAM,MAAM,OAAO,SAAS,IAAI;AAAA,EACxD;AACF;","names":["computed","toValue","onScopeDispose","shallowRef","toValue","computed","shallowRef","toValue","watchEffect","computed","toValue"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@naculus/connect-appkit-vue",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@stencil/vue-output-target": "^0.14.3",
|
|
21
|
-
"@naculus/connect-appkit-wc": "0.2.
|
|
21
|
+
"@naculus/connect-appkit-wc": "0.2.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@naculus/connect-appkit-core": "^0.2.
|
|
24
|
+
"@naculus/connect-appkit-core": "^0.2.4",
|
|
25
25
|
"@naculus/connect-core": "^0.2.0",
|
|
26
26
|
"vue": "^3.5.0"
|
|
27
27
|
},
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@naculus/connect-core": "^0.2.1",
|
|
33
33
|
"vitest": "^5.0.0",
|
|
34
34
|
"vue": "^3.5.42",
|
|
35
|
-
"@naculus/connect-appkit-core": "0.2.
|
|
35
|
+
"@naculus/connect-appkit-core": "0.2.4"
|
|
36
36
|
},
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|