Hello everyone how we all doingš. Can anyone tell me how to get an APIKEY in my contract
Dec 23, 2021, 6:56 PM
are you asking how to get an etherscan API KEY ?
Dec 23, 2021, 6:59 PM
Yes and how to use it to communicate with your contract
Dec 23, 2021, 7:04 PM
https://docs.etherscan.io/getting-started/viewing-api-usage-statistics
you don't need an etherscan API key to communicate with your contract, as the contract lives on ethereum itself, not etherscan
you typically would only need the API key to verify your contract code on etherscan
Dec 23, 2021, 7:05 PM
Im running a BSC project but it will be relaunched we are building a MetaVerse and want the balances to be visible in the game and the game being able to do transactions. This requires the API-KEY
Dec 23, 2021, 7:06 PM
no, you dont need an etherscan/bscscan API key to read data from a contract. You can use web3 directly
Dec 23, 2021, 7:07 PM
*ABI
What you need is ABI
Dec 23, 2021, 7:08 PM
Yea sorry i ment that
Dec 23, 2021, 8:10 PM
you get the ABI from compiling the contract (i.e. via truffle compile)
or if it's already deployed and verified, you can fetch the ABI from bscscan/etherscan
Dec 23, 2021, 8:11 PM
Can get Abi by compiling locally with solc via solc āAbi
Oooooof
Please, do more homework before attempting an ambitious project such as this
Dec 23, 2021, 8:20 PM
It wasnt the plan at first š
Dec 23, 2021, 9:12 PM
fair enough :)
you can also specify individual test files to run if you just want to run tests from 1 file
and im sure you can alsio use various seleciton filters to specify individual tests or batches of tests to run if you want more fine grained control
Oh interesting! And to confirm, they are both in the same directory?
Interestign question! Took a look, you can create a new file which imports all of your other test files and then just run that file
So lets call it index.js Put in it smoething like:
require('./test/foo.js')
require('./test/bar.js')
Put this in your root project directory and then run npx hardhat test testindex.js
require('./test/foo.js')
require('./test/bar.js')
Put this in your root project directory and then run npx hardhat test testindex.js
Wish you could just use filename wildcards e.g. npx hardhat test test/* but that doesn't seem to work
Dec 23, 2021, 9:50 PM
Does hardhat test command follow a similar convention as truffle test? I.e. it will by default run all test files in the /test directory?
If not hopefully they add it someday
Dec 23, 2021, 9:59 PM
It seems like currently no, at least not with the version of hardhat Iām using whuch may not be the latest one
Absolutely I was surprised it didnāt do that since that makes the most sense. Ultimately I expect itās tied to the version of mocha so it could just be that the version of hardhat Iām using has old version of mocha
Dec 23, 2021, 10:04 PM
Ah gotcha
Yep either track highest values or sort off-chain seems easiest
Dec 23, 2021, 11:42 PM