@cometh/connect-react-hooks 0.0.12 → 0.0.13-dev.1
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.cjs +8 -5
- package/dist/index.d.cts +5241 -2
- package/dist/index.d.ts +5241 -2
- package/dist/index.js +8 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -82,8 +82,7 @@ var ConnectContext = _react.createContext.call(void 0, {
|
|
82
82
|
queryClient: void 0,
|
83
83
|
smartAccountClient: null,
|
84
84
|
smartAccountAddress: void 0,
|
85
|
-
updateSmartAccountClient: async () =>
|
86
|
-
},
|
85
|
+
updateSmartAccountClient: async () => null,
|
87
86
|
disconnectSmartAccount: async () => {
|
88
87
|
},
|
89
88
|
networksConfig: void 0
|
@@ -124,8 +123,10 @@ var ConnectProvider = ({
|
|
124
123
|
setSmartAccountClient(client);
|
125
124
|
setSmartAccountAddress(newAddress);
|
126
125
|
localStorage.setItem(CHAIN_STORAGE_KEY, JSON.stringify(chain));
|
126
|
+
return client;
|
127
127
|
} catch (e) {
|
128
128
|
console.log(e);
|
129
|
+
return smartAccountClient;
|
129
130
|
}
|
130
131
|
},
|
131
132
|
[config]
|
@@ -2209,13 +2210,14 @@ var useSwitchChain = () => {
|
|
2209
2210
|
if (!selectedNetwork)
|
2210
2211
|
throw new Error("No current configuration found");
|
2211
2212
|
try {
|
2212
|
-
await updateSmartAccountClient({
|
2213
|
+
const client = await updateSmartAccountClient({
|
2213
2214
|
address: _optionalChain([smartAccountClient, 'optionalAccess', _94 => _94.account, 'access', _95 => _95.address]),
|
2214
2215
|
chain: selectedNetwork.chain
|
2215
2216
|
});
|
2216
2217
|
_optionalChain([queryClient, 'optionalAccess', _96 => _96.invalidateQueries, 'call', _97 => _97({
|
2217
2218
|
queryKey: ["switchChain"]
|
2218
2219
|
})]);
|
2220
|
+
return client;
|
2219
2221
|
} catch (e) {
|
2220
2222
|
throw e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2221
2223
|
}
|
@@ -2231,7 +2233,7 @@ var useSwitchChain = () => {
|
|
2231
2233
|
(params) => {
|
2232
2234
|
setIsPending(true);
|
2233
2235
|
setError(null);
|
2234
|
-
switchChainInternal(params).catch((e) => {
|
2236
|
+
return switchChainInternal(params).catch((e) => {
|
2235
2237
|
const err = e instanceof Error ? e : new Error(
|
2236
2238
|
"An error occurred while switching chain"
|
2237
2239
|
);
|
@@ -2247,7 +2249,8 @@ var useSwitchChain = () => {
|
|
2247
2249
|
setIsPending(true);
|
2248
2250
|
setError(null);
|
2249
2251
|
try {
|
2250
|
-
await switchChainInternal(params);
|
2252
|
+
const client = await switchChainInternal(params);
|
2253
|
+
return client;
|
2251
2254
|
} catch (e) {
|
2252
2255
|
const err = e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2253
2256
|
setError(err);
|