From 26af6a0817518e4091e481a7034317144fd5883a Mon Sep 17 00:00:00 2001 From: Saeed Dadkhah Date: Mon, 4 Mar 2024 14:40:57 +0330 Subject: [PATCH] fix --- .eslintrc.js | 1 - src/ScillaChaiMatchers.ts | 5 +++-- src/ScillaContractDeployer.ts | 8 ++------ src/ScillaContractProxy.ts | 5 +++-- src/ScillaParser.ts | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 08091b3..8fd720e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -234,7 +234,6 @@ module.exports = { "max-len": "off", "new-parens": "off", "newline-per-chained-call": "off", - "no-bitwise": "error", "no-caller": "error", "no-cond-assign": "error", "no-console": "off", diff --git a/src/ScillaChaiMatchers.ts b/src/ScillaChaiMatchers.ts index e51f3e3..51e5d04 100644 --- a/src/ScillaChaiMatchers.ts +++ b/src/ScillaChaiMatchers.ts @@ -33,6 +33,7 @@ export const scillaChaiEventMatcher = function ( const tx: Transaction = this._obj; const receipt = tx.getReceipt()!; + // eslint-disable-next-line @typescript-eslint/no-unused-expressions new Assertion(receipt.event_logs).not.to.be.null; const event_logs = receipt.event_logs!; @@ -42,14 +43,14 @@ export const scillaChaiEventMatcher = function ( ); }); - Assertion.addMethod("eventLogWithParams", function ( + Assertion.addMethod("eventLogWithParams", async function ( eventName: string, ...params: EventParam[] ) { const tx: Transaction = this._obj; const receipt = tx.getReceipt()!; - new Assertion(this._obj).to.eventLog(eventName); + await new Assertion(this._obj).to.eventLog(eventName); const event_logs = simplifyLogs(receipt.event_logs!); const desiredLog = event_logs.filter( diff --git a/src/ScillaContractDeployer.ts b/src/ScillaContractDeployer.ts index 069b18b..61690ac 100644 --- a/src/ScillaContractDeployer.ts +++ b/src/ScillaContractDeployer.ts @@ -139,8 +139,6 @@ export async function deploy( throw new Error(`Scilla contract ${contractName} doesn't exist.`); } - let sc: ScillaContract; - let tx: Transaction; let txParamsForContractDeployment = {}; if (contractInfo.parsedContract.constructorParams && args.length === contractInfo.parsedContract.constructorParams.length + 1) { // The last param is Tx info such as amount, nonce, gasPrice @@ -154,7 +152,7 @@ export async function deploy( ...args ); - [tx, sc] = await deployFromFile(contractInfo.path, init, txParamsForContractDeployment); + const [tx, sc] = await deployFromFile(contractInfo.path, init, txParamsForContractDeployment); sc.deployed_by = tx; ScillaContractProxy.injectProxies(setup!, contractInfo, sc); @@ -171,11 +169,9 @@ export const deployLibrary = async ( throw new Error(`Scilla contract ${libraryName} doesn't exist.`); } - let sc: ScillaContract; - let tx: Transaction; const init: Init = fillLibraryInit(); - [tx, sc] = await deployFromFile(contractInfo.path, init, {}); // FIXME: In #45 + const [tx, sc] = await deployFromFile(contractInfo.path, init, {}); // FIXME: In #45 sc.deployed_by = tx; return sc; diff --git a/src/ScillaContractProxy.ts b/src/ScillaContractProxy.ts index dec24cb..67bb837 100644 --- a/src/ScillaContractProxy.ts +++ b/src/ScillaContractProxy.ts @@ -3,6 +3,7 @@ import { Account } from "@zilliqa-js/account"; import { CallParams, State } from "@zilliqa-js/contract"; import { BN } from "@zilliqa-js/util"; import { HardhatPluginError } from "hardhat/plugins"; + import * as ScillaContractDeployer from './ScillaContractDeployer'; import { ScillaContract, Value, Setup } from './ScillaContractDeployer'; import { ContractInfo } from "./ScillaContractsInfoUpdater"; @@ -62,8 +63,8 @@ function handleUnnamedParam(param: Field, arg: any): Value { return arg.toString(); } else { const values: Value[] = []; - param.typeJSON.argtypes.forEach((param: Field, index: number) => { - values.push(handleUnnamedParam(param, arg[index])); + param.typeJSON.argtypes.forEach((f: Field, index: number) => { + values.push(handleUnnamedParam(f, arg[index])); }); const argtypes = param.typeJSON.argtypes.map((x) => x.type); /* diff --git a/src/ScillaParser.ts b/src/ScillaParser.ts index 96952e2..92e9ff2 100644 --- a/src/ScillaParser.ts +++ b/src/ScillaParser.ts @@ -92,7 +92,7 @@ export const parseScillaLibrary = async ( } return { - name: libraryName, + name: libraryName || "", transitions: [], fields: [], constructorParams: [],