@edgeandnode/graph-auth-kit 0.4.3 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export * from './constants';
4
4
  export * from './GraphAuthKit.context';
5
5
  export * from './hooks';
6
6
  export * from './safe';
7
+ export * from './test-harness';
7
8
  export * from './types';
8
9
  export * from './utils';
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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"}
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,gBAAgB,CAAA;AAC9B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
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 { b as createSafe, c as createApiKit, G as GraphAuthKitConnector } from "./utils-BfSaP91v.js";
5
- import { k, A, p, B, D, s, g, h, L, e, M, R, r, a, S, l, q, j, m, o, f, n, d, i } from "./utils-BfSaP91v.js";
6
- import { u as useGraphAuthKitInnerContext, b as clientToProvider } from "./GraphAuthKit.context-BMrdWwq0.js";
7
- import { a as a2, f as f2, c, k as k2, g as g2, i as i2, h as h2, j as j2, e as e2 } from "./GraphAuthKit.context-BMrdWwq0.js";
4
+ import { b as createSafe, c as createApiKit, G as GraphAuthKitConnector } from "./utils-DUSrognp.js";
5
+ import { l, A, j, B, D, s, L, m, n, o, M, R, r, a, S, p, q, k, e, h, f, g, d, i } from "./utils-DUSrognp.js";
6
+ import { u as useGraphAuthKitInnerContext, c as clientToProvider } from "./utils-Foi6fjvf.js";
7
+ import { G, e as e2, M as M2, b, f as f2, k as k2, d as d2, g as g2, i as i2, h as h2, j as j2, a as a2 } from "./utils-Foi6fjvf.js";
8
8
  import { useMutation } from "@tanstack/react-query";
9
9
  import { watchAccount } from "@wagmi/core";
10
10
  import { useMemo, useEffect } from "react";
@@ -512,39 +512,42 @@ function SwitchChain(props) {
512
512
  );
513
513
  }
