Signer: Add isDerivable and keyPair to ISigner, align IWalletAccount with signer-backed accounts#52
Open
claudiovb wants to merge 1 commit into
Open
Signer: Add isDerivable and keyPair to ISigner, align IWalletAccount with signer-backed accounts#52claudiovb wants to merge 1 commit into
claudiovb wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR extends the universal signer interface and aligns the wallet account interface with it, following up on the post-merge review of tetherto/wdk-wallet-evm#40:
ISignergains two members:isDerivable(boolean) — whether the signer supports account derivation. Lets users check derivation support without asserting on concrete types or probing whetherderive()throws. Wallet managers already branch on this to validate default signers and to decide how to build accounts for registered signers.keyPair(KeyPair | null) — the signer's key pair, ornullfor signers that cannot expose key material (e.g. hardware signers).IWalletAccountis updated so accounts backed by anyISignercan honestly fulfill the contract:keyPair→KeyPair | null(null when the underlying signer doesn't allow retrieving key pairs).index→number | undefinedandpath→string | undefined(undefined when the signer is not bound to a BIP-44 position, e.g. private-key signers).WalletManagerconstructor overloads are now annotated with@throws:Errorfor an invalid seed phrase on the seed overload, andSignerErroron the signer overload when the default signer does not support account derivation (enforced by chain-specific subclasses).types/were hand-edited to match (nobuild:typesrun; the generator currently has issues — tracked separately).No implementation code changes; runtime behavior is unchanged. Verified with the full test suite,
standard, and atsccheck over the declaration files, plus end-to-end againstwdk-wallet-evm(node and bare runtimes) with this branch as the dependency.Motivation and Context
Discussed in the post-merge review of tetherto/wdk-wallet-evm#40 (EVM: split signer from account). The EVM package needed
isDerivableandkeyPairon itsISignerEvminterface, and review concluded these belong on the baseISignersince all signer implementations should support them. MakingkeyPairnullable (andindex/pathoptional onIWalletAccount) is required for signers that can never expose key material or a derivation position.Related Issue
No standalone issue — this implements interface changes requested in the post-merge review discussion of tetherto/wdk-wallet-evm#40.
Type of change