Support EIP-712
mahnunchik opened this issue · 5 comments
EIP-712
Typed structured data hashing and signing (eth_signTypedData_v4
) is required to perform token swap on pancakeswap.
Existing implementation using @noble/hashes
https://github.com/Mrtenz/eip-712
An example on walletconnect website https://docs.walletconnect.com/advanced/multichain/rpc-reference/ethereum-rpc#eth_signtypeddata
How popular is EIP-712? Have you analyzed this?
EIP-712 is used in all token swaps on pancakeswap and uniswap. Some documentation:
- https://support.uniswap.org/hc/en-us/articles/8120520483085-What-is-an-approval-transaction
- https://docs.walletconnect.com/advanced/multichain/rpc-reference/ethereum-rpc
I think other decentralized exchanges use this mechanism too.
Soon we will have our own usage statistics.
EIP-712 has become the de facto standard for Typed Data Signing in Ethereum and EVM systems. This would definitely be a good addition to this package.
Ethers.js provides a good EIP-712 implementation but I was required to roll my own implementation of it for a private project using only noble cryptography packages without any dependency on ethers. It's essentially a drop-in replacement for the TypedDataEncoder
class provided by ethers.
Given that there is agreement in supporting EIP-712 here, I'd be happy to re-purpose my implementation and raise a PR with it.
cc: @paulmillr