mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-07 16:34:06 +00:00
Add demo for graph-watcher IPLD statediff and checkpointing
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import '@nomiclabs/hardhat-waffle';
|
||||
|
||||
import './test/tasks/example-deploy';
|
||||
import './test/tasks/example-test';
|
||||
|
||||
// You need to export an object to set up your config
|
||||
// Go to https://hardhat.org/config/ to learn more
|
||||
|
||||
@@ -42,7 +42,8 @@
|
||||
"build:example": "cd test/subgraph/example1 && yarn && yarn codegen && yarn build",
|
||||
"watch": "DEBUG=vulcanize:* nodemon --watch src src/watcher.ts",
|
||||
"compare-entity": "node bin/compare-entity",
|
||||
"example:deploy": "hardhat --network localhost example-deploy"
|
||||
"example:deploy": "hardhat --network localhost example-deploy",
|
||||
"example:test": "hardhat --network localhost example-test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.3.19",
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright 2022 Vulcanize, Inc.
|
||||
//
|
||||
|
||||
import { task, types } from 'hardhat/config';
|
||||
import '@nomiclabs/hardhat-ethers';
|
||||
import { ContractTransaction } from 'ethers';
|
||||
|
||||
task('example-test', 'Trigger Test event')
|
||||
.addParam('address', 'Contract address', undefined, types.string)
|
||||
.setAction(async (args, hre) => {
|
||||
const { address } = args;
|
||||
await hre.run('compile');
|
||||
const Example = await hre.ethers.getContractFactory('Example');
|
||||
const example = Example.attach(address);
|
||||
|
||||
const transaction: ContractTransaction = await example.emitEvent();
|
||||
|
||||
const receipt = await transaction.wait();
|
||||
|
||||
if (receipt.events) {
|
||||
const TestEvent = receipt.events.find(el => el.event === 'Test');
|
||||
|
||||
if (TestEvent && TestEvent.args) {
|
||||
console.log('Test Event');
|
||||
console.log('param1:', TestEvent.args.param1.toString());
|
||||
console.log('param2:', TestEvent.args.param2.toString());
|
||||
console.log('param3:', TestEvent.args.param3.toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user