@xyo-network/react-chain-client 1.20.25 → 1.20.26
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/dist/browser/context/in-page/Provider.d.ts +60 -0
- package/dist/browser/context/in-page/Provider.d.ts.map +1 -0
- package/dist/browser/context/in-page/index.d.ts +1 -0
- package/dist/browser/context/in-page/index.d.ts.map +1 -1
- package/dist/browser/context/in-page/lib/buildGateway.d.ts +3 -0
- package/dist/browser/context/in-page/lib/buildGateway.d.ts.map +1 -0
- package/dist/browser/context/in-page/lib/index.d.ts +2 -0
- package/dist/browser/context/in-page/lib/index.d.ts.map +1 -0
- package/dist/browser/index.mjs +96 -10
- package/dist/browser/index.mjs.map +1 -1
- package/package.json +4 -4
- package/dist/browser/context/providers/story/mockInPageGatewaysDecorator.d.ts +0 -10
- package/dist/browser/context/providers/story/mockInPageGatewaysDecorator.d.ts.map +0 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { RpcTransport, XyoSignerRpcSchemas } from '@xyo-network/xl1-sdk';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
export interface InPageGatewaysProviderProps extends PropsWithChildren {
|
|
5
|
+
signerTransport?: RpcTransport<XyoSignerRpcSchemas>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Publishes a keyed map of in-page gateways — one per network in
|
|
9
|
+
* `DefaultNetworks` — under the narrow `InPageGatewaysContext`.
|
|
10
|
+
*
|
|
11
|
+
* This provider is deliberately *not* a direct publisher of the shared
|
|
12
|
+
* `GatewayContext` that `useProvidedGateway` reads. Its consumer is the
|
|
13
|
+
* wrapping `GatewayProvider` in this same package, which picks the
|
|
14
|
+
* `gatewayName` the consumer asked for out of this map, adapts it into
|
|
15
|
+
* the single-gateway `GatewayContextState` shape, and then publishes *that*
|
|
16
|
+
* to the shared context. Splitting the work this way lets one
|
|
17
|
+
* `InPageGatewaysProvider` near the root build every network's gateway
|
|
18
|
+
* once, while many `GatewayProvider` instances deeper in the tree each
|
|
19
|
+
* expose whichever gateway their subtree cares about.
|
|
20
|
+
*
|
|
21
|
+
* Unlike `WalletGatewayProvider`, gateways here are constructed directly
|
|
22
|
+
* in the page (via `buildGateway`) against each network's RPC endpoint
|
|
23
|
+
* — no browser wallet extension is required. `signerTransport` switches
|
|
24
|
+
* between viewer (read-only) and runner (can sign/send) locators; supply
|
|
25
|
+
* it only when the app needs to sign.
|
|
26
|
+
*
|
|
27
|
+
* Behavior:
|
|
28
|
+
* - On mount, and whenever `signerTransport` changes, `buildGateway` is
|
|
29
|
+
* called in parallel for every network in `DefaultNetworks` via
|
|
30
|
+
* `Promise.allSettled`. Networks that resolve populate `gateways[id]`;
|
|
31
|
+
* networks that reject populate `errors[id]`. One failed network does
|
|
32
|
+
* not block the others.
|
|
33
|
+
* - If `signerTransport` is provided, gateways are built with a remote
|
|
34
|
+
* *runner* locator, otherwise with a remote *viewer* locator.
|
|
35
|
+
* - When `signerTransport` changes identity mid-life, the provider clears
|
|
36
|
+
* all cached gateways and errors synchronously during render (via
|
|
37
|
+
* `previousSignerTransport` state) so consumers never see gateways
|
|
38
|
+
* bound to the previous transport, then rebuilds in the effect.
|
|
39
|
+
* - State updates from the rebuild are wrapped in `startTransition` so a
|
|
40
|
+
* slow network doesn't stall higher-priority UI updates.
|
|
41
|
+
* - A `cancelled` flag in the effect's cleanup discards results from a
|
|
42
|
+
* prior `signerTransport` once a new one is in flight.
|
|
43
|
+
*
|
|
44
|
+
* Published `InPageGatewaysState` (narrower than `GatewayContextState` —
|
|
45
|
+
* this is an internal handoff shape, not the cross-publisher surface):
|
|
46
|
+
* - `gateways` — `Partial<Record<GatewayName, ContextGatewayType>>`. Keys
|
|
47
|
+
* are only present for networks that built successfully.
|
|
48
|
+
* - `errors` — `Partial<Record<GatewayName, Error>>`. Per-network build
|
|
49
|
+
* failures, keyed by `GatewayName`.
|
|
50
|
+
* - `clearAll()` — manually empties both maps. Also invoked internally on
|
|
51
|
+
* transport changes. Forwarded by `GatewayProvider` to consumers as
|
|
52
|
+
* `resetGatewaysFromConfig`.
|
|
53
|
+
* - `provided: true` — lets descendants detect a real provider.
|
|
54
|
+
*
|
|
55
|
+
* Note: the commented-out `SimpleXyoClient` at the top is intentionally
|
|
56
|
+
* disabled pending a type unification between `XyoGateway` and
|
|
57
|
+
* `XyoGatewayRunner`.
|
|
58
|
+
*/
|
|
59
|
+
export declare const InPageGatewaysProvider: React.FC<InPageGatewaysProviderProps>;
|
|
60
|
+
//# sourceMappingURL=Provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["../../../../src/context/in-page/Provider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACG,YAAY,EAAE,mBAAmB,EAC/C,MAAM,sBAAsB,CAAA;AAE7B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,KAGN,MAAM,OAAO,CAAA;AAOd,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,eAAe,CAAC,EAAE,YAAY,CAAC,mBAAmB,CAAC,CAAA;CACpD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,eAAO,MAAM,sBAAsB,EAAE,KAAK,CAAC,EAAE,CAAC,2BAA2B,CAmExE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/in-page/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gCAAgC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/context/in-page/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,0BAA0B,CAAA;AACxC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gCAAgC,CAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { GatewayName, RpcTransport, SimpleXyoGateway, XyoSignerRpcSchemas } from '@xyo-network/xl1-sdk';
|
|
2
|
+
export declare const buildGateway: (gatewayName: GatewayName, signerTransport?: RpcTransport<XyoSignerRpcSchemas>) => Promise<import("@xyo-network/xl1-sdk").CreatableProviderInstance<SimpleXyoGateway>>;
|
|
3
|
+
//# sourceMappingURL=buildGateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildGateway.d.ts","sourceRoot":"","sources":["../../../../../src/context/in-page/lib/buildGateway.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EACG,YAAY,EAAE,gBAAgB,EAC5C,mBAAmB,EACpB,MAAM,sBAAsB,CAAA;AAO7B,eAAO,MAAM,YAAY,GAAU,aAAa,WAAW,EAAE,kBAAkB,YAAY,CAAC,mBAAmB,CAAC,wFAkB/G,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/context/in-page/lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/browser/index.mjs
CHANGED
|
@@ -313,6 +313,91 @@ var GatewayContext = createContextEx();
|
|
|
313
313
|
import { createContextEx as createContextEx2 } from "@xylabs/react-shared";
|
|
314
314
|
var InPageGatewaysContext = createContextEx2();
|
|
315
315
|
|
|
316
|
+
// src/context/in-page/Provider.tsx
|
|
317
|
+
import { DefaultNetworks as DefaultNetworks2 } from "@xyo-network/xl1-sdk";
|
|
318
|
+
import React3, { startTransition, useCallback as useCallback2, useEffect as useEffect3, useMemo, useState as useState3 } from "react";
|
|
319
|
+
|
|
320
|
+
// src/context/in-page/lib/buildGateway.ts
|
|
321
|
+
import { assertEx as assertEx2, isDefined as isDefined4 } from "@xylabs/sdk-js";
|
|
322
|
+
import { basicRemoteRunnerLocator, basicRemoteViewerLocator, DefaultNetworks, NetworkDataLakeUrls, XyoGatewayMoniker } from "@xyo-network/xl1-sdk";
|
|
323
|
+
var buildGateway = /* @__PURE__ */ __name(async (gatewayName, signerTransport) => {
|
|
324
|
+
const network = DefaultNetworks.find((network2) => network2.id === gatewayName);
|
|
325
|
+
const resolvedNetwork = assertEx2(network, () => `No network found for id ${gatewayName}`);
|
|
326
|
+
const remoteConfig = {
|
|
327
|
+
rpc: {
|
|
328
|
+
protocol: "http",
|
|
329
|
+
url: `${resolvedNetwork.url}/rpc`
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName];
|
|
333
|
+
const locator = isDefined4(signerTransport) ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint) : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint);
|
|
334
|
+
return await locator.getInstance(XyoGatewayMoniker);
|
|
335
|
+
}, "buildGateway");
|
|
336
|
+
|
|
337
|
+
// src/context/in-page/Provider.tsx
|
|
338
|
+
var InPageGatewaysProvider = /* @__PURE__ */ __name(({ signerTransport, children }) => {
|
|
339
|
+
const [gateways, setGateways] = useState3({});
|
|
340
|
+
const [errors, setErrors] = useState3({});
|
|
341
|
+
const [previousSignerTransport, setPreviousSignerTransport] = useState3(signerTransport);
|
|
342
|
+
const clearAll = useCallback2(() => {
|
|
343
|
+
setGateways({});
|
|
344
|
+
setErrors({});
|
|
345
|
+
}, []);
|
|
346
|
+
if (previousSignerTransport !== signerTransport) {
|
|
347
|
+
clearAll();
|
|
348
|
+
setPreviousSignerTransport(signerTransport);
|
|
349
|
+
}
|
|
350
|
+
useEffect3(() => {
|
|
351
|
+
let cancelled = false;
|
|
352
|
+
const buildAll = /* @__PURE__ */ __name(async () => {
|
|
353
|
+
const results = await Promise.allSettled(DefaultNetworks2.map(async (network) => {
|
|
354
|
+
const gateway = await buildGateway(network.id, signerTransport);
|
|
355
|
+
return {
|
|
356
|
+
id: network.id,
|
|
357
|
+
gateway
|
|
358
|
+
};
|
|
359
|
+
}));
|
|
360
|
+
if (cancelled) return;
|
|
361
|
+
const nextGateways = {};
|
|
362
|
+
const nextErrors = {};
|
|
363
|
+
for (const [index, result] of results.entries()) {
|
|
364
|
+
const networkId = DefaultNetworks2[index].id;
|
|
365
|
+
if (result.status === "fulfilled") {
|
|
366
|
+
nextGateways[networkId] = result.value.gateway;
|
|
367
|
+
} else {
|
|
368
|
+
nextErrors[networkId] = result.reason instanceof Error ? result.reason : new Error(String(result.reason));
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
startTransition(() => {
|
|
372
|
+
setGateways(nextGateways);
|
|
373
|
+
setErrors(nextErrors);
|
|
374
|
+
});
|
|
375
|
+
}, "buildAll");
|
|
376
|
+
void buildAll();
|
|
377
|
+
return () => {
|
|
378
|
+
cancelled = true;
|
|
379
|
+
};
|
|
380
|
+
}, [
|
|
381
|
+
signerTransport
|
|
382
|
+
]);
|
|
383
|
+
const value = useMemo(() => {
|
|
384
|
+
const value2 = {
|
|
385
|
+
clearAll,
|
|
386
|
+
errors,
|
|
387
|
+
gateways,
|
|
388
|
+
provided: true
|
|
389
|
+
};
|
|
390
|
+
return value2;
|
|
391
|
+
}, [
|
|
392
|
+
clearAll,
|
|
393
|
+
errors,
|
|
394
|
+
gateways
|
|
395
|
+
]);
|
|
396
|
+
return /* @__PURE__ */ React3.createElement(InPageGatewaysContext, {
|
|
397
|
+
value
|
|
398
|
+
}, children);
|
|
399
|
+
}, "InPageGatewaysProvider");
|
|
400
|
+
|
|
316
401
|
// src/context/in-page/useProvidedInPageGateways.ts
|
|
317
402
|
import { useContextEx } from "@xylabs/react-shared";
|
|
318
403
|
var useProvidedInPageGateways = /* @__PURE__ */ __name((required = true) => useContextEx(InPageGatewaysContext, "InPageGateways", required), "useProvidedInPageGateways");
|
|
@@ -320,13 +405,13 @@ var useProvidedInPageGateways = /* @__PURE__ */ __name((required = true) => useC
|
|
|
320
405
|
// src/context/providers/GatewayProvider.tsx
|
|
321
406
|
import { ErrorRender as ErrorRender2 } from "@xylabs/react-error";
|
|
322
407
|
import { isDefinedNotNull as isDefinedNotNull2, isNull as isNull2 } from "@xylabs/sdk-js";
|
|
323
|
-
import
|
|
408
|
+
import React4, { useMemo as useMemo2 } from "react";
|
|
324
409
|
var GatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
325
410
|
const { gateway: gatewayFromWallet, error: gatewayFromWalletError } = useGatewayFromWallet(gatewayName);
|
|
326
411
|
const { gateways: allGateways, errors: allGatewayErrors, clearAll } = useProvidedInPageGateways(true);
|
|
327
412
|
const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : void 0;
|
|
328
413
|
const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : void 0;
|
|
329
|
-
const { defaultGateway, gateways } =
|
|
414
|
+
const { defaultGateway, gateways } = useMemo2(() => {
|
|
330
415
|
if (isNull2(gatewayFromWallet)) {
|
|
331
416
|
return {
|
|
332
417
|
defaultGateway: gatewayFromConfig,
|
|
@@ -355,7 +440,7 @@ var GatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
|
355
440
|
gatewayFromConfig,
|
|
356
441
|
gatewayFromWallet
|
|
357
442
|
]);
|
|
358
|
-
const value =
|
|
443
|
+
const value = useMemo2(() => {
|
|
359
444
|
const value2 = {
|
|
360
445
|
defaultGateway,
|
|
361
446
|
error: gatewayFromWalletError || gatewayFromConfigError,
|
|
@@ -371,19 +456,19 @@ var GatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
|
371
456
|
gateways,
|
|
372
457
|
clearAll
|
|
373
458
|
]);
|
|
374
|
-
return /* @__PURE__ */
|
|
459
|
+
return /* @__PURE__ */ React4.createElement(GatewayContext, {
|
|
375
460
|
value
|
|
376
|
-
}, /* @__PURE__ */
|
|
461
|
+
}, /* @__PURE__ */ React4.createElement(ErrorRender2, {
|
|
377
462
|
error: gatewayFromConfigError
|
|
378
463
|
}), children);
|
|
379
464
|
}, "GatewayProvider");
|
|
380
465
|
|
|
381
466
|
// src/context/providers/WalletGatewayProvider.tsx
|
|
382
467
|
import { ErrorRender as ErrorRender3 } from "@xylabs/react-error";
|
|
383
|
-
import
|
|
468
|
+
import React5, { useMemo as useMemo3 } from "react";
|
|
384
469
|
var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) => {
|
|
385
470
|
const { gateway: gatewayFromWallet, error: gatewayFromWalletError } = useGatewayFromWallet(gatewayName);
|
|
386
|
-
const { defaultGateway, gateways } =
|
|
471
|
+
const { defaultGateway, gateways } = useMemo3(() => {
|
|
387
472
|
return {
|
|
388
473
|
defaultGateway: gatewayFromWallet,
|
|
389
474
|
gateways: {
|
|
@@ -394,7 +479,7 @@ var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) =
|
|
|
394
479
|
}, [
|
|
395
480
|
gatewayFromWallet
|
|
396
481
|
]);
|
|
397
|
-
const value =
|
|
482
|
+
const value = useMemo3(() => {
|
|
398
483
|
const value2 = {
|
|
399
484
|
defaultGateway,
|
|
400
485
|
error: gatewayFromWalletError,
|
|
@@ -407,9 +492,9 @@ var WalletGatewayProvider = /* @__PURE__ */ __name(({ gatewayName, children }) =
|
|
|
407
492
|
gatewayFromWalletError,
|
|
408
493
|
gateways
|
|
409
494
|
]);
|
|
410
|
-
return /* @__PURE__ */
|
|
495
|
+
return /* @__PURE__ */ React5.createElement(GatewayContext, {
|
|
411
496
|
value
|
|
412
|
-
}, /* @__PURE__ */
|
|
497
|
+
}, /* @__PURE__ */ React5.createElement(ErrorRender3, {
|
|
413
498
|
error: gatewayFromWalletError
|
|
414
499
|
}), children);
|
|
415
500
|
}, "WalletGatewayProvider");
|
|
@@ -423,6 +508,7 @@ export {
|
|
|
423
508
|
GatewayContext,
|
|
424
509
|
GatewayProvider,
|
|
425
510
|
InPageGatewaysContext,
|
|
511
|
+
InPageGatewaysProvider,
|
|
426
512
|
WalletGatewayProvider,
|
|
427
513
|
findCaveat,
|
|
428
514
|
getXyoClient,
|
|
@@ -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/in-page/InPageGatewaysContext.ts","../../src/context/in-page/useProvidedInPageGateways.ts","../../src/context/providers/GatewayProvider.tsx","../../src/context/providers/WalletGatewayProvider.tsx","../../src/context/useProvidedGateway.ts"],"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\n/**\n * Shared React context that decouples gateway *sources* from gateway\n * *consumers*. Any provider that can resolve an `XyoGateway` publishes to\n * this context; any hook or component that needs a gateway reads from it\n * via `useProvidedGateway`. Consumers never import a specific provider —\n * they just require that *some* provider is mounted above them in the\n * tree.\n *\n * Current publishers:\n * - `WalletGatewayProvider` (this package) — sources gateways from the\n * injected XL1 wallet extension.\n * - `GatewayProvider` in `@xyo-network/react-chain-provider` — sources\n * gateways built in-page against RPC endpoints, falling back to the\n * wallet when available.\n *\n * To add a new source (e.g. a mock provider for tests, an iframe-bridged\n * provider, a server-rendered provider), publish a `GatewayContextState`\n * to this same context — do not create a parallel context, or consumers\n * will silently stop receiving updates.\n */\nexport const GatewayContext = createContextEx<GatewayContextState>()\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Narrow, provider-internal context that `InPageGatewaysProvider` writes\n * to and `GatewayProvider` reads from. Do not consume this in application\n * code — use `useProvidedGateway` (which reads the shared\n * `GatewayContext`) instead. This context only exists to decouple the\n * single in-page *builder* from the many single-gateway *adapters* that\n * sit between it and the shared gateway surface.\n */\nexport const InPageGatewaysContext = createContextEx<InPageGatewaysState>()\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\n\n/**\n * Reads the `InPageGatewaysContext` map of per-network in-page gateways.\n * Intended for internal use by `GatewayProvider` — application code\n * should prefer `useProvidedGateway`, which returns a single resolved\n * gateway regardless of source.\n *\n * @param required - When `true` (default), throws if no\n * `InPageGatewaysProvider` is mounted above.\n */\nexport const useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, 'InPageGateways', required)\n","import { ErrorRender } from '@xylabs/react-error'\nimport { isDefinedNotNull, isNull } from '@xylabs/sdk-js'\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'\nimport { useProvidedInPageGateways } from '../in-page/index.ts'\n\n/**\n * Publishes the shared `GatewayContext` backed by two sources: the\n * injected XL1 Wallet extension *and* the in-page gateways built by\n * `InPageGatewaysProvider`. Use this provider when the host app can\n * function without a wallet (falling back to the in-page client) but\n * should still prefer the wallet when it is present.\n *\n * Required ancestry: an `InPageGatewaysProvider` must be mounted above\n * this provider — `useProvidedInPageGateways(true)` throws if missing.\n * If you only need a wallet-backed gateway, use `WalletGatewayProvider`\n * instead.\n *\n * Source precedence for `defaultGateway`:\n * - Wallet present and resolved (`XyoGatewayRunner`) → wallet wins; the\n * in-page gateway is still exposed via `gateways.inPageGateway` for\n * the rare consumer that needs to target it specifically.\n * - Wallet definitively absent (`null`) → fall back to the in-page\n * gateway matching `gatewayName`.\n * - Wallet still resolving (`undefined`) → leave `defaultGateway`\n * `undefined` so consumers render a loading state rather than\n * committing to the in-page fallback prematurely.\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` — resolved per the precedence above. Three-state:\n * `undefined` = loading, `null` is not produced by this provider\n * (wallet-null collapses to `gatewayFromConfig`), `XyoGateway` = ready.\n * - `gateways.walletGateway` — raw wallet result (tri-state).\n * - `gateways.inPageGateway` — raw in-page result for the requested\n * `gatewayName`, or `undefined` if no `gatewayName` was passed.\n * - `error` — first non-null of wallet error, then in-page build error\n * for this `gatewayName`. Also rendered inline via `ErrorRender` above\n * `children` so mount-time failures surface even when no consumer\n * reads `error`.\n * - `resetGatewaysFromConfig` — forwards `clearAll` from\n * `InPageGatewaysProvider`, letting consumers force a rebuild of the\n * in-page gateways (e.g. after a network or endpoint change).\n * - `provided: true` — lets descendants detect a real provider in the\n * tree.\n *\n * `defaultGateway`, `gateways`, and the context `value` are memoized so\n * consumers only re-render when wallet or in-page sources actually\n * change identity.\n */\nexport const GatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const {\n gateways: allGateways,\n errors: allGatewayErrors,\n clearAll,\n } = useProvidedInPageGateways(true)\n\n const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : undefined\n const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : undefined\n\n const { defaultGateway, gateways } = useMemo(() => {\n if (isNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromConfig,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: null,\n },\n }\n } else if (isDefinedNotNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: gatewayFromWallet,\n },\n }\n }\n return {\n defaultGateway: undefined,\n gateways: {\n inPageGateway: undefined,\n walletGateway: undefined,\n },\n }\n }, [gatewayFromConfig, gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError || gatewayFromConfigError,\n gateways,\n provided: true,\n resetGatewaysFromConfig: clearAll,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gatewayFromConfigError,\n gateways,\n clearAll,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromConfigError} />\n {children}\n </GatewayContext>\n )\n}\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","import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\n\n/**\n * The sole consumer entry point for gateway state. Reads the nearest\n * `GatewayContext` in the tree, regardless of which provider published\n * it — this is the decoupling that lets a component work unchanged when\n * the surrounding app swaps `WalletGatewayProvider` for\n * `GatewayProvider` (or a test double).\n *\n * @param required - When `true` (default), throws if no gateway provider\n * is mounted above — use this when the component is meaningless\n * without a gateway. When `false`, returns default state (all fields\n * undefined) so the component can render a graceful fallback.\n */\nexport const useProvidedGateway = (required = true) => useContextEx(GatewayContext, 'Gateway', required)\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,aAA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EACJC,SAASC,mBACTC,OAAOC,uBAAsB,IAC3BC,qBAAqBN,WAAAA;AAEzB,QAAM,EAAEO,gBAAgBC,SAAQ,IAAKC,SAAQ,MAAA;AAC3C,WAAO;MACLF,gBAAgBJ;MAChBK,UAAU;QACRE,eAAe;QACfC,eAAeR;MACjB;IACF;EACF,GAAG;IAACA;GAAkB;AAEtB,QAAMS,QAAQH,SAAQ,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;;;ACtCrE,SAASgB,gBAAAA,qBAAoB;AAgBtB,IAAMC,qBAAqB,wBAACC,WAAW,SAASC,cAAaC,gBAAgB,WAAWF,QAAAA,GAA7D;","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","createContextEx","InPageGatewaysContext","useContextEx","useProvidedInPageGateways","required","useContextEx","InPageGatewaysContext","ErrorRender","isDefinedNotNull","isNull","React","useMemo","GatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","gateways","allGateways","errors","allGatewayErrors","clearAll","useProvidedInPageGateways","gatewayFromConfig","undefined","gatewayFromConfigError","defaultGateway","useMemo","isNull","inPageGateway","walletGateway","isDefinedNotNull","value","provided","resetGatewaysFromConfig","React","GatewayContext","ErrorRender","ErrorRender","React","useMemo","WalletGatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","defaultGateway","gateways","useMemo","inPageGateway","walletGateway","value","provided","React","GatewayContext","ErrorRender","useContextEx","useProvidedGateway","required","useContextEx","GatewayContext"]}
|
|
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/in-page/InPageGatewaysContext.ts","../../src/context/in-page/Provider.tsx","../../src/context/in-page/lib/buildGateway.ts","../../src/context/in-page/useProvidedInPageGateways.ts","../../src/context/providers/GatewayProvider.tsx","../../src/context/providers/WalletGatewayProvider.tsx","../../src/context/useProvidedGateway.ts"],"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\n/**\n * Shared React context that decouples gateway *sources* from gateway\n * *consumers*. Any provider that can resolve an `XyoGateway` publishes to\n * this context; any hook or component that needs a gateway reads from it\n * via `useProvidedGateway`. Consumers never import a specific provider —\n * they just require that *some* provider is mounted above them in the\n * tree.\n *\n * Current publishers:\n * - `WalletGatewayProvider` (this package) — sources gateways from the\n * injected XL1 wallet extension.\n * - `GatewayProvider` in `@xyo-network/react-chain-provider` — sources\n * gateways built in-page against RPC endpoints, falling back to the\n * wallet when available.\n *\n * To add a new source (e.g. a mock provider for tests, an iframe-bridged\n * provider, a server-rendered provider), publish a `GatewayContextState`\n * to this same context — do not create a parallel context, or consumers\n * will silently stop receiving updates.\n */\nexport const GatewayContext = createContextEx<GatewayContextState>()\n","import { createContextEx } from '@xylabs/react-shared'\n\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\n\n/**\n * Narrow, provider-internal context that `InPageGatewaysProvider` writes\n * to and `GatewayProvider` reads from. Do not consume this in application\n * code — use `useProvidedGateway` (which reads the shared\n * `GatewayContext`) instead. This context only exists to decouple the\n * single in-page *builder* from the many single-gateway *adapters* that\n * sit between it and the shared gateway surface.\n */\nexport const InPageGatewaysContext = createContextEx<InPageGatewaysState>()\n","import type {\n GatewayName, RpcTransport, XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport { DefaultNetworks } from '@xyo-network/xl1-sdk'\nimport type { PropsWithChildren } from 'react'\nimport React, {\n startTransition,\n useCallback, useEffect, useMemo, useState,\n} from 'react'\n\nimport type { ContextGatewayType } from '../../types/index.ts'\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\nimport type { InPageGatewaysState } from './InPageGatewaysState.ts'\nimport { buildGateway } from './lib/index.ts'\n\nexport interface InPageGatewaysProviderProps extends PropsWithChildren {\n signerTransport?: RpcTransport<XyoSignerRpcSchemas>\n}\n\n/**\n * Publishes a keyed map of in-page gateways — one per network in\n * `DefaultNetworks` — under the narrow `InPageGatewaysContext`.\n *\n * This provider is deliberately *not* a direct publisher of the shared\n * `GatewayContext` that `useProvidedGateway` reads. Its consumer is the\n * wrapping `GatewayProvider` in this same package, which picks the\n * `gatewayName` the consumer asked for out of this map, adapts it into\n * the single-gateway `GatewayContextState` shape, and then publishes *that*\n * to the shared context. Splitting the work this way lets one\n * `InPageGatewaysProvider` near the root build every network's gateway\n * once, while many `GatewayProvider` instances deeper in the tree each\n * expose whichever gateway their subtree cares about.\n *\n * Unlike `WalletGatewayProvider`, gateways here are constructed directly\n * in the page (via `buildGateway`) against each network's RPC endpoint\n * — no browser wallet extension is required. `signerTransport` switches\n * between viewer (read-only) and runner (can sign/send) locators; supply\n * it only when the app needs to sign.\n *\n * Behavior:\n * - On mount, and whenever `signerTransport` changes, `buildGateway` is\n * called in parallel for every network in `DefaultNetworks` via\n * `Promise.allSettled`. Networks that resolve populate `gateways[id]`;\n * networks that reject populate `errors[id]`. One failed network does\n * not block the others.\n * - If `signerTransport` is provided, gateways are built with a remote\n * *runner* locator, otherwise with a remote *viewer* locator.\n * - When `signerTransport` changes identity mid-life, the provider clears\n * all cached gateways and errors synchronously during render (via\n * `previousSignerTransport` state) so consumers never see gateways\n * bound to the previous transport, then rebuilds in the effect.\n * - State updates from the rebuild are wrapped in `startTransition` so a\n * slow network doesn't stall higher-priority UI updates.\n * - A `cancelled` flag in the effect's cleanup discards results from a\n * prior `signerTransport` once a new one is in flight.\n *\n * Published `InPageGatewaysState` (narrower than `GatewayContextState` —\n * this is an internal handoff shape, not the cross-publisher surface):\n * - `gateways` — `Partial<Record<GatewayName, ContextGatewayType>>`. Keys\n * are only present for networks that built successfully.\n * - `errors` — `Partial<Record<GatewayName, Error>>`. Per-network build\n * failures, keyed by `GatewayName`.\n * - `clearAll()` — manually empties both maps. Also invoked internally on\n * transport changes. Forwarded by `GatewayProvider` to consumers as\n * `resetGatewaysFromConfig`.\n * - `provided: true` — lets descendants detect a real provider.\n *\n * Note: the commented-out `SimpleXyoClient` at the top is intentionally\n * disabled pending a type unification between `XyoGateway` and\n * `XyoGatewayRunner`.\n */\nexport const InPageGatewaysProvider: React.FC<InPageGatewaysProviderProps> = ({ signerTransport, children }) => {\n const [gateways, setGateways] = useState<Partial<Record<GatewayName, ContextGatewayType>>>({})\n const [errors, setErrors] = useState<Partial<Record<GatewayName, Error>>>({})\n const [previousSignerTransport, setPreviousSignerTransport] = useState<RpcTransport<XyoSignerRpcSchemas> | undefined>(signerTransport)\n\n // This can come back once we homogenize the type for XyoGateway.\n // Right now, SimpleXyoClient takes XyoGatewayRunners but ideally it would take XyoGateway.\n // const clientInPage = useMemo(() => new SimpleXyoClient(gateways, {}), [gateways])\n\n const clearAll = useCallback(() => {\n setGateways({})\n setErrors({})\n }, [])\n\n if (previousSignerTransport !== signerTransport) {\n clearAll()\n setPreviousSignerTransport(signerTransport)\n }\n\n useEffect(() => {\n let cancelled = false\n\n const buildAll = async () => {\n const results = await Promise.allSettled(\n DefaultNetworks.map(async (network) => {\n const gateway = await buildGateway(network.id as GatewayName, signerTransport)\n return { id: network.id as GatewayName, gateway }\n }),\n )\n\n if (cancelled) return\n\n const nextGateways: Partial<Record<GatewayName, ContextGatewayType>> = {}\n const nextErrors: Partial<Record<GatewayName, Error>> = {}\n\n for (const [index, result] of results.entries()) {\n const networkId = DefaultNetworks[index].id as GatewayName\n if (result.status === 'fulfilled') {\n nextGateways[networkId] = result.value.gateway\n } else {\n nextErrors[networkId] = result.reason instanceof Error ? result.reason : new Error(String(result.reason))\n }\n }\n\n startTransition(() => {\n setGateways(nextGateways)\n setErrors(nextErrors)\n })\n }\n\n void buildAll()\n return () => {\n cancelled = true\n }\n }, [signerTransport])\n\n const value = useMemo(() => {\n const value: InPageGatewaysState = {\n clearAll,\n errors,\n gateways,\n provided: true,\n }\n return value\n }, [clearAll, errors, gateways])\n\n return <InPageGatewaysContext value={value}>{children}</InPageGatewaysContext>\n}\n","import { assertEx, isDefined } from '@xylabs/sdk-js'\nimport type {\n GatewayName,\n RemoteConfig, RpcTransport, SimpleXyoGateway,\n XyoSignerRpcSchemas,\n} from '@xyo-network/xl1-sdk'\nimport {\n basicRemoteRunnerLocator,\n basicRemoteViewerLocator,\n DefaultNetworks, NetworkDataLakeUrls, XyoGatewayMoniker,\n} from '@xyo-network/xl1-sdk'\n\nexport const buildGateway = async (gatewayName: GatewayName, signerTransport?: RpcTransport<XyoSignerRpcSchemas>) => {\n const network = DefaultNetworks.find(network => network.id === gatewayName)\n const resolvedNetwork = assertEx(network, () => `No network found for id ${gatewayName}`)\n\n const remoteConfig: RemoteConfig = {\n rpc: {\n protocol: 'http',\n url: `${resolvedNetwork.url}/rpc`,\n },\n }\n\n const dataLakeEndpoint = NetworkDataLakeUrls[gatewayName]\n\n const locator = isDefined(signerTransport)\n ? await basicRemoteRunnerLocator(gatewayName, remoteConfig, signerTransport, dataLakeEndpoint)\n : await basicRemoteViewerLocator(gatewayName, remoteConfig, dataLakeEndpoint)\n\n return await locator.getInstance<SimpleXyoGateway>(XyoGatewayMoniker)\n}\n","import { useContextEx } from '@xylabs/react-shared'\n\nimport { InPageGatewaysContext } from './InPageGatewaysContext.ts'\n\n/**\n * Reads the `InPageGatewaysContext` map of per-network in-page gateways.\n * Intended for internal use by `GatewayProvider` — application code\n * should prefer `useProvidedGateway`, which returns a single resolved\n * gateway regardless of source.\n *\n * @param required - When `true` (default), throws if no\n * `InPageGatewaysProvider` is mounted above.\n */\nexport const useProvidedInPageGateways = (required = true) => useContextEx(InPageGatewaysContext, 'InPageGateways', required)\n","import { ErrorRender } from '@xylabs/react-error'\nimport { isDefinedNotNull, isNull } from '@xylabs/sdk-js'\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'\nimport { useProvidedInPageGateways } from '../in-page/index.ts'\n\n/**\n * Publishes the shared `GatewayContext` backed by two sources: the\n * injected XL1 Wallet extension *and* the in-page gateways built by\n * `InPageGatewaysProvider`. Use this provider when the host app can\n * function without a wallet (falling back to the in-page client) but\n * should still prefer the wallet when it is present.\n *\n * Required ancestry: an `InPageGatewaysProvider` must be mounted above\n * this provider — `useProvidedInPageGateways(true)` throws if missing.\n * If you only need a wallet-backed gateway, use `WalletGatewayProvider`\n * instead.\n *\n * Source precedence for `defaultGateway`:\n * - Wallet present and resolved (`XyoGatewayRunner`) → wallet wins; the\n * in-page gateway is still exposed via `gateways.inPageGateway` for\n * the rare consumer that needs to target it specifically.\n * - Wallet definitively absent (`null`) → fall back to the in-page\n * gateway matching `gatewayName`.\n * - Wallet still resolving (`undefined`) → leave `defaultGateway`\n * `undefined` so consumers render a loading state rather than\n * committing to the in-page fallback prematurely.\n *\n * The published `GatewayContextState` shape:\n * - `defaultGateway` — resolved per the precedence above. Three-state:\n * `undefined` = loading, `null` is not produced by this provider\n * (wallet-null collapses to `gatewayFromConfig`), `XyoGateway` = ready.\n * - `gateways.walletGateway` — raw wallet result (tri-state).\n * - `gateways.inPageGateway` — raw in-page result for the requested\n * `gatewayName`, or `undefined` if no `gatewayName` was passed.\n * - `error` — first non-null of wallet error, then in-page build error\n * for this `gatewayName`. Also rendered inline via `ErrorRender` above\n * `children` so mount-time failures surface even when no consumer\n * reads `error`.\n * - `resetGatewaysFromConfig` — forwards `clearAll` from\n * `InPageGatewaysProvider`, letting consumers force a rebuild of the\n * in-page gateways (e.g. after a network or endpoint change).\n * - `provided: true` — lets descendants detect a real provider in the\n * tree.\n *\n * `defaultGateway`, `gateways`, and the context `value` are memoized so\n * consumers only re-render when wallet or in-page sources actually\n * change identity.\n */\nexport const GatewayProvider: React.FC<GatewayProviderProps> = ({ gatewayName, children }) => {\n const {\n gateway: gatewayFromWallet,\n error: gatewayFromWalletError,\n } = useGatewayFromWallet(gatewayName)\n\n const {\n gateways: allGateways,\n errors: allGatewayErrors,\n clearAll,\n } = useProvidedInPageGateways(true)\n\n const gatewayFromConfig = gatewayName ? allGateways[gatewayName] : undefined\n const gatewayFromConfigError = gatewayName ? allGatewayErrors[gatewayName] : undefined\n\n const { defaultGateway, gateways } = useMemo(() => {\n if (isNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromConfig,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: null,\n },\n }\n } else if (isDefinedNotNull(gatewayFromWallet)) {\n return {\n defaultGateway: gatewayFromWallet,\n gateways: {\n inPageGateway: gatewayFromConfig,\n walletGateway: gatewayFromWallet,\n },\n }\n }\n return {\n defaultGateway: undefined,\n gateways: {\n inPageGateway: undefined,\n walletGateway: undefined,\n },\n }\n }, [gatewayFromConfig, gatewayFromWallet])\n\n const value = useMemo(() => {\n const value: GatewayContextState = {\n defaultGateway,\n error: gatewayFromWalletError || gatewayFromConfigError,\n gateways,\n provided: true,\n resetGatewaysFromConfig: clearAll,\n }\n return value\n }, [\n defaultGateway,\n gatewayFromWalletError,\n gatewayFromConfigError,\n gateways,\n clearAll,\n ])\n\n return (\n <GatewayContext value={value}>\n <ErrorRender error={gatewayFromConfigError} />\n {children}\n </GatewayContext>\n )\n}\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","import { useContextEx } from '@xylabs/react-shared'\n\nimport { GatewayContext } from './GatewayContext.ts'\n\n/**\n * The sole consumer entry point for gateway state. Reads the nearest\n * `GatewayContext` in the tree, regardless of which provider published\n * it — this is the decoupling that lets a component work unchanged when\n * the surrounding app swaps `WalletGatewayProvider` for\n * `GatewayProvider` (or a test double).\n *\n * @param required - When `true` (default), throws if no gateway provider\n * is mounted above — use this when the component is meaningless\n * without a gateway. When `false`, returns default state (all fields\n * undefined) so the component can render a graceful fallback.\n */\nexport const useProvidedGateway = (required = true) => useContextEx(GatewayContext, 'Gateway', required)\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,YAAY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,OAAOC;MACnBJ,QAAAA;AAGP,GApCqE;;;ACtCrE,SAASgB,gBAAAA,qBAAoB;AAgBtB,IAAMC,qBAAqB,wBAACC,WAAW,SAASC,cAAaC,gBAAgB,WAAWF,QAAAA,GAA7D;","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","createContextEx","InPageGatewaysContext","DefaultNetworks","React","startTransition","useCallback","useEffect","useMemo","useState","assertEx","isDefined","basicRemoteRunnerLocator","basicRemoteViewerLocator","DefaultNetworks","NetworkDataLakeUrls","XyoGatewayMoniker","buildGateway","gatewayName","signerTransport","network","DefaultNetworks","find","id","resolvedNetwork","assertEx","remoteConfig","rpc","protocol","url","dataLakeEndpoint","NetworkDataLakeUrls","locator","isDefined","basicRemoteRunnerLocator","basicRemoteViewerLocator","getInstance","XyoGatewayMoniker","InPageGatewaysProvider","signerTransport","children","gateways","setGateways","useState","errors","setErrors","previousSignerTransport","setPreviousSignerTransport","clearAll","useCallback","useEffect","cancelled","buildAll","results","Promise","allSettled","DefaultNetworks","map","network","gateway","buildGateway","id","nextGateways","nextErrors","index","result","entries","networkId","status","value","reason","Error","String","startTransition","useMemo","provided","React","InPageGatewaysContext","useContextEx","useProvidedInPageGateways","required","useContextEx","InPageGatewaysContext","ErrorRender","isDefinedNotNull","isNull","React","useMemo","GatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","gateways","allGateways","errors","allGatewayErrors","clearAll","useProvidedInPageGateways","gatewayFromConfig","undefined","gatewayFromConfigError","defaultGateway","useMemo","isNull","inPageGateway","walletGateway","isDefinedNotNull","value","provided","resetGatewaysFromConfig","React","GatewayContext","ErrorRender","ErrorRender","React","useMemo","WalletGatewayProvider","gatewayName","children","gateway","gatewayFromWallet","error","gatewayFromWalletError","useGatewayFromWallet","defaultGateway","gateways","useMemo","inPageGateway","walletGateway","value","provided","React","GatewayContext","ErrorRender","useContextEx","useProvidedGateway","required","useContextEx","GatewayContext"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/react-chain-client",
|
|
3
|
-
"version": "1.20.
|
|
3
|
+
"version": "1.20.26",
|
|
4
4
|
"description": "XYO Layer One React SDK - Client/Wallet Hooks",
|
|
5
5
|
"homepage": "https://xylabs.com",
|
|
6
6
|
"bugs": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@xylabs/react-error": "~7.1.20",
|
|
43
43
|
"@xylabs/react-shared": "~7.1.20",
|
|
44
44
|
"@xyo-network/xl1-sdk": "^1.26.36",
|
|
45
|
-
"@xyo-network/react-chain-blockies": "~1.20.
|
|
45
|
+
"@xyo-network/react-chain-blockies": "~1.20.26"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@emotion/react": "^11.5.0",
|
|
@@ -134,8 +134,8 @@
|
|
|
134
134
|
"vite": "^8.0.9",
|
|
135
135
|
"webextension-polyfill": "^0.10.0 || ^0.11.0 || ^0.12.0",
|
|
136
136
|
"zod": "~4.3.6",
|
|
137
|
-
"@xyo-network/react-chain-model": "~1.20.
|
|
138
|
-
"@xyo-network/react-chain-shared": "~1.20.
|
|
137
|
+
"@xyo-network/react-chain-model": "~1.20.26",
|
|
138
|
+
"@xyo-network/react-chain-shared": "~1.20.26"
|
|
139
139
|
},
|
|
140
140
|
"peerDependencies": {
|
|
141
141
|
"@mui/material": ">=6 <8",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Decorator } from '@storybook/react-vite';
|
|
2
|
-
/**
|
|
3
|
-
* Decorator that publishes a mock `InPageGatewaysContext` value so
|
|
4
|
-
* `GatewayProvider` can be exercised in isolation — without needing the
|
|
5
|
-
* real `InPageGatewaysProvider` (which depends on `buildGateway` from the
|
|
6
|
-
* provider package). Reads `inPageScenario` from story args to toggle
|
|
7
|
-
* between a populated map and an empty one.
|
|
8
|
-
*/
|
|
9
|
-
export declare const WithMockInPageGateways: Decorator;
|
|
10
|
-
//# sourceMappingURL=mockInPageGatewaysDecorator.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mockInPageGatewaysDecorator.d.ts","sourceRoot":"","sources":["../../../../../src/context/providers/story/mockInPageGatewaysDecorator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAiBtD;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAkBpC,CAAA"}
|