I'm trying to sign a transaction without broadcast using metamask. I have tried web3js and etherjs (eth_signTransaction) but neither worked. How to do this?
I think opensea is signing message and then using it for transaction. How did they do this?
MetaMask - RPC Error: Method not supported
const signedTx = await web3.eth.signTransaction(tx, accounts[0])
Error: signing transactions is unsupported (operation="signTransaction", code=UNSUPPORTED_OPERATION
const signedTx = await signer.signTransaction(tx)
Metamask currently does not support the RPC method that is used to sign transactions. See the GitHub issue discussing why they chose not to implement it: https://github.com/MetaMask/metamask-extension/issues/3475
EDIT:
I think opensea is signing message and then using it for transaction. How did they do this?
The way that OpenSea allows minting in a gasless manner is actually quite simple: they don't mint the NFT until it is purchased by somebody. OpenSea then mints the NFT themselves, using an owner 'bypass' present in the contract it deploys.