@solana/wallet-adapter-base
Advanced tools
Comparing version 0.9.19 to 0.9.20
@@ -15,3 +15,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.scopePollingDetectionStrategy = exports.BaseWalletAdapter = exports.WalletReadyState = exports.EventEmitter = void 0; | ||
exports.isIosAndRedirectable = exports.scopePollingDetectionStrategy = exports.BaseWalletAdapter = exports.WalletReadyState = exports.EventEmitter = void 0; | ||
const eventemitter3_1 = __importDefault(require("eventemitter3")); | ||
@@ -53,2 +53,7 @@ exports.EventEmitter = eventemitter3_1.default; | ||
} | ||
autoConnect() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.connect(); | ||
}); | ||
} | ||
prepareTransaction(transaction, connection, options = {}) { | ||
@@ -107,2 +112,26 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.scopePollingDetectionStrategy = scopePollingDetectionStrategy; | ||
/** | ||
* Users on iOS can be redirected into a wallet's in-app browser automatically, | ||
* if that wallet has a universal link configured to do so | ||
* But should not be redirected from within a webview, eg. if they're already | ||
* inside a wallet's browser | ||
* This function can be used to identify users who are on iOS and can be redirected | ||
* | ||
* @returns true if the user can be redirected | ||
*/ | ||
function isIosAndRedirectable() { | ||
// SSR: return false | ||
if (!navigator) | ||
return false; | ||
const userAgent = navigator.userAgent.toLowerCase(); | ||
// if on iOS the user agent will contain either iPhone or iPad | ||
// caveat: if requesting desktop site then this won't work | ||
const isIos = userAgent.includes('iphone') || userAgent.includes('ipad'); | ||
// if in a webview then it will not include Safari | ||
// note that other iOS browsers also include Safari | ||
// so we will redirect only if Safari is also included | ||
const isSafari = userAgent.includes('safari'); | ||
return isIos && isSafari; | ||
} | ||
exports.isIosAndRedirectable = isIosAndRedirectable; | ||
//# sourceMappingURL=adapter.js.map |
@@ -37,2 +37,5 @@ import EventEmitter from 'eventemitter3'; | ||
} | ||
async autoConnect() { | ||
await this.connect(); | ||
} | ||
async prepareTransaction(transaction, connection, options = {}) { | ||
@@ -87,2 +90,25 @@ const publicKey = this.publicKey; | ||
} | ||
/** | ||
* Users on iOS can be redirected into a wallet's in-app browser automatically, | ||
* if that wallet has a universal link configured to do so | ||
* But should not be redirected from within a webview, eg. if they're already | ||
* inside a wallet's browser | ||
* This function can be used to identify users who are on iOS and can be redirected | ||
* | ||
* @returns true if the user can be redirected | ||
*/ | ||
export function isIosAndRedirectable() { | ||
// SSR: return false | ||
if (!navigator) | ||
return false; | ||
const userAgent = navigator.userAgent.toLowerCase(); | ||
// if on iOS the user agent will contain either iPhone or iPad | ||
// caveat: if requesting desktop site then this won't work | ||
const isIos = userAgent.includes('iphone') || userAgent.includes('ipad'); | ||
// if in a webview then it will not include Safari | ||
// note that other iOS browsers also include Safari | ||
// so we will redirect only if Safari is also included | ||
const isSafari = userAgent.includes('safari'); | ||
return isIos && isSafari; | ||
} | ||
//# sourceMappingURL=adapter.js.map |
@@ -27,2 +27,3 @@ import type { Connection, PublicKey, SendOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js'; | ||
supportedTransactionVersions?: SupportedTransactionVersions; | ||
autoConnect(): Promise<void>; | ||
connect(): Promise<void>; | ||
@@ -70,2 +71,3 @@ disconnect(): Promise<void>; | ||
get connected(): boolean; | ||
autoConnect(): Promise<void>; | ||
abstract connect(): Promise<void>; | ||
@@ -77,2 +79,12 @@ abstract disconnect(): Promise<void>; | ||
export declare function scopePollingDetectionStrategy(detect: () => boolean): void; | ||
/** | ||
* Users on iOS can be redirected into a wallet's in-app browser automatically, | ||
* if that wallet has a universal link configured to do so | ||
* But should not be redirected from within a webview, eg. if they're already | ||
* inside a wallet's browser | ||
* This function can be used to identify users who are on iOS and can be redirected | ||
* | ||
* @returns true if the user can be redirected | ||
*/ | ||
export declare function isIosAndRedirectable(): boolean; | ||
//# sourceMappingURL=adapter.d.ts.map |
{ | ||
"name": "@solana/wallet-adapter-base", | ||
"version": "0.9.19", | ||
"version": "0.9.20", | ||
"author": "Solana Maintainers <maintainers@solana.foundation>", | ||
@@ -5,0 +5,0 @@ "repository": "https://github.com/solana-labs/wallet-adapter", |
@@ -34,2 +34,3 @@ import type { Connection, PublicKey, SendOptions, Signer, Transaction, TransactionSignature } from '@solana/web3.js'; | ||
autoConnect(): Promise<void>; | ||
connect(): Promise<void>; | ||
@@ -92,2 +93,6 @@ disconnect(): Promise<void>; | ||
async autoConnect() { | ||
await this.connect(); | ||
} | ||
abstract connect(): Promise<void>; | ||
@@ -166,1 +171,28 @@ abstract disconnect(): Promise<void>; | ||
} | ||
/** | ||
* Users on iOS can be redirected into a wallet's in-app browser automatically, | ||
* if that wallet has a universal link configured to do so | ||
* But should not be redirected from within a webview, eg. if they're already | ||
* inside a wallet's browser | ||
* This function can be used to identify users who are on iOS and can be redirected | ||
* | ||
* @returns true if the user can be redirected | ||
*/ | ||
export function isIosAndRedirectable() { | ||
// SSR: return false | ||
if (!navigator) return false; | ||
const userAgent = navigator.userAgent.toLowerCase(); | ||
// if on iOS the user agent will contain either iPhone or iPad | ||
// caveat: if requesting desktop site then this won't work | ||
const isIos = userAgent.includes('iphone') || userAgent.includes('ipad'); | ||
// if in a webview then it will not include Safari | ||
// note that other iOS browsers also include Safari | ||
// so we will redirect only if Safari is also included | ||
const isSafari = userAgent.includes('safari'); | ||
return isIos && isSafari; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85661
1212