@vue-solana/vue 1.2.0 → 2.0.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 +9 -8
- 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 +19 -17
- package/dist/index.d.cts +4 -8
- package/dist/index.d.mts +4 -8
- package/dist/index.d.ts +4 -8
- package/dist/index.mjs +20 -18
- 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.BtUKvuQw.mjs → vue.3VLZmw05.mjs} +2 -2
- package/dist/shared/{vue.QHAHFnw8.mjs → vue.B2sFJ1xI.mjs} +3 -3
- package/dist/shared/{vue.BEesxsrA.cjs → vue.BAlo-tIh.cjs} +3 -3
- package/dist/shared/vue.BMencBpI.cjs +82 -0
- package/dist/shared/{vue.BbX3ePDY.cjs → vue.B_LRH8SM.cjs} +9 -10
- package/dist/shared/{vue.By1CUlOU.mjs → vue.BaFrF2PF.mjs} +1 -1
- package/dist/shared/{vue.BE4KHksm.cjs → vue.BaR1VPhl.cjs} +0 -1
- package/dist/shared/{vue.CPjEwHSg.mjs → vue.BbMPRDeO.mjs} +20 -8
- package/dist/shared/vue.Bfu1dCKe.mjs +10 -0
- package/dist/shared/{vue.ByUemLSf.cjs → vue.C32ozdA1.cjs} +3 -3
- package/dist/shared/{vue.B14U1xmP.cjs → vue.C7yR7Cs0.cjs} +20 -8
- package/dist/shared/{vue.BsD6AAmO.cjs → vue.CEn2purG.cjs} +8 -8
- package/dist/shared/{vue.C0uCLjJ6.cjs → vue.CP1DPDX9.cjs} +1 -1
- package/dist/shared/{vue.DzKfcfpX.cjs → vue.CSJSK0Nq.cjs} +6 -6
- package/dist/shared/{vue.j1vB3h1n.cjs → vue.CXHYdyKZ.cjs} +9 -9
- package/dist/shared/{vue.CSzg70vB.mjs → vue.CZO8TwJP.mjs} +1 -1
- package/dist/shared/vue.CZwftA0L.cjs +9 -0
- package/dist/shared/vue.ChujsB0B.mjs +7 -0
- package/dist/shared/{vue.CYKT65tB.mjs → vue.CnUlZSe8.mjs} +0 -1
- package/dist/shared/{vue.DFbay4mm.mjs → vue.D7xFeC2m.mjs} +1 -1
- package/dist/shared/{vue.B12Pt1PQ.mjs → vue.DL-yMCNc.mjs} +18 -74
- package/dist/shared/vue.DNxOpDXz.cjs +12 -0
- package/dist/shared/{vue.D0ycWj82.mjs → vue.DP7qY8Rk.mjs} +9 -9
- package/dist/shared/{vue.G9t8pE0J.cjs → vue.DgCmU1RR.cjs} +1 -1
- package/dist/shared/{vue.B2AQR2bE.mjs → vue.PJjEncbP.mjs} +3 -3
- package/dist/shared/{vue.CM_uqVc0.mjs → vue.WugzPOca.mjs} +6 -6
- package/dist/shared/{vue.Bhdhmz8d.cjs → vue.XQFqlMId.cjs} +18 -74
- package/dist/shared/{vue.LNhX07HB.cjs → vue.__r7YYZE.cjs} +2 -2
- package/dist/shared/vue.dPRo2X5y.mjs +80 -0
- package/dist/shared/{vue.COPnX5fq.cjs → vue.k9Q6aN-0.cjs} +1 -1
- package/dist/shared/{vue.DDxhSi72.mjs → vue.stUBDBI9.mjs} +9 -9
- package/dist/shared/{vue.CKTUFwSI.mjs → vue.yQcL1yMv.mjs} +9 -10
- package/dist/useAccountInfo.cjs +6 -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 +6 -5
- package/dist/useBalance.cjs +4 -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 +4 -4
- package/dist/useConnection.cjs +3 -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 +3 -3
- package/dist/useProgramAccounts.cjs +6 -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 +6 -5
- package/dist/useRpc.cjs +2 -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 +2 -2
- package/dist/useSignAndSendTransaction.cjs +6 -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 +6 -6
- package/dist/useSignMessage.cjs +3 -3
- package/dist/useSignMessage.mjs +3 -3
- package/dist/useSignatureStatus.cjs +4 -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 +4 -4
- package/dist/useSolana.cjs +1 -1
- package/dist/useSolana.mjs +1 -1
- package/dist/useSolanaClient.cjs +2 -2
- package/dist/useSolanaClient.mjs +2 -2
- package/dist/useTokenAccounts.cjs +6 -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 +6 -6
- package/dist/useTokenBalance.cjs +6 -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 +6 -6
- package/dist/useTransaction.d.cts +1 -2
- package/dist/useTransaction.d.mts +1 -2
- package/dist/useTransaction.d.ts +1 -2
- package/dist/useTransactionConfirmation.cjs +4 -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 +4 -4
- package/dist/useWallet.cjs +2 -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 +2 -2
- package/dist/useWallets.cjs +2 -2
- package/dist/useWallets.mjs +2 -2
- package/package.json +2 -8
- 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
|
@@ -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';
|