Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ts codegen #8267

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 18 additions & 15 deletions yarn-project/builder/src/contract-interface-gen/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,10 @@ function generateEvents(events: any[] | undefined) {
* @returns The corresponding ts code.
*/
export function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string) {
const methods = input.functions.filter(f => !f.isInternal).map(generateMethod);
const methods = input.functions
.filter(f => !f.isInternal)
.sort((a, b) => a.name.localeCompare(b.name))
.map(generateMethod);
const deploy = artifactImportPath && generateDeploy(input);
const ctor = artifactImportPath && generateConstructor(input.name);
const at = artifactImportPath && generateAt(input.name);
Expand All @@ -332,31 +335,31 @@ export function generateTypescriptContractInterface(input: ContractArtifact, art
/* eslint-disable */
import {
AztecAddress,
AztecAddressLike,
type AztecAddressLike,
CompleteAddress,
Contract,
ContractArtifact,
type ContractArtifact,
ContractBase,
ContractFunctionInteraction,
ContractInstanceWithAddress,
ContractMethod,
ContractStorageLayout,
ContractNotes,
type ContractInstanceWithAddress,
type ContractMethod,
type ContractStorageLayout,
type ContractNotes,
DeployMethod,
EthAddress,
EthAddressLike,
type EthAddressLike,
EventSelector,
FieldLike,
type FieldLike,
Fr,
FunctionSelectorLike,
type FunctionSelectorLike,
L1EventPayload,
loadContractArtifact,
NoirCompiledContract,
type NoirCompiledContract,
NoteSelector,
Point,
PublicKey,
Wallet,
WrappedFieldLike,
type PublicKey,
type Wallet,
type WrappedFieldLike,
} from '@aztec/aztec.js';
${artifactStatement}

Expand All @@ -379,7 +382,7 @@ export class ${input.name}Contract extends ContractBase {
${notesGetter}

/** Type-safe wrappers for the public methods exposed by the contract. */
public override methods!: {
public declare methods: {
${methods.join('\n')}
};

Expand Down
Loading