Skip to content

Conversation

@bjfresh
Copy link
Contributor

@bjfresh bjfresh commented Sep 29, 2023

Previously, we relied on a custom wagmi renderer and e2e testing. Here we run transactions more directly against anvil by spinning it up using the viem/anvil package on a local RPC endpoint.

The endpoint invokes a walletClient, which is then used to create new signers for ethers5 and ethers6 using an adaptor.

Each of the tests is run against all 3 signing implementations.

Current test sequence:

✓ can mint 2 Zora 721 NFTs into Anvil wallet #0
✓ can transfer one of the minted NFTs to the TBA
✓ can createAccount
✓ can getAccount
✓ can transfer ETH to the TBA
✓ can executeCall with the TBA
✓ can transferETH with the TBA
✓ can transferNFT with the TBA
✓ can mint 2 Zora 721 NFTs with the TBA
✓ can transferERC20 with the TBA
✓ can use a custom publicClient RPC URL
✓ can sign a message
✓ can sign a hexified message
✓ can sign a Uint8Array message as raw
✓ throws when viem incorrectly receives an ArrayLike message for signing
✓ throws when viem incorrectly receives an Uint8Array message for signing

Additional changes:

  • adds new transferETH, transferERC20, + signMessage methods
  • removes simulateContract calls within methods and simply uses executeCall (mmmmm, dogfood! 🦴)
  • enables users to specify a custom publicClient or publicClientRPCUrl
  • adds Prettify type so that fields from types are cleanly exposed in VSCode
  • moves prettier/eslint config to YAML so it's less finicky (read: actually works)
  • rolls prettier back to 2.8.8 due to eslint-prettier conflict in newer versions
  • bumps viem deps
  • moves params types into separate file
  • adds transaction debug helper function
  • fixes the name of SegmentedERC6551Bytecode type (oops, was SegmentedERC1155Bytecode 😬)

@bjfresh bjfresh requested a review from huynhr September 29, 2023 00:56
@bjfresh bjfresh changed the title Revised Anvil testing methodologies Revised Anvil test pipeline + add transferETH, transferERC20, signMessage methods Sep 30, 2023
@bjfresh bjfresh marked this pull request as ready for review October 2, 2023 20:56
@bjfresh bjfresh requested a review from huynhr October 3, 2023 23:17
@bjfresh bjfresh merged commit 60a8925 into main Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants