Skip to content

Commit

Permalink
export dynamic array for specific types
Browse files Browse the repository at this point in the history
  • Loading branch information
Ho Nguyen Pham authored and Ho Nguyen Pham committed Oct 30, 2023
1 parent 6ae05b7 commit 9b7f40e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@auxo-dev/dkg-libs",
"version": "0.1.4",
"version": "0.1.5",
"description": "",
"author": "",
"license": "Apache-2.0",
Expand Down
34 changes: 31 additions & 3 deletions src/utils/DynamicArray.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,43 @@
import {
Bool,
Circuit,
Field,
FlexibleProvable,
Group,
Poseidon,
Provable,
ProvablePure,
PublicKey,
Struct,
} from 'o1js';
import { CustomScalar } from './CustomScalar';

export {
DynamicArray,
BoolDynamicArray,
FieldDynamicArray,
GroupDynamicArray,
ScalarDynamicArray,
PublicKeyDynamicArray,
};

function BoolDynamicArray(maxLength: number) {
return DynamicArray(Bool, maxLength);
}

function FieldDynamicArray(maxLength: number) {
return DynamicArray(Field, maxLength);
}

export { DynamicArray };
function GroupDynamicArray(maxLength: number) {
return DynamicArray(Group, maxLength);
}

function ScalarDynamicArray(maxLength: number) {
return DynamicArray(CustomScalar, maxLength);
}

function PublicKeyDynamicArray(maxLength: number) {
return DynamicArray(PublicKey, maxLength);
}

type HashableProvable<T> = Provable<T> & {
hash(x: T): Field;
Expand Down

0 comments on commit 9b7f40e

Please sign in to comment.