Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@onekeyfe/cross-inpage-provider-core

Package Overview
Dependencies
Maintainers
2
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@onekeyfe/cross-inpage-provider-core - npm Package Compare versions

Comparing version 1.1.58-alpha.0 to 1.1.58-alpha.1

dist/cjs/notification/icon.js

3

dist/cjs/consts.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WALLET_INFO_LOACAL_KEY = exports.DEBUG_LOGGER_STORAGE_KEY = exports.EXT_PORT_UI_TO_BG = exports.EXT_PORT_CS_TO_BG = exports.EXT_PORT_OFFSCREEN_TO_BG = exports.JS_BRIDGE_MESSAGE_DIRECTION = exports.JS_BRIDGE_MESSAGE_EXT_PING = exports.JS_BRIDGE_MESSAGE_EXT_CHANNEL = exports.JS_BRIDGE_MESSAGE_IPC_CHANNEL = void 0;
exports.WALLET_INFO_LOACAL_KEY_V5 = exports.WALLET_INFO_LOACAL_KEY = exports.DEBUG_LOGGER_STORAGE_KEY = exports.EXT_PORT_UI_TO_BG = exports.EXT_PORT_CS_TO_BG = exports.EXT_PORT_OFFSCREEN_TO_BG = exports.JS_BRIDGE_MESSAGE_DIRECTION = exports.JS_BRIDGE_MESSAGE_EXT_PING = exports.JS_BRIDGE_MESSAGE_EXT_CHANNEL = exports.JS_BRIDGE_MESSAGE_IPC_CHANNEL = void 0;
exports.JS_BRIDGE_MESSAGE_IPC_CHANNEL = 'onekey@JS_BRIDGE_MESSAGE_IPC_CHANNEL';

@@ -16,1 +16,2 @@ exports.JS_BRIDGE_MESSAGE_EXT_CHANNEL = 'onekey@JS_BRIDGE_MESSAGE_EXT_CHANNEL';

exports.WALLET_INFO_LOACAL_KEY = 'onekey_wallet_info_local_key';
exports.WALLET_INFO_LOACAL_KEY_V5 = "onekey_wallet_info_local_key_v5";

@@ -38,2 +38,3 @@ "use strict";

__exportStar(require("./walletProperty"), exports);
__exportStar(require("./notification"), exports);
const consts = __importStar(require("./consts"));

@@ -40,0 +41,0 @@ exports.consts = consts;

@@ -98,3 +98,3 @@ "use strict";

try {
localStorage.setItem(consts_1.WALLET_INFO_LOACAL_KEY, JSON.stringify(result.walletInfo));
localStorage.setItem(consts_1.WALLET_INFO_LOACAL_KEY_V5, JSON.stringify(result.walletInfo));
}

@@ -101,0 +101,0 @@ catch (e) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const version = '1.1.58-alpha.0';
const version = '1.1.58-alpha.1';
const versionBuild = '2020-0101-1';

