fix: remove buggy node polyfill plugin (#18531)

* fix: remove buggy node polyfill plugin

* fix websocket test

* remove assert dependency
This commit is contained in:
Justin Starry
2021-07-09 00:33:41 -05:00
committed by GitHub
parent f6371cce17
commit 2ef2b6daa0
12 changed files with 24 additions and 20 deletions

View File

@@ -1,7 +1,5 @@
import assert from 'assert';
import bs58 from 'bs58';
import {Buffer} from 'buffer';
import {parse as urlParse} from 'url';
import fetch, {Response} from 'node-fetch';
import {
type as pick,
@@ -34,6 +32,7 @@ import {Signer} from './keypair';
import {MS_PER_SLOT} from './timing';
import {Transaction} from './transaction';
import {Message} from './message';
import assert from './util/assert';
import {sleep} from './util/sleep';
import {promiseTimeout} from './util/promise-timeout';
import {toBuffer} from './util/to-buffer';
@@ -2025,7 +2024,7 @@ export class Connection {
endpoint: string,
commitmentOrConfig?: Commitment | ConnectionConfig,
) {
let url = urlParse(endpoint);
let url = new URL(endpoint);
const useHttps = url.protocol === 'https:';
let wsEndpoint;
@@ -2046,7 +2045,7 @@ export class Connection {
this._rpcWsEndpoint = wsEndpoint || makeWebsocketUrl(endpoint);
this._rpcClient = createRpcClient(
url.href,
url.toString(),
useHttps,
httpHeaders,
fetchMiddleware,