Quickstart

1) Install package

# Install dependencies

```bash
yarn add \
  @emotion/styled@^11.14.0 \
  @emotion/react@^11.14.0 \
  framer-motion@^11.14.0 \
  @tanstack/react-query@^5.64.2 \
  @chakra-ui/react@^2.8.2 \
  @vechain/[email protected] \
  @vechain/[email protected] \
  @vechain/[email protected]

```

# Install vechain kit

```bash
yarn @vechain/[email protected]
```

2) Define Provider

On Next.js you will need to dynamically load the import

Login Methods

The modal implements a dynamic grid layout system that can be customized through the loginMethods configuration.

The modal can be configured through the VeChainKitProvider props.

By default we have a list of default apps that will be shown as ecosystem login options. If you want to customize this list you can pass the allowedApps array prop. You can find the app ids in the Ecosystem tab in the Privy dashboard.

3) Setup Fee Delegation (mandatory if allowing social login)

Fee delegation is mandatory if you want to use this kit with social login. Learn how to setup fee delegation in the following guide:

Fee Delegation

4) Setup Privy (optional)

If you have your own Privy app, you can pass an additional prop with your settings.

Go to privy.io and create an app. You will find the APP ID and the CLIENT ID in the App Settings tab.

For further information on how to implement Privy SDK please refer to their docs: https://docs.privy.io/

This project uses:

You can import privy from the kit as

Pros of self hosting Privy:

  • No UI confirmations on users transactions

  • Allow your users to backup their keys and update security settings directly in your app

  • Targetted social login methods

Cons:

  • Price

  • Responsibilities to correctly secure your Privy account, since it contains access to user's wallet settings

  • Your users will need to login into other apps through ecosystem mode

To prompt users to review and accept your policies, like Terms and Conditions, Privacy Policy, or Cookie Policy, VeChainKit offers a simple plug-and-play solution.

You can avoid building your own if you haven't already.

By enabling also the tracking consent, you will allow VeChainKit to prompt your users to collect data to improve the kit.


When the legalDocuments option is configured, the users will see:

  • Left: A modal prompt when connecting their wallet, requiring them to review and accept required and optional legal documents.

  • Right: A summary view under Settings > General > Terms and Policies, showing which policies they’ve accepted and when.

Legal Docs Modal
Legal Docs Summary View

Important

Legal document agreements are tied to the wallet address, document type, document version, and the url.

  • If the version of any document is updated, users will be prompted to accept it again.

  • Agreements are stored in the browser’s local storage, meaning acceptance is per browser and device.

  • As a result, users may be prompted again if they switch browsers, devices, or clear their local storage even if they've previously agreed on another setup.

Key Options

Option
Type
Required
Description

allowAnalytics

boolean

No

If true, prompts users with an optional tracking policy.

cookiePolicy

array

No

One or more cookie policy versions.

privacyPolicy

array

No

One or more privacy policy versions.

termsAndConditions

array

No

One or more T&C versions.

6) Show the login button

Once you set up the kit provider, you are good to go, and you can allow your users to login, customizing the login experience based on your needs. You can choose between many options, leaving you complete freedom on your design.

You can use this component by importing it from the kit, it will handle for you the connection state and show a login button if the user is disconnected or the profile button when the user is connected.

Read more here on how to customize this button.

Support for devs

Are you having issues using the kit? Join our discord server to receive support from our devs or open an issue on our Github!

Check our Troubleshooting section.

Contact us on Discord: https://discord.gg/wGkQnPpRVq

Open an issue on Github: https://github.com/vechain/vechain-kit/issues

Last updated

Was this helpful?