@vue-solana/vue 2.6.1 → 3.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 (188) hide show
  1. package/README.md +6 -4
  2. package/dist/index.d.mts +3 -1
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.mjs +36 -47
  5. package/dist/shared/vue.1Qwco2kv.mjs +33 -0
  6. package/dist/shared/vue.BFSboXMB.mjs +17 -0
  7. package/dist/shared/vue.BGGixph-.d.mts +5 -0
  8. package/dist/shared/vue.BGGixph-.d.ts +5 -0
  9. package/dist/shared/{vue.CbJFnho-.mjs → vue.BNJTXSnQ.mjs} +17 -70
  10. package/dist/shared/{vue.BINkrA8h.mjs → vue.BwBqla_n.mjs} +16 -26
  11. package/dist/shared/vue.BxtOHzY_.mjs +27 -0
  12. package/dist/shared/vue.C1JbUTpJ.mjs +66 -0
  13. package/dist/shared/vue.C9OOmvkD.mjs +36 -0
  14. package/dist/shared/vue.CGv0ip3w.mjs +52 -0
  15. package/dist/shared/vue.CaAgH2Xt.mjs +51 -0
  16. package/dist/shared/{vue.Dyi1OCI1.mjs → vue.CjSw0Hh1.mjs} +3 -9
  17. package/dist/shared/vue.CsFY1mfz.mjs +29 -0
  18. package/dist/shared/vue.CvenSbZZ.mjs +27 -0
  19. package/dist/shared/{vue.BDNOyiGZ.mjs → vue.D5pqR5Fa.mjs} +9 -12
  20. package/dist/shared/vue.DNKD6jqM.mjs +22 -0
  21. package/dist/shared/vue.DlihC5GG.mjs +38 -0
  22. package/dist/shared/vue.XlfH_nkc.mjs +32 -0
  23. package/dist/shared/vue.hG_FieA3.mjs +37 -0
  24. package/dist/shared/vue.o98pAmDg.mjs +40 -0
  25. package/dist/swr.mjs +22 -76
  26. package/dist/useAccountInfo.d.mts +4 -4
  27. package/dist/useAccountInfo.d.ts +4 -4
  28. package/dist/useAccountInfo.mjs +5 -4
  29. package/dist/useBalance.d.mts +4 -4
  30. package/dist/useBalance.d.ts +4 -4
  31. package/dist/useBalance.mjs +5 -4
  32. package/dist/usePlanTransaction.d.mts +12 -13
  33. package/dist/usePlanTransaction.d.ts +12 -13
  34. package/dist/usePlanTransaction.mjs +2 -1
  35. package/dist/usePlanTransactions.d.mts +2 -1
  36. package/dist/usePlanTransactions.d.ts +2 -1
  37. package/dist/usePlanTransactions.mjs +2 -1
  38. package/dist/useProgramAccounts.d.mts +5 -15
  39. package/dist/useProgramAccounts.d.ts +5 -15
  40. package/dist/useProgramAccounts.mjs +5 -4
  41. package/dist/useSendTransaction.d.mts +11 -12
  42. package/dist/useSendTransaction.d.ts +11 -12
  43. package/dist/useSendTransaction.mjs +2 -1
  44. package/dist/useSendTransactions.d.mts +2 -1
  45. package/dist/useSendTransactions.d.ts +2 -1
  46. package/dist/useSendTransactions.mjs +2 -1
  47. package/dist/useSignAndSendTransaction.d.mts +1 -1
  48. package/dist/useSignAndSendTransaction.d.ts +1 -1
  49. package/dist/useSignAndSendTransaction.mjs +3 -2
  50. package/dist/useSignAndSendTransactions.d.mts +2 -2
  51. package/dist/useSignAndSendTransactions.d.ts +2 -2
  52. package/dist/useSignAndSendTransactions.mjs +2 -1
  53. package/dist/useSignIn.d.mts +4 -4
  54. package/dist/useSignIn.d.ts +4 -4
  55. package/dist/useSignIn.mjs +3 -2
  56. package/dist/useSignMessage.d.mts +4 -4
  57. package/dist/useSignMessage.d.ts +4 -4
  58. package/dist/useSignMessage.mjs +3 -2
  59. package/dist/useSignTransactions.d.mts +4 -4
  60. package/dist/useSignTransactions.d.ts +4 -4
  61. package/dist/useSignTransactions.mjs +3 -2
  62. package/dist/useSubscription.mjs +1 -1
  63. package/dist/useTokenAccounts.d.mts +4 -4
  64. package/dist/useTokenAccounts.d.ts +4 -4
  65. package/dist/useTokenAccounts.mjs +5 -4
  66. package/dist/useTokenBalance.d.mts +9 -7
  67. package/dist/useTokenBalance.d.ts +9 -7
  68. package/dist/useTokenBalance.mjs +4 -3
  69. package/dist/useTrackedData.mjs +1 -1
  70. package/dist/useTransactionConfirmation.d.mts +4 -4
  71. package/dist/useTransactionConfirmation.d.ts +4 -4
  72. package/dist/useTransactionConfirmation.mjs +3 -2
  73. package/package.json +38 -75
  74. package/dist/buffer-polyfill.cjs +0 -8
  75. package/dist/buffer-polyfill.d.cts +0 -2
  76. package/dist/index.cjs +0 -452
  77. package/dist/index.d.cts +0 -62
  78. package/dist/kit.cjs +0 -16
  79. package/dist/kit.d.cts +0 -1
  80. package/dist/shared/vue.4C5kX4fE.cjs +0 -36
  81. package/dist/shared/vue.9TPxZPMf.cjs +0 -59
  82. package/dist/shared/vue.B4eMoJT2.cjs +0 -36
  83. package/dist/shared/vue.B6ainw2G.cjs +0 -63
  84. package/dist/shared/vue.BD6Gm1nl.mjs +0 -74
  85. package/dist/shared/vue.BGxz4dru.cjs +0 -98
  86. package/dist/shared/vue.BIxphCAq.cjs +0 -10
  87. package/dist/shared/vue.BOpgWr43.mjs +0 -70
  88. package/dist/shared/vue.BQRpjwKl.mjs +0 -80
  89. package/dist/shared/vue.BVaMoz9y.cjs +0 -9
  90. package/dist/shared/vue.Bk5xjlUx.cjs +0 -61
  91. package/dist/shared/vue.Bwd1sGAM.cjs +0 -72
  92. package/dist/shared/vue.ByxbBC3y.mjs +0 -57
  93. package/dist/shared/vue.C13umiQi.mjs +0 -85
  94. package/dist/shared/vue.CIs8QhCw.cjs +0 -132
  95. package/dist/shared/vue.CMohL_Cz.mjs +0 -58
  96. package/dist/shared/vue.CWZSMVnB.cjs +0 -84
  97. package/dist/shared/vue.Co5rj-I6.mjs +0 -118
  98. package/dist/shared/vue.CoaIWGPT.cjs +0 -38
  99. package/dist/shared/vue.CrkK_T15.cjs +0 -86
  100. package/dist/shared/vue.D-qi8PSL.cjs +0 -82
  101. package/dist/shared/vue.D3Y0PWbF.mjs +0 -71
  102. package/dist/shared/vue.D5U1yLG3.mjs +0 -83
  103. package/dist/shared/vue.DAg5wC1G.cjs +0 -76
  104. package/dist/shared/vue.DAthhH4D.mjs +0 -118
  105. package/dist/shared/vue.DDbVk0Zh.cjs +0 -180
  106. package/dist/shared/vue.DE3emjSF.cjs +0 -48
  107. package/dist/shared/vue.DEHxNvUX.cjs +0 -7
  108. package/dist/shared/vue.DFaMJLAQ.cjs +0 -60
  109. package/dist/shared/vue.DKoM8jIV.cjs +0 -121
  110. package/dist/shared/vue.DKyQ7J67.cjs +0 -15
  111. package/dist/shared/vue.DL3z5PxP.d.cts +0 -21
  112. package/dist/shared/vue.DNxOpDXz.cjs +0 -12
  113. package/dist/shared/vue.Di7yjJ-R.cjs +0 -87
  114. package/dist/shared/vue.Dn3KLJZH.cjs +0 -121
  115. package/dist/shared/vue.DxM45azl.cjs +0 -173
  116. package/dist/shared/vue.E_npPFoV.cjs +0 -67
  117. package/dist/shared/vue.FiMmnMHr.cjs +0 -20
  118. package/dist/shared/vue.JUWqu6kD.mjs +0 -61
  119. package/dist/shared/vue.Sbbm9JSu.cjs +0 -74
  120. package/dist/shared/vue.ZuUCEEab.cjs +0 -103
  121. package/dist/shared/vue.l3UCdN7z.cjs +0 -111
  122. package/dist/shared/vue.ldvmk9NM.cjs +0 -45
  123. package/dist/swr.cjs +0 -136
  124. package/dist/swr.d.cts +0 -41
  125. package/dist/useAccountInfo.cjs +0 -15
  126. package/dist/useAccountInfo.d.cts +0 -24
  127. package/dist/useAction.cjs +0 -9
  128. package/dist/useAction.d.cts +0 -45
  129. package/dist/useAirdrop.cjs +0 -14
  130. package/dist/useAirdrop.d.cts +0 -27
  131. package/dist/useBalance.cjs +0 -14
  132. package/dist/useBalance.d.cts +0 -15
  133. package/dist/useClientCapability.cjs +0 -12
  134. package/dist/useClientCapability.d.cts +0 -39
  135. package/dist/useConnection.cjs +0 -11
  136. package/dist/useConnection.d.cts +0 -46
  137. package/dist/useIdentity.cjs +0 -12
  138. package/dist/useIdentity.d.cts +0 -3
  139. package/dist/usePayer.cjs +0 -13
  140. package/dist/usePayer.d.cts +0 -18
  141. package/dist/usePlanTransaction.cjs +0 -14
  142. package/dist/usePlanTransaction.d.cts +0 -45
  143. package/dist/usePlanTransactions.cjs +0 -13
  144. package/dist/usePlanTransactions.d.cts +0 -4
  145. package/dist/useProgramAccounts.cjs +0 -15
  146. package/dist/useProgramAccounts.d.cts +0 -55
  147. package/dist/useRequest.cjs +0 -11
  148. package/dist/useRequest.d.cts +0 -73
  149. package/dist/useRpc.cjs +0 -10
  150. package/dist/useRpc.d.cts +0 -55
  151. package/dist/useSelectedWalletAccount.cjs +0 -13
  152. package/dist/useSelectedWalletAccount.d.cts +0 -117
  153. package/dist/useSendTransaction.cjs +0 -14
  154. package/dist/useSendTransaction.d.cts +0 -51
  155. package/dist/useSendTransactions.cjs +0 -13
  156. package/dist/useSendTransactions.d.cts +0 -4
  157. package/dist/useSignAndSendTransaction.cjs +0 -18
  158. package/dist/useSignAndSendTransaction.d.cts +0 -40
  159. package/dist/useSignAndSendTransactions.cjs +0 -15
  160. package/dist/useSignAndSendTransactions.d.cts +0 -35
  161. package/dist/useSignIn.cjs +0 -13
  162. package/dist/useSignIn.d.cts +0 -23
  163. package/dist/useSignMessage.cjs +0 -13
  164. package/dist/useSignMessage.d.cts +0 -236
  165. package/dist/useSignTransactions.cjs +0 -13
  166. package/dist/useSignTransactions.d.cts +0 -24
  167. package/dist/useSignatureStatus.cjs +0 -14
  168. package/dist/useSignatureStatus.d.cts +0 -26
  169. package/dist/useSolana.cjs +0 -10
  170. package/dist/useSolana.d.cts +0 -9
  171. package/dist/useSolanaClient.cjs +0 -10
  172. package/dist/useSolanaClient.d.cts +0 -45
  173. package/dist/useSubscription.cjs +0 -9
  174. package/dist/useSubscription.d.cts +0 -70
  175. package/dist/useTokenAccounts.cjs +0 -15
  176. package/dist/useTokenAccounts.d.cts +0 -19
  177. package/dist/useTokenBalance.cjs +0 -15
  178. package/dist/useTokenBalance.d.cts +0 -15
  179. package/dist/useTrackedData.cjs +0 -10
  180. package/dist/useTrackedData.d.cts +0 -98
  181. package/dist/useTransaction.cjs +0 -11
  182. package/dist/useTransaction.d.cts +0 -27
  183. package/dist/useTransactionConfirmation.cjs +0 -15
  184. package/dist/useTransactionConfirmation.d.cts +0 -38
  185. package/dist/useWallet.cjs +0 -12
  186. package/dist/useWallet.d.cts +0 -31
  187. package/dist/useWallets.cjs +0 -10
  188. package/dist/useWallets.d.cts +0 -11
