@edgeandnode/graph-auth-kit 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -231,6 +231,37 @@ export function Layout({ children }: Readonly<{ children: ReactNode }>) {
231
231
  - `useGraphAuthKitAccount` -> This is an override of the [wagmi useAccount hook](https://wagmi.sh/react/api/hooks/useAccount). The reason is, if the user connects with a multisig, the wagmi context is connected with the user-selected EoA, so all of the wagmi context hooks reference this EoA and not the Safe. This returns the wagmi `UseAccountReturnType` but the `address` and `addresses` values include the entered Safe address. It also adds an `eoa` property that is the connected EoA address.
232
232
  - `useGraphAuthKitConnector` -> The user selected wallet/connector option.
233
233
 
234
+ ## Components
235
+
236
+ - `Connected` -> renders the passed in `children` _only if_ the user is connected.
237
+
238
+ ```tsx
239
+ import { Connected } from '@edgeandnode/graph-auth-kit'
240
+
241
+ export function ShowMeConnected() {
242
+ return <Connected>{(account) => <div>Connected Wallet: {account.address}</div>}</Connected>
243
+ }
244
+ ```
245
+
246
+ - `Disconnected` -> renders the passed in `children` _only if_ the user id disconnected. Useful for rendering components like a "Connect Wallet" CTA that should only render if the user is _not_ authenticated.
247
+
248
+ ```tsx
249
+ import { ExperimentalButton as Button } from '@edgeandnode/gds'
250
+ import { Disconnected, useGraphAuthKit } from '@edgeandnode/graph-auth-kit'
251
+
252
+ export function ShowMeDisconnected() {
253
+ const authkit = useGraphAuthKit()
254
+
255
+ return (
256
+ <Disconnected>
257
+ <Button variant="primary" onClick={() => authkit.openConnectModal()}>
258
+ Connect Wallet
259
+ </Button>
260
+ </Disconnected>
261
+ )
262
+ }
263
+ ```
264
+
234
265
  ## References
235
266
 
236
267
  - [`wagmi`](https://wagmi.sh/)
@@ -0,0 +1,29 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type UseGraphAuthKitAccountReturnType } from '../hooks';
3
+ export type ConnectedProps = {
4
+ children(account: {
5
+ address: NonNullable<UseGraphAuthKitAccountReturnType['address']>;
6
+ chain: NonNullable<UseGraphAuthKitAccountReturnType['chain']>;
7
+ }): ReactNode;
8
+ };
9
+ /**
10
+ * Utility component that only renders the passed in children if the user is authenticated.
11
+ * Otherwise, it renders null.
12
+ * Useful for wrapping components where you want to guarantee that they are only rendered,
13
+ * if the user is connected.
14
+ *
15
+ * @example
16
+ * ```tsx
17
+ * import { Connected } from '@edgeandnode/graph-auth-kit'
18
+ *
19
+ * export function ShowMeConnected() {
20
+ * return (
21
+ * <Connected>
22
+ * {(account) => <div>Connected Wallet: {account.address}</div>}
23
+ * </Connected>
24
+ * )
25
+ * }
26
+ * ```
27
+ */
28
+ export declare function Connected({ children }: ConnectedProps): ReactNode;
29
+ //# sourceMappingURL=Connected.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Connected.d.ts","sourceRoot":"","sources":["../../src/Components/Connected.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,EAA0B,KAAK,gCAAgC,EAAE,MAAM,UAAU,CAAA;AAExF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,OAAO,EAAE;QAChB,OAAO,EAAE,WAAW,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC,CAAA;QACjE,KAAK,EAAE,WAAW,CAAC,gCAAgC,CAAC,OAAO,CAAC,CAAC,CAAA;KAC9D,GAAG,SAAS,CAAA;CACd,CAAA;AACD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,cAAc,aAWrD"}
@@ -0,0 +1,28 @@
1
+ import { type ReactNode } from 'react';
2
+ export type DisconnectedProps = {
3
+ children: ReactNode;
4
+ };
5
+ /**
6
+ * Utility component that only renders the passed in children if the user is NOT connected/authenticated.
7
+ * If the user is connected, this will render null.
8
+ * Useful for wrapping components where you want to guarantee that they are only rendered,
9
+ * if the user is NOT connected.
10
+ * Such as: a connect wallet button, etc
11
+ *
12
+ * @example
13
+ * ```tsx
14
+ * import { Disconnected, useGraphAuthKit } from '@edgeandnode/graph-auth-kit'
15
+ *
16
+ * export function ShowMeDisonnected() {
17
+ * const authkit = useGraphAuthKit()
18
+ *
19
+ * return (
20
+ * <Disconnected>
21
+ * <button onClick={() => authkit.openConnectModal()}>Connect</button>
22
+ * </Disconnected>
23
+ * )
24
+ * }
25
+ * ```
26
+ */
27
+ export declare function Disconnected({ children }: DisconnectedProps): ReactNode;
28
+ //# sourceMappingURL=Disconnected.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Disconnected.d.ts","sourceRoot":"","sources":["../../src/Components/Disconnected.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,SAAS,CAAA;CACpB,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,EAAE,iBAAiB,aAQ3D"}
@@ -0,0 +1,3 @@
1
+ export { Connected, type ConnectedProps } from './Connected';
2
+ export { Disconnected, type DisconnectedProps } from './Disconnected';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/hooks.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type providers } from 'ethers';
2
- import { type Address } from 'viem';
3
- import { type Config, type ResolvedRegister, type UseAccountReturnType, type UseWalletClientReturnType, type UseWriteContractParameters, type UseWriteContractReturnType } from 'wagmi';
2
+ import { type Address, type Chain } from 'viem';
3
+ import { type Config, type Connector, type ResolvedRegister, type UseAccountReturnType, type UseWalletClientReturnType, type UseWriteContractParameters, type UseWriteContractReturnType } from 'wagmi';
4
4
  import { SafeEthersSigner } from './safe/SafeEthersSigner';
5
5
  import { type GraphAuthKitConnector } from './types';
6
6
  /**
@@ -28,6 +28,23 @@ export type UseGraphAuthKitAccountReturnType = UseAccountReturnType & Readonly<{
28
28
  * @see https://wagmi.sh/react/api/hooks/useAccount
29
29
  */
30
30
  export declare function useGraphAuthKitAccount(): UseGraphAuthKitAccountReturnType;
31
+ export type UseAuthAccountReturnType<config extends Config = Config, chain = Config extends config ? Chain : config['chains'][number]> = {
32
+ address: Address;
33
+ addresses: readonly [Address, ...Address[]];
34
+ chain: chain | undefined;
35
+ chainId: number;
36
+ connector: Connector;
37
+ } & Readonly<{
38
+ /** If the user is connected to a multisig, this is the EoA signer address the user is connected with */
39
+ eoa?: Address | null;
40
+ }>;
41
+ /**
42
+ * Hook that returns the authenticated account information.
43
+ * If the wallet is not connected, an error is thrown.
44
+ * This hooks is useful to render where you _know_ the wallet is connected,
45
+ * preventing checks if the `address` is null further down the tree.
46
+ */
47
+ export declare function useAuthAccount(): UseAuthAccountReturnType;
31
48
  /**
32
49
  * Override hook of wagmi `useWalletClient`.
33
50
  * The GraphAuthKit lets users connect to a Safe by entering the Safe information in,
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,MAAM,CAAA;AAC/C,OAAO,EACL,KAAK,MAAM,EACX,KAAK,gBAAgB,EAErB,KAAK,oBAAoB,EAKzB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpD;;;;GAIG;AACH,wBAAgB,uBAAuB,2DAwBtC;AAED,wBAAgB,wBAAwB,IAAI,qBAAqB,GAAG,IAAI,CAIvE;AAED,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GACjE,QAAQ,CAAC;IACP,wGAAwG;IACxG,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACrB,CAAC,CAAA;AACJ;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI,gCAAgC,CAiCzE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,IAAI,yBAAyB,CAgBvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,EAChH,UAAU,GAAE,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAM,GAC3D,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,CA8B7C"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAA;AAEvC,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAc,MAAM,MAAM,CAAA;AAC3D,OAAO,EACL,KAAK,MAAM,EACX,KAAK,SAAS,EACd,KAAK,gBAAgB,EAErB,KAAK,oBAAoB,EAKzB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,OAAO,CAAA;AAGd,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAI1D,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpD;;;;GAIG;AACH,wBAAgB,uBAAuB,2DAwBtC;AAED,wBAAgB,wBAAwB,IAAI,qBAAqB,GAAG,IAAI,CAIvE;AAED,MAAM,MAAM,gCAAgC,GAAG,oBAAoB,GACjE,QAAQ,CAAC;IACP,wGAAwG;IACxG,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACrB,CAAC,CAAA;AACJ;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,IAAI,gCAAgC,CAiCzE;AAED,MAAM,MAAM,wBAAwB,CAClC,MAAM,SAAS,MAAM,GAAG,MAAM,EAE9B,KAAK,GAAG,MAAM,SAAS,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAC9D;IACF,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,SAAS,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC,CAAA;IAC3C,KAAK,EAAE,KAAK,GAAG,SAAS,CAAA;IACxB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,SAAS,CAAA;CACrB,GAAG,QAAQ,CAAC;IACX,wGAAwG;IACxG,GAAG,CAAC,EAAE,OAAO,GAAG,IAAI,CAAA;CACrB,CAAC,CAAA;AACF;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,wBAAwB,CAczD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,2BAA2B,IAAI,yBAAyB,CAgBvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,EAChH,UAAU,GAAE,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAM,GAC3D,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,CA8B7C"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './client';
2
+ export * from './Components';
2
3
  export * from './constants';
3
4
  export * from './GraphAuthKit.context';
4
5
  export * from './hooks';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAA;AACxB,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,wBAAwB,CAAA;AACtC,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { u as useGraphAuthKitInnerContext, e as clientToProvider } from "./GraphAuthKit.context-DBwb2jco.js";
5
- import { h, B, m, a, l, j, R, k, b, f, g, c, r, o, n, p, q, i } from "./GraphAuthKit.context-DBwb2jco.js";
4
+ import { u as useGraphAuthKitInnerContext, e as clientToProvider } from "./GraphAuthKit.context-B7OJAuEY.js";
5
+ import { h, B, m, a, l, j, R, k, b, f, g, c, r, o, n, p, q, i } from "./GraphAuthKit.context-B7OJAuEY.js";
6
6
  import { b as createSafe, c as createApiKit } from "./utils-KuRu9vB-.js";
7
7
  import { j as j2, A, D, g as g2, h as h2, L, e, M, a as a2, S, k as k2, l as l2, f as f2, d, i as i2 } from "./utils-KuRu9vB-.js";
8
8
  import { useMutation } from "@tanstack/react-query";
@@ -362,6 +362,21 @@ function useGraphAuthKitAccount() {
362
362
  }
363
363
  return { ...data, eoa: void 0 };
364
364
  }
365
+ function useAuthAccount() {
366
+ const auth = useGraphAuthKitAccount();
367
+ if (auth.address == null || auth.addresses == null) {
368
+ throw new Error("Wallet is not connected");
369
+ }
370
+ return {
371
+ address: auth.address,
372
+ addresses: auth.addresses,
373
+ // not sure why this type assertion is necessary. but addresses comes across as [string, ...string[]]
374
+ chain: auth.chain,
375
+ chainId: auth.chainId,
376
+ connector: auth.connector,
377
+ eoa: auth.eoa
378
+ };
379
+ }
365
380
  function useGraphAuthKitWalletClient() {
366
381
  const ctx = useGraphAuthKitInnerContext();
367
382
  const walletClient = useWalletClient();
@@ -397,12 +412,31 @@ function useGraphAuthKitWriteContract(parameters = {}) {
397
412
  writeContractAsync: mutateAsync
398
413
  };
399
414
  }
415
+ function Connected({ children }) {
416
+ const account = useGraphAuthKitAccount();
417
+ if (account.address == null || account.chain == null) {
418
+ return null;
419
+ }
420
+ return children({
421
+ address: account.address,
422
+ chain: account.chain
423
+ });
424
+ }
425
+ function Disconnected({ children }) {
426
+ const account = useGraphAuthKitAccount();
427
+ if (account.address == null || account.chain == null) {
428
+ return children;
429
+ }
430
+ return null;
431
+ }
400
432
  export {
401
433
  j2 as AUTH_STORAGE_KEY,
402
434
  A as ApiKitUrlMap,
403
435
  h as BuildClientArgs,
404
436
  B as BuildPublicClientArgs,
437
+ Connected,
405
438
  D as DefChain,
439
+ Disconnected,
406
440
  m as GraphAuthKitConnector,
407
441
  a as GraphAuthKitContext,
408
442
  l as GraphAuthKitProps,
@@ -433,6 +467,7 @@ export {
433
467
  q as isChainTestnet,
434
468
  d as isSafeOwner,
435
469
  i2 as isValidSafe,
470
+ useAuthAccount,
436
471
  useClientToEthersSigner,
437
472
  i as useGraphAuthKit,
438
473
  useGraphAuthKitAccount,
@@ -2,7 +2,7 @@ import { jsx } from "@theme-ui/core/jsx-runtime";
2
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
3
  import { createConfig, createStorage, cookieStorage, cookieToInitialState, WagmiProvider, useDisconnect } from "wagmi";
4
4
  import { mock } from "wagmi/connectors";
5
- import { c as chainIsSupportedChain, b as buildClient, G as GraphAuthKitInnerContext, d as defInnerState, u as useGraphAuthKitInnerContext, a as GraphAuthKitContext } from "../GraphAuthKit.context-DBwb2jco.js";
5
+ import { c as chainIsSupportedChain, b as buildClient, G as GraphAuthKitInnerContext, d as defInnerState, u as useGraphAuthKitInnerContext, a as GraphAuthKitContext } from "../GraphAuthKit.context-B7OJAuEY.js";
6
6
  import { L as L2Chain, e as L2ChainTestnet, g as L1Chain, h as L1ChainTestnet, D as DefChain, j as AUTH_STORAGE_KEY } from "../utils-KuRu9vB-.js";
7
7
  function MockGraphAuthKitProvider(props) {
8
8
  const mockConfig = createConfig({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeandnode/graph-auth-kit",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "private": false,
5
5
  "description": "Wallet authentication connect kit in The Graph suite of applications",
6
6
  "author": "Edge & Node",
@@ -45,8 +45,8 @@
45
45
  "viem": "2.18.6",
46
46
  "wagmi": "2.12.1",
47
47
  "@edgeandnode/common": "^6.18.0",
48
- "@edgeandnode/go": "^6.42.0",
49
- "@edgeandnode/gds": "^5.27.0"
48
+ "@edgeandnode/gds": "^5.27.0",
49
+ "@edgeandnode/go": "^6.42.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@emotion/react": "^11.13",
@@ -59,6 +59,7 @@
59
59
  "@types/react": "^18.3.3",
60
60
  "@types/react-dom": "^18.3.0",
61
61
  "@vitejs/plugin-react-swc": "^3.5.0",
62
+ "@wagmi/core": "^2.13.4",
62
63
  "autoprefixer": "^10.4.19",
63
64
  "ethers": "5.7.2",
64
65
  "postcss": "^8.4.40",
@@ -69,9 +70,9 @@
69
70
  "viem": "2.18.6",
70
71
  "wagmi": "2.12.2",
71
72
  "@edgeandnode/common": "^6.18.0",
72
- "@edgeandnode/test-utils": "^2.0.0",
73
+ "@edgeandnode/gds": "^5.27.0",
73
74
  "@edgeandnode/go": "^6.42.0",
74
- "@edgeandnode/gds": "^5.27.0"
75
+ "@edgeandnode/test-utils": "^2.0.0"
75
76
  },
76
77
  "dependencies": {
77
78
  "zod": "^3.23.8"
@@ -282,6 +282,36 @@ function GraphAuthKitInnerContextProvider({ infuraKey, children }) {
282
282
  }
283
283
  );
284
284
  }
285
+ function chainIsSupportedChain(chain) {
286
+ return SupportedClientChainId.safeParse(chain.id).success;
287
+ }
288
+ function isChainL2(chain) {
289
+ return chain === L2Chain.id || chain === L2ChainTestnet.id;
290
+ }
291
+ function isChainL1(chain) {
292
+ return chain === L1Chain.id || chain === L1ChainTestnet.id;
293
+ }
294
+ function isChainMainnet(chain) {
295
+ return chain === L1Chain.id || chain === L2Chain.id;
296
+ }
297
+ function isChainTestnet(chain) {
298
+ return chain === L1ChainTestnet.id || chain === L2ChainTestnet.id;
299
+ }
300
+ function clientToProvider(client) {
301
+ var _a, _b;
302
+ const { chain, transport } = client;
303
+ const network = {
304
+ chainId: chain.id,
305
+ name: chain.name,
306
+ ensAddress: (_b = (_a = chain.contracts) == null ? void 0 : _a.ensRegistry) == null ? void 0 : _b.address
307
+ };
308
+ const provider = new providers.Web3Provider(transport, network);
309
+ return provider;
310
+ }
311
+ async function connectedWalletIsEoA(client, address) {
312
+ const code = await client.getCode({ address });
313
+ return code == null || code === "0x";
314
+ }
285
315
  function ConnectorOption(props) {
286
316
  return /* @__PURE__ */ jsxs(
287
317
  "button",
@@ -789,36 +819,6 @@ function ConnectModal() {
789
819
  }
790
820
  );
791
821
  }
