@xyo-network/react-chain-client 1.20.22 → 1.20.24

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.
@@ -14,5 +14,38 @@ export interface ConnectClientAccountsStackProps extends StackProps {
14
14
  onCancel?: () => void;
15
15
  timeout?: number;
16
16
  }
17
+ /**
18
+ * Renders a horizontal stack that surfaces the current state of the user's
19
+ * connection to an XL1 wallet (e.g. the XL1 Chrome extension) and lets them
20
+ * kick off a connection.
21
+ *
22
+ * Connection state is derived from `useConnectAccount`, which wraps
23
+ * `useGatewayFromWallet` (wallet/gateway discovery with a configurable
24
+ * `timeout`) and `useAccountPermissions` (already-authorized addresses).
25
+ * The hook returns: `address` (resolved once the wallet exposes one),
26
+ * `connectSigner` (prompts the wallet for an address), `timedout` (the
27
+ * gateway never appeared within `timeout`), and `error` (the first of
28
+ * gateway, permissions, or signer-connect failures).
29
+ *
30
+ * The component renders exactly one of the following wallet states, plus
31
+ * an always-present error slot:
32
+ *
33
+ * - **Connected** — `address` is defined: renders `AccountComponent` for
34
+ * that address. Also fires `onAccountConnected(address)` once via effect.
35
+ * - **Disconnected, wallet available** — no `address` and not `timedout`:
36
+ * renders `ConnectComponent` as a "Connect" button that invokes
37
+ * `connectSigner()`. This covers both "wallet installed but no account
38
+ * authorized yet" and "gateway still resolving".
39
+ * - **Wallet missing / unreachable** — no `address` and `timedout` is true:
40
+ * renders `NoWalletInstalledComponent` (defaults to an Alert linking to
41
+ * the XL1 Wallet Chrome Web Store listing).
42
+ * - **Error** — any error from the hook is rendered via `ErrorRender`
43
+ * alongside the state above, and `onCancel()` is fired once via effect
44
+ * so the host UI can close/abort its connect flow.
45
+ *
46
+ * All three slot components (`AccountComponent`, `ConnectComponent`,
47
+ * `NoWalletInstalledComponent`) are injectable so consumers can restyle
48
+ * any state without forking this component.
49
+ */
17
50
  export declare const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps>;
18
51
  //# sourceMappingURL=ConnectAccountsStack.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectAccountsStack.d.ts","sourceRoot":"","sources":["../../../../src/components/connected/ConnectAccountsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAO/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAG7C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAoB,MAAM,OAAO,CAAA;AA4BxC,MAAM,WAAW,+BAAgC,SAAQ,UAAU;IACjE,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9E,0BAA0B,CAAC,EAAE,aAAa,CAAA;IAC1C,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,CA2C1E,CAAA"}