package/README.md CHANGED
@@ -55,6 +55,8 @@ pnpm add @vue-solana/vue
55
55
  npm install @vue-solana/vue
56
56
  ```
57
57
 
58
+ Since v3.0.0 this package is ESM only. There is no `require` export condition and no top-level `main`, so `require("@vue-solana/vue")` fails with `No "exports" main defined`. Vite apps are unaffected; pin to `@vue-solana/vue@^2` if you must stay on CommonJS.
59
+
58
60
  ## Plugin Setup
59
61
 
60
62
  ```ts
@@ -196,7 +198,7 @@ const { balance, loading, error, refresh } = useBalance(address);
196
198
  `useAirdrop()` sends SOL to an account on devnet, testnet, or a local validator. The default Vue client includes the RPC and airdrop capabilities; a custom client can install them with `createClient().use(solanaRpc({ ... })).use(rpcAirdrop())` from `@solana/kit-plugin-rpc`.
197
199
 
198
200
  ```ts
199
- import { lamports } from "@solana/kit";
201
+ import { lamports } from "@vue-solana/vue/kit";
200
202
  import { useAirdrop } from "@vue-solana/vue/useAirdrop";
201
203
 
202
204
  const { data, status, error, dispatch } = useAirdrop();
@@ -344,10 +346,10 @@ await confirmation.confirm(signature);
344
346
 
345
347
  ### Wallet Request Inputs and Returns
346
348
 
347
- Wallet signing flows accept transaction input as raw `Uint8Array` wire bytes that conform to the Solana transaction schema. Build them with `@solana/kit` (or decode them from a base64/base58 RPC response); base64 strings, transaction objects, and instruction lists are not accepted here.
349
+ Wallet signing flows accept transaction input as raw `Uint8Array` wire bytes that conform to the Solana transaction schema. Build them with the Kit helpers from `@vue-solana/vue/kit` (or decode them from a base64/base58 RPC response); base64 strings, transaction objects, and instruction lists are not accepted here.
348
350
 
349
351
  ```ts
