Skip to content

Commit

Permalink
✨ feat: ERC1155 batch transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
matstyler committed Feb 28, 2024
1 parent 6f5034b commit 5083b7f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
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')
})
}
})

0 comments on commit 5083b7f

Please sign in to comment.