IND-180 | UI SDK Update for Unified SimpleAccountFactory and Versioned Signature Support #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Story:
https://incentiv-net.atlassian.net/browse/IND-180
Summary:
This PR updates the
SimpleAccountAPIin the UI SDK to align with the mergedSimpleAccountFactorycontract, which now supports both Externally Owned Accounts (EOA) and Passkey accounts within a single factory. Additionally, the PR introduces versioned signatures to differentiate between EOA (version == 0) and Passkey (version == 1) signatures, ensuring compatibility with the unified contract structure.Changes Implemented:
1. Updated getAccountInitCode Method
createAccountABI ingetAccountInitCodeto reflect the new contract’s unified structure:"function createAccount(address owner, bytes32[2] memory publicKey, uint256 salt) external payable returns (SimpleAccount)"ownerAddress, setpublicKeyto[HashZero, HashZero], and usedthis.indexas thesalt.publicKeyvalues from theowner, setownertoAddressZero, and usedthis.indexas thesalt.createAccount.this.factory.addresswith the encoded function data, ensuring correct initialization code for the account type.2. Versioned Signature Support in signUserOpHash
signUserOpHashreturn value to distinguish between EOA (version == 0) and Passkey (version == 1) signatures.zeroPadandhexlifyto prepend a0x00byte for EOAs or0x01for Passkey accounts to the signed message.Testing Recommendations:
Account Initialization Tests:
getAccountInitCodeproduces the correct initialization code for:owneris populated withownerAddress,publicKeyis zeroed, and the correctsaltis used.publicKeyis set with theowner’spublicKeycoordinates,owneris zeroed, and the correctsaltis used.sample-aa-walletto ensure compatibility.Signature Versioning Tests:
signUserOpHashprepends the correct version byte:0x00for EOA accounts.0x01for Passkey accounts.sample-aa-wallet.Edge Case Tests:
ownernorpublicKeyis correctly set in the account configuration.Additional Notes:
SimpleAccountFactoryand versioned signature changes, ensuring seamless interaction with both EOA and Passkey accounts.sample-aa-walletto test both MetaMask (EOA) and Passkey account flows, ensuring backward compatibility and functionality consistency.This PR improves flexibility and compatibility with the unified
SimpleAccountFactory, enhancing user experience across account types. Please review and test to ensure seamless functionality.