Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions generated/Token/Token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ export class Token__royaltyInfoResult {
map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1));
return map;
}

getReceiver(): Address {
return this.value0;
}

getRoyaltyAmount(): BigInt {
return this.value1;
}
}

export class Token extends ethereum.SmartContract {
Expand Down
120 changes: 76 additions & 44 deletions generated/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ export class Token extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));

this.set("tokenID", Value.fromBigInt(BigInt.zero()));
this.set("tokenURI", Value.fromString(""));
this.set("externalURL", Value.fromString(""));
this.set("ipfsURI", Value.fromString(""));
this.set("image", Value.fromString(""));
this.set("name", Value.fromString(""));
this.set("description", Value.fromString(""));
this.set("type", Value.fromString(""));
this.set("sun", Value.fromString(""));
this.set("moon", Value.fromString(""));
this.set("rising", Value.fromString(""));
this.set("updatedAtTimestamp", Value.fromBigInt(BigInt.zero()));
this.set("owner", Value.fromString(""));
}

save(): void {
Expand All @@ -37,8 +23,7 @@ export class Token extends Entity {
if (id) {
assert(
id.kind == ValueKind.STRING,
"Cannot save Token entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
`Entities of type Token must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("Token", id.toString(), this);
}
Expand Down Expand Up @@ -75,22 +60,79 @@ export class Token extends Entity {
this.set("tokenURI", Value.fromString(value));
}

get externalURL(): string {
let value = this.get("externalURL");
get ipfsURI(): string | null {
let value = this.get("ipfsURI");
if (!value || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toString();
}
}

set ipfsURI(value: string | null) {
if (!value) {
this.unset("ipfsURI");
} else {
this.set("ipfsURI", Value.fromString(<string>value));
}
}

get updatedAtTimestamp(): BigInt | null {
let value = this.get("updatedAtTimestamp");
if (!value || value.kind == ValueKind.NULL) {
return null;
} else {
return value.toBigInt();
}
}

set updatedAtTimestamp(value: BigInt | null) {
if (!value) {
this.unset("updatedAtTimestamp");
} else {
this.set("updatedAtTimestamp", Value.fromBigInt(<BigInt>value));
}
}

get owner(): string {
let value = this.get("owner");
return value!.toString();
}

set externalURL(value: string) {
this.set("externalURL", Value.fromString(value));
set owner(value: string) {
this.set("owner", Value.fromString(value));
}
}

get ipfsURI(): string {
let value = this.get("ipfsURI");
export class TokenMetadata extends Entity {
constructor(id: string) {
super();
this.set("id", Value.fromString(id));
}

save(): void {
let id = this.get("id");
assert(id != null, "Cannot save TokenMetadata entity without an ID");
if (id) {
assert(
id.kind == ValueKind.STRING,
`Entities of type TokenMetadata must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("TokenMetadata", id.toString(), this);
}
}

static load(id: string): TokenMetadata | null {
return changetype<TokenMetadata | null>(store.get("TokenMetadata", id));
}

get id(): string {
let value = this.get("id");
return value!.toString();
}

set ipfsURI(value: string) {
this.set("ipfsURI", Value.fromString(value));
set id(value: string) {
this.set("id", Value.fromString(value));
}

get image(): string {
Expand All @@ -102,6 +144,15 @@ export class Token extends Entity {
this.set("image", Value.fromString(value));
}

get externalURL(): string {
let value = this.get("externalURL");
return value!.toString();
}

set externalURL(value: string) {
this.set("externalURL", Value.fromString(value));
}

get name(): string {
let value = this.get("name");
return value!.toString();
Expand Down Expand Up @@ -155,24 +206,6 @@ export class Token extends Entity {
set rising(value: string) {
this.set("rising", Value.fromString(value));
}

get updatedAtTimestamp(): BigInt {
let value = this.get("updatedAtTimestamp");
return value!.toBigInt();
}

set updatedAtTimestamp(value: BigInt) {
this.set("updatedAtTimestamp", Value.fromBigInt(value));
}

get owner(): string {
let value = this.get("owner");
return value!.toString();
}

set owner(value: string) {
this.set("owner", Value.fromString(value));
}
}

export class User extends Entity {
Expand All @@ -187,8 +220,7 @@ export class User extends Entity {
if (id) {
assert(
id.kind == ValueKind.STRING,
"Cannot save User entity with non-string ID. " +
'Considering using .toHex() to convert the "id" to a string.'
`Entities of type User must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}`
);
store.set("User", id.toString(), this);
}
Expand Down
13 changes: 13 additions & 0 deletions generated/templates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

import { DataSourceTemplate, DataSourceContext } from "@graphprotocol/graph-ts";

export class TokenMetadata extends DataSourceTemplate {
static create(cid: string): void {
DataSourceTemplate.create("TokenMetadata", [cid]);
}

static createWithContext(cid: string, context: DataSourceContext): void {
DataSourceTemplate.createWithContext("TokenMetadata", [cid], context);
}
}
Loading