Skip to content

Commit

Permalink
Addresses PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantina Blazhukova <konstantina.blajukova@gmail.com>
  • Loading branch information
konstantinabl committed Apr 24, 2024
1 parent 7374fc8 commit be88a86
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
10 changes: 4 additions & 6 deletions packages/relay/src/lib/precheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ export class Precheck {
async sendRawTransactionCheck(parsedTx: ethers.Transaction, gasPrice: number, requestId?: string): Promise<void> {
this.gasLimit(parsedTx, requestId);
const mirrorAccountInfo = await this.verifyAccount(parsedTx, requestId);
await this.nonce(parsedTx, mirrorAccountInfo.ethereum_nonce, requestId);
this.nonce(parsedTx, mirrorAccountInfo.ethereum_nonce, requestId);
this.chainId(parsedTx, requestId);
this.value(parsedTx);
this.gasPrice(parsedTx, gasPrice, requestId);
await this.balance(parsedTx, mirrorAccountInfo, requestId);
this.balance(parsedTx, mirrorAccountInfo, requestId);
}

/**
Expand Down Expand Up @@ -110,9 +110,8 @@ export class Precheck {
* @param {Transaction} tx - The transaction.
* @param {number} accountInfoNonce - The nonce of the account.
* @param {string} [requestId] - The request ID.
* @returns {Promise<void>} A Promise.
*/
async nonce(tx: Transaction, accountInfoNonce: number, requestId?: string): Promise<void> {
nonce(tx: Transaction, accountInfoNonce: number, requestId?: string): void {
const requestIdPrefix = formatRequestIdMessage(requestId);
this.logger.trace(
`${requestIdPrefix} Nonce precheck for sendRawTransaction(tx.nonce=${tx.nonce}, accountInfoNonce=${accountInfoNonce})`,
Expand Down Expand Up @@ -191,9 +190,8 @@ export class Precheck {
* @param {Transaction} tx - The transaction.
* @param {any} account - The account information.
* @param {string} [requestId] - The request ID.
* @returns {Promise<void>} A Promise.
*/
async balance(tx: Transaction, account: any, requestId?: string): Promise<void> {
balance(tx: Transaction, account: any, requestId?: string): void {
const requestIdPrefix = formatRequestIdMessage(requestId);
const result = {
passes: false,
Expand Down
8 changes: 4 additions & 4 deletions packages/relay/tests/lib/precheck.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { expectedError, mockData, signTransaction } from '../helpers';
import { MirrorNodeClient } from '../../src/lib/clients';
import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { ethers } from 'ethers';
import { Transaction, ethers } from 'ethers';
import constants from '../../src/lib/constants';
import { JsonRpcError, predefined } from '../../src';
import { CacheService } from '../../src/lib/services/cacheService/cacheService';
Expand Down Expand Up @@ -421,11 +421,11 @@ describe('Precheck', async function () {
});

describe('account', async function () {
let defaultNonce, defaultTx, signed, parsedTx, mirrorAccount, wallet;
let parsedTx: Transaction, mirrorAccount, defaultNonce: number;
before(async () => {
defaultNonce = 3;
wallet = ethers.Wallet.createRandom();
signed = await wallet.signTransaction({ ...defaultTx, from: wallet.address, nonce: defaultNonce });
const wallet = ethers.Wallet.createRandom();
const signed = await wallet.signTransaction({ ...defaultTx, from: wallet.address, nonce: defaultNonce });
parsedTx = ethers.Transaction.from(signed);
mirrorAccount = {
evm_address: parsedTx.from,
Expand Down

0 comments on commit be88a86

Please sign in to comment.