From 6b82235fab155ef80e990309d693bf2045e2ee4e Mon Sep 17 00:00:00 2001 From: steveluscher Date: Fri, 1 Jul 2022 22:34:05 -0700 Subject: [PATCH] fix: a much simpler way to prevent getRecentPerformanceSamples from sending a commitment --- web3.js/src/connection.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/web3.js/src/connection.ts b/web3.js/src/connection.ts index 5bf6e7287e..c398d02423 100644 --- a/web3.js/src/connection.ts +++ b/web3.js/src/connection.ts @@ -195,9 +195,6 @@ type RpcRequest = (methodName: string, args: Array) => Promise; type RpcBatchRequest = (requests: RpcParams[]) => Promise; -const NO_COMMITMENT = - typeof Symbol === 'function' ? Symbol('NO_COMMITMENT') : ({} as const); - /** * @internal */ @@ -3434,10 +3431,9 @@ export class Connection { async getRecentPerformanceSamples( limit?: number, ): Promise> { - const args = this._buildArgs(limit ? [limit] : [], NO_COMMITMENT); const unsafeRes = await this._rpcRequest( 'getRecentPerformanceSamples', - args, + limit ? [limit] : [], ); const res = create(unsafeRes, GetRecentPerformanceSamplesRpcResult); if ('error' in res) { @@ -5065,12 +5061,11 @@ export class Connection { _buildArgs( args: Array, - override?: Commitment | typeof NO_COMMITMENT, + override?: Commitment, encoding?: 'jsonParsed' | 'base64', extra?: any, ): Array { - const commitment = - override === NO_COMMITMENT ? undefined : override || this._commitment; + const commitment = override || this._commitment; if (commitment || encoding || extra) { let options: any = {}; if (encoding) {