I am using your library to test a smart contract that requires another one. I am also using npx hardhat test test/simpleTest.ts for testing. I am not sure if this is a bug or just me doing something I shouldn't. Here is my code for test/simpleTest.ts:
import { MockContractInstance, PChainStakeMirrorVerifierInstance, PChainStakeMirrorVerifierMockInstance } from "../../../../typechain-truffle";
import type { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { BN } from "bn.js";
import { ethers } from 'hardhat';
import { abi } from "../artifacts/contracts/Random.sol/Random.json"
import { RandomContract, RouletteContract, RouletteInstance } from '../typechain-types/';
import { RandomInstance } from "../typechain-types/contracts/Random";
const MockContract = artifacts.require("MockContract");
const Roulette: RouletteContract = artifacts.require('Roulette');
const Random: RandomInstance = artifacts.require('Random');
function bn(n: any) {
return new BN(n.toString());
}
const IRandom = new web3.eth.Contract(
abi as any
)
describe('Roulette', async () => {
let roulette: RouletteInstance
let owner: SignerWithAddress
let randomMock: MockContractInstance
beforeEach(async () => {
randomMock = await MockContract.new();
const methodGetRandom = IRandom.methods.getRandom(25).encodeABI()
// await ethers.getSigners();
[owner] = await ethers.getSigners();
randomMock.givenCalldataReturn(
methodGetRandom,
web3.eth.abi.encodeParameters(["uint256", "bool"], [12345 , true])
)
console.log(owner);
})
})
This code produces TypeError: Cannot create property 'undefined' on string '0xcd4b69140000000000000000000000000000000000000000000000000000000000000019'. If I uncomment // await ethers.getSigners();, it works.
If I move randomMock... above getting owner, then owner is undefined. Again uncommenting that await ... line makes it work again.
I hope either I am doing something wrong or it helps you improve your library. If you need more information I can provide it.
I am using your library to test a smart contract that requires another one. I am also using
npx hardhat test test/simpleTest.tsfor testing. I am not sure if this is a bug or just me doing something I shouldn't. Here is my code for test/simpleTest.ts:This code produces
TypeError: Cannot create property 'undefined' on string '0xcd4b69140000000000000000000000000000000000000000000000000000000000000019'. If I uncomment// await ethers.getSigners();, it works.If I move randomMock... above getting owner, then owner is undefined. Again uncommenting that await ... line makes it work again.
I hope either I am doing something wrong or it helps you improve your library. If you need more information I can provide it.