792
- function chainIsSupportedChain(chain) {
793
- return SupportedClientChainId.safeParse(chain.id).success;
794
- }
795
- function isChainL2(chain) {
796
- return chain === L2Chain.id || chain === L2ChainTestnet.id;
797
- }
798
- function isChainL1(chain) {
799
- return chain === L1Chain.id || chain === L1ChainTestnet.id;
800
- }
801
- function isChainMainnet(chain) {
802
- return chain === L1Chain.id || chain === L2Chain.id;
803
- }
804
- function isChainTestnet(chain) {
805
- return chain === L1ChainTestnet.id || chain === L2ChainTestnet.id;
806
- }
807
- function clientToProvider(client) {
808
- var _a, _b;
809
- const { chain, transport } = client;
810
- const network = {
811
- chainId: chain.id,
812
- name: chain.name,
813
- ensAddress: (_b = (_a = chain.contracts) == null ? void 0 : _a.ensRegistry) == null ? void 0 : _b.address
814
- };
815
- const provider = new providers.Web3Provider(transport, network);
816
- return provider;
817
- }
818
- async function connectedWalletIsEoA(client, address) {
819
- const code = await client.getCode({ address });
820
- return code == null || code === "0x";
821
- }
822
822
  const GraphAuthKitContext = createContext({
823
823
  openConnectModal() {
824
824
  },