|
| 1 | + |
| 2 | +/* Autogenerated file, do not edit! */ |
| 3 | + |
| 4 | +/* eslint-disable */ |
| 5 | +import { |
| 6 | + type AbiType, |
| 7 | + AztecAddress, |
| 8 | + type AztecAddressLike, |
| 9 | + CompleteAddress, |
| 10 | + Contract, |
| 11 | + type ContractArtifact, |
| 12 | + ContractBase, |
| 13 | + ContractFunctionInteraction, |
| 14 | + type ContractInstanceWithAddress, |
| 15 | + type ContractMethod, |
| 16 | + type ContractStorageLayout, |
| 17 | + type ContractNotes, |
| 18 | + decodeFromAbi, |
| 19 | + DeployMethod, |
| 20 | + EthAddress, |
| 21 | + type EthAddressLike, |
| 22 | + EventSelector, |
| 23 | + type FieldLike, |
| 24 | + Fr, |
| 25 | + type FunctionSelectorLike, |
| 26 | + L1EventPayload, |
| 27 | + loadContractArtifact, |
| 28 | + type NoirCompiledContract, |
| 29 | + NoteSelector, |
| 30 | + Point, |
| 31 | + type PublicKey, |
| 32 | + type UnencryptedL2Log, |
| 33 | + type Wallet, |
| 34 | + type WrappedFieldLike, |
| 35 | +} from '@aztec/aztec.js'; |
| 36 | +import ProfileContractArtifactJson from '../../target/zkpTestContract-Profile.json' assert { type: 'json' }; |
| 37 | +export const ProfileContractArtifact = loadContractArtifact(ProfileContractArtifactJson as NoirCompiledContract); |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | +/** |
| 42 | + * Type-safe interface for contract Profile; |
| 43 | + */ |
| 44 | +export class ProfileContract extends ContractBase { |
| 45 | + |
| 46 | + private constructor( |
| 47 | + instance: ContractInstanceWithAddress, |
| 48 | + wallet: Wallet, |
| 49 | + ) { |
| 50 | + super(instance, ProfileContractArtifact, wallet); |
| 51 | + } |
| 52 | + |
| 53 | + |
| 54 | + |
| 55 | + /** |
| 56 | + * Creates a contract instance. |
| 57 | + * @param address - The deployed contract's address. |
| 58 | + * @param wallet - The wallet to use when interacting with the contract. |
| 59 | + * @returns A promise that resolves to a new Contract instance. |
| 60 | + */ |
| 61 | + public static async at( |
| 62 | + address: AztecAddress, |
| 63 | + wallet: Wallet, |
| 64 | + ) { |
| 65 | + return Contract.at(address, ProfileContract.artifact, wallet) as Promise<ProfileContract>; |
| 66 | + } |
| 67 | + |
| 68 | + |
| 69 | + /** |
| 70 | + * Creates a tx to deploy a new instance of this contract. |
| 71 | + */ |
| 72 | + public static deploy(wallet: Wallet, initial_supply: (bigint | number), owner: AztecAddressLike, outgoing_viewer: AztecAddressLike) { |
| 73 | + return new DeployMethod<ProfileContract>(Fr.ZERO, wallet, ProfileContractArtifact, ProfileContract.at, Array.from(arguments).slice(1)); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * Creates a tx to deploy a new instance of this contract using the specified public keys hash to derive the address. |
| 78 | + */ |
| 79 | + public static deployWithPublicKeysHash(publicKeysHash: Fr, wallet: Wallet, initial_supply: (bigint | number), owner: AztecAddressLike, outgoing_viewer: AztecAddressLike) { |
| 80 | + return new DeployMethod<ProfileContract>(publicKeysHash, wallet, ProfileContractArtifact, ProfileContract.at, Array.from(arguments).slice(2)); |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * Creates a tx to deploy a new instance of this contract using the specified constructor method. |
| 85 | + */ |
| 86 | + public static deployWithOpts<M extends keyof ProfileContract['methods']>( |
| 87 | + opts: { publicKeysHash?: Fr; method?: M; wallet: Wallet }, |
| 88 | + ...args: Parameters<ProfileContract['methods'][M]> |
| 89 | + ) { |
| 90 | + return new DeployMethod<ProfileContract>( |
| 91 | + opts.publicKeysHash ?? Fr.ZERO, |
| 92 | + opts.wallet, |
| 93 | + ProfileContractArtifact, |
| 94 | + ProfileContract.at, |
| 95 | + Array.from(arguments).slice(1), |
| 96 | + opts.method ?? 'constructor', |
| 97 | + ); |
| 98 | + } |
| 99 | + |
| 100 | + |
| 101 | + |
| 102 | + /** |
| 103 | + * Returns this contract's artifact. |
| 104 | + */ |
| 105 | + public static get artifact(): ContractArtifact { |
| 106 | + return ProfileContractArtifact; |
| 107 | + } |
| 108 | + |
| 109 | + |
| 110 | + public static get storage(): ContractStorageLayout<'balances' | 'is_adult' | 'profile_nfts'> { |
| 111 | + return { |
| 112 | + balances: { |
| 113 | + slot: new Fr(1n), |
| 114 | + }, |
| 115 | +is_adult: { |
| 116 | + slot: new Fr(2n), |
| 117 | + }, |
| 118 | +profile_nfts: { |
| 119 | + slot: new Fr(3n), |
| 120 | + } |
| 121 | + } as ContractStorageLayout<'balances' | 'is_adult' | 'profile_nfts'>; |
| 122 | + } |
| 123 | + |
| 124 | + |
| 125 | + public static get notes(): ContractNotes<'ProfileNFT' | 'ValueNote'> { |
| 126 | + return { |
| 127 | + ProfileNFT: { |
| 128 | + id: new NoteSelector(4239572523), |
| 129 | + }, |
| 130 | +ValueNote: { |
| 131 | + id: new NoteSelector(1038582377), |
| 132 | + } |
| 133 | + } as ContractNotes<'ProfileNFT' | 'ValueNote'>; |
| 134 | + } |
| 135 | + |
| 136 | + |
| 137 | + /** Type-safe wrappers for the public methods exposed by the contract. */ |
| 138 | + public declare methods: { |
| 139 | + |
| 140 | + /** compute_note_hash_and_optionally_a_nullifier(contract_address: struct, nonce: field, storage_slot: field, note_type_id: field, compute_nullifier: boolean, serialized_note: array) */ |
| 141 | + compute_note_hash_and_optionally_a_nullifier: ((contract_address: AztecAddressLike, nonce: FieldLike, storage_slot: FieldLike, note_type_id: FieldLike, compute_nullifier: boolean, serialized_note: FieldLike[]) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 142 | + |
| 143 | + /** constructor(initial_supply: integer, owner: struct, outgoing_viewer: struct) */ |
| 144 | + constructor: ((initial_supply: (bigint | number), owner: AztecAddressLike, outgoing_viewer: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 145 | + |
| 146 | + /** get_profile_nfts(owner: struct, page_index: integer) */ |
| 147 | + get_profile_nfts: ((owner: AztecAddressLike, page_index: (bigint | number)) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 148 | + |
| 149 | + /** mint(amount: integer, owner: struct, outgoing_viewer: struct) */ |
| 150 | + mint: ((amount: (bigint | number), owner: AztecAddressLike, outgoing_viewer: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 151 | + |
| 152 | + /** mintNFT(to: struct, token_id: field, is_adult: boolean) */ |
| 153 | + mintNFT: ((to: AztecAddressLike, token_id: FieldLike, is_adult: boolean) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 154 | + |
| 155 | + /** update_is_adult(amount: integer, owner: struct, recipient: struct) */ |
| 156 | + update_is_adult: ((amount: (bigint | number), owner: AztecAddressLike, recipient: AztecAddressLike) => ContractFunctionInteraction) & Pick<ContractMethod, 'selector'>; |
| 157 | + }; |
| 158 | + |
| 159 | + |
| 160 | +} |
0 commit comments