@aztec/builder 0.0.1-commit.ff7989d6c → 0.0.1-commit.ffe5b04ea

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,4 +6,4 @@ import { type ContractArtifact } from '@aztec/stdlib/abi';
6
6
  * @returns The corresponding ts code.
7
7
  */
8
8
  export declare function generateTypescriptContractInterface(input: ContractArtifact, artifactImportPath?: string): Promise<string>;
9
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXNjcmlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vdHlwZXNjcmlwdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsS0FBSyxnQkFBZ0IsRUFZdEIsTUFBTSxtQkFBbUIsQ0FBQztBQTRRM0I7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsbUNBQW1DLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFLGtCQUFrQixDQUFDLEVBQUUsTUFBTSxtQkFrRDdHIn0=
9
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXNjcmlwdC5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2NvbnRyYWN0LWludGVyZmFjZS1nZW4vdHlwZXNjcmlwdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBR0wsS0FBSyxnQkFBZ0IsRUFhdEIsTUFBTSxtQkFBbUIsQ0FBQztBQStRM0I7Ozs7O0dBS0c7QUFDSCx3QkFBc0IsbUNBQW1DLENBQUMsS0FBSyxFQUFFLGdCQUFnQixFQUFFLGtCQUFrQixDQUFDLEVBQUUsTUFBTSxtQkFrRDdHIn0=
@@ -1 +1 @@
1
- {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAYtB,MAAM,mBAAmB,CAAC;AA4Q3B;;;;;GAKG;AACH,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,MAAM,mBAkD7G"}
1
+ {"version":3,"file":"typescript.d.ts","sourceRoot":"","sources":["../../src/contract-interface-gen/typescript.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gBAAgB,EAatB,MAAM,mBAAmB,CAAC;AA+Q3B;;;;;GAKG;AACH,wBAAsB,mCAAmC,CAAC,KAAK,EAAE,gBAAgB,EAAE,kBAAkB,CAAC,EAAE,MAAM,mBAkD7G"}
@@ -1,4 +1,4 @@
1
- import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultInitializer, isAztecAddressStruct, isBoundedVecStruct, isEthAddressStruct, isFunctionSelectorStruct, isPublicKeysStruct, isWrappedFieldStruct } from '@aztec/stdlib/abi';
1
+ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultInitializer, isAztecAddressStruct, isBoundedVecStruct, isEthAddressStruct, isFunctionSelectorStruct, isOptionStruct, isPublicKeysStruct, isWrappedFieldStruct } from '@aztec/stdlib/abi';
2
2
  /**
3
3
  * Returns the corresponding typescript type for a given Noir type.
4
4
  * @param type - The input Noir type.
@@ -38,6 +38,9 @@ import { EventSelector, decodeFunctionSignature, getAllFunctionAbis, getDefaultI
38
38
  // as a BoundedVec in the ArgumentsEncoder.
39
39
  return `${abiTypeToTypescript(type.fields[0].type)}`;
40
40
  }
41
+ if (isOptionStruct(type)) {
42
+ return `OptionLike<${abiTypeToTypescript(type.fields[1].type)}>`;
43
+ }
41
44
  return `{ ${type.fields.map((f)=>`${f.name}: ${abiTypeToTypescript(f.type)}`).join(', ')} }`;
42
45
  default:
43
46
  throw new Error(`Unknown type ${type.kind}`);
@@ -250,7 +253,7 @@ async function generateEvents(events) {
250
253
 
251
254
  /* eslint-disable */
252
255
  import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
253
- import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
256
+ import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type OptionLike, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
254
257
  import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
255
258
  import { EthAddress } from '@aztec/aztec.js/addresses';
256
259
  import { Fr, Point } from '@aztec/aztec.js/fields';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/builder",
3
- "version": "0.0.1-commit.ff7989d6c",
3
+ "version": "0.0.1-commit.ffe5b04ea",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -67,8 +67,8 @@
67
67
  ]
68
68
  },
69
69
  "dependencies": {
70
- "@aztec/foundation": "0.0.1-commit.ff7989d6c",
71
- "@aztec/stdlib": "0.0.1-commit.ff7989d6c",
70
+ "@aztec/foundation": "0.0.1-commit.ffe5b04ea",
71
+ "@aztec/stdlib": "0.0.1-commit.ffe5b04ea",
72
72
  "commander": "^12.1.0"
73
73
  },
74
74
  "devDependencies": {
@@ -11,6 +11,7 @@ import {
11
11
  isBoundedVecStruct,
12
12
  isEthAddressStruct,
13
13
  isFunctionSelectorStruct,
14
+ isOptionStruct,
14
15
  isPublicKeysStruct,
15
16
  isWrappedFieldStruct,
16
17
  } from '@aztec/stdlib/abi';
@@ -55,6 +56,9 @@ function abiTypeToTypescript(type: ABIParameter['type']): string {
55
56
  // as a BoundedVec in the ArgumentsEncoder.
56
57
  return `${abiTypeToTypescript(type.fields[0].type)}`;
57
58
  }
59
+ if (isOptionStruct(type)) {
60
+ return `OptionLike<${abiTypeToTypescript(type.fields[1].type)}>`;
61
+ }
58
62
  return `{ ${type.fields.map(f => `${f.name}: ${abiTypeToTypescript(f.type)}`).join(', ')} }`;
59
63
  default:
60
64
  throw new Error(`Unknown type ${type.kind}`);
@@ -305,7 +309,7 @@ export async function generateTypescriptContractInterface(input: ContractArtifac
305
309
 
306
310
  /* eslint-disable */
307
311
  import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses';
308
- import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
312
+ import { type AbiType, type AztecAddressLike, type ContractArtifact, EventSelector, decodeFromAbi, type EthAddressLike, type FieldLike, type FunctionSelectorLike, loadContractArtifact, loadContractArtifactForPublic, type NoirCompiledContract, type OptionLike, type U128Like, type WrappedFieldLike } from '@aztec/aztec.js/abi';
309
313
  import { Contract, ContractBase, ContractFunctionInteraction, type ContractMethod, type ContractStorageLayout, DeployMethod } from '@aztec/aztec.js/contracts';
310
314
  import { EthAddress } from '@aztec/aztec.js/addresses';
311
315
  import { Fr, Point } from '@aztec/aztec.js/fields';