Appearance
Create a wallet
Call registerPasskey from a user-initiated action. The SDK opens the passkey prompt, reports progress, and returns a discriminated result that tells you which capability is ready.
Register a passkey wallet
Use the hook when your product owns the registration button and result UI. Render CreateWalletButton inside the SeamsWebProvider from Start here.
tsx
import type { RegistrationFlowEvent } from '@seams/wallet';
import { useSeams } from '@seams/wallet/react';
export function CreateWalletButton() {
const { registerPasskey, seams } = useSeams();
const onCreateWallet = async (): Promise<void> => {
const result = await registerPasskey({
onEvent: (event: RegistrationFlowEvent) =>
console.log(event.phase, event.status, event.message),
});
if (!result.success) {
console.error('Registration failed:', result.error);
return;
}
// `walletId` is the stable identifier for every later wallet operation.
console.log(`Wallet ${result.walletId} registered (${result.kind})`);
// A mixed registration returns before NEAR provisioning finishes, so the
// result carries no NEAR account id yet. Wait for one before signing NEAR.
if (result.kind === 'ecdsa_wallet_registered_near_pending') {
const near = await seams.registration.awaitNearReady({ walletId: result.walletId });
console.log('NEAR provisioning finished:', near.kind);
}
};
return <button onClick={() => void onCreateWallet()}>Create wallet</button>;
}The example treats result.success as the only gate and logs the branch kind. Read branch-specific fields, such as a NEAR provisioning state, only after checking the branch.
Read the result
wallet_registeredmeans the wallet and its returned capabilities are ready.ecdsa_wallet_registered_near_pendingmeans the EVM-family capability is ready while NEAR provisioning is pending or retryable. This branch carries no NEAR account id — awaitseams.registration.awaitNearReady({ walletId })before signing NEAR.near_wallet_registered_pendingmeans NEAR provisioning still needs to reach a ready state before you read a NEAR account.wallet_signer_addedmeans a signer was added to an existing wallet.success: falsecontains the error text to show or log for the current attempt.
The returned walletId is the stable wallet identifier used by signing, session provisioning, and every other wallet-scoped operation. Keep it with your application account record; never store passkey or holder secrets in application state.
If registration stops
Passkey cancellation ends the current attempt. Let the person start a new attempt from the same button. A retryable NEAR provisioning result keeps the wallet identity, so check provisioning before offering a retry instead of registering a second wallet:
seams.registration.awaitNearReady({ walletId })waits for provisioning to settle and resolves withnear_ready,near_failed_retryable, ortimed_out. It never rejects unless you abort it with asignal.seams.registration.getNearProvisioningState({ walletId })reads the current state without waiting.
Origin, publishable-key, and authentication errors require configuration or account changes before retrying.