Skip to content

Commit

Permalink
Merge pull request #519 from us3r-network/u3
Browse files Browse the repository at this point in the history
U3
  • Loading branch information
Tonyce authored Feb 2, 2024
2 parents 78df981 + ffdf95c commit 9ae8e18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions apps/u3/src/components/social/Embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ function EmbedCastFrame({
url: Buffer.from(data.url),
buttonIndex: index,
castId,
inputText: Buffer.from(''),
},
{
fid: currFid,
Expand Down
14 changes: 12 additions & 2 deletions apps/u3/src/components/social/farcaster/signupv2/AddAccountKey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ import { optimism } from 'viem/chains';
import { toast } from 'react-toastify';
import { NobleEd25519Signer, ViemWalletEip712Signer } from '@farcaster/hub-web';
import { useConnectModal } from '@rainbow-me/rainbowkit';
import { useAccount, usePublicClient, useWalletClient } from 'wagmi';
import {
useAccount,
useNetwork,
usePublicClient,
useWalletClient,
} from 'wagmi';
import {
waitForTransaction,
writeContract,
prepareWriteContract,
switchNetwork,
} from '@wagmi/core';
import * as ed25519 from '@noble/ed25519';

Expand Down Expand Up @@ -37,6 +43,7 @@ export default function AddAccountKey({
const { address } = useAccount();
const account = useAccount();
const wallet = useWalletClient();
const network = useNetwork();

const publicClient = usePublicClient({
chainId: optimism.id,
Expand All @@ -59,6 +66,9 @@ export default function AddAccountKey({
setSigner(ed25519Signer);
return;
}
if (network.chain?.id !== optimism.id) {
await switchNetwork({ chainId: optimism.id });
}
// const privateKey = ed25519.utils.randomPrivateKey();
// const publicKey = toHex(ed25519.getPublicKey(privateKey));
const privateKey = ed25519.utils.randomPrivateKey();
Expand Down Expand Up @@ -118,7 +128,7 @@ export default function AddAccountKey({
console.error(error);
toast.error(error.message);
}
}, [fid, account, publicClient]);
}, [fid, account, publicClient, network]);

return (
<div
Expand Down

0 comments on commit 9ae8e18

Please sign in to comment.