mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 16:54:08 +00:00
Implement remaining json host APIs (#487)
* Instantiate a new wasm string to convert JSON value to BigInt * Implement remaining json host APIs * Upgrade graph-ts and graph-cli in test example subgraph * Handle null context for dataSource context host API * Use JSONBig for parsing JSON strings
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 example1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@graphprotocol/graph-ts": "npm:@cerc-io/graph-ts@0.22.1-watcher-ts-0.1.0",
|
||||
"@cerc-io/graph-cli": "0.22.4-watcher-ts-0.1.2"
|
||||
"@graphprotocol/graph-ts": "npm:@cerc-io/graph-ts@0.27.0-watcher-ts-0.1.3",
|
||||
"@cerc-io/graph-cli": "0.32.0-watcher-ts-0.1.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -577,13 +577,21 @@ export function testJsonFromBytes (): void {
|
||||
const numberValue = jsonData.toObject().get('numberValue')!;
|
||||
assert(numberValue.kind === JSONValueKind.NUMBER, 'JSON value is not a number');
|
||||
|
||||
// TODO: Debug json toI64 failing test case.
|
||||
// const i64Value = numberValue.toI64();
|
||||
// assert(i64Value == 123, 'values are not equal');
|
||||
const i64Value = numberValue.toI64();
|
||||
const expectedI64: i64 = 123;
|
||||
assert(i64Value === expectedI64, 'i64 values are not equal');
|
||||
|
||||
// TODO: Debug json toBigInt failing test case.
|
||||
// const bigIntValue = numberValue.toBigInt();
|
||||
// assert(bigIntValue.toString() == '123', 'values are not equal');
|
||||
const u64Value = numberValue.toU64();
|
||||
const expectedU64: u64 = 123;
|
||||
assert(u64Value === expectedU64, 'u64 values are not equal');
|
||||
|
||||
const f64Value = numberValue.toF64();
|
||||
const expectedF64: f64 = 123;
|
||||
assert(f64Value === expectedF64, 'f64 values are not equal');
|
||||
|
||||
const bigIntValue = numberValue.toBigInt();
|
||||
const expectedBigInt = BigInt.fromString('123');
|
||||
assert(bigIntValue.equals(expectedBigInt), 'BigInt values are not equal');
|
||||
}
|
||||
|
||||
export function testJsonTryFromBytes (): void {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
specVersion: 0.0.2
|
||||
specVersion: 0.0.4
|
||||
schema:
|
||||
file: ./schema.graphql
|
||||
dataSources:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user