UNPKG

@tronweb3/tronwallet-adapter-okxwallet

Version:

Wallet adapter for Okx Wallet extension and Okx Wallet app.

25 lines 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isOKApp = void 0; exports.supportOkxWallet = supportOkxWallet; exports.isInOKApp = isInOKApp; exports.openOkxWallet = openOkxWallet; const tronwallet_abstract_adapter_1 = require("@tronweb3/tronwallet-abstract-adapter"); function supportOkxWallet() { return !!(window.okxwallet && window.okxwallet.tronLink); } exports.isOKApp = typeof navigator !== 'undefined' && /OKApp/i.test(navigator.userAgent); function isInOKApp() { if (typeof window !== 'undefined' && typeof window.navigator !== 'undefined') { return /OKApp/i.test(window.navigator.userAgent); } return false; } function openOkxWallet() { if (!isInOKApp() && (0, tronwallet_abstract_adapter_1.isInMobileBrowser)()) { window.location.href = 'okx://wallet/dapp/url?dappUrl=' + encodeURIComponent(window.location.href); return true; } return false; } //# sourceMappingURL=utils.js.map