@edgeandnode/graph-auth-kit 6.1.1-gau-add-usepollsafetransaction-1739537269810-173707a9b7a2f0057f7fdefde5326859c440878e → 6.1.1-gau-add-usewaitforsafetransaction-1739825153307-ae65380841053846f20df847aa95081441d5b125

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.js CHANGED
@@ -1,12 +1,13 @@
1
1
  "use client";
2
- import { m, A, k, B, D, v, G, L, n, o, p, M, O, R, u, a, S, q, r, s, t, l, g, j, c, b, f, h, e, i, d } from "./utils-DP_AxKkW.js";
3
- import { G as G2, a as a2, M as M2, b as b2, d as d2, u as u2 } from "./utils-C_72bAxT.js";
4
- import { d as useGraphAuthKitAccount, e as useGraphAuthKitConnector } from "./useGraphAuthKitEnsNames-8d-_Qd5D.js";
5
- import { g as g2, f as f2, i as i2, u as u3, a as a3, b as b3, c as c2, j as j2, k as k2, h as h2, l as l2 } from "./useGraphAuthKitEnsNames-8d-_Qd5D.js";
6
- import { c as c3, f as f3, g as g3, b as b4, a as a4, d as d3, e as e2, i as i3, m as m2 } from "./GraphAuthKitInner.context-DkY5ODsb.js";
2
+ import { m, A, k, B, D, v, G, L, n, o, p, M, O, R, u, a, S, q, r, s, t, l, g, j, w, H, I, c, b, f, h, C, z, E, F, e, i, x, d, y } from "./GraphAuthKitInner.context-B8vsvUDy.js";
3
+ import { G as G2, a as a2, M as M2, b as b2, d as d2, u as u2 } from "./utils-DuHz-YHi.js";
4
+ import { a as useGraphAuthKitAccount, b as useGraphAuthKitConnector } from "./hooks-ClXeFY-j.js";
5
+ import { d as d3, c as c2, e as e2, f as f2, g as g2, u as u3 } from "./hooks-ClXeFY-j.js";
6
+ import { g as g3, u as u4, w as w2 } from "./useWaitForSafeTransaction-D4k3ZLSB.js";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Alert, ExperimentalButton } from "@edgeandnode/gds";
9
9
  import { useConfig, useSwitchChain } from "wagmi";
