Gasless Onboarding
Gasless Onboarding is a combination of Gasless Wallet and Web3Auth which gives developers the ability to onboard their users via social logins such as Google, Facebook, Discord, etc.
yarn add @gelatonetwork/gasless-onboarding
or
npm install @gelatonetwork/gasless-onboarding
class GaslessOnboarding
constructor(loginConfig: LoginConfig, gaslessWalletConfig: GaslessWalletConfig);
interface LoginConfig {
chain: { id: number; rpcUrl: string };
ui?: {
theme?: "light" | "dark";
};
openLogin?: {
mfa?: LoginSettings["mfaLevel"];
redirectUrl?: string;
};
}
chain
id
: The Chain ID of the networkrpcUrl
: The RPC provider URL
ui
theme
: light or dark
openLogin
mfa
: The multi-factor authentication configuration for openLogin. Possible values are:optional
: SettingmfaLevel
to optional will present the MFA screen to the user on every login but they will have the option to skip it.default
: Setting themfaLevel
to default will present the MFA screen to user on every third login.mandatory
: SettingmfaLevel
to mandatory will make it mandatory for user to setup MFA after login.- none: Setting
mfaLevel
to none will skip the mfa setup screen totally.
redirectUrl
: The url to which the user will be redirected after the Web3Auth login flow
type GaslessWalletConfig = {
apiKey: string;
}
init(): Promise<void>;
The init function should be invoked before using other methods as it sets up the instance for further processing.
getGaslessWallet(): GaslessWallet;
getProvider(): SafeEventEmitterProvider | null;
The returned instance contains the respective provider corresponding to your selected blockchain. You can use this provider to connect your user to the blockchain and make transactions.
getUserInfo(): Promise<Partial<UserInfo>>;
If the user is logged in with social media accounts, this function can be used to fetch user related data such as
email
, name
, profileImage
etc.login(): Promise<SafeEventEmitterProvider>;
This function pops up the login modal on UI, and returns the provider instance after a successful login.
logout(): Promise<void>;
This function logs the user out and clears the cache.
Last modified 1mo ago