@solana/react-hooks 1.1.1 → 1.1.3

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.
@@ -1,1253 +0,0 @@
1
- 'use strict';
2
-
3
- var client = require('@solana/client');
4
- var react = require('react');
5
- var jsxRuntime = require('react/jsx-runtime');
6
- var useSWR = require('swr');
7
- var zustand = require('zustand');
8
- var kit = require('@solana/kit');
9
-
10
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
-
12
- var useSWR__default = /*#__PURE__*/_interopDefault(useSWR);
13
-
14
- var __defProp = Object.defineProperty;
15
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
16
- var SolanaClientContext = react.createContext(null);
17
- function normalizeConfig(config) {
18
- return client.resolveClientConfig(config ?? {});
19
- }
20
- __name(normalizeConfig, "normalizeConfig");
21
- function SolanaClientProvider({ children, client: providedClient, config }) {
22
- const normalizedConfig = react.useMemo(() => normalizeConfig(config), [config]);
23
- const client$1 = react.useMemo(() => {
24
- if (providedClient) {
25
- return providedClient;
26
- }
27
- return client.createClient(normalizedConfig);
28
- }, [normalizedConfig, providedClient]);
29
- react.useEffect(() => {
30
- if (providedClient) {
31
- return;
32
- }
33
- return () => {
34
- client$1.destroy();
35
- };
36
- }, [client$1, providedClient]);
37
- return /* @__PURE__ */ jsxRuntime.jsx(SolanaClientContext.Provider, { value: client$1, children });
38
- }
39
- __name(SolanaClientProvider, "SolanaClientProvider");
40
- function useSolanaClient() {
41
- const client = react.useContext(SolanaClientContext);
42
- if (!client) {
43
- throw new Error("useSolanaClient must be used within a SolanaClientProvider.");
44
- }
45
- return client;
46
- }
47
- __name(useSolanaClient, "useSolanaClient");
48
- var QuerySuspenseContext = react.createContext(void 0);
49
- function useQuerySuspensePreference() {
50
- return react.useContext(QuerySuspenseContext);
51
- }
52
- __name(useQuerySuspensePreference, "useQuerySuspensePreference");
53
- var identitySelector = /* @__PURE__ */ __name((state) => state, "identitySelector");
54
- function useClientStore(selector) {
55
- const client = useSolanaClient();
56
- const appliedSelector = selector ?? identitySelector;
57
- const slice = zustand.useStore(client.store, appliedSelector);
58
- return selector ? slice : slice;
59
- }
60
- __name(useClientStore, "useClientStore");
61
-
62
- // src/query.ts
63
- var QUERY_NAMESPACE = "@solana/react-hooks";
64
- function useSolanaRpcQuery(scope, args, fetcher, options = {}) {
65
- const client = useSolanaClient();
66
- const cluster = useClientStore((state) => state.cluster);
67
- const { disabled = false, swr } = options;
68
- const providerSuspensePreference = useQuerySuspensePreference();
69
- const suspenseEnabled = !disabled && Boolean(providerSuspensePreference);
70
- const swrOptions = {
71
- ...swr ?? {},
72
- suspense: suspenseEnabled
73
- };
74
- const key = react.useMemo(() => {
75
- if (disabled) {
76
- return null;
77
- }
78
- return [QUERY_NAMESPACE, scope, cluster.endpoint, cluster.commitment, ...args];
79
- }, [cluster.commitment, cluster.endpoint, args, scope, disabled]);
80
- const swrResponse = useSWR__default.default(key, () => fetcher(client), swrOptions);
81
- const [dataUpdatedAt, setDataUpdatedAt] = react.useState(
82
- () => swrResponse.data !== void 0 ? Date.now() : void 0
83
- );
84
- react.useEffect(() => {
85
- if (swrResponse.data !== void 0) {
86
- setDataUpdatedAt(Date.now());
87
- }
88
- }, [swrResponse.data]);
89
- const status = swrResponse.error ? "error" : swrResponse.isLoading ? "loading" : swrResponse.data !== void 0 ? "success" : "idle";
90
- const refresh = react.useCallback(() => swrResponse.mutate(void 0, { revalidate: true }), [swrResponse.mutate]);
91
- return {
92
- data: swrResponse.data,
93
- dataUpdatedAt,
94
- error: swrResponse.error ?? null,
95
- isError: status === "error",
96
- isLoading: swrResponse.isLoading,
97
- isSuccess: status === "success",
98
- isValidating: swrResponse.isValidating,
99
- mutate: swrResponse.mutate,
100
- refresh,
101
- status
102
- };
103
- }
104
- __name(useSolanaRpcQuery, "useSolanaRpcQuery");
105
- function getLatestBlockhashKey(params = {}) {
106
- const { commitment = null, minContextSlot = null } = params;
107
- return ["latestBlockhash", commitment, normalizeBigint(minContextSlot)];
108
- }
109
- __name(getLatestBlockhashKey, "getLatestBlockhashKey");
110
- function getProgramAccountsKey(params = {}) {
111
- const { programAddress, config } = params;
112
- const address = programAddress ? client.toAddress(programAddress) : void 0;
113
- const addressKey = address ? client.toAddressString(address) : null;
114
- const configKey = client.stableStringify(config ?? null);
115
- return ["programAccounts", addressKey, configKey];
116
- }
117
- __name(getProgramAccountsKey, "getProgramAccountsKey");
118
- function getSimulateTransactionKey(params = {}) {
119
- const { transaction, config } = params;
120
- const wire = transaction ? normalizeWire(transaction) : null;
121
- const configKey = client.stableStringify(config ?? null);
122
- return ["simulateTransaction", wire, configKey];
123
- }
124
- __name(getSimulateTransactionKey, "getSimulateTransactionKey");
125
- function getSignatureStatusKey(params = {}) {
126
- const { config, signature } = params;
127
- const signatureKey = signature?.toString() ?? null;
128
- const configKey = JSON.stringify(config ?? null);
129
- return ["signatureStatus", signatureKey, configKey];
130
- }
131
- __name(getSignatureStatusKey, "getSignatureStatusKey");
132
- function normalizeBigint(value) {
133
- if (value === void 0 || value === null) return null;
134
- return typeof value === "bigint" ? value : BigInt(Math.floor(value));
135
- }
136
- __name(normalizeBigint, "normalizeBigint");
137
- function normalizeWire(input) {
138
- if (!input) return null;
139
- if (typeof input === "string") {
140
- return input;
141
- }
142
- return kit.getBase64EncodedWireTransaction(input);
143
- }
144
- __name(normalizeWire, "normalizeWire");
145
-
146
- // src/queryHooks.ts
147
- var DEFAULT_BLOCKHASH_REFRESH_INTERVAL = 3e4;
148
- function useLatestBlockhash(options = {}) {
149
- const {
150
- commitment,
151
- minContextSlot,
152
- refreshInterval = DEFAULT_BLOCKHASH_REFRESH_INTERVAL,
153
- disabled = false,
154
- swr
155
- } = options;
156
- const fetcher = react.useCallback(
157
- async (client) => {
158
- const fallbackCommitment = commitment ?? client.store.getState().cluster.commitment;
159
- const plan = client.runtime.rpc.getLatestBlockhash({
160
- commitment: fallbackCommitment,
161
- minContextSlot: normalizeMinContextSlot(minContextSlot)
162
- });
163
- return plan.send({ abortSignal: AbortSignal.timeout(15e3) });
164
- },
165
- [commitment, minContextSlot]
166
- );
167
- const query = useSolanaRpcQuery(
168
- "latestBlockhash",
169
- getLatestBlockhashKey(options),
170
- fetcher,
171
- {
172
- disabled,
173
- swr: {
174
- refreshInterval,
175
- ...swr
176
- }
177
- }
178
- );
179
- return {
180
- ...query,
181
- blockhash: query.data?.value.blockhash ?? null,
182
- contextSlot: query.data?.context.slot,
183
- lastValidBlockHeight: query.data?.value.lastValidBlockHeight ?? null
184
- };
185
- }
186
- __name(useLatestBlockhash, "useLatestBlockhash");
187
- function useProgramAccounts(programAddress, options) {
188
- const { commitment, config, swr, disabled: disabledOption } = options ?? {};
189
- const fetcher = react.useCallback(
190
- async (client$1) => {
191
- const address = programAddress ? client.toAddress(programAddress) : void 0;
192
- if (!address) {
193
- throw new Error("Provide a program address before querying program accounts.");
194
- }
195
- const fallbackCommitment = commitment ?? config?.commitment ?? client$1.store.getState().cluster.commitment;
196
- const mergedConfig = {
197
- ...config ?? {},
198
- commitment: fallbackCommitment
199
- };
200
- const plan = client$1.runtime.rpc.getProgramAccounts(address, mergedConfig);
201
- return plan.send({ abortSignal: AbortSignal.timeout(2e4) });
202
- },
203
- [commitment, config, programAddress]
204
- );
205
- const disabled = disabledOption ?? !programAddress;
206
- const query = useSolanaRpcQuery(
207
- "programAccounts",
208
- getProgramAccountsKey({ programAddress, config }),
209
- fetcher,
210
- {
211
- disabled,
212
- swr
213
- }
214
- );
215
- return {
216
- ...query,
217
- accounts: query.data ?? []
218
- };
219
- }
220
- __name(useProgramAccounts, "useProgramAccounts");
221
- function useSimulateTransaction(transaction, options) {
222
- const { commitment, config, refreshInterval, disabled: disabledOption, swr } = options ?? {};
223
- const wire = react.useMemo(() => {
224
- if (!transaction) {
225
- return null;
226
- }
227
- if (typeof transaction === "string") {
228
- return transaction;
229
- }
230
- return kit.getBase64EncodedWireTransaction(transaction);
231
- }, [transaction]);
232
- const fetcher = react.useCallback(
233
- async (client) => {
234
- if (!wire) {
235
- throw new Error("Provide a transaction payload before simulating.");
236
- }
237
- const resolvedConfig = {
238
- ...config ?? {},
239
- commitment: commitment ?? config?.commitment ?? client.store.getState().cluster.commitment
240
- };
241
- const plan = client.runtime.rpc.simulateTransaction(wire, resolvedConfig);
242
- return plan.send({ abortSignal: AbortSignal.timeout(2e4) });
243
- },
244
- [commitment, config, wire]
245
- );
246
- const disabled = disabledOption ?? !wire;
247
- const query = useSolanaRpcQuery(
248
- "simulateTransaction",
249
- getSimulateTransactionKey({ transaction, config }),
250
- fetcher,
251
- {
252
- disabled,
253
- swr: {
254
- refreshInterval,
255
- revalidateIfStale: false,
256
- revalidateOnFocus: false,
257
- ...swr
258
- }
259
- }
260
- );
261
- return {
262
- ...query,
263
- logs: query.data?.value.logs ?? []
264
- };
265
- }
266
- __name(useSimulateTransaction, "useSimulateTransaction");
267
- function normalizeMinContextSlot(minContextSlot) {
268
- if (minContextSlot === void 0) return void 0;
269
- return typeof minContextSlot === "bigint" ? minContextSlot : BigInt(Math.floor(minContextSlot));
270
- }
271
- __name(normalizeMinContextSlot, "normalizeMinContextSlot");
272
-
273
- // src/hooks.ts
274
- function createClusterSelector() {
275
- return (state) => state.cluster;
276
- }
277
- __name(createClusterSelector, "createClusterSelector");
278
- function createClusterStatusSelector() {
279
- return (state) => state.cluster.status;
280
- }
281
- __name(createClusterStatusSelector, "createClusterStatusSelector");
282
- function createWalletSelector() {
283
- return (state) => state.wallet;
284
- }
285
- __name(createWalletSelector, "createWalletSelector");
286
- function createAccountSelector(key) {
287
- return (state) => key ? state.accounts[key] : void 0;
288
- }
289
- __name(createAccountSelector, "createAccountSelector");
290
- function useSuspenseFetcher(config) {
291
- const preference = useQuerySuspensePreference();
292
- const suspenseEnabled = Boolean(preference) && config.enabled;
293
- const pendingRef = react.useRef(null);
294
- react.useEffect(() => {
295
- if (!suspenseEnabled) {
296
- pendingRef.current = null;
297
- return;
298
- }
299
- if (pendingRef.current && pendingRef.current.key !== config.key) {
300
- pendingRef.current = null;
301
- }
302
- }, [config.key, suspenseEnabled]);
303
- if (pendingRef.current && pendingRef.current.key !== config.key) {
304
- pendingRef.current = null;
305
- }
306
- if (suspenseEnabled && config.key && !config.ready) {
307
- if (!pendingRef.current) {
308
- const promise = config.fetcher();
309
- pendingRef.current = {
310
- key: config.key,
311
- promise: promise.finally(() => {
312
- if (pendingRef.current?.promise === promise) {
313
- pendingRef.current = null;
314
- }
315
- })
316
- };
317
- }
318
- throw pendingRef.current.promise;
319
- }
320
- }
321
- __name(useSuspenseFetcher, "useSuspenseFetcher");
322
- function useClusterState() {
323
- const selector = react.useMemo(createClusterSelector, []);
324
- return useClientStore(selector);
325
- }
326
- __name(useClusterState, "useClusterState");
327
- function useClusterStatus() {
328
- const selector = react.useMemo(createClusterStatusSelector, []);
329
- return useClientStore(selector);
330
- }
331
- __name(useClusterStatus, "useClusterStatus");
332
- function useWallet() {
333
- const selector = react.useMemo(createWalletSelector, []);
334
- return useClientStore(selector);
335
- }
336
- __name(useWallet, "useWallet");
337
- function useWalletSession() {
338
- const wallet = useWallet();
339
- if (wallet.status === "connected") {
340
- return wallet.session;
341
- }
342
- return void 0;
343
- }
344
- __name(useWalletSession, "useWalletSession");
345
- function useWalletActions() {
346
- const client = useSolanaClient();
347
- return client.actions;
348
- }
349
- __name(useWalletActions, "useWalletActions");
350
- function useConnectWallet() {
351
- const client = useSolanaClient();
352
- return react.useCallback(
353
- (connectorId, options) => client.actions.connectWallet(connectorId, options),
354
- [client]
355
- );
356
- }
357
- __name(useConnectWallet, "useConnectWallet");
358
- function useDisconnectWallet() {
359
- const client = useSolanaClient();
360
- return react.useCallback(() => client.actions.disconnectWallet(), [client]);
361
- }
362
- __name(useDisconnectWallet, "useDisconnectWallet");
363
- function useSolTransfer() {
364
- const client$1 = useSolanaClient();
365
- const session = useWalletSession();
366
- const helper = client$1.solTransfer;
367
- const sessionRef = react.useRef(session);
368
- react.useEffect(() => {
369
- sessionRef.current = session;
370
- }, [session]);
371
- const controller = react.useMemo(
372
- () => client.createSolTransferController({
373
- authorityProvider: /* @__PURE__ */ __name(() => sessionRef.current, "authorityProvider"),
374
- helper
375
- }),
376
- [helper]
377
- );
378
- const state = react.useSyncExternalStore(
379
- controller.subscribe,
380
- controller.getState,
381
- controller.getState
382
- );
383
- const send = react.useCallback(
384
- (config, options) => controller.send(config, options),
385
- [controller]
386
- );
387
- return {
388
- error: state.error ?? null,
389
- helper,
390
- isSending: state.status === "loading",
391
- reset: controller.reset,
392
- send,
393
- signature: state.data ?? null,
394
- status: state.status
395
- };
396
- }
397
- __name(useSolTransfer, "useSolTransfer");
398
- function useStake(validatorId) {
399
- const client$1 = useSolanaClient();
400
- const session = useWalletSession();
401
- const helper = client$1.stake;
402
- const sessionRef = react.useRef(session);
403
- const normalizedValidatorId = react.useMemo(() => String(validatorId), [validatorId]);
404
- react.useEffect(() => {
405
- sessionRef.current = session;
406
- }, [session]);
407
- const controller = react.useMemo(
408
- () => client.createStakeController({
409
- authorityProvider: /* @__PURE__ */ __name(() => sessionRef.current, "authorityProvider"),
410
- helper
411
- }),
412
- [helper]
413
- );
414
- const state = react.useSyncExternalStore(
415
- controller.subscribe,
416
- controller.getState,
417
- controller.getState
418
- );
419
- const unstakeState = react.useSyncExternalStore(
420
- controller.subscribeUnstake,
421
- controller.getUnstakeState,
422
- controller.getUnstakeState
423
- );
424
- const withdrawState = react.useSyncExternalStore(
425
- controller.subscribeWithdraw,
426
- controller.getWithdrawState,
427
- controller.getWithdrawState
428
- );
429
- const stake = react.useCallback(
430
- (config, options) => controller.stake({ ...config, validatorId: normalizedValidatorId }, options),
431
- [controller, normalizedValidatorId]
432
- );
433
- const unstake = react.useCallback(
434
- (config, options) => controller.unstake({ ...config }, options),
435
- [controller]
436
- );
437
- const withdraw = react.useCallback(
438
- (config, options) => controller.withdraw({ ...config }, options),
439
- [controller]
440
- );
441
- const getStakeAccounts = react.useCallback(
442
- async (wallet, validatorIdFilter) => {
443
- if (!helper.getStakeAccounts) {
444
- throw new Error(
445
- "getStakeAccounts is not available. Make sure you have the latest version of @solana/client package."
446
- );
447
- }
448
- const walletAddr = typeof wallet === "string" ? wallet : String(wallet);
449
- const filterAddr = validatorIdFilter ? typeof validatorIdFilter === "string" ? validatorIdFilter : String(validatorIdFilter) : void 0;
450
- return helper.getStakeAccounts(walletAddr, filterAddr);
451
- },
452
- [helper]
453
- );
454
- return {
455
- error: state.error ?? null,
456
- getStakeAccounts,
457
- helper,
458
- isStaking: state.status === "loading",
459
- isUnstaking: unstakeState.status === "loading",
460
- isWithdrawing: withdrawState.status === "loading",
461
- reset: controller.reset,
462
- resetUnstake: controller.resetUnstake,
463
- resetWithdraw: controller.resetWithdraw,
464
- stake,
465
- unstake,
466
- withdraw,
467
- signature: state.data ?? null,
468
- unstakeSignature: unstakeState.data ?? null,
469
- withdrawSignature: withdrawState.data ?? null,
470
- status: state.status,
471
- unstakeStatus: unstakeState.status,
472
- withdrawStatus: withdrawState.status,
473
- unstakeError: unstakeState.error ?? null,
474
- withdrawError: withdrawState.error ?? null,
475
- validatorId: normalizedValidatorId
476
- };
477
- }
478
- __name(useStake, "useStake");
479
- function useSplToken(mint, options = {}) {
480
- const client$1 = useSolanaClient();
481
- const session = useWalletSession();
482
- const suspense = Boolean(useQuerySuspensePreference());
483
- const normalizedMint = react.useMemo(() => String(mint), [mint]);
484
- const helperConfig = react.useMemo(
485
- () => ({
486
- commitment: options.commitment,
487
- mint: normalizedMint,
488
- ...options.config ?? {}
489
- }),
490
- [normalizedMint, options.commitment, options.config]
491
- );
492
- const helper = react.useMemo(() => client$1.splToken(helperConfig), [client$1, helperConfig]);
493
- const ownerRaw = options.owner ?? session?.account.address;
494
- const owner = react.useMemo(() => ownerRaw ? String(ownerRaw) : null, [ownerRaw]);
495
- const balanceKey = owner ? ["spl-balance", normalizedMint, owner, options.commitment ?? null] : null;
496
- const fetchBalance = react.useCallback(() => {
497
- if (!owner) {
498
- throw new Error("Unable to fetch SPL balance without an owner.");
499
- }
500
- return helper.fetchBalance(owner, options.commitment);
501
- }, [helper, owner, options.commitment]);
502
- const swrOptions = react.useMemo(
503
- () => ({
504
- revalidateOnFocus: options.revalidateOnFocus ?? false,
505
- suspense,
506
- ...options.swr ?? {}
507
- }),
508
- [options.revalidateOnFocus, options.swr, suspense]
509
- );
510
- const { data, error, isLoading, isValidating, mutate } = useSWR__default.default(
511
- balanceKey,
512
- fetchBalance,
513
- swrOptions
514
- );
515
- const sessionRef = react.useRef(session);
516
- react.useEffect(() => {
517
- sessionRef.current = session;
518
- }, [session]);
519
- const ownerRef = react.useRef(owner);
520
- react.useEffect(() => {
521
- ownerRef.current = owner;
522
- }, [owner]);
523
- const controller = react.useMemo(
524
- () => client.createSplTransferController({
525
- authorityProvider: /* @__PURE__ */ __name(() => sessionRef.current ?? void 0, "authorityProvider"),
526
- helper,
527
- sourceOwnerProvider: /* @__PURE__ */ __name(() => ownerRef.current ?? void 0, "sourceOwnerProvider")
528
- }),
529
- [helper]
530
- );
531
- const sendState = react.useSyncExternalStore(
532
- controller.subscribe,
533
- controller.getState,
534
- controller.getState
535
- );
536
- const refresh = react.useCallback(() => {
537
- if (!owner) {
538
- return Promise.resolve(void 0);
539
- }
540
- return mutate(() => helper.fetchBalance(owner, options.commitment), { revalidate: false });
541
- }, [helper, mutate, owner, options.commitment]);
542
- const send = react.useCallback(
543
- async (config, sendOptions) => {
544
- const signature = await controller.send(config, sendOptions);
545
- if (owner) {
546
- await mutate(() => helper.fetchBalance(owner, options.commitment), { revalidate: false });
547
- }
548
- return signature;
549
- },
550
- [controller, helper, mutate, options.commitment, owner]
551
- );
552
- const resetSend = react.useCallback(() => {
553
- controller.reset();
554
- }, [controller]);
555
- const status = owner === null ? "disconnected" : error ? "error" : isLoading && !data ? "loading" : "ready";
556
- return {
557
- balance: data ?? null,
558
- error: error ?? null,
559
- helper,
560
- isFetching: Boolean(owner) && (isLoading || isValidating),
561
- isSending: sendState.status === "loading",
562
- owner,
563
- refresh,
564
- refreshing: Boolean(owner) && isValidating,
565
- resetSend,
566
- send,
567
- sendError: sendState.error ?? null,
568
- sendSignature: sendState.data ?? null,
569
- sendStatus: sendState.status,
570
- status
571
- };
572
- }
573
- __name(useSplToken, "useSplToken");
574
- function useAccount(addressLike, options = {}) {
575
- const client$1 = useSolanaClient();
576
- const shouldSkip = options.skip ?? !addressLike;
577
- const address = react.useMemo(() => {
578
- if (shouldSkip || !addressLike) {
579
- return void 0;
580
- }
581
- return client.toAddress(addressLike);
582
- }, [addressLike, shouldSkip]);
583
- const accountKey = react.useMemo(() => address?.toString(), [address]);
584
- const selector = react.useMemo(() => createAccountSelector(accountKey), [accountKey]);
585
- const account = useClientStore(selector);
586
- useSuspenseFetcher({
587
- enabled: options.fetch !== false && !shouldSkip && Boolean(address),
588
- fetcher: /* @__PURE__ */ __name(() => {
589
- if (!address) {
590
- throw new Error("Provide an address before fetching account data.");
591
- }
592
- return client$1.actions.fetchAccount(address, options.commitment);
593
- }, "fetcher"),
594
- key: accountKey ?? null,
595
- ready: account !== void 0
596
- });
597
- react.useEffect(() => {
598
- if (!address) {
599
- return;
600
- }
601
- const commitment = options.commitment;
602
- if (options.fetch !== false && account === void 0) {
603
- void client$1.actions.fetchAccount(address, commitment).catch(() => void 0);
604
- }
605
- if (options.watch) {
606
- const subscription = client$1.watchers.watchAccount({ address, commitment }, () => void 0);
607
- return () => {
608
- subscription.abort();
609
- };
610
- }
611
- return void 0;
612
- }, [account, address, client$1, options.commitment, options.fetch, options.watch]);
613
- return account;
614
- }
615
- __name(useAccount, "useAccount");
616
- function useBalance(addressLike, options = {}) {
617
- const mergedOptions = react.useMemo(
618
- () => ({
619
- commitment: options.commitment,
620
- fetch: options.fetch ?? true,
621
- skip: options.skip,
622
- watch: options.watch ?? true
623
- }),
624
- [options.commitment, options.fetch, options.skip, options.watch]
625
- );
626
- const client$1 = useSolanaClient();
627
- const shouldSkip = mergedOptions.skip ?? !addressLike;
628
- const address = react.useMemo(() => {
629
- if (shouldSkip || !addressLike) {
630
- return void 0;
631
- }
632
- return client.toAddress(addressLike);
633
- }, [addressLike, shouldSkip]);
634
- const accountKey = react.useMemo(() => address?.toString(), [address]);
635
- const selector = react.useMemo(() => createAccountSelector(accountKey), [accountKey]);
636
- const account = useClientStore(selector);
637
- useSuspenseFetcher({
638
- enabled: mergedOptions.fetch !== false && !shouldSkip && Boolean(address),
639
- fetcher: /* @__PURE__ */ __name(() => {
640
- if (!address) {
641
- throw new Error("Provide an address before fetching balance.");
642
- }
643
- return client$1.actions.fetchBalance(address, mergedOptions.commitment);
644
- }, "fetcher"),
645
- key: accountKey ?? null,
646
- ready: account !== void 0
647
- });
648
- react.useEffect(() => {
649
- if (!address) {
650
- return;
651
- }
652
- const commitment = mergedOptions.commitment;
653
- if (mergedOptions.fetch !== false && account === void 0) {
654
- void client$1.actions.fetchBalance(address, commitment).catch(() => void 0);
655
- }
656
- if (mergedOptions.watch) {
657
- const watcher = client$1.watchers.watchBalance({ address, commitment }, () => void 0);
658
- return () => {
659
- watcher.abort();
660
- };
661
- }
662
- return void 0;
663
- }, [account, address, client$1, mergedOptions.commitment, mergedOptions.fetch, mergedOptions.watch]);
664
- const lamports = account?.lamports ?? null;
665
- const fetching = account?.fetching ?? false;
666
- const slot = account?.slot;
667
- const error = account?.error;
668
- return react.useMemo(
669
- () => ({
670
- account,
671
- error,
672
- fetching,
673
- lamports,
674
- slot
675
- }),
676
- [account, error, fetching, lamports, slot]
677
- );
678
- }
679
- __name(useBalance, "useBalance");
680
- function useTransactionPool(config = {}) {
681
- const initialInstructions = react.useMemo(
682
- () => config.instructions ?? [],
683
- [config.instructions]
684
- );
685
- const client$1 = useSolanaClient();
686
- const helper = client$1.helpers.transaction;
687
- const swrRefreshInterval = config.latestBlockhash?.swr?.refreshInterval;
688
- const blockhashRefreshInterval = config.latestBlockhash?.refreshInterval ?? (typeof swrRefreshInterval === "number" ? swrRefreshInterval : void 0);
689
- const blockhashMaxAgeMs = blockhashRefreshInterval ?? 3e4;
690
- const controller = react.useMemo(
691
- () => client.createTransactionPoolController({
692
- blockhashMaxAgeMs,
693
- helper,
694
- initialInstructions
695
- }),
696
- [blockhashMaxAgeMs, helper, initialInstructions]
697
- );
698
- const latestBlockhash = useLatestBlockhash(config.latestBlockhash);
699
- react.useEffect(() => {
700
- const value = latestBlockhash.data?.value;
701
- if (!value) {
702
- controller.setLatestBlockhashCache(void 0);
703
- return;
704
- }
705
- const cache = {
706
- updatedAt: latestBlockhash.dataUpdatedAt ?? Date.now(),
707
- value
708
- };
709
- controller.setLatestBlockhashCache(cache);
710
- }, [controller, latestBlockhash.data, latestBlockhash.dataUpdatedAt]);
711
- const instructions = react.useSyncExternalStore(
712
- controller.subscribeInstructions,
713
- controller.getInstructions,
714
- controller.getInstructions
715
- );
716
- const prepared = react.useSyncExternalStore(
717
- controller.subscribePrepared,
718
- controller.getPrepared,
719
- controller.getPrepared
720
- );
721
- const prepareState = react.useSyncExternalStore(
722
- controller.subscribePrepareState,
723
- controller.getPrepareState,
724
- controller.getPrepareState
725
- );
726
- const sendState = react.useSyncExternalStore(
727
- controller.subscribeSendState,
728
- controller.getSendState,
729
- controller.getSendState
730
- );
731
- return {
732
- addInstruction: controller.addInstruction,
733
- addInstructions: controller.addInstructions,
734
- clearInstructions: controller.clearInstructions,
735
- instructions,
736
- isPreparing: prepareState.status === "loading",
737
- isSending: sendState.status === "loading",
738
- prepared,
739
- prepare: controller.prepare,
740
- prepareError: prepareState.error ?? null,
741
- prepareStatus: prepareState.status,
742
- removeInstruction: controller.removeInstruction,
743
- replaceInstructions: controller.replaceInstructions,
744
- reset: controller.reset,
745
- send: controller.send,
746
- sendError: sendState.error ?? null,
747
- sendSignature: sendState.data ?? null,
748
- sendStatus: sendState.status,
749
- prepareAndSend: controller.prepareAndSend,
750
- sign: controller.sign,
751
- toWire: controller.toWire,
752
- latestBlockhash
753
- };
754
- }
755
- __name(useTransactionPool, "useTransactionPool");
756
- function useSendTransaction() {
757
- const client$1 = useSolanaClient();
758
- const helper = client$1.transaction;
759
- const session = useWalletSession();
760
- const [state, setState] = react.useState(
761
- () => client.createInitialAsyncState()
762
- );
763
- const execute = react.useCallback(
764
- async (operation) => {
765
- setState(client.createAsyncState("loading"));
766
- try {
767
- const signature = await operation();
768
- setState(client.createAsyncState("success", { data: signature }));
769
- return signature;
770
- } catch (error) {
771
- setState(client.createAsyncState("error", { error }));
772
- throw error;
773
- }
774
- },
775
- []
776
- );
777
- const ensureAuthority = react.useCallback(
778
- (request) => {
779
- if (request.authority) {
780
- return request;
781
- }
782
- if (!session) {
783
- throw new Error("Connect a wallet or supply an `authority` before sending transactions.");
784
- }
785
- return { ...request, authority: session };
786
- },
787
- [session]
788
- );
789
- const send = react.useCallback(
790
- async (request, options) => {
791
- const normalizedRequest = ensureAuthority(request);
792
- return execute(() => helper.prepareAndSend(normalizedRequest, options));
793
- },
794
- [ensureAuthority, execute, helper]
795
- );
796
- const sendPrepared = react.useCallback(
797
- async (prepared, options) => execute(() => helper.send(prepared, options)),
798
- [execute, helper]
799
- );
800
- const reset = react.useCallback(() => {
801
- setState(client.createInitialAsyncState());
802
- }, []);
803
- return {
804
- error: state.error ?? null,
805
- isSending: state.status === "loading",
806
- reset,
807
- send,
808
- sendPrepared,
809
- signature: state.data ?? null,
810
- status: state.status
811
- };
812
- }
813
- __name(useSendTransaction, "useSendTransaction");
814
- function useSignatureStatus(signatureInput, options = {}) {
815
- const { config, disabled: disabledOption, swr } = options;
816
- const signature = react.useMemo(() => client.normalizeSignature(signatureInput), [signatureInput]);
817
- const signatureKey = signature?.toString() ?? null;
818
- const fetcher = react.useCallback(
819
- async (client$1) => {
820
- if (!signatureKey) {
821
- throw new Error("Provide a signature before querying its status.");
822
- }
823
- if (!signature) {
824
- throw new Error("Provide a signature before querying its status.");
825
- }
826
- const plan = client$1.runtime.rpc.getSignatureStatuses([signature], config);
827
- const response = await plan.send({ abortSignal: AbortSignal.timeout(client.SIGNATURE_STATUS_TIMEOUT_MS) });
828
- return response.value[0] ?? null;
829
- },
830
- [config, signature, signatureKey]
831
- );
832
- const disabled = disabledOption ?? !signatureKey;
833
- const query = useSolanaRpcQuery(
834
- "signatureStatus",
835
- getSignatureStatusKey({ signature: signatureInput, config }),
836
- fetcher,
837
- {
838
- disabled,
839
- swr
840
- }
841
- );
842
- const confirmationStatus = client.deriveConfirmationStatus(query.data ?? null);
843
- return {
844
- ...query,
845
- confirmationStatus,
846
- signatureStatus: query.data ?? null
847
- };
848
- }
849
- __name(useSignatureStatus, "useSignatureStatus");
850
- function useWaitForSignature(signatureInput, options = {}) {
851
- const {
852
- commitment = "confirmed",
853
- disabled: disabledOption,
854
- subscribe = true,
855
- watchCommitment,
856
- ...signatureStatusOptions
857
- } = options;
858
- const { swr, ...restStatusOptions } = signatureStatusOptions;
859
- const subscribeCommitment = watchCommitment ?? commitment;
860
- const client$1 = useSolanaClient();
861
- const normalizedSignature = react.useMemo(() => client.normalizeSignature(signatureInput), [signatureInput]);
862
- const disabled = disabledOption ?? !normalizedSignature;
863
- const statusQuery = useSignatureStatus(signatureInput, {
864
- ...restStatusOptions,
865
- swr: {
866
- refreshInterval: 2e3,
867
- ...swr
868
- },
869
- disabled
870
- });
871
- const [subscriptionSettled, setSubscriptionSettled] = react.useState(false);
872
- react.useEffect(() => {
873
- if (normalizedSignature === void 0) {
874
- setSubscriptionSettled(false);
875
- return;
876
- }
877
- setSubscriptionSettled(false);
878
- }, [normalizedSignature]);
879
- react.useEffect(() => {
880
- if (!normalizedSignature || disabled || !subscribe) {
881
- return;
882
- }
883
- const subscription = client$1.watchers.watchSignature(
884
- {
885
- commitment: subscribeCommitment,
886
- enableReceivedNotification: true,
887
- signature: normalizedSignature
888
- },
889
- () => {
890
- setSubscriptionSettled(true);
891
- }
892
- );
893
- return () => {
894
- subscription.abort();
895
- };
896
- }, [client$1, disabled, normalizedSignature, subscribe, subscribeCommitment]);
897
- const hasSignature = Boolean(normalizedSignature) && !disabled;
898
- const signatureError = statusQuery.signatureStatus?.err ?? null;
899
- const waitError = statusQuery.error ?? signatureError ?? null;
900
- const meetsCommitment = client.confirmationMeetsCommitment(statusQuery.confirmationStatus, commitment);
901
- const settled = subscriptionSettled || meetsCommitment;
902
- let waitStatus = "idle";
903
- if (!hasSignature) {
904
- waitStatus = "idle";
905
- } else if (waitError) {
906
- waitStatus = "error";
907
- } else if (settled) {
908
- waitStatus = "success";
909
- } else {
910
- waitStatus = "waiting";
911
- }
912
- return {
913
- ...statusQuery,
914
- isError: waitStatus === "error",
915
- isSuccess: waitStatus === "success",
916
- isWaiting: waitStatus === "waiting",
917
- waitError,
918
- waitStatus
919
- };
920
- }
921
- __name(useWaitForSignature, "useWaitForSignature");
922
- function useLookupTable(addressLike, options = {}) {
923
- const addr = react.useMemo(() => addressLike ? client.toAddress(addressLike) : void 0, [addressLike]);
924
- const key = addr?.toString() ?? null;
925
- const fetcher = react.useCallback(
926
- async (c) => {
927
- if (!addr) throw new Error("Address required");
928
- return c.actions.fetchLookupTable(addr, options.commitment);
929
- },
930
- [addr, options.commitment]
931
- );
932
- return useSolanaRpcQuery("lookupTable", [key, options.commitment], fetcher, {
933
- disabled: !addr,
934
- swr: options.swr
935
- });
936
- }
937
- __name(useLookupTable, "useLookupTable");
938
- function useNonceAccount(addressLike, options = {}) {
939
- const addr = react.useMemo(() => addressLike ? client.toAddress(addressLike) : void 0, [addressLike]);
940
- const key = addr?.toString() ?? null;
941
- const fetcher = react.useCallback(
942
- async (c) => {
943
- if (!addr) throw new Error("Address required");
944
- return c.actions.fetchNonceAccount(addr, options.commitment);
945
- },
946
- [addr, options.commitment]
947
- );
948
- return useSolanaRpcQuery("nonceAccount", [key, options.commitment], fetcher, {
949
- disabled: !addr,
950
- swr: options.swr
951
- });
952
- }
953
- __name(useNonceAccount, "useNonceAccount");
954
- var createCache = /* @__PURE__ */ __name(() => /* @__PURE__ */ new Map(), "createCache");
955
- var DEFAULT_QUERY_CONFIG = Object.freeze({
956
- dedupingInterval: 2e3,
957
- focusThrottleInterval: 5e3,
958
- provider: /* @__PURE__ */ __name(() => createCache(), "provider"),
959
- revalidateIfStale: true,
960
- revalidateOnFocus: true,
961
- revalidateOnReconnect: true
962
- });
963
- function SolanaQueryProvider({
964
- children,
965
- config,
966
- resetOnClusterChange = true,
967
- suspense
968
- }) {
969
- const cluster = useClientStore((state) => state.cluster);
970
- const cacheRegistryRef = react.useRef(/* @__PURE__ */ new Map());
971
- const cacheKey = resetOnClusterChange ? `${cluster.endpoint}|${cluster.commitment}` : "global";
972
- const cache = react.useMemo(() => {
973
- const registry = cacheRegistryRef.current;
974
- if (!resetOnClusterChange) {
975
- const existing = registry.get("global");
976
- if (existing) {
977
- return existing;
978
- }
979
- const next2 = createCache();
980
- registry.set("global", next2);
981
- return next2;
982
- }
983
- const next = createCache();
984
- registry.set(cacheKey, next);
985
- return next;
986
- }, [cacheKey, resetOnClusterChange]);
987
- const value = react.useMemo(() => {
988
- const base = {
989
- ...DEFAULT_QUERY_CONFIG,
990
- ...config
991
- };
992
- if (!config?.provider) {
993
- base.provider = () => cache;
994
- }
995
- if (base.suspense === void 0 && suspense !== void 0) {
996
- base.suspense = suspense;
997
- }
998
- return base;
999
- }, [cache, config, suspense]);
1000
- return /* @__PURE__ */ jsxRuntime.jsx(QuerySuspenseContext.Provider, { value: suspense, children: /* @__PURE__ */ jsxRuntime.jsx(useSWR.SWRConfig, { value, children }) });
1001
- }
1002
- __name(SolanaQueryProvider, "SolanaQueryProvider");
1003
- function SolanaProvider({ children, client: client$1, config, query, walletPersistence }) {
1004
- const shouldIncludeQueryLayer = query !== false && query?.disabled !== true;
1005
- const queryProps = shouldIncludeQueryLayer && query ? query : {};
1006
- const persistenceConfig = walletPersistence === false ? void 0 : walletPersistence ?? {};
1007
- const storage = persistenceConfig ? persistenceConfig.storage ?? getDefaultStorage() : null;
1008
- const storageKey = persistenceConfig?.storageKey ?? DEFAULT_STORAGE_KEY;
1009
- const persistedState = persistenceConfig ? readPersistedState(storage, storageKey) : { legacyConnectorId: null, state: null };
1010
- const normalizedConfig = config ? client.resolveClientConfig(config) : client.resolveClientConfig();
1011
- const clientConfig = persistenceConfig ? { ...normalizedConfig, initialState: normalizedConfig.initialState ?? persistedState.state ?? void 0 } : normalizedConfig;
1012
- const content = shouldIncludeQueryLayer ? /* @__PURE__ */ jsxRuntime.jsx(
1013
- SolanaQueryProvider,
1014
- {
1015
- config: queryProps.config,
1016
- resetOnClusterChange: queryProps.resetOnClusterChange,
1017
- suspense: queryProps.suspense,
1018
- children
1019
- }
1020
- ) : children;
1021
- return /* @__PURE__ */ jsxRuntime.jsxs(SolanaClientProvider, { client: client$1, config: clientConfig, children: [
1022
- persistenceConfig ? /* @__PURE__ */ jsxRuntime.jsx(
1023
- WalletPersistence,
1024
- {
1025
- autoConnect: persistenceConfig.autoConnect,
1026
- initialState: clientConfig?.initialState ?? persistedState.state,
1027
- legacyConnectorId: persistedState.legacyConnectorId,
1028
- storage,
1029
- storageKey
1030
- }
1031
- ) : null,
1032
- content
1033
- ] });
1034
- }
1035
- __name(SolanaProvider, "SolanaProvider");
1036
- var DEFAULT_STORAGE_KEY = "solana:last-connector";
1037
- function readPersistedState(storage, storageKey) {
1038
- if (!storage) {
1039
- return { legacyConnectorId: null, state: null };
1040
- }
1041
- const raw = safelyRead(() => storage.getItem(storageKey));
1042
- if (!raw) {
1043
- return { legacyConnectorId: null, state: null };
1044
- }
1045
- const parsed = client.deserializeSolanaState(raw);
1046
- if (parsed) {
1047
- return { legacyConnectorId: null, state: parsed };
1048
- }
1049
- return { legacyConnectorId: raw, state: null };
1050
- }
1051
- __name(readPersistedState, "readPersistedState");
1052
- function WalletPersistence({
1053
- autoConnect = true,
1054
- initialState = null,
1055
- legacyConnectorId = null,
1056
- storage,
1057
- storageKey = DEFAULT_STORAGE_KEY
1058
- }) {
1059
- const wallet = useWallet();
1060
- const connectWallet = useConnectWallet();
1061
- const client$1 = useSolanaClient();
1062
- const storageRef = react.useRef(storage ?? getDefaultStorage());
1063
- const [hasAttemptedAutoConnect, setHasAttemptedAutoConnect] = react.useState(false);
1064
- const clientRef = react.useRef(null);
1065
- const persistedStateRef = react.useRef(initialState);
1066
- const legacyConnectorIdRef = react.useRef(legacyConnectorId);
1067
- react.useEffect(() => {
1068
- storageRef.current = storage ?? getDefaultStorage();
1069
- }, [storage]);
1070
- react.useEffect(() => {
1071
- if (clientRef.current !== client$1) {
1072
- clientRef.current = client$1;
1073
- setHasAttemptedAutoConnect(false);
1074
- }
1075
- }, [client$1]);
1076
- react.useEffect(() => {
1077
- const activeStorage = storageRef.current;
1078
- if (!activeStorage) return;
1079
- const unsubscribe = client.subscribeSolanaState(client$1, (state) => {
1080
- persistedStateRef.current = state;
1081
- legacyConnectorIdRef.current = null;
1082
- safelyWrite(() => activeStorage.setItem(storageKey, client.serializeSolanaState(state)));
1083
- });
1084
- return () => {
1085
- unsubscribe();
1086
- };
1087
- }, [client$1, storageKey]);
1088
- react.useEffect(() => {
1089
- persistedStateRef.current = initialState ?? persistedStateRef.current;
1090
- legacyConnectorIdRef.current = legacyConnectorId;
1091
- }, [initialState, legacyConnectorId]);
1092
- react.useEffect(() => {
1093
- const persisted = persistedStateRef.current ?? initialState;
1094
- const persistedAutoConnect = persisted?.autoconnect ?? false;
1095
- const autoConnectEnabled = persistedAutoConnect || autoConnect;
1096
- if (!autoConnectEnabled || hasAttemptedAutoConnect) {
1097
- return;
1098
- }
1099
- if (wallet.status === "connected" || wallet.status === "connecting") {
1100
- setHasAttemptedAutoConnect(true);
1101
- return;
1102
- }
1103
- const connectorId = persisted?.lastConnectorId ?? legacyConnectorIdRef.current;
1104
- const shouldAutoConnect = autoConnectEnabled && connectorId;
1105
- if (!shouldAutoConnect || !connectorId) return;
1106
- const connector = client$1.connectors.get(connectorId);
1107
- if (!connector) return;
1108
- void (async () => {
1109
- try {
1110
- await connectWallet(connectorId, { autoConnect: true, allowInteractiveFallback: false });
1111
- } catch {
1112
- } finally {
1113
- setHasAttemptedAutoConnect(true);
1114
- }
1115
- })();
1116
- }, [autoConnect, client$1, connectWallet, hasAttemptedAutoConnect, initialState, wallet.status]);
1117
- return null;
1118
- }
1119
- __name(WalletPersistence, "WalletPersistence");
1120
- function safelyRead(reader) {
1121
- try {
1122
- return reader();
1123
- } catch {
1124
- return null;
1125
- }
1126
- }
1127
- __name(safelyRead, "safelyRead");
1128
- function safelyWrite(writer) {
1129
- try {
1130
- writer();
1131
- } catch {
1132
- }
1133
- }
1134
- __name(safelyWrite, "safelyWrite");
1135
- function getDefaultStorage() {
1136
- if (typeof globalThis !== "object" || globalThis === null) {
1137
- return null;
1138
- }
1139
- const candidate = globalThis.localStorage;
1140
- if (!candidate) {
1141
- return null;
1142
- }
1143
- return candidate;
1144
- }
1145
- __name(getDefaultStorage, "getDefaultStorage");
1146
- function useWalletConnection(options = {}) {
1147
- const wallet = useWallet();
1148
- const connectWallet = useConnectWallet();
1149
- const disconnectWallet = useDisconnectWallet();
1150
- const client = useSolanaClient();
1151
- const [isHydrated, setIsHydrated] = react.useState(false);
1152
- react.useEffect(() => {
1153
- setIsHydrated(true);
1154
- }, []);
1155
- const connectors = isHydrated ? options.connectors ?? client.connectors.all : [];
1156
- const connect = react.useCallback(
1157
- (connectorId, connectOptions) => connectWallet(connectorId, connectOptions),
1158
- [connectWallet]
1159
- );
1160
- const disconnect = react.useCallback(() => disconnectWallet(), [disconnectWallet]);
1161
- const state = react.useMemo(() => {
1162
- const connectorId = "connectorId" in wallet ? wallet.connectorId : void 0;
1163
- const currentConnector = connectorId ? connectors.find((connector) => connector.id === connectorId) : void 0;
1164
- const session = wallet.status === "connected" ? wallet.session : void 0;
1165
- const error = wallet.status === "error" ? wallet.error ?? null : null;
1166
- return {
1167
- connect,
1168
- connected: wallet.status === "connected",
1169
- connecting: wallet.status === "connecting",
1170
- connectors,
1171
- connectorId,
1172
- currentConnector,
1173
- disconnect,
1174
- error,
1175
- status: wallet.status,
1176
- wallet: session
1177
- };
1178
- }, [connect, connectors, disconnect, wallet]);
1179
- return state;
1180
- }
1181
- __name(useWalletConnection, "useWalletConnection");
1182
- function WalletConnectionManager({ children, connectors }) {
1183
- const state = useWalletConnection({ connectors });
1184
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children(state) });
1185
- }
1186
- __name(WalletConnectionManager, "WalletConnectionManager");
1187
- function useWalletModalState(options = {}) {
1188
- const connection = useWalletConnection(options);
1189
- const [isOpen, setIsOpen] = react.useState(options.initialOpen ?? false);
1190
- const [selectedConnector, setSelectedConnector] = react.useState(null);
1191
- const closeOnConnect = options.closeOnConnect ?? true;
1192
- const open = react.useCallback(() => setIsOpen(true), []);
1193
- const close = react.useCallback(() => setIsOpen(false), []);
1194
- const toggle = react.useCallback(() => setIsOpen((value) => !value), []);
1195
- const select = react.useCallback((connectorId) => setSelectedConnector(connectorId), []);
1196
- const connect = react.useCallback(
1197
- async (connectorId, connectOptions) => {
1198
- await connection.connect(connectorId, connectOptions);
1199
- setSelectedConnector(connectorId);
1200
- if (closeOnConnect) {
1201
- setIsOpen(false);
1202
- }
1203
- },
1204
- [closeOnConnect, connection]
1205
- );
1206
- return {
1207
- ...connection,
1208
- close,
1209
- connect,
1210
- isOpen,
1211
- open,
1212
- selectedConnector,
1213
- select,
1214
- toggle
1215
- };
1216
- }
1217
- __name(useWalletModalState, "useWalletModalState");
1218
-
1219
- exports.SolanaClientProvider = SolanaClientProvider;
1220
- exports.SolanaProvider = SolanaProvider;
1221
- exports.SolanaQueryProvider = SolanaQueryProvider;
1222
- exports.WalletConnectionManager = WalletConnectionManager;
1223
- exports.getLatestBlockhashKey = getLatestBlockhashKey;
1224
- exports.getProgramAccountsKey = getProgramAccountsKey;
1225
- exports.getSignatureStatusKey = getSignatureStatusKey;
1226
- exports.getSimulateTransactionKey = getSimulateTransactionKey;
1227
- exports.useAccount = useAccount;
1228
- exports.useBalance = useBalance;
1229
- exports.useClientStore = useClientStore;
1230
- exports.useClusterState = useClusterState;
1231
- exports.useClusterStatus = useClusterStatus;
1232
- exports.useConnectWallet = useConnectWallet;
1233
- exports.useDisconnectWallet = useDisconnectWallet;
1234
- exports.useLatestBlockhash = useLatestBlockhash;
1235
- exports.useLookupTable = useLookupTable;
1236
- exports.useNonceAccount = useNonceAccount;
1237
- exports.useProgramAccounts = useProgramAccounts;
1238
- exports.useSendTransaction = useSendTransaction;
1239
- exports.useSignatureStatus = useSignatureStatus;
1240
- exports.useSimulateTransaction = useSimulateTransaction;
1241
- exports.useSolTransfer = useSolTransfer;
1242
- exports.useSolanaClient = useSolanaClient;
1243
- exports.useSplToken = useSplToken;
1244
- exports.useStake = useStake;
1245
- exports.useTransactionPool = useTransactionPool;
1246
- exports.useWaitForSignature = useWaitForSignature;
1247
- exports.useWallet = useWallet;
1248
- exports.useWalletActions = useWalletActions;
1249
- exports.useWalletConnection = useWalletConnection;
1250
- exports.useWalletModalState = useWalletModalState;
1251
- exports.useWalletSession = useWalletSession;
1252
- //# sourceMappingURL=index.browser.cjs.map
1253
- //# sourceMappingURL=index.browser.cjs.map