-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add serialization to the account classes #571
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just two comment but everything else looks good
export interface DeserializableAccount<T> extends Deserializable<T> { | ||
fromHex(hex: HexInput): T; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to only be used in one test. Define it in the test file instead since this interface won't be that useful if it's not being inherited
const anyKeyVariantOffset = deserializer.getOffset(); | ||
deserializer.reset(offset); | ||
switch (anyKeyVariant) { | ||
case AnyPublicKeyVariant.Keyless: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if we can look into refactoring the accounts so that Keyless and Federated are SingleKeyAccount's and SingleKeyAccount can deserialize for the other two.
Since you added SingleKeySigner, maybe we can add the deserialization logic there and call that instead. This would be useful in the case that SingleKey's can also be used in new accounts (if ever)
Description
This adds serialization to all the account classes. Clients that use Keyless will want to support the ability to add backup keys or turn the account into a multikey. This allows clients to cache the account agnostic of the actual signing method impl underneath. i.e., caching a
MultiKeyAccount
andKeylessAccount
can work the same and useAccount.deserialize
Test Plan
Added unit tests
Checklist
pnpm fmt
?CHANGELOG.md
?