@vue-solana/core 4.1.3 → 4.1.4
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/mobile-wallet.d.ts +8 -0
- package/dist/mobile-wallet.mjs +14 -4
- package/package.json +1 -1
package/dist/mobile-wallet.d.ts
CHANGED
|
@@ -33,6 +33,14 @@ declare function createChainScopedAuthorizationCache(chains: readonly SolanaChai
|
|
|
33
33
|
* host-side registration. Intended for test/HMR reset only.
|
|
34
34
|
*/
|
|
35
35
|
declare function unregisterSolanaMobileWallet(): void;
|
|
36
|
+
/**
|
|
37
|
+
* The identity MWA sends with every `authorize`, including the re-authorization
|
|
38
|
+
* that precedes each signing request. Wallets bind the auth token to it, so it
|
|
39
|
+
* must not change between page loads: `document.title` did (per route, per
|
|
40
|
+
* locale, and empty on a client-only route at registration time), and a session
|
|
41
|
+
* restored under one title was then re-authorized under another, which Phantom
|
|
42
|
+
* answered by opening without a prompt. Pass `appIdentity` to pin it explicitly.
|
|
43
|
+
*/
|
|
36
44
|
declare function getDefaultMobileWalletAppIdentity(): SolanaMobileWalletAppIdentity;
|
|
37
45
|
|
|
38
46
|
export { createChainScopedAuthorizationCache, getDefaultMobileWalletAppIdentity, registerSolanaMobileWallet, unregisterSolanaMobileWallet };
|
package/dist/mobile-wallet.mjs
CHANGED
|
@@ -61,11 +61,18 @@ function getDefaultMobileWalletAppIdentity() {
|
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
63
|
return {
|
|
64
|
-
name:
|
|
64
|
+
name: getDocumentAppName(),
|
|
65
65
|
uri: window.location.origin,
|
|
66
66
|
icon: getDocumentIconPath()
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
+
function getDocumentAppName() {
|
|
70
|
+
const name = getMetaContent('meta[name="application-name"]') ?? getMetaContent('meta[property="og:site_name"]') ?? window.location.hostname;
|
|
71
|
+
return name || "Vue Solana App";
|
|
72
|
+
}
|
|
73
|
+
function getMetaContent(selector) {
|
|
74
|
+
return document.querySelector(selector)?.content.trim() || void 0;
|
|
75
|
+
}
|
|
69
76
|
function getDocumentIconPath() {
|
|
70
77
|
const icon = document.querySelector(
|
|
71
78
|
'link[rel="icon"], link[rel="shortcut icon"], link[rel="apple-touch-icon"]'
|
|
@@ -73,10 +80,13 @@ function getDocumentIconPath() {
|
|
|
73
80
|
if (!icon?.href) {
|
|
74
81
|
return void 0;
|
|
75
82
|
}
|
|
76
|
-
if (icon.href.startsWith(
|
|
77
|
-
return icon.href
|
|
83
|
+
if (icon.href.startsWith("data:")) {
|
|
84
|
+
return icon.href;
|
|
85
|
+
}
|
|
86
|
+
if (icon.href.startsWith(`${window.location.origin}/`)) {
|
|
87
|
+
return icon.href.slice(window.location.origin.length + 1);
|
|
78
88
|
}
|
|
79
|
-
return
|
|
89
|
+
return void 0;
|
|
80
90
|
}
|
|
81
91
|
|
|
82
92
|
export { createChainScopedAuthorizationCache, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet, unregisterSolanaMobileWallet };
|