You'll be prompted to create a passKey for your current domain. Depending on the user's device, the UX might be different.
Thanks to these credentials, your wallet address will be predicted and can already be used to receive funds.
However, note that at this point the wallet has not been created on-chain yet: the Safe is deployed on the first transaction of the wallet.
To get the address of the created wallet, you'll have to call:
constaddress=smartAccount.address
You must store the wallet address of your user. Not saving this address will prevent your user from accessing the wallet it in the future.
It is recommended to store the wallet address in your backend, linked to your user. For a quick demo or Proof of Concept (POC), you may use local storage.
Connect to an existing connect wallet
When you already have created your user's wallet through Cometh Connect, just pass the wallet address to the connect method in order to instantiate it.
disableEoaFallback: By default we provide a local wallet solution in the rare case of browser not fully supports platform authentication. You have the ability to disable that feature using this boolean.
passKeyName: Allows to name the webAuthn credential that you create through cometh connect.
sessionKeysEnabled: Allows to use sessionkeys for your project.
import { ENTRYPOINT_ADDRESS_V07,createSafeSmartAccount,createSmartAccountClient,webAuthnOptions} from"@cometh/connect-sdk-4337";constcomethSignerConfig= {// These are the default values we use webAuthnOptions: webAuthnOptions = { authenticatorSelection: { authenticatorAttachment:"platform", residentKey:"preferred", userVerification:"preferred", }, } passKeyName: "Cometh Connect", disableEoaFallback:false}constsessionKeysEnabled=trueconstsmartAccount=awaitcreateSafeSmartAccount({ apiKey, rpcUrl, chain: arbitrumSepolia, entryPoint:ENTRYPOINT_ADDRESS_V07, comethSignerConfig, sessionKeysEnabled });constsmartAccountClient=createSmartAccountClient({ account: smartAccount, entryPoint:ENTRYPOINT_ADDRESS_V07, chain: arbitrumSepolia, bundlerTransport:http(bundlerUrl)})