Skip to content

Commit

Permalink
Regenerate ts interface for boxes
Browse files Browse the repository at this point in the history
  • Loading branch information
spalladino committed Oct 6, 2023
1 parent ceca748 commit 004b3c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 54 deletions.
24 changes: 6 additions & 18 deletions yarn-project/boxes/blank-react/src/artifacts/blank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import {
AztecAddress,
CompleteAddress,
Contract,
ContractBase,
ContractFunctionInteraction,
ContractMethod,
DeployMethod,
EthAddress,
FieldLike,
AztecAddressLike,
EthAddressLike,
Expand All @@ -23,13 +25,8 @@ export const BlankContractAbi = BlankContractAbiJson as ContractAbi;
* Type-safe interface for contract Blank;
*/
export class BlankContract extends ContractBase {
private constructor(
/** The deployed contract's complete address. */
completeAddress: CompleteAddress,
/** The wallet. */
wallet: Wallet,
) {
super(completeAddress, BlankContractAbi, wallet);
private constructor(completeAddress: CompleteAddress, wallet: Wallet, portalContract = EthAddress.ZERO) {
super(completeAddress, BlankContractAbi, wallet, portalContract);
}

/**
Expand All @@ -38,17 +35,8 @@ export class BlankContract extends ContractBase {
* @param wallet - The wallet to use when interacting with the contract.
* @returns A promise that resolves to a new Contract instance.
*/
public static async at(
/** The deployed contract's address. */
address: AztecAddress,
/** The wallet. */
wallet: Wallet,
) {
const extendedContractData = await wallet.getExtendedContractData(address);
if (extendedContractData === undefined) {
throw new Error('Contract ' + address.toString() + ' is not deployed');
}
return new BlankContract(extendedContractData.getCompleteAddress(), wallet);
public static async at(address: AztecAddress, wallet: Wallet) {
return Contract.at(address, BlankContract.abi, wallet) as Promise<BlankContract>;
}

/**
Expand Down
24 changes: 6 additions & 18 deletions yarn-project/boxes/blank/src/artifacts/blank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import {
AztecAddress,
CompleteAddress,
Contract,
ContractBase,
ContractFunctionInteraction,
ContractMethod,
DeployMethod,
EthAddress,
FieldLike,
AztecAddressLike,
EthAddressLike,
Expand All @@ -23,13 +25,8 @@ export const BlankContractAbi = BlankContractAbiJson as ContractAbi;
* Type-safe interface for contract Blank;
*/
export class BlankContract extends ContractBase {
private constructor(
/** The deployed contract's complete address. */
completeAddress: CompleteAddress,
/** The wallet. */
wallet: Wallet,
) {
super(completeAddress, BlankContractAbi, wallet);
private constructor(completeAddress: CompleteAddress, wallet: Wallet, portalContract = EthAddress.ZERO) {
super(completeAddress, BlankContractAbi, wallet, portalContract);
}

/**
Expand All @@ -38,17 +35,8 @@ export class BlankContract extends ContractBase {
* @param wallet - The wallet to use when interacting with the contract.
* @returns A promise that resolves to a new Contract instance.
*/
public static async at(
/** The deployed contract's address. */
address: AztecAddress,
/** The wallet. */
wallet: Wallet,
) {
const extendedContractData = await wallet.getExtendedContractData(address);
if (extendedContractData === undefined) {
throw new Error('Contract ' + address.toString() + ' is not deployed');
}
return new BlankContract(extendedContractData.getCompleteAddress(), wallet);
public static async at(address: AztecAddress, wallet: Wallet) {
return Contract.at(address, BlankContract.abi, wallet) as Promise<BlankContract>;
}

/**
Expand Down
24 changes: 6 additions & 18 deletions yarn-project/boxes/private-token/src/artifacts/private_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
import {
AztecAddress,
CompleteAddress,
Contract,
ContractBase,
ContractFunctionInteraction,
ContractMethod,
DeployMethod,
EthAddress,
FieldLike,
AztecAddressLike,
EthAddressLike,
Expand All @@ -23,13 +25,8 @@ export const PrivateTokenContractAbi = PrivateTokenContractAbiJson as ContractAb
* Type-safe interface for contract PrivateToken;
*/
export class PrivateTokenContract extends ContractBase {
private constructor(
/** The deployed contract's complete address. */
completeAddress: CompleteAddress,
/** The wallet. */
wallet: Wallet,
) {
super(completeAddress, PrivateTokenContractAbi, wallet);
private constructor(completeAddress: CompleteAddress, wallet: Wallet, portalContract = EthAddress.ZERO) {
super(completeAddress, PrivateTokenContractAbi, wallet, portalContract);
}

/**
Expand All @@ -38,17 +35,8 @@ export class PrivateTokenContract extends ContractBase {
* @param wallet - The wallet to use when interacting with the contract.
* @returns A promise that resolves to a new Contract instance.
*/
public static async at(
/** The deployed contract's address. */
address: AztecAddress,
/** The wallet. */
wallet: Wallet,
) {
const extendedContractData = await wallet.getExtendedContractData(address);
if (extendedContractData === undefined) {
throw new Error('Contract ' + address.toString() + ' is not deployed');
}
return new PrivateTokenContract(extendedContractData.getCompleteAddress(), wallet);
public static async at(address: AztecAddress, wallet: Wallet) {
return Contract.at(address, PrivateTokenContract.abi, wallet) as Promise<PrivateTokenContract>;
}

/**
Expand Down

0 comments on commit 004b3c3

Please sign in to comment.