Skip to content

Commit

Permalink
Update client hook
Browse files Browse the repository at this point in the history
  • Loading branch information
rygine committed Sep 26, 2024
1 parent 4bce358 commit df6b824
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions example2/src/hooks/useCreateClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ import {
ReplyCodec,
RemoteAttachmentCodec,
StaticAttachmentCodec,
Signer,
} from '@xmtp/react-native-sdk'
import { WalletClient } from 'viem'

interface Signer {
getAddress: () => Promise<string>
getChainId: () => bigint
getBlockNumber: () => bigint
isSmartContractWallet: () => boolean
signMessage: (message: string) => Promise<string>
}

const supportedCodecs = [
new ReactionCodec(),
new ReplyCodec(),
Expand All @@ -40,8 +33,8 @@ export const useCreateClient = (walletClient: WalletClient | undefined) => {

const signer: Signer = {
getAddress: () => Promise.resolve(walletClient.account?.address ?? ''),
getChainId: () => BigInt(walletClient.chain?.id ?? 0),
getBlockNumber: () => 0n,
getChainId: () => walletClient.chain?.id ?? 0,
getBlockNumber: () => undefined,
isSmartContractWallet: () => true,
signMessage: (message: string) =>
walletClient.signMessage({ message, account }),
Expand Down

0 comments on commit df6b824

Please sign in to comment.