@vue-solana/vue 1.2.0 → 2.1.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/README.md +162 -23
- package/dist/buffer-polyfill.d.cts +0 -1
- package/dist/buffer-polyfill.d.mts +0 -1
- package/dist/buffer-polyfill.d.ts +0 -1
- package/dist/index.cjs +62 -22
- package/dist/index.d.cts +29 -13
- package/dist/index.d.mts +29 -13
- package/dist/index.d.ts +29 -13
- package/dist/index.mjs +41 -21
- package/dist/kit.d.cts +1 -1
- package/dist/kit.d.mts +1 -1
- package/dist/kit.d.ts +1 -1
- package/dist/shared/vue.5euWd6-V.mjs +59 -0
- package/dist/shared/vue.9TPxZPMf.cjs +59 -0
- package/dist/shared/vue.B4-LEdSE.cjs +102 -0
- package/dist/shared/{vue.C0uCLjJ6.cjs → vue.B6ainw2G.cjs} +1 -1
- package/dist/shared/vue.B8LptjZP.mjs +32 -0
- package/dist/shared/vue.B8pLQ8P4.cjs +105 -0
- package/dist/shared/vue.B8ub540p.mjs +109 -0
- package/dist/shared/{vue.D0ycWj82.mjs → vue.BD6Gm1nl.mjs} +9 -9
- package/dist/shared/{vue.BEesxsrA.cjs → vue.BGxz4dru.cjs} +7 -3
- package/dist/shared/{vue.DDxhSi72.mjs → vue.BINkrA8h.mjs} +9 -9
- package/dist/shared/{vue.COPnX5fq.cjs → vue.BIxphCAq.cjs} +1 -1
- package/dist/shared/{vue.CKTUFwSI.mjs → vue.BOpgWr43.mjs} +9 -10
- package/dist/shared/vue.BQRpjwKl.mjs +80 -0
- package/dist/shared/vue.BVaMoz9y.cjs +9 -0
- package/dist/shared/vue.BVj9lWBK.cjs +111 -0
- package/dist/shared/vue.BY0qpgYr.cjs +35 -0
- package/dist/shared/vue.Bfu1dCKe.mjs +10 -0
- package/dist/shared/vue.Bk5xjlUx.cjs +61 -0
- package/dist/shared/{vue.BtUKvuQw.mjs → vue.BsGwt78R.mjs} +2 -2
- package/dist/shared/{vue.BbX3ePDY.cjs → vue.Bwd1sGAM.cjs} +9 -10
- package/dist/shared/vue.ByxbBC3y.mjs +57 -0
- package/dist/shared/{vue.CPjEwHSg.mjs → vue.C13umiQi.mjs} +20 -8
- package/dist/shared/vue.C5FVoEZT.mjs +99 -0
- package/dist/shared/vue.CATOh_9G.mjs +42 -0
- package/dist/shared/{vue.Bhdhmz8d.cjs → vue.CIs8QhCw.cjs} +18 -74
- package/dist/shared/vue.CMohL_Cz.mjs +58 -0
- package/dist/shared/{vue.CYKT65tB.mjs → vue.CQh3AUE8.mjs} +2 -6
- package/dist/shared/{vue.DzKfcfpX.cjs → vue.CWZSMVnB.cjs} +6 -6
- package/dist/shared/{vue.B12Pt1PQ.mjs → vue.CXB4NEMA.mjs} +18 -74
- package/dist/shared/{vue.DFbay4mm.mjs → vue.C_4qJDiF.mjs} +1 -1
- package/dist/shared/vue.CoaIWGPT.cjs +38 -0
- package/dist/shared/vue.CogzzQXM.mjs +171 -0
- package/dist/shared/vue.CpkwC8Th.mjs +7 -0
- package/dist/shared/vue.CrkK_T15.cjs +86 -0
- package/dist/shared/vue.D-qi8PSL.cjs +82 -0
- package/dist/shared/{vue.B2AQR2bE.mjs → vue.D218Ow7t.mjs} +8 -4
- package/dist/shared/{vue.QHAHFnw8.mjs → vue.D3Y0PWbF.mjs} +3 -3
- package/dist/shared/vue.D5U1yLG3.mjs +83 -0
- package/dist/shared/{vue.j1vB3h1n.cjs → vue.DAg5wC1G.cjs} +9 -9
- package/dist/shared/vue.DDbVk0Zh.cjs +180 -0
- package/dist/shared/{vue.BE4KHksm.cjs → vue.DE3emjSF.cjs} +2 -7
- package/dist/shared/vue.DEHxNvUX.cjs +7 -0
- package/dist/shared/vue.DFaMJLAQ.cjs +60 -0
- package/dist/shared/vue.DImwKTwJ.mjs +103 -0
- package/dist/shared/{vue.G9t8pE0J.cjs → vue.DKyQ7J67.cjs} +1 -1
- package/dist/shared/vue.DNxOpDXz.cjs +12 -0
- package/dist/shared/vue.DXQVIRZA.mjs +174 -0
- package/dist/shared/vue.DYk0Xfr3.mjs +36 -0
- package/dist/shared/vue.D_P5SqqD.mjs +5 -0
- package/dist/shared/{vue.B14U1xmP.cjs → vue.Di7yjJ-R.cjs} +20 -8
- package/dist/shared/vue.DtCbCcPd.cjs +173 -0
- package/dist/shared/{vue.CM_uqVc0.mjs → vue.Dyi1OCI1.mjs} +6 -6
- package/dist/shared/{vue.BsD6AAmO.cjs → vue.E_npPFoV.cjs} +8 -8
- package/dist/shared/{vue.LNhX07HB.cjs → vue.FiMmnMHr.cjs} +2 -2
- package/dist/shared/{vue.CSzg70vB.mjs → vue.JUWqu6kD.mjs} +1 -1
- package/dist/shared/{vue.By1CUlOU.mjs → vue.Mxc8w6Qk.mjs} +1 -1
- package/dist/shared/{vue.ByUemLSf.cjs → vue.Sbbm9JSu.cjs} +3 -3
- package/dist/shared/vue.g8fnm_ca.cjs +45 -0
- package/dist/swr.cjs +136 -0
- package/dist/swr.d.cts +41 -0
- package/dist/swr.d.mts +41 -0
- package/dist/swr.d.ts +41 -0
- package/dist/swr.mjs +131 -0
- package/dist/useAccountInfo.cjs +7 -5
- package/dist/useAccountInfo.d.cts +12 -8
- package/dist/useAccountInfo.d.mts +12 -8
- package/dist/useAccountInfo.d.ts +12 -8
- package/dist/useAccountInfo.mjs +7 -5
- package/dist/useAction.cjs +9 -0
- package/dist/useAction.d.cts +45 -0
- package/dist/useAction.d.mts +45 -0
- package/dist/useAction.d.ts +45 -0
- package/dist/useAction.mjs +3 -0
- package/dist/useBalance.cjs +5 -4
- package/dist/useBalance.d.cts +4 -2
- package/dist/useBalance.d.mts +4 -2
- package/dist/useBalance.d.ts +4 -2
- package/dist/useBalance.mjs +5 -4
- package/dist/useClientCapability.cjs +12 -0
- package/dist/useClientCapability.d.cts +39 -0
- package/dist/useClientCapability.d.mts +39 -0
- package/dist/useClientCapability.d.ts +39 -0
- package/dist/useClientCapability.mjs +5 -0
- package/dist/useConnection.cjs +4 -3
- package/dist/useConnection.d.cts +9 -2
- package/dist/useConnection.d.mts +9 -2
- package/dist/useConnection.d.ts +9 -2
- package/dist/useConnection.mjs +4 -3
- package/dist/useIdentity.cjs +12 -0
- package/dist/useIdentity.d.cts +3 -0
- package/dist/useIdentity.d.mts +3 -0
- package/dist/useIdentity.d.ts +3 -0
- package/dist/useIdentity.mjs +6 -0
- package/dist/usePayer.cjs +13 -0
- package/dist/usePayer.d.cts +18 -0
- package/dist/usePayer.d.mts +18 -0
- package/dist/usePayer.d.ts +18 -0
- package/dist/usePayer.mjs +6 -0
- package/dist/usePlanTransaction.cjs +14 -0
- package/dist/usePlanTransaction.d.cts +37 -0
- package/dist/usePlanTransaction.d.mts +37 -0
- package/dist/usePlanTransaction.d.ts +37 -0
- package/dist/usePlanTransaction.mjs +7 -0
- package/dist/usePlanTransactions.cjs +13 -0
- package/dist/usePlanTransactions.d.cts +4 -0
- package/dist/usePlanTransactions.d.mts +4 -0
- package/dist/usePlanTransactions.d.ts +4 -0
- package/dist/usePlanTransactions.mjs +7 -0
- package/dist/useProgramAccounts.cjs +7 -5
- package/dist/useProgramAccounts.d.cts +24 -9
- package/dist/useProgramAccounts.d.mts +24 -9
- package/dist/useProgramAccounts.d.ts +24 -9
- package/dist/useProgramAccounts.mjs +7 -5
- package/dist/useRequest.cjs +11 -0
- package/dist/useRequest.d.cts +57 -0
- package/dist/useRequest.d.mts +57 -0
- package/dist/useRequest.d.ts +57 -0
- package/dist/useRequest.mjs +5 -0
- package/dist/useRpc.cjs +3 -2
- package/dist/useRpc.d.cts +5 -2
- package/dist/useRpc.d.mts +5 -2
- package/dist/useRpc.d.ts +5 -2
- package/dist/useRpc.mjs +3 -2
- package/dist/useSelectedWalletAccount.cjs +13 -0
- package/dist/useSelectedWalletAccount.d.cts +117 -0
- package/dist/useSelectedWalletAccount.d.mts +117 -0
- package/dist/useSelectedWalletAccount.d.ts +117 -0
- package/dist/useSelectedWalletAccount.mjs +3 -0
- package/dist/useSignAndSendTransaction.cjs +7 -6
- package/dist/useSignAndSendTransaction.d.cts +18 -24
- package/dist/useSignAndSendTransaction.d.mts +18 -24
- package/dist/useSignAndSendTransaction.d.ts +18 -24
- package/dist/useSignAndSendTransaction.mjs +7 -6
- package/dist/useSignAndSendTransactions.cjs +15 -0
- package/dist/useSignAndSendTransactions.d.cts +35 -0
- package/dist/useSignAndSendTransactions.d.mts +35 -0
- package/dist/useSignAndSendTransactions.d.ts +35 -0
- package/dist/useSignAndSendTransactions.mjs +8 -0
- package/dist/useSignIn.cjs +13 -0
- package/dist/useSignIn.d.cts +23 -0
- package/dist/useSignIn.d.mts +23 -0
- package/dist/useSignIn.d.ts +23 -0
- package/dist/useSignIn.mjs +7 -0
- package/dist/useSignMessage.cjs +4 -3
- package/dist/useSignMessage.mjs +4 -3
- package/dist/useSignTransactions.cjs +13 -0
- package/dist/useSignTransactions.d.cts +24 -0
- package/dist/useSignTransactions.d.mts +24 -0
- package/dist/useSignTransactions.d.ts +24 -0
- package/dist/useSignTransactions.mjs +7 -0
- package/dist/useSignatureStatus.cjs +5 -4
- package/dist/useSignatureStatus.d.cts +9 -5
- package/dist/useSignatureStatus.d.mts +9 -5
- package/dist/useSignatureStatus.d.ts +9 -5
- package/dist/useSignatureStatus.mjs +5 -4
- package/dist/useSolana.cjs +2 -1
- package/dist/useSolana.mjs +2 -1
- package/dist/useSolanaClient.cjs +3 -2
- package/dist/useSolanaClient.mjs +3 -2
- package/dist/useSubscription.cjs +9 -0
- package/dist/useSubscription.d.cts +58 -0
- package/dist/useSubscription.d.mts +58 -0
- package/dist/useSubscription.d.ts +58 -0
- package/dist/useSubscription.mjs +3 -0
- package/dist/useTokenAccounts.cjs +7 -6
- package/dist/useTokenAccounts.d.cts +6 -6
- package/dist/useTokenAccounts.d.mts +6 -6
- package/dist/useTokenAccounts.d.ts +6 -6
- package/dist/useTokenAccounts.mjs +7 -6
- package/dist/useTokenBalance.cjs +7 -6
- package/dist/useTokenBalance.d.cts +2 -2
- package/dist/useTokenBalance.d.mts +2 -2
- package/dist/useTokenBalance.d.ts +2 -2
- package/dist/useTokenBalance.mjs +7 -6
- package/dist/useTrackedData.cjs +10 -0
- package/dist/useTrackedData.d.cts +86 -0
- package/dist/useTrackedData.d.mts +86 -0
- package/dist/useTrackedData.d.ts +86 -0
- package/dist/useTrackedData.mjs +4 -0
- package/dist/useTransaction.cjs +2 -1
- package/dist/useTransaction.d.cts +13 -3
- package/dist/useTransaction.d.mts +13 -3
- package/dist/useTransaction.d.ts +13 -3
- package/dist/useTransaction.mjs +2 -1
- package/dist/useTransactionConfirmation.cjs +5 -4
- package/dist/useTransactionConfirmation.d.cts +18 -24
- package/dist/useTransactionConfirmation.d.mts +18 -24
- package/dist/useTransactionConfirmation.d.ts +18 -24
- package/dist/useTransactionConfirmation.mjs +5 -4
- package/dist/useWallet.cjs +3 -2
- package/dist/useWallet.d.cts +2 -2
- package/dist/useWallet.d.mts +2 -2
- package/dist/useWallet.d.ts +2 -2
- package/dist/useWallet.mjs +3 -2
- package/dist/useWallets.cjs +3 -2
- package/dist/useWallets.mjs +3 -2
- package/package.json +73 -9
- package/dist/shared/vue.C4d2JA8U.mjs +0 -44
- package/dist/shared/vue.CE5i8KZZ.cjs +0 -46
- package/dist/shared/vue.CfrVAzEf.mjs +0 -129
- package/dist/shared/vue.DCgByzxg.cjs +0 -9
- package/dist/shared/vue.DiNn3XHm.mjs +0 -7
- package/dist/shared/vue._CAClzAz.cjs +0 -131
- package/dist/web3.cjs +0 -13
- package/dist/web3.d.cts +0 -1
- package/dist/web3.d.mts +0 -1
- package/dist/web3.d.ts +0 -1
- package/dist/web3.mjs +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-solana/vue",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Vue plugin and composables for Solana applications.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
@@ -35,6 +35,76 @@
|
|
|
35
35
|
"import": "./dist/buffer-polyfill.mjs",
|
|
36
36
|
"require": "./dist/buffer-polyfill.cjs"
|
|
37
37
|
},
|
|
38
|
+
"./useAction": {
|
|
39
|
+
"types": "./dist/useAction.d.ts",
|
|
40
|
+
"import": "./dist/useAction.mjs",
|
|
41
|
+
"require": "./dist/useAction.cjs"
|
|
42
|
+
},
|
|
43
|
+
"./useRequest": {
|
|
44
|
+
"types": "./dist/useRequest.d.ts",
|
|
45
|
+
"import": "./dist/useRequest.mjs",
|
|
46
|
+
"require": "./dist/useRequest.cjs"
|
|
47
|
+
},
|
|
48
|
+
"./useSubscription": {
|
|
49
|
+
"types": "./dist/useSubscription.d.ts",
|
|
50
|
+
"import": "./dist/useSubscription.mjs",
|
|
51
|
+
"require": "./dist/useSubscription.cjs"
|
|
52
|
+
},
|
|
53
|
+
"./useTrackedData": {
|
|
54
|
+
"types": "./dist/useTrackedData.d.ts",
|
|
55
|
+
"import": "./dist/useTrackedData.mjs",
|
|
56
|
+
"require": "./dist/useTrackedData.cjs"
|
|
57
|
+
},
|
|
58
|
+
"./useSignIn": {
|
|
59
|
+
"types": "./dist/useSignIn.d.ts",
|
|
60
|
+
"import": "./dist/useSignIn.mjs",
|
|
61
|
+
"require": "./dist/useSignIn.cjs"
|
|
62
|
+
},
|
|
63
|
+
"./useSelectedWalletAccount": {
|
|
64
|
+
"types": "./dist/useSelectedWalletAccount.d.ts",
|
|
65
|
+
"import": "./dist/useSelectedWalletAccount.mjs",
|
|
66
|
+
"require": "./dist/useSelectedWalletAccount.cjs"
|
|
67
|
+
},
|
|
68
|
+
"./useSignTransactions": {
|
|
69
|
+
"types": "./dist/useSignTransactions.d.ts",
|
|
70
|
+
"import": "./dist/useSignTransactions.mjs",
|
|
71
|
+
"require": "./dist/useSignTransactions.cjs"
|
|
72
|
+
},
|
|
73
|
+
"./useSignAndSendTransactions": {
|
|
74
|
+
"types": "./dist/useSignAndSendTransactions.d.ts",
|
|
75
|
+
"import": "./dist/useSignAndSendTransactions.mjs",
|
|
76
|
+
"require": "./dist/useSignAndSendTransactions.cjs"
|
|
77
|
+
},
|
|
78
|
+
"./useClientCapability": {
|
|
79
|
+
"types": "./dist/useClientCapability.d.ts",
|
|
80
|
+
"import": "./dist/useClientCapability.mjs",
|
|
81
|
+
"require": "./dist/useClientCapability.cjs"
|
|
82
|
+
},
|
|
83
|
+
"./usePayer": {
|
|
84
|
+
"types": "./dist/usePayer.d.ts",
|
|
85
|
+
"import": "./dist/usePayer.mjs",
|
|
86
|
+
"require": "./dist/usePayer.cjs"
|
|
87
|
+
},
|
|
88
|
+
"./useIdentity": {
|
|
89
|
+
"types": "./dist/useIdentity.d.ts",
|
|
90
|
+
"import": "./dist/useIdentity.mjs",
|
|
91
|
+
"require": "./dist/useIdentity.cjs"
|
|
92
|
+
},
|
|
93
|
+
"./usePlanTransaction": {
|
|
94
|
+
"types": "./dist/usePlanTransaction.d.ts",
|
|
95
|
+
"import": "./dist/usePlanTransaction.mjs",
|
|
96
|
+
"require": "./dist/usePlanTransaction.cjs"
|
|
97
|
+
},
|
|
98
|
+
"./usePlanTransactions": {
|
|
99
|
+
"types": "./dist/usePlanTransactions.d.ts",
|
|
100
|
+
"import": "./dist/usePlanTransactions.mjs",
|
|
101
|
+
"require": "./dist/usePlanTransactions.cjs"
|
|
102
|
+
},
|
|
103
|
+
"./swr": {
|
|
104
|
+
"types": "./dist/swr.d.ts",
|
|
105
|
+
"import": "./dist/swr.mjs",
|
|
106
|
+
"require": "./dist/swr.cjs"
|
|
107
|
+
},
|
|
38
108
|
"./useSolana": {
|
|
39
109
|
"types": "./dist/useSolana.d.ts",
|
|
40
110
|
"import": "./dist/useSolana.mjs",
|
|
@@ -115,11 +185,6 @@
|
|
|
115
185
|
"import": "./dist/useTokenAccounts.mjs",
|
|
116
186
|
"require": "./dist/useTokenAccounts.cjs"
|
|
117
187
|
},
|
|
118
|
-
"./web3": {
|
|
119
|
-
"types": "./dist/web3.d.ts",
|
|
120
|
-
"import": "./dist/web3.mjs",
|
|
121
|
-
"require": "./dist/web3.cjs"
|
|
122
|
-
},
|
|
123
188
|
"./kit": {
|
|
124
189
|
"types": "./dist/kit.d.ts",
|
|
125
190
|
"import": "./dist/kit.mjs",
|
|
@@ -133,9 +198,8 @@
|
|
|
133
198
|
"access": "public"
|
|
134
199
|
},
|
|
135
200
|
"dependencies": {
|
|
136
|
-
"@solana/web3-compat": "^0.0.21",
|
|
137
201
|
"bs58": "^6.0.0",
|
|
138
|
-
"@vue-solana/core": "1.
|
|
202
|
+
"@vue-solana/core": "2.1.0"
|
|
139
203
|
},
|
|
140
204
|
"peerDependencies": {
|
|
141
205
|
"vue": "^3.5.0"
|
|
@@ -146,7 +210,7 @@
|
|
|
146
210
|
"vue": "^3.5.16"
|
|
147
211
|
},
|
|
148
212
|
"scripts": {
|
|
149
|
-
"build": "unbuild",
|
|
213
|
+
"build": "NODE_OPTIONS=--max-old-space-size=8192 unbuild",
|
|
150
214
|
"dev": "unbuild --stub",
|
|
151
215
|
"typecheck": "tsc --noEmit",
|
|
152
216
|
"clean": "rm -rf dist"
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
2
|
-
import { withSolanaTimeout } from '@vue-solana/core/timeout';
|
|
3
|
-
import { ref } from 'vue';
|
|
4
|
-
|
|
5
|
-
function useTransaction(handler, options = {}) {
|
|
6
|
-
const signature = ref(null);
|
|
7
|
-
const loading = ref(false);
|
|
8
|
-
const error = ref(null);
|
|
9
|
-
let executionId = 0;
|
|
10
|
-
async function execute(...args) {
|
|
11
|
-
const currentExecutionId = ++executionId;
|
|
12
|
-
loading.value = true;
|
|
13
|
-
error.value = null;
|
|
14
|
-
try {
|
|
15
|
-
const nextSignature = await withSolanaTimeout(
|
|
16
|
-
handler(...args),
|
|
17
|
-
options.timeoutMs,
|
|
18
|
-
options.timeoutMessage ?? "Transaction did not return a result before timing out."
|
|
19
|
-
);
|
|
20
|
-
if (currentExecutionId === executionId) {
|
|
21
|
-
signature.value = nextSignature;
|
|
22
|
-
}
|
|
23
|
-
return nextSignature;
|
|
24
|
-
} catch (cause) {
|
|
25
|
-
const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
26
|
-
if (currentExecutionId === executionId) {
|
|
27
|
-
error.value = normalizedError;
|
|
28
|
-
}
|
|
29
|
-
throw normalizedError;
|
|
30
|
-
} finally {
|
|
31
|
-
if (currentExecutionId === executionId) {
|
|
32
|
-
loading.value = false;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
signature,
|
|
38
|
-
loading,
|
|
39
|
-
error,
|
|
40
|
-
execute
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { useTransaction as u };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const errors = require('@vue-solana/core/errors');
|
|
4
|
-
const timeout = require('@vue-solana/core/timeout');
|
|
5
|
-
const vue = require('vue');
|
|
6
|
-
|
|
7
|
-
function useTransaction(handler, options = {}) {
|
|
8
|
-
const signature = vue.ref(null);
|
|
9
|
-
const loading = vue.ref(false);
|
|
10
|
-
const error = vue.ref(null);
|
|
11
|
-
let executionId = 0;
|
|
12
|
-
async function execute(...args) {
|
|
13
|
-
const currentExecutionId = ++executionId;
|
|
14
|
-
loading.value = true;
|
|
15
|
-
error.value = null;
|
|
16
|
-
try {
|
|
17
|
-
const nextSignature = await timeout.withSolanaTimeout(
|
|
18
|
-
handler(...args),
|
|
19
|
-
options.timeoutMs,
|
|
20
|
-
options.timeoutMessage ?? "Transaction did not return a result before timing out."
|
|
21
|
-
);
|
|
22
|
-
if (currentExecutionId === executionId) {
|
|
23
|
-
signature.value = nextSignature;
|
|
24
|
-
}
|
|
25
|
-
return nextSignature;
|
|
26
|
-
} catch (cause) {
|
|
27
|
-
const normalizedError = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
28
|
-
if (currentExecutionId === executionId) {
|
|
29
|
-
error.value = normalizedError;
|
|
30
|
-
}
|
|
31
|
-
throw normalizedError;
|
|
32
|
-
} finally {
|
|
33
|
-
if (currentExecutionId === executionId) {
|
|
34
|
-
loading.value = false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return {
|
|
39
|
-
signature,
|
|
40
|
-
loading,
|
|
41
|
-
error,
|
|
42
|
-
execute
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.useTransaction = useTransaction;
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { parsePublicKey } from '@vue-solana/core/address';
|
|
2
|
-
import { normalizeSolanaError } from '@vue-solana/core/errors';
|
|
3
|
-
import { shallowRef, onMounted, onUnmounted, watch, toValue } from 'vue';
|
|
4
|
-
import { u as useConnection } from './vue.DiNn3XHm.mjs';
|
|
5
|
-
import { t as tryUseSolana } from './vue.CYKT65tB.mjs';
|
|
6
|
-
|
|
7
|
-
function useAccountInfo(address, options = {}) {
|
|
8
|
-
const solana = tryUseSolana();
|
|
9
|
-
const connection = solana?.connection ?? useConnection();
|
|
10
|
-
const accountInfo = shallowRef(null);
|
|
11
|
-
const loading = shallowRef(false);
|
|
12
|
-
const error = shallowRef(null);
|
|
13
|
-
let refreshId = 0;
|
|
14
|
-
let watchId = 0;
|
|
15
|
-
let subscriptionId = null;
|
|
16
|
-
let manuallyStopped = false;
|
|
17
|
-
async function refresh() {
|
|
18
|
-
const requestId = ++refreshId;
|
|
19
|
-
const value = toValue(address);
|
|
20
|
-
if (!value || !solana) {
|
|
21
|
-
accountInfo.value = null;
|
|
22
|
-
loading.value = false;
|
|
23
|
-
error.value = null;
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
loading.value = true;
|
|
27
|
-
error.value = null;
|
|
28
|
-
try {
|
|
29
|
-
const publicKey = parsePublicKey(value);
|
|
30
|
-
if (!publicKey) {
|
|
31
|
-
accountInfo.value = null;
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
const nextAccountInfo = await connection.getAccountInfo(publicKey, options.commitment);
|
|
35
|
-
if (requestId === refreshId) {
|
|
36
|
-
accountInfo.value = nextAccountInfo;
|
|
37
|
-
}
|
|
38
|
-
return nextAccountInfo;
|
|
39
|
-
} catch (cause) {
|
|
40
|
-
const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
41
|
-
if (requestId === refreshId) {
|
|
42
|
-
accountInfo.value = null;
|
|
43
|
-
error.value = normalizedError;
|
|
44
|
-
}
|
|
45
|
-
throw normalizedError;
|
|
46
|
-
} finally {
|
|
47
|
-
if (requestId === refreshId) {
|
|
48
|
-
loading.value = false;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async function stopWatching() {
|
|
53
|
-
manuallyStopped = true;
|
|
54
|
-
watchId += 1;
|
|
55
|
-
await stopCurrentWatcher();
|
|
56
|
-
}
|
|
57
|
-
async function stopCurrentWatcher() {
|
|
58
|
-
if (subscriptionId === null) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const currentSubscriptionId = subscriptionId;
|
|
62
|
-
subscriptionId = null;
|
|
63
|
-
try {
|
|
64
|
-
await connection.removeAccountChangeListener(currentSubscriptionId);
|
|
65
|
-
} catch (cause) {
|
|
66
|
-
error.value = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
async function startWatching() {
|
|
70
|
-
const requestId = ++watchId;
|
|
71
|
-
await stopCurrentWatcher();
|
|
72
|
-
if (requestId !== watchId) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
if (manuallyStopped || !options.watch || !solana) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const publicKey = parsePublicKey(toValue(address));
|
|
80
|
-
if (!publicKey) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const nextSubscriptionId = connection.onAccountChange(
|
|
84
|
-
publicKey,
|
|
85
|
-
(nextAccountInfo) => {
|
|
86
|
-
if (requestId !== watchId) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
accountInfo.value = nextAccountInfo;
|
|
90
|
-
error.value = null;
|
|
91
|
-
},
|
|
92
|
-
options.commitment
|
|
93
|
-
);
|
|
94
|
-
if (requestId !== watchId) {
|
|
95
|
-
await connection.removeAccountChangeListener(nextSubscriptionId);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
subscriptionId = nextSubscriptionId;
|
|
99
|
-
} catch (cause) {
|
|
100
|
-
if (requestId === watchId) {
|
|
101
|
-
error.value = normalizeSolanaError(cause, "RPC_FAILURE");
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
onMounted(() => {
|
|
106
|
-
void refresh().catch(() => void 0);
|
|
107
|
-
void startWatching();
|
|
108
|
-
});
|
|
109
|
-
onUnmounted(() => {
|
|
110
|
-
refreshId += 1;
|
|
111
|
-
void stopWatching();
|
|
112
|
-
});
|
|
113
|
-
watch(
|
|
114
|
-
() => toValue(address),
|
|
115
|
-
() => {
|
|
116
|
-
void refresh().catch(() => void 0);
|
|
117
|
-
void startWatching();
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
return {
|
|
121
|
-
accountInfo,
|
|
122
|
-
loading,
|
|
123
|
-
error,
|
|
124
|
-
refresh,
|
|
125
|
-
stopWatching
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export { useAccountInfo as u };
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const address = require('@vue-solana/core/address');
|
|
4
|
-
const errors = require('@vue-solana/core/errors');
|
|
5
|
-
const vue = require('vue');
|
|
6
|
-
const useConnection = require('./vue.DCgByzxg.cjs');
|
|
7
|
-
const useSolana = require('./vue.BE4KHksm.cjs');
|
|
8
|
-
|
|
9
|
-
function useAccountInfo(address$1, options = {}) {
|
|
10
|
-
const solana = useSolana.tryUseSolana();
|
|
11
|
-
const connection = solana?.connection ?? useConnection.useConnection();
|
|
12
|
-
const accountInfo = vue.shallowRef(null);
|
|
13
|
-
const loading = vue.shallowRef(false);
|
|
14
|
-
const error = vue.shallowRef(null);
|
|
15
|
-
let refreshId = 0;
|
|
16
|
-
let watchId = 0;
|
|
17
|
-
let subscriptionId = null;
|
|
18
|
-
let manuallyStopped = false;
|
|
19
|
-
async function refresh() {
|
|
20
|
-
const requestId = ++refreshId;
|
|
21
|
-
const value = vue.toValue(address$1);
|
|
22
|
-
if (!value || !solana) {
|
|
23
|
-
accountInfo.value = null;
|
|
24
|
-
loading.value = false;
|
|
25
|
-
error.value = null;
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
loading.value = true;
|
|
29
|
-
error.value = null;
|
|
30
|
-
try {
|
|
31
|
-
const publicKey = address.parsePublicKey(value);
|
|
32
|
-
if (!publicKey) {
|
|
33
|
-
accountInfo.value = null;
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const nextAccountInfo = await connection.getAccountInfo(publicKey, options.commitment);
|
|
37
|
-
if (requestId === refreshId) {
|
|
38
|
-
accountInfo.value = nextAccountInfo;
|
|
39
|
-
}
|
|
40
|
-
return nextAccountInfo;
|
|
41
|
-
} catch (cause) {
|
|
42
|
-
const normalizedError = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
43
|
-
if (requestId === refreshId) {
|
|
44
|
-
accountInfo.value = null;
|
|
45
|
-
error.value = normalizedError;
|
|
46
|
-
}
|
|
47
|
-
throw normalizedError;
|
|
48
|
-
} finally {
|
|
49
|
-
if (requestId === refreshId) {
|
|
50
|
-
loading.value = false;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function stopWatching() {
|
|
55
|
-
manuallyStopped = true;
|
|
56
|
-
watchId += 1;
|
|
57
|
-
await stopCurrentWatcher();
|
|
58
|
-
}
|
|
59
|
-
async function stopCurrentWatcher() {
|
|
60
|
-
if (subscriptionId === null) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const currentSubscriptionId = subscriptionId;
|
|
64
|
-
subscriptionId = null;
|
|
65
|
-
try {
|
|
66
|
-
await connection.removeAccountChangeListener(currentSubscriptionId);
|
|
67
|
-
} catch (cause) {
|
|
68
|
-
error.value = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
async function startWatching() {
|
|
72
|
-
const requestId = ++watchId;
|
|
73
|
-
await stopCurrentWatcher();
|
|
74
|
-
if (requestId !== watchId) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
if (manuallyStopped || !options.watch || !solana) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
const publicKey = address.parsePublicKey(vue.toValue(address$1));
|
|
82
|
-
if (!publicKey) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const nextSubscriptionId = connection.onAccountChange(
|
|
86
|
-
publicKey,
|
|
87
|
-
(nextAccountInfo) => {
|
|
88
|
-
if (requestId !== watchId) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
accountInfo.value = nextAccountInfo;
|
|
92
|
-
error.value = null;
|
|
93
|
-
},
|
|
94
|
-
options.commitment
|
|
95
|
-
);
|
|
96
|
-
if (requestId !== watchId) {
|
|
97
|
-
await connection.removeAccountChangeListener(nextSubscriptionId);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
subscriptionId = nextSubscriptionId;
|
|
101
|
-
} catch (cause) {
|
|
102
|
-
if (requestId === watchId) {
|
|
103
|
-
error.value = errors.normalizeSolanaError(cause, "RPC_FAILURE");
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
vue.onMounted(() => {
|
|
108
|
-
void refresh().catch(() => void 0);
|
|
109
|
-
void startWatching();
|
|
110
|
-
});
|
|
111
|
-
vue.onUnmounted(() => {
|
|
112
|
-
refreshId += 1;
|
|
113
|
-
void stopWatching();
|
|
114
|
-
});
|
|
115
|
-
vue.watch(
|
|
116
|
-
() => vue.toValue(address$1),
|
|
117
|
-
() => {
|
|
118
|
-
void refresh().catch(() => void 0);
|
|
119
|
-
void startWatching();
|
|
120
|
-
}
|
|
121
|
-
);
|
|
122
|
-
return {
|
|
123
|
-
accountInfo,
|
|
124
|
-
loading,
|
|
125
|
-
error,
|
|
126
|
-
refresh,
|
|
127
|
-
stopWatching
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
exports.useAccountInfo = useAccountInfo;
|
package/dist/web3.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const web3 = require('@vue-solana/core/web3');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
exports.Connection = web3.Connection;
|
|
8
|
-
exports.Keypair = web3.Keypair;
|
|
9
|
-
exports.PublicKey = web3.PublicKey;
|
|
10
|
-
exports.SystemProgram = web3.SystemProgram;
|
|
11
|
-
exports.Transaction = web3.Transaction;
|
|
12
|
-
exports.TransactionInstruction = web3.TransactionInstruction;
|
|
13
|
-
exports.VersionedTransaction = web3.VersionedTransaction;
|
package/dist/web3.d.cts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@vue-solana/core/web3';
|
package/dist/web3.d.mts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@vue-solana/core/web3';
|
package/dist/web3.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@vue-solana/core/web3';
|
package/dist/web3.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Connection, Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, VersionedTransaction } from '@vue-solana/core/web3';
|