watcher-ts/packages/graph-node/test/subgraph/example1/generated/Example1/Example1.ts
Ashwin Phatak d247815ce2 Example subgraph, ethCall test to drive implementation (#18)
* Setup example subgraph.

* Implement eth_call in subgraph.

* eth-call test stub

Co-authored-by: nabarun <nabarun@deepstacksoft.com>
2021-12-28 16:08:04 +05:30

55 lines
1.1 KiB
TypeScript

// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
import {
ethereum,
JSONValue,
TypedMap,
Entity,
Bytes,
Address,
BigInt
} from "@graphprotocol/graph-ts";
export class Test extends ethereum.Event {
get params(): Test__Params {
return new Test__Params(this);
}
}
export class Test__Params {
_event: Test;
constructor(event: Test) {
this._event = event;
}
get param1(): string {
return this._event.parameters[0].value.toString();
}
get param2(): BigInt {
return this._event.parameters[1].value.toBigInt();
}
}
export class Example1 extends ethereum.SmartContract {
static bind(address: Address): Example1 {
return new Example1("Example1", address);
}
getMethod(): string {
let result = super.call("getMethod", "getMethod():(string)", []);
return result[0].toString();
}
try_getMethod(): ethereum.CallResult<string> {
let result = super.tryCall("getMethod", "getMethod():(string)", []);
if (result.reverted) {
return new ethereum.CallResult();
}
let value = result.value;
return ethereum.CallResult.fromValue(value[0].toString());
}
}