Skip to content

Commit

Permalink
fix: make tracking property optional
Browse files Browse the repository at this point in the history
  • Loading branch information
EresDev committed Jun 16, 2024
1 parent e3cd0f0 commit 4fbe2f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion tests/rpc-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ describe("RPCHandler", () => {
yes: function (rpc: RpcType) {
return true;
},
undefined: function (rpc: RpcType) {
return true;
},
};

for (const [trackingOption, filterFunction] of Object.entries(filterFunctions)) {
Expand All @@ -111,7 +114,11 @@ describe("RPCHandler", () => {
});

const rpcHandlerConfig = { ...testConfig };
rpcHandlerConfig.tracking = trackingOption as Tracking;
if (trackingOption == "undefined") {
delete rpcHandlerConfig.tracking;
} else {
rpcHandlerConfig.tracking = trackingOption as Tracking;
}
const handler = new RPCHandler(rpcHandlerConfig);
await handler.testRpcPerformance();
const runtime = handler.getRuntimeRpcs();
Expand Down
2 changes: 1 addition & 1 deletion types/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export type HandlerConstructorConfig = {
cacheRefreshCycles: number | null;
runtimeRpcs: string[] | null;
rpcTimeout: number | null;
tracking: Tracking;
tracking?: Tracking;
};

export type NetworkRPCs = typeof networkRpcs;
Expand Down
2 changes: 1 addition & 1 deletion types/rpc-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class RPCHandler implements HandlerInterface {

constructor(config: HandlerConstructorConfig) {
this._networkId = config.networkId;
this._networkRpcs = this.filterNetworks(networkRpcsOriginal[this._networkId], config.tracking);
this._networkRpcs = this.filterNetworks(networkRpcsOriginal[this._networkId], config.tracking || "yes");
this._networkName = networkNames[this._networkId];
this._initialize(config);
}
Expand Down

0 comments on commit 4fbe2f1

Please sign in to comment.