@txnlab/use-wallet-solid 3.0.0-beta.10

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.jsx ADDED
@@ -0,0 +1,721 @@
1
+ // src/index.tsx
2
+ export * from "@txnlab/use-wallet";
3
+
4
+ // ../../node_modules/.pnpm/solid-js@1.8.16/node_modules/solid-js/dist/solid.js
5
+ var sharedConfig = {
6
+ context: void 0,
7
+ registry: void 0
8
+ };
9
+ function setHydrateContext(context) {
10
+ sharedConfig.context = context;
11
+ }
12
+ var equalFn = (a, b) => a === b;
13
+ var $PROXY = Symbol("solid-proxy");
14
+ var $TRACK = Symbol("solid-track");
15
+ var $DEVCOMP = Symbol("solid-dev-component");
16
+ var signalOptions = {
17
+ equals: equalFn
18
+ };
19
+ var ERROR = null;
20
+ var runEffects = runQueue;
21
+ var STALE = 1;
22
+ var PENDING = 2;
23
+ var UNOWNED = {
24
+ owned: null,
25
+ cleanups: null,
26
+ context: null,
27
+ owner: null
28
+ };
29
+ var Owner = null;
30
+ var Transition = null;
31
+ var Scheduler = null;
32
+ var ExternalSourceConfig = null;
33
+ var Listener = null;
34
+ var Updates = null;
35
+ var Effects = null;
36
+ var ExecCount = 0;
37
+ function createSignal(value, options) {
38
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
39
+ const s = {
40
+ value,
41
+ observers: null,
42
+ observerSlots: null,
43
+ comparator: options.equals || void 0
44
+ };
45
+ const setter = (value2) => {
46
+ if (typeof value2 === "function") {
47
+ if (Transition && Transition.running && Transition.sources.has(s))
48
+ value2 = value2(s.tValue);
49
+ else
50
+ value2 = value2(s.value);
51
+ }
52
+ return writeSignal(s, value2);
53
+ };
54
+ return [readSignal.bind(s), setter];
55
+ }
56
+ function createRenderEffect(fn, value, options) {
57
+ const c = createComputation(fn, value, false, STALE);
58
+ if (Scheduler && Transition && Transition.running)
59
+ Updates.push(c);
60
+ else
61
+ updateComputation(c);
62
+ }
63
+ function createEffect(fn, value, options) {
64
+ runEffects = runUserEffects;
65
+ const c = createComputation(fn, value, false, STALE), s = SuspenseContext && useContext(SuspenseContext);
66
+ if (s)
67
+ c.suspense = s;
68
+ if (!options || !options.render)
69
+ c.user = true;
70
+ Effects ? Effects.push(c) : updateComputation(c);
71
+ }
72
+ function createMemo(fn, value, options) {
73
+ options = options ? Object.assign({}, signalOptions, options) : signalOptions;
74
+ const c = createComputation(fn, value, true, 0);
75
+ c.observers = null;
76
+ c.observerSlots = null;
77
+ c.comparator = options.equals || void 0;
78
+ if (Scheduler && Transition && Transition.running) {
79
+ c.tState = STALE;
80
+ Updates.push(c);
81
+ } else
82
+ updateComputation(c);
83
+ return readSignal.bind(c);
84
+ }
85
+ function untrack(fn) {
86
+ if (!ExternalSourceConfig && Listener === null)
87
+ return fn();
88
+ const listener = Listener;
89
+ Listener = null;
90
+ try {
91
+ if (ExternalSourceConfig)
92
+ return ExternalSourceConfig.untrack(fn);
93
+ return fn();
94
+ } finally {
95
+ Listener = listener;
96
+ }
97
+ }
98
+ function onMount(fn) {
99
+ createEffect(() => untrack(fn));
100
+ }
101
+ function onCleanup(fn) {
102
+ if (Owner === null)
103
+ ;
104
+ else if (Owner.cleanups === null)
105
+ Owner.cleanups = [fn];
106
+ else
107
+ Owner.cleanups.push(fn);
108
+ return fn;
109
+ }
110
+ function startTransition(fn) {
111
+ if (Transition && Transition.running) {
112
+ fn();
113
+ return Transition.done;
114
+ }
115
+ const l = Listener;
116
+ const o = Owner;
117
+ return Promise.resolve().then(() => {
118
+ Listener = l;
119
+ Owner = o;
120
+ let t;
121
+ if (Scheduler || SuspenseContext) {
122
+ t = Transition || (Transition = {
123
+ sources: /* @__PURE__ */ new Set(),
124
+ effects: [],
125
+ promises: /* @__PURE__ */ new Set(),
126
+ disposed: /* @__PURE__ */ new Set(),
127
+ queue: /* @__PURE__ */ new Set(),
128
+ running: true
129
+ });
130
+ t.done || (t.done = new Promise((res) => t.resolve = res));
131
+ t.running = true;
132
+ }
133
+ runUpdates(fn, false);
134
+ Listener = Owner = null;
135
+ return t ? t.done : void 0;
136
+ });
137
+ }
138
+ var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
139
+ function createContext(defaultValue, options) {
140
+ const id = Symbol("context");
141
+ return {
142
+ id,
143
+ Provider: createProvider(id),
144
+ defaultValue
145
+ };
146
+ }
147
+ function useContext(context) {
148
+ return Owner && Owner.context && Owner.context[context.id] !== void 0 ? Owner.context[context.id] : context.defaultValue;
149
+ }
150
+ function children(fn) {
151
+ const children2 = createMemo(fn);
152
+ const memo = createMemo(() => resolveChildren(children2()));
153
+ memo.toArray = () => {
154
+ const c = memo();
155
+ return Array.isArray(c) ? c : c != null ? [c] : [];
156
+ };
157
+ return memo;
158
+ }
159
+ var SuspenseContext;
160
+ function readSignal() {
161
+ const runningTransition = Transition && Transition.running;
162
+ if (this.sources && (runningTransition ? this.tState : this.state)) {
163
+ if ((runningTransition ? this.tState : this.state) === STALE)
164
+ updateComputation(this);
165
+ else {
166
+ const updates = Updates;
167
+ Updates = null;
168
+ runUpdates(() => lookUpstream(this), false);
169
+ Updates = updates;
170
+ }
171
+ }
172
+ if (Listener) {
173
+ const sSlot = this.observers ? this.observers.length : 0;
174
+ if (!Listener.sources) {
175
+ Listener.sources = [this];
176
+ Listener.sourceSlots = [sSlot];
177
+ } else {
178
+ Listener.sources.push(this);
179
+ Listener.sourceSlots.push(sSlot);
180
+ }
181
+ if (!this.observers) {
182
+ this.observers = [Listener];
183
+ this.observerSlots = [Listener.sources.length - 1];
184
+ } else {
185
+ this.observers.push(Listener);
186
+ this.observerSlots.push(Listener.sources.length - 1);
187
+ }
188
+ }
189
+ if (runningTransition && Transition.sources.has(this))
190
+ return this.tValue;
191
+ return this.value;
192
+ }
193
+ function writeSignal(node, value, isComp) {
194
+ let current = Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value;
195
+ if (!node.comparator || !node.comparator(current, value)) {
196
+ if (Transition) {
197
+ const TransitionRunning = Transition.running;
198
+ if (TransitionRunning || !isComp && Transition.sources.has(node)) {
199
+ Transition.sources.add(node);
200
+ node.tValue = value;
201
+ }
202
+ if (!TransitionRunning)
203
+ node.value = value;
204
+ } else
205
+ node.value = value;
206
+ if (node.observers && node.observers.length) {
207
+ runUpdates(() => {
208
+ for (let i = 0; i < node.observers.length; i += 1) {
209
+ const o = node.observers[i];
210
+ const TransitionRunning = Transition && Transition.running;
211
+ if (TransitionRunning && Transition.disposed.has(o))
212
+ continue;
213
+ if (TransitionRunning ? !o.tState : !o.state) {
214
+ if (o.pure)
215
+ Updates.push(o);
216
+ else
217
+ Effects.push(o);
218
+ if (o.observers)
219
+ markDownstream(o);
220
+ }
221
+ if (!TransitionRunning)
222
+ o.state = STALE;
223
+ else
224
+ o.tState = STALE;
225
+ }
226
+ if (Updates.length > 1e6) {
227
+ Updates = [];
228
+ if (false)
229
+ ;
230
+ throw new Error();
231
+ }
232
+ }, false);
233
+ }
234
+ }
235
+ return value;
236
+ }
237
+ function updateComputation(node) {
238
+ if (!node.fn)
239
+ return;
240
+ cleanNode(node);
241
+ const time = ExecCount;
242
+ runComputation(
243
+ node,
244
+ Transition && Transition.running && Transition.sources.has(node) ? node.tValue : node.value,
245
+ time
246
+ );
247
+ if (Transition && !Transition.running && Transition.sources.has(node)) {
248
+ queueMicrotask(() => {
249
+ runUpdates(() => {
250
+ Transition && (Transition.running = true);
251
+ Listener = Owner = node;
252
+ runComputation(node, node.tValue, time);
253
+ Listener = Owner = null;
254
+ }, false);
255
+ });
256
+ }
257
+ }
258
+ function runComputation(node, value, time) {
259
+ let nextValue;
260
+ const owner = Owner, listener = Listener;
261
+ Listener = Owner = node;
262
+ try {
263
+ nextValue = node.fn(value);
264
+ } catch (err) {
265
+ if (node.pure) {
266
+ if (Transition && Transition.running) {
267
+ node.tState = STALE;
268
+ node.tOwned && node.tOwned.forEach(cleanNode);
269
+ node.tOwned = void 0;
270
+ } else {
271
+ node.state = STALE;
272
+ node.owned && node.owned.forEach(cleanNode);
273
+ node.owned = null;
274
+ }
275
+ }
276
+ node.updatedAt = time + 1;
277
+ return handleError(err);
278
+ } finally {
279
+ Listener = listener;
280
+ Owner = owner;
281
+ }
282
+ if (!node.updatedAt || node.updatedAt <= time) {
283
+ if (node.updatedAt != null && "observers" in node) {
284
+ writeSignal(node, nextValue, true);
285
+ } else if (Transition && Transition.running && node.pure) {
286
+ Transition.sources.add(node);
287
+ node.tValue = nextValue;
288
+ } else
289
+ node.value = nextValue;
290
+ node.updatedAt = time;
291
+ }
292
+ }
293
+ function createComputation(fn, init, pure, state = STALE, options) {
294
+ const c = {
295
+ fn,
296
+ state,
297
+ updatedAt: null,
298
+ owned: null,
299
+ sources: null,
300
+ sourceSlots: null,
301
+ cleanups: null,
302
+ value: init,
303
+ owner: Owner,
304
+ context: Owner ? Owner.context : null,
305
+ pure
306
+ };
307
+ if (Transition && Transition.running) {
308
+ c.state = 0;
309
+ c.tState = state;
310
+ }
311
+ if (Owner === null)
312
+ ;
313
+ else if (Owner !== UNOWNED) {
314
+ if (Transition && Transition.running && Owner.pure) {
315
+ if (!Owner.tOwned)
316
+ Owner.tOwned = [c];
317
+ else
318
+ Owner.tOwned.push(c);
319
+ } else {
320
+ if (!Owner.owned)
321
+ Owner.owned = [c];
322
+ else
323
+ Owner.owned.push(c);
324
+ }
325
+ }
326
+ if (ExternalSourceConfig && c.fn) {
327
+ const [track, trigger] = createSignal(void 0, {
328
+ equals: false
329
+ });
330
+ const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
331
+ onCleanup(() => ordinary.dispose());
332
+ const triggerInTransition = () => startTransition(trigger).then(() => inTransition.dispose());
333
+ const inTransition = ExternalSourceConfig.factory(c.fn, triggerInTransition);
334
+ c.fn = (x) => {
335
+ track();
336
+ return Transition && Transition.running ? inTransition.track(x) : ordinary.track(x);
337
+ };
338
+ }
339
+ return c;
340
+ }
341
+ function runTop(node) {
342
+ const runningTransition = Transition && Transition.running;
343
+ if ((runningTransition ? node.tState : node.state) === 0)
344
+ return;
345
+ if ((runningTransition ? node.tState : node.state) === PENDING)
346
+ return lookUpstream(node);
347
+ if (node.suspense && untrack(node.suspense.inFallback))
348
+ return node.suspense.effects.push(node);
349
+ const ancestors = [node];
350
+ while ((node = node.owner) && (!node.updatedAt || node.updatedAt < ExecCount)) {
351
+ if (runningTransition && Transition.disposed.has(node))
352
+ return;
353
+ if (runningTransition ? node.tState : node.state)
354
+ ancestors.push(node);
355
+ }
356
+ for (let i = ancestors.length - 1; i >= 0; i--) {
357
+ node = ancestors[i];
358
+ if (runningTransition) {
359
+ let top = node, prev = ancestors[i + 1];
360
+ while ((top = top.owner) && top !== prev) {
361
+ if (Transition.disposed.has(top))
362
+ return;
363
+ }
364
+ }
365
+ if ((runningTransition ? node.tState : node.state) === STALE) {
366
+ updateComputation(node);
367
+ } else if ((runningTransition ? node.tState : node.state) === PENDING) {
368
+ const updates = Updates;
369
+ Updates = null;
370
+ runUpdates(() => lookUpstream(node, ancestors[0]), false);
371
+ Updates = updates;
372
+ }
373
+ }
374
+ }
375
+ function runUpdates(fn, init) {
376
+ if (Updates)
377
+ return fn();
378
+ let wait = false;
379
+ if (!init)
380
+ Updates = [];
381
+ if (Effects)
382
+ wait = true;
383
+ else
384
+ Effects = [];
385
+ ExecCount++;
386
+ try {
387
+ const res = fn();
388
+ completeUpdates(wait);
389
+ return res;
390
+ } catch (err) {
391
+ if (!wait)
392
+ Effects = null;
393
+ Updates = null;
394
+ handleError(err);
395
+ }
396
+ }
397
+ function completeUpdates(wait) {
398
+ if (Updates) {
399
+ if (Scheduler && Transition && Transition.running)
400
+ scheduleQueue(Updates);
401
+ else
402
+ runQueue(Updates);
403
+ Updates = null;
404
+ }
405
+ if (wait)
406
+ return;
407
+ let res;
408
+ if (Transition) {
409
+ if (!Transition.promises.size && !Transition.queue.size) {
410
+ const sources = Transition.sources;
411
+ const disposed = Transition.disposed;
412
+ Effects.push.apply(Effects, Transition.effects);
413
+ res = Transition.resolve;
414
+ for (const e2 of Effects) {
415
+ "tState" in e2 && (e2.state = e2.tState);
416
+ delete e2.tState;
417
+ }
418
+ Transition = null;
419
+ runUpdates(() => {
420
+ for (const d of disposed)
421
+ cleanNode(d);
422
+ for (const v of sources) {
423
+ v.value = v.tValue;
424
+ if (v.owned) {
425
+ for (let i = 0, len = v.owned.length; i < len; i++)
426
+ cleanNode(v.owned[i]);
427
+ }
428
+ if (v.tOwned)
429
+ v.owned = v.tOwned;
430
+ delete v.tValue;
431
+ delete v.tOwned;
432
+ v.tState = 0;
433
+ }
434
+ setTransPending(false);
435
+ }, false);
436
+ } else if (Transition.running) {
437
+ Transition.running = false;
438
+ Transition.effects.push.apply(Transition.effects, Effects);
439
+ Effects = null;
440
+ setTransPending(true);
441
+ return;
442
+ }
443
+ }
444
+ const e = Effects;
445
+ Effects = null;
446
+ if (e.length)
447
+ runUpdates(() => runEffects(e), false);
448
+ if (res)
449
+ res();
450
+ }
451
+ function runQueue(queue) {
452
+ for (let i = 0; i < queue.length; i++)
453
+ runTop(queue[i]);
454
+ }
455
+ function scheduleQueue(queue) {
456
+ for (let i = 0; i < queue.length; i++) {
457
+ const item = queue[i];
458
+ const tasks = Transition.queue;
459
+ if (!tasks.has(item)) {
460
+ tasks.add(item);
461
+ Scheduler(() => {
462
+ tasks.delete(item);
463
+ runUpdates(() => {
464
+ Transition.running = true;
465
+ runTop(item);
466
+ }, false);
467
+ Transition && (Transition.running = false);
468
+ });
469
+ }
470
+ }
471
+ }
472
+ function runUserEffects(queue) {
473
+ let i, userLength = 0;
474
+ for (i = 0; i < queue.length; i++) {
475
+ const e = queue[i];
476
+ if (!e.user)
477
+ runTop(e);
478
+ else
479
+ queue[userLength++] = e;
480
+ }
481
+ if (sharedConfig.context) {
482
+ if (sharedConfig.count) {
483
+ sharedConfig.effects || (sharedConfig.effects = []);
484
+ sharedConfig.effects.push(...queue.slice(0, userLength));
485
+ return;
486
+ } else if (sharedConfig.effects) {
487
+ queue = [...sharedConfig.effects, ...queue];
488
+ userLength += sharedConfig.effects.length;
489
+ delete sharedConfig.effects;
490
+ }
491
+ setHydrateContext();
492
+ }
493
+ for (i = 0; i < userLength; i++)
494
+ runTop(queue[i]);
495
+ }
496
+ function lookUpstream(node, ignore) {
497
+ const runningTransition = Transition && Transition.running;
498
+ if (runningTransition)
499
+ node.tState = 0;
500
+ else
501
+ node.state = 0;
502
+ for (let i = 0; i < node.sources.length; i += 1) {
503
+ const source = node.sources[i];
504
+ if (source.sources) {
505
+ const state = runningTransition ? source.tState : source.state;
506
+ if (state === STALE) {
507
+ if (source !== ignore && (!source.updatedAt || source.updatedAt < ExecCount))
508
+ runTop(source);
509
+ } else if (state === PENDING)
510
+ lookUpstream(source, ignore);
511
+ }
512
+ }
513
+ }
514
+ function markDownstream(node) {
515
+ const runningTransition = Transition && Transition.running;
516
+ for (let i = 0; i < node.observers.length; i += 1) {
517
+ const o = node.observers[i];
518
+ if (runningTransition ? !o.tState : !o.state) {
519
+ if (runningTransition)
520
+ o.tState = PENDING;
521
+ else
522
+ o.state = PENDING;
523
+ if (o.pure)
524
+ Updates.push(o);
525
+ else
526
+ Effects.push(o);
527
+ o.observers && markDownstream(o);
528
+ }
529
+ }
530
+ }
531
+ function cleanNode(node) {
532
+ let i;
533
+ if (node.sources) {
534
+ while (node.sources.length) {
535
+ const source = node.sources.pop(), index = node.sourceSlots.pop(), obs = source.observers;
536
+ if (obs && obs.length) {
537
+ const n = obs.pop(), s = source.observerSlots.pop();
538
+ if (index < obs.length) {
539
+ n.sourceSlots[s] = index;
540
+ obs[index] = n;
541
+ source.observerSlots[index] = s;
542
+ }
543
+ }
544
+ }
545
+ }
546
+ if (Transition && Transition.running && node.pure) {
547
+ if (node.tOwned) {
548
+ for (i = node.tOwned.length - 1; i >= 0; i--)
549
+ cleanNode(node.tOwned[i]);
550
+ delete node.tOwned;
551
+ }
552
+ reset(node, true);
553
+ } else if (node.owned) {
554
+ for (i = node.owned.length - 1; i >= 0; i--)
555
+ cleanNode(node.owned[i]);
556
+ node.owned = null;
557
+ }
558
+ if (node.cleanups) {
559
+ for (i = node.cleanups.length - 1; i >= 0; i--)
560
+ node.cleanups[i]();
561
+ node.cleanups = null;
562
+ }
563
+ if (Transition && Transition.running)
564
+ node.tState = 0;
565
+ else
566
+ node.state = 0;
567
+ }
568
+ function reset(node, top) {
569
+ if (!top) {
570
+ node.tState = 0;
571
+ Transition.disposed.add(node);
572
+ }
573
+ if (node.owned) {
574
+ for (let i = 0; i < node.owned.length; i++)
575
+ reset(node.owned[i]);
576
+ }
577
+ }
578
+ function castError(err) {
579
+ if (err instanceof Error)
580
+ return err;
581
+ return new Error(typeof err === "string" ? err : "Unknown error", {
582
+ cause: err
583
+ });
584
+ }
585
+ function runErrors(err, fns, owner) {
586
+ try {
587
+ for (const f of fns)
588
+ f(err);
589
+ } catch (e) {
590
+ handleError(e, owner && owner.owner || null);
591
+ }
592
+ }
593
+ function handleError(err, owner = Owner) {
594
+ const fns = ERROR && owner && owner.context && owner.context[ERROR];
595
+ const error = castError(err);
596
+ if (!fns)
597
+ throw error;
598
+ if (Effects)
599
+ Effects.push({
600
+ fn() {
601
+ runErrors(error, fns, owner);
602
+ },
603
+ state: STALE
604
+ });
605
+ else
606
+ runErrors(error, fns, owner);
607
+ }
608
+ function resolveChildren(children2) {
609
+ if (typeof children2 === "function" && !children2.length)
610
+ return resolveChildren(children2());
611
+ if (Array.isArray(children2)) {
612
+ const results = [];
613
+ for (let i = 0; i < children2.length; i++) {
614
+ const result = resolveChildren(children2[i]);
615
+ Array.isArray(result) ? results.push.apply(results, result) : results.push(result);
616
+ }
617
+ return results;
618
+ }
619
+ return children2;
620
+ }
621
+ function createProvider(id, options) {
622
+ return function provider(props) {
623
+ let res;
624
+ createRenderEffect(
625
+ () => res = untrack(() => {
626
+ Owner.context = {
627
+ ...Owner.context,
628
+ [id]: props.value
629
+ };
630
+ return children(() => props.children);
631
+ }),
632
+ void 0
633
+ );
634
+ return res;
635
+ };
636
+ }
637
+ var FALLBACK = Symbol("fallback");
638
+ var SuspenseListContext = createContext();
639
+
640
+ // src/WalletProvider.tsx
641
+ var WalletContext = createContext();
642
+ var WalletProvider = (props) => {
643
+ const store = () => props.manager;
644
+ onMount(async () => {
645
+ try {
646
+ await props.manager.resumeSessions();
647
+ } catch (error) {
648
+ }
649
+ });
650
+ return <WalletContext.Provider value={store}>{props.children}</WalletContext.Provider>;
651
+ };
652
+ var useWalletManager = () => {
653
+ const manager = useContext(WalletContext);
654
+ if (!manager) {
655
+ throw new Error("useWalletManager must be used within a WalletProvider");
656
+ }
657
+ return manager();
658
+ };
659
+
660
+ // src/useWallet.ts
661
+ import { useStore } from "@tanstack/solid-store";
662
+ function useWallet() {
663
+ const manager = createMemo(() => useWalletManager());
664
+ const walletStore = useStore(manager().store, (state) => {
665
+ return state.wallets;
666
+ });
667
+ const walletState = (walletId) => walletStore()[walletId] || null;
668
+ const activeWalletId = useStore(manager().store, (state) => {
669
+ return state.activeWallet;
670
+ });
671
+ const activeWallet = () => manager().getWallet(activeWalletId()) || null;
672
+ const activeWalletState = () => walletState(activeWalletId());
673
+ const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
674
+ const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
675
+ const activeAccount = () => activeWalletState()?.activeAccount ?? null;
676
+ const activeAddress = () => activeAccount()?.address ?? null;
677
+ const isWalletActive = (walletId) => walletId === activeWalletId();
678
+ const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
679
+ const activeNetworkState = createMemo(() => {
680
+ return useStore(manager().store, (state) => state.activeNetwork);
681
+ });
682
+ const activeNetwork = () => activeNetworkState()();
683
+ const setActiveNetwork = (network) => manager().setActiveNetwork(network);
684
+ const algodClient = createMemo(() => manager().algodClient);
685
+ const signTransactions = (txnGroup, indexesToSign, returnGroup) => {
686
+ const wallet = activeWallet();
687
+ if (!wallet) {
688
+ throw new Error("No active wallet");
689
+ }
690
+ return wallet.signTransactions(txnGroup, indexesToSign, returnGroup);
691
+ };
692
+ const transactionSigner = (txnGroup, indexesToSign) => {
693
+ const wallet = activeWallet();
694
+ if (!wallet) {
695
+ throw new Error("No active wallet");
696
+ }
697
+ return wallet.transactionSigner(txnGroup, indexesToSign);
698
+ };
699
+ return {
700
+ activeWalletId,
701
+ walletStore,
702
+ algodClient,
703
+ activeNetwork,
704
+ activeWallet,
705
+ activeWalletAccounts,
706
+ activeWalletAddresses,
707
+ activeWalletState,
708
+ activeAccount,
709
+ activeAddress,
710
+ isWalletActive,
711
+ isWalletConnected,
712
+ setActiveNetwork,
713
+ signTransactions,
714
+ transactionSigner,
715
+ wallets: manager().wallets
716
+ };
717
+ }
718
+ export {
719
+ WalletProvider,
720
+ useWallet
721
+ };