@vue-solana/core 4.1.10 → 4.1.12

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
@@ -244,6 +244,7 @@ Direct subpaths:
244
244
  | `isSolanaMobileWalletSupported()` | Android-support gate used to decide whether to lazy-load the MWA module. |
245
245
  | `getSolanaIosWallets(options?)` | Builds iOS browser wallet entries (Phantom, Solflare, Backpack) as universal links. |
246
246
  | `handleSolanaIosWalletCallback()` | Completes a pending iOS wallet deep-link callback after redirect. |
247
+ | `waitForRedirect(options?)` | Waits for an iOS wallet redirect that reloads the page; intentionally never resolves in-page. Rejects with `REDIRECT_TIMEOUT` after `timeoutMs` (default 10 minutes) or with the signal's reason on abort. |
247
248
  | `adaptSolanaStandardWallet(wallet)` | Adapts a Solana Wallet Standard wallet into `SolanaWallet`. |
248
249
  | `disconnectSolanaStandardWallet(walletInfo)` | Disconnects a discovered Wallet Standard wallet through its own `standard:disconnect` feature, without adapting it. Resolves `false` if the wallet has no disconnect feature, and ignores failures after a 2 s timeout. |
249
250
  | `getRegisteredSolanaWallets()` | Returns the Wallet Standard wallets currently registered in the app. |
package/dist/address.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  import { isAddress, address } from '@solana/kit';
2
2
  import { createSolanaError } from './errors.mjs';
3
3
 
4
+ const MAX_ADDRESS_INPUT_DEPTH = 32;
4
5
  function parseAddress(value) {
5
- const input = toAddressInput(value);
6
+ const input = toAddressInput(value, 0);
6
7
  if (!input) {
7
8
  return null;
8
9
  }
@@ -15,18 +16,24 @@ function parseAddress(value) {
15
16
  throw createSolanaError("INVALID_ADDRESS", "Invalid Solana address", { cause });
16
17
  }
17
18
  }
18
- function toAddressInput(value) {
19
+ function toAddressInput(value, depth) {
19
20
  if (!value) {
20
21
  return null;
21
22
  }
23
+ if (depth > MAX_ADDRESS_INPUT_DEPTH) {
24
+ throw createSolanaError(
25
+ "INVALID_ADDRESS",
26
+ `Invalid Solana address: input nests more than ${MAX_ADDRESS_INPUT_DEPTH} levels (possible cycle)`
27
+ );
28
+ }
22
29
  if (typeof value === "function") {
23
- return toAddressInput(value());
30
+ return toAddressInput(value(), depth + 1);
24
31
  }
25
32
  if (typeof value === "string") {
26
33
  return value;
27
34
  }
28
35
  if (typeof value === "object" && value !== null && "value" in value) {
29
- return toAddressInput(value.value);
36
+ return toAddressInput(value.value, depth + 1);
30
37
  }
31
38
  throw createSolanaError(
32
39
  "INVALID_ADDRESS",
@@ -52,10 +52,39 @@ declare function isSolanaIosBrowserWalletSupported(): boolean;
52
52
  declare function isIosBrowser(): boolean;
53
53
  declare function getDefaultIosWalletAppIdentity(): SolanaIosWalletAppIdentity;
54
54
  declare function getDefaultIosWalletRedirectUrl(): string;
55
+ interface WaitForRedirectOptions {
56
+ /**
57
+ * Milliseconds to wait for the wallet to redirect back before rejecting
58
+ * with `REDIRECT_TIMEOUT`. Defaults to 10 minutes, matching the pending
59
+ * request TTL (`PENDING_REQUEST_TTL_MS` in `storage.ts`).
60
+ */
61
+ timeoutMs?: number;
62
+ /**
63
+ * Rejects without further waiting when the caller's own `AbortSignal`
64
+ * fires. An aborted wait rejects with the signal's reason (an
65
+ * `AbortError` by default) rather than a timeout error — including when the
66
+ * signal is already aborted at call time.
67
+ */
68
+ signal?: AbortSignal;
69
+ }
70
+ /**
71
+ * Settles when the iOS wallet redirects back to the app and the page reloads
72
+ * — which is the only way it settles on its own. The reload path runs
73
+ * `handleSolanaIosWalletCallback()` at bootstrap and reads the stored
74
+ * session/pending request, so this promise intentionally never resolves
75
+ * in-page: it only rejects on `timeoutMs` / `signal` so callers can reset
76
+ * `connecting` state instead of hanging forever.
77
+ *
78
+ * Invalid options (`timeoutMs`) throw synchronously with `INVALID_INPUT`. An
79
+ * aborted `signal` always *rejects* — a pre-aborted signal does not throw
80
+ * before the promise exists, so `.catch()` handles every abort path the same
81
+ * way.
82
+ */
83
+ declare function waitForRedirect<T = never>(options?: WaitForRedirectOptions): Promise<T>;
55
84
 
56
85
  declare function handleSolanaIosWalletCallback(options?: {
57
86
  clearUrl?: boolean;
58
87
  }): IosWalletCallbackResult | null;
59
88
 
60
- export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo };
61
- export type { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity };
89
+ export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo, waitForRedirect };
90
+ export type { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, WaitForRedirectOptions };
@@ -68,8 +68,11 @@ function waitForRedirect(options = {}) {
68
68
  `Invalid redirect timeout: expected a non-negative number of milliseconds, received ${String(timeoutMs)}`
69
69
  );
70
70
  }
71
- signal?.throwIfAborted();
72
71
  return new Promise((_, reject) => {
72
+ if (signal?.aborted) {
73
+ reject(signal.reason);
74
+ return;
75
+ }
73
76
  const timeoutId = setTimeout(() => {
74
77
  signal?.removeEventListener("abort", onAbort);
75
78
  reject(
@@ -676,4 +679,4 @@ function getIosWalletDefinition(walletInfo) {
676
679
  return walletInfo.wallet;
677
680
  }
678
681
 
679
- export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo };
682
+ export { adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo, waitForRedirect };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/core",
3
- "version": "4.1.10",
3
+ "version": "4.1.12",
4
4
  "description": "Framework-agnostic primitives for Vue Solana libraries.",
5
5
  "license": "MIT",
6
6
  "keywords": [