Skip to content

Commit

Permalink
fix: continue the privy provider
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiorigam committed Nov 21, 2024
1 parent cee39e9 commit f2e74cb
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/dapp-kit-react-privy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"scripts": {
"build": "tsup",
"clean": "rm -rf dist .turbo",
"lint": "eslint"
"lint": "eslint",
"purge": "yarn clean && rm -rf node_modules"
},
"dependencies": {
"@privy-io/react-auth": "1.83.1"
Expand All @@ -29,6 +30,7 @@
"eslint": "^9.12.0",
"react": "^18.2.0",
"tsup": "*",
"typescript": "*"
"typescript": "*",
"vite": "^4.5.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,67 @@
import { ReactNode } from "react";
import { PrivyProvider as BasePrivyProvider } from "@privy-io/react-auth";

export const DAppKitPrivyProvider = ({}) => {
type Props = {
children: ReactNode;
appId: string;
clientId: string;
appearance: {
theme: "dark" | "light";
accentColor: `#${string}`;
loginMessage: string;
logo: string;
};
embeddedWallets: {
createOnLogin: "all-users";
};
loginMethods: (
| "wallet"
| "email"
| "sms"
| "google"
| "twitter"
| "discord"
| "github"
| "linkedin"
| "spotify"
| "instagram"
| "tiktok"
| "apple"
| "farcaster"
| "telegram"
)[];
smartAccountConfig: {
nodeUrl: string;
delegatorUrl: string;
accountFactoryAddress: string;
};
dappKitConfig: {
nodeUrl: string;
genesis: Connex.Thor.Block;
projectId: string;
colorMode: "DARK" | "LIGHT";
walletConnectOptions: {
projectId: string;
metadata: {
name: string;
description: string;
url: string;
icons: string[];
};
};
};
};

export const DAppKitPrivyProvider = ({
children,
appId,
clientId,
loginMethods,
appearance,
embeddedWallets,
}: Props) => {
return (
<BasePrivyProvider
<BasePrivyProvider
appId={appId}
clientId={clientId}
config={{
Expand All @@ -13,9 +72,7 @@ export const DAppKitPrivyProvider = ({}) => {
},
}}
>
<DAppKitProvider>
{children}
</DAppKitProvider>
{children}
</BasePrivyProvider>
);
};
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export * from './DAppKitPrivyProvider';
export * from './hooks';
1 change: 1 addition & 0 deletions packages/dapp-kit-react-privy/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DAppKitPrivyProvider';
33 changes: 33 additions & 0 deletions packages/dapp-kit-react-privy/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/// <reference types="vitest" />
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';

export default defineConfig({
test: {
include: [
'src/**/*.test.ts',
'src/**/*.test.tsx',
'test/**/*.test.ts',
'test/**/*.test.tsx',
],
environment: 'happy-dom',
reporters: 'dot',
setupFiles: [resolve(__dirname, 'test/setup/setup.ts')],
coverage: {
reporter: [
'text',
'json',
'html',
'lcov',
'json-summary',
'text-summary',
'text',
],
statements: 99,
branches: 100,
functions: 100,
lines: 99,
},
globals: true,
},
});

0 comments on commit f2e74cb

Please sign in to comment.