There is no function in Web3.js which would directly solve your problem, however you could write a little function to solve it.
In short you should use web3.eth.getBlock(arg)
, where arg
is the number of the block you are interested in. Here, in the transactions field you will have a list of transactions (represented by their hashes) happened in that specific block. Then you need to iterate over this list of transaction hashes and check whether web3.eth.getTransaction(transactionHash).to
is null
or not. If it is null
, then it means that the transaction was a contract creation.