integration test: get block, tx, receipt, filter logs, code at

This commit is contained in:
ramil
2021-04-19 11:32:36 +03:00
parent 141b3eaffe
commit 3c57fa1064
14 changed files with 879 additions and 80 deletions
+47
View File
@@ -0,0 +1,47 @@
const fastify = require('fastify')({ logger: true });
const hre = require("hardhat");
// readiness check
fastify.get('/v1/healthz', async (req, reply) => {
reply
.code(200)
.header('Content-Type', 'application/json; charset=utf-8')
.send({ success: true })
});
fastify.get('/v1/deployContract', async (req, reply) => {
const GLDToken = await hre.ethers.getContractFactory("GLDToken");
const token = await GLDToken.deploy();
await token.deployed();
return {
address: token.address,
txHash: token.deployTransaction.hash,
blockNumber: token.deployTransaction.blockNumber,
blockHash: token.deployTransaction.blockHash,
}
});
// fastify.get('/v1/deployContract', async (req, reply) => {
// const GLDToken = await hre.ethers.getContractFactory("GLDToken");
// const token = await GLDToken.deploy();
// await token.deployed();
// console.log("GLDToken deployed to:", token.address, token.deployTransaction);
//
// return {
// address: token.address,
// txHash: token.deployTransaction.hash,
// blockNumber: token.deployTransaction.blockNumber,
// }
// });
async function main() {
try {
await fastify.listen(3000, '0.0.0.0');
} catch (err) {
fastify.log.error(err);
process.exit(1);
}
}
main();