@starknet-io/get-starknet-virtual-wallet 5.0.0 → 6.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@starknet-io/get-starknet-virtual-wallet",
3
- "version": "5.0.0",
3
+ "version": "6.0.0",
4
4
  "keywords": [
5
5
  "starknet",
6
6
  "starkware",
@@ -12,17 +12,22 @@
12
12
  ],
13
13
  "license": "MIT",
14
14
  "type": "module",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/starknet-io/get-starknet.git",
18
+ "directory": "packages/virtual-wallet"
19
+ },
15
20
  "main": "./dist/index.mjs",
16
- "types": "./dist/index.d.ts",
21
+ "types": "./dist/index.d.mts",
17
22
  "exports": {
18
23
  ".": {
19
- "types": "./dist/index.d.ts",
24
+ "types": "./dist/index.d.mts",
20
25
  "import": "./dist/index.mjs",
21
26
  "require": "./dist/index.cjs",
22
27
  "default": "./dist/index.mjs"
23
28
  },
24
29
  "./metamask": {
25
- "types": "./dist/metamask.d.ts",
30
+ "types": "./dist/metamask.d.mts",
26
31
  "import": "./dist/metamask.mjs",
27
32
  "require": "./dist/metamask.cjs",
28
33
  "default": "./dist/metamask.mjs"
@@ -33,21 +38,22 @@
33
38
  "src"
34
39
  ],
35
40
  "devDependencies": {
36
- "typescript": "^5.8.3",
37
- "unbuild": "^2.0.0",
38
- "vitest": "^3.1.1"
41
+ "tsdown": "^0.21.9",
42
+ "typescript": "^5.9.3",
43
+ "vitest": "^3.2.6"
39
44
  },
40
45
  "dependencies": {
41
46
  "@module-federation/runtime": "^0.12.0",
42
- "@starknet-io/types-js": "^0.7.10",
43
- "@wallet-standard/base": "^1.1.0",
44
- "@wallet-standard/features": "^1.1.0",
47
+ "@starknet-io/types-js": "^0.10.2",
48
+ "@wallet-standard/base": "^1.1.1",
49
+ "@wallet-standard/features": "^1.1.1",
45
50
  "async-mutex": "^0.5.0",
46
- "viem": "^2.27.2",
47
- "@starknet-io/get-starknet-wallet-standard": "5.0.0"
51
+ "viem": "^2.52.2",
52
+ "@starknet-io/get-starknet-wallet-standard": "6.0.0"
48
53
  },
49
54
  "scripts": {
50
- "build": "unbuild",
55
+ "typecheck": "tsc --noEmit",
56
+ "build": "tsdown",
51
57
  "lint:check": "biome check .",
52
58
  "lint": "biome check --write .",
53
59
  "format": "biome format --write .",
package/src/metamask.ts CHANGED
@@ -112,7 +112,7 @@ export class MetaMaskVirtualWallet implements WalletWithStarknetFeatures {
112
112
  return [];
113
113
  }
114
114
 
115
- #connect: StandardConnectMethod = async ({ silent }) => {
115
+ #connect: StandardConnectMethod = async ({ silent } = {}) => {
116
116
  if (!this.#account) {
117
117
  const accounts = await this.#request({
118
118
  type: "wallet_requestAccounts",
@@ -243,7 +243,7 @@ export class MetaMaskVirtualWallet implements WalletWithStarknetFeatures {
243
243
  return chain;
244
244
  }
245
245
 
246
- async #onAccountsChanged(accounts: string[]) {
246
+ async #onAccountsChanged(accounts?: string[]) {
247
247
  if (!accounts || accounts.length === 0) {
248
248
  this.#disconnected();
249
249
  return;
@@ -275,15 +275,14 @@ export class MetaMaskVirtualWallet implements WalletWithStarknetFeatures {
275
275
  }
276
276
 
277
277
  // Accounts should always be set, but check just in case.
278
- if (accounts?.length > 0) {
278
+ if (accounts && accounts.length > 0) {
279
279
  const [account] = accounts;
280
280
 
281
281
  this.#account = { address: account, chain };
282
- this.#emit("change", { accounts: this.accounts });
283
- } else {
282
+ } else if (this.#account !== null) {
284
283
  this.#account.chain = chain;
285
- this.#emit("change", { accounts: this.accounts });
286
284
  }
285
+ this.#emit("change", { accounts: this.accounts });
287
286
  }
288
287
  }
289
288
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { WalletWithStarknetFeatures } from '@starknet-io/get-starknet-wallet-standard/features';
2
- import { EIP1193Provider } from 'viem';
3
-
4
- type EIP6963ProviderInfo = {
5
- rdns: string;
6
- };
7
- type EIP1193Adapter = (info: EIP6963ProviderInfo, provider: EIP1193Provider) => WalletWithStarknetFeatures | null;
8
-
9
- export type { EIP1193Adapter, EIP6963ProviderInfo };
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,26 +0,0 @@
1
- import { StarknetWalletAccount } from '@starknet-io/get-starknet-wallet-standard';
2
- import { WalletWithStarknetFeatures, StarknetFeatures } from '@starknet-io/get-starknet-wallet-standard/features';
3
- import { EIP1193Provider } from 'viem';
4
- import { EIP6963ProviderInfo } from './index.js';
5
-
6
- declare function metaMaskVirtualWallet(info: EIP6963ProviderInfo, provider: EIP1193Provider): WalletWithStarknetFeatures | null;
7
- declare class MetaMaskVirtualWallet implements WalletWithStarknetFeatures {
8
- #private;
9
- private provider;
10
- constructor(provider: MetaMaskProvider);
11
- get version(): "1.0.0";
12
- get name(): string;
13
- get icon(): WalletWithStarknetFeatures["icon"];
14
- get features(): StarknetFeatures;
15
- get chains(): ("starknet:0x534e5f4d41494e" | "starknet:0x534e5f5345504f4c4941")[];
16
- get accounts(): StarknetWalletAccount[];
17
- }
18
- type MetaMaskProvider = {
19
- isMetaMask: boolean;
20
- request(options: {
21
- method: string;
22
- }): Promise<void>;
23
- };
24
- declare function isMetaMaskProvider(obj: unknown): obj is MetaMaskProvider;
25
-
26
- export { type MetaMaskProvider, MetaMaskVirtualWallet, isMetaMaskProvider, metaMaskVirtualWallet };