diff --git a/packages/core/src/walletProperty.ts b/packages/core/src/walletProperty.ts index 78d6bfa4..8122b57c 100644 --- a/packages/core/src/walletProperty.ts +++ b/packages/core/src/walletProperty.ts @@ -93,10 +93,13 @@ export function defineWindowProperty( options?: { enumerable?: boolean; disablePlatform?: IPlatformType[]; + alwaysInject?: boolean; }, ) { - if (!checkPlatformEnable(options?.disablePlatform)) return; - if (!checkWalletSwitchEnable()) return; + if (!options?.alwaysInject) { + if (!checkPlatformEnable(options?.disablePlatform)) return; + if (!checkWalletSwitchEnable()) return; + } const enable = checkEnableDefineProperty(property); const proxyProvider = new Proxy(provider as object, { defineProperty(target, property, attributes) { diff --git a/packages/providers/inpage-providers-hub/src/injectWeb3Provider.ts b/packages/providers/inpage-providers-hub/src/injectWeb3Provider.ts index 6004eb70..d01ac8b9 100644 --- a/packages/providers/inpage-providers-hub/src/injectWeb3Provider.ts +++ b/packages/providers/inpage-providers-hub/src/injectWeb3Provider.ts @@ -152,7 +152,7 @@ function injectWeb3Provider(): unknown { algorand, }; - defineWindowProperty('$onekey', $onekey, { enumerable: true }); + defineWindowProperty('$onekey', $onekey, { enumerable: true, alwaysInject: true }); const martianProxy = new Proxy(martian, { get: (target, property, ...args) => {