Browser Compatibility Updates (#107)

* BigInt -> big-integer to support older browsers
* Buffer read/write BigUInt64 removed for browser compatibility.
This commit is contained in:
Nathan Nichols
2020-10-22 15:36:45 -05:00
parent b197897227
commit b43e79a9af
10 changed files with 1288 additions and 1215 deletions

View File

@@ -9,6 +9,7 @@ import { sha512Half, transactionID } from "./hashes";
import { FieldInstance } from "./enums";
import { STObject } from "./types/st-object";
import { JsonObject } from "./types/serialized-type";
import * as bigInt from "big-integer";
/**
* Construct a BinaryParser
@@ -102,9 +103,10 @@ interface ClaimObject extends JsonObject {
* @returns the serialized object with appropriate prefix
*/
function signingClaimData(claim: ClaimObject): Buffer {
const num = bigInt(String(claim.amount));
const prefix = HashPrefix.paymentChannelClaim;
const channel = coreTypes.Hash256.from(claim.channel).toBytes();
const amount = coreTypes.UInt64.from(BigInt(claim.amount)).toBytes();
const amount = coreTypes.UInt64.from(num).toBytes();
const bytesList = new BytesList();