@vue-solana/vue 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -165,14 +165,30 @@ Composables return inert SSR-safe state when no plugin context is available. Rea
165
165
  ```ts
166
166
  import { useSignAndSendTransaction } from "@vue-solana/vue/useSignAndSendTransaction";
167
167
 
168
- const { signature, loading, error, execute } = useSignAndSendTransaction();
168
+ const { signature, confirmation, status, loading, error, execute } = useSignAndSendTransaction();
169
169
 
170
170
  await execute(transaction, {
171
+ confirm: true,
172
+ confirmation: { commitment: "confirmed" },
171
173
  skipPreflight: false,
172
174
  });
173
175
  ```
174
176
 
175
- The current wallet must be connected and support either `signAndSendTransaction` or `signTransaction`. Android Mobile Wallet Adapter wallets prefer `signTransaction` plus app-side RPC submission when available. `loading` is also cleared if a wallet adapter never returns a result; in that stale case, check the wallet or an explorer before retrying because chain status may be unknown.
177
+ The current wallet must be connected and support either `signAndSendTransaction` or `signTransaction`. Android Mobile Wallet Adapter wallets prefer `signTransaction` plus app-side RPC submission when available. This avoids a mobile handoff edge case where the wallet sends successfully but the browser page does not receive the wallet adapter's returned signature.
178
+
179
+ Without `confirm: true`, `execute()` returns after submission and sets `status` to `sent`. With confirmation enabled, status moves through `sending`, `confirming`, and then `processed`, `confirmed`, or `finalized` to match the requested commitment. If confirmation times out or fails, the submitted `signature` remains available so the app can link to an explorer.
180
+
181
+ Use `useTransactionConfirmation()` when you already have a submitted signature and want to wait for confirmation separately:
182
+
183
+ ```ts
184
+ import { useTransactionConfirmation } from "@vue-solana/vue/useTransactionConfirmation";
185
+
186
+ const confirmation = useTransactionConfirmation({ commitment: "finalized" });
187
+
188
+ await confirmation.confirm(signature);
189
+ ```
190
+
191
+ `useSignAndSendTransaction()` also clears `loading` if a wallet adapter never returns a result. In that stale case, `error` is set and the chain status may be unknown, so check the connected wallet or an explorer before retrying.
176
192
 
177
193
  ## Example App
178
194
 
