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:
2023-11-17 10:26:03 +05:30
committed by GitHub
co-authored by neeraj
parent 7c8f84b1dc
commit e54f4c9276
4 changed files with 51 additions and 1 deletions
@@ -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', []);