mirror of
https://github.com/cerc-io/watcher-ts
synced 2026-09-08 16:54:08 +00:00
Implement host API for big decimal equals (#476)
* Implement host api for big decimal equals * Add test cases for big decimal equals * Use boolean type conversion --------- Co-authored-by: neeraj <neeraj.rtly@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
|
||||
import { Address, log, BigInt, BigDecimal, ByteArray, dataSource, ethereum, Bytes, crypto, json, JSONValueKind } from '@graphprotocol/graph-ts';
|
||||
import { Address, log, BigInt, BigDecimal, bigDecimal, ByteArray, dataSource, ethereum, Bytes, crypto, json, JSONValueKind } from '@graphprotocol/graph-ts';
|
||||
|
||||
import {
|
||||
Example1,
|
||||
@@ -299,6 +299,15 @@ export function testBigDecimalTimes (value1: string, value2: string): string {
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
export function testBigDecimalEquals (value1: string, value2: string): boolean {
|
||||
log.debug('In test bigDecimal.equals', []);
|
||||
|
||||
const bigDecimal1 = bigDecimal.fromString(value1);
|
||||
const bigDecimal2 = bigDecimal.fromString(value2);
|
||||
|
||||
return bigDecimal1.equals(bigDecimal2);
|
||||
}
|
||||
|
||||
export function testBigIntPlus (value1: string, value2: string): string {
|
||||
log.debug('In test bigInt.plus', []);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user