Update chat client (#125)

* Update chat client

* Update event name

* Change event name
This commit is contained in:
Celine Sarafa 2023-02-28 15:44:33 +03:00 committed by GitHub
parent 4bb9940a09
commit 04b98ac68e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 8 additions and 7 deletions

View File

@ -15,7 +15,7 @@
"@json-rpc-tools/utils": "1.7.6", "@json-rpc-tools/utils": "1.7.6",
"@nextui-org/react": "1.0.8-beta.5", "@nextui-org/react": "1.0.8-beta.5",
"@solana/web3.js": "1.43.0", "@solana/web3.js": "1.43.0",
"@walletconnect/chat-client": "^0.2.2", "@walletconnect/chat-client": "^0.3.2",
"@walletconnect/sign-client": "2.0.0-rc.4", "@walletconnect/sign-client": "2.0.0-rc.4",
"@walletconnect/utils": "2.0.0-rc.4", "@walletconnect/utils": "2.0.0-rc.4",
"@web3modal/core": "^2.0.0-beta.7", "@web3modal/core": "^2.0.0-beta.7",

View File

@ -54,7 +54,7 @@ export default function ChatsPage() {
setChatInvites(chatClient.getReceivedInvites({ account: `eip155:1:${eip155Address}` })) setChatInvites(chatClient.getReceivedInvites({ account: `eip155:1:${eip155Address}` }))
}) })
chatClient.on('chat_joined', async args => { chatClient.on('chat_invite_accepted', async args => {
console.log('chat_joined:', args) console.log('chat_joined:', args)
console.log(chatClient.chatThreads.getAll()) console.log(chatClient.chatThreads.getAll())
setChatThreads(chatClient.chatThreads.getAll()) setChatThreads(chatClient.chatThreads.getAll())

View File

@ -17,7 +17,7 @@ export default function NewChatPage() {
const { eip155Address } = useSnapshot(SettingsStore.state) const { eip155Address } = useSnapshot(SettingsStore.state)
useEffect(() => { useEffect(() => {
chatClient.once('chat_joined', args => { chatClient.once('chat_invite_accepted', args => {
const newChatTarget = new URLSearchParams(document.location.search).get('target') const newChatTarget = new URLSearchParams(document.location.search).get('target')
router.push(`/chat?topic=${args.topic}&peerAccount=${newChatTarget}`) router.push(`/chat?topic=${args.topic}&peerAccount=${newChatTarget}`)
}) })

View File

@ -21,6 +21,7 @@ export async function createSignClient() {
export async function createChatClient() { export async function createChatClient() {
chatClient = await ChatClient.init({ chatClient = await ChatClient.init({
logger: 'debug', logger: 'debug',
keyseverUrl: 'https://keys.walletconnect.com',
projectId: process.env.NEXT_PUBLIC_PROJECT_ID, projectId: process.env.NEXT_PUBLIC_PROJECT_ID,
relayUrl: process.env.NEXT_PUBLIC_RELAY_URL ?? 'wss://relay.walletconnect.com' relayUrl: process.env.NEXT_PUBLIC_RELAY_URL ?? 'wss://relay.walletconnect.com'
}) })

View File

@ -2129,10 +2129,10 @@
"@typescript-eslint/types" "5.51.0" "@typescript-eslint/types" "5.51.0"
eslint-visitor-keys "^3.3.0" eslint-visitor-keys "^3.3.0"
"@walletconnect/chat-client@^0.2.2": "@walletconnect/chat-client@^0.3.2":
version "0.2.2" version "0.3.2"
resolved "https://registry.yarnpkg.com/@walletconnect/chat-client/-/chat-client-0.2.2.tgz#0a7807f1d606ec740eef5aad7646e4a65a57f74d" resolved "https://registry.yarnpkg.com/@walletconnect/chat-client/-/chat-client-0.3.2.tgz#6fc4ceb7ef1207ed821d1a0ea1451f7affa96965"
integrity sha512-L1s1fCotRrbJBpJQ5Ky63D+JzH9d0DxQtgJVTs/b7bxI6q9akWfGUIeLQJLgu0dZiBFizK+ilMf4Sn8S93W35g== integrity sha512-xs84upGbLtMn9Ev4z+S8e2o5bYr070gCDwK84K5AgBM8BKhAexz956aVRUq90sKBMuKl0cCCp5lzm13eGIFKJA==
dependencies: dependencies:
"@noble/ed25519" "^1.7.1" "@noble/ed25519" "^1.7.1"
"@walletconnect/core" "^2.3.3" "@walletconnect/core" "^2.3.3"