@subwallet/extension-inject 1.3.31-1 → 1.3.32-0

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.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import type { AuthRequestOption, Injected, InjectOptions } from './types';
1
+ import type { AuthRequestOption, CardanoProvider, Injected, InjectOptions } from './types';
2
2
  import { EIP6963ProviderInfo, EvmProvider } from './types';
3
3
  export { packageInfo } from './packageInfo';
4
4
  export declare function injectExtension(enable: (origin: string, opt?: AuthRequestOption) => Promise<Injected>, { name, version }: InjectOptions): void;
5
5
  export declare function injectEvmExtension(evmProvider: EvmProvider): void;
6
6
  export declare const eip6963ProviderInfo: EIP6963ProviderInfo;
7
7
  export declare const inject6963EIP: (provider: EvmProvider) => void;
8
+ export declare function injectCardanoExtension(cardanoProvider: CardanoProvider): void;
package/bundle.js CHANGED
@@ -87,4 +87,14 @@ export const inject6963EIP = provider => {
87
87
  };
88
88
  window.addEventListener('eip6963:requestProvider', announceProvider);
89
89
  announceProvider();
90
- };
90
+ };
91
+
92
+ // Inject Cardano Provider
93
+ export function injectCardanoExtension(cardanoProvider) {
94
+ const windowInject = window;
95
+ if (!windowInject.cardano) {
96
+ windowInject.cardano = {};
97
+ }
98
+ windowInject.cardano.subwallet = Object.freeze(cardanoProvider);
99
+ windowInject.dispatchEvent(new Event('subwallet#initialized'));
100
+ }
package/cjs/bundle.js CHANGED
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.inject6963EIP = exports.eip6963ProviderInfo = void 0;
7
+ exports.injectCardanoExtension = injectCardanoExtension;
7
8
  exports.injectEvmExtension = injectEvmExtension;
8
9
  exports.injectExtension = injectExtension;
9
10
  Object.defineProperty(exports, "packageInfo", {
@@ -103,4 +104,14 @@ const inject6963EIP = provider => {
103
104
  window.addEventListener('eip6963:requestProvider', announceProvider);
104
105
  announceProvider();
105
106
  };
106
- exports.inject6963EIP = inject6963EIP;
107
+
108
+ // Inject Cardano Provider
109
+ exports.inject6963EIP = inject6963EIP;
110
+ function injectCardanoExtension(cardanoProvider) {
111
+ const windowInject = window;
112
+ if (!windowInject.cardano) {
113
+ windowInject.cardano = {};
114
+ }
115
+ windowInject.cardano.subwallet = Object.freeze(cardanoProvider);
116
+ windowInject.dispatchEvent(new Event('subwallet#initialized'));
117
+ }
@@ -13,6 +13,6 @@ const packageInfo = {
13
13
  name: '@subwallet/extension-inject',
14
14
  path: typeof __dirname === 'string' ? __dirname : 'auto',
15
15
  type: 'cjs',
16
- version: '1.3.31-1'
16
+ version: '1.3.32-0'
17
17
  };
18
18
  exports.packageInfo = packageInfo;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  },
15
15
  "sideEffects": true,
16
16
  "type": "module",
17
- "version": "1.3.31-1",
17
+ "version": "1.3.32-0",
18
18
  "main": "./cjs/index.js",
19
19
  "module": "./index.js",
20
20
  "types": "./index.d.ts",
@@ -75,7 +75,7 @@
75
75
  "@polkadot/util": "^13.4.3",
76
76
  "@polkadot/util-crypto": "^13.4.3",
77
77
  "@polkadot/x-global": "^13.4.3",
78
- "@subwallet/keyring": "^0.1.9",
78
+ "@subwallet/keyring": "^0.1.11",
79
79
  "web3-core": "^1.10.0"
80
80
  },
81
81
  "peerDependencies": {
package/packageInfo.js CHANGED
@@ -7,5 +7,5 @@ export const packageInfo = {
7
7
  name: '@subwallet/extension-inject',
8
8
  path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto',
9
9
  type: 'esm',
10
- version: '1.3.31-1'
10
+ version: '1.3.32-0'
11
11
  };
package/types.d.ts CHANGED
@@ -91,6 +91,7 @@ export interface InjectedWindow extends This {
91
91
  injectedWeb3: Record<string, InjectedWindowProvider>;
92
92
  ethereum: EvmProvider;
93
93
  SubWallet: EvmProvider;
94
+ cardano: Record<string, CardanoProvider>;
94
95
  }
95
96
  export declare type InjectedExtension = InjectedExtensionInfo & Injected;
96
97
  export declare type InjectOptions = InjectedExtensionInfo;
@@ -115,4 +116,15 @@ export interface EIP6963AnnounceProviderEvent extends CustomEvent {
115
116
  export interface EIP6963RequestProviderEvent extends Event {
116
117
  type: 'eip6963:requestProvider';
117
118
  }
119
+ export interface CardanoExtensionCIP {
120
+ cip: number;
121
+ }
122
+ export interface CardanoProvider {
123
+ apiVersion: string;
124
+ name: string;
125
+ icon: string;
126
+ enable: () => Promise<unknown>;
127
+ supportedExtensions: CardanoExtensionCIP[];
128
+ isEnable: () => Promise<boolean>;
129
+ }
118
130
  export {};