Skip to content

fix(wallets): skip device signer injection for Solana wallets#1826

Open
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1778279188-skip-device-signer-solana
Open

fix(wallets): skip device signer injection for Solana wallets#1826
devin-ai-integration[bot] wants to merge 2 commits into
mainfrom
devin/1778279188-skip-device-signer-solana

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented May 8, 2026

Description

CrossmintWalletProvider always creates an IframeDeviceSignerKeyStorage, which causes WalletFactory.createWallet to unconditionally inject a { type: "device" } signer into the wallet creation request via ensureDeviceSignerInSigners. For Solana wallets using the Squads provider (the current default), the backend rejects this with a 400 error: "Device signers are not currently supported for this Solana wallet."

This PR makes ensureDeviceSignerInSigners chain-aware: when chain === "solana", the method skips automatic device signer injection and returns the user-provided signers as-is. EVM wallets continue to get device signers injected automatically.

Note: if a consumer explicitly includes a device signer in their signers array (e.g. for a swig/crossmint-provider Solana wallet), it will still be passed through — only the automatic injection is skipped.

Related: wallets-quickstart#18 (switches quickstart default chain from solana → base-sepolia)

Human review checklist

  • Verify that skipping device signers for all Solana chains is acceptable (vs. only skipping for Squads provider). Currently the backend already handles provider-specific rejection, but this is a broader client-side gate.
  • Confirm no other code paths rely on device signers being present in the signers array for Solana wallet creation flows.

Test plan

  • Updated existing unit test to verify device signers are not injected for Solana wallets
  • Existing test for EVM wallets continues to pass (device signers still injected for EVM)
  • Full wallet-factory test suite passes (32 tests), full package suite passes (317 tests)

Package updates

  • @crossmint/wallets-sdk: patch — changeset added via .changeset/skip-device-signer-solana.md

Link to Devin session: https://crossmint.devinenterprise.com/sessions/f538ed0c51a24bf8b61461a597f92487
Requested by: @jcurbelo

The SDK was unconditionally injecting a device signer during wallet
creation when deviceSignerKeyStorage was available. This caused 400
errors for Solana wallets using the Squads provider, which does not
support device signers.

ensureDeviceSignerInSigners now checks the chain and skips injection
for Solana, where device signer support is not yet broadly available.
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

Original prompt from Robin

https://github.com/Crossmint/wallets-quickstart uses our latest wallets SDK with Device signers in Solana, however we don't support device signers on solana yet

  • switch chain from solana to base-sepolia

@devin-ai-integration devin-ai-integration Bot requested a review from jcurbelo May 8, 2026 22:34
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 8, 2026

🦋 Changeset detected

Latest commit: f0588fb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@crossmint/wallets-sdk Patch
@crossmint/wallets-quickstart-devkit Patch
@crossmint/wallets-playground-react Patch
@crossmint/client-sdk-react-base Patch
@crossmint/client-sdk-react-native-ui Patch
@crossmint/client-sdk-react-ui Patch
@crossmint/wallets-playground-expo Patch
@crossmint/auth-ssr-nextjs-demo Patch
@crossmint/client-sdk-nextjs-starter Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
packages/wallets/src/wallets/wallet-factory.ts:257-270
The `chain` parameter is redundant here since it's already accessible as `args.chain`. Passing it separately requires the caller to remember to keep them in sync, which is error-prone and adds noise to the signature.

```suggestion
    private ensureDeviceSignerInSigners<C extends Chain>(
        args: WalletCreateArgs<C>
    ): Array<SignerConfigForChain<C> | ExternalWalletRegistrationConfig> {
        if (args.chain === "solana") {
            return args.signers ?? [];
        }
        const signers = args.signers ?? [];
        const hasDeviceSigner = signers.some((s) => s.type === "device");
        if (!hasDeviceSigner) {
            return [...signers, { type: "device" } as SignerConfigForChain<C>];
        }
        return signers;
    }
```

### Issue 2 of 2
packages/wallets/src/wallets/wallet-factory.ts:131
Call-site update to match the simplified signature (removing the now-redundant `chain` argument).

```suggestion
                ? this.ensureDeviceSignerInSigners(validatedArgs)
```

Reviews (1): Last reviewed commit: "fix(wallets): skip device signer injecti..." | Re-trigger Greptile

const signersWithDevice =
validatedArgs.options?.deviceSignerKeyStorage != null
? this.ensureDeviceSignerInSigners(validatedArgs)
? this.ensureDeviceSignerInSigners(validatedArgs.chain, validatedArgs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Call-site update to match the simplified signature (removing the now-redundant chain argument).

Suggested change
? this.ensureDeviceSignerInSigners(validatedArgs.chain, validatedArgs)
? this.ensureDeviceSignerInSigners(validatedArgs)
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/wallets/src/wallets/wallet-factory.ts
Line: 131

Comment:
Call-site update to match the simplified signature (removing the now-redundant `chain` argument).

```suggestion
                ? this.ensureDeviceSignerInSigners(validatedArgs)
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch you cold-blooded code crawler 🐍 — applied in f0588fb. The redundant param has shed its skin.

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

Reviews (2): Last reviewed commit: "refactor: remove redundant chain paramet..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant