@edgeandnode/graph-auth-kit 2.13.0 → 2.14.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.
@@ -0,0 +1,107 @@
1
+ import { http, createPublicClient, createClient } from "viem";
2
+ import { z } from "zod";
3
+ import { mainnet, sepolia, arbitrum, arbitrumSepolia } from "viem/chains";
4
+ import { injected, coinbaseWallet, walletConnect } from "wagmi/connectors";
5
+ const AUTH_STORAGE_KEY = "thegraph__authstate";
6
+ const MULTISIG_AUTH_STORAGE_KEY = "multisig";
7
+ const L1Chain = mainnet;
8
+ const L1ChainTestnet = sepolia;
9
+ const L2Chain = arbitrum;
10
+ const L2ChainTestnet = arbitrumSepolia;
11
+ const DefChain = L2Chain;
12
+ const SupportedClientChainId = z.union([
13
+ z.literal(L1Chain.id),
14
+ z.literal(L1ChainTestnet.id),
15
+ z.literal(L2Chain.id),
16
+ z.literal(L2ChainTestnet.id)
17
+ ]).readonly();
18
+ const SupportedClientChains = [L2Chain, L2ChainTestnet, L1Chain, L1ChainTestnet];
19
+ const SupportedL1ClientChainId = z.union([z.literal(L1Chain.id), z.literal(L1ChainTestnet.id)]).readonly();
20
+ const SupportedL2ClientChainId = z.union([z.literal(L2Chain.id), z.literal(L2ChainTestnet.id)]).readonly();
21
+ const RequiredInfuraKey = z.object({
22
+ infuraKey: z.string({ required_error: "The Infura Key is required" }).min(1).readonly()
23
+ });
24
+ const RequiredWalletConnectProjectId = z.object({
25
+ walletConnectProjectID: z.string({ required_error: "The WalletConnect Project ID is required" }).min(1).readonly()
26
+ });
27
+ const GraphAuthKitProps = RequiredInfuraKey;
28
+ const GraphAuthKitConnector = z.union([
29
+ z.literal(injected.type),
30
+ z.literal(coinbaseWallet.type),
31
+ z.literal(walletConnect.type),
32
+ z.literal("multisig")
33
+ ]);
34
+ RequiredInfuraKey.extend({
35
+ chain: SupportedClientChainId.optional().nullable().default(DefChain.id)
36
+ });
37
+ function buildInfuraHttpTransport({
38
+ chain = DefChain.id,
39
+ infuraKey
40
+ }) {
41
+ switch (chain) {
42
+ case L1Chain.id: {
43
+ return http(`https://mainnet.infura.io/v3/${infuraKey}`);
44
+ }
45
+ case L1ChainTestnet.id: {
46
+ return http(`https://sepolia.infura.io/v3/${infuraKey}`);
47
+ }
48
+ case L2ChainTestnet.id: {
49
+ return http(`https://arbitrum-sepolia.infura.io/v3/${infuraKey}`);
50
+ }
51
+ default: {
52
+ return http(`https://arbitrum-mainnet.infura.io/v3/${infuraKey}`);
53
+ }
54
+ }
55
+ }
56
+ const BuildPublicClientArgs = RequiredInfuraKey.extend({
57
+ chain: z.custom().optional().default(DefChain)
58
+ });
59
+ function isBuildPublicClientArgs(args) {
60
+ return args != null && typeof args === "object" && typeof args.infuraKey === "string";
61
+ }
62
+ function buildPublicClient({ chain = DefChain, infuraKey }) {
63
+ const transport = buildInfuraHttpTransport({
64
+ chain: chain.id,
65
+ infuraKey
66
+ });
67
+ return createPublicClient({
68
+ chain,
69
+ transport
70
+ });
71
+ }
72
+ const BuildClientArgs = RequiredInfuraKey.extend({
73
+ chain: z.custom().optional().default(DefChain)
74
+ });
75
+ function buildClient({ chain = DefChain, infuraKey }) {
76
+ const transport = buildInfuraHttpTransport({
77
+ chain: chain.id,
78
+ infuraKey
79
+ });
80
+ return createClient({
81
+ chain,
82
+ transport
83
+ });
84
+ }
85
+ export {
86
+ AUTH_STORAGE_KEY as A,
87
+ BuildPublicClientArgs as B,
88
+ DefChain as D,
89
+ GraphAuthKitConnector as G,
90
+ L1Chain as L,
91
+ MULTISIG_AUTH_STORAGE_KEY as M,
92
+ RequiredInfuraKey as R,
93
+ SupportedClientChainId as S,
94
+ L1ChainTestnet as a,
95
+ L2Chain as b,
96
+ buildPublicClient as c,
97
+ buildInfuraHttpTransport as d,
98
+ BuildClientArgs as e,
99
+ buildClient as f,
100
+ L2ChainTestnet as g,
101
+ SupportedClientChains as h,
102
+ isBuildPublicClientArgs as i,
103
+ SupportedL1ClientChainId as j,
104
+ SupportedL2ClientChainId as k,
105
+ RequiredWalletConnectProjectId as l,
106
+ GraphAuthKitProps as m
107
+ };
@@ -326,4 +326,8 @@ export declare const SupportedClientChains: readonly [{
326
326
  serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
327
327
  }];
