Skip to content

Commit

Permalink
Remove useWalletClient stuff. Just use the client
Browse files Browse the repository at this point in the history
  • Loading branch information
neekolas committed Feb 15, 2024
1 parent 5d01a10 commit 40f0dd4
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions src/controllers/FullMessageController.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import type { CachedConversation, CachedMessageWithId } from "@xmtp/react-sdk";
import { Client, useClient } from "@xmtp/react-sdk";
import { useClient } from "@xmtp/react-sdk";
import { FramesClient } from "@xmtp/frames-client";
import { useEffect, useState } from "react";
import type { PrivateKeyAccount, Transport, WalletClient } from "viem";
import type { mainnet } from "wagmi";
import { useWalletClient } from "wagmi";

Check failure on line 5 in src/controllers/FullMessageController.tsx

View workflow job for this annotation

GitHub Actions / eslint

'useWalletClient' is defined but never used
import { FullMessage } from "../component-library/components/FullMessage/FullMessage";
import { classNames, shortAddress } from "../helpers";
Expand Down Expand Up @@ -33,7 +31,6 @@ export const FullMessageController = ({
isReply,
}: FullMessageControllerProps) => {
const { client } = useClient();
const { data: walletClient } = useWalletClient();

const conversationTopic = useXmtpStore((state) => state.conversationTopic);

Expand All @@ -44,31 +41,21 @@ export const FullMessageController = ({
buttonIndex: number,
action: FrameButton["action"],
) => {
if (!frameInfo) {
if (!frameInfo || !client) {
return;
}
const frameUrl = frameInfo.image;
const button = frameInfo.buttons[buttonIndex];

setFrameButtonUpdating(buttonIndex);

const xmtpClient = await Client.create(
walletClient as WalletClient<
Transport,
typeof mainnet,
PrivateKeyAccount
>,
);
const framesClient = new FramesClient(xmtpClient);
const framesClient = new FramesClient(client);

const payload = await framesClient.signFrameAction({
frameUrl,
buttonIndex,
conversationTopic: conversationTopic as string,
participantAccountAddresses: [
client?.address as string,
conversation.peerAddress,
],
participantAccountAddresses: [client.address, conversation.peerAddress],
});
if (action === "post") {
const updatedFrameMetadata = await framesClient.proxy.post(
Expand Down

0 comments on commit 40f0dd4

Please sign in to comment.