10
+ import { u as u5, a as a3, b as b3, c as c3 } from "./useGraphAuthKitEnsNames-BEajLdia.js";
10
11
  function Connected({ children }) {
11
12
  const account = useGraphAuthKitAccount();
12
13
  const connector = useGraphAuthKitConnector();
@@ -101,35 +102,37 @@ export {
101
102
  g as buildInfuraHttpTransport,
102
103
  b2 as buildMockProviderState,
103
104
  j as buildPublicClient,
104
- c3 as chainIsSupportedChain,
105
- f3 as clientToProvider,
106
- g3 as connectedWalletIsEoA,
105
+ w as chainIsSupportedChain,
106
+ H as clientToProvider,
107
+ I as connectedWalletIsEoA,
107
108
  c as createApiKit,
108
109
  b as createSafe,
109
110
  d2 as disconnectedMockState,
110
111
  f as fetchOwnedSafes,
112
+ g3 as getSafeTransaction,
111
113
  h as isBuildPublicClientArgs,
112
- b4 as isChainL1,
113
- a4 as isChainL2,
114
- d3 as isChainMainnet,
115
- e2 as isChainTestnet,
114
+ C as isChainL1,
115
+ z as isChainL2,
116
+ E as isChainMainnet,
117
+ F as isChainTestnet,
116
118
  e as isSafeOwner,
117
119
  i as isSafeSupportedNetwork,
118
- i3 as isSupportedChainId,
120
+ x as isSupportedChainId,
119
121
  d as isValidSafe,
120
- m2 as mapChainIdToChain,
121
- g2 as useAuthAccount,
122
- f2 as useClientToEthersSigner,
122
+ y as mapChainIdToChain,
123
+ d3 as useAuthAccount,
124
+ c2 as useClientToEthersSigner,
123
125
  u2 as useGraphAuthKit,
124
126
  useGraphAuthKitAccount,
125
- i2 as useGraphAuthKitAccountEffect,
126
- u3 as useGraphAuthKitAvatar,
127
+ e2 as useGraphAuthKitAccountEffect,
128
+ u5 as useGraphAuthKitAvatar,
127
129
  a3 as useGraphAuthKitAvatars,
128
130
  useGraphAuthKitConnector,
129
131
  b3 as useGraphAuthKitEnsName,
130
- c2 as useGraphAuthKitEnsNames,
131
- j2 as useGraphAuthKitWalletClient,
132
- k2 as useGraphAuthKitWriteContract,
133
- h2 as useMultisigInfo,
134
- l2 as usePollSafeTransaction
132
+ c3 as useGraphAuthKitEnsNames,
133
+ f2 as useGraphAuthKitWalletClient,
134
+ g2 as useGraphAuthKitWriteContract,
135
+ u3 as useMultisigInfo,
136
+ u4 as useWaitForSafeTransaction,
137
+ w2 as waitForSafeTransation
135
138
  };
@@ -1,3 +1,4 @@
1
1
  export * from './constants';
2
+ export * from './useWaitForSafeTransaction';
2
3
  export * from './utils';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/safe/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/safe/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,6BAA6B,CAAA;AAC3C,cAAc,SAAS,CAAA"}
@@ -1,4 +1,5 @@
1
- import { A, a, S, c, b, f, e, i, d } from "../utils-DP_AxKkW.js";
1
+ import { A, a, S, c, b, f, e, i, d } from "../GraphAuthKitInner.context-B8vsvUDy.js";
2
+ import { g, u, w } from "../useWaitForSafeTransaction-D4k3ZLSB.js";
2
3
  export {
3
4
  A as ApiKitUrlMap,
4
5
  a as SafeSupportedNetworkNames,
@@ -6,7 +7,10 @@ export {
6
7
  c as createApiKit,
7
8
  b as createSafe,
8
9
  f as fetchOwnedSafes,
10
+ g as getSafeTransaction,
9
11
  e as isSafeOwner,
10
12
  i as isSafeSupportedNetwork,
11
- d as isValidSafe
13
+ d as isValidSafe,
14
+ u as useWaitForSafeTransaction,
15
+ w as waitForSafeTransation
12
16
  };
@@ -0,0 +1,9 @@
1
+ import { SafeMultisigTransactionResponse } from '@safe-global/types-kit';
2
+ import { Config, ResolvedRegister } from 'wagmi';
3
+ import { SafeSupportedNetworks } from './constants';
4
+ export declare function getSafeTransaction(safeTxHash: string, network: SafeSupportedNetworks): Promise<SafeMultisigTransactionResponse>;
5
+ export declare function waitForSafeTransation(safeTxHash: string, network: SafeSupportedNetworks, pollingInterval?: number): Promise<SafeMultisigTransactionResponse>;
6
+ export declare function useWaitForSafeTransaction<const config extends Config = ResolvedRegister['config']>({ safeTxHash, }: {
7
+ safeTxHash: string | undefined;
8
+ }): import('@tanstack/react-query').UseQueryResult<SafeMultisigTransactionResponse | undefined, Error>;
9
+ //# sourceMappingURL=useWaitForSafeTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useWaitForSafeTransaction.d.ts","sourceRoot":"","sources":["../../src/safe/useWaitForSafeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAA;AAE7E,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,gBAAgB,EAAa,MAAM,OAAO,CAAA;AAIrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAGnD,wBAAsB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,4CAI1F;AAED,wBAAsB,qBAAqB,CACzC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,qBAAqB,EAC9B,eAAe,GAAE,MAAc,4CAWhC;AAED,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,MAAM,SAAS,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,EAAE,EAClG,UAAU,GACX,EAAE;IACD,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAC/B,sGAiBA"}
@@ -1,4 +1,4 @@
1
- import { M, b, d } from "../utils-C_72bAxT.js";
1
+ import { M, b, d } from "../utils-DuHz-YHi.js";
2
2
  export {
3
3
  M as MockGraphAuthKitProvider,
4
4
  b as buildMockProviderState,
@@ -0,0 +1,211 @@
1
+ "use client";
2
+ import { createIdenticon } from "@edgeandnode/gds";
3
+ import { getEnsAvatarQueryKey, getEnsNameQueryKey } from "@wagmi/core/query";
4
+ import { useQuery } from "wagmi/query";
5
+ import { J as useGraphAuthKitInnerContext, x as isSupportedChainId, o as L2Chain, n as L1ChainTestnet, p as L2ChainTestnet, L as L1Chain } from "./GraphAuthKitInner.context-B8vsvUDy.js";
6
+ import { a as useGraphAuthKitAccount } from "./hooks-ClXeFY-j.js";
7
+ import { useChainId } from "wagmi";
8
+ function useGraphAuthKitAvatar(args = {}) {
9
+ const innerCtx = useGraphAuthKitInnerContext();
10
+ const account = useGraphAuthKitAccount();
11
+ const address = args.address || account.address || void 0;
12
+ const chain = args.chain != null ? args.chain : account.chainId != null && isSupportedChainId(account.chainId) ? account.chainId : L2Chain.id;
13
+ return useQuery({
14
+ queryKey: getEnsAvatarQueryKey({
15
+ chainId: chain,
16
+ blockTag: "latest",
17
+ name: address
18
+ }),
19
+ async queryFn() {
20
+ if (address == null) {
21
+ return createIdenticon("0x0000000000000000000000000000000000000000");
22
+ }
23
+ const avatar = await innerCtx._ensResolver.resolveAvatar({
24
+ ...args,
25
+ address,
26
+ chain
27
+ });
28
+ return avatar || createIdenticon(address);
29
+ }
30
+ });
31
+ }
32
+ function useGraphAuthKitAvatars(args) {
33
+ const innerCtx = useGraphAuthKitInnerContext();
34
+ const account = useGraphAuthKitAccount();
35
+ const chain = args.chain != null ? args.chain : account.chainId != null && isSupportedChainId(account.chainId) ? account.chainId : L2Chain.id;
36
+ return useQuery({
37
+ queryKey: getAvatarsBatchQueryKey({
38
+ chainId: chain,
39
+ blockTag: "latest",
40
+ addresses: args.addresses
41
+ }),
42
+ async queryFn() {
43
+ if (args.addresses.length === 0) {
44
+ return {};
45
+ }
46
+ const map = await innerCtx._ensResolver.resolveAvatarsBatch({
47
+ ...args,
48
+ addresses: args.addresses,
49
+ chain
50
+ });
51
+ return Object.entries(map).reduce((accum, [addr, avatar]) => {
52
+ accum[addr] = avatar || createIdenticon(addr);
53
+ return accum;
54
+ }, map);
55
+ }
56
+ });
57
+ }
58
+ function filterQueryOptions$1(options) {
59
+ const {
60
+ // import('@tanstack/query-core').QueryOptions
61
+ _defaulted,
62
+ behavior,
63
+ gcTime,
64
+ initialData,
65
+ initialDataUpdatedAt,
66
+ maxPages,
67
+ meta,
68
+ networkMode,
69
+ queryFn,
70
+ queryHash,
71
+ queryKey,
72
+ queryKeyHashFn,
73
+ retry,
74
+ retryDelay,
75
+ structuralSharing,
76
+ // import('@tanstack/query-core').InfiniteQueryObserverOptions
77
+ getPreviousPageParam,
78
+ getNextPageParam,
79
+ initialPageParam,
80
+ // import('@tanstack/react-query').UseQueryOptions
81
+ _optimisticResults,
82
+ enabled,
83
+ notifyOnChangeProps,
84
+ placeholderData,
85
+ refetchInterval,
86
+ refetchIntervalInBackground,
87
+ refetchOnMount,
88
+ refetchOnReconnect,
89
+ refetchOnWindowFocus,
90
+ retryOnMount,
91
+ select,
92
+ staleTime,
93
+ suspense,
94
+ throwOnError,
95
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
96
+ // wagmi
97
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
98
+ config,
99
+ connector,
100
+ query,
101
+ ...rest
102
+ } = options;
103
+ return rest;
104
+ }
105
+ function getAvatarsBatchQueryKey(options = { addresses: [] }) {
106
+ return ["ensAvatars", filterQueryOptions$1(options)];
107
+ }
108
+ function useGraphAuthKitEnsName(args = {}) {
109
+ const innerCtx = useGraphAuthKitInnerContext();
110
+ const chainId = useChainId();
111
+ const account = useGraphAuthKitAccount();
112
+ const address = args.address || account.address || void 0;
113
+ const testnet = args.testnet ?? (chainId === L1ChainTestnet.id || chainId === L2ChainTestnet.id);
114
+ return useQuery({
115
+ queryKey: getEnsNameQueryKey({
116
+ chainId: testnet ? L1ChainTestnet.id : L1Chain.id,
117
+ blockTag: "latest",
118
+ address
119
+ }),
120
+ async queryFn() {
121
+ if (address == null) {
122
+ return null;
123
+ }
124
+ return await innerCtx._ensResolver.resolveEnsName({
125
+ ...args,
126
+ address,
127
+ testnet
128
+ });
129
+ },
130
+ enabled: args.address != null
131
+ });
132
+ }
133
+ function useGraphAuthKitEnsNames(args) {
134
+ const innerCtx = useGraphAuthKitInnerContext();
135
+ const chainId = useChainId();
136
+ const testnet = args.testnet ?? (chainId === L1ChainTestnet.id || chainId === L2ChainTestnet.id);
137
+ return useQuery({
138
+ queryKey: getEnsNamesBatchQueryKey({
139
+ chainId: testnet ? L1ChainTestnet.id : L1Chain.id,
140
+ blockTag: "latest",
141
+ addresses: args.addresses
142
+ }),
143
+ async queryFn() {
144
+ if (args.addresses.length === 0) {
145
+ return {};
146
+ }
147
+ return await innerCtx._ensResolver.resolveEnsNamesBatch({
148
+ ...args,
149
+ addresses: args.addresses,
150
+ testnet
151
+ });
152
+ },
153
+ enabled: args.addresses.length > 0
154
+ });
155
+ }
156
+ function filterQueryOptions(options) {
157
+ const {
158
+ // import('@tanstack/query-core').QueryOptions
159
+ _defaulted,
160
+ behavior,
161
+ gcTime,
162
+ initialData,
163
+ initialDataUpdatedAt,
164
+ maxPages,
165
+ meta,
166
+ networkMode,
167
+ queryFn,
168
+ queryHash,
169
+ queryKey,
170
+ queryKeyHashFn,
171
+ retry,
172
+ retryDelay,
173
+ structuralSharing,
174
+ // import('@tanstack/query-core').InfiniteQueryObserverOptions
175
+ getPreviousPageParam,
176
+ getNextPageParam,
177
+ initialPageParam,
178
+ // import('@tanstack/react-query').UseQueryOptions
179
+ _optimisticResults,
180
+ enabled,
181
+ notifyOnChangeProps,
182
+ placeholderData,
183
+ refetchInterval,
184
+ refetchIntervalInBackground,
185
+ refetchOnMount,
186
+ refetchOnReconnect,
187
+ refetchOnWindowFocus,
188
+ retryOnMount,
189
+ select,
190
+ staleTime,
191
+ suspense,
192
+ throwOnError,
193
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
194
+ // wagmi
195
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
196
+ config,
197
+ connector,
198
+ query,
199
+ ...rest
200
+ } = options;
201
+ return rest;
202
+ }
203
+ function getEnsNamesBatchQueryKey(options = { addresses: [] }) {
204
+ return ["ensName", filterQueryOptions(options)];
205
+ }
206
+ export {
207
+ useGraphAuthKitAvatars as a,
208
+ useGraphAuthKitEnsName as b,
209
+ useGraphAuthKitEnsNames as c,
210
+ useGraphAuthKitAvatar as u
211
+ };
@@ -0,0 +1,44 @@
1
+ import { useQuery } from "@tanstack/react-query";
2
+ import { useConfig } from "wagmi";
3
+ import { u as useMultisigInfo } from "./hooks-ClXeFY-j.js";
4
+ import { c as createApiKit } from "./GraphAuthKitInner.context-B8vsvUDy.js";
5
+ async function getSafeTransaction(safeTxHash, network) {
6
+ const apiKit = await createApiKit(network);
7
+ const txDetails = await apiKit.getTransaction(safeTxHash);
8
+ return txDetails;
9
+ }
10
+ async function waitForSafeTransation(safeTxHash, network, pollingInterval = 4e3) {
11
+ return new Promise((resolve) => {
12
+ const poll = async () => {
13
+ const txDetails = await getSafeTransaction(safeTxHash, network);
14
+ if (txDetails.transactionHash) {
15
+ resolve(txDetails);
16
+ } else setTimeout(poll, pollingInterval);
17
+ };
18
+ void poll();
19
+ });
20
+ }
21
+ function useWaitForSafeTransaction({
22
+ safeTxHash
23
+ }) {
24
+ const config = useConfig();
25
+ const _enteredMultisigInfo = useMultisigInfo();
26
+ return useQuery({
27
+ queryKey: ["SafeMultisigTransactionResponse", safeTxHash],
28
+ queryFn: async () => {
29
+ if (!_enteredMultisigInfo || !safeTxHash) return;
30
+ const txDetails = await waitForSafeTransation(
31
+ safeTxHash,
32
+ _enteredMultisigInfo.network,
33
+ config.getClient().pollingInterval
34
+ );
35
+ return txDetails;
36
+ },
37
+ enabled: _enteredMultisigInfo != null && safeTxHash != null
38
+ });
39
+ }
40
+ export {
41
+ getSafeTransaction as g,
42
+ useWaitForSafeTransaction as u,
43
+ waitForSafeTransation as w
44
+ };
@@ -3,10 +3,9 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
3
  import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
4
  import { useConfig, WagmiProvider, useDisconnect, createConfig, createStorage, cookieStorage, cookieToInitialState } from "wagmi";
5
5
  import { injected, walletConnect, coinbaseWallet, mock } from "wagmi/connectors";
6
- import { v as GraphAuthKitConnector, o as L2Chain, a as SafeSupportedNetworkNames, j as buildPublicClient, L as L1Chain, n as L1ChainTestnet, d as isValidSafe, S as SafeSupportedNetworks, p as L2ChainTestnet, m as AUTH_STORAGE_KEY, D as DefChain, l as buildClient, R as RequiredInfuraKey, O as OptionalGatewayApiKey, q as SupportedClientChainId } from "./utils-DP_AxKkW.js";
6
+ import { J as useGraphAuthKitInnerContext, v as GraphAuthKitConnector, o as L2Chain, a as SafeSupportedNetworkNames, j as buildPublicClient, L as L1Chain, n as L1ChainTestnet, d as isValidSafe, S as SafeSupportedNetworks, N as GraphAuthKitInnerContextProvider, p as L2ChainTestnet, m as AUTH_STORAGE_KEY, w as chainIsSupportedChain, D as DefChain, l as buildClient, P as GraphAuthKitInnerContext, Q as defInnerState, R as RequiredInfuraKey, O as OptionalGatewayApiKey, q as SupportedClientChainId } from "./GraphAuthKitInner.context-B8vsvUDy.js";
7
7
  import { useState, useReducer, useId, useEffect, createContext, useContext } from "react";
8
8
  import { Icon, ExperimentalModal, ExperimentalButton, Alert, Link, ExperimentalLoadingIndicator, ExperimentalSelect, ExperimentalInput, Divider, List } from "@edgeandnode/gds";
9
- import { u as useGraphAuthKitInnerContext, G as GraphAuthKitInnerContextProvider, c as chainIsSupportedChain, h as GraphAuthKitInnerContext, j as defInnerState } from "./GraphAuthKitInner.context-DkY5ODsb.js";
10
9
  import { addrShortener } from "@edgeandnode/common";
11
10
  import { isAddress } from "viem";
12
11
  import { NetworkIcon } from "@edgeandnode/go";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@edgeandnode/graph-auth-kit",
3
3
  "private": false,
4
- "version": "6.1.1-gau-add-usepollsafetransaction-1739537269810-173707a9b7a2f0057f7fdefde5326859c440878e",
4
+ "version": "6.1.1-gau-add-usewaitforsafetransaction-1739825153307-ae65380841053846f20df847aa95081441d5b125",
5
5
  "description": "Wallet authentication connect kit in The Graph suite of applications",
6
6
  "author": "Edge & Node",
7
7
  "license": "UNLICENSED",
@@ -55,8 +55,8 @@
55
55
  "viem": "^2.21",
56
56
  "wagmi": "^2.12",
57
57
  "@edgeandnode/common": "^7.0.1",
58
- "@edgeandnode/ens": "^2.1.0",
59
58
  "@edgeandnode/gds": "^6.3.0",
59
+ "@edgeandnode/ens": "^2.1.0",
60
60
  "@edgeandnode/go": "^9.1.0"
61
61
  },
62
62
  "devDependencies": {