import { web3 } from "hardhat"; import deployer from '../.secret' describe('Univ3 Test', () => { it('Parse ether test', async () => { console.log(web3.utils.toWei('1', 'gwei')) }) it('Get block number test', async () => { console.log(await web3.eth.getBlockNumber()) }) it('Get balance test', async () => { console.log(await web3.eth.getBalance(deployer.address)) }) it('Transfer test', async () => { let rawTx = { nonce: await web3.eth.getTransactionCount(deployer.address), gasPrice: web3.utils.toWei('2', 'gwei'), gasLimit: 1_000_000, to: '0x0000000000000000000000000000000000000000', value: '0x05' } const signedObj = await web3.eth.accounts.signTransaction(rawTx, deployer.private) if (signedObj.rawTransaction != null) { console.log('ready send hash: ' + signedObj.transactionHash) await web3.eth.sendSignedTransaction(signedObj.rawTransaction).on('error', function (rst) { console.error(rst) }) console.log('sent finish.') } }) })