Hello,
I am trying to do a relayed transaction, using the Relayer from Defender, and I've got a code working. But, I need the "from" field to function, so as to replay the transaction at least following the ERC2771 schema. I've got the _msgSender setuped to read the data from the transaction. But when I try a transaction it seems not to follow ERC2271 as the msg sender is the Relayer contract?
Code to reproduce
here's a sample code of what I'm doing for now:
const args = remixBuildArgs([owner.address], [], "http://whatever.com/whatever.json")
const provider = client.relaySigner.getProvider();
const signer = client.relaySigner.getSigner(provider, { speed: 'fast', validForSeconds: 120 });
console.log("Defender signer is:", signer)
const factory = RemixFactory as Contract
const tmp = await factory.populateTransaction.deploy(args)
const txToSend = {
to: tmp.to as string,
from: tmp.from as string,
data: tmp.data as string,
maxFeePerGas: 29000000,
maxPriorityFeePerGas: 29000000,
gasLimit: 29000000
}
console.log("Transaction to be sent:", txToSend)
const relayTransaction = await relayClient.sendTransaction(txToSend);
console.log(relayTransaction)
How can I get the relayer to follow ERC2771 or to send the original msg.sender ?