@cometh/connect-react-hooks 0.0.9 → 0.0.11-dev.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +147 -36
- package/dist/index.d.cts +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +115 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
@@ -77,6 +77,7 @@ async function createSmartAccount(config) {
|
|
77
77
|
|
78
78
|
|
79
79
|
var _react = require('react'); var React2 = _interopRequireWildcard(_react); var React3 = _interopRequireWildcard(_react); var React4 = _interopRequireWildcard(_react); var React5 = _interopRequireWildcard(_react); var React6 = _interopRequireWildcard(_react); var React7 = _interopRequireWildcard(_react);
|
80
|
+
var CHAIN_STORAGE_KEY = "currentChain";
|
80
81
|
var ConnectContext = _react.createContext.call(void 0, {
|
81
82
|
queryClient: void 0,
|
82
83
|
smartAccountClient: null,
|
@@ -84,7 +85,8 @@ var ConnectContext = _react.createContext.call(void 0, {
|
|
84
85
|
updateSmartAccountClient: async () => {
|
85
86
|
},
|
86
87
|
disconnectSmartAccount: async () => {
|
87
|
-
}
|
88
|
+
},
|
89
|
+
networksConfig: void 0
|
88
90
|
});
|
89
91
|
var ConnectProvider = ({
|
90
92
|
children,
|
@@ -95,9 +97,21 @@ var ConnectProvider = ({
|
|
95
97
|
const [smartAccountAddress, setSmartAccountAddress] = _react.useState.call(void 0, void 0);
|
96
98
|
const updateSmartAccountClient = _react.useCallback.call(void 0,
|
97
99
|
async (params = {}) => {
|
100
|
+
const chain = _nullishCoalesce(_nullishCoalesce(params.chain, () => ( JSON.parse(_nullishCoalesce(localStorage.getItem(CHAIN_STORAGE_KEY), () => ( "null"))))), () => ( config.networksConfig[0].chain));
|
101
|
+
const bundlerUrl = _optionalChain([config, 'access', _2 => _2.networksConfig, 'access', _3 => _3.find, 'call', _4 => _4(
|
102
|
+
(network) => _optionalChain([network, 'access', _5 => _5.chain, 'optionalAccess', _6 => _6.id]) === chain.id
|
103
|
+
), 'optionalAccess', _7 => _7.bundlerUrl]);
|
104
|
+
const paymasterUrl = _optionalChain([config, 'access', _8 => _8.networksConfig, 'access', _9 => _9.find, 'call', _10 => _10(
|
105
|
+
(network) => _optionalChain([network, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.id]) === chain.id
|
106
|
+
), 'optionalAccess', _13 => _13.paymasterUrl]);
|
107
|
+
if (!bundlerUrl || !paymasterUrl)
|
108
|
+
throw new Error("Bundler or paymaster url not found");
|
98
109
|
try {
|
99
110
|
const { client, address: newAddress } = await createSmartAccount({
|
100
111
|
...config,
|
112
|
+
chain,
|
113
|
+
bundlerUrl,
|
114
|
+
paymasterUrl,
|
101
115
|
smartAccountAddress: params.address,
|
102
116
|
comethSignerConfig: {
|
103
117
|
...config.comethSignerConfig,
|
@@ -106,6 +120,7 @@ var ConnectProvider = ({
|
|
106
120
|
});
|
107
121
|
setSmartAccountClient(client);
|
108
122
|
setSmartAccountAddress(newAddress);
|
123
|
+
localStorage.setItem(CHAIN_STORAGE_KEY, JSON.stringify(chain));
|
109
124
|
} catch (e) {
|
110
125
|
console.log(e);
|
111
126
|
}
|
@@ -115,6 +130,7 @@ var ConnectProvider = ({
|
|
115
130
|
const disconnectSmartAccount = _react.useCallback.call(void 0, async () => {
|
116
131
|
setSmartAccountClient(null);
|
117
132
|
setSmartAccountAddress(void 0);
|
133
|
+
localStorage.removeItem(CHAIN_STORAGE_KEY);
|
118
134
|
}, []);
|
119
135
|
_react.useEffect.call(void 0, () => {
|
120
136
|
if (config.smartAccountAddress) {
|
@@ -127,14 +143,16 @@ var ConnectProvider = ({
|
|
127
143
|
smartAccountClient,
|
128
144
|
smartAccountAddress,
|
129
145
|
updateSmartAccountClient,
|
130
|
-
disconnectSmartAccount
|
146
|
+
disconnectSmartAccount,
|
147
|
+
networksConfig: config.networksConfig
|
131
148
|
}),
|
132
149
|
[
|
133
150
|
queryClient,
|
134
151
|
smartAccountClient,
|
135
152
|
smartAccountAddress,
|
136
153
|
updateSmartAccountClient,
|
137
|
-
disconnectSmartAccount
|
154
|
+
disconnectSmartAccount,
|
155
|
+
config.networksConfig
|
138
156
|
]
|
139
157
|
);
|
140
158
|
return /* @__PURE__ */ React2.default.createElement(ConnectContext.Provider, { value }, children);
|
@@ -148,6 +166,13 @@ var useAccount = () => {
|
|
148
166
|
throw new Error("useAccount must be used within a ConnectProvider");
|
149
167
|
}
|
150
168
|
const { smartAccountClient, smartAccountAddress } = context;
|
169
|
+
const { chain, chainId } = _react.useMemo.call(void 0,
|
170
|
+
() => ({
|
171
|
+
chain: _optionalChain([smartAccountClient, 'optionalAccess', _14 => _14.chain]),
|
172
|
+
chainId: _optionalChain([smartAccountClient, 'optionalAccess', _15 => _15.chain, 'optionalAccess', _16 => _16.id])
|
173
|
+
}),
|
174
|
+
[smartAccountClient]
|
175
|
+
);
|
151
176
|
const isConnected = _react.useMemo.call(void 0,
|
152
177
|
() => !!smartAccountClient && !!smartAccountAddress,
|
153
178
|
[smartAccountClient, smartAccountAddress]
|
@@ -160,7 +185,9 @@ var useAccount = () => {
|
|
160
185
|
smartAccountClient,
|
161
186
|
isConnected,
|
162
187
|
isDisconnected: !isConnected,
|
163
|
-
status
|
188
|
+
status,
|
189
|
+
chain,
|
190
|
+
chainId
|
164
191
|
};
|
165
192
|
};
|
166
193
|
|
@@ -358,7 +385,7 @@ var FocusManager = (_a = class extends Subscribable {
|
|
358
385
|
if (typeof __privateGet(this, _focused) === "boolean") {
|
359
386
|
return __privateGet(this, _focused);
|
360
387
|
}
|
361
|
-
return _optionalChain([globalThis, 'access',
|
388
|
+
return _optionalChain([globalThis, 'access', _17 => _17.document, 'optionalAccess', _18 => _18.visibilityState]) !== "hidden";
|
362
389
|
}
|
363
390
|
}, _focused = new WeakMap(), _cleanup = new WeakMap(), _setup = new WeakMap(), _a);
|
364
391
|
var focusManager = new FocusManager();
|
@@ -648,7 +675,7 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
648
675
|
enumerable: true,
|
649
676
|
get: () => {
|
650
677
|
this.trackProp(key);
|
651
|
-
_optionalChain([onPropTracked, 'optionalCall',
|
678
|
+
_optionalChain([onPropTracked, 'optionalCall', _19 => _19(key)]);
|
652
679
|
return result[key];
|
653
680
|
}
|
654
681
|
});
|
@@ -709,13 +736,13 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
709
736
|
}
|
710
737
|
let { error, errorUpdatedAt, status } = newState;
|
711
738
|
if (options.select && newState.data !== void 0) {
|
712
|
-
if (prevResult && newState.data === _optionalChain([prevResultState, 'optionalAccess',
|
739
|
+
if (prevResult && newState.data === _optionalChain([prevResultState, 'optionalAccess', _20 => _20.data]) && options.select === __privateGet(this, _selectFn)) {
|
713
740
|
data = __privateGet(this, _selectResult);
|
714
741
|
} else {
|
715
742
|
try {
|
716
743
|
__privateSet(this, _selectFn, options.select);
|
717
744
|
data = options.select(newState.data);
|
718
|
-
data = replaceData(_optionalChain([prevResult, 'optionalAccess',
|
745
|
+
data = replaceData(_optionalChain([prevResult, 'optionalAccess', _21 => _21.data]), data, options);
|
719
746
|
__privateSet(this, _selectResult, data);
|
720
747
|
__privateSet(this, _selectError, null);
|
721
748
|
} catch (selectError) {
|
@@ -727,11 +754,11 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
727
754
|
}
|
728
755
|
if (options.placeholderData !== void 0 && data === void 0 && status === "pending") {
|
729
756
|
let placeholderData;
|
730
|
-
if (_optionalChain([prevResult, 'optionalAccess',
|
757
|
+
if (_optionalChain([prevResult, 'optionalAccess', _22 => _22.isPlaceholderData]) && options.placeholderData === _optionalChain([prevResultOptions, 'optionalAccess', _23 => _23.placeholderData])) {
|
731
758
|
placeholderData = prevResult.data;
|
732
759
|
} else {
|
733
760
|
placeholderData = typeof options.placeholderData === "function" ? options.placeholderData(
|
734
|
-
_optionalChain([__privateGet, 'call',
|
761
|
+
_optionalChain([__privateGet, 'call', _24 => _24(this, _lastQueryWithDefinedData), 'optionalAccess', _25 => _25.state, 'access', _26 => _26.data]),
|
735
762
|
__privateGet(this, _lastQueryWithDefinedData)
|
736
763
|
) : options.placeholderData;
|
737
764
|
if (options.select && placeholderData !== void 0) {
|
@@ -746,7 +773,7 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
746
773
|
if (placeholderData !== void 0) {
|
747
774
|
status = "success";
|
748
775
|
data = replaceData(
|
749
|
-
_optionalChain([prevResult, 'optionalAccess',
|
776
|
+
_optionalChain([prevResult, 'optionalAccess', _27 => _27.data]),
|
750
777
|
placeholderData,
|
751
778
|
options
|
752
779
|
);
|
@@ -826,7 +853,7 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
826
853
|
return changed && includedProps.has(typedKey);
|
827
854
|
});
|
828
855
|
};
|
829
|
-
if (_optionalChain([notifyOptions, 'optionalAccess',
|
856
|
+
if (_optionalChain([notifyOptions, 'optionalAccess', _28 => _28.listeners]) !== false && shouldNotifyListeners()) {
|
830
857
|
defaultNotifyOptions.listeners = true;
|
831
858
|
}
|
832
859
|
__privateMethod(this, _QueryObserver_instances, notify_fn).call(this, { ...defaultNotifyOptions, ...notifyOptions });
|
@@ -843,7 +870,7 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
843
870
|
this.options,
|
844
871
|
fetchOptions
|
845
872
|
);
|
846
|
-
if (!_optionalChain([fetchOptions, 'optionalAccess',
|
873
|
+
if (!_optionalChain([fetchOptions, 'optionalAccess', _29 => _29.throwOnError])) {
|
847
874
|
promise = promise.catch(noop);
|
848
875
|
}
|
849
876
|
return promise;
|
@@ -898,7 +925,7 @@ var QueryObserver = (_a3 = class extends Subscribable {
|
|
898
925
|
__privateSet(this, _currentQuery, query);
|
899
926
|
__privateSet(this, _currentQueryInitialState, query.state);
|
900
927
|
if (this.hasListeners()) {
|
901
|
-
_optionalChain([prevQuery, 'optionalAccess',
|
928
|
+
_optionalChain([prevQuery, 'optionalAccess', _30 => _30.removeObserver, 'call', _31 => _31(this)]);
|
902
929
|
query.addObserver(this);
|
903
930
|
}
|
904
931
|
}, notify_fn = function(notifyOptions) {
|
@@ -969,15 +996,15 @@ var MutationObserver = (_a4 = class extends Subscribable {
|
|
969
996
|
observer: this
|
970
997
|
});
|
971
998
|
}
|
972
|
-
if (_optionalChain([prevOptions, 'optionalAccess',
|
999
|
+
if (_optionalChain([prevOptions, 'optionalAccess', _32 => _32.mutationKey]) && this.options.mutationKey && hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)) {
|
973
1000
|
this.reset();
|
974
|
-
} else if (_optionalChain([__privateGet, 'call',
|
1001
|
+
} else if (_optionalChain([__privateGet, 'call', _33 => _33(this, _currentMutation), 'optionalAccess', _34 => _34.state, 'access', _35 => _35.status]) === "pending") {
|
975
1002
|
__privateGet(this, _currentMutation).setOptions(this.options);
|
976
1003
|
}
|
977
1004
|
}
|
978
1005
|
onUnsubscribe() {
|
979
1006
|
if (!this.hasListeners()) {
|
980
|
-
_optionalChain([__privateGet, 'call',
|
1007
|
+
_optionalChain([__privateGet, 'call', _36 => _36(this, _currentMutation), 'optionalAccess', _37 => _37.removeObserver, 'call', _38 => _38(this)]);
|
981
1008
|
}
|
982
1009
|
}
|
983
1010
|
onMutationUpdate(action) {
|
@@ -988,20 +1015,20 @@ var MutationObserver = (_a4 = class extends Subscribable {
|
|
988
1015
|
return __privateGet(this, _currentResult2);
|
989
1016
|
}
|
990
1017
|
reset() {
|
991
|
-
_optionalChain([__privateGet, 'call',
|
1018
|
+
_optionalChain([__privateGet, 'call', _39 => _39(this, _currentMutation), 'optionalAccess', _40 => _40.removeObserver, 'call', _41 => _41(this)]);
|
992
1019
|
__privateSet(this, _currentMutation, void 0);
|
993
1020
|
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
994
1021
|
__privateMethod(this, _MutationObserver_instances, notify_fn2).call(this);
|
995
1022
|
}
|
996
1023
|
mutate(variables, options) {
|
997
1024
|
__privateSet(this, _mutateOptions, options);
|
998
|
-
_optionalChain([__privateGet, 'call',
|
1025
|
+
_optionalChain([__privateGet, 'call', _42 => _42(this, _currentMutation), 'optionalAccess', _43 => _43.removeObserver, 'call', _44 => _44(this)]);
|
999
1026
|
__privateSet(this, _currentMutation, __privateGet(this, _client2).getMutationCache().build(__privateGet(this, _client2), this.options));
|
1000
1027
|
__privateGet(this, _currentMutation).addObserver(this);
|
1001
1028
|
return __privateGet(this, _currentMutation).execute(variables);
|
1002
1029
|
}
|
1003
1030
|
}, _client2 = new WeakMap(), _currentResult2 = new WeakMap(), _currentMutation = new WeakMap(), _mutateOptions = new WeakMap(), _MutationObserver_instances = new WeakSet(), updateResult_fn = function() {
|
1004
|
-
const state = _nullishCoalesce(_optionalChain([__privateGet, 'call',
|
1031
|
+
const state = _nullishCoalesce(_optionalChain([__privateGet, 'call', _45 => _45(this, _currentMutation), 'optionalAccess', _46 => _46.state]), () => ( getDefaultState()));
|
1005
1032
|
__privateSet(this, _currentResult2, {
|
1006
1033
|
...state,
|
1007
1034
|
isPending: state.status === "pending",
|
@@ -1016,12 +1043,12 @@ var MutationObserver = (_a4 = class extends Subscribable {
|
|
1016
1043
|
if (__privateGet(this, _mutateOptions) && this.hasListeners()) {
|
1017
1044
|
const variables = __privateGet(this, _currentResult2).variables;
|
1018
1045
|
const context = __privateGet(this, _currentResult2).context;
|
1019
|
-
if (_optionalChain([action, 'optionalAccess',
|
1020
|
-
_optionalChain([__privateGet, 'call',
|
1021
|
-
_optionalChain([__privateGet, 'call',
|
1022
|
-
} else if (_optionalChain([action, 'optionalAccess',
|
1023
|
-
_optionalChain([__privateGet, 'call',
|
1024
|
-
_optionalChain([__privateGet, 'call',
|
1046
|
+
if (_optionalChain([action, 'optionalAccess', _47 => _47.type]) === "success") {
|
1047
|
+
_optionalChain([__privateGet, 'call', _48 => _48(this, _mutateOptions), 'access', _49 => _49.onSuccess, 'optionalCall', _50 => _50(action.data, variables, context)]);
|
1048
|
+
_optionalChain([__privateGet, 'call', _51 => _51(this, _mutateOptions), 'access', _52 => _52.onSettled, 'optionalCall', _53 => _53(action.data, null, variables, context)]);
|
1049
|
+
} else if (_optionalChain([action, 'optionalAccess', _54 => _54.type]) === "error") {
|
1050
|
+
_optionalChain([__privateGet, 'call', _55 => _55(this, _mutateOptions), 'access', _56 => _56.onError, 'optionalCall', _57 => _57(action.error, variables, context)]);
|
1051
|
+
_optionalChain([__privateGet, 'call', _58 => _58(this, _mutateOptions), 'access', _59 => _59.onSettled, 'optionalCall', _60 => _60(
|
1025
1052
|
void 0,
|
1026
1053
|
action.error,
|
1027
1054
|
variables,
|
@@ -1121,7 +1148,7 @@ var ensureStaleTime = (defaultedOptions) => {
|
|
1121
1148
|
}
|
1122
1149
|
}
|
1123
1150
|
};
|
1124
|
-
var shouldSuspend = (defaultedOptions, result) => _optionalChain([defaultedOptions, 'optionalAccess',
|
1151
|
+
var shouldSuspend = (defaultedOptions, result) => _optionalChain([defaultedOptions, 'optionalAccess', _61 => _61.suspense]) && result.isPending;
|
1125
1152
|
var fetchOptimistic = (defaultedOptions, observer, errorResetBoundary) => observer.fetchOptimistic(defaultedOptions).catch(() => {
|
1126
1153
|
errorResetBoundary.clearReset();
|
1127
1154
|
});
|
@@ -1140,7 +1167,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
1140
1167
|
const isRestoring = useIsRestoring();
|
1141
1168
|
const errorResetBoundary = useQueryErrorResetBoundary();
|
1142
1169
|
const defaultedOptions = client.defaultQueryOptions(options);
|
1143
|
-
_optionalChain([client, 'access',
|
1170
|
+
_optionalChain([client, 'access', _62 => _62.getDefaultOptions, 'call', _63 => _63(), 'access', _64 => _64.queries, 'optionalAccess', _65 => _65._experimental_beforeQuery, 'optionalCall', _66 => _66(
|
1144
1171
|
defaultedOptions
|
1145
1172
|
)]);
|
1146
1173
|
defaultedOptions._optimisticResults = isRestoring ? "isRestoring" : "optimistic";
|
@@ -1181,7 +1208,7 @@ function useBaseQuery(options, Observer, queryClient) {
|
|
1181
1208
|
throw result.error;
|
1182
1209
|
}
|
1183
1210
|
;
|
1184
|
-
_optionalChain([client, 'access',
|
1211
|
+
_optionalChain([client, 'access', _67 => _67.getDefaultOptions, 'call', _68 => _68(), 'access', _69 => _69.queries, 'optionalAccess', _70 => _70._experimental_afterQuery, 'optionalCall', _71 => _71(
|
1185
1212
|
defaultedOptions,
|
1186
1213
|
result
|
1187
1214
|
)]);
|
@@ -1385,7 +1412,7 @@ var useConnect = () => {
|
|
1385
1412
|
setIsPending(true);
|
1386
1413
|
setError(null);
|
1387
1414
|
updateSmartAccountClient(params).then(() => {
|
1388
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1415
|
+
_optionalChain([queryClient, 'optionalAccess', _72 => _72.invalidateQueries, 'call', _73 => _73({
|
1389
1416
|
queryKey: ["connect"]
|
1390
1417
|
})]);
|
1391
1418
|
}).catch((e) => {
|
@@ -1403,7 +1430,7 @@ var useConnect = () => {
|
|
1403
1430
|
setError(null);
|
1404
1431
|
try {
|
1405
1432
|
await updateSmartAccountClient(params);
|
1406
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1433
|
+
_optionalChain([queryClient, 'optionalAccess', _74 => _74.invalidateQueries, 'call', _75 => _75({ queryKey: ["connect"] })]);
|
1407
1434
|
} catch (e) {
|
1408
1435
|
const err = e instanceof Error ? e : new Error("An error occurred");
|
1409
1436
|
setError(err);
|
@@ -1436,7 +1463,7 @@ var useDisconnect = () => {
|
|
1436
1463
|
setIsPending(true);
|
1437
1464
|
setError(null);
|
1438
1465
|
disconnectSmartAccount().then(() => {
|
1439
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1466
|
+
_optionalChain([queryClient, 'optionalAccess', _76 => _76.invalidateQueries, 'call', _77 => _77({
|
1440
1467
|
queryKey: ["connect"]
|
1441
1468
|
})]);
|
1442
1469
|
}).catch((e) => {
|
@@ -1451,7 +1478,7 @@ var useDisconnect = () => {
|
|
1451
1478
|
setError(null);
|
1452
1479
|
try {
|
1453
1480
|
await disconnectSmartAccount();
|
1454
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1481
|
+
_optionalChain([queryClient, 'optionalAccess', _78 => _78.invalidateQueries, 'call', _79 => _79({ queryKey: ["connect"] })]);
|
1455
1482
|
} catch (e) {
|
1456
1483
|
const err = e instanceof Error ? e : new Error("An error occurred during disconnection");
|
1457
1484
|
setError(err);
|
@@ -1888,7 +1915,7 @@ var useCreateNewSigner = (apiKey, baseUrl) => {
|
|
1888
1915
|
setIsPending(true);
|
1889
1916
|
setError(null);
|
1890
1917
|
_connectsdk4337.createNewSigner.call(void 0, { apiKey, baseUrl, params }).then((signer) => {
|
1891
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1918
|
+
_optionalChain([queryClient, 'optionalAccess', _80 => _80.invalidateQueries, 'call', _81 => _81({ queryKey: ["signer"] })]);
|
1892
1919
|
return signer;
|
1893
1920
|
}).catch((e) => {
|
1894
1921
|
const err = e instanceof Error ? e : new Error("An error occurred");
|
@@ -1909,7 +1936,7 @@ var useCreateNewSigner = (apiKey, baseUrl) => {
|
|
1909
1936
|
baseUrl,
|
1910
1937
|
params
|
1911
1938
|
});
|
1912
|
-
_optionalChain([queryClient, 'optionalAccess',
|
1939
|
+
_optionalChain([queryClient, 'optionalAccess', _82 => _82.invalidateQueries, 'call', _83 => _83({ queryKey: ["signer"] })]);
|
1913
1940
|
return signer;
|
1914
1941
|
} catch (e) {
|
1915
1942
|
const err = e instanceof Error ? e : new Error("An error occurred");
|
@@ -2153,6 +2180,90 @@ function useCancelRecoveryRequest() {
|
|
2153
2180
|
};
|
2154
2181
|
}
|
2155
2182
|
|
2183
|
+
// src/hooks/useSwitchChain.ts
|
2184
|
+
|
2185
|
+
|
2186
|
+
var useSwitchChain = () => {
|
2187
|
+
const { address } = _wagmi.useAccount.call(void 0, );
|
2188
|
+
const context = _react.useContext.call(void 0, ConnectContext);
|
2189
|
+
if (context === void 0) {
|
2190
|
+
throw new Error("useSwitchChain must be used within a ConnectProvider");
|
2191
|
+
}
|
2192
|
+
const {
|
2193
|
+
queryClient,
|
2194
|
+
smartAccountClient,
|
2195
|
+
updateSmartAccountClient,
|
2196
|
+
networksConfig
|
2197
|
+
} = context;
|
2198
|
+
const [isPending, setIsPending] = _react.useState.call(void 0, false);
|
2199
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
2200
|
+
const switchChainInternal = _react.useCallback.call(void 0,
|
2201
|
+
async (params) => {
|
2202
|
+
const { chain } = params;
|
2203
|
+
if (!networksConfig) {
|
2204
|
+
throw new Error("No current configuration found");
|
2205
|
+
}
|
2206
|
+
try {
|
2207
|
+
await updateSmartAccountClient({
|
2208
|
+
address: _optionalChain([smartAccountClient, 'optionalAccess', _84 => _84.account, 'access', _85 => _85.address]),
|
2209
|
+
chain
|
2210
|
+
});
|
2211
|
+
_optionalChain([queryClient, 'optionalAccess', _86 => _86.invalidateQueries, 'call', _87 => _87({
|
2212
|
+
queryKey: ["switchChain"]
|
2213
|
+
})]);
|
2214
|
+
} catch (e) {
|
2215
|
+
throw e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2216
|
+
}
|
2217
|
+
},
|
2218
|
+
[
|
2219
|
+
smartAccountClient,
|
2220
|
+
updateSmartAccountClient,
|
2221
|
+
queryClient,
|
2222
|
+
networksConfig
|
2223
|
+
]
|
2224
|
+
);
|
2225
|
+
const switchChain = _react.useCallback.call(void 0,
|
2226
|
+
(params) => {
|
2227
|
+
if (!address) throw new Error("No connected wallet");
|
2228
|
+
setIsPending(true);
|
2229
|
+
setError(null);
|
2230
|
+
switchChainInternal(params).catch((e) => {
|
2231
|
+
const err = e instanceof Error ? e : new Error(
|
2232
|
+
"An error occurred while switching chain"
|
2233
|
+
);
|
2234
|
+
setError(err);
|
2235
|
+
}).finally(() => {
|
2236
|
+
setIsPending(false);
|
2237
|
+
});
|
2238
|
+
},
|
2239
|
+
[switchChainInternal]
|
2240
|
+
);
|
2241
|
+
const switchChainAsync = _react.useCallback.call(void 0,
|
2242
|
+
async (params) => {
|
2243
|
+
if (!address) throw new Error("No connected wallet");
|
2244
|
+
setIsPending(true);
|
2245
|
+
setError(null);
|
2246
|
+
try {
|
2247
|
+
await switchChainInternal(params);
|
2248
|
+
} catch (e) {
|
2249
|
+
const err = e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2250
|
+
setError(err);
|
2251
|
+
throw err;
|
2252
|
+
} finally {
|
2253
|
+
setIsPending(false);
|
2254
|
+
}
|
2255
|
+
},
|
2256
|
+
[switchChainInternal]
|
2257
|
+
);
|
2258
|
+
return {
|
2259
|
+
switchChain,
|
2260
|
+
switchChainAsync,
|
2261
|
+
isPending,
|
2262
|
+
error
|
2263
|
+
};
|
2264
|
+
};
|
2265
|
+
|
2266
|
+
|
2156
2267
|
|
2157
2268
|
|
2158
2269
|
|
@@ -2184,4 +2295,4 @@ function useCancelRecoveryRequest() {
|
|
2184
2295
|
|
2185
2296
|
|
2186
2297
|
|
2187
|
-
exports.ConnectProvider = ConnectProvider; exports.useAccount = useAccount; exports.useAddOwner = useAddOwner; exports.useAddSessionKey = useAddSessionKey; exports.useAddWhitelistDestination = useAddWhitelistDestination; exports.useCancelRecoveryRequest = useCancelRecoveryRequest; exports.useConnect = useConnect; exports.useCreateNewSigner = useCreateNewSigner; exports.useDisconnect = useDisconnect; exports.useGenerateQRCodeUrl = useGenerateQRCodeUrl; exports.useGetEnrichedOwners = useGetEnrichedOwners; exports.useGetGasPrice = useGetGasPrice; exports.useGetOwners = useGetOwners; exports.useGetRecoveryRequest = useGetRecoveryRequest; exports.useGetSessionFromAddress = useGetSessionFromAddress; exports.useIsAddressWhitelistDestination = useIsAddressWhitelistDestination; exports.useIsRecoveryActive = useIsRecoveryActive; exports.useRemoveOwner = useRemoveOwner; exports.useRemoveWhitelistDestination = useRemoveWhitelistDestination; exports.useRetrieveAccountAddressFromPasskeyId = useRetrieveAccountAddressFromPasskeyId; exports.useRetrieveAccountAddressFromPasskeys = useRetrieveAccountAddressFromPasskeys; exports.useRevokeSessionKey = useRevokeSessionKey; exports.useSendTransaction = useSendTransaction; exports.useSendTransactionWithSessionKey = useSendTransactionWithSessionKey; exports.useSerializeUrlWithSignerPayload = useSerializeUrlWithSignerPayload; exports.useSetUpRecovery = useSetUpRecovery; exports.useSignMessage = useSignMessage; exports.useValidateAddDevice = useValidateAddDevice; exports.useVerifyMessage = useVerifyMessage; exports.useWriteContract = useWriteContract; exports.useWriteContractWithSessionKey = useWriteContractWithSessionKey;
|
2298
|
+
exports.ConnectProvider = ConnectProvider; exports.useAccount = useAccount; exports.useAddOwner = useAddOwner; exports.useAddSessionKey = useAddSessionKey; exports.useAddWhitelistDestination = useAddWhitelistDestination; exports.useCancelRecoveryRequest = useCancelRecoveryRequest; exports.useConnect = useConnect; exports.useCreateNewSigner = useCreateNewSigner; exports.useDisconnect = useDisconnect; exports.useGenerateQRCodeUrl = useGenerateQRCodeUrl; exports.useGetEnrichedOwners = useGetEnrichedOwners; exports.useGetGasPrice = useGetGasPrice; exports.useGetOwners = useGetOwners; exports.useGetRecoveryRequest = useGetRecoveryRequest; exports.useGetSessionFromAddress = useGetSessionFromAddress; exports.useIsAddressWhitelistDestination = useIsAddressWhitelistDestination; exports.useIsRecoveryActive = useIsRecoveryActive; exports.useRemoveOwner = useRemoveOwner; exports.useRemoveWhitelistDestination = useRemoveWhitelistDestination; exports.useRetrieveAccountAddressFromPasskeyId = useRetrieveAccountAddressFromPasskeyId; exports.useRetrieveAccountAddressFromPasskeys = useRetrieveAccountAddressFromPasskeys; exports.useRevokeSessionKey = useRevokeSessionKey; exports.useSendTransaction = useSendTransaction; exports.useSendTransactionWithSessionKey = useSendTransactionWithSessionKey; exports.useSerializeUrlWithSignerPayload = useSerializeUrlWithSignerPayload; exports.useSetUpRecovery = useSetUpRecovery; exports.useSignMessage = useSignMessage; exports.useSwitchChain = useSwitchChain; exports.useValidateAddDevice = useValidateAddDevice; exports.useVerifyMessage = useVerifyMessage; exports.useWriteContract = useWriteContract; exports.useWriteContractWithSessionKey = useWriteContractWithSessionKey;
|
package/dist/index.d.cts
CHANGED
@@ -41,10 +41,18 @@ type Override<TTargetA, TTargetB> = {
|
|
41
41
|
|
42
42
|
declare function useMutation<TData = unknown, TError = y, TVariables = void, TContext = unknown>(options: UseMutationOptions<TData, TError, TVariables, TContext>, queryClient?: b): UseMutationResult<TData, TError, TVariables, TContext>;
|
43
43
|
|
44
|
-
type
|
45
|
-
|
44
|
+
type NetworkParams = {
|
45
|
+
chain?: Chain;
|
46
|
+
bundlerUrl?: string;
|
46
47
|
paymasterUrl?: string;
|
47
48
|
};
|
49
|
+
type OmitConfig<T> = Omit<T, "chain" | "paymasterUrl" | "bundlerUrl"> & {
|
50
|
+
networksConfig: NetworkParams[];
|
51
|
+
};
|
52
|
+
type ConnectConfig = OmitConfig<createSafeSmartAccountParameters<ENTRYPOINT_ADDRESS_V07_TYPE> & {
|
53
|
+
bundlerUrl: string;
|
54
|
+
paymasterUrl?: string;
|
55
|
+
}>;
|
48
56
|
type ContextComethSmartAccountClient = ComethSmartAccountClient<SafeSmartAccount<ENTRYPOINT_ADDRESS_V07_TYPE, Transport, Chain>, Transport, Chain, ENTRYPOINT_ADDRESS_V07_TYPE>;
|
49
57
|
declare const ConnectProvider: <TConfig extends ConnectConfig, TQueryClient extends b | undefined>({ children, config, queryClient, }: {
|
50
58
|
children: ReactNode;
|
@@ -59,6 +67,8 @@ interface UseAccountResult {
|
|
59
67
|
isConnected: boolean;
|
60
68
|
isDisconnected: boolean;
|
61
69
|
status: AccountStatus;
|
70
|
+
chain: Chain | undefined;
|
71
|
+
chainId: number | undefined;
|
62
72
|
}
|
63
73
|
declare const useAccount: () => UseAccountResult;
|
64
74
|
|
@@ -929,4 +939,15 @@ type UseCancelRecoveryRequestReturn = QueryResultType & {
|
|
929
939
|
*/
|
930
940
|
declare function useCancelRecoveryRequest(): UseCancelRecoveryRequestReturn;
|
931
941
|
|
932
|
-
|
942
|
+
declare const useSwitchChain: () => {
|
943
|
+
switchChain: (params: {
|
944
|
+
chain: Chain;
|
945
|
+
}) => void;
|
946
|
+
switchChainAsync: (params: {
|
947
|
+
chain: Chain;
|
948
|
+
}) => Promise<void>;
|
949
|
+
isPending: boolean;
|
950
|
+
error: Error | null;
|
951
|
+
};
|
952
|
+
|
953
|
+
export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useCancelRecoveryRequest, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetRecoveryRequest, useGetSessionFromAddress, useIsAddressWhitelistDestination, useIsRecoveryActive, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSetUpRecovery, useSignMessage, useSwitchChain, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
|
package/dist/index.d.ts
CHANGED
@@ -41,10 +41,18 @@ type Override<TTargetA, TTargetB> = {
|
|
41
41
|
|
42
42
|
declare function useMutation<TData = unknown, TError = y, TVariables = void, TContext = unknown>(options: UseMutationOptions<TData, TError, TVariables, TContext>, queryClient?: b): UseMutationResult<TData, TError, TVariables, TContext>;
|
43
43
|
|
44
|
-
type
|
45
|
-
|
44
|
+
type NetworkParams = {
|
45
|
+
chain?: Chain;
|
46
|
+
bundlerUrl?: string;
|
46
47
|
paymasterUrl?: string;
|
47
48
|
};
|
49
|
+
type OmitConfig<T> = Omit<T, "chain" | "paymasterUrl" | "bundlerUrl"> & {
|
50
|
+
networksConfig: NetworkParams[];
|
51
|
+
};
|
52
|
+
type ConnectConfig = OmitConfig<createSafeSmartAccountParameters<ENTRYPOINT_ADDRESS_V07_TYPE> & {
|
53
|
+
bundlerUrl: string;
|
54
|
+
paymasterUrl?: string;
|
55
|
+
}>;
|
48
56
|
type ContextComethSmartAccountClient = ComethSmartAccountClient<SafeSmartAccount<ENTRYPOINT_ADDRESS_V07_TYPE, Transport, Chain>, Transport, Chain, ENTRYPOINT_ADDRESS_V07_TYPE>;
|
49
57
|
declare const ConnectProvider: <TConfig extends ConnectConfig, TQueryClient extends b | undefined>({ children, config, queryClient, }: {
|
50
58
|
children: ReactNode;
|
@@ -59,6 +67,8 @@ interface UseAccountResult {
|
|
59
67
|
isConnected: boolean;
|
60
68
|
isDisconnected: boolean;
|
61
69
|
status: AccountStatus;
|
70
|
+
chain: Chain | undefined;
|
71
|
+
chainId: number | undefined;
|
62
72
|
}
|
63
73
|
declare const useAccount: () => UseAccountResult;
|
64
74
|
|
@@ -929,4 +939,15 @@ type UseCancelRecoveryRequestReturn = QueryResultType & {
|
|
929
939
|
*/
|
930
940
|
declare function useCancelRecoveryRequest(): UseCancelRecoveryRequestReturn;
|
931
941
|
|
932
|
-
|
942
|
+
declare const useSwitchChain: () => {
|
943
|
+
switchChain: (params: {
|
944
|
+
chain: Chain;
|
945
|
+
}) => void;
|
946
|
+
switchChainAsync: (params: {
|
947
|
+
chain: Chain;
|
948
|
+
}) => Promise<void>;
|
949
|
+
isPending: boolean;
|
950
|
+
error: Error | null;
|
951
|
+
};
|
952
|
+
|
953
|
+
export { ConnectProvider, type SendTransactionMutate, type SendTransactionMutateAsync, type SendTransactionWithSessionKeyMutate, type SendTransactionWithSessionKeyMutateAsync, type UseAddOwnerReturn, type UseAddSessionKeyReturn, type UseAddWhitelistDestinationReturn, type UseRemoveOwnerReturn, type UseRemoveWhitelistDestinationReturn, type UseRetrieveAccountAddressFromPasskeyOptions, type UseRevokeSessionKeyReturn, type VerifyMessageMutate, type VerifyMessageMutateAsync, type WriteContractMutate, type WriteContractMutateAsync, type WriteContractWithSessionKeyMutate, type WriteContractWithSessionKeyMutateAsync, useAccount, useAddOwner, useAddSessionKey, useAddWhitelistDestination, useCancelRecoveryRequest, useConnect, useCreateNewSigner, useDisconnect, useGenerateQRCodeUrl, useGetEnrichedOwners, useGetGasPrice, useGetOwners, useGetRecoveryRequest, useGetSessionFromAddress, useIsAddressWhitelistDestination, useIsRecoveryActive, useRemoveOwner, useRemoveWhitelistDestination, useRetrieveAccountAddressFromPasskeyId, useRetrieveAccountAddressFromPasskeys, useRevokeSessionKey, useSendTransaction, useSendTransactionWithSessionKey, useSerializeUrlWithSignerPayload, useSetUpRecovery, useSignMessage, useSwitchChain, useValidateAddDevice, useVerifyMessage, useWriteContract, useWriteContractWithSessionKey };
|
package/dist/index.js
CHANGED
@@ -77,6 +77,7 @@ import React, {
|
|
77
77
|
useEffect,
|
78
78
|
useCallback
|
79
79
|
} from "react";
|
80
|
+
var CHAIN_STORAGE_KEY = "currentChain";
|
80
81
|
var ConnectContext = createContext({
|
81
82
|
queryClient: void 0,
|
82
83
|
smartAccountClient: null,
|
@@ -84,7 +85,8 @@ var ConnectContext = createContext({
|
|
84
85
|
updateSmartAccountClient: async () => {
|
85
86
|
},
|
86
87
|
disconnectSmartAccount: async () => {
|
87
|
-
}
|
88
|
+
},
|
89
|
+
networksConfig: void 0
|
88
90
|
});
|
89
91
|
var ConnectProvider = ({
|
90
92
|
children,
|
@@ -95,9 +97,21 @@ var ConnectProvider = ({
|
|
95
97
|
const [smartAccountAddress, setSmartAccountAddress] = useState(void 0);
|
96
98
|
const updateSmartAccountClient = useCallback(
|
97
99
|
async (params = {}) => {
|
100
|
+
const chain = params.chain ?? JSON.parse(localStorage.getItem(CHAIN_STORAGE_KEY) ?? "null") ?? config.networksConfig[0].chain;
|
101
|
+
const bundlerUrl = config.networksConfig.find(
|
102
|
+
(network) => network.chain?.id === chain.id
|
103
|
+
)?.bundlerUrl;
|
104
|
+
const paymasterUrl = config.networksConfig.find(
|
105
|
+
(network) => network.chain?.id === chain.id
|
106
|
+
)?.paymasterUrl;
|
107
|
+
if (!bundlerUrl || !paymasterUrl)
|
108
|
+
throw new Error("Bundler or paymaster url not found");
|
98
109
|
try {
|
99
110
|
const { client, address: newAddress } = await createSmartAccount({
|
100
111
|
...config,
|
112
|
+
chain,
|
113
|
+
bundlerUrl,
|
114
|
+
paymasterUrl,
|
101
115
|
smartAccountAddress: params.address,
|
102
116
|
comethSignerConfig: {
|
103
117
|
...config.comethSignerConfig,
|
@@ -106,6 +120,7 @@ var ConnectProvider = ({
|
|
106
120
|
});
|
107
121
|
setSmartAccountClient(client);
|
108
122
|
setSmartAccountAddress(newAddress);
|
123
|
+
localStorage.setItem(CHAIN_STORAGE_KEY, JSON.stringify(chain));
|
109
124
|
} catch (e) {
|
110
125
|
console.log(e);
|
111
126
|
}
|
@@ -115,6 +130,7 @@ var ConnectProvider = ({
|
|
115
130
|
const disconnectSmartAccount = useCallback(async () => {
|
116
131
|
setSmartAccountClient(null);
|
117
132
|
setSmartAccountAddress(void 0);
|
133
|
+
localStorage.removeItem(CHAIN_STORAGE_KEY);
|
118
134
|
}, []);
|
119
135
|
useEffect(() => {
|
120
136
|
if (config.smartAccountAddress) {
|
@@ -127,14 +143,16 @@ var ConnectProvider = ({
|
|
127
143
|
smartAccountClient,
|
128
144
|
smartAccountAddress,
|
129
145
|
updateSmartAccountClient,
|
130
|
-
disconnectSmartAccount
|
146
|
+
disconnectSmartAccount,
|
147
|
+
networksConfig: config.networksConfig
|
131
148
|
}),
|
132
149
|
[
|
133
150
|
queryClient,
|
134
151
|
smartAccountClient,
|
135
152
|
smartAccountAddress,
|
136
153
|
updateSmartAccountClient,
|
137
|
-
disconnectSmartAccount
|
154
|
+
disconnectSmartAccount,
|
155
|
+
config.networksConfig
|
138
156
|
]
|
139
157
|
);
|
140
158
|
return /* @__PURE__ */ React.createElement(ConnectContext.Provider, { value }, children);
|
@@ -148,6 +166,13 @@ var useAccount = () => {
|
|
148
166
|
throw new Error("useAccount must be used within a ConnectProvider");
|
149
167
|
}
|
150
168
|
const { smartAccountClient, smartAccountAddress } = context;
|
169
|
+
const { chain, chainId } = useMemo2(
|
170
|
+
() => ({
|
171
|
+
chain: smartAccountClient?.chain,
|
172
|
+
chainId: smartAccountClient?.chain?.id
|
173
|
+
}),
|
174
|
+
[smartAccountClient]
|
175
|
+
);
|
151
176
|
const isConnected = useMemo2(
|
152
177
|
() => !!smartAccountClient && !!smartAccountAddress,
|
153
178
|
[smartAccountClient, smartAccountAddress]
|
@@ -160,7 +185,9 @@ var useAccount = () => {
|
|
160
185
|
smartAccountClient,
|
161
186
|
isConnected,
|
162
187
|
isDisconnected: !isConnected,
|
163
|
-
status
|
188
|
+
status,
|
189
|
+
chain,
|
190
|
+
chainId
|
164
191
|
};
|
165
192
|
};
|
166
193
|
|
@@ -2152,6 +2179,89 @@ function useCancelRecoveryRequest() {
|
|
2152
2179
|
data: result.data
|
2153
2180
|
};
|
2154
2181
|
}
|
2182
|
+
|
2183
|
+
// src/hooks/useSwitchChain.ts
|
2184
|
+
import { useCallback as useCallback8, useContext as useContext8, useState as useState9 } from "react";
|
2185
|
+
import { useAccount as useAccount2 } from "wagmi";
|
2186
|
+
var useSwitchChain = () => {
|
2187
|
+
const { address } = useAccount2();
|
2188
|
+
const context = useContext8(ConnectContext);
|
2189
|
+
if (context === void 0) {
|
2190
|
+
throw new Error("useSwitchChain must be used within a ConnectProvider");
|
2191
|
+
}
|
2192
|
+
const {
|
2193
|
+
queryClient,
|
2194
|
+
smartAccountClient,
|
2195
|
+
updateSmartAccountClient,
|
2196
|
+
networksConfig
|
2197
|
+
} = context;
|
2198
|
+
const [isPending, setIsPending] = useState9(false);
|
2199
|
+
const [error, setError] = useState9(null);
|
2200
|
+
const switchChainInternal = useCallback8(
|
2201
|
+
async (params) => {
|
2202
|
+
const { chain } = params;
|
2203
|
+
if (!networksConfig) {
|
2204
|
+
throw new Error("No current configuration found");
|
2205
|
+
}
|
2206
|
+
try {
|
2207
|
+
await updateSmartAccountClient({
|
2208
|
+
address: smartAccountClient?.account.address,
|
2209
|
+
chain
|
2210
|
+
});
|
2211
|
+
queryClient?.invalidateQueries({
|
2212
|
+
queryKey: ["switchChain"]
|
2213
|
+
});
|
2214
|
+
} catch (e) {
|
2215
|
+
throw e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2216
|
+
}
|
2217
|
+
},
|
2218
|
+
[
|
2219
|
+
smartAccountClient,
|
2220
|
+
updateSmartAccountClient,
|
2221
|
+
queryClient,
|
2222
|
+
networksConfig
|
2223
|
+
]
|
2224
|
+
);
|
2225
|
+
const switchChain = useCallback8(
|
2226
|
+
(params) => {
|
2227
|
+
if (!address) throw new Error("No connected wallet");
|
2228
|
+
setIsPending(true);
|
2229
|
+
setError(null);
|
2230
|
+
switchChainInternal(params).catch((e) => {
|
2231
|
+
const err = e instanceof Error ? e : new Error(
|
2232
|
+
"An error occurred while switching chain"
|
2233
|
+
);
|
2234
|
+
setError(err);
|
2235
|
+
}).finally(() => {
|
2236
|
+
setIsPending(false);
|
2237
|
+
});
|
2238
|
+
},
|
2239
|
+
[switchChainInternal]
|
2240
|
+
);
|
2241
|
+
const switchChainAsync = useCallback8(
|
2242
|
+
async (params) => {
|
2243
|
+
if (!address) throw new Error("No connected wallet");
|
2244
|
+
setIsPending(true);
|
2245
|
+
setError(null);
|
2246
|
+
try {
|
2247
|
+
await switchChainInternal(params);
|
2248
|
+
} catch (e) {
|
2249
|
+
const err = e instanceof Error ? e : new Error("An error occurred while switching chain");
|
2250
|
+
setError(err);
|
2251
|
+
throw err;
|
2252
|
+
} finally {
|
2253
|
+
setIsPending(false);
|
2254
|
+
}
|
2255
|
+
},
|
2256
|
+
[switchChainInternal]
|
2257
|
+
);
|
2258
|
+
return {
|
2259
|
+
switchChain,
|
2260
|
+
switchChainAsync,
|
2261
|
+
isPending,
|
2262
|
+
error
|
2263
|
+
};
|
2264
|
+
};
|
2155
2265
|
export {
|
2156
2266
|
ConnectProvider,
|
2157
2267
|
useAccount,
|
@@ -2180,6 +2290,7 @@ export {
|
|
2180
2290
|
useSerializeUrlWithSignerPayload,
|
2181
2291
|
useSetUpRecovery,
|
2182
2292
|
useSignMessage,
|
2293
|
+
useSwitchChain,
|
2183
2294
|
useValidateAddDevice,
|
2184
2295
|
useVerifyMessage,
|
2185
2296
|
useWriteContract,
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"url": "https://twitter.com/slovaye"
|
8
8
|
}
|
9
9
|
],
|
10
|
-
"version": "0.0.
|
10
|
+
"version": "0.0.11-dev.1",
|
11
11
|
"description": "React hooks Connect 4337",
|
12
12
|
"repository": "https://github.com/cometh-hq/connect-sdk-4337.git",
|
13
13
|
"keywords": [
|
@@ -58,7 +58,7 @@
|
|
58
58
|
"typescript": "^5"
|
59
59
|
},
|
60
60
|
"dependencies": {
|
61
|
-
"@cometh/connect-sdk-4337": "^0.1.
|
61
|
+
"@cometh/connect-sdk-4337": "^0.1.11",
|
62
62
|
"permissionless": "0.1.31"
|
63
63
|
}
|
64
64
|
}
|