|
1 |
| -import { Address, BigInt, Bytes, crypto, Entity, log, store } from '@graphprotocol/graph-ts'; |
2 |
| -import { ExampleContract, ExampleEvent } from './../generated/ExampleSubgraph/ExampleContract'; |
3 |
| -import { ExampleEntity } from './../generated/schema'; |
| 1 | +import { Address, BigInt, Bytes, log, store } from '@graphprotocol/graph-ts'; |
| 2 | +import { ExampleContract, ExampleEvent } from './types/ExampleSubgraph/ExampleContract'; |
| 3 | +import { ExampleEntity } from './types/schema'; |
4 | 4 |
|
5 | 5 | export function handleExampleEvent(event: ExampleEvent): void {
|
6 | 6 | const entity = new ExampleEntity('example id');
|
@@ -57,14 +57,14 @@ export function handleExampleEvent(event: ExampleEvent): void {
|
57 | 57 | entity.optionalBigIntList = [new BigInt(0), new BigInt(0)];
|
58 | 58 | entity.optionalBigIntList = null;
|
59 | 59 |
|
60 |
| - const optionalBigInt: bigint | null = entity.optionalBigInt; |
61 |
| - const optionalBigIntList: Array<bigint> | null = entity.optionalBigIntList; |
| 60 | + const optionalBigInt: BigInt | null = entity.optionalBigInt; |
| 61 | + const optionalBigIntList: Array<BigInt> | null = entity.optionalBigIntList; |
62 | 62 |
|
63 | 63 | entity.requiredBigInt = new BigInt(0);
|
64 | 64 | entity.requiredBigIntList = [new BigInt(0), new BigInt(0)];
|
65 | 65 |
|
66 |
| - const requiredBigInt: bigint = entity.requiredBigInt; |
67 |
| - const requiredBigIntList: Array<bigint> = entity.requiredBigIntList; |
| 66 | + const requiredBigInt: BigInt = entity.requiredBigInt; |
| 67 | + const requiredBigIntList: Array<BigInt> = entity.requiredBigIntList; |
68 | 68 |
|
69 | 69 | entity.optionalBytes = new Bytes(0);
|
70 | 70 | entity.optionalBytes = null;
|
@@ -212,7 +212,7 @@ export function handleExampleEvent(event: ExampleEvent): void {
|
212 | 212 | const u8Array: Array<i32> = contract.getAndReturnUint8Array([1 as i32, 100 as i32]);
|
213 | 213 | const u16Array: Array<i32> = contract.getAndReturnUint16Array([1 as i32, 100 as i32]);
|
214 | 214 | const u24Array: Array<i32> = contract.getAndReturnUint24Array([1 as i32, 100 as i32]);
|
215 |
| - const u32Array: Array<bigint> = contract.getAndReturnUint32Array([new BigInt(0), new BigInt(0)]); |
| 215 | + const u32Array: Array<BigInt> = contract.getAndReturnUint32Array([new BigInt(0), new BigInt(0)]); |
216 | 216 | entity.requiredBigIntList = contract.getAndReturnUint40Array(entity.requiredBigIntList);
|
217 | 217 | entity.requiredBigIntList = contract.getAndReturnUint56Array(entity.requiredBigIntList);
|
218 | 218 | entity.requiredBigIntList = contract.getAndReturnUint64Array(entity.requiredBigIntList);
|
@@ -251,7 +251,9 @@ export function handleExampleEvent(event: ExampleEvent): void {
|
251 | 251 | // Entity load and save (using the store behind the scenes)
|
252 | 252 | entity.save();
|
253 | 253 | let other = ExampleEntity.load('other example id');
|
254 |
| - other ??= new ExampleEntity('other example id'); |
| 254 | + if (other == null) { |
| 255 | + other = new ExampleEntity('other example id'); |
| 256 | + } |
255 | 257 | other.save();
|
256 | 258 |
|
257 | 259 | // BigInt math
|
|
0 commit comments