@naculus/connect-appkit-vue 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +191 -111
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +123 -42
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.cjs
CHANGED
|
@@ -101,6 +101,7 @@ __export(index_exports, {
|
|
|
101
101
|
useSolanaAccount: () => useSolanaAccount,
|
|
102
102
|
useSolanaBalance: () => useSolanaBalance,
|
|
103
103
|
useSolanaRoles: () => useSolanaRoles,
|
|
104
|
+
useSolanaSessionKey: () => useSolanaSessionKey,
|
|
104
105
|
useSolanaTransaction: () => useSolanaTransaction,
|
|
105
106
|
useSwitchChain: () => useSwitchChain,
|
|
106
107
|
useTokenBalance: () => useTokenBalance,
|
|
@@ -2616,18 +2617,68 @@ function usePaymentFetch(pay) {
|
|
|
2616
2617
|
};
|
|
2617
2618
|
}
|
|
2618
2619
|
|
|
2619
|
-
// src/
|
|
2620
|
+
// src/useSolanaSessionKey.ts
|
|
2620
2621
|
var import_connect_appkit_core25 = require("@naculus/connect-appkit-core");
|
|
2621
2622
|
var import_vue39 = require("vue");
|
|
2623
|
+
function useSolanaSessionKey(deps) {
|
|
2624
|
+
const guard = useActionGuard();
|
|
2625
|
+
const keys = (0, import_vue39.shallowRef)([]);
|
|
2626
|
+
let flow = null;
|
|
2627
|
+
let generation = 0;
|
|
2628
|
+
let disposed = false;
|
|
2629
|
+
(0, import_vue39.onScopeDispose)(() => {
|
|
2630
|
+
disposed = true;
|
|
2631
|
+
});
|
|
2632
|
+
const refresh = async () => {
|
|
2633
|
+
const own = ++generation;
|
|
2634
|
+
const next = flow ? await flow.list() : [];
|
|
2635
|
+
if (!disposed && own === generation) keys.value = next;
|
|
2636
|
+
};
|
|
2637
|
+
(0, import_vue39.watch)(
|
|
2638
|
+
() => (0, import_vue39.unref)(deps),
|
|
2639
|
+
(next) => {
|
|
2640
|
+
flow = next ? (0, import_connect_appkit_core25.createSolanaSessionKeyFlow)(next) : null;
|
|
2641
|
+
guard.invalidate();
|
|
2642
|
+
void refresh().catch(() => {
|
|
2643
|
+
});
|
|
2644
|
+
},
|
|
2645
|
+
{ immediate: true }
|
|
2646
|
+
);
|
|
2647
|
+
const unavailable = () => Promise.reject(new Error("No Solana session key manager is connected"));
|
|
2648
|
+
const act = (action, fallback) => {
|
|
2649
|
+
const current = flow;
|
|
2650
|
+
if (!current) return unavailable();
|
|
2651
|
+
return guard.run(async () => {
|
|
2652
|
+
try {
|
|
2653
|
+
return await action(current);
|
|
2654
|
+
} finally {
|
|
2655
|
+
await refresh().catch(() => {
|
|
2656
|
+
});
|
|
2657
|
+
}
|
|
2658
|
+
}, fallback);
|
|
2659
|
+
};
|
|
2660
|
+
return {
|
|
2661
|
+
keys,
|
|
2662
|
+
create: (scope) => act((f) => f.create(scope), "Could not create the key"),
|
|
2663
|
+
revoke: (id) => act((f) => f.revoke(id), "Could not revoke the key"),
|
|
2664
|
+
refresh,
|
|
2665
|
+
isPending: guard.busy,
|
|
2666
|
+
error: guard.error
|
|
2667
|
+
};
|
|
2668
|
+
}
|
|
2669
|
+
|
|
2670
|
+
// src/name-lookup.ts
|
|
2671
|
+
var import_connect_appkit_core26 = require("@naculus/connect-appkit-core");
|
|
2672
|
+
var import_vue40 = require("vue");
|
|
2622
2673
|
function useNameLookup(options) {
|
|
2623
2674
|
const guard = useActionGuard();
|
|
2624
|
-
const data = (0,
|
|
2625
|
-
const loading = (0,
|
|
2675
|
+
const data = (0, import_vue40.shallowRef)(null);
|
|
2676
|
+
const loading = (0, import_vue40.shallowRef)(false);
|
|
2626
2677
|
const run = () => {
|
|
2627
|
-
const input = (0,
|
|
2628
|
-
const skip = (0,
|
|
2629
|
-
const scope = (0,
|
|
2630
|
-
const config = (0,
|
|
2678
|
+
const input = (0, import_vue40.toValue)(options.input).trim();
|
|
2679
|
+
const skip = (0, import_vue40.toValue)(options.skip) ?? false;
|
|
2680
|
+
const scope = (0, import_vue40.toValue)(options.scope);
|
|
2681
|
+
const config = (0, import_vue40.toValue)(options.resolverConfig);
|
|
2631
2682
|
if (!input || skip) {
|
|
2632
2683
|
guard.reset();
|
|
2633
2684
|
data.value = null;
|
|
@@ -2640,7 +2691,7 @@ function useNameLookup(options) {
|
|
|
2640
2691
|
async (commit) => {
|
|
2641
2692
|
try {
|
|
2642
2693
|
const result = await Promise.resolve().then(
|
|
2643
|
-
() => options.query((0,
|
|
2694
|
+
() => options.query((0, import_connect_appkit_core26.getResolver)(config), input, scope)
|
|
2644
2695
|
);
|
|
2645
2696
|
commit(() => {
|
|
2646
2697
|
data.value = result;
|
|
@@ -2662,19 +2713,19 @@ function useNameLookup(options) {
|
|
|
2662
2713
|
).catch(() => {
|
|
2663
2714
|
});
|
|
2664
2715
|
};
|
|
2665
|
-
(0,
|
|
2716
|
+
(0, import_vue40.watch)(
|
|
2666
2717
|
() => [
|
|
2667
|
-
(0,
|
|
2668
|
-
(0,
|
|
2669
|
-
(0,
|
|
2670
|
-
(0,
|
|
2718
|
+
(0, import_vue40.toValue)(options.input),
|
|
2719
|
+
(0, import_vue40.toValue)(options.skip),
|
|
2720
|
+
(0, import_vue40.toValue)(options.scope),
|
|
2721
|
+
(0, import_vue40.toValue)(options.resolverConfig)
|
|
2671
2722
|
],
|
|
2672
2723
|
run,
|
|
2673
2724
|
{ immediate: true, flush: "sync", deep: true }
|
|
2674
2725
|
);
|
|
2675
2726
|
return {
|
|
2676
2727
|
data,
|
|
2677
|
-
isLoading: (0,
|
|
2728
|
+
isLoading: (0, import_vue40.computed)(() => loading.value),
|
|
2678
2729
|
error: guard.error,
|
|
2679
2730
|
refetch: run
|
|
2680
2731
|
};
|
|
@@ -2702,21 +2753,21 @@ function useLookupAddress(address, options) {
|
|
|
2702
2753
|
}
|
|
2703
2754
|
|
|
2704
2755
|
// src/useSolanaAccount.ts
|
|
2705
|
-
var
|
|
2756
|
+
var import_vue41 = require("vue");
|
|
2706
2757
|
function useSolanaAccount(accounts, connected) {
|
|
2707
|
-
const isConnected = (0,
|
|
2708
|
-
const caip10 = (0,
|
|
2709
|
-
() => isConnected.value ? ((0,
|
|
2758
|
+
const isConnected = (0, import_vue41.computed)(() => (0, import_vue41.toValue)(connected));
|
|
2759
|
+
const caip10 = (0, import_vue41.computed)(
|
|
2760
|
+
() => isConnected.value ? ((0, import_vue41.toValue)(accounts) ?? []).find(
|
|
2710
2761
|
(account) => account.startsWith("solana:")
|
|
2711
2762
|
) ?? null : null
|
|
2712
2763
|
);
|
|
2713
|
-
const parts = (0,
|
|
2764
|
+
const parts = (0, import_vue41.computed)(() => caip10.value?.split(":") ?? []);
|
|
2714
2765
|
return {
|
|
2715
|
-
address: (0,
|
|
2766
|
+
address: (0, import_vue41.computed)(
|
|
2716
2767
|
() => parts.value.length >= 3 ? parts.value.at(-1) ?? null : null
|
|
2717
2768
|
),
|
|
2718
2769
|
caip10,
|
|
2719
|
-
chainId: (0,
|
|
2770
|
+
chainId: (0, import_vue41.computed)(
|
|
2720
2771
|
() => parts.value.length >= 3 ? parts.value.slice(0, -1).join(":") : null
|
|
2721
2772
|
),
|
|
2722
2773
|
isConnected
|
|
@@ -2724,35 +2775,35 @@ function useSolanaAccount(accounts, connected) {
|
|
|
2724
2775
|
}
|
|
2725
2776
|
|
|
2726
2777
|
// src/useChain.ts
|
|
2727
|
-
var
|
|
2728
|
-
var
|
|
2778
|
+
var import_connect_appkit_core27 = require("@naculus/connect-appkit-core");
|
|
2779
|
+
var import_vue42 = require("vue");
|
|
2729
2780
|
function useChain(chains, chainId) {
|
|
2730
|
-
const list = (0,
|
|
2731
|
-
const id = (0,
|
|
2732
|
-
const currentChain = (0,
|
|
2781
|
+
const list = (0, import_vue42.computed)(() => (0, import_vue42.toValue)(chains) ?? []);
|
|
2782
|
+
const id = (0, import_vue42.computed)(() => (0, import_vue42.toValue)(chainId) ?? null);
|
|
2783
|
+
const currentChain = (0, import_vue42.computed)(() => (0, import_connect_appkit_core27.resolveChain)(list.value, id.value));
|
|
2733
2784
|
return {
|
|
2734
2785
|
currentChain,
|
|
2735
|
-
chainInfo: (0,
|
|
2736
|
-
availableChains: (0,
|
|
2737
|
-
currentChainNumber: (0,
|
|
2738
|
-
() => currentChain.value ? (0,
|
|
2786
|
+
chainInfo: (0, import_vue42.computed)(() => (0, import_connect_appkit_core27.describeChain)(list.value, id.value)),
|
|
2787
|
+
availableChains: (0, import_vue42.computed)(() => (0, import_connect_appkit_core27.chainsForNamespace)(list.value, id.value)),
|
|
2788
|
+
currentChainNumber: (0, import_vue42.computed)(
|
|
2789
|
+
() => currentChain.value ? (0, import_connect_appkit_core27.chainNumber)(currentChain.value) : null
|
|
2739
2790
|
),
|
|
2740
|
-
namespace: (0,
|
|
2741
|
-
() => currentChain.value ? (0,
|
|
2791
|
+
namespace: (0, import_vue42.computed)(
|
|
2792
|
+
() => currentChain.value ? (0, import_connect_appkit_core27.chainNamespace)(currentChain.value) : null
|
|
2742
2793
|
)
|
|
2743
2794
|
};
|
|
2744
2795
|
}
|
|
2745
2796
|
|
|
2746
2797
|
// src/usePassphraseGate.ts
|
|
2747
|
-
var
|
|
2798
|
+
var import_vue43 = require("vue");
|
|
2748
2799
|
function usePassphraseGate(gate) {
|
|
2749
|
-
const request = (0,
|
|
2800
|
+
const request = (0, import_vue43.shallowRef)(gate.getSnapshot());
|
|
2750
2801
|
const unsubscribe = gate.subscribe(() => {
|
|
2751
2802
|
request.value = gate.getSnapshot();
|
|
2752
2803
|
});
|
|
2753
|
-
(0,
|
|
2804
|
+
(0, import_vue43.onScopeDispose)(unsubscribe);
|
|
2754
2805
|
return {
|
|
2755
|
-
request: (0,
|
|
2806
|
+
request: (0, import_vue43.readonly)(request),
|
|
2756
2807
|
submit: (passphrase) => gate.submit(passphrase),
|
|
2757
2808
|
cancel: (reason) => gate.cancel(reason),
|
|
2758
2809
|
forget: (reason) => gate.forget(reason)
|
|
@@ -2761,14 +2812,14 @@ function usePassphraseGate(gate) {
|
|
|
2761
2812
|
|
|
2762
2813
|
// src/useSolanaBalance.ts
|
|
2763
2814
|
var import_connect_core17 = require("@naculus/connect-core");
|
|
2764
|
-
var
|
|
2815
|
+
var import_vue44 = require("vue");
|
|
2765
2816
|
function useSolanaBalance(address, rpcUrl) {
|
|
2766
2817
|
const guard = useActionGuard();
|
|
2767
|
-
const balance = (0,
|
|
2768
|
-
const isFetching = (0,
|
|
2818
|
+
const balance = (0, import_vue44.shallowRef)(null);
|
|
2819
|
+
const isFetching = (0, import_vue44.ref)(false);
|
|
2769
2820
|
const refetch = async () => {
|
|
2770
|
-
const addr = (0,
|
|
2771
|
-
const url = (0,
|
|
2821
|
+
const addr = (0, import_vue44.toValue)(address);
|
|
2822
|
+
const url = (0, import_vue44.toValue)(rpcUrl);
|
|
2772
2823
|
if (!addr || !url) {
|
|
2773
2824
|
guard.invalidate();
|
|
2774
2825
|
isFetching.value = false;
|
|
@@ -2800,22 +2851,22 @@ function useSolanaBalance(address, rpcUrl) {
|
|
|
2800
2851
|
).catch(() => {
|
|
2801
2852
|
});
|
|
2802
2853
|
};
|
|
2803
|
-
(0,
|
|
2804
|
-
(0,
|
|
2805
|
-
(0,
|
|
2854
|
+
(0, import_vue44.watchEffect)(() => {
|
|
2855
|
+
(0, import_vue44.toValue)(address);
|
|
2856
|
+
(0, import_vue44.toValue)(rpcUrl);
|
|
2806
2857
|
void refetch();
|
|
2807
2858
|
});
|
|
2808
2859
|
return { balance, isFetching, error: guard.error, refetch };
|
|
2809
2860
|
}
|
|
2810
2861
|
|
|
2811
2862
|
// src/useLastTx.ts
|
|
2812
|
-
var
|
|
2863
|
+
var import_vue45 = require("vue");
|
|
2813
2864
|
function useLastTx(monitor) {
|
|
2814
|
-
const lastTx = (0,
|
|
2815
|
-
const lastConfirmedTx = (0,
|
|
2816
|
-
const lastFailedTx = (0,
|
|
2817
|
-
(0,
|
|
2818
|
-
() => (0,
|
|
2865
|
+
const lastTx = (0, import_vue45.shallowRef)(null);
|
|
2866
|
+
const lastConfirmedTx = (0, import_vue45.shallowRef)(null);
|
|
2867
|
+
const lastFailedTx = (0, import_vue45.shallowRef)(null);
|
|
2868
|
+
(0, import_vue45.watch)(
|
|
2869
|
+
() => (0, import_vue45.toValue)(monitor),
|
|
2819
2870
|
(activeMonitor, _previous, onCleanup) => {
|
|
2820
2871
|
if (!activeMonitor) return;
|
|
2821
2872
|
const recordLatest = (entry) => {
|
|
@@ -2853,13 +2904,13 @@ function useLastTx(monitor) {
|
|
|
2853
2904
|
}
|
|
2854
2905
|
|
|
2855
2906
|
// src/useTxHistory.ts
|
|
2856
|
-
var
|
|
2907
|
+
var import_vue46 = require("vue");
|
|
2857
2908
|
function useTxHistory(address, chainId, monitor) {
|
|
2858
2909
|
const guard = useActionGuard();
|
|
2859
|
-
const entries = (0,
|
|
2860
|
-
const isLoading = (0,
|
|
2910
|
+
const entries = (0, import_vue46.shallowRef)([]);
|
|
2911
|
+
const isLoading = (0, import_vue46.shallowRef)(false);
|
|
2861
2912
|
const refresh = async () => {
|
|
2862
|
-
const activeMonitor = (0,
|
|
2913
|
+
const activeMonitor = (0, import_vue46.toValue)(monitor);
|
|
2863
2914
|
if (!activeMonitor) {
|
|
2864
2915
|
guard.reset();
|
|
2865
2916
|
entries.value = [];
|
|
@@ -2870,8 +2921,8 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
2870
2921
|
await guard.run(
|
|
2871
2922
|
async (commit) => {
|
|
2872
2923
|
const result = await activeMonitor.getTxHistory(
|
|
2873
|
-
(0,
|
|
2874
|
-
(0,
|
|
2924
|
+
(0, import_vue46.toValue)(address) ?? void 0,
|
|
2925
|
+
(0, import_vue46.toValue)(chainId) ?? void 0
|
|
2875
2926
|
);
|
|
2876
2927
|
commit(() => {
|
|
2877
2928
|
entries.value = result;
|
|
@@ -2887,8 +2938,8 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
2887
2938
|
).catch(() => {
|
|
2888
2939
|
});
|
|
2889
2940
|
};
|
|
2890
|
-
(0,
|
|
2891
|
-
[() => (0,
|
|
2941
|
+
(0, import_vue46.watch)(
|
|
2942
|
+
[() => (0, import_vue46.toValue)(monitor), () => (0, import_vue46.toValue)(address), () => (0, import_vue46.toValue)(chainId)],
|
|
2892
2943
|
([activeMonitor], _previous, onCleanup) => {
|
|
2893
2944
|
if (!activeMonitor) {
|
|
2894
2945
|
void refresh();
|
|
@@ -2908,7 +2959,7 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
2908
2959
|
isLoading,
|
|
2909
2960
|
error: guard.error,
|
|
2910
2961
|
refresh,
|
|
2911
|
-
summary: (0,
|
|
2962
|
+
summary: (0, import_vue46.computed)(() => ({
|
|
2912
2963
|
pending: entries.value.filter((item) => item.status === "pending").length,
|
|
2913
2964
|
confirmed: entries.value.filter((item) => item.status === "confirmed").length,
|
|
2914
2965
|
failed: entries.value.filter((item) => item.status === "failed").length
|
|
@@ -2917,45 +2968,74 @@ function useTxHistory(address, chainId, monitor) {
|
|
|
2917
2968
|
}
|
|
2918
2969
|
|
|
2919
2970
|
// src/useTxMonitor.ts
|
|
2920
|
-
var
|
|
2971
|
+
var import_vue47 = require("vue");
|
|
2921
2972
|
function useTxMonitor(hash, chainId, monitor) {
|
|
2922
|
-
const entry = (0,
|
|
2923
|
-
const isLoading = (0,
|
|
2924
|
-
const isWatching = (0,
|
|
2925
|
-
const
|
|
2973
|
+
const entry = (0, import_vue47.shallowRef)(null);
|
|
2974
|
+
const isLoading = (0, import_vue47.shallowRef)(false);
|
|
2975
|
+
const isWatching = (0, import_vue47.shallowRef)(false);
|
|
2976
|
+
const guard = useActionGuard();
|
|
2977
|
+
const error = guard.error;
|
|
2926
2978
|
let generation = 0;
|
|
2979
|
+
let refreshed = [];
|
|
2980
|
+
const currentInputs = () => [
|
|
2981
|
+
(0, import_vue47.toValue)(monitor),
|
|
2982
|
+
(0, import_vue47.toValue)(hash),
|
|
2983
|
+
(0, import_vue47.toValue)(chainId)
|
|
2984
|
+
];
|
|
2985
|
+
const sameInputs = (a, b) => a.every((value, i) => Object.is(value, b[i]));
|
|
2927
2986
|
const refresh = async () => {
|
|
2928
|
-
const activeMonitor = (0,
|
|
2929
|
-
const activeHash = (0,
|
|
2930
|
-
const activeChainId = (0,
|
|
2987
|
+
const activeMonitor = (0, import_vue47.toValue)(monitor);
|
|
2988
|
+
const activeHash = (0, import_vue47.toValue)(hash);
|
|
2989
|
+
const activeChainId = (0, import_vue47.toValue)(chainId);
|
|
2931
2990
|
if (!activeMonitor || !activeHash) return;
|
|
2991
|
+
const started = [activeMonitor, activeHash, activeChainId];
|
|
2992
|
+
refreshed = started;
|
|
2932
2993
|
isLoading.value = true;
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2994
|
+
await guard.run(
|
|
2995
|
+
async (commit) => {
|
|
2996
|
+
try {
|
|
2997
|
+
await activeMonitor.refreshTx(
|
|
2998
|
+
activeHash,
|
|
2999
|
+
activeChainId ?? void 0
|
|
3000
|
+
);
|
|
3001
|
+
} catch (err) {
|
|
3002
|
+
if (!sameInputs(started, currentInputs())) return;
|
|
3003
|
+
throw err;
|
|
3004
|
+
}
|
|
3005
|
+
if (!sameInputs(started, currentInputs())) return;
|
|
3006
|
+
const current = activeMonitor.getTxStatus(
|
|
3007
|
+
activeHash,
|
|
3008
|
+
activeChainId ?? void 0
|
|
3009
|
+
);
|
|
3010
|
+
commit(() => {
|
|
3011
|
+
entry.value = current ?? null;
|
|
3012
|
+
});
|
|
3013
|
+
},
|
|
3014
|
+
"Failed to refresh transaction",
|
|
3015
|
+
void 0,
|
|
3016
|
+
{
|
|
3017
|
+
onSettled: () => {
|
|
3018
|
+
isLoading.value = false;
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
).catch(() => {
|
|
3022
|
+
});
|
|
2946
3023
|
};
|
|
2947
3024
|
const stopWatching = () => {
|
|
2948
|
-
const activeMonitor = (0,
|
|
2949
|
-
const activeHash = (0,
|
|
2950
|
-
const activeChainId = (0,
|
|
3025
|
+
const activeMonitor = (0, import_vue47.toValue)(monitor);
|
|
3026
|
+
const activeHash = (0, import_vue47.toValue)(hash);
|
|
3027
|
+
const activeChainId = (0, import_vue47.toValue)(chainId);
|
|
2951
3028
|
if (!activeMonitor || !activeHash) return;
|
|
2952
3029
|
activeMonitor.stopWatching(activeHash, activeChainId ?? void 0);
|
|
2953
3030
|
isWatching.value = false;
|
|
2954
3031
|
};
|
|
2955
|
-
(0,
|
|
2956
|
-
[() => (0,
|
|
3032
|
+
(0, import_vue47.watch)(
|
|
3033
|
+
[() => (0, import_vue47.toValue)(monitor), () => (0, import_vue47.toValue)(hash), () => (0, import_vue47.toValue)(chainId)],
|
|
2957
3034
|
([activeMonitor, activeHash, activeChainId], _previous, onCleanup) => {
|
|
2958
3035
|
const mine = ++generation;
|
|
3036
|
+
if (!sameInputs([activeMonitor, activeHash, activeChainId], refreshed)) {
|
|
3037
|
+
guard.invalidate();
|
|
3038
|
+
}
|
|
2959
3039
|
if (!activeMonitor || !activeHash || !activeChainId) {
|
|
2960
3040
|
entry.value = null;
|
|
2961
3041
|
isLoading.value = false;
|
|
@@ -2977,8 +3057,7 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
2977
3057
|
isWatching.value = true;
|
|
2978
3058
|
isLoading.value = true;
|
|
2979
3059
|
error.value = null;
|
|
2980
|
-
|
|
2981
|
-
if (current) entry.value = current;
|
|
3060
|
+
entry.value = activeMonitor.getTxStatus(activeHash, activeChainId) ?? null;
|
|
2982
3061
|
activeMonitor.watchTx(activeHash, activeChainId, {}).then((initial) => {
|
|
2983
3062
|
if (cancelled || mine !== generation) return;
|
|
2984
3063
|
entry.value = initial;
|
|
@@ -2993,7 +3072,7 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
2993
3072
|
);
|
|
2994
3073
|
return {
|
|
2995
3074
|
entry,
|
|
2996
|
-
status: (0,
|
|
3075
|
+
status: (0, import_vue47.computed)(() => entry.value?.status ?? "idle"),
|
|
2997
3076
|
isLoading,
|
|
2998
3077
|
isWatching,
|
|
2999
3078
|
error,
|
|
@@ -3003,17 +3082,17 @@ function useTxMonitor(hash, chainId, monitor) {
|
|
|
3003
3082
|
}
|
|
3004
3083
|
|
|
3005
3084
|
// src/useCapabilities.ts
|
|
3006
|
-
var
|
|
3007
|
-
var
|
|
3085
|
+
var import_connect_appkit_core28 = require("@naculus/connect-appkit-core");
|
|
3086
|
+
var import_vue48 = require("vue");
|
|
3008
3087
|
function useCapabilities(client, session, chainId) {
|
|
3009
3088
|
const guard = useActionGuard();
|
|
3010
|
-
const capabilities = (0,
|
|
3089
|
+
const capabilities = (0, import_vue48.shallowRef)(
|
|
3011
3090
|
null
|
|
3012
3091
|
);
|
|
3013
|
-
const isFetching = (0,
|
|
3092
|
+
const isFetching = (0, import_vue48.shallowRef)(false);
|
|
3014
3093
|
const refetch = async () => {
|
|
3015
|
-
const activeClient = (0,
|
|
3016
|
-
const activeSession = (0,
|
|
3094
|
+
const activeClient = (0, import_vue48.toValue)(client);
|
|
3095
|
+
const activeSession = (0, import_vue48.toValue)(session);
|
|
3017
3096
|
if (!activeClient?.getCapabilities || !activeSession) {
|
|
3018
3097
|
guard.reset();
|
|
3019
3098
|
capabilities.value = null;
|
|
@@ -3026,7 +3105,7 @@ function useCapabilities(client, session, chainId) {
|
|
|
3026
3105
|
try {
|
|
3027
3106
|
const raw = await activeClient.getCapabilities(activeSession);
|
|
3028
3107
|
commit(() => {
|
|
3029
|
-
capabilities.value = (0,
|
|
3108
|
+
capabilities.value = (0, import_connect_appkit_core28.normalizeCapabilities)(raw);
|
|
3030
3109
|
});
|
|
3031
3110
|
} catch (err) {
|
|
3032
3111
|
commit(() => {
|
|
@@ -3045,18 +3124,18 @@ function useCapabilities(client, session, chainId) {
|
|
|
3045
3124
|
).catch(() => {
|
|
3046
3125
|
});
|
|
3047
3126
|
};
|
|
3048
|
-
(0,
|
|
3049
|
-
void (0,
|
|
3050
|
-
void (0,
|
|
3127
|
+
(0, import_vue48.watchEffect)(() => {
|
|
3128
|
+
void (0, import_vue48.toValue)(client);
|
|
3129
|
+
void (0, import_vue48.toValue)(session);
|
|
3051
3130
|
void refetch();
|
|
3052
3131
|
});
|
|
3053
3132
|
return {
|
|
3054
3133
|
capabilities,
|
|
3055
|
-
current: (0,
|
|
3056
|
-
() => (0,
|
|
3134
|
+
current: (0, import_vue48.computed)(
|
|
3135
|
+
() => (0, import_connect_appkit_core28.selectChainCapabilities)(capabilities.value, (0, import_vue48.toValue)(chainId))
|
|
3057
3136
|
),
|
|
3058
|
-
atomic: (0,
|
|
3059
|
-
() => (0,
|
|
3137
|
+
atomic: (0, import_vue48.computed)(
|
|
3138
|
+
() => (0, import_connect_appkit_core28.atomicSupportFor)(capabilities.value, (0, import_vue48.toValue)(chainId))
|
|
3060
3139
|
),
|
|
3061
3140
|
isFetching,
|
|
3062
3141
|
error: guard.error,
|
|
@@ -3065,18 +3144,18 @@ function useCapabilities(client, session, chainId) {
|
|
|
3065
3144
|
}
|
|
3066
3145
|
|
|
3067
3146
|
// src/useSolanaRoles.ts
|
|
3068
|
-
var
|
|
3069
|
-
var
|
|
3147
|
+
var import_connect_appkit_core29 = require("@naculus/connect-appkit-core");
|
|
3148
|
+
var import_vue49 = require("vue");
|
|
3070
3149
|
function useSolanaRoles(connector, session) {
|
|
3071
|
-
const state = (0,
|
|
3072
|
-
() => (0,
|
|
3150
|
+
const state = (0, import_vue49.computed)(
|
|
3151
|
+
() => (0, import_connect_appkit_core29.readSolanaRoles)((0, import_vue49.toValue)(connector), (0, import_vue49.toValue)(session))
|
|
3073
3152
|
);
|
|
3074
3153
|
return {
|
|
3075
|
-
roles: (0,
|
|
3076
|
-
absence: (0,
|
|
3077
|
-
identity: (0,
|
|
3078
|
-
signer: (0,
|
|
3079
|
-
payer: (0,
|
|
3154
|
+
roles: (0, import_vue49.computed)(() => state.value.roles),
|
|
3155
|
+
absence: (0, import_vue49.computed)(() => state.value.absence),
|
|
3156
|
+
identity: (0, import_vue49.computed)(() => state.value.roles?.identity ?? null),
|
|
3157
|
+
signer: (0, import_vue49.computed)(() => state.value.roles?.signer ?? null),
|
|
3158
|
+
payer: (0, import_vue49.computed)(() => state.value.roles?.payer ?? null)
|
|
3080
3159
|
};
|
|
3081
3160
|
}
|
|
3082
3161
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -3152,6 +3231,7 @@ function useSolanaRoles(connector, session) {
|
|
|
3152
3231
|
useSolanaAccount,
|
|
3153
3232
|
useSolanaBalance,
|
|
3154
3233
|
useSolanaRoles,
|
|
3234
|
+
useSolanaSessionKey,
|
|
3155
3235
|
useSolanaTransaction,
|
|
3156
3236
|
useSwitchChain,
|
|
3157
3237
|
useTokenBalance,
|