Skip to main content
Protocol Factory for obtaining and creating Crossmint smart wallets.

Overview

Obtain an instance from ClientSDK/crossmintWallets() or CrossmintSDK/crossmintWallets. Prefer the chain-specific overloads (e.g. getWallet(chain:options:)) over the generic ones so you get a typed wallet back without an additional cast.

Example

Instance Methods

createWallet(chain:recovery:options:)

Creates a new smart wallet for the authenticated user on the given chain.

Parameters

createWallet(chain:recoveryMethods:options:)

Creates a new smart wallet for the authenticated user on the given chain.

Discussion

Deploys the wallet contract on-chain. Calling this when a wallet already exists returns the existing wallet rather than creating a duplicate. Each recovery signer can authorize on its own. The wallet stays usable when the user loses one of them. Only Solana and Stellar accept more than one recovery signer. The wallet’s first recovery signer, as the API reports it, is the active signer until useSigner(_:) selects another one.
Throws: WalletError.recoveryConfigRejected(code:message:) in these conditions:
  • The list is empty.
  • The list has more than one signer, and the chain accepts only one.
  • The list has a passkey, and the chain is Solana.

Parameters

createWallet(chain:recoveryMethods:signers:options:)

Creates a new smart wallet for the authenticated user, with more signers on the wallet.

Discussion

The SDK adds the signers when it creates the wallet. The recovery method does not approve them.
Throws: WalletError.recoveryConfigRejected(code:message:) if the recovery list is empty. The SDK also throws this error if the list has more than one signer on a chain that accepts one. WalletError.walletCreationCancelled if the user cancels the passkey creation.

Parameters

getWallet(chain:options:)

Returns the wallet of the authenticated user on the given chain. Returns nil if the wallet does not exist.

Discussion

The SDK selects the signer for transactions:
  • If signers() has only one signer, the SDK uses that signer. This applies to email, phone, API key, and passkey signers.
  • If not, the SDK uses the first recovery method of the wallet. To use a different signer, call useSigner(_:). To sign with a passkey, set passkeyHost in options. To sign with an external wallet, call useSigner(_:) before you send a transaction.

Parameters

getWallet(chain:recovery:options:)

Returns the wallet for the authenticated user on the given chain, or nil if none exists yet.

Parameters