-
In BigInt class of graph-ts library, the operators rely on certain functions. However, only host interfaces are defined, but I cannot find the implementation for those functions. /** Host interface for BigInt arithmetic */
export declare namespace bigInt {
function plus(x: BigInt, y: BigInt): BigInt;
function minus(x: BigInt, y: BigInt): BigInt;
function times(x: BigInt, y: BigInt): BigInt;
function dividedBy(x: BigInt, y: BigInt): BigInt;
function dividedByDecimal(x: BigInt, y: BigDecimal): BigDecimal;
function mod(x: BigInt, y: BigInt): BigInt;
function pow(x: BigInt, exp: u8): BigInt;
function fromString(s: string): BigInt;
function bitOr(x: BigInt, y: BigInt): BigInt;
function bitAnd(x: BigInt, y: BigInt): BigInt;
function leftShift(x: BigInt, bits: u8): BigInt;
function rightShift(x: BigInt, bits: u8): BigInt;
} Also, conversion.ts has interface, but no implementation. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@fewwwww There is no implementations because those are WASM intrinsics, which is essentially the signature of functions that you can use in your AssemblyScript code that are provided by the host environment, so the entity actually executing the WASM compiled from your AssemblyScript source code. In The Graph case, the host environment is |
Beta Was this translation helpful? Give feedback.
@fewwwww There is no implementations because those are WASM intrinsics, which is essentially the signature of functions that you can use in your AssemblyScript code that are provided by the host environment, so the entity actually executing the WASM compiled from your AssemblyScript source code.
In The Graph case, the host environment is
graph-node
which is the one responsible for executing your WASM code. You can find most of the intrinsics implementation at https://github.com/graphprotocol/graph-node/blob/master/runtime/wasm/src/host_exports.rs for example thebigInt#plus
method implementation is defined at https://github.com/graphprotocol/graph-node/blob/master/runtime/wasm/src/host_ex…