From 4e9f49f8ea14ab7a5a2bfd3f164ef27b88046321 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Mon, 14 Aug 2023 22:16:58 -0300 Subject: [PATCH] Rename contract create to at in tests --- docs/src/code_examples/sandbox_example.ts | 4 ++-- yarn-project/aztec-cli/src/index.ts | 2 +- .../src/examples/private_token_contract.ts | 2 +- .../src/examples/uniswap_trade_on_l1_from_l2.ts | 2 +- yarn-project/aztec-sandbox/src/examples/util.ts | 2 +- yarn-project/aztec.js/README.md | 4 ++-- yarn-project/aztec.js/src/contract/contract.test.ts | 10 +++++----- yarn-project/aztec.js/src/contract/contract.ts | 2 +- .../aztec.js/src/contract_deployer/deploy_sent_tx.ts | 2 +- .../canary/src/uniswap_trade_on_l1_from_l2.test.ts | 7 ++----- yarn-project/canary/src/utils.ts | 2 +- .../end-to-end/src/e2e_2_rpc_servers.test.ts | 8 ++++---- .../end-to-end/src/e2e_account_contracts.test.ts | 2 +- .../end-to-end/src/e2e_aztec_js_browser.test.ts | 12 ++---------- yarn-project/end-to-end/src/e2e_cheat_codes.test.ts | 2 +- .../end-to-end/src/e2e_lending_contract.test.ts | 2 +- .../src/e2e_multiple_accounts_1_enc_key.test.ts | 4 ++-- .../end-to-end/src/e2e_nested_contract.test.ts | 2 +- .../end-to-end/src/e2e_non_contract_account.test.ts | 4 ++-- .../src/e2e_pending_commitments_contract.test.ts | 2 +- yarn-project/end-to-end/src/fixtures/utils.ts | 4 ++-- .../src/uniswap_trade_on_l1_from_l2.test.ts | 2 +- 22 files changed, 36 insertions(+), 47 deletions(-) diff --git a/docs/src/code_examples/sandbox_example.ts b/docs/src/code_examples/sandbox_example.ts index f9be30abfab5..1ccbe0fafa34 100644 --- a/docs/src/code_examples/sandbox_example.ts +++ b/docs/src/code_examples/sandbox_example.ts @@ -116,13 +116,13 @@ await viewUnencryptedLogs(); ////////////// QUERYING THE TOKEN BALANCE FOR EACH ACCOUNT ////////////// // Create the contract abstraction and link to Alice's wallet for future signing -const tokenContractAlice = await PrivateTokenContract.create( +const tokenContractAlice = await PrivateTokenContract.at( receipt.contractAddress!, await accounts[0].getWallet() ); // Bob wants to mint some funds, the contract is already deployed, create an abstraction and link it his wallet -const tokenContractBob = await PrivateTokenContract.create( +const tokenContractBob = await PrivateTokenContract.at( receipt.contractAddress!, await accounts[1].getWallet() ); diff --git a/yarn-project/aztec-cli/src/index.ts b/yarn-project/aztec-cli/src/index.ts index a34a2c186010..e87c17aea0fc 100644 --- a/yarn-project/aztec-cli/src/index.ts +++ b/yarn-project/aztec-cli/src/index.ts @@ -345,7 +345,7 @@ async function main() { PrivateKey.fromString(options.privateKey), accountCreationSalt, ); - const contract = await Contract.create(contractAddress, contractAbi, wallet); + const contract = await Contract.at(contractAddress, contractAbi, wallet); const tx = contract.methods[functionName](...functionArgs).send(); await tx.isMined(); log('\nTransaction has been mined'); diff --git a/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts b/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts index 1d831149a2b8..c2c374877405 100644 --- a/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts +++ b/yarn-project/aztec-sandbox/src/examples/private_token_contract.ts @@ -24,7 +24,7 @@ async function deployZKContract(owner: AztecAddress) { logger('Deploying L2 contract...'); const tx = PrivateTokenContract.deploy(aztecRpcClient, INITIAL_BALANCE, owner).send(); const receipt = await tx.getReceipt(); - const contract = await PrivateTokenContract.create(receipt.contractAddress!, wallet); + const contract = await PrivateTokenContract.at(receipt.contractAddress!, wallet); await tx.isMined(); logger('L2 contract deployed'); return contract; diff --git a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts index 66c61b233fed..1639a1c58dc6 100644 --- a/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts +++ b/yarn-project/aztec-sandbox/src/examples/uniswap_trade_on_l1_from_l2.ts @@ -111,7 +111,7 @@ async function deployAllContracts(owner: AztecAddress) { const tx = UniswapContract.deploy(aztecRpcClient).send({ portalContract: uniswapPortalAddress }); await tx.isMined({ interval: 0.5 }); const receipt = await tx.getReceipt(); - const uniswapL2Contract = await UniswapContract.create(receipt.contractAddress!, wallet); + const uniswapL2Contract = await UniswapContract.at(receipt.contractAddress!, wallet); await uniswapL2Contract.attach(uniswapPortalAddress); await uniswapPortal.write.initialize( diff --git a/yarn-project/aztec-sandbox/src/examples/util.ts b/yarn-project/aztec-sandbox/src/examples/util.ts index 42754426880a..f6feb91507e3 100644 --- a/yarn-project/aztec-sandbox/src/examples/util.ts +++ b/yarn-project/aztec-sandbox/src/examples/util.ts @@ -51,7 +51,7 @@ export async function deployAndInitializeNonNativeL2TokenContracts( }); await tx.isMined({ interval: 0.1 }); const receipt = await tx.getReceipt(); - const l2Contract = await NonNativeTokenContract.create(receipt.contractAddress!, wallet); + const l2Contract = await NonNativeTokenContract.at(receipt.contractAddress!, wallet); await l2Contract.attach(tokenPortalAddress); const l2TokenAddress = l2Contract.address.toString() as `0x${string}`; diff --git a/yarn-project/aztec.js/README.md b/yarn-project/aztec.js/README.md index 40cd7f398733..30ca0f8a1efb 100644 --- a/yarn-project/aztec.js/README.md +++ b/yarn-project/aztec.js/README.md @@ -23,7 +23,7 @@ console.log(`Contract address: ${receipt.contractAddress}`); ```typescript import { Contract } from '@aztec/aztec.js'; -const contract = await Contract.create(contractAddress, contractAbi, aztecRpcServer); +const contract = await Contract.at(contractAddress, contractAbi, aztecRpcServer); const tx = contract.methods .transfer(amount, recipientAddress)) .send({ origin: senderAddress }); @@ -36,7 +36,7 @@ console.log(`Transferred ${amount} to ${recipientAddress}!`); ```typescript import { Contract } from '@aztec/aztec.js'; -const contract = await Contract.create(contractAddress, contractAbi, aztecRpcServer); +const contract = await Contract.at(contractAddress, contractAbi, aztecRpcServer); const balance = contract.methods .getBalance(accountPublicKey)) .view({ from: accountAddress }); diff --git a/yarn-project/aztec.js/src/contract/contract.test.ts b/yarn-project/aztec.js/src/contract/contract.test.ts index 188bb08bf1c1..daa2f599ae77 100644 --- a/yarn-project/aztec.js/src/contract/contract.test.ts +++ b/yarn-project/aztec.js/src/contract/contract.test.ts @@ -104,7 +104,7 @@ describe('Contract Class', () => { }); it('should create and send a contract method tx', async () => { - const fooContract = await Contract.create(contractAddress, defaultAbi, wallet); + const fooContract = await Contract.at(contractAddress, defaultAbi, wallet); const param0 = 12; const param1 = 345n; const sentTx = fooContract.methods.bar(param0, param1).send({ @@ -121,7 +121,7 @@ describe('Contract Class', () => { }); it('should call view on an unconstrained function', async () => { - const fooContract = await Contract.create(contractAddress, defaultAbi, wallet); + const fooContract = await Contract.at(contractAddress, defaultAbi, wallet); const result = await fooContract.methods.qux(123n).view({ from: account, }); @@ -131,19 +131,19 @@ describe('Contract Class', () => { }); it('should not call create on an unconstrained function', async () => { - const fooContract = await Contract.create(contractAddress, defaultAbi, wallet); + const fooContract = await Contract.at(contractAddress, defaultAbi, wallet); await expect(fooContract.methods.qux().create({ origin: account })).rejects.toThrow(); }); it('should not call view on a secret or open function', async () => { - const fooContract = await Contract.create(contractAddress, defaultAbi, wallet); + const fooContract = await Contract.at(contractAddress, defaultAbi, wallet); expect(() => fooContract.methods.bar().view()).toThrow(); expect(() => fooContract.methods.baz().view()).toThrow(); }); it('should add contract and dependencies to aztec rpc', async () => { const entry = randomDeployContract(); - const contract = await Contract.create(entry.address, entry.abi, wallet); + const contract = await Contract.at(entry.address, entry.abi, wallet); { await contract.attach(entry.portalContract); diff --git a/yarn-project/aztec.js/src/contract/contract.ts b/yarn-project/aztec.js/src/contract/contract.ts index 64b443231074..bf141aedb1b5 100644 --- a/yarn-project/aztec.js/src/contract/contract.ts +++ b/yarn-project/aztec.js/src/contract/contract.ts @@ -20,7 +20,7 @@ export class Contract 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 create(address: AztecAddress, abi: ContractAbi, wallet: Wallet): Promise { + public static async at(address: AztecAddress, abi: ContractAbi, wallet: Wallet): Promise { if (!(await isContractDeployed(wallet, address))) { throw new Error('Contract ' + address.toString() + ' is not deployed'); } diff --git a/yarn-project/aztec.js/src/contract_deployer/deploy_sent_tx.ts b/yarn-project/aztec.js/src/contract_deployer/deploy_sent_tx.ts index 673c56d45c5e..d60781902582 100644 --- a/yarn-project/aztec.js/src/contract_deployer/deploy_sent_tx.ts +++ b/yarn-project/aztec.js/src/contract_deployer/deploy_sent_tx.ts @@ -50,6 +50,6 @@ export class DeploySentTx extends Sen const contractWallet = wallet ?? (isWallet(this.arc) && this.arc); if (!contractWallet) throw new Error(`A wallet is required for creating a contract instance`); if (!address) throw new Error(`Contract address is missing from transaction receipt`); - return Contract.create(address, this.abi, contractWallet) as Promise; + return Contract.at(address, this.abi, contractWallet) as Promise; } } diff --git a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts b/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts index f6b187c2c452..7fd1a13e229f 100644 --- a/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts +++ b/yarn-project/canary/src/uniswap_trade_on_l1_from_l2.test.ts @@ -114,7 +114,7 @@ async function deployAllContracts( }); await tx.isMined(); const receipt = await tx.getReceipt(); - const uniswapL2Contract = await UniswapContract.create(receipt.contractAddress!, wallet); + const uniswapL2Contract = await UniswapContract.at(receipt.contractAddress!, wallet); await uniswapL2Contract.attach(uniswapPortalAddress); await uniswapPortal.write.initialize( @@ -136,10 +136,7 @@ async function deployAllContracts( }; } -const getL2BalanceOf = async ( - owner: AztecAddress, - l2Contract: NonNativeTokenContract -) => { +const getL2BalanceOf = async (owner: AztecAddress, l2Contract: NonNativeTokenContract) => { return await l2Contract.methods.getBalance(owner).view({ from: owner }); }; diff --git a/yarn-project/canary/src/utils.ts b/yarn-project/canary/src/utils.ts index eb3a14a21d64..52a8c535a0b2 100644 --- a/yarn-project/canary/src/utils.ts +++ b/yarn-project/canary/src/utils.ts @@ -62,7 +62,7 @@ export async function deployAndInitializeNonNativeL2TokenContracts( }); await tx.isMined(); const receipt = await tx.getReceipt(); - const l2Contract = await NonNativeTokenContract.create(receipt.contractAddress!, wallet); + const l2Contract = await NonNativeTokenContract.at(receipt.contractAddress!, wallet); await l2Contract.attach(tokenPortalAddress); const l2TokenAddress = l2Contract.address.toString() as `0x${string}`; diff --git a/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts b/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts index 426b36ff7a52..8d19de92e9d3 100644 --- a/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts +++ b/yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts @@ -70,7 +70,7 @@ describe('e2e_2_rpc_servers', () => { await awaitUserSynchronised(wallet, owner); // Then check the balance - const contractWithWallet = await PrivateTokenContract.create(tokenAddress, wallet); + const contractWithWallet = await PrivateTokenContract.at(tokenAddress, wallet); const balance = await contractWithWallet.methods.getBalance(owner).view({ from: owner }); logger(`Account ${owner} balance: ${balance}`); expect(balance).toBe(expectedBalance); @@ -118,7 +118,7 @@ describe('e2e_2_rpc_servers', () => { await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Balance set in constructor']); // Transfer funds from A to B via RPC server A - const contractWithWalletA = await PrivateTokenContract.create(tokenAddress, walletA); + const contractWithWalletA = await PrivateTokenContract.at(tokenAddress, walletA); const txAToB = contractWithWalletA.methods.transfer(transferAmount1, userA, userB).send({ origin: userA }); await txAToB.isMined({ interval: 0.1 }); @@ -133,7 +133,7 @@ describe('e2e_2_rpc_servers', () => { await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins transferred']); // Transfer funds from B to A via RPC server B - const contractWithWalletB = await PrivateTokenContract.create(tokenAddress, walletB); + const contractWithWalletB = await PrivateTokenContract.at(tokenAddress, walletB); const txBToA = contractWithWalletB.methods.transfer(transferAmount2, userB, userA).send({ origin: userB }); await txBToA.isMined({ interval: 0.1 }); @@ -186,7 +186,7 @@ describe('e2e_2_rpc_servers', () => { const newValueToSet = 256n; - const childContractWithWalletB = await ChildContract.create(childAddress, walletB); + const childContractWithWalletB = await ChildContract.at(childAddress, walletB); const tx = childContractWithWalletB.methods.pubStoreValue(newValueToSet).send({ origin: userB }); await tx.isMined({ interval: 0.1 }); diff --git a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts index f04132b99a3a..8a26fdadc164 100644 --- a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts +++ b/yarn-project/end-to-end/src/e2e_account_contracts.test.ts @@ -60,7 +60,7 @@ function itShouldBehaveLikeAnAccountContract(getAccountContract: (encryptionKey: getAccountContract(PrivateKey.random()), accountAddress, ).getWallet(); - const childWithInvalidWallet = await ChildContract.create(child.address, invalidWallet); + const childWithInvalidWallet = await ChildContract.at(child.address, invalidWallet); await expect(childWithInvalidWallet.methods.value(42).simulate()).rejects.toThrowError( /could not satisfy all constraints/, ); diff --git a/yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts b/yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts index c8e1ec64eec7..2d6acb10de0b 100644 --- a/yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts +++ b/yarn-project/end-to-end/src/e2e_aztec_js_browser.test.ts @@ -142,11 +142,7 @@ conditionalDescribe()('e2e_aztec.js_browser', () => { const client = createAztecRpcClient(rpcUrl!, mustSucceedFetch); const [owner] = await client.getAccounts(); const wallet = await getUnsafeSchnorrWallet(client, owner, privateKey); - const contract = await Contract.create( - AztecAddress.fromString(contractAddress), - PrivateTokenContractAbi, - wallet, - ); + const contract = await Contract.at(AztecAddress.fromString(contractAddress), PrivateTokenContractAbi, wallet); const balance = await contract.methods.getBalance(owner).view({ from: owner }); return balance; }, @@ -180,11 +176,7 @@ conditionalDescribe()('e2e_aztec.js_browser', () => { console.log(`Created 2nd Account: ${receiver.toString()}`); const [owner] = await client.getAccounts(); const wallet = await getUnsafeSchnorrWallet(client, owner, privateKey); - const contract = await Contract.create( - AztecAddress.fromString(contractAddress), - PrivateTokenContractAbi, - wallet, - ); + const contract = await Contract.at(AztecAddress.fromString(contractAddress), PrivateTokenContractAbi, wallet); await contract.methods.transfer(transferAmount, owner, receiver).send({ origin: owner }).wait(); console.log(`Transfered ${transferAmount} tokens to new Account`); return await contract.methods.getBalance(receiver).view({ from: receiver }); diff --git a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts index 37cd528ce07e..7db9be4a41fb 100644 --- a/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts +++ b/yarn-project/end-to-end/src/e2e_cheat_codes.test.ts @@ -140,7 +140,7 @@ describe('e2e_cheat_codes', () => { const tx = LendingContract.deploy(aztecRpcServer).send(); await tx.isMined({ interval: 0.1 }); const receipt = await tx.getReceipt(); - const contract = await LendingContract.create(receipt.contractAddress!, wallet); + const contract = await LendingContract.at(receipt.contractAddress!, wallet); // now update time: const timestamp = await cc.l1.timestamp(); diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts index 60b1a7235ef1..54f5cec5ecc6 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_lending_contract.test.ts @@ -27,7 +27,7 @@ describe('e2e_lending_contract', () => { await tx.isMined({ interval: 0.1 }); const txReceipt = await tx.getReceipt(); logger(`L2 contract deployed at ${receipt.contractAddress}`); - contract = await LendingContract.create(receipt.contractAddress!, wallet); + contract = await LendingContract.at(receipt.contractAddress!, wallet); return { contract, tx, txReceipt }; }; diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts index 342e977a6b13..47807aecf533 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts @@ -67,7 +67,7 @@ describe('e2e_multiple_accounts_1_enc_key', () => { const owner = accounts[userIndex]; // Then check the balance - const contractWithWallet = await PrivateTokenContract.create(privateTokenAddress, wallet); + const contractWithWallet = await PrivateTokenContract.at(privateTokenAddress, wallet); const balance = await contractWithWallet.methods.getBalance(owner).view({ from: owner }); logger(`Account ${owner} balance: ${balance}`); expect(balance).toBe(expectedBalance); @@ -84,7 +84,7 @@ describe('e2e_multiple_accounts_1_enc_key', () => { const sender = accounts[senderIndex]; const receiver = accounts[receiverIndex]; - const contractWithWallet = await PrivateTokenContract.create(privateTokenAddress, wallets[senderIndex]); + const contractWithWallet = await PrivateTokenContract.at(privateTokenAddress, wallets[senderIndex]); const tx = contractWithWallet.methods.transfer(transferAmount, sender, receiver).send({ origin: sender }); await tx.isMined({ interval: 0.1 }); diff --git a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts index fb8cdedd0155..a826fecb50d5 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_nested_contract.test.ts @@ -45,7 +45,7 @@ describe('e2e_nested_contract', () => { await tx.isMined({ interval: 0.1 }); const receipt = await tx.getReceipt(); - const contract = await Contract.create(receipt.contractAddress!, abi, wallet); + const contract = await Contract.at(receipt.contractAddress!, abi, wallet); logger(`L2 contract ${abi.name} deployed at ${contract.address}`); return contract; }; diff --git a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts index 753cc5419fce..4a52ec7ab960 100644 --- a/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts +++ b/yarn-project/end-to-end/src/e2e_non_contract_account.test.ts @@ -35,7 +35,7 @@ describe('e2e_non_contract_account', () => { const minedReceipt = await tx.getReceipt(); expect(minedReceipt.status).toEqual(TxStatus.MINED); logger('L2 contract deployed'); - contract = await PokeableTokenContract.create(receipt.contractAddress!, wallet); + contract = await PokeableTokenContract.at(receipt.contractAddress!, wallet); }, 100_000); afterEach(async () => { @@ -56,7 +56,7 @@ describe('e2e_non_contract_account', () => { await expectBalance(recipient, 0n); await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1); - const contractWithNoContractWallet = await PokeableTokenContract.create(contract.address, pokerWallet); + const contractWithNoContractWallet = await PokeableTokenContract.at(contract.address, pokerWallet); // Send transaction as poker (arbitrary non-contract account) await contractWithNoContractWallet.methods diff --git a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts index ee0242eebb3e..8038de99a4fd 100644 --- a/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts +++ b/yarn-project/end-to-end/src/e2e_pending_commitments_contract.test.ts @@ -62,7 +62,7 @@ describe('e2e_pending_commitments_contract', () => { await tx.isMined({ interval: 0.1 }); await tx.getReceipt(); logger('L2 contract deployed'); - contract = await PendingCommitmentsContract.create(receipt.contractAddress!, wallet); + contract = await PendingCommitmentsContract.at(receipt.contractAddress!, wallet); return contract; }; diff --git a/yarn-project/end-to-end/src/fixtures/utils.ts b/yarn-project/end-to-end/src/fixtures/utils.ts index 8c8073268b48..eef4ac65d4a4 100644 --- a/yarn-project/end-to-end/src/fixtures/utils.ts +++ b/yarn-project/end-to-end/src/fixtures/utils.ts @@ -311,7 +311,7 @@ export async function deployL2Contracts(wallet: Wallet, abis: ContractAbi[]) { const contracts = zipWith( abis, receipts, - async (abi, receipt) => await Contract.create(receipt!.contractAddress!, abi!, wallet), + async (abi, receipt) => await Contract.at(receipt!.contractAddress!, abi!, wallet), ); contracts.forEach(async c => logger(`L2 contract ${(await c).abi.name} deployed at ${(await c).address}`)); return contracts; @@ -374,7 +374,7 @@ export async function deployAndInitializeNonNativeL2TokenContracts( await tx.isMined({ interval: 0.1 }); const receipt = await tx.getReceipt(); if (receipt.status !== TxStatus.MINED) throw new Error(`Tx status is ${receipt.status}`); - const l2Contract = await NonNativeTokenContract.create(receipt.contractAddress!, wallet); + const l2Contract = await NonNativeTokenContract.at(receipt.contractAddress!, wallet); await l2Contract.attach(tokenPortalAddress); const l2TokenAddress = l2Contract.address.toString() as `0x${string}`; diff --git a/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts b/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts index 064c3a546e5f..9219021ef0d4 100644 --- a/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts +++ b/yarn-project/end-to-end/src/uniswap_trade_on_l1_from_l2.test.ts @@ -141,7 +141,7 @@ describe('uniswap_trade_on_l1_from_l2', () => { await tx.isMined({ interval: 0.1 }); const receipt = await tx.getReceipt(); expect(receipt.status).toEqual(TxStatus.MINED); - uniswapL2Contract = await UniswapContract.create(receipt.contractAddress!, wallet); + uniswapL2Contract = await UniswapContract.at(receipt.contractAddress!, wallet); await uniswapL2Contract.attach(uniswapPortalAddress); await uniswapPortal.write.initialize(