Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/privy kit #332

Merged
merged 14 commits into from
Dec 24, 2024
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
Loading