Currently, we're trying to sign some EAS attestations (https://docs.attest.org/docs/developer-tools/eas-sdk#creating-offchain-attestations) using OpenZeppelin Defender. The EAS SDK expects a signer object that is of the ethers Signer type, but OpenZeppelin Defender seems to have its own variant of the signer that doesn't have all the functions associated with the ethers signer.
Environment
Defender Relayer signer: in order to sign EAS attestations.
Details
// Signer is an ethers.js Signer instance
const signer = new ethers.Wallet(privateKey, provider);
const offchainAttestation = await offchain.signOffchainAttestation(
{
recipient: '0xFD50b031E778fAb33DfD2Fc3Ca66a1EeF0652165',
expirationTime: 0n, // Unix timestamp of when attestation expires (0 for no expiration)
time: BigInt(Math.floor(Date.now() / 1000)), // Unix timestamp of current time
revocable: true, // Be aware that if your schema is not revocable, this MUST be false
schema: '0xb16fa048b0d597f5a821747eba64efa4762ee5143e9a80600d0005386edfc995',
refUID: '0x0000000000000000000000000000000000000000000000000000000000000000',
data: encodedData
},
signer
);
The accepted signer should just be an Ethers.js signer instance. OpenZeppelin Defender's signer instance differs from that of the Ethers one.
Code to reproduce
const provider = client.relaySigner.getProvider();
const relaySigner = await client.relaySigner.getSigner(provider, {
speed: "fast",
});
console.log(EAS_ADDRESSES[ENABLED_CHAIN_ID as keyof typeof EAS_ADDRESSES]);
const eas = new EAS(
EAS_ADDRESSES[ENABLED_CHAIN_ID as keyof typeof EAS_ADDRESSES],
{
signer: relaySigner, // Issue also happens here
}
);
const offchain = await eas.getOffchain();
logger.info("attestation test: cid: ", cid);
const schemaEncoder = new SchemaEncoder("string post");
const encodedData = schemaEncoder.encodeData([
{
name: "post",
value: value,
type: "string",
},
]);
const attestation = await offchain.signOffchainAttestation(
{
recipient: "",
expirationTime: BigInt(0),
time: BigInt(Date.now()),
revocable: false,
schema:
"0xbbea47804168571b26f0ea2962bfbd1b11184bc0a438724c890151201eb60128",
refUID:
"0x0000000000000000000000000000000000000000000000000000000000000000",
data: encodedData,
},
relaySigner // (xBalbinus) The issue happens here
);