Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
sklppy88 committed Oct 14, 2024
1 parent 440e729 commit ea2ca9e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions yarn-project/circuits.js/src/types/public_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ export class PublicKeys {
];
}

encodeToNoir(): Fr[] {
return this.toFields();
}

static fromFields(fields: Fr[] | FieldReader): PublicKeys {
const reader = FieldReader.asReader(fields);
return new PublicKeys(
Expand Down
6 changes: 6 additions & 0 deletions yarn-project/foundation/src/abi/encoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ class ArgumentEncoder {
}
break;
case 'struct': {
// If the type defines the encoding to noir, we use it
if (arg.encodeToNoir !== undefined) {
this.flattened.push(...arg.encodeToNoir());
break;
}

// If the abi expects a struct like { address: Field } and the supplied arg does not have
// an address field in it, we try to encode it as if it were a field directly.
const isAddress = isAddressStruct(abiType);
Expand Down

0 comments on commit ea2ca9e

Please sign in to comment.