Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat: ERC1155 batch transfer #1110

Merged
merged 4 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions wallets/metamask/test/e2e/metamask/batchTransfer.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { testWithMetaMask } from '../testWithMetaMask'

const test = testWithMetaMask

const { expect } = test

test('should confirm approval to transfer all from ERC1155', async ({ page, metamask, deployAndMintERC1155 }) => {
await deployAndMintERC1155()

await page.locator('#setApprovalForAllERC1155Button').click()
await metamask.confirmTransaction()

await expect(page.locator('#erc1155Status')).toHaveText('Set Approval For All completed')
})

test('should perform batch ERC115 transfer', async ({ page, metamask, deployAndMintERC1155 }) => {
await deployAndMintERC1155()

await page.locator('#batchTransferFromButton').click()
await metamask.confirmTransaction()

await expect(page.locator('#erc1155Status')).toHaveText('Batch Transfer From completed')
})
14 changes: 14 additions & 0 deletions wallets/metamask/test/e2e/testWithMetaMask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const testWithMetaMask = testWithSynpress(connectedSetup, unlockForFixtur
metamask: MetaMask
connectToAnvil: () => Promise<void>
deployToken: () => Promise<void>
deployAndMintERC1155: () => Promise<void>
}>({
metamask: async ({ context, metamaskPage, extensionId }, use) => {
const metamask = new MetaMask(context, metamaskPage, connectedSetup.walletPassword, extensionId)
Expand Down Expand Up @@ -43,5 +44,18 @@ export const testWithMetaMask = testWithSynpress(connectedSetup, unlockForFixtur

await metamask.confirmTransaction()
})
},
deployAndMintERC1155: async ({ page, metamask, connectToAnvil }, use) => {
await use(async () => {
await connectToAnvil()

await page.locator('#deployERC1155Button').click()
await metamask.confirmTransaction()

await page.locator('#batchMintButton').click()
await metamask.confirmTransactionAndWaitForMining()

await expect(page.locator('#erc1155Status')).toHaveText('Batch Minting completed')
})
}
})
Loading