@@ -5,0 +5,0 @@ exports.default = {

"use strict";
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */

@@ -19,13 +20,24 @@ /* eslint-disable @typescript-eslint/no-unsafe-assignment */

})(ISpecialPropertyProviderNamesReflection = exports.ISpecialPropertyProviderNamesReflection || (exports.ISpecialPropertyProviderNamesReflection = {}));
function checkWalletSwitchEnable(property) {
function checkWalletSwitchEnable() {
try {
const walletInfoLocalStr = localStorage.getItem(consts_1.WALLET_INFO_LOACAL_KEY);
const walletInfoLocalStr = localStorage.getItem(consts_1.WALLET_INFO_LOACAL_KEY_V5);
const walletInfoLocal = walletInfoLocalStr ? JSON.parse(walletInfoLocalStr) : null;
if (walletInfoLocal && walletInfoLocal.walletSwitchConfig) {
const { enable, disable } = walletInfoLocal.walletSwitchConfig;
const enableList = enable || [];
const disableList = disable || [];
return ((enableList.includes(property) && !disableList.includes(property)) ||
(!enableList.includes(property) && !disableList.includes(property)));
console.log('===>: walletInfoLocal: ', walletInfoLocal);
if (!(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.isDefaultWallet)) {
if (process.env.NODE_ENV !== 'production') {
console.log('OneKey is not default wallet');
}
return false;
}
if (Array.isArray(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.excludedDappList)) {
const currentOrigin = window.location.origin;
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
if (walletInfoLocal.excludedDappList.includes(currentOrigin)) {
if (process.env.NODE_ENV !== 'production') {
console.log('skip inject web3 provider: ', currentOrigin);
}
return false;
}
}
return true;
}

@@ -42,3 +54,3 @@ catch (e) {

try {
const walletInfoLocalStr = localStorage.getItem(consts_1.WALLET_INFO_LOACAL_KEY);
const walletInfoLocalStr = localStorage.getItem(consts_1.WALLET_INFO_LOACAL_KEY_V5);
const walletInfoLocal = walletInfoLocalStr ? JSON.parse(walletInfoLocalStr) : null;

@@ -55,3 +67,3 @@ return !!(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.platformEnv.isExtension);

var _a;
if (!checkWalletSwitchEnable(property))
if (!checkWalletSwitchEnable())
return;

@@ -58,0 +70,0 @@ const enable = checkEnableDefineProperty(property);

@@ -13,1 +13,2 @@ export declare const JS_BRIDGE_MESSAGE_IPC_CHANNEL = "onekey@JS_BRIDGE_MESSAGE_IPC_CHANNEL";

export declare const WALLET_INFO_LOACAL_KEY = "onekey_wallet_info_local_key";
export declare const WALLET_INFO_LOACAL_KEY_V5 = "onekey_wallet_info_local_key_v5";

@@ -13,1 +13,2 @@ export const JS_BRIDGE_MESSAGE_IPC_CHANNEL = 'onekey@JS_BRIDGE_MESSAGE_IPC_CHANNEL';

export const WALLET_INFO_LOACAL_KEY = 'onekey_wallet_info_local_key';
export const WALLET_INFO_LOACAL_KEY_V5 = "onekey_wallet_info_local_key_v5";

@@ -10,2 +10,3 @@ export * from './JsBridgeBase';

export * from './walletProperty';
export * from './notification';
import * as consts from './consts';

@@ -12,0 +13,0 @@ export { consts };

@@ -10,2 +10,3 @@ export * from './JsBridgeBase';

export * from './walletProperty';
export * from './notification';
import * as consts from './consts';

@@ -12,0 +13,0 @@ export { consts };

@@ -16,3 +16,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

import versionInfo from './versionInfo';
import { WALLET_INFO_LOACAL_KEY } from './consts';
import { WALLET_INFO_LOACAL_KEY_V5 } from './consts';
const METHODS = {

@@ -93,3 +93,3 @@ wallet_getConnectWalletInfo: 'wallet_getConnectWalletInfo',

try {
localStorage.setItem(WALLET_INFO_LOACAL_KEY, JSON.stringify(result.walletInfo));
localStorage.setItem(WALLET_INFO_LOACAL_KEY_V5, JSON.stringify(result.walletInfo));
}

@@ -96,0 +96,0 @@ catch (e) {

@@ -1,2 +0,2 @@

const version = '1.1.58-alpha.0';
const version = '1.1.58-alpha.1';
const versionBuild = '2020-0101-1';

@@ -3,0 +3,0 @@ export default {

@@ -12,3 +12,3 @@ /**

}
export declare function checkWalletSwitchEnable(property: string): boolean;
export declare function checkWalletSwitchEnable(): boolean;
export declare function checkEnableDefineProperty(property: string): boolean;

@@ -15,0 +15,0 @@ export declare function defineWindowProperty(property: string, provider: unknown, options?: {

@@ -0,4 +1,5 @@

/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { WALLET_INFO_LOACAL_KEY } from './consts';
import { WALLET_INFO_LOACAL_KEY_V5 } from './consts';
/**

@@ -16,13 +17,24 @@ * An enumeration mapping specific blockchain provider names to their corresponding blockchain identifiers.

})(ISpecialPropertyProviderNamesReflection || (ISpecialPropertyProviderNamesReflection = {}));
export function checkWalletSwitchEnable(property) {
export function checkWalletSwitchEnable() {
try {
const walletInfoLocalStr = localStorage.getItem(WALLET_INFO_LOACAL_KEY);
const walletInfoLocalStr = localStorage.getItem(WALLET_INFO_LOACAL_KEY_V5);
const walletInfoLocal = walletInfoLocalStr ? JSON.parse(walletInfoLocalStr) : null;
if (walletInfoLocal && walletInfoLocal.walletSwitchConfig) {
const { enable, disable } = walletInfoLocal.walletSwitchConfig;
const enableList = enable || [];
const disableList = disable || [];
return ((enableList.includes(property) && !disableList.includes(property)) ||
(!enableList.includes(property) && !disableList.includes(property)));
console.log('===>: walletInfoLocal: ', walletInfoLocal);
if (!(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.isDefaultWallet)) {
if (process.env.NODE_ENV !== 'production') {
console.log('OneKey is not default wallet');
}
return false;
}
if (Array.isArray(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.excludedDappList)) {
const currentOrigin = window.location.origin;
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
if (walletInfoLocal.excludedDappList.includes(currentOrigin)) {
if (process.env.NODE_ENV !== 'production') {
console.log('skip inject web3 provider: ', currentOrigin);
}
return false;
}
}
return true;
}

@@ -38,3 +50,3 @@ catch (e) {

try {
const walletInfoLocalStr = localStorage.getItem(WALLET_INFO_LOACAL_KEY);
const walletInfoLocalStr = localStorage.getItem(WALLET_INFO_LOACAL_KEY_V5);
const walletInfoLocal = walletInfoLocalStr ? JSON.parse(walletInfoLocalStr) : null;

@@ -50,3 +62,3 @@ return !!(walletInfoLocal === null || walletInfoLocal === void 0 ? void 0 : walletInfoLocal.platformEnv.isExtension);

var _a;
if (!checkWalletSwitchEnable(property))
if (!checkWalletSwitchEnable())
return;

@@ -53,0 +65,0 @@ const enable = checkEnableDefineProperty(property);

{
"name": "@onekeyfe/cross-inpage-provider-core",
"version": "1.1.58-alpha.0",
"version": "1.1.58-alpha.1",
"keywords": [

@@ -32,5 +32,5 @@ "cross-inpage-provider"

"dependencies": {
"@onekeyfe/cross-inpage-provider-errors": "1.1.58-alpha.0",
"@onekeyfe/cross-inpage-provider-events": "1.1.58-alpha.0",
"@onekeyfe/cross-inpage-provider-types": "1.1.58-alpha.0",
"@onekeyfe/cross-inpage-provider-errors": "1.1.58-alpha.1",
"@onekeyfe/cross-inpage-provider-events": "1.1.58-alpha.1",
"@onekeyfe/cross-inpage-provider-types": "1.1.58-alpha.1",
"events": "^3.3.0",

@@ -40,3 +40,3 @@ "lodash": "^4.17.21",

},
"gitHead": "41a844fb8a7167a1a0414b7ced577730d792a93c"
"gitHead": "16470ca312556502f09dc62c6ac83c74a98b79a6"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc