Social Logins and Create Wallet

The Leap SDK provides social login methods that allow users to log in with a familiar web2 style approach, while creating non-custodial wallets for them in the background. You can also customize the theme to reflect your brand.

To initialize the SDK with your preferred chain and login service, use the following code:

import { LeapEVMSdk, chainConfig } from "@leapwallet/leap-evm-js";

const loginConfig = {
  auth_service: PREFERRED-LOGIN-SERVICE, // either 'web3auth' or 'ramper'
  config: { appName: YOUR_APP_NAME },
};

const leapSdk = await LeapEVMSdk.init(chainConfig.ploygon.mainnet, loginConfig);

Once you have initialized the SDK, you can create a button for the user to initiate the login process. To log in, simply call:

const res = await leapSdk.auth.connect(LOGIN_PROVIDER_TYPE)

If you are using web3auth as your preferred login service, you can specify the following LOGIN_PROVIDER_TYPE options:


LOGIN_PROVIDER_TYPE : "google" | "facebook" | "apple" | "twitter" | "github" | "reddit" | "discord" |
"twitch" | "linkedin" | "line" | "kakao" | "weibo" | "wechat"

Note : We recommend using Promises for fields that need network access to be determined.

To get the currently logged-in user, use the following code:

const user = await leapSdk.getUser()

Sign out

To log out or disconnect the user's wallet, call:

await leapSdk.signOut()

Last updated