@vue-solana/vue 1.1.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.
Files changed (125) hide show
  1. package/README.md +9 -8
  2. package/dist/buffer-polyfill.d.cts +1 -1
  3. package/dist/buffer-polyfill.d.mts +1 -1
  4. package/dist/buffer-polyfill.d.ts +1 -1
  5. package/dist/index.cjs +24 -16
  6. package/dist/index.d.cts +6 -7
  7. package/dist/index.d.mts +6 -7
  8. package/dist/index.d.ts +6 -7
  9. package/dist/index.mjs +21 -17
  10. package/dist/kit.cjs +9 -0
  11. package/dist/kit.d.cts +1 -0
  12. package/dist/kit.d.mts +1 -0
  13. package/dist/kit.d.ts +1 -0
  14. package/dist/kit.mjs +1 -0
  15. package/dist/shared/{vue.ChnRkpDR.mjs → vue.3VLZmw05.mjs} +2 -2
  16. package/dist/shared/{vue.DaoqgzJC.mjs → vue.B2sFJ1xI.mjs} +3 -3
  17. package/dist/shared/{vue.o-mWY2Yg.cjs → vue.BAlo-tIh.cjs} +3 -3
  18. package/dist/shared/vue.BMencBpI.cjs +82 -0
  19. package/dist/shared/{vue.Diugnf4a.cjs → vue.B_LRH8SM.cjs} +9 -10
  20. package/dist/shared/vue.BaFrF2PF.mjs +8 -0
  21. package/dist/shared/{vue.eNXmiI3a.cjs → vue.BaR1VPhl.cjs} +2 -2
  22. package/dist/shared/{vue.BTN0h5Il.mjs → vue.BbMPRDeO.mjs} +20 -8
  23. package/dist/shared/vue.Bfu1dCKe.mjs +10 -0
  24. package/dist/shared/{vue.CZohWxBN.cjs → vue.C32ozdA1.cjs} +3 -3
  25. package/dist/shared/{vue.BleajB0B.cjs → vue.C7yR7Cs0.cjs} +20 -8
  26. package/dist/shared/{vue.D6U1RFZ0.cjs → vue.CEn2purG.cjs} +8 -8
  27. package/dist/shared/{vue.Dp894nYb.cjs → vue.CP1DPDX9.cjs} +1 -1
  28. package/dist/shared/{vue.CMJANJ4a.cjs → vue.CSJSK0Nq.cjs} +6 -6
  29. package/dist/shared/{vue.BM8Qjk74.cjs → vue.CXHYdyKZ.cjs} +9 -9
  30. package/dist/shared/{vue.vn--SX8d.mjs → vue.CZO8TwJP.mjs} +1 -1
  31. package/dist/shared/vue.CZwftA0L.cjs +9 -0
  32. package/dist/shared/vue.ChujsB0B.mjs +7 -0
  33. package/dist/shared/{vue.DCDTsSjf.mjs → vue.CnUlZSe8.mjs} +2 -2
  34. package/dist/shared/{vue.Cvg6TEXE.mjs → vue.D7xFeC2m.mjs} +1 -1
  35. package/dist/shared/{vue.DZWyk9E_.mjs → vue.DL-yMCNc.mjs} +18 -74
  36. package/dist/shared/vue.DNxOpDXz.cjs +12 -0
  37. package/dist/shared/{vue.BPuN7ieB.mjs → vue.DP7qY8Rk.mjs} +9 -9
  38. package/dist/shared/{vue.D5Kmwcx3.cjs → vue.DgCmU1RR.cjs} +1 -1
  39. package/dist/shared/{vue.B7w1CC4R.mjs → vue.PJjEncbP.mjs} +3 -3
  40. package/dist/shared/{vue.BBNHeOeb.mjs → vue.WugzPOca.mjs} +6 -6
  41. package/dist/shared/{vue.CXNFQf3l.cjs → vue.XQFqlMId.cjs} +18 -74
  42. package/dist/shared/{vue.C5C3l0RQ.cjs → vue.__r7YYZE.cjs} +2 -2
  43. package/dist/shared/vue.dPRo2X5y.mjs +80 -0
  44. package/dist/shared/vue.k9Q6aN-0.cjs +10 -0
  45. package/dist/shared/{vue.DOpWV4b3.mjs → vue.stUBDBI9.mjs} +9 -9
  46. package/dist/shared/{vue.DYCd9oyI.mjs → vue.yQcL1yMv.mjs} +9 -10
  47. package/dist/useAccountInfo.cjs +6 -5
  48. package/dist/useAccountInfo.d.cts +12 -8
  49. package/dist/useAccountInfo.d.mts +12 -8
  50. package/dist/useAccountInfo.d.ts +12 -8
  51. package/dist/useAccountInfo.mjs +6 -5
  52. package/dist/useBalance.cjs +4 -4
  53. package/dist/useBalance.d.cts +4 -2
  54. package/dist/useBalance.d.mts +4 -2
  55. package/dist/useBalance.d.ts +4 -2
  56. package/dist/useBalance.mjs +4 -4
  57. package/dist/useConnection.cjs +3 -3
  58. package/dist/useConnection.d.cts +9 -2
  59. package/dist/useConnection.d.mts +9 -2
  60. package/dist/useConnection.d.ts +9 -2
  61. package/dist/useConnection.mjs +3 -3
  62. package/dist/useProgramAccounts.cjs +6 -5
  63. package/dist/useProgramAccounts.d.cts +24 -9
  64. package/dist/useProgramAccounts.d.mts +24 -9
  65. package/dist/useProgramAccounts.d.ts +24 -9
  66. package/dist/useProgramAccounts.mjs +6 -5
  67. package/dist/useRpc.cjs +2 -2
  68. package/dist/useRpc.d.cts +5 -2
  69. package/dist/useRpc.d.mts +5 -2
  70. package/dist/useRpc.d.ts +5 -2
  71. package/dist/useRpc.mjs +2 -2
  72. package/dist/useSignAndSendTransaction.cjs +6 -6
  73. package/dist/useSignAndSendTransaction.d.cts +18 -24
  74. package/dist/useSignAndSendTransaction.d.mts +18 -24
  75. package/dist/useSignAndSendTransaction.d.ts +18 -24
  76. package/dist/useSignAndSendTransaction.mjs +6 -6
  77. package/dist/useSignMessage.cjs +3 -3
  78. package/dist/useSignMessage.mjs +3 -3
  79. package/dist/useSignatureStatus.cjs +4 -4
  80. package/dist/useSignatureStatus.d.cts +9 -5
  81. package/dist/useSignatureStatus.d.mts +9 -5
  82. package/dist/useSignatureStatus.d.ts +9 -5
  83. package/dist/useSignatureStatus.mjs +4 -4
  84. package/dist/useSolana.cjs +1 -1
  85. package/dist/useSolana.mjs +1 -1
  86. package/dist/useSolanaClient.cjs +9 -0
  87. package/dist/useSolanaClient.d.cts +11 -0
  88. package/dist/useSolanaClient.d.mts +11 -0
  89. package/dist/useSolanaClient.d.ts +11 -0
  90. package/dist/useSolanaClient.mjs +3 -0
  91. package/dist/useTokenAccounts.cjs +6 -6
  92. package/dist/useTokenAccounts.d.cts +6 -6
  93. package/dist/useTokenAccounts.d.mts +6 -6
  94. package/dist/useTokenAccounts.d.ts +6 -6
  95. package/dist/useTokenAccounts.mjs +6 -6
  96. package/dist/useTokenBalance.cjs +6 -6
  97. package/dist/useTokenBalance.d.cts +2 -2
  98. package/dist/useTokenBalance.d.mts +2 -2
  99. package/dist/useTokenBalance.d.ts +2 -2
  100. package/dist/useTokenBalance.mjs +6 -6
  101. package/dist/useTransaction.d.cts +1 -2
  102. package/dist/useTransaction.d.mts +1 -2
  103. package/dist/useTransaction.d.ts +1 -2
  104. package/dist/useTransactionConfirmation.cjs +4 -4
  105. package/dist/useTransactionConfirmation.d.cts +18 -24
  106. package/dist/useTransactionConfirmation.d.mts +18 -24
  107. package/dist/useTransactionConfirmation.d.ts +18 -24
  108. package/dist/useTransactionConfirmation.mjs +4 -4
  109. package/dist/useWallet.cjs +2 -2
  110. package/dist/useWallet.d.cts +2 -2
  111. package/dist/useWallet.d.mts +2 -2
  112. package/dist/useWallet.d.ts +2 -2
  113. package/dist/useWallet.mjs +2 -2
  114. package/dist/useWallets.cjs +2 -2
  115. package/dist/useWallets.mjs +2 -2
  116. package/package.json +11 -7
  117. package/dist/shared/vue.Bii4W61L.cjs +0 -9
  118. package/dist/shared/vue.CKXhlRu-.cjs +0 -131
  119. package/dist/shared/vue.CKx4lRew.mjs +0 -7
  120. package/dist/shared/vue.DgPfVZnU.mjs +0 -129
  121. package/dist/web3.cjs +0 -13
  122. package/dist/web3.d.cts +0 -1
  123. package/dist/web3.d.mts +0 -1
  124. package/dist/web3.d.ts +0 -1
  125. package/dist/web3.mjs +0 -1
