Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
expose CommitToPoly as a static method on Element
Browse files Browse the repository at this point in the history
  • Loading branch information
kevaundray committed Oct 15, 2023
1 parent ff0dc56 commit 685492d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
12 changes: 8 additions & 4 deletions verkle_trie_js/src/banderwagon_bindings/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ export class Element {
return this.inner.toBytes();
}

commitToPoly(values: ScalarField[]): Element {
const serializableValues = values.map((value) =>
value.inner.toSerializableWrapper(),
);
const inner = commit_scalar_values(serializableValues);
return Element.fromElementWrapper(inner);
}

static fromBytes(bytes: Uint8Array): Element {
const inner = ElementWrapper.fromBytes(bytes);
return Element.fromElementWrapper(inner);
}
}

export function CommitToPoly(values: ScalarField[]): Element {
throw new Error("Not implemented");
}
1 change: 0 additions & 1 deletion verkle_trie_js/src/banderwagon_bindings/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { Element } from "./element";
export { CommitToPoly } from "./element";
6 changes: 4 additions & 2 deletions verkle_trie_js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Export ScalarField
export { ScalarField as Fr } from "./ecc_bindings/index";

// Export a Banderwagon group element and the commit to polynomial method
export { Element as Point, CommitToPoly } from "./banderwagon_bindings/index";
// Export a Banderwagon group element
//
// commitToPoly is a static method on Point
export { Element as Point } from "./banderwagon_bindings/index";

0 comments on commit 685492d

Please sign in to comment.