-
Notifications
You must be signed in to change notification settings - Fork 971
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: change entity name for integration test
- Loading branch information
1 parent
6d0bfb4
commit 7aacb63
Showing
3 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
type Data @entity { | ||
id: ID! | ||
foo: String | ||
bar: Int | ||
isTest: Boolean | ||
type MirrorBlock @entity { | ||
id: Bytes! | ||
number: BigInt! | ||
hash: Bytes! | ||
} |
12 changes: 10 additions & 2 deletions
12
tests/integration-tests/subgraph-data-sources/src/mapping.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
import { Entity, log } from '@graphprotocol/graph-ts'; | ||
import { MirrorBlock } from '../generated/schema'; | ||
|
||
export function handleEntity(blockEntity: Entity): void { | ||
let blockNumberString = blockEntity.getBigInt('number').toString(); | ||
log.info('===> Block: {}', [blockNumberString]); | ||
let blockNumber = blockEntity.getBigInt('number'); | ||
let blockHash = blockEntity.getBytes('hash'); | ||
|
||
log.info('Block number: {}', [blockNumber.toString()]); | ||
|
||
let block = new MirrorBlock(blockHash); | ||
block.number = blockNumber; | ||
block.hash = blockHash; | ||
block.save(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters