@atomiqlabs/chain-starknet 7.0.7 → 7.0.9

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/dist/index.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  const WebSocket = require("ws");
18
- if (window == null)
18
+ if (global.window == null)
19
19
  global.WebSocket = WebSocket;
20
20
  __exportStar(require("./starknet/chain/StarknetAction"), exports);
21
21
  __exportStar(require("./starknet/chain/StarknetChainInterface"), exports);
@@ -45,7 +45,7 @@ function initializeStarknet(options, bitcoinRpc, network) {
45
45
  let wsChannel;
46
46
  if (options.wsUrl != null)
47
47
  wsChannel = typeof (options.wsUrl) === "string" ?
48
- new starknet_1.WebSocketChannel({ nodeUrl: options.wsUrl, websocket: typeof window !== "undefined" && typeof window.WebSocket !== "undefined" ? window.WebSocket : require("ws") }) :
48
+ new starknet_1.WebSocketChannel({ nodeUrl: options.wsUrl }) :
49
49
  options.wsUrl;
50
50
  const Fees = options.fees ?? new StarknetFees_1.StarknetFees(provider);
51
51
  const chainId = options.chainId ??
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomiqlabs/chain-starknet",
3
- "version": "7.0.7",
3
+ "version": "7.0.9",
4
4
  "description": "Starknet specific base implementation",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as WebSocket from "ws";
2
- if(window==null) global.WebSocket = WebSocket as any;
2
+ if(global.window==null) global.WebSocket = WebSocket as any;
3
3
 
4
4
  export * from "./starknet/chain/StarknetAction";
5
5
  export * from "./starknet/chain/StarknetChainInterface";
@@ -72,7 +72,7 @@ export function initializeStarknet(
72
72
  options.rpcUrl;
73
73
  let wsChannel: WebSocketChannel;
74
74
  if(options.wsUrl!=null) wsChannel = typeof(options.wsUrl)==="string" ?
75
- new WebSocketChannel({nodeUrl: options.wsUrl, websocket: typeof window !== "undefined" && typeof window.WebSocket !== "undefined" ? window.WebSocket : require("ws")}) :
75
+ new WebSocketChannel({nodeUrl: options.wsUrl}) :
76
76
  options.wsUrl;
77
77
 
78
78
  const Fees = options.fees ?? new StarknetFees(provider);