watcher-ts/packages/graph-node/assembly/index.ts
nikugogoi f34d83c04b Use async functions in wasm imports (#28)
* Use async functions in wasm imports

* Complete implementing asyncify with assemblyscript loader
2021-12-28 16:08:05 +05:30

75 lines
1.2 KiB
TypeScript

import {
// ethereum,
// store,
log
// ipfs,
// json,
// crypto,
// dataSource,
// ens,
// typeConversion,
// bigDecimal,
// bigInt,
// Address,
// BigDecimal,
// BigInt,
// ByteArray,
// Bytes,
// DataSourceContext,
// DataSourceTemplate,
// Entity,
// JSONValue,
// JSONValueKind,
// JSONValuePayload,
// Result,
// TypedMap,
// TypedMapEntry,
// Value,
// ValueKind,
// ValuePayload,
// Wrapped
} from '@graphprotocol/graph-ts';
/* eslint-disable @typescript-eslint/no-namespace */
export declare namespace test {
export function asyncMethod(): i32;
}
export function callGraphAPI (): void {
log.debug('hello {}', ['world']);
}
export function callAsyncMethod (): void {
log.debug('calling async method', []);
const res = test.asyncMethod();
log.debug('res after async: {}', [res.toString()]);
}
export class Foo {
static getFoo (): Foo {
return new Foo();
}
getString (): string {
return 'hello world!';
}
}
export const FooID = idof<Foo>();
export class Bar {
prop: string
constructor (prop: string) {
this.prop = prop;
}
getProp (): string {
return this.prop;
}
}