Add signer constructors (#5757)

Co-authored-by: ernestognw <ernestognw@gmail.com>
This commit is contained in:
Hadrien Croubois
2025-06-20 13:09:28 +02:00
committed by GitHub
parent 61f81e313c
commit 6079eb3f01
16 changed files with 49 additions and 56 deletions

View File

@ -19,7 +19,7 @@ async function fixture() {
// ERC-4337 account
const helper = new ERC4337Helper();
const mock = await helper.newAccount('$AccountECDSAMock', ['AccountECDSA', '1', signer]);
const mock = await helper.newAccount('$AccountECDSAMock', [signer, 'AccountECDSA', '1']);
// ERC-4337 Entrypoint domain
const entrypointDomain = await getDomain(entrypoint.v08);

View File

@ -32,7 +32,7 @@ async function fixture() {
const domain = { name: 'AccountERC7913', version: '1', chainId: entrypointDomain.chainId }; // Missing verifyingContract,
const makeMock = signer =>
helper.newAccount('$AccountERC7913Mock', ['AccountERC7913', '1', signer]).then(mock => {
helper.newAccount('$AccountERC7913Mock', [signer, 'AccountERC7913', '1']).then(mock => {
domain.verifyingContract = mock.address;
return mock;
});

View File

@ -37,7 +37,7 @@ async function fixture() {
const domain = { name: 'AccountMultiSigner', version: '1', chainId: entrypointDomain.chainId }; // Missing verifyingContract
const makeMock = (signers, threshold) =>
helper.newAccount('$AccountMultiSignerMock', ['AccountMultiSigner', '1', signers, threshold]).then(mock => {
helper.newAccount('$AccountMultiSignerMock', [signers, threshold, 'AccountMultiSigner', '1']).then(mock => {
domain.verifyingContract = mock.address;
return mock;
});

View File

@ -37,7 +37,7 @@ async function fixture() {
const makeMock = (signers, weights, threshold) =>
helper
.newAccount('$AccountMultiSignerWeightedMock', ['AccountMultiSignerWeighted', '1', signers, weights, threshold])
.newAccount('$AccountMultiSignerWeightedMock', [signers, weights, threshold, 'AccountMultiSignerWeighted', '1'])
.then(mock => {
domain.verifyingContract = mock.address;
return mock;

View File

@ -21,10 +21,10 @@ async function fixture() {
// ERC-4337 account
const helper = new ERC4337Helper();
const mock = await helper.newAccount('$AccountP256Mock', [
'AccountP256',
'1',
signer.signingKey.publicKey.qx,
signer.signingKey.publicKey.qy,
'AccountP256',
'1',
]);
// ERC-4337 Entrypoint domain

View File

@ -21,10 +21,10 @@ async function fixture() {
// ERC-4337 account
const helper = new ERC4337Helper();
const mock = await helper.newAccount('$AccountRSAMock', [
'AccountRSA',
'1',
signer.signingKey.publicKey.e,
signer.signingKey.publicKey.n,
'AccountRSA',
'1',
]);
// ERC-4337 Entrypoint domain

View File

@ -6,7 +6,7 @@ describe('ERC7739', function () {
describe('for an ECDSA signer', function () {
before(async function () {
this.signer = ethers.Wallet.createRandom();
this.mock = await ethers.deployContract('ERC7739ECDSAMock', [this.signer.address]);
this.mock = await ethers.deployContract('$ERC7739ECDSAMock', ['ERC7739ECDSA', '1', this.signer.address]);
});
shouldBehaveLikeERC1271({ erc7739: true });
@ -15,7 +15,9 @@ describe('ERC7739', function () {
describe('for a P256 signer', function () {
before(async function () {
this.signer = new NonNativeSigner(P256SigningKey.random());
this.mock = await ethers.deployContract('ERC7739P256Mock', [
this.mock = await ethers.deployContract('$ERC7739P256Mock', [
'ERC7739P256',
'1',
this.signer.signingKey.publicKey.qx,
this.signer.signingKey.publicKey.qy,
]);
@ -27,7 +29,9 @@ describe('ERC7739', function () {
describe('for an RSA signer', function () {
before(async function () {
this.signer = new NonNativeSigner(RSASHA256SigningKey.random());
this.mock = await ethers.deployContract('ERC7739RSAMock', [
this.mock = await ethers.deployContract('$ERC7739RSAMock', [
'ERC7739RSA',
'1',
this.signer.signingKey.publicKey.e,
this.signer.signingKey.publicKey.n,
]);