350
- import { compileTransaction, getTransactionEncoder } from "@solana/kit";
352
+ import { compileTransaction, getTransactionEncoder } from "@vue-solana/vue/kit";
351
353
 
352
354
  const transaction: Uint8Array = getTransactionEncoder().encode(compileTransaction(message));
353
355
  await execute(transaction);
@@ -673,7 +675,7 @@ Other direct subpaths:
673
675
  - Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.
674
676
  - Broad `useProgramAccounts()` scans can be expensive or blocked on public RPC nodes. Prefer narrow filters and `dataSlice`.
675
677
  - Use `mainnet` for Solana mainnet. This is Solana's official mainnet cluster name; the legacy `mainnet-beta` spelling is still accepted and redirects to the same endpoint.
676
- - v2.0.0 removed `@solana/web3-compat` and the `web3` subpaths. Build transaction messages with `@solana/kit` and pass raw `Uint8Array` wire bytes to wallet flows. See the [Kit Migration guide](https://vue-solana-docs.vercel.app/guides/kit-migration) for migrating from v1.
678
+ - v2.0.0 removed `@solana/web3-compat` and the `web3` subpaths. Build transaction messages with `@vue-solana/vue/kit` and pass raw `Uint8Array` wire bytes to wallet flows. See the [Kit Migration guide](https://vue-solana-docs.vercel.app/guides/kit-migration) for migrating from v1.
677
679
  - Desktop native app wallets are planned but not implemented yet.
678
680
 
679
681
  ## Status
package/dist/index.d.mts CHANGED
@@ -33,11 +33,13 @@ import { GetSolanaIosWalletsOptions } from '@vue-solana/core/ios-wallet';
33
33
  import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
34
34
  import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
35
35
  export * from '@vue-solana/core/types';
36
+ export { TransactionStatus } from '@vue-solana/core/types';
36
37
  import { App } from 'vue';
38
+ export { SolanaError, SolanaErrorCode, isSolanaError } from '@vue-solana/core/errors';
37
39
  export * from '@vue-solana/core/kit';
38
- import '@vue-solana/core/errors';
39
40
  import '@solana/kit-plugin-rpc';
40
41
  import '@solana/kit';
42
+ import './shared/vue.BGGixph-.mjs';
41
43
  import '@vue-solana/core/token-accounts';
42
44
 
43
45
  interface VueSolanaPluginOptions extends SolanaConfig {
package/dist/index.d.ts CHANGED
@@ -33,11 +33,13 @@ import { GetSolanaIosWalletsOptions } from '@vue-solana/core/ios-wallet';
33
33
  import { RegisterSolanaMobileWalletOptions } from '@vue-solana/core/mobile-wallet';
34
34
  import { SolanaConfig, SolanaWallet } from '@vue-solana/core/types';
35
35
  export * from '@vue-solana/core/types';
36
+ export { TransactionStatus } from '@vue-solana/core/types';
36
37
  import { App } from 'vue';
38
+ export { SolanaError, SolanaErrorCode, isSolanaError } from '@vue-solana/core/errors';
37
39
  export * from '@vue-solana/core/kit';
38
- import '@vue-solana/core/errors';
39
40
  import '@solana/kit-plugin-rpc';
40
41
  import '@solana/kit';
42
+ import './shared/vue.BGGixph-.js';
41
43
  import '@vue-solana/core/token-accounts';
42
44
 
43
45
  interface VueSolanaPluginOptions extends SolanaConfig {
package/dist/index.mjs CHANGED
@@ -1,34 +1,35 @@
1
- export { u as useAccountInfo } from './shared/vue.BQRpjwKl.mjs';
1
+ export { u as useAccountInfo } from './shared/vue.CvenSbZZ.mjs';
2
2
  export { u as useAction } from './shared/vue.DYk0Xfr3.mjs';
3
3
  export { u as useAirdrop } from './shared/vue.DDQxNX5q.mjs';
4
- export { u as useBalance } from './shared/vue.BINkrA8h.mjs';
4
+ export { u as useBalance } from './shared/vue.BFSboXMB.mjs';
5
5
  export { M as MissingClientCapabilityError, u as useClientCapability } from './shared/vue.B9uRpSDJ.mjs';
6
6
  export { u as useConnection } from './shared/vue.CpkwC8Th.mjs';
7
- export { u as usePlanTransaction, a as usePlanTransactions } from './shared/vue.Co5rj-I6.mjs';
8
- export { u as useProgramAccounts } from './shared/vue.C13umiQi.mjs';
7
+ export { u as usePlanTransaction, a as usePlanTransactions } from './shared/vue.CsFY1mfz.mjs';
8
+ export { u as useProgramAccounts } from './shared/vue.1Qwco2kv.mjs';
9
9
  export { u as useIdentity, a as usePayer } from './shared/vue.B-xtuLtD.mjs';
10
10
  export { u as useRequest } from './shared/vue.B8VvC8d2.mjs';
11
11
  export { u as useRpc } from './shared/vue.BsGwt78R.mjs';
12
12
  export { S as SelectedWalletAccountProvider, c as createSelectedWalletAccountContext, p as provideSelectedWalletAccount, s as selectedWalletAccountInjectionKey, u as useSelectedWalletAccount } from './shared/vue.BngCaeXJ.mjs';
13
- export { u as useSendTransaction, a as useSendTransactions } from './shared/vue.DAthhH4D.mjs';
14
- export { u as useSignMessage } from './shared/vue.JUWqu6kD.mjs';
15
- export { u as useSignAndSendTransaction } from './shared/vue.Dyi1OCI1.mjs';
16
- export { u as useSignTransactions } from './shared/vue.CMohL_Cz.mjs';
17
- export { P as PartialSignAndSendError, u as useSignAndSendTransactions } from './shared/vue.D5U1yLG3.mjs';
13
+ export { u as useSendTransaction, a as useSendTransactions } from './shared/vue.BxtOHzY_.mjs';
14
+ export { u as useSignMessage } from './shared/vue.o98pAmDg.mjs';
15
+ export { u as useSignAndSendTransaction } from './shared/vue.CjSw0Hh1.mjs';
16
+ export { u as useSignTransactions } from './shared/vue.hG_FieA3.mjs';
17
+ export { P as PartialSignAndSendError, u as useSignAndSendTransactions } from './shared/vue.C1JbUTpJ.mjs';
18
18
  export { u as useSignatureStatus } from './shared/vue.CXB4NEMA.mjs';
19
- export { u as useSignIn } from './shared/vue.ByxbBC3y.mjs';
19
+ export { u as useSignIn } from './shared/vue.C9OOmvkD.mjs';
20
20
  export { t as tryUseSolana, u as useSolana } from './shared/vue.CQh3AUE8.mjs';
21
21
  export { u as useSolanaClient } from './shared/vue.Mxc8w6Qk.mjs';
22
- export { u as useSubscription } from './shared/vue.BDNOyiGZ.mjs';
23
- export { u as useTokenAccounts } from './shared/vue.BOpgWr43.mjs';
24
- export { u as useTokenBalance } from './shared/vue.BD6Gm1nl.mjs';
25
- export { u as useTrackedData } from './shared/vue.CbJFnho-.mjs';
22
+ export { u as useSubscription } from './shared/vue.D5pqR5Fa.mjs';
23
+ export { u as useTokenAccounts } from './shared/vue.DNKD6jqM.mjs';
24
+ export { u as useTokenBalance } from './shared/vue.XlfH_nkc.mjs';
25
+ export { u as useTrackedData } from './shared/vue.BNJTXSnQ.mjs';
26
26
  export { u as useTransaction } from './shared/vue.5euWd6-V.mjs';
27
- export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.D3Y0PWbF.mjs';
27
+ export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.CaAgH2Xt.mjs';
28
28
  export { u as useWallet } from './shared/vue.D218Ow7t.mjs';
29
29
  export { u as useWallets } from './shared/vue.C_4qJDiF.mjs';
30
30
  import { s as solanaInjectionKey } from './shared/vue.D_P5SqqD.mjs';
31
31
  import { createSolanaError, normalizeSolanaError } from '@vue-solana/core/errors';
32
+ export { SolanaError, isSolanaError } from '@vue-solana/core/errors';
32
33
  import { createSolanaContext } from '@vue-solana/core/rpc';
33
34
  import { withTimeout } from '@vue-solana/core/timeout';
34
35
  import { getRegisteredSolanaWallets, getSolanaChain, adaptSolanaStandardWallet, subscribeSolanaWallets } from '@vue-solana/core/wallet-standard';
@@ -36,10 +37,13 @@ import { shallowRef, ref, triggerRef } from 'vue';
36
37
  import { handleSolanaIosWalletCallback, getSolanaIosWallets, isSolanaIosWalletInfo, adaptSolanaIosWallet } from '@vue-solana/core/ios-wallet';
37
38
  export * from '@vue-solana/core/types';
38
39
  export * from '@vue-solana/core/kit';
40
+ import './shared/vue.BwBqla_n.mjs';
39
41
  import '@vue-solana/core/address';
40
42
  import './shared/vue.Bfu1dCKe.mjs';
41
43
  import '@vue-solana/core/action';
44
+ import './shared/vue.CGv0ip3w.mjs';
42
45
  import '@vue-solana/core/wallet';
46
+ import './shared/vue.DlihC5GG.mjs';
43
47
  import '@vue-solana/core/transaction';
44
48
  import 'bs58';
45
49
  import '@vue-solana/core/token-accounts';
@@ -142,38 +146,23 @@ function createSolanaWalletRegistry(options) {
142
146
  chain: getSolanaChain(options.cluster),
143
147
  onChange: options.onWalletChange
144
148
  });
145
- const cachedAdapter = {
146
- platform: walletInfo.platform,
147
- source: walletInfo.source,
148
- get publicKey() {
149
- return adaptedWallet.publicKey;
150
- },
151
- get connected() {
152
- return adaptedWallet.connected;
153
- },
154
- get connecting() {
155
- return adaptedWallet.connecting;
156
- },
157
- get disconnecting() {
158
- return adaptedWallet.disconnecting;
159
- },
160
- async connect() {
161
- await adaptedWallet.connect();
162
- await Promise.all(
163
- Array.from(getCachedWallets()).map(
164
- (otherWallet) => otherWallet !== cachedAdapter && otherWallet.connected ? otherWallet.disconnect() : void 0
165
- )
166
- );
167
- },
168
- disconnect: () => adaptedWallet.disconnect(),
169
- signMessage: adaptedWallet.signMessage?.bind(adaptedWallet),
170
- signTransaction: adaptedWallet.signTransaction?.bind(adaptedWallet),
171
- signAllTransactions: adaptedWallet.signAllTransactions?.bind(adaptedWallet),
172
- signAndSendTransaction: adaptedWallet.signAndSendTransaction?.bind(adaptedWallet),
173
- signIn: adaptedWallet.signIn?.bind(adaptedWallet),
174
- signTransactions: adaptedWallet.signTransactions?.bind(adaptedWallet),
175
- signAndSendTransactions: adaptedWallet.signAndSendTransactions?.bind(adaptedWallet)
176
- };
149
+ const cachedAdapter = new Proxy(adaptedWallet, {
150
+ get(target, property) {
151
+ if (property === "connect") {
152
+ return connectAndDisconnectOthers;
153
+ }
154
+ const value = Reflect.get(target, property);
155
+ return typeof value === "function" ? value.bind(target) : value;
156
+ }
157
+ });
158
+ async function connectAndDisconnectOthers() {
159
+ await adaptedWallet.connect();
160
+ await Promise.all(
161
+ Array.from(getCachedWallets()).map(
162
+ (otherWallet) => otherWallet !== cachedAdapter && otherWallet.connected ? otherWallet.disconnect() : void 0
163
+ )
164
+ );
165
+ }
177
166
  adaptedWallets.set(walletInfo.wallet, cachedAdapter);
178
167
  return cachedAdapter;
179
168
  }
@@ -0,0 +1,33 @@
1
+ import { u as useConnection } from './vue.CpkwC8Th.mjs';
2
+ import { u as useAddressRead } from './vue.BwBqla_n.mjs';
3
+ import { t as tryUseSolana } from './vue.CQh3AUE8.mjs';
4
+ import { d as decodeBase64 } from './vue.Bfu1dCKe.mjs';
5
+
6
+ function useProgramAccounts(programId, options = {}) {
7
+ const empty = [];
8
+ const solana = tryUseSolana();
9
+ const client = solana?.client ?? useConnection();
10
+ const { data: accounts, ...rest } = useAddressRead(
11
+ [programId],
12
+ async (key) => (await client.rpc.getProgramAccounts(key, {
13
+ encoding: "base64",
14
+ commitment: options.commitment,
15
+ dataSlice: options.dataSlice,
16
+ filters: options.filters
17
+ }).send()).value,
18
+ (response) => response.map(({ pubkey, account }) => ({
19
+ pubkey,
20
+ account: {
21
+ executable: account.executable,
22
+ lamports: Number(account.lamports),
23
+ owner: account.owner,
24
+ space: Number(account.space),
25
+ data: decodeBase64(account.data[0])
26
+ }
27
+ })),
28
+ empty
29
+ );
30
+ return { accounts, ...rest };
31
+ }
32
+
33
+ export { useProgramAccounts as u };
@@ -0,0 +1,17 @@
1
+ import { u as useConnection } from './vue.CpkwC8Th.mjs';
2
+ import { u as useAddressRead } from './vue.BwBqla_n.mjs';
3
+ import { t as tryUseSolana } from './vue.CQh3AUE8.mjs';
4
+
5
+ function useBalance(address, commitment) {
6
+ const solana = tryUseSolana();
7
+ const client = solana?.client ?? useConnection();
8
+ const { data: balance, ...rest } = useAddressRead(
9
+ [address],
10
+ async (key) => (await client.rpc.getBalance(key, commitment ? { commitment } : void 0).send()).value,
11
+ Number,
12
+ null
13
+ );
14
+ return { balance, ...rest };
15
+ }
16
+
17
+ export { useBalance as u };
@@ -0,0 +1,5 @@
1
+ interface ClientActionConfig {
2
+ abortSignal?: AbortSignal;
3
+ }
4
+
5
+ export type { ClientActionConfig as C };
@@ -0,0 +1,5 @@
1
+ interface ClientActionConfig {
2
+ abortSignal?: AbortSignal;
3
+ }
4
+
5
+ export type { ClientActionConfig as C };
@@ -1,4 +1,4 @@
1
- import { createReactiveStoreWithInitialValueAndSlotTracking, getAbortablePromise } from '@vue-solana/core/kit';
1
+ import { createReactiveActionStore, getAbortablePromise, createReactiveStoreWithInitialValueAndSlotTracking } from '@vue-solana/core/kit';
2
2
  import { normalizeSolanaError } from '@vue-solana/core/errors';
3
3
  import { shallowRef, watch, unref, onMounted, getCurrentInstance, onScopeDispose, computed } from 'vue';
4
4
 
@@ -9,7 +9,7 @@ function useTrackedData(source, options = {}) {
9
9
  const data = shallowRef(void 0);
10
10
  const error = shallowRef(null);
11
11
  const status = shallowRef("loading");
12
- const disposables = [];
12
+ let disposeActive;
13
13
  let connectionCount = 0;
14
14
  let disposed = false;
15
15
  let activeStore;
@@ -22,8 +22,8 @@ function useTrackedData(source, options = {}) {
22
22
  error.value = normalizeSolanaError(state.error, "RPC_FAILURE");
23
23
  status.value = "error";
24
24
  options.onError?.(state.error);
25
- } else if (state.status === "loading") {
26
- status.value = data.value === void 0 ? "loading" : status.value;
25
+ } else if (state.status === "loading" && data.value === void 0) {
26
+ status.value = "loading";
27
27
  } else if (state.status === "idle") {
28
28
  error.value = null;
29
29
  }
@@ -32,74 +32,25 @@ function useTrackedData(source, options = {}) {
32
32
  if (disposed) {
33
33
  return;
34
34
  }
35
+ disconnect();
35
36
  let rpcRequest = unref(source.rpcRequest);
36
37
  const rpcSubscriptionRequest = unref(source.rpcSubscriptionRequest);
37
38
  if (!rpcRequest || !rpcSubscriptionRequest) {
38
- disconnect();
39
39
  data.value = void 0;
40
40
  error.value = null;
41
41
  status.value = "disabled";
42
42
  return;
43
43
  }
44
44
  if (!isActionSource(rpcRequest) && isSendSource(rpcRequest)) {
45
- let runSend = function(abortSignal) {
46
- controller?.abort();
47
- controller = new AbortController();
48
- const composed = abortSignal ? AbortSignal.any([controller.signal, abortSignal]) : controller.signal;
49
- settle({ data: void 0, error: void 0, status: "running" });
50
- const pending = Promise.resolve(sendSource.send({ abortSignal: composed }));
51
- pending.then((response) => {
52
- settle({ data: response, error: void 0, status: "success" });
53
- }).catch((cause) => {
54
- settle({ data: void 0, error: cause, status: "error" });
55
- });
56
- return getAbortablePromise(pending, composed);
57
- };
58
45
  const sendSource = rpcRequest;
59
- const listeners = /* @__PURE__ */ new Set();
60
- let sendState = {
61
- data: void 0,
62
- error: void 0,
63
- status: "idle"
64
- };
65
- let controller;
66
- const emit = () => {
67
- listeners.forEach((listener) => {
68
- listener();
69
- });
70
- };
71
- const settle = (next) => {
72
- sendState = next;
73
- emit();
74
- };
75
46
  rpcRequest = {
76
- reactiveStore: () => ({
77
- dispatch() {
78
- void runSend().catch(() => {
79
- });
80
- },
81
- dispatchAsync: () => runSend(),
82
- getState: () => sendState,
83
- reset() {
84
- controller?.abort();
85
- settle({ data: void 0, error: void 0, status: "idle" });
86
- },
87
- subscribe(listener) {
88
- listeners.add(listener);
89
- return () => {
90
- listeners.delete(listener);
91
- };
92
- },
93
- withSignal(signal) {
94
- return {
95
- dispatch: () => {
96
- void runSend(signal).catch(() => {
97
- });
98
- },
99
- dispatchAsync: () => runSend(signal)
100
- };
101
- }
102
- })
47
+ reactiveStore: () => createReactiveActionStore(
48
+ (abortSignal) => (
49
+ // Race the send against the signal so a reconnection or teardown
50
+ // abort fails the attempt even if the source ignores it.
51
+ getAbortablePromise(sendSource.send({ abortSignal }), abortSignal)
52
+ )
53
+ )
103
54
  };
104
55
  }
105
56
  connectionCount += 1;
@@ -113,11 +64,9 @@ function useTrackedData(source, options = {}) {
113
64
  });
114
65
  activeStore = store;
115
66
  applyState(store.getState());
116
- disposables.push(
117
- store.subscribe(() => {
118
- applyState(store.getState());
119
- })
120
- );
67
+ disposeActive = store.subscribe(() => {
68
+ applyState(store.getState());
69
+ });
121
70
  if (callerSignal?.aborted) {
122
71
  applyState({ data: store.getState().data, error: callerSignal.reason, status: "error" });
123
72
  return;
@@ -129,10 +78,8 @@ function useTrackedData(source, options = {}) {
129
78
  }
130
79
  }
131
80
  function disconnect() {
132
- disposables.forEach((dispose) => {
133
- dispose();
134
- });
135
- disposables.length = 0;
81
+ disposeActive?.();
82
+ disposeActive = void 0;
136
83
  if (activeStore) {
137
84
  activeStore.reset();
138
85
  activeStore = void 0;
@@ -1,21 +1,17 @@
1
1
  import { parseAddress } from '@vue-solana/core/address';
2
2
  import { normalizeSolanaError } from '@vue-solana/core/errors';
3
- import { shallowRef, onMounted, watch, toValue } from 'vue';
4
- import { u as useConnection } from './vue.CpkwC8Th.mjs';
5
- import { t as tryUseSolana } from './vue.CQh3AUE8.mjs';
3
+ import { shallowRef, onMounted, onScopeDispose, watch, toValue } from 'vue';
6
4
 
7
- function useBalance(address, commitment) {
8
- const solana = tryUseSolana();
9
- const client = solana?.client ?? useConnection();
10
- const balance = shallowRef(null);
5
+ function useAddressRead(addresses, read, select, empty) {
6
+ const data = shallowRef(empty);
11
7
  const loading = shallowRef(false);
12
8
  const error = shallowRef(null);
13
9
  let refreshId = 0;
14
10
  async function refresh() {
15
11
  const requestId = ++refreshId;
16
- const value = toValue(address);
17
- if (!value || !solana) {
18
- balance.value = null;
12
+ const values = addresses.map((address) => toValue(address));
13
+ if (values.some((value) => !value)) {
14
+ data.value = empty;
19
15
  loading.value = false;
20
16
  error.value = null;
21
17
  return null;
@@ -23,19 +19,15 @@ function useBalance(address, commitment) {
23
19
  loading.value = true;
24
20
  error.value = null;
25
21
  try {
26
- const parsedAddress = parseAddress(value);
27
- if (!parsedAddress) {
28
- balance.value = null;
29
- return null;
30
- }
31
- const { value: lamports } = await client.rpc.getBalance(parsedAddress, commitment ? { commitment } : void 0).send();
22
+ const next = select(await read(...values.map((value) => parseAddress(value))));
32
23
  if (requestId === refreshId) {
33
- balance.value = Number(lamports);
24
+ data.value = next;
34
25
  }
35
- return Number(lamports);
26
+ return next;
36
27
  } catch (cause) {
37
28
  const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
38
29
  if (requestId === refreshId) {
30
+ data.value = empty;
39
31
  error.value = normalizedError;
40
32
  }
41
33
  throw normalizedError;
@@ -48,18 +40,16 @@ function useBalance(address, commitment) {
48
40
  onMounted(() => {
49
41
  void refresh().catch(() => void 0);
50
42
  });
43
+ onScopeDispose(() => {
44
+ refreshId += 1;
45
+ });
51
46
  watch(
52
- () => toValue(address),
47
+ () => addresses.map((address) => toValue(address)),
53
48
  () => {
54
49
  void refresh().catch(() => void 0);
55
50
  }
56
51
  );
57
- return {
58
- balance,
59
- loading,
60
- error,
61
- refresh
62
- };
52
+ return { data, loading, error, refresh };
63
53
  }
64
54
 
65
- export { useBalance as u };
55
+ export { useAddressRead as u };
@@ -0,0 +1,27 @@
1
+ import { u as useClientAction } from './vue.CGv0ip3w.mjs';
2
+
3
+ const SENDING_PROVIDER_HINT = "Use a client created by `createSolanaClient({ payer })` \u2014 or any client with a `payer` signer. Kit reads `client.payer` when it plans a transaction from an instruction plan.";
4
+ const SEND_STATUSES = {
5
+ error: "error",
6
+ idle: "idle",
7
+ success: "sent",
8
+ working: "sending"
9
+ };
10
+ function useSendTransaction() {
11
+ return useClientAction({
12
+ capability: "sendTransaction",
13
+ hookName: "useSendTransaction",
14
+ providerHint: SENDING_PROVIDER_HINT,
15
+ statuses: SEND_STATUSES
16
+ });
17
+ }
18
+ function useSendTransactions() {
19
+ return useClientAction({
20
+ capability: "sendTransactions",
21
+ hookName: "useSendTransactions",
22
+ providerHint: SENDING_PROVIDER_HINT,
23
+ statuses: SEND_STATUSES
24
+ });
25
+ }
26
+
27
+ export { useSendTransactions as a, useSendTransaction as u };
@@ -0,0 +1,66 @@
1
+ import { SolanaError, normalizeSolanaError } from '@vue-solana/core/errors';
2
+ import { withSolanaTimeout } from '@vue-solana/core/timeout';
3
+ import { createNoWalletSelectedError, assertWalletCanSignAndSendTransactions } from '@vue-solana/core/wallet';
4
+ import { shallowRef } from 'vue';
5
+ import { u as useExecution } from './vue.DlihC5GG.mjs';
6
+ import { u as useWallet } from './vue.D218Ow7t.mjs';
7
+
8
+ const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
9
+ class PartialSignAndSendError extends SolanaError {
10
+ constructor(cause, signatures) {
11
+ super(cause.code, cause.message, { cause: cause.cause, feature: cause.feature });
12
+ this.signatures = signatures;
13
+ this.name = "PartialSignAndSendError";
14
+ }
15
+ }
16
+ function useSignAndSendTransactions() {
17
+ const { wallet } = useWallet();
18
+ const signatures = shallowRef(null);
19
+ const { status, loading, error, execute } = useExecution("sending");
20
+ function send(transactions, options) {
21
+ signatures.value = null;
22
+ return execute(
23
+ async () => {
24
+ const activeWallet = wallet.value;
25
+ if (!activeWallet) {
26
+ throw createNoWalletSelectedError();
27
+ }
28
+ assertWalletCanSignAndSendTransactions(activeWallet);
29
+ const sendSingularSequentially = async () => {
30
+ const collected = [];
31
+ for (const transaction of transactions) {
32
+ try {
33
+ const result = await activeWallet.signAndSendTransaction(transaction, options);
34
+ collected.push(result.signature);
35
+ } catch (cause) {
36
+ throw new PartialSignAndSendError(
37
+ normalizeSolanaError(cause, "RPC_FAILURE"),
38
+ collected
39
+ );
40
+ }
41
+ }
42
+ return collected;
43
+ };
44
+ const send2 = withSolanaTimeout(
45
+ activeWallet.signAndSendTransactions ? activeWallet.signAndSendTransactions(transactions, options) : sendSingularSequentially(),
46
+ SIGN_AND_SEND_TIMEOUT_MS,
47
+ "Wallet transaction did not return a result. Check your wallet or explorer for the final status."
48
+ );
49
+ return await send2;
50
+ },
51
+ (result) => {
52
+ signatures.value = result;
53
+ return "sent";
54
+ }
55
+ );
56
+ }
57
+ return {
58
+ signatures,
59
+ status,
60
+ loading,
61
+ error,
62
+ execute: send
63
+ };
64
+ }
65
+
66
+ export { PartialSignAndSendError as P, useSignAndSendTransactions as u };
@@ -0,0 +1,36 @@
1
+ import { createNoWalletSelectedError, assertWalletCanSignIn } from '@vue-solana/core/wallet';
2
+ import { shallowRef } from 'vue';
3
+ import { u as useExecution } from './vue.DlihC5GG.mjs';
4
+ import { u as useWallet } from './vue.D218Ow7t.mjs';
5
+
6
+ function useSignIn() {
7
+ const { wallet } = useWallet();
8
+ const signInResult = shallowRef(null);
9
+ const { status, loading, error, execute } = useExecution("signing-in");
10
+ function signIn(input) {
11
+ signInResult.value = null;
12
+ return execute(
13
+ async () => {
14
+ const activeWallet = wallet.value;
15
+ if (!activeWallet) {
16
+ throw createNoWalletSelectedError();
17
+ }
18
+ assertWalletCanSignIn(activeWallet);
19
+ return activeWallet.signIn(input);
20
+ },
21
+ (result) => {
22
+ signInResult.value = result;
23
+ return "signed-in";
24
+ }
25
+ );
26
+ }
27
+ return {
28
+ signInResult,
29
+ status,
30
+ loading,
31
+ error,
32
+ signIn
33
+ };
34
+ }
35
+
36
+ export { useSignIn as u };
@@ -0,0 +1,52 @@
1
+ import { normalizeSolanaError } from '@vue-solana/core/errors';
2
+ import { shallowRef, computed, ref, onScopeDispose } from 'vue';
3
+ import { u as useClientCapability, M as MissingClientCapabilityError } from './vue.B9uRpSDJ.mjs';
4
+ import { u as useSolanaClient } from './vue.Mxc8w6Qk.mjs';
5
+
6
+ function useClientAction(config) {
7
+ const { capability, hookName, providerHint, statuses } = config;
8
+ useClientCapability([capability, "payer"], { hookName, providerHint });
9
+ const { client } = useSolanaClient();
10
+ const data = shallowRef(null);
11
+ const status = shallowRef(statuses.idle);
12
+ const loading = computed(() => status.value === statuses.working);
13
+ const error = ref(null);
14
+ let executionId = 0;
15
+ let abortController;
16
+ onScopeDispose(() => {
17
+ abortController?.abort();
18
+ executionId++;
19
+ });
20
+ async function execute(input, options = {}) {
21
+ const method = client?.[capability];
22
+ if (typeof method !== "function") {
23
+ throw new MissingClientCapabilityError(hookName, [capability], providerHint);
24
+ }
25
+ abortController?.abort();
26
+ const controller = new AbortController();
27
+ abortController = controller;
28
+ const currentExecutionId = ++executionId;
29
+ status.value = statuses.working;
30
+ error.value = null;
31
+ data.value = null;
32
+ try {
33
+ const abortSignal = options.abortSignal ? AbortSignal.any([controller.signal, options.abortSignal]) : controller.signal;
34
+ const result = await method(input, { abortSignal });
35
+ if (currentExecutionId === executionId) {
36
+ data.value = result;
37
+ status.value = statuses.success;
38
+ }
39
+ return result;
40
+ } catch (cause) {
41
+ const normalizedError = normalizeSolanaError(cause, "RPC_FAILURE");
42
+ if (currentExecutionId === executionId) {
43
+ error.value = normalizedError;
44
+ status.value = statuses.error;
45
+ }
46
+ throw normalizedError;
47
+ }
48
+ }
49
+ return { data, status, loading, error, execute };
50
+ }
51
+
52
+ export { useClientAction as u };