Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
benesjan committed Oct 21, 2024
1 parent f3ba5db commit b2ebd7c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions yarn-project/end-to-end/src/e2e_nft.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ describe('NFT', () => {
it('transfers to private', async () => {
const nftContractAsUser1 = await NFTContract.at(nftContractAddress, user1Wallet);

// In a simple "shield" flow the sender and recipient are the same. In the "uniswap swap to private" flow
// the sender would be the uniswap contract.
const recipient = user1Wallet.getAddress();
// In a simple "shield" flow the sender and recipient are the same. In the "AMM swap to private" flow
// the sender would be the AMM contract.
const recipient = user2Wallet.getAddress();

const { debugInfo } = await nftContractAsUser1.methods
.transfer_to_private(recipient, TOKEN_ID)
Expand All @@ -80,29 +80,29 @@ describe('NFT', () => {
});

it('transfers in private', async () => {
const nftContractAsUser1 = await NFTContract.at(nftContractAddress, user1Wallet);
const nftContractAsUser2 = await NFTContract.at(nftContractAddress, user2Wallet);

await nftContractAsUser1.methods
.transfer_in_private(user1Wallet.getAddress(), user2Wallet.getAddress(), TOKEN_ID, 0)
await nftContractAsUser2.methods
.transfer_in_private(user2Wallet.getAddress(), user1Wallet.getAddress(), TOKEN_ID, 0)
.send()
.wait();

const user1Nfts = await getPrivateNfts(user1Wallet.getAddress());
expect(user1Nfts).toEqual([]);
expect(user1Nfts).toEqual([TOKEN_ID]);

const user2Nfts = await getPrivateNfts(user2Wallet.getAddress());
expect(user2Nfts).toEqual([TOKEN_ID]);
expect(user2Nfts).toEqual([]);
});

it('transfers to public', async () => {
const nftContractAsUser2 = await NFTContract.at(nftContractAddress, user2Wallet);
const nftContractAsUser1 = await NFTContract.at(nftContractAddress, user1Wallet);

await nftContractAsUser2.methods
.transfer_to_public(user2Wallet.getAddress(), user2Wallet.getAddress(), TOKEN_ID, 0)
await nftContractAsUser1.methods
.transfer_to_public(user1Wallet.getAddress(), user2Wallet.getAddress(), TOKEN_ID, 0)
.send()
.wait();

const publicOwnerAfter = await nftContractAsUser2.methods.owner_of(TOKEN_ID).simulate();
const publicOwnerAfter = await nftContractAsUser1.methods.owner_of(TOKEN_ID).simulate();
expect(publicOwnerAfter).toEqual(user2Wallet.getAddress());
});

Expand Down

0 comments on commit b2ebd7c

Please sign in to comment.