Comparing version 0.0.91 to 0.0.92
@@ -539,4 +539,4 @@ import { check } from "./system"; | ||
pack(): u8[] { | ||
const rawX = Utils.hexToBytes(this.x.toString(16).padStart(32, '0')); | ||
const rawY = Utils.hexToBytes(this.y.toString(16).padStart(32, '0')); | ||
const rawX = this.x.toBytes(true); | ||
const rawY = this.y.toBytes(true) | ||
return rawX.concat(rawY); | ||
@@ -552,2 +552,9 @@ } | ||
unpackLE(data: u8[]): usize { | ||
let dec = new Decoder(data); | ||
this.x = U256.fromBytesLE(dec.unpackBytes(32)) | ||
this.y = U256.fromBytesLE(dec.unpackBytes(32)) | ||
return dec.getPos(); | ||
} | ||
getSize(): usize { | ||
@@ -581,6 +588,6 @@ return 64; | ||
pack(): u8[] { | ||
const rawX1 = Utils.hexToBytes(this.x1.toString(16).padStart(32, '0')); | ||
const rawX2 = Utils.hexToBytes(this.x2.toString(16).padStart(32, '0')); | ||
const rawY1 = Utils.hexToBytes(this.y1.toString(16).padStart(32, '0')); | ||
const rawY2 = Utils.hexToBytes(this.y2.toString(16).padStart(32, '0')); | ||
const rawX1 = this.x1.toBytes(true); | ||
const rawX2 = this.x2.toBytes(true); | ||
const rawY1 = this.y1.toBytes(true); | ||
const rawY2 = this.y2.toBytes(true); | ||
return rawX1.concat(rawX2).concat(rawY1).concat(rawY2); | ||
@@ -598,2 +605,11 @@ } | ||
unpackLE(data: u8[]): usize { | ||
let dec = new Decoder(data); | ||
this.x1 = U256.fromBytesLE(dec.unpackBytes(32)) | ||
this.x2 = U256.fromBytesLE(dec.unpackBytes(32)) | ||
this.y1 = U256.fromBytesLE(dec.unpackBytes(32)) | ||
this.y2 = U256.fromBytesLE(dec.unpackBytes(32)) | ||
return dec.getPos(); | ||
} | ||
getSize(): usize { | ||
@@ -657,3 +673,3 @@ return 128; | ||
const rawG1 = g1.pack(); | ||
const rawScalar = Utils.hexToBytes(scalar.toString(16).padStart(32, '0')); | ||
const rawScalar = scalar.toBytes(true); | ||
const rawResult = new Array<u8>(64); | ||
@@ -664,3 +680,3 @@ const ret = env.alt_bn128_mul(rawG1.dataStart, rawG1.length, rawScalar.dataStart, rawScalar.length, rawResult.dataStart, rawResult.length) | ||
result.unpack(rawResult); | ||
return result; | ||
return new AltBn128G1(); | ||
} | ||
@@ -667,0 +683,0 @@ |
{ | ||
"name": "as-chain", | ||
"version": "0.0.91", | ||
"version": "0.0.92", | ||
"description": "chain module for assemblyscript", | ||
@@ -5,0 +5,0 @@ "main": "js/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1577228
6731