Swap-Aggregator-Subgraph/node_modules/@graphprotocol/graph-ts/common/json.ts
Richa-iitr d211083153 Revert "Revert "added handler""
This reverts commit c36ee8c5ca.
2022-07-03 07:30:05 +05:30

29 lines
791 B
TypeScript

import './eager_offset'
import { BigInt } from './numbers'
import { JSONValue } from './value'
import { Bytes, Result } from './collections'
/** Host JSON interface */
export declare namespace json {
function fromBytes(data: Bytes): JSONValue
function try_fromBytes(data: Bytes): Result<JSONValue, boolean>
function toI64(decimal: string): i64
function toU64(decimal: string): u64
function toF64(decimal: string): f64
function toBigInt(decimal: string): BigInt
}
export namespace json {
export function fromString(data: string): JSONValue {
let bytes = Bytes.fromUTF8(data)
return json.fromBytes(bytes)
}
export function try_fromString(data: string): Result<JSONValue, boolean> {
let bytes = Bytes.fromUTF8(data)
return json.try_fromBytes(bytes)
}
}