Build esm (& add x-rxjs package) (#2942)
This commit is contained in:
@@ -14,15 +14,15 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@polkadot/types": "2.10.2-12",
|
||||
"@polkadot/util": "^4.2.2-12",
|
||||
"@polkadot/util-crypto": "^4.2.2-12",
|
||||
"@polkadot/x-fetch": "^4.2.2-12",
|
||||
"@polkadot/x-ws": "^4.2.2-12",
|
||||
"@polkadot/util": "^4.2.2-14",
|
||||
"@polkadot/util-crypto": "^4.2.2-14",
|
||||
"@polkadot/x-fetch": "^4.2.2-14",
|
||||
"@polkadot/x-ws": "^4.2.2-14",
|
||||
"bn.js": "^4.11.9",
|
||||
"eventemitter3": "^4.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polkadot/keyring": "^4.2.2-12",
|
||||
"@polkadot/keyring": "^4.2.2-14",
|
||||
"@polkadot/metadata": "2.10.2-12",
|
||||
"mock-socket": "^9.0.3",
|
||||
"nock": "^13.0.5"
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
import type { ProviderInterface, ProviderInterfaceCallback, ProviderInterfaceEmitCb, ProviderInterfaceEmitted } from '../types';
|
||||
|
||||
import { assert, logger } from '@polkadot/util';
|
||||
import fetch from '@polkadot/x-fetch';
|
||||
import { fetch } from '@polkadot/x-fetch';
|
||||
|
||||
import { RpcCoder } from '../coder';
|
||||
import defaults from '../defaults';
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { JsonRpcResponse, ProviderInterface, ProviderInterfaceCallback, Pro
|
||||
import EventEmitter from 'eventemitter3';
|
||||
|
||||
import { assert, isChildClass, isNull, isUndefined, logger } from '@polkadot/util';
|
||||
import WS from '@polkadot/x-ws';
|
||||
import { WebSocket } from '@polkadot/x-ws';
|
||||
|
||||
import { RpcCoder } from '../coder';
|
||||
import defaults from '../defaults';
|
||||
@@ -160,11 +160,11 @@ export class WsProvider implements ProviderInterface {
|
||||
public async connect (): Promise<void> {
|
||||
try {
|
||||
this.#endpointIndex = (this.#endpointIndex + 1) % this.#endpoints.length;
|
||||
this.#websocket = typeof WebSocket !== 'undefined' && isChildClass(WebSocket, WS)
|
||||
? new WS(this.#endpoints[this.#endpointIndex])
|
||||
this.#websocket = typeof global.WebSocket !== 'undefined' && isChildClass(global.WebSocket, WebSocket)
|
||||
? new WebSocket(this.#endpoints[this.#endpointIndex])
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore - WS may be an instance of w3cwebsocket, which supports headers
|
||||
: new WS(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers, undefined, {
|
||||
: new WebSocket(this.#endpoints[this.#endpointIndex], undefined, undefined, this.#headers, undefined, {
|
||||
// default: true
|
||||
fragmentOutgoingMessages: true,
|
||||
// default: 16K
|
||||
|
||||
Reference in New Issue
Block a user