Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Aug 22, 2023
1 parent 52d9d44 commit 0fdfe22
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
6 changes: 3 additions & 3 deletions yarn-project/end-to-end/src/e2e_2_rpc_servers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ describe('e2e_2_rpc_servers', () => {
await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance);
await expectTokenBalance(walletB, tokenAddress, userB.address, 0n);
await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Balance set in constructor']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']);

// Transfer funds from A to B via RPC server A
const contractWithWalletA = await PrivateTokenContract.at(tokenAddress, walletA);
Expand All @@ -130,7 +130,7 @@ describe('e2e_2_rpc_servers', () => {
await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance - transferAmount1);
await expectTokenBalance(walletB, tokenAddress, userB.address, transferAmount1);
await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins transferred']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']);

// Transfer funds from B to A via RPC server B
const contractWithWalletB = await PrivateTokenContract.at(tokenAddress, walletB);
Expand All @@ -147,7 +147,7 @@ describe('e2e_2_rpc_servers', () => {
await expectTokenBalance(walletA, tokenAddress, userA.address, initialBalance - transferAmount1 + transferAmount2);
await expectTokenBalance(walletB, tokenAddress, userB.address, transferAmount1 - transferAmount2);
await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins transferred']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']);
}, 120_000);

const deployChildContractViaServerA = async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('e2e_multiple_accounts_1_enc_key', () => {
}

await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins transferred']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']);

logger(`Transfer ${transferAmount} from ${sender} to ${receiver} successful`);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('e2e_private_token_contract', () => {
await expectBalance(receiver, 0n);

await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Balance set in constructor']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']);
}, 30_000);

/**
Expand All @@ -81,7 +81,7 @@ describe('e2e_private_token_contract', () => {
await expectBalance(owner, mintAmount);

await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins minted']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins minted']);
}, 60_000);

/**
Expand All @@ -97,7 +97,7 @@ describe('e2e_private_token_contract', () => {
await expectBalance(receiver, 0n);

await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 1);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Balance set in constructor']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Balance set in constructor']);

const tx = contract.methods.transfer(transferAmount, owner, receiver).send({ origin: owner });

Expand All @@ -110,6 +110,6 @@ describe('e2e_private_token_contract', () => {
await expectBalance(receiver, transferAmount);

await expectsNumOfEncryptedLogsInTheLastBlockToBe(aztecNode, 2);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode, ['Coins transferred']);
await expectUnencryptedLogsFromLastBlockToBe(aztecNode!, ['Coins transferred']);
}, 60_000);
});
13 changes: 8 additions & 5 deletions yarn-project/end-to-end/src/e2e_sandbox_example.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-unused-vars */

/* eslint-disable import/no-duplicates */
// docs:start:imports
import {
Expand All @@ -10,14 +11,14 @@ import {
getSchnorrAccount,
mustSucceedFetch,
} from '@aztec/aztec.js';
import { PrivateTokenContract } from '@aztec/noir-contracts/types';

// docs:end:imports

/* eslint-enable @typescript-eslint/no-unused-vars */
// Note: this is a hack to make the docs use http://localhost:8080 and CI to use the SANDBOX_URL
import { createAztecRpcClient as createAztecRpcClient2 } from '@aztec/aztec.js';
import { defaultFetch } from '@aztec/foundation/json-rpc/client';
import { PrivateTokenContract } from '@aztec/noir-contracts/types';

import { expectUnencryptedLogsFromLastBlockToBe } from './fixtures/utils.js';

const { SANDBOX_URL } = process.env;
Expand Down Expand Up @@ -105,9 +106,11 @@ describe('e2e_sandbox_example', () => {
aztecRpc,
initialSupply, // the initial supply
alice, // the owner of the initial supply
).send().deployed();
)
.send()
.deployed();

logger(`Contract successfully deployed at address ${contract.address!.toShortString()}`);
logger(`Contract successfully deployed at address ${contract.address!.toShortString()}`);
// docs:end:Deployment

// ensure that private token contract is registered in the rpc
Expand Down Expand Up @@ -199,6 +202,6 @@ describe('e2e_sandbox_example', () => {
expect(aliceBalance).toBe(initialSupply - transferQuantity);
expect(bobBalance).toBe(transferQuantity + mintQuantity);

await expectUnencryptedLogsFromLastBlockToBe(aztecRpc, ["Coins minted"]);
await expectUnencryptedLogsFromLastBlockToBe(aztecRpc, ['Coins minted']);
}, 60_000);
});

0 comments on commit 0fdfe22

Please sign in to comment.