Core Quickstart
If you’re not using React, but still want a number of the abstractions that make the React package so easy to use, you can leverage the @account-kit/core
package directly.
In this guide, we’ll walk you through how to use this package to send a user operation, while using the reactive utilities exported by this package.
Install packages
Prerequisites
- minimum Typescript version of 5
Installation
To get started, you’ll need to install the required packages. We also install the infra
package because it contains the necessary Chain
definitions that makes it easier to setup your a Bundler client.
Get your Environment Variables
-
Create an app in the dashboard and copy the API Key.
-
Create a
configuration
in theSmart Wallets
dashboard to enable login methods. -
Create a policy in your gas manager dashboard to set rules for sponsorship.
If your setup allows, store both the policy and API key in a .env
so you can use them in the following steps. Otherwise you can hold onto them for the next section where you will make use of them!
Create a config
Now, you’re ready to create a config. The config we create should be a static object that you can import anywhere into your application. It contains all of the state that the functions within this package use.
Authenticate the user
Before you can create a Smart Account instance for your users, you need to authenticate them with the user. Depending on what framework you’re using this will look different, but using email based auth as an example you would:
- collect the user’s email
- call the
authenticate
method on the signer - handle the redirect from the user’s email and pass the bundle to the signer to complete login
Send a user operation
Now that you have your config, you can send user operations by leveraging the underlying smart account client.
The key thing here is the watchSmartAccountClient
method which allows you to subscribe to the state of signer and underlying account to give you a stable instance of the Smart Account Client. How you store the clientState
variable will depend largely on your framework, but the above example should give you a good starting point.
Next steps
Now that you have basic authentication and user operations working, you can explore additional features: