-
Notifications
You must be signed in to change notification settings - Fork 34
feat(wallets): normalize EVM server signer derivation to use "evm" chain type with legacy fallback #1854
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
Open
guilleasz-crossmint
wants to merge
23
commits into
main
Choose a base branch
from
devin/1779463225-evm-server-signer-normalization
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(wallets): normalize EVM server signer derivation to use "evm" chain type with legacy fallback #1854
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
ebb7fd1
feat(wallets): normalize EVM server signer derivation to use 'evm' ch…
devin-ai-integration[bot] fb328f0
fix(wallets): set #resolvedServerDerivation for server recovery signe…
devin-ai-integration[bot] 4ebcd27
fix(wallets): address review feedback — validateSigners dual-derivati…
devin-ai-integration[bot] 42d8466
fix(wallets): store API-sourced recovery address for repeated useSign…
devin-ai-integration[bot] b8198eb
fix(wallets): remove cache from resolveSignerLocator to prevent cross…
devin-ai-integration[bot] f24e5f4
fix(wallets): restore cache in resolveSignerLocator for legacy wallet…
devin-ai-integration[bot] df4d9da
fix(wallets): restore cache in resolveServerSignerApiLocator for lega…
devin-ai-integration[bot] d109ad9
fix(wallets): validate cache ownership before using it — prevent cros…
devin-ai-integration[bot] 81ab88a
fix(wallets): pass API recovery address from factory to wallet constr…
devin-ai-integration[bot] 0a43d99
fix(wallets): propagate apiRecoveryAddress through all wallet subclas…
devin-ai-integration[bot] 8f39cac
fix(wallets): include both primary and legacy addresses in unregister…
devin-ai-integration[bot] b9a06a0
refactor(wallets): extract resolveServerSigner and deduplicate deriva…
devin-ai-integration[bot] 9d7e1fc
fix(wallets): fix type error in resolveServerSigner parameter type
devin-ai-integration[bot] 9e83f1e
fix(wallets): use type assertion for isRecoverySigner in resolveServe…
devin-ai-integration[bot] d2d15d1
refactor(wallets): address PR review - rename helpers, use explicit n…
devin-ai-integration[bot] 239ceb8
fix(wallets): update stale comment references to #resolvedServerSigner
devin-ai-integration[bot] 56a3723
refactor(wallets): consolidate server signer derivation resolution in…
devin-ai-integration[bot] 2aefc11
fix(wallets): handle legacy delegated server signers in resolveServer…
devin-ai-integration[bot] 018bd5f
fix(wallets): preserve API-sourced delegated signer addresses for leg…
devin-ai-integration[bot] 7941682
refactor(wallets): extract DerivedServerSigner type, generalize API a…
devin-ai-integration[bot] c49a201
refactor(wallets): rename API address fields to be explicitly server-…
devin-ai-integration[bot] a778035
perf(wallets): fetch signer list once in resolveServerSigner
devin-ai-integration[bot] 7fa85f0
refactor(wallets): restore deriveServerSignerCandidates name with imp…
devin-ai-integration[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| "@crossmint/wallets-sdk": minor | ||
| --- | ||
|
|
||
| Normalize EVM server signer key derivation to use "evm" chain type | ||
|
|
||
| - Add `deriveServerSignerCandidates` helper that returns both primary ("evm") and legacy (chain-specific) derivations | ||
| - Update `deriveServerSignerDetails` to use normalized "evm" chain type for all EVM chains | ||
| - Implement dual-derivation fallback in `useSigner`: try primary first, fall back to legacy for backward compatibility | ||
| - Update `isRecoverySigner` to match against either derivation | ||
| - Cache resolved server derivation in `buildInternalSignerConfig` for signing consistency |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,7 @@ | ||
| export { deriveServerSignerAddress, deriveServerSignerDetails } from "./derive-server-signer"; | ||
| export { | ||
| type DerivedServerSigner, | ||
| deriveServerSignerAddress, | ||
| deriveServerSignerDetails, | ||
| deriveServerSignerCandidates, | ||
| } from "./derive-server-signer"; | ||
| export { getChainType } from "./get-chain-type"; |
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
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
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
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
|
devin-ai-integration[bot] marked this conversation as resolved.
|
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ import { Wallet } from "./wallet"; | |
| import type { Chain, EVMChain } from "../chains/chains"; | ||
| import { InvalidTypedDataError, SignatureNotCreatedError, TransactionNotCreatedError } from "../utils/errors"; | ||
| import type { CreateTransactionParams, CreateTransactionSuccessResponse } from "@/api"; | ||
| import { deriveServerSignerDetails } from "../signers/server"; | ||
| import type { ServerSignerConfig } from "../signers/types"; | ||
| import { walletsLogger } from "../logger"; | ||
|
|
||
| export class EVMWallet extends Wallet<EVMChain> { | ||
|
|
@@ -28,6 +28,8 @@ export class EVMWallet extends Wallet<EVMChain> { | |
| options: Wallet.getOptions(wallet), | ||
| alias: wallet.alias, | ||
| recovery: Wallet.getRecovery(wallet), | ||
| apiServerRecoveryAddress: Wallet.getApiServerRecoveryAddress(wallet), | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. lets go with apiRecoveryServerSignerAddress for clarity. api and server can clash easily and confuse |
||
| apiServerDelegatedAddresses: Wallet.getApiServerDelegatedAddresses(wallet), | ||
| signer: wallet.signer, | ||
| signers: Wallet.getInitialSigners(wallet), | ||
| }, | ||
|
|
@@ -222,7 +224,7 @@ export class EVMWallet extends Wallet<EVMChain> { | |
| } else if (typeof options.signer === "string") { | ||
| signer = options.signer; | ||
| } else { | ||
| signer = `server:${deriveServerSignerDetails(options.signer, this.chain, this.apiClient.projectId, this.apiClient.environment).derivedAddress}`; | ||
| signer = this.resolveServerSignerApiLocator(options.signer as ServerSignerConfig); | ||
| } | ||
| const transactionCreationResponse = await this.apiClient.createTransaction(this.walletLocator, { | ||
| params: { | ||
|
|
||
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.