@@ -1,10 +1,10 @@
1
- import * as _solana_web3_compat from '@solana/web3-compat';
1
+ import * as _solana_kit from '@solana/kit';
2
2
  import * as vue from 'vue';
3
3
  import * as _vue_solana_core_types from '@vue-solana/core/types';
4
4
 
5
5
  declare function useWallet(): {
6
6
  wallet: vue.Ref<_vue_solana_core_types.SolanaWallet | null, _vue_solana_core_types.SolanaWallet | null>;
7
- publicKey: vue.ComputedRef<_solana_web3_compat.PublicKey | null>;
7
+ publicKey: vue.ComputedRef<_solana_kit.Address | null>;
8
8
  connected: vue.ComputedRef<boolean>;
9
9
  connecting: vue.ComputedRef<boolean>;
10
10
  disconnecting: vue.ComputedRef<boolean>;
@@ -1,10 +1,10 @@
1
- import * as _solana_web3_compat from '@solana/web3-compat';
1
+ import * as _solana_kit from '@solana/kit';
2
2
  import * as vue from 'vue';
3
3
  import * as _vue_solana_core_types from '@vue-solana/core/types';
4
4
 
5
5
  declare function useWallet(): {
6
6
  wallet: vue.Ref<_vue_solana_core_types.SolanaWallet | null, _vue_solana_core_types.SolanaWallet | null>;
7
- publicKey: vue.ComputedRef<_solana_web3_compat.PublicKey | null>;
7
+ publicKey: vue.ComputedRef<_solana_kit.Address | null>;
8
8
  connected: vue.ComputedRef<boolean>;
9
9
  connecting: vue.ComputedRef<boolean>;
10
10
  disconnecting: vue.ComputedRef<boolean>;
@@ -1,5 +1,5 @@
1
- export { u as useWallet } from './shared/vue.B7w1CC4R.mjs';
1
+ export { u as useWallet } from './shared/vue.PJjEncbP.mjs';
2
2
  import '@vue-solana/core/errors';
3
3
  import '@vue-solana/core/wallet';
4
4
  import 'vue';
5
- import './shared/vue.DCDTsSjf.mjs';
5
+ import './shared/vue.CnUlZSe8.mjs';
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- const useWallets = require('./shared/vue.D5Kmwcx3.cjs');
4
- require('./shared/vue.eNXmiI3a.cjs');
3
+ const useWallets = require('./shared/vue.DgCmU1RR.cjs');
4
+ require('./shared/vue.BaR1VPhl.cjs');
5
5
  require('vue');
6
6
 
7
7
 
@@ -1,3 +1,3 @@
1
- export { u as useWallets } from './shared/vue.Cvg6TEXE.mjs';
2
- import './shared/vue.DCDTsSjf.mjs';
1
+ export { u as useWallets } from './shared/vue.D7xFeC2m.mjs';
2
+ import './shared/vue.CnUlZSe8.mjs';
3
3
  import 'vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -40,6 +40,11 @@
40
40
  "import": "./dist/useSolana.mjs",
41
41
  "require": "./dist/useSolana.cjs"
42
42
  },
43
+ "./useSolanaClient": {
44
+ "types": "./dist/useSolanaClient.d.ts",
45
+ "import": "./dist/useSolanaClient.mjs",
46
+ "require": "./dist/useSolanaClient.cjs"
47
+ },
43
48
  "./useRpc": {
44
49
  "types": "./dist/useRpc.d.ts",
45
50
  "import": "./dist/useRpc.mjs",
@@ -110,10 +115,10 @@
110
115
  "import": "./dist/useTokenAccounts.mjs",
111
116
  "require": "./dist/useTokenAccounts.cjs"
112
117
  },
113
- "./web3": {
114
- "types": "./dist/web3.d.ts",
115
- "import": "./dist/web3.mjs",
116
- "require": "./dist/web3.cjs"
118
+ "./kit": {
119
+ "types": "./dist/kit.d.ts",
120
+ "import": "./dist/kit.mjs",
121
+ "require": "./dist/kit.cjs"
117
122
  }
118
123
  },
119
124
  "files": [
@@ -123,9 +128,8 @@
123
128
  "access": "public"
124
129
  },
125
130
  "dependencies": {
126
- "@solana/web3-compat": "^0.0.21",
127
131
  "bs58": "^6.0.0",
128
- "@vue-solana/core": "1.1.0"
132
+ "@vue-solana/core": "2.0.0"
129
133
  },
130
134
  "peerDependencies": {
131
135
  "vue": "^3.5.0"
@@ -1,9 +0,0 @@
1
- 'use strict';
2
-
3
- const useRpc = require('./vue.C5C3l0RQ.cjs');
4
-
5
- function useConnection() {
6
- return useRpc.useRpc().connection;
7
- }
8
-
9
- exports.useConnection = useConnection;
@@ -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.Bii4W61L.cjs');
7
- const useSolana = require('./vue.eNXmiI3a.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;
@@ -1,7 +0,0 @@
1
- import { u as useRpc } from './vue.ChnRkpDR.mjs';
2
-
3
- function useConnection() {
4
- return useRpc().connection;
5
- }
6
-
7
- export { useConnection as u };
@@ -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.CKx4lRew.mjs';
5
- import { t as tryUseSolana } from './vue.DCDTsSjf.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 };
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';