Send signature to minimal forwarder execute method using web3js

Hello everyone, I am trying to create a relayer using the minimal forwarder from open zeppelin. The method "execute" takes a signature as parameter (bytes) but I can't find a way to get the signature from a signed transaction in my node server. I have the r and s field. I am using web3js library. If you could highlight me on this. Thanks :slightly_smiling_face:

Have you checked out the OpenZeppelin documentation, it contains some examples on how to use the relayer.

Hello,
Thank you for your quick answer.
Yes I checked it, but still, we can see they are using a signature coming from the request.
The thing is, I have signed a transaction using web3js.
In this object I have

{
  messageHash: '0x1c7897d53de815dbc55ccca2...',
  v: '0xe5',
  r: '0xbb164c7d5da1d9d13f3e63ebe0cbca...',
  s: '0x2abf25dfd9027449d5618ec5ea00f937...',
  rawTransaction: '0xf8aa328502540be40082c9be94aa7d315f34733100784dc740b1a13e87310ac2c180b844a9059cbb0000000000000000000000007b5cf62081f57...,
  transactionHash: '0xb1edb3668d1100ed8a4527a2ce8c5...'
}

How can I get the signature from this ?

Thanks

normally to get the v r and s you split the signature

const { v, r, s } = ethers.utils.splitSignature(await signer._signTypedData(...))

if you want just the signature you can skip that step.

	await signer._signTypedData(
	  {
		name,
		version,
		chainId,
		verifyingContract: token.address,
	  },
	  {
		Permit: [
		  {
			name: "owner",
			type: "address",
		  },
		  {
			name: "spender",
			type: "address",
		  },
		  {
			name: "value",
			type: "uint256",
		  },
		  {
			name: "nonce",
			type: "uint256",
		  },
		  {
			name: "deadline",
			type: "uint256",
		  },
		],
	  },
	  {
		owner: signer.address,
		spender,
		value,
		nonce,
		deadline,
	  }
	)

In the defender workshop api code (located in signer.js) they have the following function which returns the signature:

async function signMetaTxRequest(signer, forwarder, input) {
  const request = await buildRequest(forwarder, input);
  const toSign = await buildTypedData(forwarder, request);
  const signature = await signTypedData(signer, input.from, toSign);
  return { signature, request };
}

Okay I see,
but using web3.js, what would be the equivalent?

Thanks

We only use nextjs/ethersjs so i'm afriad i have no example code for you.