@vue-solana/vue 4.1.9 → 4.1.11

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/dist/index.mjs CHANGED
@@ -18,7 +18,7 @@ export { u as useSignAndSendTransactions } from './shared/vue.sPcsjyKU.mjs';
18
18
  export { u as useSignatureStatus } from './shared/vue.Bu2cQ690.mjs';
19
19
  export { u as useSignIn } from './shared/vue.SeuJipQ8.mjs';
20
20
  export { t as tryUseSolana, u as useSolana } from './shared/vue.CcOZ9858.mjs';
21
- export { u as useSolanaQrScanner } from './shared/vue.D0MQeVy2.mjs';
21
+ export { u as useSolanaQrScanner } from './shared/vue.BF7Vn27B.mjs';
22
22
  export { u as useSolanaQrCode } from './shared/vue.Bo4nAja_.mjs';
23
23
  export { u as useSolanaPay } from './shared/vue.gvgOc5rc.mjs';
24
24
  export { u as useSolanaPayConfirmation } from './shared/vue.MN-kcudq.mjs';
@@ -1,7 +1,7 @@
1
1
  import { ref, shallowRef, onUnmounted } from 'vue';
2
2
  import { parseURL } from '@vue-solana/core/solana-pay';
3
3
 
4
- const DECODE_SIZE = 720;
4
+ const DECODE_SIZES = [360, 480];
5
5
  async function createQrCodeDetector() {
6
6
  const BarcodeDetectorCtor = globalThis.BarcodeDetector;
7
7
  if (!BarcodeDetectorCtor) {
@@ -29,6 +29,19 @@ async function loadQrDecoder() {
29
29
  return null;
30
30
  }
31
31
  }
32
+ async function enableContinuousFocus(stream) {
33
+ const [track] = stream.getVideoTracks?.() ?? [];
34
+ const capabilities = track?.getCapabilities?.();
35
+ if (!track || !capabilities?.focusMode?.includes("continuous")) {
36
+ return;
37
+ }
38
+ try {
39
+ await track.applyConstraints({
40
+ advanced: [{ focusMode: "continuous" }]
41
+ });
42
+ } catch {
43
+ }
44
+ }
32
45
  function useSolanaQrScanner() {
33
46
  const scanning = ref(false);
34
47
  const result = shallowRef(null);
@@ -85,26 +98,31 @@ function useSolanaQrScanner() {
85
98
  if (!qrDecoder || !side) {
86
99
  return null;
87
100
  }
88
- const size = Math.min(side, DECODE_SIZE);
89
101
  frameCanvas ??= document.createElement("canvas");
90
- frameCanvas.width = size;
91
- frameCanvas.height = size;
92
- const context = frameCanvas.getContext("2d", { willReadFrequently: true });
93
- if (!context) {
94
- return null;
102
+ for (const size of new Set(DECODE_SIZES.map((decodeSize) => Math.min(side, decodeSize)))) {
103
+ frameCanvas.width = size;
104
+ frameCanvas.height = size;
105
+ const context = frameCanvas.getContext("2d", { willReadFrequently: true });
106
+ if (!context) {
107
+ return null;
108
+ }
109
+ context.drawImage(
110
+ video,
111
+ (video.videoWidth - side) / 2,
112
+ (video.videoHeight - side) / 2,
113
+ side,
114
+ side,
115
+ 0,
116
+ 0,
117
+ size,
118
+ size
119
+ );
120
+ const text = qrDecoder(context.getImageData(0, 0, size, size).data, size, size);
121
+ if (text) {
122
+ return text;
123
+ }
95
124
  }
96
- context.drawImage(
97
- video,
98
- (video.videoWidth - side) / 2,
99
- (video.videoHeight - side) / 2,
100
- side,
101
- side,
102
- 0,
103
- 0,
104
- size,
105
- size
106
- );
107
- return qrDecoder(context.getImageData(0, 0, size, size).data, size, size);
125
+ return null;
108
126
  }
109
127
  async function scanFrame() {
110
128
  if (!videoElement || videoElement.readyState < 2) {
@@ -143,6 +161,7 @@ function useSolanaQrScanner() {
143
161
  mediaStream = await navigator.mediaDevices.getUserMedia({
144
162
  video: { facingMode: "environment", width: { ideal: 1280 }, height: { ideal: 720 } }
145
163
  });
164
+ await enableContinuousFocus(mediaStream);
146
165
  if (videoElement) {
147
166
  videoElement.srcObject = mediaStream;
148
167
  await videoElement.play().catch(() => {
@@ -7,6 +7,14 @@ import * as _solana_kit from '@solana/kit';
7
7
  * in 5.0.0.
8
8
  */
9
9
  declare function useConnection(): Omit<_solana_kit.Client<{
10
+ planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
11
+ abortSignal?: AbortSignal;
12
+ maxInstructionsPerTransaction?: number;
13
+ }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
14
+ planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
15
+ abortSignal?: AbortSignal;
16
+ maxInstructionsPerTransaction?: number;
17
+ }) => Promise<_solana_kit.TransactionPlan>;
10
18
  signTransactions: (input: _solana_kit.InstructionPlanInput | _solana_kit.TransactionPlanInput, config?: {
11
19
  abortSignal?: AbortSignal;
12
20
  maxInstructionsPerTransaction?: number;
@@ -16,14 +24,6 @@ declare function useConnection(): Omit<_solana_kit.Client<{
16
24
  rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
17
25
  getMinimumBalance: (space: number, config?: _solana_kit.GetMinimumBalanceConfig) => Promise<_solana_kit.Lamports>;
18
26
  transactionPlanner: _solana_kit.TransactionPlanner;
19
- planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
20
- abortSignal?: AbortSignal;
21
- maxInstructionsPerTransaction?: number;
22
- }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
23
- planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
24
- abortSignal?: AbortSignal;
25
- maxInstructionsPerTransaction?: number;
26
- }) => Promise<_solana_kit.TransactionPlan>;
27
27
  signTransaction: (input: _solana_kit.InstructionPlanInput | (_solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>) | Readonly<{
28
28
  kind: "single";
29
29
  message: _solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>;
package/dist/useRpc.d.ts CHANGED
@@ -15,6 +15,14 @@ declare function useRpc(): {
15
15
  latestBlockhash: vue.Ref<string | null, string | null>;
16
16
  checkConnection: () => Promise<void>;
17
17
  client: Omit<_solana_kit.Client<{
18
+ planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
19
+ abortSignal?: AbortSignal;
20
+ maxInstructionsPerTransaction?: number;
21
+ }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
22
+ planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
23
+ abortSignal?: AbortSignal;
24
+ maxInstructionsPerTransaction?: number;
25
+ }) => Promise<_solana_kit.TransactionPlan>;
18
26
  signTransactions: (input: _solana_kit.InstructionPlanInput | _solana_kit.TransactionPlanInput, config?: {
19
27
  abortSignal?: AbortSignal;
20
28
  maxInstructionsPerTransaction?: number;
@@ -24,14 +32,6 @@ declare function useRpc(): {
24
32
  rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
25
33
  getMinimumBalance: (space: number, config?: _solana_kit.GetMinimumBalanceConfig) => Promise<_solana_kit.Lamports>;
26
34
  transactionPlanner: _solana_kit.TransactionPlanner;
27
- planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
28
- abortSignal?: AbortSignal;
29
- maxInstructionsPerTransaction?: number;
30
- }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
31
- planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
32
- abortSignal?: AbortSignal;
33
- maxInstructionsPerTransaction?: number;
34
- }) => Promise<_solana_kit.TransactionPlan>;
35
35
  signTransaction: (input: _solana_kit.InstructionPlanInput | (_solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>) | Readonly<{
36
36
  kind: "single";
37
37
  message: _solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>;
@@ -3,6 +3,14 @@ import * as _solana_kit from '@solana/kit';
3
3
 
4
4
  declare function useSolanaClient(): {
5
5
  client: Omit<_solana_kit.Client<{
6
+ planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
7
+ abortSignal?: AbortSignal;
8
+ maxInstructionsPerTransaction?: number;
9
+ }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
10
+ planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
11
+ abortSignal?: AbortSignal;
12
+ maxInstructionsPerTransaction?: number;
13
+ }) => Promise<_solana_kit.TransactionPlan>;
6
14
  signTransactions: (input: _solana_kit.InstructionPlanInput | _solana_kit.TransactionPlanInput, config?: {
7
15
  abortSignal?: AbortSignal;
8
16
  maxInstructionsPerTransaction?: number;
@@ -12,14 +20,6 @@ declare function useSolanaClient(): {
12
20
  rpcSubscriptions: _solana_kit.RpcSubscriptions<_solana_kit.SolanaRpcSubscriptionsApi>;
13
21
  getMinimumBalance: (space: number, config?: _solana_kit.GetMinimumBalanceConfig) => Promise<_solana_kit.Lamports>;
14
22
  transactionPlanner: _solana_kit.TransactionPlanner;
15
- planTransaction: (input: _solana_kit.InstructionPlanInput, config?: {
16
- abortSignal?: AbortSignal;
17
- maxInstructionsPerTransaction?: number;
18
- }) => Promise<_solana_kit.SingleTransactionPlan["message"]>;
19
- planTransactions: (input: _solana_kit.InstructionPlanInput, config?: {
20
- abortSignal?: AbortSignal;
21
- maxInstructionsPerTransaction?: number;
22
- }) => Promise<_solana_kit.TransactionPlan>;
23
23
  signTransaction: (input: _solana_kit.InstructionPlanInput | (_solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>) | Readonly<{
24
24
  kind: "single";
25
25
  message: _solana_kit.TransactionMessage & _solana_kit.TransactionMessageWithFeePayer<string>;
@@ -6,7 +6,7 @@ declare function useSolanaPay(): {
6
6
  requestUrl: vue.ShallowRef<string | null, string | null>;
7
7
  parsedRequest: vue.ShallowRef<unknown, unknown>;
8
8
  reference: vue.ShallowRef<unknown, unknown>;
9
- status: vue.ShallowRef<"confirmed" | "finalized" | "error" | "idle" | "pending" | "found" | "expired", "confirmed" | "finalized" | "error" | "idle" | "pending" | "found" | "expired">;
9
+ status: vue.ShallowRef<"idle" | "error" | "confirmed" | "finalized" | "pending" | "found" | "expired", "idle" | "error" | "confirmed" | "finalized" | "pending" | "found" | "expired">;
10
10
  loading: vue.ShallowRef<boolean, boolean>;
11
11
  error: vue.ShallowRef<unknown, unknown>;
12
12
  createTransferRequest: (input: Record<string, unknown>) => Promise<string>;
@@ -1 +1 @@
1
- export { u as useSolanaQrScanner } from './shared/vue.D0MQeVy2.mjs';
1
+ export { u as useSolanaQrScanner } from './shared/vue.BF7Vn27B.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/vue",
3
- "version": "4.1.9",
3
+ "version": "4.1.11",
4
4
  "description": "Vue plugin and composables for Solana applications.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -195,7 +195,7 @@
195
195
  },
196
196
  "dependencies": {
197
197
  "jsqr": "^1.4.0",
198
- "@vue-solana/core": "4.1.9"
198
+ "@vue-solana/core": "4.1.11"
199
199
  },
200
200
  "peerDependencies": {
201
201
  "vue": "^3.5.0"