328
328
  export type SupportedClientChains = (typeof SupportedClientChains)[number];
329
+ export declare const SupportedL1ClientChainId: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<11155111>]>>;
330
+ export type SupportedL1ClientChainId = z.infer<typeof SupportedL1ClientChainId>;
331
+ export declare const SupportedL2ClientChainId: z.ZodReadonly<z.ZodUnion<readonly [z.ZodLiteral<42161>, z.ZodLiteral<421614>]>>;
332
+ export type SupportedL2ClientChainId = z.infer<typeof SupportedL2ClientChainId>;
329
333
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,gBAAgB,uBAAiC,CAAA;AAC9D,eAAO,MAAM,yBAAyB,YAAsB,CAAA;AAE5D,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkBqO,MAAgB;;yBAAyF,MAAgB,qCAAqC,MAAgB;CAlBzY,CAAA;AAC9B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBuO,MAAgB;;yBAAyF,MAAgB,qCAAqC,MAAgB;CAjB3Y,CAAA;AACrC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAemB,MAAgB;;yBACc,MAAgB,qCAAqC,MAAgB;CAhB3G,CAAA;AAC/B,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAe1B,MAAgB;;yBAAyF,MAAgB,qCAAq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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAAU,CAAA;AAE/B,eAAO,MAAM,sBAAsB,0HAOtB,CAAA;AACb,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAC3E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA8D,CAAA;AAChG,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAA;AAC1E,eAAO,MAAM,wBAAwB,+EAExB,CAAA;AACb,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA;AAC/E,eAAO,MAAM,wBAAwB,iFAExB,CAAA;AACb,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAA"}
@@ -0,0 +1,45 @@
1
+ import * as types from './graphql';
2
+ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
3
+ /**
4
+ * Map of all GraphQL operations in the project.
5
+ *
6
+ * This map has several performance disadvantages:
7
+ * 1. It is not tree-shakeable, so it will include all operations in the project.
8
+ * 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
9
+ * 3. It does not support dead code elimination, so it will add unused operations.
10
+ *
11
+ * Therefore it is highly recommended to use the babel or swc plugin for production.
12
+ * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
13
+ */
14
+ declare const documents: {
15
+ '\n query GraphAccount($id: ID!) {\n graphAccount(id: $id) {\n id\n defaultDisplayName\n }\n }\n': DocumentNode<types.GraphAccountQuery, types.Exact<{
16
+ id: types.Scalars["ID"]["input"];
17
+ }>>;
18
+ '\n query GraphAccounts($id_in: [ID!]!) {\n graphAccounts(first: 1000, skip: 0, where: { id_in: $id_in }) {\n id\n defaultDisplayName\n }\n }\n': DocumentNode<types.GraphAccountsQuery, types.Exact<{
19
+ id_in: Array<types.Scalars["ID"]["input"]>;
20
+ }>>;
21
+ };
22
+ /**
23
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
24
+ *
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
29
+ * ```
30
+ *
31
+ * The query argument is unknown!
32
+ * Please regenerate the types.
33
+ */
34
+ export declare function graphql(source: string): unknown;
35
+ /**
36
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
37
+ */
38
+ export declare function graphql(source: '\n query GraphAccount($id: ID!) {\n graphAccount(id: $id) {\n id\n defaultDisplayName\n }\n }\n'): (typeof documents)['\n query GraphAccount($id: ID!) {\n graphAccount(id: $id) {\n id\n defaultDisplayName\n }\n }\n'];
39
+ /**
40
+ * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
41
+ */
42
+ export declare function graphql(source: '\n query GraphAccounts($id_in: [ID!]!) {\n graphAccounts(first: 1000, skip: 0, where: { id_in: $id_in }) {\n id\n defaultDisplayName\n }\n }\n'): (typeof documents)['\n query GraphAccounts($id_in: [ID!]!) {\n graphAccounts(first: 1000, skip: 0, where: { id_in: $id_in }) {\n id\n defaultDisplayName\n }\n }\n'];
43
+ export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
44
+ export {};
45
+ //# sourceMappingURL=gql.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gql.d.ts","sourceRoot":"","sources":["../../../../src/ens/generated/network/gql.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,iBAAiB,IAAI,YAAY,EAAE,MAAM,mCAAmC,CAAA;AAErF;;;;;;;;;;GAUG;AACH,QAAA,MAAM,SAAS;;YAwCkjob,mBAAc;;;qBAAmP,mBAAa;;CAnC90ob,CAAA;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;AAEhD;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,mHAAmH,GAC1H,CAAC,OAAO,SAAS,CAAC,CAAC,mHAAmH,CAAC,CAAA;AAC1I;;GAEG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,kKAAkK,GACzK,CAAC,OAAO,SAAS,CAAC,CAAC,kKAAkK,CAAC,CAAA;AAMzL,MAAM,MAAM,YAAY,CAAC,aAAa,SAAS,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,IACnE,aAAa,SAAS,YAAY,CAAC,MAAM,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,GAAG,KAAK,CAAA"}