1
+ {"version":3,"file":"ConnectAccountsStack.d.ts","sourceRoot":"","sources":["../../../../src/components/connected/ConnectAccountsStack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAQ/C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC7D,OAAO,KAAoB,MAAM,OAAO,CAAA;AA4BxC,MAAM,WAAW,+BAAgC,SAAQ,UAAU;IACjE,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACtD,gBAAgB,CAAC,EAAE,aAAa,CAAC;QAAE,OAAO,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAA;KAAE,CAAC,CAAA;IAC9E,0BAA0B,CAAC,EAAE,aAAa,CAAA;IAC1C,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,+BAA+B,CA2C1E,CAAA"}
@@ -1,4 +1,34 @@
1
1
  import React from 'react';
2
2
  import type { GatewayProviderProps } from './GatewayProviderProps.ts';
3
+ /**
4
+ * Publishes a `GatewayContext` backed exclusively by the injected XL1 Wallet
5
+ * extension (i.e. `globalThis.xyo`). This is the provider to use when the
6
+ * host app is a browser UI that expects the user to bring their own wallet,
7
+ * rather than running an in-page gateway.
8
+ *
9
+ * The requested `gatewayName` is forwarded to `useGatewayFromWallet`, whose
10
+ * returned gateway uses a three-state contract (`undefined` = still
11
+ * resolving, `null` = wallet confirmed absent / timed out,
12
+ * `XyoGatewayRunner` = ready). That tri-state is passed through to
13
+ * consumers unchanged as `defaultGateway` / `gateways.walletGateway`, so
14
+ * downstream hooks can distinguish "loading" from "missing".
15
+ *
16
+ * The published `GatewayContextState` shape:
17
+ * - `defaultGateway` — the wallet gateway, used when consumers don't
18
+ * specify which gateway they want.
19
+ * - `gateways.walletGateway` — same instance as `defaultGateway`.
20
+ * - `gateways.inPageGateway` — always `null` here; this provider does not
21
+ * stand up an in-page client. Pair with a different provider if you need
22
+ * both.
23
+ * - `error` — surfaced from `useGatewayFromWallet` (detection / timeout /
24
+ * wallet errors). Also rendered inline via `ErrorRender` above `children`
25
+ * so mount-time failures are visible even if no consumer reads `error`.
26
+ * - `provided: true` — lets descendants detect that a real provider (not
27
+ * the default empty context) is in the tree.
28
+ *
29
+ * The `defaultGateway`, `gateways`, and context `value` are memoized so
30
+ * consumers only re-render when the underlying wallet gateway reference or
31
+ * error actually changes.
32
+ */
3
33
  export declare const WalletGatewayProvider: React.FC<GatewayProviderProps>;
4
34
  //# sourceMappingURL=WalletGatewayProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WalletGatewayProvider.d.ts","sourceRoot":"","sources":["../../../src/context/WalletGatewayProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGrE,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoChE,CAAA"}
1
+ {"version":3,"file":"WalletGatewayProvider.d.ts","sourceRoot":"","sources":["../../../src/context/WalletGatewayProvider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAItC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoChE,CAAA"}
@@ -27,8 +27,8 @@ var ConnectedAccount = /* @__PURE__ */ __name(({ address }) => {
27
27
  // src/components/connected/ConnectAccountsStack.tsx
28
28
  import { Alert, AlertTitle, Button, Stack as Stack2, Typography as Typography2 } from "@mui/material";
29
29
  import { ButtonEx } from "@xylabs/react-button";
30
+ import { ErrorRender } from "@xylabs/react-error";
30
31
  import { isDefined as isDefined3, isUndefined as isUndefined3 } from "@xylabs/sdk-js";
31
- import { ErrorRender } from "@xyo-network/react-error";
32
32
  import React2, { useEffect as useEffect2 } from "react";
33
33
 
34
34
  // src/components/connected/hooks/useConnectAccount.ts
@@ -314,7 +314,7 @@ import { useContextEx } from "@xylabs/react-shared";
314
314
  var useProvidedGateway = /* @__PURE__ */ __name((required = true) => useContextEx(GatewayContext, "Gateway", required), "useProvidedGateway");
315
315
 
316
316
  // src/context/WalletGatewayProvider.tsx
317
- import { ErrorRender as ErrorRender2 } from "@xyo-network/react-error";
317
+ import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
318
318
  import React3, { useMemo } from "react";
319
319
  var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
320
320
  const { gateway: gatewayFromWallet, error: gatewayFromWalletError } = useGatewayFromWallet(gatewayName);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/connected/account/Connected.tsx","../../src/components/connected/ConnectAccountsStack.tsx","../../src/components/connected/hooks/useConnectAccount.ts","../../src/hooks/client/helpers/findCaveat.ts","../../src/hooks/client/useClientFromWallet.ts","../../src/hooks/helpers/getXyoClient.ts","../../src/hooks/client/permissions/usePermissions.ts","../../src/hooks/client/permissions/usePermissionsAccounts.ts","../../src/hooks/client/useGatewayFromWallet.ts","../../src/context/GatewayContext.ts","../../src/context/useProvidedGateway.ts","../../src/context/WalletGatewayProvider.tsx"],"sourcesContent":["import {\n Stack, Tooltip, Typography,\n} from '@mui/material'\nimport { EthAddressWrapper } from '@xylabs/sdk-js'\nimport { BlockiesAvatarAddress } from '@xyo-network/react-chain-blockies'\nimport React from 'react'\n\nexport const ConnectedAccount: React.FC<{ address: string }> = ({ address }) => {\n const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" spacing={1}>\n <BlockiesAvatarAddress address={address} size={21} />\n <Tooltip title={address}>\n <Typography color=\"textSecondary\" variant=\"caption\" fontFamily=\"monospace\">{shortenedAddress}</Typography>\n </Tooltip>\n </Stack>\n )\n}\n","import type { StackProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Button, Stack,\n Typography,\n} from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } from '@xylabs/react-button'\nimport type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport { ErrorRender } from '@xyo-network/react-error'\nimport type { ComponentType, MouseEventHandler } from 'react'\nimport React, { useEffect } from 'react'\n\nimport { ConnectedAccount } from './account/index.ts'\nimport { useConnectAccount } from './hooks/index.ts'\n\nconst DefaultConnectComponent: React.FC<ButtonExProps> = props => (\n <ButtonEx variant=\"contained\" size=\"small\" {...props} />\n)\n\nconst DefaultNoWalletInstalledComponent: React.FC = () => (\n <Alert severity=\"warning\">\n <AlertTitle>XL1 Wallet Not Found</AlertTitle>\n <Typography gutterBottom>\n Please ensure that your XL1 Wallet is installed to connect your account.\n </Typography>\n <Button\n sx={{ display: 'flex', justifySelf: 'end' }}\n size=\"small\"\n variant=\"outlined\"\n href=\"https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n Get XL1 Wallet\n </Button>\n </Alert>\n)\n\nexport interface ConnectClientAccountsStackProps extends StackProps {\n AccountComponent?: ComponentType<{ account?: string }>\n ConnectComponent?: ComponentType<{ onClick?: MouseEventHandler<HTMLElement> }>\n NoWalletInstalledComponent?: ComponentType\n onAccountConnected?: (account: Address) => void\n onCancel?: () => void\n timeout?: number\n}\n\nexport const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps> = ({\n AccountComponent = ConnectedAccount,\n ConnectComponent = DefaultConnectComponent,\n NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,\n onAccountConnected,\n onCancel,\n timeout,\n ...props\n}) => {\n const {\n address, connectSigner, error, timedout,\n } = useConnectAccount(undefined, timeout)\n\n useEffect(() => {\n if (isDefined(error) && isDefined(onCancel)) {\n onCancel()\n }\n }, [error, onCancel])\n\n useEffect(() => {\n if (isDefined(address) && isDefined(onAccountConnected)) {\n onAccountConnected(address)\n }\n }, [address, onAccountConnected])\n\n return (\n <Stack direction=\"row\" alignItems=\"start\" spacing={2} {...props}>\n {isDefined(address)\n ? <AccountComponent address={address} />\n : null}\n {isUndefined(address) && !timedout\n ? (\n <ConnectComponent onClick={() => void connectSigner()}>Connect</ConnectComponent>\n )\n : null}\n {isUndefined(address) && timedout\n ? (\n <NoWalletInstalledComponent />\n )\n : null}\n <ErrorRender error={error} scope=\"ConnectSigner:error\" />\n </Stack>\n )\n}\n","import { type Address, asAddress } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\nimport { MainNetwork } from '@xyo-network/xl1-sdk'\nimport { useCallback, useState } from 'react'\n\nimport { useAccountPermissions, useGatewayFromWallet } from '../../../hooks/index.ts'\n\nexport const useConnectAccount = (gatewayName: GatewayName = MainNetwork.id, timeout?: number) => {\n const [connectError, setConnectError] = useState<Error>()\n\n const {\n gateway, error, timedout,\n } = useGatewayFromWallet(gatewayName, timeout)\n\n const [accountPermissions, accountPermissionsError] = useAccountPermissions()\n\n const [address, setAddress] = useState<Address>()\n\n const connectSigner = useCallback(async () => {\n try {\n setConnectError(undefined)\n const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`)\n const signer = assertedGateway.signer\n const address = await signer.address()\n setAddress(address)\n return address\n } catch (e) {\n setConnectError(e as Error)\n }\n }, [gateway, gatewayName])\n\n return {\n address: asAddress(accountPermissions?.[0] ?? address), connectSigner, error: error ?? accountPermissionsError ?? connectError, gateway, timedout,\n }\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type {\n CaveatTypes, ParentCapability, XyoPermissions,\n} from '@xyo-network/xl1-sdk'\n\nexport const findCaveat = async (\n permissions: XyoPermissions,\n targetCapability: ParentCapability,\n targetCaveatType: CaveatTypes,\n) => {\n const existingPermissions = await permissions.getPermissions()\n if (isDefined(existingPermissions) && existingPermissions.length > 0) {\n const foundPermissions = existingPermissions\n .find(p => p.parentCapability === targetCapability)\n if (isDefined(foundPermissions)) {\n return foundPermissions.caveats?.find(caveat => caveat.type === targetCaveatType)?.value ?? []\n }\n }\n return existingPermissions\n}\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\nimport { useEffect, useState } from 'react'\n\nimport { getXyoClient } from '../helpers/index.ts'\n\ninterface ClientState {\n client?: XyoClient | null\n error: Error | null\n isLoading: boolean\n timedout: boolean\n}\n\nconst initialState: ClientState = {\n client: undefined,\n error: null,\n isLoading: false,\n timedout: false,\n}\n\nexport const useClientFromWallet = (timeout?: number): ClientState => {\n const [state, setState] = useState<ClientState>(initialState)\n\n useEffect(() => {\n let cancelled = false\n\n const initialize = async () => {\n setState((prev) => {\n if (prev.isLoading) return prev\n return {\n ...prev, isLoading: true, error: null,\n }\n })\n\n try {\n const client = await getXyoClient(timeout)\n if (cancelled) return\n if (client === null) {\n setState({\n client: null, timedout: true, isLoading: false, error: null,\n })\n } else {\n setState({\n client, isLoading: false, error: null, timedout: false,\n })\n }\n } catch (error) {\n if (cancelled) return\n setState({\n client: undefined, isLoading: false, error: error as Error, timedout: false,\n })\n }\n }\n\n void initialize()\n\n // Late recovery: if wallet loads after timeout, update state\n const onPluginReady = () => {\n if (cancelled) return\n const client = isUndefined(globalThis.xyo) ? null : globalThis.xyo?.client ?? null\n setState({\n client, isLoading: false, timedout: false, error: null,\n })\n }\n globalThis.addEventListener('xyo:plugin-ready', onPluginReady)\n\n return () => {\n cancelled = true\n globalThis.removeEventListener('xyo:plugin-ready', onPluginReady)\n }\n }, [timeout])\n\n return state\n}\n\n/** @deprecated - use useClientFromWallet instead */\nexport const useClient = useClientFromWallet\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\n\nconst CLIENT_LISTENER_TIMEOUT = 2000\n\nconst hasXyoClient = () => {\n return 'client' in globalThis.xyo\n}\n\nexport const listenForClientInjection = (onClientReady: () => void, timeout: number, onTimeout: () => void) => {\n let resolved = false\n const listener: EventListener = () => {\n onClientReady()\n resolved = true\n }\n globalThis.addEventListener('xyo:plugin-ready', listener)\n setTimeout(() => {\n if (!resolved) {\n globalThis.removeEventListener('xyo:plugin-ready', listener)\n onTimeout()\n }\n }, timeout)\n}\n\ntype ReturnType = XyoClient | undefined | null\n\nexport async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT): Promise<ReturnType> {\n // if no xyo object, we can bail early\n if (isUndefined(globalThis.xyo)) {\n return null\n }\n return hasXyoClient()\n ? globalThis.xyo.client\n // listen for the XyoWallet to be injected\n : await new Promise<ReturnType>((resolve) => {\n listenForClientInjection(\n () => {\n resolve(globalThis.xyo.client)\n },\n timeout,\n () => {\n resolve(null)\n },\n )\n })\n}\n","import { useClientFromWallet } from '../useClientFromWallet.ts'\n\nexport const usePermissions = () => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet()\n const permissions = client?.permissions\n return {\n permissions,\n isLoading,\n error,\n timedout,\n }\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport type { JsonValue } from '@xylabs/sdk-js'\nimport {\n isArray, isDefined, isDefinedNotNull, isString,\n} from '@xylabs/sdk-js'\n\nimport { findCaveat } from '../helpers/index.ts'\nimport { usePermissions } from './usePermissions.ts'\n\nconst validateRestrictedAccounts = (restrictedAccounts: JsonValue): readonly string [] => {\n if (isDefined(restrictedAccounts)) {\n if (isArray(restrictedAccounts) && restrictedAccounts.every(isString)) {\n return restrictedAccounts\n }\n throw new Error(\n `Unrecognized format for restrictReturnedAccounts caveat found on permissions. \\n\n Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`,\n )\n }\n return []\n}\n\nexport const useAccountPermissions = () => {\n const { permissions, error } = usePermissions()\n\n return usePromise(async () => {\n if (isDefinedNotNull(error)) throw error\n if (isDefined(permissions)) {\n const restrictedAccounts = await findCaveat(\n permissions,\n // TODO - extract to constant in protocol package\n 'xyoWallet_getAccounts',\n 'restrictReturnedAccounts',\n )\n return validateRestrictedAccounts(restrictedAccounts)\n }\n }, [permissions])\n}\n","import { isNull } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\n\nimport type { GatewayFromWallet } from '../../types/index.ts'\nimport { useClientFromWallet } from './useClientFromWallet.ts'\n\n/**\n * Resolves a gateway from the injected XL1 Wallet extension.\n *\n * The returned `gateway` uses a three-state contract:\n * - `undefined` — wallet detection is still in progress (isLoading=true),\n * or no gatewayName was provided. Consumers should treat this as \"not yet known\"\n * and avoid committing to either a present or absent UI state.\n * - `null` — wallet is definitively absent. Either globalThis.xyo was never set,\n * or detection timed out. Safe to show fallback UI (e.g. \"Get XL1 Wallet\").\n * A late-recovery listener may still transition this to a real gateway if\n * the extension loads after the timeout.\n * - `XyoGatewayRunner` — wallet is present and exposes this gateway for the\n * requested network. Ready to use for transactions and queries.\n */\nexport const useGatewayFromWallet = (gatewayName?: GatewayName, timeout?: number): GatewayFromWallet => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet(timeout)\n\n const resolveGateway = () => {\n // null client = wallet confirmed absent (no globalThis.xyo or timed out)\n if (isNull(client)) return null\n // client is undefined (still loading) or defined (wallet present) —\n // optional chain returns undefined while loading, or the gateway if available\n return client?.gateways?.[gatewayName!]\n }\n\n return {\n // no gatewayName requested = undefined (opt-out, not \"absent\")\n gateway: gatewayName ? resolveGateway() : undefined,\n isLoading,\n error,\n timedout,\n }\n}\n\n/** @deprecated - useGatewayFromWallet */\nexport const useGateway = useGatewayFromWallet\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\nexport const GatewayContext = createContextEx<GatewayContextState>()\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\n\nexport const useProvidedGateway = (required = true) => useContextEx(GatewayContext, 'Gateway', required)\n","import { ErrorRender } from '@xyo-network/react-error'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../hooks/index.ts'\nimport { GatewayContext } from './GatewayContext.ts'\nimport type { GatewayProviderProps } from './GatewayProviderProps.ts'\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\nexport const WalletGatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const { defaultGateway, gateways } = useMemo(() => {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: null,\n walletGateway: gatewayFromWallet,\n },\n }\n }, [gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError,\n gateways,\n provided: true,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gateways,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromWalletError} />\n {children}\n </GatewayContext>\n )\n}\n"],"mappings":";;;;AAAA,SACEA,OAAOC,SAASC,kBACX;AACP,SAASC,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,OAAOC,WAAW;AAEX,IAAMC,mBAAkD,wBAAC,EAAEC,QAAO,MAAE;AACzE,QAAMC,mBAAmB,GAAGC,kBAAkBC,WAAWH,OAAAA,GAAUI,cAAc,CAAA,CAAA;AAEjF,SACE,sBAAA,cAACC,OAAAA;IAAMC,WAAU;IAAMC,YAAW;IAASC,SAAS;KAClD,sBAAA,cAACC,uBAAAA;IAAsBT;IAAkBU,MAAM;MAC/C,sBAAA,cAACC,SAAAA;IAAQC,OAAOZ;KACd,sBAAA,cAACa,YAAAA;IAAWC,OAAM;IAAgBC,SAAQ;IAAUC,YAAW;KAAaf,gBAAAA,CAAAA,CAAAA;AAIpF,GAX+D;;;ACN/D,SACEgB,OAAOC,YAAYC,QAAQC,SAAAA,QAC3BC,cAAAA,mBACK;AAEP,SAASC,gBAAgB;AAEzB,SAASC,aAAAA,YAAWC,eA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eAAe;AAOxB,IAAMC,wBAAwD,wBAAC,EAAEC,aAAaC,SAAQ,MAAE;AAC7F,QAAM,EACJC,SAASC,mBACTC,OAAOC,uBAAsB,IAC3BC,qBAAqBN,WAAAA;AAEzB,QAAM,EAAEO,gBAAgBC,SAAQ,IAAKC,QAAQ,MAAA;AAC3C,WAAO;MACLF,gBAAgBJ;MAChBK,UAAU;QACRE,eAAe;QACfC,eAAeR;MACjB;IACF;EACF,GAAG;IAACA;GAAkB;AAEtB,QAAMS,QAAQH,QAAQ,MAAA;AACpB,UAAMG,SAA6B;MACjCL;MACAH,OAAOC;MACPG;MACAK,UAAU;IACZ;AACA,WAAOD;EACT,GAAG;IACDL;IACAF;IACAG;GACD;AAED,SACE,gBAAAM,OAAA,cAACC,gBAAAA;IAAeH;KACd,gBAAAE,OAAA,cAACE,cAAAA;IAAYZ,OAAOC;MACnBJ,QAAAA;AAGP,GApCqE;","names":["Stack","Tooltip","Typography","EthAddressWrapper","BlockiesAvatarAddress","React","ConnectedAccount","address","shortenedAddress","EthAddressWrapper","fromString","toShortString","Stack","direction","alignItems","spacing","BlockiesAvatarAddress","size","Tooltip","title","Typography","color","variant","fontFamily","Alert","AlertTitle","Button","Stack","Typography","ButtonEx","isDefined","isUndefined","ErrorRender","React","useEffect","asAddress","assertEx","MainNetwork","useCallback","useState","isDefined","findCaveat","permissions","targetCapability","targetCaveatType","existingPermissions","getPermissions","isDefined","length","foundPermissions","find","p","parentCapability","caveats","caveat","type","value","isUndefined","useEffect","useState","isUndefined","CLIENT_LISTENER_TIMEOUT","hasXyoClient","globalThis","xyo","listenForClientInjection","onClientReady","timeout","onTimeout","resolved","listener","addEventListener","setTimeout","removeEventListener","getXyoClient","isUndefined","client","Promise","resolve","initialState","client","undefined","error","isLoading","timedout","useClientFromWallet","timeout","state","setState","useState","useEffect","cancelled","initialize","prev","getXyoClient","onPluginReady","isUndefined","globalThis","xyo","addEventListener","removeEventListener","useClient","usePermissions","client","isLoading","error","timedout","useClientFromWallet","permissions","usePromise","isArray","isDefined","isDefinedNotNull","isString","validateRestrictedAccounts","restrictedAccounts","isDefined","isArray","every","isString","Error","JSON","stringify","useAccountPermissions","permissions","error","usePermissions","usePromise","isDefinedNotNull","findCaveat","isNull","useGatewayFromWallet","gatewayName","timeout","client","isLoading","error","timedout","useClientFromWallet","resolveGateway","isNull","gateways","gateway","undefined","useGateway","useConnectAccount","gatewayName","MainNetwork","id","timeout","connectError","setConnectError","useState","gateway","error","timedout","useGatewayFromWallet","accountPermissions","accountPermissionsError","useAccountPermissions","address","setAddress","connectSigner","useCallback","undefined","assertedGateway","assertEx","signer","e","asAddress","DefaultConnectComponent","props","React","ButtonEx","variant","size","DefaultNoWalletInstalledComponent","Alert","severity","AlertTitle","Typography","gutterBottom","Button","sx","display","justifySelf","href","target","rel","ConnectAccountsStack","AccountComponent","ConnectedAccount","ConnectComponent","NoWalletInstalledComponent","onAccountConnected","onCancel","timeout","address","connectSigner","error","timedout","useConnectAccount","undefined","useEffect","isDefined","Stack","direction","alignItems","spacing","isUndefined","onClick","ErrorRender","scope","createContextEx","GatewayContext","useContextEx","useProvidedGateway","required","useContextEx","GatewayContext","ErrorRender","React","useMemo","WalletGatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","defaultGateway","gateways","useMemo","inPageGateway","walletGateway","value","provided","React","GatewayContext","ErrorRender"]}
1
+ {"version":3,"sources":["../../src/components/connected/account/Connected.tsx","../../src/components/connected/ConnectAccountsStack.tsx","../../src/components/connected/hooks/useConnectAccount.ts","../../src/hooks/client/helpers/findCaveat.ts","../../src/hooks/client/useClientFromWallet.ts","../../src/hooks/helpers/getXyoClient.ts","../../src/hooks/client/permissions/usePermissions.ts","../../src/hooks/client/permissions/usePermissionsAccounts.ts","../../src/hooks/client/useGatewayFromWallet.ts","../../src/context/GatewayContext.ts","../../src/context/useProvidedGateway.ts","../../src/context/WalletGatewayProvider.tsx"],"sourcesContent":["import {\n Stack, Tooltip, Typography,\n} from '@mui/material'\nimport { EthAddressWrapper } from '@xylabs/sdk-js'\nimport { BlockiesAvatarAddress } from '@xyo-network/react-chain-blockies'\nimport React from 'react'\n\nexport const ConnectedAccount: React.FC<{ address: string }> = ({ address }) => {\n const shortenedAddress = `${EthAddressWrapper.fromString(address)?.toShortString(4)}`\n\n return (\n <Stack direction=\"row\" alignItems=\"center\" spacing={1}>\n <BlockiesAvatarAddress address={address} size={21} />\n <Tooltip title={address}>\n <Typography color=\"textSecondary\" variant=\"caption\" fontFamily=\"monospace\">{shortenedAddress}</Typography>\n </Tooltip>\n </Stack>\n )\n}\n","import type { StackProps } from '@mui/material'\nimport {\n Alert, AlertTitle, Button, Stack,\n Typography,\n} from '@mui/material'\nimport type { ButtonExProps } from '@xylabs/react-button'\nimport { ButtonEx } from '@xylabs/react-button'\nimport { ErrorRender } from '@xylabs/react-error'\nimport type { Address } from '@xylabs/sdk-js'\nimport { isDefined, isUndefined } from '@xylabs/sdk-js'\nimport type { ComponentType, MouseEventHandler } from 'react'\nimport React, { useEffect } from 'react'\n\nimport { ConnectedAccount } from './account/index.ts'\nimport { useConnectAccount } from './hooks/index.ts'\n\nconst DefaultConnectComponent: React.FC<ButtonExProps> = props => (\n <ButtonEx variant=\"contained\" size=\"small\" {...props} />\n)\n\nconst DefaultNoWalletInstalledComponent: React.FC = () => (\n <Alert severity=\"warning\">\n <AlertTitle>XL1 Wallet Not Found</AlertTitle>\n <Typography gutterBottom>\n Please ensure that your XL1 Wallet is installed to connect your account.\n </Typography>\n <Button\n sx={{ display: 'flex', justifySelf: 'end' }}\n size=\"small\"\n variant=\"outlined\"\n href=\"https://chromewebstore.google.com/detail/xl1-wallet/fblbagcjeigmhakkfgjpdlcapcgmcfbm\"\n target=\"_blank\"\n rel=\"noopener\"\n >\n Get XL1 Wallet\n </Button>\n </Alert>\n)\n\nexport interface ConnectClientAccountsStackProps extends StackProps {\n AccountComponent?: ComponentType<{ account?: string }>\n ConnectComponent?: ComponentType<{ onClick?: MouseEventHandler<HTMLElement> }>\n NoWalletInstalledComponent?: ComponentType\n onAccountConnected?: (account: Address) => void\n onCancel?: () => void\n timeout?: number\n}\n\n/**\n * Renders a horizontal stack that surfaces the current state of the user's\n * connection to an XL1 wallet (e.g. the XL1 Chrome extension) and lets them\n * kick off a connection.\n *\n * Connection state is derived from `useConnectAccount`, which wraps\n * `useGatewayFromWallet` (wallet/gateway discovery with a configurable\n * `timeout`) and `useAccountPermissions` (already-authorized addresses).\n * The hook returns: `address` (resolved once the wallet exposes one),\n * `connectSigner` (prompts the wallet for an address), `timedout` (the\n * gateway never appeared within `timeout`), and `error` (the first of\n * gateway, permissions, or signer-connect failures).\n *\n * The component renders exactly one of the following wallet states, plus\n * an always-present error slot:\n *\n * - **Connected** — `address` is defined: renders `AccountComponent` for\n * that address. Also fires `onAccountConnected(address)` once via effect.\n * - **Disconnected, wallet available** — no `address` and not `timedout`:\n * renders `ConnectComponent` as a \"Connect\" button that invokes\n * `connectSigner()`. This covers both \"wallet installed but no account\n * authorized yet\" and \"gateway still resolving\".\n * - **Wallet missing / unreachable** — no `address` and `timedout` is true:\n * renders `NoWalletInstalledComponent` (defaults to an Alert linking to\n * the XL1 Wallet Chrome Web Store listing).\n * - **Error** — any error from the hook is rendered via `ErrorRender`\n * alongside the state above, and `onCancel()` is fired once via effect\n * so the host UI can close/abort its connect flow.\n *\n * All three slot components (`AccountComponent`, `ConnectComponent`,\n * `NoWalletInstalledComponent`) are injectable so consumers can restyle\n * any state without forking this component.\n */\nexport const ConnectAccountsStack: React.FC<ConnectClientAccountsStackProps> = ({\n AccountComponent = ConnectedAccount,\n ConnectComponent = DefaultConnectComponent,\n NoWalletInstalledComponent = DefaultNoWalletInstalledComponent,\n onAccountConnected,\n onCancel,\n timeout,\n ...props\n}) => {\n const {\n address, connectSigner, error, timedout,\n } = useConnectAccount(undefined, timeout)\n\n useEffect(() => {\n if (isDefined(error) && isDefined(onCancel)) {\n onCancel()\n }\n }, [error, onCancel])\n\n useEffect(() => {\n if (isDefined(address) && isDefined(onAccountConnected)) {\n onAccountConnected(address)\n }\n }, [address, onAccountConnected])\n\n return (\n <Stack direction=\"row\" alignItems=\"start\" spacing={2} {...props}>\n {isDefined(address)\n ? <AccountComponent address={address} />\n : null}\n {isUndefined(address) && !timedout\n ? (\n <ConnectComponent onClick={() => void connectSigner()}>Connect</ConnectComponent>\n )\n : null}\n {isUndefined(address) && timedout\n ? (\n <NoWalletInstalledComponent />\n )\n : null}\n <ErrorRender error={error} scope=\"ConnectSigner:error\" />\n </Stack>\n )\n}\n","import { type Address, asAddress } from '@xylabs/sdk-js'\nimport { assertEx } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\nimport { MainNetwork } from '@xyo-network/xl1-sdk'\nimport { useCallback, useState } from 'react'\n\nimport { useAccountPermissions, useGatewayFromWallet } from '../../../hooks/index.ts'\n\nexport const useConnectAccount = (gatewayName: GatewayName = MainNetwork.id, timeout?: number) => {\n const [connectError, setConnectError] = useState<Error>()\n\n const {\n gateway, error, timedout,\n } = useGatewayFromWallet(gatewayName, timeout)\n\n const [accountPermissions, accountPermissionsError] = useAccountPermissions()\n\n const [address, setAddress] = useState<Address>()\n\n const connectSigner = useCallback(async () => {\n try {\n setConnectError(undefined)\n const assertedGateway = assertEx(gateway, () => `Gateway ${gatewayName} is not available`)\n const signer = assertedGateway.signer\n const address = await signer.address()\n setAddress(address)\n return address\n } catch (e) {\n setConnectError(e as Error)\n }\n }, [gateway, gatewayName])\n\n return {\n address: asAddress(accountPermissions?.[0] ?? address), connectSigner, error: error ?? accountPermissionsError ?? connectError, gateway, timedout,\n }\n}\n","import { isDefined } from '@xylabs/sdk-js'\nimport type {\n CaveatTypes, ParentCapability, XyoPermissions,\n} from '@xyo-network/xl1-sdk'\n\nexport const findCaveat = async (\n permissions: XyoPermissions,\n targetCapability: ParentCapability,\n targetCaveatType: CaveatTypes,\n) => {\n const existingPermissions = await permissions.getPermissions()\n if (isDefined(existingPermissions) && existingPermissions.length > 0) {\n const foundPermissions = existingPermissions\n .find(p => p.parentCapability === targetCapability)\n if (isDefined(foundPermissions)) {\n return foundPermissions.caveats?.find(caveat => caveat.type === targetCaveatType)?.value ?? []\n }\n }\n return existingPermissions\n}\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\nimport { useEffect, useState } from 'react'\n\nimport { getXyoClient } from '../helpers/index.ts'\n\ninterface ClientState {\n client?: XyoClient | null\n error: Error | null\n isLoading: boolean\n timedout: boolean\n}\n\nconst initialState: ClientState = {\n client: undefined,\n error: null,\n isLoading: false,\n timedout: false,\n}\n\nexport const useClientFromWallet = (timeout?: number): ClientState => {\n const [state, setState] = useState<ClientState>(initialState)\n\n useEffect(() => {\n let cancelled = false\n\n const initialize = async () => {\n setState((prev) => {\n if (prev.isLoading) return prev\n return {\n ...prev, isLoading: true, error: null,\n }\n })\n\n try {\n const client = await getXyoClient(timeout)\n if (cancelled) return\n if (client === null) {\n setState({\n client: null, timedout: true, isLoading: false, error: null,\n })\n } else {\n setState({\n client, isLoading: false, error: null, timedout: false,\n })\n }\n } catch (error) {\n if (cancelled) return\n setState({\n client: undefined, isLoading: false, error: error as Error, timedout: false,\n })\n }\n }\n\n void initialize()\n\n // Late recovery: if wallet loads after timeout, update state\n const onPluginReady = () => {\n if (cancelled) return\n const client = isUndefined(globalThis.xyo) ? null : globalThis.xyo?.client ?? null\n setState({\n client, isLoading: false, timedout: false, error: null,\n })\n }\n globalThis.addEventListener('xyo:plugin-ready', onPluginReady)\n\n return () => {\n cancelled = true\n globalThis.removeEventListener('xyo:plugin-ready', onPluginReady)\n }\n }, [timeout])\n\n return state\n}\n\n/** @deprecated - use useClientFromWallet instead */\nexport const useClient = useClientFromWallet\n","import { isUndefined } from '@xylabs/sdk-js'\nimport type { XyoClient } from '@xyo-network/xl1-sdk'\n\nconst CLIENT_LISTENER_TIMEOUT = 2000\n\nconst hasXyoClient = () => {\n return 'client' in globalThis.xyo\n}\n\nexport const listenForClientInjection = (onClientReady: () => void, timeout: number, onTimeout: () => void) => {\n let resolved = false\n const listener: EventListener = () => {\n onClientReady()\n resolved = true\n }\n globalThis.addEventListener('xyo:plugin-ready', listener)\n setTimeout(() => {\n if (!resolved) {\n globalThis.removeEventListener('xyo:plugin-ready', listener)\n onTimeout()\n }\n }, timeout)\n}\n\ntype ReturnType = XyoClient | undefined | null\n\nexport async function getXyoClient(timeout = CLIENT_LISTENER_TIMEOUT): Promise<ReturnType> {\n // if no xyo object, we can bail early\n if (isUndefined(globalThis.xyo)) {\n return null\n }\n return hasXyoClient()\n ? globalThis.xyo.client\n // listen for the XyoWallet to be injected\n : await new Promise<ReturnType>((resolve) => {\n listenForClientInjection(\n () => {\n resolve(globalThis.xyo.client)\n },\n timeout,\n () => {\n resolve(null)\n },\n )\n })\n}\n","import { useClientFromWallet } from '../useClientFromWallet.ts'\n\nexport const usePermissions = () => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet()\n const permissions = client?.permissions\n return {\n permissions,\n isLoading,\n error,\n timedout,\n }\n}\n","import { usePromise } from '@xylabs/react-promise'\nimport type { JsonValue } from '@xylabs/sdk-js'\nimport {\n isArray, isDefined, isDefinedNotNull, isString,\n} from '@xylabs/sdk-js'\n\nimport { findCaveat } from '../helpers/index.ts'\nimport { usePermissions } from './usePermissions.ts'\n\nconst validateRestrictedAccounts = (restrictedAccounts: JsonValue): readonly string [] => {\n if (isDefined(restrictedAccounts)) {\n if (isArray(restrictedAccounts) && restrictedAccounts.every(isString)) {\n return restrictedAccounts\n }\n throw new Error(\n `Unrecognized format for restrictReturnedAccounts caveat found on permissions. \\n\n Should be an array of strings: ${JSON.stringify(restrictedAccounts)}`,\n )\n }\n return []\n}\n\nexport const useAccountPermissions = () => {\n const { permissions, error } = usePermissions()\n\n return usePromise(async () => {\n if (isDefinedNotNull(error)) throw error\n if (isDefined(permissions)) {\n const restrictedAccounts = await findCaveat(\n permissions,\n // TODO - extract to constant in protocol package\n 'xyoWallet_getAccounts',\n 'restrictReturnedAccounts',\n )\n return validateRestrictedAccounts(restrictedAccounts)\n }\n }, [permissions])\n}\n","import { isNull } from '@xylabs/sdk-js'\nimport type { GatewayName } from '@xyo-network/xl1-sdk'\n\nimport type { GatewayFromWallet } from '../../types/index.ts'\nimport { useClientFromWallet } from './useClientFromWallet.ts'\n\n/**\n * Resolves a gateway from the injected XL1 Wallet extension.\n *\n * The returned `gateway` uses a three-state contract:\n * - `undefined` — wallet detection is still in progress (isLoading=true),\n * or no gatewayName was provided. Consumers should treat this as \"not yet known\"\n * and avoid committing to either a present or absent UI state.\n * - `null` — wallet is definitively absent. Either globalThis.xyo was never set,\n * or detection timed out. Safe to show fallback UI (e.g. \"Get XL1 Wallet\").\n * A late-recovery listener may still transition this to a real gateway if\n * the extension loads after the timeout.\n * - `XyoGatewayRunner` — wallet is present and exposes this gateway for the\n * requested network. Ready to use for transactions and queries.\n */\nexport const useGatewayFromWallet = (gatewayName?: GatewayName, timeout?: number): GatewayFromWallet => {\n const {\n client, isLoading, error, timedout,\n } = useClientFromWallet(timeout)\n\n const resolveGateway = () => {\n // null client = wallet confirmed absent (no globalThis.xyo or timed out)\n if (isNull(client)) return null\n // client is undefined (still loading) or defined (wallet present) —\n // optional chain returns undefined while loading, or the gateway if available\n return client?.gateways?.[gatewayName!]\n }\n\n return {\n // no gatewayName requested = undefined (opt-out, not \"absent\")\n gateway: gatewayName ? resolveGateway() : undefined,\n isLoading,\n error,\n timedout,\n }\n}\n\n/** @deprecated - useGatewayFromWallet */\nexport const useGateway = useGatewayFromWallet\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\nexport const GatewayContext = createContextEx<GatewayContextState>()\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\n\nexport const useProvidedGateway = (required = true) => useContextEx(GatewayContext, 'Gateway', required)\n","import { ErrorRender } from '@xylabs/react-error'\nimport React, { useMemo } from 'react'\n\nimport { useGatewayFromWallet } from '../hooks/index.ts'\nimport { GatewayContext } from './GatewayContext.ts'\nimport type { GatewayProviderProps } from './GatewayProviderProps.ts'\nimport type { GatewayContextState } from './GatewayProviderState.ts'\n\n/**\n * Publishes a `GatewayContext` backed exclusively by the injected XL1 Wallet\n * extension (i.e. `globalThis.xyo`). This is the provider to use when the\n * host app is a browser UI that expects the user to bring their own wallet,\n * rather than running an in-page gateway.\n *\n * The requested `gatewayName` is forwarded to `useGatewayFromWallet`, whose\n * returned gateway uses a three-state contract (`undefined` = still\n * resolving, `null` = wallet confirmed absent / timed out,\n * `XyoGatewayRunner` = ready). That tri-state is passed through to\n * consumers unchanged as `defaultGateway` / `gateways.walletGateway`, so\n * downstream hooks can distinguish \"loading\" from \"missing\".\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` — the wallet gateway, used when consumers don't\n * specify which gateway they want.\n * - `gateways.walletGateway` — same instance as `defaultGateway`.\n * - `gateways.inPageGateway` — always `null` here; this provider does not\n * stand up an in-page client. Pair with a different provider if you need\n * both.\n * - `error` — surfaced from `useGatewayFromWallet` (detection / timeout /\n * wallet errors). Also rendered inline via `ErrorRender` above `children`\n * so mount-time failures are visible even if no consumer reads `error`.\n * - `provided: true` — lets descendants detect that a real provider (not\n * the default empty context) is in the tree.\n *\n * The `defaultGateway`, `gateways`, and context `value` are memoized so\n * consumers only re-render when the underlying wallet gateway reference or\n * error actually changes.\n */\nexport const WalletGatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const { defaultGateway, gateways } = useMemo(() => {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: null,\n walletGateway: gatewayFromWallet,\n },\n }\n }, [gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError,\n gateways,\n provided: true,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gateways,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromWalletError} />\n {children}\n </GatewayContext>\n )\n}\n"],"mappings":";;;;AAAA,SACEA,OAAOC,SAASC,kBACX;AACP,SAASC,yBAAyB;AAClC,SAASC,6BAA6B;AACtC,OAAOC,WAAW;AAEX,IAAMC,mBAAkD,wBAAC,EAAEC,QAAO,MAAE;AACzE,QAAMC,mBAAmB,GAAGC,kBAAkBC,WAAWH,OAAAA,GAAUI,cAAc,CAAA,CAAA;AAEjF,SACE,sBAAA,cAACC,OAAAA;IAAMC,WAAU;IAAMC,YAAW;IAASC,SAAS;KAClD,sBAAA,cAACC,uBAAAA;IAAsBT;IAAkBU,MAAM;MAC/C,sBAAA,cAACC,SAAAA;IAAQC,OAAOZ;KACd,sBAAA,cAACa,YAAAA;IAAWC,OAAM;IAAgBC,SAAQ;IAAUC,YAAW;KAAaf,gBAAAA,CAAAA,CAAAA;AAIpF,GAX+D;;;ACN/D,SACEgB,OAAOC,YAAYC,QAAQC,SAAAA,QAC3BC,cAAAA,mBACK;AAEP,SAASC,gBAAgB;AACzB,SAASC,mBAAmB;AAE5B,SAASC,aAAAA,YAAWC,eAAAA,oBAAmB;AAEvC,OAAOC,UAASC,aAAAA,kBAAiB;;;ACXjC,SAAuBC,iBAAiB;AACxC,SAASC,gBAAgB;AAEzB,SAASC,mBAAmB;AAC5B,SAASC,aAAaC,YAAAA,iBAAgB;;;ACJtC,SAASC,iBAAiB;AAKnB,IAAMC,aAAa,8BACxBC,aACAC,kBACAC,qBAAAA;AAEA,QAAMC,sBAAsB,MAAMH,YAAYI,eAAc;AAC5D,MAAIC,UAAUF,mBAAAA,KAAwBA,oBAAoBG,SAAS,GAAG;AACpE,UAAMC,mBAAmBJ,oBACtBK,KAAKC,CAAAA,MAAKA,EAAEC,qBAAqBT,gBAAAA;AACpC,QAAII,UAAUE,gBAAAA,GAAmB;AAC/B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ACC,gBAAAA;IAAeH;KACd,gBAAAE,OAAA,cAACE,cAAAA;IAAYZ,OAAOC;MACnBJ,QAAAA;AAGP,GApCqE;","names":["Stack","Tooltip","Typography","EthAddressWrapper","BlockiesAvatarAddress","React","ConnectedAccount","address","shortenedAddress","EthAddressWrapper","fromString","toShortString","Stack","direction","alignItems","spacing","BlockiesAvatarAddress","size","Tooltip","title","Typography","color","variant","fontFamily","Alert","AlertTitle","Button","Stack","Typography","ButtonEx","ErrorRender","isDefined","isUndefined","React","useEffect","asAddress","assertEx","MainNetwork","useCallback","useState","isDefined","findCaveat","permissions","targetCapability","targetCaveatType","existingPermissions","getPermissions","isDefined","length","foundPermissions","find","p","parentCapability","caveats","caveat","type","value","isUndefined","useEffect","useState","isUndefined","CLIENT_LISTENER_TIMEOUT","hasXyoClient","globalThis","xyo","listenForClientInjection","onClientReady","timeout","onTimeout","resolved","listener","addEventListener","setTimeout","removeEventListener","getXyoClient","isUndefined","client","Promise","resolve","initialState","client","undefined","error","isLoading","timedout","useClientFromWallet","timeout","state","setState","useState","useEffect","cancelled","initialize","prev","getXyoClient","onPluginReady","isUndefined","globalThis","xyo","addEventListener","removeEventListener","useClient","usePermissions","client","isLoading","error","timedout","useClientFromWallet","permissions","usePromise","isArray","isDefined","isDefinedNotNull","isString","validateRestrictedAccounts","restrictedAccounts","isDefined","isArray","every","isString","Error","JSON","stringify","useAccountPermissions","permissions","error","usePermissions","usePromise","isDefinedNotNull","findCaveat","isNull","useGatewayFromWallet","gatewayName","timeout","client","isLoading","error","timedout","useClientFromWallet","resolveGateway","isNull","gateways","gateway","undefined","useGateway","useConnectAccount","gatewayName","MainNetwork","id","timeout","connectError","setConnectError","useState","gateway","error","timedout","useGatewayFromWallet","accountPermissions","accountPermissionsError","useAccountPermissions","address","setAddress","connectSigner","useCallback","undefined","assertedGateway","assertEx","signer","e","asAddress","DefaultConnectComponent","props","React","ButtonEx","variant","size","DefaultNoWalletInstalledComponent","Alert","severity","AlertTitle","Typography","gutterBottom","Button","sx","display","justifySelf","href","target","rel","ConnectAccountsStack","AccountComponent","ConnectedAccount","ConnectComponent","NoWalletInstalledComponent","onAccountConnected","onCancel","timeout","address","connectSigner","error","timedout","useConnectAccount","undefined","useEffect","isDefined","Stack","direction","alignItems","spacing","isUndefined","onClick","ErrorRender","scope","createContextEx","GatewayContext","useContextEx","useProvidedGateway","required","useContextEx","GatewayContext","ErrorRender","React","useMemo","WalletGatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","defaultGateway","gateways","useMemo","inPageGateway","walletGateway","value","provided","React","GatewayContext","ErrorRender"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/react-chain-client",
3
- "version": "1.20.22",
3
+ "version": "1.20.24",
4
4
  "description": "XYO Layer One React SDK - Client/Wallet Hooks",
5
5
  "homepage": "https://xylabs.com",
6
6
  "bugs": {
@@ -38,23 +38,32 @@
38
38
  "README.md"
39
39
  ],
40
40
  "dependencies": {
41
- "@xyo-network/xl1-sdk": "^1.26.35",
42
- "@xyo-network/react-chain-blockies": "~1.20.22"
41
+ "@xylabs/react-button": "~7.1.20",
42
+ "@xylabs/react-error": "~7.1.20",
43
+ "@xylabs/react-shared": "~7.1.20",
44
+ "@xyo-network/xl1-sdk": "^1.26.36",
45
+ "@xyo-network/react-chain-blockies": "~1.20.24"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@emotion/react": "^11.5.0",
46
49
  "@emotion/styled": "^11.3.0",
47
- "@mui/material": "^7.3.9",
50
+ "@metamask/providers": "^22",
48
51
  "@opentelemetry/api": "^1",
49
52
  "@storybook/react-vite": "~10.3.5",
53
+ "@testing-library/dom": ">=7.21.4",
50
54
  "@types/node": "^25.6.0",
51
55
  "@types/react": "~19.2.14",
56
+ "@xylabs/geo": "^5",
57
+ "@xylabs/react-async-effect": "~7.1.20",
58
+ "@xylabs/react-dialogs": "~7.1.20",
52
59
  "@xylabs/react-promise": "~7.1.20",
60
+ "@xylabs/react-quick-tip-button": "~7.1.20",
53
61
  "@xylabs/sdk-js": "~5.0.97",
54
62
  "@xylabs/toolchain": "~7.10.8",
55
63
  "@xylabs/tsconfig": "~7.10.8",
56
64
  "@xylabs/tsconfig-dom": "~7.10.8",
57
65
  "@xylabs/tsconfig-react": "~7.10.8",
66
+ "@xylabs/zod": "~5.0.95",
58
67
  "@xyo-network/account": "~5.3.30",
59
68
  "@xyo-network/account-model": "~5.3.30",
60
69
  "@xyo-network/api-models": "~5.3.30",
@@ -105,24 +114,39 @@
105
114
  "@xyo-network/wasm": "~5.3.30",
106
115
  "@xyo-network/witness-adhoc": "~5.3.30",
107
116
  "@xyo-network/witness-model": "~5.3.30",
117
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0",
108
118
  "ajv": "^8",
109
- "axios": "^1.15.1",
119
+ "axios": "^1.15.2",
120
+ "cosmiconfig": ">=9",
110
121
  "esbuild": "*",
122
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0",
111
123
  "ethers": "^6.16.0",
124
+ "firebase": "^12",
125
+ "lru-cache": "^11",
126
+ "mapbox-gl": "^3",
112
127
  "pako": "~2.1.0",
113
128
  "react": "~19.2.5",
114
129
  "react-dom": "^19.2.5",
130
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
131
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0",
115
132
  "storybook": "~10.3.5",
116
133
  "typescript": "~5.9.3",
117
134
  "vite": "^8.0.9",
135
+ "webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0",
118
136
  "zod": "~4.3.6",
119
- "@xyo-network/react-chain-model": "~1.20.22",
120
- "@xyo-network/react-chain-shared": "~1.20.22"
137
+ "@xyo-network/react-chain-model": "~1.20.24",
138
+ "@xyo-network/react-chain-shared": "~1.20.24"
121
139
  },
122
140
  "peerDependencies": {
123
- "@xylabs/react-promise": "~7.1.20",
124
- "@xylabs/sdk-js": "~5.0.97",
125
- "react": "~19.2.4"
141
+ "@mui/material": ">=6 <8",
142
+ "@xylabs/react-async-effect": "^7.1.20",
143
+ "@xylabs/react-promise": "^7.1.20",
144
+ "@xylabs/react-quick-tip-button": "^7.1.20",
145
+ "@xylabs/sdk-js": "^5.0.97",
146
+ "@xylabs/zod": "^5.0.95",
147
+ "react": "^19.2.4",
148
+ "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
149
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
126
150
  },
127
151
  "engines": {
128
152
  "node": ">=24"