Create a wallet
Onboard your user with a few lines of code
Installβ
Init the Cometh Connect SDK
To begin with, you'll have to create an instance of the cometh wallet using the sdk, specifying the needed variables (network, apiKey, rpcurl...).
You can configure the sdk with optional parameters. See below for more details.
Create a new wallet
When your user doesn't already have a wallet, create a new one by calling the connect method without any parameter.
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 onchain yet: the Safe is deployed on the first transaction of the wallet.
To get the address of the wallet created, you'll just have to call:
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.
Once your wallet is connected, the user will be prompted to use biometrics when executing a transaction.
Advanced Configuration
When instantiating the sdk, you are able to configure some optional parameters:
webAuthnOptions: Allows you to customize your webAuthn credentials (authenticatorSelection, extensions...). By default we use platform authentication, but you can customize it the way you like.
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.
RpcUrl: You can provide your own Rpc for better performance.
uiConfig: Allows you to disable the gas indication modal used for non-sponsored transactions. By default displayValidationModal is set as true.
gasToken: Allows you to pay gas fees with an ERC20 token instead of the chain's native token by specifying the ERC20 token's address on the network you are using. ( please contact us if you want to activate this feature )
Last updated