ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.98k stars 1.86k forks source link

Transaction type EIP712_TX_TYPE not supported #4832

Open MickWang opened 2 months ago

MickWang commented 2 months ago

Ethers Version

6.13.2

Search Terms

EIP712_TX_TYPE, eip712

Describe the Problem

User zksync-ethers(v6.12.1) signer to send EIP712 transaction, zksync-ethers depends on ethers.js v6. The transaction can be sent and confirmed on chain. There is an error happens in ethers's abstract-provider (https://github.com/ethers-io/ethers.js/blob/5aba4963e3e8ddfc912747076f5b7fe7a743cfe2/src.ts/providers/abstract-provider.ts#L1088), where it use Trnsaction.from(signedTx) and got error as : Error: unsupported transaction type (operation="from", code=UNSUPPORTED_OPERATION, version=6.13.2). So the transaction type EIP712 is not supported in transaction.js.

Code Snippet

const transaction = {...tx}
transaction.customData = tx.customData;
                const zksyncSigner = ZksyncSigner.from(
                  // @ts-ignore
                  signer,
                  tx.chainId,
                  new ZksyncProvider(getRpc(tx.chainId))
                );
                const res = await zksyncSigner.sendTransaction({
                  ...transaction,
                  gasLimit: fee.gasLimit,
                  maxPriorityFeePerGas: Number(fee.maxPriorityFeePerGas)
                    ? fee.maxPriorityFeePerGas
                    : 100,
                });
                return res;

Contract ABI

No response

Errors

Error: unsupported transaction type (operation="from", code=UNSUPPORTED_OPERATION, version=6.13.2)
    at makeError (errors.js:137:21)
    at assert (errors.js:156:15)
    at Transaction.from (transaction.js:933:68)
    at BrowserProvider.broadcastTransaction (abstract-provider.js:761:83)
    at async Signer.sendTransaction (signer.js:593:20)
    at async eval (useSendMultichainTx.ts:489:29)
    at async eval (SignButton.tsx:97:26)

Environment

Ethereum (mainnet/ropsten/rinkeby/goerli)

Environment (Other)

No response

ricmoo commented 2 months ago

I think this may be an issue in the zkSync library? Can you print out the entire value being passed in?

If you open an issue on zkSync, please also link to it here.

MickWang commented 1 month ago

I think this may be an issue in the zkSync library? Can you print out the entire value being passed in?

If you open an issue on zkSync, please also link to it here.

here: https://github.com/zksync-sdk/zksync-ethers/issues/202