138 lines
3.0 KiB
TypeScript
Raw Normal View History

2021-08-02 13:42:11 +02:00
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
TypedMap,
Entity,
Value,
ValueKind,
store,
Address,
Bytes,
BigInt,
BigDecimal
} from "@graphprotocol/graph-ts";
export class ExampleEntity extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id !== null, "Cannot save ExampleEntity entity without an ID");
assert(
id.kind == ValueKind.STRING,
"Cannot save ExampleEntity entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
);
store.set("ExampleEntity", id.toString(), this);
}
static load(id: string): ExampleEntity | null {
return store.get("ExampleEntity", id) as ExampleEntity | null;
}
get id(): string {
let value = this.get("id");
return value.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get roomId(): BigInt {
let value = this.get("roomId");
return value.toBigInt();
}
set roomId(value: BigInt) {
this.set("roomId", Value.fromBigInt(value));
}
get voter(): Bytes {
let value = this.get("voter");
return value.toBytes();
}
set voter(value: Bytes) {
this.set("voter", Value.fromBytes(value));
}
}
export class VotingRoom extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}
save(): void {
let id = this.get("id");
assert(id !== null, "Cannot save VotingRoom entity without an ID");
assert(
id.kind == ValueKind.STRING,
"Cannot save VotingRoom entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
);
store.set("VotingRoom", id.toString(), this);
}
static load(id: string): VotingRoom | null {
return store.get("VotingRoom", id) as VotingRoom | null;
}
get id(): string {
let value = this.get("id");
return value.toString();
}
set id(value: string) {
this.set("id", Value.fromString(value));
}
get community(): Bytes {
let value = this.get("community");
return value.toBytes();
}
set community(value: Bytes) {
this.set("community", Value.fromBytes(value));
}
get type(): i32 {
let value = this.get("type");
return value.toI32();
}
set type(value: i32) {
this.set("type", Value.fromI32(value));
}
get timestamp(): BigInt | null {
let value = this.get("timestamp");
if (value === null || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toBigInt();
}
}
set timestamp(value: BigInt | null) {
if (value === null) {
this.unset("timestamp");
} else {
this.set("timestamp", Value.fromBigInt(value as BigInt));
}
}
get result(): boolean {
let value = this.get("result");
return value.toBoolean();
}
set result(value: boolean) {
this.set("result", Value.fromBoolean(value));
}
}