Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/solana-device-signer-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@crossmint/wallets-sdk": patch
---

Reject device signers for Solana wallets with a clear error message instead of letting the request fail with a 500. Includes a contact sales link for access.
8 changes: 7 additions & 1 deletion packages/wallets/src/wallets/wallet-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {
Signer as SignerResponse,
RegisterSignerParams,
} from "../api";
import { WalletCreationError, WalletNotAvailableError } from "../utils/errors";
import { InvalidSignerError, WalletCreationError, WalletNotAvailableError } from "../utils/errors";
import { type Chain, validateChainForEnvironment } from "../chains/chains";
import type { ExternalWalletRegistrationConfig, PasskeySignerConfig, SignerConfigForChain } from "../signers/types";
import { Wallet } from "./wallet";
Expand Down Expand Up @@ -400,6 +400,12 @@ export class WalletFactory {
return { signer };
}
if (signer.type === "device") {
// Device signers are not supported for Solana wallets
if (chain === "solana") {
throw new InvalidSignerError(
"Device signers are not currently supported for Solana wallets. Contact sales (https://www.crossmint.com/contact/sales) for access."
);
}
// If the device signer already has a locator or public key (e.g., created via createDeviceSigner helper), use it directly
if (signer.publicKey != null) {
return {
Expand Down
7 changes: 7 additions & 0 deletions packages/wallets/src/wallets/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,13 @@ export class Wallet<C extends Chain> {
): Promise<T extends PrepareOnly<true> ? AddSignerReturnType<C> : WalletSigner> {
walletsLogger.info("wallet.addSigner.start");

// Device signers are not supported for Solana wallets
if (signer.type === "device" && this.chain === "solana") {
throw new InvalidSignerError(
"Device signers are not currently supported for Solana wallets. Contact sales (https://www.crossmint.com/contact/sales) for access."
);
}

// Resolve server signer config to locator string
const resolvedSigner =
typeof signer === "object" && "type" in signer && signer.type === "server"
Expand Down
Loading