Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Victor Yanev <victor.yanev@limechain.tech>
  • Loading branch information
victor-yanev committed Oct 3, 2024
1 parent 5a1c6a0 commit e71182e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/relay/src/lib/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1721,7 +1721,7 @@ export class EthImpl implements Eth {
transactionIndex: string,
requestDetails: RequestDetails,
): Promise<Transaction | null> {
const block = await this.mirrorNodeClient.getBlock(blockParam.value, requestIdPrefix);
const block = await this.mirrorNodeClient.getBlock(blockParam.value, requestDetails);
const timestampRangeParams = block ? [`gte:${block.timestamp.from}`, `lte:${block.timestamp.to}`] : undefined;

const contractResults = await this.mirrorNodeClient.getContractResults(
Expand Down
7 changes: 6 additions & 1 deletion packages/relay/tests/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ const getQueryParams = (params: object) => {

return '?'.concat(
Object.entries(params)
.map(([key, value]) => `${key}=${value}`)
.map(([key, value]) => {
if (Array.isArray(value)) {
return value.map((v) => `${key}=${v}`).join('&');
}
return `${key}=${value}`;
})
.join('&'),
);
};
Expand Down
15 changes: 1 addition & 14 deletions packages/relay/tests/lib/eth/eth-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,7 @@ import MockAdapter from 'axios-mock-adapter';
import { MirrorNodeClient } from '../../../src/lib/clients';
import { EthImpl } from '../../../src/lib/eth';
import EventEmitter from 'events';

export function getQueryParams(params: object) {
let paramString = '';
for (const [key, value] of Object.entries(params)) {
let additionalString = '';
if (Array.isArray(value)) {
additionalString = value.map((v) => `${key}=${v}`).join('&');
} else if (value !== undefined) {
additionalString = `${key}=${value}`;
}
paramString += paramString === '' ? `?${additionalString}` : `&${additionalString}`;
}
return paramString;
}
import { getQueryParams } from '../../helpers';

export function contractResultsByNumberByIndexURL(
number: number,
Expand Down

0 comments on commit e71182e

Please sign in to comment.