Skip to content

Commit

Permalink
fix: add readme files and a small explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorigam committed Nov 28, 2024
1 parent 4145d48 commit 6e5cfc4
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
48 changes: 48 additions & 0 deletions examples/sample-privy-next-app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# `sample-privy-next-app`

This example demonstrates how to integrate the `@vechain/dapp-kit-react-privy` package into a Next.js application. It showcases how to leverage the library for seamless social login and VeChain ecosystem integration, providing a foundation for building robust and user-friendly decentralized applications (dApps).

## How it works

### Step 1: Dynamically Import the SocialLoginWrapper

To ensure compatibility with server-side rendering, dynamically import the SocialLoginWrapper component in layout.tsx:

```typescript
const SocialLoginWrapper = dynamic(async () => (await import('./components/SocialLoginWrapper')).SocialLoginWrapper, {
ssr: false
});

export default function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
return (
<html lang="en">
<head>
<title>Privy Next JS</title>
</head>
<body>
<SocialLoginWrapper>
{children}
</SocialLoginWrapper>
</body>
</html>
);
}
```

### Step 2: Use Hooks and Components

Import the necessary hooks and components from @vechain/dapp-kit-react-privy and use them to interact with the VeChain ecosystem in your application:

```typescript
import {
useVOT3Balance,
useB3TRBalance,
} from "@vechain/dapp-kit-react-privy";

const b3trBalanceQuery = isConnected ? useB3TRBalance({ address: connectedAddress ?? '' }) : useB3TRBalance({ address: abstractedAccount.embeddedWallet?.address ?? '' });
const vot3BalanceQuery = isConnected ? useVOT3Balance({ address: connectedAddress ?? '' }) : useVOT3Balance({ address: abstractedAccount.embeddedWallet?.address ?? '' });
```
9 changes: 9 additions & 0 deletions packages/dapp-kit-react-privy/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# `@vechain/dapp-kit-react-privy`

The `@vechain/dapp-kit-react-privy` package simplifies the development of decentralized applications (dApps) on VeChainThor and VeBetterDAO. It provides seamless integration with social login functionality powered by Privy, making it easier for developers to enhance user onboarding and authentication experiences.

## Installation

```bash
yarn add @vechain/dapp-kit-react-privy
```

0 comments on commit 6e5cfc4

Please sign in to comment.