UNPKG

@tronweb3/tronwallet-adapter-bybit

Version:

Wallet adapter for Bybit Wallet extension and Bybit Wallet app.

25 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isBybitApp = void 0; exports.supportBybitWallet = supportBybitWallet; exports.isInBybitApp = isInBybitApp; exports.openBybitWallet = openBybitWallet; const tronwallet_abstract_adapter_1 = require("@tronweb3/tronwallet-abstract-adapter"); function supportBybitWallet() { return !!(window.bybitWallet && window.bybitWallet.tronLink); } exports.isBybitApp = typeof navigator !== 'undefined' && /bybit_app/i.test(navigator.userAgent); function isInBybitApp() { if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { return /bybit_app/i.test(window.navigator.userAgent); } return false; } function openBybitWallet() { if (!isInBybitApp() && (0, tronwallet_abstract_adapter_1.isInMobileBrowser)()) { window.location.href = `https://app.bybit.com/inapp?by_dp=${encodeURIComponent('bybitapp://open/route?targetUrl=by%3A%2F%2Fweb3%2Ftab%2Findex%3Findex%3D0')}&by_web_link=${encodeURIComponent(window.location.href)}`; return true; } return false; } //# sourceMappingURL=utils.js.map