Skip to content

Commit

Permalink
Feat/privy kit (#332)
Browse files Browse the repository at this point in the history
* feat: allow more wallets login + some ui fixes

* WIP on feat/add-react-query

* feat: login with vechain

* style: account selector

* fix: modal overflow

* style: connect modal

* chore: moved files to folders

* feat: login with email

* feat: handle login with passkey

* fix: transaction toast

* fix: merge conflicts

* fix: yarn lock

* fix: missing import
  • Loading branch information
Agilulfo1820 authored Dec 24, 2024
1 parent 1b1390b commit 5d27743
Show file tree
Hide file tree
Showing 97 changed files with 2,576 additions and 1,780 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function SocialLoginWrapper({ children }: Props) {
clientId: process.env.NEXT_PUBLIC_PRIVY_CLIENT_ID!,
loginMethods: ['google', 'twitter', 'github', 'sms', 'email'],
appearance: {
walletList: ['metamask', 'rainbow'],
theme: colorMode,
accentColor: '#696FFD',
loginMessage: 'Select a social media profile',
Expand All @@ -33,10 +34,9 @@ export function SocialLoginWrapper({ children }: Props) {
createOnLogin: 'all-users',
},
ecosystemAppsID: [
'cm4wxxujb022fyujl7g0thb21', //vechain
'clz41gcg00e4ay75dmq3uzzgr', //cleanify
'clxdoatq601h35inz6qykgmai',
'clpgf04wn04hnkw0fv1m11mnb',
'clrtmg1n104ypl60p9w5c3v4c',
],
allowPasskeyLinking: true,
}}
Expand Down
24 changes: 15 additions & 9 deletions examples/sample-next-privy-app/src/app/pages/homepage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const HomePage = (): ReactElement => {
const { toggleColorMode: toggleDAppKitPrivyColorMode } =
useDAppKitPrivyColorMode();

const { connection, smartAccount, connectedWallet } = useWallet();
const { connection, selectedAccount, connectedWallet, smartAccount } =
useWallet();

// A dummy tx sending 0 b3tr tokens
const clauses = useMemo(() => {
Expand All @@ -45,7 +46,7 @@ const HomePage = (): ReactElement => {
connectedWallet.address,
'0', // 1 B3TR (in wei)
]),
comment: `Transfer ${1} B3TR to `,
comment: `Transfer ${0} B3TR to `,
abi: abi.getFunction('transfer'),
});
return clausesArray;
Expand All @@ -59,11 +60,11 @@ const HomePage = (): ReactElement => {
isTransactionPending,
error,
} = useSendTransaction({
signerAccount: smartAccount,
signerAccountAddress: selectedAccount?.address,
privyUIOptions: {
title: 'Sign to confirm',
description:
'This is a test transaction performing a transfer of 1 B3TR tokens from your smart account.',
'This is a test transaction performing a transfer of 0 B3TR tokens from your smart account.',
buttonText: 'Sign',
},
});
Expand Down Expand Up @@ -131,7 +132,6 @@ const HomePage = (): ReactElement => {
<Text>
Deployed: {smartAccount.isDeployed.toString()}
</Text>
<Text>Owner: {smartAccount.owner}</Text>
</Box>
)}

Expand All @@ -140,12 +140,18 @@ const HomePage = (): ReactElement => {
<b>Wallet</b>
</Heading>
<Text>Address: {connectedWallet?.address}</Text>
<Text>Connection Type: {connection.source.type}</Text>
</Box>

<Box>
<Heading size={'md'}>
<b>Connection</b>
</Heading>
<Text>Type: {connection.source.type}</Text>
</Box>

<Box mt={4}>
<Heading size={'md'}>
<b>Actions</b>
<b>Test actions</b>
</Heading>
<HStack mt={4} spacing={4}>
<HStack mt={4} spacing={4}>
Expand All @@ -154,14 +160,14 @@ const HomePage = (): ReactElement => {
isLoading={isTransactionPending}
isDisabled={isTransactionPending}
>
Test Tx with toast
Tx with toast
</Button>
<Button
onClick={handleTransactionWithModal}
isLoading={isTransactionPending}
isDisabled={isTransactionPending}
>
Test Tx with modal
Tx with modal
</Button>
</HStack>
</HStack>
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-kit-react-privy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"dependencies": {
"@chakra-ui/react": "^2.8.2",
"@choc-ui/chakra-autocomplete": "^5.3.0",
"@privy-io/react-auth": "1.98.2",
"@privy-io/react-auth": "1.98.4",
"@vechain/dapp-kit-react": "*",
"@vechain/picasso": "^2.1.1",
"@vechain/sdk-core": "^1.0.0-rc.5",
Expand Down
Loading

0 comments on commit 5d27743

Please sign in to comment.