Skip to content

GeorgeFane/ETHchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

XMTP Chat with CyberConnect Filtering v2

Deployed Site

Demo Video

Original Demo Video on Zoom

Comments on the video

The CodeSandbox in the demo video showing "Followers" and "Followings" was created by CyberConnect and embedded at this link: https://docs.cyberconnect.me/get-started/read-connections/#sandbox

Changes from original XMTP

To detemine which contacts fit into which filter category, I referenced the GraphQL code here: https://docs.cyberconnect.me/cyberconnect-api/graphql-api/connections/#fetch-followstatus-example

The "Follow" button is defined at https://github.com/georgefane/ETHchat/blob/main/components/CyberConnect/FollowButton.tsx, and is based on the code here: https://docs.cyberconnect.me/get-started/create-a-connection/#sandbox

The dropdown to select a filter is defined in this file https://github.com/georgefane/ETHchat/blob/v2/components/CyberConnect/MyListbox.tsx and is based on the top example here: https://headlessui.dev/react/listbox

How to Deploy

Fork this repo and import into Vercel (tutorial).

ORIGINAL README BELOW

React Chat Example

Test Lint Build

x-red-sm

This example chat application demonstrates the core concepts and capabilities of the XMTP Client SDK. It is built with React, Next.js, and the xmtp-js client library. The application is capable of sending and receiving messages via the XMTP Labs development network, with no performance guarantees and notable limitations to its functionality.

It is maintained by XMTP Labs and distributed under MIT License for learning about and developing applications that utilize the XMTP decentralized communication protocol.

All wallets and messages are forcibly deleted from the development network on Mondays.

Disclaimer

The XMTP protocol is in the early stages of development. This software is being provided for evaluation, feedback, and community contribution. It has not undergone a formal security audit and is not intended for production applications. Significant breaking revisions should be expected.

Getting Started

Configure Infura

Add your Infura ID to .env.local in the project's root.

NEXT_PUBLIC_INFURA_ID={YOUR_INFURA_ID}

If you do not have an Infura ID, you can follow these instructions to get one.

This example comes preconfigured with an Infura ID provided for demonstration purposes. If you plan to fork or host it, you must use your own Infura ID as detailed above.

Install the package

npm install

Run the development server

npm run dev

Open https://localhost:3000 with your browser to see the application.

Functionality

Wallet Connections

Web3Modal is used to inject a Metamask, Coinbase Wallet, or WalletConnect provider through ethers. Methods for connecting and disconnecting are included in WalletContext alongside the provider, signer, wallet address, and ENS utilities.

In order to use the application's chat functionality, the connected wallet must provide two signatures:

  1. A one-time signature that is used to generate the wallet's private XMTP identity
  2. A signature that is used on application start-up to initialize the XMTP client with that identity

Chat Conversations

The application utilizes the xmtp-js Conversations abstraction to list the available conversations for a connected wallet and to listen for or create new conversations. For each convesation, it gets existing messages and listens for or creates new messages. Conversations and messages are kept in a lightweight store and made available through XmtpContext alongside the client and its methods.

Limitations

The application's functionality is limited by current work-in-progress on the xmtp-js client.

Messages cannot yet be directed to wallets that have not used XMTP

The client will throw an error when attempting to lookup an address that does not have an identity broadcast on the XMTP network.

This limitation will be mitigated very soon by the example application's UI, and resolved soon via improvements to the xmtp-js library that will allow messages to be created even if the intended recipient has not yet generated its keys.

About

XMTP chat app with filtering by CyberConnect connections

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •