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

Add cip42 capable tx parser #897

Closed
wants to merge 66 commits into from

Conversation

aaronmgdr
Copy link
Contributor

@aaronmgdr aaronmgdr commented Jul 14, 2023

Following on from #755 it becomes evident that a parser capable of handling cip42 transactions is need as the default will simple error out. This parser follows the same patter as serializer first checking if the transaction is the right kind and if not deferring to the default parseTransaction function.


PR-Codex overview

This PR updates the viem library to version 1.6.1.

Detailed summary

  • Fixed TypeScript 5.1.6 support
  • Added parseTransactionCelo function for parsing serialized transactions
  • Updated various function signatures and types
  • Updated imports and file paths
  • Updated documentation links

The following files were skipped due to too many changes: src/contract.ts, src/utils/abi/decodeErrorResult.test.ts, src/actions/index.ts, src/utils/abi/decodeDeployData.test-d.ts, src/utils/hash/hashFunction.ts, site/docs/ens/actions/getEnsAddress.md, site/.vitepress/sidebar.ts, src/actions/public/estimateContractGas.ts, site/docs/glossary/types.md, src/utils/abi/encodeDeployData.ts, src/constants/abis.ts, src/utils/typedData.ts, src/types/contract.ts, src/actions/ens/getEnsAddress.test.ts, src/utils/abi/formatAbiItem.test.ts, site/docs/clients/test.md, src/accounts/utils/signTransaction.ts, src/utils/unit/parseUnits.test.ts, src/_test/ccip.ts, src/utils/abi/decodeDeployData.ts, src/errors/abi.ts, README.md, site/docs/accounts/custom.md, site/docs/clients/wallet.md, src/utils/hash/getFunctionSelector.test.ts, src/accounts/utils/privateKeyToAddress.ts, src/utils/abi/getAbiItem.ts, src/accounts/utils/signTypedData.ts, src/actions/public/watchBlocks.test.ts, src/utils/abi/encodeFunctionResult.ts, src/utils/abi/decodeEventLog.ts, site/docs/introduction.md, site/docs/accounts/signTransaction.md, src/utils/abi/encodeFunctionData.ts, src/utils/formatters/transactionReceipt.ts, src/actions/public/estimateGas.test.ts, src/actions/public/estimateGas.ts, src/utils/abi/encodeErrorResult.ts, src/utils/promise/withCache.test.ts, src/clients/createTestClient.test.ts, src/utils/formatters/transactionRequest.ts, src/actions/public/createEventFilter.test-d.ts, src/clients/decorators/wallet.ts, src/utils/signature/hexToSignature.ts, src/actions/public/getBlockNumber.ts, src/constants/abis.test.ts, src/utils/abi/decodeErrorResult.ts, src/clients/createClient.ts, src/utils/signature/signatureToHex.ts, src/utils/abi/decodeFunctionResult.ts, src/accounts/index.ts, src/actions/test/mine.test.ts, src/actions/public/createEventFilter.test.ts, src/_test/utils.ts, src/utils/signature/hexToSignature.test.ts, src/utils/promise/withCache.ts, src/utils/abi/encodeEventTopics.ts, src/actions/public/readContract.test.ts, src/actions/public/createContractEventFilter.test-d.ts, src/utils/abi/decodeErrorResult.test-d.ts, src/clients/createPublicClient.test.ts, site/docs/typescript.md, site/docs/utilities/signatureToHex.md, src/actions/getContract.test-d.ts, src/actions/wallet/deployContract.ts, src/errors/contract.test.ts, site/docs/utilities/hexToSignature.md, src/actions/test/setIntervalMining.test.ts, src/utils/chain.ts, src/chains/utils.ts, src/actions/public/simulateContract.ts, site/docs/getting-started.md, src/utils/transaction/parseTransaction.ts, package.json, src/utils/hash/getEventSelector.test.ts, src/actions/getContract.ts, src/clients/createWalletClient.test.ts, src/types/rpc.ts, src/utils/formatters/transaction.ts, site/docs/actions/public/createEventFilter.md, site/docs/actions/public/getBlockNumber.md, src/utils/abi/encodePacked.ts, .github/CONTRIBUTING.md, src/actions/wallet/sendTransaction.ts, src/utils/rpc.test.ts, src/actions/public/getBlock.ts, src/actions/public/multicall.ts, src/types/filter.ts, src/actions/public/getTransaction.ts, src/actions/public/getTransaction.test-d.ts, src/utils/formatters/block.ts, src/types/log.ts, src/actions/wallet/writeContract.ts, src/actions/ens/getEnsAddress.ts, src/types/multicall.ts, src/utils/abi/encodeAbiParameters.test.ts, src/chains/serializers/celo.ts, src/actions/public/multicall.test-d.ts, src/utils/abi/decodeAbiParameters.ts, src/types/block.ts, site/docs/clients/public.md, src/chains/optimism/formatters.ts, site/docs/contract/watchContractEvent.md, site/docs/faq.md, src/actions/public/getLogs.test-d.ts, src/chains/formatters/celo.test-d.ts, src/clients/createClient.test.ts, site/index.md, src/types/transaction.ts, src/chains/optimism/types.ts, src/chains/celo/types.ts, src/actions/public/getFilterLogs.ts, src/actions/public/getFilterChanges.ts, src/chains/formatters/optimism.test-d.ts, src/chains/parsers/celo.ts, src/actions/public/estimateContractGas.test.ts, src/chains/index.ts, src/actions/public/multicall.test.ts, src/utils/abi/encodeAbiParameters.ts, src/errors/contract.ts, src/actions/public/getLogs.test.ts, src/actions/public/getBlock.test-d.ts, src/actions/public/createContractEventFilter.ts, src/chains/formatters/celo.ts, site/docs/actions/public/watchEvent.md, src/constants/number.ts, src/types/chain.ts, src/actions/public/watchBlocks.ts, src/index.ts, site/docs/actions/public/getLogs.md, src/actions/public/getFilterLogs.test.ts, src/utils/transaction/prepareRequest.ts, src/actions/public/getLogs.ts, src/chains/parsers/celo.test.ts, src/actions/public/getFilterChanges.test.ts, src/constants/number.test.ts, src/actions/public/createEventFilter.ts, src/utils/transaction/prepareRequest.test.ts, src/actions/public/getFilterLogs.test-d.ts, src/actions/public/getFilterChanges.test-d.ts, src/clients/decorators/public.ts, src/actions/public/watchContractEvent.ts, CHANGELOG.md, src/actions/public/watchEvent.ts, pnpm-lock.yaml, src/index.test.ts, src/chains/index.test.ts, src/actions/public/watchEvent.test.ts, src/chains/optimism/formatters.test.ts, src/chains/celo/formatters.test.ts, src/actions/public/watchContractEvent.test.ts, src/utils/abi/decodeAbiParameters.test.ts, site/public/bench-isaddress.svg, site/public/bench-encodeabi.svg, site/public/bench-bundlesize.svg

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2023

🦋 Changeset detected

Latest commit: 0d3e5d8

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jul 14, 2023

Someone is attempting to deploy a commit to the wagmi Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Jul 14, 2023

Codecov Report

Merging #897 (f052a78) into main (2c666f4) will decrease coverage by 12.88%.
Report is 61 commits behind head on main.
The diff coverage is 96.85%.

❗ Current head f052a78 differs from pull request most recent head 0d3e5d8. Consider uploading reports for the commit 0d3e5d8 to get more accurate results

@@             Coverage Diff             @@
##             main     #897       +/-   ##
===========================================
- Coverage   99.78%   86.91%   -12.88%     
===========================================
  Files         260      245       -15     
  Lines       24998    24412      -586     
  Branches     1958     1344      -614     
===========================================
- Hits        24945    21218     -3727     
- Misses         50     3160     +3110     
- Partials        3       34       +31     
Files Changed Coverage Δ
src/utils/transaction/parseTransaction.ts 40.54% <85.71%> (-59.46%) ⬇️
src/chains/parsers/celo.ts 97.43% <97.43%> (ø)
src/chains/serializers/celo.ts 80.72% <100.00%> (-19.28%) ⬇️

... and 138 files with indirect coverage changes

@aaronmgdr aaronmgdr force-pushed the aaronmgder/celo-tx-parser branch from b3ea893 to 6f8846e Compare July 17, 2023 17:38
@aaronmgdr aaronmgdr marked this pull request as ready for review July 20, 2023 18:44
@aaronmgdr
Copy link
Contributor Author

bit confused as to why its saying there is less coverage, its reporting the original parse Transaction Errors are not being tested yet there are tests for them that pass

Raiden1411 and others added 19 commits August 18, 2023 10:44
* chore: update abitype

* chore: chore changeset

* chore: downgrade pnpm
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* feat: add support for resolving ens addresses using coinType

* docs: update the docs to include examples for using coinType

* refactor: address pr comments and merge ABIs

* refactor

* chore: changeset

* refactor: alphabetize

* docs: coinType type

---------

Co-authored-by: moxey.eth <jakemoxey@gmail.com>
* exports the filter type

* Removes accidental changes to pnpm-lock.yaml

* add changeset
Ensure the [!code focus] is applied to the `to` param for the `to` param section of the docs.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* prevent scientific notation bug for large integers when decimals == 0

* add parseUnits changeset

* better comparison

* slice for consistency

* refactor

---------

Co-authored-by: moxey.eth <jakemoxey@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
fix: wrong mapping of JSON RPC method for watchAsset

The docs stated the JSON RPC method was `eth_switchEthereumChain` but it should be `wallet_watchAsset`.
…dError` (wevm#941)

fix: capture unsupported error signatures
* fix: Rename the  and  types with the appropriate file prefixes

* ref: add migration path for deprecated types

* Update honest-grapes-leave.md

* Update index.ts

* Update contract.ts

* Update index.ts

* Update public.ts

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-actions bot and others added 27 commits August 18, 2023 10:44
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* docs: update run test  as per wevm#996

* Update CONTRIBUTING.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
* fix estimateContractGas' error docsPath

* chore: update snapshots

---------

Co-authored-by: norswap <norswap@gmail.com>
* docs: add Ethereum Provider section

* Update typescript.md

* Update typescript.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
* fix: support `gasPrice`

* chore: update snapshots
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
…#886)

* feat: optimism transaction receipt formatter

* refactor: restructure

* chore: tests
…or` (wevm#1008)

* match already known

* Create little-ravens-warn.md

---------

Co-authored-by: jxom <jakemoxey@gmail.com>
* feat: optimism transaction receipt formatter

* refactor: restructure

* feat: chain fees config

* chore: changeset

* chore: update test

* chore: impl

* refactor: cleanup formatters & serializers types

* chore: fix

* refactor

* chore: snapshots

* Update sweet-lemons-explain.md

* Update sweet-lemons-explain.md

* refactor

* refactor

* refactor
)

* export signTransaction

* update docs

* refactor

---------

Co-authored-by: moxey.eth <jakemoxey@gmail.com>
…chContractEvent` (wevm#1012)

* Support eth_subscribe in watchContractEvent

* Complete test suite for watchContractEvent

* Support eth_subscribe in watchEvent and add tests

* Update docs

* chore: add tests

* chore: update docs

---------

Co-authored-by: Simone <simone@nemo.ventures>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* refactor: use const type parameters

* chore: ts version

* chore: changeset

* chore: lint errors

* chore: format

* test: types

* chore: update

* refactor: remove Narrow

* docs: fix

* test: dynamic multicall types

* chore: fix snapshot

---------

Co-authored-by: tmm <tmm@users.noreply.github.com>
Revert "refactor: use const type parameters (wevm#1017)"

This reverts commit 2bbe907.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
* refactor: use const type parameters

* chore: ts version

* chore: changeset

* chore: lint errors

* chore: format

* test: types

* chore: update

* refactor: remove Narrow

* docs: fix

* test: dynamic multicall types

* chore: fix snapshot

* chore: snapshot

* chore: types

* chore: updates

---------

Co-authored-by: tmm <tmm@users.noreply.github.com>
@aaronmgdr
Copy link
Contributor Author

closing for #1035

@aaronmgdr aaronmgdr closed this Aug 18, 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.