@txnlab/use-wallet-solid 4.0.0-beta.4 → 4.0.0-beta.5
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/dev.cjs +94 -38
- package/dist/dev.js +92 -35
- package/dist/dev.jsx +66 -22
- package/dist/index.cjs +91 -37
- package/dist/index.d.cts +15 -8
- package/dist/index.d.ts +15 -8
- package/dist/index.js +89 -34
- package/dist/index.jsx +63 -21
- package/package.json +7 -7
package/dist/dev.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var solidStore = require('@tanstack/solid-store');
|
|
4
4
|
var algosdk = require('algosdk');
|
|
5
|
-
var useWallet
|
|
5
|
+
var useWallet = require('@txnlab/use-wallet');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ var algosdk__default = /*#__PURE__*/_interopDefault(algosdk);
|
|
|
10
10
|
|
|
11
11
|
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
|
|
12
12
|
var sharedConfig = {
|
|
13
|
-
context:
|
|
14
|
-
registry:
|
|
15
|
-
effects:
|
|
13
|
+
context: undefined,
|
|
14
|
+
registry: undefined,
|
|
15
|
+
effects: undefined,
|
|
16
16
|
done: false,
|
|
17
17
|
getContextId() {
|
|
18
18
|
return getContextId(this.context.count);
|
|
@@ -63,7 +63,7 @@ function createSignal(value, options) {
|
|
|
63
63
|
value,
|
|
64
64
|
observers: null,
|
|
65
65
|
observerSlots: null,
|
|
66
|
-
comparator: options.equals ||
|
|
66
|
+
comparator: options.equals || undefined
|
|
67
67
|
};
|
|
68
68
|
const setter = (value2) => {
|
|
69
69
|
if (typeof value2 === "function") {
|
|
@@ -91,7 +91,7 @@ function createMemo(fn, value, options) {
|
|
|
91
91
|
const c = createComputation(fn, value, true, 0);
|
|
92
92
|
c.observers = null;
|
|
93
93
|
c.observerSlots = null;
|
|
94
|
-
c.comparator = options.equals ||
|
|
94
|
+
c.comparator = options.equals || undefined;
|
|
95
95
|
if (Scheduler && Transition && Transition.running) {
|
|
96
96
|
c.tState = STALE;
|
|
97
97
|
Updates.push(c);
|
|
@@ -143,7 +143,7 @@ function startTransition(fn) {
|
|
|
143
143
|
}
|
|
144
144
|
runUpdates(fn);
|
|
145
145
|
Listener = Owner = null;
|
|
146
|
-
return t ? t.done :
|
|
146
|
+
return t ? t.done : undefined;
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
@@ -157,7 +157,7 @@ function createContext(defaultValue, options) {
|
|
|
157
157
|
}
|
|
158
158
|
function useContext(context) {
|
|
159
159
|
let value;
|
|
160
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !==
|
|
160
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
161
161
|
}
|
|
162
162
|
function children(fn) {
|
|
163
163
|
const children2 = createMemo(fn);
|
|
@@ -266,7 +266,7 @@ function runComputation(node, value, time) {
|
|
|
266
266
|
if (Transition && Transition.running) {
|
|
267
267
|
node.tState = STALE;
|
|
268
268
|
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
269
|
-
node.tOwned =
|
|
269
|
+
node.tOwned = undefined;
|
|
270
270
|
} else {
|
|
271
271
|
node.state = STALE;
|
|
272
272
|
node.owned && node.owned.forEach(cleanNode);
|
|
@@ -318,7 +318,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
if (ExternalSourceConfig && c.fn) {
|
|
321
|
-
const [track, trigger] = createSignal(
|
|
321
|
+
const [track, trigger] = createSignal(undefined, {
|
|
322
322
|
equals: false
|
|
323
323
|
});
|
|
324
324
|
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
@@ -583,7 +583,7 @@ function createProvider(id, options) {
|
|
|
583
583
|
};
|
|
584
584
|
return children(() => props.children);
|
|
585
585
|
}),
|
|
586
|
-
|
|
586
|
+
undefined
|
|
587
587
|
);
|
|
588
588
|
return res;
|
|
589
589
|
};
|
|
@@ -664,21 +664,13 @@ exports.useWalletManager = () => {
|
|
|
664
664
|
}
|
|
665
665
|
return manager();
|
|
666
666
|
};
|
|
667
|
-
|
|
667
|
+
exports.useNetwork = () => {
|
|
668
668
|
const manager = createMemo(() => exports.useWalletManager());
|
|
669
|
-
const algodClient = solidStore.useStore(manager().store, (state) => state.algodClient);
|
|
670
|
-
const walletStore = solidStore.useStore(manager().store, (state) => state.wallets);
|
|
671
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
672
|
-
const activeWalletId = solidStore.useStore(manager().store, (state) => state.activeWallet);
|
|
673
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
674
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
675
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
676
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
677
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
678
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
679
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
680
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
681
669
|
const activeNetwork = solidStore.useStore(manager().store, (state) => state.activeNetwork);
|
|
670
|
+
const activeNetworkConfig = () => {
|
|
671
|
+
const store = solidStore.useStore(manager().store);
|
|
672
|
+
return store().networkConfig[activeNetwork()];
|
|
673
|
+
};
|
|
682
674
|
const setActiveNetwork = async (networkId) => {
|
|
683
675
|
if (networkId === activeNetwork()) {
|
|
684
676
|
return;
|
|
@@ -686,17 +678,18 @@ function useWallet() {
|
|
|
686
678
|
if (!manager().networkConfig[networkId]) {
|
|
687
679
|
throw new Error(`Network "${networkId}" not found in network configuration`);
|
|
688
680
|
}
|
|
689
|
-
console.info(`[Solid] Creating Algodv2 client
|
|
681
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
690
682
|
const {
|
|
691
683
|
algod
|
|
692
684
|
} = manager().networkConfig[networkId];
|
|
693
685
|
const {
|
|
694
|
-
token,
|
|
686
|
+
token = "",
|
|
695
687
|
baseServer,
|
|
696
|
-
port,
|
|
697
|
-
headers
|
|
688
|
+
port = "",
|
|
689
|
+
headers = {}
|
|
698
690
|
} = algod;
|
|
699
691
|
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
692
|
+
await manager().setActiveNetwork(networkId);
|
|
700
693
|
manager().store.setState((state) => ({
|
|
701
694
|
...state,
|
|
702
695
|
activeNetwork: networkId,
|
|
@@ -704,6 +697,71 @@ function useWallet() {
|
|
|
704
697
|
}));
|
|
705
698
|
console.info(`[Solid] \u2705 Active network set to ${networkId}.`);
|
|
706
699
|
};
|
|
700
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
701
|
+
manager().updateAlgodConfig(networkId, config);
|
|
702
|
+
if (networkId === activeNetwork()) {
|
|
703
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
704
|
+
const {
|
|
705
|
+
algod
|
|
706
|
+
} = manager().networkConfig[networkId];
|
|
707
|
+
const {
|
|
708
|
+
token = "",
|
|
709
|
+
baseServer,
|
|
710
|
+
port = "",
|
|
711
|
+
headers = {}
|
|
712
|
+
} = algod;
|
|
713
|
+
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
714
|
+
manager().store.setState((state) => ({
|
|
715
|
+
...state,
|
|
716
|
+
algodClient: newClient
|
|
717
|
+
}));
|
|
718
|
+
}
|
|
719
|
+
};
|
|
720
|
+
const resetNetworkConfig = (networkId) => {
|
|
721
|
+
manager().resetNetworkConfig(networkId);
|
|
722
|
+
if (networkId === activeNetwork()) {
|
|
723
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
724
|
+
const {
|
|
725
|
+
algod
|
|
726
|
+
} = manager().networkConfig[networkId];
|
|
727
|
+
const {
|
|
728
|
+
token = "",
|
|
729
|
+
baseServer,
|
|
730
|
+
port = "",
|
|
731
|
+
headers = {}
|
|
732
|
+
} = algod;
|
|
733
|
+
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
734
|
+
manager().store.setState((state) => ({
|
|
735
|
+
...state,
|
|
736
|
+
algodClient: newClient
|
|
737
|
+
}));
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
return {
|
|
741
|
+
activeNetwork,
|
|
742
|
+
networkConfig: () => manager().networkConfig,
|
|
743
|
+
activeNetworkConfig,
|
|
744
|
+
setActiveNetwork,
|
|
745
|
+
updateAlgodConfig,
|
|
746
|
+
resetNetworkConfig
|
|
747
|
+
};
|
|
748
|
+
};
|
|
749
|
+
exports.useWallet = () => {
|
|
750
|
+
const manager = createMemo(() => exports.useWalletManager());
|
|
751
|
+
const managerStatus = solidStore.useStore(manager().store, (state) => state.managerStatus);
|
|
752
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
753
|
+
const algodClient = solidStore.useStore(manager().store, (state) => state.algodClient);
|
|
754
|
+
const walletStore = solidStore.useStore(manager().store, (state) => state.wallets);
|
|
755
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
756
|
+
const activeWalletId = solidStore.useStore(manager().store, (state) => state.activeWallet);
|
|
757
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
758
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
759
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
760
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
761
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
762
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
763
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
764
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
707
765
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
708
766
|
const wallet = activeWallet();
|
|
709
767
|
if (!wallet) {
|
|
@@ -719,29 +777,27 @@ function useWallet() {
|
|
|
719
777
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
720
778
|
};
|
|
721
779
|
return {
|
|
722
|
-
|
|
723
|
-
|
|
780
|
+
wallets: manager().wallets,
|
|
781
|
+
isReady,
|
|
724
782
|
algodClient,
|
|
725
|
-
activeNetwork,
|
|
726
783
|
activeWallet,
|
|
727
784
|
activeWalletAccounts,
|
|
728
785
|
activeWalletAddresses,
|
|
729
786
|
activeWalletState,
|
|
730
787
|
activeAccount,
|
|
731
788
|
activeAddress,
|
|
789
|
+
activeWalletId,
|
|
790
|
+
walletStore,
|
|
732
791
|
isWalletActive,
|
|
733
792
|
isWalletConnected,
|
|
734
|
-
setActiveNetwork,
|
|
735
793
|
signTransactions,
|
|
736
|
-
transactionSigner
|
|
737
|
-
wallets: manager().wallets
|
|
794
|
+
transactionSigner
|
|
738
795
|
};
|
|
739
|
-
}
|
|
796
|
+
};
|
|
740
797
|
|
|
741
|
-
|
|
742
|
-
Object.keys(useWallet$1).forEach(function (k) {
|
|
798
|
+
Object.keys(useWallet).forEach(function (k) {
|
|
743
799
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
744
800
|
enumerable: true,
|
|
745
|
-
get: function () { return useWallet
|
|
801
|
+
get: function () { return useWallet[k]; }
|
|
746
802
|
});
|
|
747
803
|
});
|
package/dist/dev.js
CHANGED
|
@@ -4,9 +4,9 @@ export * from '@txnlab/use-wallet';
|
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
|
|
6
6
|
var sharedConfig = {
|
|
7
|
-
context:
|
|
8
|
-
registry:
|
|
9
|
-
effects:
|
|
7
|
+
context: undefined,
|
|
8
|
+
registry: undefined,
|
|
9
|
+
effects: undefined,
|
|
10
10
|
done: false,
|
|
11
11
|
getContextId() {
|
|
12
12
|
return getContextId(this.context.count);
|
|
@@ -57,7 +57,7 @@ function createSignal(value, options) {
|
|
|
57
57
|
value,
|
|
58
58
|
observers: null,
|
|
59
59
|
observerSlots: null,
|
|
60
|
-
comparator: options.equals ||
|
|
60
|
+
comparator: options.equals || undefined
|
|
61
61
|
};
|
|
62
62
|
const setter = (value2) => {
|
|
63
63
|
if (typeof value2 === "function") {
|
|
@@ -85,7 +85,7 @@ function createMemo(fn, value, options) {
|
|
|
85
85
|
const c = createComputation(fn, value, true, 0);
|
|
86
86
|
c.observers = null;
|
|
87
87
|
c.observerSlots = null;
|
|
88
|
-
c.comparator = options.equals ||
|
|
88
|
+
c.comparator = options.equals || undefined;
|
|
89
89
|
if (Scheduler && Transition && Transition.running) {
|
|
90
90
|
c.tState = STALE;
|
|
91
91
|
Updates.push(c);
|
|
@@ -137,7 +137,7 @@ function startTransition(fn) {
|
|
|
137
137
|
}
|
|
138
138
|
runUpdates(fn);
|
|
139
139
|
Listener = Owner = null;
|
|
140
|
-
return t ? t.done :
|
|
140
|
+
return t ? t.done : undefined;
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
@@ -151,7 +151,7 @@ function createContext(defaultValue, options) {
|
|
|
151
151
|
}
|
|
152
152
|
function useContext(context) {
|
|
153
153
|
let value;
|
|
154
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !==
|
|
154
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
155
155
|
}
|
|
156
156
|
function children(fn) {
|
|
157
157
|
const children2 = createMemo(fn);
|
|
@@ -260,7 +260,7 @@ function runComputation(node, value, time) {
|
|
|
260
260
|
if (Transition && Transition.running) {
|
|
261
261
|
node.tState = STALE;
|
|
262
262
|
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
263
|
-
node.tOwned =
|
|
263
|
+
node.tOwned = undefined;
|
|
264
264
|
} else {
|
|
265
265
|
node.state = STALE;
|
|
266
266
|
node.owned && node.owned.forEach(cleanNode);
|
|
@@ -312,7 +312,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
if (ExternalSourceConfig && c.fn) {
|
|
315
|
-
const [track, trigger] = createSignal(
|
|
315
|
+
const [track, trigger] = createSignal(undefined, {
|
|
316
316
|
equals: false
|
|
317
317
|
});
|
|
318
318
|
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
@@ -577,7 +577,7 @@ function createProvider(id, options) {
|
|
|
577
577
|
};
|
|
578
578
|
return children(() => props.children);
|
|
579
579
|
}),
|
|
580
|
-
|
|
580
|
+
undefined
|
|
581
581
|
);
|
|
582
582
|
return res;
|
|
583
583
|
};
|
|
@@ -658,21 +658,13 @@ var useWalletManager = () => {
|
|
|
658
658
|
}
|
|
659
659
|
return manager();
|
|
660
660
|
};
|
|
661
|
-
|
|
661
|
+
var useNetwork = () => {
|
|
662
662
|
const manager = createMemo(() => useWalletManager());
|
|
663
|
-
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
664
|
-
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
665
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
666
|
-
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
667
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
668
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
669
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
670
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
671
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
672
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
673
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
674
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
675
663
|
const activeNetwork = useStore(manager().store, (state) => state.activeNetwork);
|
|
664
|
+
const activeNetworkConfig = () => {
|
|
665
|
+
const store = useStore(manager().store);
|
|
666
|
+
return store().networkConfig[activeNetwork()];
|
|
667
|
+
};
|
|
676
668
|
const setActiveNetwork = async (networkId) => {
|
|
677
669
|
if (networkId === activeNetwork()) {
|
|
678
670
|
return;
|
|
@@ -680,17 +672,18 @@ function useWallet() {
|
|
|
680
672
|
if (!manager().networkConfig[networkId]) {
|
|
681
673
|
throw new Error(`Network "${networkId}" not found in network configuration`);
|
|
682
674
|
}
|
|
683
|
-
console.info(`[Solid] Creating Algodv2 client
|
|
675
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
684
676
|
const {
|
|
685
677
|
algod
|
|
686
678
|
} = manager().networkConfig[networkId];
|
|
687
679
|
const {
|
|
688
|
-
token,
|
|
680
|
+
token = "",
|
|
689
681
|
baseServer,
|
|
690
|
-
port,
|
|
691
|
-
headers
|
|
682
|
+
port = "",
|
|
683
|
+
headers = {}
|
|
692
684
|
} = algod;
|
|
693
685
|
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
686
|
+
await manager().setActiveNetwork(networkId);
|
|
694
687
|
manager().store.setState((state) => ({
|
|
695
688
|
...state,
|
|
696
689
|
activeNetwork: networkId,
|
|
@@ -698,6 +691,71 @@ function useWallet() {
|
|
|
698
691
|
}));
|
|
699
692
|
console.info(`[Solid] \u2705 Active network set to ${networkId}.`);
|
|
700
693
|
};
|
|
694
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
695
|
+
manager().updateAlgodConfig(networkId, config);
|
|
696
|
+
if (networkId === activeNetwork()) {
|
|
697
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
698
|
+
const {
|
|
699
|
+
algod
|
|
700
|
+
} = manager().networkConfig[networkId];
|
|
701
|
+
const {
|
|
702
|
+
token = "",
|
|
703
|
+
baseServer,
|
|
704
|
+
port = "",
|
|
705
|
+
headers = {}
|
|
706
|
+
} = algod;
|
|
707
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
708
|
+
manager().store.setState((state) => ({
|
|
709
|
+
...state,
|
|
710
|
+
algodClient: newClient
|
|
711
|
+
}));
|
|
712
|
+
}
|
|
713
|
+
};
|
|
714
|
+
const resetNetworkConfig = (networkId) => {
|
|
715
|
+
manager().resetNetworkConfig(networkId);
|
|
716
|
+
if (networkId === activeNetwork()) {
|
|
717
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
718
|
+
const {
|
|
719
|
+
algod
|
|
720
|
+
} = manager().networkConfig[networkId];
|
|
721
|
+
const {
|
|
722
|
+
token = "",
|
|
723
|
+
baseServer,
|
|
724
|
+
port = "",
|
|
725
|
+
headers = {}
|
|
726
|
+
} = algod;
|
|
727
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
728
|
+
manager().store.setState((state) => ({
|
|
729
|
+
...state,
|
|
730
|
+
algodClient: newClient
|
|
731
|
+
}));
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
return {
|
|
735
|
+
activeNetwork,
|
|
736
|
+
networkConfig: () => manager().networkConfig,
|
|
737
|
+
activeNetworkConfig,
|
|
738
|
+
setActiveNetwork,
|
|
739
|
+
updateAlgodConfig,
|
|
740
|
+
resetNetworkConfig
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
var useWallet = () => {
|
|
744
|
+
const manager = createMemo(() => useWalletManager());
|
|
745
|
+
const managerStatus = useStore(manager().store, (state) => state.managerStatus);
|
|
746
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
747
|
+
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
748
|
+
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
749
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
750
|
+
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
751
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
752
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
753
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
754
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
755
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
756
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
757
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
758
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
701
759
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
702
760
|
const wallet = activeWallet();
|
|
703
761
|
if (!wallet) {
|
|
@@ -713,23 +771,22 @@ function useWallet() {
|
|
|
713
771
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
714
772
|
};
|
|
715
773
|
return {
|
|
716
|
-
|
|
717
|
-
|
|
774
|
+
wallets: manager().wallets,
|
|
775
|
+
isReady,
|
|
718
776
|
algodClient,
|
|
719
|
-
activeNetwork,
|
|
720
777
|
activeWallet,
|
|
721
778
|
activeWalletAccounts,
|
|
722
779
|
activeWalletAddresses,
|
|
723
780
|
activeWalletState,
|
|
724
781
|
activeAccount,
|
|
725
782
|
activeAddress,
|
|
783
|
+
activeWalletId,
|
|
784
|
+
walletStore,
|
|
726
785
|
isWalletActive,
|
|
727
786
|
isWalletConnected,
|
|
728
|
-
setActiveNetwork,
|
|
729
787
|
signTransactions,
|
|
730
|
-
transactionSigner
|
|
731
|
-
wallets: manager().wallets
|
|
788
|
+
transactionSigner
|
|
732
789
|
};
|
|
733
|
-
}
|
|
790
|
+
};
|
|
734
791
|
|
|
735
|
-
export { WalletProvider, useWallet, useWalletManager };
|
|
792
|
+
export { WalletProvider, useNetwork, useWallet, useWalletManager };
|
package/dist/dev.jsx
CHANGED
|
@@ -601,21 +601,13 @@ var useWalletManager = () => {
|
|
|
601
601
|
}
|
|
602
602
|
return manager();
|
|
603
603
|
};
|
|
604
|
-
|
|
604
|
+
var useNetwork = () => {
|
|
605
605
|
const manager = createMemo(() => useWalletManager());
|
|
606
|
-
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
607
|
-
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
608
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
609
|
-
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
610
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
611
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
612
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
613
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
614
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
615
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
616
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
617
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
618
606
|
const activeNetwork = useStore(manager().store, (state) => state.activeNetwork);
|
|
607
|
+
const activeNetworkConfig = () => {
|
|
608
|
+
const store = useStore(manager().store);
|
|
609
|
+
return store().networkConfig[activeNetwork()];
|
|
610
|
+
};
|
|
619
611
|
const setActiveNetwork = async (networkId) => {
|
|
620
612
|
if (networkId === activeNetwork()) {
|
|
621
613
|
return;
|
|
@@ -623,10 +615,11 @@ function useWallet() {
|
|
|
623
615
|
if (!manager().networkConfig[networkId]) {
|
|
624
616
|
throw new Error(`Network "${networkId}" not found in network configuration`);
|
|
625
617
|
}
|
|
626
|
-
console.info(`[Solid] Creating Algodv2 client
|
|
618
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
627
619
|
const { algod } = manager().networkConfig[networkId];
|
|
628
|
-
const { token, baseServer, port, headers } = algod;
|
|
620
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
629
621
|
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
622
|
+
await manager().setActiveNetwork(networkId);
|
|
630
623
|
manager().store.setState((state) => ({
|
|
631
624
|
...state,
|
|
632
625
|
activeNetwork: networkId,
|
|
@@ -634,6 +627,57 @@ function useWallet() {
|
|
|
634
627
|
}));
|
|
635
628
|
console.info(`[Solid] \u2705 Active network set to ${networkId}.`);
|
|
636
629
|
};
|
|
630
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
631
|
+
manager().updateAlgodConfig(networkId, config);
|
|
632
|
+
if (networkId === activeNetwork()) {
|
|
633
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
634
|
+
const { algod } = manager().networkConfig[networkId];
|
|
635
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
636
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
637
|
+
manager().store.setState((state) => ({
|
|
638
|
+
...state,
|
|
639
|
+
algodClient: newClient
|
|
640
|
+
}));
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
const resetNetworkConfig = (networkId) => {
|
|
644
|
+
manager().resetNetworkConfig(networkId);
|
|
645
|
+
if (networkId === activeNetwork()) {
|
|
646
|
+
console.info(`[Solid] Creating new Algodv2 client...`);
|
|
647
|
+
const { algod } = manager().networkConfig[networkId];
|
|
648
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
649
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
650
|
+
manager().store.setState((state) => ({
|
|
651
|
+
...state,
|
|
652
|
+
algodClient: newClient
|
|
653
|
+
}));
|
|
654
|
+
}
|
|
655
|
+
};
|
|
656
|
+
return {
|
|
657
|
+
activeNetwork,
|
|
658
|
+
networkConfig: () => manager().networkConfig,
|
|
659
|
+
activeNetworkConfig,
|
|
660
|
+
setActiveNetwork,
|
|
661
|
+
updateAlgodConfig,
|
|
662
|
+
resetNetworkConfig
|
|
663
|
+
};
|
|
664
|
+
};
|
|
665
|
+
var useWallet = () => {
|
|
666
|
+
const manager = createMemo(() => useWalletManager());
|
|
667
|
+
const managerStatus = useStore(manager().store, (state) => state.managerStatus);
|
|
668
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
669
|
+
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
670
|
+
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
671
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
672
|
+
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
673
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
674
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
675
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
676
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
677
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
678
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
679
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
680
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
637
681
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
638
682
|
const wallet = activeWallet();
|
|
639
683
|
if (!wallet) {
|
|
@@ -649,26 +693,26 @@ function useWallet() {
|
|
|
649
693
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
650
694
|
};
|
|
651
695
|
return {
|
|
652
|
-
|
|
653
|
-
|
|
696
|
+
wallets: manager().wallets,
|
|
697
|
+
isReady,
|
|
654
698
|
algodClient,
|
|
655
|
-
activeNetwork,
|
|
656
699
|
activeWallet,
|
|
657
700
|
activeWalletAccounts,
|
|
658
701
|
activeWalletAddresses,
|
|
659
702
|
activeWalletState,
|
|
660
703
|
activeAccount,
|
|
661
704
|
activeAddress,
|
|
705
|
+
activeWalletId,
|
|
706
|
+
walletStore,
|
|
662
707
|
isWalletActive,
|
|
663
708
|
isWalletConnected,
|
|
664
|
-
setActiveNetwork,
|
|
665
709
|
signTransactions,
|
|
666
|
-
transactionSigner
|
|
667
|
-
wallets: manager().wallets
|
|
710
|
+
transactionSigner
|
|
668
711
|
};
|
|
669
|
-
}
|
|
712
|
+
};
|
|
670
713
|
export {
|
|
671
714
|
WalletProvider,
|
|
715
|
+
useNetwork,
|
|
672
716
|
useWallet,
|
|
673
717
|
useWalletManager
|
|
674
718
|
};
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var solidStore = require('@tanstack/solid-store');
|
|
4
4
|
var algosdk = require('algosdk');
|
|
5
|
-
var useWallet
|
|
5
|
+
var useWallet = require('@txnlab/use-wallet');
|
|
6
6
|
|
|
7
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
8
8
|
|
|
@@ -10,9 +10,9 @@ var algosdk__default = /*#__PURE__*/_interopDefault(algosdk);
|
|
|
10
10
|
|
|
11
11
|
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
|
|
12
12
|
var sharedConfig = {
|
|
13
|
-
context:
|
|
14
|
-
registry:
|
|
15
|
-
effects:
|
|
13
|
+
context: undefined,
|
|
14
|
+
registry: undefined,
|
|
15
|
+
effects: undefined,
|
|
16
16
|
done: false,
|
|
17
17
|
getContextId() {
|
|
18
18
|
return getContextId(this.context.count);
|
|
@@ -63,7 +63,7 @@ function createSignal(value, options) {
|
|
|
63
63
|
value,
|
|
64
64
|
observers: null,
|
|
65
65
|
observerSlots: null,
|
|
66
|
-
comparator: options.equals ||
|
|
66
|
+
comparator: options.equals || undefined
|
|
67
67
|
};
|
|
68
68
|
const setter = (value2) => {
|
|
69
69
|
if (typeof value2 === "function") {
|
|
@@ -91,7 +91,7 @@ function createMemo(fn, value, options) {
|
|
|
91
91
|
const c = createComputation(fn, value, true, 0);
|
|
92
92
|
c.observers = null;
|
|
93
93
|
c.observerSlots = null;
|
|
94
|
-
c.comparator = options.equals ||
|
|
94
|
+
c.comparator = options.equals || undefined;
|
|
95
95
|
if (Scheduler && Transition && Transition.running) {
|
|
96
96
|
c.tState = STALE;
|
|
97
97
|
Updates.push(c);
|
|
@@ -143,7 +143,7 @@ function startTransition(fn) {
|
|
|
143
143
|
}
|
|
144
144
|
runUpdates(fn);
|
|
145
145
|
Listener = Owner = null;
|
|
146
|
-
return t ? t.done :
|
|
146
|
+
return t ? t.done : undefined;
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
@@ -157,7 +157,7 @@ function createContext(defaultValue, options) {
|
|
|
157
157
|
}
|
|
158
158
|
function useContext(context) {
|
|
159
159
|
let value;
|
|
160
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !==
|
|
160
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
161
161
|
}
|
|
162
162
|
function children(fn) {
|
|
163
163
|
const children2 = createMemo(fn);
|
|
@@ -266,7 +266,7 @@ function runComputation(node, value, time) {
|
|
|
266
266
|
if (Transition && Transition.running) {
|
|
267
267
|
node.tState = STALE;
|
|
268
268
|
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
269
|
-
node.tOwned =
|
|
269
|
+
node.tOwned = undefined;
|
|
270
270
|
} else {
|
|
271
271
|
node.state = STALE;
|
|
272
272
|
node.owned && node.owned.forEach(cleanNode);
|
|
@@ -318,7 +318,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
318
318
|
}
|
|
319
319
|
}
|
|
320
320
|
if (ExternalSourceConfig && c.fn) {
|
|
321
|
-
const [track, trigger] = createSignal(
|
|
321
|
+
const [track, trigger] = createSignal(undefined, {
|
|
322
322
|
equals: false
|
|
323
323
|
});
|
|
324
324
|
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
@@ -583,7 +583,7 @@ function createProvider(id, options) {
|
|
|
583
583
|
};
|
|
584
584
|
return children(() => props.children);
|
|
585
585
|
}),
|
|
586
|
-
|
|
586
|
+
undefined
|
|
587
587
|
);
|
|
588
588
|
return res;
|
|
589
589
|
};
|
|
@@ -663,21 +663,13 @@ exports.useWalletManager = () => {
|
|
|
663
663
|
}
|
|
664
664
|
return manager();
|
|
665
665
|
};
|
|
666
|
-
|
|
666
|
+
exports.useNetwork = () => {
|
|
667
667
|
const manager = createMemo(() => exports.useWalletManager());
|
|
668
|
-
const algodClient = solidStore.useStore(manager().store, (state) => state.algodClient);
|
|
669
|
-
const walletStore = solidStore.useStore(manager().store, (state) => state.wallets);
|
|
670
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
671
|
-
const activeWalletId = solidStore.useStore(manager().store, (state) => state.activeWallet);
|
|
672
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
673
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
674
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
675
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
676
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
677
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
678
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
679
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
680
668
|
const activeNetwork = solidStore.useStore(manager().store, (state) => state.activeNetwork);
|
|
669
|
+
const activeNetworkConfig = () => {
|
|
670
|
+
const store = solidStore.useStore(manager().store);
|
|
671
|
+
return store().networkConfig[activeNetwork()];
|
|
672
|
+
};
|
|
681
673
|
const setActiveNetwork = async (networkId) => {
|
|
682
674
|
if (networkId === activeNetwork()) {
|
|
683
675
|
return;
|
|
@@ -689,18 +681,82 @@ function useWallet() {
|
|
|
689
681
|
algod
|
|
690
682
|
} = manager().networkConfig[networkId];
|
|
691
683
|
const {
|
|
692
|
-
token,
|
|
684
|
+
token = "",
|
|
693
685
|
baseServer,
|
|
694
|
-
port,
|
|
695
|
-
headers
|
|
686
|
+
port = "",
|
|
687
|
+
headers = {}
|
|
696
688
|
} = algod;
|
|
697
689
|
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
690
|
+
await manager().setActiveNetwork(networkId);
|
|
698
691
|
manager().store.setState((state) => ({
|
|
699
692
|
...state,
|
|
700
693
|
activeNetwork: networkId,
|
|
701
694
|
algodClient: newClient
|
|
702
695
|
}));
|
|
703
696
|
};
|
|
697
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
698
|
+
manager().updateAlgodConfig(networkId, config);
|
|
699
|
+
if (networkId === activeNetwork()) {
|
|
700
|
+
const {
|
|
701
|
+
algod
|
|
702
|
+
} = manager().networkConfig[networkId];
|
|
703
|
+
const {
|
|
704
|
+
token = "",
|
|
705
|
+
baseServer,
|
|
706
|
+
port = "",
|
|
707
|
+
headers = {}
|
|
708
|
+
} = algod;
|
|
709
|
+
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
710
|
+
manager().store.setState((state) => ({
|
|
711
|
+
...state,
|
|
712
|
+
algodClient: newClient
|
|
713
|
+
}));
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
const resetNetworkConfig = (networkId) => {
|
|
717
|
+
manager().resetNetworkConfig(networkId);
|
|
718
|
+
if (networkId === activeNetwork()) {
|
|
719
|
+
const {
|
|
720
|
+
algod
|
|
721
|
+
} = manager().networkConfig[networkId];
|
|
722
|
+
const {
|
|
723
|
+
token = "",
|
|
724
|
+
baseServer,
|
|
725
|
+
port = "",
|
|
726
|
+
headers = {}
|
|
727
|
+
} = algod;
|
|
728
|
+
const newClient = new algosdk__default.default.Algodv2(token, baseServer, port, headers);
|
|
729
|
+
manager().store.setState((state) => ({
|
|
730
|
+
...state,
|
|
731
|
+
algodClient: newClient
|
|
732
|
+
}));
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
return {
|
|
736
|
+
activeNetwork,
|
|
737
|
+
networkConfig: () => manager().networkConfig,
|
|
738
|
+
activeNetworkConfig,
|
|
739
|
+
setActiveNetwork,
|
|
740
|
+
updateAlgodConfig,
|
|
741
|
+
resetNetworkConfig
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
exports.useWallet = () => {
|
|
745
|
+
const manager = createMemo(() => exports.useWalletManager());
|
|
746
|
+
const managerStatus = solidStore.useStore(manager().store, (state) => state.managerStatus);
|
|
747
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
748
|
+
const algodClient = solidStore.useStore(manager().store, (state) => state.algodClient);
|
|
749
|
+
const walletStore = solidStore.useStore(manager().store, (state) => state.wallets);
|
|
750
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
751
|
+
const activeWalletId = solidStore.useStore(manager().store, (state) => state.activeWallet);
|
|
752
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
753
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
754
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
755
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
756
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
757
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
758
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
759
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
704
760
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
705
761
|
const wallet = activeWallet();
|
|
706
762
|
if (!wallet) {
|
|
@@ -716,29 +772,27 @@ function useWallet() {
|
|
|
716
772
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
717
773
|
};
|
|
718
774
|
return {
|
|
719
|
-
|
|
720
|
-
|
|
775
|
+
wallets: manager().wallets,
|
|
776
|
+
isReady,
|
|
721
777
|
algodClient,
|
|
722
|
-
activeNetwork,
|
|
723
778
|
activeWallet,
|
|
724
779
|
activeWalletAccounts,
|
|
725
780
|
activeWalletAddresses,
|
|
726
781
|
activeWalletState,
|
|
727
782
|
activeAccount,
|
|
728
783
|
activeAddress,
|
|
784
|
+
activeWalletId,
|
|
785
|
+
walletStore,
|
|
729
786
|
isWalletActive,
|
|
730
787
|
isWalletConnected,
|
|
731
|
-
setActiveNetwork,
|
|
732
788
|
signTransactions,
|
|
733
|
-
transactionSigner
|
|
734
|
-
wallets: manager().wallets
|
|
789
|
+
transactionSigner
|
|
735
790
|
};
|
|
736
|
-
}
|
|
791
|
+
};
|
|
737
792
|
|
|
738
|
-
|
|
739
|
-
Object.keys(useWallet$1).forEach(function (k) {
|
|
793
|
+
Object.keys(useWallet).forEach(function (k) {
|
|
740
794
|
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
741
795
|
enumerable: true,
|
|
742
|
-
get: function () { return useWallet
|
|
796
|
+
get: function () { return useWallet[k]; }
|
|
743
797
|
});
|
|
744
798
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _txnlab_use_wallet from '@txnlab/use-wallet';
|
|
2
|
-
import { WalletManager, WalletMetadata, WalletAccount,
|
|
2
|
+
import { WalletManager, NetworkId, AlgodConfig, WalletMetadata, WalletAccount, WalletState, WalletId } from '@txnlab/use-wallet';
|
|
3
3
|
export * from '@txnlab/use-wallet';
|
|
4
4
|
import * as solid_js from 'solid-js';
|
|
5
5
|
import { JSX } from 'solid-js';
|
|
@@ -11,6 +11,14 @@ interface WalletProviderProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const WalletProvider: (props: WalletProviderProps) => JSX.Element;
|
|
13
13
|
declare const useWalletManager: () => WalletManager;
|
|
14
|
+
declare const useNetwork: () => {
|
|
15
|
+
activeNetwork: solid_js.Accessor<string>;
|
|
16
|
+
networkConfig: () => Record<string, _txnlab_use_wallet.NetworkConfig>;
|
|
17
|
+
activeNetworkConfig: () => _txnlab_use_wallet.NetworkConfig;
|
|
18
|
+
setActiveNetwork: (networkId: NetworkId | string) => Promise<void>;
|
|
19
|
+
updateAlgodConfig: (networkId: string, config: Partial<AlgodConfig>) => void;
|
|
20
|
+
resetNetworkConfig: (networkId: string) => void;
|
|
21
|
+
};
|
|
14
22
|
interface Wallet {
|
|
15
23
|
id: () => string;
|
|
16
24
|
metadata: () => WalletMetadata;
|
|
@@ -23,23 +31,22 @@ interface Wallet {
|
|
|
23
31
|
setActive: () => void;
|
|
24
32
|
setActiveAccount: (address: string) => void;
|
|
25
33
|
}
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
declare const useWallet: () => {
|
|
35
|
+
wallets: _txnlab_use_wallet.BaseWallet[];
|
|
36
|
+
isReady: solid_js.Accessor<boolean>;
|
|
29
37
|
algodClient: solid_js.Accessor<algosdk.Algodv2>;
|
|
30
|
-
activeNetwork: solid_js.Accessor<string>;
|
|
31
38
|
activeWallet: () => _txnlab_use_wallet.BaseWallet | null;
|
|
32
39
|
activeWalletAccounts: () => WalletAccount[] | null;
|
|
33
40
|
activeWalletAddresses: () => string[] | null;
|
|
34
41
|
activeWalletState: () => WalletState | null;
|
|
35
42
|
activeAccount: () => WalletAccount | null;
|
|
36
43
|
activeAddress: () => string | null;
|
|
44
|
+
activeWalletId: solid_js.Accessor<WalletId | null>;
|
|
45
|
+
walletStore: solid_js.Accessor<Partial<Record<WalletId, WalletState>>>;
|
|
37
46
|
isWalletActive: (walletId: WalletId) => boolean;
|
|
38
47
|
isWalletConnected: (walletId: WalletId) => boolean;
|
|
39
|
-
setActiveNetwork: (networkId: string) => Promise<void>;
|
|
40
48
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
41
49
|
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
42
|
-
wallets: _txnlab_use_wallet.BaseWallet[];
|
|
43
50
|
};
|
|
44
51
|
|
|
45
|
-
export { type Wallet, WalletProvider, useWallet, useWalletManager };
|
|
52
|
+
export { type Wallet, WalletProvider, useNetwork, useWallet, useWalletManager };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _txnlab_use_wallet from '@txnlab/use-wallet';
|
|
2
|
-
import { WalletManager, WalletMetadata, WalletAccount,
|
|
2
|
+
import { WalletManager, NetworkId, AlgodConfig, WalletMetadata, WalletAccount, WalletState, WalletId } from '@txnlab/use-wallet';
|
|
3
3
|
export * from '@txnlab/use-wallet';
|
|
4
4
|
import * as solid_js from 'solid-js';
|
|
5
5
|
import { JSX } from 'solid-js';
|
|
@@ -11,6 +11,14 @@ interface WalletProviderProps {
|
|
|
11
11
|
}
|
|
12
12
|
declare const WalletProvider: (props: WalletProviderProps) => JSX.Element;
|
|
13
13
|
declare const useWalletManager: () => WalletManager;
|
|
14
|
+
declare const useNetwork: () => {
|
|
15
|
+
activeNetwork: solid_js.Accessor<string>;
|
|
16
|
+
networkConfig: () => Record<string, _txnlab_use_wallet.NetworkConfig>;
|
|
17
|
+
activeNetworkConfig: () => _txnlab_use_wallet.NetworkConfig;
|
|
18
|
+
setActiveNetwork: (networkId: NetworkId | string) => Promise<void>;
|
|
19
|
+
updateAlgodConfig: (networkId: string, config: Partial<AlgodConfig>) => void;
|
|
20
|
+
resetNetworkConfig: (networkId: string) => void;
|
|
21
|
+
};
|
|
14
22
|
interface Wallet {
|
|
15
23
|
id: () => string;
|
|
16
24
|
metadata: () => WalletMetadata;
|
|
@@ -23,23 +31,22 @@ interface Wallet {
|
|
|
23
31
|
setActive: () => void;
|
|
24
32
|
setActiveAccount: (address: string) => void;
|
|
25
33
|
}
|
|
26
|
-
declare
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
declare const useWallet: () => {
|
|
35
|
+
wallets: _txnlab_use_wallet.BaseWallet[];
|
|
36
|
+
isReady: solid_js.Accessor<boolean>;
|
|
29
37
|
algodClient: solid_js.Accessor<algosdk.Algodv2>;
|
|
30
|
-
activeNetwork: solid_js.Accessor<string>;
|
|
31
38
|
activeWallet: () => _txnlab_use_wallet.BaseWallet | null;
|
|
32
39
|
activeWalletAccounts: () => WalletAccount[] | null;
|
|
33
40
|
activeWalletAddresses: () => string[] | null;
|
|
34
41
|
activeWalletState: () => WalletState | null;
|
|
35
42
|
activeAccount: () => WalletAccount | null;
|
|
36
43
|
activeAddress: () => string | null;
|
|
44
|
+
activeWalletId: solid_js.Accessor<WalletId | null>;
|
|
45
|
+
walletStore: solid_js.Accessor<Partial<Record<WalletId, WalletState>>>;
|
|
37
46
|
isWalletActive: (walletId: WalletId) => boolean;
|
|
38
47
|
isWalletConnected: (walletId: WalletId) => boolean;
|
|
39
|
-
setActiveNetwork: (networkId: string) => Promise<void>;
|
|
40
48
|
signTransactions: <T extends algosdk.Transaction[] | Uint8Array[]>(txnGroup: T | T[], indexesToSign?: number[]) => Promise<(Uint8Array | null)[]>;
|
|
41
49
|
transactionSigner: (txnGroup: algosdk.Transaction[], indexesToSign: number[]) => Promise<Uint8Array[]>;
|
|
42
|
-
wallets: _txnlab_use_wallet.BaseWallet[];
|
|
43
50
|
};
|
|
44
51
|
|
|
45
|
-
export { type Wallet, WalletProvider, useWallet, useWalletManager };
|
|
52
|
+
export { type Wallet, WalletProvider, useNetwork, useWallet, useWalletManager };
|
package/dist/index.js
CHANGED
|
@@ -4,9 +4,9 @@ export * from '@txnlab/use-wallet';
|
|
|
4
4
|
|
|
5
5
|
// ../../node_modules/.pnpm/solid-js@1.9.3/node_modules/solid-js/dist/solid.js
|
|
6
6
|
var sharedConfig = {
|
|
7
|
-
context:
|
|
8
|
-
registry:
|
|
9
|
-
effects:
|
|
7
|
+
context: undefined,
|
|
8
|
+
registry: undefined,
|
|
9
|
+
effects: undefined,
|
|
10
10
|
done: false,
|
|
11
11
|
getContextId() {
|
|
12
12
|
return getContextId(this.context.count);
|
|
@@ -57,7 +57,7 @@ function createSignal(value, options) {
|
|
|
57
57
|
value,
|
|
58
58
|
observers: null,
|
|
59
59
|
observerSlots: null,
|
|
60
|
-
comparator: options.equals ||
|
|
60
|
+
comparator: options.equals || undefined
|
|
61
61
|
};
|
|
62
62
|
const setter = (value2) => {
|
|
63
63
|
if (typeof value2 === "function") {
|
|
@@ -85,7 +85,7 @@ function createMemo(fn, value, options) {
|
|
|
85
85
|
const c = createComputation(fn, value, true, 0);
|
|
86
86
|
c.observers = null;
|
|
87
87
|
c.observerSlots = null;
|
|
88
|
-
c.comparator = options.equals ||
|
|
88
|
+
c.comparator = options.equals || undefined;
|
|
89
89
|
if (Scheduler && Transition && Transition.running) {
|
|
90
90
|
c.tState = STALE;
|
|
91
91
|
Updates.push(c);
|
|
@@ -137,7 +137,7 @@ function startTransition(fn) {
|
|
|
137
137
|
}
|
|
138
138
|
runUpdates(fn);
|
|
139
139
|
Listener = Owner = null;
|
|
140
|
-
return t ? t.done :
|
|
140
|
+
return t ? t.done : undefined;
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
var [transPending, setTransPending] = /* @__PURE__ */ createSignal(false);
|
|
@@ -151,7 +151,7 @@ function createContext(defaultValue, options) {
|
|
|
151
151
|
}
|
|
152
152
|
function useContext(context) {
|
|
153
153
|
let value;
|
|
154
|
-
return Owner && Owner.context && (value = Owner.context[context.id]) !==
|
|
154
|
+
return Owner && Owner.context && (value = Owner.context[context.id]) !== undefined ? value : context.defaultValue;
|
|
155
155
|
}
|
|
156
156
|
function children(fn) {
|
|
157
157
|
const children2 = createMemo(fn);
|
|
@@ -260,7 +260,7 @@ function runComputation(node, value, time) {
|
|
|
260
260
|
if (Transition && Transition.running) {
|
|
261
261
|
node.tState = STALE;
|
|
262
262
|
node.tOwned && node.tOwned.forEach(cleanNode);
|
|
263
|
-
node.tOwned =
|
|
263
|
+
node.tOwned = undefined;
|
|
264
264
|
} else {
|
|
265
265
|
node.state = STALE;
|
|
266
266
|
node.owned && node.owned.forEach(cleanNode);
|
|
@@ -312,7 +312,7 @@ function createComputation(fn, init, pure, state = STALE, options) {
|
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
314
|
if (ExternalSourceConfig && c.fn) {
|
|
315
|
-
const [track, trigger] = createSignal(
|
|
315
|
+
const [track, trigger] = createSignal(undefined, {
|
|
316
316
|
equals: false
|
|
317
317
|
});
|
|
318
318
|
const ordinary = ExternalSourceConfig.factory(c.fn, trigger);
|
|
@@ -577,7 +577,7 @@ function createProvider(id, options) {
|
|
|
577
577
|
};
|
|
578
578
|
return children(() => props.children);
|
|
579
579
|
}),
|
|
580
|
-
|
|
580
|
+
undefined
|
|
581
581
|
);
|
|
582
582
|
return res;
|
|
583
583
|
};
|
|
@@ -657,21 +657,13 @@ var useWalletManager = () => {
|
|
|
657
657
|
}
|
|
658
658
|
return manager();
|
|
659
659
|
};
|
|
660
|
-
|
|
660
|
+
var useNetwork = () => {
|
|
661
661
|
const manager = createMemo(() => useWalletManager());
|
|
662
|
-
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
663
|
-
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
664
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
665
|
-
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
666
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
667
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
668
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
669
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
670
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
671
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
672
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
673
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
674
662
|
const activeNetwork = useStore(manager().store, (state) => state.activeNetwork);
|
|
663
|
+
const activeNetworkConfig = () => {
|
|
664
|
+
const store = useStore(manager().store);
|
|
665
|
+
return store().networkConfig[activeNetwork()];
|
|
666
|
+
};
|
|
675
667
|
const setActiveNetwork = async (networkId) => {
|
|
676
668
|
if (networkId === activeNetwork()) {
|
|
677
669
|
return;
|
|
@@ -683,18 +675,82 @@ function useWallet() {
|
|
|
683
675
|
algod
|
|
684
676
|
} = manager().networkConfig[networkId];
|
|
685
677
|
const {
|
|
686
|
-
token,
|
|
678
|
+
token = "",
|
|
687
679
|
baseServer,
|
|
688
|
-
port,
|
|
689
|
-
headers
|
|
680
|
+
port = "",
|
|
681
|
+
headers = {}
|
|
690
682
|
} = algod;
|
|
691
683
|
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
684
|
+
await manager().setActiveNetwork(networkId);
|
|
692
685
|
manager().store.setState((state) => ({
|
|
693
686
|
...state,
|
|
694
687
|
activeNetwork: networkId,
|
|
695
688
|
algodClient: newClient
|
|
696
689
|
}));
|
|
697
690
|
};
|
|
691
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
692
|
+
manager().updateAlgodConfig(networkId, config);
|
|
693
|
+
if (networkId === activeNetwork()) {
|
|
694
|
+
const {
|
|
695
|
+
algod
|
|
696
|
+
} = manager().networkConfig[networkId];
|
|
697
|
+
const {
|
|
698
|
+
token = "",
|
|
699
|
+
baseServer,
|
|
700
|
+
port = "",
|
|
701
|
+
headers = {}
|
|
702
|
+
} = algod;
|
|
703
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
704
|
+
manager().store.setState((state) => ({
|
|
705
|
+
...state,
|
|
706
|
+
algodClient: newClient
|
|
707
|
+
}));
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
const resetNetworkConfig = (networkId) => {
|
|
711
|
+
manager().resetNetworkConfig(networkId);
|
|
712
|
+
if (networkId === activeNetwork()) {
|
|
713
|
+
const {
|
|
714
|
+
algod
|
|
715
|
+
} = manager().networkConfig[networkId];
|
|
716
|
+
const {
|
|
717
|
+
token = "",
|
|
718
|
+
baseServer,
|
|
719
|
+
port = "",
|
|
720
|
+
headers = {}
|
|
721
|
+
} = algod;
|
|
722
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
723
|
+
manager().store.setState((state) => ({
|
|
724
|
+
...state,
|
|
725
|
+
algodClient: newClient
|
|
726
|
+
}));
|
|
727
|
+
}
|
|
728
|
+
};
|
|
729
|
+
return {
|
|
730
|
+
activeNetwork,
|
|
731
|
+
networkConfig: () => manager().networkConfig,
|
|
732
|
+
activeNetworkConfig,
|
|
733
|
+
setActiveNetwork,
|
|
734
|
+
updateAlgodConfig,
|
|
735
|
+
resetNetworkConfig
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
var useWallet = () => {
|
|
739
|
+
const manager = createMemo(() => useWalletManager());
|
|
740
|
+
const managerStatus = useStore(manager().store, (state) => state.managerStatus);
|
|
741
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
742
|
+
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
743
|
+
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
744
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
745
|
+
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
746
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
747
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
748
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
749
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
750
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
751
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
752
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
753
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
698
754
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
699
755
|
const wallet = activeWallet();
|
|
700
756
|
if (!wallet) {
|
|
@@ -710,23 +766,22 @@ function useWallet() {
|
|
|
710
766
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
711
767
|
};
|
|
712
768
|
return {
|
|
713
|
-
|
|
714
|
-
|
|
769
|
+
wallets: manager().wallets,
|
|
770
|
+
isReady,
|
|
715
771
|
algodClient,
|
|
716
|
-
activeNetwork,
|
|
717
772
|
activeWallet,
|
|
718
773
|
activeWalletAccounts,
|
|
719
774
|
activeWalletAddresses,
|
|
720
775
|
activeWalletState,
|
|
721
776
|
activeAccount,
|
|
722
777
|
activeAddress,
|
|
778
|
+
activeWalletId,
|
|
779
|
+
walletStore,
|
|
723
780
|
isWalletActive,
|
|
724
781
|
isWalletConnected,
|
|
725
|
-
setActiveNetwork,
|
|
726
782
|
signTransactions,
|
|
727
|
-
transactionSigner
|
|
728
|
-
wallets: manager().wallets
|
|
783
|
+
transactionSigner
|
|
729
784
|
};
|
|
730
|
-
}
|
|
785
|
+
};
|
|
731
786
|
|
|
732
|
-
export { WalletProvider, useWallet, useWalletManager };
|
|
787
|
+
export { WalletProvider, useNetwork, useWallet, useWalletManager };
|
package/dist/index.jsx
CHANGED
|
@@ -600,21 +600,13 @@ var useWalletManager = () => {
|
|
|
600
600
|
}
|
|
601
601
|
return manager();
|
|
602
602
|
};
|
|
603
|
-
|
|
603
|
+
var useNetwork = () => {
|
|
604
604
|
const manager = createMemo(() => useWalletManager());
|
|
605
|
-
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
606
|
-
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
607
|
-
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
608
|
-
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
609
|
-
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
610
|
-
const activeWalletState = () => walletState(activeWalletId());
|
|
611
|
-
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
612
|
-
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
613
|
-
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
614
|
-
const activeAddress = () => activeAccount()?.address ?? null;
|
|
615
|
-
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
616
|
-
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
617
605
|
const activeNetwork = useStore(manager().store, (state) => state.activeNetwork);
|
|
606
|
+
const activeNetworkConfig = () => {
|
|
607
|
+
const store = useStore(manager().store);
|
|
608
|
+
return store().networkConfig[activeNetwork()];
|
|
609
|
+
};
|
|
618
610
|
const setActiveNetwork = async (networkId) => {
|
|
619
611
|
if (networkId === activeNetwork()) {
|
|
620
612
|
return;
|
|
@@ -623,14 +615,64 @@ function useWallet() {
|
|
|
623
615
|
throw new Error(`Network "${networkId}" not found in network configuration`);
|
|
624
616
|
}
|
|
625
617
|
const { algod } = manager().networkConfig[networkId];
|
|
626
|
-
const { token, baseServer, port, headers } = algod;
|
|
618
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
627
619
|
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
620
|
+
await manager().setActiveNetwork(networkId);
|
|
628
621
|
manager().store.setState((state) => ({
|
|
629
622
|
...state,
|
|
630
623
|
activeNetwork: networkId,
|
|
631
624
|
algodClient: newClient
|
|
632
625
|
}));
|
|
633
626
|
};
|
|
627
|
+
const updateAlgodConfig = (networkId, config) => {
|
|
628
|
+
manager().updateAlgodConfig(networkId, config);
|
|
629
|
+
if (networkId === activeNetwork()) {
|
|
630
|
+
const { algod } = manager().networkConfig[networkId];
|
|
631
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
632
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
633
|
+
manager().store.setState((state) => ({
|
|
634
|
+
...state,
|
|
635
|
+
algodClient: newClient
|
|
636
|
+
}));
|
|
637
|
+
}
|
|
638
|
+
};
|
|
639
|
+
const resetNetworkConfig = (networkId) => {
|
|
640
|
+
manager().resetNetworkConfig(networkId);
|
|
641
|
+
if (networkId === activeNetwork()) {
|
|
642
|
+
const { algod } = manager().networkConfig[networkId];
|
|
643
|
+
const { token = "", baseServer, port = "", headers = {} } = algod;
|
|
644
|
+
const newClient = new algosdk.Algodv2(token, baseServer, port, headers);
|
|
645
|
+
manager().store.setState((state) => ({
|
|
646
|
+
...state,
|
|
647
|
+
algodClient: newClient
|
|
648
|
+
}));
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
return {
|
|
652
|
+
activeNetwork,
|
|
653
|
+
networkConfig: () => manager().networkConfig,
|
|
654
|
+
activeNetworkConfig,
|
|
655
|
+
setActiveNetwork,
|
|
656
|
+
updateAlgodConfig,
|
|
657
|
+
resetNetworkConfig
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
var useWallet = () => {
|
|
661
|
+
const manager = createMemo(() => useWalletManager());
|
|
662
|
+
const managerStatus = useStore(manager().store, (state) => state.managerStatus);
|
|
663
|
+
const isReady = createMemo(() => managerStatus() === "ready");
|
|
664
|
+
const algodClient = useStore(manager().store, (state) => state.algodClient);
|
|
665
|
+
const walletStore = useStore(manager().store, (state) => state.wallets);
|
|
666
|
+
const walletState = (walletId) => walletStore()[walletId] || null;
|
|
667
|
+
const activeWalletId = useStore(manager().store, (state) => state.activeWallet);
|
|
668
|
+
const activeWallet = () => manager().getWallet(activeWalletId()) || null;
|
|
669
|
+
const activeWalletState = () => walletState(activeWalletId());
|
|
670
|
+
const activeWalletAccounts = () => activeWalletState()?.accounts ?? null;
|
|
671
|
+
const activeWalletAddresses = () => activeWalletAccounts()?.map((account) => account.address) ?? null;
|
|
672
|
+
const activeAccount = () => activeWalletState()?.activeAccount ?? null;
|
|
673
|
+
const activeAddress = () => activeAccount()?.address ?? null;
|
|
674
|
+
const isWalletActive = (walletId) => walletId === activeWalletId();
|
|
675
|
+
const isWalletConnected = (walletId) => !!walletState(walletId)?.accounts.length || false;
|
|
634
676
|
const signTransactions = (txnGroup, indexesToSign) => {
|
|
635
677
|
const wallet = activeWallet();
|
|
636
678
|
if (!wallet) {
|
|
@@ -646,26 +688,26 @@ function useWallet() {
|
|
|
646
688
|
return wallet.transactionSigner(txnGroup, indexesToSign);
|
|
647
689
|
};
|
|
648
690
|
return {
|
|
649
|
-
|
|
650
|
-
|
|
691
|
+
wallets: manager().wallets,
|
|
692
|
+
isReady,
|
|
651
693
|
algodClient,
|
|
652
|
-
activeNetwork,
|
|
653
694
|
activeWallet,
|
|
654
695
|
activeWalletAccounts,
|
|
655
696
|
activeWalletAddresses,
|
|
656
697
|
activeWalletState,
|
|
657
698
|
activeAccount,
|
|
658
699
|
activeAddress,
|
|
700
|
+
activeWalletId,
|
|
701
|
+
walletStore,
|
|
659
702
|
isWalletActive,
|
|
660
703
|
isWalletConnected,
|
|
661
|
-
setActiveNetwork,
|
|
662
704
|
signTransactions,
|
|
663
|
-
transactionSigner
|
|
664
|
-
wallets: manager().wallets
|
|
705
|
+
transactionSigner
|
|
665
706
|
};
|
|
666
|
-
}
|
|
707
|
+
};
|
|
667
708
|
export {
|
|
668
709
|
WalletProvider,
|
|
710
|
+
useNetwork,
|
|
669
711
|
useWallet,
|
|
670
712
|
useWalletManager
|
|
671
713
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@txnlab/use-wallet-solid",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.5",
|
|
4
4
|
"description": "Solid.js library for integrating Algorand wallets into decentralized applications",
|
|
5
5
|
"author": "Doug Richar <drichar@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"dist"
|
|
54
54
|
],
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@tanstack/solid-store": "0.
|
|
57
|
-
"@txnlab/use-wallet": "4.0.0-beta.
|
|
56
|
+
"@tanstack/solid-store": "0.7.0",
|
|
57
|
+
"@txnlab/use-wallet": "4.0.0-beta.5"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@solidjs/testing-library": "0.8.10",
|
|
@@ -62,17 +62,17 @@
|
|
|
62
62
|
"solid-js": "1.9.3",
|
|
63
63
|
"tsup": "8.3.5",
|
|
64
64
|
"tsup-preset-solid": "2.2.0",
|
|
65
|
-
"typescript": "5.
|
|
65
|
+
"typescript": "5.7.2"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"@blockshake/defly-connect": "^1.2.1",
|
|
69
|
-
"@magic-ext/algorand": "^23.
|
|
69
|
+
"@magic-ext/algorand": "^23.20.0",
|
|
70
70
|
"@perawallet/connect": "^1.4.1",
|
|
71
71
|
"@walletconnect/modal": "^2.7.0",
|
|
72
|
-
"@walletconnect/sign-client": "^2.17.
|
|
72
|
+
"@walletconnect/sign-client": "^2.17.3",
|
|
73
73
|
"algosdk": "^3.0.0",
|
|
74
74
|
"lute-connect": "^1.4.1",
|
|
75
|
-
"magic-sdk": "^28.
|
|
75
|
+
"magic-sdk": "^28.21.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependenciesMeta": {
|
|
78
78
|
"@blockshake/defly-connect": {
|