514
514
  export {
515
- k as AUTH_STORAGE_KEY,
515
+ l as AUTH_STORAGE_KEY,
516
516
  A as ApiKitUrlMap,
517
- p as BuildClientArgs,
517
+ j as BuildClientArgs,
518
518
  B as BuildPublicClientArgs,
519
519
  Connected,
520
520
  D as DefChain,
521
521
  Disconnected,
522
522
  GraphAuthKitConnector,
523
- a2 as GraphAuthKitContext,
523
+ G as GraphAuthKitContext,
524
524
  s as GraphAuthKitProps,
525
- f2 as GraphAuthKitProvider,
526
- g as L1Chain,
527
- h as L1ChainTestnet,
528
- L as L2Chain,
529
- e as L2ChainTestnet,
525
+ e2 as GraphAuthKitProvider,
526
+ L as L1Chain,
527
+ m as L1ChainTestnet,
528
+ n as L2Chain,
529
+ o as L2ChainTestnet,
530
530
  M as MULTISIG_AUTH_STORAGE_KEY,
531
+ M2 as MockGraphAuthKitProvider,
531
532
  R as RequiredInfuraKey,
532
533
  r as RequiredWalletConnectProjectId,
533
534
  a as SafeSupportedNetworkNames,
534
535
  S as SafeSupportedNetworks,
535
- l as SupportedClientChainId,
536
+ p as SupportedClientChainId,
536
537
  q as SupportedClientChains,
537
538
  SwitchChain,
538
- j as buildClient,
539
- m as buildInfuraHttpTransport,
540
- o as buildPublicClient,
541
- c as chainIsSupportedChain,
539
+ k as buildClient,
540
+ e as buildInfuraHttpTransport,
541
+ b as buildMockProviderState,
542
+ h as buildPublicClient,
543
+ f2 as chainIsSupportedChain,
542
544
  clientToProvider,
543
545
  k2 as connectedWalletIsEoA,
544
546
  createApiKit,
545
547
  createSafe,
548
+ d2 as disconnectedMockState,
546
549
  f as fetchOwnedSafes,
547
- n as isBuildPublicClientArgs,
550
+ g as isBuildPublicClientArgs,
548
551
  g2 as isChainL1,
549
552
  i2 as isChainL2,
550
553
  h2 as isChainMainnet,
@@ -553,7 +556,7 @@ export {
553
556
  i as isValidSafe,
554
557
  useAuthAccount,
555
558
  useClientToEthersSigner,
556
- e2 as useGraphAuthKit,
559
+ a2 as useGraphAuthKit,
557
560
  useGraphAuthKitAccount,
558
561
  useGraphAuthKitAccountEffect,
559
562
  useGraphAuthKitConnector,
@@ -1,4 +1,4 @@
1
- import { A, a, S, c, b, f, d, i } from "../utils-BfSaP91v.js";
1
+ import { A, a, S, c, b, f, d, i } from "../utils-DUSrognp.js";
2
2
  export {
3
3
  A as ApiKitUrlMap,
4
4
  a as SafeSupportedNetworkNames,
@@ -1,255 +1,6 @@
1
- import { jsx } from "@theme-ui/core/jsx-runtime";
2
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
- import { createConfig, createStorage, cookieStorage, cookieToInitialState, WagmiProvider, useDisconnect } from "wagmi";
4
- import { mock, injected, coinbaseWallet, walletConnect } from "wagmi/connectors";
5
- import { L as L2Chain, e as L2ChainTestnet, g as L1Chain, h as L1ChainTestnet, D as DefChain, j as buildClient, k as AUTH_STORAGE_KEY, R as RequiredInfuraKey, l as SupportedClientChainId, S as SafeSupportedNetworks } from "../utils-BfSaP91v.js";
6
- import { c as chainIsSupportedChain, G as GraphAuthKitInnerContext, d as defInnerState, u as useGraphAuthKitInnerContext, a as GraphAuthKitContext } from "../GraphAuthKit.context-BMrdWwq0.js";
7
- import { isAddress } from "viem";
8
- import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
9
- import { z } from "zod";
10
- function MockGraphAuthKitProvider(props) {
11
- const mockConfig = createConfig({
12
- chains: [L2Chain, L2ChainTestnet, L1Chain, L1ChainTestnet],
13
- connectors: [mock(props.mockConnectorParams)],
14
- client(params) {
15
- const chain = chainIsSupportedChain(params.chain) ? params.chain : DefChain;
16
- return buildClient({ chain, infuraKey: props.infuraKey });
17
- },
18
- storage: createStorage({
19
- storage: cookieStorage,
20
- key: AUTH_STORAGE_KEY
21
- })
22
- });
23
- const queryClient = new QueryClient({
24
- defaultOptions: {
25
- queries: {
26
- retry: false
27
- }
28
- }
29
- });
30
- const initialState = props.initialState == null ? void 0 : typeof props.initialState === "string" ? cookieToInitialState(mockConfig, props.initialState) : props.initialState;
31
- return /* @__PURE__ */ jsx(WagmiProvider, { config: mockConfig, initialState, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(GraphAuthKitInnerContext.Provider, { value: props.innerCtxState ?? defInnerState, children: /* @__PURE__ */ jsx(MockGraphAuthKitContent, { children: props.children }) }) }) });
32
- }
33
- function MockGraphAuthKitContent({ children }) {
34
- const { disconnect } = useDisconnect();
35
- const innerContext = useGraphAuthKitInnerContext();
36
- return /* @__PURE__ */ jsx(
37
- GraphAuthKitContext.Provider,
38
- {
39
- value: {
40
- openConnectModal(props) {
41
- innerContext._setConnectModalOpen(true);
42
- innerContext._setModalTitle((props == null ? void 0 : props.title) ?? "Connect your wallet");
43
- innerContext._setModalSubtitle(props == null ? void 0 : props.subtitle);
44
- },
45
- closeConnectModal() {
46
- innerContext._setConnectModalOpen(false);
47
- innerContext._reset();
48
- },
49
- disconnect() {
50
- disconnect(
51
- {},
52
- {
53
- onSettled() {
54
- innerContext._reset();
55
- }
56
- }
57
- );
58
- }
59
- },
60
- children
61
- }
62
- );
63
- }
64
- z.union([
65
- RequiredInfuraKey.extend({ status: z.literal("disconnected") }),
66
- RequiredInfuraKey.extend({
67
- status: z.literal("connected"),
68
- account: z.union([
69
- z.object({ type: z.literal("generated") }),
70
- z.object({
71
- type: z.literal("provided"),
72
- /** If the specified connection is with a multisig, this is the multisig address */
73
- address: z.custom((val) => val != null && typeof val === "string" && isAddress(val)),
74
- chain: SupportedClientChainId.optional().default(L2Chain.id),
75
- connector: z.union([
76
- z.object({
77
- type: z.union([
78
- z.literal(injected.type),
79
- z.literal(coinbaseWallet.type),
80
- z.literal(walletConnect.type)
81
- ])
82
- }),
83
- /** If specified as a multsig, provide the EoA and Safe supported chain */
84
- z.object({
85
- type: z.literal("multisig"),
86
- eoa: z.custom((val) => val != null && typeof val === "string" && isAddress(val)),
87
- network: SafeSupportedNetworks.optional().default(L2Chain.id)
88
- })
89
- ])
90
- })
91
- ])
92
- })
93
- ]);
94
- function buildMockProviderState(args) {
95
- if (args.status === "disconnected") {
96
- return {
97
- props: {
98
- infuraKey: args.infuraKey,
99
- initialState: void 0,
100
- innerCtxState: {
101
- ...defInnerState,
102
- _infuraKey: args.infuraKey
103
- },
104
- mockConnectorParams: {
105
- accounts: ["0x"]
106
- }
107
- },
108
- connectedAddress: null,
109
- connector: null,
110
- graphAuthKitConnector: null,
111
- chain: null
112
- };
113
- }
114
- if (args.account.type === "generated") {
115
- const privKey = generatePrivateKey();
116
- const account = privateKeyToAccount(privKey);
117
- const address = account.address;
118
- const connector2 = selectedTypeToMockConnector("injected");
119
- return {
120
- props: {
121
- infuraKey: args.infuraKey,
122
- initialState: {
123
- status: "connected",
124
- chainId: L2Chain.id,
125
- connections: /* @__PURE__ */ new Map([
126
- [
127
- connector2.uid,
128
- {
129
- accounts: [address],
130
- chainId: L2Chain.id,
131
- connector: connector2
132
- }
133
- ]
134
- ]),
135
- current: connector2.uid
136
- },
137
- innerCtxState: {
138
- ...defInnerState,
139
- _infuraKey: args.infuraKey
140
- },
141
- mockConnectorParams: {
142
- accounts: [address]
143
- }
144
- },
145
- connectedAddress: address,
146
- connector: connector2,
147
- graphAuthKitConnector: "injected",
148
- chain: L2Chain.id
149
- };
150
- }
151
- if (args.account.connector.type === "multisig") {
152
- const connector2 = selectedTypeToMockConnector("injected");
153
- return {
154
- props: {
155
- infuraKey: args.infuraKey,
156
- initialState: {
157
- status: "connected",
158
- chainId: args.account.connector.network,
159
- connections: /* @__PURE__ */ new Map([
160
- [
161
- connector2.uid,
162
- {
163
- accounts: [args.account.connector.eoa],
164
- chainId: args.account.connector.network,
165
- connector: connector2
166
- }
167
- ]
168
- ]),
169
- current: connector2.uid
170
- },
171
- innerCtxState: {
172
- ...defInnerState,
173
- _infuraKey: args.infuraKey,
174
- _enteredMultisigInfo: {
175
- address: args.account.address,
176
- network: args.account.connector.network,
177
- enteredSafeIsValid: true
178
- }
179
- },
180
- mockConnectorParams: {
181
- accounts: [args.account.address, args.account.connector.eoa]
182
- }
183
- },
184
- connectedAddress: args.account.address,
185
- connector: connector2,
186
- graphAuthKitConnector: "multisig",
187
- chain: args.account.connector.network
188
- };
189
- }
190
- const connector = selectedTypeToMockConnector(args.account.connector.type);
191
- return {
192
- props: {
193
- infuraKey: args.infuraKey,
194
- initialState: {
195
- status: "connected",
196
- chainId: args.account.chain,
197
- connections: /* @__PURE__ */ new Map([
198
- [
199
- connector.uid,
200
- {
201
- accounts: [args.account.address],
202
- chainId: args.account.chain,
203
- connector
204
- }
205
- ]
206
- ]),
207
- current: connector.uid
208
- },
209
- innerCtxState: {
210
- ...defInnerState,
211
- _infuraKey: args.infuraKey
212
- },
213
- mockConnectorParams: {
214
- accounts: [args.account.address]
215
- }
216
- },
217
- connectedAddress: args.account.address,
218
- connector,
219
- graphAuthKitConnector: args.account.connector.type,
220
- chain: args.account.chain
221
- };
222
- }
223
- const disconnectedMockState = buildMockProviderState({
224
- infuraKey: "doesnotmatter.notconnected",
225
- status: "disconnected"
226
- });
227
- function selectedTypeToMockConnector(connector) {
228
- switch (connector) {
229
- case "coinbaseWallet": {
230
- return {
231
- id: "coinbaseWalletSDK",
232
- name: "Coinbase Wallet",
233
- uid: "192a483cf83",
234
- type: "coinbaseWallet"
235
- };
236
- }
237
- case "walletConnect": {
238
- return {
239
- id: "walletConnect",
240
- name: "WalletConnect",
241
- uid: "92a483cf83b",
242
- type: "walletConnect"
243
- };
244
- }
245
- case "multisig":
246
- default: {
247
- return { id: "io.metamask", name: "MetaMask", type: "injected", uid: "27cbd81134e" };
248
- }
249
- }
250
- }
1
+ import { M, b, d } from "../utils-Foi6fjvf.js";
251
2
  export {
252
- MockGraphAuthKitProvider,
253
- buildMockProviderState,
254
- disconnectedMockState
3
+ M as MockGraphAuthKitProvider,
4
+ b as buildMockProviderState,
5
+ d as disconnectedMockState
255
6
  };
@@ -275,7 +275,7 @@ export {
275
275
  BuildPublicClientArgs as B,
276
276
  DefChain as D,
277
277
  GraphAuthKitConnector as G,
278
- L2Chain as L,
278
+ L1Chain as L,
279
279
  MULTISIG_AUTH_STORAGE_KEY as M,
280
280
  RequiredInfuraKey as R,
281
281
  SafeSupportedNetworks as S,
@@ -283,18 +283,18 @@ export {
283
283
  createSafe as b,
284
284
  createApiKit as c,
285
285
  isSafeOwner as d,
286
- L2ChainTestnet as e,
286
+ buildInfuraHttpTransport as e,
287
287
  fetchOwnedSafes as f,
288
- L1Chain as g,
289
- L1ChainTestnet as h,
288
+ isBuildPublicClientArgs as g,
289
+ buildPublicClient as h,
290
290
  isValidSafe as i,
291
- buildClient as j,
292
- AUTH_STORAGE_KEY as k,
293
- SupportedClientChainId as l,
294
- buildInfuraHttpTransport as m,
295
- isBuildPublicClientArgs as n,
296
- buildPublicClient as o,
297
- BuildClientArgs as p,
291
+ BuildClientArgs as j,
292
+ buildClient as k,
293
+ AUTH_STORAGE_KEY as l,
294
+ L1ChainTestnet as m,
295
+ L2Chain as n,
296
+ L2ChainTestnet as o,
297
+ SupportedClientChainId as p,
298
298
  SupportedClientChains as q,
299
299
  RequiredWalletConnectProjectId as r,
300
300
  GraphAuthKitProps as s
@@ -1,15 +1,16 @@
1
1
  import { jsx, jsxs, Fragment } from "@theme-ui/core/jsx-runtime";
2
2
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
3
- import { createContext, useContext, useRef, useState, useReducer, useEffect } from "react";
4
3
  import { useConfig, useConnect, useDisconnect, useAccountEffect, createConfig, createStorage, cookieStorage, cookieToInitialState, WagmiProvider, useAccount } from "wagmi";
5
- import { injected, walletConnect, coinbaseWallet } from "wagmi/connectors";
4
+ import { injected, walletConnect, coinbaseWallet, mock } from "wagmi/connectors";
5
+ import { S as SafeSupportedNetworks, M as MULTISIG_AUTH_STORAGE_KEY, h as buildPublicClient, n as L2Chain, L as L1Chain, m as L1ChainTestnet, d as isSafeOwner, p as SupportedClientChainId, o as L2ChainTestnet, G as GraphAuthKitConnector, a as SafeSupportedNetworkNames, i as isValidSafe, D as DefChain, k as buildClient, l as AUTH_STORAGE_KEY, R as RequiredInfuraKey } from "./utils-DUSrognp.js";
6
+ import { createContext, useContext, useRef, useState, useReducer, useEffect } from "react";
6
7
  import { Icon, ExperimentalButton, Alert, Divider, Link, ExperimentalSelect, ExperimentalInput, List, ExperimentalModal, ExperimentalLoadingIndicator } from "@edgeandnode/gds";
7
8
  import { isAddress } from "viem";
8
- import { z } from "zod";
9
- import { S as SafeSupportedNetworks, M as MULTISIG_AUTH_STORAGE_KEY, o as buildPublicClient, L as L2Chain, g as L1Chain, h as L1ChainTestnet, d as isSafeOwner, l as SupportedClientChainId, e as L2ChainTestnet, G as GraphAuthKitConnector, a as SafeSupportedNetworkNames, i as isValidSafe, D as DefChain, j as buildClient, k as AUTH_STORAGE_KEY } from "./utils-BfSaP91v.js";
10
9
  import { addrShortener } from "@edgeandnode/common";
11
- import { providers } from "ethers";
10
+ import { z } from "zod";
12
11
  import { NetworkIcon } from "@edgeandnode/go";
12
+ import { providers } from "ethers";
13
+ import { generatePrivateKey, privateKeyToAccount } from "viem/accounts";
13
14
  const MultisigErrorMap = {
14
15
  INVALID_SIGNER: {
15
16
  title: "Signer Wallet is Invalid",
@@ -887,14 +888,256 @@ function GraphAuthKitContent({ children }) {
887
888
  }
888
889
  );
889
890
  }
891
+ function MockGraphAuthKitProvider(props) {
892
+ const mockConfig = createConfig({
893
+ chains: [L2Chain, L2ChainTestnet, L1Chain, L1ChainTestnet],
894
+ connectors: [mock(props.mockConnectorParams)],
895
+ client(params) {
896
+ const chain = chainIsSupportedChain(params.chain) ? params.chain : DefChain;
897
+ return buildClient({ chain, infuraKey: props.infuraKey });
898
+ },
899
+ storage: createStorage({
900
+ storage: cookieStorage,
901
+ key: AUTH_STORAGE_KEY
902
+ })
903
+ });
904
+ const queryClient = new QueryClient({
905
+ defaultOptions: {
906
+ queries: {
907
+ retry: false
908
+ }
909
+ }
910
+ });
911
+ const initialState = props.initialState == null ? void 0 : typeof props.initialState === "string" ? cookieToInitialState(mockConfig, props.initialState) : props.initialState;
912
+ return /* @__PURE__ */ jsx(WagmiProvider, { config: mockConfig, initialState, children: /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(GraphAuthKitInnerContext.Provider, { value: props.innerCtxState ?? defInnerState, children: /* @__PURE__ */ jsx(MockGraphAuthKitContent, { children: props.children }) }) }) });
913
+ }
914
+ function MockGraphAuthKitContent({ children }) {
915
+ const { disconnect } = useDisconnect();
916
+ const innerContext = useGraphAuthKitInnerContext();
917
+ return /* @__PURE__ */ jsx(
918
+ GraphAuthKitContext.Provider,
919
+ {
920
+ value: {
921
+ openConnectModal(props) {
922
+ innerContext._setConnectModalOpen(true);
923
+ innerContext._setModalTitle((props == null ? void 0 : props.title) ?? "Connect your wallet");
924
+ innerContext._setModalSubtitle(props == null ? void 0 : props.subtitle);
925
+ },
926
+ closeConnectModal() {
927
+ innerContext._setConnectModalOpen(false);
928
+ innerContext._reset();
929
+ },
930
+ disconnect() {
931
+ disconnect(
932
+ {},
933
+ {
934
+ onSettled() {
935
+ innerContext._reset();
936
+ }
937
+ }
938
+ );
939
+ }
940
+ },
941
+ children
942
+ }
943
+ );
944
+ }
945
+ z.union([
946
+ RequiredInfuraKey.extend({ status: z.literal("disconnected") }),
947
+ RequiredInfuraKey.extend({
948
+ status: z.literal("connected"),
949
+ account: z.union([
950
+ z.object({ type: z.literal("generated") }),
951
+ z.object({
952
+ type: z.literal("provided"),
953
+ /** If the specified connection is with a multisig, this is the multisig address */
954
+ address: z.custom((val) => val != null && typeof val === "string" && isAddress(val)),
955
+ chain: SupportedClientChainId.optional().default(L2Chain.id),
956
+ connector: z.union([
957
+ z.object({
958
+ type: z.union([
959
+ z.literal(injected.type),
960
+ z.literal(coinbaseWallet.type),
961
+ z.literal(walletConnect.type)
962
+ ])
963
+ }),
964
+ /** If specified as a multsig, provide the EoA and Safe supported chain */
965
+ z.object({
966
+ type: z.literal("multisig"),
967
+ eoa: z.custom((val) => val != null && typeof val === "string" && isAddress(val)),
968
+ network: SafeSupportedNetworks.optional().default(L2Chain.id)
969
+ })
970
+ ])
971
+ })
972
+ ])
973
+ })
974
+ ]);
975
+ function buildMockProviderState(args) {
976
+ if (args.status === "disconnected") {
977
+ return {
978
+ props: {
979
+ infuraKey: args.infuraKey,
980
+ initialState: void 0,
981
+ innerCtxState: {
982
+ ...defInnerState,
983
+ _infuraKey: args.infuraKey
984
+ },
985
+ mockConnectorParams: {
986
+ accounts: ["0x"]
987
+ }
988
+ },
989
+ connectedAddress: null,
990
+ connector: null,
991
+ graphAuthKitConnector: null,
992
+ chain: null
993
+ };
994
+ }
995
+ if (args.account.type === "generated") {
996
+ const privKey = generatePrivateKey();
997
+ const account = privateKeyToAccount(privKey);
998
+ const address = account.address;
999
+ const connector2 = selectedTypeToMockConnector("injected");
1000
+ return {
1001
+ props: {
1002
+ infuraKey: args.infuraKey,
1003
+ initialState: {
1004
+ status: "connected",
1005
+ chainId: L2Chain.id,
1006
+ connections: /* @__PURE__ */ new Map([
1007
+ [
1008
+ connector2.uid,
1009
+ {
1010
+ accounts: [address],
1011
+ chainId: L2Chain.id,
1012
+ connector: connector2
1013
+ }
1014
+ ]
1015
+ ]),
1016
+ current: connector2.uid
1017
+ },
1018
+ innerCtxState: {
1019
+ ...defInnerState,
1020
+ _infuraKey: args.infuraKey
1021
+ },
1022
+ mockConnectorParams: {
1023
+ accounts: [address]
1024
+ }
1025
+ },
1026
+ connectedAddress: address,
1027
+ connector: connector2,
1028
+ graphAuthKitConnector: "injected",
1029
+ chain: L2Chain.id
1030
+ };
1031
+ }
1032
+ if (args.account.connector.type === "multisig") {
1033
+ const connector2 = selectedTypeToMockConnector("injected");
1034
+ return {
1035
+ props: {
1036
+ infuraKey: args.infuraKey,
1037
+ initialState: {
1038
+ status: "connected",
1039
+ chainId: args.account.connector.network,
1040
+ connections: /* @__PURE__ */ new Map([
1041
+ [
1042
+ connector2.uid,
1043
+ {
1044
+ accounts: [args.account.connector.eoa],
1045
+ chainId: args.account.connector.network,
1046
+ connector: connector2
1047
+ }
1048
+ ]
1049
+ ]),
1050
+ current: connector2.uid
1051
+ },
1052
+ innerCtxState: {
1053
+ ...defInnerState,
1054
+ _infuraKey: args.infuraKey,
1055
+ _enteredMultisigInfo: {
1056
+ address: args.account.address,
1057
+ network: args.account.connector.network,
1058
+ enteredSafeIsValid: true
1059
+ }
1060
+ },
1061
+ mockConnectorParams: {
1062
+ accounts: [args.account.address, args.account.connector.eoa]
1063
+ }
1064
+ },
1065
+ connectedAddress: args.account.address,
1066
+ connector: connector2,
1067
+ graphAuthKitConnector: "multisig",
1068
+ chain: args.account.connector.network
1069
+ };
1070
+ }
1071
+ const connector = selectedTypeToMockConnector(args.account.connector.type);
1072
+ return {
1073
+ props: {
1074
+ infuraKey: args.infuraKey,
1075
+ initialState: {
1076
+ status: "connected",
1077
+ chainId: args.account.chain,
1078
+ connections: /* @__PURE__ */ new Map([
1079
+ [
1080
+ connector.uid,
1081
+ {
1082
+ accounts: [args.account.address],
1083
+ chainId: args.account.chain,
1084
+ connector
1085
+ }
1086
+ ]
1087
+ ]),
1088
+ current: connector.uid
1089
+ },
1090
+ innerCtxState: {
1091
+ ...defInnerState,
1092
+ _infuraKey: args.infuraKey
1093
+ },
1094
+ mockConnectorParams: {
1095
+ accounts: [args.account.address]
1096
+ }
1097
+ },
1098
+ connectedAddress: args.account.address,
1099
+ connector,
1100
+ graphAuthKitConnector: args.account.connector.type,
1101
+ chain: args.account.chain
1102
+ };
1103
+ }
1104
+ const disconnectedMockState = buildMockProviderState({
1105
+ infuraKey: "doesnotmatter.notconnected",
1106
+ status: "disconnected"
1107
+ });
1108
+ function selectedTypeToMockConnector(connector) {
1109
+ switch (connector) {
1110
+ case "coinbaseWallet": {
1111
+ return {
1112
+ id: "coinbaseWalletSDK",
1113
+ name: "Coinbase Wallet",
1114
+ uid: "192a483cf83",
1115
+ type: "coinbaseWallet"
1116
+ };
1117
+ }
1118
+ case "walletConnect": {
1119
+ return {
1120
+ id: "walletConnect",
1121
+ name: "WalletConnect",
1122
+ uid: "92a483cf83b",
1123
+ type: "walletConnect"
1124
+ };
1125
+ }
1126
+ case "multisig":
1127
+ default: {
1128
+ return { id: "io.metamask", name: "MetaMask", type: "injected", uid: "27cbd81134e" };
1129
+ }
1130
+ }
1131
+ }
890
1132
  export {
891
- GraphAuthKitInnerContext as G,
892
- GraphAuthKitContext as a,
893
- clientToProvider as b,
894
- chainIsSupportedChain as c,
895
- defInnerState as d,
896
- useGraphAuthKit as e,
897
- GraphAuthKitProvider as f,
1133
+ GraphAuthKitContext as G,
1134
+ MockGraphAuthKitProvider as M,
1135
+ useGraphAuthKit as a,
1136
+ buildMockProviderState as b,
1137
+ clientToProvider as c,
1138
+ disconnectedMockState as d,
1139
+ GraphAuthKitProvider as e,
1140
+ chainIsSupportedChain as f,
898
1141
  isChainL1 as g,
899
1142
  isChainMainnet as h,
900
1143
  isChainL2 as i,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgeandnode/graph-auth-kit",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "private": false,
5
5
  "description": "Wallet authentication connect kit in The Graph suite of applications",
6
6
  "author": "Edge & Node",
@@ -69,8 +69,8 @@
69
69
  "viem": "2.19.3",
70
70
  "wagmi": "2.12.5",
71
71
  "@edgeandnode/common": "^6.18.0",
72
- "@edgeandnode/go": "^6.42.0",
73
72
  "@edgeandnode/gds": "^5.27.0",
73
+ "@edgeandnode/go": "^6.42.0",
74
74
  "@edgeandnode/test-utils": "^2.0.0"
75
75
  },
76
76
  "dependencies": {