mirror of
https://github.com/cerc-io/watcher-ts
synced 2025-02-02 00:02:49 +00:00
Instantiate a new wasm string to convert JSON value to BigInt
This commit is contained in:
parent
e6b957e921
commit
d455a95c9f
@ -778,9 +778,9 @@ export const instantiate = async (
|
|||||||
'json.toF64': async (decimal: number) => {
|
'json.toF64': async (decimal: number) => {
|
||||||
return BigInt(__getString(decimal));
|
return BigInt(__getString(decimal));
|
||||||
},
|
},
|
||||||
// TODO: Debug toBigInt not working.
|
|
||||||
'json.toBigInt': async (decimal: number) => {
|
'json.toBigInt': async (decimal: number) => {
|
||||||
return ASBigInt.fromString(decimal);
|
const ptr = await __newString(__getString(decimal));
|
||||||
|
return ASBigInt.fromString(ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -581,9 +581,9 @@ export function testJsonFromBytes (): void {
|
|||||||
// const i64Value = numberValue.toI64();
|
// const i64Value = numberValue.toI64();
|
||||||
// assert(i64Value == 123, 'values are not equal');
|
// assert(i64Value == 123, 'values are not equal');
|
||||||
|
|
||||||
// TODO: Debug json toBigInt failing test case.
|
const bigIntValue = numberValue.toBigInt();
|
||||||
// const bigIntValue = numberValue.toBigInt();
|
const expectedBigInt = BigInt.fromString('123');
|
||||||
// assert(bigIntValue.toString() == '123', 'values are not equal');
|
assert(bigIntValue.equals(expectedBigInt), 'BigInt values are not equal');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function testJsonTryFromBytes (): void {
|
export function testJsonTryFromBytes (): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user