@subwallet/extension-inject 0.4.8-0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bundle.js CHANGED
@@ -23,7 +23,14 @@ export function injectEvmExtension(evmProvider) {
23
23
  // small helper with the typescript types, just cast window
24
24
  const windowInject = window; // add our enable function
25
25
 
26
- windowInject.SubWallet = evmProvider;
26
+ if (windowInject.SubWallet) {
27
+ // Provider has been initialized in proxy mode
28
+ windowInject.SubWallet.provider = evmProvider;
29
+ } else {
30
+ // Provider has been initialized in direct mode
31
+ windowInject.SubWallet = evmProvider;
32
+ }
33
+
27
34
  windowInject.dispatchEvent(new Event('subwallet#initialized')); // Publish to global if window.ethereum is not available
28
35
 
29
36
  windowInject.addEventListener('load', () => {
package/cjs/bundle.js CHANGED
@@ -40,7 +40,14 @@ function injectEvmExtension(evmProvider) {
40
40
  // small helper with the typescript types, just cast window
41
41
  const windowInject = window; // add our enable function
42
42
 
43
- windowInject.SubWallet = evmProvider;
43
+ if (windowInject.SubWallet) {
44
+ // Provider has been initialized in proxy mode
45
+ windowInject.SubWallet.provider = evmProvider;
46
+ } else {
47
+ // Provider has been initialized in direct mode
48
+ windowInject.SubWallet = evmProvider;
49
+ }
50
+
44
51
  windowInject.dispatchEvent(new Event('subwallet#initialized')); // Publish to global if window.ethereum is not available
45
52
 
46
53
  windowInject.addEventListener('load', () => {
@@ -11,6 +11,6 @@ const packageInfo = {
11
11
  name: '@subwallet/extension-inject',
12
12
  path: typeof __dirname === 'string' ? __dirname : 'auto',
13
13
  type: 'cjs',
14
- version: '0.4.8-0'
14
+ version: '0.5.1'
15
15
  };
16
16
  exports.packageInfo = packageInfo;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "sideEffects": true,
16
16
  "type": "module",
17
- "version": "0.4.8-0",
17
+ "version": "0.5.1",
18
18
  "main": "./cjs/index.js",
19
19
  "module": "./index.js",
20
20
  "types": "./index.d.ts",
@@ -69,13 +69,13 @@
69
69
  }
70
70
  },
71
71
  "dependencies": {
72
- "@babel/runtime": "^7.16.7",
73
- "@polkadot/rpc-provider": "^7.3.1",
74
- "@polkadot/types": "^7.3.1",
75
- "@polkadot/util": "^8.3.1",
76
- "@polkadot/util-crypto": "^8.3.1",
77
- "@polkadot/x-global": "^8.3.1",
78
- "web3-core": "^1.7.3"
72
+ "@babel/runtime": "^7.18.6",
73
+ "@polkadot/rpc-provider": "^8.11.3",
74
+ "@polkadot/types": "^8.11.3",
75
+ "@polkadot/util": "^9.7.2",
76
+ "@polkadot/util-crypto": "^9.7.2",
77
+ "@polkadot/x-global": "^9.7.2",
78
+ "web3-core": "^1.7.4"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "@polkadot/api": "*"
package/packageInfo.js CHANGED
@@ -5,5 +5,5 @@ export const packageInfo = {
5
5
  name: '@subwallet/extension-inject',
6
6
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
7
7
  type: 'esm',
8
- version: '0.4.8-0'
8
+ version: '0.5.1'
9
9
  };
package/types.d.ts CHANGED
@@ -73,6 +73,7 @@ export interface Injected {
73
73
  signer: InjectedSigner;
74
74
  }
75
75
  export interface EvmProvider {
76
+ provider?: EvmProvider;
76
77
  isMetaMask: boolean;
77
78
  isSubWallet: boolean;
78
79
  version: string;