@@ -207,7 +223,8 @@ Docs: [Vue Solana Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
207
223
  - `useWallets()`: returns discovered browser extension wallets, Android Mobile Wallet Adapter wallets, iOS browser wallet links, and wallet selection actions.
208
224
  - `useBalance(address, commitment?)`: loads lamport balance for a `PublicKey` or address string.
209
225
  - `useTransaction(handler, options?)`: generic async transaction state helper with optional timeout settings.
210
- - `useSignAndSendTransaction()`: signs and sends a transaction through the configured wallet.
226
+ - `useTransactionConfirmation(options?)`: confirms a submitted signature with reactive status and timeout/error state.
227
+ - `useSignAndSendTransaction()`: signs and sends a transaction through the configured wallet, with optional confirmation waiting.
211
228
 
212
229
  Direct composable subpaths:
213
230
 
@@ -218,6 +235,7 @@ Direct composable subpaths:
218
235
  - `@vue-solana/vue/useWallet`
219
236
  - `@vue-solana/vue/useWallets`
220
237
  - `@vue-solana/vue/useTransaction`
238
+ - `@vue-solana/vue/useTransactionConfirmation`
221
239
  - `@vue-solana/vue/useSignAndSendTransaction`
222
240
 
223
241
  ## Known TypeScript Issue
@@ -228,7 +246,13 @@ If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts`
228
246
 
229
247
  ```ts
230
248
  declare module "@solana/web3-compat" {
231
- export type { Commitment, SendOptions, TransactionSignature } from "@solana/web3.js";
249
+ export type {
250
+ Commitment,
251
+ RpcResponseAndContext,
252
+ SendOptions,
253
+ SignatureResult,
254
+ TransactionSignature,
255
+ } from "@solana/web3.js";
232
256
  export {
233
257
  Connection,
234
258
  Keypair,
package/dist/index.cjs CHANGED
@@ -3,9 +3,10 @@
3
3
  const useBalance = require('./shared/vue.D_AM1Nl8.cjs');
4
4
  const useConnection = require('./shared/vue.CwhEmATP.cjs');
5
5
  const useRpc = require('./shared/vue.COyyrsQU.cjs');
6
- const useSignAndSendTransaction = require('./shared/vue.DQmAPXVB.cjs');
6
+ const useSignAndSendTransaction = require('./shared/vue.DEQJ23UM.cjs');
7
7
  const useSolana = require('./shared/vue.C4tLiG3R.cjs');
8
8
  const useTransaction = require('./shared/vue.DQi38JeF.cjs');
9
+ const useTransactionConfirmation = require('./shared/vue.DHVYJk8P.cjs');
9
10
  const useWallet = require('./shared/vue.CwPjPFN6.cjs');
10
11
  const useWallets = require('./shared/vue.P9tgeC5S.cjs');
11
12
  const rpc = require('@vue-solana/core/rpc');
@@ -323,6 +324,8 @@ exports.solanaInjectionKey = useSolana.solanaInjectionKey;
323
324
  exports.tryUseSolana = useSolana.tryUseSolana;
324
325
  exports.useSolana = useSolana.useSolana;
325
326
  exports.useTransaction = useTransaction.useTransaction;
327
+ exports.getConfirmedTransactionStatus = useTransactionConfirmation.getConfirmedTransactionStatus;
328
+ exports.useTransactionConfirmation = useTransactionConfirmation.useTransactionConfirmation;
326
329
  exports.useWallet = useWallet.useWallet;
327
330
  exports.useWallets = useWallets.useWallets;
328
331
  exports.VueSolana = VueSolana;
package/dist/index.d.cts CHANGED
@@ -1,9 +1,10 @@
1
1
  export { useBalance } from './useBalance.cjs';
2
2
  export { useConnection } from './useConnection.cjs';
3
3
  export { useRpc } from './useRpc.cjs';
4
- export { useSignAndSendTransaction } from './useSignAndSendTransaction.cjs';
4
+ export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.cjs';
5
5
  export { tryUseSolana, useSolana } from './useSolana.cjs';
6
6
  export { UseTransactionOptions, useTransaction } from './useTransaction.cjs';
7
+ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.cjs';
7
8
  export { useWallet } from './useWallet.cjs';
8
9
  export { useWallets } from './useWallets.cjs';
9
10
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.cjs';
package/dist/index.d.mts CHANGED
@@ -1,9 +1,10 @@
1
1
  export { useBalance } from './useBalance.mjs';
2
2
  export { useConnection } from './useConnection.mjs';
3
3
  export { useRpc } from './useRpc.mjs';
4
- export { useSignAndSendTransaction } from './useSignAndSendTransaction.mjs';
4
+ export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.mjs';
5
5
  export { tryUseSolana, useSolana } from './useSolana.mjs';
6
6
  export { UseTransactionOptions, useTransaction } from './useTransaction.mjs';
7
+ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.mjs';
7
8
  export { useWallet } from './useWallet.mjs';
8
9
  export { useWallets } from './useWallets.mjs';
9
10
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.mjs';
package/dist/index.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export { useBalance } from './useBalance.js';
2
2
  export { useConnection } from './useConnection.js';
3
3
  export { useRpc } from './useRpc.js';
4
- export { useSignAndSendTransaction } from './useSignAndSendTransaction.js';
4
+ export { SignAndSendTransactionOptions, SignAndSendTransactionStatus, useSignAndSendTransaction } from './useSignAndSendTransaction.js';
5
5
  export { tryUseSolana, useSolana } from './useSolana.js';
6
6
  export { UseTransactionOptions, useTransaction } from './useTransaction.js';
7
+ export { TransactionConfirmationStatus, getConfirmedTransactionStatus, useTransactionConfirmation } from './useTransactionConfirmation.js';
7
8
  export { useWallet } from './useWallet.js';
8
9
  export { useWallets } from './useWallets.js';
9
10
  export { S as SolanaConnectionStatus, V as VueSolanaContext, s as solanaInjectionKey } from './shared/vue.DGhodYJh.js';
package/dist/index.mjs CHANGED
@@ -1,11 +1,12 @@
1
1
  export { u as useBalance } from './shared/vue.DQhHHVu6.mjs';
2
2
  export { u as useConnection } from './shared/vue.DlEAL2G8.mjs';
3
3
  export { u as useRpc } from './shared/vue.BqDzSepb.mjs';
4
- export { u as useSignAndSendTransaction } from './shared/vue.DJ42Zrow.mjs';
4
+ export { u as useSignAndSendTransaction } from './shared/vue.RQ9fETnm.mjs';
5
5
  import { s as solanaInjectionKey } from './shared/vue.1M_c5FWA.mjs';
6
6
  export { t as tryUseSolana, u as useSolana } from './shared/vue.1M_c5FWA.mjs';
7
7
  import { w as withTimeout } from './shared/vue.gLqkzJY4.mjs';
8
8
  export { u as useTransaction } from './shared/vue.gLqkzJY4.mjs';
9
+ export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.jOsz34kz.mjs';
9
10
  export { u as useWallet } from './shared/vue.DYf_CRDv.mjs';
10
11
  export { u as useWallets } from './shared/vue.h-uS8MXN.mjs';
11
12
  import { createSolanaContext } from '@vue-solana/core/rpc';
@@ -0,0 +1,92 @@
1
+ 'use strict';
2
+
3
+ const transaction = require('@vue-solana/core/transaction');
4
+ const vue = require('vue');
5
+ const useConnection = require('./vue.CwhEmATP.cjs');
6
+ const useWallet = require('./vue.CwPjPFN6.cjs');
7
+ const useTransactionConfirmation = require('./vue.DHVYJk8P.cjs');
8
+
9
+ const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
10
+ function useSignAndSendTransaction() {
11
+ const connection = useConnection.useConnection();
12
+ const { wallet } = useWallet.useWallet();
13
+ const signature = vue.ref(null);
14
+ const confirmation = vue.ref(null);
15
+ const status = vue.ref("idle");
16
+ const loading = vue.ref(false);
17
+ const error = vue.ref(null);
18
+ let executionId = 0;
19
+ async function execute(transaction$1, options) {
20
+ const currentExecutionId = ++executionId;
21
+ const { confirm, confirmation: confirmationOptions, ...sendOptions } = options ?? {};
22
+ const transactionOptions = Object.keys(sendOptions).length > 0 ? sendOptions : void 0;
23
+ status.value = "sending";
24
+ loading.value = true;
25
+ error.value = null;
26
+ confirmation.value = null;
27
+ try {
28
+ if (!wallet.value) {
29
+ throw new Error("No Solana wallet is configured");
30
+ }
31
+ const nextSignature = await withWalletTransactionTimeout(
32
+ transaction.signAndSendTransaction(connection, wallet.value, transaction$1, transactionOptions)
33
+ );
34
+ if (currentExecutionId === executionId) {
35
+ signature.value = nextSignature;
36
+ status.value = confirm ? "confirming" : "sent";
37
+ }
38
+ if (!confirm) {
39
+ return nextSignature;
40
+ }
41
+ const nextConfirmation = await transaction.confirmTransactionSignature(
42
+ connection,
43
+ nextSignature,
44
+ confirmationOptions
45
+ );
46
+ if (currentExecutionId === executionId) {
47
+ confirmation.value = nextConfirmation;
48
+ status.value = useTransactionConfirmation.getConfirmedTransactionStatus(nextConfirmation);
49
+ }
50
+ return nextSignature;
51
+ } catch (cause) {
52
+ if (currentExecutionId === executionId) {
53
+ error.value = cause;
54
+ status.value = "error";
55
+ }
56
+ throw cause;
57
+ } finally {
58
+ if (currentExecutionId === executionId) {
59
+ loading.value = false;
60
+ }
61
+ }
62
+ }
63
+ return {
64
+ signature,
65
+ confirmation,
66
+ status,
67
+ loading,
68
+ error,
69
+ execute
70
+ };
71
+ }
72
+ async function withWalletTransactionTimeout(promise) {
73
+ let timeoutId;
74
+ try {
75
+ const timeout = new Promise((_, reject) => {
76
+ timeoutId = setTimeout(() => {
77
+ reject(
78
+ new Error(
79
+ "Wallet transaction did not return a result. Check your wallet or explorer for the final status."
80
+ )
81
+ );
82
+ }, SIGN_AND_SEND_TIMEOUT_MS);
83
+ });
84
+ return await Promise.race([promise, timeout]);
85
+ } finally {
86
+ if (timeoutId) {
87
+ clearTimeout(timeoutId);
88
+ }
89
+ }
90
+ }
91
+
92
+ exports.useSignAndSendTransaction = useSignAndSendTransaction;
@@ -0,0 +1,72 @@
1
+ 'use strict';
2
+
3
+ const transaction = require('@vue-solana/core/transaction');
4
+ const vue = require('vue');
5
+ const useConnection = require('./vue.CwhEmATP.cjs');
6
+
7
+ function getConfirmedTransactionStatus(confirmation) {
8
+ if (confirmation.commitment === "finalized") {
9
+ return "finalized";
10
+ }
11
+ return confirmation.commitment === "processed" ? "processed" : "confirmed";
12
+ }
13
+ function useTransactionConfirmation(defaultOptions = {}) {
14
+ const connection = useConnection.useConnection();
15
+ const signature = vue.ref(null);
16
+ const confirmation = vue.ref(null);
17
+ const status = vue.ref("idle");
18
+ const loading = vue.ref(false);
19
+ const error = vue.ref(null);
20
+ let executionId = 0;
21
+ async function confirm(nextSignature, options = {}) {
22
+ const currentExecutionId = ++executionId;
23
+ const confirmationOptions = { ...defaultOptions, ...options };
24
+ signature.value = nextSignature;
25
+ confirmation.value = null;
26
+ status.value = "confirming";
27
+ loading.value = true;
28
+ error.value = null;
29
+ try {
30
+ const nextConfirmation = await transaction.confirmTransactionSignature(
31
+ connection,
32
+ nextSignature,
33
+ confirmationOptions
34
+ );
35
+ if (currentExecutionId === executionId) {
36
+ confirmation.value = nextConfirmation;
37
+ status.value = getConfirmedTransactionStatus(nextConfirmation);
38
+ }
39
+ return nextConfirmation;
40
+ } catch (cause) {
41
+ if (currentExecutionId === executionId) {
42
+ error.value = cause;
43
+ status.value = "error";
44
+ }
45
+ throw cause;
46
+ } finally {
47
+ if (currentExecutionId === executionId) {
48
+ loading.value = false;
49
+ }
50
+ }
51
+ }
52
+ function reset() {
53
+ executionId += 1;
54
+ signature.value = null;
55
+ confirmation.value = null;
56
+ status.value = "idle";
57
+ loading.value = false;
58
+ error.value = null;
59
+ }
60
+ return {
61
+ signature,
62
+ confirmation,
63
+ status,
64
+ loading,
65
+ error,
66
+ confirm,
67
+ reset
68
+ };
69
+ }
70
+
71
+ exports.getConfirmedTransactionStatus = getConfirmedTransactionStatus;
72
+ exports.useTransactionConfirmation = useTransactionConfirmation;
@@ -0,0 +1,90 @@
1
+ import { signAndSendTransaction, confirmTransactionSignature } from '@vue-solana/core/transaction';
2
+ import { ref } from 'vue';
3
+ import { u as useConnection } from './vue.DlEAL2G8.mjs';
4
+ import { u as useWallet } from './vue.DYf_CRDv.mjs';
5
+ import { g as getConfirmedTransactionStatus } from './vue.jOsz34kz.mjs';
6
+
7
+ const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
8
+ function useSignAndSendTransaction() {
9
+ const connection = useConnection();
10
+ const { wallet } = useWallet();
11
+ const signature = ref(null);
12
+ const confirmation = ref(null);
13
+ const status = ref("idle");
14
+ const loading = ref(false);
15
+ const error = ref(null);
16
+ let executionId = 0;
17
+ async function execute(transaction, options) {
18
+ const currentExecutionId = ++executionId;
19
+ const { confirm, confirmation: confirmationOptions, ...sendOptions } = options ?? {};
20
+ const transactionOptions = Object.keys(sendOptions).length > 0 ? sendOptions : void 0;
21
+ status.value = "sending";
22
+ loading.value = true;
23
+ error.value = null;
24
+ confirmation.value = null;
25
+ try {
26
+ if (!wallet.value) {
27
+ throw new Error("No Solana wallet is configured");
28
+ }
29
+ const nextSignature = await withWalletTransactionTimeout(
30
+ signAndSendTransaction(connection, wallet.value, transaction, transactionOptions)
31
+ );
32
+ if (currentExecutionId === executionId) {
33
+ signature.value = nextSignature;
34
+ status.value = confirm ? "confirming" : "sent";
35
+ }
36
+ if (!confirm) {
37
+ return nextSignature;
38
+ }
39
+ const nextConfirmation = await confirmTransactionSignature(
40
+ connection,
41
+ nextSignature,
42
+ confirmationOptions
43
+ );
44
+ if (currentExecutionId === executionId) {
45
+ confirmation.value = nextConfirmation;
46
+ status.value = getConfirmedTransactionStatus(nextConfirmation);
47
+ }
48
+ return nextSignature;
49
+ } catch (cause) {
50
+ if (currentExecutionId === executionId) {
51
+ error.value = cause;
52
+ status.value = "error";
53
+ }
54
+ throw cause;
55
+ } finally {
56
+ if (currentExecutionId === executionId) {
57
+ loading.value = false;
58
+ }
59
+ }
60
+ }
61
+ return {
62
+ signature,
63
+ confirmation,
64
+ status,
65
+ loading,
66
+ error,
67
+ execute
68
+ };
69
+ }
70
+ async function withWalletTransactionTimeout(promise) {
71
+ let timeoutId;
72
+ try {
73
+ const timeout = new Promise((_, reject) => {
74
+ timeoutId = setTimeout(() => {
75
+ reject(
76
+ new Error(
77
+ "Wallet transaction did not return a result. Check your wallet or explorer for the final status."
78
+ )
79
+ );
80
+ }, SIGN_AND_SEND_TIMEOUT_MS);
81
+ });
82
+ return await Promise.race([promise, timeout]);
83
+ } finally {
84
+ if (timeoutId) {
85
+ clearTimeout(timeoutId);
86
+ }
87
+ }
88
+ }
89
+
90
+ export { useSignAndSendTransaction as u };
@@ -0,0 +1,69 @@
1
+ import { confirmTransactionSignature } from '@vue-solana/core/transaction';
2
+ import { ref } from 'vue';
3
+ import { u as useConnection } from './vue.DlEAL2G8.mjs';
4
+
5
+ function getConfirmedTransactionStatus(confirmation) {
6
+ if (confirmation.commitment === "finalized") {
7
+ return "finalized";
8
+ }
9
+ return confirmation.commitment === "processed" ? "processed" : "confirmed";
10
+ }
11
+ function useTransactionConfirmation(defaultOptions = {}) {
12
+ const connection = useConnection();
13
+ const signature = ref(null);
14
+ const confirmation = ref(null);
15
+ const status = ref("idle");
16
+ const loading = ref(false);
17
+ const error = ref(null);
18
+ let executionId = 0;
19
+ async function confirm(nextSignature, options = {}) {
20
+ const currentExecutionId = ++executionId;
21
+ const confirmationOptions = { ...defaultOptions, ...options };
22
+ signature.value = nextSignature;
23
+ confirmation.value = null;
24
+ status.value = "confirming";
25
+ loading.value = true;
26
+ error.value = null;
27
+ try {
28
+ const nextConfirmation = await confirmTransactionSignature(
29
+ connection,
30
+ nextSignature,
31
+ confirmationOptions
32
+ );
33
+ if (currentExecutionId === executionId) {
34
+ confirmation.value = nextConfirmation;
35
+ status.value = getConfirmedTransactionStatus(nextConfirmation);
36
+ }
37
+ return nextConfirmation;
38
+ } catch (cause) {
39
+ if (currentExecutionId === executionId) {
40
+ error.value = cause;
41
+ status.value = "error";
42
+ }
43
+ throw cause;
44
+ } finally {
45
+ if (currentExecutionId === executionId) {
46
+ loading.value = false;
47
+ }
48
+ }
49
+ }
50
+ function reset() {
51
+ executionId += 1;
52
+ signature.value = null;
53
+ confirmation.value = null;
54
+ status.value = "idle";
55
+ loading.value = false;
56
+ error.value = null;
57
+ }
58
+ return {
59
+ signature,
60
+ confirmation,
61
+ status,
62
+ loading,
63
+ error,
64
+ confirm,
65
+ reset
66
+ };
67
+ }
68
+
69
+ export { getConfirmedTransactionStatus as g, useTransactionConfirmation as u };
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- const useSignAndSendTransaction = require('./shared/vue.DQmAPXVB.cjs');
3
+ const useSignAndSendTransaction = require('./shared/vue.DEQJ23UM.cjs');
4
4
  require('@vue-solana/core/transaction');
5
+ require('vue');
5
6
  require('./shared/vue.CwhEmATP.cjs');
6
7
  require('./shared/vue.COyyrsQU.cjs');
7
- require('vue');
8
8
  require('./shared/vue.C4tLiG3R.cjs');
9
9
  require('./shared/vue.CwPjPFN6.cjs');
10
- require('./shared/vue.DQi38JeF.cjs');
10
+ require('./shared/vue.DHVYJk8P.cjs');
11
11
 
12
12
 
13
13
 
@@ -1,11 +1,28 @@
1
1
  import * as vue from 'vue';
2
- import { SendTransactionOptions } from '@vue-solana/core/types';
2
+ import { SendTransactionOptions, ConfirmTransactionOptions, TransactionConfirmation, SolanaTransaction } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
3
4
 
5
+ type SignAndSendTransactionStatus = "idle" | "sending" | "sent" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ interface SignAndSendTransactionOptions extends SendTransactionOptions {
7
+ confirm?: boolean;
8
+ confirmation?: ConfirmTransactionOptions;
9
+ }
4
10
  declare function useSignAndSendTransaction(): {
5
11
  signature: any;
12
+ confirmation: vue.Ref<{
13
+ signature: TransactionSignature;
14
+ commitment: TransactionSignature;
15
+ result: TransactionSignature<TransactionSignature>;
16
+ } | null, TransactionConfirmation | {
17
+ signature: TransactionSignature;
18
+ commitment: TransactionSignature;
19
+ result: TransactionSignature<TransactionSignature>;
20
+ } | null>;
21
+ status: vue.Ref<SignAndSendTransactionStatus, SignAndSendTransactionStatus>;
6
22
  loading: vue.Ref<boolean, boolean>;
7
23
  error: vue.Ref<unknown, unknown>;
8
- execute: (transaction: any, options?: SendTransactionOptions | undefined) => Promise<TransactionSignature>;
24
+ execute: (transaction: SolanaTransaction, options?: SignAndSendTransactionOptions) => Promise<TransactionSignature>;
9
25
  };
10
26
 
11
27
  export { useSignAndSendTransaction };
28
+ export type { SignAndSendTransactionOptions, SignAndSendTransactionStatus };
@@ -1,11 +1,28 @@
1
1
  import * as vue from 'vue';
2
- import { SendTransactionOptions } from '@vue-solana/core/types';
2
+ import { SendTransactionOptions, ConfirmTransactionOptions, TransactionConfirmation, SolanaTransaction } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
3
4
 
5
+ type SignAndSendTransactionStatus = "idle" | "sending" | "sent" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ interface SignAndSendTransactionOptions extends SendTransactionOptions {
7
+ confirm?: boolean;
8
+ confirmation?: ConfirmTransactionOptions;
9
+ }
4
10
  declare function useSignAndSendTransaction(): {
5
11
  signature: any;
12
+ confirmation: vue.Ref<{
13
+ signature: TransactionSignature;
14
+ commitment: TransactionSignature;
15
+ result: TransactionSignature<TransactionSignature>;
16
+ } | null, TransactionConfirmation | {
17
+ signature: TransactionSignature;
18
+ commitment: TransactionSignature;
19
+ result: TransactionSignature<TransactionSignature>;
20
+ } | null>;
21
+ status: vue.Ref<SignAndSendTransactionStatus, SignAndSendTransactionStatus>;
6
22
  loading: vue.Ref<boolean, boolean>;
7
23
  error: vue.Ref<unknown, unknown>;
8
- execute: (transaction: any, options?: SendTransactionOptions | undefined) => Promise<TransactionSignature>;
24
+ execute: (transaction: SolanaTransaction, options?: SignAndSendTransactionOptions) => Promise<TransactionSignature>;
9
25
  };
10
26
 
11
27
  export { useSignAndSendTransaction };
28
+ export type { SignAndSendTransactionOptions, SignAndSendTransactionStatus };
@@ -1,11 +1,28 @@
1
1
  import * as vue from 'vue';
2
- import { SendTransactionOptions } from '@vue-solana/core/types';
2
+ import { SendTransactionOptions, ConfirmTransactionOptions, TransactionConfirmation, SolanaTransaction } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
3
4
 
5
+ type SignAndSendTransactionStatus = "idle" | "sending" | "sent" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ interface SignAndSendTransactionOptions extends SendTransactionOptions {
7
+ confirm?: boolean;
8
+ confirmation?: ConfirmTransactionOptions;
9
+ }
4
10
  declare function useSignAndSendTransaction(): {
5
11
  signature: any;
12
+ confirmation: vue.Ref<{
13
+ signature: TransactionSignature;
14
+ commitment: TransactionSignature;
15
+ result: TransactionSignature<TransactionSignature>;
16
+ } | null, TransactionConfirmation | {
17
+ signature: TransactionSignature;
18
+ commitment: TransactionSignature;
19
+ result: TransactionSignature<TransactionSignature>;
20
+ } | null>;
21
+ status: vue.Ref<SignAndSendTransactionStatus, SignAndSendTransactionStatus>;
6
22
  loading: vue.Ref<boolean, boolean>;
7
23
  error: vue.Ref<unknown, unknown>;
8
- execute: (transaction: any, options?: SendTransactionOptions | undefined) => Promise<TransactionSignature>;
24
+ execute: (transaction: SolanaTransaction, options?: SignAndSendTransactionOptions) => Promise<TransactionSignature>;
9
25
  };
10
26
 
11
27
  export { useSignAndSendTransaction };
28
+ export type { SignAndSendTransactionOptions, SignAndSendTransactionStatus };
@@ -1,8 +1,8 @@
1
- export { u as useSignAndSendTransaction } from './shared/vue.DJ42Zrow.mjs';
1
+ export { u as useSignAndSendTransaction } from './shared/vue.RQ9fETnm.mjs';
2
2
  import '@vue-solana/core/transaction';
3
+ import 'vue';
3
4
  import './shared/vue.DlEAL2G8.mjs';
4
5
  import './shared/vue.BqDzSepb.mjs';
5
- import 'vue';
6
6
  import './shared/vue.1M_c5FWA.mjs';
7
7
  import './shared/vue.DYf_CRDv.mjs';
8
- import './shared/vue.gLqkzJY4.mjs';
8
+ import './shared/vue.jOsz34kz.mjs';
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ const useTransactionConfirmation = require('./shared/vue.DHVYJk8P.cjs');
4
+ require('@vue-solana/core/transaction');
5
+ require('vue');
6
+ require('./shared/vue.CwhEmATP.cjs');
7
+ require('./shared/vue.COyyrsQU.cjs');
8
+ require('./shared/vue.C4tLiG3R.cjs');
9
+
10
+
11
+
12
+ exports.getConfirmedTransactionStatus = useTransactionConfirmation.getConfirmedTransactionStatus;
13
+ exports.useTransactionConfirmation = useTransactionConfirmation.useTransactionConfirmation;
@@ -0,0 +1,26 @@
1
+ import * as vue from 'vue';
2
+ import { TransactionConfirmation, ConfirmTransactionOptions } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
4
+
5
+ type TransactionConfirmationStatus = "idle" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ declare function getConfirmedTransactionStatus(confirmation: TransactionConfirmation): Extract<TransactionConfirmationStatus, "processed" | "confirmed" | "finalized">;
7
+ declare function useTransactionConfirmation(defaultOptions?: ConfirmTransactionOptions): {
8
+ signature: any;
9
+ confirmation: vue.Ref<{
10
+ signature: TransactionSignature;
11
+ commitment: TransactionSignature;
12
+ result: TransactionSignature<TransactionSignature>;
13
+ } | null, TransactionConfirmation | {
14
+ signature: TransactionSignature;
15
+ commitment: TransactionSignature;
16
+ result: TransactionSignature<TransactionSignature>;
17
+ } | null>;
18
+ status: vue.Ref<TransactionConfirmationStatus, TransactionConfirmationStatus>;
19
+ loading: vue.Ref<boolean, boolean>;
20
+ error: vue.Ref<unknown, unknown>;
21
+ confirm: (nextSignature: TransactionSignature, options?: ConfirmTransactionOptions) => Promise<TransactionConfirmation>;
22
+ reset: () => void;
23
+ };
24
+
25
+ export { getConfirmedTransactionStatus, useTransactionConfirmation };
26
+ export type { TransactionConfirmationStatus };
@@ -0,0 +1,26 @@
1
+ import * as vue from 'vue';
2
+ import { TransactionConfirmation, ConfirmTransactionOptions } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
4
+
5
+ type TransactionConfirmationStatus = "idle" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ declare function getConfirmedTransactionStatus(confirmation: TransactionConfirmation): Extract<TransactionConfirmationStatus, "processed" | "confirmed" | "finalized">;
7
+ declare function useTransactionConfirmation(defaultOptions?: ConfirmTransactionOptions): {
8
+ signature: any;
9
+ confirmation: vue.Ref<{
10
+ signature: TransactionSignature;
11
+ commitment: TransactionSignature;
12
+ result: TransactionSignature<TransactionSignature>;
13
+ } | null, TransactionConfirmation | {
14
+ signature: TransactionSignature;
15
+ commitment: TransactionSignature;
16
+ result: TransactionSignature<TransactionSignature>;
17
+ } | null>;
18
+ status: vue.Ref<TransactionConfirmationStatus, TransactionConfirmationStatus>;
19
+ loading: vue.Ref<boolean, boolean>;
20
+ error: vue.Ref<unknown, unknown>;
21
+ confirm: (nextSignature: TransactionSignature, options?: ConfirmTransactionOptions) => Promise<TransactionConfirmation>;
22
+ reset: () => void;
23
+ };
24
+
25
+ export { getConfirmedTransactionStatus, useTransactionConfirmation };
26
+ export type { TransactionConfirmationStatus };
@@ -0,0 +1,26 @@
1
+ import * as vue from 'vue';
2
+ import { TransactionConfirmation, ConfirmTransactionOptions } from '@vue-solana/core/types';
3
+ import { TransactionSignature } from '@solana/web3-compat';
4
+
5
+ type TransactionConfirmationStatus = "idle" | "confirming" | "processed" | "confirmed" | "finalized" | "error";
6
+ declare function getConfirmedTransactionStatus(confirmation: TransactionConfirmation): Extract<TransactionConfirmationStatus, "processed" | "confirmed" | "finalized">;
7
+ declare function useTransactionConfirmation(defaultOptions?: ConfirmTransactionOptions): {
8
+ signature: any;
9
+ confirmation: vue.Ref<{
10
+ signature: TransactionSignature;
11
+ commitment: TransactionSignature;
12
+ result: TransactionSignature<TransactionSignature>;
13
+ } | null, TransactionConfirmation | {
14
+ signature: TransactionSignature;
15
+ commitment: TransactionSignature;
16
+ result: TransactionSignature<TransactionSignature>;
17
+ } | null>;
18
+ status: vue.Ref<TransactionConfirmationStatus, TransactionConfirmationStatus>;
19
+ loading: vue.Ref<boolean, boolean>;
20
+ error: vue.Ref<unknown, unknown>;
21
+ confirm: (nextSignature: TransactionSignature, options?: ConfirmTransactionOptions) => Promise<TransactionConfirmation>;
22
+ reset: () => void;
23
+ };
24
+
25
+ export { getConfirmedTransactionStatus, useTransactionConfirmation };
26
+ export type { TransactionConfirmationStatus };
@@ -0,0 +1,6 @@
1
+ export { g as getConfirmedTransactionStatus, u as useTransactionConfirmation } from './shared/vue.jOsz34kz.mjs';
2
+ import '@vue-solana/core/transaction';
3
+ import 'vue';
4
+ import './shared/vue.DlEAL2G8.mjs';
5
+ import './shared/vue.BqDzSepb.mjs';
6
+ import './shared/vue.1M_c5FWA.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -65,6 +65,11 @@
65
65
  "import": "./dist/useTransaction.mjs",
66
66
  "require": "./dist/useTransaction.cjs"
67
67
  },
68
+ "./useTransactionConfirmation": {
69
+ "types": "./dist/useTransactionConfirmation.d.ts",
70
+ "import": "./dist/useTransactionConfirmation.mjs",
71
+ "require": "./dist/useTransactionConfirmation.cjs"
72
+ },
68
73
  "./useSignAndSendTransaction": {
69
74
  "types": "./dist/useSignAndSendTransaction.d.ts",
70
75
  "import": "./dist/useSignAndSendTransaction.mjs",
@@ -78,7 +83,7 @@
78
83
  "access": "public"
79
84
  },
80
85
  "dependencies": {
81
- "@vue-solana/core": "0.4.2"
86
+ "@vue-solana/core": "0.5.0"
82
87
  },
83
88
  "peerDependencies": {
84
89
  "@solana/web3-compat": "^0.0.21",
@@ -1,24 +0,0 @@
1
- import { signAndSendTransaction } from '@vue-solana/core/transaction';
2
- import { u as useConnection } from './vue.DlEAL2G8.mjs';
3
- import { u as useWallet } from './vue.DYf_CRDv.mjs';
4
- import { u as useTransaction } from './vue.gLqkzJY4.mjs';
5
-
6
- const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
7
- function useSignAndSendTransaction() {
8
- const connection = useConnection();
9
- const { wallet } = useWallet();
10
- return useTransaction(
11
- (transaction, options) => {
12
- if (!wallet.value) {
13
- return Promise.reject(new Error("No Solana wallet is configured"));
14
- }
15
- return signAndSendTransaction(connection, wallet.value, transaction, options);
16
- },
17
- {
18
- timeoutMs: SIGN_AND_SEND_TIMEOUT_MS,
19
- timeoutMessage: "Wallet transaction did not return a result. Check your wallet or explorer for the final status."
20
- }
21
- );
22
- }
23
-
24
- export { useSignAndSendTransaction as u };
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- const transaction = require('@vue-solana/core/transaction');
4
- const useConnection = require('./vue.CwhEmATP.cjs');
5
- const useWallet = require('./vue.CwPjPFN6.cjs');
6
- const useTransaction = require('./vue.DQi38JeF.cjs');
7
-
8
- const SIGN_AND_SEND_TIMEOUT_MS = 12e4;
9
- function useSignAndSendTransaction() {
10
- const connection = useConnection.useConnection();
11
- const { wallet } = useWallet.useWallet();
12
- return useTransaction.useTransaction(
13
- (transaction$1, options) => {
14
- if (!wallet.value) {
15
- return Promise.reject(new Error("No Solana wallet is configured"));
16
- }
17
- return transaction.signAndSendTransaction(connection, wallet.value, transaction$1, options);
18
- },
19
- {
20
- timeoutMs: SIGN_AND_SEND_TIMEOUT_MS,
21
- timeoutMessage: "Wallet transaction did not return a result. Check your wallet or explorer for the final status."
22
- }
23
- );
24
- }
25
-
26
- exports.useSignAndSendTransaction = useSignAndSendTransaction;